@banou/media-player 0.8.5 → 0.8.7

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,10 +1,10 @@
1
- import { i as e, n as t, o as n, s as r, t as i } from "./engine-Dmc7JSd9.js";
2
- import { Children as a, Fragment as o, isValidElement as s, useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
3
- import { css as p, keyframes as m } from "@emotion/react";
4
- import { createPlayer as h, useContainerAttach as g, useMediaAttach as _ } from "@videojs/react";
5
- import { definePlayerFeature as v, videoFeatures as y } from "@videojs/core/dom";
6
- import { Fragment as b, jsx as x, jsxs as S } from "@emotion/react/jsx-runtime";
7
- import { ChevronLeft as C, ChevronRight as w, Maximize as T, Minimize as E, Pause as D, Play as O, RotateCcw as k, Settings as A, Volume1 as j, Volume2 as ee, VolumeX as te } from "react-feather";
1
+ import { a as e, c as t, n, r, s as i, t as a } from "./engine-B6flRjLd.js";
2
+ import { Children as o, Fragment as s, isValidElement as c, useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
3
+ import { css as m, keyframes as h } from "@emotion/react";
4
+ import { createPlayer as g, useContainerAttach as _, useMediaAttach as v } from "@videojs/react";
5
+ import { definePlayerFeature as y, videoFeatures as b } from "@videojs/core/dom";
6
+ import { Fragment as x, jsx as S, jsxs as C } from "@emotion/react/jsx-runtime";
7
+ import { ChevronLeft as w, ChevronRight as T, Maximize as E, Minimize as D, Pause as O, Play as k, RotateCcw as A, Settings as j, Volume1 as M, Volume2 as ee, VolumeX as te } from "react-feather";
8
8
  import { Tooltip as ne } from "react-tooltip";
9
9
  //#region src/lib/react/source-feature.ts
10
10
  var re = {
@@ -19,10 +19,12 @@ var re = {
19
19
  hideUI: !1,
20
20
  setHideUI: () => {},
21
21
  togglePictureInPicture: null,
22
+ pictureInPictureMode: null,
23
+ burnedInSubtitles: !1,
22
24
  playbackError: null,
23
25
  ready: !1,
24
26
  setSourceState: () => {}
25
- }, M = v({
27
+ }, N = y({
26
28
  name: "source",
27
29
  state: () => ({ ...re }),
28
30
  attach({ set: e }) {
@@ -31,10 +33,10 @@ var re = {
31
33
  setHideUI: (t) => e({ hideUI: t })
32
34
  });
33
35
  }
34
- }), N = h({
35
- features: [...y, M],
36
+ }), P = g({
37
+ features: [...b, N],
36
38
  displayName: "MediaPlayer"
37
- }), P = N.usePlayer, ie = (e) => {
39
+ }), F = P.usePlayer, ie = (e) => {
38
40
  if (!(!e || e === "und")) try {
39
41
  return new Intl.DisplayNames([navigator.language || "en"], {
40
42
  type: "language",
@@ -43,35 +45,35 @@ var re = {
43
45
  } catch {
44
46
  return;
45
47
  }
46
- }, F = (e) => e?.replace(/_/g, " ").trim() || void 0, ae = (e) => {
47
- let t = e.map((e) => ie(e.language) ?? F(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
48
+ }, I = (e) => e?.replace(/_/g, " ").trim() || void 0, ae = (e) => {
49
+ let t = e.map((e) => ie(e.language) ?? I(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
48
50
  ...e,
49
51
  [t]: (e[t] ?? 0) + 1
50
52
  }), {});
51
53
  return e.map((e, r) => {
52
- let i = t[r], a = F(e.title);
54
+ let i = t[r], a = I(e.title);
53
55
  return {
54
56
  track: e,
55
57
  label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
56
58
  };
57
59
  });
58
- }, I = (e) => ae(e).map(({ track: e, label: t }) => ({
60
+ }, L = (e) => ae(e).map(({ track: e, label: t }) => ({
59
61
  id: e.streamIndex,
60
62
  label: t
61
63
  })), oe = (t, n, r) => {
62
- let i = P(), { read: a, size: o, publicPath: s = "", libavWorkerUrl: u = "", jassubWorkerUrl: p = "", jassubWasmUrl: m = "", jassubLegacyWasmUrl: h, defaultFontUrl: g, bufferSize: _, autoplay: v = !1 } = r ?? {}, [y, b] = f(void 0), x = d(null), S = d(0), C = d(!1), w = d(a);
64
+ let i = F(), { read: a, size: o, publicPath: s = "", libavWorkerUrl: c = "", jassubWorkerUrl: d = "", jassubWasmUrl: m = "", jassubLegacyWasmUrl: h, defaultFontUrl: g, bufferSize: _, autoplay: v = !1 } = r ?? {}, [y, b] = p(void 0), x = f(null), S = f(0), C = f(!1), w = f(a);
63
65
  w.current = a;
64
- let T = d(r?.onSeek);
66
+ let T = f(r?.onSeek);
65
67
  T.current = r?.onSeek;
66
- let E = d(r?.onPlaybackError);
68
+ let E = f(r?.onPlaybackError);
67
69
  E.current = r?.onPlaybackError;
68
- let D = c((e) => {
70
+ let D = l((e) => {
69
71
  let t = typeof e == "number" ? e : void 0;
70
72
  C.current = !0, i.setSourceState({ selectedSubtitleTrack: t }), x.current?.selectSubtitleStream(t);
71
- }, [i]), O = c((e) => {
73
+ }, [i]), O = l((e) => {
72
74
  typeof e == "number" && (i.setSourceState({ selectedAudioTrack: e }), b(e));
73
- }, [i]), k = P((e) => e.setSourceState);
74
- l(() => {
75
+ }, [i]), k = F((e) => e.setSourceState);
76
+ u(() => {
75
77
  k({
76
78
  selectSubtitleTrack: D,
77
79
  selectAudioTrack: O
@@ -80,14 +82,14 @@ var re = {
80
82
  k,
81
83
  D,
82
84
  O
83
- ]), l(() => {
85
+ ]), u(() => {
84
86
  if (!t || !n || !o || !a) return;
85
87
  let r = !1;
86
88
  i.setSourceState({
87
89
  playbackError: null,
88
90
  ready: !1
89
91
  });
90
- let c = (e) => {
92
+ let l = (e) => {
91
93
  r || (console.error("playback failed", e), i.setSourceState({ playbackError: e }), E.current?.(e));
92
94
  };
93
95
  return (async () => {
@@ -98,8 +100,8 @@ var re = {
98
100
  read: (e, t) => w.current(e, t),
99
101
  length: o,
100
102
  publicPath: s,
101
- libavWorkerUrl: u,
102
- jassubWorkerUrl: p,
103
+ libavWorkerUrl: c,
104
+ jassubWorkerUrl: d,
103
105
  jassubWasmUrl: m,
104
106
  jassubLegacyWasmUrl: h,
105
107
  defaultFontUrl: g,
@@ -108,20 +110,20 @@ var re = {
108
110
  onReady: () => {
109
111
  r || (i.setSourceState({ ready: !0 }), S.current > 0 && (t.currentTime = S.current, S.current = 0), v && t.play().catch(() => {}));
110
112
  },
111
- onError: c,
113
+ onError: l,
112
114
  onRecovered: () => {
113
115
  r || i.setSourceState({ playbackError: null });
114
116
  },
115
117
  onSeek: (e) => T.current?.(e),
116
118
  onSubtitleStreams: (e) => {
117
119
  r || i.setSourceState({
118
- subtitleTracks: I(e),
120
+ subtitleTracks: L(e),
119
121
  ...C.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
120
122
  });
121
123
  },
122
124
  onAudioStreams: (e, t) => {
123
125
  r || i.setSourceState({
124
- audioTracks: I(e),
126
+ audioTracks: L(e),
125
127
  selectedAudioTrack: t
126
128
  });
127
129
  }
@@ -131,10 +133,10 @@ var re = {
131
133
  return;
132
134
  }
133
135
  x.current = a, i.setSourceState({ indexes: a.indexes });
134
- let l = i.selectedSubtitleTrack;
135
- typeof l == "number" && a.selectSubtitleStream(l);
136
+ let u = i.selectedSubtitleTrack;
137
+ typeof u == "number" && a.selectSubtitleStream(u);
136
138
  } catch (e) {
137
- c(e);
139
+ l(e);
138
140
  }
139
141
  })(), () => {
140
142
  r = !0, S.current = t.currentTime, x.current?.destroy(), x.current = null, i.setSourceState({ ready: !1 });
@@ -145,8 +147,8 @@ var re = {
145
147
  n,
146
148
  o,
147
149
  s,
148
- u,
149
- p,
150
+ c,
151
+ d,
150
152
  m,
151
153
  h,
152
154
  g,
@@ -154,18 +156,18 @@ var re = {
154
156
  y,
155
157
  v
156
158
  ]);
157
- }, se = 5e3, ce = 6e4, L = ({ publicPath: e, workerUrl: n, length: r, read: i, downloadedRanges: a }) => {
158
- let [o, s] = f([]), c = d(null), p = d(i);
159
- p.current = i;
160
- let m = u(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = d(m);
161
- return h.current = m, l(() => {
162
- if (!r || !i || !e || !n) return;
163
- let a = !1, o = null, l, u = se, d = () => {
164
- t({
159
+ }, se = 5e3, ce = 6e4, R = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
160
+ let [o, s] = p([]), c = f(null), l = f(i);
161
+ l.current = i;
162
+ let m = d(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = f(m);
163
+ return h.current = m, u(() => {
164
+ if (!n || !i || !e || !t) return;
165
+ let a = !1, o = null, u, d = se, f = () => {
166
+ r({
165
167
  publicPath: e,
166
- workerUrl: n,
167
- length: r,
168
- read: (e, t) => p.current(e, t),
168
+ workerUrl: t,
169
+ length: n,
170
+ read: (e, t) => l.current(e, t),
169
171
  onThumbnails: (e) => {
170
172
  a || s(e);
171
173
  }
@@ -176,43 +178,48 @@ var re = {
176
178
  }
177
179
  o = e, c.current = e, e.update(h.current);
178
180
  }, () => {
179
- a || (l = setTimeout(d, u), u = Math.min(u * 2, ce));
181
+ a || (u = setTimeout(f, d), d = Math.min(d * 2, ce));
180
182
  });
181
183
  };
182
- return d(), () => {
183
- a = !0, clearTimeout(l), c.current = null, o?.destroy(), s([]);
184
+ return f(), () => {
185
+ a = !0, clearTimeout(u), c.current = null, o?.destroy(), s([]);
184
186
  };
185
187
  }, [
186
- r,
188
+ n,
187
189
  e,
188
- n
189
- ]), l(() => {
190
+ t
191
+ ]), u(() => {
190
192
  c.current?.update(m);
191
193
  }, [m]), o;
192
- }, R = (e, t) => {
193
- let n = P(), r = d(null);
194
- l(() => {
195
- if (!e || !t) return;
196
- let a = i({
194
+ }, z = (e, t) => {
195
+ let r = f(null), [i, o] = p(!1), [s] = p(() => n());
196
+ u(() => {
197
+ if (!e || !t || !s) return;
198
+ let n = a({
197
199
  video: e,
198
200
  canvas: t,
199
- fallback: () => n.togglePictureInPicture()
201
+ mode: s,
202
+ onBurnedInChange: o
200
203
  });
201
- return r.current = a, () => {
202
- a.destroy(), r.current = null;
204
+ return r.current = n, () => {
205
+ n.destroy(), r.current = null, o(!1);
203
206
  };
204
207
  }, [
205
208
  e,
206
209
  t,
207
- n
210
+ s
208
211
  ]);
209
- let a = c(() => {
212
+ let c = l(() => {
210
213
  r.current?.toggle().catch((e) => {
211
214
  console.warn("picture in picture was refused", e);
212
215
  });
213
216
  }, []);
214
- return e && t ? a : null;
215
- }, z = {
217
+ return {
218
+ toggle: e && t && s ? c : null,
219
+ mode: s,
220
+ burnedIn: i
221
+ };
222
+ }, B = {
216
223
  headings: {
217
224
  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 ",
218
225
  medium: "\n font-weight: 600;\n font-size: calc(2.4 * var(--mp-unit));\n line-height: calc(2.9 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n }\n ",
@@ -239,14 +246,14 @@ var re = {
239
246
  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 ",
240
247
  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 "
241
248
  }
242
- }, le = p`
249
+ }, le = m`
243
250
  top: unset !important;
244
251
  left: unset !important;
245
252
  width: 100%;
246
253
  height: 100%;
247
254
  margin: auto;
248
255
  pointer-events: none;
249
- `, ue = p`
256
+ `, ue = m`
250
257
  position: absolute;
251
258
  top: 0;
252
259
  left: 0;
@@ -254,7 +261,7 @@ var re = {
254
261
  padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
255
262
  /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
256
263
  padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
257
- ${z.headings.small}
264
+ ${B.headings.small}
258
265
  color: white;
259
266
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
260
267
  z-index: 2;
@@ -275,7 +282,7 @@ var re = {
275
282
 
276
283
  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%);
277
284
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
278
- `, de = p`
285
+ `, de = m`
279
286
  position: absolute;
280
287
  inset: 0;
281
288
  z-index: 2;
@@ -291,24 +298,24 @@ var re = {
291
298
  border-radius: 50%;
292
299
  border: 3px solid rgba(255, 255, 255, 0.25);
293
300
  border-top-color: #fff;
294
- animation: ${m`
301
+ animation: ${h`
295
302
  to { transform: rotate(360deg); }
296
303
  `} 0.8s linear infinite;
297
304
  }
298
- `, fe = p`
305
+ `, fe = m`
299
306
  position: absolute;
300
307
  inset: auto 0 20%;
301
308
  z-index: 3;
302
309
  padding: 0 calc(2 * var(--mp-unit));
303
310
  text-align: center;
304
311
  color: #fff;
305
- ${z.bLarge.regular}
312
+ ${B.bLarge.regular}
306
313
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
307
314
  pointer-events: none;
308
315
  `, pe = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", me = ({ onCanvasRef: e }) => {
309
- let t = P((e) => e.title), n = P((e) => e.hideUI), r = P((e) => e.playbackError), i = P((e) => e.ready), a = P((e) => e.size), o = P((e) => e.waiting);
310
- return /* @__PURE__ */ S(b, { children: [
311
- t ? /* @__PURE__ */ x("div", {
316
+ let t = F((e) => e.title), n = F((e) => e.hideUI), r = F((e) => e.playbackError), i = F((e) => e.ready), a = F((e) => e.size), o = F((e) => e.waiting);
317
+ return /* @__PURE__ */ C(x, { children: [
318
+ t ? /* @__PURE__ */ S("div", {
312
319
  className: "title",
313
320
  css: ue,
314
321
  style: { ...n ? {
@@ -317,21 +324,21 @@ var re = {
317
324
  } : {} },
318
325
  children: t
319
326
  }) : void 0,
320
- (a ? !i : o) && !r ? /* @__PURE__ */ x("div", { css: de }) : void 0,
321
- r ? /* @__PURE__ */ x("div", {
327
+ (a ? !i : o) && !r ? /* @__PURE__ */ S("div", { css: de }) : void 0,
328
+ r ? /* @__PURE__ */ S("div", {
322
329
  css: fe,
323
330
  children: pe(r)
324
331
  }) : void 0,
325
- /* @__PURE__ */ x("canvas", {
332
+ /* @__PURE__ */ S("canvas", {
326
333
  ref: e,
327
334
  css: le
328
335
  })
329
336
  ] });
330
- }, B = 1e-4, V = 1, H = (e) => Math.max(B, Math.min(V, e)) ** 2, U = (e) => Math.max(B, Math.min(V, e)) ** (V / 2), W = (e) => {
337
+ }, V = 1e-4, H = 1, U = (e) => Math.max(V, Math.min(H, e)) ** 2, W = (e) => Math.max(V, Math.min(H, e)) ** (H / 2), G = (e) => {
331
338
  if (e === void 0) return "0:00";
332
339
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
333
340
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
334
- }, he = (e, t) => `${W(e)} / ${W(t)}`, ge = (e) => p`
341
+ }, he = (e, t) => `${G(e)} / ${G(t)}`, ge = (e) => m`
335
342
  display: flex;
336
343
  justify-content: flex-end;
337
344
 
@@ -341,19 +348,19 @@ var re = {
341
348
  z-index: 3;
342
349
 
343
350
  * {
344
- ${z.bMedium.regular}
351
+ ${B.bMedium.regular}
345
352
  }
346
353
 
347
- ${e === "sm" && p`
354
+ ${e === "sm" && m`
348
355
  padding: calc(0.4 * var(--mp-unit))!important;
349
356
  `}
350
- ${e === "md" && p`
357
+ ${e === "md" && m`
351
358
  padding: calc(0.6 * var(--mp-unit))!important;
352
359
  `}
353
- ${e === "lg" && p`
360
+ ${e === "lg" && m`
354
361
  padding: calc(1.2 * var(--mp-unit))!important;
355
362
  `}
356
- `, G = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("div", {
363
+ `, K = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
357
364
  "data-tooltip-id": e,
358
365
  "data-open": !0,
359
366
  "data-tooltip-offset": a,
@@ -361,39 +368,39 @@ var re = {
361
368
  "data-tooltip-delay-hide": i,
362
369
  "data-tooltip-place": o,
363
370
  children: n
364
- }), !s && /* @__PURE__ */ x(ne, {
371
+ }), !s && /* @__PURE__ */ S(ne, {
365
372
  css: ge(c),
366
373
  id: e,
367
374
  noArrow: !0,
368
375
  children: t
369
- })] }), K = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
370
- let [i, a] = f(!1), o = d(t);
376
+ })] }), q = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
377
+ let [i, a] = p(!1), o = f(t);
371
378
  o.current = t;
372
- let s = d(null), u = c((t, r) => {
379
+ let s = f(null), c = l((t, r) => {
373
380
  let i = e.current;
374
381
  if (!i) return 0;
375
382
  let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
376
383
  return Math.min(Math.max(l, 0), 1);
377
- }, [e, n]), p = c((e) => {
378
- r || e.button > 0 || (s.current = e.pointerId, e.currentTarget.setPointerCapture?.(e.pointerId), a(!0), o.current(u(e.clientX, e.clientY)));
379
- }, [r, u]), m = c((e) => {
380
- s.current === e.pointerId && o.current(u(e.clientX, e.clientY));
381
- }, [u]), h = c((e) => {
384
+ }, [e, n]), d = l((e) => {
385
+ r || e.button > 0 || (s.current = e.pointerId, e.currentTarget.setPointerCapture?.(e.pointerId), a(!0), o.current(c(e.clientX, e.clientY)));
386
+ }, [r, c]), m = l((e) => {
387
+ s.current === e.pointerId && o.current(c(e.clientX, e.clientY));
388
+ }, [c]), h = l((e) => {
382
389
  s.current === e.pointerId && (s.current = null, e.currentTarget.releasePointerCapture?.(e.pointerId), a(!1));
383
390
  }, []);
384
- return l(() => {
391
+ return u(() => {
385
392
  r && (s.current = null, a(!1));
386
393
  }, [r]), {
387
394
  dragging: i,
388
395
  handlers: {
389
- onPointerDown: p,
396
+ onPointerDown: d,
390
397
  onPointerMove: m,
391
398
  onPointerUp: h,
392
399
  onPointerCancel: h,
393
400
  style: { touchAction: "none" }
394
401
  }
395
402
  };
396
- }, _e = p`
403
+ }, _e = m`
397
404
  position: relative;
398
405
  height: calc(.4 * var(--mp-unit));
399
406
 
@@ -447,7 +454,7 @@ var re = {
447
454
  box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
448
455
 
449
456
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
450
- ${z.bMedium.bold}
457
+ ${B.bMedium.bold}
451
458
 
452
459
  position: absolute;
453
460
  /* Anchored on its bottom edge rather than its top: now that it has a background its height
@@ -565,14 +572,14 @@ var re = {
565
572
  --thumbnail-half: calc(9 * var(--mp-unit));
566
573
  }
567
574
  `, ve = () => {
568
- let e = P(), t = P((e) => e.currentTime), n = P((e) => e.duration), r = P((e) => e.size), i = P((e) => e.downloadedRanges), a = P((e) => e.indexes), o = P((e) => e.thumbnails), s = P((e) => e.thumbnailAt), c = d(null), [p, m] = f(void 0), [h, g] = f(void 0), _ = d(void 0), { dragging: v, handlers: y } = K({
575
+ let e = F(), t = F((e) => e.currentTime), n = F((e) => e.duration), r = F((e) => e.size), i = F((e) => e.downloadedRanges), a = F((e) => e.indexes), o = F((e) => e.thumbnails), s = F((e) => e.thumbnailAt), c = f(null), [l, m] = p(void 0), [h, g] = p(void 0), _ = f(void 0), { dragging: v, handlers: y } = q({
569
576
  ref: c,
570
577
  onChange: (e) => {
571
578
  m(e), _.current !== "mouse" && g(e * n);
572
579
  }
573
580
  }), b = (e) => {
574
581
  _.current = e.pointerType, y.onPointerDown(e);
575
- }, C = (e) => {
582
+ }, x = (e) => {
576
583
  y.onPointerUp(e), e.pointerType !== "mouse" && g(void 0);
577
584
  }, w = (e) => {
578
585
  if (!c.current) return;
@@ -582,12 +589,12 @@ var re = {
582
589
  g(w(e.clientX));
583
590
  }, E = () => {
584
591
  c.current && g(void 0);
585
- }, D = (e) => n ? e / n * 100 : 0, O = u(() => i?.map((e, t) => {
592
+ }, D = (e) => n ? e / n * 100 : 0, O = d(() => i?.map((e, t) => {
586
593
  if (!r || !n) return null;
587
594
  let i = a.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), o = i.at(0), s = i.at(-1);
588
595
  if (!o || !s) return null;
589
596
  let c = o.timestamp / n, l = s.timestamp / n, u = Number((l - c).toFixed(2)), d = c * 100;
590
- return /* @__PURE__ */ x("div", {
597
+ return /* @__PURE__ */ S("div", {
591
598
  className: "loaded-part",
592
599
  style: {
593
600
  transform: `scaleX(${u})`,
@@ -598,21 +605,21 @@ var re = {
598
605
  n,
599
606
  a.length,
600
607
  i?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
601
- ]), k = u(() => {
608
+ ]), k = d(() => {
602
609
  if (!h || h < 0) return;
603
610
  let e = Math.floor(h / 3600), t = Math.floor((h - e * 3600) / 60), n = Math.floor(h - e * 3600 - t * 60);
604
611
  return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
605
612
  }, [h]);
606
- l(() => {
607
- if (p === void 0 || !n) return;
608
- let t = p * n;
613
+ u(() => {
614
+ if (l === void 0 || !n) return;
615
+ let t = l * n;
609
616
  e.seek(t);
610
617
  }, [
611
618
  e,
612
- p,
619
+ l,
613
620
  n
614
621
  ]);
615
- let A = u(() => !n || typeof t != "number" ? 0 : t / n, [n, t]), j = u(() => {
622
+ let A = d(() => !n || typeof t != "number" ? 0 : t / n, [n, t]), j = d(() => {
616
623
  if (h) {
617
624
  if (s) return s(h);
618
625
  if (o.length) return o.find(({ startTime: e, endTime: t }) => e <= h && h < t);
@@ -622,49 +629,105 @@ var re = {
622
629
  s,
623
630
  h
624
631
  ]);
625
- return /* @__PURE__ */ S("div", {
632
+ return /* @__PURE__ */ C("div", {
626
633
  css: _e,
627
634
  ref: c,
628
635
  className: v ? "progress-bar dragging" : "progress-bar",
629
636
  onMouseMove: T,
630
637
  onMouseOut: E,
631
638
  children: [
632
- /* @__PURE__ */ x("div", { className: "background-bar" }),
633
- h ? /* @__PURE__ */ x("div", {
639
+ /* @__PURE__ */ S("div", { className: "background-bar" }),
640
+ h ? /* @__PURE__ */ S("div", {
634
641
  className: "cursor-time",
635
642
  style: { left: `clamp(calc(3 * var(--mp-unit)), ${D(h)}%, calc(100% - calc(3 * var(--mp-unit))))` },
636
643
  children: k
637
644
  }) : void 0,
638
- /* @__PURE__ */ x("div", { className: "progress" }),
639
- /* @__PURE__ */ x("div", {
645
+ /* @__PURE__ */ S("div", { className: "progress" }),
646
+ /* @__PURE__ */ S("div", {
640
647
  className: "loaded",
641
648
  children: O
642
649
  }),
643
- /* @__PURE__ */ x("div", { className: "hover" }),
644
- /* @__PURE__ */ x("div", {
650
+ /* @__PURE__ */ S("div", { className: "hover" }),
651
+ /* @__PURE__ */ S("div", {
645
652
  className: "play-container",
646
- children: /* @__PURE__ */ x("div", {
653
+ children: /* @__PURE__ */ S("div", {
647
654
  className: "play",
648
655
  style: { transform: `scaleX(${A})` }
649
656
  })
650
657
  }),
651
- /* @__PURE__ */ x("div", { className: "chapters" }),
652
- /* @__PURE__ */ x("div", { className: "scrubber" }),
653
- /* @__PURE__ */ x("div", {
658
+ /* @__PURE__ */ S("div", { className: "chapters" }),
659
+ /* @__PURE__ */ S("div", { className: "scrubber" }),
660
+ /* @__PURE__ */ S("div", {
654
661
  className: "padding",
655
662
  ...y,
656
663
  onPointerDown: b,
657
- onPointerUp: C,
658
- onPointerCancel: C
664
+ onPointerUp: x,
665
+ onPointerCancel: x
659
666
  }),
660
- /* @__PURE__ */ x("div", {
667
+ /* @__PURE__ */ S("div", {
661
668
  className: "thumbnail",
662
669
  style: { left: `clamp(var(--thumbnail-half), ${D(h ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
663
- children: j?.url ? /* @__PURE__ */ x("img", { src: j.url }) : void 0
670
+ children: j?.url ? /* @__PURE__ */ S("img", { src: j.url }) : void 0
664
671
  })
665
672
  ]
666
673
  });
667
- }, ye = "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", be = p`
674
+ }, ye = "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", J = {
675
+ xmlns: "http://www.w3.org/2000/svg",
676
+ width: 24,
677
+ height: 24,
678
+ viewBox: "0 0 24 24",
679
+ fill: "none",
680
+ stroke: "currentColor",
681
+ strokeWidth: 2,
682
+ strokeLinecap: "round",
683
+ strokeLinejoin: "round"
684
+ }, be = (e) => /* @__PURE__ */ C("svg", {
685
+ ...J,
686
+ ...e,
687
+ children: [/* @__PURE__ */ S("rect", {
688
+ x: "3",
689
+ y: "5",
690
+ width: "18",
691
+ height: "14",
692
+ rx: "2",
693
+ ry: "2"
694
+ }), /* @__PURE__ */ S("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
695
+ }), xe = (e) => /* @__PURE__ */ C("svg", {
696
+ ...J,
697
+ ...e,
698
+ children: [
699
+ /* @__PURE__ */ S("rect", {
700
+ x: "3",
701
+ y: "5",
702
+ width: "18",
703
+ height: "14",
704
+ rx: "2",
705
+ ry: "2"
706
+ }),
707
+ /* @__PURE__ */ S("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
708
+ /* @__PURE__ */ S("line", {
709
+ x1: "2",
710
+ y1: "2",
711
+ x2: "22",
712
+ y2: "22"
713
+ })
714
+ ]
715
+ }), Se = (e) => /* @__PURE__ */ C("svg", {
716
+ ...J,
717
+ ...e,
718
+ children: [
719
+ /* @__PURE__ */ S("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
720
+ /* @__PURE__ */ S("rect", {
721
+ x: "12",
722
+ y: "13",
723
+ width: "10",
724
+ height: "8",
725
+ rx: "1",
726
+ ry: "1"
727
+ }),
728
+ /* @__PURE__ */ S("path", { d: "M14.5 18.5h2m2 0h1" })
729
+ ]
730
+ }), Ce = m`
668
731
  display: flex;
669
732
  align-items: center;
670
733
  justify-content: center;
@@ -717,42 +780,42 @@ width: 100%;
717
780
  }
718
781
  }
719
782
  }
720
- `, xe = () => {
721
- let e = P(), t = P((e) => e.playbackRate), n = d(null), r = d(null), i = .25, a = 3 - i, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, u = (e) => o(i + e * a), { handlers: f } = K({
783
+ `, we = () => {
784
+ let e = F(), t = F((e) => e.playbackRate), n = f(null), r = f(null), i = .25, a = 3 - i, 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: d } = q({
722
785
  ref: r,
723
- onChange: (t) => e.setPlaybackRate(u(t))
786
+ onChange: (t) => e.setPlaybackRate(l(t))
724
787
  }), p = (t) => {
725
788
  t.preventDefault();
726
789
  let n = .05, r = s;
727
790
  r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
728
791
  };
729
- l(() => {
792
+ u(() => {
730
793
  let e = n.current;
731
794
  return e && e.addEventListener("wheel", p, { passive: !1 }), () => {
732
795
  e && e.removeEventListener("wheel", p);
733
796
  };
734
797
  }, [t]);
735
798
  let m = c(s);
736
- return /* @__PURE__ */ S("div", {
737
- css: be,
738
- children: [/* @__PURE__ */ S("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ x("div", {
799
+ return /* @__PURE__ */ C("div", {
800
+ css: Ce,
801
+ children: [/* @__PURE__ */ C("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ S("div", {
739
802
  className: "playback-slider",
740
803
  ref: n,
741
- ...f,
742
- children: /* @__PURE__ */ x("div", {
804
+ ...d,
805
+ children: /* @__PURE__ */ S("div", {
743
806
  ref: r,
744
807
  style: { background: `linear-gradient(to right,
745
808
  #fff 0% ${m}%,
746
809
  #3A3A3A ${m}% 100%
747
810
  )` },
748
- children: /* @__PURE__ */ x("div", {
811
+ children: /* @__PURE__ */ S("div", {
749
812
  className: "playback-handle",
750
813
  style: { left: `${m}%` }
751
814
  })
752
815
  })
753
816
  })]
754
817
  });
755
- }, q = p`
818
+ }, Y = m`
756
819
  .popover {
757
820
  position: absolute;
758
821
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -791,7 +854,7 @@ width: 100%;
791
854
 
792
855
  border-radius: 8px;
793
856
  background-color: rgba(28,28,28,0.95);
794
- ${z.bMedium.regular}
857
+ ${B.bMedium.regular}
795
858
 
796
859
  z-index: 4;
797
860
 
@@ -834,7 +897,7 @@ width: 100%;
834
897
 
835
898
  .secondary {
836
899
  color: #eee;
837
- ${z.bSmall.regular}
900
+ ${B.bSmall.regular}
838
901
  }
839
902
  }
840
903
  }
@@ -876,29 +939,29 @@ width: 100%;
876
939
  .failed {
877
940
  border-bottom: 1px solid #4D4D4E;
878
941
  color: #f66;
879
- ${z.bSmall.regular}
942
+ ${B.bSmall.regular}
880
943
  }
881
944
  }
882
- `, J = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
945
+ `, X = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
883
946
  let c = o !== void 0, l = (e, i, a) => {
884
947
  let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
885
- return /* @__PURE__ */ S("div", {
948
+ return /* @__PURE__ */ C("div", {
886
949
  onClick: () => {
887
950
  l || r(e ?? void 0);
888
951
  },
889
952
  className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
890
- children: [/* @__PURE__ */ x("span", { children: i }), /* @__PURE__ */ x("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
953
+ children: [/* @__PURE__ */ S("span", { children: i }), /* @__PURE__ */ S("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
891
954
  }, e ?? "__off__");
892
955
  };
893
- return /* @__PURE__ */ S("div", {
956
+ return /* @__PURE__ */ C("div", {
894
957
  className: "popover track-list",
895
958
  children: [
896
- /* @__PURE__ */ S("div", {
959
+ /* @__PURE__ */ C("div", {
897
960
  className: i ? "back" : "back no-hover",
898
961
  onClick: i,
899
- children: [i ? /* @__PURE__ */ x(C, {}) : null, /* @__PURE__ */ x("span", { children: e })]
962
+ children: [i ? /* @__PURE__ */ S(w, {}) : null, /* @__PURE__ */ S("span", { children: e })]
900
963
  }),
901
- s ? /* @__PURE__ */ x("div", {
964
+ s ? /* @__PURE__ */ S("div", {
902
965
  className: "no-hover failed",
903
966
  children: "Could not switch. Try again."
904
967
  }) : null,
@@ -906,15 +969,15 @@ width: 100%;
906
969
  t.map(({ id: e, label: t }) => l(e, t, "description"))
907
970
  ]
908
971
  });
909
- }, Y = ({ onReset: e } = {}) => {
910
- let t = d(null), [n, r] = f(!1), [i, a] = f(void 0), [o, s] = f(!1), c = d(e);
972
+ }, Z = ({ onReset: e } = {}) => {
973
+ let t = f(null), [n, r] = p(!1), [i, a] = p(void 0), [o, s] = p(!1), c = f(e);
911
974
  c.current = e;
912
- let u = () => {
975
+ let l = () => {
913
976
  r(!1), c.current?.();
914
977
  };
915
- return l(() => {
978
+ return u(() => {
916
979
  let e = (e) => {
917
- n && t.current && !t.current.contains(e.target) && u();
980
+ n && t.current && !t.current.contains(e.target) && l();
918
981
  };
919
982
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
920
983
  }, [n]), {
@@ -922,7 +985,7 @@ width: 100%;
922
985
  toggle: () => {
923
986
  r((e) => !e), s(!1), c.current?.();
924
987
  },
925
- close: u,
988
+ close: l,
926
989
  containerRef: t,
927
990
  pending: i,
928
991
  failed: o,
@@ -937,17 +1000,17 @@ width: 100%;
937
1000
  return;
938
1001
  }
939
1002
  if (!(n instanceof Promise)) {
940
- u();
1003
+ l();
941
1004
  return;
942
1005
  }
943
1006
  a(e), n.then(() => {
944
- a(void 0), u();
1007
+ a(void 0), l();
945
1008
  }, (e) => {
946
1009
  console.warn("[media-player] track selection failed:", e), a(void 0), s(!0);
947
1010
  });
948
1011
  }
949
1012
  };
950
- }, Se = p`
1013
+ }, Te = m`
951
1014
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
952
1015
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
953
1016
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -965,7 +1028,7 @@ position: static;
965
1028
  }
966
1029
  }
967
1030
 
968
- ${q}
1031
+ ${Y}
969
1032
 
970
1033
  .playback-rate {
971
1034
  .slider {
@@ -1006,70 +1069,70 @@ ${q}
1006
1069
  }
1007
1070
  }
1008
1071
 
1009
- `, Ce = () => {
1010
- let e = P(), t = P((e) => e.playbackRate), n = P((e) => e.audioTracks), r = P((e) => e.selectedAudioTrack), i = P((e) => e.selectAudioTrack), [a, o] = f(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: p } = Y({ onReset: () => o(0) }), m = (t) => {
1072
+ `, Ee = () => {
1073
+ let e = F(), t = F((e) => e.playbackRate), n = F((e) => e.audioTracks), r = F((e) => e.selectedAudioTrack), i = F((e) => e.selectAudioTrack), [a, o] = p(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = Z({ onReset: () => o(0) }), m = (t) => {
1011
1074
  e.setPlaybackRate(t), o(0);
1012
1075
  }, h = (e) => {
1013
- e !== void 0 && p(e, () => i(e));
1076
+ e !== void 0 && f(e, () => i(e));
1014
1077
  }, g = (e) => () => {
1015
1078
  o(e);
1016
1079
  };
1017
- return /* @__PURE__ */ S("div", {
1018
- css: Se,
1080
+ return /* @__PURE__ */ C("div", {
1081
+ css: Te,
1019
1082
  ref: l,
1020
1083
  children: [
1021
- /* @__PURE__ */ x(G, {
1084
+ /* @__PURE__ */ S(K, {
1022
1085
  id: "settings",
1023
1086
  disabled: s,
1024
- text: /* @__PURE__ */ x("button", {
1087
+ text: /* @__PURE__ */ S("button", {
1025
1088
  className: "settings",
1026
1089
  type: "button",
1027
1090
  onClick: c,
1028
- children: /* @__PURE__ */ x(A, {})
1091
+ children: /* @__PURE__ */ S(j, {})
1029
1092
  }),
1030
- toolTipText: /* @__PURE__ */ x("span", { children: "Settings" })
1093
+ toolTipText: /* @__PURE__ */ S("span", { children: "Settings" })
1031
1094
  }),
1032
- s && a === 0 && /* @__PURE__ */ S("div", {
1095
+ s && a === 0 && /* @__PURE__ */ C("div", {
1033
1096
  className: "popover menu",
1034
- children: [n.length > 1 ? /* @__PURE__ */ S("div", {
1097
+ children: [n.length > 1 ? /* @__PURE__ */ C("div", {
1035
1098
  onClick: g(2),
1036
- children: [/* @__PURE__ */ x("div", { children: "Audio" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
1037
- }) : null, /* @__PURE__ */ S("div", {
1099
+ children: [/* @__PURE__ */ S("div", { children: "Audio" }), /* @__PURE__ */ S("div", { children: /* @__PURE__ */ S(T, {}) })]
1100
+ }) : null, /* @__PURE__ */ C("div", {
1038
1101
  onClick: g(1),
1039
- children: [/* @__PURE__ */ x("div", { children: "Playback speed" }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
1102
+ children: [/* @__PURE__ */ S("div", { children: "Playback speed" }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("span", {
1040
1103
  className: "secondary",
1041
1104
  children: t === 1 ? "(Default)" : t.toFixed(2)
1042
- }), /* @__PURE__ */ x(w, {})] })]
1105
+ }), /* @__PURE__ */ S(T, {})] })]
1043
1106
  })]
1044
1107
  }),
1045
- s && a === 1 && /* @__PURE__ */ S("div", {
1108
+ s && a === 1 && /* @__PURE__ */ C("div", {
1046
1109
  className: "popover playback-rate",
1047
1110
  children: [
1048
- /* @__PURE__ */ S("div", {
1111
+ /* @__PURE__ */ C("div", {
1049
1112
  className: "back",
1050
1113
  onClick: g(0),
1051
- children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: "Playback speed" })]
1114
+ children: [/* @__PURE__ */ S(w, {}), /* @__PURE__ */ S("span", { children: "Playback speed" })]
1052
1115
  }),
1053
- /* @__PURE__ */ x("div", {
1116
+ /* @__PURE__ */ S("div", {
1054
1117
  className: "slider no-hover",
1055
- children: /* @__PURE__ */ x(xe, {})
1118
+ children: /* @__PURE__ */ S(we, {})
1056
1119
  }),
1057
- /* @__PURE__ */ S("div", {
1120
+ /* @__PURE__ */ C("div", {
1058
1121
  className: "options no-hover",
1059
1122
  children: [
1060
- /* @__PURE__ */ x("div", {
1123
+ /* @__PURE__ */ S("div", {
1061
1124
  onClick: () => m(.5),
1062
1125
  children: "0.5x"
1063
1126
  }),
1064
- /* @__PURE__ */ x("div", {
1127
+ /* @__PURE__ */ S("div", {
1065
1128
  onClick: () => m(1),
1066
1129
  children: "1x"
1067
1130
  }),
1068
- /* @__PURE__ */ x("div", {
1131
+ /* @__PURE__ */ S("div", {
1069
1132
  onClick: () => m(1.5),
1070
1133
  children: "1.5x"
1071
1134
  }),
1072
- /* @__PURE__ */ x("div", {
1135
+ /* @__PURE__ */ S("div", {
1073
1136
  onClick: () => m(2),
1074
1137
  children: "2x"
1075
1138
  })
@@ -1077,7 +1140,7 @@ ${q}
1077
1140
  })
1078
1141
  ]
1079
1142
  }),
1080
- s && a === 2 && /* @__PURE__ */ x(J, {
1143
+ s && a === 2 && /* @__PURE__ */ S(X, {
1081
1144
  title: "Audio",
1082
1145
  tracks: n,
1083
1146
  selected: r,
@@ -1088,48 +1151,7 @@ ${q}
1088
1151
  })
1089
1152
  ]
1090
1153
  });
1091
- }, X = {
1092
- xmlns: "http://www.w3.org/2000/svg",
1093
- width: 24,
1094
- height: 24,
1095
- viewBox: "0 0 24 24",
1096
- fill: "none",
1097
- stroke: "currentColor",
1098
- strokeWidth: 2,
1099
- strokeLinecap: "round",
1100
- strokeLinejoin: "round"
1101
- }, we = (e) => /* @__PURE__ */ S("svg", {
1102
- ...X,
1103
- ...e,
1104
- children: [/* @__PURE__ */ x("rect", {
1105
- x: "3",
1106
- y: "5",
1107
- width: "18",
1108
- height: "14",
1109
- rx: "2",
1110
- ry: "2"
1111
- }), /* @__PURE__ */ x("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1112
- }), Te = (e) => /* @__PURE__ */ S("svg", {
1113
- ...X,
1114
- ...e,
1115
- children: [
1116
- /* @__PURE__ */ x("rect", {
1117
- x: "3",
1118
- y: "5",
1119
- width: "18",
1120
- height: "14",
1121
- rx: "2",
1122
- ry: "2"
1123
- }),
1124
- /* @__PURE__ */ x("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
1125
- /* @__PURE__ */ x("line", {
1126
- x1: "2",
1127
- y1: "2",
1128
- x2: "22",
1129
- y2: "22"
1130
- })
1131
- ]
1132
- }), Ee = p`
1154
+ }, De = m`
1133
1155
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1134
1156
  which is the width of the player box, so it can be clamped to it. */
1135
1157
  position: static;
@@ -1145,23 +1167,23 @@ position: static;
1145
1167
  }
1146
1168
  }
1147
1169
 
1148
- ${q}
1149
- `, De = () => {
1150
- let e = P((e) => e.subtitleTracks), t = P((e) => e.selectedSubtitleTrack), n = P((e) => e.selectSubtitleTrack), r = P((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Y();
1151
- return e.length === 0 ? null : /* @__PURE__ */ S("div", {
1152
- css: Ee,
1170
+ ${Y}
1171
+ `, Oe = () => {
1172
+ let e = F((e) => e.subtitleTracks), t = F((e) => e.selectedSubtitleTrack), n = F((e) => e.selectSubtitleTrack), r = F((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Z();
1173
+ return e.length === 0 ? null : /* @__PURE__ */ C("div", {
1174
+ css: De,
1153
1175
  ref: o,
1154
- children: [/* @__PURE__ */ x(G, {
1176
+ children: [/* @__PURE__ */ S(K, {
1155
1177
  id: "subtitles",
1156
1178
  disabled: i,
1157
- text: /* @__PURE__ */ x("button", {
1179
+ text: /* @__PURE__ */ S("button", {
1158
1180
  className: "subtitles",
1159
1181
  type: "button",
1160
1182
  onClick: a,
1161
- children: t === void 0 ? /* @__PURE__ */ x(Te, { className: "captions-off" }) : /* @__PURE__ */ x(we, { className: "captions" })
1183
+ children: t === void 0 ? /* @__PURE__ */ S(xe, { className: "captions-off" }) : /* @__PURE__ */ S(be, { className: "captions" })
1162
1184
  }),
1163
- toolTipText: /* @__PURE__ */ x("span", { children: "Subtitles" })
1164
- }), i && /* @__PURE__ */ x(J, {
1185
+ toolTipText: /* @__PURE__ */ S("span", { children: "Subtitles" })
1186
+ }), i && /* @__PURE__ */ S(X, {
1165
1187
  title: "Subtitles",
1166
1188
  tracks: e,
1167
1189
  selected: t,
@@ -1171,13 +1193,14 @@ ${q}
1171
1193
  failed: c
1172
1194
  })]
1173
1195
  });
1174
- }, Oe = {
1196
+ }, Q = {
1175
1197
  primary: "#EAEBEE",
1176
1198
  secondary: "#D0D0D9",
1177
1199
  hover: "rgba(255, 255, 255, 0.13)",
1200
+ accent: "#6EA8FE",
1178
1201
  borderPrimary: "#384F70",
1179
1202
  backgroundTooltip: "#222222"
1180
- }, ke = p`
1203
+ }, ke = m`
1181
1204
  display: flex;
1182
1205
  align-items: center;
1183
1206
 
@@ -1221,7 +1244,7 @@ ${q}
1221
1244
  height: 10px;
1222
1245
  }
1223
1246
  `, Ae = ({ value: e, onChange: t }) => {
1224
- let n = P((e) => e.volume), r = P((e) => e.muted), i = d(null), a = d(null), { handlers: o } = K({
1247
+ let n = F((e) => e.volume), r = F((e) => e.muted), i = f(null), a = f(null), { handlers: o } = q({
1225
1248
  ref: a,
1226
1249
  onChange: t
1227
1250
  }), s = (n) => {
@@ -1229,37 +1252,37 @@ ${q}
1229
1252
  let r = .05, i = e;
1230
1253
  i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
1231
1254
  };
1232
- l(() => {
1255
+ u(() => {
1233
1256
  let e = i.current;
1234
1257
  return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
1235
1258
  e && e.removeEventListener("wheel", s);
1236
1259
  };
1237
1260
  }, [e]);
1238
- let c = e * 100, f = u(() => Math.round(r ? 0 : U(n) * 100), [n, r]);
1239
- return /* @__PURE__ */ x(G, {
1261
+ let c = e * 100, l = d(() => Math.round(r ? 0 : W(n) * 100), [n, r]);
1262
+ return /* @__PURE__ */ S(K, {
1240
1263
  id: "volume-slider",
1241
- text: /* @__PURE__ */ x("div", {
1264
+ text: /* @__PURE__ */ S("div", {
1242
1265
  ref: i,
1243
1266
  css: ke,
1244
1267
  ...o,
1245
- children: /* @__PURE__ */ x("div", {
1268
+ children: /* @__PURE__ */ S("div", {
1246
1269
  ref: a,
1247
1270
  style: { background: `linear-gradient(to right,
1248
1271
  #fff 0% ${c}%,
1249
1272
  #3A3A3A ${c}% 100%
1250
1273
  )` },
1251
- children: /* @__PURE__ */ x("div", {
1274
+ children: /* @__PURE__ */ S("div", {
1252
1275
  className: "volume-handle",
1253
1276
  style: { left: `${e * 100}%` }
1254
1277
  })
1255
1278
  })
1256
1279
  }),
1257
- toolTipText: /* @__PURE__ */ S("div", {
1280
+ toolTipText: /* @__PURE__ */ C("div", {
1258
1281
  className: "volume-value",
1259
- children: [f, "%"]
1282
+ children: [l, "%"]
1260
1283
  })
1261
1284
  });
1262
- }, je = p`
1285
+ }, je = m`
1263
1286
  position: relative;
1264
1287
  display: flex;
1265
1288
  align-items: center;
@@ -1284,7 +1307,7 @@ ${q}
1284
1307
  border-radius: 4px;
1285
1308
 
1286
1309
  .volume-value {
1287
- ${z.bMedium.regular};
1310
+ ${B.bMedium.regular};
1288
1311
  color: #ffffff;
1289
1312
  }
1290
1313
  }
@@ -1323,36 +1346,47 @@ ${q}
1323
1346
  }
1324
1347
 
1325
1348
  `, Me = ({ ref: e }) => {
1326
- let t = P(), n = P((e) => e.volume), r = P((e) => e.muted), i = u(() => U(n), [n]);
1327
- return /* @__PURE__ */ S("div", {
1349
+ let t = F(), n = F((e) => e.volume), r = F((e) => e.muted), i = d(() => W(n), [n]);
1350
+ return /* @__PURE__ */ C("div", {
1328
1351
  css: je,
1329
- children: [/* @__PURE__ */ x(G, {
1352
+ children: [/* @__PURE__ */ S(K, {
1330
1353
  id: "sound",
1331
- text: /* @__PURE__ */ x("button", {
1354
+ text: /* @__PURE__ */ S("button", {
1332
1355
  className: "sound",
1333
1356
  type: "button",
1334
1357
  onClick: () => t.toggleMuted(),
1335
1358
  ref: e,
1336
- children: x(r || n === 0 ? te : n <= .5 ? j : ee, {
1359
+ children: S(r || n === 0 ? te : n <= .5 ? M : ee, {
1337
1360
  size: 18,
1338
1361
  color: "#fff"
1339
1362
  })
1340
1363
  }),
1341
- toolTipText: /* @__PURE__ */ x("span", { children: r ? "Unmute (m)" : "Mute (m)" })
1342
- }), /* @__PURE__ */ x("div", {
1364
+ toolTipText: /* @__PURE__ */ S("span", { children: r ? "Unmute (m)" : "Mute (m)" })
1365
+ }), /* @__PURE__ */ S("div", {
1343
1366
  className: "volume-slider-container",
1344
- children: /* @__PURE__ */ x("div", {
1367
+ children: /* @__PURE__ */ S("div", {
1345
1368
  className: "volume-slider-background",
1346
- children: /* @__PURE__ */ x(Ae, {
1369
+ children: /* @__PURE__ */ S(Ae, {
1347
1370
  value: r ? 0 : i,
1348
1371
  onChange: (e) => {
1349
- t.setVolume(H(e));
1372
+ t.setVolume(U(e));
1350
1373
  }
1351
1374
  })
1352
1375
  })
1353
1376
  })]
1354
1377
  });
1355
- }, Z = .05, Q = 5, Ne = p`
1378
+ }, $ = .05, Ne = 5, Pe = m`
1379
+ display: flex;
1380
+ flex-direction: column;
1381
+ gap: calc(0.4 * var(--mp-unit));
1382
+ max-width: calc(26 * var(--mp-unit));
1383
+ white-space: normal;
1384
+
1385
+ .hint {
1386
+ opacity: 0.72;
1387
+ font-size: 0.9em;
1388
+ }
1389
+ `, Fe = m`
1356
1390
  position: absolute;
1357
1391
  bottom: 0;
1358
1392
  width: 100%;
@@ -1402,6 +1436,22 @@ ${q}
1402
1436
  svg {
1403
1437
  stroke: #fff;
1404
1438
  }
1439
+
1440
+ /* Reads as unavailable rather than absent, so the bar does not reflow when tracks land. */
1441
+ &:disabled {
1442
+ cursor: default;
1443
+ opacity: .4;
1444
+ }
1445
+ }
1446
+
1447
+ /**
1448
+ * The burn-in control's own on state.
1449
+ *
1450
+ * Not \`colors.hover\`: the pointer is on the button at the moment of the click, so an on state
1451
+ * drawn in the hover colour is invisible exactly when it is being looked for.
1452
+ */
1453
+ button[aria-pressed='true'] svg {
1454
+ stroke: ${Q.accent};
1405
1455
  }
1406
1456
 
1407
1457
  .play, .sound, .time, .subtitles, .settings, .picture-in-picture, .full-screen {
@@ -1436,7 +1486,7 @@ ${q}
1436
1486
  cursor: pointer;
1437
1487
 
1438
1488
  :hover {
1439
- background-color: ${Oe.hover};
1489
+ background-color: ${Q.hover};
1440
1490
  }
1441
1491
 
1442
1492
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -1453,7 +1503,7 @@ ${q}
1453
1503
 
1454
1504
  .left {
1455
1505
  .time {
1456
- ${z.bMedium.regular}
1506
+ ${B.bMedium.regular}
1457
1507
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
1458
1508
  }
1459
1509
  }
@@ -1474,12 +1524,12 @@ ${q}
1474
1524
  }
1475
1525
  }
1476
1526
  }
1477
- `, Pe = () => {
1478
- let e = P(), t = P((e) => e.paused), n = P((e) => e.currentTime), r = P((e) => e.duration), i = P((e) => e.fullscreen), a = P((e) => e.hideUI), o = P((e) => e.togglePictureInPicture), [s, u] = f(null), d = r > 0 && n === r, p = c(({ direction: t, stepSize: n }) => {
1479
- let r = U(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
1480
- e.setVolume(H(a)), o && !e.muted && e.toggleMuted();
1527
+ `, Ie = () => {
1528
+ let e = F(), t = F((e) => e.paused), n = F((e) => e.currentTime), r = F((e) => e.duration), i = F((e) => e.fullscreen), a = F((e) => e.hideUI), o = F((e) => e.togglePictureInPicture), s = F((e) => e.pictureInPictureMode), c = F((e) => e.burnedInSubtitles), d = F((e) => e.subtitleTracks), [f, m] = p(null), h = s === "burn-in", g = d.length > 0, _ = r > 0 && n === r, v = l(({ direction: t, stepSize: n }) => {
1529
+ let r = W(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
1530
+ e.setVolume(U(a)), o && !e.muted && e.toggleMuted();
1481
1531
  }, [e]);
1482
- l(() => {
1532
+ u(() => {
1483
1533
  let t = (t) => {
1484
1534
  let n = t.target;
1485
1535
  if (n?.isContentEditable || /^(input|textarea|select)$/i.test(n?.tagName ?? "")) return;
@@ -1488,92 +1538,194 @@ ${q}
1488
1538
  else if (t.key === "k") e.togglePaused();
1489
1539
  else if (t.key === " ") e.togglePaused();
1490
1540
  else if (t.key === "m") e.toggleMuted();
1491
- else if (t.key === "ArrowUp") p({
1541
+ else if (t.key === "ArrowUp") v({
1492
1542
  direction: "up",
1493
- stepSize: Z
1543
+ stepSize: $
1494
1544
  });
1495
- else if (t.key === "ArrowDown") p({
1545
+ else if (t.key === "ArrowDown") v({
1496
1546
  direction: "down",
1497
- stepSize: Z
1547
+ stepSize: $
1498
1548
  });
1499
1549
  else if (t.key === "ArrowRight") {
1500
1550
  if (!e.duration) return;
1501
- e.seek(Math.min(e.currentTime + Q, e.duration));
1502
- } else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime - Q, 0)) : r = !1;
1551
+ e.seek(Math.min(e.currentTime + Ne, e.duration));
1552
+ } else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime - Ne, 0)) : r = !1;
1503
1553
  r && t.preventDefault();
1504
1554
  };
1505
1555
  return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1506
- }, [e, p]);
1507
- let m = c((e) => {
1508
- e.preventDefault(), e.deltaY < 0 ? p({
1556
+ }, [e, v]);
1557
+ let y = l((e) => {
1558
+ e.preventDefault(), e.deltaY < 0 ? v({
1509
1559
  direction: "up",
1510
- stepSize: Z
1511
- }) : p({
1560
+ stepSize: $
1561
+ }) : v({
1512
1562
  direction: "down",
1513
- stepSize: Z
1563
+ stepSize: $
1514
1564
  });
1515
- }, [p]);
1516
- return l(() => {
1517
- if (s) return s.addEventListener("wheel", m, { passive: !1 }), () => s.removeEventListener("wheel", m);
1518
- }, [s, m]), /* @__PURE__ */ S("div", {
1519
- css: Ne,
1565
+ }, [v]);
1566
+ return u(() => {
1567
+ if (f) return f.addEventListener("wheel", y, { passive: !1 }), () => f.removeEventListener("wheel", y);
1568
+ }, [f, y]), /* @__PURE__ */ C("div", {
1569
+ css: Fe,
1520
1570
  style: { ...a ? {
1521
1571
  opacity: "0",
1522
1572
  pointerEvents: "none"
1523
1573
  } : {} },
1524
- children: [/* @__PURE__ */ x(ve, {}), /* @__PURE__ */ S("div", {
1574
+ children: [/* @__PURE__ */ S(ve, {}), /* @__PURE__ */ C("div", {
1525
1575
  className: "actions",
1526
- children: [/* @__PURE__ */ S("div", {
1576
+ children: [/* @__PURE__ */ C("div", {
1527
1577
  className: "left",
1528
1578
  children: [
1529
- /* @__PURE__ */ x(G, {
1579
+ /* @__PURE__ */ S(K, {
1530
1580
  id: "play",
1531
1581
  tooltipPlace: "top-start",
1532
- text: /* @__PURE__ */ x("button", {
1582
+ text: /* @__PURE__ */ S("button", {
1533
1583
  className: "play",
1534
1584
  type: "button",
1535
1585
  onClick: () => e.togglePaused(),
1536
- children: x(d ? k : t ? O : D, {})
1586
+ children: S(_ ? A : t ? k : O, {})
1537
1587
  }),
1538
- toolTipText: /* @__PURE__ */ x("span", { children: d ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
1588
+ toolTipText: /* @__PURE__ */ S("span", { children: _ ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
1539
1589
  }),
1540
- /* @__PURE__ */ x(Me, { ref: u }),
1541
- /* @__PURE__ */ x("div", {
1590
+ /* @__PURE__ */ S(Me, { ref: m }),
1591
+ /* @__PURE__ */ S("div", {
1542
1592
  className: "time",
1543
1593
  children: he(n, r)
1544
1594
  })
1545
1595
  ]
1546
- }), /* @__PURE__ */ S("div", {
1596
+ }), /* @__PURE__ */ C("div", {
1547
1597
  className: "right",
1548
1598
  children: [
1549
- /* @__PURE__ */ x(De, {}),
1550
- /* @__PURE__ */ x(Ce, {}),
1551
- o ? /* @__PURE__ */ x(G, {
1599
+ /* @__PURE__ */ S(Oe, {}),
1600
+ /* @__PURE__ */ S(Ee, {}),
1601
+ o ? /* @__PURE__ */ S(K, {
1552
1602
  id: "picture-in-picture",
1553
- text: /* @__PURE__ */ x("button", {
1603
+ tooltipPlace: "top-end",
1604
+ text: /* @__PURE__ */ S("button", {
1554
1605
  className: "picture-in-picture",
1555
1606
  type: "button",
1556
1607
  onClick: o,
1557
- children: /* @__PURE__ */ x("img", { src: ye })
1608
+ disabled: h && !g,
1609
+ "aria-label": h ? "Put the subtitles in the video" : "Picture in picture",
1610
+ "aria-pressed": h ? c : void 0,
1611
+ children: h ? /* @__PURE__ */ S(Se, {}) : /* @__PURE__ */ S("img", {
1612
+ src: ye,
1613
+ alt: ""
1614
+ })
1558
1615
  }),
1559
- toolTipText: /* @__PURE__ */ x("span", { children: "Picture in picture" })
1616
+ toolTipText: /* @__PURE__ */ C("span", {
1617
+ css: Pe,
1618
+ children: [/* @__PURE__ */ S("span", {
1619
+ className: "lead",
1620
+ children: h ? g ? c ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
1621
+ }), h && g ? /* @__PURE__ */ S("span", {
1622
+ className: "hint",
1623
+ children: "Then hover the video and click your browser's own pop out button"
1624
+ }) : null]
1625
+ })
1560
1626
  }) : null,
1561
- /* @__PURE__ */ x(G, {
1627
+ /* @__PURE__ */ S(K, {
1562
1628
  id: "full-screen",
1563
1629
  tooltipPlace: "top-end",
1564
- text: /* @__PURE__ */ x("button", {
1630
+ text: /* @__PURE__ */ S("button", {
1565
1631
  className: "full-screen",
1566
1632
  type: "button",
1567
1633
  onClick: () => e.toggleFullscreen(),
1568
- children: x(i ? E : T, {})
1634
+ children: S(i ? D : E, {})
1569
1635
  }),
1570
- toolTipText: /* @__PURE__ */ x("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
1636
+ toolTipText: /* @__PURE__ */ S("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
1571
1637
  })
1572
1638
  ]
1573
1639
  })]
1574
1640
  })]
1575
1641
  });
1576
- }, Fe = 3e3, Ie = p`
1642
+ }, Le = 9e3, Re = m`
1643
+ position: absolute;
1644
+ inset: 0;
1645
+ z-index: 2;
1646
+ pointer-events: none;
1647
+
1648
+ .card {
1649
+ position: absolute;
1650
+ /* Where Firefox draws its own toggle: right aligned, a little past the middle of the height. */
1651
+ top: 52%;
1652
+ right: calc(7 * var(--mp-unit));
1653
+ transform: translateY(-50%);
1654
+
1655
+ display: flex;
1656
+ align-items: center;
1657
+ gap: calc(1.2 * var(--mp-unit));
1658
+
1659
+ max-width: min(calc(42 * var(--mp-unit)), 60%);
1660
+ padding: calc(1.4 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1661
+ border-radius: calc(0.8 * var(--mp-unit));
1662
+ background-color: rgba(20, 20, 22, 0.94);
1663
+ box-shadow: 0 0 calc(2 * var(--mp-unit)) rgba(0, 0, 0, 0.6);
1664
+
1665
+ opacity: 0;
1666
+ transition: opacity 0.25s ease;
1667
+ }
1668
+
1669
+ &.show .card {
1670
+ opacity: 1;
1671
+ }
1672
+
1673
+ .words {
1674
+ display: flex;
1675
+ flex-direction: column;
1676
+ gap: calc(0.3 * var(--mp-unit));
1677
+ }
1678
+
1679
+ .title {
1680
+ ${B.bMedium.bold}
1681
+ color: #fff;
1682
+ }
1683
+
1684
+ .body {
1685
+ ${B.bSmall.regular}
1686
+ color: rgba(255, 255, 255, 0.75);
1687
+ }
1688
+
1689
+ /* Points at the edge the browser's control lives on, which is the whole message. */
1690
+ .arrow {
1691
+ flex: none;
1692
+ font-size: calc(2.6 * var(--mp-unit));
1693
+ line-height: 1;
1694
+ color: #6EA8FE;
1695
+ }
1696
+ `, ze = () => {
1697
+ let e = F((e) => e.burnedInSubtitles), t = F((e) => e.pictureInPictureMode), [n, r] = p(!1);
1698
+ return u(() => {
1699
+ if (t !== "burn-in" || !e) {
1700
+ r(!1);
1701
+ return;
1702
+ }
1703
+ r(!0);
1704
+ let n = setTimeout(() => r(!1), Le);
1705
+ return () => clearTimeout(n);
1706
+ }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ S("div", {
1707
+ css: Re,
1708
+ className: n ? "show" : "",
1709
+ role: "status",
1710
+ children: /* @__PURE__ */ C("div", {
1711
+ className: "card",
1712
+ children: [/* @__PURE__ */ C("div", {
1713
+ className: "words",
1714
+ children: [/* @__PURE__ */ S("div", {
1715
+ className: "title",
1716
+ children: "Subtitles are in the picture"
1717
+ }), /* @__PURE__ */ S("div", {
1718
+ className: "body",
1719
+ children: "Now hover the video and click your browser's own pop out button"
1720
+ })]
1721
+ }), /* @__PURE__ */ S("div", {
1722
+ className: "arrow",
1723
+ "aria-hidden": "true",
1724
+ children: "→"
1725
+ })]
1726
+ })
1727
+ });
1728
+ }, Be = 3e3, Ve = m`
1577
1729
  position: absolute;
1578
1730
  inset: 0;
1579
1731
  z-index: 2;
@@ -1584,7 +1736,7 @@ ${q}
1584
1736
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
1585
1737
  not, and transitioning it holds the item on screen for the length of the fade. */
1586
1738
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
1587
- `, Le = p`
1739
+ `, He = m`
1588
1740
  position: relative;
1589
1741
  background-color: black;
1590
1742
  display: flex;
@@ -1616,38 +1768,38 @@ ${q}
1616
1768
  &.hide {
1617
1769
  cursor: none;
1618
1770
  }
1619
- `, $ = (e, t = "") => a.toArray(e).flatMap((e, n) => {
1620
- let r = `${t}${s(e) && e.key != null ? e.key : n}`;
1621
- return s(e) && e.type === o ? $(e.props.children, `${r}/`) : [{
1771
+ `, Ue = (e, t = "") => o.toArray(e).flatMap((e, n) => {
1772
+ let r = `${t}${c(e) && e.key != null ? e.key : n}`;
1773
+ return c(e) && e.type === s ? Ue(e.props.children, `${r}/`) : [{
1622
1774
  key: r,
1623
1775
  item: e
1624
1776
  }];
1625
- }), Re = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
1626
- let o = P(), s = P((e) => e.hideUI), c = P((e) => e.setHideUI), u = d(void 0), f = d("mouse");
1627
- l(() => () => clearTimeout(u.current), []);
1777
+ }), We = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
1778
+ let o = F(), s = F((e) => e.hideUI), c = F((e) => e.setHideUI), l = f(void 0), d = f("mouse");
1779
+ u(() => () => clearTimeout(l.current), []);
1628
1780
  let p = () => {
1629
- c(!1), clearTimeout(u.current), u.current = setTimeout(() => c(!0), Fe);
1781
+ c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), Be);
1630
1782
  };
1631
- return /* @__PURE__ */ S("div", {
1632
- css: Le,
1783
+ return /* @__PURE__ */ C("div", {
1784
+ css: He,
1633
1785
  ref: e,
1634
1786
  onPointerMove: (e) => {
1635
- f.current = e.pointerType, e.pointerType === "mouse" && p();
1787
+ d.current = e.pointerType, e.pointerType === "mouse" && p();
1636
1788
  },
1637
1789
  onPointerDown: (e) => {
1638
- f.current = e.pointerType;
1790
+ d.current = e.pointerType;
1639
1791
  },
1640
1792
  onMouseOut: (e) => {
1641
1793
  let t = e.relatedTarget;
1642
1794
  if (t && e.currentTarget.contains(t)) return;
1643
1795
  let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
1644
- e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(u.current), c(!0));
1796
+ e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(l.current), c(!0));
1645
1797
  },
1646
1798
  className: s ? "hide" : "",
1647
1799
  children: [
1648
- /* @__PURE__ */ x(me, { onCanvasRef: n }),
1649
- $(r).map(({ key: e, item: t }) => /* @__PURE__ */ x("div", {
1650
- css: Ie,
1800
+ /* @__PURE__ */ S(me, { onCanvasRef: n }),
1801
+ Ue(r).map(({ key: e, item: t }) => /* @__PURE__ */ S("div", {
1802
+ css: Ve,
1651
1803
  style: { ...s ? {
1652
1804
  opacity: "0",
1653
1805
  visibility: "hidden",
@@ -1655,89 +1807,94 @@ ${q}
1655
1807
  } : {} },
1656
1808
  children: t
1657
1809
  }, e)),
1658
- i === !1 ? null : /* @__PURE__ */ x(Pe, {}),
1659
- /* @__PURE__ */ S("div", {
1810
+ i === !1 ? null : /* @__PURE__ */ S(Ie, {}),
1811
+ /* @__PURE__ */ S(ze, {}),
1812
+ /* @__PURE__ */ C("div", {
1660
1813
  className: "video",
1661
1814
  onClick: () => {
1662
- if (f.current === "mouse") {
1815
+ if (d.current === "mouse") {
1663
1816
  o.togglePaused();
1664
1817
  return;
1665
1818
  }
1666
- s ? p() : (clearTimeout(u.current), c(!0));
1819
+ s ? p() : (clearTimeout(l.current), c(!0));
1667
1820
  },
1668
- children: [t ? /* @__PURE__ */ x("video", {
1821
+ children: [t ? /* @__PURE__ */ S("video", {
1669
1822
  ref: t,
1670
1823
  playsInline: !0
1671
1824
  }) : null, a]
1672
1825
  })
1673
1826
  ]
1674
1827
  });
1675
- }, ze = ({ options: e, children: t }) => {
1676
- let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: u, thumbnailRead: d, thumbnailsEnabled: p } = r ?? {}, m = _(), h = g(), [v, y] = f(null), [b, S] = f(null), C = n?.media ?? v;
1677
- l(() => (m?.(C), () => m?.(null)), [C, m]), oe(v, b, r);
1678
- let w = L({
1828
+ }, Ge = ({ options: e, children: t }) => {
1829
+ let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: l, thumbnailRead: d, thumbnailsEnabled: f } = r ?? {}, m = v(), h = _(), [g, y] = p(null), [b, x] = p(null), C = n?.media ?? g;
1830
+ u(() => (m?.(C), () => m?.(null)), [C, m]), oe(g, b, r);
1831
+ let w = R({
1679
1832
  publicPath: s,
1680
1833
  workerUrl: c,
1681
- length: p === !1 ? void 0 : a,
1682
- read: d ?? u,
1834
+ length: f === !1 ? void 0 : a,
1835
+ read: d ?? l,
1683
1836
  downloadedRanges: o
1684
- }), T = n?.thumbnails?.all ?? w, E = R(v, b), D = P((e) => e.setSourceState);
1685
- l(() => {
1686
- D({
1837
+ }), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = z(g, b), k = F((e) => e.setSourceState);
1838
+ u(() => {
1839
+ k({
1687
1840
  title: i,
1688
1841
  size: a,
1689
1842
  downloadedRanges: o
1690
1843
  });
1691
1844
  }, [
1692
- D,
1845
+ k,
1693
1846
  i,
1694
1847
  a,
1695
1848
  o
1696
1849
  ]);
1697
- let O = n?.thumbnails?.at;
1698
- l(() => {
1699
- D({
1850
+ let A = n?.thumbnails?.at;
1851
+ u(() => {
1852
+ k({
1700
1853
  thumbnails: T,
1701
- thumbnailAt: O,
1702
- togglePictureInPicture: E
1854
+ thumbnailAt: A,
1855
+ togglePictureInPicture: E,
1856
+ pictureInPictureMode: D,
1857
+ burnedInSubtitles: O
1703
1858
  });
1704
1859
  }, [
1705
- D,
1860
+ k,
1706
1861
  T,
1707
- O,
1708
- E
1862
+ A,
1863
+ E,
1864
+ D,
1865
+ O
1709
1866
  ]);
1710
- let k = n?.subtitles?.selection, A = n?.audioTracks?.selection;
1711
- return l(() => {
1712
- k && D({
1713
- subtitleTracks: k.options.map(({ id: e, label: t, disabled: n }) => ({
1867
+ let j = n?.subtitles?.selection, M = n?.audioTracks?.selection;
1868
+ return u(() => {
1869
+ j && k({
1870
+ subtitleTracks: j.options.map(({ id: e, label: t, disabled: n }) => ({
1714
1871
  id: e,
1715
1872
  label: t,
1716
1873
  disabled: n
1717
1874
  })),
1718
- selectedSubtitleTrack: k.selectedId ?? void 0,
1719
- selectSubtitleTrack: (e) => k.select(e == null ? null : String(e)),
1720
- subtitleOffLabel: k.offLabel
1875
+ selectedSubtitleTrack: j.selectedId ?? void 0,
1876
+ selectSubtitleTrack: (e) => j.select(e == null ? null : String(e)),
1877
+ subtitleOffLabel: j.offLabel
1721
1878
  });
1722
- }, [D, k]), l(() => {
1723
- A && D({
1724
- audioTracks: A.options.map(({ id: e, label: t, disabled: n }) => ({
1879
+ }, [k, j]), u(() => {
1880
+ M && k({
1881
+ audioTracks: M.options.map(({ id: e, label: t, disabled: n }) => ({
1725
1882
  id: e,
1726
1883
  label: t,
1727
1884
  disabled: n
1728
1885
  })),
1729
- selectedAudioTrack: A.selectedId ?? void 0,
1730
- selectAudioTrack: (e) => A.select(String(e))
1886
+ selectedAudioTrack: M.selectedId ?? void 0,
1887
+ selectAudioTrack: (e) => M.select(String(e))
1731
1888
  });
1732
- }, [D, A]), /* @__PURE__ */ x(Re, {
1889
+ }, [k, M]), /* @__PURE__ */ S(We, {
1733
1890
  ref: h,
1734
1891
  onVideoRef: n ? void 0 : y,
1735
- onCanvasRef: S,
1892
+ onCanvasRef: x,
1736
1893
  overlay: e.overlay,
1737
1894
  controls: e.controls,
1738
1895
  children: t
1739
1896
  });
1740
- }, Be = p`
1897
+ }, Ke = m`
1741
1898
  /**
1742
1899
  * The chrome's whole scale, in one place.
1743
1900
  *
@@ -1807,17 +1964,17 @@ ${q}
1807
1964
  height: 100%;
1808
1965
  width: 100%;
1809
1966
  overflow: hidden;
1810
- `, Ve = (e) => /* @__PURE__ */ x("div", {
1811
- css: Be,
1812
- children: /* @__PURE__ */ x(N.Provider, { children: /* @__PURE__ */ x(ze, {
1967
+ `, qe = (e) => /* @__PURE__ */ S("div", {
1968
+ css: Ke,
1969
+ children: /* @__PURE__ */ S(P.Provider, { children: /* @__PURE__ */ S(Ge, {
1813
1970
  options: e,
1814
1971
  children: e.children
1815
1972
  }) })
1816
- }), He = (e) => !!e && typeof e == "object" && "at" in e, Ue = (e) => !!e && typeof e == "object" && "selection" in e, We = ({ blob: e, name: t }) => ({
1973
+ }), Je = (e) => !!e && typeof e == "object" && "at" in e, Ye = (e) => !!e && typeof e == "object" && "selection" in e, Xe = ({ blob: e, name: t }) => ({
1817
1974
  length: e.size,
1818
1975
  name: t ?? (e instanceof File ? e.name : void 0),
1819
1976
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
1820
- }), Ge = async (e, t) => {
1977
+ }), Ze = async (e, t) => {
1821
1978
  let n = await fetch(e, {
1822
1979
  headers: { Range: "bytes=0-1" },
1823
1980
  credentials: t
@@ -1827,8 +1984,8 @@ ${q}
1827
1984
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
1828
1985
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
1829
1986
  return i;
1830
- }, Ke = async ({ url: e, length: t, name: n, credentials: r }) => {
1831
- let i = t ?? await Ge(e, r);
1987
+ }, Qe = async ({ url: e, length: t, name: n, credentials: r }) => {
1988
+ let i = t ?? await Ze(e, r);
1832
1989
  return {
1833
1990
  length: i,
1834
1991
  name: n,
@@ -1841,9 +1998,9 @@ ${q}
1841
1998
  return a.arrayBuffer();
1842
1999
  }
1843
2000
  };
1844
- }, qe = async (e) => {
1845
- if ("blob" in e) return We(e);
1846
- if ("url" in e) return Ke(e);
2001
+ }, $e = async (e) => {
2002
+ if ("blob" in e) return Xe(e);
2003
+ if ("url" in e) return Qe(e);
1847
2004
  if ("read" in e) return {
1848
2005
  length: e.length,
1849
2006
  name: e.name,
@@ -1852,4 +2009,4 @@ ${q}
1852
2009
  throw Error(`Unknown source type: ${e}`);
1853
2010
  };
1854
2011
  //#endregion
1855
- export { Ve as MediaPlayer, Ve as default, N as Player, n as SUBTITLES_OFF, i as createPictureInPicture, r as createSubtitleRenderer, t as createThumbnailGenerator, qe as inputToRemuxerInput, Ue as isDelegatedTracks, He as isExternalThumbnails, M as sourceFeature, e as startPlayback, R as usePictureInPicture, P as usePlayer, L as useSeekThumbnails };
2012
+ export { qe as MediaPlayer, qe as default, P as Player, i as SUBTITLES_OFF, a as createPictureInPicture, t as createSubtitleRenderer, r as createThumbnailGenerator, $e as inputToRemuxerInput, Ye as isDelegatedTracks, Je as isExternalThumbnails, N as sourceFeature, e as startPlayback, z as usePictureInPicture, F as usePlayer, R as useSeekThumbnails };