@banou/media-player 0.8.2 → 0.8.4

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,13 +1,13 @@
1
1
  import { i as e, n as t, o as n, s as r, t as i } from "./engine-Dmc7JSd9.js";
2
- import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
3
- import { css as u, keyframes as d } from "@emotion/react";
4
- import { createPlayer as f, useContainerAttach as p, useMediaAttach as m } from "@videojs/react";
5
- import { definePlayerFeature as h, videoFeatures as g } from "@videojs/core/dom";
6
- import { Fragment as _, jsx as v, jsxs as y } from "@emotion/react/jsx-runtime";
7
- import { ChevronLeft as b, ChevronRight as x, Maximize as S, Minimize as C, Pause as w, Play as T, RotateCcw as E, Settings as D, Volume1 as O, Volume2 as k, VolumeX as A } from "react-feather";
8
- import { Tooltip as j } from "react-tooltip";
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 M, VolumeX as ee } from "react-feather";
8
+ import { Tooltip as te } from "react-tooltip";
9
9
  //#region src/lib/react/source-feature.ts
10
- var ee = {
10
+ var ne = {
11
11
  indexes: [],
12
12
  thumbnails: [],
13
13
  subtitleTracks: [],
@@ -22,19 +22,19 @@ var ee = {
22
22
  playbackError: null,
23
23
  ready: !1,
24
24
  setSourceState: () => {}
25
- }, M = h({
25
+ }, N = v({
26
26
  name: "source",
27
- state: () => ({ ...ee }),
27
+ state: () => ({ ...ne }),
28
28
  attach({ set: e }) {
29
29
  e({
30
30
  setSourceState: (t) => e(t),
31
31
  setHideUI: (t) => e({ hideUI: t })
32
32
  });
33
33
  }
34
- }), N = f({
35
- features: [...g, M],
34
+ }), P = h({
35
+ features: [...y, N],
36
36
  displayName: "MediaPlayer"
37
- }), P = N.usePlayer, te = (e) => {
37
+ }), F = P.usePlayer, re = (e) => {
38
38
  if (!(!e || e === "und")) try {
39
39
  return new Intl.DisplayNames([navigator.language || "en"], {
40
40
  type: "language",
@@ -43,35 +43,35 @@ var ee = {
43
43
  } catch {
44
44
  return;
45
45
  }
46
- }, F = (e) => e?.replace(/_/g, " ").trim() || void 0, ne = (e) => {
47
- let t = e.map((e) => te(e.language) ?? F(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
46
+ }, I = (e) => e?.replace(/_/g, " ").trim() || void 0, L = (e) => {
47
+ let t = e.map((e) => re(e.language) ?? I(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
48
48
  ...e,
49
49
  [t]: (e[t] ?? 0) + 1
50
50
  }), {});
51
51
  return e.map((e, r) => {
52
- let i = t[r], a = F(e.title);
52
+ let i = t[r], a = I(e.title);
53
53
  return {
54
54
  track: e,
55
55
  label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
56
56
  };
57
57
  });
58
- }, I = (e) => ne(e).map(({ track: e, label: t }) => ({
58
+ }, R = (e) => L(e).map(({ track: e, label: t }) => ({
59
59
  id: e.streamIndex,
60
60
  label: t
61
- })), re = (t, n, r) => {
62
- let i = P(), { read: s, size: u, publicPath: d = "", libavWorkerUrl: f = "", jassubWorkerUrl: p = "", jassubWasmUrl: m = "", jassubLegacyWasmUrl: h, defaultFontUrl: g, bufferSize: _, autoplay: v = !1 } = r ?? {}, [y, b] = l(void 0), x = c(null), S = c(0), C = c(!1), w = c(s);
63
- w.current = s;
64
- let T = c(r?.onSeek);
61
+ })), ie = (t, n, r) => {
62
+ let i = F(), { 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);
63
+ w.current = a;
64
+ let T = d(r?.onSeek);
65
65
  T.current = r?.onSeek;
66
- let E = c(r?.onPlaybackError);
66
+ let E = d(r?.onPlaybackError);
67
67
  E.current = r?.onPlaybackError;
68
- let D = a((e) => {
68
+ let D = c((e) => {
69
69
  let t = typeof e == "number" ? e : void 0;
70
70
  C.current = !0, i.setSourceState({ selectedSubtitleTrack: t }), x.current?.selectSubtitleStream(t);
71
- }, [i]), O = a((e) => {
71
+ }, [i]), O = c((e) => {
72
72
  typeof e == "number" && (i.setSourceState({ selectedAudioTrack: e }), b(e));
73
- }, [i]), k = P((e) => e.setSourceState);
74
- o(() => {
73
+ }, [i]), k = F((e) => e.setSourceState);
74
+ l(() => {
75
75
  k({
76
76
  selectSubtitleTrack: D,
77
77
  selectAudioTrack: O
@@ -80,25 +80,25 @@ var ee = {
80
80
  k,
81
81
  D,
82
82
  O
83
- ]), o(() => {
84
- if (!t || !n || !u || !s) return;
83
+ ]), l(() => {
84
+ if (!t || !n || !o || !a) return;
85
85
  let r = !1;
86
86
  i.setSourceState({
87
87
  playbackError: null,
88
88
  ready: !1
89
89
  });
90
- let a = (e) => {
90
+ let c = (e) => {
91
91
  r || (console.error("playback failed", e), i.setSourceState({ playbackError: e }), E.current?.(e));
92
92
  };
93
93
  return (async () => {
94
94
  try {
95
- let o = await e({
95
+ let a = await e({
96
96
  videoElement: t,
97
97
  canvasElement: n,
98
98
  read: (e, t) => w.current(e, t),
99
- length: u,
100
- publicPath: d,
101
- libavWorkerUrl: f,
99
+ length: o,
100
+ publicPath: s,
101
+ libavWorkerUrl: u,
102
102
  jassubWorkerUrl: p,
103
103
  jassubWasmUrl: m,
104
104
  jassubLegacyWasmUrl: h,
@@ -108,33 +108,33 @@ var ee = {
108
108
  onReady: () => {
109
109
  r || (i.setSourceState({ ready: !0 }), S.current > 0 && (t.currentTime = S.current, S.current = 0), v && t.play().catch(() => {}));
110
110
  },
111
- onError: a,
111
+ onError: c,
112
112
  onRecovered: () => {
113
113
  r || i.setSourceState({ playbackError: null });
114
114
  },
115
115
  onSeek: (e) => T.current?.(e),
116
116
  onSubtitleStreams: (e) => {
117
117
  r || i.setSourceState({
118
- subtitleTracks: I(e),
118
+ subtitleTracks: R(e),
119
119
  ...C.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
120
120
  });
121
121
  },
122
122
  onAudioStreams: (e, t) => {
123
123
  r || i.setSourceState({
124
- audioTracks: I(e),
124
+ audioTracks: R(e),
125
125
  selectedAudioTrack: t
126
126
  });
127
127
  }
128
128
  });
129
129
  if (r) {
130
- o.destroy();
130
+ a.destroy();
131
131
  return;
132
132
  }
133
- x.current = o, i.setSourceState({ indexes: o.indexes });
134
- let s = i.selectedSubtitleTrack;
135
- typeof s == "number" && o.selectSubtitleStream(s);
133
+ x.current = a, i.setSourceState({ indexes: a.indexes });
134
+ let l = i.selectedSubtitleTrack;
135
+ typeof l == "number" && a.selectSubtitleStream(l);
136
136
  } catch (e) {
137
- a(e);
137
+ c(e);
138
138
  }
139
139
  })(), () => {
140
140
  r = !0, S.current = t.currentTime, x.current?.destroy(), x.current = null, i.setSourceState({ ready: !1 });
@@ -143,9 +143,9 @@ var ee = {
143
143
  i,
144
144
  t,
145
145
  n,
146
+ o,
147
+ s,
146
148
  u,
147
- d,
148
- f,
149
149
  p,
150
150
  m,
151
151
  h,
@@ -154,44 +154,44 @@ var ee = {
154
154
  y,
155
155
  v
156
156
  ]);
157
- }, L = 5e3, R = 6e4, z = ({ publicPath: e, workerUrl: n, length: r, read: i, downloadedRanges: a }) => {
158
- let [u, d] = l([]), f = c(null), p = c(i);
157
+ }, ae = 5e3, oe = 6e4, z = ({ publicPath: e, workerUrl: n, length: r, read: i, downloadedRanges: a }) => {
158
+ let [o, s] = f([]), c = d(null), p = d(i);
159
159
  p.current = i;
160
- let m = s(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = c(m);
161
- return h.current = m, o(() => {
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
162
  if (!r || !i || !e || !n) return;
163
- let a = !1, o = null, s, c = L, l = () => {
163
+ let a = !1, o = null, l, u = ae, d = () => {
164
164
  t({
165
165
  publicPath: e,
166
166
  workerUrl: n,
167
167
  length: r,
168
168
  read: (e, t) => p.current(e, t),
169
169
  onThumbnails: (e) => {
170
- a || d(e);
170
+ a || s(e);
171
171
  }
172
172
  }).then((e) => {
173
173
  if (a) {
174
174
  e.destroy();
175
175
  return;
176
176
  }
177
- o = e, f.current = e, e.update(h.current);
177
+ o = e, c.current = e, e.update(h.current);
178
178
  }, () => {
179
- a || (s = setTimeout(l, c), c = Math.min(c * 2, R));
179
+ a || (l = setTimeout(d, u), u = Math.min(u * 2, oe));
180
180
  });
181
181
  };
182
- return l(), () => {
183
- a = !0, clearTimeout(s), f.current = null, o?.destroy(), d([]);
182
+ return d(), () => {
183
+ a = !0, clearTimeout(l), c.current = null, o?.destroy(), s([]);
184
184
  };
185
185
  }, [
186
186
  r,
187
187
  e,
188
188
  n
189
- ]), o(() => {
190
- f.current?.update(m);
191
- }, [m]), u;
189
+ ]), l(() => {
190
+ c.current?.update(m);
191
+ }, [m]), o;
192
192
  }, B = (e, t) => {
193
- let n = P(), r = c(null);
194
- o(() => {
193
+ let n = F(), r = d(null);
194
+ l(() => {
195
195
  if (!e || !t) return;
196
196
  let a = i({
197
197
  video: e,
@@ -206,12 +206,12 @@ var ee = {
206
206
  t,
207
207
  n
208
208
  ]);
209
- let s = a(() => {
209
+ let a = c(() => {
210
210
  r.current?.toggle().catch((e) => {
211
211
  console.warn("picture in picture was refused", e);
212
212
  });
213
213
  }, []);
214
- return e && t ? s : null;
214
+ return e && t ? a : null;
215
215
  }, V = {
216
216
  headings: {
217
217
  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 ",
@@ -239,75 +239,43 @@ var ee = {
239
239
  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
240
  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
241
  }
242
- }, ie = u`
242
+ }, se = p`
243
243
  top: unset !important;
244
244
  left: unset !important;
245
245
  width: 100%;
246
246
  height: 100%;
247
247
  margin: auto;
248
248
  pointer-events: none;
249
- `, ae = u`
249
+ `, ce = p`
250
250
  position: absolute;
251
251
  top: 0;
252
252
  left: 0;
253
253
  width: 100%;
254
+ padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
255
+ /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
256
+ padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
257
+ ${V.headings.small}
258
+ color: white;
259
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
254
260
  z-index: 2;
255
- /* the video underneath keeps the click that toggles playback; anything in the slot that needs a
256
- pointer takes it back for itself */
257
261
  pointer-events: none;
258
262
 
259
- display: flex;
260
- align-items: flex-start;
261
- gap: calc(1.6 * var(--mp-unit));
262
-
263
- /* longhands per breakpoint, never the shorthand: a nested at-rule is hoisted after the rule it
264
- sits in, so a shorthand in a media query would override the longhands above it and silently
265
- drop the safe-area insets. Those clear a notch once the player is fullscreen and resolve to
266
- zero everywhere else. */
267
- padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
268
- padding-bottom: calc(1.2 * var(--mp-unit));
269
- padding-left: calc(calc(1.6 * var(--mp-unit)) + env(safe-area-inset-left, 0px));
270
- padding-right: calc(calc(1.6 * var(--mp-unit)) + env(safe-area-inset-right, 0px));
263
+ /* one line with an ellipsis until there is width to wrap, since a release filename would
264
+ otherwise run to four lines on a phone */
265
+ white-space: nowrap;
266
+ overflow: hidden;
267
+ text-overflow: ellipsis;
271
268
 
272
269
  @media (min-width: 768px) {
270
+ padding: calc(2.4 * var(--mp-unit));
273
271
  padding-top: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
274
- padding-bottom: calc(2.4 * var(--mp-unit));
275
- padding-left: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-left, 0px));
276
- padding-right: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-right, 0px));
272
+ white-space: normal;
273
+ overflow: visible;
277
274
  }
278
275
 
279
276
  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%);
280
- /* visibility, not only opacity: a slot child that took pointer events back would otherwise stay
281
- hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events
282
- does not, and transitioning it holds the element visible for the length of the fade. */
283
- transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
284
-
285
- .title {
286
- ${V.headings.small}
287
- color: white;
288
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
289
-
290
- /* one line with an ellipsis until there is width to wrap, since a release filename would
291
- otherwise run to four lines on a phone */
292
- flex: 1;
293
- min-width: 0;
294
- white-space: nowrap;
295
- overflow: hidden;
296
- text-overflow: ellipsis;
297
-
298
- @media (min-width: 768px) {
299
- white-space: normal;
300
- overflow: visible;
301
- }
302
- }
303
-
304
- /* pinned right with or without a title, so an app's readout does not jump sideways when a
305
- filename arrives late */
306
- .app-slot {
307
- margin-left: auto;
308
- flex: none;
309
- }
310
- `, oe = u`
277
+ transition: opacity 0.1s cubic-bezier(.4,0,1,1);
278
+ `, le = p`
311
279
  position: absolute;
312
280
  inset: 0;
313
281
  z-index: 2;
@@ -323,11 +291,11 @@ var ee = {
323
291
  border-radius: 50%;
324
292
  border: 3px solid rgba(255, 255, 255, 0.25);
325
293
  border-top-color: #fff;
326
- animation: ${d`
294
+ animation: ${m`
327
295
  to { transform: rotate(360deg); }
328
296
  `} 0.8s linear infinite;
329
297
  }
330
- `, se = u`
298
+ `, ue = p`
331
299
  position: absolute;
332
300
  inset: auto 0 20%;
333
301
  z-index: 3;
@@ -337,39 +305,33 @@ var ee = {
337
305
  ${V.bLarge.regular}
338
306
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
339
307
  pointer-events: none;
340
- `, ce = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", le = ({ onCanvasRef: e, overlay: t }) => {
341
- let n = P((e) => e.title), r = P((e) => e.hideUI), i = P((e) => e.playbackError), a = P((e) => e.ready), o = P((e) => e.size), s = P((e) => e.waiting);
342
- return /* @__PURE__ */ y(_, { children: [
343
- n || t ? /* @__PURE__ */ y("div", {
344
- css: ae,
345
- style: { ...r ? {
308
+ `, de = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", fe = ({ onCanvasRef: e }) => {
309
+ 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);
310
+ return /* @__PURE__ */ S(b, { children: [
311
+ t ? /* @__PURE__ */ x("div", {
312
+ className: "title",
313
+ css: ce,
314
+ style: { ...n ? {
346
315
  opacity: "0",
347
- visibility: "hidden",
348
316
  pointerEvents: "none"
349
317
  } : {} },
350
- children: [n ? /* @__PURE__ */ v("div", {
351
- className: "title",
352
- children: n
353
- }) : void 0, t ? /* @__PURE__ */ v("div", {
354
- className: "app-slot",
355
- children: t
356
- }) : void 0]
318
+ children: t
357
319
  }) : void 0,
358
- (o ? !a : s) && !i ? /* @__PURE__ */ v("div", { css: oe }) : void 0,
359
- i ? /* @__PURE__ */ v("div", {
360
- css: se,
361
- children: ce(i)
320
+ (a ? !i : o) && !r ? /* @__PURE__ */ x("div", { css: le }) : void 0,
321
+ r ? /* @__PURE__ */ x("div", {
322
+ css: ue,
323
+ children: de(r)
362
324
  }) : void 0,
363
- /* @__PURE__ */ v("canvas", {
325
+ /* @__PURE__ */ x("canvas", {
364
326
  ref: e,
365
- css: ie
327
+ css: se
366
328
  })
367
329
  ] });
368
330
  }, H = 1e-4, U = 1, W = (e) => Math.max(H, Math.min(U, e)) ** 2, G = (e) => Math.max(H, Math.min(U, e)) ** (U / 2), K = (e) => {
369
331
  if (e === void 0) return "0:00";
370
332
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
371
333
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
372
- }, ue = (e, t) => `${K(e)} / ${K(t)}`, de = (e) => u`
334
+ }, pe = (e, t) => `${K(e)} / ${K(t)}`, me = (e) => p`
373
335
  display: flex;
374
336
  justify-content: flex-end;
375
337
 
@@ -382,16 +344,16 @@ var ee = {
382
344
  ${V.bMedium.regular}
383
345
  }
384
346
 
385
- ${e === "sm" && u`
347
+ ${e === "sm" && p`
386
348
  padding: calc(0.4 * var(--mp-unit))!important;
387
349
  `}
388
- ${e === "md" && u`
350
+ ${e === "md" && p`
389
351
  padding: calc(0.6 * var(--mp-unit))!important;
390
352
  `}
391
- ${e === "lg" && u`
353
+ ${e === "lg" && p`
392
354
  padding: calc(1.2 * var(--mp-unit))!important;
393
355
  `}
394
- `, q = ({ 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__ */ y(_, { children: [/* @__PURE__ */ v("div", {
356
+ `, q = ({ 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", {
395
357
  "data-tooltip-id": e,
396
358
  "data-open": !0,
397
359
  "data-tooltip-offset": a,
@@ -399,28 +361,28 @@ var ee = {
399
361
  "data-tooltip-delay-hide": i,
400
362
  "data-tooltip-place": o,
401
363
  children: n
402
- }), !s && /* @__PURE__ */ v(j, {
403
- css: de(c),
364
+ }), !s && /* @__PURE__ */ x(te, {
365
+ css: me(c),
404
366
  id: e,
405
367
  noArrow: !0,
406
368
  children: t
407
369
  })] }), J = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
408
- let [i, s] = l(!1), u = c(t);
409
- u.current = t;
410
- let d = c(null), f = a((t, r) => {
370
+ let [i, a] = f(!1), o = d(t);
371
+ o.current = t;
372
+ let s = d(null), u = c((t, r) => {
411
373
  let i = e.current;
412
374
  if (!i) return 0;
413
375
  let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
414
376
  return Math.min(Math.max(l, 0), 1);
415
- }, [e, n]), p = a((e) => {
416
- r || e.button > 0 || (d.current = e.pointerId, e.currentTarget.setPointerCapture?.(e.pointerId), s(!0), u.current(f(e.clientX, e.clientY)));
417
- }, [r, f]), m = a((e) => {
418
- d.current === e.pointerId && u.current(f(e.clientX, e.clientY));
419
- }, [f]), h = a((e) => {
420
- d.current === e.pointerId && (d.current = null, e.currentTarget.releasePointerCapture?.(e.pointerId), s(!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) => {
382
+ s.current === e.pointerId && (s.current = null, e.currentTarget.releasePointerCapture?.(e.pointerId), a(!1));
421
383
  }, []);
422
- return o(() => {
423
- r && (d.current = null, s(!1));
384
+ return l(() => {
385
+ r && (s.current = null, a(!1));
424
386
  }, [r]), {
425
387
  dragging: i,
426
388
  handlers: {
@@ -431,7 +393,7 @@ var ee = {
431
393
  style: { touchAction: "none" }
432
394
  }
433
395
  };
434
- }, fe = u`
396
+ }, he = p`
435
397
  position: relative;
436
398
  height: calc(.4 * var(--mp-unit));
437
399
 
@@ -588,30 +550,30 @@ var ee = {
588
550
  --thumbnail-width: calc(18 * var(--mp-unit));
589
551
  --thumbnail-half: calc(9 * var(--mp-unit));
590
552
  }
591
- `, pe = () => {
592
- 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), u = P((e) => e.thumbnails), d = P((e) => e.thumbnailAt), f = c(null), [p, m] = l(void 0), [h, g] = l(void 0), _ = c(void 0), { dragging: b, handlers: x } = J({
593
- ref: f,
553
+ `, ge = () => {
554
+ 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 = d(null), [p, m] = f(void 0), [h, g] = f(void 0), _ = d(void 0), { dragging: v, handlers: y } = J({
555
+ ref: c,
594
556
  onChange: (e) => {
595
557
  m(e), _.current !== "mouse" && g(e * n);
596
558
  }
597
- }), S = (e) => {
598
- _.current = e.pointerType, x.onPointerDown(e);
559
+ }), b = (e) => {
560
+ _.current = e.pointerType, y.onPointerDown(e);
599
561
  }, C = (e) => {
600
- x.onPointerUp(e), e.pointerType !== "mouse" && g(void 0);
562
+ y.onPointerUp(e), e.pointerType !== "mouse" && g(void 0);
601
563
  }, w = (e) => {
602
- if (!f.current) return;
603
- let { left: t, right: r } = f.current.getBoundingClientRect();
564
+ if (!c.current) return;
565
+ let { left: t, right: r } = c.current.getBoundingClientRect();
604
566
  return Math.min(Math.max((e - t) / (r - t), 0), 1) * n;
605
567
  }, T = (e) => {
606
568
  g(w(e.clientX));
607
569
  }, E = () => {
608
- f.current && g(void 0);
609
- }, D = (e) => n ? e / n * 100 : 0, O = s(() => i?.map((e, t) => {
570
+ c.current && g(void 0);
571
+ }, D = (e) => n ? e / n * 100 : 0, O = u(() => i?.map((e, t) => {
610
572
  if (!r || !n) return null;
611
573
  let i = a.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), o = i.at(0), s = i.at(-1);
612
574
  if (!o || !s) return null;
613
575
  let c = o.timestamp / n, l = s.timestamp / n, u = Number((l - c).toFixed(2)), d = c * 100;
614
- return /* @__PURE__ */ v("div", {
576
+ return /* @__PURE__ */ x("div", {
615
577
  className: "loaded-part",
616
578
  style: {
617
579
  transform: `scaleX(${u})`,
@@ -622,12 +584,12 @@ var ee = {
622
584
  n,
623
585
  a.length,
624
586
  i?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
625
- ]), k = s(() => {
587
+ ]), k = u(() => {
626
588
  if (!h || h < 0) return;
627
589
  let e = Math.floor(h / 3600), t = Math.floor((h - e * 3600) / 60), n = Math.floor(h - e * 3600 - t * 60);
628
590
  return `${e > 0 ? `${e}:` : ""}${t < 10 ? "0" : ""}${t}:${n < 10 ? "0" : ""}${n}`;
629
591
  }, [h]);
630
- o(() => {
592
+ l(() => {
631
593
  if (p === void 0 || !n) return;
632
594
  let t = p * n;
633
595
  e.seek(t);
@@ -636,59 +598,59 @@ var ee = {
636
598
  p,
637
599
  n
638
600
  ]);
639
- let A = s(() => !n || typeof t != "number" ? 0 : t / n, [n, t]), j = s(() => {
601
+ let A = u(() => !n || typeof t != "number" ? 0 : t / n, [n, t]), j = u(() => {
640
602
  if (h) {
641
- if (d) return d(h);
642
- if (u.length) return u.find(({ startTime: e, endTime: t }) => e <= h && h < t);
603
+ if (s) return s(h);
604
+ if (o.length) return o.find(({ startTime: e, endTime: t }) => e <= h && h < t);
643
605
  }
644
606
  }, [
645
- u,
646
- d,
607
+ o,
608
+ s,
647
609
  h
648
610
  ]);
649
- return /* @__PURE__ */ y("div", {
650
- css: fe,
651
- ref: f,
652
- className: b ? "progress-bar dragging" : "progress-bar",
611
+ return /* @__PURE__ */ S("div", {
612
+ css: he,
613
+ ref: c,
614
+ className: v ? "progress-bar dragging" : "progress-bar",
653
615
  onMouseMove: T,
654
616
  onMouseOut: E,
655
617
  children: [
656
- /* @__PURE__ */ v("div", { className: "background-bar" }),
657
- h ? /* @__PURE__ */ v("div", {
618
+ /* @__PURE__ */ x("div", { className: "background-bar" }),
619
+ h ? /* @__PURE__ */ x("div", {
658
620
  className: "cursor-time",
659
621
  style: { left: `clamp(calc(1.8 * var(--mp-unit)), ${D(h)}%, calc(100% - calc(1.8 * var(--mp-unit))))` },
660
622
  children: k
661
623
  }) : void 0,
662
- /* @__PURE__ */ v("div", { className: "progress" }),
663
- /* @__PURE__ */ v("div", {
624
+ /* @__PURE__ */ x("div", { className: "progress" }),
625
+ /* @__PURE__ */ x("div", {
664
626
  className: "loaded",
665
627
  children: O
666
628
  }),
667
- /* @__PURE__ */ v("div", { className: "hover" }),
668
- /* @__PURE__ */ v("div", {
629
+ /* @__PURE__ */ x("div", { className: "hover" }),
630
+ /* @__PURE__ */ x("div", {
669
631
  className: "play-container",
670
- children: /* @__PURE__ */ v("div", {
632
+ children: /* @__PURE__ */ x("div", {
671
633
  className: "play",
672
634
  style: { transform: `scaleX(${A})` }
673
635
  })
674
636
  }),
675
- /* @__PURE__ */ v("div", { className: "chapters" }),
676
- /* @__PURE__ */ v("div", { className: "scrubber" }),
677
- /* @__PURE__ */ v("div", {
637
+ /* @__PURE__ */ x("div", { className: "chapters" }),
638
+ /* @__PURE__ */ x("div", { className: "scrubber" }),
639
+ /* @__PURE__ */ x("div", {
678
640
  className: "padding",
679
- ...x,
680
- onPointerDown: S,
641
+ ...y,
642
+ onPointerDown: b,
681
643
  onPointerUp: C,
682
644
  onPointerCancel: C
683
645
  }),
684
- /* @__PURE__ */ v("div", {
646
+ /* @__PURE__ */ x("div", {
685
647
  className: "thumbnail",
686
648
  style: { left: `clamp(var(--thumbnail-half), ${D(h ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
687
- children: j?.url ? /* @__PURE__ */ v("img", { src: j.url }) : void 0
649
+ children: j?.url ? /* @__PURE__ */ x("img", { src: j.url }) : void 0
688
650
  })
689
651
  ]
690
652
  });
691
- }, me = "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", he = u`
653
+ }, _e = "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", ve = p`
692
654
  display: flex;
693
655
  align-items: center;
694
656
  justify-content: center;
@@ -741,42 +703,42 @@ width: 100%;
741
703
  }
742
704
  }
743
705
  }
744
- `, ge = () => {
745
- let e = P(), t = P((e) => e.playbackRate), n = c(null), r = c(null), i = .25, a = 3 - i, s = (e, t = .05) => Math.round(e / t) * t, l = s(t || 1), u = (e) => (e - i) / a * 100, d = (e) => s(i + e * a), { handlers: f } = J({
706
+ `, ye = () => {
707
+ let e = F(), t = F((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 } = J({
746
708
  ref: r,
747
- onChange: (t) => e.setPlaybackRate(d(t))
709
+ onChange: (t) => e.setPlaybackRate(u(t))
748
710
  }), p = (t) => {
749
711
  t.preventDefault();
750
- let n = .05, r = l;
712
+ let n = .05, r = s;
751
713
  r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
752
714
  };
753
- o(() => {
715
+ l(() => {
754
716
  let e = n.current;
755
717
  return e && e.addEventListener("wheel", p, { passive: !1 }), () => {
756
718
  e && e.removeEventListener("wheel", p);
757
719
  };
758
720
  }, [t]);
759
- let m = u(l);
760
- return /* @__PURE__ */ y("div", {
761
- css: he,
762
- children: [/* @__PURE__ */ y("div", { children: [l.toFixed(2), "x"] }), /* @__PURE__ */ v("div", {
721
+ let m = c(s);
722
+ return /* @__PURE__ */ S("div", {
723
+ css: ve,
724
+ children: [/* @__PURE__ */ S("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ x("div", {
763
725
  className: "playback-slider",
764
726
  ref: n,
765
727
  ...f,
766
- children: /* @__PURE__ */ v("div", {
728
+ children: /* @__PURE__ */ x("div", {
767
729
  ref: r,
768
730
  style: { background: `linear-gradient(to right,
769
731
  #fff 0% ${m}%,
770
732
  #3A3A3A ${m}% 100%
771
733
  )` },
772
- children: /* @__PURE__ */ v("div", {
734
+ children: /* @__PURE__ */ x("div", {
773
735
  className: "playback-handle",
774
736
  style: { left: `${m}%` }
775
737
  })
776
738
  })
777
739
  })]
778
740
  });
779
- }, _e = u`
741
+ }, be = p`
780
742
  position: relative;
781
743
 
782
744
  .settings {
@@ -924,138 +886,186 @@ position: relative;
924
886
  .description {
925
887
  word-break: break-word;
926
888
  }
889
+
890
+ /* Dimmed and inert, but still listed. A source that names a track it cannot serve right now is
891
+ saying the track exists, and dropping the row would read as the source having nothing. */
892
+ .unavailable {
893
+ opacity: 0.5;
894
+ cursor: default;
895
+ :hover {
896
+ background-color: transparent;
897
+ }
898
+ }
899
+
900
+ .failed {
901
+ border-bottom: 1px solid #4D4D4E;
902
+ color: #f66;
903
+ ${V.bSmall.regular}
904
+ }
927
905
  }
928
- `, Y = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, allowDisable: a }) => /* @__PURE__ */ y("div", {
929
- className: "popover track-list",
930
- children: [
931
- /* @__PURE__ */ y("div", {
932
- className: "back",
933
- onClick: i,
934
- children: [/* @__PURE__ */ v(b, {}), /* @__PURE__ */ v("span", { children: e })]
935
- }),
936
- a ? /* @__PURE__ */ y("div", {
937
- onClick: () => r(void 0),
938
- children: [/* @__PURE__ */ v("span", { children: "Disable" }), /* @__PURE__ */ v("span", { children: n === void 0 ? "✓" : "" })]
939
- }) : null,
940
- t.map(({ id: e, label: t }) => /* @__PURE__ */ y("div", {
941
- onClick: () => r(e),
942
- className: "description",
943
- children: [/* @__PURE__ */ v("span", { children: t }), /* @__PURE__ */ v("span", { children: n === e ? "✓" : "" })]
944
- }, e))
945
- ]
946
- }), ve = () => {
947
- let e = P(), t = P((e) => e.playbackRate), n = P((e) => e.subtitleTracks), r = P((e) => e.selectedSubtitleTrack), i = P((e) => e.selectSubtitleTrack), a = P((e) => e.audioTracks), s = P((e) => e.selectedAudioTrack), u = P((e) => e.selectAudioTrack), [d, f] = l(!1), [p, m] = l(0), h = c(null), g = () => {
948
- f(!d), m(0);
949
- }, _ = (t) => {
950
- e.setPlaybackRate(t), m(0);
906
+ `, Y = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
907
+ let c = o !== void 0, l = (e, i, a) => {
908
+ let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
909
+ return /* @__PURE__ */ S("div", {
910
+ onClick: () => {
911
+ l || r(e ?? void 0);
912
+ },
913
+ className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
914
+ children: [/* @__PURE__ */ x("span", { children: i }), /* @__PURE__ */ x("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
915
+ }, e ?? "__off__");
951
916
  };
952
- o(() => {
917
+ return /* @__PURE__ */ S("div", {
918
+ className: "popover track-list",
919
+ children: [
920
+ /* @__PURE__ */ S("div", {
921
+ className: "back",
922
+ onClick: i,
923
+ children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: e })]
924
+ }),
925
+ s ? /* @__PURE__ */ x("div", {
926
+ className: "no-hover failed",
927
+ children: "Could not switch. Try again."
928
+ }) : null,
929
+ a ? l(null, a) : null,
930
+ t.map(({ id: e, label: t }) => l(e, t, "description"))
931
+ ]
932
+ });
933
+ }, xe = () => {
934
+ let e = F(), t = F((e) => e.playbackRate), n = F((e) => e.subtitleTracks), r = F((e) => e.selectedSubtitleTrack), i = F((e) => e.selectSubtitleTrack), a = F((e) => e.audioTracks), o = F((e) => e.selectedAudioTrack), s = F((e) => e.selectAudioTrack), c = F((e) => e.subtitleOffLabel), [u, p] = f(!1), [m, h] = f(0), g = d(null), [_, v] = f(void 0), [y, b] = f(!1), T = () => {
935
+ p(!u), h(0), b(!1);
936
+ }, E = () => {
937
+ p(!1), h(0);
938
+ }, D = (t) => {
939
+ e.setPlaybackRate(t), h(0);
940
+ };
941
+ l(() => {
953
942
  let e = (e) => {
954
- d && h.current && !h.current.contains(e.target) && g();
943
+ u && g.current && !g.current.contains(e.target) && T();
955
944
  };
956
945
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
957
- }, [d]);
958
- let S = (e) => {
959
- i(e), g();
960
- }, C = (e) => {
961
- e !== void 0 && u(e), g();
962
- }, w = (e) => () => {
963
- m(e);
946
+ }, [u]);
947
+ let O = (e, t) => {
948
+ if (_ !== void 0) return;
949
+ b(!1);
950
+ let n;
951
+ try {
952
+ n = t();
953
+ } catch (e) {
954
+ console.warn("[media-player] track selection failed:", e), b(!0);
955
+ return;
956
+ }
957
+ if (!(n instanceof Promise)) {
958
+ E();
959
+ return;
960
+ }
961
+ v(e), n.then(() => {
962
+ v(void 0), E();
963
+ }, (e) => {
964
+ console.warn("[media-player] track selection failed:", e), v(void 0), b(!0);
965
+ });
966
+ }, k = (e) => O(e ?? null, () => i(e)), j = (e) => {
967
+ e !== void 0 && O(e, () => s(e));
968
+ }, M = (e) => () => {
969
+ h(e);
964
970
  };
965
- return /* @__PURE__ */ y("div", {
966
- css: _e,
967
- ref: h,
971
+ return /* @__PURE__ */ S("div", {
972
+ css: be,
973
+ ref: g,
968
974
  children: [
969
- /* @__PURE__ */ v(q, {
975
+ /* @__PURE__ */ x(q, {
970
976
  id: "settings",
971
- disabled: d,
972
- text: /* @__PURE__ */ v("button", {
977
+ disabled: u,
978
+ text: /* @__PURE__ */ x("button", {
973
979
  className: "settings",
974
980
  type: "button",
975
- onClick: g,
976
- children: /* @__PURE__ */ v(D, {})
981
+ onClick: T,
982
+ children: /* @__PURE__ */ x(A, {})
977
983
  }),
978
- toolTipText: /* @__PURE__ */ v("span", { children: "Settings" })
984
+ toolTipText: /* @__PURE__ */ x("span", { children: "Settings" })
979
985
  }),
980
- d && p === 0 && /* @__PURE__ */ y("div", {
986
+ u && m === 0 && /* @__PURE__ */ S("div", {
981
987
  className: "popover menu",
982
988
  children: [
983
- a.length > 1 ? /* @__PURE__ */ y("div", {
984
- onClick: w(3),
985
- children: [/* @__PURE__ */ v("div", { children: "Audio" }), /* @__PURE__ */ v("div", { children: /* @__PURE__ */ v(x, {}) })]
989
+ a.length > 1 ? /* @__PURE__ */ S("div", {
990
+ onClick: M(3),
991
+ children: [/* @__PURE__ */ x("div", { children: "Audio" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
986
992
  }) : null,
987
- n.length > 0 ? /* @__PURE__ */ y("div", {
988
- onClick: w(2),
989
- children: [/* @__PURE__ */ v("div", { children: "Subtitles" }), /* @__PURE__ */ v("div", { children: /* @__PURE__ */ v(x, {}) })]
993
+ n.length > 0 ? /* @__PURE__ */ S("div", {
994
+ onClick: M(2),
995
+ children: [/* @__PURE__ */ x("div", { children: "Subtitles" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
990
996
  }) : null,
991
- /* @__PURE__ */ y("div", {
992
- onClick: w(1),
993
- children: [/* @__PURE__ */ v("div", { children: "Playback speed" }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("span", {
997
+ /* @__PURE__ */ S("div", {
998
+ onClick: M(1),
999
+ children: [/* @__PURE__ */ x("div", { children: "Playback speed" }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
994
1000
  className: "secondary",
995
1001
  children: t === 1 ? "(Default)" : t.toFixed(2)
996
- }), /* @__PURE__ */ v(x, {})] })]
1002
+ }), /* @__PURE__ */ x(w, {})] })]
997
1003
  })
998
1004
  ]
999
1005
  }),
1000
- d && p === 1 && /* @__PURE__ */ y("div", {
1006
+ u && m === 1 && /* @__PURE__ */ S("div", {
1001
1007
  className: "popover playback-rate",
1002
1008
  children: [
1003
- /* @__PURE__ */ y("div", {
1009
+ /* @__PURE__ */ S("div", {
1004
1010
  className: "back",
1005
- onClick: w(0),
1006
- children: [/* @__PURE__ */ v(b, {}), /* @__PURE__ */ v("span", { children: "Playback speed" })]
1011
+ onClick: M(0),
1012
+ children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: "Playback speed" })]
1007
1013
  }),
1008
- /* @__PURE__ */ v("div", {
1014
+ /* @__PURE__ */ x("div", {
1009
1015
  className: "slider no-hover",
1010
- children: /* @__PURE__ */ v(ge, {})
1016
+ children: /* @__PURE__ */ x(ye, {})
1011
1017
  }),
1012
- /* @__PURE__ */ y("div", {
1018
+ /* @__PURE__ */ S("div", {
1013
1019
  className: "options no-hover",
1014
1020
  children: [
1015
- /* @__PURE__ */ v("div", {
1016
- onClick: () => _(.5),
1021
+ /* @__PURE__ */ x("div", {
1022
+ onClick: () => D(.5),
1017
1023
  children: "0.5x"
1018
1024
  }),
1019
- /* @__PURE__ */ v("div", {
1020
- onClick: () => _(1),
1025
+ /* @__PURE__ */ x("div", {
1026
+ onClick: () => D(1),
1021
1027
  children: "1x"
1022
1028
  }),
1023
- /* @__PURE__ */ v("div", {
1024
- onClick: () => _(1.5),
1029
+ /* @__PURE__ */ x("div", {
1030
+ onClick: () => D(1.5),
1025
1031
  children: "1.5x"
1026
1032
  }),
1027
- /* @__PURE__ */ v("div", {
1028
- onClick: () => _(2),
1033
+ /* @__PURE__ */ x("div", {
1034
+ onClick: () => D(2),
1029
1035
  children: "2x"
1030
1036
  })
1031
1037
  ]
1032
1038
  })
1033
1039
  ]
1034
1040
  }),
1035
- d && p === 2 && /* @__PURE__ */ v(Y, {
1041
+ u && m === 2 && /* @__PURE__ */ x(Y, {
1036
1042
  title: "Subtitles",
1037
1043
  tracks: n,
1038
1044
  selected: r,
1039
- onSelect: S,
1040
- onBack: w(0),
1041
- allowDisable: !0
1045
+ onSelect: k,
1046
+ onBack: M(0),
1047
+ offLabel: c ?? "Disable",
1048
+ pending: _,
1049
+ failed: y
1042
1050
  }),
1043
- d && p === 3 && /* @__PURE__ */ v(Y, {
1051
+ u && m === 3 && /* @__PURE__ */ x(Y, {
1044
1052
  title: "Audio",
1045
1053
  tracks: a,
1046
- selected: s,
1047
- onSelect: C,
1048
- onBack: w(0)
1054
+ selected: o,
1055
+ onSelect: j,
1056
+ onBack: M(0),
1057
+ pending: _,
1058
+ failed: y
1049
1059
  })
1050
1060
  ]
1051
1061
  });
1052
- }, ye = {
1062
+ }, Se = {
1053
1063
  primary: "#EAEBEE",
1054
1064
  secondary: "#D0D0D9",
1055
1065
  hover: "rgba(255, 255, 255, 0.13)",
1056
1066
  borderPrimary: "#384F70",
1057
1067
  backgroundTooltip: "#222222"
1058
- }, be = u`
1068
+ }, Ce = p`
1059
1069
  display: flex;
1060
1070
  align-items: center;
1061
1071
 
@@ -1098,46 +1108,46 @@ position: relative;
1098
1108
  width: 10px;
1099
1109
  height: 10px;
1100
1110
  }
1101
- `, xe = ({ value: e, onChange: t }) => {
1102
- let n = P((e) => e.volume), r = P((e) => e.muted), i = c(null), a = c(null), { handlers: l } = J({
1111
+ `, we = ({ value: e, onChange: t }) => {
1112
+ let n = F((e) => e.volume), r = F((e) => e.muted), i = d(null), a = d(null), { handlers: o } = J({
1103
1113
  ref: a,
1104
1114
  onChange: t
1105
- }), u = (n) => {
1115
+ }), s = (n) => {
1106
1116
  n.preventDefault();
1107
1117
  let r = .05, i = e;
1108
1118
  i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
1109
1119
  };
1110
- o(() => {
1120
+ l(() => {
1111
1121
  let e = i.current;
1112
- return e && e.addEventListener("wheel", u, { passive: !1 }), () => {
1113
- e && e.removeEventListener("wheel", u);
1122
+ return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
1123
+ e && e.removeEventListener("wheel", s);
1114
1124
  };
1115
1125
  }, [e]);
1116
- let d = e * 100, f = s(() => Math.round(r ? 0 : G(n) * 100), [n, r]);
1117
- return /* @__PURE__ */ v(q, {
1126
+ let c = e * 100, f = u(() => Math.round(r ? 0 : G(n) * 100), [n, r]);
1127
+ return /* @__PURE__ */ x(q, {
1118
1128
  id: "volume-slider",
1119
- text: /* @__PURE__ */ v("div", {
1129
+ text: /* @__PURE__ */ x("div", {
1120
1130
  ref: i,
1121
- css: be,
1122
- ...l,
1123
- children: /* @__PURE__ */ v("div", {
1131
+ css: Ce,
1132
+ ...o,
1133
+ children: /* @__PURE__ */ x("div", {
1124
1134
  ref: a,
1125
1135
  style: { background: `linear-gradient(to right,
1126
- #fff 0% ${d}%,
1127
- #3A3A3A ${d}% 100%
1136
+ #fff 0% ${c}%,
1137
+ #3A3A3A ${c}% 100%
1128
1138
  )` },
1129
- children: /* @__PURE__ */ v("div", {
1139
+ children: /* @__PURE__ */ x("div", {
1130
1140
  className: "volume-handle",
1131
1141
  style: { left: `${e * 100}%` }
1132
1142
  })
1133
1143
  })
1134
1144
  }),
1135
- toolTipText: /* @__PURE__ */ y("div", {
1145
+ toolTipText: /* @__PURE__ */ S("div", {
1136
1146
  className: "volume-value",
1137
1147
  children: [f, "%"]
1138
1148
  })
1139
1149
  });
1140
- }, Se = u`
1150
+ }, Te = p`
1141
1151
  position: relative;
1142
1152
  display: flex;
1143
1153
  align-items: center;
@@ -1200,28 +1210,28 @@ position: relative;
1200
1210
  }
1201
1211
  }
1202
1212
 
1203
- `, Ce = ({ ref: e }) => {
1204
- let t = P(), n = P((e) => e.volume), r = P((e) => e.muted), i = s(() => G(n), [n]);
1205
- return /* @__PURE__ */ y("div", {
1206
- css: Se,
1207
- children: [/* @__PURE__ */ v(q, {
1213
+ `, Ee = ({ ref: e }) => {
1214
+ let t = F(), n = F((e) => e.volume), r = F((e) => e.muted), i = u(() => G(n), [n]);
1215
+ return /* @__PURE__ */ S("div", {
1216
+ css: Te,
1217
+ children: [/* @__PURE__ */ x(q, {
1208
1218
  id: "sound",
1209
- text: /* @__PURE__ */ v("button", {
1219
+ text: /* @__PURE__ */ x("button", {
1210
1220
  className: "sound",
1211
1221
  type: "button",
1212
1222
  onClick: () => t.toggleMuted(),
1213
1223
  ref: e,
1214
- children: v(r || n === 0 ? A : n <= .5 ? O : k, {
1224
+ children: x(r || n === 0 ? ee : n <= .5 ? j : M, {
1215
1225
  size: 18,
1216
1226
  color: "#fff"
1217
1227
  })
1218
1228
  }),
1219
- toolTipText: /* @__PURE__ */ v("span", { children: r ? "Unmute (m)" : "Mute (m)" })
1220
- }), /* @__PURE__ */ v("div", {
1229
+ toolTipText: /* @__PURE__ */ x("span", { children: r ? "Unmute (m)" : "Mute (m)" })
1230
+ }), /* @__PURE__ */ x("div", {
1221
1231
  className: "volume-slider-container",
1222
- children: /* @__PURE__ */ v("div", {
1232
+ children: /* @__PURE__ */ x("div", {
1223
1233
  className: "volume-slider-background",
1224
- children: /* @__PURE__ */ v(xe, {
1234
+ children: /* @__PURE__ */ x(we, {
1225
1235
  value: r ? 0 : i,
1226
1236
  onChange: (e) => {
1227
1237
  t.setVolume(W(e));
@@ -1230,7 +1240,7 @@ position: relative;
1230
1240
  })
1231
1241
  })]
1232
1242
  });
1233
- }, X = .05, Z = 5, we = u`
1243
+ }, X = .05, Z = 5, De = p`
1234
1244
  position: absolute;
1235
1245
  bottom: 0;
1236
1246
  width: 100%;
@@ -1314,7 +1324,7 @@ position: relative;
1314
1324
  cursor: pointer;
1315
1325
 
1316
1326
  :hover {
1317
- background-color: ${ye.hover};
1327
+ background-color: ${Se.hover};
1318
1328
  }
1319
1329
 
1320
1330
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -1352,12 +1362,12 @@ position: relative;
1352
1362
  }
1353
1363
  }
1354
1364
  }
1355
- `, Te = () => {
1356
- let e = P(), t = P((e) => e.paused), n = P((e) => e.currentTime), r = P((e) => e.duration), i = P((e) => e.fullscreen), s = P((e) => e.hideUI), c = P((e) => e.togglePictureInPicture), [u, d] = l(null), f = r > 0 && n === r, p = a(({ direction: t, stepSize: n }) => {
1365
+ `, Oe = () => {
1366
+ 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, u] = f(null), d = r > 0 && n === r, p = c(({ direction: t, stepSize: n }) => {
1357
1367
  let r = G(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
1358
1368
  e.setVolume(W(a)), o && !e.muted && e.toggleMuted();
1359
1369
  }, [e]);
1360
- o(() => {
1370
+ l(() => {
1361
1371
  let t = (t) => {
1362
1372
  let n = t.target;
1363
1373
  if (n?.isContentEditable || /^(input|textarea|select)$/i.test(n?.tagName ?? "")) return;
@@ -1382,7 +1392,7 @@ position: relative;
1382
1392
  };
1383
1393
  return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1384
1394
  }, [e, p]);
1385
- let m = a((e) => {
1395
+ let m = c((e) => {
1386
1396
  e.preventDefault(), e.deltaY < 0 ? p({
1387
1397
  direction: "up",
1388
1398
  stepSize: X
@@ -1391,66 +1401,77 @@ position: relative;
1391
1401
  stepSize: X
1392
1402
  });
1393
1403
  }, [p]);
1394
- return o(() => {
1395
- if (u) return u.addEventListener("wheel", m, { passive: !1 }), () => u.removeEventListener("wheel", m);
1396
- }, [u, m]), /* @__PURE__ */ y("div", {
1397
- css: we,
1398
- style: { ...s ? {
1404
+ return l(() => {
1405
+ if (s) return s.addEventListener("wheel", m, { passive: !1 }), () => s.removeEventListener("wheel", m);
1406
+ }, [s, m]), /* @__PURE__ */ S("div", {
1407
+ css: De,
1408
+ style: { ...a ? {
1399
1409
  opacity: "0",
1400
1410
  pointerEvents: "none"
1401
1411
  } : {} },
1402
- children: [/* @__PURE__ */ v(pe, {}), /* @__PURE__ */ y("div", {
1412
+ children: [/* @__PURE__ */ x(ge, {}), /* @__PURE__ */ S("div", {
1403
1413
  className: "actions",
1404
- children: [/* @__PURE__ */ y("div", {
1414
+ children: [/* @__PURE__ */ S("div", {
1405
1415
  className: "left",
1406
1416
  children: [
1407
- /* @__PURE__ */ v(q, {
1417
+ /* @__PURE__ */ x(q, {
1408
1418
  id: "play",
1409
1419
  tooltipPlace: "top-start",
1410
- text: /* @__PURE__ */ v("button", {
1420
+ text: /* @__PURE__ */ x("button", {
1411
1421
  className: "play",
1412
1422
  type: "button",
1413
1423
  onClick: () => e.togglePaused(),
1414
- children: v(f ? E : t ? T : w, {})
1424
+ children: x(d ? k : t ? O : D, {})
1415
1425
  }),
1416
- toolTipText: /* @__PURE__ */ v("span", { children: f ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
1426
+ toolTipText: /* @__PURE__ */ x("span", { children: d ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
1417
1427
  }),
1418
- /* @__PURE__ */ v(Ce, { ref: d }),
1419
- /* @__PURE__ */ v("div", {
1428
+ /* @__PURE__ */ x(Ee, { ref: u }),
1429
+ /* @__PURE__ */ x("div", {
1420
1430
  className: "time",
1421
- children: ue(n, r)
1431
+ children: pe(n, r)
1422
1432
  })
1423
1433
  ]
1424
- }), /* @__PURE__ */ y("div", {
1434
+ }), /* @__PURE__ */ S("div", {
1425
1435
  className: "right",
1426
1436
  children: [
1427
- /* @__PURE__ */ v(ve, {}),
1428
- c ? /* @__PURE__ */ v(q, {
1437
+ /* @__PURE__ */ x(xe, {}),
1438
+ o ? /* @__PURE__ */ x(q, {
1429
1439
  id: "picture-in-picture",
1430
- text: /* @__PURE__ */ v("button", {
1440
+ text: /* @__PURE__ */ x("button", {
1431
1441
  className: "picture-in-picture",
1432
1442
  type: "button",
1433
- onClick: c,
1434
- children: /* @__PURE__ */ v("img", { src: me })
1443
+ onClick: o,
1444
+ children: /* @__PURE__ */ x("img", { src: _e })
1435
1445
  }),
1436
- toolTipText: /* @__PURE__ */ v("span", { children: "Picture in picture" })
1446
+ toolTipText: /* @__PURE__ */ x("span", { children: "Picture in picture" })
1437
1447
  }) : null,
1438
- /* @__PURE__ */ v(q, {
1448
+ /* @__PURE__ */ x(q, {
1439
1449
  id: "full-screen",
1440
1450
  tooltipPlace: "top-end",
1441
- text: /* @__PURE__ */ v("button", {
1451
+ text: /* @__PURE__ */ x("button", {
1442
1452
  className: "full-screen",
1443
1453
  type: "button",
1444
1454
  onClick: () => e.toggleFullscreen(),
1445
- children: v(i ? C : S, {})
1455
+ children: x(i ? E : T, {})
1446
1456
  }),
1447
- toolTipText: /* @__PURE__ */ v("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
1457
+ toolTipText: /* @__PURE__ */ x("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
1448
1458
  })
1449
1459
  ]
1450
1460
  })]
1451
1461
  })]
1452
1462
  });
1453
- }, Ee = 3e3, De = u`
1463
+ }, ke = 3e3, Ae = p`
1464
+ position: absolute;
1465
+ inset: 0;
1466
+ z-index: 2;
1467
+ /* Never eats a click: click-to-pause still reaches the video underneath, and an item that needs a
1468
+ pointer (a tooltip anchor, a button) sets \`pointer-events: auto\` on itself. */
1469
+ pointer-events: none;
1470
+ /* visibility, not only opacity: an item that took pointer events back would otherwise stay
1471
+ hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
1472
+ not, and transitioning it holds the item on screen for the length of the fade. */
1473
+ transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
1474
+ `, je = p`
1454
1475
  position: relative;
1455
1476
  background-color: black;
1456
1477
  display: flex;
@@ -1482,74 +1503,86 @@ position: relative;
1482
1503
  &.hide {
1483
1504
  cursor: none;
1484
1505
  }
1485
- `, Oe = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, children: i }) => {
1486
- let a = P(), s = P((e) => e.hideUI), l = P((e) => e.setHideUI), u = c(void 0), d = c("mouse");
1487
- o(() => () => clearTimeout(u.current), []);
1488
- let f = () => {
1489
- l(!1), clearTimeout(u.current), u.current = setTimeout(() => l(!0), Ee);
1506
+ `, Q = (e, t = "") => a.toArray(e).flatMap((e, n) => {
1507
+ let r = `${t}${s(e) && e.key != null ? e.key : n}`;
1508
+ return s(e) && e.type === o ? Q(e.props.children, `${r}/`) : [{
1509
+ key: r,
1510
+ item: e
1511
+ }];
1512
+ }), Me = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
1513
+ let o = F(), s = F((e) => e.hideUI), c = F((e) => e.setHideUI), u = d(void 0), f = d("mouse");
1514
+ l(() => () => clearTimeout(u.current), []);
1515
+ let p = () => {
1516
+ c(!1), clearTimeout(u.current), u.current = setTimeout(() => c(!0), ke);
1490
1517
  };
1491
- return /* @__PURE__ */ y("div", {
1492
- css: De,
1518
+ return /* @__PURE__ */ S("div", {
1519
+ css: je,
1493
1520
  ref: e,
1494
1521
  onPointerMove: (e) => {
1495
- d.current = e.pointerType, e.pointerType === "mouse" && f();
1522
+ f.current = e.pointerType, e.pointerType === "mouse" && p();
1496
1523
  },
1497
1524
  onPointerDown: (e) => {
1498
- d.current = e.pointerType;
1525
+ f.current = e.pointerType;
1499
1526
  },
1500
1527
  onMouseOut: (e) => {
1501
1528
  let t = e.relatedTarget;
1502
1529
  if (t && e.currentTarget.contains(t)) return;
1503
1530
  let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
1504
- e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(u.current), l(!0));
1531
+ e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(u.current), c(!0));
1505
1532
  },
1506
1533
  className: s ? "hide" : "",
1507
1534
  children: [
1508
- /* @__PURE__ */ v(le, {
1509
- onCanvasRef: n,
1510
- overlay: r
1511
- }),
1512
- /* @__PURE__ */ v(Te, {}),
1513
- /* @__PURE__ */ y("div", {
1535
+ /* @__PURE__ */ x(fe, { onCanvasRef: n }),
1536
+ Q(r).map(({ key: e, item: t }) => /* @__PURE__ */ x("div", {
1537
+ css: Ae,
1538
+ style: { ...s ? {
1539
+ opacity: "0",
1540
+ visibility: "hidden",
1541
+ pointerEvents: "none"
1542
+ } : {} },
1543
+ children: t
1544
+ }, e)),
1545
+ i === !1 ? null : /* @__PURE__ */ x(Oe, {}),
1546
+ /* @__PURE__ */ S("div", {
1514
1547
  className: "video",
1515
1548
  onClick: () => {
1516
- if (d.current === "mouse") {
1517
- a.togglePaused();
1549
+ if (f.current === "mouse") {
1550
+ o.togglePaused();
1518
1551
  return;
1519
1552
  }
1520
- s ? f() : (clearTimeout(u.current), l(!0));
1553
+ s ? p() : (clearTimeout(u.current), c(!0));
1521
1554
  },
1522
- children: [t ? /* @__PURE__ */ v("video", {
1555
+ children: [t ? /* @__PURE__ */ x("video", {
1523
1556
  ref: t,
1524
1557
  playsInline: !0
1525
- }) : null, i]
1558
+ }) : null, a]
1526
1559
  })
1527
1560
  ]
1528
1561
  });
1529
- }, Q = ({ options: e, children: t }) => {
1530
- let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: s, publicPath: c, libavWorkerUrl: u, read: d, thumbnailRead: f, thumbnailsEnabled: h } = r ?? {}, g = m(), _ = p(), [y, b] = l(null), [x, S] = l(null), C = n?.media ?? y;
1531
- o(() => (g?.(C), () => g?.(null)), [C, g]), re(y, x, r);
1562
+ }, Ne = ({ options: e, children: t }) => {
1563
+ 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;
1564
+ l(() => (m?.(C), () => m?.(null)), [C, m]), ie(v, b, r);
1532
1565
  let w = z({
1533
- publicPath: c,
1534
- workerUrl: u,
1535
- length: h === !1 ? void 0 : a,
1536
- read: f ?? d,
1537
- downloadedRanges: s
1538
- }), T = n?.thumbnails?.all ?? w, E = B(y, x), D = P((e) => e.setSourceState);
1539
- o(() => {
1566
+ publicPath: s,
1567
+ workerUrl: c,
1568
+ length: p === !1 ? void 0 : a,
1569
+ read: d ?? u,
1570
+ downloadedRanges: o
1571
+ }), T = n?.thumbnails?.all ?? w, E = B(v, b), D = F((e) => e.setSourceState);
1572
+ l(() => {
1540
1573
  D({
1541
1574
  title: i,
1542
1575
  size: a,
1543
- downloadedRanges: s
1576
+ downloadedRanges: o
1544
1577
  });
1545
1578
  }, [
1546
1579
  D,
1547
1580
  i,
1548
1581
  a,
1549
- s
1582
+ o
1550
1583
  ]);
1551
1584
  let O = n?.thumbnails?.at;
1552
- o(() => {
1585
+ l(() => {
1553
1586
  D({
1554
1587
  thumbnails: T,
1555
1588
  thumbnailAt: O,
@@ -1562,32 +1595,36 @@ position: relative;
1562
1595
  E
1563
1596
  ]);
1564
1597
  let k = n?.subtitles?.selection, A = n?.audioTracks?.selection;
1565
- return o(() => {
1598
+ return l(() => {
1566
1599
  k && D({
1567
- subtitleTracks: k.options.map(({ id: e, label: t }) => ({
1600
+ subtitleTracks: k.options.map(({ id: e, label: t, disabled: n }) => ({
1568
1601
  id: e,
1569
- label: t
1602
+ label: t,
1603
+ disabled: n
1570
1604
  })),
1571
1605
  selectedSubtitleTrack: k.selectedId ?? void 0,
1572
- selectSubtitleTrack: (e) => k.select(e == null ? null : String(e))
1606
+ selectSubtitleTrack: (e) => k.select(e == null ? null : String(e)),
1607
+ subtitleOffLabel: k.offLabel
1573
1608
  });
1574
- }, [D, k]), o(() => {
1609
+ }, [D, k]), l(() => {
1575
1610
  A && D({
1576
- audioTracks: A.options.map(({ id: e, label: t }) => ({
1611
+ audioTracks: A.options.map(({ id: e, label: t, disabled: n }) => ({
1577
1612
  id: e,
1578
- label: t
1613
+ label: t,
1614
+ disabled: n
1579
1615
  })),
1580
1616
  selectedAudioTrack: A.selectedId ?? void 0,
1581
1617
  selectAudioTrack: (e) => A.select(String(e))
1582
1618
  });
1583
- }, [D, A]), /* @__PURE__ */ v(Oe, {
1584
- ref: _,
1585
- onVideoRef: n ? void 0 : b,
1619
+ }, [D, A]), /* @__PURE__ */ x(Me, {
1620
+ ref: h,
1621
+ onVideoRef: n ? void 0 : y,
1586
1622
  onCanvasRef: S,
1587
1623
  overlay: e.overlay,
1624
+ controls: e.controls,
1588
1625
  children: t
1589
1626
  });
1590
- }, ke = u`
1627
+ }, Pe = p`
1591
1628
  /**
1592
1629
  * The chrome's whole scale, in one place.
1593
1630
  *
@@ -1618,17 +1655,17 @@ position: relative;
1618
1655
  height: 100%;
1619
1656
  width: 100%;
1620
1657
  overflow: hidden;
1621
- `, $ = (e) => /* @__PURE__ */ v("div", {
1622
- css: ke,
1623
- children: /* @__PURE__ */ v(N.Provider, { children: /* @__PURE__ */ v(Q, {
1658
+ `, $ = (e) => /* @__PURE__ */ x("div", {
1659
+ css: Pe,
1660
+ children: /* @__PURE__ */ x(P.Provider, { children: /* @__PURE__ */ x(Ne, {
1624
1661
  options: e,
1625
1662
  children: e.children
1626
1663
  }) })
1627
- }), Ae = (e) => !!e && typeof e == "object" && "at" in e, je = (e) => !!e && typeof e == "object" && "selection" in e, Me = ({ blob: e, name: t }) => ({
1664
+ }), Fe = (e) => !!e && typeof e == "object" && "at" in e, Ie = (e) => !!e && typeof e == "object" && "selection" in e, Le = ({ blob: e, name: t }) => ({
1628
1665
  length: e.size,
1629
1666
  name: t ?? (e instanceof File ? e.name : void 0),
1630
1667
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
1631
- }), Ne = async (e, t) => {
1668
+ }), Re = async (e, t) => {
1632
1669
  let n = await fetch(e, {
1633
1670
  headers: { Range: "bytes=0-1" },
1634
1671
  credentials: t
@@ -1638,8 +1675,8 @@ position: relative;
1638
1675
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
1639
1676
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
1640
1677
  return i;
1641
- }, Pe = async ({ url: e, length: t, name: n, credentials: r }) => {
1642
- let i = t ?? await Ne(e, r);
1678
+ }, ze = async ({ url: e, length: t, name: n, credentials: r }) => {
1679
+ let i = t ?? await Re(e, r);
1643
1680
  return {
1644
1681
  length: i,
1645
1682
  name: n,
@@ -1652,9 +1689,9 @@ position: relative;
1652
1689
  return a.arrayBuffer();
1653
1690
  }
1654
1691
  };
1655
- }, Fe = async (e) => {
1656
- if ("blob" in e) return Me(e);
1657
- if ("url" in e) return Pe(e);
1692
+ }, Be = async (e) => {
1693
+ if ("blob" in e) return Le(e);
1694
+ if ("url" in e) return ze(e);
1658
1695
  if ("read" in e) return {
1659
1696
  length: e.length,
1660
1697
  name: e.name,
@@ -1663,4 +1700,4 @@ position: relative;
1663
1700
  throw Error(`Unknown source type: ${e}`);
1664
1701
  };
1665
1702
  //#endregion
1666
- export { $ as MediaPlayer, $ as default, N as Player, n as SUBTITLES_OFF, i as createPictureInPicture, r as createSubtitleRenderer, t as createThumbnailGenerator, Fe as inputToRemuxerInput, je as isDelegatedTracks, Ae as isExternalThumbnails, M as sourceFeature, e as startPlayback, B as usePictureInPicture, P as usePlayer, z as useSeekThumbnails };
1703
+ export { $ as MediaPlayer, $ as default, P as Player, n as SUBTITLES_OFF, i as createPictureInPicture, r as createSubtitleRenderer, t as createThumbnailGenerator, Be as inputToRemuxerInput, Ie as isDelegatedTracks, Fe as isExternalThumbnails, N as sourceFeature, e as startPlayback, B as usePictureInPicture, F as usePlayer, z as useSeekThumbnails };