@banou/media-player 0.10.40 → 0.10.42

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.
Files changed (74) hide show
  1. package/README.md +13 -0
  2. package/dist/{ar-CS4Yzfxw.js → ar-CWVutin3.js} +1 -0
  3. package/dist/{cs-CxBZ1aTx.js → cs-CmwRGxyE.js} +1 -0
  4. package/dist/{de-DphEdq0O.js → de-DLdKEf3t.js} +1 -0
  5. package/dist/{el-BVTNfAWK.js → el-Ckj-z6DX.js} +1 -0
  6. package/dist/engine/index.js +1 -1
  7. package/dist/{engine-DFqSQyNb.js → engine-wP5Udzzj.js} +1 -0
  8. package/dist/{es-419-D6gsvnn8.js → es-419-zORhhU8D.js} +1 -0
  9. package/dist/{fr-BqAzAJX0.js → fr-BtPmNkri.js} +1 -0
  10. package/dist/{he-DbFw1CdO.js → he-Bu79qEth.js} +1 -0
  11. package/dist/{hi-rBroV7g8.js → hi-BsH3tSHa.js} +1 -0
  12. package/dist/{hu-m-QKaaxF.js → hu-BkYBW-YP.js} +1 -0
  13. package/dist/{id-BYpApdK9.js → id-nUaBCV4o.js} +1 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +475 -435
  16. package/dist/{it-NTcUh3Gr.js → it-CqPSHyFA.js} +1 -0
  17. package/dist/{ja-DSmX_bxj.js → ja-DTjvriHw.js} +1 -0
  18. package/dist/{ko-DyPzWasj.js → ko-dV8T7XOJ.js} +1 -0
  19. package/dist/labels.d.ts +1 -0
  20. package/dist/{ms-8pQbqM0D.js → ms-VZQ7BI0z.js} +1 -0
  21. package/dist/{nl-q7xvc3xW.js → nl-Q6iDxbDz.js} +1 -0
  22. package/dist/{pl-C6Ow4ra5.js → pl-BN7bK74l.js} +1 -0
  23. package/dist/{pt-BR-wudK3giz.js → pt-BR-CPFILeFW.js} +1 -0
  24. package/dist/react/player.d.ts +1 -0
  25. package/dist/react/source-feature.d.ts +9 -0
  26. package/dist/react/video-player.d.ts +9 -0
  27. package/dist/remote/index.d.ts +18 -0
  28. package/dist/remote/index.js +51 -34
  29. package/dist/remote/protocol.d.ts +11 -6
  30. package/dist/{ro-DBrd08Df.js → ro-Bwcm-i3k.js} +1 -0
  31. package/dist/{ru-D5kxBkik.js → ru-D1FMz751.js} +1 -0
  32. package/dist/{sv-DJC3tXfW.js → sv-ci9K0Lkk.js} +1 -0
  33. package/dist/{th-BNzU_FYo.js → th-DR-UBONQ.js} +1 -0
  34. package/dist/{tr-CW7R7N9k.js → tr-BqhdfT22.js} +1 -0
  35. package/dist/{uk-C66esN2W.js → uk-8pkZqdni.js} +1 -0
  36. package/dist/{vi-oOaDECwu.js → vi-3mKZ9G_M.js} +1 -0
  37. package/dist/{zh-Hans-IhL1Pl78.js → zh-Hans-CDgigWKY.js} +1 -0
  38. package/dist/{zh-Hant-C5YyFjEc.js → zh-Hant-3WSNI0ne.js} +1 -0
  39. package/package.json +1 -1
  40. package/src/lib/audio/volume-normalizer.ts +15 -1
  41. package/src/lib/index.tsx +2 -1
  42. package/src/lib/labels.ts +1 -0
  43. package/src/lib/locales/ar.json +1 -0
  44. package/src/lib/locales/cs.json +1 -0
  45. package/src/lib/locales/de.json +1 -0
  46. package/src/lib/locales/el.json +1 -0
  47. package/src/lib/locales/es-419.json +1 -0
  48. package/src/lib/locales/fr.json +1 -0
  49. package/src/lib/locales/he.json +1 -0
  50. package/src/lib/locales/hi.json +1 -0
  51. package/src/lib/locales/hu.json +1 -0
  52. package/src/lib/locales/id.json +1 -0
  53. package/src/lib/locales/it.json +1 -0
  54. package/src/lib/locales/ja.json +1 -0
  55. package/src/lib/locales/ko.json +1 -0
  56. package/src/lib/locales/ms.json +1 -0
  57. package/src/lib/locales/nl.json +1 -0
  58. package/src/lib/locales/pl.json +1 -0
  59. package/src/lib/locales/pt-BR.json +1 -0
  60. package/src/lib/locales/ro.json +1 -0
  61. package/src/lib/locales/ru.json +1 -0
  62. package/src/lib/locales/sv.json +1 -0
  63. package/src/lib/locales/th.json +1 -0
  64. package/src/lib/locales/tr.json +1 -0
  65. package/src/lib/locales/uk.json +1 -0
  66. package/src/lib/locales/vi.json +1 -0
  67. package/src/lib/locales/zh-Hans.json +1 -0
  68. package/src/lib/locales/zh-Hant.json +1 -0
  69. package/src/lib/react/components/settings.tsx +19 -0
  70. package/src/lib/react/hooks/use-thumbnails.ts +22 -1
  71. package/src/lib/react/source-feature.ts +10 -0
  72. package/src/lib/react/video-player.tsx +40 -1
  73. package/src/lib/remote/index.ts +48 -3
  74. package/src/lib/remote/protocol.ts +18 -6
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as e, l as t, m as n, n as r, o as i, p as a, r as o, s, t as c, u as l } from "./engine-DFqSQyNb.js";
1
+ import { c as e, l as t, m as n, n as r, o as i, p as a, r as o, s, t as c, u as l } from "./engine-wP5Udzzj.js";
2
2
  import { languageOf as u, playsIn as d, startingTracks as f } from "./language/index.js";
3
3
  import { n as p, r as m, t as h } from "./chapters-EBYXcEml.js";
4
4
  import { Children as g, Fragment as _, createContext as v, isValidElement as y, useCallback as b, useContext as x, useEffect as S, useMemo as C, useRef as w, useState as T, useSyncExternalStore as E } from "react";
@@ -8,10 +8,10 @@ import { definePlayerFeature as M, videoFeatures as N } from "@videojs/core/dom"
8
8
  import { makeRemuxer as P } from "libav-wasm";
9
9
  import { Fragment as F, jsx as I, jsxs as L } from "@emotion/react/jsx-runtime";
10
10
  import { createMediaElementSource as R } from "@banou/ponyfill/web-audio";
11
- import { Captions as z, CaptionsOff as B, Check as V, ChevronLeft as H, ChevronRight as ee, Copy as U, Maximize as W, Minimize as G, Pause as te, Play as K, RotateCcw as q, Settings as ne, TriangleAlert as re, Volume1 as J, Volume2 as Y, VolumeX as ie } from "lucide-react";
12
- import { Tooltip as ae } from "react-tooltip";
11
+ import { Captions as z, CaptionsOff as B, Check as V, ChevronLeft as H, ChevronRight as ee, Copy as U, Maximize as te, Minimize as ne, Pause as re, Play as W, RotateCcw as G, Settings as K, TriangleAlert as ie, Volume1 as q, Volume2 as J, VolumeX as ae } from "lucide-react";
12
+ import { Tooltip as oe } from "react-tooltip";
13
13
  //#region src/lib/react/source-feature.ts
14
- var oe = {
14
+ var se = {
15
15
  indexes: [],
16
16
  chapters: [],
17
17
  thumbnails: [],
@@ -32,13 +32,14 @@ var oe = {
32
32
  pictureInPictureMode: null,
33
33
  burnedInSubtitles: !1,
34
34
  volumeNormalizer: null,
35
+ autoplayNext: null,
35
36
  playbackError: null,
36
37
  playbackErrors: [],
37
38
  ready: !1,
38
39
  setSourceState: () => {}
39
- }, se = M({
40
+ }, Y = M({
40
41
  name: "source",
41
- state: () => ({ ...oe }),
42
+ state: () => ({ ...se }),
42
43
  attach({ set: e }) {
43
44
  e({
44
45
  setSourceState: (t) => e(t),
@@ -46,35 +47,35 @@ var oe = {
46
47
  });
47
48
  }
48
49
  }), ce = k({
49
- features: [...N, se],
50
+ features: [...N, Y],
50
51
  displayName: "MediaPlayer"
51
52
  }), X = ce.usePlayer, le = {
52
- ar: () => import("./ar-CS4Yzfxw.js"),
53
- cs: () => import("./cs-CxBZ1aTx.js"),
54
- de: () => import("./de-DphEdq0O.js"),
55
- el: () => import("./el-BVTNfAWK.js"),
56
- "es-419": () => import("./es-419-D6gsvnn8.js"),
57
- fr: () => import("./fr-BqAzAJX0.js"),
58
- he: () => import("./he-DbFw1CdO.js"),
59
- hi: () => import("./hi-rBroV7g8.js"),
60
- hu: () => import("./hu-m-QKaaxF.js"),
61
- id: () => import("./id-BYpApdK9.js"),
62
- it: () => import("./it-NTcUh3Gr.js"),
63
- ja: () => import("./ja-DSmX_bxj.js"),
64
- ko: () => import("./ko-DyPzWasj.js"),
65
- ms: () => import("./ms-8pQbqM0D.js"),
66
- nl: () => import("./nl-q7xvc3xW.js"),
67
- pl: () => import("./pl-C6Ow4ra5.js"),
68
- "pt-BR": () => import("./pt-BR-wudK3giz.js"),
69
- ro: () => import("./ro-DBrd08Df.js"),
70
- ru: () => import("./ru-D5kxBkik.js"),
71
- sv: () => import("./sv-DJC3tXfW.js"),
72
- th: () => import("./th-BNzU_FYo.js"),
73
- tr: () => import("./tr-CW7R7N9k.js"),
74
- uk: () => import("./uk-C66esN2W.js"),
75
- vi: () => import("./vi-oOaDECwu.js"),
76
- "zh-Hans": () => import("./zh-Hans-IhL1Pl78.js"),
77
- "zh-Hant": () => import("./zh-Hant-C5YyFjEc.js")
53
+ ar: () => import("./ar-CWVutin3.js"),
54
+ cs: () => import("./cs-CmwRGxyE.js"),
55
+ de: () => import("./de-DLdKEf3t.js"),
56
+ el: () => import("./el-Ckj-z6DX.js"),
57
+ "es-419": () => import("./es-419-zORhhU8D.js"),
58
+ fr: () => import("./fr-BtPmNkri.js"),
59
+ he: () => import("./he-Bu79qEth.js"),
60
+ hi: () => import("./hi-BsH3tSHa.js"),
61
+ hu: () => import("./hu-BkYBW-YP.js"),
62
+ id: () => import("./id-nUaBCV4o.js"),
63
+ it: () => import("./it-CqPSHyFA.js"),
64
+ ja: () => import("./ja-DTjvriHw.js"),
65
+ ko: () => import("./ko-dV8T7XOJ.js"),
66
+ ms: () => import("./ms-VZQ7BI0z.js"),
67
+ nl: () => import("./nl-Q6iDxbDz.js"),
68
+ pl: () => import("./pl-BN7bK74l.js"),
69
+ "pt-BR": () => import("./pt-BR-CPFILeFW.js"),
70
+ ro: () => import("./ro-Bwcm-i3k.js"),
71
+ ru: () => import("./ru-D1FMz751.js"),
72
+ sv: () => import("./sv-ci9K0Lkk.js"),
73
+ th: () => import("./th-DR-UBONQ.js"),
74
+ tr: () => import("./tr-BqhdfT22.js"),
75
+ uk: () => import("./uk-8pkZqdni.js"),
76
+ vi: () => import("./vi-3mKZ9G_M.js"),
77
+ "zh-Hans": () => import("./zh-Hans-CDgigWKY.js"),
78
+ "zh-Hant": () => import("./zh-Hant-3WSNI0ne.js")
78
79
  }, ue = Object.keys(le), de = (e) => {
79
80
  try {
80
81
  let t = new Intl.Locale(e), { language: n, script: r } = t.maximize();
@@ -86,7 +87,7 @@ var oe = {
86
87
  } catch {
87
88
  return;
88
89
  }
89
- }, Z = (e) => {
90
+ }, fe = (e) => {
90
91
  let t = de(e);
91
92
  if (!t) return;
92
93
  let n = ue.map((e) => ({
@@ -94,24 +95,24 @@ var oe = {
94
95
  catalogue: e
95
96
  }));
96
97
  return (n.find(({ tag: e }) => e === t.tag) ?? n.find(({ language: e, script: n }) => e === t.language && n === t.script) ?? n.find(({ language: e }) => e === t.language))?.catalogue;
97
- }, fe = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Map(), me = (e, t) => {
98
- let n = pe.get(e);
98
+ }, pe = /* @__PURE__ */ new Map(), me = /* @__PURE__ */ new Map(), he = (e, t) => {
99
+ let n = me.get(e);
99
100
  return n || (n = Promise.all([import("@formatjs/intl"), le[t]()]).then(([{ createIntl: t }, { default: n }]) => {
100
101
  let r = t({
101
102
  locale: e,
102
103
  defaultLocale: "en",
103
104
  messages: n
104
105
  });
105
- return fe.set(e, r), r;
106
- }), n.catch(() => pe.delete(e)), pe.set(e, n)), n;
107
- }, he = (e) => {
106
+ return pe.set(e, r), r;
107
+ }), n.catch(() => me.delete(e)), me.set(e, n)), n;
108
+ }, ge = (e) => {
108
109
  try {
109
110
  return Intl.getCanonicalLocales(e)[0];
110
111
  } catch {
111
112
  return;
112
113
  }
113
- }, ge = (e, t) => {
114
- let r = t ? he(t) ?? "en" : void 0;
114
+ }, _e = (e, t) => {
115
+ let r = t ? ge(t) ?? "en" : void 0;
115
116
  return {
116
117
  format: (t, ...[r]) => e ? e.formatMessage({
117
118
  id: t,
@@ -120,18 +121,18 @@ var oe = {
120
121
  number: (e, t) => new Intl.NumberFormat(r ?? "en", t).format(e),
121
122
  locale: r
122
123
  };
123
- }, _e = ge(void 0, void 0), ve = v(_e), Q = () => x(ve), ye = ({ language: e, children: t }) => {
124
- let n = e ? Z(e) : void 0, [, r] = T();
124
+ }, Z = _e(void 0, void 0), ve = v(Z), Q = () => x(ve), ye = ({ language: e, children: t }) => {
125
+ let n = e ? fe(e) : void 0, [, r] = T();
125
126
  S(() => {
126
- if (!e || !n || fe.has(e)) return;
127
+ if (!e || !n || pe.has(e)) return;
127
128
  let t = !1;
128
- return me(e, n).then((e) => {
129
+ return he(e, n).then((e) => {
129
130
  t || r(e);
130
131
  }, () => {}), () => {
131
132
  t = !0;
132
133
  };
133
134
  }, [e, n]);
134
- let i = e && n ? fe.get(e) : void 0, a = C(() => e ? ge(i, e) : _e, [i, e]);
135
+ let i = e && n ? pe.get(e) : void 0, a = C(() => e ? _e(i, e) : Z, [i, e]);
135
136
  return /* @__PURE__ */ I(ve.Provider, {
136
137
  value: a,
137
138
  children: t
@@ -201,31 +202,31 @@ var oe = {
201
202
  original: n?.originalLanguage,
202
203
  subtitles: n?.preferredSubtitleLanguage,
203
204
  alwaysSubtitles: n?.alwaysShowSubtitles
204
- }, W = w(U);
205
- W.current = U;
206
- let G = w(n?.onPreferredAudioLanguageChange);
207
- G.current = n?.onPreferredAudioLanguageChange;
208
- let te = w(n?.onPreferredSubtitleLanguageChange);
209
- te.current = n?.onPreferredSubtitleLanguageChange;
210
- let K = w(n?.onAlwaysShowSubtitlesChange);
211
- K.current = n?.onAlwaysShowSubtitlesChange;
212
- let q = w(n?.onSeek);
213
- q.current = n?.onSeek;
214
- let ne = w(n?.onPlaybackError);
215
- ne.current = n?.onPlaybackError;
216
- let re = w(r);
217
- re.current = r;
218
- let J = Q(), Y = w(J);
219
- Y.current = J, S(() => {
205
+ }, te = w(U);
206
+ te.current = U;
207
+ let ne = w(n?.onPreferredAudioLanguageChange);
208
+ ne.current = n?.onPreferredAudioLanguageChange;
209
+ let re = w(n?.onPreferredSubtitleLanguageChange);
210
+ re.current = n?.onPreferredSubtitleLanguageChange;
211
+ let W = w(n?.onAlwaysShowSubtitlesChange);
212
+ W.current = n?.onAlwaysShowSubtitlesChange;
213
+ let G = w(n?.onSeek);
214
+ G.current = n?.onSeek;
215
+ let K = w(n?.onPlaybackError);
216
+ K.current = n?.onPlaybackError;
217
+ let ie = w(r);
218
+ ie.current = r;
219
+ let q = Q(), J = w(q);
220
+ J.current = q, S(() => {
220
221
  let { audio: e, subtitles: t } = V.current;
221
- t.length && a.setSourceState({ subtitleTracks: Ce(t, J) }), e.length && a.setSourceState({ audioTracks: Ce(e, J) });
222
- }, [a, J]);
223
- let ie = b((e) => {
222
+ t.length && a.setSourceState({ subtitleTracks: Ce(t, q) }), e.length && a.setSourceState({ audioTracks: Ce(e, q) });
223
+ }, [a, q]);
224
+ let ae = b((e) => {
224
225
  let t = typeof e == "number" ? e : void 0, n = a.selectedSubtitleTrack === void 0;
225
226
  z.current = B.current, a.setSourceState({ selectedSubtitleTrack: t }), L.current?.selectSubtitleStream(t);
226
227
  let r = V.current.subtitles.find((e) => e.streamIndex === t), i = t === void 0 ? null : u(r) ?? (n ? r?.title?.trim() || "und" : void 0);
227
- i !== void 0 && te.current?.(i), i && d(H(), i) && K.current?.(!0);
228
- }, [a, H]), ae = b((e) => {
228
+ i !== void 0 && re.current?.(i), i && d(H(), i) && W.current?.(!0);
229
+ }, [a, H]), oe = b((e) => {
229
230
  let t = L.current;
230
231
  if (!t || O <= 0) {
231
232
  a.seek(e);
@@ -249,26 +250,26 @@ var oe = {
249
250
  t.prepareSeek(e).catch(() => {}).finally(() => {
250
251
  clearTimeout(d), s();
251
252
  });
252
- }, [a, O]), oe = b((e) => {
253
+ }, [a, O]), se = b((e) => {
253
254
  if (typeof e != "number" || B.current === void 0) return;
254
255
  a.setSourceState({ selectedAudioTrack: e }), j({
255
256
  size: B.current,
256
257
  streamIndex: e
257
258
  });
258
259
  let t = u(V.current.audio.find((t) => t.streamIndex === e));
259
- t !== void 0 && G.current?.(t);
260
- }, [a]), se = X((e) => e.setSourceState);
260
+ t !== void 0 && ne.current?.(t);
261
+ }, [a]), Y = X((e) => e.setSourceState);
261
262
  S(() => {
262
- se({
263
- selectSubtitleTrack: ie,
264
- selectAudioTrack: oe,
265
- requestSeek: ae
263
+ Y({
264
+ selectSubtitleTrack: ae,
265
+ selectAudioTrack: se,
266
+ requestSeek: oe
266
267
  });
267
268
  }, [
269
+ Y,
270
+ ae,
268
271
  se,
269
- ie,
270
- oe,
271
- ae
272
+ oe
272
273
  ]), S(() => {
273
274
  if (!e || !t || !c || !o) return;
274
275
  let n = !1;
@@ -313,7 +314,7 @@ var oe = {
313
314
  }, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), I.current && clearTimeout(I.current), I.current = setTimeout(() => P((e) => e + 1), n);
314
315
  return;
315
316
  }
316
- console.error("playback failed", e), a.setSourceState({ playbackError: e }), ne.current?.(e);
317
+ console.error("playback failed", e), a.setSourceState({ playbackError: e }), K.current?.(e);
317
318
  };
318
319
  return (async () => {
319
320
  try {
@@ -333,7 +334,7 @@ var oe = {
333
334
  cjkFontUrl: x,
334
335
  bufferSize: C,
335
336
  audioStreamIndex: M,
336
- chooseAudioStream: (e) => e[f(e, [], W.current).audio]?.streamIndex,
337
+ chooseAudioStream: (e) => e[f(e, [], te.current).audio]?.streamIndex,
337
338
  onReady: () => {
338
339
  if (n) return;
339
340
  a.setSourceState({ ready: !0 });
@@ -344,20 +345,20 @@ var oe = {
344
345
  onRecovered: () => {
345
346
  n || a.setSourceState({ playbackError: null });
346
347
  },
347
- onSeek: (e) => q.current?.(e),
348
- onOutput: (e) => re.current?.(e),
348
+ onSeek: (e) => G.current?.(e),
349
+ onOutput: (e) => ie.current?.(e),
349
350
  onSubtitleStreams: (e) => {
350
351
  if (n) return;
351
352
  V.current.subtitles = e;
352
- let t = H(), r = f(t ? [t] : [], e, W.current).subtitles;
353
+ let t = H(), r = f(t ? [t] : [], e, te.current).subtitles;
353
354
  a.setSourceState({
354
- subtitleTracks: Ce(e, Y.current),
355
+ subtitleTracks: Ce(e, J.current),
355
356
  ...z.current === c ? {} : { selectedSubtitleTrack: r === null ? void 0 : e[Math.max(r, 0)]?.streamIndex }
356
357
  });
357
358
  },
358
359
  onAudioStreams: (e, t) => {
359
360
  n || (V.current.audio = e, a.setSourceState({
360
- audioTracks: Ce(e, Y.current),
361
+ audioTracks: Ce(e, J.current),
361
362
  selectedAudioTrack: t
362
363
  }));
363
364
  }
@@ -470,13 +471,17 @@ var oe = {
470
471
  n,
471
472
  r
472
473
  ]);
473
- }, Fe = 5e3, Ie = 6e4, Le = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: i }) => {
474
+ }, Fe = 5e3, Ie = 6e4, Le = 1e6, Re = (e, t) => !e || e.some(([e, n]) => e <= 0 && n >= Math.min(Le, t)), ze = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: i }) => {
474
475
  let [a, s] = T([]), c = w(null), l = w(r);
475
476
  l.current = r;
476
477
  let u = C(() => i?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [i?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), d = w(u);
477
- return d.current = u, S(() => {
478
+ d.current = u;
479
+ let f = w(null);
480
+ return S(() => {
478
481
  if (!n || !r || !e || !t) return;
479
- let i = !1, a = null, u, f = Fe, p = () => {
482
+ let i = !1, a = null, u, p = Fe, m = () => {
483
+ f.current = null;
484
+ let r = !Re(d.current, n);
480
485
  o({
481
486
  publicPath: e,
482
487
  workerUrl: t,
@@ -492,25 +497,29 @@ var oe = {
492
497
  }
493
498
  a = e, c.current = e, e.update(d.current);
494
499
  }, () => {
495
- i || (u = setTimeout(p, f), f = Math.min(f * 2, Ie));
500
+ if (i || (u = setTimeout(m, p), p = Math.min(p * 2, Ie), !r)) return;
501
+ let e = () => {
502
+ clearTimeout(u), m();
503
+ };
504
+ Re(d.current, n) ? e() : f.current = e;
496
505
  });
497
506
  };
498
- return p(), () => {
499
- i = !0, clearTimeout(u), c.current = null, a?.destroy(), s([]);
507
+ return m(), () => {
508
+ i = !0, f.current = null, clearTimeout(u), c.current = null, a?.destroy(), s([]);
500
509
  };
501
510
  }, [
502
511
  n,
503
512
  e,
504
513
  t
505
514
  ]), S(() => {
506
- c.current?.update(u);
515
+ c.current?.update(u), n && Re(u, n) && f.current?.();
507
516
  }, [u]), {
508
517
  thumbnails: a,
509
518
  requestThumbnail: b((e) => {
510
519
  c.current?.prioritize(e);
511
520
  }, [])
512
521
  };
513
- }, Re = (e, t) => {
522
+ }, Be = (e, t) => {
514
523
  let n = w(null), [i, a] = T(!1), [o] = T(() => r());
515
524
  S(() => {
516
525
  if (!e || !t || !o) return;
@@ -538,10 +547,10 @@ var oe = {
538
547
  mode: o,
539
548
  burnedIn: i
540
549
  };
541
- }, ze = "(hover: hover) and (pointer: fine)", Be = () => typeof matchMedia == "function" ? matchMedia(ze) : void 0, Ve = (e) => {
542
- let t = Be();
550
+ }, Ve = "(hover: hover) and (pointer: fine)", He = () => typeof matchMedia == "function" ? matchMedia(Ve) : void 0, Ue = (e) => {
551
+ let t = He();
543
552
  return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
544
- }, He = () => !!Be()?.matches, Ue = () => !1, We = (e, t) => {
553
+ }, We = () => !!He()?.matches, Ge = () => !1, Ke = (e, t) => {
545
554
  let [n, r] = T(!1), [i, a] = T(), o = w(t);
546
555
  t && (o.current = t);
547
556
  let s = w(!1), c = b((e) => {
@@ -564,7 +573,7 @@ var oe = {
564
573
  d,
565
574
  u
566
575
  ]);
567
- let f = E(Ve, He, Ue), [p, m] = T(!1);
576
+ let f = E(Ue, We, Ge), [p, m] = T(!1);
568
577
  S(() => {
569
578
  if (!d) return;
570
579
  let e = (e) => {
@@ -605,61 +614,66 @@ var oe = {
605
614
  u,
606
615
  g
607
616
  ]);
608
- }, Ge = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
617
+ }, qe = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
609
618
  channelCountMode: "max",
610
619
  processorOptions: n
611
- })), Ke = /* @__PURE__ */ new WeakMap(), qe = (e) => new Promise((t, n) => {
620
+ })), Je = /* @__PURE__ */ new WeakMap(), Ye = (e) => new Promise((t, n) => {
612
621
  let r = () => {
613
622
  (e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
614
623
  };
615
624
  e.addEventListener("statechange", r), r();
616
- }), Je = (e, t, n = {}) => {
617
- let r = Ke.get(e);
625
+ }), Xe = (e, t, n = {}) => {
626
+ let r = Je.get(e);
618
627
  if (r) return r.wake(), r;
619
- 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 = () => {
628
+ let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = !1, l = () => 20 * Math.log10(Math.max(e.volume, 1e-6)), u = e.ownerDocument, d = () => {
620
629
  i.state === "suspended" && i.resume().catch(() => {});
621
- }, d = (e) => {
630
+ }, f = (e) => {
622
631
  for (let t of [
623
632
  "pointerdown",
624
633
  "pointerup",
625
634
  "keydown"
626
- ]) e ? l.addEventListener(t, u, !0) : l.removeEventListener(t, u, !0);
627
- }, f = () => {
628
- let e = !s && i.state === "suspended";
629
- d(e), e && o && u();
635
+ ]) e ? u.addEventListener(t, d, !0) : u.removeEventListener(t, d, !0);
636
+ }, p = () => {
637
+ c && i.state === "running" && i.suspend().catch(() => {});
638
+ let e = !s && !c && i.state === "suspended";
639
+ f(e), e && o && d();
630
640
  };
631
- i.addEventListener("statechange", f), f();
632
- let p = (async () => {
633
- let r = await Ge(i, t, {
641
+ i.addEventListener("statechange", p), p();
642
+ let m = (async () => {
643
+ let r = await qe(i, t, {
634
644
  ...n,
635
645
  enabled: a,
636
- inputGainDb: c()
646
+ inputGainDb: l()
637
647
  });
638
- await qe(i);
648
+ await Ye(i);
639
649
  let s = R(i, e);
640
650
  return r.port.postMessage({
641
651
  enabled: a,
642
- inputGainDb: c()
643
- }), s.connect(r).connect(i.destination), e.addEventListener("volumechange", () => r.port.postMessage({ inputGainDb: c() })), e.addEventListener("seeking", () => r.port.postMessage({ reset: "seek" })), e.addEventListener("emptied", () => r.port.postMessage({ reset: "source" })), o = r, r;
652
+ inputGainDb: l()
653
+ }), s.connect(r).connect(i.destination), e.addEventListener("volumechange", () => r.port.postMessage({ inputGainDb: l() })), e.addEventListener("seeking", () => r.port.postMessage({ reset: "seek" })), e.addEventListener("emptied", () => r.port.postMessage({ reset: "source" })), e.addEventListener("pause", () => {
654
+ c = !0, i.state === "running" && i.suspend().catch(() => {});
655
+ }), e.addEventListener("play", () => {
656
+ c = !1, d();
657
+ }), o = r, r;
644
658
  })();
645
- p.catch(() => {
646
- s = !0, d(!1), i.close().catch(() => {});
659
+ m.catch(() => {
660
+ s = !0, f(!1), i.close().catch(() => {});
647
661
  });
648
- let m = {
662
+ let h = {
649
663
  context: i,
650
- routed: p,
664
+ routed: m,
651
665
  setEnabled: (e) => {
652
666
  a = e, o?.port.postMessage({ enabled: a });
653
667
  },
654
668
  release: () => {
655
- s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (Ke.delete(e), i.close().catch(() => {}));
669
+ s = !0, f(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (Je.delete(e), i.close().catch(() => {}));
656
670
  },
657
671
  wake: () => {
658
- i.state !== "closed" && (s = !1, u(), f());
672
+ i.state !== "closed" && (s = !1, d(), p());
659
673
  }
660
674
  };
661
- return Ke.set(e, m), m;
662
- }, Ye = 20, Xe = 5, Ze = 1, Qe = 50, $e = ({ node: t, element: n, scriptUrl: r, source: i }) => {
675
+ return Je.set(e, h), h;
676
+ }, Ze = 20, Qe = 5, $e = 1, et = 50, tt = ({ node: t, element: n, scriptUrl: r, source: i }) => {
663
677
  let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
664
678
  for (let e of [...c]) e();
665
679
  c.clear();
@@ -690,7 +704,7 @@ var oe = {
690
704
  }, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
691
705
  p.onmessage = ({ data: e }) => {
692
706
  if (e.type === "unsupported") {
693
- G();
707
+ ne();
694
708
  return;
695
709
  }
696
710
  e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
@@ -706,7 +720,7 @@ var oe = {
706
720
  }), S = () => p.postMessage({
707
721
  type: "playhead",
708
722
  time: n.currentTime
709
- }), C = setInterval(x, Qe), w = [
723
+ }), C = setInterval(x, et), w = [
710
724
  "play",
711
725
  "playing",
712
726
  "pause",
@@ -723,7 +737,7 @@ var oe = {
723
737
  return t >= (h.end ?? T) - .05 ? null : t;
724
738
  }, N = (e) => j.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
725
739
  let e = n.currentTime, t = M(e), r = O && y !== D;
726
- if (t !== null && t < e + Ye) return r && k <= t + 1 && t <= A + Xe ? "read" : N(t);
740
+ if (t !== null && t < e + Ze) return r && k <= t + 1 && t <= A + Qe ? "read" : N(t);
727
741
  if (r) return "read";
728
742
  let i = t ?? M(0);
729
743
  return i === null ? "done" : N(i);
@@ -788,7 +802,7 @@ var oe = {
788
802
  await H(e), e.finished && await V(!0);
789
803
  } else {
790
804
  await V(!1), j.set(Math.round(e * 10), g);
791
- let t = B.seek(Math.max(0, e - Ze));
805
+ let t = B.seek(Math.max(0, e - $e));
792
806
  f(!0);
793
807
  let r = await L(t);
794
808
  if (a) return;
@@ -808,7 +822,7 @@ var oe = {
808
822
  }
809
823
  e(B), B = void 0;
810
824
  }
811
- }, U = () => {}, W = (e, t) => {
825
+ }, U = () => {}, te = (e, t) => {
812
826
  let n = !1, r = (e) => {
813
827
  n && p.postMessage({
814
828
  type: "end",
@@ -843,7 +857,7 @@ var oe = {
843
857
  }, [t]);
844
858
  }
845
859
  });
846
- }, G = () => {
860
+ }, ne = () => {
847
861
  if (!a) {
848
862
  a = !0, f(!0), l(), clearInterval(C);
849
863
  for (let e of w) n.removeEventListener(e, x);
@@ -852,20 +866,20 @@ var oe = {
852
866
  _.clear();
853
867
  }
854
868
  };
855
- return "tap" in i ? W(i.tap, i.audioStreamIndex) : ee(i).catch((e) => {
856
- a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), G());
869
+ return "tap" in i ? te(i.tap, i.audioStreamIndex) : ee(i).catch((e) => {
870
+ a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), ne());
857
871
  }), S(), {
858
872
  update: (e) => {
859
873
  o = e, f(!1);
860
874
  },
861
- stop: G
875
+ stop: ne
862
876
  };
863
- }, et = (e, t, n, r, i) => {
877
+ }, nt = (e, t, n, r, i) => {
864
878
  let a = w(null), [o, s] = T(!1), [c, l] = T(null);
865
879
  S(() => {
866
880
  if (e && t) {
867
881
  if (n && !a.current) {
868
- let r = Je(e, t, { enabled: n });
882
+ let r = Xe(e, t, { enabled: n });
869
883
  a.current = r, r.routed.then((e) => {
870
884
  a.current === r && l(e);
871
885
  }, (e) => {
@@ -889,7 +903,7 @@ var oe = {
889
903
  return S(() => {
890
904
  let r = f.current;
891
905
  if (!c || !e || !t || !n || !r) return;
892
- let i = $e({
906
+ let i = tt({
893
907
  node: c,
894
908
  element: e,
895
909
  scriptUrl: t,
@@ -911,7 +925,7 @@ var oe = {
911
925
  ]), S(() => {
912
926
  d.current?.update(i);
913
927
  }, [i]), { refused: o };
914
- }, tt = () => {
928
+ }, rt = () => {
915
929
  let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
916
930
  return {
917
931
  push: (n) => {
@@ -957,7 +971,7 @@ var oe = {
957
971
  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 ",
958
972
  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 "
959
973
  }
960
- }, nt = D`
974
+ }, it = D`
961
975
  display: flex;
962
976
  justify-content: center;
963
977
  align-items: center;
@@ -970,7 +984,7 @@ var oe = {
970
984
  margin: auto;
971
985
  pointer-events: none;
972
986
  }
973
- `, rt = D`
987
+ `, at = D`
974
988
  position: absolute;
975
989
  top: 0;
976
990
  left: 0;
@@ -999,9 +1013,9 @@ var oe = {
999
1013
 
1000
1014
  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%);
1001
1015
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
1002
- `, it = O`
1016
+ `, ot = O`
1003
1017
  to { transform: rotate(360deg); }
1004
- `, at = D`
1018
+ `, st = D`
1005
1019
  position: absolute;
1006
1020
  inset: 0;
1007
1021
  z-index: 2;
@@ -1017,9 +1031,9 @@ var oe = {
1017
1031
  border-radius: 50%;
1018
1032
  border: 3px solid rgba(255, 255, 255, 0.25);
1019
1033
  border-top-color: #fff;
1020
- animation: ${it} 0.8s linear infinite;
1034
+ animation: ${ot} 0.8s linear infinite;
1021
1035
  }
1022
- `, ot = D`
1036
+ `, ct = D`
1023
1037
  position: absolute;
1024
1038
  inset: auto 0 20%;
1025
1039
  z-index: 3;
@@ -1029,36 +1043,36 @@ var oe = {
1029
1043
  ${$.bLarge.regular}
1030
1044
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
1031
1045
  pointer-events: none;
1032
- `, st = new Set(Object.values(a)), ct = (e) => e instanceof Error && st.has(e.label ?? ""), lt = (e, { format: t }) => ct(e) ? t(e.label, e.values) : e instanceof Error ? e.message : typeof e == "string" ? e : t(a.failed), ut = ({ onSubtitleRef: e }) => {
1046
+ `, lt = new Set(Object.values(a)), ut = (e) => e instanceof Error && lt.has(e.label ?? ""), dt = (e, { format: t }) => ut(e) ? t(e.label, e.values) : e instanceof Error ? e.message : typeof e == "string" ? e : t(a.failed), ft = ({ onSubtitleRef: e }) => {
1033
1047
  let t = Q(), n = X((e) => e.title), r = X((e) => e.hideUI), i = X((e) => e.playbackError), a = X((e) => e.ready), o = X((e) => e.size), s = X((e) => e.waiting), c = X((e) => e.seekingTo);
1034
1048
  return /* @__PURE__ */ L(F, { children: [
1035
1049
  n ? /* @__PURE__ */ I("div", {
1036
1050
  className: "title",
1037
1051
  dir: "auto",
1038
- css: rt,
1052
+ css: at,
1039
1053
  style: { ...r ? {
1040
1054
  opacity: "0",
1041
1055
  pointerEvents: "none"
1042
1056
  } : {} },
1043
1057
  children: n
1044
1058
  }) : void 0,
1045
- ((o ? !a : s) || c !== void 0) && !i ? /* @__PURE__ */ I("div", { css: at }) : void 0,
1059
+ ((o ? !a : s) || c !== void 0) && !i ? /* @__PURE__ */ I("div", { css: st }) : void 0,
1046
1060
  i ? /* @__PURE__ */ I("div", {
1047
- css: ot,
1061
+ css: ct,
1048
1062
  dir: "auto",
1049
- children: lt(i, t)
1063
+ children: dt(i, t)
1050
1064
  }) : void 0,
1051
1065
  /* @__PURE__ */ I("div", {
1052
1066
  className: "subtitles",
1053
1067
  ref: e,
1054
- css: nt
1068
+ css: it
1055
1069
  })
1056
1070
  ] });
1057
- }, dt = 1e-4, ft = 1, pt = (e) => Math.max(dt, Math.min(ft, e)) ** 2, mt = (e) => Math.max(dt, Math.min(ft, e)) ** (ft / 2), ht = (e) => {
1071
+ }, pt = 1e-4, mt = 1, ht = (e) => Math.max(pt, Math.min(mt, e)) ** 2, gt = (e) => Math.max(pt, Math.min(mt, e)) ** (mt / 2), _t = (e) => {
1058
1072
  if (e === void 0) return "0:00";
1059
1073
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
1060
1074
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
1061
- }, gt = (e, t) => `${ht(e)} / ${ht(t)}`, _t = (e) => D`
1075
+ }, vt = (e, t) => `${_t(e)} / ${_t(t)}`, yt = (e) => D`
1062
1076
  display: flex;
1063
1077
  justify-content: flex-start;
1064
1078
 
@@ -1104,25 +1118,25 @@ var oe = {
1104
1118
  ${e === "lg" && D`
1105
1119
  padding: calc(1.2 * var(--mp-unit))!important;
1106
1120
  `}
1107
- `, vt = {
1121
+ `, bt = {
1108
1122
  x: -1,
1109
1123
  y: -1,
1110
1124
  anchors: 0
1111
- }, yt = (e) => {
1112
- vt.x = e.clientX, vt.y = e.clientY;
1113
- }, bt = () => (vt.anchors++ === 0 && window.addEventListener("pointermove", yt, {
1125
+ }, xt = (e) => {
1126
+ bt.x = e.clientX, bt.y = e.clientY;
1127
+ }, St = () => (bt.anchors++ === 0 && window.addEventListener("pointermove", xt, {
1114
1128
  capture: !0,
1115
1129
  passive: !0
1116
1130
  }), () => {
1117
- --vt.anchors === 0 && window.removeEventListener("pointermove", yt, { capture: !0 });
1118
- }), xt = v(!1), St = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
1119
- let l = w(null), u = w(null), d = x(xt);
1131
+ --bt.anchors === 0 && window.removeEventListener("pointermove", xt, { capture: !0 });
1132
+ }), Ct = v(!1), wt = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
1133
+ let l = w(null), u = w(null), d = x(Ct);
1120
1134
  return S(() => {
1121
- let e = bt(), t = () => {
1135
+ let e = St(), t = () => {
1122
1136
  let e = l.current;
1123
1137
  if (!e) return;
1124
1138
  let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
1125
- vt.x >= t && vt.x < n && vt.y >= r && vt.y < i || u.current?.close();
1139
+ bt.x >= t && bt.x < n && bt.y >= r && bt.y < i || u.current?.close();
1126
1140
  }, n = ["fullscreenchange", "webkitfullscreenchange"];
1127
1141
  for (let e of n) document.addEventListener(e, t);
1128
1142
  return d && window.addEventListener("resize", t), () => {
@@ -1139,14 +1153,14 @@ var oe = {
1139
1153
  "data-tooltip-delay-hide": i,
1140
1154
  "data-tooltip-place": o,
1141
1155
  children: n
1142
- }), !s && /* @__PURE__ */ I(ae, {
1156
+ }), !s && /* @__PURE__ */ I(oe, {
1143
1157
  ref: u,
1144
- css: _t(c),
1158
+ css: yt(c),
1145
1159
  id: e,
1146
1160
  noArrow: !0,
1147
1161
  children: t
1148
1162
  })] });
1149
- }, Ct = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
1163
+ }, Tt = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
1150
1164
  let [i, a] = T(!1), o = w(t);
1151
1165
  o.current = t;
1152
1166
  let s = w(null), c = b((t, r) => {
@@ -1185,7 +1199,7 @@ var oe = {
1185
1199
  style: { touchAction: "none" }
1186
1200
  }
1187
1201
  };
1188
- }, wt = D`
1202
+ }, Et = D`
1189
1203
  position: relative;
1190
1204
  height: calc(.4 * var(--mp-unit));
1191
1205
 
@@ -1404,7 +1418,7 @@ var oe = {
1404
1418
  --thumbnail-width: calc(18 * var(--mp-unit));
1405
1419
  --thumbnail-half: calc(9 * var(--mp-unit));
1406
1420
  }
1407
- `, Tt = 4, Et = () => {
1421
+ `, Dt = 4, Ot = () => {
1408
1422
  let e = X(), t = X((e) => e.currentTime), n = X((e) => e.requestSeek), r = X((e) => e.duration), i = X((e) => e.size), a = X((e) => e.downloadedRanges), o = X((e) => e.buffered), s = X((e) => e.indexes), c = X((e) => e.thumbnails), l = X((e) => e.thumbnailAt), u = X((e) => e.requestThumbnail), d = X((e) => e.chapters), f = X((e) => e.seekingTo), h = X((e) => e.setSourceState), g = X((e) => e.hideUI), _ = w(null), [v, y] = T(void 0), [b, x] = T(void 0), E = (e) => {
1409
1423
  x(e), u(e);
1410
1424
  }, D = !!b;
@@ -1413,13 +1427,13 @@ var oe = {
1413
1427
  }, [h, D]), S(() => {
1414
1428
  g && E(void 0);
1415
1429
  }, [g]);
1416
- let O = w(void 0), k = w(0), A = w(void 0), j = w(void 0), M = w(!1), { dragging: N, handlers: P } = Ct({
1430
+ let O = w(void 0), k = w(0), A = w(void 0), j = w(void 0), M = w(!1), { dragging: N, handlers: P } = Tt({
1417
1431
  ref: _,
1418
1432
  onChange: (e) => {
1419
1433
  if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
1420
1434
  else if (!M.current) {
1421
1435
  let t = _.current?.getBoundingClientRect().width ?? 0;
1422
- Math.abs(e - j.current) * t > Tt && (M.current = !0);
1436
+ Math.abs(e - j.current) * t > Dt && (M.current = !0);
1423
1437
  }
1424
1438
  y(e), O.current !== "mouse" && E(e * r);
1425
1439
  }
@@ -1443,7 +1457,7 @@ var oe = {
1443
1457
  B.current !== "touch" && E(z(e.clientX));
1444
1458
  }, ee = () => {
1445
1459
  _.current && E(void 0);
1446
- }, U = (e) => r ? e / r * 100 : 0, W = (e, t, n) => {
1460
+ }, U = (e) => r ? e / r * 100 : 0, te = (e, t, n) => {
1447
1461
  let r = Number((n - t).toFixed(4)), i = t * 100;
1448
1462
  return /* @__PURE__ */ I("div", {
1449
1463
  className: "loaded-part",
@@ -1452,10 +1466,10 @@ var oe = {
1452
1466
  marginLeft: `${i}%`
1453
1467
  }
1454
1468
  }, e);
1455
- }, G = C(() => i === void 0 ? r ? o.map(([e, t], n) => W(n, e / r, t / r)) : [] : a?.map((e, t) => {
1469
+ }, ne = C(() => i === void 0 ? r ? o.map(([e, t], n) => te(n, e / r, t / r)) : [] : a?.map((e, t) => {
1456
1470
  if (!i || !r) return null;
1457
1471
  let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
1458
- return !a || !o ? null : W(t, a.timestamp / r, o.timestamp / r);
1472
+ return !a || !o ? null : te(t, a.timestamp / r, o.timestamp / r);
1459
1473
  }) ?? [], [
1460
1474
  r,
1461
1475
  i,
@@ -1471,7 +1485,7 @@ var oe = {
1471
1485
  v,
1472
1486
  r
1473
1487
  ]);
1474
- let te = C(() => {
1488
+ let re = C(() => {
1475
1489
  if (!r) return 0;
1476
1490
  if (N && v !== void 0) return v;
1477
1491
  let e = f ?? t;
@@ -1482,22 +1496,22 @@ var oe = {
1482
1496
  N,
1483
1497
  v,
1484
1498
  f
1485
- ]), K = C(() => p(d, r), [d, r]), q = K.length > 0, ne = C(() => {
1486
- if (!q || b === void 0 || !r) return -1;
1487
- let e = b / r * 100, t = K.findIndex((t, n) => n < K.length - 1 && e >= t && e < K[n + 1]);
1488
- return t >= 0 ? t : K.length - 2;
1499
+ ]), W = C(() => p(d, r), [d, r]), G = W.length > 0, K = C(() => {
1500
+ if (!G || b === void 0 || !r) return -1;
1501
+ let e = b / r * 100, t = W.findIndex((t, n) => n < W.length - 1 && e >= t && e < W[n + 1]);
1502
+ return t >= 0 ? t : W.length - 2;
1489
1503
  }, [
1490
- q,
1491
- K,
1504
+ G,
1505
+ W,
1492
1506
  b,
1493
1507
  r
1494
- ]), re = C(() => q ? m(K, (e) => e !== ne) : void 0, [
1495
- q,
1496
- K,
1497
- ne
1498
- ]), J = C(() => ne >= 0 ? m(K, (e) => e === ne) : void 0, [K, ne]), Y = C(() => {
1508
+ ]), ie = C(() => G ? m(W, (e) => e !== K) : void 0, [
1509
+ G,
1510
+ W,
1511
+ K
1512
+ ]), q = C(() => K >= 0 ? m(W, (e) => e === K) : void 0, [W, K]), J = C(() => {
1499
1513
  if (b !== void 0) return d.find(({ start: e, end: t }) => e <= b && b < t);
1500
- }, [d, b]), ie = C(() => {
1514
+ }, [d, b]), ae = C(() => {
1501
1515
  if (b) {
1502
1516
  if (l) return l(b);
1503
1517
  if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
@@ -1506,55 +1520,55 @@ var oe = {
1506
1520
  c,
1507
1521
  l,
1508
1522
  b
1509
- ]), ae = (e, t) => /* @__PURE__ */ L("div", {
1523
+ ]), oe = (e, t) => /* @__PURE__ */ L("div", {
1510
1524
  className: e ? `track ${e}` : "track",
1511
1525
  style: t ? { maskImage: t } : void 0,
1512
1526
  children: [
1513
1527
  /* @__PURE__ */ I("div", { className: "background-bar" }),
1514
1528
  /* @__PURE__ */ I("div", {
1515
1529
  className: "loaded",
1516
- children: G
1530
+ children: ne
1517
1531
  }),
1518
1532
  /* @__PURE__ */ I("div", {
1519
1533
  className: "play-container",
1520
1534
  children: /* @__PURE__ */ I("div", {
1521
1535
  className: "play",
1522
- style: { transform: `scaleX(${te})` }
1536
+ style: { transform: `scaleX(${re})` }
1523
1537
  })
1524
1538
  })
1525
1539
  ]
1526
1540
  });
1527
1541
  return /* @__PURE__ */ L("div", {
1528
- css: wt,
1542
+ css: Et,
1529
1543
  ref: _,
1530
1544
  className: [
1531
1545
  "progress-bar",
1532
1546
  N ? "dragging" : "",
1533
- q ? "segmented" : ""
1547
+ G ? "segmented" : ""
1534
1548
  ].filter(Boolean).join(" "),
1535
1549
  onPointerDown: V,
1536
1550
  onPointerMove: V,
1537
1551
  onMouseMove: H,
1538
1552
  onMouseOut: ee,
1539
1553
  children: [
1540
- ae(void 0, re),
1554
+ oe(void 0, ie),
1541
1555
  b ? /* @__PURE__ */ L("div", {
1542
1556
  className: "cursor-time",
1543
1557
  style: {
1544
- left: Y ? `clamp(var(--thumbnail-half), ${U(b)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${U(b)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1545
- maxWidth: Y ? "var(--thumbnail-width)" : void 0
1558
+ left: J ? `clamp(var(--thumbnail-half), ${U(b)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${U(b)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1559
+ maxWidth: J ? "var(--thumbnail-width)" : void 0
1546
1560
  },
1547
1561
  children: [/* @__PURE__ */ I("span", {
1548
1562
  className: "cursor-time-value",
1549
- children: ht(b)
1550
- }), Y ? /* @__PURE__ */ I("span", {
1563
+ children: _t(b)
1564
+ }), J ? /* @__PURE__ */ I("span", {
1551
1565
  className: "chapter-title",
1552
- children: Y.title
1566
+ children: J.title
1553
1567
  }) : void 0]
1554
1568
  }) : void 0,
1555
1569
  /* @__PURE__ */ I("div", { className: "progress" }),
1556
1570
  /* @__PURE__ */ I("div", { className: "hover" }),
1557
- J ? ae("focus", J) : void 0,
1571
+ q ? oe("focus", q) : void 0,
1558
1572
  /* @__PURE__ */ I("div", { className: "scrubber" }),
1559
1573
  /* @__PURE__ */ I("div", {
1560
1574
  className: "padding",
@@ -1566,11 +1580,11 @@ var oe = {
1566
1580
  /* @__PURE__ */ I("div", {
1567
1581
  className: "thumbnail",
1568
1582
  style: { left: `clamp(var(--thumbnail-half), ${U(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1569
- children: ie?.url ? /* @__PURE__ */ I("img", { src: ie.url }) : void 0
1583
+ children: ae?.url ? /* @__PURE__ */ I("img", { src: ae.url }) : void 0
1570
1584
  })
1571
1585
  ]
1572
1586
  });
1573
- }, Dt = "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", Ot = {
1587
+ }, kt = "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", At = {
1574
1588
  xmlns: "http://www.w3.org/2000/svg",
1575
1589
  width: 24,
1576
1590
  height: 24,
@@ -1580,8 +1594,8 @@ var oe = {
1580
1594
  strokeWidth: 2,
1581
1595
  strokeLinecap: "round",
1582
1596
  strokeLinejoin: "round"
1583
- }, kt = (e) => /* @__PURE__ */ L("svg", {
1584
- ...Ot,
1597
+ }, jt = (e) => /* @__PURE__ */ L("svg", {
1598
+ ...At,
1585
1599
  ...e,
1586
1600
  children: [
1587
1601
  /* @__PURE__ */ I("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
@@ -1595,8 +1609,8 @@ var oe = {
1595
1609
  }),
1596
1610
  /* @__PURE__ */ I("path", { d: "M14.5 18.5h2m2 0h1" })
1597
1611
  ]
1598
- }), At = (e) => /* @__PURE__ */ L("svg", {
1599
- ...Ot,
1612
+ }), Mt = (e) => /* @__PURE__ */ L("svg", {
1613
+ ...At,
1600
1614
  ...e,
1601
1615
  children: [
1602
1616
  /* @__PURE__ */ I("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
@@ -1610,7 +1624,7 @@ var oe = {
1610
1624
  }),
1611
1625
  /* @__PURE__ */ I("path", { d: "M6 9h3m2 0h2" })
1612
1626
  ]
1613
- }), jt = D`
1627
+ }), Nt = D`
1614
1628
  .popover {
1615
1629
  position: absolute;
1616
1630
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -1738,7 +1752,7 @@ var oe = {
1738
1752
  ${$.bSmall.regular}
1739
1753
  }
1740
1754
  }
1741
- `, Mt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: o, pending: s, failed: c }) => {
1755
+ `, Pt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: o, pending: s, failed: c }) => {
1742
1756
  let { format: l } = Q(), u = s !== void 0, d = (e, i, a) => {
1743
1757
  let o = u && s === e, c = u || t.find((t) => t.id === e)?.disabled;
1744
1758
  return /* @__PURE__ */ L("div", {
@@ -1766,7 +1780,7 @@ var oe = {
1766
1780
  t.map(({ id: e, label: t }) => d(e, t, "description"))
1767
1781
  ]
1768
1782
  });
1769
- }, Nt = ({ onReset: e } = {}) => {
1783
+ }, Ft = ({ onReset: e } = {}) => {
1770
1784
  let t = w(null), [n, r] = T(!1), [i, a] = T(void 0), [o, s] = T(!1), c = w(e);
1771
1785
  c.current = e;
1772
1786
  let l = () => {
@@ -1807,7 +1821,7 @@ var oe = {
1807
1821
  });
1808
1822
  }
1809
1823
  };
1810
- }, Pt = D`
1824
+ }, It = D`
1811
1825
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1812
1826
  which is the width of the player box, so it can be clamped to it. */
1813
1827
  position: static;
@@ -1823,7 +1837,7 @@ position: static;
1823
1837
  }
1824
1838
  }
1825
1839
 
1826
- ${jt}
1840
+ ${Nt}
1827
1841
 
1828
1842
  .popover.error-list {
1829
1843
  /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
@@ -1895,25 +1909,25 @@ ${jt}
1895
1909
  }
1896
1910
  }
1897
1911
  }
1898
- `, Ft = (e, t) => new Date(e).toLocaleTimeString(t), It = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : ht(Math.max(0, e)), Lt = (e) => e.reduce((e, t) => e + t.count, 0), Rt = (e) => e.map((e, t) => {
1899
- let n = It(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1912
+ `, Lt = (e, t) => new Date(e).toLocaleTimeString(t), Rt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : _t(Math.max(0, e)), zt = (e) => e.reduce((e, t) => e + t.count, 0), Bt = (e) => e.map((e, t) => {
1913
+ let n = Rt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1900
1914
  return [
1901
1915
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
1902
1916
  e.message,
1903
1917
  e.detail
1904
1918
  ].filter(Boolean).join("\n");
1905
- }).join("\n\n"), zt = () => {
1906
- let e = X((e) => e.playbackErrors), { format: t, locale: n } = Q(), { open: r, toggle: i, containerRef: o } = Nt(), [s, c] = T(!1);
1919
+ }).join("\n\n"), Vt = () => {
1920
+ let e = X((e) => e.playbackErrors), { format: t, locale: n } = Q(), { open: r, toggle: i, containerRef: o } = Ft(), [s, c] = T(!1);
1907
1921
  if (e.length === 0) return null;
1908
1922
  let l = () => {
1909
- navigator.clipboard?.writeText(Rt(e)).then(() => {
1923
+ navigator.clipboard?.writeText(Bt(e)).then(() => {
1910
1924
  c(!0), setTimeout(() => c(!1), 2e3);
1911
1925
  }, (e) => console.warn("[media-player] could not copy the errors:", e));
1912
- }, u = t(a.errors, { count: Lt(e) });
1926
+ }, u = t(a.errors, { count: zt(e) });
1913
1927
  return /* @__PURE__ */ L("div", {
1914
- css: Pt,
1928
+ css: It,
1915
1929
  ref: o,
1916
- children: [/* @__PURE__ */ I(St, {
1930
+ children: [/* @__PURE__ */ I(wt, {
1917
1931
  id: "errors",
1918
1932
  disabled: r,
1919
1933
  text: /* @__PURE__ */ I("button", {
@@ -1922,7 +1936,7 @@ ${jt}
1922
1936
  onClick: i,
1923
1937
  "aria-label": u,
1924
1938
  "aria-expanded": r,
1925
- children: /* @__PURE__ */ I(re, { className: "alert-triangle" })
1939
+ children: /* @__PURE__ */ I(ie, { className: "alert-triangle" })
1926
1940
  }),
1927
1941
  toolTipText: /* @__PURE__ */ I("span", { children: u })
1928
1942
  }), r && /* @__PURE__ */ L("div", {
@@ -1943,10 +1957,10 @@ ${jt}
1943
1957
  className: "when",
1944
1958
  children: [
1945
1959
  e.count > 1 ? t(a.errorSpan, {
1946
- start: Ft(e.at, n),
1947
- end: Ft(e.lastAt, n)
1948
- }) : Ft(e.at, n),
1949
- It(e.atMediaTime) ? ` ${t(a.errorAt, { time: It(e.atMediaTime) })}` : "",
1960
+ start: Lt(e.at, n),
1961
+ end: Lt(e.lastAt, n)
1962
+ }) : Lt(e.at, n),
1963
+ Rt(e.atMediaTime) ? ` ${t(a.errorAt, { time: Rt(e.atMediaTime) })}` : "",
1950
1964
  e.recovered ? ` ${t(a.recovered)}` : "",
1951
1965
  e.count > 1 ? /* @__PURE__ */ I("span", {
1952
1966
  className: "count",
@@ -1966,7 +1980,7 @@ ${jt}
1966
1980
  }, `${e.at}-${r}`))]
1967
1981
  })]
1968
1982
  });
1969
- }, Bt = D`
1983
+ }, Ht = D`
1970
1984
  display: flex;
1971
1985
  align-items: center;
1972
1986
  justify-content: center;
@@ -2019,8 +2033,8 @@ width: 100%;
2019
2033
  }
2020
2034
  }
2021
2035
  }
2022
- `, Vt = () => {
2023
- let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = w(null), o = w(null), s = .25, c = 2.75, l = (e, t = .05) => Math.round(e / t) * t, u = l(r || 1), d = (e) => (e - s) / c * 100, f = (e) => l(s + e * c), { handlers: p } = Ct({
2036
+ `, Ut = () => {
2037
+ let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = w(null), o = w(null), s = .25, c = 2.75, l = (e, t = .05) => Math.round(e / t) * t, u = l(r || 1), d = (e) => (e - s) / c * 100, f = (e) => l(s + e * c), { handlers: p } = Tt({
2024
2038
  ref: o,
2025
2039
  onChange: (t) => e.setPlaybackRate(f(t))
2026
2040
  }), m = (t) => {
@@ -2036,7 +2050,7 @@ width: 100%;
2036
2050
  }, [r]);
2037
2051
  let h = d(u);
2038
2052
  return /* @__PURE__ */ L("div", {
2039
- css: Bt,
2053
+ css: Ht,
2040
2054
  children: [/* @__PURE__ */ I("div", { children: t(a.speed, { rate: n(u, {
2041
2055
  minimumFractionDigits: 2,
2042
2056
  maximumFractionDigits: 2
@@ -2057,7 +2071,7 @@ width: 100%;
2057
2071
  })
2058
2072
  })]
2059
2073
  });
2060
- }, Ht = D`
2074
+ }, Wt = D`
2061
2075
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
2062
2076
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
2063
2077
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -2075,7 +2089,7 @@ position: static;
2075
2089
  }
2076
2090
  }
2077
2091
 
2078
- ${jt}
2092
+ ${Nt}
2079
2093
 
2080
2094
  .switch {
2081
2095
  position: relative;
@@ -2083,6 +2097,7 @@ ${jt}
2083
2097
  width: 28px;
2084
2098
  height: 16px;
2085
2099
  margin-right: 6px;
2100
+ margin-left: 8px;
2086
2101
  border-radius: 8px;
2087
2102
  background-color: rgba(255,255,255,.3);
2088
2103
  transition: background-color 0.15s ease-in-out;
@@ -2151,54 +2166,60 @@ ${jt}
2151
2166
  }
2152
2167
  }
2153
2168
 
2154
- `, Ut = [
2169
+ `, Gt = [
2155
2170
  .5,
2156
2171
  1,
2157
2172
  1.5,
2158
2173
  2
2159
- ], Wt = () => {
2160
- let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = X((e) => e.audioTracks), o = X((e) => e.selectedAudioTrack), s = X((e) => e.selectAudioTrack), c = X((e) => e.quality), l = X((e) => e.volumeNormalizer), [u, d] = T(0), { open: f, toggle: p, containerRef: m, pending: h, failed: g, runSelect: _ } = Nt({ onReset: () => d(0) }), v = (t) => {
2161
- e.setPlaybackRate(t), d(0);
2162
- }, y = (e) => {
2163
- e !== void 0 && _(e, () => s(e));
2174
+ ], Kt = () => {
2175
+ let e = X(), { format: t, number: n } = Q(), r = X((e) => e.playbackRate), i = X((e) => e.audioTracks), o = X((e) => e.selectedAudioTrack), s = X((e) => e.selectAudioTrack), c = X((e) => e.quality), l = X((e) => e.volumeNormalizer), u = X((e) => e.autoplayNext), [d, f] = T(0), { open: p, toggle: m, containerRef: h, pending: g, failed: _, runSelect: v } = Ft({ onReset: () => f(0) }), y = (t) => {
2176
+ e.setPlaybackRate(t), f(0);
2164
2177
  }, b = (e) => {
2165
- c && _(e ?? null, () => c.select(e === void 0 ? null : String(e)));
2166
- }, x = c ? c.options.length + +!!c.offLabel : 0, S = c?.selectedId == null ? c?.offLabel : c.options.find(({ id: e }) => e === c.selectedId)?.label, C = (e) => () => {
2167
- d(e);
2178
+ e !== void 0 && v(e, () => s(e));
2179
+ }, x = (e) => {
2180
+ c && v(e ?? null, () => c.select(e === void 0 ? null : String(e)));
2181
+ }, S = c ? c.options.length + +!!c.offLabel : 0, C = c?.selectedId == null ? c?.offLabel : c.options.find(({ id: e }) => e === c.selectedId)?.label, w = (e) => () => {
2182
+ f(e);
2168
2183
  };
2169
2184
  return /* @__PURE__ */ L("div", {
2170
- css: Ht,
2171
- ref: m,
2185
+ css: Wt,
2186
+ ref: h,
2172
2187
  children: [
2173
- /* @__PURE__ */ I(St, {
2188
+ /* @__PURE__ */ I(wt, {
2174
2189
  id: "settings",
2175
- disabled: f,
2190
+ disabled: p,
2176
2191
  text: /* @__PURE__ */ I("button", {
2177
2192
  className: "settings",
2178
2193
  type: "button",
2179
- onClick: p,
2194
+ onClick: m,
2180
2195
  "aria-label": t(a.settings),
2181
- "aria-expanded": f,
2182
- children: /* @__PURE__ */ I(ne, {})
2196
+ "aria-expanded": p,
2197
+ children: /* @__PURE__ */ I(K, {})
2183
2198
  }),
2184
2199
  toolTipText: /* @__PURE__ */ I("span", { children: t(a.settings) })
2185
2200
  }),
2186
- f && u === 0 && /* @__PURE__ */ L("div", {
2201
+ p && d === 0 && /* @__PURE__ */ L("div", {
2187
2202
  className: "popover menu",
2188
2203
  children: [
2204
+ u ? /* @__PURE__ */ L("div", {
2205
+ role: "switch",
2206
+ "aria-checked": u.enabled,
2207
+ onClick: () => u.setEnabled(!u.enabled),
2208
+ children: [/* @__PURE__ */ I("div", { children: t(a.autoplayNext) }), /* @__PURE__ */ I("div", { children: /* @__PURE__ */ I("span", { className: u.enabled ? "switch on" : "switch" }) })]
2209
+ }) : null,
2189
2210
  i.length > 1 ? /* @__PURE__ */ L("div", {
2190
- onClick: C(2),
2211
+ onClick: w(2),
2191
2212
  children: [/* @__PURE__ */ I("div", { children: t(a.audio) }), /* @__PURE__ */ I("div", { children: /* @__PURE__ */ I(ee, {}) })]
2192
2213
  }) : null,
2193
- x > 1 ? /* @__PURE__ */ L("div", {
2194
- onClick: C(3),
2195
- children: [/* @__PURE__ */ I("div", { children: t(a.quality) }), /* @__PURE__ */ L("div", { children: [S ? /* @__PURE__ */ I("span", {
2214
+ S > 1 ? /* @__PURE__ */ L("div", {
2215
+ onClick: w(3),
2216
+ children: [/* @__PURE__ */ I("div", { children: t(a.quality) }), /* @__PURE__ */ L("div", { children: [C ? /* @__PURE__ */ I("span", {
2196
2217
  className: "secondary",
2197
- children: S
2218
+ children: C
2198
2219
  }) : null, /* @__PURE__ */ I(ee, {})] })]
2199
2220
  }) : null,
2200
2221
  /* @__PURE__ */ L("div", {
2201
- onClick: C(1),
2222
+ onClick: w(1),
2202
2223
  children: [/* @__PURE__ */ I("div", { children: t(a.playbackSpeed) }), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("span", {
2203
2224
  className: "secondary",
2204
2225
  children: r === 1 ? t(a.defaultSpeed) : n(r, {
@@ -2222,49 +2243,49 @@ ${jt}
2222
2243
  }) : null
2223
2244
  ]
2224
2245
  }),
2225
- f && u === 1 && /* @__PURE__ */ L("div", {
2246
+ p && d === 1 && /* @__PURE__ */ L("div", {
2226
2247
  className: "popover playback-rate",
2227
2248
  children: [
2228
2249
  /* @__PURE__ */ L("div", {
2229
2250
  className: "back",
2230
- onClick: C(0),
2251
+ onClick: w(0),
2231
2252
  children: [/* @__PURE__ */ I(H, {}), /* @__PURE__ */ I("span", { children: t(a.playbackSpeed) })]
2232
2253
  }),
2233
2254
  /* @__PURE__ */ I("div", {
2234
2255
  className: "slider no-hover",
2235
- children: /* @__PURE__ */ I(Vt, {})
2256
+ children: /* @__PURE__ */ I(Ut, {})
2236
2257
  }),
2237
2258
  /* @__PURE__ */ I("div", {
2238
2259
  className: "options no-hover",
2239
- children: Ut.map((e) => /* @__PURE__ */ I("div", {
2240
- onClick: () => v(e),
2260
+ children: Gt.map((e) => /* @__PURE__ */ I("div", {
2261
+ onClick: () => y(e),
2241
2262
  children: t(a.speed, { rate: n(e) })
2242
2263
  }, e))
2243
2264
  })
2244
2265
  ]
2245
2266
  }),
2246
- f && u === 2 && /* @__PURE__ */ I(Mt, {
2267
+ p && d === 2 && /* @__PURE__ */ I(Pt, {
2247
2268
  title: t(a.audio),
2248
2269
  tracks: i,
2249
2270
  selected: o,
2250
- onSelect: y,
2251
- onBack: C(0),
2252
- pending: h,
2253
- failed: g
2271
+ onSelect: b,
2272
+ onBack: w(0),
2273
+ pending: g,
2274
+ failed: _
2254
2275
  }),
2255
- f && u === 3 && c && /* @__PURE__ */ I(Mt, {
2276
+ p && d === 3 && c && /* @__PURE__ */ I(Pt, {
2256
2277
  title: t(a.quality),
2257
2278
  tracks: c.options,
2258
2279
  selected: c.selectedId ?? void 0,
2259
- onSelect: b,
2260
- onBack: C(0),
2280
+ onSelect: x,
2281
+ onBack: w(0),
2261
2282
  offLabel: c.offLabel,
2262
- pending: h,
2263
- failed: g
2283
+ pending: g,
2284
+ failed: _
2264
2285
  })
2265
2286
  ]
2266
2287
  });
2267
- }, Gt = D`
2288
+ }, qt = D`
2268
2289
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
2269
2290
  which is the width of the player box, so it can be clamped to it. */
2270
2291
  position: static;
@@ -2280,15 +2301,15 @@ position: static;
2280
2301
  }
2281
2302
  }
2282
2303
 
2283
- ${jt}
2284
- `, Kt = () => {
2285
- let { format: e } = Q(), t = X((e) => e.subtitleTracks), n = X((e) => e.selectedSubtitleTrack), r = X((e) => e.selectSubtitleTrack), i = X((e) => e.subtitleOffLabel), { open: o, toggle: s, containerRef: c, pending: l, failed: u, runSelect: d } = Nt();
2304
+ ${Nt}
2305
+ `, Jt = () => {
2306
+ let { format: e } = Q(), t = X((e) => e.subtitleTracks), n = X((e) => e.selectedSubtitleTrack), r = X((e) => e.selectSubtitleTrack), i = X((e) => e.subtitleOffLabel), { open: o, toggle: s, containerRef: c, pending: l, failed: u, runSelect: d } = Ft();
2286
2307
  if (t.length === 0) return null;
2287
2308
  let f = n !== void 0;
2288
2309
  return /* @__PURE__ */ L("div", {
2289
- css: Gt,
2310
+ css: qt,
2290
2311
  ref: c,
2291
- children: [/* @__PURE__ */ I(St, {
2312
+ children: [/* @__PURE__ */ I(wt, {
2292
2313
  id: "subtitles",
2293
2314
  disabled: o,
2294
2315
  text: /* @__PURE__ */ I("button", {
@@ -2301,7 +2322,7 @@ ${jt}
2301
2322
  children: f ? /* @__PURE__ */ I(z, { className: "captions" }) : /* @__PURE__ */ I(B, { className: "captions-off" })
2302
2323
  }),
2303
2324
  toolTipText: /* @__PURE__ */ I("span", { children: e(a.subtitles) })
2304
- }), o && /* @__PURE__ */ I(Mt, {
2325
+ }), o && /* @__PURE__ */ I(Pt, {
2305
2326
  title: e(a.subtitles),
2306
2327
  tracks: t,
2307
2328
  selected: n,
@@ -2311,13 +2332,13 @@ ${jt}
2311
2332
  failed: u
2312
2333
  })]
2313
2334
  });
2314
- }, qt = {
2335
+ }, Yt = {
2315
2336
  primary: "#EAEBEE",
2316
2337
  secondary: "#D0D0D9",
2317
2338
  hover: "rgba(255, 255, 255, 0.13)",
2318
2339
  borderPrimary: "#384F70",
2319
2340
  backgroundTooltip: "#222222"
2320
- }, Jt = D`
2341
+ }, Xt = D`
2321
2342
  display: flex;
2322
2343
  align-items: center;
2323
2344
 
@@ -2360,8 +2381,8 @@ ${jt}
2360
2381
  width: 10px;
2361
2382
  height: 10px;
2362
2383
  }
2363
- `, Yt = ({ value: e, onChange: t }) => {
2364
- let { number: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), a = w(null), o = w(null), { handlers: s } = Ct({
2384
+ `, Zt = ({ value: e, onChange: t }) => {
2385
+ let { number: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), a = w(null), o = w(null), { handlers: s } = Tt({
2365
2386
  ref: o,
2366
2387
  onChange: t
2367
2388
  }), c = (n) => {
@@ -2375,12 +2396,12 @@ ${jt}
2375
2396
  e && e.removeEventListener("wheel", c);
2376
2397
  };
2377
2398
  }, [e]);
2378
- let l = e * 100, u = C(() => Math.round(i ? 0 : mt(r) * 100), [r, i]);
2379
- return /* @__PURE__ */ I(St, {
2399
+ let l = e * 100, u = C(() => Math.round(i ? 0 : gt(r) * 100), [r, i]);
2400
+ return /* @__PURE__ */ I(wt, {
2380
2401
  id: "volume-slider",
2381
2402
  text: /* @__PURE__ */ I("div", {
2382
2403
  ref: a,
2383
- css: Jt,
2404
+ css: Xt,
2384
2405
  ...s,
2385
2406
  children: /* @__PURE__ */ I("div", {
2386
2407
  ref: o,
@@ -2399,7 +2420,7 @@ ${jt}
2399
2420
  children: n(u / 100, { style: "percent" })
2400
2421
  })
2401
2422
  });
2402
- }, Xt = D`
2423
+ }, Qt = D`
2403
2424
  position: relative;
2404
2425
  display: flex;
2405
2426
  align-items: center;
@@ -2462,11 +2483,11 @@ ${jt}
2462
2483
  }
2463
2484
  }
2464
2485
 
2465
- `, Zt = ({ ref: e }) => {
2466
- let t = X(), { format: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), o = C(() => mt(r), [r]);
2486
+ `, $t = ({ ref: e }) => {
2487
+ let t = X(), { format: n } = Q(), r = X((e) => e.volume), i = X((e) => e.muted), o = C(() => gt(r), [r]);
2467
2488
  return /* @__PURE__ */ L("div", {
2468
- css: Xt,
2469
- children: [/* @__PURE__ */ I(St, {
2489
+ css: Qt,
2490
+ children: [/* @__PURE__ */ I(wt, {
2470
2491
  id: "sound",
2471
2492
  text: /* @__PURE__ */ I("button", {
2472
2493
  className: "sound",
@@ -2475,7 +2496,7 @@ ${jt}
2475
2496
  ref: e,
2476
2497
  "aria-label": n(a.mute),
2477
2498
  "aria-pressed": i || r === 0,
2478
- children: I(i || r === 0 ? ie : r <= .5 ? J : Y, {
2499
+ children: I(i || r === 0 ? ae : r <= .5 ? q : J, {
2479
2500
  size: 18,
2480
2501
  color: "#fff"
2481
2502
  })
@@ -2485,16 +2506,16 @@ ${jt}
2485
2506
  className: "volume-slider-container",
2486
2507
  children: /* @__PURE__ */ I("div", {
2487
2508
  className: "volume-slider-background",
2488
- children: /* @__PURE__ */ I(Yt, {
2509
+ children: /* @__PURE__ */ I(Zt, {
2489
2510
  value: i ? 0 : o,
2490
2511
  onChange: (e) => {
2491
- t.setVolume(pt(e));
2512
+ t.setVolume(ht(e));
2492
2513
  }
2493
2514
  })
2494
2515
  })
2495
2516
  })]
2496
2517
  });
2497
- }, Qt = .05, $t = 5, en = 50, tn = 1e3, nn = D`
2518
+ }, en = .05, tn = 5, nn = 50, rn = 1e3, an = D`
2498
2519
  position: absolute;
2499
2520
  bottom: 0;
2500
2521
  width: 100%;
@@ -2586,7 +2607,7 @@ ${jt}
2586
2607
  /* .armed is the hover of a control letting its click through, which takes no pointer events
2587
2608
  of its own and so is never :hover */
2588
2609
  :hover, &.armed {
2589
- background-color: ${qt.hover};
2610
+ background-color: ${Yt.hover};
2590
2611
  }
2591
2612
 
2592
2613
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -2624,12 +2645,12 @@ ${jt}
2624
2645
  }
2625
2646
  }
2626
2647
  }
2627
- `, rn = ({ shortcuts: e = "window", root: t, fullscreen: n }) => {
2648
+ `, on = ({ shortcuts: e = "window", root: t, fullscreen: n }) => {
2628
2649
  let r = X(), { format: i } = Q(), o = X((e) => e.paused), s = X((e) => e.currentTime), c = X((e) => e.duration), l = X((e) => e.seekingTo), u = X((e) => e.fullscreen), d = n ? n.active : u, f = w(n);
2629
2650
  f.current = n;
2630
2651
  let p = X((e) => e.hideUI), m = X((e) => e.togglePictureInPicture), h = X((e) => e.pictureInPictureMode), g = X((e) => e.burnedInSubtitles), _ = X((e) => e.passThroughPictureInPicture), v = X((e) => e.subtitleTracks), y = X((e) => e.requestSeek), x = X((e) => e.stepFrame), [C, E] = T(null), D = w(null), O = w(void 0), k = h === "burn-in", A = v.length > 0, j = c > 0 && s === c, M = b(({ direction: e, stepSize: t }) => {
2631
- let n = mt(r.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, n + i)), o = r.muted;
2632
- r.setVolume(pt(a)), o && !r.muted && r.toggleMuted();
2652
+ let n = gt(r.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, n + i)), o = r.muted;
2653
+ r.setVolume(ht(a)), o && !r.muted && r.toggleMuted();
2633
2654
  }, [r]), N = w(!1), P = b(() => {
2634
2655
  f.current ? f.current.request() : r.toggleFullscreen();
2635
2656
  }, [r]);
@@ -2648,16 +2669,16 @@ ${jt}
2648
2669
  else if (a.key === "m") r.toggleMuted();
2649
2670
  else if (a.key === "ArrowUp") M({
2650
2671
  direction: "up",
2651
- stepSize: Qt
2672
+ stepSize: en
2652
2673
  });
2653
2674
  else if (a.key === "ArrowDown") M({
2654
2675
  direction: "down",
2655
- stepSize: Qt
2676
+ stepSize: en
2656
2677
  });
2657
2678
  else if (a.key === "ArrowRight") {
2658
2679
  if (!r.duration) return;
2659
- n(Math.min(r.currentTime + $t, r.duration));
2660
- } else a.key === "ArrowLeft" ? n(Math.max(r.currentTime - $t, 0)) : (a.key === "<" || a.key === ">") && x ? x(a.key === ">" ? 1 : -1) : l = !1;
2680
+ n(Math.min(r.currentTime + tn, r.duration));
2681
+ } else a.key === "ArrowLeft" ? n(Math.max(r.currentTime - tn, 0)) : (a.key === "<" || a.key === ">") && x ? x(a.key === ">" ? 1 : -1) : l = !1;
2661
2682
  l && a.preventDefault();
2662
2683
  };
2663
2684
  return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
@@ -2675,10 +2696,10 @@ ${jt}
2675
2696
  let F = b((e) => {
2676
2697
  e.preventDefault(), e.deltaY < 0 ? M({
2677
2698
  direction: "up",
2678
- stepSize: Qt
2699
+ stepSize: en
2679
2700
  }) : M({
2680
2701
  direction: "down",
2681
- stepSize: Qt
2702
+ stepSize: en
2682
2703
  });
2683
2704
  }, [M]);
2684
2705
  S(() => {
@@ -2704,23 +2725,23 @@ ${jt}
2704
2725
  }
2705
2726
  let n = D.current, r = document.activeElement;
2706
2727
  n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
2707
- }, en);
2728
+ }, nn);
2708
2729
  return O.current = t, () => {
2709
- e = Date.now() + tn;
2730
+ e = Date.now() + rn;
2710
2731
  };
2711
2732
  }, [z]), S(() => () => clearInterval(O.current), []), /* @__PURE__ */ L("div", {
2712
2733
  className: "control-bar",
2713
- css: nn,
2734
+ css: an,
2714
2735
  style: { ...p ? {
2715
2736
  opacity: "0",
2716
2737
  pointerEvents: "none"
2717
2738
  } : z ? { pointerEvents: "none" } : {} },
2718
- children: [/* @__PURE__ */ I(Et, {}), /* @__PURE__ */ L("div", {
2739
+ children: [/* @__PURE__ */ I(Ot, {}), /* @__PURE__ */ L("div", {
2719
2740
  className: "actions",
2720
2741
  children: [/* @__PURE__ */ L("div", {
2721
2742
  className: "left",
2722
2743
  children: [
2723
- /* @__PURE__ */ I(St, {
2744
+ /* @__PURE__ */ I(wt, {
2724
2745
  id: "play",
2725
2746
  tooltipPlace: "top-start",
2726
2747
  text: /* @__PURE__ */ I("button", {
@@ -2728,23 +2749,23 @@ ${jt}
2728
2749
  type: "button",
2729
2750
  onClick: () => r.togglePaused(),
2730
2751
  "aria-label": i(j ? a.replay : o ? a.play : a.pause),
2731
- children: I(j ? q : o ? K : te, {})
2752
+ children: I(j ? G : o ? W : re, {})
2732
2753
  }),
2733
2754
  toolTipText: /* @__PURE__ */ I("span", { children: i(j ? a.replayKey : o ? a.playKey : a.pauseKey) })
2734
2755
  }),
2735
- /* @__PURE__ */ I(Zt, { ref: E }),
2756
+ /* @__PURE__ */ I($t, { ref: E }),
2736
2757
  /* @__PURE__ */ I("div", {
2737
2758
  className: "time",
2738
- children: gt(l ?? s, c)
2759
+ children: vt(l ?? s, c)
2739
2760
  })
2740
2761
  ]
2741
2762
  }), /* @__PURE__ */ L("div", {
2742
2763
  className: "right",
2743
2764
  children: [
2744
- /* @__PURE__ */ I(zt, {}),
2765
+ /* @__PURE__ */ I(Vt, {}),
2766
+ /* @__PURE__ */ I(Jt, {}),
2745
2767
  /* @__PURE__ */ I(Kt, {}),
2746
- /* @__PURE__ */ I(Wt, {}),
2747
- _ ? /* @__PURE__ */ I(St, {
2768
+ _ ? /* @__PURE__ */ I(wt, {
2748
2769
  id: "picture-in-picture",
2749
2770
  tooltipPlace: "top-end",
2750
2771
  text: /* @__PURE__ */ I("button", {
@@ -2757,12 +2778,12 @@ ${jt}
2757
2778
  "aria-label": i(a.pictureInPicture),
2758
2779
  "aria-pressed": _.active,
2759
2780
  children: /* @__PURE__ */ I("img", {
2760
- src: Dt,
2781
+ src: kt,
2761
2782
  alt: ""
2762
2783
  })
2763
2784
  }),
2764
2785
  toolTipText: /* @__PURE__ */ I("span", { children: i(_.active ? a.exitPictureInPicture : a.pictureInPicture) })
2765
- }) : m ? /* @__PURE__ */ I(St, {
2786
+ }) : m ? /* @__PURE__ */ I(wt, {
2766
2787
  id: "picture-in-picture",
2767
2788
  tooltipPlace: "top-end",
2768
2789
  text: /* @__PURE__ */ I("button", {
@@ -2772,14 +2793,14 @@ ${jt}
2772
2793
  disabled: k && !A,
2773
2794
  "aria-label": i(k ? a.burnIn : a.pictureInPicture),
2774
2795
  "aria-pressed": k ? g : void 0,
2775
- children: k ? I(g ? kt : At, {}) : /* @__PURE__ */ I("img", {
2776
- src: Dt,
2796
+ children: k ? I(g ? jt : Mt, {}) : /* @__PURE__ */ I("img", {
2797
+ src: kt,
2777
2798
  alt: ""
2778
2799
  })
2779
2800
  }),
2780
2801
  toolTipText: /* @__PURE__ */ I("span", { children: i(k ? A ? g ? a.burnedIn : a.burnInOffer : a.noSubtitles : a.pictureInPicture) })
2781
2802
  }) : null,
2782
- /* @__PURE__ */ I(St, {
2803
+ /* @__PURE__ */ I(wt, {
2783
2804
  id: "full-screen",
2784
2805
  tooltipPlace: "top-end",
2785
2806
  text: /* @__PURE__ */ I("button", {
@@ -2788,7 +2809,7 @@ ${jt}
2788
2809
  onClick: P,
2789
2810
  "aria-label": i(a.fullScreen),
2790
2811
  "aria-pressed": d,
2791
- children: I(d ? G : W, {})
2812
+ children: I(d ? ne : te, {})
2792
2813
  }),
2793
2814
  toolTipText: /* @__PURE__ */ I("span", { children: i(d ? a.exitFullScreenKey : a.fullScreenKey) })
2794
2815
  })
@@ -2796,7 +2817,7 @@ ${jt}
2796
2817
  })]
2797
2818
  })]
2798
2819
  });
2799
- }, an = 9e3, on = D`
2820
+ }, sn = 9e3, cn = D`
2800
2821
  position: absolute;
2801
2822
  inset: 0;
2802
2823
  z-index: 2;
@@ -2839,7 +2860,7 @@ ${jt}
2839
2860
  line-height: 1;
2840
2861
  color: #fff;
2841
2862
  }
2842
- `, sn = () => {
2863
+ `, ln = () => {
2843
2864
  let { format: e } = Q(), t = X((e) => e.burnedInSubtitles), n = X((e) => e.pictureInPictureMode), [r, i] = T(!1);
2844
2865
  return S(() => {
2845
2866
  if (n !== "burn-in" || !t) {
@@ -2847,10 +2868,10 @@ ${jt}
2847
2868
  return;
2848
2869
  }
2849
2870
  i(!0);
2850
- let e = setTimeout(() => i(!1), an);
2871
+ let e = setTimeout(() => i(!1), sn);
2851
2872
  return () => clearTimeout(e);
2852
2873
  }, [n, t]), n !== "burn-in" || !t ? null : /* @__PURE__ */ I("div", {
2853
- css: on,
2874
+ css: cn,
2854
2875
  className: r ? "show" : "",
2855
2876
  role: "status",
2856
2877
  children: /* @__PURE__ */ L("div", {
@@ -2865,10 +2886,10 @@ ${jt}
2865
2886
  })]
2866
2887
  })
2867
2888
  });
2868
- }, cn = 1, ln = 6e3, un = 1, dn = {
2889
+ }, un = 1, dn = 6e3, fn = 1, pn = {
2869
2890
  opening: a.skipOpening,
2870
2891
  ending: a.skipEnding
2871
- }, fn = D`
2892
+ }, mn = D`
2872
2893
  position: absolute;
2873
2894
  inset: 0;
2874
2895
  z-index: 2;
@@ -2919,13 +2940,13 @@ ${jt}
2919
2940
  bottom: calc(9 * var(--mp-unit));
2920
2941
  }
2921
2942
  }
2922
- `, pn = ({ endingOffered: e }) => {
2943
+ `, hn = ({ endingOffered: e }) => {
2923
2944
  let t = X((e) => e.chapters), n = X((e) => e.currentTime), r = X((e) => e.requestSeek), i = X((e) => e.seekPreview), a = X(), { format: o } = Q(), s = C(() => {
2924
2945
  let n = h(t), r = e ? -1 : n.lastIndexOf("ending");
2925
2946
  return n.map((e, t) => t === r ? void 0 : e);
2926
2947
  }, [t, e]), c = C(() => {
2927
2948
  if (typeof n != "number") return;
2928
- let e = t.findIndex((e, t) => s[t] !== void 0 && e.start - cn <= n && n < e.end), r = e >= 0 ? s[e] : void 0;
2949
+ let e = t.findIndex((e, t) => s[t] !== void 0 && e.start - un <= n && n < e.end), r = e >= 0 ? s[e] : void 0;
2929
2950
  return r ? {
2930
2951
  kind: r,
2931
2952
  end: t[e].end
@@ -2937,7 +2958,7 @@ ${jt}
2937
2958
  ]), l = w(0), [u, d] = T(0);
2938
2959
  S(() => {
2939
2960
  let e = typeof n == "number" ? n : 0, t = l.current;
2940
- l.current = e, e < t - un && d((e) => e + 1);
2961
+ l.current = e, e < t - fn && d((e) => e + 1);
2941
2962
  }, [n]);
2942
2963
  let [f, p] = T(!1), m = c ? `${c.kind}@${c.end}` : "";
2943
2964
  return S(() => {
@@ -2946,12 +2967,12 @@ ${jt}
2946
2967
  return;
2947
2968
  }
2948
2969
  p(!0);
2949
- let e = setTimeout(() => p(!1), ln);
2970
+ let e = setTimeout(() => p(!1), dn);
2950
2971
  return () => clearTimeout(e);
2951
2972
  }, [m, u]), S(() => {
2952
2973
  c || p(!1);
2953
2974
  }, [c]), c ? /* @__PURE__ */ I("div", {
2954
- css: fn,
2975
+ css: mn,
2955
2976
  className: f && !i ? "show" : "",
2956
2977
  children: /* @__PURE__ */ I("button", {
2957
2978
  type: "button",
@@ -2959,10 +2980,10 @@ ${jt}
2959
2980
  onClick: () => {
2960
2981
  p(!1), r ? r(c.end) : a.seek(c.end);
2961
2982
  },
2962
- children: o(dn[c.kind])
2983
+ children: o(pn[c.kind])
2963
2984
  })
2964
2985
  }) : null;
2965
- }, mn = 3e3, hn = D`
2986
+ }, gn = 3e3, _n = D`
2966
2987
  position: absolute;
2967
2988
  inset: 0;
2968
2989
  z-index: 2;
@@ -2973,10 +2994,10 @@ ${jt}
2973
2994
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
2974
2995
  not, and transitioning it holds the item on screen for the length of the fade. */
2975
2996
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
2976
- `, gn = (e, t) => {
2997
+ `, vn = (e, t) => {
2977
2998
  let n = e.left - t.left, r = e.top - t.top;
2978
2999
  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')`;
2979
- }, _n = D`
3000
+ }, yn = D`
2980
3001
  position: relative;
2981
3002
  background-color: black;
2982
3003
  display: flex;
@@ -3033,13 +3054,13 @@ ${jt}
3033
3054
  &.hide {
3034
3055
  cursor: none;
3035
3056
  }
3036
- `, vn = (e, t = "") => g.toArray(e).flatMap((e, n) => {
3057
+ `, bn = (e, t = "") => g.toArray(e).flatMap((e, n) => {
3037
3058
  let r = `${t}${y(e) && e.key != null ? e.key : n}`;
3038
- return y(e) && e.type === _ ? vn(e.props.children, `${r}/`) : [{
3059
+ return y(e) && e.type === _ ? bn(e.props.children, `${r}/`) : [{
3039
3060
  key: r,
3040
3061
  item: e
3041
3062
  }];
3042
- }), yn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o, endingOffered: s, children: c }) => {
3063
+ }), xn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o, endingOffered: s, children: c }) => {
3043
3064
  let l = X(), u = X((e) => e.hideUI), d = X((e) => e.setHideUI), f = X((e) => e.hasMedia), p = X((e) => e.passThroughPictureInPicture), m = w(void 0), h = w("mouse"), g = w({
3044
3065
  x: -1,
3045
3066
  y: -1
@@ -3065,12 +3086,12 @@ ${jt}
3065
3086
  return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
3066
3087
  }, C = () => {
3067
3088
  if (x()) {
3068
- m.current = setTimeout(C, mn);
3089
+ m.current = setTimeout(C, gn);
3069
3090
  return;
3070
3091
  }
3071
3092
  y();
3072
3093
  }, T = () => {
3073
- d(!1), clearTimeout(m.current), m.current = setTimeout(C, mn);
3094
+ d(!1), clearTimeout(m.current), m.current = setTimeout(C, gn);
3074
3095
  }, E = (e) => {
3075
3096
  h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
3076
3097
  x: e.clientX,
@@ -3082,7 +3103,7 @@ ${jt}
3082
3103
  _.current = !1;
3083
3104
  }, k = w(!0);
3084
3105
  return /* @__PURE__ */ L("div", {
3085
- css: _n,
3106
+ css: yn,
3086
3107
  ref: b,
3087
3108
  onPointerMove: E,
3088
3109
  onPointerDown: D,
@@ -3097,9 +3118,9 @@ ${jt}
3097
3118
  className: u ? "hide" : "",
3098
3119
  tabIndex: a === "player" ? -1 : void 0,
3099
3120
  children: [
3100
- /* @__PURE__ */ I(ut, { onSubtitleRef: n }),
3101
- vn(r).map(({ key: e, item: t }) => /* @__PURE__ */ I("div", {
3102
- css: hn,
3121
+ /* @__PURE__ */ I(ft, { onSubtitleRef: n }),
3122
+ bn(r).map(({ key: e, item: t }) => /* @__PURE__ */ I("div", {
3123
+ css: _n,
3103
3124
  style: { ...u ? {
3104
3125
  opacity: "0",
3105
3126
  visibility: "hidden",
@@ -3107,19 +3128,19 @@ ${jt}
3107
3128
  } : {} },
3108
3129
  children: t
3109
3130
  }, e)),
3110
- i === !1 ? null : /* @__PURE__ */ I(xt, {
3131
+ i === !1 ? null : /* @__PURE__ */ I(Ct, {
3111
3132
  value: !!o,
3112
- children: /* @__PURE__ */ I(rn, {
3133
+ children: /* @__PURE__ */ I(on, {
3113
3134
  shortcuts: a,
3114
3135
  root: v,
3115
3136
  fullscreen: o
3116
3137
  })
3117
3138
  }),
3118
- /* @__PURE__ */ I(sn, {}),
3119
- /* @__PURE__ */ I(pn, { endingOffered: s }),
3139
+ /* @__PURE__ */ I(ln, {}),
3140
+ /* @__PURE__ */ I(hn, { endingOffered: s }),
3120
3141
  p?.armed && v.current ? /* @__PURE__ */ I("div", {
3121
3142
  className: "pass-through",
3122
- style: { clipPath: gn(p.armed, v.current.getBoundingClientRect()) },
3143
+ style: { clipPath: vn(p.armed, v.current.getBoundingClientRect()) },
3123
3144
  onPointerOver: p.disarm
3124
3145
  }) : null,
3125
3146
  /* @__PURE__ */ L("div", {
@@ -3142,24 +3163,28 @@ ${jt}
3142
3163
  })
3143
3164
  ]
3144
3165
  });
3145
- }, bn = (e, t) => ({ title: e.options.find((e) => e.id === t)?.label }), xn = (e, t) => e instanceof Promise ? e.then(t) : t(), Sn = ({ options: e, children: t }) => {
3166
+ }, Sn = (e, t) => ({ title: e.options.find((e) => e.id === t)?.label }), Cn = (e, t) => e instanceof Promise ? e.then(t) : t(), wn = ({ options: e, children: t }) => {
3146
3167
  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: f, thumbnailRead: p, thumbnailsEnabled: m, readsDownload: h } = r ?? {}, g = j(), _ = A(), [v, y] = T(null), [b, x] = T(null), E = n?.media ?? v;
3147
3168
  S(() => (g?.(E), () => g?.(null)), [E, g]), Pe(E, n?.stepFrame);
3148
- let { expose: D } = e, [O, k] = T(null), [M, N] = T(!0), [P] = T(() => Object.assign(new EventTarget(), {
3169
+ let { expose: D } = e, [O, k] = T(null), [M, N] = T(!0), [P, F] = T(null), [L, R] = T(e.autoplayNext), [z] = T(() => Object.assign(new EventTarget(), {
3149
3170
  chapters: [],
3150
3171
  endingOffered: !0,
3172
+ autoplayNext: null,
3151
3173
  onHostFullscreen: k,
3152
- onEndingOffered: N
3153
- })), F = D === !0 ? {} : D || void 0, L = w(F);
3154
- L.current = F;
3155
- let R = F ? F.id : void 0, z = F ? F.origin : void 0, B = F ? F.channel : void 0;
3174
+ onEndingOffered: N,
3175
+ onAutoplayNext: (e) => {
3176
+ F(e), e !== null && R(e);
3177
+ }
3178
+ })), B = D === !0 ? {} : D || void 0, V = w(B);
3179
+ V.current = B;
3180
+ let H = B ? B.id : void 0, ee = B ? B.origin : void 0, U = B ? B.channel : void 0;
3156
3181
  S(() => {
3157
3182
  if (!D || !E) return;
3158
3183
  let e, t = !1;
3159
3184
  return import("./remote/index.js").then(({ exposePlayer: n }) => {
3160
3185
  t || (e = n(E, {
3161
- ...L.current,
3162
- player: P
3186
+ ...V.current,
3187
+ player: z
3163
3188
  }));
3164
3189
  }).catch(() => {}), () => {
3165
3190
  t = !0, e?.();
@@ -3167,155 +3192,170 @@ ${jt}
3167
3192
  }, [
3168
3193
  E,
3169
3194
  !!D,
3170
- R,
3171
- z,
3172
- B
3195
+ H,
3196
+ ee,
3197
+ U
3173
3198
  ]);
3174
- let V = X((e) => e.chapters), H = JSON.stringify(V);
3199
+ let te = X((e) => e.chapters), ne = JSON.stringify(te);
3200
+ S(() => {
3201
+ z.chapters = te, z.endingOffered = M, z.dispatchEvent(new Event("chapterschange"));
3202
+ }, [ne, M]);
3203
+ let re = e.autoplayNext;
3175
3204
  S(() => {
3176
- P.chapters = V, P.endingOffered = M, P.dispatchEvent(new Event("chapterschange"));
3177
- }, [H, M]);
3178
- let ee = e.fullscreen ?? (O === null ? void 0 : {
3205
+ P === null && R(re);
3206
+ }, [re, P]);
3207
+ let W = w(e.onAutoplayNextChange);
3208
+ W.current = e.onAutoplayNextChange, S(() => {
3209
+ z.autoplayNext = L ?? null, z.dispatchEvent(new Event("autoplaynextchange"));
3210
+ }, [L]);
3211
+ let G = e.fullscreen ?? (O === null ? void 0 : {
3179
3212
  active: O,
3180
- request: () => P.dispatchEvent(new Event("fullscreenrequest"))
3181
- }), U = C(() => tt(), [o]);
3182
- Ae(v, b, r, h ? U.push : void 0);
3183
- let W = r?.normalizeVolume ?? !0, [G, te] = T(W);
3213
+ request: () => z.dispatchEvent(new Event("fullscreenrequest"))
3214
+ }), K = C(() => rt(), [o]);
3215
+ Ae(v, b, r, h ? K.push : void 0);
3216
+ let ie = r?.normalizeVolume ?? !0, [q, J] = T(ie);
3184
3217
  S(() => {
3185
- te(W);
3186
- }, [W]);
3187
- let K = w(r?.onNormalizeVolumeChange);
3188
- K.current = r?.onNormalizeVolumeChange;
3189
- let q = r?.normalizerWorkletUrl, ne = w(p ?? f);
3190
- ne.current = p ?? f;
3191
- let re = X((e) => e.selectedAudioTrack), J = !!f, { refused: Y } = et(v, q, G, C(() => J && o && c && l && typeof re == "number" && re >= 0 ? h ? {
3192
- tap: U,
3193
- audioStreamIndex: re
3218
+ J(ie);
3219
+ }, [ie]);
3220
+ let ae = w(r?.onNormalizeVolumeChange);
3221
+ ae.current = r?.onNormalizeVolumeChange;
3222
+ let oe = r?.normalizerWorkletUrl, se = w(p ?? f);
3223
+ se.current = p ?? f;
3224
+ let Y = X((e) => e.selectedAudioTrack), ce = !!f, { refused: le } = nt(v, oe, q, C(() => ce && o && c && l && typeof Y == "number" && Y >= 0 ? h ? {
3225
+ tap: K,
3226
+ audioStreamIndex: Y
3194
3227
  } : {
3195
- read: (e, t) => ne.current(e, t),
3228
+ read: (e, t) => se.current(e, t),
3196
3229
  length: o,
3197
3230
  publicPath: c,
3198
3231
  libavWorkerUrl: l,
3199
- audioStreamIndex: re
3232
+ audioStreamIndex: Y
3200
3233
  } : void 0, [
3201
- J,
3234
+ ce,
3202
3235
  o,
3203
3236
  c,
3204
3237
  l,
3205
- re,
3238
+ Y,
3206
3239
  h,
3207
- U
3208
- ]), C(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), ie = C(() => q && typeof AudioWorkletNode == "function" ? {
3209
- enabled: G,
3210
- available: !Y,
3240
+ K
3241
+ ]), C(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), ue = C(() => oe && typeof AudioWorkletNode == "function" ? {
3242
+ enabled: q,
3243
+ available: !le,
3211
3244
  setEnabled: (e) => {
3212
- te(e), K.current?.(e);
3245
+ J(e), ae.current?.(e);
3213
3246
  }
3214
3247
  } : null, [
3248
+ oe,
3215
3249
  q,
3216
- G,
3217
- Y
3218
- ]), { thumbnails: ae, requestThumbnail: oe } = Le({
3250
+ le
3251
+ ]), { thumbnails: de, requestThumbnail: fe } = ze({
3219
3252
  publicPath: c,
3220
3253
  workerUrl: l,
3221
3254
  length: m === !1 ? void 0 : o,
3222
3255
  read: p ?? f,
3223
3256
  downloadedRanges: s
3224
- }), se = n?.thumbnails?.all ?? ae, { toggle: ce, mode: le, burnedIn: ue } = Re(v, b), de = We(n?.media ?? null, n?.pictureInPicture), Z = X((e) => e.setSourceState), fe = n ? !!n.media : o !== void 0;
3257
+ }), pe = n?.thumbnails?.all ?? de, { toggle: me, mode: he, burnedIn: ge } = Be(v, b), _e = Ke(n?.media ?? null, n?.pictureInPicture), Z = X((e) => e.setSourceState), ve = n ? !!n.media : o !== void 0;
3225
3258
  S(() => {
3226
3259
  Z({
3227
3260
  title: i,
3228
3261
  size: o,
3229
3262
  downloadedRanges: s,
3230
- hasMedia: fe
3263
+ hasMedia: ve
3231
3264
  });
3232
3265
  }, [
3233
3266
  Z,
3234
3267
  i,
3235
3268
  o,
3236
3269
  s,
3237
- fe
3270
+ ve
3238
3271
  ]);
3239
- let pe = n?.thumbnails?.at;
3272
+ let Q = n?.thumbnails?.at;
3240
3273
  S(() => {
3241
3274
  Z({
3242
- thumbnails: se,
3243
- thumbnailAt: pe,
3244
- requestThumbnail: oe,
3245
- togglePictureInPicture: ce,
3246
- pictureInPictureMode: le,
3247
- burnedInSubtitles: ue
3275
+ thumbnails: pe,
3276
+ thumbnailAt: Q,
3277
+ requestThumbnail: fe,
3278
+ togglePictureInPicture: me,
3279
+ pictureInPictureMode: he,
3280
+ burnedInSubtitles: ge
3248
3281
  });
3249
3282
  }, [
3250
3283
  Z,
3251
- se,
3252
3284
  pe,
3253
- oe,
3254
- ce,
3255
- le,
3256
- ue
3285
+ Q,
3286
+ fe,
3287
+ me,
3288
+ he,
3289
+ ge
3257
3290
  ]), S(() => {
3258
- Z({ volumeNormalizer: ie });
3259
- }, [Z, ie]), S(() => {
3260
- Z({ passThroughPictureInPicture: de });
3261
- }, [Z, de]);
3262
- let me = n?.subtitles?.selection, he = n?.audioTracks?.selection, ge = w({
3291
+ Z({ volumeNormalizer: ue });
3292
+ }, [Z, ue]), S(() => {
3293
+ Z({ autoplayNext: L === void 0 ? null : {
3294
+ enabled: L,
3295
+ setEnabled: (e) => {
3296
+ R(e), W.current?.(e);
3297
+ }
3298
+ } });
3299
+ }, [Z, L]), S(() => {
3300
+ Z({ passThroughPictureInPicture: _e });
3301
+ }, [Z, _e]);
3302
+ let ye = n?.subtitles?.selection, be = n?.audioTracks?.selection, xe = w({
3263
3303
  options: e,
3264
- audio: he
3304
+ audio: be
3265
3305
  });
3266
- ge.current = {
3306
+ xe.current = {
3267
3307
  options: e,
3268
- audio: he
3308
+ audio: be
3269
3309
  }, S(() => {
3270
- me && Z({
3271
- subtitleTracks: me.options.map(({ id: e, label: t, disabled: n }) => ({
3310
+ ye && Z({
3311
+ subtitleTracks: ye.options.map(({ id: e, label: t, disabled: n }) => ({
3272
3312
  id: e,
3273
3313
  label: t,
3274
3314
  disabled: n
3275
3315
  })),
3276
- selectedSubtitleTrack: me.selectedId ?? void 0,
3316
+ selectedSubtitleTrack: ye.selectedId ?? void 0,
3277
3317
  selectSubtitleTrack: (e) => {
3278
- let t = e == null ? null : String(e), n = t === null ? void 0 : bn(me, t), r = me.selectedId === null;
3279
- return xn(me.select(t), () => {
3280
- let e = t === null ? null : u(n) ?? (r ? n?.title : void 0), i = ge.current;
3318
+ let t = e == null ? null : String(e), n = t === null ? void 0 : Sn(ye, t), r = ye.selectedId === null;
3319
+ return Cn(ye.select(t), () => {
3320
+ let e = t === null ? null : u(n) ?? (r ? n?.title : void 0), i = xe.current;
3281
3321
  e !== void 0 && i.options.onPreferredSubtitleLanguageChange?.(e);
3282
- let a = i.audio && bn(i.audio, i.audio.selectedId ?? "");
3322
+ let a = i.audio && Sn(i.audio, i.audio.selectedId ?? "");
3283
3323
  e && d(a, e) && i.options.onAlwaysShowSubtitlesChange?.(!0);
3284
3324
  });
3285
3325
  },
3286
- subtitleOffLabel: me.offLabel
3326
+ subtitleOffLabel: ye.offLabel
3287
3327
  });
3288
- }, [Z, me]), S(() => {
3289
- he && Z({
3290
- audioTracks: he.options.map(({ id: e, label: t, disabled: n }) => ({
3328
+ }, [Z, ye]), S(() => {
3329
+ be && Z({
3330
+ audioTracks: be.options.map(({ id: e, label: t, disabled: n }) => ({
3291
3331
  id: e,
3292
3332
  label: t,
3293
3333
  disabled: n
3294
3334
  })),
3295
- selectedAudioTrack: he.selectedId ?? void 0,
3296
- selectAudioTrack: (e) => xn(he.select(String(e)), () => {
3297
- let t = u(bn(he, String(e)));
3298
- t !== void 0 && ge.current.options.onPreferredAudioLanguageChange?.(t);
3335
+ selectedAudioTrack: be.selectedId ?? void 0,
3336
+ selectAudioTrack: (e) => Cn(be.select(String(e)), () => {
3337
+ let t = u(Sn(be, String(e)));
3338
+ t !== void 0 && xe.current.options.onPreferredAudioLanguageChange?.(t);
3299
3339
  })
3300
3340
  });
3301
- }, [Z, he]);
3302
- let _e = n?.quality?.selection ?? null;
3341
+ }, [Z, be]);
3342
+ let Se = n?.quality?.selection ?? null;
3303
3343
  return S(() => {
3304
- Z({ quality: _e });
3305
- }, [Z, _e]), S(() => {
3344
+ Z({ quality: Se });
3345
+ }, [Z, Se]), S(() => {
3306
3346
  a && Z({ chapters: a });
3307
- }, [Z, a]), /* @__PURE__ */ I(yn, {
3347
+ }, [Z, a]), /* @__PURE__ */ I(xn, {
3308
3348
  ref: _,
3309
3349
  onVideoRef: n ? void 0 : y,
3310
3350
  onSubtitleRef: x,
3311
3351
  overlay: e.overlay,
3312
3352
  controls: e.controls,
3313
3353
  shortcuts: e.shortcuts,
3314
- fullscreen: ee,
3354
+ fullscreen: G,
3315
3355
  endingOffered: M,
3316
3356
  children: t
3317
3357
  });
3318
- }, Cn = D`
3358
+ }, Tn = D`
3319
3359
  /**
3320
3360
  * The chrome's whole scale, in one place.
3321
3361
  *
@@ -3385,20 +3425,20 @@ ${jt}
3385
3425
  height: 100%;
3386
3426
  width: 100%;
3387
3427
  overflow: hidden;
3388
- `, wn = (e) => /* @__PURE__ */ I("div", {
3389
- css: Cn,
3428
+ `, En = (e) => /* @__PURE__ */ I("div", {
3429
+ css: Tn,
3390
3430
  children: /* @__PURE__ */ I(ce.Provider, { children: /* @__PURE__ */ I(ye, {
3391
3431
  language: e.language,
3392
- children: /* @__PURE__ */ I(Sn, {
3432
+ children: /* @__PURE__ */ I(wn, {
3393
3433
  options: e,
3394
3434
  children: e.children
3395
3435
  })
3396
3436
  }) })
3397
- }), Tn = (e) => !!e && typeof e == "object" && "at" in e, En = (e) => !!e && typeof e == "object" && "selection" in e, Dn = ({ blob: e, name: t }) => ({
3437
+ }), Dn = (e) => !!e && typeof e == "object" && "at" in e, On = (e) => !!e && typeof e == "object" && "selection" in e, kn = ({ blob: e, name: t }) => ({
3398
3438
  length: e.size,
3399
3439
  name: t ?? (e instanceof File ? e.name : void 0),
3400
3440
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
3401
- }), On = async (e, t) => {
3441
+ }), An = async (e, t) => {
3402
3442
  let n = await fetch(e, {
3403
3443
  headers: { Range: "bytes=0-1" },
3404
3444
  credentials: t
@@ -3408,8 +3448,8 @@ ${jt}
3408
3448
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
3409
3449
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
3410
3450
  return i;
3411
- }, kn = async ({ url: e, length: t, name: n, credentials: r }) => {
3412
- let i = t ?? await On(e, r);
3451
+ }, jn = async ({ url: e, length: t, name: n, credentials: r }) => {
3452
+ let i = t ?? await An(e, r);
3413
3453
  return {
3414
3454
  length: i,
3415
3455
  name: n,
@@ -3425,9 +3465,9 @@ ${jt}
3425
3465
  },
3426
3466
  readsDownload: !0
3427
3467
  };
3428
- }, An = async (e) => {
3429
- if ("blob" in e) return Dn(e);
3430
- if ("url" in e) return kn(e);
3468
+ }, Mn = async (e) => {
3469
+ if ("blob" in e) return kn(e);
3470
+ if ("url" in e) return jn(e);
3431
3471
  if ("read" in e) return {
3432
3472
  length: e.length,
3433
3473
  name: e.name,
@@ -3436,4 +3476,4 @@ ${jt}
3436
3476
  throw Error(`Unknown source type: ${e}`);
3437
3477
  };
3438
3478
  //#endregion
3439
- export { wn as MediaPlayer, wn as default, ce as Player, t as SUBTITLES_OFF, c as createPictureInPicture, l as createSubtitleRenderer, o as createThumbnailGenerator, An as inputToRemuxerInput, En as isDelegatedTracks, Tn as isExternalThumbnails, se as sourceFeature, s as startPlayback, Re as usePictureInPicture, X as usePlayer, Le as useSeekThumbnails };
3479
+ export { En as MediaPlayer, En as default, ce as Player, t as SUBTITLES_OFF, c as createPictureInPicture, l as createSubtitleRenderer, o as createThumbnailGenerator, Mn as inputToRemuxerInput, On as isDelegatedTracks, Dn as isExternalThumbnails, Y as sourceFeature, s as startPlayback, Be as usePictureInPicture, X as usePlayer, ze as useSeekThumbnails };