react-modern-audio-player 2.1.0 → 2.2.0

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 (53) hide show
  1. package/README.md +138 -3
  2. package/dist/index.es.js +1288 -1163
  3. package/dist/types/components/AudioPlayer/Context/StateContext/index.d.ts +1 -0
  4. package/dist/types/components/AudioPlayer/Context/UIContext.d.ts +1 -0
  5. package/dist/types/{hooks/context → components/AudioPlayer/Context/hooks}/index.d.ts +0 -1
  6. package/dist/types/components/AudioPlayer/Context/hooks/useAudioAttrsContext.d.ts +2 -0
  7. package/dist/types/components/AudioPlayer/Context/hooks/usePlaybackContext.d.ts +2 -0
  8. package/dist/types/components/AudioPlayer/Context/hooks/useResourceContext.d.ts +2 -0
  9. package/dist/types/components/AudioPlayer/Context/hooks/useTimeContext.d.ts +2 -0
  10. package/dist/types/components/AudioPlayer/Context/hooks/useTrackContext.d.ts +2 -0
  11. package/dist/types/components/AudioPlayer/Context/hooks/useUIContext.d.ts +1 -0
  12. package/dist/types/components/AudioPlayer/Context/index.d.ts +1 -0
  13. package/dist/types/components/AudioPlayer/Interface/Controller/Button/RepeatTypeBtn.d.ts +3 -1
  14. package/dist/types/components/AudioPlayer/Interface/Controller/Button/TransportControls/index.d.ts +4 -0
  15. package/dist/types/components/AudioPlayer/Interface/Controller/Button/index.d.ts +4 -3
  16. package/dist/types/components/AudioPlayer/Interface/Controller/Drawer/SortablePlayList/index.d.ts +5 -1
  17. package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/index.d.ts +12 -1
  18. package/dist/types/components/AudioPlayer/Interface/Controller/Tooltip/Volume/index.d.ts +3 -1
  19. package/dist/types/components/AudioPlayer/Interface/Information/Artwork.d.ts +3 -1
  20. package/dist/types/components/AudioPlayer/Interface/Information/TrackInfo.d.ts +3 -1
  21. package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/index.d.ts +3 -1
  22. package/dist/types/components/AudioPlayer/Interface/PlayListEmpty/index.d.ts +6 -0
  23. package/dist/types/components/AudioPlayer/Interface/compound/index.d.ts +3 -0
  24. package/dist/types/components/AudioPlayer/Interface/compound/slotMetaMap.d.ts +10 -0
  25. package/dist/types/components/AudioPlayer/Interface/compound/useCompoundSlots.d.ts +6 -0
  26. package/dist/types/components/AudioPlayer/Interface/compound/useDuplicateSlotWarning.d.ts +7 -0
  27. package/dist/types/components/AudioPlayer/Interface/contexts/index.d.ts +2 -0
  28. package/dist/types/components/AudioPlayer/Interface/contexts/playListEmptyContext.d.ts +2 -0
  29. package/dist/types/components/AudioPlayer/Interface/contexts/playListPortalContext.d.ts +1 -0
  30. package/dist/types/components/AudioPlayer/Interface/hooks/index.d.ts +2 -0
  31. package/dist/types/components/AudioPlayer/Interface/hooks/useGridTemplate.d.ts +3 -0
  32. package/dist/types/components/AudioPlayer/Interface/hooks/useResolvedGridArea.d.ts +2 -0
  33. package/dist/types/components/AudioPlayer/index.d.ts +23 -2
  34. package/dist/types/components/Drawer/Drawer.d.ts +1 -0
  35. package/dist/types/components/Grid/Item.d.ts +3 -2
  36. package/dist/types/components/Grid/index.d.ts +1 -0
  37. package/dist/types/hooks/index.d.ts +1 -2
  38. package/dist/types/index.d.ts +2 -2
  39. package/dist/types/utils/ssr.d.ts +0 -2
  40. package/llms.txt +61 -0
  41. package/package.json +4 -2
  42. package/dist/types/hooks/context/useAudioAttrsContext.d.ts +0 -2
  43. package/dist/types/hooks/context/usePlaybackContext.d.ts +0 -2
  44. package/dist/types/hooks/context/useResourceContext.d.ts +0 -2
  45. package/dist/types/hooks/context/useTimeContext.d.ts +0 -2
  46. package/dist/types/hooks/context/useTrackContext.d.ts +0 -2
  47. package/dist/types/hooks/context/useUIContext.d.ts +0 -1
  48. package/dist/types/hooks/useGridTemplate.d.ts +0 -2
  49. /package/dist/types/components/AudioPlayer/Interface/Controller/Button/{NextBtn.d.ts → TransportControls/NextBtn.d.ts} +0 -0
  50. /package/dist/types/components/AudioPlayer/Interface/Controller/Button/{PlayBtn.d.ts → TransportControls/PlayBtn.d.ts} +0 -0
  51. /package/dist/types/components/AudioPlayer/Interface/Controller/Button/{PrevBtn.d.ts → TransportControls/PrevBtn.d.ts} +0 -0
  52. /package/dist/types/{utils → components/AudioPlayer/utils}/clampVolume.d.ts +0 -0
  53. /package/dist/types/hooks/{context/useNonNullableContext.d.ts → useNonNullableContext.d.ts} +0 -0
package/dist/index.es.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import './index.css';
3
- import { jsx as i, Fragment as z, jsxs as w } from "react/jsx-runtime";
4
- import te, { createContext as H, useReducer as it, useMemo as D, useContext as lt, forwardRef as ve, useCallback as f, useRef as A, useEffect as E, memo as W, useState as C, useId as Ne, useLayoutEffect as ct, cloneElement as ut } from "react";
5
- import dt, { flushSync as be } from "react-dom";
6
- const F = {
3
+ import { jsx as s, Fragment as R, jsxs as w } from "react/jsx-runtime";
4
+ import ee, { createContext as O, useContext as he, useReducer as kt, useMemo as k, forwardRef as Pe, useCallback as g, useRef as A, useEffect as P, memo as G, useState as b, useId as Be, useLayoutEffect as Ct, cloneElement as xt, isValidElement as Mt } from "react";
5
+ import _t, { flushSync as $e } from "react-dom";
6
+ const H = {
7
7
  isPlaying: !1,
8
8
  volume: 1,
9
9
  muted: !1,
10
10
  repeatType: "ALL",
11
11
  currentTime: 0,
12
12
  duration: 0
13
- }, pr = 10, N = {
13
+ }, _r = 10, de = {
14
14
  templateArea: {
15
15
  artwork: "row1-1",
16
16
  trackInfo: "row1-2",
@@ -22,15 +22,15 @@ const F = {
22
22
  playButton: "row1-8",
23
23
  playList: "row1-9"
24
24
  }
25
- }, P = H(null);
26
- P.displayName = "AudioPlayerDispatchContext";
27
- const Ce = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) => Math.round(Math.random() * (t - e) + e), mt = 1, ke = (e, t, o) => {
28
- if (o - t < 1) return e;
29
- let r = Le(t, o);
30
- for (; r === e; )
31
- r = Le(t, o);
32
- return r;
33
- }, pt = (e, t) => {
25
+ }, L = O(null);
26
+ L.displayName = "AudioPlayerDispatchContext";
27
+ const Fe = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Oe = (e, t) => Math.round(Math.random() * (t - e) + e), Dt = 1, Ve = (e, t, n) => {
28
+ if (n - t < 1) return e;
29
+ let a = Oe(t, n);
30
+ for (; a === e; )
31
+ a = Oe(t, n);
32
+ return a;
33
+ }, Ut = (e, t) => {
34
34
  switch (t.type) {
35
35
  case "NEXT_AUDIO": {
36
36
  if (e.playList.length === 0) return e;
@@ -51,7 +51,7 @@ const Ce = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) =>
51
51
  audioResetKey: e.audioResetKey + 1,
52
52
  curAudioState: { ...e.curAudioState, currentTime: 0 }
53
53
  };
54
- const r = ke(
54
+ const a = Ve(
55
55
  e.curIdx,
56
56
  0,
57
57
  e.playList.length - 1
@@ -59,8 +59,8 @@ const Ce = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) =>
59
59
  return {
60
60
  ...e,
61
61
  audioResetKey: e.audioResetKey + 1,
62
- curPlayId: e.playList[r].id,
63
- curIdx: r,
62
+ curPlayId: e.playList[a].id,
63
+ curIdx: a,
64
64
  curAudioState: {
65
65
  ...e.curAudioState,
66
66
  isLoadedMetaData: !1,
@@ -68,41 +68,41 @@ const Ce = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) =>
68
68
  }
69
69
  };
70
70
  }
71
- const o = (e.curIdx + 1) % e.playList.length;
71
+ const n = (e.curIdx + 1) % e.playList.length;
72
72
  return {
73
73
  ...e,
74
74
  audioResetKey: e.audioResetKey + 1,
75
- curIdx: o,
76
- curPlayId: e.playList[o].id,
75
+ curIdx: n,
76
+ curPlayId: e.playList[n].id,
77
77
  curAudioState: { ...e.curAudioState, currentTime: 0 }
78
78
  };
79
79
  }
80
80
  case "PREV_AUDIO": {
81
- const o = e.playList.length <= 1, r = t.currentTime > mt, a = e.curAudioState.repeatType === "NONE" && e.curIdx === 0;
82
- if (o || r || a)
81
+ const n = e.playList.length <= 1, a = t.currentTime > Dt, r = e.curAudioState.repeatType === "NONE" && e.curIdx === 0;
82
+ if (n || a || r)
83
83
  return {
84
84
  ...e,
85
85
  audioResetKey: e.audioResetKey + 1,
86
86
  curAudioState: { ...e.curAudioState, currentTime: 0 }
87
87
  };
88
88
  if (e.curAudioState.repeatType === "SHUFFLE") {
89
- const n = ke(
89
+ const o = Ve(
90
90
  e.curIdx,
91
91
  0,
92
92
  e.playList.length - 1
93
93
  );
94
94
  return {
95
95
  ...e,
96
- curPlayId: e.playList[n].id,
97
- curIdx: n,
96
+ curPlayId: e.playList[o].id,
97
+ curIdx: o,
98
98
  curAudioState: { ...e.curAudioState, currentTime: 0 }
99
99
  };
100
100
  }
101
- const s = (e.curIdx - 1 + e.playList.length) % e.playList.length;
101
+ const i = (e.curIdx - 1 + e.playList.length) % e.playList.length;
102
102
  return {
103
103
  ...e,
104
- curPlayId: e.playList[s].id,
105
- curIdx: s,
104
+ curPlayId: e.playList[i].id,
105
+ curIdx: i,
106
106
  curAudioState: {
107
107
  ...e.curAudioState,
108
108
  isLoadedMetaData: !1,
@@ -126,7 +126,7 @@ const Ce = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) =>
126
126
  }
127
127
  };
128
128
  if (!t.playList.find(
129
- (a) => a.id === e.curPlayId
129
+ (r) => r.id === e.curPlayId
130
130
  ))
131
131
  return {
132
132
  ...e,
@@ -140,13 +140,13 @@ const Ce = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) =>
140
140
  isLoadedMetaData: !1
141
141
  }
142
142
  };
143
- const r = t.playList.findIndex(
144
- (a) => a.id === e.curPlayId
143
+ const a = t.playList.findIndex(
144
+ (r) => r.id === e.curPlayId
145
145
  );
146
146
  return {
147
147
  ...e,
148
148
  playList: t.playList,
149
- curIdx: r
149
+ curIdx: a
150
150
  };
151
151
  }
152
152
  case "SET_VOLUME":
@@ -154,7 +154,7 @@ const Ce = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) =>
154
154
  ...e,
155
155
  curAudioState: {
156
156
  ...e.curAudioState,
157
- volume: Ce(t.volume)
157
+ volume: Fe(t.volume)
158
158
  }
159
159
  };
160
160
  case "SET_AUDIO_STATE":
@@ -247,370 +247,381 @@ const Ce = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) =>
247
247
  default:
248
248
  throw new Error("Unhandled action");
249
249
  }
250
- }, Te = H(null);
251
- Te.displayName = "PlaybackContext";
252
- const he = H(null);
253
- he.displayName = "AudioAttrsContext";
254
- const fe = H(null);
255
- fe.displayName = "TrackContext";
256
- const ge = H(null);
257
- ge.displayName = "UIContext";
258
- const Ae = H(null);
259
- Ae.displayName = "ResourceContext";
260
- const Ee = H(null);
261
- Ee.displayName = "TimeContext";
262
- function yt(e) {
250
+ }, Ae = O(null);
251
+ Ae.displayName = "PlaybackContext";
252
+ const Ie = O(null);
253
+ Ie.displayName = "AudioAttrsContext";
254
+ const Se = O(null);
255
+ Se.displayName = "TrackContext";
256
+ const we = O(null);
257
+ we.displayName = "UIContext";
258
+ const Le = O(null);
259
+ Le.displayName = "ResourceContext";
260
+ const Ne = O(null);
261
+ Ne.displayName = "TimeContext";
262
+ const E = (e) => {
263
+ const t = he(e);
264
+ if (!t) {
265
+ const n = e.displayName || "Context";
266
+ throw new Error(`${n} is not provided`);
267
+ }
268
+ return t;
269
+ }, C = () => E(Ae), te = () => E(Ne), K = () => E(Se), x = () => E(we), N = () => E(Le), Ot = () => E(Ie);
270
+ function Vt(e) {
263
271
  const {
264
272
  playList: t,
265
- audioInitialState: o,
266
- activeUI: r,
267
- placement: a,
268
- customIcons: s,
269
- coverImgsCss: n
273
+ audioInitialState: n,
274
+ activeUI: a,
275
+ placement: r,
276
+ customIcons: i,
277
+ coverImgsCss: o
270
278
  } = e, c = {
271
- isPlaying: (o == null ? void 0 : o.isPlaying) ?? F.isPlaying,
272
- repeatType: (o == null ? void 0 : o.repeatType) ?? F.repeatType,
273
- volume: typeof (o == null ? void 0 : o.volume) == "number" ? Ce(o.volume) : F.volume,
274
- muted: (o == null ? void 0 : o.muted) ?? F.muted
275
- }, d = r || { playButton: !0 }, m = {
276
- playerPlacement: a == null ? void 0 : a.player,
277
- playListPlacement: (a == null ? void 0 : a.playList) || "bottom",
278
- interfacePlacement: (a == null ? void 0 : a.interface) || {
279
+ isPlaying: (n == null ? void 0 : n.isPlaying) ?? H.isPlaying,
280
+ repeatType: (n == null ? void 0 : n.repeatType) ?? H.repeatType,
281
+ volume: typeof (n == null ? void 0 : n.volume) == "number" ? Fe(n.volume) : H.volume,
282
+ muted: (n == null ? void 0 : n.muted) ?? H.muted
283
+ }, u = a || { playButton: !0 }, d = {
284
+ playerPlacement: r == null ? void 0 : r.player,
285
+ playListPlacement: (r == null ? void 0 : r.playList) || "bottom",
286
+ interfacePlacement: (r == null ? void 0 : r.interface) || {
279
287
  templateArea: {
280
- playButton: N.templateArea.playButton
288
+ playButton: de.templateArea.playButton
281
289
  }
282
290
  },
283
- volumeSliderPlacement: a == null ? void 0 : a.volumeSlider
284
- }, l = t.length === 0, y = o == null ? void 0 : o.curPlayId, u = y == null ? -1 : t.findIndex((p) => p.id === y);
291
+ volumeSliderPlacement: r == null ? void 0 : r.volumeSlider
292
+ }, l = t.length === 0, p = n == null ? void 0 : n.curPlayId, m = p == null ? -1 : t.findIndex((y) => y.id === p);
285
293
  return {
286
294
  playList: t,
287
- curPlayId: l ? 0 : u >= 0 ? y : t[0].id,
288
- curIdx: l ? -1 : u >= 0 ? u : 0,
295
+ curPlayId: l ? 0 : m >= 0 ? p : t[0].id,
296
+ curIdx: l ? -1 : m >= 0 ? m : 0,
289
297
  curAudioState: c,
290
- activeUI: d,
298
+ activeUI: u,
291
299
  audioResetKey: 0,
292
300
  seekRequestKey: 0,
293
- ...m,
294
- customIcons: s,
295
- coverImgsCss: n
301
+ ...d,
302
+ customIcons: i,
303
+ coverImgsCss: o
296
304
  };
297
305
  }
298
- const vt = ({
306
+ const Kt = ({
299
307
  children: e,
300
308
  colorScheme: t,
301
- ...o
309
+ ...n
302
310
  }) => {
303
- var u, p;
304
- const [r, a] = it(
305
- pt,
306
- o,
307
- yt
308
- ), s = D(
311
+ var y, f;
312
+ const [a, r] = kt(
313
+ Ut,
314
+ n,
315
+ Vt
316
+ ), i = k(
309
317
  () => ({
310
- currentTime: r.curAudioState.currentTime ?? F.currentTime,
311
- duration: r.curAudioState.duration ?? F.duration,
312
- seekRequestKey: r.seekRequestKey
318
+ currentTime: a.curAudioState.currentTime ?? H.currentTime,
319
+ duration: a.curAudioState.duration ?? H.duration,
320
+ seekRequestKey: a.seekRequestKey
313
321
  }),
314
322
  [
315
- r.curAudioState.currentTime,
316
- r.curAudioState.duration,
317
- r.seekRequestKey
323
+ a.curAudioState.currentTime,
324
+ a.curAudioState.duration,
325
+ a.seekRequestKey
318
326
  ]
319
- ), n = D(
327
+ ), o = k(
320
328
  () => ({
321
- isPlaying: r.curAudioState.isPlaying ?? F.isPlaying,
322
- volume: r.curAudioState.volume ?? F.volume,
323
- muted: r.curAudioState.muted ?? F.muted,
324
- repeatType: r.curAudioState.repeatType,
325
- isLoadedMetaData: r.curAudioState.isLoadedMetaData,
326
- audioResetKey: r.audioResetKey
329
+ isPlaying: a.curAudioState.isPlaying ?? H.isPlaying,
330
+ volume: a.curAudioState.volume ?? H.volume,
331
+ muted: a.curAudioState.muted ?? H.muted,
332
+ repeatType: a.curAudioState.repeatType,
333
+ isLoadedMetaData: a.curAudioState.isLoadedMetaData,
334
+ audioResetKey: a.audioResetKey
327
335
  }),
328
336
  [
329
- r.curAudioState.isPlaying,
330
- r.curAudioState.isLoadedMetaData,
331
- r.curAudioState.volume,
332
- r.curAudioState.muted,
333
- r.curAudioState.repeatType,
334
- r.audioResetKey
337
+ a.curAudioState.isPlaying,
338
+ a.curAudioState.isLoadedMetaData,
339
+ a.curAudioState.volume,
340
+ a.curAudioState.muted,
341
+ a.curAudioState.repeatType,
342
+ a.audioResetKey
335
343
  ]
336
- ), c = D(
344
+ ), c = k(
337
345
  () => ({
338
- playList: r.playList,
339
- curPlayId: r.curPlayId,
340
- curIdx: r.curIdx
346
+ playList: a.playList,
347
+ curPlayId: a.curPlayId,
348
+ curIdx: a.curIdx
341
349
  }),
342
- [r.playList, r.curPlayId, r.curIdx]
343
- ), d = D(
350
+ [a.playList, a.curPlayId, a.curIdx]
351
+ ), { audioInitialState: u } = n, d = u == null ? void 0 : u.playListExpanded, l = k(
344
352
  () => ({
345
- activeUI: r.activeUI,
346
- playListPlacement: r.playListPlacement,
347
- playerPlacement: r.playerPlacement,
348
- interfacePlacement: r.interfacePlacement,
349
- volumeSliderPlacement: r.volumeSliderPlacement,
350
- colorScheme: t
353
+ activeUI: a.activeUI,
354
+ playListPlacement: a.playListPlacement,
355
+ playerPlacement: a.playerPlacement,
356
+ interfacePlacement: a.interfacePlacement,
357
+ volumeSliderPlacement: a.volumeSliderPlacement,
358
+ colorScheme: t,
359
+ playListExpanded: d
351
360
  }),
352
361
  [
353
- r.activeUI,
354
- r.playListPlacement,
355
- r.playerPlacement,
356
- r.interfacePlacement,
357
- r.volumeSliderPlacement,
358
- t
362
+ a.activeUI,
363
+ a.playListPlacement,
364
+ a.playerPlacement,
365
+ a.interfacePlacement,
366
+ a.volumeSliderPlacement,
367
+ t,
368
+ d
359
369
  ]
360
- ), { audioInitialState: m } = o, l = D(() => {
361
- if (!m) return {};
370
+ ), p = k(() => {
371
+ if (!u) return {};
362
372
  const {
363
- isPlaying: T,
364
- repeatType: v,
373
+ isPlaying: v,
374
+ repeatType: T,
365
375
  isLoadedMetaData: h,
366
- currentTime: S,
367
- duration: k,
368
- volume: B,
369
- muted: R,
370
- curPlayId: G,
371
- ...ae
372
- } = m;
373
- return ae;
374
- }, [m]), y = D(
376
+ currentTime: I,
377
+ duration: B,
378
+ volume: re,
379
+ muted: se,
380
+ curPlayId: D,
381
+ playListExpanded: ce,
382
+ ...q
383
+ } = u;
384
+ return q;
385
+ }, [u]), m = k(
375
386
  () => ({
376
- elementRefs: r.elementRefs,
377
- customIcons: r.customIcons,
378
- coverImgsCss: r.coverImgsCss
387
+ elementRefs: a.elementRefs,
388
+ customIcons: a.customIcons,
389
+ coverImgsCss: a.coverImgsCss
379
390
  }),
380
391
  [
381
- (u = r.elementRefs) == null ? void 0 : u.audioEl,
382
- (p = r.elementRefs) == null ? void 0 : p.waveformInst,
383
- r.customIcons,
384
- r.coverImgsCss
392
+ (y = a.elementRefs) == null ? void 0 : y.audioEl,
393
+ (f = a.elementRefs) == null ? void 0 : f.waveformInst,
394
+ a.customIcons,
395
+ a.coverImgsCss
385
396
  ]
386
397
  );
387
- return /* @__PURE__ */ i(Ee.Provider, { value: s, children: /* @__PURE__ */ i(Te.Provider, { value: n, children: /* @__PURE__ */ i(fe.Provider, { value: c, children: /* @__PURE__ */ i(ge.Provider, { value: d, children: /* @__PURE__ */ i(Ae.Provider, { value: y, children: /* @__PURE__ */ i(he.Provider, { value: l, children: /* @__PURE__ */ i(P.Provider, { value: a, children: e }) }) }) }) }) }) });
388
- }, g = (e) => {
389
- const t = lt(e);
390
- if (!t) {
391
- const o = e.displayName || "Context";
392
- throw new Error(`${o} is not provided`);
393
- }
394
- return t;
395
- }, O = () => g(ge), J = {
398
+ return /* @__PURE__ */ s(Ne.Provider, { value: i, children: /* @__PURE__ */ s(Ae.Provider, { value: o, children: /* @__PURE__ */ s(Se.Provider, { value: c, children: /* @__PURE__ */ s(we.Provider, { value: l, children: /* @__PURE__ */ s(Le.Provider, { value: m, children: /* @__PURE__ */ s(Ie.Provider, { value: p, children: /* @__PURE__ */ s(L.Provider, { value: r, children: e }) }) }) }) }) }) });
399
+ }, Q = {
396
400
  top: "auto",
397
401
  right: "auto",
398
402
  bottom: "auto",
399
403
  left: "auto"
400
- }, Tt = {
401
- bottom: { ...J, bottom: 0 },
402
- top: { ...J, top: 0 },
403
- "bottom-left": { ...J, bottom: 0, left: 0 },
404
- "bottom-right": { ...J, bottom: 0, right: 0 },
405
- "top-left": { ...J, top: 0, left: 0 },
406
- "top-right": { ...J, top: 0, right: 0 }
407
- }, Me = te.memo(({ children: e, rootContainerProps: t }) => {
408
- const { playerPlacement: o, colorScheme: r } = O(), a = D(
409
- () => o ? Tt[o] : void 0,
410
- [o]
411
- ), n = {
404
+ }, Bt = {
405
+ bottom: { ...Q, bottom: 0 },
406
+ top: { ...Q, top: 0 },
407
+ "bottom-left": { ...Q, bottom: 0, left: 0 },
408
+ "bottom-right": { ...Q, bottom: 0, right: 0 },
409
+ "top-left": { ...Q, top: 0, left: 0 },
410
+ "top-right": { ...Q, top: 0, right: 0 }
411
+ }, He = ee.memo(({ children: e, rootContainerProps: t }) => {
412
+ const { playerPlacement: n, colorScheme: a } = x(), r = k(
413
+ () => n ? Bt[n] : void 0,
414
+ [n]
415
+ ), o = {
412
416
  width: "100%",
413
- position: o !== "static" && !!o ? "fixed" : "static",
414
- ...a,
417
+ position: n !== "static" && !!n ? "fixed" : "static",
418
+ ...r,
415
419
  ...(t == null ? void 0 : t.style) ?? {}
416
420
  };
417
- return /* @__PURE__ */ i(
421
+ return /* @__PURE__ */ s(
418
422
  "div",
419
423
  {
420
424
  ...t,
421
425
  className: `rmap-player-provider${t != null && t.className ? ` ${t.className}` : ""}`,
422
- "data-theme": r ?? void 0,
423
- style: n,
426
+ "data-theme": a ?? void 0,
427
+ style: o,
424
428
  children: e
425
429
  }
426
430
  );
427
431
  });
428
- Me.displayName = "AudioPlayerContainer";
429
- const ht = ({
432
+ He.displayName = "AudioPlayerContainer";
433
+ const $t = ({
430
434
  areas: e,
431
435
  columns: t,
432
- alignItems: o,
433
- justifyContent: r,
434
- minHeight: a,
435
- UNSAFE_className: s,
436
- children: n
436
+ alignItems: n,
437
+ justifyContent: a,
438
+ minHeight: r,
439
+ UNSAFE_className: i,
440
+ children: o
437
441
  }) => {
438
442
  const c = {
439
443
  display: "grid",
440
- gridTemplateAreas: e == null ? void 0 : e.map((d) => `"${d}"`).join(" "),
444
+ gridTemplateAreas: e == null ? void 0 : e.map((u) => `"${u}"`).join(" "),
441
445
  gridTemplateColumns: t == null ? void 0 : t.join(" "),
442
- alignItems: o,
443
- justifyContent: r,
444
- minHeight: a
446
+ alignItems: n,
447
+ justifyContent: a,
448
+ minHeight: r
445
449
  };
446
- return /* @__PURE__ */ i("div", { className: s, style: c, children: n });
447
- }, ft = ht, xe = ve(
450
+ return /* @__PURE__ */ s("div", { className: i, style: c, children: o });
451
+ }, Ft = $t, Re = Pe(
448
452
  ({
449
453
  children: e,
450
454
  visible: t = !0,
451
- gridArea: o,
452
- width: r,
453
- justifySelf: a = "center",
454
- padding: s,
455
- UNSAFE_className: n,
455
+ gridArea: n,
456
+ width: a,
457
+ justifySelf: r = "center",
458
+ padding: i,
459
+ UNSAFE_className: o,
456
460
  style: c,
457
- ...d
458
- }, m) => {
461
+ ...u
462
+ }, d) => {
459
463
  if (!t) return null;
460
464
  const l = {
461
- gridArea: o,
462
- width: r,
463
- justifySelf: a,
464
- padding: s ?? "0 5px",
465
+ gridArea: n,
466
+ width: a,
467
+ justifySelf: r,
468
+ padding: i ?? "0 5px",
465
469
  ...c
466
470
  };
467
- return /* @__PURE__ */ i("div", { ref: m, className: n, style: l, ...d, children: e });
471
+ return /* @__PURE__ */ s("div", { ref: d, className: o, style: l, ...u, children: e });
468
472
  }
469
473
  );
470
- xe.displayName = "GridItem";
471
- const M = ft;
472
- M.Item = xe;
473
- const b = () => g(Te), re = () => g(Ee), V = () => g(fe), L = () => g(Ae), _e = ({
474
+ Re.displayName = "GridItem";
475
+ const _ = Ft;
476
+ _.Item = Re;
477
+ const Ht = ({
474
478
  children: e,
475
479
  id: t,
476
- ...o
480
+ ...n
477
481
  }) => {
478
- var l, y;
479
- const r = b(), a = re(), s = V(), n = O(), c = L(), d = {
482
+ var l, p;
483
+ const a = C(), r = te(), i = K(), o = x(), c = N(), u = {
480
484
  curAudioState: {
481
- isPlaying: r.isPlaying,
482
- volume: r.volume,
483
- muted: r.muted,
484
- repeatType: r.repeatType,
485
- isLoadedMetaData: r.isLoadedMetaData,
486
- currentTime: a.currentTime,
487
- duration: a.duration
485
+ isPlaying: a.isPlaying,
486
+ volume: a.volume,
487
+ muted: a.muted,
488
+ repeatType: a.repeatType,
489
+ isLoadedMetaData: a.isLoadedMetaData,
490
+ currentTime: r.currentTime,
491
+ duration: r.duration
488
492
  },
489
- audioResetKey: r.audioResetKey,
490
- ...a,
491
- ...s,
492
- ...n,
493
+ audioResetKey: a.audioResetKey,
494
+ ...r,
495
+ ...i,
496
+ ...o,
493
497
  ...c
494
- }, m = (y = (l = n.interfacePlacement) == null ? void 0 : l.customComponentsArea) == null ? void 0 : y[t];
495
- return /* @__PURE__ */ i(
496
- M.Item,
498
+ }, d = (p = (l = o.interfacePlacement) == null ? void 0 : l.customComponentsArea) == null ? void 0 : p[t];
499
+ return /* @__PURE__ */ s(
500
+ _.Item,
497
501
  {
498
502
  UNSAFE_className: "rmap-custom-component",
499
- gridArea: m,
500
- ...o,
501
- children: te.cloneElement(e, { audioPlayerState: d })
503
+ gridArea: d,
504
+ ...n,
505
+ children: ee.cloneElement(e, { audioPlayerState: u })
502
506
  }
503
507
  );
504
- }, gt = () => g(he), At = () => {
508
+ }, ze = "PlayListEmpty", Ge = () => null;
509
+ Ge.displayName = ze;
510
+ const Rt = () => {
505
511
  const {
506
512
  isPlaying: e,
507
513
  volume: t,
508
- repeatType: o,
509
- audioResetKey: r
510
- } = b(), { currentTime: a, seekRequestKey: s } = re(), { elementRefs: n } = L(), c = g(P), d = f(
511
- (p) => {
512
- if (p.currentTarget.readyState === 0) return;
513
- const T = p.currentTarget.currentTime;
514
+ repeatType: n,
515
+ audioResetKey: a
516
+ } = C(), { currentTime: r, seekRequestKey: i } = te(), { elementRefs: o } = N(), c = E(L), u = g(
517
+ (y) => {
518
+ if (y.currentTarget.readyState === 0) return;
519
+ const f = y.currentTarget.currentTime;
514
520
  c({
515
521
  type: "SET_AUDIO_STATE",
516
- audioState: { currentTime: T }
522
+ audioState: { currentTime: f }
517
523
  });
518
524
  },
519
525
  [c]
520
- ), m = f(() => {
521
- if (n != null && n.audioEl) {
522
- if (o === "ONE") {
523
- be(() => {
526
+ ), d = g(() => {
527
+ if (o != null && o.audioEl) {
528
+ if (n === "ONE") {
529
+ $e(() => {
524
530
  c({ type: "SEEK", time: 0 });
525
- }), n.audioEl.play();
531
+ }), o.audioEl.play();
526
532
  return;
527
533
  }
528
534
  c({ type: "NEXT_AUDIO" });
529
535
  }
530
- }, [c, o, n == null ? void 0 : n.audioEl]), l = f(
531
- (p) => {
532
- const { duration: T } = p.currentTarget;
533
- t != null && (p.currentTarget.volume = t), c({
536
+ }, [c, n, o == null ? void 0 : o.audioEl]), l = g(
537
+ (y) => {
538
+ const { duration: f } = y.currentTarget;
539
+ t != null && (y.currentTarget.volume = t), c({
534
540
  type: "SET_AUDIO_STATE",
535
- audioState: { isLoadedMetaData: !0, duration: T }
541
+ audioState: { isLoadedMetaData: !0, duration: f }
536
542
  });
537
543
  },
538
544
  [c, t]
539
- ), y = A(!1);
540
- E(() => {
541
- if (n != null && n.audioEl) {
542
- if (!y.current) {
543
- y.current = !0;
545
+ ), p = A(!1);
546
+ P(() => {
547
+ if (o != null && o.audioEl) {
548
+ if (!p.current) {
549
+ p.current = !0;
544
550
  return;
545
551
  }
546
- n.audioEl.currentTime = 0;
552
+ o.audioEl.currentTime = 0;
547
553
  }
548
- }, [r, n == null ? void 0 : n.audioEl]), E(() => {
549
- n != null && n.audioEl && (e ? n.audioEl.play().catch(() => {
554
+ }, [a, o == null ? void 0 : o.audioEl]), P(() => {
555
+ o != null && o.audioEl && (e ? o.audioEl.play().catch(() => {
550
556
  c({
551
557
  type: "SET_AUDIO_STATE",
552
558
  audioState: { isPlaying: !1 }
553
559
  });
554
- }) : n.audioEl.pause());
555
- }, [n == null ? void 0 : n.audioEl, e, c]), E(() => {
556
- !(n != null && n.audioEl) || t == null || (n.audioEl.volume = t);
557
- }, [n == null ? void 0 : n.audioEl, t]);
558
- const u = A(0);
559
- return E(() => {
560
- if (s === u.current) return;
561
- u.current = s;
562
- const p = n == null ? void 0 : n.audioEl;
563
- if (!p || a == null) return;
564
- p.currentTime = a;
565
- const T = n == null ? void 0 : n.waveformInst, v = p.duration, h = Number.isFinite(v) && v > 0;
566
- if (!T || !h) return;
567
- const S = a / v, k = Math.min(1, Math.max(0, S));
568
- T.seekTo(k);
560
+ }) : o.audioEl.pause());
561
+ }, [o == null ? void 0 : o.audioEl, e, c]), P(() => {
562
+ !(o != null && o.audioEl) || t == null || (o.audioEl.volume = t);
563
+ }, [o == null ? void 0 : o.audioEl, t]);
564
+ const m = A(0);
565
+ return P(() => {
566
+ if (i === m.current) return;
567
+ m.current = i;
568
+ const y = o == null ? void 0 : o.audioEl;
569
+ if (!y || r == null) return;
570
+ y.currentTime = r;
571
+ const f = o == null ? void 0 : o.waveformInst, v = y.duration, T = Number.isFinite(v) && v > 0;
572
+ if (!f || !T) return;
573
+ const h = r / v, I = Math.min(1, Math.max(0, h));
574
+ f.seekTo(I);
569
575
  }, [
570
- s,
571
- a,
572
- n == null ? void 0 : n.audioEl,
573
- n == null ? void 0 : n.waveformInst
576
+ i,
577
+ r,
578
+ o == null ? void 0 : o.audioEl,
579
+ o == null ? void 0 : o.waveformInst
574
580
  ]), {
575
- onTimeUpdate: d,
576
- onEnded: m,
581
+ onTimeUpdate: u,
582
+ onEnded: d,
577
583
  onLoadedMetadata: l
578
584
  };
579
- }, De = te.memo(({ audioRef: e }) => {
580
- const t = A(null), { muted: o } = b(), { curPlayId: r, playList: a } = V(), s = gt(), n = g(P), c = a.find(
581
- (m) => m.id === r
582
- ), d = At();
583
- return E(() => {
584
- t.current && (n({
585
+ }, We = ee.memo(({ audioRef: e }) => {
586
+ const t = A(null), { muted: n } = C(), { curPlayId: a, playList: r } = K(), i = Ot(), o = E(L), c = r.find(
587
+ (d) => d.id === a
588
+ ), u = Rt();
589
+ return P(() => {
590
+ t.current && (o({
585
591
  type: "SET_ELEMENT_REFS",
586
592
  elementRefs: { audioEl: t.current }
587
593
  }), e && (e.current = t.current));
588
- }, [n, e]), /* @__PURE__ */ i(
594
+ }, [o, e]), /* @__PURE__ */ s(
589
595
  "audio",
590
596
  {
591
597
  id: "rm-audio-player-audio",
592
- ...s,
593
- muted: o,
598
+ ...i,
599
+ muted: n,
594
600
  ref: t,
595
601
  src: c == null ? void 0 : c.src,
596
- ...d
602
+ ...u
597
603
  }
598
604
  );
599
605
  });
600
- De.displayName = "Audio";
601
- const q = ve(({ className: e, type: t = "button", ...o }, r) => /* @__PURE__ */ i(
606
+ We.displayName = "Audio";
607
+ function z(e, t) {
608
+ var a, r;
609
+ const { interfacePlacement: n } = x();
610
+ return t ?? ((a = n == null ? void 0 : n.itemCustomArea) == null ? void 0 : a[e]) ?? ((r = n == null ? void 0 : n.templateArea) == null ? void 0 : r[e]) ?? de.templateArea[e];
611
+ }
612
+ const j = Pe(({ className: e, type: t = "button", ...n }, a) => /* @__PURE__ */ s(
602
613
  "button",
603
614
  {
604
- ref: r,
615
+ ref: a,
605
616
  type: t,
606
617
  className: `styled-btn${e ? ` ${e}` : ""}`,
607
- ...o
618
+ ...n
608
619
  }
609
620
  ));
610
- q.displayName = "StyledBtn";
611
- const Ie = (e) => (
621
+ j.displayName = "StyledBtn";
622
+ const be = (e) => (
612
623
  // eslint-disable-next-line react/display-name
613
- ({ size: t = "1em", color: o, style: r, ...a }) => /* @__PURE__ */ i(
624
+ ({ size: t = "1em", color: n, style: a, ...r }) => /* @__PURE__ */ s(
614
625
  "svg",
615
626
  {
616
627
  "aria-hidden": "true",
@@ -621,16 +632,16 @@ const Ie = (e) => (
621
632
  viewBox: "0 0 24 24",
622
633
  height: t,
623
634
  width: t,
624
- color: o,
625
- style: o ? { color: o, ...r } : r,
635
+ color: n,
636
+ style: n ? { color: n, ...a } : a,
626
637
  xmlns: "http://www.w3.org/2000/svg",
627
- ...a,
638
+ ...r,
628
639
  dangerouslySetInnerHTML: { __html: e }
629
640
  }
630
641
  )
631
642
  ), Y = (e) => (
632
643
  // eslint-disable-next-line react/display-name
633
- ({ size: t = "1em", color: o, style: r, ...a }) => /* @__PURE__ */ i(
644
+ ({ size: t = "1em", color: n, style: a, ...r }) => /* @__PURE__ */ s(
634
645
  "svg",
635
646
  {
636
647
  "aria-hidden": "true",
@@ -643,16 +654,16 @@ const Ie = (e) => (
643
654
  strokeLinejoin: "round",
644
655
  height: t,
645
656
  width: t,
646
- color: o,
647
- style: o ? { color: o, ...r } : r,
657
+ color: n,
658
+ style: n ? { color: n, ...a } : a,
648
659
  xmlns: "http://www.w3.org/2000/svg",
649
- ...a,
660
+ ...r,
650
661
  dangerouslySetInnerHTML: { __html: e }
651
662
  }
652
663
  )
653
- ), Oe = (e, t = "0 0 16 16") => (
664
+ ), je = (e, t = "0 0 16 16") => (
654
665
  // eslint-disable-next-line react/display-name
655
- ({ size: o = "1em", color: r, style: a, ...s }) => /* @__PURE__ */ i(
666
+ ({ size: n = "1em", color: a, style: r, ...i }) => /* @__PURE__ */ s(
656
667
  "svg",
657
668
  {
658
669
  "aria-hidden": "true",
@@ -661,358 +672,404 @@ const Ie = (e) => (
661
672
  fill: "currentColor",
662
673
  strokeWidth: 0,
663
674
  viewBox: t,
664
- height: o,
665
- width: o,
666
- color: r,
667
- style: r ? { color: r, ...a } : a,
675
+ height: n,
676
+ width: n,
677
+ color: a,
678
+ style: a ? { color: a, ...r } : r,
668
679
  xmlns: "http://www.w3.org/2000/svg",
669
- ...s,
680
+ ...i,
670
681
  dangerouslySetInnerHTML: { __html: e }
671
682
  }
672
683
  )
673
- ), Ue = Ie(
684
+ ), Ye = be(
674
685
  '<path fill="none" d="M0 0h24v24H0z"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z"/>'
675
686
  );
676
- Ue.displayName = "MdPlayCircleFilled";
677
- const Ve = Ie(
687
+ Ye.displayName = "MdPlayCircleFilled";
688
+ const qe = be(
678
689
  '<path fill="none" d="M0 0h24v24H0z"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 14H9V8h2v8zm4 0h-2V8h2v8z"/>'
679
690
  );
680
- Ve.displayName = "MdPauseCircleFilled";
681
- const Be = Ie(
691
+ qe.displayName = "MdPauseCircleFilled";
692
+ const Xe = be(
682
693
  '<path fill="none" d="M0 0h24v24H0z"/><path d="M3 10h11v2H3zM3 6h11v2H3zM3 14h7v2H3zM16 13v8l6-4z"/>'
683
694
  );
684
- Be.displayName = "MdPlaylistPlay";
685
- const Ke = Y(
695
+ Xe.displayName = "MdPlaylistPlay";
696
+ const Qe = Y(
686
697
  '<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3"/><path d="M20 12v3a3 3 0 0 1 -3 3h-13m3 3l-3 -3l3 -3"/>'
687
698
  );
688
- Ke.displayName = "TbRepeat";
689
- const $e = Y(
699
+ Qe.displayName = "TbRepeat";
700
+ const Je = Y(
690
701
  '<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3"/><path d="M20 12v3a3 3 0 0 1 -3 3h-13m3 3l-3 -3l3 -3"/><path d="M11 11l1 -1v4"/>'
691
702
  );
692
- $e.displayName = "TbRepeatOnce";
693
- const Fe = Y(
703
+ Je.displayName = "TbRepeatOnce";
704
+ const Ze = Y(
694
705
  '<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 12v-3c0 -1.336 .873 -2.468 2.08 -2.856m3.92 -.144h10m-3 -3l3 3l-3 3"/><path d="M20 12v3a3 3 0 0 1 -.133 .886m-1.99 1.984a3 3 0 0 1 -.877 .13h-13m3 3l-3 -3l3 -3"/><path d="M3 3l18 18"/>'
695
706
  );
696
- Fe.displayName = "TbRepeatOff";
697
- const He = Y(
707
+ Ze.displayName = "TbRepeatOff";
708
+ const et = Y(
698
709
  '<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 4l3 3l-3 3"/><path d="M18 20l3 -3l-3 -3"/><path d="M3 7h3a5 5 0 0 1 5 5a5 5 0 0 0 5 5h5"/><path d="M21 7h-5a4.978 4.978 0 0 0 -2.998 .998m-4.002 8.003a4.984 4.984 0 0 1 -3 .999h-3"/>'
699
710
  );
700
- He.displayName = "TbArrowsShuffle";
701
- const Re = Y(
711
+ et.displayName = "TbArrowsShuffle";
712
+ const tt = Y(
702
713
  '<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 8a5 5 0 0 1 0 8"/><path d="M17.7 5a9 9 0 0 1 0 14"/><path d="M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a0.8 .8 0 0 1 1.5 .5v14a0.8 .8 0 0 1 -1.5 .5l-3.5 -4.5"/>'
703
714
  );
704
- Re.displayName = "TbVolume";
705
- const ze = Y(
715
+ tt.displayName = "TbVolume";
716
+ const rt = Y(
706
717
  '<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 8a5 5 0 0 1 0 8"/><path d="M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a0.8 .8 0 0 1 1.5 .5v14a0.8 .8 0 0 1 -1.5 .5l-3.5 -4.5"/>'
707
718
  );
708
- ze.displayName = "TbVolume2";
709
- const We = Y(
719
+ rt.displayName = "TbVolume2";
720
+ const at = Y(
710
721
  '<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a0.8 .8 0 0 1 1.5 .5v14a0.8 .8 0 0 1 -1.5 .5l-3.5 -4.5"/><path d="M16 10l4 4m0 -4l-4 4"/>'
711
722
  );
712
- We.displayName = "TbVolume3";
713
- const Ge = Oe(
723
+ at.displayName = "TbVolume3";
724
+ const nt = je(
714
725
  '<path d="M8 0c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zM8 14.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5 6.5 2.91 6.5 6.5-2.91 6.5-6.5 6.5z"/><path d="M7 8l4-3v6z"/><path d="M5 5h2v6h-2v-6z"/>'
715
726
  );
716
- Ge.displayName = "ImPrevious";
717
- const je = Oe(
727
+ nt.displayName = "ImPrevious";
728
+ const ot = je(
718
729
  '<path d="M8 0c4.418 0 8 3.582 8 8s-3.582 8-8 8-8-3.582-8-8 3.582-8 8-8zM8 14.5c3.59 0 6.5-2.91 6.5-6.5s-2.91-6.5-6.5-6.5-6.5 2.91-6.5 6.5 2.91 6.5 6.5 6.5z"/><path d="M9 8l-4-3v6z"/><path d="M11 5h-2v6h2v-6z"/>'
719
730
  );
720
- je.displayName = "ImNext";
721
- const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(z, { children: t ?? e }), Et = W(function() {
722
- const { isPlaying: t } = b(), { customIcons: o } = L(), r = g(P);
723
- return /* @__PURE__ */ i(
724
- q,
731
+ ot.displayName = "ImNext";
732
+ const M = ({ render: e, customIcon: t }) => /* @__PURE__ */ s(R, { children: t ?? e }), zt = G(function() {
733
+ const { isPlaying: t } = C(), { customIcons: n } = N(), a = E(L);
734
+ return /* @__PURE__ */ s(
735
+ j,
725
736
  {
726
737
  type: "button",
727
738
  "aria-label": t ? "Pause" : "Play",
728
- onClick: () => r({ type: "CHANGE_PLAYING_STATE" }),
739
+ onClick: () => a({ type: "CHANGE_PLAYING_STATE" }),
729
740
  className: "rmap-play-btn",
730
741
  "data-testid": "play-btn",
731
- children: t ? /* @__PURE__ */ i(
732
- x,
742
+ children: t ? /* @__PURE__ */ s(
743
+ M,
733
744
  {
734
- render: /* @__PURE__ */ i(Ve, {}),
735
- customIcon: o == null ? void 0 : o.pause
745
+ render: /* @__PURE__ */ s(qe, {}),
746
+ customIcon: n == null ? void 0 : n.pause
736
747
  }
737
- ) : /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(Ue, {}), customIcon: o == null ? void 0 : o.play })
748
+ ) : /* @__PURE__ */ s(M, { render: /* @__PURE__ */ s(Ye, {}), customIcon: n == null ? void 0 : n.play })
738
749
  }
739
750
  );
740
- }), It = W(function({ isVisible: t }) {
741
- const { customIcons: o, elementRefs: r } = L(), a = g(P);
742
- return t ? /* @__PURE__ */ i(
743
- q,
751
+ }), Gt = G(function({ isVisible: t }) {
752
+ const { customIcons: n, elementRefs: a } = N(), r = E(L);
753
+ return t ? /* @__PURE__ */ s(
754
+ j,
744
755
  {
745
756
  type: "button",
746
757
  "aria-label": "Previous track",
747
758
  onClick: () => {
748
759
  var c;
749
- const n = ((c = r == null ? void 0 : r.audioEl) == null ? void 0 : c.currentTime) ?? 0;
750
- a({ type: "PREV_AUDIO", currentTime: n });
760
+ const o = ((c = a == null ? void 0 : a.audioEl) == null ? void 0 : c.currentTime) ?? 0;
761
+ r({ type: "PREV_AUDIO", currentTime: o });
751
762
  },
752
763
  className: "rmap-prev-btn",
753
764
  "data-testid": "prev-btn",
754
- children: /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(Ge, {}), customIcon: o == null ? void 0 : o.prev })
765
+ children: /* @__PURE__ */ s(M, { render: /* @__PURE__ */ s(nt, {}), customIcon: n == null ? void 0 : n.prev })
755
766
  }
756
767
  ) : null;
757
- }), St = W(function({ isVisible: t }) {
758
- const { customIcons: o } = L(), r = g(P);
759
- return t ? /* @__PURE__ */ i(
760
- q,
768
+ }), Wt = G(function({ isVisible: t }) {
769
+ const { customIcons: n } = N(), a = E(L);
770
+ return t ? /* @__PURE__ */ s(
771
+ j,
761
772
  {
762
773
  type: "button",
763
774
  "aria-label": "Next track",
764
775
  onClick: () => {
765
- r({ type: "NEXT_AUDIO" });
776
+ a({ type: "NEXT_AUDIO" });
766
777
  },
767
778
  className: "rmap-next-btn",
768
779
  "data-testid": "next-btn",
769
- children: /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(je, {}), customIcon: o == null ? void 0 : o.next })
780
+ children: /* @__PURE__ */ s(M, { render: /* @__PURE__ */ s(ot, {}), customIcon: n == null ? void 0 : n.next })
770
781
  }
771
782
  ) : null;
772
- }), wt = {
783
+ }), it = ({
784
+ gridArea: e,
785
+ visible: t,
786
+ ...n
787
+ }) => {
788
+ const { activeUI: a } = x(), r = !!(a.prevNnext ?? a.all), i = z("playButton", e);
789
+ return /* @__PURE__ */ s(_.Item, { gridArea: i, visible: t ?? !0, ...n, children: /* @__PURE__ */ w(
790
+ "div",
791
+ {
792
+ className: "rmap-ctrl-btn-wrapper",
793
+ role: "group",
794
+ "aria-label": "Playback controls",
795
+ children: [
796
+ /* @__PURE__ */ s(Gt, { isVisible: r }),
797
+ /* @__PURE__ */ s(zt, {}),
798
+ /* @__PURE__ */ s(Wt, { isVisible: r })
799
+ ]
800
+ }
801
+ ) });
802
+ }, jt = {
773
803
  ALL: "Repeat: All tracks",
774
804
  ONE: "Repeat: One track",
775
805
  NONE: "Repeat: Off",
776
806
  SHUFFLE: "Shuffle"
777
- }, Pt = {
807
+ }, Yt = {
778
808
  ALL: "ONE",
779
809
  ONE: "NONE",
780
810
  NONE: "SHUFFLE",
781
811
  SHUFFLE: "ALL"
782
- }, Lt = W(function() {
783
- const { repeatType: t } = b(), { customIcons: o } = L(), r = g(P), a = () => {
784
- r({
785
- type: "SET_REPEAT_TYPE",
786
- repeatType: Pt[t]
787
- });
788
- };
789
- return /* @__PURE__ */ w(
790
- q,
791
- {
792
- type: "button",
793
- "aria-label": wt[t],
794
- onClick: a,
795
- className: "rmap-repeat-btn",
796
- "data-testid": "repeat-btn",
797
- "data-repeattype": t,
798
- children: [
799
- t === "ALL" && /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(Ke, {}), customIcon: o == null ? void 0 : o.repeatAll }),
800
- t === "ONE" && /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i($e, {}), customIcon: o == null ? void 0 : o.repeatOne }),
801
- t === "NONE" && /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(Fe, {}), customIcon: o == null ? void 0 : o.repeatNone }),
802
- t === "SHUFFLE" && /* @__PURE__ */ i(
803
- x,
812
+ }, st = G(
813
+ function({ gridArea: t, visible: n, ...a }) {
814
+ const { repeatType: r } = C(), { customIcons: i } = N(), o = E(
815
+ L
816
+ ), c = () => {
817
+ o({
818
+ type: "SET_REPEAT_TYPE",
819
+ repeatType: Yt[r]
820
+ });
821
+ }, u = z("repeatType", t);
822
+ return /* @__PURE__ */ s(
823
+ _.Item,
824
+ {
825
+ gridArea: u,
826
+ visible: n ?? !0,
827
+ ...a,
828
+ children: /* @__PURE__ */ w(
829
+ j,
804
830
  {
805
- render: /* @__PURE__ */ i(He, {}),
806
- customIcon: o == null ? void 0 : o.repeatShuffle
831
+ type: "button",
832
+ "aria-label": jt[r],
833
+ onClick: c,
834
+ className: "rmap-repeat-btn",
835
+ "data-testid": "repeat-btn",
836
+ "data-repeattype": r,
837
+ children: [
838
+ r === "ALL" && /* @__PURE__ */ s(M, { render: /* @__PURE__ */ s(Qe, {}), customIcon: i == null ? void 0 : i.repeatAll }),
839
+ r === "ONE" && /* @__PURE__ */ s(
840
+ M,
841
+ {
842
+ render: /* @__PURE__ */ s(Je, {}),
843
+ customIcon: i == null ? void 0 : i.repeatOne
844
+ }
845
+ ),
846
+ r === "NONE" && /* @__PURE__ */ s(
847
+ M,
848
+ {
849
+ render: /* @__PURE__ */ s(Ze, {}),
850
+ customIcon: i == null ? void 0 : i.repeatNone
851
+ }
852
+ ),
853
+ r === "SHUFFLE" && /* @__PURE__ */ s(
854
+ M,
855
+ {
856
+ render: /* @__PURE__ */ s(et, {}),
857
+ customIcon: i == null ? void 0 : i.repeatShuffle
858
+ }
859
+ )
860
+ ]
807
861
  }
808
862
  )
809
- ]
810
- }
811
- );
812
- }), me = { size: "100%" }, qe = W(() => {
813
- var n;
814
- const { volume: e, muted: t } = b(), { customIcons: o, elementRefs: r } = L(), a = e ?? ((n = r == null ? void 0 : r.audioEl) == null ? void 0 : n.volume) ?? 0, s = a > 0 && a <= 0.5;
815
- return t || a === 0 ? /* @__PURE__ */ i(
816
- x,
863
+ }
864
+ );
865
+ }
866
+ ), fe = { size: "100%" }, ct = G(() => {
867
+ var o;
868
+ const { volume: e, muted: t } = C(), { customIcons: n, elementRefs: a } = N(), r = e ?? ((o = a == null ? void 0 : a.audioEl) == null ? void 0 : o.volume) ?? 0, i = r > 0 && r <= 0.5;
869
+ return t || r === 0 ? /* @__PURE__ */ s(
870
+ M,
817
871
  {
818
- render: /* @__PURE__ */ i(We, { ...me }),
819
- customIcon: o == null ? void 0 : o.volumeMuted
872
+ render: /* @__PURE__ */ s(at, { ...fe }),
873
+ customIcon: n == null ? void 0 : n.volumeMuted
820
874
  }
821
- ) : s ? /* @__PURE__ */ i(
822
- x,
875
+ ) : i ? /* @__PURE__ */ s(
876
+ M,
823
877
  {
824
- render: /* @__PURE__ */ i(ze, { ...me }),
825
- customIcon: o == null ? void 0 : o.volumeHalf
878
+ render: /* @__PURE__ */ s(rt, { ...fe }),
879
+ customIcon: n == null ? void 0 : n.volumeHalf
826
880
  }
827
- ) : /* @__PURE__ */ i(
828
- x,
881
+ ) : /* @__PURE__ */ s(
882
+ M,
829
883
  {
830
- render: /* @__PURE__ */ i(Re, { ...me }),
831
- customIcon: o == null ? void 0 : o.volumeFull
884
+ render: /* @__PURE__ */ s(tt, { ...fe }),
885
+ customIcon: n == null ? void 0 : n.volumeFull
832
886
  }
833
887
  );
834
888
  });
835
- qe.displayName = "VolumeIcon";
836
- const le = H(null);
837
- le.displayName = "DrawerContext";
838
- const Ye = (e, t) => {
839
- E(() => {
840
- const o = (r) => {
841
- const a = e.current, { target: s } = r;
842
- !r || !a || a.contains(s) || t(r);
889
+ ct.displayName = "VolumeIcon";
890
+ const ie = O(null);
891
+ ie.displayName = "DrawerContext";
892
+ const lt = (e, t) => {
893
+ P(() => {
894
+ const n = (a) => {
895
+ const r = e.current, { target: i } = a;
896
+ !a || !r || r.contains(i) || t(a);
843
897
  };
844
- return document.addEventListener("click", o), () => document.removeEventListener("click", o);
898
+ return document.addEventListener("click", n), () => document.removeEventListener("click", n);
845
899
  }, [e, t]);
846
- }, se = ({
900
+ }, ne = ({
847
901
  outboundClickActive: e = !1,
848
902
  placement: t = "bottom",
849
- children: o,
850
- isOpen: r,
851
- onOpenChange: a
903
+ children: n,
904
+ isOpen: a,
905
+ onOpenChange: r,
906
+ initialOpen: i
852
907
  }) => {
853
- const s = A(null), [n, c] = te.Children.toArray(o), [d, m] = C(!1), l = Ne();
854
- Ye(s, () => {
855
- e && (m(!1), a && a(!1));
856
- }), E(() => {
857
- r !== void 0 && m(r);
858
- }, [r]);
859
- const y = D(
860
- () => ({ isOpen: d, setIsOpen: m, onOpenChange: a, drawerId: l }),
861
- [d, m, a, l]
908
+ const o = A(null), [c, u] = ee.Children.toArray(n), [d, l] = b(
909
+ a !== void 0 ? a : i ?? !1
910
+ ), p = Be();
911
+ lt(o, () => {
912
+ e && (l(!1), r && r(!1));
913
+ }), P(() => {
914
+ a !== void 0 && l(a);
915
+ }, [a]);
916
+ const m = k(
917
+ () => ({ isOpen: d, setIsOpen: l, onOpenChange: r, drawerId: p }),
918
+ [d, l, r, p]
862
919
  );
863
- return /* @__PURE__ */ i("div", { className: "rmap-drawer-container", ref: s, children: /* @__PURE__ */ i(le.Provider, { value: y, children: /* @__PURE__ */ w(z, { children: [
864
- t === "top" && c,
865
- n,
866
- t === "bottom" && c
920
+ return /* @__PURE__ */ s("div", { className: "rmap-drawer-container", ref: o, children: /* @__PURE__ */ s(ie.Provider, { value: m, children: /* @__PURE__ */ w(R, { children: [
921
+ t === "top" && u,
922
+ c,
923
+ t === "bottom" && u
867
924
  ] }) }) });
868
- }, Xe = typeof window < "u", pe = Xe ? ct : E, Se = ({
925
+ }, ut = typeof window < "u", Te = ut ? Ct : P, ke = ({
869
926
  visible: e,
870
927
  name: t,
871
- leaveTime: o,
872
- enterTime: r,
873
- clearTime: a,
874
- onExited: s,
875
- onEntered: n,
928
+ leaveTime: n,
929
+ enterTime: a,
930
+ clearTime: r,
931
+ onExited: i,
932
+ onEntered: o,
876
933
  children: c
877
934
  }) => {
878
- const [d, m] = C(""), [l, y] = C(!1), u = A(n), p = A(s), T = A(t), v = A(r), h = A(o), S = A(a);
879
- return pe(() => {
880
- u.current = n, p.current = s, T.current = t, v.current = r, h.current = o, S.current = a;
881
- }), pe(() => {
882
- const k = e ? "enter" : "leave", B = T.current, R = e ? v.current : h.current;
883
- e && !l && y(!0), m(`${B}-${k}`);
884
- const G = setTimeout(() => {
885
- var X, oe;
886
- m(
887
- `${B}-${k} ${B}-${k}-active`
888
- ), k === "leave" ? (X = p.current) == null || X.call(p) : (oe = u.current) == null || oe.call(u);
889
- }, R), ae = setTimeout(() => {
890
- e || (m(B), y(!1));
891
- }, R + S.current);
935
+ const [u, d] = b(""), [l, p] = b(!1), m = A(o), y = A(i), f = A(t), v = A(a), T = A(n), h = A(r);
936
+ return Te(() => {
937
+ m.current = o, y.current = i, f.current = t, v.current = a, T.current = n, h.current = r;
938
+ }), Te(() => {
939
+ const I = e ? "enter" : "leave", B = f.current, re = e ? v.current : T.current;
940
+ e && !l && p(!0), d(`${B}-${I}`);
941
+ const se = setTimeout(() => {
942
+ var ce, q;
943
+ d(
944
+ `${B}-${I} ${B}-${I}-active`
945
+ ), I === "leave" ? (ce = y.current) == null || ce.call(y) : (q = m.current) == null || q.call(m);
946
+ }, re), D = setTimeout(() => {
947
+ e || (d(B), p(!1));
948
+ }, re + h.current);
892
949
  return () => {
893
- clearTimeout(G), clearTimeout(ae);
950
+ clearTimeout(se), clearTimeout(D);
894
951
  };
895
- }, [e, l]), l ? ut(c, {
896
- className: `${c.props.className} ${d}`
952
+ }, [e, l]), l ? xt(c, {
953
+ className: `${c.props.className} ${u}`
897
954
  }) : null;
898
- }, kt = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [role="button"]:not([aria-disabled="true"])', Nt = ({
955
+ }, qt = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [role="button"]:not([aria-disabled="true"])', Xt = ({
899
956
  children: e,
900
957
  isWithAnimation: t = !0,
901
- "aria-label": o = "Dialog"
958
+ "aria-label": n = "Dialog"
902
959
  }) => {
903
- const { isOpen: r, setIsOpen: a, onOpenChange: s, drawerId: n } = g(le), c = A(null), d = A(null), m = f(
960
+ const { isOpen: a, setIsOpen: r, onOpenChange: i, drawerId: o } = E(ie), c = A(null), u = A(null), d = g(
904
961
  () => {
905
962
  var v;
906
- return (v = c.current) == null ? void 0 : v.querySelectorAll(kt);
963
+ return (v = c.current) == null ? void 0 : v.querySelectorAll(qt);
907
964
  },
908
965
  []
909
- ), l = f(() => {
910
- var v, h;
911
- (h = (v = m()) == null ? void 0 : v[0]) == null || h.focus();
912
- }, [m]), y = f(() => {
913
- d.current = document.activeElement, l();
914
- }, [l]), u = f(() => {
966
+ ), l = g(() => {
967
+ var v, T;
968
+ (T = (v = d()) == null ? void 0 : v[0]) == null || T.focus();
969
+ }, [d]), p = g(() => {
970
+ u.current = document.activeElement, l();
971
+ }, [l]), m = g(() => {
915
972
  var v;
916
- (v = d.current) == null || v.focus();
973
+ (v = u.current) == null || v.focus();
917
974
  }, []);
918
- E(() => {
975
+ P(() => {
919
976
  var v;
920
- r && !t ? (d.current = document.activeElement, l()) : !r && !t && ((v = d.current) == null || v.focus());
921
- }, [r, t, l]);
922
- const p = f(
977
+ a && !t ? (u.current = document.activeElement, l()) : !a && !t && ((v = u.current) == null || v.focus());
978
+ }, [a, t, l]);
979
+ const y = g(
923
980
  (v) => {
924
981
  if (v.key === "Escape") {
925
- a(!1), s && s(!1);
982
+ r(!1), i && i(!1);
926
983
  return;
927
984
  }
928
985
  if (v.key === "Tab") {
929
- const h = m();
930
- if (!h || h.length === 0) return;
931
- const S = h[0], k = h[h.length - 1];
932
- v.shiftKey ? document.activeElement === S && (v.preventDefault(), k.focus()) : document.activeElement === k && (v.preventDefault(), S.focus());
986
+ const T = d();
987
+ if (!T || T.length === 0) return;
988
+ const h = T[0], I = T[T.length - 1];
989
+ v.shiftKey ? document.activeElement === h && (v.preventDefault(), I.focus()) : document.activeElement === I && (v.preventDefault(), h.focus());
933
990
  }
934
991
  },
935
- [a, s, m]
936
- ), T = /* @__PURE__ */ i(
992
+ [r, i, d]
993
+ ), f = /* @__PURE__ */ s(
937
994
  "div",
938
995
  {
939
996
  ref: c,
940
997
  className: "rmap-drawer-content-container",
941
998
  role: "dialog",
942
999
  "aria-modal": "true",
943
- "aria-label": o,
944
- id: n,
945
- onKeyDown: p,
1000
+ "aria-label": n,
1001
+ id: o,
1002
+ onKeyDown: y,
946
1003
  children: e
947
1004
  }
948
1005
  );
949
- return t ? /* @__PURE__ */ i(
950
- Se,
1006
+ return t ? /* @__PURE__ */ s(
1007
+ ke,
951
1008
  {
952
- visible: r,
1009
+ visible: a,
953
1010
  name: "rmap-drawer-content",
954
1011
  enterTime: 20,
955
1012
  leaveTime: 60,
956
1013
  clearTime: 300,
957
- onEntered: y,
958
- onExited: u,
959
- children: T
1014
+ onEntered: p,
1015
+ onExited: m,
1016
+ children: f
960
1017
  }
961
- ) : r ? T : null;
962
- }, bt = ({
1018
+ ) : a ? f : null;
1019
+ }, Qt = ({
963
1020
  children: e,
964
1021
  "aria-label": t,
965
- "data-testid": o
1022
+ "data-testid": n
966
1023
  }) => {
967
- const { isOpen: r, setIsOpen: a, onOpenChange: s, drawerId: n } = g(le), c = f(() => {
968
- const d = !r;
969
- a(d), s == null || s(d);
970
- }, [r, a, s]);
971
- return /* @__PURE__ */ i(
972
- q,
1024
+ const { isOpen: a, setIsOpen: r, onOpenChange: i, drawerId: o } = E(ie), c = g(() => {
1025
+ const u = !a;
1026
+ r(u), i == null || i(u);
1027
+ }, [a, r, i]);
1028
+ return /* @__PURE__ */ s(
1029
+ j,
973
1030
  {
974
1031
  className: "rmap-drawer-trigger",
975
1032
  type: "button",
976
- "aria-expanded": r,
977
- "aria-controls": n,
1033
+ "aria-expanded": a,
1034
+ "aria-controls": o,
978
1035
  "aria-label": t,
979
- "data-testid": o,
1036
+ "data-testid": n,
980
1037
  onClick: c,
981
1038
  children: e
982
1039
  }
983
1040
  );
984
1041
  };
985
- se.Content = Nt;
986
- se.Trigger = bt;
987
- const ye = ({ children: e }) => /* @__PURE__ */ i("ul", { className: "rmap-sortable-list-container", "aria-label": "Sortable list", children: e }), Ct = ({
1042
+ ne.Content = Xt;
1043
+ ne.Trigger = Qt;
1044
+ const ge = ({ children: e }) => /* @__PURE__ */ s("ul", { className: "rmap-sortable-list-container", "aria-label": "Sortable list", children: e }), Jt = ({
988
1045
  index: e,
989
1046
  dragStartIdx: t,
990
- listData: o,
991
- draggable: r = !0,
992
- onDragStart: a,
993
- onDragOver: s,
994
- onDrop: n,
1047
+ listData: n,
1048
+ draggable: a = !0,
1049
+ onDragStart: r,
1050
+ onDragOver: i,
1051
+ onDrop: o,
995
1052
  onReorder: c,
996
- onClick: d
1053
+ onClick: u
997
1054
  }) => {
998
- const m = (l, y) => {
999
- if (l < 0 || l >= o.length) return;
1000
- const u = [...o], p = u.splice(e, 1)[0];
1001
- u.splice(l, 0, p);
1002
- const T = u.map((h, S) => ({
1003
- ...h,
1004
- index: S
1005
- })), v = (y == null ? void 0 : y.parentElement) ?? null;
1006
- if (be(() => {
1007
- c == null || c(T);
1055
+ const d = (l, p) => {
1056
+ if (l < 0 || l >= n.length) return;
1057
+ const m = [...n], y = m.splice(e, 1)[0];
1058
+ m.splice(l, 0, y);
1059
+ const f = m.map((T, h) => ({
1060
+ ...T,
1061
+ index: h
1062
+ })), v = (p == null ? void 0 : p.parentElement) ?? null;
1063
+ if ($e(() => {
1064
+ c == null || c(f);
1008
1065
  }), v) {
1009
- const h = v.children[l];
1010
- h == null || h.focus();
1066
+ const T = v.children[l];
1067
+ T == null || T.focus();
1011
1068
  }
1012
1069
  };
1013
1070
  return {
1014
1071
  tabIndex: 0,
1015
- draggable: r,
1072
+ draggable: a,
1016
1073
  onKeyDown: (l) => {
1017
1074
  switch (l.key) {
1018
1075
  case "Enter":
@@ -1020,25 +1077,25 @@ const ye = ({ children: e }) => /* @__PURE__ */ i("ul", { className: "rmap-sorta
1020
1077
  l.preventDefault(), l.currentTarget.click();
1021
1078
  break;
1022
1079
  case "ArrowUp":
1023
- if (l.preventDefault(), r && l.altKey)
1024
- m(e - 1, l.currentTarget);
1080
+ if (l.preventDefault(), a && l.altKey)
1081
+ d(e - 1, l.currentTarget);
1025
1082
  else {
1026
- const y = l.currentTarget.previousElementSibling;
1027
- y == null || y.focus();
1083
+ const p = l.currentTarget.previousElementSibling;
1084
+ p == null || p.focus();
1028
1085
  }
1029
1086
  break;
1030
1087
  case "ArrowDown":
1031
- if (l.preventDefault(), r && l.altKey)
1032
- m(e + 1, l.currentTarget);
1088
+ if (l.preventDefault(), a && l.altKey)
1089
+ d(e + 1, l.currentTarget);
1033
1090
  else {
1034
- const y = l.currentTarget.nextElementSibling;
1035
- y == null || y.focus();
1091
+ const p = l.currentTarget.nextElementSibling;
1092
+ p == null || p.focus();
1036
1093
  }
1037
1094
  break;
1038
1095
  }
1039
1096
  },
1040
1097
  onDragStart: (l) => {
1041
- l.stopPropagation(), l.currentTarget.classList.add("rmap-drag-start"), a == null || a(l);
1098
+ l.stopPropagation(), l.currentTarget.classList.add("rmap-drag-start"), r == null || r(l);
1042
1099
  },
1043
1100
  onDragEnd: (l) => {
1044
1101
  l.stopPropagation(), l.currentTarget.classList.remove("rmap-drag-start");
@@ -1050,67 +1107,71 @@ const ye = ({ children: e }) => /* @__PURE__ */ i("ul", { className: "rmap-sorta
1050
1107
  l.stopPropagation(), l.currentTarget.classList.remove("rmap-drag-over");
1051
1108
  },
1052
1109
  onDragOver: (l) => {
1053
- l.preventDefault(), l.stopPropagation(), s == null || s(l);
1110
+ l.preventDefault(), l.stopPropagation(), i == null || i(l);
1054
1111
  },
1055
1112
  onDrop: (l) => {
1056
1113
  l.stopPropagation(), l.currentTarget.classList.remove("rmap-drag-over");
1057
- const y = [...o], u = o[t];
1058
- y.splice(t, 1);
1059
- const p = [
1060
- ...y.slice(0, e),
1061
- u,
1062
- ...y.slice(e, y.length)
1063
- ].map((T, v) => ({ ...T, index: v }));
1064
- n == null || n(l, p);
1114
+ const p = [...n], m = n[t];
1115
+ p.splice(t, 1);
1116
+ const y = [
1117
+ ...p.slice(0, e),
1118
+ m,
1119
+ ...p.slice(e, p.length)
1120
+ ].map((f, v) => ({ ...f, index: v }));
1121
+ o == null || o(l, y);
1065
1122
  },
1066
1123
  onClick: (l) => {
1067
- l.stopPropagation(), d == null || d(l);
1124
+ l.stopPropagation(), u == null || u(l);
1068
1125
  }
1069
1126
  };
1070
- }, Mt = (e) => {
1071
- const { children: t, ...o } = e, r = Ct(o);
1072
- return /* @__PURE__ */ i("li", { className: "rmap-sortable-item", ...r, children: /* @__PURE__ */ i("div", { className: "rmap-sortable-item-inner", children: t }) });
1127
+ }, Zt = (e) => {
1128
+ const { children: t, ...n } = e, a = Jt(n);
1129
+ return /* @__PURE__ */ s("li", { className: "rmap-sortable-item", ...a, children: /* @__PURE__ */ s("div", { className: "rmap-sortable-item-inner", children: t }) });
1073
1130
  };
1074
- ye.Item = Mt;
1075
- const xt = W(function({
1131
+ ge.Item = Zt;
1132
+ const Ce = O(null);
1133
+ Ce.displayName = "PlayListPortalContext";
1134
+ const xe = O(null);
1135
+ xe.displayName = "PlayListEmptyContext";
1136
+ const er = G(function({
1076
1137
  data: t
1077
1138
  }) {
1078
- const { curPlayId: o } = V(), { coverImgsCss: r } = L(), a = o === t.id;
1079
- return /* @__PURE__ */ i(
1139
+ const { curPlayId: n } = K(), { coverImgsCss: a } = N(), r = n === t.id;
1140
+ return /* @__PURE__ */ s(
1080
1141
  "div",
1081
1142
  {
1082
- className: `rmap-playlist-item${a ? " rmap-cur-played" : ""}`,
1143
+ className: `rmap-playlist-item${r ? " rmap-cur-played" : ""}`,
1083
1144
  "data-testid": "playlist-item",
1084
- "aria-current": a ? "true" : void 0,
1145
+ "aria-current": r ? "true" : void 0,
1085
1146
  children: /* @__PURE__ */ w("div", { className: "rmap-playlist-item-contents", children: [
1086
- /* @__PURE__ */ i("div", { className: "rmap-playlist-album-cover", children: t.img && /* @__PURE__ */ i(
1147
+ /* @__PURE__ */ s("div", { className: "rmap-playlist-album-cover", children: t.img && /* @__PURE__ */ s(
1087
1148
  "img",
1088
1149
  {
1089
1150
  src: t.img,
1090
1151
  alt: t.name || "Album thumbnail",
1091
- style: r == null ? void 0 : r.listThumbnail
1152
+ style: a == null ? void 0 : a.listThumbnail
1092
1153
  }
1093
1154
  ) }),
1094
1155
  /* @__PURE__ */ w("div", { className: "rmap-playlist-album-info", children: [
1095
- t.writer && /* @__PURE__ */ i("span", { className: "rmap-playlist-writer", children: t.writer }),
1096
- t.name && /* @__PURE__ */ i("span", { className: "rmap-playlist-title", children: t.name }),
1097
- t.description && /* @__PURE__ */ i("div", { className: "rmap-playlist-description", children: t.description })
1156
+ t.writer && /* @__PURE__ */ s("span", { className: "rmap-playlist-writer", children: t.writer }),
1157
+ t.name && /* @__PURE__ */ s("span", { className: "rmap-playlist-title", children: t.name }),
1158
+ t.description && /* @__PURE__ */ s("div", { className: "rmap-playlist-description", children: t.description })
1098
1159
  ] })
1099
1160
  ] })
1100
1161
  }
1101
1162
  );
1102
- }), _t = ({
1163
+ }), tr = ({
1103
1164
  setIsOpen: e
1104
1165
  }) => {
1105
- const { playList: t } = V(), { activeUI: o } = O(), r = g(P), [a, s] = C(0), n = f(
1166
+ const { playList: t } = K(), { activeUI: n } = x(), a = E(L), [r, i] = b(0), o = g(
1106
1167
  (c) => {
1107
- r({
1168
+ a({
1108
1169
  type: "SET_CURRENT_AUDIO",
1109
1170
  currentIndex: c,
1110
1171
  currentAudioId: t[c].id
1111
1172
  });
1112
1173
  },
1113
- [r, t]
1174
+ [a, t]
1114
1175
  );
1115
1176
  return {
1116
1177
  cssTransitionEventProps: {
@@ -1118,138 +1179,155 @@ const xt = W(function({
1118
1179
  onEntered: () => e(!0)
1119
1180
  },
1120
1181
  sortableItemEventProps: {
1121
- draggable: o.playList !== "unSortable",
1122
- dragStartIdx: a,
1123
- onDragStart: (c) => s(c),
1124
- onDrop: (c, d) => r({
1182
+ draggable: n.playList !== "unSortable",
1183
+ dragStartIdx: r,
1184
+ onDragStart: (c) => i(c),
1185
+ onDrop: (c, u) => a({
1125
1186
  type: "UPDATE_PLAY_LIST",
1126
- playList: d
1187
+ playList: u
1127
1188
  }),
1128
- onReorder: (c) => r({
1189
+ onReorder: (c) => a({
1129
1190
  type: "UPDATE_PLAY_LIST",
1130
1191
  playList: c
1131
1192
  }),
1132
- onClick: (c) => n(c)
1193
+ onClick: (c) => o(c)
1133
1194
  }
1134
1195
  };
1135
- }, Dt = () => {
1136
- const { playList: e } = V(), { isOpen: t, setIsOpen: o } = g(le), { cssTransitionEventProps: r, sortableItemEventProps: a } = _t({
1137
- setIsOpen: o
1196
+ }, rr = () => {
1197
+ const { playList: e } = K(), { isOpen: t, setIsOpen: n } = E(ie), a = he(Ce), r = he(xe), { cssTransitionEventProps: i, sortableItemEventProps: o } = tr({
1198
+ setIsOpen: n
1138
1199
  }), {
1139
- onClick: s,
1140
- onDragStart: n,
1141
- ...c
1142
- } = a;
1143
- return e.length !== 0 ? dt.createPortal(
1144
- /* @__PURE__ */ i(
1145
- Se,
1200
+ onClick: c,
1201
+ onDragStart: u,
1202
+ ...d
1203
+ } = o;
1204
+ if (!a) return /* @__PURE__ */ s(R, {});
1205
+ const l = e.length === 0;
1206
+ return l && !r ? /* @__PURE__ */ s(R, {}) : _t.createPortal(
1207
+ /* @__PURE__ */ s(
1208
+ ke,
1146
1209
  {
1147
1210
  visible: t,
1148
1211
  name: "rmap-playlist-content",
1149
1212
  enterTime: 20,
1150
1213
  leaveTime: 20,
1151
1214
  clearTime: 300,
1152
- ...r,
1153
- children: /* @__PURE__ */ i("div", { className: "rmap-playlist-container", children: /* @__PURE__ */ i(ye, { children: e.map((d, m) => /* @__PURE__ */ i(
1154
- ye.Item,
1215
+ ...i,
1216
+ children: /* @__PURE__ */ s("div", { className: "rmap-playlist-container", children: l ? r : /* @__PURE__ */ s(ge, { children: e.map((p, m) => /* @__PURE__ */ s(
1217
+ ge.Item,
1155
1218
  {
1156
1219
  index: m,
1157
1220
  listData: e,
1158
- onClick: () => s(m),
1159
- onDragStart: () => n(m),
1160
- ...c,
1161
- children: /* @__PURE__ */ i(xt, { data: d })
1221
+ onClick: () => c(m),
1222
+ onDragStart: () => u(m),
1223
+ ...d,
1224
+ children: /* @__PURE__ */ s(er, { data: p })
1162
1225
  },
1163
- `sortable-item-${m}`
1226
+ p.id
1164
1227
  )) }) })
1165
1228
  }
1166
1229
  ),
1167
- document.querySelector(".rmap-sortable-playlist") ?? document.body
1168
- ) : /* @__PURE__ */ i(z, {});
1169
- }, Ot = () => {
1170
- const { customIcons: e } = L();
1171
- return /* @__PURE__ */ i(
1172
- x,
1230
+ a
1231
+ );
1232
+ }, ar = () => {
1233
+ const { customIcons: e } = N();
1234
+ return /* @__PURE__ */ s(
1235
+ M,
1173
1236
  {
1174
- render: /* @__PURE__ */ i(Be, { size: "100%" }),
1237
+ render: /* @__PURE__ */ s(Xe, { size: "100%" }),
1175
1238
  customIcon: e == null ? void 0 : e.playList
1176
1239
  }
1177
1240
  );
1178
- }, Ut = () => /* @__PURE__ */ w(se, { children: [
1179
- /* @__PURE__ */ i(se.Trigger, { "aria-label": "Playlist", "data-testid": "playlist-trigger-btn", children: /* @__PURE__ */ i(Ot, {}) }),
1180
- /* @__PURE__ */ i(se.Content, { "aria-label": "Playlist", children: /* @__PURE__ */ i(Dt, {}) })
1181
- ] }), ee = (e) => {
1182
- const t = `${Math.floor(e / 60)}`.padStart(2, "0"), o = `${Math.floor(e % 60)}`.padStart(2, "0");
1183
- return `${t}:${o}`;
1184
- }, ce = (e, t, o = 0) => {
1185
- if (!t) return o;
1186
- const r = e / t;
1187
- return isFinite(r) ? r : o;
1188
- }, Qe = () => {
1189
- const { isLoadedMetaData: e } = b(), { elementRefs: t } = L(), [o, r] = C(!1), a = f(
1190
- (s) => {
1241
+ }, dt = ({
1242
+ initialExpanded: e,
1243
+ gridArea: t,
1244
+ visible: n,
1245
+ ...a
1246
+ }) => {
1247
+ const { playListExpanded: r } = x(), i = e ?? r, o = z("playList", t);
1248
+ return /* @__PURE__ */ s(_.Item, { gridArea: o, visible: n ?? !0, ...a, children: /* @__PURE__ */ w(ne, { initialOpen: i, children: [
1249
+ /* @__PURE__ */ s(
1250
+ ne.Trigger,
1251
+ {
1252
+ "aria-label": "Playlist",
1253
+ "data-testid": "playlist-trigger-btn",
1254
+ children: /* @__PURE__ */ s(ar, {})
1255
+ }
1256
+ ),
1257
+ /* @__PURE__ */ s(ne.Content, { "aria-label": "Playlist", children: /* @__PURE__ */ s(rr, {}) })
1258
+ ] }) });
1259
+ }, Z = (e) => {
1260
+ const t = `${Math.floor(e / 60)}`.padStart(2, "0"), n = `${Math.floor(e % 60)}`.padStart(2, "0");
1261
+ return `${t}:${n}`;
1262
+ }, me = (e, t, n = 0) => {
1263
+ if (!t) return n;
1264
+ const a = e / t;
1265
+ return isFinite(a) ? a : n;
1266
+ }, mt = () => {
1267
+ const { isLoadedMetaData: e } = C(), { elementRefs: t } = N(), [n, a] = b(!1), r = g(
1268
+ (i) => {
1191
1269
  if (!(t != null && t.audioEl) || !e) return;
1192
- const { clientX: n } = s, { clientWidth: c } = s.currentTarget, d = s.currentTarget.getBoundingClientRect(), m = n - d.x, l = ce(m, c) * t.audioEl.duration;
1270
+ const { clientX: o } = i, { clientWidth: c } = i.currentTarget, u = i.currentTarget.getBoundingClientRect(), d = o - u.x, l = me(d, c) * t.audioEl.duration;
1193
1271
  t.audioEl.currentTime = l;
1194
1272
  },
1195
1273
  [e, t == null ? void 0 : t.audioEl]
1196
1274
  );
1197
- return E(() => {
1198
- if (!o) return;
1199
- const s = (n) => n.preventDefault();
1200
- return document.addEventListener("selectstart", s), () => {
1201
- document.removeEventListener("selectstart", s);
1275
+ return P(() => {
1276
+ if (!n) return;
1277
+ const i = (o) => o.preventDefault();
1278
+ return document.addEventListener("selectstart", i), () => {
1279
+ document.removeEventListener("selectstart", i);
1202
1280
  };
1203
- }, [o]), {
1204
- onMouseDown: () => r(!0),
1205
- onMouseUp: () => r(!1),
1206
- onMouseLeave: () => r(!1),
1207
- onMouseMove: o ? a : void 0,
1208
- onClick: a
1281
+ }, [n]), {
1282
+ onMouseDown: () => a(!0),
1283
+ onMouseUp: () => a(!1),
1284
+ onMouseLeave: () => a(!1),
1285
+ onMouseMove: n ? r : void 0,
1286
+ onClick: r
1209
1287
  };
1210
- }, Je = (e) => {
1211
- const { isLoadedMetaData: t } = b(), { elementRefs: o } = L();
1212
- return f(
1213
- (r) => {
1214
- if (!(o != null && o.audioEl) || !t) return;
1215
- const a = o.audioEl;
1216
- let s = null;
1217
- switch (r.key) {
1288
+ }, pt = (e) => {
1289
+ const { isLoadedMetaData: t } = C(), { elementRefs: n } = N();
1290
+ return g(
1291
+ (a) => {
1292
+ if (!(n != null && n.audioEl) || !t) return;
1293
+ const r = n.audioEl;
1294
+ let i = null;
1295
+ switch (a.key) {
1218
1296
  case "ArrowRight":
1219
1297
  case "ArrowUp":
1220
- r.preventDefault(), s = Math.min(a.currentTime + 5, a.duration);
1298
+ a.preventDefault(), i = Math.min(r.currentTime + 5, r.duration);
1221
1299
  break;
1222
1300
  case "ArrowLeft":
1223
1301
  case "ArrowDown":
1224
- r.preventDefault(), s = Math.max(a.currentTime - 5, 0);
1302
+ a.preventDefault(), i = Math.max(r.currentTime - 5, 0);
1225
1303
  break;
1226
1304
  case "Home":
1227
- r.preventDefault(), s = 0;
1305
+ a.preventDefault(), i = 0;
1228
1306
  break;
1229
1307
  case "End":
1230
- r.preventDefault(), s = a.duration;
1308
+ a.preventDefault(), i = r.duration;
1231
1309
  break;
1232
1310
  }
1233
- s !== null && isFinite(a.duration) && (a.currentTime = s, e == null || e(s, a.duration));
1311
+ i !== null && isFinite(r.duration) && (r.currentTime = i, e == null || e(i, r.duration));
1234
1312
  },
1235
- [o == null ? void 0 : o.audioEl, t, e]
1313
+ [n == null ? void 0 : n.audioEl, t, e]
1236
1314
  );
1237
- }, Vt = () => {
1238
- const { currentTime: e, duration: t } = re(), o = A(null), [r, a] = C(0);
1239
- E(() => {
1240
- const m = o.current;
1241
- if (!m) return;
1242
- a(m.offsetWidth);
1243
- const l = new ResizeObserver(([y]) => {
1244
- a(y.contentBoxSize[0].inlineSize);
1315
+ }, nr = () => {
1316
+ const { currentTime: e, duration: t } = te(), n = A(null), [a, r] = b(0);
1317
+ P(() => {
1318
+ const d = n.current;
1319
+ if (!d) return;
1320
+ r(d.offsetWidth);
1321
+ const l = new ResizeObserver(([p]) => {
1322
+ r(p.contentBoxSize[0].inlineSize);
1245
1323
  });
1246
- return l.observe(m), () => l.disconnect();
1324
+ return l.observe(d), () => l.disconnect();
1247
1325
  }, []);
1248
- const s = ce(e, t), n = Qe(), c = Je(), d = s * r;
1326
+ const i = me(e, t), o = mt(), c = pt(), u = i * a;
1249
1327
  return /* @__PURE__ */ w(
1250
1328
  "div",
1251
1329
  {
1252
- ref: o,
1330
+ ref: n,
1253
1331
  className: "rmap-bar-progress-wrapper",
1254
1332
  "data-testid": "progress-bar",
1255
1333
  role: "slider",
@@ -1257,83 +1335,83 @@ const xt = W(function({
1257
1335
  "aria-label": "Seek",
1258
1336
  "aria-valuemin": 0,
1259
1337
  "aria-valuemax": 100,
1260
- "aria-valuenow": Math.round(s * 100),
1261
- "aria-valuetext": `${ee(
1338
+ "aria-valuenow": Math.round(i * 100),
1339
+ "aria-valuetext": `${Z(
1262
1340
  e
1263
- )} of ${ee(t)}`,
1341
+ )} of ${Z(t)}`,
1264
1342
  onKeyDown: c,
1265
- ...n,
1343
+ ...o,
1266
1344
  children: [
1267
- /* @__PURE__ */ i("div", { className: "rmap-progress-bar", children: /* @__PURE__ */ i(
1345
+ /* @__PURE__ */ s("div", { className: "rmap-progress-bar", children: /* @__PURE__ */ s(
1268
1346
  "div",
1269
1347
  {
1270
1348
  className: "rmap-progress-fill",
1271
- style: { transform: `scaleX(${s})` }
1349
+ style: { transform: `scaleX(${i})` }
1272
1350
  }
1273
1351
  ) }),
1274
- /* @__PURE__ */ i(
1352
+ /* @__PURE__ */ s(
1275
1353
  "div",
1276
1354
  {
1277
1355
  className: "rmap-progress-handle",
1278
1356
  style: {
1279
- transform: `translateX(${d}px)`
1357
+ transform: `translateX(${u}px)`
1280
1358
  }
1281
1359
  }
1282
1360
  )
1283
1361
  ]
1284
1362
  }
1285
1363
  );
1286
- }, Bt = (e, t) => {
1287
- const o = A(), r = f(() => {
1288
- const a = document.getElementsByClassName("rmap-player-provider")[0];
1289
- if (!a) return;
1290
- const s = Object.entries(
1364
+ }, or = (e, t) => {
1365
+ const n = A(), a = g(() => {
1366
+ const r = document.getElementsByClassName("rmap-player-provider")[0];
1367
+ if (!r) return;
1368
+ const i = Object.entries(
1291
1369
  e
1292
1370
  ).reduce(
1293
- (n, [c, d]) => ({
1294
- ...n,
1295
- [c]: window.getComputedStyle(a).getPropertyValue(`${d}`)
1371
+ (o, [c, u]) => ({
1372
+ ...o,
1373
+ [c]: window.getComputedStyle(r).getPropertyValue(`${u}`)
1296
1374
  }),
1297
1375
  {}
1298
1376
  );
1299
- o.current = s;
1377
+ n.current = i;
1300
1378
  }, [e]);
1301
- return pe(() => {
1302
- r();
1303
- const a = window.matchMedia("(prefers-color-scheme: dark)");
1304
- return a.addEventListener("change", r), () => a.removeEventListener("change", r);
1305
- }, [r, t]), o;
1306
- }, Kt = {
1379
+ return Te(() => {
1380
+ a();
1381
+ const r = window.matchMedia("(prefers-color-scheme: dark)");
1382
+ return r.addEventListener("change", a), () => r.removeEventListener("change", a);
1383
+ }, [a, t]), n;
1384
+ }, ir = {
1307
1385
  progressColor: "--rm-audio-player-waveform-bar",
1308
1386
  waveColor: "--rm-audio-player-waveform-background"
1309
- }, $t = (e) => {
1387
+ }, sr = (e) => {
1310
1388
  const t = e.backend;
1311
1389
  if (!(!(t != null && t.media) || !t.mediaListeners))
1312
- for (const [o, r] of Object.entries(t.mediaListeners))
1313
- t.media.removeEventListener(o, r);
1314
- }, Ft = (e) => {
1315
- const t = g(P), { isPlaying: o } = b(), { curPlayId: r } = V(), { elementRefs: a } = L(), { colorScheme: s } = O(), n = Bt(Kt, s), c = A(a == null ? void 0 : a.waveformInst);
1316
- c.current = a == null ? void 0 : a.waveformInst, E(() => {
1317
- var p, T;
1318
- if (a != null && a.waveformInst || !((p = n.current) != null && p.progressColor) || !((T = n.current) != null && T.waveColor))
1390
+ for (const [n, a] of Object.entries(t.mediaListeners))
1391
+ t.media.removeEventListener(n, a);
1392
+ }, cr = (e) => {
1393
+ const t = E(L), { isPlaying: n } = C(), { curPlayId: a } = K(), { elementRefs: r } = N(), { colorScheme: i } = x(), o = or(ir, i), c = A(r == null ? void 0 : r.waveformInst);
1394
+ c.current = r == null ? void 0 : r.waveformInst, P(() => {
1395
+ var y, f;
1396
+ if (r != null && r.waveformInst || !((y = o.current) != null && y.progressColor) || !((f = o.current) != null && f.waveColor))
1319
1397
  return;
1320
- let u = !1;
1398
+ let m = !1;
1321
1399
  return import("./wavesurfer-_j5aw4gZ.mjs").then((v) => v.w).then(({ default: v }) => {
1322
- var S, k;
1323
- if (u || !e.current || !((S = n.current) != null && S.progressColor) || !((k = n.current) != null && k.waveColor)) {
1400
+ var h, I;
1401
+ if (m || !e.current || !((h = o.current) != null && h.progressColor) || !((I = o.current) != null && I.waveColor)) {
1324
1402
  console.error("[useWaveSurfer] missing required dependencies");
1325
1403
  return;
1326
1404
  }
1327
- let h;
1405
+ let T;
1328
1406
  try {
1329
- h = v.create({
1407
+ T = v.create({
1330
1408
  barWidth: 1,
1331
1409
  cursorWidth: 2,
1332
1410
  container: e.current,
1333
1411
  height: 80,
1334
- progressColor: n.current.progressColor,
1412
+ progressColor: o.current.progressColor,
1335
1413
  responsive: !0,
1336
- waveColor: n.current.waveColor,
1414
+ waveColor: o.current.waveColor,
1337
1415
  cursorColor: "var(--rm-audio-player-waveform-cursor)",
1338
1416
  backend: "MediaElement",
1339
1417
  removeMediaElementOnDestroy: !1
@@ -1347,43 +1425,43 @@ const xt = W(function({
1347
1425
  }
1348
1426
  t({
1349
1427
  type: "SET_ELEMENT_REFS",
1350
- elementRefs: { waveformInst: h }
1428
+ elementRefs: { waveformInst: T }
1351
1429
  });
1352
1430
  }).catch((v) => {
1353
1431
  console.error("[useWaveSurfer] failed to load wavesurfer.js", v);
1354
1432
  }), () => {
1355
- u = !0;
1433
+ m = !0;
1356
1434
  };
1357
- }, [a == null ? void 0 : a.waveformInst, t, n]);
1358
- const d = A(r);
1359
- E(() => {
1360
- if (!(a != null && a.audioEl) || !(a != null && a.waveformInst)) return;
1361
- const u = a.audioEl;
1362
- if (!u.getAttribute("src")) return;
1363
- const p = a.waveformInst, T = d.current !== r;
1364
- d.current = r;
1365
- const v = T ? 0 : u.currentTime, h = o;
1366
- $t(p), p.load(u);
1367
- const S = () => {
1368
- !T && v > 0 && u.duration && (u.currentTime = v, p.seekTo(v / u.duration)), h && u.play();
1435
+ }, [r == null ? void 0 : r.waveformInst, t, o]);
1436
+ const u = A(a);
1437
+ P(() => {
1438
+ if (!(r != null && r.audioEl) || !(r != null && r.waveformInst)) return;
1439
+ const m = r.audioEl;
1440
+ if (!m.getAttribute("src")) return;
1441
+ const y = r.waveformInst, f = u.current !== a;
1442
+ u.current = a;
1443
+ const v = f ? 0 : m.currentTime, T = n;
1444
+ sr(y), y.load(m);
1445
+ const h = () => {
1446
+ !f && v > 0 && m.duration && (m.currentTime = v, y.seekTo(v / m.duration)), T && m.play();
1369
1447
  };
1370
- return p.on("ready", S), () => {
1371
- p.un("ready", S);
1448
+ return y.on("ready", h), () => {
1449
+ y.un("ready", h);
1372
1450
  };
1373
- }, [r, a == null ? void 0 : a.audioEl, a == null ? void 0 : a.waveformInst]), E(() => {
1374
- if (!e.current || !(a != null && a.waveformInst)) return;
1375
- const u = () => {
1376
- var T, v;
1377
- (v = (T = a.waveformInst) == null ? void 0 : T.drawer) == null || v.fireEvent("redraw");
1378
- }, p = new ResizeObserver(u);
1379
- return p.observe(e.current), () => {
1380
- p.disconnect();
1451
+ }, [a, r == null ? void 0 : r.audioEl, r == null ? void 0 : r.waveformInst]), P(() => {
1452
+ if (!e.current || !(r != null && r.waveformInst)) return;
1453
+ const m = () => {
1454
+ var f, v;
1455
+ (v = (f = r.waveformInst) == null ? void 0 : f.drawer) == null || v.fireEvent("redraw");
1456
+ }, y = new ResizeObserver(m);
1457
+ return y.observe(e.current), () => {
1458
+ y.disconnect();
1381
1459
  };
1382
- }, [a == null ? void 0 : a.waveformInst, e]), E(
1460
+ }, [r == null ? void 0 : r.waveformInst, e]), P(
1383
1461
  () => () => {
1384
- var p, T;
1385
- const u = (p = e.current) == null ? void 0 : p.querySelector("wave");
1386
- u && u.remove(), (T = c.current) == null || T.destroy(), t({
1462
+ var y, f;
1463
+ const m = (y = e.current) == null ? void 0 : y.querySelector("wave");
1464
+ m && m.remove(), (f = c.current) == null || f.destroy(), t({
1387
1465
  type: "SET_ELEMENT_REFS",
1388
1466
  elementRefs: { waveformInst: void 0 }
1389
1467
  });
@@ -1391,47 +1469,47 @@ const xt = W(function({
1391
1469
  // eslint-disable-next-line react-hooks/exhaustive-deps
1392
1470
  [t]
1393
1471
  );
1394
- const m = () => {
1395
- var v, h;
1396
- const u = c.current;
1397
- if (!(u != null && u.isReady)) return;
1398
- const p = (v = n.current) == null ? void 0 : v.waveColor, T = (h = n.current) == null ? void 0 : h.progressColor;
1399
- p && u.setWaveColor(p), T && u.setProgressColor(T);
1400
- }, l = A(m);
1401
- l.current = m;
1402
- const y = A(s);
1403
- E(() => {
1404
- y.current !== s && (y.current = s, l.current());
1405
- }, [s, a == null ? void 0 : a.waveformInst]), E(() => {
1406
- const u = () => l.current(), p = window.matchMedia("(prefers-color-scheme: dark)");
1407
- return p.addEventListener("change", u), () => p.removeEventListener("change", u);
1472
+ const d = () => {
1473
+ var v, T;
1474
+ const m = c.current;
1475
+ if (!(m != null && m.isReady)) return;
1476
+ const y = (v = o.current) == null ? void 0 : v.waveColor, f = (T = o.current) == null ? void 0 : T.progressColor;
1477
+ y && m.setWaveColor(y), f && m.setProgressColor(f);
1478
+ }, l = A(d);
1479
+ l.current = d;
1480
+ const p = A(i);
1481
+ P(() => {
1482
+ p.current !== i && (p.current = i, l.current());
1483
+ }, [i, r == null ? void 0 : r.waveformInst]), P(() => {
1484
+ const m = () => l.current(), y = window.matchMedia("(prefers-color-scheme: dark)");
1485
+ return y.addEventListener("change", m), () => y.removeEventListener("change", m);
1408
1486
  }, []);
1409
- }, Ht = ({ isActive: e }) => {
1410
- var d, m, l, y;
1411
- const t = A(null), { isLoadedMetaData: o, isPlaying: r } = b(), { elementRefs: a } = L();
1412
- Ft(t), E(() => {
1413
- if (!e || !(a != null && a.waveformInst) || !(a != null && a.audioEl) || !o || r)
1487
+ }, lr = ({ isActive: e }) => {
1488
+ var u, d, l, p;
1489
+ const t = A(null), { isLoadedMetaData: n, isPlaying: a } = C(), { elementRefs: r } = N();
1490
+ cr(t), P(() => {
1491
+ if (!e || !(r != null && r.waveformInst) || !(r != null && r.audioEl) || !n || a)
1414
1492
  return;
1415
- const u = ce(
1416
- a.audioEl.currentTime,
1417
- a.audioEl.duration
1493
+ const m = me(
1494
+ r.audioEl.currentTime,
1495
+ r.audioEl.duration
1418
1496
  );
1419
- a.waveformInst.seekTo(u);
1497
+ r.waveformInst.seekTo(m);
1420
1498
  }, [
1421
1499
  e,
1422
- o,
1423
- a == null ? void 0 : a.waveformInst,
1424
- a == null ? void 0 : a.audioEl,
1425
- r
1500
+ n,
1501
+ r == null ? void 0 : r.waveformInst,
1502
+ r == null ? void 0 : r.audioEl,
1503
+ a
1426
1504
  ]);
1427
- const s = Qe(), n = f(
1428
- (u, p) => {
1429
- var T;
1430
- p && ((T = a == null ? void 0 : a.waveformInst) == null || T.seekTo(ce(u, p)));
1505
+ const i = mt(), o = g(
1506
+ (m, y) => {
1507
+ var f;
1508
+ y && ((f = r == null ? void 0 : r.waveformInst) == null || f.seekTo(me(m, y)));
1431
1509
  },
1432
- [a == null ? void 0 : a.waveformInst]
1433
- ), c = Je(n);
1434
- return /* @__PURE__ */ i("div", { className: "rmap-waveform-wrapper", "data-active": e, children: /* @__PURE__ */ i(
1510
+ [r == null ? void 0 : r.waveformInst]
1511
+ ), c = pt(o);
1512
+ return /* @__PURE__ */ s("div", { className: "rmap-waveform-wrapper", "data-active": e, children: /* @__PURE__ */ s(
1435
1513
  "div",
1436
1514
  {
1437
1515
  id: "rm-waveform",
@@ -1442,44 +1520,61 @@ const xt = W(function({
1442
1520
  "aria-valuemin": 0,
1443
1521
  "aria-valuemax": 100,
1444
1522
  "aria-valuenow": Math.round(
1445
- (((d = a == null ? void 0 : a.audioEl) == null ? void 0 : d.currentTime) ?? 0) / (((m = a == null ? void 0 : a.audioEl) == null ? void 0 : m.duration) || 1) * 100
1523
+ (((u = r == null ? void 0 : r.audioEl) == null ? void 0 : u.currentTime) ?? 0) / (((d = r == null ? void 0 : r.audioEl) == null ? void 0 : d.duration) || 1) * 100
1446
1524
  ),
1447
- "aria-valuetext": `${ee(
1448
- ((l = a == null ? void 0 : a.audioEl) == null ? void 0 : l.currentTime) ?? 0
1449
- )} of ${ee(((y = a == null ? void 0 : a.audioEl) == null ? void 0 : y.duration) ?? 0)}`,
1525
+ "aria-valuetext": `${Z(
1526
+ ((l = r == null ? void 0 : r.audioEl) == null ? void 0 : l.currentTime) ?? 0
1527
+ )} of ${Z(((p = r == null ? void 0 : r.audioEl) == null ? void 0 : p.duration) ?? 0)}`,
1450
1528
  onKeyDown: c,
1451
- ...s
1529
+ ...i
1452
1530
  }
1453
1531
  ) });
1454
- }, Rt = () => {
1455
- const { activeUI: e } = O(), t = e.progress ?? (e.all ? "bar" : !1), o = t === "waveform", r = t === "bar", [a, s] = C(o);
1456
- return E(() => {
1457
- o && !a && s(!0);
1458
- }, [o, a]), /* @__PURE__ */ w("div", { className: "rmap-progress-container", children: [
1459
- a && /* @__PURE__ */ i(Ht, { isActive: o }),
1460
- r && /* @__PURE__ */ i(Vt, {})
1461
- ] });
1462
- }, zt = ({
1532
+ }, yt = ({
1533
+ gridArea: e,
1534
+ visible: t,
1535
+ type: n,
1536
+ width: a,
1537
+ ...r
1538
+ }) => {
1539
+ const { activeUI: i } = x(), o = n ?? (i.progress === "waveform" ? "waveform" : "bar"), c = o === "waveform", u = o === "bar", [d, l] = b(c);
1540
+ P(() => {
1541
+ c && !d && l(!0);
1542
+ }, [c, d]);
1543
+ const p = z("progress", e);
1544
+ return /* @__PURE__ */ s(
1545
+ _.Item,
1546
+ {
1547
+ gridArea: p,
1548
+ width: a ?? "100%",
1549
+ visible: t ?? !0,
1550
+ ...r,
1551
+ children: /* @__PURE__ */ w("div", { className: "rmap-progress-container", children: [
1552
+ d && /* @__PURE__ */ s(lr, { isActive: c }),
1553
+ u && /* @__PURE__ */ s(nr, {})
1554
+ ] })
1555
+ }
1556
+ );
1557
+ }, ur = ({
1463
1558
  placement: e
1464
1559
  }) => {
1465
- var y;
1466
- const t = A(null), { volume: o, muted: r } = b(), { elementRefs: a } = L(), s = g(P), n = f(
1467
- (u) => {
1468
- u.stopPropagation(), u.preventDefault(), r && s({ type: "SET_MUTED", muted: !1 });
1469
- const { value: p } = u.target, T = parseFloat(p);
1470
- s({
1560
+ var p;
1561
+ const t = A(null), { volume: n, muted: a } = C(), { elementRefs: r } = N(), i = E(L), o = g(
1562
+ (m) => {
1563
+ m.stopPropagation(), m.preventDefault(), a && i({ type: "SET_MUTED", muted: !1 });
1564
+ const { value: y } = m.target, f = parseFloat(y);
1565
+ i({
1471
1566
  type: "SET_VOLUME",
1472
- volume: T
1567
+ volume: f
1473
1568
  });
1474
1569
  },
1475
- [r, s]
1476
- ), c = o ?? ((y = a == null ? void 0 : a.audioEl) == null ? void 0 : y.volume) ?? 0, d = c * 100, m = Math.round(d), l = D(
1570
+ [a, i]
1571
+ ), c = n ?? ((p = r == null ? void 0 : r.audioEl) == null ? void 0 : p.volume) ?? 0, u = c * 100, d = Math.round(u), l = k(
1477
1572
  () => ({
1478
- "--rm-audio-player-volume-value": `${d}%`
1573
+ "--rm-audio-player-volume-value": `${u}%`
1479
1574
  }),
1480
- [d]
1575
+ [u]
1481
1576
  );
1482
- return /* @__PURE__ */ i(
1577
+ return /* @__PURE__ */ s(
1483
1578
  "div",
1484
1579
  {
1485
1580
  ref: t,
@@ -1487,51 +1582,51 @@ const xt = W(function({
1487
1582
  "data-placement": e,
1488
1583
  "data-testid": "volume-slider",
1489
1584
  style: l,
1490
- children: /* @__PURE__ */ i("div", { className: "rmap-volume-panel", children: /* @__PURE__ */ i(
1585
+ children: /* @__PURE__ */ s("div", { className: "rmap-volume-panel", children: /* @__PURE__ */ s(
1491
1586
  "input",
1492
1587
  {
1493
1588
  className: "rmap-volume-slider",
1494
1589
  type: "range",
1495
1590
  style: { cursor: "pointer" },
1496
1591
  value: c,
1497
- onChange: n,
1592
+ onChange: o,
1498
1593
  min: "0",
1499
1594
  max: "1",
1500
1595
  step: "0.01",
1501
- "aria-label": r ? "Volume (muted)" : "Volume",
1502
- "aria-valuetext": `${m} percent`
1596
+ "aria-label": a ? "Volume (muted)" : "Volume",
1597
+ "aria-valuetext": `${d} percent`
1503
1598
  }
1504
1599
  ) })
1505
1600
  }
1506
1601
  );
1507
- }, ue = H(null);
1508
- ue.displayName = "DropdownContext";
1509
- const Ze = ({
1602
+ }, pe = O(null);
1603
+ pe.displayName = "DropdownContext";
1604
+ const vt = ({
1510
1605
  clickArea: e,
1511
1606
  triggerType: t,
1512
- isOpen: o,
1513
- setIsOpen: r,
1514
- onOpenChange: a
1607
+ isOpen: n,
1608
+ setIsOpen: a,
1609
+ onOpenChange: r
1515
1610
  }) => {
1516
- const s = A(), n = (l) => {
1517
- const y = () => {
1518
- clearTimeout(s.current), s.current = void 0;
1519
- }, u = (p) => {
1520
- r(p), a && a(p), y();
1611
+ const i = A(), o = (l) => {
1612
+ const p = () => {
1613
+ clearTimeout(i.current), i.current = void 0;
1614
+ }, m = (y) => {
1615
+ a(y), r && r(y), p();
1521
1616
  };
1522
- if (y(), l) {
1523
- s.current = window.setTimeout(() => u(!0), 100);
1617
+ if (p(), l) {
1618
+ i.current = window.setTimeout(() => m(!0), 100);
1524
1619
  return;
1525
1620
  }
1526
- s.current = window.setTimeout(() => u(!1), 100);
1621
+ i.current = window.setTimeout(() => m(!1), 100);
1527
1622
  }, c = (l) => {
1528
- t === "hover" && n(l);
1623
+ t === "hover" && o(l);
1529
1624
  };
1530
1625
  return {
1531
1626
  onClick: e === "content" ? (l) => {
1532
1627
  l.stopPropagation(), l.nativeEvent.stopImmediatePropagation();
1533
1628
  } : () => {
1534
- t === "click" && (r(!o), a && a(!o));
1629
+ t === "click" && (a(!n), r && r(!n));
1535
1630
  },
1536
1631
  onKeyUp: () => c(!0),
1537
1632
  onMouseEnter: () => c(!0),
@@ -1539,50 +1634,50 @@ const Ze = ({
1539
1634
  onFocus: () => c(!0),
1540
1635
  onBlur: () => c(!1)
1541
1636
  };
1542
- }, ie = ({
1637
+ }, oe = ({
1543
1638
  triggerType: e = "click",
1544
1639
  outboundClickActive: t = !0,
1545
- children: o,
1546
- isOpen: r,
1547
- placement: a = "bottom",
1548
- disabled: s = !1,
1549
- onOpenChange: n,
1640
+ children: n,
1641
+ isOpen: a,
1642
+ placement: r = "bottom",
1643
+ disabled: i = !1,
1644
+ onOpenChange: o,
1550
1645
  "data-testid": c
1551
1646
  }) => {
1552
- const d = A(null), [m, l] = te.Children.toArray(o), [y, u] = C(!1), p = Ze({
1553
- setIsOpen: u,
1554
- isOpen: y,
1647
+ const u = A(null), [d, l] = ee.Children.toArray(n), [p, m] = b(!1), y = vt({
1648
+ setIsOpen: m,
1649
+ isOpen: p,
1555
1650
  triggerType: e,
1556
1651
  clickArea: "root"
1557
- }), T = Ne();
1558
- Ye(d, () => t && u(!1)), E(() => {
1559
- r !== void 0 && u(r);
1560
- }, [r]);
1561
- const v = D(
1652
+ }), f = Be();
1653
+ lt(u, () => t && m(!1)), P(() => {
1654
+ a !== void 0 && m(a);
1655
+ }, [a]);
1656
+ const v = k(
1562
1657
  () => ({
1563
- dropdownRef: d,
1564
- placement: a,
1565
- isOpen: y,
1566
- setIsOpen: u,
1567
- onOpenChange: n,
1568
- dropdownId: T
1658
+ dropdownRef: u,
1659
+ placement: r,
1660
+ isOpen: p,
1661
+ setIsOpen: m,
1662
+ onOpenChange: o,
1663
+ dropdownId: f
1569
1664
  }),
1570
- [a, y, n, T]
1665
+ [r, p, o, f]
1571
1666
  );
1572
- return /* @__PURE__ */ i(ue.Provider, { value: v, children: /* @__PURE__ */ i(
1667
+ return /* @__PURE__ */ s(pe.Provider, { value: v, children: /* @__PURE__ */ s(
1573
1668
  "div",
1574
1669
  {
1575
1670
  className: "rmap-dropdown-container",
1576
- ref: d,
1671
+ ref: u,
1577
1672
  "data-testid": c,
1578
- ...p,
1579
- children: /* @__PURE__ */ w(z, { children: [
1580
- m,
1581
- !s && l
1673
+ ...y,
1674
+ children: /* @__PURE__ */ w(R, { children: [
1675
+ d,
1676
+ !i && l
1582
1677
  ] })
1583
1678
  }
1584
1679
  ) });
1585
- }, Wt = (e, t) => D(() => {
1680
+ }, dr = (e, t) => k(() => {
1586
1681
  if (t)
1587
1682
  return {
1588
1683
  position: "absolute",
@@ -1593,228 +1688,192 @@ const Ze = ({
1593
1688
  left: e === "right" ? `${t.width}px` : void 0,
1594
1689
  right: e === "left" ? `${t.width}px` : void 0
1595
1690
  };
1596
- }, [t, e]), Gt = ({
1691
+ }, [t, e]), mr = ({
1597
1692
  children: e,
1598
1693
  isWithAnimation: t = !0,
1599
- ...o
1694
+ ...n
1600
1695
  }) => {
1601
- const { dropdownRef: r, placement: a, isOpen: s, setIsOpen: n, dropdownId: c } = g(ue), [d, m] = C(), { onClick: l } = Ze({
1602
- setIsOpen: n,
1603
- isOpen: s,
1696
+ const { dropdownRef: a, placement: r, isOpen: i, setIsOpen: o, dropdownId: c } = E(pe), [u, d] = b(), { onClick: l } = vt({
1697
+ setIsOpen: o,
1698
+ isOpen: i,
1604
1699
  clickArea: "content"
1605
- }), y = () => n(!1), u = () => n(!0);
1606
- E(() => {
1607
- r.current && m({
1608
- width: r.current.offsetWidth,
1609
- height: r.current.offsetHeight
1700
+ }), p = () => o(!1), m = () => o(!0);
1701
+ P(() => {
1702
+ a.current && d({
1703
+ width: a.current.offsetWidth,
1704
+ height: a.current.offsetHeight
1610
1705
  });
1611
- }, [r]);
1612
- const p = Wt(a, d), T = d ? /* @__PURE__ */ i(
1706
+ }, [a]);
1707
+ const y = dr(r, u), f = u ? /* @__PURE__ */ s(
1613
1708
  "div",
1614
1709
  {
1615
- ...o,
1710
+ ...n,
1616
1711
  id: c,
1617
- style: { ...p, ...o.style },
1712
+ style: { ...y, ...n.style },
1618
1713
  onClick: l,
1619
1714
  children: e
1620
1715
  }
1621
1716
  ) : null;
1622
- return t ? /* @__PURE__ */ i(
1623
- Se,
1717
+ return t ? /* @__PURE__ */ s(
1718
+ ke,
1624
1719
  {
1625
- visible: s,
1720
+ visible: i,
1626
1721
  name: "rmap-dropdown-content",
1627
1722
  enterTime: 20,
1628
1723
  leaveTime: 60,
1629
1724
  clearTime: 300,
1630
- onExited: y,
1631
- onEntered: u,
1632
- children: T
1725
+ onExited: p,
1726
+ onEntered: m,
1727
+ children: f
1633
1728
  }
1634
- ) : s ? T : null;
1635
- }, et = ve(({ children: e, className: t, ...o }, r) => {
1636
- const { isOpen: a, dropdownId: s } = g(ue), n = t ? `rmap-dropdown-trigger ${t}` : "rmap-dropdown-trigger";
1637
- return /* @__PURE__ */ i(
1638
- q,
1729
+ ) : i ? f : null;
1730
+ }, ft = Pe(({ children: e, className: t, ...n }, a) => {
1731
+ const { isOpen: r, dropdownId: i } = E(pe), o = t ? `rmap-dropdown-trigger ${t}` : "rmap-dropdown-trigger";
1732
+ return /* @__PURE__ */ s(
1733
+ j,
1639
1734
  {
1640
- className: n,
1735
+ className: o,
1641
1736
  type: "button",
1642
- ...o,
1737
+ ...n,
1643
1738
  "aria-haspopup": "true",
1644
- "aria-expanded": a,
1645
- "aria-controls": s,
1646
- ref: r,
1739
+ "aria-expanded": r,
1740
+ "aria-controls": i,
1741
+ ref: a,
1647
1742
  children: e
1648
1743
  }
1649
1744
  );
1650
1745
  });
1651
- et.displayName = "DropdownTrigger";
1652
- ie.Content = Gt;
1653
- ie.Trigger = et;
1654
- const jt = ({
1746
+ ft.displayName = "DropdownTrigger";
1747
+ oe.Content = mr;
1748
+ oe.Trigger = ft;
1749
+ const pr = ({
1655
1750
  triggerRef: e,
1656
1751
  initialState: t
1657
1752
  }) => {
1658
- const { playerPlacement: o } = O(), [r, a] = C(t);
1659
- return E(() => {
1753
+ const { playerPlacement: n } = x(), [a, r] = b(t);
1754
+ return P(() => {
1660
1755
  if (e.current) {
1661
- const s = () => e.current.getBoundingClientRect().top < window.innerHeight / 2 ? "bottom" : "top", n = setTimeout(() => {
1662
- a(s());
1756
+ const i = () => e.current.getBoundingClientRect().top < window.innerHeight / 2 ? "bottom" : "top", o = setTimeout(() => {
1757
+ r(i());
1663
1758
  }, 0);
1664
1759
  return () => {
1665
- clearTimeout(n);
1760
+ clearTimeout(o);
1666
1761
  };
1667
1762
  }
1668
- }, [o, e]), r;
1669
- }, qt = () => {
1670
- const e = A(null), { muted: t } = b(), o = g(P), r = f(
1671
- () => o({ type: "SET_MUTED", muted: !t }),
1672
- [o, t]
1763
+ }, [n, e]), a;
1764
+ }, ht = ({ gridArea: e, visible: t, ...n }) => {
1765
+ const a = A(null), { muted: r } = C(), i = E(L), o = g(
1766
+ () => i({ type: "SET_MUTED", muted: !r }),
1767
+ [i, r]
1673
1768
  ), {
1674
- activeUI: { volumeSlider: a },
1675
- volumeSliderPlacement: s
1676
- } = O(), n = jt({
1677
- triggerRef: e,
1769
+ activeUI: { volumeSlider: c },
1770
+ volumeSliderPlacement: u
1771
+ } = x(), d = pr({
1772
+ triggerRef: a,
1678
1773
  initialState: "bottom"
1679
- });
1680
- return /* @__PURE__ */ w(
1681
- ie,
1774
+ }), l = z("volume", e);
1775
+ return /* @__PURE__ */ s(_.Item, { gridArea: l, visible: t ?? !0, ...n, children: /* @__PURE__ */ w(
1776
+ oe,
1682
1777
  {
1683
- placement: s || n,
1778
+ placement: u || d,
1684
1779
  triggerType: "hover",
1685
- disabled: a === !1,
1780
+ disabled: c === !1,
1686
1781
  "data-testid": "volume-dropdown",
1687
1782
  children: [
1688
- /* @__PURE__ */ i(
1689
- ie.Trigger,
1783
+ /* @__PURE__ */ s(
1784
+ oe.Trigger,
1690
1785
  {
1691
- ref: e,
1692
- "aria-label": t ? "Unmute" : "Mute",
1693
- "aria-pressed": t,
1694
- onClick: r,
1786
+ ref: a,
1787
+ "aria-label": r ? "Unmute" : "Mute",
1788
+ "aria-pressed": r,
1789
+ onClick: o,
1695
1790
  className: "rmap-volume-trigger",
1696
1791
  "data-testid": "volume-trigger-btn",
1697
- "data-muted": String(t),
1698
- children: /* @__PURE__ */ i(qe, {})
1792
+ "data-muted": String(r),
1793
+ children: /* @__PURE__ */ s(ct, {})
1699
1794
  }
1700
1795
  ),
1701
- /* @__PURE__ */ i(ie.Content, { role: "tooltip", children: /* @__PURE__ */ i(
1702
- zt,
1796
+ /* @__PURE__ */ s(oe.Content, { role: "tooltip", children: /* @__PURE__ */ s(
1797
+ ur,
1703
1798
  {
1704
- placement: s || n
1799
+ placement: u || d
1705
1800
  }
1706
1801
  ) })
1707
1802
  ]
1708
1803
  }
1709
- );
1710
- }, Yt = () => {
1711
- var r, a, s, n, c, d, m, l, y, u;
1712
- const { interfacePlacement: e, activeUI: t } = O(), o = !!(t.prevNnext ?? t.all);
1713
- return /* @__PURE__ */ w(z, { children: [
1714
- /* @__PURE__ */ i(
1715
- M.Item,
1716
- {
1717
- gridArea: ((r = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : r.progress) || ((a = e == null ? void 0 : e.templateArea) == null ? void 0 : a.progress) || N.templateArea.progress,
1718
- width: "100%",
1719
- visible: !!(t.progress !== void 0 ? t.progress : t.all),
1720
- children: /* @__PURE__ */ i(Rt, {})
1721
- }
1722
- ),
1723
- /* @__PURE__ */ i(
1724
- M.Item,
1725
- {
1726
- gridArea: ((s = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : s.repeatType) || ((n = e == null ? void 0 : e.templateArea) == null ? void 0 : n.repeatType) || N.templateArea.repeatType,
1727
- visible: !!(t.repeatType ?? t.all),
1728
- children: /* @__PURE__ */ i(Lt, {})
1729
- }
1730
- ),
1731
- /* @__PURE__ */ i(
1732
- M.Item,
1733
- {
1734
- gridArea: ((c = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : c.playButton) || ((d = e == null ? void 0 : e.templateArea) == null ? void 0 : d.playButton) || N.templateArea.playButton,
1735
- visible: !!(t.playButton ?? t.all),
1736
- children: /* @__PURE__ */ w("div", { className: "rmap-ctrl-btn-wrapper", children: [
1737
- /* @__PURE__ */ i(It, { isVisible: o }),
1738
- /* @__PURE__ */ i(Et, {}),
1739
- /* @__PURE__ */ i(St, { isVisible: o })
1740
- ] })
1741
- }
1742
- ),
1743
- /* @__PURE__ */ i(
1744
- M.Item,
1745
- {
1746
- gridArea: ((m = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : m.volume) || ((l = e == null ? void 0 : e.templateArea) == null ? void 0 : l.volume) || N.templateArea.volume,
1747
- visible: !!(t.volume ?? t.all),
1748
- children: /* @__PURE__ */ i(qt, {})
1749
- }
1750
- ),
1751
- /* @__PURE__ */ i(
1752
- M.Item,
1753
- {
1754
- gridArea: ((y = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : y.playList) || ((u = e == null ? void 0 : e.templateArea) == null ? void 0 : u.playList) || N.templateArea.playList,
1755
- visible: !!(t.playList ?? t.all),
1756
- children: /* @__PURE__ */ i(Ut, {})
1757
- }
1758
- )
1804
+ ) });
1805
+ }, yr = () => {
1806
+ const { activeUI: e } = x(), t = (n) => !!(e[n] ?? e.all);
1807
+ return /* @__PURE__ */ w(R, { children: [
1808
+ /* @__PURE__ */ s(yt, { visible: t("progress") }),
1809
+ /* @__PURE__ */ s(st, { visible: t("repeatType") }),
1810
+ /* @__PURE__ */ s(it, { visible: t("playButton") }),
1811
+ /* @__PURE__ */ s(ht, { visible: t("volume") }),
1812
+ /* @__PURE__ */ s(dt, { visible: t("playList") })
1759
1813
  ] });
1760
- }, Xt = W(function() {
1761
- const { playList: t, curIdx: o } = V(), { coverImgsCss: r } = L(), a = t[o], s = [a == null ? void 0 : a.writer, a == null ? void 0 : a.name].filter(Boolean).join(" - ") || "Album artwork";
1762
- return /* @__PURE__ */ i("div", { className: "rmap-artwork-container", children: a != null && a.img ? /* @__PURE__ */ i("img", { src: a.img, alt: s, style: r == null ? void 0 : r.artwork }) : /* @__PURE__ */ i(
1814
+ }, Tt = G(function({
1815
+ gridArea: t,
1816
+ visible: n,
1817
+ ...a
1818
+ }) {
1819
+ const { playList: r, curIdx: i } = K(), { coverImgsCss: o } = N(), c = r[i], u = [c == null ? void 0 : c.writer, c == null ? void 0 : c.name].filter(Boolean).join(" - ") || "Album artwork", d = z("artwork", t);
1820
+ return /* @__PURE__ */ s(_.Item, { gridArea: d, visible: n ?? !0, ...a, children: /* @__PURE__ */ s("div", { className: "rmap-artwork-container", children: c != null && c.img ? /* @__PURE__ */ s("img", { src: c.img, alt: u, style: o == null ? void 0 : o.artwork }) : /* @__PURE__ */ s(
1763
1821
  "div",
1764
1822
  {
1765
1823
  className: "rmap-artwork-fallback",
1766
1824
  role: "img",
1767
- "aria-label": s,
1768
- style: r == null ? void 0 : r.artwork,
1769
- children: (a == null ? void 0 : a.name) || "♪"
1825
+ "aria-label": u,
1826
+ style: o == null ? void 0 : o.artwork,
1827
+ children: (c == null ? void 0 : c.name) || "♪"
1770
1828
  }
1771
- ) });
1772
- }), Qt = W(function() {
1773
- const { playList: t, curIdx: o } = V(), r = t[o];
1774
- return /* @__PURE__ */ i("div", { className: "rmap-track-info-container", children: r != null && r.customTrackInfo ? r.customTrackInfo : /* @__PURE__ */ w(z, { children: [
1775
- (r == null ? void 0 : r.name) && /* @__PURE__ */ i("span", { className: "title", "data-testid": "track-title", children: r.name }),
1776
- (r == null ? void 0 : r.writer) && /* @__PURE__ */ i("span", { className: "writer", children: r.writer })
1777
- ] }) });
1778
- }), tt = ({ position: e, className: t, children: o, ...r }) => /* @__PURE__ */ i(
1829
+ ) }) });
1830
+ }), Me = G(function({
1831
+ gridArea: t,
1832
+ visible: n,
1833
+ ...a
1834
+ }) {
1835
+ const { playList: r, curIdx: i } = K(), o = r[i], c = z("trackInfo", t);
1836
+ return /* @__PURE__ */ s(_.Item, { gridArea: c, visible: n ?? !0, ...a, children: /* @__PURE__ */ s("div", { className: "rmap-track-info-container", children: o != null && o.customTrackInfo ? o.customTrackInfo : /* @__PURE__ */ w(R, { children: [
1837
+ (o == null ? void 0 : o.name) && /* @__PURE__ */ s("span", { className: "title", "data-testid": "track-title", children: o.name }),
1838
+ (o == null ? void 0 : o.writer) && /* @__PURE__ */ s("span", { className: "writer", children: o.writer })
1839
+ ] }) }) });
1840
+ });
1841
+ Me.displayName = "TrackInfo";
1842
+ const gt = ({ position: e, className: t, children: n, ...a }) => /* @__PURE__ */ s(
1779
1843
  "div",
1780
1844
  {
1781
1845
  className: `rmap-track-time-container${t ? ` ${t}` : ""}`,
1782
1846
  "data-position": e,
1783
- ...r,
1784
- children: o
1847
+ ...a,
1848
+ children: n
1785
1849
  }
1786
- ), Jt = ({ position: e }) => {
1787
- const { currentTime: t } = re();
1788
- return /* @__PURE__ */ i(tt, { position: e, className: "rmap-track-time-current", children: /* @__PURE__ */ i(
1850
+ ), vr = ({ position: e }) => {
1851
+ const { currentTime: t } = te();
1852
+ return /* @__PURE__ */ s(gt, { position: e, className: "rmap-track-time-current", children: /* @__PURE__ */ s(
1789
1853
  "span",
1790
1854
  {
1791
1855
  className: "rmap-track-current-time",
1792
1856
  "data-testid": "track-current-time",
1793
- children: ee(t)
1857
+ children: Z(t)
1794
1858
  }
1795
1859
  ) });
1796
- }, Zt = ({ position: e }) => {
1797
- const { duration: t } = re();
1798
- return /* @__PURE__ */ i(
1799
- tt,
1860
+ }, fr = ({ position: e }) => {
1861
+ const { duration: t } = te();
1862
+ return /* @__PURE__ */ s(
1863
+ gt,
1800
1864
  {
1801
1865
  position: e,
1802
1866
  className: "rmap-track-time-duration",
1803
- children: /* @__PURE__ */ i("span", { className: "rmap-track-duration", children: ee(t) })
1867
+ children: /* @__PURE__ */ s("span", { className: "rmap-track-duration", children: Z(t) })
1804
1868
  }
1805
1869
  );
1806
- }, er = () => {
1807
- var c, d, m, l, y, u, p, T;
1808
- const { interfacePlacement: e, activeUI: t } = O(), o = f(
1809
- (v) => +v.split(/[^\d]/).join(""),
1870
+ }, Et = ({ visible: e }) => {
1871
+ const t = z("trackTimeCurrent"), n = z("trackTimeDuration"), a = g(
1872
+ (d) => +d.split(/[^\d]/).join(""),
1810
1873
  []
1811
- ), r = o(
1812
- ((c = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : c.trackTimeCurrent) || ((d = e == null ? void 0 : e.templateArea) == null ? void 0 : d.trackTimeCurrent) || N.templateArea.trackTimeCurrent
1813
- ), a = o(
1814
- ((m = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : m.trackTimeDuration) || ((l = e == null ? void 0 : e.templateArea) == null ? void 0 : l.trackTimeDuration) || N.templateArea.trackTimeDuration
1815
- ), s = f(
1816
- (v) => {
1817
- switch (v) {
1874
+ ), r = a(t), i = a(n), o = g(
1875
+ (d) => {
1876
+ switch (d) {
1818
1877
  case 1:
1819
1878
  return "right";
1820
1879
  case -1:
@@ -1824,296 +1883,357 @@ const jt = ({
1824
1883
  }
1825
1884
  },
1826
1885
  []
1827
- ), n = {
1828
- current: s(r - a),
1829
- duration: s(a - r)
1830
- };
1831
- return /* @__PURE__ */ w(z, { children: [
1832
- /* @__PURE__ */ i(
1833
- M.Item,
1834
- {
1835
- gridArea: ((y = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : y.trackTimeCurrent) || ((u = e == null ? void 0 : e.templateArea) == null ? void 0 : u.trackTimeCurrent) || N.templateArea.trackTimeCurrent,
1836
- visible: !!(t.trackTime ?? t.all),
1837
- children: /* @__PURE__ */ i(Jt, { position: n.current })
1838
- }
1839
- ),
1840
- /* @__PURE__ */ i(
1841
- M.Item,
1842
- {
1843
- gridArea: ((p = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : p.trackTimeDuration) || ((T = e == null ? void 0 : e.templateArea) == null ? void 0 : T.trackTimeDuration) || N.templateArea.trackTimeDuration,
1844
- visible: !!(t.trackTime ?? t.all),
1845
- children: /* @__PURE__ */ i(Zt, { position: n.duration })
1846
- }
1847
- )
1886
+ ), c = {
1887
+ current: o(r - i),
1888
+ duration: o(i - r)
1889
+ }, u = e ?? !0;
1890
+ return /* @__PURE__ */ w(R, { children: [
1891
+ /* @__PURE__ */ s(_.Item, { gridArea: t, visible: u, children: /* @__PURE__ */ s(vr, { position: c.current }) }),
1892
+ /* @__PURE__ */ s(_.Item, { gridArea: n, visible: u, children: /* @__PURE__ */ s(fr, { position: c.duration }) })
1848
1893
  ] });
1849
- }, tr = () => {
1850
- var s, n, c, d, m, l, y, u;
1851
- const { playList: e, curIdx: t } = V(), { interfacePlacement: o, activeUI: r } = O(), a = !!(((s = e[t]) == null ? void 0 : s.customTrackInfo) ?? ((n = e[t]) == null ? void 0 : n.writer) ?? ((c = e[t]) == null ? void 0 : c.name)) && !!(r.trackInfo ?? r.all);
1852
- return /* @__PURE__ */ w(z, { children: [
1853
- /* @__PURE__ */ i(
1854
- M.Item,
1894
+ }, hr = () => {
1895
+ var r, i, o, c;
1896
+ const { playList: e, curIdx: t } = K(), { activeUI: n } = x(), a = !!(((r = e[t]) == null ? void 0 : r.customTrackInfo) ?? ((i = e[t]) == null ? void 0 : i.writer) ?? ((o = e[t]) == null ? void 0 : o.name)) && !!(n.trackInfo ?? n.all);
1897
+ return /* @__PURE__ */ w(R, { children: [
1898
+ /* @__PURE__ */ s(
1899
+ Tt,
1855
1900
  {
1856
- gridArea: ((d = o == null ? void 0 : o.itemCustomArea) == null ? void 0 : d.artwork) || ((m = o == null ? void 0 : o.templateArea) == null ? void 0 : m.artwork) || N.templateArea.artwork,
1857
- visible: !!((l = e[t]) != null && l.img && (r.artwork ?? r.all)),
1858
- children: /* @__PURE__ */ i(Xt, {})
1901
+ visible: !!((c = e[t]) != null && c.img && (n.artwork ?? n.all))
1859
1902
  }
1860
1903
  ),
1861
- /* @__PURE__ */ i(
1862
- M.Item,
1863
- {
1864
- gridArea: ((y = o == null ? void 0 : o.itemCustomArea) == null ? void 0 : y.trackInfo) || ((u = o == null ? void 0 : o.templateArea) == null ? void 0 : u.trackInfo) || N.templateArea.trackInfo,
1865
- visible: a,
1866
- children: /* @__PURE__ */ i(Qt, {})
1867
- }
1868
- ),
1869
- /* @__PURE__ */ i(er, {})
1904
+ /* @__PURE__ */ s(Me, { visible: a }),
1905
+ /* @__PURE__ */ s(Et, { visible: !!(n.trackTime ?? n.all) })
1870
1906
  ] });
1871
- }, rr = (e, t, o) => {
1872
- const r = f(
1873
- (u, p, T) => {
1874
- const v = Object.keys(
1875
- N.templateArea
1876
- ).filter((I) => (I === "trackTimeCurrent" || I === "trackTimeDuration") && u.trackTime === !1 ? !1 : u[I] !== void 0 ? u[I] : !0), h = u.all ? v : Object.entries(u).filter(([, I]) => I).map(([I]) => I);
1907
+ }, Ee = {
1908
+ Progress: { displayName: "Progress", activeUIKey: "progress" },
1909
+ Volume: { displayName: "Volume", activeUIKey: "volume" },
1910
+ SortablePlayList: { displayName: "PlayList", activeUIKey: "playList" },
1911
+ TransportControls: { displayName: "PlayButton", activeUIKey: "playButton" },
1912
+ RepeatTypeBtn: { displayName: "RepeatButton", activeUIKey: "repeatType" },
1913
+ Artwork: { displayName: "Artwork", activeUIKey: "artwork" },
1914
+ TrackInfo: { displayName: "TrackInfo", activeUIKey: "trackInfo" },
1915
+ TrackTime: { displayName: "TrackTime", activeUIKey: "trackTime" }
1916
+ };
1917
+ function Tr(e, t) {
1918
+ const n = e[t];
1919
+ return n === !1 ? !1 : n !== void 0 ? !0 : !!e.all;
1920
+ }
1921
+ function _e(e) {
1922
+ const t = e.type;
1923
+ if (!t) return;
1924
+ const n = t.type ?? t;
1925
+ return n.displayName || n.name || void 0;
1926
+ }
1927
+ const gr = (e, t, n, a) => {
1928
+ const r = k(
1929
+ () => (a ?? []).map(_e).map(
1930
+ (h) => {
1931
+ var I;
1932
+ return h ? (I = Ee[h]) == null ? void 0 : I.activeUIKey : void 0;
1933
+ }
1934
+ ).filter((h) => h !== void 0),
1935
+ [a]
1936
+ ), i = k(
1937
+ () => [...r].sort().join(","),
1938
+ [r]
1939
+ ), o = g(
1940
+ (h, I, B, re) => {
1941
+ const se = Object.keys(
1942
+ de.templateArea
1943
+ ).filter((S) => (S === "trackTimeCurrent" || S === "trackTimeDuration") && h.trackTime === !1 ? !1 : h[S] !== void 0 ? h[S] : !0), D = h.all ? se : Object.entries(h).filter(([, S]) => S).map(([S]) => S);
1944
+ for (const S of re)
1945
+ D.includes(S) || D.push(S);
1877
1946
  (() => {
1878
- h.find((I) => I === "trackTime") && (h.splice(h.indexOf("trackTime"), 1), h.push("trackTimeCurrent"), h.push("trackTimeDuration"));
1947
+ D.find((S) => S === "trackTime") && (D.splice(D.indexOf("trackTime"), 1), D.push("trackTimeCurrent"), D.push("trackTimeDuration"));
1879
1948
  })();
1880
- const k = {
1881
- ...N.templateArea,
1882
- ...p
1883
- }, B = Object.entries(
1884
- k
1885
- ).filter(([I]) => h.includes(I));
1886
- let R = 1;
1887
- const G = {}, ae = [
1888
- ...B,
1889
- ...Object.entries(T || {})
1890
- ].flatMap(([I, _]) => {
1891
- if (_ == null) return [];
1892
- const [K, $] = _.split("-"), j = +K.split("row")[1];
1893
- return R = Math.max(R, j), G[j] = G[j] ? G[j] + 1 : 1, [
1949
+ const q = {
1950
+ ...de.templateArea,
1951
+ ...I
1952
+ }, At = Object.entries(
1953
+ q
1954
+ ).filter(([S]) => D.includes(S));
1955
+ let le = 1;
1956
+ const ue = {}, It = [
1957
+ ...At,
1958
+ ...Object.entries(B || {})
1959
+ ].flatMap(([S, U]) => {
1960
+ if (U == null) return [];
1961
+ const [$, F] = U.split("-"), W = +$.split("row")[1];
1962
+ return le = Math.max(le, W), ue[W] = ue[W] ? ue[W] + 1 : 1, [
1894
1963
  {
1895
- key: I,
1896
- row: j,
1897
- col: +$
1964
+ key: S,
1965
+ row: W,
1966
+ col: +F
1898
1967
  }
1899
1968
  ];
1900
- }).sort((I, _) => I.col - _.col), X = Math.max(...Object.values(G));
1901
- let oe;
1902
- const rt = new Array(R).fill("").map((I, _) => {
1903
- let K = "", $;
1904
- const j = ae.filter((U) => U.row !== _ + 1 ? !1 : (U.key === "progress" && ($ = U), !0));
1905
- if ($) {
1906
- const U = /* @__PURE__ */ new Map();
1907
- j.forEach((Q) => U.set(Q.col, Q));
1908
- const de = `row${_ + 1}-${$.col}`, ne = [];
1909
- for (let Q = 0; Q < X; Q++) {
1910
- const Pe = Q + 1;
1911
- U.has(Pe) ? ne.push(`row${_ + 1}-${Pe}`) : ne.push(de);
1969
+ }).sort((S, U) => S.col - U.col), ye = Math.max(...Object.values(ue));
1970
+ let De;
1971
+ const St = new Array(le).fill("").map((S, U) => {
1972
+ let $ = "", F;
1973
+ const W = It.filter((V) => V.row !== U + 1 ? !1 : (V.key === "progress" && (F = V), !0));
1974
+ if (F) {
1975
+ const V = /* @__PURE__ */ new Map();
1976
+ W.forEach((X) => V.set(X.col, X));
1977
+ const ve = `row${U + 1}-${F.col}`, ae = [];
1978
+ for (let X = 0; X < ye; X++) {
1979
+ const Ue = X + 1;
1980
+ V.has(Ue) ? ae.push(`row${U + 1}-${Ue}`) : ae.push(ve);
1912
1981
  }
1913
- const nt = ne.indexOf(de), st = ne.lastIndexOf(de);
1914
- oe = Math.floor((nt + st) / 2), K = " " + ne.join(" ");
1982
+ const Nt = ae.indexOf(ve), bt = ae.lastIndexOf(ve);
1983
+ De = Math.floor((Nt + bt) / 2), $ = " " + ae.join(" ");
1915
1984
  } else
1916
- for (let U = 0; U < X; U++)
1917
- K += ` row${_ + 1}-${U + 1}`;
1918
- return K.trimStart();
1919
- }), at = Xe ? window.innerWidth - 100 : 1500, ot = new Array(R).fill("").map((I, _) => {
1920
- let K = "";
1921
- for (let $ = 0; $ < X; $++) {
1922
- if (oe === $ && _ === 0) {
1923
- K += " 1fr";
1985
+ for (let V = 0; V < ye; V++)
1986
+ $ += ` row${U + 1}-${V + 1}`;
1987
+ return $.trimStart();
1988
+ }), wt = ut ? window.innerWidth - 100 : 1500, Lt = new Array(le).fill("").map((S, U) => {
1989
+ let $ = "";
1990
+ for (let F = 0; F < ye; F++) {
1991
+ if (De === F && U === 0) {
1992
+ $ += " 1fr";
1924
1993
  continue;
1925
1994
  }
1926
- K += ` fit-content(${at}px)`;
1995
+ $ += ` fit-content(${wt}px)`;
1927
1996
  }
1928
- return K.trimStart();
1997
+ return $.trimStart();
1929
1998
  });
1930
- return { gridAreas: rt, gridColumns: ot };
1999
+ return { gridAreas: St, gridColumns: Lt };
1931
2000
  },
1932
2001
  []
1933
- ), [a, s] = C(e), [n, c] = C({
2002
+ ), [c, u] = b(e), [d, l] = b(i), [p, m] = b({
1934
2003
  templateArea: t,
1935
- customComponentsArea: o
1936
- }), [d, m] = C();
1937
- if (!d) {
1938
- const { gridAreas: u, gridColumns: p } = r(
1939
- a,
1940
- n.templateArea,
1941
- n.customComponentsArea
2004
+ customComponentsArea: n
2005
+ }), [y, f] = b();
2006
+ if (!y) {
2007
+ const { gridAreas: h, gridColumns: I } = o(
2008
+ c,
2009
+ p.templateArea,
2010
+ p.customComponentsArea,
2011
+ r
1942
2012
  );
1943
- return m({ gridAreas: u, gridColumns: p }), [u, p];
2013
+ return f({ gridAreas: h, gridColumns: I }), [h, I];
1944
2014
  }
1945
- if (a !== e || n.templateArea !== t || n.customComponentsArea !== o) {
1946
- s(e), c({ templateArea: t, customComponentsArea: o });
1947
- const { gridAreas: u, gridColumns: p } = r(
2015
+ if (c !== e || d !== i || p.templateArea !== t || p.customComponentsArea !== n) {
2016
+ u(e), l(i), m({ templateArea: t, customComponentsArea: n });
2017
+ const { gridAreas: h, gridColumns: I } = o(
1948
2018
  e,
1949
2019
  t,
1950
- o
2020
+ n,
2021
+ r
1951
2022
  );
1952
- m({ gridAreas: u, gridColumns: p });
2023
+ f({ gridAreas: h, gridColumns: I });
1953
2024
  }
1954
- const { gridAreas: l, gridColumns: y } = d;
1955
- return [l, y];
1956
- }, ar = ({ children: e }) => {
1957
- const { interfacePlacement: t, activeUI: o, playListPlacement: r } = O(), a = te.Children.toArray(e), [s, n] = rr(
1958
- o,
2025
+ const { gridAreas: v, gridColumns: T } = y;
2026
+ return [v, T];
2027
+ };
2028
+ function Er(e) {
2029
+ return k(() => {
2030
+ const t = ee.Children.toArray(e).filter(Mt), n = t.find(Ke);
2031
+ return {
2032
+ compoundChildren: t.filter(
2033
+ (a) => !Ke(a)
2034
+ ),
2035
+ playListEmptyNode: Pr(n)
2036
+ };
2037
+ }, [e]);
2038
+ }
2039
+ function Ke(e) {
2040
+ return _e(e) === ze;
2041
+ }
2042
+ function Pr(e) {
2043
+ if (!e) return null;
2044
+ const t = e.props;
2045
+ return (t == null ? void 0 : t.children) ?? null;
2046
+ }
2047
+ function Ar({
2048
+ compoundChildren: e,
2049
+ activeUI: t
2050
+ }) {
2051
+ const n = e.map(_e).filter((a) => !!(a && Ee[a])).sort().join(",");
2052
+ P(() => {
2053
+ if (process.env.NODE_ENV === "production" || !n) return;
2054
+ const a = /* @__PURE__ */ new Set();
2055
+ for (const r of n.split(",")) {
2056
+ const i = Ee[r];
2057
+ i && (a.has(i.displayName) || Tr(t, i.activeUIKey) && (a.add(i.displayName), console.warn(
2058
+ `[react-modern-audio-player] Both preset and compound '${i.displayName}' are rendered. Set \`activeUI.${i.activeUIKey}=false\` to replace the preset control.`
2059
+ )));
2060
+ }
2061
+ }, [n, t]);
2062
+ }
2063
+ const Ir = ({ children: e }) => {
2064
+ const { interfacePlacement: t, activeUI: n, playListPlacement: a } = x(), { compoundChildren: r, playListEmptyNode: i } = Er(e);
2065
+ Ar({ compoundChildren: r, activeUI: n });
2066
+ const [o, c] = gr(
2067
+ n,
1959
2068
  t == null ? void 0 : t.templateArea,
1960
- t == null ? void 0 : t.customComponentsArea
1961
- );
1962
- return /* @__PURE__ */ w(
2069
+ t == null ? void 0 : t.customComponentsArea,
2070
+ r
2071
+ ), [u, d] = b(null);
2072
+ return /* @__PURE__ */ s(
1963
2073
  "div",
1964
2074
  {
1965
2075
  className: "rmap-interface-container",
1966
2076
  "data-testid": "audio-player",
1967
2077
  role: "region",
1968
2078
  "aria-label": "Audio player",
1969
- children: [
1970
- r === "top" && /* @__PURE__ */ i("div", { className: "rmap-sortable-playlist" }),
2079
+ children: /* @__PURE__ */ s(Ce.Provider, { value: u, children: /* @__PURE__ */ w(xe.Provider, { value: i, children: [
2080
+ a === "top" && /* @__PURE__ */ s("div", { ref: d, className: "rmap-sortable-playlist" }),
1971
2081
  /* @__PURE__ */ w(
1972
- M,
2082
+ _,
1973
2083
  {
1974
2084
  alignItems: "center",
1975
2085
  justifyContent: "center",
1976
- areas: s,
2086
+ areas: o,
1977
2087
  minHeight: "30px",
1978
- columns: n,
2088
+ columns: c,
1979
2089
  UNSAFE_className: "rmap-interface-grid",
1980
2090
  children: [
1981
- /* @__PURE__ */ i(tr, {}),
1982
- /* @__PURE__ */ i(Yt, {}),
1983
- a
2091
+ /* @__PURE__ */ s(hr, {}),
2092
+ /* @__PURE__ */ s(yr, {}),
2093
+ r
1984
2094
  ]
1985
2095
  }
1986
2096
  ),
1987
- r === "bottom" && /* @__PURE__ */ i("div", { className: "rmap-sortable-playlist" })
1988
- ]
2097
+ a === "bottom" && /* @__PURE__ */ s("div", { ref: d, className: "rmap-sortable-playlist" })
2098
+ ] }) })
1989
2099
  }
1990
2100
  );
1991
- }, Z = (e, t) => {
1992
- const o = A(!1);
1993
- E(() => {
1994
- if (o.current)
2101
+ }, J = (e, t) => {
2102
+ const n = A(!1);
2103
+ P(() => {
2104
+ if (n.current)
1995
2105
  return e();
1996
- }, t), E(() => (o.current = !0, () => {
1997
- o.current = !1;
2106
+ }, t), P(() => (n.current = !0, () => {
2107
+ n.current = !1;
1998
2108
  }), []);
1999
- }, or = ({
2109
+ }, Sr = ({
2000
2110
  placement: e = {},
2001
2111
  activeUI: t,
2002
- coverImgsCss: o,
2003
- audioInitialState: r,
2004
- playList: a,
2005
- customIcons: s
2112
+ coverImgsCss: n,
2113
+ audioInitialState: a,
2114
+ playList: r,
2115
+ customIcons: i
2006
2116
  }) => {
2007
- const n = g(P);
2008
- Z(() => {
2117
+ const o = E(L);
2118
+ J(() => {
2009
2119
  const {
2010
2120
  player: c,
2011
- playList: d,
2012
- interface: m,
2121
+ playList: u,
2122
+ interface: d,
2013
2123
  volumeSlider: l
2014
2124
  } = e;
2015
- n({
2125
+ o({
2016
2126
  type: "SET_PLACEMENTS",
2017
2127
  playerPlacement: c,
2018
- playListPlacement: d,
2019
- interfacePlacement: m,
2128
+ playListPlacement: u,
2129
+ interfacePlacement: d,
2020
2130
  volumeSliderPlacement: l
2021
2131
  });
2022
- }, [n, e]), Z(() => {
2023
- t && n({ type: "SET_ACTIVE_UI", activeUI: t });
2024
- }, [t, n]), Z(() => {
2025
- o && n({ type: "SET_COVER_IMGS_CSS", coverImgsCss: o });
2026
- }, [n, o]), Z(() => {
2027
- r && n({
2132
+ }, [o, e]), J(() => {
2133
+ t && o({ type: "SET_ACTIVE_UI", activeUI: t });
2134
+ }, [t, o]), J(() => {
2135
+ n && o({ type: "SET_COVER_IMGS_CSS", coverImgsCss: n });
2136
+ }, [o, n]), J(() => {
2137
+ a && o({
2028
2138
  type: "SET_INITIAL_STATES",
2029
- audioState: r,
2030
- curPlayId: r.curPlayId
2139
+ audioState: a,
2140
+ curPlayId: a.curPlayId
2031
2141
  });
2032
- }, [r, n]), Z(() => {
2033
- n({ type: "UPDATE_PLAY_LIST", playList: a });
2034
- }, [n, a]), Z(() => {
2035
- s && n({ type: "SET_CUSTOM_ICONS", customIcons: s });
2036
- }, [s, n]);
2037
- }, nr = ({
2142
+ }, [a, o]), J(() => {
2143
+ o({ type: "UPDATE_PLAY_LIST", playList: r });
2144
+ }, [o, r]), J(() => {
2145
+ i && o({ type: "SET_CUSTOM_ICONS", customIcons: i });
2146
+ }, [i, o]);
2147
+ }, wr = ({
2038
2148
  audioRef: e,
2039
2149
  children: t,
2040
- ...o
2041
- }) => (or(o), /* @__PURE__ */ w("div", { id: "rm-audio-player", className: "rmap-player-container", children: [
2042
- /* @__PURE__ */ i(De, { audioRef: e }),
2043
- /* @__PURE__ */ i(ar, { children: t })
2150
+ ...n
2151
+ }) => (Sr(n), /* @__PURE__ */ w("div", { id: "rm-audio-player", className: "rmap-player-container", children: [
2152
+ /* @__PURE__ */ s(We, { audioRef: e }),
2153
+ /* @__PURE__ */ s(Ir, { children: t })
2044
2154
  ] }));
2045
- function we({
2155
+ function Pt({
2046
2156
  rootContainerProps: e,
2047
2157
  ...t
2048
2158
  }) {
2049
- return /* @__PURE__ */ i(vt, { ...t, children: /* @__PURE__ */ i(Me, { rootContainerProps: e, children: /* @__PURE__ */ i(nr, { ...t }) }) });
2159
+ return /* @__PURE__ */ s(Kt, { ...t, children: /* @__PURE__ */ s(He, { rootContainerProps: e, children: /* @__PURE__ */ s(wr, { ...t }) }) });
2050
2160
  }
2051
- we.displayName = "AudioPlayerWithProviders";
2052
- we.CustomComponent = _e;
2053
- const sr = () => {
2054
- const e = g(P), { isPlaying: t, repeatType: o } = b(), r = f(() => {
2161
+ Pt.displayName = "AudioPlayerWithProviders";
2162
+ const Dr = Object.assign(Pt, {
2163
+ Progress: yt,
2164
+ Volume: ht,
2165
+ PlayList: dt,
2166
+ PlayListEmpty: Ge,
2167
+ PlayButton: it,
2168
+ RepeatButton: st,
2169
+ Artwork: Tt,
2170
+ TrackInfo: Me,
2171
+ TrackTime: Et,
2172
+ CustomComponent: Ht
2173
+ }), Lr = () => {
2174
+ const e = E(L), { isPlaying: t, repeatType: n } = C(), a = g(() => {
2055
2175
  e({ type: "CHANGE_PLAYING_STATE", state: !0 });
2056
- }, [e]), a = f(() => {
2176
+ }, [e]), r = g(() => {
2057
2177
  e({ type: "CHANGE_PLAYING_STATE", state: !1 });
2058
- }, [e]), s = f(() => {
2178
+ }, [e]), i = g(() => {
2059
2179
  e({ type: "CHANGE_PLAYING_STATE" });
2060
2180
  }, [e]);
2061
- return { isPlaying: t, repeatType: o, play: r, pause: a, togglePlay: s };
2062
- }, ir = () => {
2063
- const e = g(P), { playList: t, curIdx: o, curPlayId: r } = V(), { elementRefs: a } = L(), s = f(
2064
- (d) => {
2065
- const m = t[d];
2066
- m && e({
2181
+ return { isPlaying: t, repeatType: n, play: a, pause: r, togglePlay: i };
2182
+ }, Nr = () => {
2183
+ const e = E(L), { playList: t, curIdx: n, curPlayId: a } = K(), { elementRefs: r } = N(), i = g(
2184
+ (u) => {
2185
+ const d = t[u];
2186
+ d && e({
2067
2187
  type: "SET_CURRENT_AUDIO",
2068
- currentIndex: d,
2069
- currentAudioId: m.id
2188
+ currentIndex: u,
2189
+ currentAudioId: d.id
2070
2190
  });
2071
2191
  },
2072
2192
  [e, t]
2073
- ), n = f(() => {
2193
+ ), o = g(() => {
2074
2194
  t.length !== 0 && e({ type: "NEXT_AUDIO" });
2075
- }, [e, t.length]), c = f(() => {
2076
- var m;
2195
+ }, [e, t.length]), c = g(() => {
2196
+ var d;
2077
2197
  if (t.length === 0) return;
2078
- const d = ((m = a == null ? void 0 : a.audioEl) == null ? void 0 : m.currentTime) ?? 0;
2079
- e({ type: "PREV_AUDIO", currentTime: d });
2080
- }, [e, t.length, a == null ? void 0 : a.audioEl]);
2198
+ const u = ((d = r == null ? void 0 : r.audioEl) == null ? void 0 : d.currentTime) ?? 0;
2199
+ e({ type: "PREV_AUDIO", currentTime: u });
2200
+ }, [e, t.length, r == null ? void 0 : r.audioEl]);
2081
2201
  return {
2082
- currentPlayId: r,
2083
- currentIndex: o,
2202
+ currentPlayId: a,
2203
+ currentIndex: n,
2084
2204
  playList: t,
2085
- currentTrack: t[o] ?? null,
2086
- setTrack: s,
2087
- next: n,
2205
+ currentTrack: t[n] ?? null,
2206
+ setTrack: i,
2207
+ next: o,
2088
2208
  prev: c
2089
2209
  };
2090
- }, lr = () => {
2091
- const e = g(P), { volume: t, muted: o } = b(), r = f(
2092
- (s) => {
2093
- e({ type: "SET_VOLUME", volume: s });
2210
+ }, br = () => {
2211
+ const e = E(L), { volume: t, muted: n } = C(), a = g(
2212
+ (i) => {
2213
+ e({ type: "SET_VOLUME", volume: i });
2094
2214
  },
2095
2215
  [e]
2096
- ), a = f(() => {
2097
- e({ type: "SET_MUTED", muted: !o });
2098
- }, [e, o]);
2099
- return { volume: t, muted: o, setVolume: r, toggleMute: a };
2100
- }, cr = () => {
2101
- const e = g(P), { currentTime: t, duration: o } = re(), r = f(
2102
- (a) => {
2103
- e({ type: "SEEK", time: a });
2216
+ ), r = g(() => {
2217
+ e({ type: "SET_MUTED", muted: !n });
2218
+ }, [e, n]);
2219
+ return { volume: t, muted: n, setVolume: a, toggleMute: r };
2220
+ }, kr = () => {
2221
+ const e = E(L), { currentTime: t, duration: n } = te(), a = g(
2222
+ (r) => {
2223
+ e({ type: "SEEK", time: r });
2104
2224
  },
2105
2225
  [e]
2106
2226
  );
2107
- return { currentTime: t, duration: o, seek: r };
2108
- }, yr = () => {
2109
- const e = sr(), t = ir(), o = lr(), r = cr();
2227
+ return { currentTime: t, duration: n, seek: a };
2228
+ }, Ur = () => {
2229
+ const e = Lr(), t = Nr(), n = br(), a = kr();
2110
2230
  return {
2111
2231
  isPlaying: e.isPlaying,
2112
- volume: o.volume,
2113
- currentTime: r.currentTime,
2114
- duration: r.duration,
2232
+ volume: n.volume,
2233
+ currentTime: a.currentTime,
2234
+ duration: a.duration,
2115
2235
  repeatType: e.repeatType,
2116
- muted: o.muted,
2236
+ muted: n.muted,
2117
2237
  currentTrack: t.currentTrack,
2118
2238
  currentIndex: t.currentIndex,
2119
2239
  playList: t.playList,
@@ -2122,39 +2242,44 @@ const sr = () => {
2122
2242
  togglePlay: e.togglePlay,
2123
2243
  next: t.next,
2124
2244
  prev: t.prev,
2125
- seek: r.seek,
2126
- setVolume: o.setVolume,
2127
- toggleMute: o.toggleMute,
2245
+ seek: a.seek,
2246
+ setVolume: n.setVolume,
2247
+ toggleMute: n.toggleMute,
2128
2248
  setTrack: t.setTrack
2129
2249
  };
2130
- }, vr = () => {
2131
- const { elementRefs: e } = L();
2250
+ }, Or = () => {
2251
+ const { elementRefs: e } = N();
2132
2252
  return {
2133
2253
  audioEl: e == null ? void 0 : e.audioEl,
2134
2254
  waveformInst: e == null ? void 0 : e.waveformInst
2135
2255
  };
2136
2256
  };
2137
- we.CustomComponent = _e;
2138
2257
  export {
2139
- nr as AudioPlayer,
2140
- Me as AudioPlayerContainer,
2141
- vt as AudioPlayerStateProvider,
2142
- F as DEFAULT_AUDIO_STATE,
2143
- he as audioAttrsContext,
2144
- P as audioPlayerDispatchContext,
2145
- pt as audioPlayerReducer,
2146
- we as default,
2147
- N as defaultInterfacePlacement,
2148
- pr as defaultInterfacePlacementMaxLength,
2149
- Te as playbackContext,
2150
- Ae as resourceContext,
2151
- Ee as timeContext,
2152
- fe as trackContext,
2153
- ge as uiContext,
2154
- yr as useAudioPlayer,
2155
- vr as useAudioPlayerElement,
2156
- sr as useAudioPlayerPlayback,
2157
- cr as useAudioPlayerTime,
2158
- ir as useAudioPlayerTrack,
2159
- lr as useAudioPlayerVolume
2258
+ wr as AudioPlayer,
2259
+ He as AudioPlayerContainer,
2260
+ Kt as AudioPlayerStateProvider,
2261
+ H as DEFAULT_AUDIO_STATE,
2262
+ Ie as audioAttrsContext,
2263
+ L as audioPlayerDispatchContext,
2264
+ Ut as audioPlayerReducer,
2265
+ Dr as default,
2266
+ de as defaultInterfacePlacement,
2267
+ _r as defaultInterfacePlacementMaxLength,
2268
+ Ae as playbackContext,
2269
+ Le as resourceContext,
2270
+ Ne as timeContext,
2271
+ Se as trackContext,
2272
+ we as uiContext,
2273
+ Ot as useAudioAttrsContext,
2274
+ Ur as useAudioPlayer,
2275
+ Or as useAudioPlayerElement,
2276
+ Lr as useAudioPlayerPlayback,
2277
+ kr as useAudioPlayerTime,
2278
+ Nr as useAudioPlayerTrack,
2279
+ br as useAudioPlayerVolume,
2280
+ C as usePlaybackContext,
2281
+ N as useResourceContext,
2282
+ te as useTimeContext,
2283
+ K as useTrackContext,
2284
+ x as useUIContext
2160
2285
  };