@banou/media-player 0.8.3 → 0.8.5

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
@@ -305,7 +305,7 @@ var re = {
305
305
  ${z.bLarge.regular}
306
306
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
307
307
  pointer-events: none;
308
- `, pe = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", B = ({ onCanvasRef: e }) => {
308
+ `, pe = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", me = ({ onCanvasRef: e }) => {
309
309
  let t = P((e) => e.title), n = P((e) => e.hideUI), r = P((e) => e.playbackError), i = P((e) => e.ready), a = P((e) => e.size), o = P((e) => e.waiting);
310
310
  return /* @__PURE__ */ S(b, { children: [
311
311
  t ? /* @__PURE__ */ x("div", {
@@ -327,11 +327,11 @@ var re = {
327
327
  css: le
328
328
  })
329
329
  ] });
330
- }, V = 1e-4, H = 1, U = (e) => Math.max(V, Math.min(H, e)) ** 2, W = (e) => Math.max(V, Math.min(H, e)) ** (H / 2), G = (e) => {
330
+ }, B = 1e-4, V = 1, H = (e) => Math.max(B, Math.min(V, e)) ** 2, U = (e) => Math.max(B, Math.min(V, e)) ** (V / 2), W = (e) => {
331
331
  if (e === void 0) return "0:00";
332
332
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
333
333
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
334
- }, me = (e, t) => `${G(e)} / ${G(t)}`, he = (e) => p`
334
+ }, he = (e, t) => `${W(e)} / ${W(t)}`, ge = (e) => p`
335
335
  display: flex;
336
336
  justify-content: flex-end;
337
337
 
@@ -353,7 +353,7 @@ var re = {
353
353
  ${e === "lg" && p`
354
354
  padding: calc(1.2 * var(--mp-unit))!important;
355
355
  `}
356
- `, K = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("div", {
356
+ `, G = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("div", {
357
357
  "data-tooltip-id": e,
358
358
  "data-open": !0,
359
359
  "data-tooltip-offset": a,
@@ -362,11 +362,11 @@ var re = {
362
362
  "data-tooltip-place": o,
363
363
  children: n
364
364
  }), !s && /* @__PURE__ */ x(ne, {
365
- css: he(c),
365
+ css: ge(c),
366
366
  id: e,
367
367
  noArrow: !0,
368
368
  children: t
369
- })] }), q = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
369
+ })] }), K = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
370
370
  let [i, a] = f(!1), o = d(t);
371
371
  o.current = t;
372
372
  let s = d(null), u = c((t, r) => {
@@ -393,7 +393,7 @@ var re = {
393
393
  style: { touchAction: "none" }
394
394
  }
395
395
  };
396
- }, ge = p`
396
+ }, _e = p`
397
397
  position: relative;
398
398
  height: calc(.4 * var(--mp-unit));
399
399
 
@@ -437,14 +437,28 @@ var re = {
437
437
  display: flex;
438
438
  justify-content: center;
439
439
 
440
+ /* The seekbar's other hover affordance, the thumbnail below, gets a rounded box and a drop
441
+ shadow. A source that ships no thumbnails, which is every source whose media the player does
442
+ not own, leaves this readout as the entire preview, so it carries the same treatment instead
443
+ of sitting as bare text on the picture. The ink comes from the player root. */
444
+ background-color: rgba(28, 28, 28, .95);
445
+ border-radius: calc(.4 * var(--mp-unit));
446
+ padding: 0 calc(.6 * var(--mp-unit));
447
+ box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
448
+
440
449
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
441
450
  ${z.bMedium.bold}
442
451
 
443
452
  position: absolute;
444
- top: calc(-2.5 * var(--mp-unit));
445
- width: calc(5 * var(--mp-unit));
453
+ /* Anchored on its bottom edge rather than its top: now that it has a background its height
454
+ follows the font size, and a top-anchored box would grow downward into the track. */
455
+ bottom: calc(1.2 * var(--mp-unit));
456
+ /* Sized to its content, replacing a fixed 5 unit box that \`1:04:09\` overflows. Transparent, that
457
+ overflow was invisible; filled, it would not be. */
458
+ width: max-content;
459
+ white-space: nowrap;
460
+ transform: translateX(-50%);
446
461
 
447
- margin-left: calc(-2.5 * var(--mp-unit));
448
462
  pointer-events: none;
449
463
  }
450
464
 
@@ -550,8 +564,8 @@ var re = {
550
564
  --thumbnail-width: calc(18 * var(--mp-unit));
551
565
  --thumbnail-half: calc(9 * var(--mp-unit));
552
566
  }
553
- `, J = () => {
554
- let e = P(), t = P((e) => e.currentTime), n = P((e) => e.duration), r = P((e) => e.size), i = P((e) => e.downloadedRanges), a = P((e) => e.indexes), o = P((e) => e.thumbnails), s = P((e) => e.thumbnailAt), c = d(null), [p, m] = f(void 0), [h, g] = f(void 0), _ = d(void 0), { dragging: v, handlers: y } = q({
567
+ `, ve = () => {
568
+ let e = P(), t = P((e) => e.currentTime), n = P((e) => e.duration), r = P((e) => e.size), i = P((e) => e.downloadedRanges), a = P((e) => e.indexes), o = P((e) => e.thumbnails), s = P((e) => e.thumbnailAt), c = d(null), [p, m] = f(void 0), [h, g] = f(void 0), _ = d(void 0), { dragging: v, handlers: y } = K({
555
569
  ref: c,
556
570
  onChange: (e) => {
557
571
  m(e), _.current !== "mouse" && g(e * n);
@@ -609,7 +623,7 @@ var re = {
609
623
  h
610
624
  ]);
611
625
  return /* @__PURE__ */ S("div", {
612
- css: ge,
626
+ css: _e,
613
627
  ref: c,
614
628
  className: v ? "progress-bar dragging" : "progress-bar",
615
629
  onMouseMove: T,
@@ -618,7 +632,7 @@ var re = {
618
632
  /* @__PURE__ */ x("div", { className: "background-bar" }),
619
633
  h ? /* @__PURE__ */ x("div", {
620
634
  className: "cursor-time",
621
- style: { left: `clamp(calc(1.8 * var(--mp-unit)), ${D(h)}%, calc(100% - calc(1.8 * var(--mp-unit))))` },
635
+ style: { left: `clamp(calc(3 * var(--mp-unit)), ${D(h)}%, calc(100% - calc(3 * var(--mp-unit))))` },
622
636
  children: k
623
637
  }) : void 0,
624
638
  /* @__PURE__ */ x("div", { className: "progress" }),
@@ -650,7 +664,7 @@ var re = {
650
664
  })
651
665
  ]
652
666
  });
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`
667
+ }, ye = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-picture-in-picture'%3e%3cpath%20stroke='none'%20d='M0%200h24v24H0z'%20fill='none'%20/%3e%3cpath%20d='M11%2019h-6a2%202%200%200%201%20-2%20-2v-10a2%202%200%200%201%202%20-2h14a2%202%200%200%201%202%202v4'%20/%3e%3cpath%20d='M14%2014m0%201a1%201%200%200%201%201%20-1h5a1%201%200%200%201%201%201v3a1%201%200%200%201%20-1%201h-5a1%201%200%200%201%20-1%20-1z'%20/%3e%3c/svg%3e", be = p`
654
668
  display: flex;
655
669
  align-items: center;
656
670
  justify-content: center;
@@ -703,8 +717,8 @@ width: 100%;
703
717
  }
704
718
  }
705
719
  }
706
- `, ye = () => {
707
- let e = P(), t = P((e) => e.playbackRate), n = d(null), r = d(null), i = .25, a = 3 - i, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, u = (e) => o(i + e * a), { handlers: f } = q({
720
+ `, xe = () => {
721
+ let e = P(), t = P((e) => e.playbackRate), n = d(null), r = d(null), i = .25, a = 3 - i, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, u = (e) => o(i + e * a), { handlers: f } = K({
708
722
  ref: r,
709
723
  onChange: (t) => e.setPlaybackRate(u(t))
710
724
  }), p = (t) => {
@@ -720,7 +734,7 @@ width: 100%;
720
734
  }, [t]);
721
735
  let m = c(s);
722
736
  return /* @__PURE__ */ S("div", {
723
- css: ve,
737
+ css: be,
724
738
  children: [/* @__PURE__ */ S("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ x("div", {
725
739
  className: "playback-slider",
726
740
  ref: n,
@@ -738,37 +752,38 @@ width: 100%;
738
752
  })
739
753
  })]
740
754
  });
741
- }, be = p`
742
- position: relative;
743
-
744
- .settings {
745
- /* the icon keeps its size, the pressable box grows around it */
746
- @media (pointer: coarse) {
747
- box-sizing: border-box;
748
- justify-content: center;
749
-
750
- min-width: 44px;
751
- min-height: 44px;
752
- }
753
- }
754
-
755
+ }, q = p`
755
756
  .popover {
756
757
  position: absolute;
757
- /* the gear sits a couple of buttons in from the right edge, so a centred popover hangs off that
758
- edge on a phone. It anchors to the button instead until the viewport has room to centre it. */
759
- right: 0;
760
- transform: none;
758
+ /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
759
+ bar, so a menu centred on it puts its own edges wherever the button happens to sit: with no
760
+ picture-in-picture button, which is every source whose media the player does not own, an edge
761
+ landed outside the box, and the root's \`overflow: hidden\` cut it off, taking the rows under it
762
+ out of reach. The inset matches the bar's own padding so the menu lines up with the last button. */
763
+ right: calc(12px + env(safe-area-inset-right, 0px));
764
+ bottom: calc(100% + 8px);
761
765
 
762
766
  overflow-y: auto;
763
767
  width: 180px;
764
- max-width: calc(100vw - 24px);
765
- height: 160px;
766
- top: -180px;
768
+ /* \`100%\` is the control bar, which is the width of the PLAYER. The old \`100vw\` was the viewport,
769
+ which equals the player only when the player is the whole document, and it is the wrong kind of
770
+ guard besides: a max-width shrinks the box, it never moves it back inside. */
771
+ max-width: calc(100% - 24px);
772
+ /* Sized to its rows, capped at what fits. A fixed height left the settings menu two thirds empty
773
+ once subtitles moved out to its own button, and a long track list scrolls at the cap either way. */
774
+ height: max-content;
775
+ /* The room actually above the bar. A short player had the top of the menu clipped by that same
776
+ \`overflow: hidden\`. With no size container in the ancestry this resolves against the small
777
+ viewport, so it can only ever shrink the box, never grow it. */
778
+ max-height: min(160px, calc(100cqh - 100% - 16px));
767
779
  @media (min-width: 768px) {
768
- right: 50%;
769
- transform: translateX(50%);
780
+ right: calc(16px + env(safe-area-inset-right, 0px));
770
781
  width: 250px;
771
- height: 160px;
782
+ max-width: calc(100% - 32px);
783
+ }
784
+ @media (min-width: 2560px) {
785
+ right: calc(24px + env(safe-area-inset-right, 0px));
786
+ max-width: calc(100% - 48px);
772
787
  }
773
788
 
774
789
  display: flex;
@@ -843,6 +858,115 @@ position: relative;
843
858
  }
844
859
  }
845
860
 
861
+ .track-list {
862
+ .description {
863
+ word-break: break-word;
864
+ }
865
+
866
+ /* Dimmed and inert, but still listed. A source that names a track it cannot serve right now is
867
+ saying the track exists, and dropping the row would read as the source having nothing. */
868
+ .unavailable {
869
+ opacity: 0.5;
870
+ cursor: default;
871
+ :hover {
872
+ background-color: transparent;
873
+ }
874
+ }
875
+
876
+ .failed {
877
+ border-bottom: 1px solid #4D4D4E;
878
+ color: #f66;
879
+ ${z.bSmall.regular}
880
+ }
881
+ }
882
+ `, J = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
883
+ let c = o !== void 0, l = (e, i, a) => {
884
+ let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
885
+ return /* @__PURE__ */ S("div", {
886
+ onClick: () => {
887
+ l || r(e ?? void 0);
888
+ },
889
+ className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
890
+ children: [/* @__PURE__ */ x("span", { children: i }), /* @__PURE__ */ x("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
891
+ }, e ?? "__off__");
892
+ };
893
+ return /* @__PURE__ */ S("div", {
894
+ className: "popover track-list",
895
+ children: [
896
+ /* @__PURE__ */ S("div", {
897
+ className: i ? "back" : "back no-hover",
898
+ onClick: i,
899
+ children: [i ? /* @__PURE__ */ x(C, {}) : null, /* @__PURE__ */ x("span", { children: e })]
900
+ }),
901
+ s ? /* @__PURE__ */ x("div", {
902
+ className: "no-hover failed",
903
+ children: "Could not switch. Try again."
904
+ }) : null,
905
+ a ? l(null, a) : null,
906
+ t.map(({ id: e, label: t }) => l(e, t, "description"))
907
+ ]
908
+ });
909
+ }, Y = ({ onReset: e } = {}) => {
910
+ let t = d(null), [n, r] = f(!1), [i, a] = f(void 0), [o, s] = f(!1), c = d(e);
911
+ c.current = e;
912
+ let u = () => {
913
+ r(!1), c.current?.();
914
+ };
915
+ return l(() => {
916
+ let e = (e) => {
917
+ n && t.current && !t.current.contains(e.target) && u();
918
+ };
919
+ return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
920
+ }, [n]), {
921
+ open: n,
922
+ toggle: () => {
923
+ r((e) => !e), s(!1), c.current?.();
924
+ },
925
+ close: u,
926
+ containerRef: t,
927
+ pending: i,
928
+ failed: o,
929
+ runSelect: (e, t) => {
930
+ if (i !== void 0) return;
931
+ s(!1);
932
+ let n;
933
+ try {
934
+ n = t();
935
+ } catch (e) {
936
+ console.warn("[media-player] track selection failed:", e), s(!0);
937
+ return;
938
+ }
939
+ if (!(n instanceof Promise)) {
940
+ u();
941
+ return;
942
+ }
943
+ a(e), n.then(() => {
944
+ a(void 0), u();
945
+ }, (e) => {
946
+ console.warn("[media-player] track selection failed:", e), a(void 0), s(!0);
947
+ });
948
+ }
949
+ };
950
+ }, Se = p`
951
+ /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
952
+ as wide as the player box and can therefore be clamped to it. The outside-click check uses
953
+ \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
954
+ tooltips already resolve against the control bar with no positioned wrapper of their own. */
955
+ position: static;
956
+
957
+ .settings {
958
+ /* the icon keeps its size, the pressable box grows around it */
959
+ @media (pointer: coarse) {
960
+ box-sizing: border-box;
961
+ justify-content: center;
962
+
963
+ min-width: 44px;
964
+ min-height: 44px;
965
+ }
966
+ }
967
+
968
+ ${q}
969
+
846
970
  .playback-rate {
847
971
  .slider {
848
972
  width: 100%;
@@ -882,142 +1006,178 @@ position: relative;
882
1006
  }
883
1007
  }
884
1008
 
885
- .track-list {
886
- .description {
887
- word-break: break-word;
888
- }
889
- }
890
- `, Y = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, allowDisable: a }) => /* @__PURE__ */ S("div", {
891
- className: "popover track-list",
892
- children: [
893
- /* @__PURE__ */ S("div", {
894
- className: "back",
895
- onClick: i,
896
- children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: e })]
897
- }),
898
- a ? /* @__PURE__ */ S("div", {
899
- onClick: () => r(void 0),
900
- children: [/* @__PURE__ */ x("span", { children: "Disable" }), /* @__PURE__ */ x("span", { children: n === void 0 ? "✓" : "" })]
901
- }) : null,
902
- t.map(({ id: e, label: t }) => /* @__PURE__ */ S("div", {
903
- onClick: () => r(e),
904
- className: "description",
905
- children: [/* @__PURE__ */ x("span", { children: t }), /* @__PURE__ */ x("span", { children: n === e ? "✓" : "" })]
906
- }, e))
907
- ]
908
- }), xe = () => {
909
- 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), o = P((e) => e.selectedAudioTrack), s = P((e) => e.selectAudioTrack), [c, u] = f(!1), [p, m] = f(0), h = d(null), g = () => {
910
- u(!c), m(0);
911
- }, _ = (t) => {
912
- e.setPlaybackRate(t), m(0);
913
- };
914
- l(() => {
915
- let e = (e) => {
916
- c && h.current && !h.current.contains(e.target) && g();
917
- };
918
- return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
919
- }, [c]);
920
- let v = (e) => {
921
- i(e), g();
922
- }, y = (e) => {
923
- e !== void 0 && s(e), g();
924
- }, b = (e) => () => {
925
- m(e);
1009
+ `, Ce = () => {
1010
+ let e = P(), t = P((e) => e.playbackRate), n = P((e) => e.audioTracks), r = P((e) => e.selectedAudioTrack), i = P((e) => e.selectAudioTrack), [a, o] = f(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: p } = Y({ onReset: () => o(0) }), m = (t) => {
1011
+ e.setPlaybackRate(t), o(0);
1012
+ }, h = (e) => {
1013
+ e !== void 0 && p(e, () => i(e));
1014
+ }, g = (e) => () => {
1015
+ o(e);
926
1016
  };
927
1017
  return /* @__PURE__ */ S("div", {
928
- css: be,
929
- ref: h,
1018
+ css: Se,
1019
+ ref: l,
930
1020
  children: [
931
- /* @__PURE__ */ x(K, {
1021
+ /* @__PURE__ */ x(G, {
932
1022
  id: "settings",
933
- disabled: c,
1023
+ disabled: s,
934
1024
  text: /* @__PURE__ */ x("button", {
935
1025
  className: "settings",
936
1026
  type: "button",
937
- onClick: g,
1027
+ onClick: c,
938
1028
  children: /* @__PURE__ */ x(A, {})
939
1029
  }),
940
1030
  toolTipText: /* @__PURE__ */ x("span", { children: "Settings" })
941
1031
  }),
942
- c && p === 0 && /* @__PURE__ */ S("div", {
1032
+ s && a === 0 && /* @__PURE__ */ S("div", {
943
1033
  className: "popover menu",
944
- children: [
945
- a.length > 1 ? /* @__PURE__ */ S("div", {
946
- onClick: b(3),
947
- children: [/* @__PURE__ */ x("div", { children: "Audio" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
948
- }) : null,
949
- n.length > 0 ? /* @__PURE__ */ S("div", {
950
- onClick: b(2),
951
- children: [/* @__PURE__ */ x("div", { children: "Subtitles" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
952
- }) : null,
953
- /* @__PURE__ */ S("div", {
954
- onClick: b(1),
955
- children: [/* @__PURE__ */ x("div", { children: "Playback speed" }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
956
- className: "secondary",
957
- children: t === 1 ? "(Default)" : t.toFixed(2)
958
- }), /* @__PURE__ */ x(w, {})] })]
959
- })
960
- ]
1034
+ children: [n.length > 1 ? /* @__PURE__ */ S("div", {
1035
+ onClick: g(2),
1036
+ children: [/* @__PURE__ */ x("div", { children: "Audio" }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(w, {}) })]
1037
+ }) : null, /* @__PURE__ */ S("div", {
1038
+ onClick: g(1),
1039
+ children: [/* @__PURE__ */ x("div", { children: "Playback speed" }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
1040
+ className: "secondary",
1041
+ children: t === 1 ? "(Default)" : t.toFixed(2)
1042
+ }), /* @__PURE__ */ x(w, {})] })]
1043
+ })]
961
1044
  }),
962
- c && p === 1 && /* @__PURE__ */ S("div", {
1045
+ s && a === 1 && /* @__PURE__ */ S("div", {
963
1046
  className: "popover playback-rate",
964
1047
  children: [
965
1048
  /* @__PURE__ */ S("div", {
966
1049
  className: "back",
967
- onClick: b(0),
1050
+ onClick: g(0),
968
1051
  children: [/* @__PURE__ */ x(C, {}), /* @__PURE__ */ x("span", { children: "Playback speed" })]
969
1052
  }),
970
1053
  /* @__PURE__ */ x("div", {
971
1054
  className: "slider no-hover",
972
- children: /* @__PURE__ */ x(ye, {})
1055
+ children: /* @__PURE__ */ x(xe, {})
973
1056
  }),
974
1057
  /* @__PURE__ */ S("div", {
975
1058
  className: "options no-hover",
976
1059
  children: [
977
1060
  /* @__PURE__ */ x("div", {
978
- onClick: () => _(.5),
1061
+ onClick: () => m(.5),
979
1062
  children: "0.5x"
980
1063
  }),
981
1064
  /* @__PURE__ */ x("div", {
982
- onClick: () => _(1),
1065
+ onClick: () => m(1),
983
1066
  children: "1x"
984
1067
  }),
985
1068
  /* @__PURE__ */ x("div", {
986
- onClick: () => _(1.5),
1069
+ onClick: () => m(1.5),
987
1070
  children: "1.5x"
988
1071
  }),
989
1072
  /* @__PURE__ */ x("div", {
990
- onClick: () => _(2),
1073
+ onClick: () => m(2),
991
1074
  children: "2x"
992
1075
  })
993
1076
  ]
994
1077
  })
995
1078
  ]
996
1079
  }),
997
- c && p === 2 && /* @__PURE__ */ x(Y, {
998
- title: "Subtitles",
1080
+ s && a === 2 && /* @__PURE__ */ x(J, {
1081
+ title: "Audio",
999
1082
  tracks: n,
1000
1083
  selected: r,
1001
- onSelect: v,
1002
- onBack: b(0),
1003
- allowDisable: !0
1004
- }),
1005
- c && p === 3 && /* @__PURE__ */ x(Y, {
1006
- title: "Audio",
1007
- tracks: a,
1008
- selected: o,
1009
- onSelect: y,
1010
- onBack: b(0)
1084
+ onSelect: h,
1085
+ onBack: g(0),
1086
+ pending: u,
1087
+ failed: d
1011
1088
  })
1012
1089
  ]
1013
1090
  });
1014
- }, Se = {
1091
+ }, X = {
1092
+ xmlns: "http://www.w3.org/2000/svg",
1093
+ width: 24,
1094
+ height: 24,
1095
+ viewBox: "0 0 24 24",
1096
+ fill: "none",
1097
+ stroke: "currentColor",
1098
+ strokeWidth: 2,
1099
+ strokeLinecap: "round",
1100
+ strokeLinejoin: "round"
1101
+ }, we = (e) => /* @__PURE__ */ S("svg", {
1102
+ ...X,
1103
+ ...e,
1104
+ children: [/* @__PURE__ */ x("rect", {
1105
+ x: "3",
1106
+ y: "5",
1107
+ width: "18",
1108
+ height: "14",
1109
+ rx: "2",
1110
+ ry: "2"
1111
+ }), /* @__PURE__ */ x("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1112
+ }), Te = (e) => /* @__PURE__ */ S("svg", {
1113
+ ...X,
1114
+ ...e,
1115
+ children: [
1116
+ /* @__PURE__ */ x("rect", {
1117
+ x: "3",
1118
+ y: "5",
1119
+ width: "18",
1120
+ height: "14",
1121
+ rx: "2",
1122
+ ry: "2"
1123
+ }),
1124
+ /* @__PURE__ */ x("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
1125
+ /* @__PURE__ */ x("line", {
1126
+ x1: "2",
1127
+ y1: "2",
1128
+ x2: "22",
1129
+ y2: "22"
1130
+ })
1131
+ ]
1132
+ }), Ee = p`
1133
+ /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1134
+ which is the width of the player box, so it can be clamped to it. */
1135
+ position: static;
1136
+
1137
+ .subtitles {
1138
+ /* the icon keeps its size, the pressable box grows around it */
1139
+ @media (pointer: coarse) {
1140
+ box-sizing: border-box;
1141
+ justify-content: center;
1142
+
1143
+ min-width: 44px;
1144
+ min-height: 44px;
1145
+ }
1146
+ }
1147
+
1148
+ ${q}
1149
+ `, De = () => {
1150
+ let e = P((e) => e.subtitleTracks), t = P((e) => e.selectedSubtitleTrack), n = P((e) => e.selectSubtitleTrack), r = P((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Y();
1151
+ return e.length === 0 ? null : /* @__PURE__ */ S("div", {
1152
+ css: Ee,
1153
+ ref: o,
1154
+ children: [/* @__PURE__ */ x(G, {
1155
+ id: "subtitles",
1156
+ disabled: i,
1157
+ text: /* @__PURE__ */ x("button", {
1158
+ className: "subtitles",
1159
+ type: "button",
1160
+ onClick: a,
1161
+ children: t === void 0 ? /* @__PURE__ */ x(Te, { className: "captions-off" }) : /* @__PURE__ */ x(we, { className: "captions" })
1162
+ }),
1163
+ toolTipText: /* @__PURE__ */ x("span", { children: "Subtitles" })
1164
+ }), i && /* @__PURE__ */ x(J, {
1165
+ title: "Subtitles",
1166
+ tracks: e,
1167
+ selected: t,
1168
+ onSelect: (e) => l(e ?? null, () => n(e)),
1169
+ offLabel: r ?? "Disable",
1170
+ pending: s,
1171
+ failed: c
1172
+ })]
1173
+ });
1174
+ }, Oe = {
1015
1175
  primary: "#EAEBEE",
1016
1176
  secondary: "#D0D0D9",
1017
1177
  hover: "rgba(255, 255, 255, 0.13)",
1018
1178
  borderPrimary: "#384F70",
1019
1179
  backgroundTooltip: "#222222"
1020
- }, Ce = p`
1180
+ }, ke = p`
1021
1181
  display: flex;
1022
1182
  align-items: center;
1023
1183
 
@@ -1060,8 +1220,8 @@ position: relative;
1060
1220
  width: 10px;
1061
1221
  height: 10px;
1062
1222
  }
1063
- `, we = ({ value: e, onChange: t }) => {
1064
- let n = P((e) => e.volume), r = P((e) => e.muted), i = d(null), a = d(null), { handlers: o } = q({
1223
+ `, Ae = ({ value: e, onChange: t }) => {
1224
+ let n = P((e) => e.volume), r = P((e) => e.muted), i = d(null), a = d(null), { handlers: o } = K({
1065
1225
  ref: a,
1066
1226
  onChange: t
1067
1227
  }), s = (n) => {
@@ -1075,12 +1235,12 @@ position: relative;
1075
1235
  e && e.removeEventListener("wheel", s);
1076
1236
  };
1077
1237
  }, [e]);
1078
- let c = e * 100, f = u(() => Math.round(r ? 0 : W(n) * 100), [n, r]);
1079
- return /* @__PURE__ */ x(K, {
1238
+ let c = e * 100, f = u(() => Math.round(r ? 0 : U(n) * 100), [n, r]);
1239
+ return /* @__PURE__ */ x(G, {
1080
1240
  id: "volume-slider",
1081
1241
  text: /* @__PURE__ */ x("div", {
1082
1242
  ref: i,
1083
- css: Ce,
1243
+ css: ke,
1084
1244
  ...o,
1085
1245
  children: /* @__PURE__ */ x("div", {
1086
1246
  ref: a,
@@ -1099,7 +1259,7 @@ position: relative;
1099
1259
  children: [f, "%"]
1100
1260
  })
1101
1261
  });
1102
- }, Te = p`
1262
+ }, je = p`
1103
1263
  position: relative;
1104
1264
  display: flex;
1105
1265
  align-items: center;
@@ -1162,11 +1322,11 @@ position: relative;
1162
1322
  }
1163
1323
  }
1164
1324
 
1165
- `, Ee = ({ ref: e }) => {
1166
- let t = P(), n = P((e) => e.volume), r = P((e) => e.muted), i = u(() => W(n), [n]);
1325
+ `, Me = ({ ref: e }) => {
1326
+ let t = P(), n = P((e) => e.volume), r = P((e) => e.muted), i = u(() => U(n), [n]);
1167
1327
  return /* @__PURE__ */ S("div", {
1168
- css: Te,
1169
- children: [/* @__PURE__ */ x(K, {
1328
+ css: je,
1329
+ children: [/* @__PURE__ */ x(G, {
1170
1330
  id: "sound",
1171
1331
  text: /* @__PURE__ */ x("button", {
1172
1332
  className: "sound",
@@ -1183,16 +1343,16 @@ position: relative;
1183
1343
  className: "volume-slider-container",
1184
1344
  children: /* @__PURE__ */ x("div", {
1185
1345
  className: "volume-slider-background",
1186
- children: /* @__PURE__ */ x(we, {
1346
+ children: /* @__PURE__ */ x(Ae, {
1187
1347
  value: r ? 0 : i,
1188
1348
  onChange: (e) => {
1189
- t.setVolume(U(e));
1349
+ t.setVolume(H(e));
1190
1350
  }
1191
1351
  })
1192
1352
  })
1193
1353
  })]
1194
1354
  });
1195
- }, X = .05, Z = 5, De = p`
1355
+ }, Z = .05, Q = 5, Ne = p`
1196
1356
  position: absolute;
1197
1357
  bottom: 0;
1198
1358
  width: 100%;
@@ -1244,7 +1404,7 @@ position: relative;
1244
1404
  }
1245
1405
  }
1246
1406
 
1247
- .play, .sound, .time, .settings, .picture-in-picture, .full-screen {
1407
+ .play, .sound, .time, .subtitles, .settings, .picture-in-picture, .full-screen {
1248
1408
  display: flex;
1249
1409
  align-items: center;
1250
1410
 
@@ -1262,7 +1422,7 @@ position: relative;
1262
1422
  }
1263
1423
  }
1264
1424
 
1265
- .play, .sound, .settings, .picture-in-picture, .full-screen {
1425
+ .play, .sound, .subtitles, .settings, .picture-in-picture, .full-screen {
1266
1426
  border-radius: 4px;
1267
1427
 
1268
1428
  padding: 8px;
@@ -1276,7 +1436,7 @@ position: relative;
1276
1436
  cursor: pointer;
1277
1437
 
1278
1438
  :hover {
1279
- background-color: ${Se.hover};
1439
+ background-color: ${Oe.hover};
1280
1440
  }
1281
1441
 
1282
1442
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -1314,10 +1474,10 @@ position: relative;
1314
1474
  }
1315
1475
  }
1316
1476
  }
1317
- `, Oe = () => {
1477
+ `, Pe = () => {
1318
1478
  let e = P(), t = P((e) => e.paused), n = P((e) => e.currentTime), r = P((e) => e.duration), i = P((e) => e.fullscreen), a = P((e) => e.hideUI), o = P((e) => e.togglePictureInPicture), [s, u] = f(null), d = r > 0 && n === r, p = c(({ direction: t, stepSize: n }) => {
1319
- let r = W(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
1320
- e.setVolume(U(a)), o && !e.muted && e.toggleMuted();
1479
+ let r = U(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
1480
+ e.setVolume(H(a)), o && !e.muted && e.toggleMuted();
1321
1481
  }, [e]);
1322
1482
  l(() => {
1323
1483
  let t = (t) => {
@@ -1330,16 +1490,16 @@ position: relative;
1330
1490
  else if (t.key === "m") e.toggleMuted();
1331
1491
  else if (t.key === "ArrowUp") p({
1332
1492
  direction: "up",
1333
- stepSize: X
1493
+ stepSize: Z
1334
1494
  });
1335
1495
  else if (t.key === "ArrowDown") p({
1336
1496
  direction: "down",
1337
- stepSize: X
1497
+ stepSize: Z
1338
1498
  });
1339
1499
  else if (t.key === "ArrowRight") {
1340
1500
  if (!e.duration) return;
1341
- e.seek(Math.min(e.currentTime + Z, e.duration));
1342
- } else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime - Z, 0)) : r = !1;
1501
+ e.seek(Math.min(e.currentTime + Q, e.duration));
1502
+ } else t.key === "ArrowLeft" ? e.seek(Math.max(e.currentTime - Q, 0)) : r = !1;
1343
1503
  r && t.preventDefault();
1344
1504
  };
1345
1505
  return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
@@ -1347,26 +1507,26 @@ position: relative;
1347
1507
  let m = c((e) => {
1348
1508
  e.preventDefault(), e.deltaY < 0 ? p({
1349
1509
  direction: "up",
1350
- stepSize: X
1510
+ stepSize: Z
1351
1511
  }) : p({
1352
1512
  direction: "down",
1353
- stepSize: X
1513
+ stepSize: Z
1354
1514
  });
1355
1515
  }, [p]);
1356
1516
  return l(() => {
1357
1517
  if (s) return s.addEventListener("wheel", m, { passive: !1 }), () => s.removeEventListener("wheel", m);
1358
1518
  }, [s, m]), /* @__PURE__ */ S("div", {
1359
- css: De,
1519
+ css: Ne,
1360
1520
  style: { ...a ? {
1361
1521
  opacity: "0",
1362
1522
  pointerEvents: "none"
1363
1523
  } : {} },
1364
- children: [/* @__PURE__ */ x(J, {}), /* @__PURE__ */ S("div", {
1524
+ children: [/* @__PURE__ */ x(ve, {}), /* @__PURE__ */ S("div", {
1365
1525
  className: "actions",
1366
1526
  children: [/* @__PURE__ */ S("div", {
1367
1527
  className: "left",
1368
1528
  children: [
1369
- /* @__PURE__ */ x(K, {
1529
+ /* @__PURE__ */ x(G, {
1370
1530
  id: "play",
1371
1531
  tooltipPlace: "top-start",
1372
1532
  text: /* @__PURE__ */ x("button", {
@@ -1377,27 +1537,28 @@ position: relative;
1377
1537
  }),
1378
1538
  toolTipText: /* @__PURE__ */ x("span", { children: d ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
1379
1539
  }),
1380
- /* @__PURE__ */ x(Ee, { ref: u }),
1540
+ /* @__PURE__ */ x(Me, { ref: u }),
1381
1541
  /* @__PURE__ */ x("div", {
1382
1542
  className: "time",
1383
- children: me(n, r)
1543
+ children: he(n, r)
1384
1544
  })
1385
1545
  ]
1386
1546
  }), /* @__PURE__ */ S("div", {
1387
1547
  className: "right",
1388
1548
  children: [
1389
- /* @__PURE__ */ x(xe, {}),
1390
- o ? /* @__PURE__ */ x(K, {
1549
+ /* @__PURE__ */ x(De, {}),
1550
+ /* @__PURE__ */ x(Ce, {}),
1551
+ o ? /* @__PURE__ */ x(G, {
1391
1552
  id: "picture-in-picture",
1392
1553
  text: /* @__PURE__ */ x("button", {
1393
1554
  className: "picture-in-picture",
1394
1555
  type: "button",
1395
1556
  onClick: o,
1396
- children: /* @__PURE__ */ x("img", { src: _e })
1557
+ children: /* @__PURE__ */ x("img", { src: ye })
1397
1558
  }),
1398
1559
  toolTipText: /* @__PURE__ */ x("span", { children: "Picture in picture" })
1399
1560
  }) : null,
1400
- /* @__PURE__ */ x(K, {
1561
+ /* @__PURE__ */ x(G, {
1401
1562
  id: "full-screen",
1402
1563
  tooltipPlace: "top-end",
1403
1564
  text: /* @__PURE__ */ x("button", {
@@ -1412,7 +1573,7 @@ position: relative;
1412
1573
  })]
1413
1574
  })]
1414
1575
  });
1415
- }, ke = 3e3, Ae = p`
1576
+ }, Fe = 3e3, Ie = p`
1416
1577
  position: absolute;
1417
1578
  inset: 0;
1418
1579
  z-index: 2;
@@ -1423,7 +1584,7 @@ position: relative;
1423
1584
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
1424
1585
  not, and transitioning it holds the item on screen for the length of the fade. */
1425
1586
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
1426
- `, je = p`
1587
+ `, Le = p`
1427
1588
  position: relative;
1428
1589
  background-color: black;
1429
1590
  display: flex;
@@ -1455,63 +1616,63 @@ position: relative;
1455
1616
  &.hide {
1456
1617
  cursor: none;
1457
1618
  }
1458
- `, Q = (e, t = "") => a.toArray(e).flatMap((e, n) => {
1619
+ `, $ = (e, t = "") => a.toArray(e).flatMap((e, n) => {
1459
1620
  let r = `${t}${s(e) && e.key != null ? e.key : n}`;
1460
- return s(e) && e.type === o ? Q(e.props.children, `${r}/`) : [{
1621
+ return s(e) && e.type === o ? $(e.props.children, `${r}/`) : [{
1461
1622
  key: r,
1462
1623
  item: e
1463
1624
  }];
1464
- }), Me = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, children: i }) => {
1465
- let a = P(), o = P((e) => e.hideUI), s = P((e) => e.setHideUI), c = d(void 0), u = d("mouse");
1466
- l(() => () => clearTimeout(c.current), []);
1467
- let f = () => {
1468
- s(!1), clearTimeout(c.current), c.current = setTimeout(() => s(!0), ke);
1625
+ }), Re = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
1626
+ let o = P(), s = P((e) => e.hideUI), c = P((e) => e.setHideUI), u = d(void 0), f = d("mouse");
1627
+ l(() => () => clearTimeout(u.current), []);
1628
+ let p = () => {
1629
+ c(!1), clearTimeout(u.current), u.current = setTimeout(() => c(!0), Fe);
1469
1630
  };
1470
1631
  return /* @__PURE__ */ S("div", {
1471
- css: je,
1632
+ css: Le,
1472
1633
  ref: e,
1473
1634
  onPointerMove: (e) => {
1474
- u.current = e.pointerType, e.pointerType === "mouse" && f();
1635
+ f.current = e.pointerType, e.pointerType === "mouse" && p();
1475
1636
  },
1476
1637
  onPointerDown: (e) => {
1477
- u.current = e.pointerType;
1638
+ f.current = e.pointerType;
1478
1639
  },
1479
1640
  onMouseOut: (e) => {
1480
1641
  let t = e.relatedTarget;
1481
1642
  if (t && e.currentTarget.contains(t)) return;
1482
1643
  let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
1483
- e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(c.current), s(!0));
1644
+ e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(u.current), c(!0));
1484
1645
  },
1485
- className: o ? "hide" : "",
1646
+ className: s ? "hide" : "",
1486
1647
  children: [
1487
- /* @__PURE__ */ x(B, { onCanvasRef: n }),
1488
- Q(r).map(({ key: e, item: t }) => /* @__PURE__ */ x("div", {
1489
- css: Ae,
1490
- style: { ...o ? {
1648
+ /* @__PURE__ */ x(me, { onCanvasRef: n }),
1649
+ $(r).map(({ key: e, item: t }) => /* @__PURE__ */ x("div", {
1650
+ css: Ie,
1651
+ style: { ...s ? {
1491
1652
  opacity: "0",
1492
1653
  visibility: "hidden",
1493
1654
  pointerEvents: "none"
1494
1655
  } : {} },
1495
1656
  children: t
1496
1657
  }, e)),
1497
- /* @__PURE__ */ x(Oe, {}),
1658
+ i === !1 ? null : /* @__PURE__ */ x(Pe, {}),
1498
1659
  /* @__PURE__ */ S("div", {
1499
1660
  className: "video",
1500
1661
  onClick: () => {
1501
- if (u.current === "mouse") {
1502
- a.togglePaused();
1662
+ if (f.current === "mouse") {
1663
+ o.togglePaused();
1503
1664
  return;
1504
1665
  }
1505
- o ? f() : (clearTimeout(c.current), s(!0));
1666
+ s ? p() : (clearTimeout(u.current), c(!0));
1506
1667
  },
1507
1668
  children: [t ? /* @__PURE__ */ x("video", {
1508
1669
  ref: t,
1509
1670
  playsInline: !0
1510
- }) : null, i]
1671
+ }) : null, a]
1511
1672
  })
1512
1673
  ]
1513
1674
  });
1514
- }, Ne = ({ options: e, children: t }) => {
1675
+ }, ze = ({ options: e, children: t }) => {
1515
1676
  let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: u, thumbnailRead: d, thumbnailsEnabled: p } = r ?? {}, m = _(), h = g(), [v, y] = f(null), [b, S] = f(null), C = n?.media ?? v;
1516
1677
  l(() => (m?.(C), () => m?.(null)), [C, m]), oe(v, b, r);
1517
1678
  let w = L({
@@ -1549,30 +1710,34 @@ position: relative;
1549
1710
  let k = n?.subtitles?.selection, A = n?.audioTracks?.selection;
1550
1711
  return l(() => {
1551
1712
  k && D({
1552
- subtitleTracks: k.options.map(({ id: e, label: t }) => ({
1713
+ subtitleTracks: k.options.map(({ id: e, label: t, disabled: n }) => ({
1553
1714
  id: e,
1554
- label: t
1715
+ label: t,
1716
+ disabled: n
1555
1717
  })),
1556
1718
  selectedSubtitleTrack: k.selectedId ?? void 0,
1557
- selectSubtitleTrack: (e) => k.select(e == null ? null : String(e))
1719
+ selectSubtitleTrack: (e) => k.select(e == null ? null : String(e)),
1720
+ subtitleOffLabel: k.offLabel
1558
1721
  });
1559
1722
  }, [D, k]), l(() => {
1560
1723
  A && D({
1561
- audioTracks: A.options.map(({ id: e, label: t }) => ({
1724
+ audioTracks: A.options.map(({ id: e, label: t, disabled: n }) => ({
1562
1725
  id: e,
1563
- label: t
1726
+ label: t,
1727
+ disabled: n
1564
1728
  })),
1565
1729
  selectedAudioTrack: A.selectedId ?? void 0,
1566
1730
  selectAudioTrack: (e) => A.select(String(e))
1567
1731
  });
1568
- }, [D, A]), /* @__PURE__ */ x(Me, {
1732
+ }, [D, A]), /* @__PURE__ */ x(Re, {
1569
1733
  ref: h,
1570
1734
  onVideoRef: n ? void 0 : y,
1571
1735
  onCanvasRef: S,
1572
1736
  overlay: e.overlay,
1737
+ controls: e.controls,
1573
1738
  children: t
1574
1739
  });
1575
- }, Pe = p`
1740
+ }, Be = p`
1576
1741
  /**
1577
1742
  * The chrome's whole scale, in one place.
1578
1743
  *
@@ -1584,6 +1749,45 @@ position: relative;
1584
1749
  */
1585
1750
  --mp-unit: 10px;
1586
1751
 
1752
+ /**
1753
+ * The chrome's own typeface, for exactly the reason the unit above exists.
1754
+ *
1755
+ * \`font-family\` inherits, and this library declared it nowhere, so every label drew in whatever the
1756
+ * embedding document happened to set, and in the UA's serif where it set nothing. Not hypothetical:
1757
+ * stub mounts the player in a second document, \`embed.html\`, which sets no font and loads no face,
1758
+ * and the entire settings menu came out in Times New Roman.
1759
+ *
1760
+ * Named faces only, no bundled webfont. The chrome is a handful of short labels, so a font request
1761
+ * on the critical path of a document whose job is to paint video buys a round trip and a flash of
1762
+ * unstyled text for nothing.
1763
+ *
1764
+ * Read through \`var()\` so a host with a brand face sets \`--mp-font-family\` on any ancestor and it
1765
+ * inherits in. A bare \`font-family\` on the host can no longer reach the chrome: this declaration is
1766
+ * on the player element itself and beats anything inherited.
1767
+ */
1768
+ font-family: var(
1769
+ --mp-font-family,
1770
+ system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
1771
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'
1772
+ );
1773
+
1774
+ /**
1775
+ * The chrome's default ink, same argument again.
1776
+ *
1777
+ * Most text here names its own colour, but the two time readouts do not: the elapsed/duration pair
1778
+ * and the seekbar's hover time carry a font token and a black text-shadow and nothing else.
1779
+ * Inherited from a host that declares none that resolves to \`canvastext\`, which is black text under
1780
+ * a black halo on a dark gradient.
1781
+ */
1782
+ color: #fff;
1783
+
1784
+ /**
1785
+ * The settings menu scrolls, and a UA that has not been told the surface is dark paints that
1786
+ * scrollbar in its light theme: a white track down the side of a #1c1c1c menu. Declared here rather
1787
+ * than asked of the host, so it reaches the menu and nothing outside the player.
1788
+ */
1789
+ color-scheme: dark;
1790
+
1587
1791
  /**
1588
1792
  * The other half of owning the chrome's own scale.
1589
1793
  *
@@ -1603,17 +1807,17 @@ position: relative;
1603
1807
  height: 100%;
1604
1808
  width: 100%;
1605
1809
  overflow: hidden;
1606
- `, $ = (e) => /* @__PURE__ */ x("div", {
1607
- css: Pe,
1608
- children: /* @__PURE__ */ x(N.Provider, { children: /* @__PURE__ */ x(Ne, {
1810
+ `, Ve = (e) => /* @__PURE__ */ x("div", {
1811
+ css: Be,
1812
+ children: /* @__PURE__ */ x(N.Provider, { children: /* @__PURE__ */ x(ze, {
1609
1813
  options: e,
1610
1814
  children: e.children
1611
1815
  }) })
1612
- }), Fe = (e) => !!e && typeof e == "object" && "at" in e, Ie = (e) => !!e && typeof e == "object" && "selection" in e, Le = ({ blob: e, name: t }) => ({
1816
+ }), He = (e) => !!e && typeof e == "object" && "at" in e, Ue = (e) => !!e && typeof e == "object" && "selection" in e, We = ({ blob: e, name: t }) => ({
1613
1817
  length: e.size,
1614
1818
  name: t ?? (e instanceof File ? e.name : void 0),
1615
1819
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
1616
- }), Re = async (e, t) => {
1820
+ }), Ge = async (e, t) => {
1617
1821
  let n = await fetch(e, {
1618
1822
  headers: { Range: "bytes=0-1" },
1619
1823
  credentials: t
@@ -1623,8 +1827,8 @@ position: relative;
1623
1827
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
1624
1828
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
1625
1829
  return i;
1626
- }, ze = async ({ url: e, length: t, name: n, credentials: r }) => {
1627
- let i = t ?? await Re(e, r);
1830
+ }, Ke = async ({ url: e, length: t, name: n, credentials: r }) => {
1831
+ let i = t ?? await Ge(e, r);
1628
1832
  return {
1629
1833
  length: i,
1630
1834
  name: n,
@@ -1637,9 +1841,9 @@ position: relative;
1637
1841
  return a.arrayBuffer();
1638
1842
  }
1639
1843
  };
1640
- }, Be = async (e) => {
1641
- if ("blob" in e) return Le(e);
1642
- if ("url" in e) return ze(e);
1844
+ }, qe = async (e) => {
1845
+ if ("blob" in e) return We(e);
1846
+ if ("url" in e) return Ke(e);
1643
1847
  if ("read" in e) return {
1644
1848
  length: e.length,
1645
1849
  name: e.name,
@@ -1648,4 +1852,4 @@ position: relative;
1648
1852
  throw Error(`Unknown source type: ${e}`);
1649
1853
  };
1650
1854
  //#endregion
1651
- export { $ as MediaPlayer, $ as default, N as Player, n as SUBTITLES_OFF, i as createPictureInPicture, r as createSubtitleRenderer, t as createThumbnailGenerator, Be as inputToRemuxerInput, Ie as isDelegatedTracks, Fe as isExternalThumbnails, M as sourceFeature, e as startPlayback, R as usePictureInPicture, P as usePlayer, L as useSeekThumbnails };
1855
+ export { Ve as MediaPlayer, Ve as default, N as Player, n as SUBTITLES_OFF, i as createPictureInPicture, r as createSubtitleRenderer, t as createThumbnailGenerator, qe as inputToRemuxerInput, Ue as isDelegatedTracks, He as isExternalThumbnails, M as sourceFeature, e as startPlayback, R as usePictureInPicture, P as usePlayer, L as useSeekThumbnails };