markdown-flow-ui 0.1.100-beta.4 → 0.1.100-beta.40

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 (101) hide show
  1. package/dist/Documents/ai-shifu/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
  2. package/dist/Documents/ai-shifu/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
  3. package/dist/Documents/ai-shifu/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
  4. package/dist/Documents/ai-shifu/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
  5. package/dist/Documents/ai-shifu/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
  6. package/dist/Documents/ai-shifu/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
  7. package/dist/Documents/ai-shifu/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
  8. package/dist/Documents/ai-shifu/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
  9. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.cjs.js +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.es.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.cjs.js +1 -1
  12. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.es.js +1 -1
  13. package/dist/_virtual/index.cjs3.js +1 -1
  14. package/dist/_virtual/index.cjs4.js +1 -1
  15. package/dist/_virtual/index.es3.js +4 -5
  16. package/dist/_virtual/index.es3.js.map +1 -1
  17. package/dist/_virtual/index.es4.js +5 -4
  18. package/dist/_virtual/index.es4.js.map +1 -1
  19. package/dist/assets/markdown-flow-ui.css +1 -1
  20. package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
  21. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  22. package/dist/components/ContentRender/ContentRender.d.ts +13 -10
  23. package/dist/components/ContentRender/ContentRender.es.js +184 -160
  24. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  25. package/dist/components/ContentRender/IframeSandbox.cjs.js +5 -4
  26. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  27. package/dist/components/ContentRender/IframeSandbox.d.ts +1 -0
  28. package/dist/components/ContentRender/IframeSandbox.es.js +307 -210
  29. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  30. package/dist/components/ContentRender/SandboxApp.cjs.js +3 -3
  31. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  32. package/dist/components/ContentRender/SandboxApp.d.ts +4 -0
  33. package/dist/components/ContentRender/SandboxApp.es.js +87 -80
  34. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  35. package/dist/components/ContentRender/index.cjs.js +1 -1
  36. package/dist/components/ContentRender/index.es.js +5 -6
  37. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
  38. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
  39. package/dist/components/ContentRender/plugins/CustomVariable.es.js +68 -64
  40. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  41. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  42. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  43. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +3 -0
  44. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +21 -18
  45. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  46. package/dist/components/Slide/Player.cjs.js +1 -1
  47. package/dist/components/Slide/Player.cjs.js.map +1 -1
  48. package/dist/components/Slide/Player.d.ts +3 -2
  49. package/dist/components/Slide/Player.es.js +228 -170
  50. package/dist/components/Slide/Player.es.js.map +1 -1
  51. package/dist/components/Slide/Slide.cjs.js +1 -1
  52. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  53. package/dist/components/Slide/Slide.d.ts +10 -0
  54. package/dist/components/Slide/Slide.es.js +422 -270
  55. package/dist/components/Slide/Slide.es.js.map +1 -1
  56. package/dist/components/Slide/Slide.stories.d.ts +27 -1
  57. package/dist/components/Slide/index.d.ts +3 -3
  58. package/dist/components/Slide/types.d.ts +5 -6
  59. package/dist/components/Slide/useSlide.cjs.js +1 -1
  60. package/dist/components/Slide/useSlide.cjs.js.map +1 -1
  61. package/dist/components/Slide/useSlide.d.ts +4 -1
  62. package/dist/components/Slide/useSlide.es.js +125 -83
  63. package/dist/components/Slide/useSlide.es.js.map +1 -1
  64. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js +2 -0
  65. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js.map +1 -0
  66. package/dist/components/Slide/useWakePlayerFromIframe.d.ts +7 -0
  67. package/dist/components/Slide/useWakePlayerFromIframe.es.js +89 -0
  68. package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -0
  69. package/dist/components/Slide/utils/playerCustomActions.cjs.js +2 -0
  70. package/dist/components/Slide/utils/playerCustomActions.cjs.js.map +1 -0
  71. package/dist/components/Slide/utils/playerCustomActions.d.ts +3 -0
  72. package/dist/components/Slide/utils/playerCustomActions.es.js +7 -0
  73. package/dist/components/Slide/utils/playerCustomActions.es.js.map +1 -0
  74. package/dist/components/index.d.ts +4 -2
  75. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  76. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  77. package/dist/index.cjs.js +1 -1
  78. package/dist/index.es.js +24 -22
  79. package/dist/lib/interaction-defaults.cjs.js +2 -0
  80. package/dist/lib/interaction-defaults.cjs.js.map +1 -0
  81. package/dist/lib/interaction-defaults.es.js +106 -0
  82. package/dist/lib/interaction-defaults.es.js.map +1 -0
  83. package/dist/lib/sandboxInteraction.cjs.js +2 -0
  84. package/dist/lib/sandboxInteraction.cjs.js.map +1 -0
  85. package/dist/lib/sandboxInteraction.d.ts +8 -0
  86. package/dist/lib/sandboxInteraction.es.js +12 -0
  87. package/dist/lib/sandboxInteraction.es.js.map +1 -0
  88. package/dist/markdown-flow-ui-lib.css +1 -1
  89. package/dist/renderer.cjs.js +1 -1
  90. package/dist/renderer.d.ts +5 -3
  91. package/dist/renderer.es.js +18 -16
  92. package/package.json +17 -2
  93. package/dist/components/Slide/interaction-defaults.cjs.js +0 -2
  94. package/dist/components/Slide/interaction-defaults.cjs.js.map +0 -1
  95. package/dist/components/Slide/interaction-defaults.es.js +0 -85
  96. package/dist/components/Slide/interaction-defaults.es.js.map +0 -1
  97. package/dist/lib/browserUserActivation.cjs.js +0 -2
  98. package/dist/lib/browserUserActivation.cjs.js.map +0 -1
  99. package/dist/lib/browserUserActivation.es.js +0 -13
  100. package/dist/lib/browserUserActivation.es.js.map +0 -1
  101. /package/dist/{components/Slide → lib}/interaction-defaults.d.ts +0 -0
@@ -1,14 +1,20 @@
1
1
  import { j as r } from "../../_virtual/jsx-runtime.es.js";
2
- import { useRef as o, useState as te, useMemo as ne, useEffect as v, useCallback as a } from "react";
3
- import { cn as Z } from "../../lib/utils.es.js";
2
+ import be, { useRef as o, useState as Se, useMemo as T, useEffect as M, useCallback as a } from "react";
3
+ import { cn as Y } from "../../lib/utils.es.js";
4
+ import { toPlayerCustomActionList as _e } from "./utils/playerCustomActions.es.js";
4
5
  /* empty css */
5
- import se from "../../Documents/ai-shifu/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";
6
- import le from "../../Documents/ai-shifu/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";
7
- import ce from "../../Documents/ai-shifu/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";
8
- import ue from "../../Documents/ai-shifu/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";
9
- import ae from "../../Documents/ai-shifu/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";
10
- import ie from "../../Documents/ai-shifu/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";
11
- const oe = () => /* @__PURE__ */ r.jsxs(
6
+ import xe from "../../Documents/ai-shifu/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";
7
+ import we from "../../Documents/ai-shifu/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";
8
+ import je from "../../Documents/ai-shifu/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";
9
+ import Ae from "../../Documents/ai-shifu/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";
10
+ import ke from "../../Documents/ai-shifu/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";
11
+ import Ne from "../../Documents/ai-shifu/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";
12
+ const D = /* @__PURE__ */ new Map(), I = (_) => {
13
+ if (typeof window > "u" || !_ || D.has(_))
14
+ return;
15
+ const N = window.document.createElement("audio");
16
+ N.preload = "auto", N.setAttribute("playsinline", "true"), N.src = _, N.load(), D.set(_, N);
17
+ }, Re = () => /* @__PURE__ */ r.jsxs(
12
18
  "svg",
13
19
  {
14
20
  xmlns: "http://www.w3.org/2000/svg",
@@ -27,7 +33,7 @@ const oe = () => /* @__PURE__ */ r.jsxs(
27
33
  /* @__PURE__ */ r.jsx("path", { d: "M12 10H16V24H12V10ZM18 10H22V24H18V10Z", fill: "white" })
28
34
  ]
29
35
  }
30
- ), fe = () => /* @__PURE__ */ r.jsxs(
36
+ ), ve = () => /* @__PURE__ */ r.jsxs(
31
37
  "svg",
32
38
  {
33
39
  xmlns: "http://www.w3.org/2000/svg",
@@ -46,240 +52,289 @@ const oe = () => /* @__PURE__ */ r.jsxs(
46
52
  /* @__PURE__ */ r.jsx("path", { d: "M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z", fill: "white" })
47
53
  ]
48
54
  }
49
- ), Se = ({
50
- audioList: $ = [],
51
- className: H,
52
- currentAudioIndex: t = -1,
53
- defaultPlaying: s = !0,
54
- onPrev: U,
55
- onNext: B,
56
- onFullscreen: K,
57
- onEnded: W,
58
- onPlayRequest: R,
59
- onInteractionToggle: z,
60
- hasInteraction: G = !1,
61
- isInteractionOpen: J = !1,
62
- prevDisabled: O = !1,
63
- nextDisabled: P = !1,
64
- showControls: Q = !0,
65
- ...X
55
+ ), Ke = ({
56
+ audioList: _ = [],
57
+ className: N,
58
+ currentAudioIndex: i = -1,
59
+ defaultPlaying: g = !0,
60
+ onLoadingChange: B,
61
+ onPrev: ee,
62
+ onNext: re,
63
+ onFullscreen: te,
64
+ onEnded: K,
65
+ onInteractionToggle: ne,
66
+ hasInteraction: se = !1,
67
+ isInteractionOpen: ue = !1,
68
+ prevDisabled: le = !1,
69
+ nextDisabled: ce = !1,
70
+ showControls: ae = !0,
71
+ customActions: Z,
72
+ ...oe
66
73
  }) => {
67
- const p = o(null), y = o(null), F = o(null), _ = o(0), f = o(null), A = o(void 0), C = o([]), m = o(!1), n = o(!1), i = o(null), h = o(!1), [M, l] = te(s), d = t >= 0 ? $[t] : void 0, j = d?.audioUrl, g = ne(
68
- () => [...d?.audioSegments ?? []].sort(
74
+ const y = o(null), x = o(null), $ = o(null), w = o(0), f = o(null), H = o(void 0), P = o([]), q = o(!1), m = o(!1), v = o(null), p = o(!1), n = o(!1), d = o(null), h = o(!1), j = o("unknown"), [F, l] = Se(g), c = i >= 0 ? _[i] : void 0, C = c?.audioUrl, b = T(
75
+ () => [...c?.audioSegments ?? []].sort(
69
76
  (e, u) => e.segment_index - u.segment_index
70
77
  ),
71
- [d?.audioSegments]
72
- ), V = `${t}:${d?.serialNumber ?? "none"}:${j ?? ""}`;
73
- v(() => {
74
- A.current = d;
75
- }, [d]), v(() => {
76
- C.current = g;
77
- }, [g]);
78
- const L = a((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), S = a(() => {
79
- const e = p.current;
80
- e && (n.current = !1, i.current = null, m.current = !1, h.current = !1, e.pause(), e.removeAttribute("src"), e.load(), y.current = null, _.current = 0, f.current = null, l(!1));
81
- }, [t]), b = a(
78
+ [c?.audioSegments]
79
+ ), z = T(
80
+ () => _e(Z),
81
+ [Z]
82
+ ), O = z.length + 4, ie = T(
83
+ () => ({
84
+ "--slide-player-mobile-control-count": String(O)
85
+ }),
86
+ [O]
87
+ ), L = T(() => c ? c.audioKey ?? `${String(c.sequenceNumber ?? "none")}:${String(c.audioUrl ?? "")}` : "none", [c]);
88
+ M(() => {
89
+ H.current = c;
90
+ }, [c]), M(() => {
91
+ P.current = b;
92
+ }, [b]), M(() => {
93
+ const e = c?.audioUrl, u = i >= 0 ? _[i + 1]?.audioUrl : void 0;
94
+ I(e), I(u);
95
+ }, [_, c?.audioUrl, i]);
96
+ const t = a(
82
97
  (e) => {
83
- const u = p.current;
98
+ q.current !== e && (q.current = e, B?.(e));
99
+ },
100
+ [B]
101
+ ), G = a((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), A = a(() => g && !m.current && j.current !== "blocked", [g]), J = a((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), Q = a(() => {
102
+ const e = f.current;
103
+ return e == null || e <= 0 ? 0 : P.current.slice(0, e).reduce(
104
+ (u, s) => u + Math.max(Number(s.duration_ms ?? 0), 0),
105
+ 0
106
+ ) / 1e3;
107
+ }, []), U = a(() => {
108
+ const e = y.current;
109
+ e && (n.current = !1, m.current = !1, v.current = null, d.current = null, p.current = !1, h.current = !1, e.pause(), e.removeAttribute("src"), e.load(), x.current = null, w.current = 0, f.current = null, l(!1), t(!1));
110
+ }, [t]), S = a(
111
+ (e) => {
112
+ const u = y.current;
84
113
  if (!u)
85
114
  return !1;
86
- const c = u.play();
87
- return c && typeof c.then == "function" && c.then(() => {
88
- n.current = !1, h.current = !1;
89
- }).catch((w) => {
90
- l(!1);
115
+ const s = u.play();
116
+ return s && typeof s.then == "function" && s.then(() => {
117
+ j.current === "unknown" && (j.current = "auto"), n.current = !1, h.current = !1;
118
+ }).catch((R) => {
119
+ j.current === "unknown" && G(R) && (j.current = "blocked", n.current = !1, t(!1)), h.current = !1, l(!1);
91
120
  }), !0;
92
121
  },
93
- [t]
94
- ), x = a(
122
+ [G, t]
123
+ ), E = a(
95
124
  (e, u) => {
96
- const c = p.current, w = C.current[e];
97
- if (!c || !w)
125
+ const s = y.current, R = P.current[e];
126
+ if (!s || !R)
98
127
  return !1;
99
- const N = L(w.audio_data);
100
- _.current = e, f.current = null, m.current = !1, h.current = !0, n.current = s;
101
- const k = y.current !== N;
102
- return k && (c.pause(), c.removeAttribute("src"), c.load(), y.current = N, c.src = N, c.load()), i.current = 0, c.readyState > 0 && (c.currentTime = 0, i.current = null), s ? k ? !0 : b(`start-segment:${u}`) : (n.current = !1, h.current = !1, c.pause(), l(!1), !0);
128
+ const k = J(R.audio_data);
129
+ w.current = e, f.current = null, p.current = !1, h.current = !0;
130
+ const W = A();
131
+ n.current = W, t(!1);
132
+ const ye = x.current !== k;
133
+ return v.current = "segment", ye && (s.pause(), s.removeAttribute("src"), s.load(), x.current = k, s.src = k, s.load()), d.current = 0, s.readyState > 0 && (s.currentTime = 0, d.current = null), W ? S(`start-segment:${u}`) : (n.current = !1, h.current = !1, s.pause(), l(!1), !0);
134
+ },
135
+ [
136
+ A,
137
+ J,
138
+ S,
139
+ t
140
+ ]
141
+ ), V = a(
142
+ (e) => {
143
+ n.current = !1, p.current = !1, h.current = !1, l(!1), t(!1), i >= 0 && K?.(i);
103
144
  },
104
- [t, s, L, b]
105
- ), E = a(() => {
106
- n.current = !1, m.current = !1, h.current = !1, l(!1), t >= 0 && W?.(t);
107
- }, [t, W]), T = a(() => {
108
- const e = _.current + 1, u = C.current, c = u[e], w = A.current, N = u.some((k) => k.is_final);
109
- if (c) {
110
- x(e, "ended");
145
+ [i, K, t]
146
+ ), X = a(() => {
147
+ const e = w.current + 1, u = P.current, s = u[e], R = H.current, k = u.some((W) => W.is_final);
148
+ if (s) {
149
+ E(e, "ended");
111
150
  return;
112
151
  }
113
- if (w?.isAudioStreaming || !N) {
114
- _.current = e, f.current = e, m.current = !0, n.current = s, l(s);
152
+ if (R?.isAudioStreaming || !k) {
153
+ w.current = e, f.current = e, p.current = !0, n.current = g, l(!1), t(!0);
115
154
  return;
116
155
  }
117
- E("segments-completed");
118
- }, [
119
- t,
120
- s,
121
- E,
122
- x
123
- ]);
124
- v(() => {
125
- if (F.current === V)
156
+ V("segments-completed");
157
+ }, [g, V, E, t]);
158
+ M(() => {
159
+ if ($.current === L)
126
160
  return;
127
- F.current = V, _.current = 0, f.current = null, m.current = !1, n.current = !1, h.current = !1, y.current = null;
128
- const e = p.current;
161
+ $.current = L, w.current = 0, f.current = null, p.current = !1, m.current = !1, n.current = !1, h.current = !1, v.current = null, x.current = null, t(!1);
162
+ const e = y.current;
129
163
  e && (e.pause(), e.removeAttribute("src"), e.load(), l(!1));
130
164
  }, [
131
- t,
132
- V,
133
- g.length,
134
- j
135
- ]), v(() => {
136
- const e = p.current;
165
+ i,
166
+ L,
167
+ b.length,
168
+ C,
169
+ t
170
+ ]), M(() => {
171
+ const e = y.current;
137
172
  if (e) {
138
- if (!d) {
139
- S();
173
+ if (!c) {
174
+ U();
140
175
  return;
141
176
  }
142
- if (j) {
143
- const u = y.current !== j;
144
- if (u && (e.pause(), e.removeAttribute("src"), e.load(), y.current = j, e.src = j, e.load()), i.current = 0, e.readyState > 0 && (e.currentTime = 0, i.current = null), n.current = s, m.current = !1, h.current = !1, !s) {
177
+ if (C) {
178
+ const u = x.current !== C, s = A();
179
+ if (v.current === "segment" && !!x.current && f.current === null) {
180
+ if (!s) {
181
+ n.current = !1, e.pause(), l(!1);
182
+ return;
183
+ }
184
+ e.paused && (n.current = !0, S("keep-segment-source"));
185
+ return;
186
+ }
187
+ if (u) {
188
+ const k = f.current !== null ? Q() : 0;
189
+ e.pause(), e.removeAttribute("src"), e.load(), x.current = C, v.current = "url", e.src = C, e.load(), d.current = k, e.readyState > 0 && (e.currentTime = k, d.current = null);
190
+ }
191
+ if (n.current = s, p.current = !1, h.current = !1, t(!1), !s) {
145
192
  n.current = !1, e.pause(), l(!1);
146
193
  return;
147
194
  }
148
- u || b("sync-url");
195
+ S(u ? "sync-url-init" : "sync-url");
149
196
  return;
150
197
  }
151
198
  if (f.current !== null) {
152
- if (f.current < g.length) {
153
- x(f.current, "wait-resume");
199
+ if (f.current < b.length) {
200
+ if (m.current) {
201
+ l(!1), t(!1);
202
+ return;
203
+ }
204
+ E(f.current, "wait-resume");
154
205
  return;
155
206
  }
156
- m.current = !0, n.current = s, l(s);
207
+ p.current = !0, n.current = A(), l(!1), t(A());
157
208
  return;
158
209
  }
159
- if (!g.length) {
160
- if (d.isAudioStreaming) {
161
- f.current = _.current, m.current = !0, n.current = s, l(s);
210
+ if (!b.length) {
211
+ if (c.isAudioStreaming) {
212
+ f.current = w.current, p.current = !0, n.current = A(), l(!1), t(A());
162
213
  return;
163
214
  }
164
- S();
215
+ U();
165
216
  return;
166
217
  }
167
- if (!y.current) {
168
- x(
218
+ if (!x.current) {
219
+ E(
169
220
  Math.min(
170
- _.current,
171
- g.length - 1
221
+ w.current,
222
+ b.length - 1
172
223
  ),
173
224
  "effect-init"
174
225
  );
175
226
  return;
176
227
  }
177
- if (!s) {
228
+ if (!g || m.current) {
178
229
  n.current = !1, e.pause(), l(!1);
179
230
  return;
180
231
  }
181
- e.paused && (n.current = !0, b("sync-paused-retry"));
232
+ e.paused && (n.current = !0, S("sync-paused-retry"));
182
233
  }
183
234
  }, [
184
- d,
185
- t,
235
+ c,
236
+ i,
237
+ b,
238
+ C,
186
239
  g,
187
- j,
188
- s,
240
+ A,
241
+ U,
242
+ E,
189
243
  S,
190
- x,
191
- b
192
- ]), v(() => S, [S]);
193
- const Y = a(() => {
194
- l(!0);
195
- }, [t]), q = a(() => {
196
- m.current || h.current || l(!1);
197
- }, [t]), D = a(() => {
198
- const e = p.current;
199
- e && i.current !== null && (e.currentTime = i.current, i.current = null), !(!n.current || !s) && b("canplay");
200
- }, [t, s, b]), I = a(() => {
201
- const e = p.current;
202
- e && i.current !== null && (e.currentTime = i.current, i.current = null);
203
- }, [t]), ee = a(() => {
204
- if (h.current = !1, A.current?.audioUrl || C.current.length === 0) {
205
- E("url-ended");
244
+ Q,
245
+ t
246
+ ]), M(() => U, [U]);
247
+ const fe = a(() => {
248
+ l(!0), t(!1);
249
+ }, [t]), de = a(() => {
250
+ p.current || h.current || l(!1);
251
+ }, [i]), me = a(() => {
252
+ const e = y.current;
253
+ e && d.current !== null && (e.currentTime = d.current, d.current = null), !(!n.current || !g) && S("canplay");
254
+ }, [i, g, S]), pe = a(() => {
255
+ const e = y.current;
256
+ e && d.current !== null && (e.currentTime = d.current, d.current = null);
257
+ }, [i]), he = a(() => {
258
+ const e = v.current === "url" || P.current.length === 0;
259
+ if (h.current = !1, e) {
260
+ V("url-ended");
206
261
  return;
207
262
  }
208
- T();
209
- }, [t, E, T]), re = a(() => {
210
- l(!1);
263
+ X();
264
+ }, [V, X]), ge = a(() => {
265
+ l(!1), t(!1);
211
266
  }, [t]);
212
- return /* @__PURE__ */ r.jsxs("div", { className: Z("slide-player", H), ...X, children: [
267
+ return /* @__PURE__ */ r.jsxs("div", { className: Y("slide-player", N), ...oe, children: [
213
268
  /* @__PURE__ */ r.jsx(
214
269
  "audio",
215
270
  {
216
- ref: p,
217
- preload: "metadata",
271
+ ref: y,
272
+ preload: "auto",
218
273
  playsInline: !0,
219
- onLoadedMetadata: I,
220
- onCanPlay: D,
221
- onPlay: Y,
222
- onPause: q,
223
- onEnded: ee,
224
- onError: re
274
+ onLoadedMetadata: pe,
275
+ onCanPlay: me,
276
+ onPlay: fe,
277
+ onPause: de,
278
+ onEnded: he,
279
+ onError: ge
225
280
  }
226
281
  ),
227
- Q ? /* @__PURE__ */ r.jsxs("div", { className: "slide-player__controls", children: [
282
+ ae ? /* @__PURE__ */ r.jsxs("div", { className: "slide-player__controls", style: ie, children: [
228
283
  /* @__PURE__ */ r.jsxs("div", { className: "slide-player__group", children: [
229
284
  /* @__PURE__ */ r.jsx("button", { "aria-label": "More options", className: "hidden", type: "button", children: /* @__PURE__ */ r.jsx(
230
- se,
285
+ xe,
231
286
  {
232
287
  className: "slide-player__icon",
233
288
  strokeWidth: 2.25
234
289
  }
235
290
  ) }),
236
- /* @__PURE__ */ r.jsx("button", { "aria-label": "Volume", className: "hidden", type: "button", children: /* @__PURE__ */ r.jsx(le, { className: "slide-player__icon", strokeWidth: 2.25 }) }),
291
+ /* @__PURE__ */ r.jsx("button", { "aria-label": "Volume", className: "hidden", type: "button", children: /* @__PURE__ */ r.jsx(we, { className: "slide-player__icon", strokeWidth: 2.25 }) }),
237
292
  /* @__PURE__ */ r.jsx(
238
293
  "button",
239
294
  {
240
295
  "aria-label": "Rewind",
241
296
  className: "slide-player__action",
242
- disabled: O,
243
- onClick: U,
297
+ disabled: le,
298
+ onClick: ee,
244
299
  type: "button",
245
- children: /* @__PURE__ */ r.jsx(ce, { className: "slide-player__icon", strokeWidth: 2.25 })
300
+ children: /* @__PURE__ */ r.jsx(je, { className: "slide-player__icon", strokeWidth: 2.25 })
246
301
  }
247
302
  ),
248
303
  /* @__PURE__ */ r.jsx(
249
304
  "button",
250
305
  {
251
- "aria-label": M ? "Pause" : "Play",
306
+ "aria-label": F ? "Pause" : "Play",
252
307
  className: "slide-player__toggle",
253
308
  onClick: () => {
254
- const e = p.current;
255
- if (!(!e || !d)) {
309
+ const e = y.current;
310
+ if (!(!e || !c)) {
256
311
  if (f.current !== null) {
257
- if (M) {
258
- n.current = !1, f.current = null, m.current = !1, l(!1), e.pause();
312
+ if (F) {
313
+ n.current = !1, m.current = !0, f.current = null, p.current = !1, l(!1), t(!1), e.pause();
259
314
  return;
260
315
  }
261
- R?.(), n.current = !0, l(!0);
316
+ j.current = "manual", m.current = !1, n.current = !0, t(!0);
262
317
  return;
263
318
  }
264
- if (!e.src && g.length > 0) {
265
- R?.(), x(
319
+ if (!e.src && b.length > 0) {
320
+ j.current = "manual", m.current = !1, E(
266
321
  Math.min(
267
- _.current,
268
- g.length - 1
322
+ w.current,
323
+ b.length - 1
269
324
  ),
270
325
  "toggle"
271
326
  );
272
327
  return;
273
328
  }
274
329
  if (e.paused) {
275
- R?.(), n.current = !0, b("toggle-resume");
330
+ j.current = "manual", m.current = !1, n.current = !0, S("toggle-resume");
276
331
  return;
277
332
  }
278
- n.current = !1, e.pause();
333
+ n.current = !1, m.current = !0, e.pause();
279
334
  }
280
335
  },
281
336
  type: "button",
282
- children: M ? /* @__PURE__ */ r.jsx(oe, {}) : /* @__PURE__ */ r.jsx(fe, {})
337
+ children: F ? /* @__PURE__ */ r.jsx(Re, {}) : /* @__PURE__ */ r.jsx(ve, {})
283
338
  }
284
339
  ),
285
340
  /* @__PURE__ */ r.jsx(
@@ -287,10 +342,10 @@ const oe = () => /* @__PURE__ */ r.jsxs(
287
342
  {
288
343
  "aria-label": "Forward",
289
344
  className: "slide-player__action",
290
- disabled: P,
291
- onClick: B,
345
+ disabled: ce,
346
+ onClick: re,
292
347
  type: "button",
293
- children: /* @__PURE__ */ r.jsx(ue, { className: "slide-player__icon", strokeWidth: 2.25 })
348
+ children: /* @__PURE__ */ r.jsx(Ae, { className: "slide-player__icon", strokeWidth: 2.25 })
294
349
  }
295
350
  ),
296
351
  /* @__PURE__ */ r.jsx(
@@ -298,31 +353,34 @@ const oe = () => /* @__PURE__ */ r.jsxs(
298
353
  {
299
354
  "aria-label": "Fullscreen",
300
355
  className: "hidden",
301
- onClick: K,
356
+ onClick: te,
302
357
  type: "button",
303
- children: /* @__PURE__ */ r.jsx(ae, { className: "slide-player__icon", strokeWidth: 2.25 })
358
+ children: /* @__PURE__ */ r.jsx(ke, { className: "slide-player__icon", strokeWidth: 2.25 })
304
359
  }
305
360
  )
306
361
  ] }),
307
362
  /* @__PURE__ */ r.jsx("div", { className: "slide-player__separator" }),
308
- /* @__PURE__ */ r.jsx("div", { className: "slide-player__group", children: /* @__PURE__ */ r.jsx(
309
- "button",
310
- {
311
- "aria-label": "Notes",
312
- className: Z(
313
- "slide-player__action",
314
- J && "slide-player__action--active"
315
- ),
316
- disabled: !G,
317
- onClick: z,
318
- type: "button",
319
- children: /* @__PURE__ */ r.jsx(ie, { className: "slide-player__icon", strokeWidth: 2.25 })
320
- }
321
- ) })
363
+ /* @__PURE__ */ r.jsxs("div", { className: "slide-player__group", children: [
364
+ z.map((e, u) => /* @__PURE__ */ r.jsx(be.Fragment, { children: e }, `custom-action-${u}`)),
365
+ /* @__PURE__ */ r.jsx(
366
+ "button",
367
+ {
368
+ "aria-label": "Notes",
369
+ className: Y(
370
+ "slide-player__action",
371
+ ue && "slide-player__action--active"
372
+ ),
373
+ disabled: !se,
374
+ onClick: ne,
375
+ type: "button",
376
+ children: /* @__PURE__ */ r.jsx(Ne, { className: "slide-player__icon", strokeWidth: 2.25 })
377
+ }
378
+ )
379
+ ] })
322
380
  ] }) : null
323
381
  ] });
324
382
  };
325
383
  export {
326
- Se as default
384
+ Ke as default
327
385
  };
328
386
  //# sourceMappingURL=Player.es.js.map