@banou/media-player 0.10.5 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
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";
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
- import { css as h, keyframes as g } from "@emotion/react";
4
- import { createPlayer as _, useContainerAttach as v, useMediaAttach as y } from "@videojs/react";
5
- import { definePlayerFeature as b, videoFeatures as x } from "@videojs/core/dom";
6
- import { Fragment as S, jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
7
- import { AlertTriangle as T, Check as E, ChevronLeft as D, ChevronRight as O, Copy as k, Maximize as A, Minimize as j, Pause as M, Play as N, RotateCcw as P, Settings as F, Volume1 as I, Volume2 as L, VolumeX as R } from "react-feather";
8
- import { Tooltip as z } from "react-tooltip";
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
+ 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, useSyncExternalStore as h } from "react";
3
+ import { css as g, keyframes as _ } from "@emotion/react";
4
+ import { createPlayer as v, useContainerAttach as y, useMediaAttach as b } from "@videojs/react";
5
+ import { definePlayerFeature as x, videoFeatures as S } from "@videojs/core/dom";
6
+ import { Fragment as C, jsx as w, jsxs as T } from "@emotion/react/jsx-runtime";
7
+ import { AlertTriangle as E, Check as D, ChevronLeft as O, ChevronRight as k, Copy as A, Maximize as j, Minimize as M, Pause as N, Play as P, RotateCcw as F, Settings as I, Volume1 as L, Volume2 as R, VolumeX as z } from "react-feather";
8
+ import { Tooltip as B } from "react-tooltip";
9
9
  //#region src/lib/react/source-feature.ts
10
- var B = {
10
+ var V = {
11
11
  indexes: [],
12
12
  chapters: [],
13
13
  thumbnails: [],
@@ -22,26 +22,27 @@ var B = {
22
22
  setHideUI: () => {},
23
23
  hasMedia: !1,
24
24
  togglePictureInPicture: null,
25
+ passThroughPictureInPicture: null,
25
26
  pictureInPictureMode: null,
26
27
  burnedInSubtitles: !1,
27
28
  playbackError: null,
28
29
  playbackErrors: [],
29
30
  ready: !1,
30
31
  setSourceState: () => {}
31
- }, V = b({
32
+ }, H = x({
32
33
  name: "source",
33
- state: () => ({ ...B }),
34
+ state: () => ({ ...V }),
34
35
  attach({ set: e }) {
35
36
  e({
36
37
  setSourceState: (t) => e(t),
37
38
  setHideUI: (t) => e({ hideUI: t })
38
39
  });
39
40
  }
40
- }), H = _({
41
- features: [...x, V],
41
+ }), U = v({
42
+ features: [...S, H],
42
43
  displayName: "MediaPlayer"
43
- }), U = H.usePlayer, W = (e) => {
44
- if (!(!e || e === "und")) try {
44
+ }), W = U.usePlayer, ee = (e) => {
45
+ if (e && e !== "und") try {
45
46
  return new Intl.DisplayNames([navigator.language || "en"], {
46
47
  type: "language",
47
48
  fallback: "none"
@@ -50,7 +51,7 @@ var B = {
50
51
  return;
51
52
  }
52
53
  }, G = (e) => e?.replace(/_/g, " ").trim() || void 0, K = (e) => {
53
- let t = e.map((e) => W(e.language) ?? G(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
54
+ let t = e.map((e) => ee(e.language) ?? G(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
54
55
  ...e,
55
56
  [t]: (e[t] ?? 0) + 1
56
57
  }), {});
@@ -64,24 +65,24 @@ var B = {
64
65
  }, q = (e) => K(e).map(({ track: e, label: t }) => ({
65
66
  id: e.streamIndex,
66
67
  label: t
67
- })), ee = [
68
+ })), te = [
68
69
  0,
69
70
  250,
70
71
  1e3,
71
72
  3e3,
72
73
  1e4
73
- ], te = 6e4, ne = 500, re = 15e3, ie = (e) => e instanceof Error ? e.message : String(e), ae = (e) => {
74
+ ], ne = 6e4, re = 500, ie = 15e3, ae = (e) => e instanceof Error ? e.message : String(e), oe = (e) => {
74
75
  let t = [], n = e?.cause;
75
76
  for (let e = 0; n != null && e < 8; e++) {
76
77
  if (typeof MediaError < "u" && n instanceof MediaError) {
77
78
  t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
78
79
  break;
79
80
  }
80
- t.push(ie(n)), n = n?.cause;
81
+ t.push(ae(n)), n = n?.cause;
81
82
  }
82
83
  return t.length ? t.join("\n") : void 0;
83
- }, oe = (e, t, r) => {
84
- let a = U(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, chapters: b, seekPrepareBudgetMs: x = ne } = r ?? {}, S = p(b);
84
+ }, se = (e, t, r) => {
85
+ let a = W(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, chapters: b, seekPrepareBudgetMs: x = re } = r ?? {}, S = p(b);
85
86
  S.current = b;
86
87
  let [C, w] = m(void 0), [T, E] = m(0), D = p({
87
88
  count: 0,
@@ -118,7 +119,7 @@ var B = {
118
119
  a.setSourceState({ seekingTo: e });
119
120
  let c = t.videoElement, l = () => {
120
121
  c?.removeEventListener("seeked", l), clearTimeout(u), a.setSourceState({ seekingTo: void 0 });
121
- }, u = setTimeout(l, re);
122
+ }, u = setTimeout(l, ie);
122
123
  c?.addEventListener("seeked", l);
123
124
  let d = setTimeout(() => {
124
125
  o = "deadline", s();
@@ -128,7 +129,7 @@ var B = {
128
129
  });
129
130
  }, [a, x]), L = u((e) => {
130
131
  typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), w(e));
131
- }, [a]), R = U((e) => e.setSourceState);
132
+ }, [a]), R = W((e) => e.setSourceState);
132
133
  d(() => {
133
134
  R({
134
135
  selectSubtitleTrack: F,
@@ -148,7 +149,7 @@ var B = {
148
149
  ready: !1
149
150
  });
150
151
  let u = (t, n) => {
151
- let r = Date.now(), i = ie(t), o = ae(t), s = a.playbackErrors, c = s[s.length - 1];
152
+ let r = Date.now(), i = ae(t), o = oe(t), s = a.playbackErrors, c = s[s.length - 1];
152
153
  if (c && c.message === i && c.detail === o && c.recovered === n) {
153
154
  let e = {
154
155
  ...c,
@@ -173,11 +174,11 @@ var B = {
173
174
  let t = n(e);
174
175
  if (u(e, t), t) {
175
176
  let t = performance.now();
176
- t - D.current.at > te && (D.current = {
177
+ t - D.current.at > ne && (D.current = {
177
178
  count: 0,
178
179
  at: t
179
180
  });
180
- let n = ee[Math.min(D.current.count, ee.length - 1)];
181
+ let n = te[Math.min(D.current.count, te.length - 1)];
181
182
  D.current = {
182
183
  count: D.current.count + 1,
183
184
  at: t
@@ -260,13 +261,13 @@ var B = {
260
261
  y,
261
262
  T
262
263
  ]);
263
- }, se = 5e3, ce = 6e4, le = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
264
+ }, ce = 5e3, le = 6e4, ue = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
264
265
  let [o, s] = m([]), c = p(null), l = p(i);
265
266
  l.current = i;
266
267
  let h = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = p(h);
267
268
  return g.current = h, d(() => {
268
269
  if (!n || !i || !e || !t) return;
269
- let a = !1, o = null, u, d = se, f = () => {
270
+ let a = !1, o = null, u, d = ce, f = () => {
270
271
  r({
271
272
  publicPath: e,
272
273
  workerUrl: t,
@@ -282,7 +283,7 @@ var B = {
282
283
  }
283
284
  o = e, c.current = e, e.update(g.current);
284
285
  }, () => {
285
- a || (u = setTimeout(f, d), d = Math.min(d * 2, ce));
286
+ a || (u = setTimeout(f, d), d = Math.min(d * 2, le));
286
287
  });
287
288
  };
288
289
  return f(), () => {
@@ -300,7 +301,7 @@ var B = {
300
301
  c.current?.prioritize(e);
301
302
  }, [])
302
303
  };
303
- }, ue = (e, n) => {
304
+ }, de = (e, n) => {
304
305
  let r = p(null), [i, o] = m(!1), [s] = m(() => t());
305
306
  d(() => {
306
307
  if (!e || !n || !s) return;
@@ -328,6 +329,73 @@ var B = {
328
329
  mode: s,
329
330
  burnedIn: i
330
331
  };
332
+ }, fe = "(hover: hover) and (pointer: fine)", pe = () => typeof matchMedia == "function" ? matchMedia(fe) : void 0, me = (e) => {
333
+ let t = pe();
334
+ return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
335
+ }, he = () => !!pe()?.matches, ge = () => !1, _e = (e, t) => {
336
+ let [n, r] = m(!1), [i, a] = m(), o = p(t);
337
+ t && (o.current = t);
338
+ let s = p(!1), c = u((e) => {
339
+ s.current !== e && (s.current = e, o.current?.onArmedChange(e));
340
+ }, []), l = u((t) => {
341
+ !e || e.readyState < 1 || e.error || (a(t), c(!0));
342
+ }, [e, c]), g = u(() => {
343
+ a(void 0), c(!1);
344
+ }, [c]), _ = !!t && !!e;
345
+ d(() => {
346
+ if (!_ || !e) return;
347
+ let t = () => {
348
+ r(!0), g();
349
+ }, n = () => r(!1);
350
+ return e.addEventListener("enterpictureinpicture", t), e.addEventListener("leavepictureinpicture", n), () => {
351
+ e.removeEventListener("enterpictureinpicture", t), e.removeEventListener("leavepictureinpicture", n), r(!1), g();
352
+ };
353
+ }, [
354
+ e,
355
+ _,
356
+ g
357
+ ]);
358
+ let v = h(me, he, ge), [y, b] = m(!1);
359
+ d(() => {
360
+ if (!_) return;
361
+ let e = (e) => {
362
+ e.pointerType === "touch" && b(!0);
363
+ }, t = (e) => {
364
+ e.pointerType !== "touch" && b(!1);
365
+ };
366
+ return window.addEventListener("pointerdown", e, {
367
+ capture: !0,
368
+ passive: !0
369
+ }), window.addEventListener("pointermove", t, {
370
+ capture: !0,
371
+ passive: !0
372
+ }), () => {
373
+ window.removeEventListener("pointerdown", e, { capture: !0 }), window.removeEventListener("pointermove", t, { capture: !0 });
374
+ };
375
+ }, [_]);
376
+ let x = _ && v && !y;
377
+ d(() => {
378
+ x || g();
379
+ }, [x, g]);
380
+ let S = u(() => {
381
+ Promise.resolve(e?.exitPictureInPicture?.()).catch((e) => {
382
+ console.warn("leaving picture in picture was refused", e);
383
+ });
384
+ }, [e]);
385
+ return f(() => x ? {
386
+ active: n,
387
+ armed: i,
388
+ arm: l,
389
+ disarm: g,
390
+ exit: S
391
+ } : null, [
392
+ x,
393
+ n,
394
+ i,
395
+ l,
396
+ g,
397
+ S
398
+ ]);
331
399
  }, J = {
332
400
  headings: {
333
401
  large: "\n font-weight: 600;\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(3.4 * var(--mp-unit));\n line-height: calc(4.1 * var(--mp-unit));\n }\n ",
@@ -355,7 +423,7 @@ var B = {
355
423
  medium: "\n font-weight: 500;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n ",
356
424
  regular: "\n font-weight: 400;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n "
357
425
  }
358
- }, de = h`
426
+ }, ve = g`
359
427
  display: flex;
360
428
  justify-content: center;
361
429
  align-items: center;
@@ -368,7 +436,7 @@ var B = {
368
436
  margin: auto;
369
437
  pointer-events: none;
370
438
  }
371
- `, fe = h`
439
+ `, ye = g`
372
440
  position: absolute;
373
441
  top: 0;
374
442
  left: 0;
@@ -397,7 +465,9 @@ var B = {
397
465
 
398
466
  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
467
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
400
- `, pe = h`
468
+ `, be = _`
469
+ to { transform: rotate(360deg); }
470
+ `, xe = g`
401
471
  position: absolute;
402
472
  inset: 0;
403
473
  z-index: 2;
@@ -413,11 +483,9 @@ var B = {
413
483
  border-radius: 50%;
414
484
  border: 3px solid rgba(255, 255, 255, 0.25);
415
485
  border-top-color: #fff;
416
- animation: ${g`
417
- to { transform: rotate(360deg); }
418
- `} 0.8s linear infinite;
486
+ animation: ${be} 0.8s linear infinite;
419
487
  }
420
- `, me = h`
488
+ `, Se = g`
421
489
  position: absolute;
422
490
  inset: auto 0 20%;
423
491
  z-index: 3;
@@ -427,34 +495,34 @@ var B = {
427
495
  ${J.bLarge.regular}
428
496
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
429
497
  pointer-events: none;
430
- `, he = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", ge = ({ onSubtitleRef: e }) => {
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
- return /* @__PURE__ */ w(S, { children: [
433
- t ? /* @__PURE__ */ C("div", {
498
+ `, Ce = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", we = ({ onSubtitleRef: e }) => {
499
+ let t = W((e) => e.title), n = W((e) => e.hideUI), r = W((e) => e.playbackError), i = W((e) => e.ready), a = W((e) => e.size), o = W((e) => e.waiting), s = W((e) => e.seekingTo);
500
+ return /* @__PURE__ */ T(C, { children: [
501
+ t ? /* @__PURE__ */ w("div", {
434
502
  className: "title",
435
- css: fe,
503
+ css: ye,
436
504
  style: { ...n ? {
437
505
  opacity: "0",
438
506
  pointerEvents: "none"
439
507
  } : {} },
440
508
  children: t
441
509
  }) : void 0,
442
- ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ C("div", { css: pe }) : void 0,
443
- r ? /* @__PURE__ */ C("div", {
444
- css: me,
445
- children: he(r)
510
+ ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ w("div", { css: xe }) : void 0,
511
+ r ? /* @__PURE__ */ w("div", {
512
+ css: Se,
513
+ children: Ce(r)
446
514
  }) : void 0,
447
- /* @__PURE__ */ C("div", {
515
+ /* @__PURE__ */ w("div", {
448
516
  className: "subtitles",
449
517
  ref: e,
450
- css: de
518
+ css: ve
451
519
  })
452
520
  ] });
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) => {
521
+ }, Te = 1e-4, Ee = 1, De = (e) => Math.max(Te, Math.min(Ee, e)) ** 2, Oe = (e) => Math.max(Te, Math.min(Ee, e)) ** (Ee / 2), Y = (e) => {
454
522
  if (e === void 0) return "0:00";
455
523
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
456
524
  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`
525
+ }, ke = (e, t) => `${Y(e)} / ${Y(t)}`, Ae = (e) => g`
458
526
  display: flex;
459
527
  justify-content: flex-start;
460
528
 
@@ -489,30 +557,30 @@ var B = {
489
557
  ${J.bMedium.regular}
490
558
  }
491
559
 
492
- ${e === "sm" && h`
560
+ ${e === "sm" && g`
493
561
  padding: calc(0.4 * var(--mp-unit))!important;
494
562
  `}
495
- ${e === "md" && h`
563
+ ${e === "md" && g`
496
564
  padding: calc(0.6 * var(--mp-unit))!important;
497
565
  `}
498
- ${e === "lg" && h`
566
+ ${e === "lg" && g`
499
567
  padding: calc(1.2 * var(--mp-unit))!important;
500
568
  `}
501
569
  `, X = {
502
570
  x: -1,
503
571
  y: -1,
504
572
  anchors: 0
505
- }, Ce = (e) => {
573
+ }, je = (e) => {
506
574
  X.x = e.clientX, X.y = e.clientY;
507
- }, we = () => (X.anchors++ === 0 && window.addEventListener("pointermove", Ce, {
575
+ }, Me = () => (X.anchors++ === 0 && window.addEventListener("pointermove", je, {
508
576
  capture: !0,
509
577
  passive: !0
510
578
  }), () => {
511
- --X.anchors === 0 && window.removeEventListener("pointermove", Ce, { capture: !0 });
579
+ --X.anchors === 0 && window.removeEventListener("pointermove", je, { capture: !0 });
512
580
  }), 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
581
  let l = p(null), u = p(null);
514
582
  return d(() => {
515
- let e = we(), t = () => {
583
+ let e = Me(), t = () => {
516
584
  let e = l.current;
517
585
  if (!e) return;
518
586
  let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
@@ -523,7 +591,7 @@ var B = {
523
591
  e();
524
592
  for (let e of n) document.removeEventListener(e, t);
525
593
  };
526
- }, []), /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
594
+ }, []), /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
527
595
  ref: l,
528
596
  "data-tooltip-id": e,
529
597
  "data-open": !0,
@@ -532,14 +600,14 @@ var B = {
532
600
  "data-tooltip-delay-hide": i,
533
601
  "data-tooltip-place": o,
534
602
  children: n
535
- }), !s && /* @__PURE__ */ C(z, {
603
+ }), !s && /* @__PURE__ */ w(B, {
536
604
  ref: u,
537
- css: Se(c),
605
+ css: Ae(c),
538
606
  id: e,
539
607
  noArrow: !0,
540
608
  children: t
541
609
  })] });
542
- }, Te = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
610
+ }, Ne = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
543
611
  let [i, a] = m(!1), o = p(t);
544
612
  o.current = t;
545
613
  let s = p(null), c = u((t, r) => {
@@ -578,26 +646,26 @@ var B = {
578
646
  style: { touchAction: "none" }
579
647
  }
580
648
  };
581
- }, Ee = 2, De = .005, Oe = "#000", ke = "#0000", Ae = (e, t) => {
649
+ }, Pe = 2, Fe = .005, Ie = "#000", Le = "#0000", Re = (e, t) => {
582
650
  if (!t) return [];
583
651
  let n = /* @__PURE__ */ new Set();
584
652
  for (let { start: r, end: i } of e) for (let e of [r, i]) {
585
653
  let r = e / t;
586
- r <= De || r >= 1 - De || n.add(Number((r * 100).toFixed(4)));
654
+ r <= Fe || r >= .995 || n.add(Number((r * 100).toFixed(4)));
587
655
  }
588
656
  return n.size ? [
589
657
  0,
590
658
  ...[...n].sort((e, t) => e - t),
591
659
  100
592
660
  ] : [];
593
- }, je = (e, t) => {
594
- let n = Ee / 2, r = e.length - 2, i = [];
661
+ }, ze = (e, t) => {
662
+ let n = Pe / 2, r = e.length - 2, i = [];
595
663
  for (let a = 0; a <= r; a += 1) {
596
664
  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)`);
665
+ i.push(`${t(a) ? Ie : Le} ${c} ${l}`), a !== r && i.push(`${Le} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
598
666
  }
599
667
  return `linear-gradient(90deg, ${i.join(", ")})`;
600
- }, Me = /* @__PURE__ */ new Set([
668
+ }, Be = /* @__PURE__ */ new Set([
601
669
  "op",
602
670
  "ops",
603
671
  "opening",
@@ -605,7 +673,7 @@ var B = {
605
673
  "ncop",
606
674
  "オープニング",
607
675
  "op主題歌"
608
- ]), Ne = /* @__PURE__ */ new Set([
676
+ ]), Ve = /* @__PURE__ */ new Set([
609
677
  "ed",
610
678
  "eds",
611
679
  "ending",
@@ -618,13 +686,13 @@ var B = {
618
686
  "エンドカード",
619
687
  "エンドロール",
620
688
  "ed主題歌"
621
- ]), Pe = /* @__PURE__ */ new Set(["intro", "イントロ"]), Fe = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Ie = {
689
+ ]), He = /* @__PURE__ */ new Set(["intro", "イントロ"]), Ue = /* @__PURE__ */ new Set(["outro", "アウトロ"]), We = {
622
690
  "credits start": "ending",
623
691
  "credits end": null,
624
692
  "preview end": null,
625
693
  "end credits": "ending",
626
694
  "closing credits": "ending"
627
- }, Le = /* @__PURE__ */ new Set([
695
+ }, Ge = /* @__PURE__ */ new Set([
628
696
  "theme",
629
697
  "themes",
630
698
  "song",
@@ -643,53 +711,53 @@ var B = {
643
711
  "the",
644
712
  "主題歌",
645
713
  "ノンクレジット"
646
- ]), Re = /* @__PURE__ */ new Set([
714
+ ]), Ke = /* @__PURE__ */ new Set([
647
715
  "post",
648
716
  "pre",
649
717
  "after",
650
718
  "before",
651
719
  "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";
720
+ ]), qe = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, Je = (e) => /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), Ye = (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) && !Ge.has(e)), Xe = (e, t) => {
721
+ if (Be.has(e)) return "opening";
722
+ if (Ve.has(e)) return "ending";
655
723
  if (t) {
656
- if (Pe.has(e)) return "opening";
657
- if (Fe.has(e)) return "ending";
724
+ if (He.has(e)) return "opening";
725
+ if (Ue.has(e)) return "ending";
658
726
  }
659
- }, Ue = (e, t) => {
660
- if (Be(e)) return;
727
+ }, Ze = (e, t) => {
728
+ if (Je(e)) return;
661
729
  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;
730
+ if (n in We) return We[n] ?? void 0;
731
+ let r = n.split(qe).map((e) => e.trim()).filter(Boolean);
732
+ if (r.some((e) => e.split(/[\s_]+/u).some((e) => Ke.has(e)))) return;
665
733
  let i = r.length > 1 ? [r[0], r.at(-1)] : r;
666
734
  for (let e of i) {
667
- let n = Ve(e);
735
+ let n = Ye(e);
668
736
  if (n.length !== 1) continue;
669
- let r = He(n[0], t);
737
+ let r = Xe(n[0], t);
670
738
  if (r) return r;
671
739
  }
672
- }, We = 15, Ge = 87, Ke = 93, qe = (e) => {
740
+ }, Qe = 15, $e = 87, et = 93, tt = (e) => {
673
741
  let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
674
742
  if (!n) return t;
675
743
  let r = e.map((e, t) => ({
676
744
  index: t,
677
745
  start: e.start,
678
746
  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);
747
+ })).filter(({ length: e }) => e >= $e && e <= et), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
680
748
  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);
749
+ }, nt = (e) => {
750
+ let t = e.map(({ title: e }) => Ze(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
751
  if (r > 0 && n * 2 > r) return e.map(() => void 0);
684
752
  let i = e.map((e, n) => {
685
- if (e.end - e.start < We) return;
753
+ if (e.end - e.start < Qe) return;
686
754
  let r = t[n];
687
755
  if (r) return r;
688
- let i = Ue(e.title, !0);
756
+ let i = Ze(e.title, !0);
689
757
  return i && !t.includes(i) ? i : void 0;
690
758
  });
691
- return i.some(Boolean) ? i : qe(e);
692
- }, Ye = h`
759
+ return i.some(Boolean) ? i : tt(e);
760
+ }, rt = g`
693
761
  position: relative;
694
762
  height: calc(.4 * var(--mp-unit));
695
763
 
@@ -908,160 +976,163 @@ var B = {
908
976
  --thumbnail-width: calc(18 * var(--mp-unit));
909
977
  --thumbnail-half: calc(9 * var(--mp-unit));
910
978
  }
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,
979
+ `, it = 4, at = () => {
980
+ let e = W(), t = W((e) => e.currentTime), n = W((e) => e.requestSeek), r = W((e) => e.duration), i = W((e) => e.size), a = W((e) => e.downloadedRanges), o = W((e) => e.buffered), s = W((e) => e.indexes), c = W((e) => e.thumbnails), l = W((e) => e.thumbnailAt), u = W((e) => e.requestThumbnail), h = W((e) => e.chapters), g = W((e) => e.seekingTo), _ = p(null), [v, y] = m(void 0), [b, x] = m(void 0), S = (e) => {
981
+ x(e), u(e);
982
+ }, C = p(void 0), E = p(0), D = p(void 0), O = p(void 0), k = p(!1), { dragging: A, handlers: j } = Ne({
983
+ ref: _,
916
984
  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);
985
+ if (E.current += 1, D.current = e, O.current === void 0) O.current = e;
986
+ else if (!k.current) {
987
+ let t = _.current?.getBoundingClientRect().width ?? 0;
988
+ Math.abs(e - O.current) * t > it && (k.current = !0);
921
989
  }
922
- v(e), S.current !== "mouse" && x(e * r);
990
+ y(e), C.current !== "mouse" && S(e * r);
923
991
  }
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;
992
+ }), M = (e) => {
993
+ C.current = e.pointerType, E.current = 0, O.current = void 0, k.current = !1, j.onPointerDown(e);
994
+ }, N = (t) => {
995
+ j.onPointerUp(t);
996
+ let i = E.current > 0 ? D.current : void 0;
929
997
  if (i !== void 0 && r) {
930
998
  let t = i * r;
931
999
  n ? n(t) : e.seek(t);
932
1000
  }
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;
1001
+ E.current = 0, k.current = !1, O.current = void 0, t.pointerType !== "mouse" && S(void 0);
938
1002
  }, 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;
947
- return /* @__PURE__ */ C("div", {
1003
+ if (!_.current) return;
1004
+ let { left: t, right: n } = _.current.getBoundingClientRect();
1005
+ return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
1006
+ }, F = (e) => {
1007
+ S(P(e.clientX));
1008
+ }, I = () => {
1009
+ _.current && S(void 0);
1010
+ }, L = (e) => r ? e / r * 100 : 0, R = (e, t, n) => {
1011
+ let r = Number((n - t).toFixed(4)), i = t * 100;
1012
+ return /* @__PURE__ */ w("div", {
948
1013
  className: "loaded-part",
949
1014
  style: {
950
- transform: `scaleX(${u})`,
951
- marginLeft: `${d}%`
1015
+ transform: `scaleX(${r})`,
1016
+ marginLeft: `${i}%`
952
1017
  }
953
- }, t);
1018
+ }, e);
1019
+ }, z = f(() => i === void 0 ? r ? o.map(([e, t], n) => R(n, e / r, t / r)) : [] : a?.map((e, t) => {
1020
+ if (!i || !r) return null;
1021
+ let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
1022
+ return !a || !o ? null : R(t, a.timestamp / r, o.timestamp / r);
954
1023
  }) ?? [], [
955
1024
  r,
956
- o.length,
1025
+ i,
1026
+ i === void 0 ? o : void 0,
1027
+ s.length,
957
1028
  a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
958
1029
  ]);
959
1030
  d(() => {
960
- _ === void 0 || !r || !k || !O.current || e.seek(_ * r);
1031
+ v !== void 0 && r && A && k.current && e.seek(v * r);
961
1032
  }, [
962
1033
  e,
963
- k,
964
- _,
1034
+ A,
1035
+ v,
965
1036
  r
966
1037
  ]);
967
- let R = f(() => {
1038
+ let B = f(() => {
968
1039
  if (!r) return 0;
969
- if (k && _ !== void 0) return _;
970
- let e = h ?? t;
1040
+ if (A && v !== void 0) return v;
1041
+ let e = g ?? t;
971
1042
  return typeof e == "number" ? e / r : 0;
972
1043
  }, [
973
1044
  r,
974
1045
  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;
1046
+ A,
1047
+ v,
1048
+ g
1049
+ ]), V = f(() => Re(h, r), [h, r]), H = V.length > 0, U = f(() => {
1050
+ if (!H || b === void 0 || !r) return -1;
1051
+ let e = b / r * 100, t = V.findIndex((t, n) => n < V.length - 1 && e >= t && e < V[n + 1]);
1052
+ return t >= 0 ? t : V.length - 2;
982
1053
  }, [
983
- B,
984
- z,
985
- y,
1054
+ H,
1055
+ V,
1056
+ b,
986
1057
  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);
1058
+ ]), ee = f(() => H ? ze(V, (e) => e !== U) : void 0, [
1059
+ H,
1060
+ V,
1061
+ U
1062
+ ]), G = f(() => U >= 0 ? ze(V, (e) => e === U) : void 0, [V, U]), K = f(() => {
1063
+ if (b !== void 0) return h.find(({ start: e, end: t }) => e <= b && b < t);
1064
+ }, [h, b]), q = f(() => {
1065
+ if (b) {
1066
+ if (l) return l(b);
1067
+ if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
997
1068
  }
998
1069
  }, [
999
- s,
1000
1070
  c,
1001
- y
1002
- ]), q = (e, t) => /* @__PURE__ */ w("div", {
1071
+ l,
1072
+ b
1073
+ ]), te = (e, t) => /* @__PURE__ */ T("div", {
1003
1074
  className: e ? `track ${e}` : "track",
1004
1075
  style: t ? { maskImage: t } : void 0,
1005
1076
  children: [
1006
- /* @__PURE__ */ C("div", { className: "background-bar" }),
1007
- /* @__PURE__ */ C("div", {
1077
+ /* @__PURE__ */ w("div", { className: "background-bar" }),
1078
+ /* @__PURE__ */ w("div", {
1008
1079
  className: "loaded",
1009
- children: L
1080
+ children: z
1010
1081
  }),
1011
- /* @__PURE__ */ C("div", {
1082
+ /* @__PURE__ */ w("div", {
1012
1083
  className: "play-container",
1013
- children: /* @__PURE__ */ C("div", {
1084
+ children: /* @__PURE__ */ w("div", {
1014
1085
  className: "play",
1015
- style: { transform: `scaleX(${R})` }
1086
+ style: { transform: `scaleX(${B})` }
1016
1087
  })
1017
1088
  })
1018
1089
  ]
1019
1090
  });
1020
- return /* @__PURE__ */ w("div", {
1021
- css: Ye,
1022
- ref: g,
1091
+ return /* @__PURE__ */ T("div", {
1092
+ css: rt,
1093
+ ref: _,
1023
1094
  className: [
1024
1095
  "progress-bar",
1025
- k ? "dragging" : "",
1026
- B ? "segmented" : ""
1096
+ A ? "dragging" : "",
1097
+ H ? "segmented" : ""
1027
1098
  ].filter(Boolean).join(" "),
1028
- onMouseMove: P,
1029
- onMouseOut: F,
1099
+ onMouseMove: F,
1100
+ onMouseOut: I,
1030
1101
  children: [
1031
- q(void 0, H),
1032
- y ? /* @__PURE__ */ w("div", {
1102
+ te(void 0, ee),
1103
+ b ? /* @__PURE__ */ T("div", {
1033
1104
  className: "cursor-time",
1034
1105
  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
1106
+ 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))))`,
1107
+ maxWidth: K ? "var(--thumbnail-width)" : void 0
1037
1108
  },
1038
- children: [/* @__PURE__ */ C("span", {
1109
+ children: [/* @__PURE__ */ w("span", {
1039
1110
  className: "cursor-time-value",
1040
- children: Y(y)
1041
- }), G ? /* @__PURE__ */ C("span", {
1111
+ children: Y(b)
1112
+ }), K ? /* @__PURE__ */ w("span", {
1042
1113
  className: "chapter-title",
1043
- children: G.title
1114
+ children: K.title
1044
1115
  }) : void 0]
1045
1116
  }) : void 0,
1046
- /* @__PURE__ */ C("div", { className: "progress" }),
1047
- /* @__PURE__ */ C("div", { className: "hover" }),
1048
- W ? q("focus", W) : void 0,
1049
- /* @__PURE__ */ C("div", { className: "scrubber" }),
1050
- /* @__PURE__ */ C("div", {
1117
+ /* @__PURE__ */ w("div", { className: "progress" }),
1118
+ /* @__PURE__ */ w("div", { className: "hover" }),
1119
+ G ? te("focus", G) : void 0,
1120
+ /* @__PURE__ */ w("div", { className: "scrubber" }),
1121
+ /* @__PURE__ */ w("div", {
1051
1122
  className: "padding",
1052
- ...A,
1053
- onPointerDown: j,
1054
- onPointerUp: M,
1055
- onPointerCancel: M
1123
+ ...j,
1124
+ onPointerDown: M,
1125
+ onPointerUp: N,
1126
+ onPointerCancel: N
1056
1127
  }),
1057
- /* @__PURE__ */ C("div", {
1128
+ /* @__PURE__ */ w("div", {
1058
1129
  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
1130
+ style: { left: `clamp(var(--thumbnail-half), ${L(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1131
+ children: q?.url ? /* @__PURE__ */ w("img", { src: q.url }) : void 0
1061
1132
  })
1062
1133
  ]
1063
1134
  });
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 = {
1135
+ }, ot = "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
1136
  xmlns: "http://www.w3.org/2000/svg",
1066
1137
  width: 24,
1067
1138
  height: 24,
@@ -1071,22 +1142,22 @@ var B = {
1071
1142
  strokeWidth: 2,
1072
1143
  strokeLinecap: "round",
1073
1144
  strokeLinejoin: "round"
1074
- }, $e = (e) => /* @__PURE__ */ w("svg", {
1145
+ }, st = (e) => /* @__PURE__ */ T("svg", {
1075
1146
  ...Q,
1076
1147
  ...e,
1077
- children: [/* @__PURE__ */ C("rect", {
1148
+ children: [/* @__PURE__ */ w("rect", {
1078
1149
  x: "3",
1079
1150
  y: "5",
1080
1151
  width: "18",
1081
1152
  height: "14",
1082
1153
  rx: "2",
1083
1154
  ry: "2"
1084
- }), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1085
- }), et = (e) => /* @__PURE__ */ w("svg", {
1155
+ }), /* @__PURE__ */ w("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1156
+ }), ct = (e) => /* @__PURE__ */ T("svg", {
1086
1157
  ...Q,
1087
1158
  ...e,
1088
1159
  children: [
1089
- /* @__PURE__ */ C("rect", {
1160
+ /* @__PURE__ */ w("rect", {
1090
1161
  x: "3",
1091
1162
  y: "5",
1092
1163
  width: "18",
@@ -1094,20 +1165,20 @@ var B = {
1094
1165
  rx: "2",
1095
1166
  ry: "2"
1096
1167
  }),
1097
- /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
1098
- /* @__PURE__ */ C("line", {
1168
+ /* @__PURE__ */ w("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
1169
+ /* @__PURE__ */ w("line", {
1099
1170
  x1: "2",
1100
1171
  y1: "2",
1101
1172
  x2: "22",
1102
1173
  y2: "22"
1103
1174
  })
1104
1175
  ]
1105
- }), tt = (e) => /* @__PURE__ */ w("svg", {
1176
+ }), lt = (e) => /* @__PURE__ */ T("svg", {
1106
1177
  ...Q,
1107
1178
  ...e,
1108
1179
  children: [
1109
- /* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1110
- /* @__PURE__ */ C("rect", {
1180
+ /* @__PURE__ */ w("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1181
+ /* @__PURE__ */ w("rect", {
1111
1182
  x: "12",
1112
1183
  y: "13",
1113
1184
  width: "10",
@@ -1115,14 +1186,14 @@ var B = {
1115
1186
  rx: "1",
1116
1187
  ry: "1"
1117
1188
  }),
1118
- /* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
1189
+ /* @__PURE__ */ w("path", { d: "M14.5 18.5h2m2 0h1" })
1119
1190
  ]
1120
- }), nt = (e) => /* @__PURE__ */ w("svg", {
1191
+ }), ut = (e) => /* @__PURE__ */ T("svg", {
1121
1192
  ...Q,
1122
1193
  ...e,
1123
1194
  children: [
1124
- /* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1125
- /* @__PURE__ */ C("rect", {
1195
+ /* @__PURE__ */ w("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1196
+ /* @__PURE__ */ w("rect", {
1126
1197
  x: "12",
1127
1198
  y: "13",
1128
1199
  width: "10",
@@ -1130,9 +1201,9 @@ var B = {
1130
1201
  rx: "1",
1131
1202
  ry: "1"
1132
1203
  }),
1133
- /* @__PURE__ */ C("path", { d: "M6 9h3m2 0h2" })
1204
+ /* @__PURE__ */ w("path", { d: "M6 9h3m2 0h2" })
1134
1205
  ]
1135
- }), rt = h`
1206
+ }), dt = g`
1136
1207
  .popover {
1137
1208
  position: absolute;
1138
1209
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -1259,26 +1330,26 @@ var B = {
1259
1330
  ${J.bSmall.regular}
1260
1331
  }
1261
1332
  }
1262
- `, it = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1333
+ `, ft = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1263
1334
  let c = o !== void 0, l = (e, i, a) => {
1264
1335
  let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
1265
- return /* @__PURE__ */ w("div", {
1336
+ return /* @__PURE__ */ T("div", {
1266
1337
  onClick: () => {
1267
1338
  l || r(e ?? void 0);
1268
1339
  },
1269
1340
  className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
1270
- children: [/* @__PURE__ */ C("span", { children: i }), /* @__PURE__ */ C("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
1341
+ children: [/* @__PURE__ */ w("span", { children: i }), /* @__PURE__ */ w("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
1271
1342
  }, e ?? "__off__");
1272
1343
  };
1273
- return /* @__PURE__ */ w("div", {
1344
+ return /* @__PURE__ */ T("div", {
1274
1345
  className: "popover track-list",
1275
1346
  children: [
1276
- /* @__PURE__ */ w("div", {
1347
+ /* @__PURE__ */ T("div", {
1277
1348
  className: i ? "back" : "back no-hover",
1278
1349
  onClick: i,
1279
- children: [i ? /* @__PURE__ */ C(D, {}) : null, /* @__PURE__ */ C("span", { children: e })]
1350
+ children: [i ? /* @__PURE__ */ w(O, {}) : null, /* @__PURE__ */ w("span", { children: e })]
1280
1351
  }),
1281
- s ? /* @__PURE__ */ C("div", {
1352
+ s ? /* @__PURE__ */ w("div", {
1282
1353
  className: "no-hover failed",
1283
1354
  children: "Could not switch. Try again."
1284
1355
  }) : null,
@@ -1286,7 +1357,7 @@ var B = {
1286
1357
  t.map(({ id: e, label: t }) => l(e, t, "description"))
1287
1358
  ]
1288
1359
  });
1289
- }, at = ({ onReset: e } = {}) => {
1360
+ }, pt = ({ onReset: e } = {}) => {
1290
1361
  let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
1291
1362
  c.current = e;
1292
1363
  let l = () => {
@@ -1327,7 +1398,7 @@ var B = {
1327
1398
  });
1328
1399
  }
1329
1400
  };
1330
- }, ot = h`
1401
+ }, mt = g`
1331
1402
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1332
1403
  which is the width of the player box, so it can be clamped to it. */
1333
1404
  position: static;
@@ -1343,7 +1414,7 @@ position: static;
1343
1414
  }
1344
1415
  }
1345
1416
 
1346
- ${rt}
1417
+ ${dt}
1347
1418
 
1348
1419
  .popover.error-list {
1349
1420
  /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
@@ -1415,68 +1486,68 @@ ${rt}
1415
1486
  }
1416
1487
  }
1417
1488
  }
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();
1489
+ `, ht = (e) => new Date(e).toLocaleTimeString(), gt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Y(Math.max(0, e)), _t = (e) => e.reduce((e, t) => e + t.count, 0), vt = (e) => e.map((e, t) => {
1490
+ let n = gt(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
1491
  return [
1421
1492
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
1422
1493
  e.message,
1423
1494
  e.detail
1424
1495
  ].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);
1496
+ }).join("\n\n"), yt = () => {
1497
+ let e = W((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = pt(), [i, a] = m(!1);
1427
1498
  if (e.length === 0) return null;
1428
1499
  let o = () => {
1429
- navigator.clipboard?.writeText(ut(e)).then(() => {
1500
+ navigator.clipboard?.writeText(vt(e)).then(() => {
1430
1501
  a(!0), setTimeout(() => a(!1), 2e3);
1431
1502
  }, (e) => console.warn("[media-player] could not copy the errors:", e));
1432
- }, s = `Playback errors (${lt(e)})`;
1433
- return /* @__PURE__ */ w("div", {
1434
- css: ot,
1503
+ }, s = `Playback errors (${_t(e)})`;
1504
+ return /* @__PURE__ */ T("div", {
1505
+ css: mt,
1435
1506
  ref: r,
1436
- children: [/* @__PURE__ */ C(Z, {
1507
+ children: [/* @__PURE__ */ w(Z, {
1437
1508
  id: "errors",
1438
1509
  disabled: t,
1439
- text: /* @__PURE__ */ C("button", {
1510
+ text: /* @__PURE__ */ w("button", {
1440
1511
  className: "errors",
1441
1512
  type: "button",
1442
1513
  onClick: n,
1443
1514
  "aria-label": s,
1444
1515
  "aria-expanded": t,
1445
- children: /* @__PURE__ */ C(T, { className: "alert-triangle" })
1516
+ children: /* @__PURE__ */ w(E, { className: "alert-triangle" })
1446
1517
  }),
1447
- toolTipText: /* @__PURE__ */ C("span", { children: s })
1448
- }), t && /* @__PURE__ */ w("div", {
1518
+ toolTipText: /* @__PURE__ */ w("span", { children: s })
1519
+ }), t && /* @__PURE__ */ T("div", {
1449
1520
  className: "popover error-list",
1450
- children: [/* @__PURE__ */ w("div", {
1521
+ children: [/* @__PURE__ */ T("div", {
1451
1522
  className: "back no-hover",
1452
- children: [/* @__PURE__ */ C("span", { children: s }), /* @__PURE__ */ w("button", {
1523
+ children: [/* @__PURE__ */ w("span", { children: s }), /* @__PURE__ */ T("button", {
1453
1524
  className: "copy",
1454
1525
  type: "button",
1455
1526
  onClick: o,
1456
1527
  "aria-label": "Copy the errors",
1457
- children: [C(i ? E : k, {}), /* @__PURE__ */ C("span", { children: i ? "Copied" : "Copy" })]
1528
+ children: [w(i ? D : A, {}), /* @__PURE__ */ w("span", { children: i ? "Copied" : "Copy" })]
1458
1529
  })]
1459
- }), e.map((e, t) => /* @__PURE__ */ w("div", {
1530
+ }), e.map((e, t) => /* @__PURE__ */ T("div", {
1460
1531
  className: "entry no-hover",
1461
1532
  children: [
1462
- /* @__PURE__ */ w("span", {
1533
+ /* @__PURE__ */ T("span", {
1463
1534
  className: "when",
1464
1535
  children: [
1465
- st(e.at),
1466
- e.count > 1 ? ` to ${st(e.lastAt)}` : "",
1467
- ct(e.atMediaTime) ? ` at ${ct(e.atMediaTime)}` : "",
1536
+ ht(e.at),
1537
+ e.count > 1 ? ` to ${ht(e.lastAt)}` : "",
1538
+ gt(e.atMediaTime) ? ` at ${gt(e.atMediaTime)}` : "",
1468
1539
  e.recovered ? " recovered" : "",
1469
- e.count > 1 ? /* @__PURE__ */ C("span", {
1540
+ e.count > 1 ? /* @__PURE__ */ w("span", {
1470
1541
  className: "count",
1471
1542
  children: `×${e.count}`
1472
1543
  }) : null
1473
1544
  ]
1474
1545
  }),
1475
- /* @__PURE__ */ C("span", {
1546
+ /* @__PURE__ */ w("span", {
1476
1547
  className: "what",
1477
1548
  children: e.message
1478
1549
  }),
1479
- e.detail ? /* @__PURE__ */ C("span", {
1550
+ e.detail ? /* @__PURE__ */ w("span", {
1480
1551
  className: "cause",
1481
1552
  children: e.detail
1482
1553
  }) : null
@@ -1484,7 +1555,7 @@ ${rt}
1484
1555
  }, `${e.at}-${t}`))]
1485
1556
  })]
1486
1557
  });
1487
- }, ft = h`
1558
+ }, bt = g`
1488
1559
  display: flex;
1489
1560
  align-items: center;
1490
1561
  justify-content: center;
@@ -1537,8 +1608,8 @@ width: 100%;
1537
1608
  }
1538
1609
  }
1539
1610
  }
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({
1611
+ `, xt = () => {
1612
+ let e = W(), t = W((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 } = Ne({
1542
1613
  ref: r,
1543
1614
  onChange: (t) => e.setPlaybackRate(l(t))
1544
1615
  }), f = (t) => {
@@ -1553,26 +1624,26 @@ width: 100%;
1553
1624
  };
1554
1625
  }, [t]);
1555
1626
  let m = c(s);
1556
- return /* @__PURE__ */ w("div", {
1557
- css: ft,
1558
- children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
1627
+ return /* @__PURE__ */ T("div", {
1628
+ css: bt,
1629
+ children: [/* @__PURE__ */ T("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ w("div", {
1559
1630
  className: "playback-slider",
1560
1631
  ref: n,
1561
1632
  ...u,
1562
- children: /* @__PURE__ */ C("div", {
1633
+ children: /* @__PURE__ */ w("div", {
1563
1634
  ref: r,
1564
1635
  style: { background: `linear-gradient(to right,
1565
1636
  #fff 0% ${m}%,
1566
1637
  #3A3A3A ${m}% 100%
1567
1638
  )` },
1568
- children: /* @__PURE__ */ C("div", {
1639
+ children: /* @__PURE__ */ w("div", {
1569
1640
  className: "playback-handle",
1570
1641
  style: { left: `${m}%` }
1571
1642
  })
1572
1643
  })
1573
1644
  })]
1574
1645
  });
1575
- }, mt = h`
1646
+ }, St = g`
1576
1647
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
1577
1648
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
1578
1649
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -1590,7 +1661,7 @@ position: static;
1590
1661
  }
1591
1662
  }
1592
1663
 
1593
- ${rt}
1664
+ ${dt}
1594
1665
 
1595
1666
  .playback-rate {
1596
1667
  .slider {
@@ -1631,72 +1702,72 @@ ${rt}
1631
1702
  }
1632
1703
  }
1633
1704
 
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) => {
1705
+ `, Ct = () => {
1706
+ let e = W(), t = W((e) => e.playbackRate), n = W((e) => e.audioTracks), r = W((e) => e.selectedAudioTrack), i = W((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = pt({ onReset: () => o(0) }), p = (t) => {
1636
1707
  e.setPlaybackRate(t), o(0);
1637
1708
  }, h = (e) => {
1638
1709
  e !== void 0 && f(e, () => i(e));
1639
1710
  }, g = (e) => () => {
1640
1711
  o(e);
1641
1712
  };
1642
- return /* @__PURE__ */ w("div", {
1643
- css: mt,
1713
+ return /* @__PURE__ */ T("div", {
1714
+ css: St,
1644
1715
  ref: l,
1645
1716
  children: [
1646
- /* @__PURE__ */ C(Z, {
1717
+ /* @__PURE__ */ w(Z, {
1647
1718
  id: "settings",
1648
1719
  disabled: s,
1649
- text: /* @__PURE__ */ C("button", {
1720
+ text: /* @__PURE__ */ w("button", {
1650
1721
  className: "settings",
1651
1722
  type: "button",
1652
1723
  onClick: c,
1653
1724
  "aria-label": "Settings",
1654
1725
  "aria-expanded": s,
1655
- children: /* @__PURE__ */ C(F, {})
1726
+ children: /* @__PURE__ */ w(I, {})
1656
1727
  }),
1657
- toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
1728
+ toolTipText: /* @__PURE__ */ w("span", { children: "Settings" })
1658
1729
  }),
1659
- s && a === 0 && /* @__PURE__ */ w("div", {
1730
+ s && a === 0 && /* @__PURE__ */ T("div", {
1660
1731
  className: "popover menu",
1661
- children: [n.length > 1 ? /* @__PURE__ */ w("div", {
1732
+ children: [n.length > 1 ? /* @__PURE__ */ T("div", {
1662
1733
  onClick: g(2),
1663
- children: [/* @__PURE__ */ C("div", { children: "Audio" }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(O, {}) })]
1664
- }) : null, /* @__PURE__ */ w("div", {
1734
+ children: [/* @__PURE__ */ w("div", { children: "Audio" }), /* @__PURE__ */ w("div", { children: /* @__PURE__ */ w(k, {}) })]
1735
+ }) : null, /* @__PURE__ */ T("div", {
1665
1736
  onClick: g(1),
1666
- children: [/* @__PURE__ */ C("div", { children: "Playback speed" }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("span", {
1737
+ children: [/* @__PURE__ */ w("div", { children: "Playback speed" }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("span", {
1667
1738
  className: "secondary",
1668
1739
  children: t === 1 ? "(Default)" : t.toFixed(2)
1669
- }), /* @__PURE__ */ C(O, {})] })]
1740
+ }), /* @__PURE__ */ w(k, {})] })]
1670
1741
  })]
1671
1742
  }),
1672
- s && a === 1 && /* @__PURE__ */ w("div", {
1743
+ s && a === 1 && /* @__PURE__ */ T("div", {
1673
1744
  className: "popover playback-rate",
1674
1745
  children: [
1675
- /* @__PURE__ */ w("div", {
1746
+ /* @__PURE__ */ T("div", {
1676
1747
  className: "back",
1677
1748
  onClick: g(0),
1678
- children: [/* @__PURE__ */ C(D, {}), /* @__PURE__ */ C("span", { children: "Playback speed" })]
1749
+ children: [/* @__PURE__ */ w(O, {}), /* @__PURE__ */ w("span", { children: "Playback speed" })]
1679
1750
  }),
1680
- /* @__PURE__ */ C("div", {
1751
+ /* @__PURE__ */ w("div", {
1681
1752
  className: "slider no-hover",
1682
- children: /* @__PURE__ */ C(pt, {})
1753
+ children: /* @__PURE__ */ w(xt, {})
1683
1754
  }),
1684
- /* @__PURE__ */ w("div", {
1755
+ /* @__PURE__ */ T("div", {
1685
1756
  className: "options no-hover",
1686
1757
  children: [
1687
- /* @__PURE__ */ C("div", {
1758
+ /* @__PURE__ */ w("div", {
1688
1759
  onClick: () => p(.5),
1689
1760
  children: "0.5x"
1690
1761
  }),
1691
- /* @__PURE__ */ C("div", {
1762
+ /* @__PURE__ */ w("div", {
1692
1763
  onClick: () => p(1),
1693
1764
  children: "1x"
1694
1765
  }),
1695
- /* @__PURE__ */ C("div", {
1766
+ /* @__PURE__ */ w("div", {
1696
1767
  onClick: () => p(1.5),
1697
1768
  children: "1.5x"
1698
1769
  }),
1699
- /* @__PURE__ */ C("div", {
1770
+ /* @__PURE__ */ w("div", {
1700
1771
  onClick: () => p(2),
1701
1772
  children: "2x"
1702
1773
  })
@@ -1704,7 +1775,7 @@ ${rt}
1704
1775
  })
1705
1776
  ]
1706
1777
  }),
1707
- s && a === 2 && /* @__PURE__ */ C(it, {
1778
+ s && a === 2 && /* @__PURE__ */ w(ft, {
1708
1779
  title: "Audio",
1709
1780
  tracks: n,
1710
1781
  selected: r,
@@ -1715,7 +1786,7 @@ ${rt}
1715
1786
  })
1716
1787
  ]
1717
1788
  });
1718
- }, gt = h`
1789
+ }, wt = g`
1719
1790
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1720
1791
  which is the width of the player box, so it can be clamped to it. */
1721
1792
  position: static;
@@ -1731,28 +1802,28 @@ position: static;
1731
1802
  }
1732
1803
  }
1733
1804
 
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();
1805
+ ${dt}
1806
+ `, Tt = () => {
1807
+ let e = W((e) => e.subtitleTracks), t = W((e) => e.selectedSubtitleTrack), n = W((e) => e.selectSubtitleTrack), r = W((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = pt();
1737
1808
  if (e.length === 0) return null;
1738
1809
  let u = t !== void 0;
1739
- return /* @__PURE__ */ w("div", {
1740
- css: gt,
1810
+ return /* @__PURE__ */ T("div", {
1811
+ css: wt,
1741
1812
  ref: o,
1742
- children: [/* @__PURE__ */ C(Z, {
1813
+ children: [/* @__PURE__ */ w(Z, {
1743
1814
  id: "subtitles",
1744
1815
  disabled: i,
1745
- text: /* @__PURE__ */ C("button", {
1816
+ text: /* @__PURE__ */ w("button", {
1746
1817
  className: "subtitles",
1747
1818
  type: "button",
1748
1819
  onClick: a,
1749
1820
  "aria-label": "Subtitles",
1750
1821
  "aria-expanded": i,
1751
1822
  "aria-pressed": u,
1752
- children: u ? /* @__PURE__ */ C($e, { className: "captions" }) : /* @__PURE__ */ C(et, { className: "captions-off" })
1823
+ children: u ? /* @__PURE__ */ w(st, { className: "captions" }) : /* @__PURE__ */ w(ct, { className: "captions-off" })
1753
1824
  }),
1754
- toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
1755
- }), i && /* @__PURE__ */ C(it, {
1825
+ toolTipText: /* @__PURE__ */ w("span", { children: "Subtitles" })
1826
+ }), i && /* @__PURE__ */ w(ft, {
1756
1827
  title: "Subtitles",
1757
1828
  tracks: e,
1758
1829
  selected: t,
@@ -1762,13 +1833,13 @@ ${rt}
1762
1833
  failed: c
1763
1834
  })]
1764
1835
  });
1765
- }, vt = {
1836
+ }, Et = {
1766
1837
  primary: "#EAEBEE",
1767
1838
  secondary: "#D0D0D9",
1768
1839
  hover: "rgba(255, 255, 255, 0.13)",
1769
1840
  borderPrimary: "#384F70",
1770
1841
  backgroundTooltip: "#222222"
1771
- }, yt = h`
1842
+ }, Dt = g`
1772
1843
  display: flex;
1773
1844
  align-items: center;
1774
1845
 
@@ -1811,8 +1882,8 @@ ${rt}
1811
1882
  width: 10px;
1812
1883
  height: 10px;
1813
1884
  }
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({
1885
+ `, Ot = ({ value: e, onChange: t }) => {
1886
+ let n = W((e) => e.volume), r = W((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Ne({
1816
1887
  ref: a,
1817
1888
  onChange: t
1818
1889
  }), s = (n) => {
@@ -1826,31 +1897,31 @@ ${rt}
1826
1897
  e && e.removeEventListener("wheel", s);
1827
1898
  };
1828
1899
  }, [e]);
1829
- let c = e * 100, l = f(() => Math.round(r ? 0 : be(n) * 100), [n, r]);
1830
- return /* @__PURE__ */ C(Z, {
1900
+ let c = e * 100, l = f(() => Math.round(r ? 0 : Oe(n) * 100), [n, r]);
1901
+ return /* @__PURE__ */ w(Z, {
1831
1902
  id: "volume-slider",
1832
- text: /* @__PURE__ */ C("div", {
1903
+ text: /* @__PURE__ */ w("div", {
1833
1904
  ref: i,
1834
- css: yt,
1905
+ css: Dt,
1835
1906
  ...o,
1836
- children: /* @__PURE__ */ C("div", {
1907
+ children: /* @__PURE__ */ w("div", {
1837
1908
  ref: a,
1838
1909
  style: { background: `linear-gradient(to right,
1839
1910
  #fff 0% ${c}%,
1840
1911
  #3A3A3A ${c}% 100%
1841
1912
  )` },
1842
- children: /* @__PURE__ */ C("div", {
1913
+ children: /* @__PURE__ */ w("div", {
1843
1914
  className: "volume-handle",
1844
1915
  style: { left: `${e * 100}%` }
1845
1916
  })
1846
1917
  })
1847
1918
  }),
1848
- toolTipText: /* @__PURE__ */ w("div", {
1919
+ toolTipText: /* @__PURE__ */ T("div", {
1849
1920
  className: "volume-value",
1850
1921
  children: [l, "%"]
1851
1922
  })
1852
1923
  });
1853
- }, xt = h`
1924
+ }, kt = g`
1854
1925
  position: relative;
1855
1926
  display: flex;
1856
1927
  align-items: center;
@@ -1913,39 +1984,39 @@ ${rt}
1913
1984
  }
1914
1985
  }
1915
1986
 
1916
- `, St = ({ ref: e }) => {
1917
- let t = U(), n = U((e) => e.volume), r = U((e) => e.muted), i = f(() => be(n), [n]);
1918
- return /* @__PURE__ */ w("div", {
1919
- css: xt,
1920
- children: [/* @__PURE__ */ C(Z, {
1987
+ `, At = ({ ref: e }) => {
1988
+ let t = W(), n = W((e) => e.volume), r = W((e) => e.muted), i = f(() => Oe(n), [n]);
1989
+ return /* @__PURE__ */ T("div", {
1990
+ css: kt,
1991
+ children: [/* @__PURE__ */ w(Z, {
1921
1992
  id: "sound",
1922
- text: /* @__PURE__ */ C("button", {
1993
+ text: /* @__PURE__ */ w("button", {
1923
1994
  className: "sound",
1924
1995
  type: "button",
1925
1996
  onClick: () => t.toggleMuted(),
1926
1997
  ref: e,
1927
1998
  "aria-label": "Mute",
1928
1999
  "aria-pressed": r || n === 0,
1929
- children: C(r || n === 0 ? R : n <= .5 ? I : L, {
2000
+ children: w(r || n === 0 ? z : n <= .5 ? L : R, {
1930
2001
  size: 18,
1931
2002
  color: "#fff"
1932
2003
  })
1933
2004
  }),
1934
- toolTipText: /* @__PURE__ */ C("span", { children: r ? "Unmute (m)" : "Mute (m)" })
1935
- }), /* @__PURE__ */ C("div", {
2005
+ toolTipText: /* @__PURE__ */ w("span", { children: r ? "Unmute (m)" : "Mute (m)" })
2006
+ }), /* @__PURE__ */ w("div", {
1936
2007
  className: "volume-slider-container",
1937
- children: /* @__PURE__ */ C("div", {
2008
+ children: /* @__PURE__ */ w("div", {
1938
2009
  className: "volume-slider-background",
1939
- children: /* @__PURE__ */ C(bt, {
2010
+ children: /* @__PURE__ */ w(Ot, {
1940
2011
  value: r ? 0 : i,
1941
2012
  onChange: (e) => {
1942
- t.setVolume(ye(e));
2013
+ t.setVolume(De(e));
1943
2014
  }
1944
2015
  })
1945
2016
  })
1946
2017
  })]
1947
2018
  });
1948
- }, $ = .05, Ct = 5, wt = h`
2019
+ }, $ = .05, jt = 5, Mt = 50, Nt = 1e3, Pt = g`
1949
2020
  display: flex;
1950
2021
  flex-direction: column;
1951
2022
  gap: calc(0.4 * var(--mp-unit));
@@ -1954,7 +2025,7 @@ ${rt}
1954
2025
  opacity: 0.72;
1955
2026
  font-size: 0.9em;
1956
2027
  }
1957
- `, Tt = h`
2028
+ `, Ft = g`
1958
2029
  position: absolute;
1959
2030
  bottom: 0;
1960
2031
  width: 100%;
@@ -2043,8 +2114,10 @@ ${rt}
2043
2114
 
2044
2115
  cursor: pointer;
2045
2116
 
2046
- :hover {
2047
- background-color: ${vt.hover};
2117
+ /* .armed is the hover of a control letting its click through, which takes no pointer events
2118
+ of its own and so is never :hover */
2119
+ :hover, &.armed {
2120
+ background-color: ${Et.hover};
2048
2121
  }
2049
2122
 
2050
2123
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -2082,13 +2155,13 @@ ${rt}
2082
2155
  }
2083
2156
  }
2084
2157
  }
2085
- `, Et = () => {
2086
- 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();
2158
+ `, It = () => {
2159
+ let e = W(), t = W((e) => e.paused), n = W((e) => e.currentTime), r = W((e) => e.duration), i = W((e) => e.seekingTo), a = W((e) => e.fullscreen), o = W((e) => e.hideUI), s = W((e) => e.togglePictureInPicture), c = W((e) => e.pictureInPictureMode), l = W((e) => e.burnedInSubtitles), f = W((e) => e.passThroughPictureInPicture), h = W((e) => e.subtitleTracks), g = W((e) => e.requestSeek), [_, v] = m(null), y = p(null), b = p(void 0), x = c === "burn-in", S = h.length > 0, C = r > 0 && n === r, E = u(({ direction: t, stepSize: n }) => {
2160
+ let r = Oe(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2161
+ e.setVolume(De(a)), o && !e.muted && e.toggleMuted();
2089
2162
  }, [e]);
2090
2163
  d(() => {
2091
- let t = (t) => p ? p(t) : e.seek(t), n = (n) => {
2164
+ let t = (t) => g ? g(t) : e.seek(t), n = (n) => {
2092
2165
  let r = n.target;
2093
2166
  if (r?.isContentEditable || /^(input|textarea|select)$/i.test(r?.tagName ?? "")) return;
2094
2167
  let i = !0;
@@ -2096,116 +2169,159 @@ ${rt}
2096
2169
  else if (n.key === "k") e.togglePaused();
2097
2170
  else if (n.key === " ") e.togglePaused();
2098
2171
  else if (n.key === "m") e.toggleMuted();
2099
- else if (n.key === "ArrowUp") b({
2172
+ else if (n.key === "ArrowUp") E({
2100
2173
  direction: "up",
2101
2174
  stepSize: $
2102
2175
  });
2103
- else if (n.key === "ArrowDown") b({
2176
+ else if (n.key === "ArrowDown") E({
2104
2177
  direction: "down",
2105
2178
  stepSize: $
2106
2179
  });
2107
2180
  else if (n.key === "ArrowRight") {
2108
2181
  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;
2182
+ t(Math.min(e.currentTime + jt, e.duration));
2183
+ } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - jt, 0)) : i = !1;
2111
2184
  i && n.preventDefault();
2112
2185
  };
2113
2186
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
2114
2187
  }, [
2115
2188
  e,
2116
- b,
2117
- p
2189
+ E,
2190
+ g
2118
2191
  ]);
2119
- let x = u((e) => {
2120
- e.preventDefault(), e.deltaY < 0 ? b({
2192
+ let D = u((e) => {
2193
+ e.preventDefault(), e.deltaY < 0 ? E({
2121
2194
  direction: "up",
2122
2195
  stepSize: $
2123
- }) : b({
2196
+ }) : E({
2124
2197
  direction: "down",
2125
2198
  stepSize: $
2126
2199
  });
2127
- }, [b]);
2200
+ }, [E]);
2201
+ d(() => {
2202
+ if (_) return _.addEventListener("wheel", D, { passive: !1 }), () => _.removeEventListener("wheel", D);
2203
+ }, [_, D]);
2204
+ let O = (e) => {
2205
+ if (!f || f.active || f.armed || e.pointerType === "touch") return;
2206
+ let { left: t, top: n, width: r, height: i } = e.currentTarget.getBoundingClientRect();
2207
+ f.arm({
2208
+ left: t,
2209
+ top: n,
2210
+ width: r,
2211
+ height: i
2212
+ });
2213
+ }, k = !!f?.armed;
2128
2214
  return d(() => {
2129
- if (h) return h.addEventListener("wheel", x, { passive: !1 }), () => h.removeEventListener("wheel", x);
2130
- }, [h, x]), /* @__PURE__ */ w("div", {
2131
- css: Tt,
2215
+ if (!k) return;
2216
+ clearInterval(b.current);
2217
+ let e = Infinity, t = setInterval(() => {
2218
+ if (Date.now() > e) {
2219
+ clearInterval(t);
2220
+ return;
2221
+ }
2222
+ let n = y.current, r = document.activeElement;
2223
+ n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
2224
+ }, Mt);
2225
+ return b.current = t, () => {
2226
+ e = Date.now() + Nt;
2227
+ };
2228
+ }, [k]), d(() => () => clearInterval(b.current), []), /* @__PURE__ */ T("div", {
2229
+ css: Ft,
2132
2230
  style: { ...o ? {
2133
2231
  opacity: "0",
2134
2232
  pointerEvents: "none"
2135
- } : {} },
2136
- children: [/* @__PURE__ */ C(Ze, {}), /* @__PURE__ */ w("div", {
2233
+ } : k ? { pointerEvents: "none" } : {} },
2234
+ children: [/* @__PURE__ */ w(at, {}), /* @__PURE__ */ T("div", {
2137
2235
  className: "actions",
2138
- children: [/* @__PURE__ */ w("div", {
2236
+ children: [/* @__PURE__ */ T("div", {
2139
2237
  className: "left",
2140
2238
  children: [
2141
- /* @__PURE__ */ C(Z, {
2239
+ /* @__PURE__ */ w(Z, {
2142
2240
  id: "play",
2143
2241
  tooltipPlace: "top-start",
2144
- text: /* @__PURE__ */ C("button", {
2242
+ text: /* @__PURE__ */ w("button", {
2145
2243
  className: "play",
2146
2244
  type: "button",
2147
2245
  onClick: () => e.togglePaused(),
2148
- "aria-label": y ? "Replay" : t ? "Play" : "Pause",
2149
- children: C(y ? P : t ? N : M, {})
2246
+ "aria-label": C ? "Replay" : t ? "Play" : "Pause",
2247
+ children: w(C ? F : t ? P : N, {})
2150
2248
  }),
2151
- toolTipText: /* @__PURE__ */ C("span", { children: y ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2249
+ toolTipText: /* @__PURE__ */ w("span", { children: C ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2152
2250
  }),
2153
- /* @__PURE__ */ C(St, { ref: g }),
2154
- /* @__PURE__ */ C("div", {
2251
+ /* @__PURE__ */ w(At, { ref: v }),
2252
+ /* @__PURE__ */ w("div", {
2155
2253
  className: "time",
2156
- children: xe(i ?? n, r)
2254
+ children: ke(i ?? n, r)
2157
2255
  })
2158
2256
  ]
2159
- }), /* @__PURE__ */ w("div", {
2257
+ }), /* @__PURE__ */ T("div", {
2160
2258
  className: "right",
2161
2259
  children: [
2162
- /* @__PURE__ */ C(dt, {}),
2163
- /* @__PURE__ */ C(_t, {}),
2164
- /* @__PURE__ */ C(ht, {}),
2165
- s ? /* @__PURE__ */ C(Z, {
2260
+ /* @__PURE__ */ w(yt, {}),
2261
+ /* @__PURE__ */ w(Tt, {}),
2262
+ /* @__PURE__ */ w(Ct, {}),
2263
+ f ? /* @__PURE__ */ w(Z, {
2166
2264
  id: "picture-in-picture",
2167
2265
  tooltipPlace: "top-end",
2168
- text: /* @__PURE__ */ C("button", {
2266
+ text: /* @__PURE__ */ w("button", {
2267
+ ref: y,
2268
+ className: f.armed ? "picture-in-picture armed" : "picture-in-picture",
2269
+ type: "button",
2270
+ onPointerEnter: O,
2271
+ onPointerMove: O,
2272
+ onClick: f.active ? f.exit : void 0,
2273
+ "aria-label": "Picture in picture",
2274
+ "aria-pressed": f.active,
2275
+ children: /* @__PURE__ */ w("img", {
2276
+ src: ot,
2277
+ alt: ""
2278
+ })
2279
+ }),
2280
+ toolTipText: /* @__PURE__ */ w("span", { children: f.active ? "Exit picture in picture" : "Picture in picture" })
2281
+ }) : s ? /* @__PURE__ */ w(Z, {
2282
+ id: "picture-in-picture",
2283
+ tooltipPlace: "top-end",
2284
+ text: /* @__PURE__ */ w("button", {
2169
2285
  className: "picture-in-picture",
2170
2286
  type: "button",
2171
2287
  onClick: s,
2172
- disabled: _ && !v,
2173
- "aria-label": _ ? "Put the subtitles in the video" : "Picture in picture",
2174
- "aria-pressed": _ ? l : void 0,
2175
- children: _ ? C(l ? tt : nt, {}) : /* @__PURE__ */ C("img", {
2176
- src: Qe,
2288
+ disabled: x && !S,
2289
+ "aria-label": x ? "Put the subtitles in the video" : "Picture in picture",
2290
+ "aria-pressed": x ? l : void 0,
2291
+ children: x ? w(l ? lt : ut, {}) : /* @__PURE__ */ w("img", {
2292
+ src: ot,
2177
2293
  alt: ""
2178
2294
  })
2179
2295
  }),
2180
- toolTipText: /* @__PURE__ */ w("span", {
2181
- css: wt,
2182
- children: [/* @__PURE__ */ C("span", {
2296
+ toolTipText: /* @__PURE__ */ T("span", {
2297
+ css: Pt,
2298
+ children: [/* @__PURE__ */ w("span", {
2183
2299
  className: "lead",
2184
- children: _ ? v ? l ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
2185
- }), _ && v ? /* @__PURE__ */ C("span", {
2300
+ children: x ? S ? l ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
2301
+ }), x && S ? /* @__PURE__ */ w("span", {
2186
2302
  className: "hint",
2187
2303
  children: "Then hover the video and click your browser's own pop out button"
2188
2304
  }) : null]
2189
2305
  })
2190
2306
  }) : null,
2191
- /* @__PURE__ */ C(Z, {
2307
+ /* @__PURE__ */ w(Z, {
2192
2308
  id: "full-screen",
2193
2309
  tooltipPlace: "top-end",
2194
- text: /* @__PURE__ */ C("button", {
2310
+ text: /* @__PURE__ */ w("button", {
2195
2311
  className: "full-screen",
2196
2312
  type: "button",
2197
2313
  onClick: () => e.toggleFullscreen(),
2198
2314
  "aria-label": "Full screen",
2199
2315
  "aria-pressed": a,
2200
- children: C(a ? j : A, {})
2316
+ children: w(a ? M : j, {})
2201
2317
  }),
2202
- toolTipText: /* @__PURE__ */ C("span", { children: a ? "Exit full screen (f)" : "Full screen (f)" })
2318
+ toolTipText: /* @__PURE__ */ w("span", { children: a ? "Exit full screen (f)" : "Full screen (f)" })
2203
2319
  })
2204
2320
  ]
2205
2321
  })]
2206
2322
  })]
2207
2323
  });
2208
- }, Dt = 9e3, Ot = h`
2324
+ }, Lt = 9e3, Rt = g`
2209
2325
  position: absolute;
2210
2326
  inset: 0;
2211
2327
  z-index: 2;
@@ -2259,42 +2375,42 @@ ${rt}
2259
2375
  line-height: 1;
2260
2376
  color: #fff;
2261
2377
  }
2262
- `, kt = () => {
2263
- let e = U((e) => e.burnedInSubtitles), t = U((e) => e.pictureInPictureMode), [n, r] = m(!1);
2378
+ `, zt = () => {
2379
+ let e = W((e) => e.burnedInSubtitles), t = W((e) => e.pictureInPictureMode), [n, r] = m(!1);
2264
2380
  return d(() => {
2265
2381
  if (t !== "burn-in" || !e) {
2266
2382
  r(!1);
2267
2383
  return;
2268
2384
  }
2269
2385
  r(!0);
2270
- let n = setTimeout(() => r(!1), Dt);
2386
+ let n = setTimeout(() => r(!1), Lt);
2271
2387
  return () => clearTimeout(n);
2272
- }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
2273
- css: Ot,
2388
+ }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ w("div", {
2389
+ css: Rt,
2274
2390
  className: n ? "show" : "",
2275
2391
  role: "status",
2276
- children: /* @__PURE__ */ w("div", {
2392
+ children: /* @__PURE__ */ T("div", {
2277
2393
  className: "card",
2278
- children: [/* @__PURE__ */ w("div", {
2394
+ children: [/* @__PURE__ */ T("div", {
2279
2395
  className: "words",
2280
- children: [/* @__PURE__ */ C("div", {
2396
+ children: [/* @__PURE__ */ w("div", {
2281
2397
  className: "title",
2282
2398
  children: "Subtitles are in the picture"
2283
- }), /* @__PURE__ */ C("div", {
2399
+ }), /* @__PURE__ */ w("div", {
2284
2400
  className: "body",
2285
2401
  children: "Now hover the video and click your browser's own pop out button"
2286
2402
  })]
2287
- }), /* @__PURE__ */ C("div", {
2403
+ }), /* @__PURE__ */ w("div", {
2288
2404
  className: "arrow",
2289
2405
  "aria-hidden": "true",
2290
2406
  children: "→"
2291
2407
  })]
2292
2408
  })
2293
2409
  });
2294
- }, At = 1, jt = 6e3, Mt = 1, Nt = {
2410
+ }, Bt = 1, Vt = 6e3, Ht = 1, Ut = {
2295
2411
  opening: "Skip Opening",
2296
2412
  ending: "Skip Ending"
2297
- }, Pt = h`
2413
+ }, Wt = g`
2298
2414
  position: absolute;
2299
2415
  inset: 0;
2300
2416
  z-index: 2;
@@ -2345,10 +2461,10 @@ ${rt}
2345
2461
  bottom: calc(9 * var(--mp-unit));
2346
2462
  }
2347
2463
  }
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(() => {
2464
+ `, Gt = () => {
2465
+ let e = W((e) => e.chapters), t = W((e) => e.currentTime), n = W((e) => e.requestSeek), r = W(), i = f(() => nt(e), [e]), a = f(() => {
2350
2466
  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;
2467
+ let n = e.findIndex((e, n) => i[n] !== void 0 && e.start - Bt <= t && t < e.end), r = n >= 0 ? i[n] : void 0;
2352
2468
  return r ? {
2353
2469
  kind: r,
2354
2470
  end: e[n].end
@@ -2360,7 +2476,7 @@ ${rt}
2360
2476
  ]), o = p(0), [s, c] = m(0);
2361
2477
  d(() => {
2362
2478
  let e = typeof t == "number" ? t : 0, n = o.current;
2363
- o.current = e, e < n - Mt && c((e) => e + 1);
2479
+ o.current = e, e < n - Ht && c((e) => e + 1);
2364
2480
  }, [t]);
2365
2481
  let [l, u] = m(!1), h = a ? `${a.kind}@${a.end}` : "";
2366
2482
  return d(() => {
@@ -2369,23 +2485,23 @@ ${rt}
2369
2485
  return;
2370
2486
  }
2371
2487
  u(!0);
2372
- let e = setTimeout(() => u(!1), jt);
2488
+ let e = setTimeout(() => u(!1), Vt);
2373
2489
  return () => clearTimeout(e);
2374
2490
  }, [h, s]), d(() => {
2375
2491
  a || u(!1);
2376
- }, [a]), a ? /* @__PURE__ */ C("div", {
2377
- css: Pt,
2492
+ }, [a]), a ? /* @__PURE__ */ w("div", {
2493
+ css: Wt,
2378
2494
  className: l ? "show" : "",
2379
- children: /* @__PURE__ */ C("button", {
2495
+ children: /* @__PURE__ */ w("button", {
2380
2496
  type: "button",
2381
2497
  className: "skip-chapter",
2382
2498
  onClick: () => {
2383
2499
  u(!1), n ? n(a.end) : r.seek(a.end);
2384
2500
  },
2385
- children: Nt[a.kind]
2501
+ children: Ut[a.kind]
2386
2502
  })
2387
2503
  }) : null;
2388
- }, It = 3e3, Lt = h`
2504
+ }, Kt = 3e3, qt = g`
2389
2505
  position: absolute;
2390
2506
  inset: 0;
2391
2507
  z-index: 2;
@@ -2396,7 +2512,10 @@ ${rt}
2396
2512
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
2397
2513
  not, and transitioning it holds the item on screen for the length of the fade. */
2398
2514
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
2399
- `, Rt = h`
2515
+ `, Jt = (e, t) => {
2516
+ let n = e.left - t.left, r = e.top - t.top;
2517
+ return `path(evenodd, 'M0 0H${t.width}V${t.height}H0Z M${n} ${r}H${n + e.width}V${r + e.height}H${n}Z')`;
2518
+ }, Yt = g`
2400
2519
  position: relative;
2401
2520
  background-color: black;
2402
2521
  display: flex;
@@ -2423,6 +2542,15 @@ ${rt}
2423
2542
  pointer-events: none;
2424
2543
  }
2425
2544
 
2545
+ /* Over everything, the control bar included, while a click on the picture in picture control is let
2546
+ through, with a hole at the control. Inside the hole every pointer event goes to the host's
2547
+ document and this one hears nothing, so the pointer arriving on this layer is the only sign here
2548
+ that it left the control. Named with its type for the specificity reason just above. */
2549
+ & > div.pass-through {
2550
+ inset: 0;
2551
+ z-index: 5;
2552
+ }
2553
+
2426
2554
  canvas {
2427
2555
  height: 100%;
2428
2556
  width: 100%;
@@ -2441,62 +2569,63 @@ ${rt}
2441
2569
  &.hide {
2442
2570
  cursor: none;
2443
2571
  }
2444
- `, zt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2572
+ `, Xt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2445
2573
  let r = `${t}${l(e) && e.key != null ? e.key : n}`;
2446
- return l(e) && e.type === c ? zt(e.props.children, `${r}/`) : [{
2574
+ return l(e) && e.type === c ? Xt(e.props.children, `${r}/`) : [{
2447
2575
  key: r,
2448
2576
  item: e
2449
2577
  }];
2450
- }), Bt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2451
- 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({
2578
+ }), Zt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2579
+ let o = W(), s = W((e) => e.hideUI), c = W((e) => e.setHideUI), l = W((e) => e.hasMedia), u = W((e) => e.passThroughPictureInPicture), f = p(void 0), m = p("mouse"), h = p({
2452
2580
  x: -1,
2453
2581
  y: -1
2454
- }), h = p(null);
2455
- d(() => () => clearTimeout(u.current), []), d(() => {
2456
- l || (clearTimeout(u.current), c(!1));
2582
+ }), g = p(null);
2583
+ d(() => () => clearTimeout(f.current), []), d(() => {
2584
+ l || (clearTimeout(f.current), c(!1));
2457
2585
  }, [l, c]);
2458
- let g = () => {
2586
+ let _ = () => {
2459
2587
  l && c(!0);
2460
- }, _ = (t) => {
2461
- h.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
2462
- }, v = () => {
2463
- if (f.current !== "mouse") return !1;
2464
- let { x: e, y: t } = m.current;
2465
- if (!h.current || e < 0) return !1;
2466
- let n = document.elementFromPoint(e, t);
2467
- return !!n && h.current.contains(n) && !n.closest(".video");
2588
+ }, v = (t) => {
2589
+ g.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
2468
2590
  }, y = () => {
2469
- if (v()) {
2470
- u.current = setTimeout(y, It);
2591
+ if (o.passThroughPictureInPicture?.armed) return !0;
2592
+ if (m.current !== "mouse") return !1;
2593
+ let { x: e, y: t } = h.current;
2594
+ if (!g.current || e < 0) return !1;
2595
+ let n = document.elementFromPoint(e, t);
2596
+ return !!n && g.current.contains(n) && !n.closest(".video");
2597
+ }, b = () => {
2598
+ if (y()) {
2599
+ f.current = setTimeout(b, Kt);
2471
2600
  return;
2472
2601
  }
2473
- g();
2474
- }, b = () => {
2475
- c(!1), clearTimeout(u.current), u.current = setTimeout(y, It);
2602
+ _();
2603
+ }, x = () => {
2604
+ c(!1), clearTimeout(f.current), f.current = setTimeout(b, Kt);
2476
2605
  };
2477
- return /* @__PURE__ */ w("div", {
2478
- css: Rt,
2479
- ref: _,
2606
+ return /* @__PURE__ */ T("div", {
2607
+ css: Yt,
2608
+ ref: v,
2480
2609
  onPointerMove: (e) => {
2481
- f.current = e.pointerType, e.pointerType === "mouse" && (m.current = {
2610
+ m.current = e.pointerType, e.pointerType === "mouse" && (h.current = {
2482
2611
  x: e.clientX,
2483
2612
  y: e.clientY
2484
- }, b());
2613
+ }, x());
2485
2614
  },
2486
2615
  onPointerDown: (e) => {
2487
- f.current = e.pointerType;
2616
+ m.current = e.pointerType;
2488
2617
  },
2489
2618
  onMouseOut: (e) => {
2490
2619
  let t = e.relatedTarget;
2491
2620
  if (t && e.currentTarget.contains(t)) return;
2492
2621
  let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
2493
- e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(u.current), g());
2622
+ e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(f.current), _());
2494
2623
  },
2495
2624
  className: s ? "hide" : "",
2496
2625
  children: [
2497
- /* @__PURE__ */ C(ge, { onSubtitleRef: n }),
2498
- zt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
2499
- css: Lt,
2626
+ /* @__PURE__ */ w(we, { onSubtitleRef: n }),
2627
+ Xt(r).map(({ key: e, item: t }) => /* @__PURE__ */ w("div", {
2628
+ css: qt,
2500
2629
  style: { ...s ? {
2501
2630
  opacity: "0",
2502
2631
  visibility: "hidden",
@@ -2504,27 +2633,32 @@ ${rt}
2504
2633
  } : {} },
2505
2634
  children: t
2506
2635
  }, e)),
2507
- i === !1 ? null : /* @__PURE__ */ C(Et, {}),
2508
- /* @__PURE__ */ C(kt, {}),
2509
- /* @__PURE__ */ C(Ft, {}),
2510
- /* @__PURE__ */ w("div", {
2636
+ i === !1 ? null : /* @__PURE__ */ w(It, {}),
2637
+ /* @__PURE__ */ w(zt, {}),
2638
+ /* @__PURE__ */ w(Gt, {}),
2639
+ u?.armed && g.current ? /* @__PURE__ */ w("div", {
2640
+ className: "pass-through",
2641
+ style: { clipPath: Jt(u.armed, g.current.getBoundingClientRect()) },
2642
+ onPointerOver: u.disarm
2643
+ }) : null,
2644
+ /* @__PURE__ */ T("div", {
2511
2645
  className: "video",
2512
2646
  onClick: () => {
2513
- if (f.current === "mouse") {
2647
+ if (m.current === "mouse") {
2514
2648
  o.togglePaused();
2515
2649
  return;
2516
2650
  }
2517
- s ? b() : (clearTimeout(u.current), g());
2651
+ s ? x() : (clearTimeout(f.current), _());
2518
2652
  },
2519
- children: [t ? /* @__PURE__ */ C("video", {
2653
+ children: [t ? /* @__PURE__ */ w("video", {
2520
2654
  ref: t,
2521
2655
  playsInline: !0
2522
2656
  }) : null, a]
2523
2657
  })
2524
2658
  ]
2525
2659
  });
2526
- }, Vt = ({ options: e, children: t }) => {
2527
- 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;
2660
+ }, Qt = ({ options: e, children: t }) => {
2661
+ 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 = b(), _ = y(), [v, x] = m(null), [S, C] = m(null), T = n?.media ?? v;
2528
2662
  d(() => (g?.(T), () => g?.(null)), [T, g]);
2529
2663
  let { expose: E } = e, D = E === !0 ? {} : E || void 0, O = p(D);
2530
2664
  O.current = D;
@@ -2543,80 +2677,82 @@ ${rt}
2543
2677
  k,
2544
2678
  A,
2545
2679
  j
2546
- ]), oe(b, S, r);
2547
- let { thumbnails: M, requestThumbnail: N } = le({
2680
+ ]), se(v, S, r);
2681
+ let { thumbnails: M, requestThumbnail: N } = ue({
2548
2682
  publicPath: c,
2549
2683
  workerUrl: l,
2550
2684
  length: h === !1 ? void 0 : o,
2551
2685
  read: f ?? u,
2552
2686
  downloadedRanges: s
2553
- }), P = n?.thumbnails?.all ?? M, { toggle: F, mode: I, burnedIn: L } = ue(b, S), R = U((e) => e.setSourceState), z = n ? !!n.media : o !== void 0;
2687
+ }), P = n?.thumbnails?.all ?? M, { toggle: F, mode: I, burnedIn: L } = de(v, S), R = _e(n?.media ?? null, n?.pictureInPicture), z = W((e) => e.setSourceState), B = n ? !!n.media : o !== void 0;
2554
2688
  d(() => {
2555
- R({
2689
+ z({
2556
2690
  title: i,
2557
2691
  size: o,
2558
2692
  downloadedRanges: s,
2559
- hasMedia: z
2693
+ hasMedia: B
2560
2694
  });
2561
2695
  }, [
2562
- R,
2696
+ z,
2563
2697
  i,
2564
2698
  o,
2565
2699
  s,
2566
- z
2700
+ B
2567
2701
  ]);
2568
- let B = n?.thumbnails?.at;
2702
+ let V = n?.thumbnails?.at;
2569
2703
  d(() => {
2570
- R({
2704
+ z({
2571
2705
  thumbnails: P,
2572
- thumbnailAt: B,
2706
+ thumbnailAt: V,
2573
2707
  requestThumbnail: N,
2574
2708
  togglePictureInPicture: F,
2575
2709
  pictureInPictureMode: I,
2576
2710
  burnedInSubtitles: L
2577
2711
  });
2578
2712
  }, [
2579
- R,
2713
+ z,
2580
2714
  P,
2581
- B,
2715
+ V,
2582
2716
  N,
2583
2717
  F,
2584
2718
  I,
2585
2719
  L
2586
- ]);
2587
- let V = n?.subtitles?.selection, H = n?.audioTracks?.selection;
2720
+ ]), d(() => {
2721
+ z({ passThroughPictureInPicture: R });
2722
+ }, [z, R]);
2723
+ let H = n?.subtitles?.selection, U = n?.audioTracks?.selection;
2588
2724
  return d(() => {
2589
- V && R({
2590
- subtitleTracks: V.options.map(({ id: e, label: t, disabled: n }) => ({
2725
+ H && z({
2726
+ subtitleTracks: H.options.map(({ id: e, label: t, disabled: n }) => ({
2591
2727
  id: e,
2592
2728
  label: t,
2593
2729
  disabled: n
2594
2730
  })),
2595
- selectedSubtitleTrack: V.selectedId ?? void 0,
2596
- selectSubtitleTrack: (e) => V.select(e == null ? null : String(e)),
2597
- subtitleOffLabel: V.offLabel
2731
+ selectedSubtitleTrack: H.selectedId ?? void 0,
2732
+ selectSubtitleTrack: (e) => H.select(e == null ? null : String(e)),
2733
+ subtitleOffLabel: H.offLabel
2598
2734
  });
2599
- }, [R, V]), d(() => {
2600
- H && R({
2601
- audioTracks: H.options.map(({ id: e, label: t, disabled: n }) => ({
2735
+ }, [z, H]), d(() => {
2736
+ U && z({
2737
+ audioTracks: U.options.map(({ id: e, label: t, disabled: n }) => ({
2602
2738
  id: e,
2603
2739
  label: t,
2604
2740
  disabled: n
2605
2741
  })),
2606
- selectedAudioTrack: H.selectedId ?? void 0,
2607
- selectAudioTrack: (e) => H.select(String(e))
2742
+ selectedAudioTrack: U.selectedId ?? void 0,
2743
+ selectAudioTrack: (e) => U.select(String(e))
2608
2744
  });
2609
- }, [R, H]), d(() => {
2610
- a && R({ chapters: a });
2611
- }, [R, a]), /* @__PURE__ */ C(Bt, {
2745
+ }, [z, U]), d(() => {
2746
+ a && z({ chapters: a });
2747
+ }, [z, a]), /* @__PURE__ */ w(Zt, {
2612
2748
  ref: _,
2613
2749
  onVideoRef: n ? void 0 : x,
2614
- onSubtitleRef: w,
2750
+ onSubtitleRef: C,
2615
2751
  overlay: e.overlay,
2616
2752
  controls: e.controls,
2617
2753
  children: t
2618
2754
  });
2619
- }, Ht = h`
2755
+ }, $t = g`
2620
2756
  /**
2621
2757
  * The chrome's whole scale, in one place.
2622
2758
  *
@@ -2686,17 +2822,17 @@ ${rt}
2686
2822
  height: 100%;
2687
2823
  width: 100%;
2688
2824
  overflow: hidden;
2689
- `, Ut = (e) => /* @__PURE__ */ C("div", {
2690
- css: Ht,
2691
- children: /* @__PURE__ */ C(H.Provider, { children: /* @__PURE__ */ C(Vt, {
2825
+ `, en = (e) => /* @__PURE__ */ w("div", {
2826
+ css: $t,
2827
+ children: /* @__PURE__ */ w(U.Provider, { children: /* @__PURE__ */ w(Qt, {
2692
2828
  options: e,
2693
2829
  children: e.children
2694
2830
  }) })
2695
- }), Wt = (e) => !!e && typeof e == "object" && "at" in e, Gt = (e) => !!e && typeof e == "object" && "selection" in e, Kt = ({ blob: e, name: t }) => ({
2831
+ }), tn = (e) => !!e && typeof e == "object" && "at" in e, nn = (e) => !!e && typeof e == "object" && "selection" in e, rn = ({ blob: e, name: t }) => ({
2696
2832
  length: e.size,
2697
2833
  name: t ?? (e instanceof File ? e.name : void 0),
2698
2834
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
2699
- }), qt = async (e, t) => {
2835
+ }), an = async (e, t) => {
2700
2836
  let n = await fetch(e, {
2701
2837
  headers: { Range: "bytes=0-1" },
2702
2838
  credentials: t
@@ -2706,8 +2842,8 @@ ${rt}
2706
2842
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
2707
2843
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
2708
2844
  return i;
2709
- }, Jt = async ({ url: e, length: t, name: n, credentials: r }) => {
2710
- let i = t ?? await qt(e, r);
2845
+ }, on = async ({ url: e, length: t, name: n, credentials: r }) => {
2846
+ let i = t ?? await an(e, r);
2711
2847
  return {
2712
2848
  length: i,
2713
2849
  name: n,
@@ -2722,9 +2858,9 @@ ${rt}
2722
2858
  return o.arrayBuffer();
2723
2859
  }
2724
2860
  };
2725
- }, Yt = async (e) => {
2726
- if ("blob" in e) return Kt(e);
2727
- if ("url" in e) return Jt(e);
2861
+ }, sn = async (e) => {
2862
+ if ("blob" in e) return rn(e);
2863
+ if ("url" in e) return on(e);
2728
2864
  if ("read" in e) return {
2729
2865
  length: e.length,
2730
2866
  name: e.name,
@@ -2733,4 +2869,4 @@ ${rt}
2733
2869
  throw Error(`Unknown source type: ${e}`);
2734
2870
  };
2735
2871
  //#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 };
2872
+ export { en as MediaPlayer, en as default, U as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, sn as inputToRemuxerInput, nn as isDelegatedTracks, tn as isExternalThumbnails, H as sourceFeature, i as startPlayback, de as usePictureInPicture, W as usePlayer, ue as useSeekThumbnails };