markdown-flow-ui 0.1.128-dev.1 → 0.1.129

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.
Files changed (95) hide show
  1. package/dist/_virtual/index.cjs8.js +1 -1
  2. package/dist/_virtual/index.cjs9.js +1 -1
  3. package/dist/_virtual/index.es8.js +2 -2
  4. package/dist/_virtual/index.es9.js +2 -2
  5. package/dist/assets/markdown-flow-ui.css +1 -1
  6. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.js.map +1 -1
  7. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
  8. package/dist/components/Slide/Player.cjs.js +1 -1
  9. package/dist/components/Slide/Player.cjs.js.map +1 -1
  10. package/dist/components/Slide/Player.d.ts +22 -2
  11. package/dist/components/Slide/Player.es.js +695 -474
  12. package/dist/components/Slide/Player.es.js.map +1 -1
  13. package/dist/components/Slide/Slide.cjs.js +1 -1
  14. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  15. package/dist/components/Slide/Slide.es.js +673 -595
  16. package/dist/components/Slide/Slide.es.js.map +1 -1
  17. package/dist/components/Slide/Slide.stories.d.ts +2 -0
  18. package/dist/components/Slide/SubtitleOverlay.cjs.js.map +1 -1
  19. package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
  20. package/dist/components/Slide/constants.cjs.js +1 -1
  21. package/dist/components/Slide/constants.cjs.js.map +1 -1
  22. package/dist/components/Slide/constants.d.ts +4 -2
  23. package/dist/components/Slide/constants.es.js +4 -2
  24. package/dist/components/Slide/constants.es.js.map +1 -1
  25. package/dist/components/Slide/useSlide.cjs.js +1 -1
  26. package/dist/components/Slide/useSlide.cjs.js.map +1 -1
  27. package/dist/components/Slide/useSlide.d.ts +2 -0
  28. package/dist/components/Slide/useSlide.es.js +124 -105
  29. package/dist/components/Slide/useSlide.es.js.map +1 -1
  30. package/dist/components/Slide/utils/audioSegments.cjs.js +2 -0
  31. package/dist/components/Slide/utils/audioSegments.cjs.js.map +1 -0
  32. package/dist/components/Slide/utils/audioSegments.d.ts +2 -0
  33. package/dist/components/Slide/utils/audioSegments.es.js +21 -0
  34. package/dist/components/Slide/utils/audioSegments.es.js.map +1 -0
  35. package/dist/components/Slide/utils/audioSegments.test.d.ts +1 -0
  36. package/dist/components/Slide/utils/playbackSequence.cjs.js +1 -1
  37. package/dist/components/Slide/utils/playbackSequence.cjs.js.map +1 -1
  38. package/dist/components/Slide/utils/playbackSequence.d.ts +10 -0
  39. package/dist/components/Slide/utils/playbackSequence.es.js +15 -6
  40. package/dist/components/Slide/utils/playbackSequence.es.js.map +1 -1
  41. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.js +1 -1
  42. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.js.map +1 -1
  43. package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +1 -1
  44. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +14 -5
  45. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -1
  46. package/dist/components/Slide/utils/segmentSeek.cjs.js +2 -0
  47. package/dist/components/Slide/utils/segmentSeek.cjs.js.map +1 -0
  48. package/dist/components/Slide/utils/segmentSeek.d.ts +8 -0
  49. package/dist/components/Slide/utils/segmentSeek.es.js +31 -0
  50. package/dist/components/Slide/utils/segmentSeek.es.js.map +1 -0
  51. package/dist/components/Slide/utils/segmentSeek.test.d.ts +1 -0
  52. package/dist/components/Slide/utils/streamingNavigation.cjs.js.map +1 -1
  53. package/dist/components/Slide/utils/streamingNavigation.es.js.map +1 -1
  54. package/dist/components/Slide/utils/subtitleCue.cjs.js +2 -2
  55. package/dist/components/Slide/utils/subtitleCue.cjs.js.map +1 -1
  56. package/dist/components/Slide/utils/subtitleCue.d.ts +31 -0
  57. package/dist/components/Slide/utils/subtitleCue.es.js +157 -6
  58. package/dist/components/Slide/utils/subtitleCue.es.js.map +1 -1
  59. package/dist/components/Slide/utils/subtitleJumpNavigation.cjs.js +2 -0
  60. package/dist/components/Slide/utils/subtitleJumpNavigation.cjs.js.map +1 -0
  61. package/dist/components/Slide/utils/subtitleJumpNavigation.d.ts +10 -0
  62. package/dist/components/Slide/utils/subtitleJumpNavigation.es.js +22 -0
  63. package/dist/components/Slide/utils/subtitleJumpNavigation.es.js.map +1 -0
  64. package/dist/components/Slide/utils/subtitleJumpNavigation.test.d.ts +1 -0
  65. package/dist/lib/interaction-defaults.cjs.js.map +1 -1
  66. package/dist/lib/interaction-defaults.es.js.map +1 -1
  67. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
  68. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  69. package/dist/node_modules/classnames/index.cjs.js +1 -1
  70. package/dist/node_modules/classnames/index.es.js +1 -1
  71. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs.js +7 -0
  72. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs.js.map +1 -0
  73. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js +16 -0
  74. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js.map +1 -0
  75. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs.js +7 -0
  76. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs.js.map +1 -0
  77. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js +16 -0
  78. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js.map +1 -0
  79. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs.js +7 -0
  80. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs.js.map +1 -0
  81. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js +16 -0
  82. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js.map +1 -0
  83. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs.js +7 -0
  84. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs.js.map +1 -0
  85. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js +16 -0
  86. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js.map +1 -0
  87. package/package.json +1 -1
  88. package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js +0 -7
  89. package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js.map +0 -1
  90. package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js +0 -16
  91. package/dist/node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js.map +0 -1
  92. package/dist/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js +0 -7
  93. package/dist/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js.map +0 -1
  94. package/dist/node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js +0 -16
  95. package/dist/node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js.map +0 -1
@@ -1,32 +1,54 @@
1
1
  import { j as n } from "../../_virtual/jsx-runtime.es.js";
2
- import Rr, { memo as Er, useId as Cr, useContext as Nr, useRef as c, useState as nr, useMemo as G, useCallback as t, useEffect as m } from "react";
3
- import { cn as ur } from "../../lib/utils.es.js";
4
- import vr from "./MobilePlayerSettingsSheet.es.js";
5
- import { DEFAULT_SLIDE_PLAYER_TEXTS as Tr } from "./constants.es.js";
6
- import { DEFAULT_MOBILE_VIEW_MODE as Kr } from "./utils/mobileScreenMode.es.js";
7
- import { hasReachedAudioEnd as Pr } from "./utils/audioCompletion.es.js";
8
- import { PlayerKeyboardShortcutContext as Ur } from "./utils/playerKeyboardShortcutContext.es.js";
9
- import { activatePlayerKeyboardShortcutOwner as Fr, registerPlayerKeyboardShortcutOwner as Wr, isActivePlayerKeyboardShortcutOwner as Or, getPlayerKeyboardShortcutAction as Br, shouldIgnorePlayerKeyboardShortcutEvent as Vr } from "./utils/playerKeyboardShortcuts.es.js";
10
- import { resolveAudioPlaybackSourceType as Hr } from "./utils/playbackSource.es.js";
11
- import { shouldKeepPlayingAfterNavigation as $r } from "./utils/playbackPreference.es.js";
12
- import { toPlayerCustomActionList as Zr } from "./utils/playerCustomActions.es.js";
13
- import { suppressPlayerControlsWakeAfterNavigation as ar } from "./utils/playerNavigationContext.es.js";
2
+ import qt, { memo as er, useId as tr, useContext as rr, useRef as o, useState as Fe, useMemo as te, useCallback as r, useEffect as S } from "react";
3
+ import { cn as Tt } from "../../lib/utils.es.js";
4
+ import nr from "./MobilePlayerSettingsSheet.es.js";
5
+ import { DEFAULT_SLIDE_PLAYER_TEXTS as ur } from "./constants.es.js";
6
+ import { DEFAULT_MOBILE_VIEW_MODE as sr } from "./utils/mobileScreenMode.es.js";
7
+ import { hasReachedAudioEnd as lr } from "./utils/audioCompletion.es.js";
8
+ import { PlayerKeyboardShortcutContext as ar } from "./utils/playerKeyboardShortcutContext.es.js";
9
+ import { activatePlayerKeyboardShortcutOwner as cr, registerPlayerKeyboardShortcutOwner as ir, isActivePlayerKeyboardShortcutOwner as or, getPlayerKeyboardShortcutAction as fr, shouldIgnorePlayerKeyboardShortcutEvent as dr } from "./utils/playerKeyboardShortcuts.es.js";
10
+ import { resolveAudioPlaybackSourceType as mr } from "./utils/playbackSource.es.js";
11
+ import { shouldKeepPlayingAfterNavigation as pr } from "./utils/playbackPreference.es.js";
12
+ import { toPlayerCustomActionList as hr } from "./utils/playerCustomActions.es.js";
13
+ import { suppressPlayerControlsWakeAfterNavigation as We } from "./utils/playerNavigationContext.es.js";
14
+ import { isPlaybackTimeCoveredBySegments as Lt, resolveSegmentSeekTarget as yr } from "./utils/segmentSeek.es.js";
15
+ import { getSortedAudioSegments as vt } from "./utils/audioSegments.es.js";
16
+ import { getSubtitleCueJumpTarget as br, shouldClearSubtitleCueJumpTarget as Sr } from "./utils/subtitleCue.es.js";
14
17
  /* empty css */
15
- import qr from "../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js";
16
- import zr from "../../node_modules/lucide-react/dist/esm/icons/volume-2.es.js";
17
- import Yr from "../../node_modules/lucide-react/dist/esm/icons/captions.es.js";
18
- import Dr from "../../node_modules/lucide-react/dist/esm/icons/captions-off.es.js";
19
- import Xr from "../../node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js";
20
- import Gr from "../../node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js";
21
- import Jr from "../../node_modules/lucide-react/dist/esm/icons/scan-line.es.js";
22
- import Qr from "../../node_modules/lucide-react/dist/esm/icons/maximize.es.js";
23
- import Ir from "../../node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js";
24
- const sr = /* @__PURE__ */ new Map(), lr = (k) => {
25
- if (typeof window > "u" || !k || sr.has(k))
18
+ import gr from "../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js";
19
+ import _r from "../../node_modules/lucide-react/dist/esm/icons/volume-2.es.js";
20
+ import xr from "../../node_modules/lucide-react/dist/esm/icons/skip-back.es.js";
21
+ import kr from "../../node_modules/lucide-react/dist/esm/icons/skip-forward.es.js";
22
+ import wr from "../../node_modules/lucide-react/dist/esm/icons/rewind.es.js";
23
+ import Mr from "../../node_modules/lucide-react/dist/esm/icons/fast-forward.es.js";
24
+ import Cr from "../../node_modules/lucide-react/dist/esm/icons/captions.es.js";
25
+ import Tr from "../../node_modules/lucide-react/dist/esm/icons/captions-off.es.js";
26
+ import Lr from "../../node_modules/lucide-react/dist/esm/icons/scan-line.es.js";
27
+ import vr from "../../node_modules/lucide-react/dist/esm/icons/maximize.es.js";
28
+ import Ar from "../../node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js";
29
+ const At = /* @__PURE__ */ new Map(), jt = (f) => {
30
+ if (typeof window > "u" || !f || At.has(f))
26
31
  return;
27
- const j = window.document.createElement("audio");
28
- j.preload = "auto", j.setAttribute("playsinline", "true"), j.src = k, j.load(), sr.set(k, j);
29
- }, et = () => /* @__PURE__ */ n.jsxs(
32
+ const d = window.document.createElement("audio");
33
+ d.preload = "auto", d.setAttribute("playsinline", "true"), d.src = f, d.load(), At.set(f, d);
34
+ }, jr = (f, d) => d !== null && d.audioList === f && d.subtitleCueLists.length === f.length && f.every((a, _) => {
35
+ const x = a.element?.subtitle_cues;
36
+ return d.subtitleCueLists[_] === x && d.subtitleCueLengths[_] === (x?.length ?? 0);
37
+ }), Nr = (f) => {
38
+ const d = f.map(
39
+ (a) => a.element?.subtitle_cues
40
+ );
41
+ return {
42
+ audioList: f,
43
+ subtitleCueLists: d,
44
+ subtitleCueLengths: d.map(
45
+ (a) => a?.length ?? 0
46
+ ),
47
+ tracks: d.map((a) => ({
48
+ subtitleCues: a ?? []
49
+ }))
50
+ };
51
+ }, Er = () => /* @__PURE__ */ n.jsxs(
30
52
  "svg",
31
53
  {
32
54
  xmlns: "http://www.w3.org/2000/svg",
@@ -45,7 +67,7 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
45
67
  /* @__PURE__ */ n.jsx("path", { d: "M12 10H16V24H12V10ZM18 10H22V24H18V10Z", fill: "white" })
46
68
  ]
47
69
  }
48
- ), rt = () => /* @__PURE__ */ n.jsxs(
70
+ ), Rr = () => /* @__PURE__ */ n.jsxs(
49
71
  "svg",
50
72
  {
51
73
  xmlns: "http://www.w3.org/2000/svg",
@@ -67,580 +89,737 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
67
89
  ), J = {
68
90
  fullscreen: "F",
69
91
  next: "→",
92
+ nextSubtitle: "Shift+→",
70
93
  notes: "N",
71
94
  playback: "Space",
72
95
  previous: "←",
96
+ previousSubtitle: "Shift+←",
73
97
  subtitle: "C"
74
- }, tt = (k, j) => k ? `${k} (${j})` : j, nt = ({
75
- audioList: k = [],
76
- className: j,
77
- currentAudioIndex: h = -1,
78
- defaultPlaying: g = !0,
79
- isPlaybackPaused: K = !1,
80
- isAutoAdvanceEnabled: O = !0,
81
- useAutoAdvanceToggle: N = !1,
82
- onLoadingChange: xe,
83
- onPlaybackPreferenceChange: ke,
84
- onPlaybackStarted: Me,
85
- onPlaybackTimeChange: ne,
86
- onSubtitleToggle: Q,
87
- onPrev: ue,
88
- onNext: ae,
89
- onFullscreen: I,
90
- isFullscreen: Le = !1,
91
- mobileViewMode: cr = Kr,
92
- settingsPortalContainer: or,
93
- onMobileViewModeChange: Ae,
94
- onEnded: je,
95
- onAutoAdvanceToggle: Re,
96
- onInteractionToggle: se,
97
- hasInteraction: me = !1,
98
- isInteractionOpen: ee = !1,
99
- isSubtitleEnabled: pe = !0,
100
- prevDisabled: he = !1,
101
- nextDisabled: ye = !1,
102
- showControls: be = !0,
103
- enableKeyboardShortcuts: ir = !0,
104
- customActions: Ee,
105
- customActionContext: Ce,
106
- texts: Ne,
107
- onFocusCapture: ve,
108
- onPointerDown: Te,
109
- ...fr
98
+ }, Kr = 250, Ur = (f, d) => f ? `${f} (${d})` : d, Fr = ({
99
+ audioList: f = [],
100
+ className: d,
101
+ currentAudioIndex: a = -1,
102
+ defaultPlaying: _ = !0,
103
+ isPlaybackPaused: x = !1,
104
+ isAutoAdvanceEnabled: Z = !0,
105
+ useAutoAdvanceToggle: F = !1,
106
+ onLoadingChange: Pe,
107
+ onPlaybackPreferenceChange: Be,
108
+ onPlaybackStarted: Oe,
109
+ onPlaybackTimeChange: oe,
110
+ onSubtitleToggle: re,
111
+ onPrev: fe,
112
+ onNext: de,
113
+ onSubtitleJump: me,
114
+ canJumpToSubtitleTarget: Te,
115
+ onFullscreen: ne,
116
+ isFullscreen: Ve = !1,
117
+ mobileViewMode: Nt = sr,
118
+ settingsPortalContainer: Et,
119
+ onMobileViewModeChange: He,
120
+ onEnded: $e,
121
+ onAutoAdvanceToggle: Je,
122
+ onInteractionToggle: pe,
123
+ hasInteraction: Le = !1,
124
+ isInteractionOpen: ue = !1,
125
+ isSubtitleEnabled: ve = !0,
126
+ prevDisabled: Ae = !1,
127
+ nextDisabled: je = !1,
128
+ showControls: Ne = !0,
129
+ enableKeyboardShortcuts: Rt = !0,
130
+ subtitleSeekRequest: O = null,
131
+ customActions: Ze,
132
+ customActionContext: ze,
133
+ texts: Ye,
134
+ onFocusCapture: De,
135
+ onPointerDown: Xe,
136
+ ...Kt
110
137
  }) => {
111
- const dr = Cr(), Ke = Nr(Ur), y = c(null), Pe = c(ee), P = c(null), Ue = c(null), R = c(0), o = c(null), le = c(void 0), v = c([]), ce = c(
112
- N ? O : g
113
- ), re = c(!1), Fe = c(!1), b = c(!1), U = c(null), q = c(null), _ = c(!1), s = c(!1), S = c(null), E = c(!1), B = c(null), Se = c(0), F = c("unknown"), [oe, f] = nr(g), [We, z] = nr(!1), V = Ke?.ownerId ?? dr, T = ir && (Ke?.enabled ?? !0), d = h >= 0 ? k[h] : void 0, H = d?.audioUrl, M = G(
114
- () => [...d?.audioSegments ?? []].sort(
115
- (e, r) => e.segment_index - r.segment_index
116
- ),
117
- [d?.audioSegments]
118
- ), Oe = G(
119
- () => Zr(Ee, Ce),
120
- [Ce, Ee]
121
- ), Be = Oe.length + 5, mr = G(
138
+ const Ut = tr(), Ge = rr(ar), M = o(null), Qe = o(ue), R = o(null), Ie = o(null), K = o(0), m = o(null), he = o(void 0), j = o([]), se = o(
139
+ F ? Z : _
140
+ ), le = o(!1), qe = o(!1), k = o(!1), U = o(null), z = o(null), v = o(!1), c = o(!1), w = o(null), N = o(!1), Y = o(null), ye = o(0), et = o(() => {
141
+ }), be = o(null), ae = o(null), tt = o(null), rt = o(null), W = o("unknown"), [Se, h] = Fe(_), [nt, Q] = Fe(!1), [I, Ft] = Fe({
142
+ next: !1,
143
+ previous: !1
144
+ }), D = Ge?.ownerId ?? Ut, P = Rt && (Ge?.enabled ?? !0), p = a >= 0 ? f[a] : void 0, T = p?.audioUrl, ut = p?.audioSegments, Wt = ut?.length ?? 0, E = te(
145
+ () => vt(p),
146
+ [p, Wt, ut]
147
+ );
148
+ let ge = rt.current;
149
+ jr(f, ge) || (ge = Nr(f), rt.current = ge);
150
+ const st = ge.tracks, lt = te(
151
+ () => hr(Ze, ze),
152
+ [ze, Ze]
153
+ ), at = lt.length + 7, Pt = te(
122
154
  () => ({
123
- "--slide-player-mobile-control-count": String(Be)
155
+ "--slide-player-mobile-control-count": String(at)
124
156
  }),
125
- [Be]
126
- ), l = G(
157
+ [at]
158
+ ), i = te(
127
159
  () => ({
128
- ...Tr,
129
- ...Ne
160
+ ...ur,
161
+ ...Ye
130
162
  }),
131
- [Ne]
132
- ), ge = G(() => d ? d.audioKey ?? `${String(d.sequenceNumber ?? "none")}:${String(d.audioUrl ?? "")}` : "none", [d]), pr = N ? O : oe, Ve = N ? O ? l.pauseAutoplayLabel : l.playAutoplayLabel : oe ? l.pauseLabel : l.playLabel, He = Le ? l.exitFullscreenLabel : l.enterFullscreenLabel, Y = t(
133
- (e, r, a) => ({
134
- ariaKeyShortcuts: T ? a : void 0,
135
- title: T ? tt(e, r) : e
163
+ [Ye]
164
+ ), Ee = te(() => p ? p.audioKey ?? `${String(p.sequenceNumber ?? "none")}:${String(p.audioUrl ?? "")}` : "none", [p]), Bt = F ? Z : Se, ct = F ? Z ? i.pauseAutoplayLabel : i.playAutoplayLabel : Se ? i.pauseLabel : i.playLabel, it = Ve ? i.exitFullscreenLabel : i.enterFullscreenLabel, V = r(
165
+ (e, t, s) => ({
166
+ ariaKeyShortcuts: P ? s : void 0,
167
+ title: P ? Ur(e, t) : e
136
168
  }),
137
- [T]
138
- ), $e = Y(
139
- l.subtitleToggleAriaLabel,
169
+ [P]
170
+ ), ot = V(
171
+ i.subtitleToggleAriaLabel,
140
172
  J.subtitle,
141
173
  "c"
142
- ), Ze = Y(
143
- l.previousLabel,
174
+ ), ft = V(
175
+ i.previousLabel,
144
176
  J.previous,
145
177
  "ArrowLeft"
146
- ), qe = Y(
147
- Ve,
178
+ ), dt = V(
179
+ i.previousSubtitleLabel,
180
+ J.previousSubtitle,
181
+ "Shift+ArrowLeft"
182
+ ), mt = V(
183
+ ct,
148
184
  J.playback,
149
185
  "Space"
150
- ), ze = Y(
151
- l.nextLabel,
186
+ ), pt = V(
187
+ i.nextLabel,
152
188
  J.next,
153
189
  "ArrowRight"
154
- ), Ye = Y(
155
- He,
190
+ ), ht = V(
191
+ i.nextSubtitleLabel,
192
+ J.nextSubtitle,
193
+ "Shift+ArrowRight"
194
+ ), yt = V(
195
+ it,
156
196
  J.fullscreen,
157
197
  "f"
158
- ), De = Y(
159
- l.notesLabel,
198
+ ), bt = V(
199
+ i.notesLabel,
160
200
  J.notes,
161
201
  "n"
162
- ), ie = t(() => {
163
- T && Fr(V);
164
- }, [V, T]), hr = t(
202
+ ), _e = r(() => {
203
+ P && cr(D);
204
+ }, [D, P]), Ot = r(
165
205
  (e) => {
166
- ie(), Te?.(e);
206
+ _e(), Xe?.(e);
167
207
  },
168
- [ie, Te]
169
- ), yr = t(
208
+ [_e, Xe]
209
+ ), Vt = r(
170
210
  (e) => {
171
- ie(), ve?.(e);
211
+ _e(), De?.(e);
172
212
  },
173
- [ie, ve]
213
+ [_e, De]
174
214
  );
175
- m(() => {
176
- le.current = d;
177
- }, [d]), m(() => {
178
- ce.current = N ? O : g;
179
- }, [g, O, N]), m(() => {
180
- be || z(!1);
181
- }, [be]), m(() => {
182
- !Pe.current && ee && z(!1), Pe.current = ee;
183
- }, [ee]), m(() => {
184
- v.current = M;
185
- }, [M]), m(() => {
186
- const e = d?.audioUrl, r = h >= 0 ? k[h + 1]?.audioUrl : void 0;
187
- lr(e), lr(r);
188
- }, [k, d?.audioUrl, h]);
189
- const u = t(
190
- (e, r = null) => {
191
- Fe.current === e && (!e || r === null) || (Fe.current = e, xe?.({
215
+ S(() => {
216
+ he.current = p;
217
+ }, [p]), S(() => {
218
+ se.current = F ? Z : _;
219
+ }, [_, Z, F]), S(() => {
220
+ Ne || Q(!1);
221
+ }, [Ne]), S(() => {
222
+ !Qe.current && ue && Q(!1), Qe.current = ue;
223
+ }, [ue]), S(() => {
224
+ j.current = E;
225
+ }, [E]), S(() => {
226
+ const e = p?.audioUrl, t = a >= 0 ? f[a + 1]?.audioUrl : void 0;
227
+ jt(e), jt(t);
228
+ }, [f, p?.audioUrl, a]);
229
+ const l = r(
230
+ (e, t = null) => {
231
+ qe.current === e && (!e || t === null) || (qe.current = e, Pe?.({
192
232
  loading: e,
193
- reason: e ? r : null
233
+ reason: e ? t : null
194
234
  }));
195
235
  },
196
- [xe]
197
- ), $ = t(
236
+ [Pe]
237
+ ), B = r(
198
238
  (e) => {
199
- ce.current = e, ke?.(e);
239
+ se.current = e, Be?.(e);
200
240
  },
201
- [ke]
202
- ), te = t(() => N ? {
203
- shouldContinuePlayback: ce.current
241
+ [Be]
242
+ ), X = r(() => F ? {
243
+ shouldContinuePlayback: se.current
204
244
  } : {
205
- shouldContinuePlayback: $r({
206
- defaultPlaying: ce.current,
207
- isPausedByUser: b.current
245
+ shouldContinuePlayback: pr({
246
+ defaultPlaying: se.current,
247
+ isPausedByUser: k.current
208
248
  })
209
- }, [N]), Xe = t((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), W = t(() => g && !K && !b.current && F.current !== "blocked", [g, K]), Ge = t((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), Je = t(() => {
210
- const e = o.current;
211
- return e == null || e <= 0 ? 0 : v.current.slice(0, e).reduce(
212
- (r, a) => r + Math.max(Number(a.duration_ms ?? 0), 0),
249
+ }, [F]), St = r((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), H = r(() => _ && !x && !k.current && W.current !== "blocked", [_, x]), gt = r((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), _t = r(() => {
250
+ const e = m.current;
251
+ return e == null || e <= 0 ? 0 : j.current.slice(0, e).reduce(
252
+ (t, s) => t + Math.max(Number(s.duration_ms ?? 0), 0),
213
253
  0
214
254
  ) / 1e3;
215
- }, []), Z = t((e) => e <= 0 ? 0 : v.current.slice(0, e).reduce(
216
- (r, a) => r + Math.max(Number(a.duration_ms ?? 0), 0),
255
+ }, []), G = r((e) => e <= 0 ? 0 : j.current.slice(0, e).reduce(
256
+ (t, s) => t + Math.max(Number(s.duration_ms ?? 0), 0),
217
257
  0
218
- ), []), Qe = t(() => {
219
- const e = y.current;
220
- return e ? U.current === "segment" ? Z(R.current) + Math.max(e.currentTime, 0) * 1e3 : S.current !== null && e.readyState === 0 ? S.current * 1e3 : Math.max(e.currentTime, 0) * 1e3 : o.current != null ? Z(o.current) : 0;
221
- }, [Z]), w = t(
258
+ ), []), xe = r(
259
+ (e, t) => !e || x ? !1 : e.audioUrl ? !0 : Lt(
260
+ vt(e),
261
+ t
262
+ ),
263
+ [x]
264
+ ), ce = r(
265
+ (e, t, s = {}) => {
266
+ const u = br({
267
+ currentAudioIndex: a,
268
+ currentTimeMs: t,
269
+ direction: e,
270
+ excludeTarget: s.excludeTarget,
271
+ tracks: st
272
+ });
273
+ return !u || !xe(
274
+ f[u.audioIndex],
275
+ u.timeMs
276
+ ) || u.audioIndex !== a && (!me || Te && !Te(u)) ? null : u;
277
+ },
278
+ [
279
+ f,
280
+ Te,
281
+ xe,
282
+ a,
283
+ me,
284
+ st
285
+ ]
286
+ ), Re = r(
287
+ (e, t = !1) => {
288
+ const s = Math.max(Number(e), 0);
289
+ if (!t && be.current !== null && Math.abs(
290
+ s - be.current
291
+ ) < Kr)
292
+ return;
293
+ be.current = s;
294
+ const u = {
295
+ previous: ce("previous", s) !== null,
296
+ next: ce("next", s) !== null
297
+ };
298
+ Ft((b) => b.previous === u.previous && b.next === u.next ? b : u);
299
+ },
300
+ [ce]
301
+ );
302
+ S(() => {
303
+ et.current = Re, Re(ye.current, !0);
304
+ }, [Re]);
305
+ const ke = r(() => {
306
+ const e = M.current;
307
+ return e ? U.current === "segment" ? G(K.current) + Math.max(e.currentTime, 0) * 1e3 : w.current !== null && e.readyState === 0 ? w.current * 1e3 : Math.max(e.currentTime, 0) * 1e3 : m.current != null ? G(m.current) : 0;
308
+ }, [G]), C = r(
222
309
  (e) => {
223
- const r = Math.max(e, 0);
224
- Se.current !== r && (Se.current = r, ne?.(r));
310
+ const t = Math.max(e, 0);
311
+ ye.current !== t && (ye.current = t, Sr({
312
+ currentAudioIndex: a,
313
+ currentTimeMs: t,
314
+ target: ae.current
315
+ }) && (ae.current = null), oe?.(t), et.current(t));
225
316
  },
226
- [ne]
227
- ), i = t(() => {
228
- w(Qe());
229
- }, [Qe, w]), p = t(() => {
230
- typeof window > "u" || B.current === null || (window.cancelAnimationFrame(B.current), B.current = null);
231
- }, []), Ie = t(() => {
232
- if (typeof window > "u" || B.current !== null)
317
+ [a, oe]
318
+ ), y = r(() => {
319
+ C(ke());
320
+ }, [ke, C]), g = r(() => {
321
+ typeof window > "u" || Y.current === null || (window.cancelAnimationFrame(Y.current), Y.current = null);
322
+ }, []), xt = r(() => {
323
+ if (typeof window > "u" || Y.current !== null)
233
324
  return;
234
325
  const e = () => {
235
- i();
236
- const r = y.current;
237
- if (!r || r.paused || r.ended) {
238
- B.current = null;
326
+ y();
327
+ const t = M.current;
328
+ if (!t || t.paused || t.ended) {
329
+ Y.current = null;
239
330
  return;
240
331
  }
241
- B.current = window.requestAnimationFrame(e);
332
+ Y.current = window.requestAnimationFrame(e);
242
333
  };
243
- B.current = window.requestAnimationFrame(e);
244
- }, [i]), D = t(() => {
245
- const e = y.current;
246
- e && (p(), s.current = !1, b.current = !1, re.current = !1, U.current = null, S.current = null, _.current = !1, E.current = !1, q.current = null, e.pause(), e.removeAttribute("src"), e.load(), P.current = null, R.current = 0, o.current = null, w(0), f(!1), u(!1));
247
- }, [w, p, u]), L = t(
334
+ Y.current = window.requestAnimationFrame(e);
335
+ }, [y]), q = r(() => {
336
+ const e = M.current;
337
+ e && (g(), c.current = !1, k.current = !1, le.current = !1, U.current = null, w.current = null, v.current = !1, N.current = !1, z.current = null, e.pause(), e.removeAttribute("src"), e.load(), R.current = null, K.current = 0, m.current = null, C(0), h(!1), l(!1));
338
+ }, [C, g, l]), L = r(
248
339
  (e) => {
249
- const r = y.current;
250
- if (!r)
340
+ const t = M.current;
341
+ if (!t)
251
342
  return !1;
252
- const a = r.play();
253
- return a && typeof a.then == "function" && a.then(() => {
254
- F.current === "unknown" && (F.current = "auto"), s.current = !1, E.current = !1;
255
- }).catch((x) => {
256
- F.current === "unknown" && Xe(x) && (F.current = "blocked", s.current = !1, u(!1)), E.current = !1, f(!1);
343
+ const s = t.play();
344
+ return s && typeof s.then == "function" && s.then(() => {
345
+ W.current === "unknown" && (W.current = "auto"), c.current = !1, N.current = !1;
346
+ }).catch((u) => {
347
+ W.current === "unknown" && St(u) && (W.current = "blocked", c.current = !1, l(!1)), N.current = !1, h(!1);
257
348
  }), !0;
258
349
  },
259
- [Xe, u]
260
- ), C = t(
261
- (e, r) => {
262
- const a = y.current, x = v.current[e];
263
- if (!a || !x)
350
+ [St, l]
351
+ ), A = r(
352
+ (e, t, s = {}) => {
353
+ const u = M.current, b = j.current[e];
354
+ if (!u || !b)
264
355
  return !1;
265
- const A = Ge(x.audio_data);
266
- R.current = e, o.current = null, _.current = !1, E.current = !0, q.current = "segment", w(Z(e));
267
- const de = W();
268
- s.current = de, u(!1);
269
- const jr = P.current !== A;
270
- return U.current = "segment", jr && (a.pause(), a.removeAttribute("src"), a.load(), P.current = A, a.src = A, a.load()), S.current = 0, a.readyState > 0 && (a.currentTime = 0, S.current = null), de ? L(`start-segment:${r}`) : (s.current = !1, E.current = !1, a.pause(), f(!1), !0);
356
+ const $ = gt(b.audio_data), Ce = Math.max(
357
+ Number(s.seekTimeSeconds ?? 0),
358
+ 0
359
+ );
360
+ K.current = e, m.current = null, v.current = !1, N.current = !0, z.current = "segment", C(
361
+ G(e) + Ce * 1e3
362
+ );
363
+ const Ct = s.shouldResume ?? H();
364
+ c.current = Ct, l(!1);
365
+ const It = R.current !== $;
366
+ return U.current = "segment", It && (u.pause(), u.removeAttribute("src"), u.load(), R.current = $, u.src = $, u.load()), w.current = Ce, u.readyState > 0 && (u.currentTime = Ce, w.current = null), Ct ? L(`start-segment:${t}`) : (c.current = !1, N.current = !1, u.pause(), h(!1), !0);
271
367
  },
272
368
  [
273
- W,
274
- Ge,
275
- Z,
276
- w,
369
+ H,
370
+ gt,
371
+ G,
372
+ C,
277
373
  L,
278
- u
374
+ l
279
375
  ]
280
- ), X = t(
376
+ ), we = r(
281
377
  (e) => {
282
- p(), s.current = !1, _.current = !1, E.current = !1, i(), f(!1), u(!1), h >= 0 && je?.(h);
378
+ const t = M.current;
379
+ if (!t || !p || x)
380
+ return !1;
381
+ const s = Math.max(Number(e), 0), u = !t.paused && !t.ended || c.current || N.current || m.current !== null && se.current && !k.current, b = Lt(
382
+ j.current,
383
+ s
384
+ ) ? yr(
385
+ j.current,
386
+ s
387
+ ) : null;
388
+ if (be.current = null, g(), c.current = u, l(!1), u && (W.current = "manual", k.current = !1, B(!0)), b && (U.current === "segment" || !T))
389
+ return A(
390
+ b.segmentIndex,
391
+ "subtitle-seek-segment",
392
+ {
393
+ seekTimeSeconds: b.segmentTimeSeconds,
394
+ shouldResume: u
395
+ }
396
+ );
397
+ if (T) {
398
+ const $ = s / 1e3;
399
+ return R.current !== T && (t.pause(), t.removeAttribute("src"), t.load(), R.current = T, U.current = "url", z.current = "url", t.src = T, t.load()), w.current = $, C(s), t.readyState > 0 && (t.currentTime = $, w.current = null), u ? L("subtitle-seek-url") : (c.current = !1, t.pause(), h(!1), !0);
400
+ }
401
+ return !1;
283
402
  },
284
403
  [
285
- h,
286
- je,
287
404
  p,
288
- i,
289
- u
405
+ T,
406
+ x,
407
+ C,
408
+ A,
409
+ g,
410
+ L,
411
+ l,
412
+ B
290
413
  ]
291
- ), fe = t(
414
+ ), ie = r(
292
415
  (e) => {
293
- const r = y.current;
294
- return !r || U.current !== "url" || !Pr({
295
- currentTimeSeconds: Math.max(r.currentTime, 0),
296
- durationSeconds: r.duration
297
- }) ? !1 : (s.current = !1, r.pause(), X(e), !0);
416
+ const t = ce(
417
+ e,
418
+ ke(),
419
+ {
420
+ excludeTarget: e === "previous" ? ae.current : null
421
+ }
422
+ );
423
+ if (t === null)
424
+ return !1;
425
+ if (t.audioIndex === a) {
426
+ const u = we(t.timeMs);
427
+ return u && (ae.current = t), u;
428
+ }
429
+ const s = !!me?.(
430
+ t,
431
+ We(X())
432
+ );
433
+ return s && (ae.current = t), s;
434
+ },
435
+ [
436
+ a,
437
+ ke,
438
+ X,
439
+ ce,
440
+ me,
441
+ we
442
+ ]
443
+ ), ee = r(
444
+ (e) => {
445
+ g(), c.current = !1, v.current = !1, N.current = !1, y(), h(!1), l(!1), a >= 0 && $e?.(a);
446
+ },
447
+ [
448
+ a,
449
+ $e,
450
+ g,
451
+ y,
452
+ l
453
+ ]
454
+ ), Me = r(
455
+ (e) => {
456
+ const t = M.current;
457
+ return !t || U.current !== "url" || !lr({
458
+ currentTimeSeconds: Math.max(t.currentTime, 0),
459
+ durationSeconds: t.duration
460
+ }) ? !1 : (c.current = !1, t.pause(), ee(e), !0);
298
461
  },
299
- [X]
300
- ), er = t(() => {
301
- const e = R.current + 1, r = v.current, a = r[e], x = le.current, A = r.some((de) => de.is_final);
302
- if (a) {
303
- C(e, "ended");
462
+ [ee]
463
+ ), kt = r(() => {
464
+ const e = K.current + 1, t = j.current, s = t[e], u = he.current, b = t.some(($) => $.is_final);
465
+ if (s) {
466
+ A(e, "ended");
304
467
  return;
305
468
  }
306
- if (x?.isAudioStreaming || !A) {
307
- R.current = e, o.current = e, _.current = !0, s.current = g, w(Z(e)), f(!1), u(!0, "waitingForMoreAudio");
469
+ if (u?.isAudioStreaming || !b) {
470
+ K.current = e, m.current = e, v.current = !0, c.current = _, C(G(e)), h(!1), l(!0, "waitingForMoreAudio");
308
471
  return;
309
472
  }
310
- X("segments-completed");
473
+ ee("segments-completed");
311
474
  }, [
312
- g,
313
- X,
314
- Z,
315
- w,
475
+ _,
476
+ ee,
477
+ G,
316
478
  C,
317
- u
479
+ A,
480
+ l
318
481
  ]);
319
- m(() => {
320
- if (Ue.current === ge)
482
+ S(() => {
483
+ if (Ie.current === Ee)
321
484
  return;
322
- Ue.current = ge, R.current = 0, o.current = null, _.current = !1, b.current = !1, re.current = !1, s.current = !1, E.current = !1, U.current = null, q.current = null, P.current = null, p(), w(0), u(!1);
323
- const e = y.current;
324
- e && (e.pause(), e.removeAttribute("src"), e.load(), f(!1));
485
+ Ie.current = Ee, K.current = 0, m.current = null, v.current = !1, k.current = !1, le.current = !1, c.current = !1, N.current = !1, U.current = null, z.current = null, R.current = null, g(), C(0), l(!1);
486
+ const e = M.current;
487
+ e && (e.pause(), e.removeAttribute("src"), e.load(), h(!1));
325
488
  }, [
326
- h,
327
- ge,
328
- M.length,
329
- H,
330
- w,
331
- p,
332
- u
333
- ]), m(() => {
334
- const e = y.current;
489
+ a,
490
+ Ee,
491
+ E.length,
492
+ T,
493
+ C,
494
+ g,
495
+ l
496
+ ]), S(() => {
497
+ const e = M.current;
335
498
  if (e) {
336
- if (K) {
337
- re.current = !!(le.current && !b.current && (!e.paused || s.current || o.current !== null)), s.current = !1, u(!1), e.pause(), f(!1);
499
+ if (x) {
500
+ le.current = !!(he.current && !k.current && (!e.paused || c.current || m.current !== null)), c.current = !1, l(!1), e.pause(), h(!1);
338
501
  return;
339
502
  }
340
- if (!(!re.current || !le.current || b.current)) {
341
- if (re.current = !1, o.current !== null) {
342
- if (o.current < v.current.length) {
343
- C(o.current, "external-resume");
503
+ if (!(!le.current || !he.current || k.current)) {
504
+ if (le.current = !1, m.current !== null) {
505
+ if (m.current < j.current.length) {
506
+ A(m.current, "external-resume");
344
507
  return;
345
508
  }
346
- s.current = !0, u(!0, "waitingForMoreAudio");
509
+ c.current = !0, l(!0, "waitingForMoreAudio");
347
510
  return;
348
511
  }
349
- if (!P.current && v.current.length > 0) {
350
- C(
512
+ if (!R.current && j.current.length > 0) {
513
+ A(
351
514
  Math.min(
352
- R.current,
353
- v.current.length - 1
515
+ K.current,
516
+ j.current.length - 1
354
517
  ),
355
518
  "external-resume-init"
356
519
  );
357
520
  return;
358
521
  }
359
- e.paused && (s.current = !0, L("external-resume"));
522
+ e.paused && (c.current = !0, L("external-resume"));
360
523
  }
361
524
  }
362
525
  }, [
363
- K,
364
- C,
526
+ x,
527
+ A,
365
528
  L,
366
- u
367
- ]), m(() => {
368
- const e = y.current;
529
+ l
530
+ ]), S(() => {
531
+ const e = M.current;
369
532
  if (!e)
370
533
  return;
371
- if (!d) {
372
- D();
534
+ if (!p) {
535
+ q();
373
536
  return;
374
537
  }
375
- if (K) {
376
- s.current = !1, u(!1), e.pause(), f(!1);
538
+ if (x) {
539
+ c.current = !1, l(!1), e.pause(), h(!1);
377
540
  return;
378
541
  }
379
- const r = Hr({
542
+ const t = mr({
380
543
  activeSourceType: U.current,
381
- hasAudioUrl: !!H,
382
- segmentCount: M.length,
383
- preferredSourceType: q.current,
384
- waitingSegmentIndex: o.current
544
+ hasAudioUrl: !!T,
545
+ segmentCount: E.length,
546
+ preferredSourceType: z.current,
547
+ waitingSegmentIndex: m.current
385
548
  });
386
- if (r && q.current !== r && (q.current = r), r === "url" && H) {
387
- const a = P.current !== H, x = W();
388
- if (a) {
389
- const A = o.current !== null ? Je() : 0;
390
- e.pause(), e.removeAttribute("src"), e.load(), P.current = H, U.current = "url", e.src = H, e.load(), S.current = A, w(A * 1e3), e.readyState > 0 && (e.currentTime = A, S.current = null);
549
+ if (t && z.current !== t && (z.current = t), t === "url" && T) {
550
+ const s = R.current !== T, u = H();
551
+ if (s) {
552
+ const b = m.current !== null ? _t() : 0;
553
+ e.pause(), e.removeAttribute("src"), e.load(), R.current = T, U.current = "url", e.src = T, e.load(), w.current = b, C(b * 1e3), e.readyState > 0 && (e.currentTime = b, w.current = null);
391
554
  }
392
- if (s.current = x, _.current = !1, E.current = !1, u(!1), !x) {
393
- s.current = !1, e.pause(), f(!1);
555
+ if (c.current = u, v.current = !1, N.current = !1, l(!1), !u) {
556
+ c.current = !1, e.pause(), h(!1);
394
557
  return;
395
558
  }
396
- L(a ? "sync-url-init" : "sync-url");
559
+ L(s ? "sync-url-init" : "sync-url");
397
560
  return;
398
561
  }
399
- if (r === "segment" && o.current !== null) {
400
- if (o.current < M.length) {
401
- if (b.current) {
402
- f(!1), u(!1);
562
+ if (t === "segment" && m.current !== null) {
563
+ if (m.current < E.length) {
564
+ if (k.current) {
565
+ h(!1), l(!1);
403
566
  return;
404
567
  }
405
- C(o.current, "wait-resume");
568
+ A(m.current, "wait-resume");
406
569
  return;
407
570
  }
408
- _.current = !0, s.current = W(), f(!1), u(W());
571
+ v.current = !0, c.current = H(), h(!1), l(H());
409
572
  return;
410
573
  }
411
- if (r === "segment" && !M.length) {
412
- if (d.isAudioStreaming) {
413
- o.current = R.current, _.current = !0, s.current = W(), f(!1), u(W());
574
+ if (t === "segment" && !E.length) {
575
+ if (p.isAudioStreaming) {
576
+ m.current = K.current, v.current = !0, c.current = H(), h(!1), l(H());
414
577
  return;
415
578
  }
416
- D();
579
+ q();
417
580
  return;
418
581
  }
419
- if (r === "segment" && !P.current) {
420
- C(
582
+ if (t === "segment" && !R.current) {
583
+ A(
421
584
  Math.min(
422
- R.current,
423
- M.length - 1
585
+ K.current,
586
+ E.length - 1
424
587
  ),
425
588
  "effect-init"
426
589
  );
427
590
  return;
428
591
  }
429
- if (r !== "segment") {
430
- D();
592
+ if (t !== "segment") {
593
+ q();
431
594
  return;
432
595
  }
433
- if (!g || b.current) {
434
- s.current = !1, e.pause(), f(!1);
596
+ if (!_ || k.current) {
597
+ c.current = !1, e.pause(), h(!1);
435
598
  return;
436
599
  }
437
- e.paused && (s.current = !0, L("sync-paused-retry"));
600
+ e.paused && (c.current = !0, L("sync-paused-retry"));
438
601
  }, [
439
- d,
440
- h,
441
- M,
602
+ p,
603
+ a,
604
+ E,
605
+ T,
606
+ _,
607
+ x,
442
608
  H,
443
- g,
444
- K,
445
- W,
446
- w,
447
- D,
448
609
  C,
610
+ q,
611
+ A,
449
612
  L,
450
- Je,
451
- u
452
- ]), m(() => D, [D]), m(() => p, [p]);
453
- const br = t(() => {
454
- i(), Ie(), f(!0), u(!1), Me?.();
613
+ _t,
614
+ l
615
+ ]), S(() => {
616
+ if (!O || O.id === tt.current || O.audioIndex !== a)
617
+ return;
618
+ const e = f[O.audioIndex];
619
+ xe(e, O.timeMs) && (tt.current = O.id, we(O.timeMs));
455
620
  }, [
456
- Me,
457
- Ie,
458
- i,
459
- u
460
- ]), Sr = t(() => {
461
- _.current || E.current || (p(), i(), f(!1));
462
- }, [h, p, i]), gr = t(() => {
463
- const e = y.current;
464
- e && S.current !== null && (e.currentTime = S.current, S.current = null), i(), !fe("canplay-seek-finished") && (!s.current || !g || L("canplay"));
621
+ f,
622
+ xe,
623
+ a,
624
+ we,
625
+ O
626
+ ]), S(() => q, [q]), S(() => g, [g]);
627
+ const Ht = r(() => {
628
+ y(), xt(), h(!0), l(!1), Oe?.();
465
629
  }, [
466
- h,
467
- g,
468
- fe,
469
- i,
630
+ Oe,
631
+ xt,
632
+ y,
633
+ l
634
+ ]), $t = r(() => {
635
+ v.current || N.current || (g(), y(), h(!1));
636
+ }, [a, g, y]), Jt = r(() => {
637
+ const e = M.current;
638
+ e && w.current !== null && (e.currentTime = w.current, w.current = null), y(), !Me("canplay-seek-finished") && (!c.current || !_ || L("canplay"));
639
+ }, [
640
+ a,
641
+ _,
642
+ Me,
643
+ y,
470
644
  L
471
- ]), _r = t(() => {
472
- const e = y.current;
473
- e && S.current !== null && (e.currentTime = S.current, S.current = null), i(), fe("metadata-seek-finished");
474
- }, [h, fe, i]), wr = t(() => {
475
- i();
476
- }, [i]), xr = t(() => {
477
- _.current || u(!0, "loadingAudio");
478
- }, [u]), kr = t(() => {
479
- if (_.current) {
480
- u(!0, "waitingForMoreAudio");
645
+ ]), Zt = r(() => {
646
+ const e = M.current;
647
+ e && w.current !== null && (e.currentTime = w.current, w.current = null), y(), Me("metadata-seek-finished");
648
+ }, [a, Me, y]), zt = r(() => {
649
+ y();
650
+ }, [y]), Yt = r(() => {
651
+ v.current || l(!0, "loadingAudio");
652
+ }, [l]), Dt = r(() => {
653
+ if (v.current) {
654
+ l(!0, "waitingForMoreAudio");
481
655
  return;
482
656
  }
483
- u(!0, "loadingAudio");
484
- }, [u]), rr = t(() => {
485
- i();
486
- }, [i]), Mr = t(() => {
487
- const e = U.current === "url" || v.current.length === 0;
488
- if (p(), E.current = !1, e) {
489
- X("url-ended");
657
+ l(!0, "loadingAudio");
658
+ }, [l]), wt = r(() => {
659
+ y();
660
+ }, [y]), Xt = r(() => {
661
+ const e = U.current === "url" || j.current.length === 0;
662
+ if (g(), N.current = !1, e) {
663
+ ee("url-ended");
490
664
  return;
491
665
  }
492
- er();
493
- }, [X, er, p]), Lr = t(() => {
494
- p(), i(), f(!1), u(!1);
495
- }, [p, i, u]), Ar = t(
666
+ kt();
667
+ }, [ee, kt, g]), Gt = r(() => {
668
+ g(), y(), h(!1), l(!1);
669
+ }, [g, y, l]), Qt = r(
496
670
  (e) => {
497
- Ae?.(e), z(!1);
671
+ He?.(e), Q(!1);
498
672
  },
499
- [Ae]
500
- ), _e = t(() => {
501
- if (N) {
502
- const r = !O;
503
- return $(r), Re?.(r), !0;
673
+ [He]
674
+ ), Ke = r(() => {
675
+ if (F) {
676
+ const t = !Z;
677
+ return B(t), Je?.(t), !0;
504
678
  }
505
- const e = y.current;
506
- return K || !e || !d ? !1 : o.current !== null ? oe ? ($(!1), s.current = !1, b.current = !0, o.current = null, _.current = !1, f(!1), u(!1), e.pause(), !0) : ($(!0), F.current = "manual", b.current = !1, s.current = !0, u(!0, "waitingForMoreAudio"), !0) : !e.src && M.length > 0 ? ($(!0), F.current = "manual", b.current = !1, C(
679
+ const e = M.current;
680
+ return x || !e || !p ? !1 : m.current !== null ? Se ? (B(!1), c.current = !1, k.current = !0, m.current = null, v.current = !1, h(!1), l(!1), e.pause(), !0) : (B(!0), W.current = "manual", k.current = !1, c.current = !0, l(!0, "waitingForMoreAudio"), !0) : !e.src && E.length > 0 ? (B(!0), W.current = "manual", k.current = !1, A(
507
681
  Math.min(
508
- R.current,
509
- M.length - 1
682
+ K.current,
683
+ E.length - 1
510
684
  ),
511
685
  "toggle"
512
- ), !0) : e.paused ? ($(!0), F.current = "manual", b.current = !1, s.current = !0, L("toggle-resume"), !0) : ($(!1), s.current = !1, b.current = !0, e.pause(), !0);
686
+ ), !0) : e.paused ? (B(!0), W.current = "manual", k.current = !1, c.current = !0, L("toggle-resume"), !0) : (B(!1), c.current = !1, k.current = !0, e.pause(), !0);
513
687
  }, [
514
- d,
515
- M.length,
516
- O,
517
- K,
518
- oe,
519
- Re,
520
- C,
688
+ p,
689
+ E.length,
690
+ Z,
691
+ x,
692
+ Se,
693
+ Je,
694
+ A,
521
695
  L,
522
- u,
523
- $,
524
- N
696
+ l,
697
+ B,
698
+ F
525
699
  ]);
526
- m(() => {
527
- if (T)
528
- return Wr(V);
529
- }, [V, T]);
530
- const we = G(
700
+ S(() => {
701
+ if (P)
702
+ return ir(D);
703
+ }, [D, P]);
704
+ const Ue = te(
531
705
  () => ({
532
- fullscreen: () => I ? (I(), !0) : !1,
533
- interaction: () => se ? (me && se(), !0) : !1,
534
- next: () => ae ? (ye || ae(
535
- ar(te())
706
+ fullscreen: () => ne ? (ne(), !0) : !1,
707
+ interaction: () => pe ? (Le && pe(), !0) : !1,
708
+ next: () => de ? (je || de(
709
+ We(X())
536
710
  ), !0) : !1,
537
- previous: () => ue ? (he || ue(
538
- ar(te())
711
+ nextSubtitle: () => I.next ? ie("next") : !0,
712
+ previous: () => fe ? (Ae || fe(
713
+ We(X())
539
714
  ), !0) : !1,
540
- subtitle: () => Q ? (Q(), !0) : !1,
541
- togglePlayback: () => (_e(), !0)
715
+ previousSubtitle: () => I.previous ? ie("previous") : !0,
716
+ subtitle: () => re ? (re(), !0) : !1,
717
+ togglePlayback: () => (Ke(), !0)
542
718
  }),
543
719
  [
544
- te,
545
- me,
546
- ye,
547
- I,
548
- se,
549
- ae,
550
- ue,
551
- Q,
552
- he,
553
- _e
720
+ X,
721
+ Le,
722
+ ie,
723
+ je,
724
+ ne,
725
+ pe,
726
+ de,
727
+ fe,
728
+ re,
729
+ Ae,
730
+ I.next,
731
+ I.previous,
732
+ Ke
554
733
  ]
555
- ), tr = c(we);
556
- return m(() => {
557
- tr.current = we;
558
- }, [we]), m(() => {
559
- if (!T || typeof document > "u")
734
+ ), Mt = o(Ue);
735
+ return S(() => {
736
+ Mt.current = Ue;
737
+ }, [Ue]), S(() => {
738
+ if (!P || typeof document > "u")
560
739
  return;
561
- const e = (r) => {
562
- if (!Or(V))
740
+ const e = (t) => {
741
+ if (!or(D))
563
742
  return;
564
- const a = Br(r);
565
- if (!a || Vr(r, a))
743
+ const s = fr(t);
744
+ if (!s || dr(t, s))
566
745
  return;
567
- let x = !1;
568
- const A = tr.current[a];
569
- x = A(), x && r.preventDefault();
746
+ let u = !1;
747
+ const b = Mt.current[s];
748
+ u = b(), u && t.preventDefault();
570
749
  };
571
750
  return document.addEventListener("keydown", e), () => {
572
751
  document.removeEventListener("keydown", e);
573
752
  };
574
- }, [V, T]), m(() => {
575
- ne?.(Se.current);
576
- }, [ne]), /* @__PURE__ */ n.jsxs(
753
+ }, [D, P]), S(() => {
754
+ oe?.(ye.current);
755
+ }, [oe]), /* @__PURE__ */ n.jsxs(
577
756
  "div",
578
757
  {
579
- ...fr,
580
- "data-slide-player-shortcut-owner": V,
581
- className: ur("slide-player", j),
582
- onFocusCapture: yr,
583
- onPointerDown: hr,
758
+ ...Kt,
759
+ "data-slide-player-shortcut-owner": D,
760
+ className: Tt("slide-player", d),
761
+ onFocusCapture: Vt,
762
+ onPointerDown: Ot,
584
763
  children: [
585
764
  /* @__PURE__ */ n.jsx(
586
765
  "audio",
587
766
  {
588
- ref: y,
767
+ ref: M,
589
768
  preload: "auto",
590
769
  playsInline: !0,
591
- onLoadStart: xr,
592
- onLoadedMetadata: _r,
593
- onCanPlay: gr,
594
- onPlay: br,
595
- onPause: Sr,
596
- onWaiting: kr,
597
- onSeeking: rr,
598
- onSeeked: rr,
599
- onTimeUpdate: wr,
600
- onEnded: Mr,
601
- onError: Lr
770
+ onLoadStart: Yt,
771
+ onLoadedMetadata: Zt,
772
+ onCanPlay: Jt,
773
+ onPlay: Ht,
774
+ onPause: $t,
775
+ onWaiting: Dt,
776
+ onSeeking: wt,
777
+ onSeeked: wt,
778
+ onTimeUpdate: zt,
779
+ onEnded: Xt,
780
+ onError: Gt
602
781
  }
603
782
  ),
604
- be ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
783
+ Ne ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
605
784
  /* @__PURE__ */ n.jsx(
606
- vr,
785
+ nr,
607
786
  {
608
- container: or,
787
+ container: Et,
609
788
  labels: {
610
- closeSettings: l.closeSettingsLabel,
611
- fullscreen: l.fullscreenLabel,
612
- nonFullscreen: l.nonFullscreenLabel,
613
- screen: l.screenLabel,
614
- screenMode: l.screenModeLabel,
615
- subtitle: l.subtitleLabel,
616
- subtitleToggle: l.subtitleToggleAriaLabel,
617
- title: l.settingsTitle
789
+ closeSettings: i.closeSettingsLabel,
790
+ fullscreen: i.fullscreenLabel,
791
+ nonFullscreen: i.nonFullscreenLabel,
792
+ screen: i.screenLabel,
793
+ screenMode: i.screenModeLabel,
794
+ subtitle: i.subtitleLabel,
795
+ subtitleToggle: i.subtitleToggleAriaLabel,
796
+ title: i.settingsTitle
618
797
  },
619
- isSubtitleEnabled: pe,
620
- onClose: () => z(!1),
621
- onOpenChange: z,
622
- onSubtitleToggle: Q ?? (() => {
798
+ isSubtitleEnabled: ve,
799
+ onClose: () => Q(!1),
800
+ onOpenChange: Q,
801
+ onSubtitleToggle: re ?? (() => {
623
802
  }),
624
- onViewModeChange: Ar,
625
- open: We,
626
- viewMode: cr
803
+ onViewModeChange: Qt,
804
+ open: nt,
805
+ viewMode: Nt
627
806
  }
628
807
  ),
629
- /* @__PURE__ */ n.jsxs("div", { className: "slide-player__controls", style: mr, children: [
808
+ /* @__PURE__ */ n.jsxs("div", { className: "slide-player__controls", style: Pt, children: [
630
809
  /* @__PURE__ */ n.jsxs("div", { className: "slide-player__group", children: [
631
810
  /* @__PURE__ */ n.jsx(
632
811
  "button",
633
812
  {
634
- "aria-expanded": We,
813
+ "aria-expanded": nt,
635
814
  "aria-haspopup": "dialog",
636
- "aria-label": l.moreOptionsAriaLabel,
815
+ "aria-label": i.moreOptionsAriaLabel,
637
816
  className: "slide-player__action slide-player__action--mobile-more",
638
817
  onClick: () => {
639
- z((e) => !e);
818
+ Q((e) => !e);
640
819
  },
641
820
  type: "button",
642
821
  children: /* @__PURE__ */ n.jsx(
643
- qr,
822
+ gr,
644
823
  {
645
824
  className: "slide-player__icon",
646
825
  strokeWidth: 2.25
@@ -651,24 +830,55 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
651
830
  /* @__PURE__ */ n.jsx(
652
831
  "button",
653
832
  {
654
- "aria-label": l.volumeAriaLabel,
833
+ "aria-label": i.volumeAriaLabel,
655
834
  className: "hidden",
656
835
  type: "button",
657
- children: /* @__PURE__ */ n.jsx(zr, { className: "slide-player__icon", strokeWidth: 2.25 })
836
+ children: /* @__PURE__ */ n.jsx(_r, { className: "slide-player__icon", strokeWidth: 2.25 })
658
837
  }
659
838
  ),
660
839
  /* @__PURE__ */ n.jsx(
661
840
  "button",
662
841
  {
663
- "aria-label": l.subtitleToggleAriaLabel,
664
- "aria-keyshortcuts": $e.ariaKeyShortcuts,
665
- "aria-pressed": pe,
666
- className: "slide-player__action slide-player__action--subtitle",
667
- onClick: Q,
668
- title: $e.title,
842
+ "aria-label": ct,
843
+ "aria-keyshortcuts": mt.ariaKeyShortcuts,
844
+ className: "slide-player__toggle slide-player__toggle--playback",
845
+ onClick: () => {
846
+ Ke();
847
+ },
848
+ title: mt.title,
669
849
  type: "button",
670
- children: pe ? /* @__PURE__ */ n.jsx(Yr, { className: "slide-player__icon", strokeWidth: 2.25 }) : /* @__PURE__ */ n.jsx(
671
- Dr,
850
+ children: Bt ? /* @__PURE__ */ n.jsx(Er, {}) : /* @__PURE__ */ n.jsx(Rr, {})
851
+ }
852
+ ),
853
+ /* @__PURE__ */ n.jsx(
854
+ "button",
855
+ {
856
+ "aria-keyshortcuts": ft.ariaKeyShortcuts,
857
+ "aria-label": i.previousLabel,
858
+ className: "slide-player__action slide-player__action--prev",
859
+ disabled: Ae,
860
+ onClick: () => {
861
+ fe?.(X());
862
+ },
863
+ title: ft.title,
864
+ type: "button",
865
+ children: /* @__PURE__ */ n.jsx(xr, { className: "slide-player__icon", strokeWidth: 2.25 })
866
+ }
867
+ ),
868
+ /* @__PURE__ */ n.jsx(
869
+ "button",
870
+ {
871
+ "aria-keyshortcuts": pt.ariaKeyShortcuts,
872
+ "aria-label": i.nextLabel,
873
+ className: "slide-player__action slide-player__action--next",
874
+ disabled: je,
875
+ onClick: () => {
876
+ de?.(X());
877
+ },
878
+ title: pt.title,
879
+ type: "button",
880
+ children: /* @__PURE__ */ n.jsx(
881
+ kr,
672
882
  {
673
883
  className: "slide-player__icon",
674
884
  strokeWidth: 2.25
@@ -679,64 +889,75 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
679
889
  /* @__PURE__ */ n.jsx(
680
890
  "button",
681
891
  {
682
- "aria-keyshortcuts": Ze.ariaKeyShortcuts,
683
- "aria-label": l.previousLabel,
684
- className: "slide-player__action slide-player__action--prev",
685
- disabled: he,
892
+ "aria-keyshortcuts": dt.ariaKeyShortcuts,
893
+ "aria-label": i.previousSubtitleLabel,
894
+ className: "slide-player__action slide-player__action--prev-subtitle",
895
+ disabled: !I.previous,
686
896
  onClick: () => {
687
- ue?.(te());
897
+ ie("previous");
688
898
  },
689
- title: Ze.title,
899
+ title: dt.title,
690
900
  type: "button",
691
- children: /* @__PURE__ */ n.jsx(Xr, { className: "slide-player__icon", strokeWidth: 2.25 })
901
+ children: /* @__PURE__ */ n.jsx(wr, { className: "slide-player__icon", strokeWidth: 2.25 })
692
902
  }
693
903
  ),
694
904
  /* @__PURE__ */ n.jsx(
695
905
  "button",
696
906
  {
697
- "aria-label": Ve,
698
- "aria-keyshortcuts": qe.ariaKeyShortcuts,
699
- className: "slide-player__toggle slide-player__toggle--playback",
907
+ "aria-keyshortcuts": ht.ariaKeyShortcuts,
908
+ "aria-label": i.nextSubtitleLabel,
909
+ className: "slide-player__action slide-player__action--next-subtitle",
910
+ disabled: !I.next,
700
911
  onClick: () => {
701
- _e();
912
+ ie("next");
702
913
  },
703
- title: qe.title,
914
+ title: ht.title,
704
915
  type: "button",
705
- children: pr ? /* @__PURE__ */ n.jsx(et, {}) : /* @__PURE__ */ n.jsx(rt, {})
916
+ children: /* @__PURE__ */ n.jsx(
917
+ Mr,
918
+ {
919
+ className: "slide-player__icon",
920
+ strokeWidth: 2.25
921
+ }
922
+ )
706
923
  }
707
924
  ),
708
925
  /* @__PURE__ */ n.jsx(
709
926
  "button",
710
927
  {
711
- "aria-keyshortcuts": ze.ariaKeyShortcuts,
712
- "aria-label": l.nextLabel,
713
- className: "slide-player__action slide-player__action--next",
714
- disabled: ye,
715
- onClick: () => {
716
- ae?.(te());
717
- },
718
- title: ze.title,
928
+ "aria-label": i.subtitleToggleAriaLabel,
929
+ "aria-keyshortcuts": ot.ariaKeyShortcuts,
930
+ "aria-pressed": ve,
931
+ className: "slide-player__action slide-player__action--subtitle",
932
+ onClick: re,
933
+ title: ot.title,
719
934
  type: "button",
720
- children: /* @__PURE__ */ n.jsx(Gr, { className: "slide-player__icon", strokeWidth: 2.25 })
935
+ children: ve ? /* @__PURE__ */ n.jsx(Cr, { className: "slide-player__icon", strokeWidth: 2.25 }) : /* @__PURE__ */ n.jsx(
936
+ Tr,
937
+ {
938
+ className: "slide-player__icon",
939
+ strokeWidth: 2.25
940
+ }
941
+ )
721
942
  }
722
943
  ),
723
- I ? /* @__PURE__ */ n.jsx(
944
+ ne ? /* @__PURE__ */ n.jsx(
724
945
  "button",
725
946
  {
726
- "aria-label": He,
727
- "aria-keyshortcuts": Ye.ariaKeyShortcuts,
947
+ "aria-label": it,
948
+ "aria-keyshortcuts": yt.ariaKeyShortcuts,
728
949
  className: "slide-player__action slide-player__action--fullscreen",
729
- onClick: I,
730
- title: Ye.title,
950
+ onClick: ne,
951
+ title: yt.title,
731
952
  type: "button",
732
- children: Le ? /* @__PURE__ */ n.jsx(
733
- Jr,
953
+ children: Ve ? /* @__PURE__ */ n.jsx(
954
+ Lr,
734
955
  {
735
956
  className: "slide-player__icon",
736
957
  strokeWidth: 2.25
737
958
  }
738
959
  ) : /* @__PURE__ */ n.jsx(
739
- Qr,
960
+ vr,
740
961
  {
741
962
  className: "slide-player__icon",
742
963
  strokeWidth: 2.25
@@ -747,22 +968,22 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
747
968
  ] }),
748
969
  /* @__PURE__ */ n.jsx("div", { className: "slide-player__separator" }),
749
970
  /* @__PURE__ */ n.jsxs("div", { className: "slide-player__group", children: [
750
- Oe.map((e, r) => /* @__PURE__ */ n.jsx(Rr.Fragment, { children: e }, `custom-action-${r}`)),
971
+ lt.map((e, t) => /* @__PURE__ */ n.jsx(qt.Fragment, { children: e }, `custom-action-${t}`)),
751
972
  /* @__PURE__ */ n.jsx(
752
973
  "button",
753
974
  {
754
- "aria-label": l.notesLabel,
755
- "aria-keyshortcuts": De.ariaKeyShortcuts,
756
- className: ur(
975
+ "aria-label": i.notesLabel,
976
+ "aria-keyshortcuts": bt.ariaKeyShortcuts,
977
+ className: Tt(
757
978
  "slide-player__action slide-player__action--notes",
758
- ee && "slide-player__action--active"
979
+ ue && "slide-player__action--active"
759
980
  ),
760
- disabled: !me,
761
- onClick: se,
762
- title: De.title,
981
+ disabled: !Le,
982
+ onClick: pe,
983
+ title: bt.title,
763
984
  type: "button",
764
985
  children: /* @__PURE__ */ n.jsx(
765
- Ir,
986
+ Ar,
766
987
  {
767
988
  className: "slide-player__icon",
768
989
  strokeWidth: 2.25
@@ -776,9 +997,9 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
776
997
  ]
777
998
  }
778
999
  );
779
- }, ut = Er(nt);
780
- ut.displayName = "Player";
1000
+ }, Wr = er(Fr);
1001
+ Wr.displayName = "Player";
781
1002
  export {
782
- ut as default
1003
+ Wr as default
783
1004
  };
784
1005
  //# sourceMappingURL=Player.es.js.map