@banou/media-player 0.10.5 → 0.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-CB5J5kah.js";
1
+ import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-C6PdWBah.js";
2
2
  import { Children as s, Fragment as c, isValidElement as l, useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
3
3
  import { css as h, keyframes as g } from "@emotion/react";
4
4
  import { createPlayer as _, useContainerAttach as v, useMediaAttach as y } from "@videojs/react";
@@ -41,7 +41,7 @@ var B = {
41
41
  features: [...x, V],
42
42
  displayName: "MediaPlayer"
43
43
  }), U = H.usePlayer, W = (e) => {
44
- if (!(!e || e === "und")) try {
44
+ if (e && e !== "und") try {
45
45
  return new Intl.DisplayNames([navigator.language || "en"], {
46
46
  type: "language",
47
47
  fallback: "none"
@@ -49,7 +49,7 @@ var B = {
49
49
  } catch {
50
50
  return;
51
51
  }
52
- }, G = (e) => e?.replace(/_/g, " ").trim() || void 0, K = (e) => {
52
+ }, G = (e) => e?.replace(/_/g, " ").trim() || void 0, ee = (e) => {
53
53
  let t = e.map((e) => W(e.language) ?? G(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
54
54
  ...e,
55
55
  [t]: (e[t] ?? 0) + 1
@@ -61,10 +61,10 @@ var B = {
61
61
  label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
62
62
  };
63
63
  });
64
- }, q = (e) => K(e).map(({ track: e, label: t }) => ({
64
+ }, K = (e) => ee(e).map(({ track: e, label: t }) => ({
65
65
  id: e.streamIndex,
66
66
  label: t
67
- })), ee = [
67
+ })), q = [
68
68
  0,
69
69
  250,
70
70
  1e3,
@@ -177,7 +177,7 @@ var B = {
177
177
  count: 0,
178
178
  at: t
179
179
  });
180
- let n = ee[Math.min(D.current.count, ee.length - 1)];
180
+ let n = q[Math.min(D.current.count, q.length - 1)];
181
181
  D.current = {
182
182
  count: D.current.count + 1,
183
183
  at: t
@@ -214,13 +214,13 @@ var B = {
214
214
  onSeek: (e) => N.current?.(e),
215
215
  onSubtitleStreams: (e) => {
216
216
  r || a.setSourceState({
217
- subtitleTracks: q(e),
217
+ subtitleTracks: K(e),
218
218
  ...j.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
219
219
  });
220
220
  },
221
221
  onAudioStreams: (e, t) => {
222
222
  r || a.setSourceState({
223
- audioTracks: q(e),
223
+ audioTracks: K(e),
224
224
  selectedAudioTrack: t
225
225
  });
226
226
  }
@@ -397,7 +397,9 @@ var B = {
397
397
 
398
398
  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%);
399
399
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
400
- `, pe = h`
400
+ `, pe = g`
401
+ to { transform: rotate(360deg); }
402
+ `, me = h`
401
403
  position: absolute;
402
404
  inset: 0;
403
405
  z-index: 2;
@@ -413,11 +415,9 @@ var B = {
413
415
  border-radius: 50%;
414
416
  border: 3px solid rgba(255, 255, 255, 0.25);
415
417
  border-top-color: #fff;
416
- animation: ${g`
417
- to { transform: rotate(360deg); }
418
- `} 0.8s linear infinite;
418
+ animation: ${pe} 0.8s linear infinite;
419
419
  }
420
- `, me = h`
420
+ `, he = h`
421
421
  position: absolute;
422
422
  inset: auto 0 20%;
423
423
  z-index: 3;
@@ -427,7 +427,7 @@ var B = {
427
427
  ${J.bLarge.regular}
428
428
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
429
429
  pointer-events: none;
430
- `, he = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", ge = ({ onSubtitleRef: e }) => {
430
+ `, ge = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", _e = ({ onSubtitleRef: e }) => {
431
431
  let t = U((e) => e.title), n = U((e) => e.hideUI), r = U((e) => e.playbackError), i = U((e) => e.ready), a = U((e) => e.size), o = U((e) => e.waiting), s = U((e) => e.seekingTo);
432
432
  return /* @__PURE__ */ w(S, { children: [
433
433
  t ? /* @__PURE__ */ C("div", {
@@ -439,10 +439,10 @@ var B = {
439
439
  } : {} },
440
440
  children: t
441
441
  }) : void 0,
442
- ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ C("div", { css: pe }) : void 0,
442
+ ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ C("div", { css: me }) : void 0,
443
443
  r ? /* @__PURE__ */ C("div", {
444
- css: me,
445
- children: he(r)
444
+ css: he,
445
+ children: ge(r)
446
446
  }) : void 0,
447
447
  /* @__PURE__ */ C("div", {
448
448
  className: "subtitles",
@@ -450,11 +450,11 @@ var B = {
450
450
  css: de
451
451
  })
452
452
  ] });
453
- }, _e = 1e-4, ve = 1, ye = (e) => Math.max(_e, Math.min(ve, e)) ** 2, be = (e) => Math.max(_e, Math.min(ve, e)) ** (ve / 2), Y = (e) => {
453
+ }, ve = 1e-4, ye = 1, be = (e) => Math.max(ve, Math.min(ye, e)) ** 2, xe = (e) => Math.max(ve, Math.min(ye, e)) ** (ye / 2), Y = (e) => {
454
454
  if (e === void 0) return "0:00";
455
455
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
456
456
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
457
- }, xe = (e, t) => `${Y(e)} / ${Y(t)}`, Se = (e) => h`
457
+ }, Se = (e, t) => `${Y(e)} / ${Y(t)}`, Ce = (e) => h`
458
458
  display: flex;
459
459
  justify-content: flex-start;
460
460
 
@@ -502,17 +502,17 @@ var B = {
502
502
  x: -1,
503
503
  y: -1,
504
504
  anchors: 0
505
- }, Ce = (e) => {
505
+ }, we = (e) => {
506
506
  X.x = e.clientX, X.y = e.clientY;
507
- }, we = () => (X.anchors++ === 0 && window.addEventListener("pointermove", Ce, {
507
+ }, Te = () => (X.anchors++ === 0 && window.addEventListener("pointermove", we, {
508
508
  capture: !0,
509
509
  passive: !0
510
510
  }), () => {
511
- --X.anchors === 0 && window.removeEventListener("pointermove", Ce, { capture: !0 });
511
+ --X.anchors === 0 && window.removeEventListener("pointermove", we, { capture: !0 });
512
512
  }), Z = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
513
513
  let l = p(null), u = p(null);
514
514
  return d(() => {
515
- let e = we(), t = () => {
515
+ let e = Te(), t = () => {
516
516
  let e = l.current;
517
517
  if (!e) return;
518
518
  let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
@@ -534,12 +534,12 @@ var B = {
534
534
  children: n
535
535
  }), !s && /* @__PURE__ */ C(z, {
536
536
  ref: u,
537
- css: Se(c),
537
+ css: Ce(c),
538
538
  id: e,
539
539
  noArrow: !0,
540
540
  children: t
541
541
  })] });
542
- }, Te = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
542
+ }, Ee = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
543
543
  let [i, a] = m(!1), o = p(t);
544
544
  o.current = t;
545
545
  let s = p(null), c = u((t, r) => {
@@ -578,26 +578,26 @@ var B = {
578
578
  style: { touchAction: "none" }
579
579
  }
580
580
  };
581
- }, Ee = 2, De = .005, Oe = "#000", ke = "#0000", Ae = (e, t) => {
581
+ }, De = 2, Oe = .005, ke = "#000", Ae = "#0000", je = (e, t) => {
582
582
  if (!t) return [];
583
583
  let n = /* @__PURE__ */ new Set();
584
584
  for (let { start: r, end: i } of e) for (let e of [r, i]) {
585
585
  let r = e / t;
586
- r <= De || r >= 1 - De || n.add(Number((r * 100).toFixed(4)));
586
+ r <= Oe || r >= .995 || n.add(Number((r * 100).toFixed(4)));
587
587
  }
588
588
  return n.size ? [
589
589
  0,
590
590
  ...[...n].sort((e, t) => e - t),
591
591
  100
592
592
  ] : [];
593
- }, je = (e, t) => {
594
- let n = Ee / 2, r = e.length - 2, i = [];
593
+ }, Me = (e, t) => {
594
+ let n = De / 2, r = e.length - 2, i = [];
595
595
  for (let a = 0; a <= r; a += 1) {
596
596
  let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
597
- i.push(`${t(a) ? Oe : ke} ${c} ${l}`), a !== r && i.push(`${ke} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
597
+ i.push(`${t(a) ? ke : Ae} ${c} ${l}`), a !== r && i.push(`${Ae} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
598
598
  }
599
599
  return `linear-gradient(90deg, ${i.join(", ")})`;
600
- }, Me = /* @__PURE__ */ new Set([
600
+ }, Ne = /* @__PURE__ */ new Set([
601
601
  "op",
602
602
  "ops",
603
603
  "opening",
@@ -605,7 +605,7 @@ var B = {
605
605
  "ncop",
606
606
  "オープニング",
607
607
  "op主題歌"
608
- ]), Ne = /* @__PURE__ */ new Set([
608
+ ]), Pe = /* @__PURE__ */ new Set([
609
609
  "ed",
610
610
  "eds",
611
611
  "ending",
@@ -618,13 +618,13 @@ var B = {
618
618
  "エンドカード",
619
619
  "エンドロール",
620
620
  "ed主題歌"
621
- ]), Pe = /* @__PURE__ */ new Set(["intro", "イントロ"]), Fe = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Ie = {
621
+ ]), Fe = /* @__PURE__ */ new Set(["intro", "イントロ"]), Ie = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Le = {
622
622
  "credits start": "ending",
623
623
  "credits end": null,
624
624
  "preview end": null,
625
625
  "end credits": "ending",
626
626
  "closing credits": "ending"
627
- }, Le = /* @__PURE__ */ new Set([
627
+ }, Re = /* @__PURE__ */ new Set([
628
628
  "theme",
629
629
  "themes",
630
630
  "song",
@@ -643,53 +643,53 @@ var B = {
643
643
  "the",
644
644
  "主題歌",
645
645
  "ノンクレジット"
646
- ]), Re = /* @__PURE__ */ new Set([
646
+ ]), ze = /* @__PURE__ */ new Set([
647
647
  "post",
648
648
  "pre",
649
649
  "after",
650
650
  "before",
651
651
  "non"
652
- ]), ze = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, Be = (e) => /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), Ve = (e) => e.replace(/([a-z぀-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w぀-ヿ一-鿿]+|[^\w぀-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !Le.has(e)), He = (e, t) => {
653
- if (Me.has(e)) return "opening";
654
- if (Ne.has(e)) return "ending";
652
+ ]), Be = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, Ve = (e) => /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), He = (e) => e.replace(/([a-z぀-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w぀-ヿ一-鿿]+|[^\w぀-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !Re.has(e)), Ue = (e, t) => {
653
+ if (Ne.has(e)) return "opening";
654
+ if (Pe.has(e)) return "ending";
655
655
  if (t) {
656
- if (Pe.has(e)) return "opening";
657
- if (Fe.has(e)) return "ending";
656
+ if (Fe.has(e)) return "opening";
657
+ if (Ie.has(e)) return "ending";
658
658
  }
659
- }, Ue = (e, t) => {
660
- if (Be(e)) return;
659
+ }, We = (e, t) => {
660
+ if (Ve(e)) return;
661
661
  let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
662
- if (n in Ie) return Ie[n] ?? void 0;
663
- let r = n.split(ze).map((e) => e.trim()).filter(Boolean);
664
- if (r.some((e) => e.split(/[\s_]+/u).some((e) => Re.has(e)))) return;
662
+ if (n in Le) return Le[n] ?? void 0;
663
+ let r = n.split(Be).map((e) => e.trim()).filter(Boolean);
664
+ if (r.some((e) => e.split(/[\s_]+/u).some((e) => ze.has(e)))) return;
665
665
  let i = r.length > 1 ? [r[0], r.at(-1)] : r;
666
666
  for (let e of i) {
667
- let n = Ve(e);
667
+ let n = He(e);
668
668
  if (n.length !== 1) continue;
669
- let r = He(n[0], t);
669
+ let r = Ue(n[0], t);
670
670
  if (r) return r;
671
671
  }
672
- }, We = 15, Ge = 87, Ke = 93, qe = (e) => {
672
+ }, Ge = 15, Ke = 87, qe = 93, Je = (e) => {
673
673
  let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
674
674
  if (!n) return t;
675
675
  let r = e.map((e, t) => ({
676
676
  index: t,
677
677
  start: e.start,
678
678
  length: e.end - e.start
679
- })).filter(({ length: e }) => e >= Ge && e <= Ke), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
679
+ })).filter(({ length: e }) => e >= Ke && e <= qe), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
680
680
  return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
681
- }, Je = (e) => {
682
- let t = e.map(({ title: e }) => Ue(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
681
+ }, Ye = (e) => {
682
+ let t = e.map(({ title: e }) => We(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
683
683
  if (r > 0 && n * 2 > r) return e.map(() => void 0);
684
684
  let i = e.map((e, n) => {
685
- if (e.end - e.start < We) return;
685
+ if (e.end - e.start < Ge) return;
686
686
  let r = t[n];
687
687
  if (r) return r;
688
- let i = Ue(e.title, !0);
688
+ let i = We(e.title, !0);
689
689
  return i && !t.includes(i) ? i : void 0;
690
690
  });
691
- return i.some(Boolean) ? i : qe(e);
692
- }, Ye = h`
691
+ return i.some(Boolean) ? i : Je(e);
692
+ }, Xe = h`
693
693
  position: relative;
694
694
  height: calc(.4 * var(--mp-unit));
695
695
 
@@ -908,160 +908,163 @@ var B = {
908
908
  --thumbnail-width: calc(18 * var(--mp-unit));
909
909
  --thumbnail-half: calc(9 * var(--mp-unit));
910
910
  }
911
- `, Xe = 4, Ze = () => {
912
- let e = U(), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U((e) => e.duration), i = U((e) => e.size), a = U((e) => e.downloadedRanges), o = U((e) => e.indexes), s = U((e) => e.thumbnails), c = U((e) => e.thumbnailAt), l = U((e) => e.requestThumbnail), u = U((e) => e.chapters), h = U((e) => e.seekingTo), g = p(null), [_, v] = m(void 0), [y, b] = m(void 0), x = (e) => {
913
- b(e), l(e);
914
- }, S = p(void 0), T = p(0), E = p(void 0), D = p(void 0), O = p(!1), { dragging: k, handlers: A } = Te({
915
- ref: g,
911
+ `, Ze = 4, Qe = () => {
912
+ let e = U(), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U((e) => e.duration), i = U((e) => e.size), a = U((e) => e.downloadedRanges), o = U((e) => e.buffered), s = U((e) => e.indexes), c = U((e) => e.thumbnails), l = U((e) => e.thumbnailAt), u = U((e) => e.requestThumbnail), h = U((e) => e.chapters), g = U((e) => e.seekingTo), _ = p(null), [v, y] = m(void 0), [b, x] = m(void 0), S = (e) => {
913
+ x(e), u(e);
914
+ }, T = p(void 0), E = p(0), D = p(void 0), O = p(void 0), k = p(!1), { dragging: A, handlers: j } = Ee({
915
+ ref: _,
916
916
  onChange: (e) => {
917
- if (T.current += 1, E.current = e, D.current === void 0) D.current = e;
918
- else if (!O.current) {
919
- let t = g.current?.getBoundingClientRect().width ?? 0;
920
- Math.abs(e - D.current) * t > Xe && (O.current = !0);
917
+ if (E.current += 1, D.current = e, O.current === void 0) O.current = e;
918
+ else if (!k.current) {
919
+ let t = _.current?.getBoundingClientRect().width ?? 0;
920
+ Math.abs(e - O.current) * t > Ze && (k.current = !0);
921
921
  }
922
- v(e), S.current !== "mouse" && x(e * r);
922
+ y(e), T.current !== "mouse" && S(e * r);
923
923
  }
924
- }), j = (e) => {
925
- S.current = e.pointerType, T.current = 0, D.current = void 0, O.current = !1, A.onPointerDown(e);
926
- }, M = (t) => {
927
- A.onPointerUp(t);
928
- let i = T.current > 0 ? E.current : void 0;
924
+ }), M = (e) => {
925
+ T.current = e.pointerType, E.current = 0, O.current = void 0, k.current = !1, j.onPointerDown(e);
926
+ }, N = (t) => {
927
+ j.onPointerUp(t);
928
+ let i = E.current > 0 ? D.current : void 0;
929
929
  if (i !== void 0 && r) {
930
930
  let t = i * r;
931
931
  n ? n(t) : e.seek(t);
932
932
  }
933
- T.current = 0, O.current = !1, D.current = void 0, t.pointerType !== "mouse" && x(void 0);
934
- }, N = (e) => {
935
- if (!g.current) return;
936
- let { left: t, right: n } = g.current.getBoundingClientRect();
937
- return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
933
+ E.current = 0, k.current = !1, O.current = void 0, t.pointerType !== "mouse" && S(void 0);
938
934
  }, P = (e) => {
939
- x(N(e.clientX));
940
- }, F = () => {
941
- g.current && x(void 0);
942
- }, I = (e) => r ? e / r * 100 : 0, L = f(() => a?.map((e, t) => {
943
- if (!i || !r) return null;
944
- let n = o.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), s = n.at(-1);
945
- if (!a || !s) return null;
946
- let c = a.timestamp / r, l = s.timestamp / r, u = Number((l - c).toFixed(2)), d = c * 100;
935
+ if (!_.current) return;
936
+ let { left: t, right: n } = _.current.getBoundingClientRect();
937
+ return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
938
+ }, F = (e) => {
939
+ S(P(e.clientX));
940
+ }, I = () => {
941
+ _.current && S(void 0);
942
+ }, L = (e) => r ? e / r * 100 : 0, R = (e, t, n) => {
943
+ let r = Number((n - t).toFixed(4)), i = t * 100;
947
944
  return /* @__PURE__ */ C("div", {
948
945
  className: "loaded-part",
949
946
  style: {
950
- transform: `scaleX(${u})`,
951
- marginLeft: `${d}%`
947
+ transform: `scaleX(${r})`,
948
+ marginLeft: `${i}%`
952
949
  }
953
- }, t);
950
+ }, e);
951
+ }, z = f(() => i === void 0 ? r ? o.map(([e, t], n) => R(n, e / r, t / r)) : [] : a?.map((e, t) => {
952
+ if (!i || !r) return null;
953
+ let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
954
+ return !a || !o ? null : R(t, a.timestamp / r, o.timestamp / r);
954
955
  }) ?? [], [
955
956
  r,
956
- o.length,
957
+ i,
958
+ i === void 0 ? o : void 0,
959
+ s.length,
957
960
  a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
958
961
  ]);
959
962
  d(() => {
960
- _ === void 0 || !r || !k || !O.current || e.seek(_ * r);
963
+ v !== void 0 && r && A && k.current && e.seek(v * r);
961
964
  }, [
962
965
  e,
963
- k,
964
- _,
966
+ A,
967
+ v,
965
968
  r
966
969
  ]);
967
- let R = f(() => {
970
+ let B = f(() => {
968
971
  if (!r) return 0;
969
- if (k && _ !== void 0) return _;
970
- let e = h ?? t;
972
+ if (A && v !== void 0) return v;
973
+ let e = g ?? t;
971
974
  return typeof e == "number" ? e / r : 0;
972
975
  }, [
973
976
  r,
974
977
  t,
975
- k,
976
- _,
977
- h
978
- ]), z = f(() => Ae(u, r), [u, r]), B = z.length > 0, V = f(() => {
979
- if (!B || y === void 0 || !r) return -1;
980
- let e = y / r * 100, t = z.findIndex((t, n) => n < z.length - 1 && e >= t && e < z[n + 1]);
981
- return t >= 0 ? t : z.length - 2;
978
+ A,
979
+ v,
980
+ g
981
+ ]), V = f(() => je(h, r), [h, r]), H = V.length > 0, W = f(() => {
982
+ if (!H || b === void 0 || !r) return -1;
983
+ let e = b / r * 100, t = V.findIndex((t, n) => n < V.length - 1 && e >= t && e < V[n + 1]);
984
+ return t >= 0 ? t : V.length - 2;
982
985
  }, [
983
- B,
984
- z,
985
- y,
986
+ H,
987
+ V,
988
+ b,
986
989
  r
987
- ]), H = f(() => B ? je(z, (e) => e !== V) : void 0, [
988
- B,
989
- z,
990
- V
991
- ]), W = f(() => V >= 0 ? je(z, (e) => e === V) : void 0, [z, V]), G = f(() => {
992
- if (y !== void 0) return u.find(({ start: e, end: t }) => e <= y && y < t);
993
- }, [u, y]), K = f(() => {
994
- if (y) {
995
- if (c) return c(y);
996
- if (s.length) return s.find(({ startTime: e, endTime: t }) => e <= y && y < t);
990
+ ]), G = f(() => H ? Me(V, (e) => e !== W) : void 0, [
991
+ H,
992
+ V,
993
+ W
994
+ ]), ee = f(() => W >= 0 ? Me(V, (e) => e === W) : void 0, [V, W]), K = f(() => {
995
+ if (b !== void 0) return h.find(({ start: e, end: t }) => e <= b && b < t);
996
+ }, [h, b]), q = f(() => {
997
+ if (b) {
998
+ if (l) return l(b);
999
+ if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
997
1000
  }
998
1001
  }, [
999
- s,
1000
1002
  c,
1001
- y
1002
- ]), q = (e, t) => /* @__PURE__ */ w("div", {
1003
+ l,
1004
+ b
1005
+ ]), te = (e, t) => /* @__PURE__ */ w("div", {
1003
1006
  className: e ? `track ${e}` : "track",
1004
1007
  style: t ? { maskImage: t } : void 0,
1005
1008
  children: [
1006
1009
  /* @__PURE__ */ C("div", { className: "background-bar" }),
1007
1010
  /* @__PURE__ */ C("div", {
1008
1011
  className: "loaded",
1009
- children: L
1012
+ children: z
1010
1013
  }),
1011
1014
  /* @__PURE__ */ C("div", {
1012
1015
  className: "play-container",
1013
1016
  children: /* @__PURE__ */ C("div", {
1014
1017
  className: "play",
1015
- style: { transform: `scaleX(${R})` }
1018
+ style: { transform: `scaleX(${B})` }
1016
1019
  })
1017
1020
  })
1018
1021
  ]
1019
1022
  });
1020
1023
  return /* @__PURE__ */ w("div", {
1021
- css: Ye,
1022
- ref: g,
1024
+ css: Xe,
1025
+ ref: _,
1023
1026
  className: [
1024
1027
  "progress-bar",
1025
- k ? "dragging" : "",
1026
- B ? "segmented" : ""
1028
+ A ? "dragging" : "",
1029
+ H ? "segmented" : ""
1027
1030
  ].filter(Boolean).join(" "),
1028
- onMouseMove: P,
1029
- onMouseOut: F,
1031
+ onMouseMove: F,
1032
+ onMouseOut: I,
1030
1033
  children: [
1031
- q(void 0, H),
1032
- y ? /* @__PURE__ */ w("div", {
1034
+ te(void 0, G),
1035
+ b ? /* @__PURE__ */ w("div", {
1033
1036
  className: "cursor-time",
1034
1037
  style: {
1035
- left: G ? `clamp(var(--thumbnail-half), ${I(y)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${I(y)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1036
- maxWidth: G ? "var(--thumbnail-width)" : void 0
1038
+ left: K ? `clamp(var(--thumbnail-half), ${L(b)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${L(b)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1039
+ maxWidth: K ? "var(--thumbnail-width)" : void 0
1037
1040
  },
1038
1041
  children: [/* @__PURE__ */ C("span", {
1039
1042
  className: "cursor-time-value",
1040
- children: Y(y)
1041
- }), G ? /* @__PURE__ */ C("span", {
1043
+ children: Y(b)
1044
+ }), K ? /* @__PURE__ */ C("span", {
1042
1045
  className: "chapter-title",
1043
- children: G.title
1046
+ children: K.title
1044
1047
  }) : void 0]
1045
1048
  }) : void 0,
1046
1049
  /* @__PURE__ */ C("div", { className: "progress" }),
1047
1050
  /* @__PURE__ */ C("div", { className: "hover" }),
1048
- W ? q("focus", W) : void 0,
1051
+ ee ? te("focus", ee) : void 0,
1049
1052
  /* @__PURE__ */ C("div", { className: "scrubber" }),
1050
1053
  /* @__PURE__ */ C("div", {
1051
1054
  className: "padding",
1052
- ...A,
1053
- onPointerDown: j,
1054
- onPointerUp: M,
1055
- onPointerCancel: M
1055
+ ...j,
1056
+ onPointerDown: M,
1057
+ onPointerUp: N,
1058
+ onPointerCancel: N
1056
1059
  }),
1057
1060
  /* @__PURE__ */ C("div", {
1058
1061
  className: "thumbnail",
1059
- style: { left: `clamp(var(--thumbnail-half), ${I(y ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1060
- children: K?.url ? /* @__PURE__ */ C("img", { src: K.url }) : void 0
1062
+ style: { left: `clamp(var(--thumbnail-half), ${L(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1063
+ children: q?.url ? /* @__PURE__ */ C("img", { src: q.url }) : void 0
1061
1064
  })
1062
1065
  ]
1063
1066
  });
1064
- }, Qe = "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", Q = {
1067
+ }, $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", Q = {
1065
1068
  xmlns: "http://www.w3.org/2000/svg",
1066
1069
  width: 24,
1067
1070
  height: 24,
@@ -1071,7 +1074,7 @@ var B = {
1071
1074
  strokeWidth: 2,
1072
1075
  strokeLinecap: "round",
1073
1076
  strokeLinejoin: "round"
1074
- }, $e = (e) => /* @__PURE__ */ w("svg", {
1077
+ }, et = (e) => /* @__PURE__ */ w("svg", {
1075
1078
  ...Q,
1076
1079
  ...e,
1077
1080
  children: [/* @__PURE__ */ C("rect", {
@@ -1082,7 +1085,7 @@ var B = {
1082
1085
  rx: "2",
1083
1086
  ry: "2"
1084
1087
  }), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1085
- }), et = (e) => /* @__PURE__ */ w("svg", {
1088
+ }), tt = (e) => /* @__PURE__ */ w("svg", {
1086
1089
  ...Q,
1087
1090
  ...e,
1088
1091
  children: [
@@ -1102,7 +1105,7 @@ var B = {
1102
1105
  y2: "22"
1103
1106
  })
1104
1107
  ]
1105
- }), tt = (e) => /* @__PURE__ */ w("svg", {
1108
+ }), nt = (e) => /* @__PURE__ */ w("svg", {
1106
1109
  ...Q,
1107
1110
  ...e,
1108
1111
  children: [
@@ -1117,7 +1120,7 @@ var B = {
1117
1120
  }),
1118
1121
  /* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
1119
1122
  ]
1120
- }), nt = (e) => /* @__PURE__ */ w("svg", {
1123
+ }), rt = (e) => /* @__PURE__ */ w("svg", {
1121
1124
  ...Q,
1122
1125
  ...e,
1123
1126
  children: [
@@ -1132,7 +1135,7 @@ var B = {
1132
1135
  }),
1133
1136
  /* @__PURE__ */ C("path", { d: "M6 9h3m2 0h2" })
1134
1137
  ]
1135
- }), rt = h`
1138
+ }), it = h`
1136
1139
  .popover {
1137
1140
  position: absolute;
1138
1141
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -1259,7 +1262,7 @@ var B = {
1259
1262
  ${J.bSmall.regular}
1260
1263
  }
1261
1264
  }
1262
- `, it = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1265
+ `, at = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1263
1266
  let c = o !== void 0, l = (e, i, a) => {
1264
1267
  let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
1265
1268
  return /* @__PURE__ */ w("div", {
@@ -1286,7 +1289,7 @@ var B = {
1286
1289
  t.map(({ id: e, label: t }) => l(e, t, "description"))
1287
1290
  ]
1288
1291
  });
1289
- }, at = ({ onReset: e } = {}) => {
1292
+ }, ot = ({ onReset: e } = {}) => {
1290
1293
  let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
1291
1294
  c.current = e;
1292
1295
  let l = () => {
@@ -1327,7 +1330,7 @@ var B = {
1327
1330
  });
1328
1331
  }
1329
1332
  };
1330
- }, ot = h`
1333
+ }, st = h`
1331
1334
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1332
1335
  which is the width of the player box, so it can be clamped to it. */
1333
1336
  position: static;
@@ -1343,7 +1346,7 @@ position: static;
1343
1346
  }
1344
1347
  }
1345
1348
 
1346
- ${rt}
1349
+ ${it}
1347
1350
 
1348
1351
  .popover.error-list {
1349
1352
  /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
@@ -1415,23 +1418,23 @@ ${rt}
1415
1418
  }
1416
1419
  }
1417
1420
  }
1418
- `, st = (e) => new Date(e).toLocaleTimeString(), ct = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Y(Math.max(0, e)), lt = (e) => e.reduce((e, t) => e + t.count, 0), ut = (e) => e.map((e, t) => {
1419
- let n = ct(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1421
+ `, ct = (e) => new Date(e).toLocaleTimeString(), lt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Y(Math.max(0, e)), ut = (e) => e.reduce((e, t) => e + t.count, 0), dt = (e) => e.map((e, t) => {
1422
+ let n = lt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1420
1423
  return [
1421
1424
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
1422
1425
  e.message,
1423
1426
  e.detail
1424
1427
  ].filter(Boolean).join("\n");
1425
- }).join("\n\n"), dt = () => {
1426
- let e = U((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = at(), [i, a] = m(!1);
1428
+ }).join("\n\n"), ft = () => {
1429
+ let e = U((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = ot(), [i, a] = m(!1);
1427
1430
  if (e.length === 0) return null;
1428
1431
  let o = () => {
1429
- navigator.clipboard?.writeText(ut(e)).then(() => {
1432
+ navigator.clipboard?.writeText(dt(e)).then(() => {
1430
1433
  a(!0), setTimeout(() => a(!1), 2e3);
1431
1434
  }, (e) => console.warn("[media-player] could not copy the errors:", e));
1432
- }, s = `Playback errors (${lt(e)})`;
1435
+ }, s = `Playback errors (${ut(e)})`;
1433
1436
  return /* @__PURE__ */ w("div", {
1434
- css: ot,
1437
+ css: st,
1435
1438
  ref: r,
1436
1439
  children: [/* @__PURE__ */ C(Z, {
1437
1440
  id: "errors",
@@ -1462,9 +1465,9 @@ ${rt}
1462
1465
  /* @__PURE__ */ w("span", {
1463
1466
  className: "when",
1464
1467
  children: [
1465
- st(e.at),
1466
- e.count > 1 ? ` to ${st(e.lastAt)}` : "",
1467
- ct(e.atMediaTime) ? ` at ${ct(e.atMediaTime)}` : "",
1468
+ ct(e.at),
1469
+ e.count > 1 ? ` to ${ct(e.lastAt)}` : "",
1470
+ lt(e.atMediaTime) ? ` at ${lt(e.atMediaTime)}` : "",
1468
1471
  e.recovered ? " recovered" : "",
1469
1472
  e.count > 1 ? /* @__PURE__ */ C("span", {
1470
1473
  className: "count",
@@ -1484,7 +1487,7 @@ ${rt}
1484
1487
  }, `${e.at}-${t}`))]
1485
1488
  })]
1486
1489
  });
1487
- }, ft = h`
1490
+ }, pt = h`
1488
1491
  display: flex;
1489
1492
  align-items: center;
1490
1493
  justify-content: center;
@@ -1537,8 +1540,8 @@ width: 100%;
1537
1540
  }
1538
1541
  }
1539
1542
  }
1540
- `, pt = () => {
1541
- let e = U(), t = U((e) => e.playbackRate), n = p(null), r = p(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: u } = Te({
1543
+ `, mt = () => {
1544
+ let e = U(), t = U((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 2.75, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = Ee({
1542
1545
  ref: r,
1543
1546
  onChange: (t) => e.setPlaybackRate(l(t))
1544
1547
  }), f = (t) => {
@@ -1554,7 +1557,7 @@ width: 100%;
1554
1557
  }, [t]);
1555
1558
  let m = c(s);
1556
1559
  return /* @__PURE__ */ w("div", {
1557
- css: ft,
1560
+ css: pt,
1558
1561
  children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
1559
1562
  className: "playback-slider",
1560
1563
  ref: n,
@@ -1572,7 +1575,7 @@ width: 100%;
1572
1575
  })
1573
1576
  })]
1574
1577
  });
1575
- }, mt = h`
1578
+ }, ht = h`
1576
1579
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
1577
1580
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
1578
1581
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -1590,7 +1593,7 @@ position: static;
1590
1593
  }
1591
1594
  }
1592
1595
 
1593
- ${rt}
1596
+ ${it}
1594
1597
 
1595
1598
  .playback-rate {
1596
1599
  .slider {
@@ -1631,8 +1634,8 @@ ${rt}
1631
1634
  }
1632
1635
  }
1633
1636
 
1634
- `, ht = () => {
1635
- let e = U(), t = U((e) => e.playbackRate), n = U((e) => e.audioTracks), r = U((e) => e.selectedAudioTrack), i = U((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = at({ onReset: () => o(0) }), p = (t) => {
1637
+ `, gt = () => {
1638
+ let e = U(), t = U((e) => e.playbackRate), n = U((e) => e.audioTracks), r = U((e) => e.selectedAudioTrack), i = U((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = ot({ onReset: () => o(0) }), p = (t) => {
1636
1639
  e.setPlaybackRate(t), o(0);
1637
1640
  }, h = (e) => {
1638
1641
  e !== void 0 && f(e, () => i(e));
@@ -1640,7 +1643,7 @@ ${rt}
1640
1643
  o(e);
1641
1644
  };
1642
1645
  return /* @__PURE__ */ w("div", {
1643
- css: mt,
1646
+ css: ht,
1644
1647
  ref: l,
1645
1648
  children: [
1646
1649
  /* @__PURE__ */ C(Z, {
@@ -1679,7 +1682,7 @@ ${rt}
1679
1682
  }),
1680
1683
  /* @__PURE__ */ C("div", {
1681
1684
  className: "slider no-hover",
1682
- children: /* @__PURE__ */ C(pt, {})
1685
+ children: /* @__PURE__ */ C(mt, {})
1683
1686
  }),
1684
1687
  /* @__PURE__ */ w("div", {
1685
1688
  className: "options no-hover",
@@ -1704,7 +1707,7 @@ ${rt}
1704
1707
  })
1705
1708
  ]
1706
1709
  }),
1707
- s && a === 2 && /* @__PURE__ */ C(it, {
1710
+ s && a === 2 && /* @__PURE__ */ C(at, {
1708
1711
  title: "Audio",
1709
1712
  tracks: n,
1710
1713
  selected: r,
@@ -1715,7 +1718,7 @@ ${rt}
1715
1718
  })
1716
1719
  ]
1717
1720
  });
1718
- }, gt = h`
1721
+ }, _t = h`
1719
1722
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1720
1723
  which is the width of the player box, so it can be clamped to it. */
1721
1724
  position: static;
@@ -1731,13 +1734,13 @@ position: static;
1731
1734
  }
1732
1735
  }
1733
1736
 
1734
- ${rt}
1735
- `, _t = () => {
1736
- let e = U((e) => e.subtitleTracks), t = U((e) => e.selectedSubtitleTrack), n = U((e) => e.selectSubtitleTrack), r = U((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = at();
1737
+ ${it}
1738
+ `, vt = () => {
1739
+ let e = U((e) => e.subtitleTracks), t = U((e) => e.selectedSubtitleTrack), n = U((e) => e.selectSubtitleTrack), r = U((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = ot();
1737
1740
  if (e.length === 0) return null;
1738
1741
  let u = t !== void 0;
1739
1742
  return /* @__PURE__ */ w("div", {
1740
- css: gt,
1743
+ css: _t,
1741
1744
  ref: o,
1742
1745
  children: [/* @__PURE__ */ C(Z, {
1743
1746
  id: "subtitles",
@@ -1749,10 +1752,10 @@ ${rt}
1749
1752
  "aria-label": "Subtitles",
1750
1753
  "aria-expanded": i,
1751
1754
  "aria-pressed": u,
1752
- children: u ? /* @__PURE__ */ C($e, { className: "captions" }) : /* @__PURE__ */ C(et, { className: "captions-off" })
1755
+ children: u ? /* @__PURE__ */ C(et, { className: "captions" }) : /* @__PURE__ */ C(tt, { className: "captions-off" })
1753
1756
  }),
1754
1757
  toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
1755
- }), i && /* @__PURE__ */ C(it, {
1758
+ }), i && /* @__PURE__ */ C(at, {
1756
1759
  title: "Subtitles",
1757
1760
  tracks: e,
1758
1761
  selected: t,
@@ -1762,13 +1765,13 @@ ${rt}
1762
1765
  failed: c
1763
1766
  })]
1764
1767
  });
1765
- }, vt = {
1768
+ }, yt = {
1766
1769
  primary: "#EAEBEE",
1767
1770
  secondary: "#D0D0D9",
1768
1771
  hover: "rgba(255, 255, 255, 0.13)",
1769
1772
  borderPrimary: "#384F70",
1770
1773
  backgroundTooltip: "#222222"
1771
- }, yt = h`
1774
+ }, bt = h`
1772
1775
  display: flex;
1773
1776
  align-items: center;
1774
1777
 
@@ -1811,8 +1814,8 @@ ${rt}
1811
1814
  width: 10px;
1812
1815
  height: 10px;
1813
1816
  }
1814
- `, bt = ({ value: e, onChange: t }) => {
1815
- let n = U((e) => e.volume), r = U((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Te({
1817
+ `, xt = ({ value: e, onChange: t }) => {
1818
+ let n = U((e) => e.volume), r = U((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Ee({
1816
1819
  ref: a,
1817
1820
  onChange: t
1818
1821
  }), s = (n) => {
@@ -1826,12 +1829,12 @@ ${rt}
1826
1829
  e && e.removeEventListener("wheel", s);
1827
1830
  };
1828
1831
  }, [e]);
1829
- let c = e * 100, l = f(() => Math.round(r ? 0 : be(n) * 100), [n, r]);
1832
+ let c = e * 100, l = f(() => Math.round(r ? 0 : xe(n) * 100), [n, r]);
1830
1833
  return /* @__PURE__ */ C(Z, {
1831
1834
  id: "volume-slider",
1832
1835
  text: /* @__PURE__ */ C("div", {
1833
1836
  ref: i,
1834
- css: yt,
1837
+ css: bt,
1835
1838
  ...o,
1836
1839
  children: /* @__PURE__ */ C("div", {
1837
1840
  ref: a,
@@ -1850,7 +1853,7 @@ ${rt}
1850
1853
  children: [l, "%"]
1851
1854
  })
1852
1855
  });
1853
- }, xt = h`
1856
+ }, St = h`
1854
1857
  position: relative;
1855
1858
  display: flex;
1856
1859
  align-items: center;
@@ -1913,10 +1916,10 @@ ${rt}
1913
1916
  }
1914
1917
  }
1915
1918
 
1916
- `, St = ({ ref: e }) => {
1917
- let t = U(), n = U((e) => e.volume), r = U((e) => e.muted), i = f(() => be(n), [n]);
1919
+ `, Ct = ({ ref: e }) => {
1920
+ let t = U(), n = U((e) => e.volume), r = U((e) => e.muted), i = f(() => xe(n), [n]);
1918
1921
  return /* @__PURE__ */ w("div", {
1919
- css: xt,
1922
+ css: St,
1920
1923
  children: [/* @__PURE__ */ C(Z, {
1921
1924
  id: "sound",
1922
1925
  text: /* @__PURE__ */ C("button", {
@@ -1936,16 +1939,16 @@ ${rt}
1936
1939
  className: "volume-slider-container",
1937
1940
  children: /* @__PURE__ */ C("div", {
1938
1941
  className: "volume-slider-background",
1939
- children: /* @__PURE__ */ C(bt, {
1942
+ children: /* @__PURE__ */ C(xt, {
1940
1943
  value: r ? 0 : i,
1941
1944
  onChange: (e) => {
1942
- t.setVolume(ye(e));
1945
+ t.setVolume(be(e));
1943
1946
  }
1944
1947
  })
1945
1948
  })
1946
1949
  })]
1947
1950
  });
1948
- }, $ = .05, Ct = 5, wt = h`
1951
+ }, $ = .05, wt = 5, Tt = h`
1949
1952
  display: flex;
1950
1953
  flex-direction: column;
1951
1954
  gap: calc(0.4 * var(--mp-unit));
@@ -1954,7 +1957,7 @@ ${rt}
1954
1957
  opacity: 0.72;
1955
1958
  font-size: 0.9em;
1956
1959
  }
1957
- `, Tt = h`
1960
+ `, Et = h`
1958
1961
  position: absolute;
1959
1962
  bottom: 0;
1960
1963
  width: 100%;
@@ -2044,7 +2047,7 @@ ${rt}
2044
2047
  cursor: pointer;
2045
2048
 
2046
2049
  :hover {
2047
- background-color: ${vt.hover};
2050
+ background-color: ${yt.hover};
2048
2051
  }
2049
2052
 
2050
2053
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -2082,10 +2085,10 @@ ${rt}
2082
2085
  }
2083
2086
  }
2084
2087
  }
2085
- `, Et = () => {
2088
+ `, Dt = () => {
2086
2089
  let e = U(), t = U((e) => e.paused), n = U((e) => e.currentTime), r = U((e) => e.duration), i = U((e) => e.seekingTo), a = U((e) => e.fullscreen), o = U((e) => e.hideUI), s = U((e) => e.togglePictureInPicture), c = U((e) => e.pictureInPictureMode), l = U((e) => e.burnedInSubtitles), f = U((e) => e.subtitleTracks), p = U((e) => e.requestSeek), [h, g] = m(null), _ = c === "burn-in", v = f.length > 0, y = r > 0 && n === r, b = u(({ direction: t, stepSize: n }) => {
2087
- let r = be(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2088
- e.setVolume(ye(a)), o && !e.muted && e.toggleMuted();
2090
+ let r = xe(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2091
+ e.setVolume(be(a)), o && !e.muted && e.toggleMuted();
2089
2092
  }, [e]);
2090
2093
  d(() => {
2091
2094
  let t = (t) => p ? p(t) : e.seek(t), n = (n) => {
@@ -2106,8 +2109,8 @@ ${rt}
2106
2109
  });
2107
2110
  else if (n.key === "ArrowRight") {
2108
2111
  if (!e.duration) return;
2109
- t(Math.min(e.currentTime + Ct, e.duration));
2110
- } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - Ct, 0)) : i = !1;
2112
+ t(Math.min(e.currentTime + wt, e.duration));
2113
+ } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - wt, 0)) : i = !1;
2111
2114
  i && n.preventDefault();
2112
2115
  };
2113
2116
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
@@ -2128,12 +2131,12 @@ ${rt}
2128
2131
  return d(() => {
2129
2132
  if (h) return h.addEventListener("wheel", x, { passive: !1 }), () => h.removeEventListener("wheel", x);
2130
2133
  }, [h, x]), /* @__PURE__ */ w("div", {
2131
- css: Tt,
2134
+ css: Et,
2132
2135
  style: { ...o ? {
2133
2136
  opacity: "0",
2134
2137
  pointerEvents: "none"
2135
2138
  } : {} },
2136
- children: [/* @__PURE__ */ C(Ze, {}), /* @__PURE__ */ w("div", {
2139
+ children: [/* @__PURE__ */ C(Qe, {}), /* @__PURE__ */ w("div", {
2137
2140
  className: "actions",
2138
2141
  children: [/* @__PURE__ */ w("div", {
2139
2142
  className: "left",
@@ -2150,18 +2153,18 @@ ${rt}
2150
2153
  }),
2151
2154
  toolTipText: /* @__PURE__ */ C("span", { children: y ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2152
2155
  }),
2153
- /* @__PURE__ */ C(St, { ref: g }),
2156
+ /* @__PURE__ */ C(Ct, { ref: g }),
2154
2157
  /* @__PURE__ */ C("div", {
2155
2158
  className: "time",
2156
- children: xe(i ?? n, r)
2159
+ children: Se(i ?? n, r)
2157
2160
  })
2158
2161
  ]
2159
2162
  }), /* @__PURE__ */ w("div", {
2160
2163
  className: "right",
2161
2164
  children: [
2162
- /* @__PURE__ */ C(dt, {}),
2163
- /* @__PURE__ */ C(_t, {}),
2164
- /* @__PURE__ */ C(ht, {}),
2165
+ /* @__PURE__ */ C(ft, {}),
2166
+ /* @__PURE__ */ C(vt, {}),
2167
+ /* @__PURE__ */ C(gt, {}),
2165
2168
  s ? /* @__PURE__ */ C(Z, {
2166
2169
  id: "picture-in-picture",
2167
2170
  tooltipPlace: "top-end",
@@ -2172,13 +2175,13 @@ ${rt}
2172
2175
  disabled: _ && !v,
2173
2176
  "aria-label": _ ? "Put the subtitles in the video" : "Picture in picture",
2174
2177
  "aria-pressed": _ ? l : void 0,
2175
- children: _ ? C(l ? tt : nt, {}) : /* @__PURE__ */ C("img", {
2176
- src: Qe,
2178
+ children: _ ? C(l ? nt : rt, {}) : /* @__PURE__ */ C("img", {
2179
+ src: $e,
2177
2180
  alt: ""
2178
2181
  })
2179
2182
  }),
2180
2183
  toolTipText: /* @__PURE__ */ w("span", {
2181
- css: wt,
2184
+ css: Tt,
2182
2185
  children: [/* @__PURE__ */ C("span", {
2183
2186
  className: "lead",
2184
2187
  children: _ ? v ? l ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
@@ -2205,7 +2208,7 @@ ${rt}
2205
2208
  })]
2206
2209
  })]
2207
2210
  });
2208
- }, Dt = 9e3, Ot = h`
2211
+ }, Ot = 9e3, kt = h`
2209
2212
  position: absolute;
2210
2213
  inset: 0;
2211
2214
  z-index: 2;
@@ -2259,7 +2262,7 @@ ${rt}
2259
2262
  line-height: 1;
2260
2263
  color: #fff;
2261
2264
  }
2262
- `, kt = () => {
2265
+ `, At = () => {
2263
2266
  let e = U((e) => e.burnedInSubtitles), t = U((e) => e.pictureInPictureMode), [n, r] = m(!1);
2264
2267
  return d(() => {
2265
2268
  if (t !== "burn-in" || !e) {
@@ -2267,10 +2270,10 @@ ${rt}
2267
2270
  return;
2268
2271
  }
2269
2272
  r(!0);
2270
- let n = setTimeout(() => r(!1), Dt);
2273
+ let n = setTimeout(() => r(!1), Ot);
2271
2274
  return () => clearTimeout(n);
2272
2275
  }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
2273
- css: Ot,
2276
+ css: kt,
2274
2277
  className: n ? "show" : "",
2275
2278
  role: "status",
2276
2279
  children: /* @__PURE__ */ w("div", {
@@ -2291,10 +2294,10 @@ ${rt}
2291
2294
  })]
2292
2295
  })
2293
2296
  });
2294
- }, At = 1, jt = 6e3, Mt = 1, Nt = {
2297
+ }, jt = 1, Mt = 6e3, Nt = 1, Pt = {
2295
2298
  opening: "Skip Opening",
2296
2299
  ending: "Skip Ending"
2297
- }, Pt = h`
2300
+ }, Ft = h`
2298
2301
  position: absolute;
2299
2302
  inset: 0;
2300
2303
  z-index: 2;
@@ -2345,10 +2348,10 @@ ${rt}
2345
2348
  bottom: calc(9 * var(--mp-unit));
2346
2349
  }
2347
2350
  }
2348
- `, Ft = () => {
2349
- let e = U((e) => e.chapters), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U(), i = f(() => Je(e), [e]), a = f(() => {
2351
+ `, It = () => {
2352
+ let e = U((e) => e.chapters), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U(), i = f(() => Ye(e), [e]), a = f(() => {
2350
2353
  if (typeof t != "number") return;
2351
- let n = e.findIndex((e, n) => i[n] !== void 0 && e.start - At <= t && t < e.end), r = n >= 0 ? i[n] : void 0;
2354
+ let n = e.findIndex((e, n) => i[n] !== void 0 && e.start - jt <= t && t < e.end), r = n >= 0 ? i[n] : void 0;
2352
2355
  return r ? {
2353
2356
  kind: r,
2354
2357
  end: e[n].end
@@ -2360,7 +2363,7 @@ ${rt}
2360
2363
  ]), o = p(0), [s, c] = m(0);
2361
2364
  d(() => {
2362
2365
  let e = typeof t == "number" ? t : 0, n = o.current;
2363
- o.current = e, e < n - Mt && c((e) => e + 1);
2366
+ o.current = e, e < n - Nt && c((e) => e + 1);
2364
2367
  }, [t]);
2365
2368
  let [l, u] = m(!1), h = a ? `${a.kind}@${a.end}` : "";
2366
2369
  return d(() => {
@@ -2369,12 +2372,12 @@ ${rt}
2369
2372
  return;
2370
2373
  }
2371
2374
  u(!0);
2372
- let e = setTimeout(() => u(!1), jt);
2375
+ let e = setTimeout(() => u(!1), Mt);
2373
2376
  return () => clearTimeout(e);
2374
2377
  }, [h, s]), d(() => {
2375
2378
  a || u(!1);
2376
2379
  }, [a]), a ? /* @__PURE__ */ C("div", {
2377
- css: Pt,
2380
+ css: Ft,
2378
2381
  className: l ? "show" : "",
2379
2382
  children: /* @__PURE__ */ C("button", {
2380
2383
  type: "button",
@@ -2382,10 +2385,10 @@ ${rt}
2382
2385
  onClick: () => {
2383
2386
  u(!1), n ? n(a.end) : r.seek(a.end);
2384
2387
  },
2385
- children: Nt[a.kind]
2388
+ children: Pt[a.kind]
2386
2389
  })
2387
2390
  }) : null;
2388
- }, It = 3e3, Lt = h`
2391
+ }, Lt = 3e3, Rt = h`
2389
2392
  position: absolute;
2390
2393
  inset: 0;
2391
2394
  z-index: 2;
@@ -2396,7 +2399,7 @@ ${rt}
2396
2399
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
2397
2400
  not, and transitioning it holds the item on screen for the length of the fade. */
2398
2401
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
2399
- `, Rt = h`
2402
+ `, zt = h`
2400
2403
  position: relative;
2401
2404
  background-color: black;
2402
2405
  display: flex;
@@ -2441,13 +2444,13 @@ ${rt}
2441
2444
  &.hide {
2442
2445
  cursor: none;
2443
2446
  }
2444
- `, zt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2447
+ `, Bt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2445
2448
  let r = `${t}${l(e) && e.key != null ? e.key : n}`;
2446
- return l(e) && e.type === c ? zt(e.props.children, `${r}/`) : [{
2449
+ return l(e) && e.type === c ? Bt(e.props.children, `${r}/`) : [{
2447
2450
  key: r,
2448
2451
  item: e
2449
2452
  }];
2450
- }), Bt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2453
+ }), Vt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2451
2454
  let o = U(), s = U((e) => e.hideUI), c = U((e) => e.setHideUI), l = U((e) => e.hasMedia), u = p(void 0), f = p("mouse"), m = p({
2452
2455
  x: -1,
2453
2456
  y: -1
@@ -2467,15 +2470,15 @@ ${rt}
2467
2470
  return !!n && h.current.contains(n) && !n.closest(".video");
2468
2471
  }, y = () => {
2469
2472
  if (v()) {
2470
- u.current = setTimeout(y, It);
2473
+ u.current = setTimeout(y, Lt);
2471
2474
  return;
2472
2475
  }
2473
2476
  g();
2474
2477
  }, b = () => {
2475
- c(!1), clearTimeout(u.current), u.current = setTimeout(y, It);
2478
+ c(!1), clearTimeout(u.current), u.current = setTimeout(y, Lt);
2476
2479
  };
2477
2480
  return /* @__PURE__ */ w("div", {
2478
- css: Rt,
2481
+ css: zt,
2479
2482
  ref: _,
2480
2483
  onPointerMove: (e) => {
2481
2484
  f.current = e.pointerType, e.pointerType === "mouse" && (m.current = {
@@ -2494,9 +2497,9 @@ ${rt}
2494
2497
  },
2495
2498
  className: s ? "hide" : "",
2496
2499
  children: [
2497
- /* @__PURE__ */ C(ge, { onSubtitleRef: n }),
2498
- zt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
2499
- css: Lt,
2500
+ /* @__PURE__ */ C(_e, { onSubtitleRef: n }),
2501
+ Bt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
2502
+ css: Rt,
2500
2503
  style: { ...s ? {
2501
2504
  opacity: "0",
2502
2505
  visibility: "hidden",
@@ -2504,9 +2507,9 @@ ${rt}
2504
2507
  } : {} },
2505
2508
  children: t
2506
2509
  }, e)),
2507
- i === !1 ? null : /* @__PURE__ */ C(Et, {}),
2508
- /* @__PURE__ */ C(kt, {}),
2509
- /* @__PURE__ */ C(Ft, {}),
2510
+ i === !1 ? null : /* @__PURE__ */ C(Dt, {}),
2511
+ /* @__PURE__ */ C(At, {}),
2512
+ /* @__PURE__ */ C(It, {}),
2510
2513
  /* @__PURE__ */ w("div", {
2511
2514
  className: "video",
2512
2515
  onClick: () => {
@@ -2523,7 +2526,7 @@ ${rt}
2523
2526
  })
2524
2527
  ]
2525
2528
  });
2526
- }, Vt = ({ options: e, children: t }) => {
2529
+ }, Ht = ({ options: e, children: t }) => {
2527
2530
  let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: f, thumbnailsEnabled: h } = r ?? {}, g = y(), _ = v(), [b, x] = m(null), [S, w] = m(null), T = n?.media ?? b;
2528
2531
  d(() => (g?.(T), () => g?.(null)), [T, g]);
2529
2532
  let { expose: E } = e, D = E === !0 ? {} : E || void 0, O = p(D);
@@ -2608,7 +2611,7 @@ ${rt}
2608
2611
  });
2609
2612
  }, [R, H]), d(() => {
2610
2613
  a && R({ chapters: a });
2611
- }, [R, a]), /* @__PURE__ */ C(Bt, {
2614
+ }, [R, a]), /* @__PURE__ */ C(Vt, {
2612
2615
  ref: _,
2613
2616
  onVideoRef: n ? void 0 : x,
2614
2617
  onSubtitleRef: w,
@@ -2616,7 +2619,7 @@ ${rt}
2616
2619
  controls: e.controls,
2617
2620
  children: t
2618
2621
  });
2619
- }, Ht = h`
2622
+ }, Ut = h`
2620
2623
  /**
2621
2624
  * The chrome's whole scale, in one place.
2622
2625
  *
@@ -2686,17 +2689,17 @@ ${rt}
2686
2689
  height: 100%;
2687
2690
  width: 100%;
2688
2691
  overflow: hidden;
2689
- `, Ut = (e) => /* @__PURE__ */ C("div", {
2690
- css: Ht,
2691
- children: /* @__PURE__ */ C(H.Provider, { children: /* @__PURE__ */ C(Vt, {
2692
+ `, Wt = (e) => /* @__PURE__ */ C("div", {
2693
+ css: Ut,
2694
+ children: /* @__PURE__ */ C(H.Provider, { children: /* @__PURE__ */ C(Ht, {
2692
2695
  options: e,
2693
2696
  children: e.children
2694
2697
  }) })
2695
- }), Wt = (e) => !!e && typeof e == "object" && "at" in e, Gt = (e) => !!e && typeof e == "object" && "selection" in e, Kt = ({ blob: e, name: t }) => ({
2698
+ }), Gt = (e) => !!e && typeof e == "object" && "at" in e, Kt = (e) => !!e && typeof e == "object" && "selection" in e, qt = ({ blob: e, name: t }) => ({
2696
2699
  length: e.size,
2697
2700
  name: t ?? (e instanceof File ? e.name : void 0),
2698
2701
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
2699
- }), qt = async (e, t) => {
2702
+ }), Jt = async (e, t) => {
2700
2703
  let n = await fetch(e, {
2701
2704
  headers: { Range: "bytes=0-1" },
2702
2705
  credentials: t
@@ -2706,8 +2709,8 @@ ${rt}
2706
2709
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
2707
2710
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
2708
2711
  return i;
2709
- }, Jt = async ({ url: e, length: t, name: n, credentials: r }) => {
2710
- let i = t ?? await qt(e, r);
2712
+ }, Yt = async ({ url: e, length: t, name: n, credentials: r }) => {
2713
+ let i = t ?? await Jt(e, r);
2711
2714
  return {
2712
2715
  length: i,
2713
2716
  name: n,
@@ -2722,9 +2725,9 @@ ${rt}
2722
2725
  return o.arrayBuffer();
2723
2726
  }
2724
2727
  };
2725
- }, Yt = async (e) => {
2726
- if ("blob" in e) return Kt(e);
2727
- if ("url" in e) return Jt(e);
2728
+ }, Xt = async (e) => {
2729
+ if ("blob" in e) return qt(e);
2730
+ if ("url" in e) return Yt(e);
2728
2731
  if ("read" in e) return {
2729
2732
  length: e.length,
2730
2733
  name: e.name,
@@ -2733,4 +2736,4 @@ ${rt}
2733
2736
  throw Error(`Unknown source type: ${e}`);
2734
2737
  };
2735
2738
  //#endregion
2736
- export { Ut as MediaPlayer, Ut as default, H as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, Yt as inputToRemuxerInput, Gt as isDelegatedTracks, Wt as isExternalThumbnails, V as sourceFeature, i as startPlayback, ue as usePictureInPicture, U as usePlayer, le as useSeekThumbnails };
2739
+ export { Wt as MediaPlayer, Wt as default, H as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, Xt as inputToRemuxerInput, Kt as isDelegatedTracks, Gt as isExternalThumbnails, V as sourceFeature, i as startPlayback, ue as usePictureInPicture, U as usePlayer, le as useSeekThumbnails };