markdown-flow-ui 0.1.115-beta.4 → 0.1.115-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,27 @@
1
- import { j as r } from "../../_virtual/jsx-runtime.es.js";
2
- import Ie, { memo as er, useRef as c, useState as je, useMemo as O, useEffect as x, useCallback as u } from "react";
3
- import { cn as ke } from "../../lib/utils.es.js";
4
- import rr from "./MobilePlayerSettingsSheet.es.js";
5
- import { DEFAULT_SLIDE_PLAYER_TEXTS as tr } from "./constants.es.js";
6
- import { DEFAULT_MOBILE_VIEW_MODE as nr } from "./utils/mobileScreenMode.es.js";
7
- import { toPlayerCustomActionList as ur } from "./utils/playerCustomActions.es.js";
1
+ import { j as t } from "../../_virtual/jsx-runtime.es.js";
2
+ import er, { memo as rr, useRef as c, useState as ke, useMemo as q, useEffect as S, useCallback as u } from "react";
3
+ import { cn as Ee } from "../../lib/utils.es.js";
4
+ import tr from "./MobilePlayerSettingsSheet.es.js";
5
+ import { DEFAULT_SLIDE_PLAYER_TEXTS as nr } from "./constants.es.js";
6
+ import { DEFAULT_MOBILE_VIEW_MODE as ur } from "./utils/mobileScreenMode.es.js";
7
+ import { hasReachedAudioEnd as sr } from "./utils/audioCompletion.es.js";
8
+ import { toPlayerCustomActionList as lr } from "./utils/playerCustomActions.es.js";
8
9
  /* empty css */
9
- import lr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js";
10
- import sr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.es.js";
11
- import ar from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions.es.js";
12
- import cr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions-off.es.js";
13
- import ir from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js";
14
- import or from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js";
15
- import fr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/scan-line.es.js";
16
- import dr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.es.js";
17
- import mr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js";
18
- const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
19
- if (typeof window > "u" || !R || Ee.has(R))
10
+ import ar from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js";
11
+ import cr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.es.js";
12
+ import ir from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions.es.js";
13
+ import or from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions-off.es.js";
14
+ import fr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js";
15
+ import dr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js";
16
+ import mr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/scan-line.es.js";
17
+ import pr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.es.js";
18
+ import hr from "../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js";
19
+ const Ne = /* @__PURE__ */ new Map(), Re = (R) => {
20
+ if (typeof window > "u" || !R || Ne.has(R))
20
21
  return;
21
- const L = window.document.createElement("audio");
22
- L.preload = "auto", L.setAttribute("playsinline", "true"), L.src = R, L.load(), Ee.set(R, L);
23
- }, pr = () => /* @__PURE__ */ r.jsxs(
22
+ const v = window.document.createElement("audio");
23
+ v.preload = "auto", v.setAttribute("playsinline", "true"), v.src = R, v.load(), Ne.set(R, v);
24
+ }, gr = () => /* @__PURE__ */ t.jsxs(
24
25
  "svg",
25
26
  {
26
27
  xmlns: "http://www.w3.org/2000/svg",
@@ -29,17 +30,17 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
29
30
  viewBox: "0 0 34 34",
30
31
  fill: "none",
31
32
  children: [
32
- /* @__PURE__ */ r.jsx(
33
+ /* @__PURE__ */ t.jsx(
33
34
  "path",
34
35
  {
35
36
  d: "M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",
36
37
  fill: "#0A0A0A"
37
38
  }
38
39
  ),
39
- /* @__PURE__ */ r.jsx("path", { d: "M12 10H16V24H12V10ZM18 10H22V24H18V10Z", fill: "white" })
40
+ /* @__PURE__ */ t.jsx("path", { d: "M12 10H16V24H12V10ZM18 10H22V24H18V10Z", fill: "white" })
40
41
  ]
41
42
  }
42
- ), hr = () => /* @__PURE__ */ r.jsxs(
43
+ ), yr = () => /* @__PURE__ */ t.jsxs(
43
44
  "svg",
44
45
  {
45
46
  xmlns: "http://www.w3.org/2000/svg",
@@ -48,294 +49,303 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
48
49
  viewBox: "0 0 34 34",
49
50
  fill: "none",
50
51
  children: [
51
- /* @__PURE__ */ r.jsx(
52
+ /* @__PURE__ */ t.jsx(
52
53
  "path",
53
54
  {
54
55
  d: "M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",
55
56
  fill: "#0A0A0A"
56
57
  }
57
58
  ),
58
- /* @__PURE__ */ r.jsx("path", { d: "M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z", fill: "white" })
59
+ /* @__PURE__ */ t.jsx("path", { d: "M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z", fill: "white" })
59
60
  ]
60
61
  }
61
- ), gr = ({
62
+ ), _r = ({
62
63
  audioList: R = [],
63
- className: L,
64
+ className: v,
64
65
  currentAudioIndex: m = -1,
65
66
  defaultPlaying: A = !0,
66
- isPlaybackPaused: v = !1,
67
- isAutoAdvanceEnabled: Y = !0,
68
- useAutoAdvanceToggle: G = !1,
69
- onLoadingChange: te,
70
- onPlaybackStarted: ne,
71
- onPlaybackTimeChange: q,
72
- onSubtitleToggle: ue,
73
- onPrev: Re,
74
- onNext: Te,
67
+ isPlaybackPaused: F = !1,
68
+ isAutoAdvanceEnabled: G = !0,
69
+ useAutoAdvanceToggle: J = !1,
70
+ onLoadingChange: ne,
71
+ onPlaybackStarted: ue,
72
+ onPlaybackTimeChange: z,
73
+ onSubtitleToggle: se,
74
+ onPrev: Te,
75
+ onNext: Ce,
75
76
  onFullscreen: le,
76
- isFullscreen: se = !1,
77
- mobileViewMode: Ce = nr,
78
- settingsPortalContainer: Le,
79
- onMobileViewModeChange: ae,
80
- onEnded: ce,
81
- onAutoAdvanceToggle: ve,
82
- onInteractionToggle: Fe,
83
- hasInteraction: Ue = !1,
84
- isInteractionOpen: Z = !1,
85
- isSubtitleEnabled: J = !0,
86
- prevDisabled: We = !1,
87
- nextDisabled: Pe = !1,
88
- showControls: Q = !0,
89
- customActions: ie,
90
- customActionContext: oe,
91
- texts: fe,
92
- ...Ve
77
+ isFullscreen: ae = !1,
78
+ mobileViewMode: Le = ur,
79
+ settingsPortalContainer: ve,
80
+ onMobileViewModeChange: ce,
81
+ onEnded: ie,
82
+ onAutoAdvanceToggle: Fe,
83
+ onInteractionToggle: Ue,
84
+ hasInteraction: We = !1,
85
+ isInteractionOpen: $ = !1,
86
+ isSubtitleEnabled: Q = !0,
87
+ prevDisabled: Pe = !1,
88
+ nextDisabled: Ve = !1,
89
+ showControls: I = !0,
90
+ customActions: oe,
91
+ customActionContext: fe,
92
+ texts: de,
93
+ ...Be
93
94
  }) => {
94
- const h = c(null), de = c(Z), M = c(null), me = c(null), S = c(0), a = c(null), z = c(void 0), j = c([]), $ = c(!1), pe = c(!1), g = c(!1), F = c(null), y = c(!1), l = c(!1), p = c(null), w = c(!1), U = c(null), I = c(0), T = c("unknown"), [ee, i] = je(A), [he, B] = je(!1), f = m >= 0 ? R[m] : void 0, K = f?.audioUrl, k = O(
95
+ const p = c(null), me = c($), M = c(null), pe = c(null), x = c(0), a = c(null), D = c(void 0), j = c([]), H = c(!1), he = c(!1), g = c(!1), T = c(null), y = c(!1), s = c(!1), h = c(null), w = c(!1), U = c(null), ee = c(0), C = c("unknown"), [re, i] = ke(A), [ge, B] = ke(!1), f = m >= 0 ? R[m] : void 0, K = f?.audioUrl, k = q(
95
96
  () => [...f?.audioSegments ?? []].sort(
96
- (e, n) => e.segment_index - n.segment_index
97
+ (e, r) => e.segment_index - r.segment_index
97
98
  ),
98
99
  [f?.audioSegments]
99
- ), ge = O(
100
- () => ur(ie, oe),
101
- [oe, ie]
102
- ), ye = ge.length + 5, Be = O(
100
+ ), ye = q(
101
+ () => lr(oe, fe),
102
+ [fe, oe]
103
+ ), _e = ye.length + 5, Ke = q(
103
104
  () => ({
104
- "--slide-player-mobile-control-count": String(ye)
105
+ "--slide-player-mobile-control-count": String(_e)
105
106
  }),
106
- [ye]
107
- ), W = O(
107
+ [_e]
108
+ ), W = q(
108
109
  () => ({
109
- ...tr,
110
- ...fe
110
+ ...nr,
111
+ ...de
111
112
  }),
112
- [fe]
113
- ), re = O(() => f ? f.audioKey ?? `${String(f.sequenceNumber ?? "none")}:${String(f.audioUrl ?? "")}` : "none", [f]), Ke = G ? Y : ee, Ze = G ? Y ? "Pause autoplay" : "Play autoplay" : ee ? "Pause" : "Play";
114
- x(() => {
115
- z.current = f;
116
- }, [f]), x(() => {
117
- Q || B(!1);
118
- }, [Q]), x(() => {
119
- !de.current && Z && B(!1), de.current = Z;
120
- }, [Z]), x(() => {
113
+ [de]
114
+ ), te = q(() => f ? f.audioKey ?? `${String(f.sequenceNumber ?? "none")}:${String(f.audioUrl ?? "")}` : "none", [f]), Ze = J ? G : re, $e = J ? G ? "Pause autoplay" : "Play autoplay" : re ? "Pause" : "Play";
115
+ S(() => {
116
+ D.current = f;
117
+ }, [f]), S(() => {
118
+ I || B(!1);
119
+ }, [I]), S(() => {
120
+ !me.current && $ && B(!1), me.current = $;
121
+ }, [$]), S(() => {
121
122
  j.current = k;
122
- }, [k]), x(() => {
123
- const e = f?.audioUrl, n = m >= 0 ? R[m + 1]?.audioUrl : void 0;
124
- Ne(e), Ne(n);
123
+ }, [k]), S(() => {
124
+ const e = f?.audioUrl, r = m >= 0 ? R[m + 1]?.audioUrl : void 0;
125
+ Re(e), Re(r);
125
126
  }, [R, f?.audioUrl, m]);
126
- const t = u(
127
- (e, n = null) => {
128
- pe.current === e && (!e || n === null) || (pe.current = e, te?.({
127
+ const n = u(
128
+ (e, r = null) => {
129
+ he.current === e && (!e || r === null) || (he.current = e, ne?.({
129
130
  loading: e,
130
- reason: e ? n : null
131
+ reason: e ? r : null
131
132
  }));
132
133
  },
133
- [te]
134
- ), _e = u((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), C = u(() => A && !v && !g.current && T.current !== "blocked", [A, v]), be = u((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), xe = u(() => {
134
+ [ne]
135
+ ), be = u((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), L = u(() => A && !F && !g.current && C.current !== "blocked", [A, F]), Se = u((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), xe = u(() => {
135
136
  const e = a.current;
136
137
  return e == null || e <= 0 ? 0 : j.current.slice(0, e).reduce(
137
- (n, s) => n + Math.max(Number(s.duration_ms ?? 0), 0),
138
+ (r, l) => r + Math.max(Number(l.duration_ms ?? 0), 0),
138
139
  0
139
140
  ) / 1e3;
140
141
  }, []), P = u((e) => e <= 0 ? 0 : j.current.slice(0, e).reduce(
141
- (n, s) => n + Math.max(Number(s.duration_ms ?? 0), 0),
142
+ (r, l) => r + Math.max(Number(l.duration_ms ?? 0), 0),
142
143
  0
143
- ), []), Se = u(() => {
144
- const e = h.current;
145
- return e ? F.current === "segment" ? P(S.current) + Math.max(e.currentTime, 0) * 1e3 : p.current !== null && e.readyState === 0 ? p.current * 1e3 : Math.max(e.currentTime, 0) * 1e3 : a.current != null ? P(a.current) : 0;
144
+ ), []), we = u(() => {
145
+ const e = p.current;
146
+ return e ? T.current === "segment" ? P(x.current) + Math.max(e.currentTime, 0) * 1e3 : h.current !== null && e.readyState === 0 ? h.current * 1e3 : Math.max(e.currentTime, 0) * 1e3 : a.current != null ? P(a.current) : 0;
146
147
  }, [P]), _ = u(
147
148
  (e) => {
148
- const n = Math.max(e, 0);
149
- I.current !== n && (I.current = n, q?.(n));
149
+ const r = Math.max(e, 0);
150
+ ee.current !== r && (ee.current = r, z?.(r));
150
151
  },
151
- [q]
152
+ [z]
152
153
  ), o = u(() => {
153
- _(Se());
154
- }, [Se, _]), d = u(() => {
154
+ _(we());
155
+ }, [we, _]), d = u(() => {
155
156
  typeof window > "u" || U.current === null || (window.cancelAnimationFrame(U.current), U.current = null);
156
- }, []), we = u(() => {
157
+ }, []), Ae = u(() => {
157
158
  if (typeof window > "u" || U.current !== null)
158
159
  return;
159
160
  const e = () => {
160
161
  o();
161
- const n = h.current;
162
- if (!n || n.paused || n.ended) {
162
+ const r = p.current;
163
+ if (!r || r.paused || r.ended) {
163
164
  U.current = null;
164
165
  return;
165
166
  }
166
167
  U.current = window.requestAnimationFrame(e);
167
168
  };
168
169
  U.current = window.requestAnimationFrame(e);
169
- }, [o]), H = u(() => {
170
- const e = h.current;
171
- e && (d(), l.current = !1, g.current = !1, $.current = !1, F.current = null, p.current = null, y.current = !1, w.current = !1, e.pause(), e.removeAttribute("src"), e.load(), M.current = null, S.current = 0, a.current = null, _(0), i(!1), t(!1));
172
- }, [_, d, t]), b = u(
170
+ }, [o]), O = u(() => {
171
+ const e = p.current;
172
+ e && (d(), s.current = !1, g.current = !1, H.current = !1, T.current = null, h.current = null, y.current = !1, w.current = !1, e.pause(), e.removeAttribute("src"), e.load(), M.current = null, x.current = 0, a.current = null, _(0), i(!1), n(!1));
173
+ }, [_, d, n]), b = u(
173
174
  (e) => {
174
- const n = h.current;
175
- if (!n)
175
+ const r = p.current;
176
+ if (!r)
176
177
  return !1;
177
- const s = n.play();
178
- return s && typeof s.then == "function" && s.then(() => {
179
- T.current === "unknown" && (T.current = "auto"), l.current = !1, w.current = !1;
178
+ const l = r.play();
179
+ return l && typeof l.then == "function" && l.then(() => {
180
+ C.current === "unknown" && (C.current = "auto"), s.current = !1, w.current = !1;
180
181
  }).catch((V) => {
181
- T.current === "unknown" && _e(V) && (T.current = "blocked", l.current = !1, t(!1)), w.current = !1, i(!1);
182
+ C.current === "unknown" && be(V) && (C.current = "blocked", s.current = !1, n(!1)), w.current = !1, i(!1);
182
183
  }), !0;
183
184
  },
184
- [_e, t]
185
+ [be, n]
185
186
  ), E = u(
186
- (e, n) => {
187
- const s = h.current, V = j.current[e];
188
- if (!s || !V)
187
+ (e, r) => {
188
+ const l = p.current, V = j.current[e];
189
+ if (!l || !V)
189
190
  return !1;
190
- const N = be(V.audio_data);
191
- S.current = e, a.current = null, y.current = !1, w.current = !0, _(P(e));
192
- const X = C();
193
- l.current = X, t(!1);
194
- const Qe = M.current !== N;
195
- return F.current = "segment", Qe && (s.pause(), s.removeAttribute("src"), s.load(), M.current = N, s.src = N, s.load()), p.current = 0, s.readyState > 0 && (s.currentTime = 0, p.current = null), X ? b(`start-segment:${n}`) : (l.current = !1, w.current = !1, s.pause(), i(!1), !0);
191
+ const N = Se(V.audio_data);
192
+ x.current = e, a.current = null, y.current = !1, w.current = !0, _(P(e));
193
+ const Y = L();
194
+ s.current = Y, n(!1);
195
+ const Ie = M.current !== N;
196
+ return T.current = "segment", Ie && (l.pause(), l.removeAttribute("src"), l.load(), M.current = N, l.src = N, l.load()), h.current = 0, l.readyState > 0 && (l.currentTime = 0, h.current = null), Y ? b(`start-segment:${r}`) : (s.current = !1, w.current = !1, l.pause(), i(!1), !0);
196
197
  },
197
198
  [
198
- C,
199
- be,
199
+ L,
200
+ Se,
200
201
  P,
201
202
  _,
202
203
  b,
203
- t
204
+ n
204
205
  ]
205
- ), D = u(
206
+ ), Z = u(
206
207
  (e) => {
207
- d(), l.current = !1, y.current = !1, w.current = !1, o(), i(!1), t(!1), m >= 0 && ce?.(m);
208
+ d(), s.current = !1, y.current = !1, w.current = !1, o(), i(!1), n(!1), m >= 0 && ie?.(m);
208
209
  },
209
210
  [
210
211
  m,
211
- ce,
212
+ ie,
212
213
  d,
213
214
  o,
214
- t
215
+ n
215
216
  ]
216
- ), Ae = u(() => {
217
- const e = S.current + 1, n = j.current, s = n[e], V = z.current, N = n.some((X) => X.is_final);
218
- if (s) {
217
+ ), X = u(
218
+ (e) => {
219
+ const r = p.current;
220
+ return !r || T.current !== "url" || !sr({
221
+ currentTimeSeconds: Math.max(r.currentTime, 0),
222
+ durationSeconds: r.duration
223
+ }) ? !1 : (s.current = !1, r.pause(), Z(e), !0);
224
+ },
225
+ [Z]
226
+ ), Me = u(() => {
227
+ const e = x.current + 1, r = j.current, l = r[e], V = D.current, N = r.some((Y) => Y.is_final);
228
+ if (l) {
219
229
  E(e, "ended");
220
230
  return;
221
231
  }
222
232
  if (V?.isAudioStreaming || !N) {
223
- S.current = e, a.current = e, y.current = !0, l.current = A, _(P(e)), i(!1), t(!0, "waitingForMoreAudio");
233
+ x.current = e, a.current = e, y.current = !0, s.current = A, _(P(e)), i(!1), n(!0, "waitingForMoreAudio");
224
234
  return;
225
235
  }
226
- D("segments-completed");
236
+ Z("segments-completed");
227
237
  }, [
228
238
  A,
229
- D,
239
+ Z,
230
240
  P,
231
241
  _,
232
242
  E,
233
- t
243
+ n
234
244
  ]);
235
- x(() => {
236
- if (me.current === re)
245
+ S(() => {
246
+ if (pe.current === te)
237
247
  return;
238
- me.current = re, S.current = 0, a.current = null, y.current = !1, g.current = !1, $.current = !1, l.current = !1, w.current = !1, F.current = null, M.current = null, d(), _(0), t(!1);
239
- const e = h.current;
248
+ pe.current = te, x.current = 0, a.current = null, y.current = !1, g.current = !1, H.current = !1, s.current = !1, w.current = !1, T.current = null, M.current = null, d(), _(0), n(!1);
249
+ const e = p.current;
240
250
  e && (e.pause(), e.removeAttribute("src"), e.load(), i(!1));
241
251
  }, [
242
252
  m,
243
- re,
253
+ te,
244
254
  k.length,
245
255
  K,
246
256
  _,
247
257
  d,
248
- t
249
- ]), x(() => {
250
- const e = h.current;
258
+ n
259
+ ]), S(() => {
260
+ const e = p.current;
251
261
  if (e) {
252
- if (v) {
253
- $.current = !!(z.current && !g.current && (!e.paused || l.current || a.current !== null)), l.current = !1, t(!1), e.pause(), i(!1);
262
+ if (F) {
263
+ H.current = !!(D.current && !g.current && (!e.paused || s.current || a.current !== null)), s.current = !1, n(!1), e.pause(), i(!1);
254
264
  return;
255
265
  }
256
- if (!(!$.current || !z.current || g.current)) {
257
- if ($.current = !1, a.current !== null) {
266
+ if (!(!H.current || !D.current || g.current)) {
267
+ if (H.current = !1, a.current !== null) {
258
268
  if (a.current < j.current.length) {
259
269
  E(a.current, "external-resume");
260
270
  return;
261
271
  }
262
- l.current = !0, t(!0, "waitingForMoreAudio");
272
+ s.current = !0, n(!0, "waitingForMoreAudio");
263
273
  return;
264
274
  }
265
275
  if (!M.current && j.current.length > 0) {
266
276
  E(
267
277
  Math.min(
268
- S.current,
278
+ x.current,
269
279
  j.current.length - 1
270
280
  ),
271
281
  "external-resume-init"
272
282
  );
273
283
  return;
274
284
  }
275
- e.paused && (l.current = !0, b("external-resume"));
285
+ e.paused && (s.current = !0, b("external-resume"));
276
286
  }
277
287
  }
278
288
  }, [
279
- v,
289
+ F,
280
290
  E,
281
291
  b,
282
- t
283
- ]), x(() => {
284
- const e = h.current;
292
+ n
293
+ ]), S(() => {
294
+ const e = p.current;
285
295
  if (e) {
286
296
  if (!f) {
287
- H();
297
+ O();
288
298
  return;
289
299
  }
290
- if (v) {
291
- l.current = !1, t(!1), e.pause(), i(!1);
300
+ if (F) {
301
+ s.current = !1, n(!1), e.pause(), i(!1);
292
302
  return;
293
303
  }
294
304
  if (K) {
295
- const n = M.current !== K, s = C();
296
- if (F.current === "segment" && !!M.current && a.current === null) {
297
- if (!s) {
298
- l.current = !1, e.pause(), i(!1);
305
+ const r = M.current !== K, l = L();
306
+ if (T.current === "segment" && !!M.current && a.current === null) {
307
+ if (!l) {
308
+ s.current = !1, e.pause(), i(!1);
299
309
  return;
300
310
  }
301
- e.paused && (l.current = !0, b("keep-segment-source"));
311
+ e.paused && (s.current = !0, b("keep-segment-source"));
302
312
  return;
303
313
  }
304
- if (n) {
314
+ if (r) {
305
315
  const N = a.current !== null ? xe() : 0;
306
- e.pause(), e.removeAttribute("src"), e.load(), M.current = K, F.current = "url", e.src = K, e.load(), p.current = N, _(N * 1e3), e.readyState > 0 && (e.currentTime = N, p.current = null);
316
+ e.pause(), e.removeAttribute("src"), e.load(), M.current = K, T.current = "url", e.src = K, e.load(), h.current = N, _(N * 1e3), e.readyState > 0 && (e.currentTime = N, h.current = null);
307
317
  }
308
- if (l.current = s, y.current = !1, w.current = !1, t(!1), !s) {
309
- l.current = !1, e.pause(), i(!1);
318
+ if (s.current = l, y.current = !1, w.current = !1, n(!1), !l) {
319
+ s.current = !1, e.pause(), i(!1);
310
320
  return;
311
321
  }
312
- b(n ? "sync-url-init" : "sync-url");
322
+ b(r ? "sync-url-init" : "sync-url");
313
323
  return;
314
324
  }
315
325
  if (a.current !== null) {
316
326
  if (a.current < k.length) {
317
327
  if (g.current) {
318
- i(!1), t(!1);
328
+ i(!1), n(!1);
319
329
  return;
320
330
  }
321
331
  E(a.current, "wait-resume");
322
332
  return;
323
333
  }
324
- y.current = !0, l.current = C(), i(!1), t(C());
334
+ y.current = !0, s.current = L(), i(!1), n(L());
325
335
  return;
326
336
  }
327
337
  if (!k.length) {
328
338
  if (f.isAudioStreaming) {
329
- a.current = S.current, y.current = !0, l.current = C(), i(!1), t(C());
339
+ a.current = x.current, y.current = !0, s.current = L(), i(!1), n(L());
330
340
  return;
331
341
  }
332
- H();
342
+ O();
333
343
  return;
334
344
  }
335
345
  if (!M.current) {
336
346
  E(
337
347
  Math.min(
338
- S.current,
348
+ x.current,
339
349
  k.length - 1
340
350
  ),
341
351
  "effect-init"
@@ -343,10 +353,10 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
343
353
  return;
344
354
  }
345
355
  if (!A || g.current) {
346
- l.current = !1, e.pause(), i(!1);
356
+ s.current = !1, e.pause(), i(!1);
347
357
  return;
348
358
  }
349
- e.paused && (l.current = !0, b("sync-paused-retry"));
359
+ e.paused && (s.current = !0, b("sync-paused-retry"));
350
360
  }
351
361
  }, [
352
362
  f,
@@ -354,89 +364,90 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
354
364
  k,
355
365
  K,
356
366
  A,
357
- v,
358
- C,
367
+ F,
368
+ L,
359
369
  _,
360
- H,
370
+ O,
361
371
  E,
362
372
  b,
363
373
  xe,
364
- t
365
- ]), x(() => H, [H]), x(() => d, [d]);
366
- const $e = u(() => {
367
- o(), we(), i(!0), t(!1), ne?.();
374
+ n
375
+ ]), S(() => O, [O]), S(() => d, [d]);
376
+ const He = u(() => {
377
+ o(), Ae(), i(!0), n(!1), ue?.();
368
378
  }, [
369
- ne,
370
- we,
379
+ ue,
380
+ Ae,
371
381
  o,
372
- t
373
- ]), He = u(() => {
382
+ n
383
+ ]), Oe = u(() => {
374
384
  y.current || w.current || (d(), o(), i(!1));
375
- }, [m, d, o]), Oe = u(() => {
376
- const e = h.current;
377
- e && p.current !== null && (e.currentTime = p.current, p.current = null), o(), !(!l.current || !A) && b("canplay");
385
+ }, [m, d, o]), qe = u(() => {
386
+ const e = p.current;
387
+ e && h.current !== null && (e.currentTime = h.current, h.current = null), o(), !X("canplay-seek-finished") && (!s.current || !A || b("canplay"));
378
388
  }, [
379
389
  m,
380
390
  A,
391
+ X,
381
392
  o,
382
393
  b
383
- ]), qe = u(() => {
384
- const e = h.current;
385
- e && p.current !== null && (e.currentTime = p.current, p.current = null), o();
386
- }, [m, o]), ze = u(() => {
394
+ ]), ze = u(() => {
395
+ const e = p.current;
396
+ e && h.current !== null && (e.currentTime = h.current, h.current = null), o(), X("metadata-seek-finished");
397
+ }, [m, X, o]), De = u(() => {
387
398
  o();
388
- }, [o]), De = u(() => {
389
- y.current || t(!0, "loadingAudio");
390
- }, [t]), Xe = u(() => {
399
+ }, [o]), Xe = u(() => {
400
+ y.current || n(!0, "loadingAudio");
401
+ }, [n]), Ye = u(() => {
391
402
  if (y.current) {
392
- t(!0, "waitingForMoreAudio");
403
+ n(!0, "waitingForMoreAudio");
393
404
  return;
394
405
  }
395
- t(!0, "loadingAudio");
396
- }, [t]), Me = u(() => {
406
+ n(!0, "loadingAudio");
407
+ }, [n]), je = u(() => {
397
408
  o();
398
- }, [o]), Ye = u(() => {
399
- const e = F.current === "url" || j.current.length === 0;
409
+ }, [o]), Ge = u(() => {
410
+ const e = T.current === "url" || j.current.length === 0;
400
411
  if (d(), w.current = !1, e) {
401
- D("url-ended");
412
+ Z("url-ended");
402
413
  return;
403
414
  }
404
- Ae();
405
- }, [D, Ae, d]), Ge = u(() => {
406
- d(), o(), i(!1), t(!1);
407
- }, [d, o, t]), Je = u(
415
+ Me();
416
+ }, [Z, Me, d]), Je = u(() => {
417
+ d(), o(), i(!1), n(!1);
418
+ }, [d, o, n]), Qe = u(
408
419
  (e) => {
409
- ae?.(e), B(!1);
420
+ ce?.(e), B(!1);
410
421
  },
411
- [ae]
422
+ [ce]
412
423
  );
413
- return x(() => {
414
- q?.(I.current);
415
- }, [q]), /* @__PURE__ */ r.jsxs("div", { className: ke("slide-player", L), ...Ve, children: [
416
- /* @__PURE__ */ r.jsx(
424
+ return S(() => {
425
+ z?.(ee.current);
426
+ }, [z]), /* @__PURE__ */ t.jsxs("div", { className: Ee("slide-player", v), ...Be, children: [
427
+ /* @__PURE__ */ t.jsx(
417
428
  "audio",
418
429
  {
419
- ref: h,
430
+ ref: p,
420
431
  preload: "auto",
421
432
  playsInline: !0,
422
- onLoadStart: De,
423
- onLoadedMetadata: qe,
424
- onCanPlay: Oe,
425
- onPlay: $e,
426
- onPause: He,
427
- onWaiting: Xe,
428
- onSeeking: Me,
429
- onSeeked: Me,
430
- onTimeUpdate: ze,
431
- onEnded: Ye,
432
- onError: Ge
433
+ onLoadStart: Xe,
434
+ onLoadedMetadata: ze,
435
+ onCanPlay: qe,
436
+ onPlay: He,
437
+ onPause: Oe,
438
+ onWaiting: Ye,
439
+ onSeeking: je,
440
+ onSeeked: je,
441
+ onTimeUpdate: De,
442
+ onEnded: Ge,
443
+ onError: Je
433
444
  }
434
445
  ),
435
- Q ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
436
- /* @__PURE__ */ r.jsx(
437
- rr,
446
+ I ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
447
+ /* @__PURE__ */ t.jsx(
448
+ tr,
438
449
  {
439
- container: Le,
450
+ container: ve,
440
451
  labels: {
441
452
  fullscreen: W.fullscreenLabel,
442
453
  nonFullscreen: W.nonFullscreenLabel,
@@ -445,22 +456,22 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
445
456
  subtitleToggle: W.subtitleToggleAriaLabel,
446
457
  title: W.settingsTitle
447
458
  },
448
- isSubtitleEnabled: J,
459
+ isSubtitleEnabled: Q,
449
460
  onClose: () => B(!1),
450
461
  onOpenChange: B,
451
- onSubtitleToggle: ue ?? (() => {
462
+ onSubtitleToggle: se ?? (() => {
452
463
  }),
453
- onViewModeChange: Je,
454
- open: he,
455
- viewMode: Ce
464
+ onViewModeChange: Qe,
465
+ open: ge,
466
+ viewMode: Le
456
467
  }
457
468
  ),
458
- /* @__PURE__ */ r.jsxs("div", { className: "slide-player__controls", style: Be, children: [
459
- /* @__PURE__ */ r.jsxs("div", { className: "slide-player__group", children: [
460
- /* @__PURE__ */ r.jsx(
469
+ /* @__PURE__ */ t.jsxs("div", { className: "slide-player__controls", style: Ke, children: [
470
+ /* @__PURE__ */ t.jsxs("div", { className: "slide-player__group", children: [
471
+ /* @__PURE__ */ t.jsx(
461
472
  "button",
462
473
  {
463
- "aria-expanded": he,
474
+ "aria-expanded": ge,
464
475
  "aria-haspopup": "dialog",
465
476
  "aria-label": "More options",
466
477
  className: "slide-player__action slide-player__action--mobile-more",
@@ -468,8 +479,8 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
468
479
  B((e) => !e);
469
480
  },
470
481
  type: "button",
471
- children: /* @__PURE__ */ r.jsx(
472
- lr,
482
+ children: /* @__PURE__ */ t.jsx(
483
+ ar,
473
484
  {
474
485
  className: "slide-player__icon",
475
486
  strokeWidth: 2.25
@@ -477,17 +488,17 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
477
488
  )
478
489
  }
479
490
  ),
480
- /* @__PURE__ */ r.jsx("button", { "aria-label": "Volume", className: "hidden", type: "button", children: /* @__PURE__ */ r.jsx(sr, { className: "slide-player__icon", strokeWidth: 2.25 }) }),
481
- /* @__PURE__ */ r.jsx(
491
+ /* @__PURE__ */ t.jsx("button", { "aria-label": "Volume", className: "hidden", type: "button", children: /* @__PURE__ */ t.jsx(cr, { className: "slide-player__icon", strokeWidth: 2.25 }) }),
492
+ /* @__PURE__ */ t.jsx(
482
493
  "button",
483
494
  {
484
495
  "aria-label": W.subtitleToggleAriaLabel,
485
- "aria-pressed": J,
496
+ "aria-pressed": Q,
486
497
  className: "slide-player__action slide-player__action--subtitle",
487
- onClick: ue,
498
+ onClick: se,
488
499
  type: "button",
489
- children: J ? /* @__PURE__ */ r.jsx(ar, { className: "slide-player__icon", strokeWidth: 2.25 }) : /* @__PURE__ */ r.jsx(
490
- cr,
500
+ children: Q ? /* @__PURE__ */ t.jsx(ir, { className: "slide-player__icon", strokeWidth: 2.25 }) : /* @__PURE__ */ t.jsx(
501
+ or,
491
502
  {
492
503
  className: "slide-player__icon",
493
504
  strokeWidth: 2.25
@@ -495,41 +506,41 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
495
506
  )
496
507
  }
497
508
  ),
498
- /* @__PURE__ */ r.jsx(
509
+ /* @__PURE__ */ t.jsx(
499
510
  "button",
500
511
  {
501
512
  "aria-label": "Rewind",
502
513
  className: "slide-player__action slide-player__action--prev",
503
- disabled: We,
504
- onClick: Re,
514
+ disabled: Pe,
515
+ onClick: Te,
505
516
  type: "button",
506
- children: /* @__PURE__ */ r.jsx(ir, { className: "slide-player__icon", strokeWidth: 2.25 })
517
+ children: /* @__PURE__ */ t.jsx(fr, { className: "slide-player__icon", strokeWidth: 2.25 })
507
518
  }
508
519
  ),
509
- /* @__PURE__ */ r.jsx(
520
+ /* @__PURE__ */ t.jsx(
510
521
  "button",
511
522
  {
512
- "aria-label": Ze,
523
+ "aria-label": $e,
513
524
  className: "slide-player__toggle slide-player__toggle--playback",
514
525
  onClick: () => {
515
- if (G) {
516
- ve?.(!Y);
526
+ if (J) {
527
+ Fe?.(!G);
517
528
  return;
518
529
  }
519
- const e = h.current;
520
- if (!(v || !e || !f)) {
530
+ const e = p.current;
531
+ if (!(F || !e || !f)) {
521
532
  if (a.current !== null) {
522
- if (ee) {
523
- l.current = !1, g.current = !0, a.current = null, y.current = !1, i(!1), t(!1), e.pause();
533
+ if (re) {
534
+ s.current = !1, g.current = !0, a.current = null, y.current = !1, i(!1), n(!1), e.pause();
524
535
  return;
525
536
  }
526
- T.current = "manual", g.current = !1, l.current = !0, t(!0, "waitingForMoreAudio");
537
+ C.current = "manual", g.current = !1, s.current = !0, n(!0, "waitingForMoreAudio");
527
538
  return;
528
539
  }
529
540
  if (!e.src && k.length > 0) {
530
- T.current = "manual", g.current = !1, E(
541
+ C.current = "manual", g.current = !1, E(
531
542
  Math.min(
532
- S.current,
543
+ x.current,
533
544
  k.length - 1
534
545
  ),
535
546
  "toggle"
@@ -537,42 +548,42 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
537
548
  return;
538
549
  }
539
550
  if (e.paused) {
540
- T.current = "manual", g.current = !1, l.current = !0, b("toggle-resume");
551
+ C.current = "manual", g.current = !1, s.current = !0, b("toggle-resume");
541
552
  return;
542
553
  }
543
- l.current = !1, g.current = !0, e.pause();
554
+ s.current = !1, g.current = !0, e.pause();
544
555
  }
545
556
  },
546
557
  type: "button",
547
- children: Ke ? /* @__PURE__ */ r.jsx(pr, {}) : /* @__PURE__ */ r.jsx(hr, {})
558
+ children: Ze ? /* @__PURE__ */ t.jsx(gr, {}) : /* @__PURE__ */ t.jsx(yr, {})
548
559
  }
549
560
  ),
550
- /* @__PURE__ */ r.jsx(
561
+ /* @__PURE__ */ t.jsx(
551
562
  "button",
552
563
  {
553
564
  "aria-label": "Forward",
554
565
  className: "slide-player__action slide-player__action--next",
555
- disabled: Pe,
556
- onClick: Te,
566
+ disabled: Ve,
567
+ onClick: Ce,
557
568
  type: "button",
558
- children: /* @__PURE__ */ r.jsx(or, { className: "slide-player__icon", strokeWidth: 2.25 })
569
+ children: /* @__PURE__ */ t.jsx(dr, { className: "slide-player__icon", strokeWidth: 2.25 })
559
570
  }
560
571
  ),
561
- le ? /* @__PURE__ */ r.jsx(
572
+ le ? /* @__PURE__ */ t.jsx(
562
573
  "button",
563
574
  {
564
- "aria-label": se ? "Exit fullscreen" : "Enter fullscreen",
575
+ "aria-label": ae ? "Exit fullscreen" : "Enter fullscreen",
565
576
  className: "slide-player__action slide-player__action--fullscreen",
566
577
  onClick: le,
567
578
  type: "button",
568
- children: se ? /* @__PURE__ */ r.jsx(
569
- fr,
579
+ children: ae ? /* @__PURE__ */ t.jsx(
580
+ mr,
570
581
  {
571
582
  className: "slide-player__icon",
572
583
  strokeWidth: 2.25
573
584
  }
574
- ) : /* @__PURE__ */ r.jsx(
575
- dr,
585
+ ) : /* @__PURE__ */ t.jsx(
586
+ pr,
576
587
  {
577
588
  className: "slide-player__icon",
578
589
  strokeWidth: 2.25
@@ -581,22 +592,22 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
581
592
  }
582
593
  ) : null
583
594
  ] }),
584
- /* @__PURE__ */ r.jsx("div", { className: "slide-player__separator" }),
585
- /* @__PURE__ */ r.jsxs("div", { className: "slide-player__group", children: [
586
- ge.map((e, n) => /* @__PURE__ */ r.jsx(Ie.Fragment, { children: e }, `custom-action-${n}`)),
587
- /* @__PURE__ */ r.jsx(
595
+ /* @__PURE__ */ t.jsx("div", { className: "slide-player__separator" }),
596
+ /* @__PURE__ */ t.jsxs("div", { className: "slide-player__group", children: [
597
+ ye.map((e, r) => /* @__PURE__ */ t.jsx(er.Fragment, { children: e }, `custom-action-${r}`)),
598
+ /* @__PURE__ */ t.jsx(
588
599
  "button",
589
600
  {
590
601
  "aria-label": "Notes",
591
- className: ke(
602
+ className: Ee(
592
603
  "slide-player__action slide-player__action--notes",
593
- Z && "slide-player__action--active"
604
+ $ && "slide-player__action--active"
594
605
  ),
595
- disabled: !Ue,
596
- onClick: Fe,
606
+ disabled: !We,
607
+ onClick: Ue,
597
608
  type: "button",
598
- children: /* @__PURE__ */ r.jsx(
599
- mr,
609
+ children: /* @__PURE__ */ t.jsx(
610
+ hr,
600
611
  {
601
612
  className: "slide-player__icon",
602
613
  strokeWidth: 2.25
@@ -608,9 +619,9 @@ const Ee = /* @__PURE__ */ new Map(), Ne = (R) => {
608
619
  ] })
609
620
  ] }) : null
610
621
  ] });
611
- }, yr = er(gr);
612
- yr.displayName = "Player";
622
+ }, br = rr(_r);
623
+ br.displayName = "Player";
613
624
  export {
614
- yr as default
625
+ br as default
615
626
  };
616
627
  //# sourceMappingURL=Player.es.js.map