markdown-flow-ui 0.1.108 → 0.1.109

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