react-modern-audio-player 2.0.0-beta.1 → 2.0.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 (2) hide show
  1. package/dist/index.es.js +403 -403
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import './index.css';
3
- import { jsx as i, Fragment as R, jsxs as S } from "react/jsx-runtime";
4
- import te, { createContext as $, useReducer as nt, useMemo as D, useContext as st, forwardRef as ve, useCallback as T, useRef as E, useEffect as A, memo as z, useState as k, useId as ke, useLayoutEffect as it, cloneElement as lt } from "react";
3
+ import { jsx as i, Fragment as z, jsxs as S } from "react/jsx-runtime";
4
+ import te, { createContext as H, useReducer as nt, useMemo as D, useContext as st, forwardRef as ve, useCallback as g, useRef as A, useEffect as E, memo as W, useState as b, useId as ke, useLayoutEffect as it, cloneElement as lt } from "react";
5
5
  import ct, { flushSync as ut } from "react-dom";
6
6
  const F = {
7
7
  isPlaying: !1,
@@ -10,7 +10,7 @@ const F = {
10
10
  repeatType: "ALL",
11
11
  currentTime: 0,
12
12
  duration: 0
13
- }, mr = 10, L = {
13
+ }, pr = 10, k = {
14
14
  templateArea: {
15
15
  artwork: "row1-1",
16
16
  trackInfo: "row1-2",
@@ -22,13 +22,13 @@ const F = {
22
22
  playButton: "row1-8",
23
23
  playList: "row1-9"
24
24
  }
25
- }, w = $(null);
25
+ }, w = H(null);
26
26
  w.displayName = "AudioPlayerDispatchContext";
27
- const be = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Ne = (e, t) => Math.round(Math.random() * (t - e) + e), dt = 1, Le = (e, t, o) => {
27
+ const be = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Le = (e, t) => Math.round(Math.random() * (t - e) + e), dt = 1, Ne = (e, t, o) => {
28
28
  if (o - t < 1) return e;
29
- let r = Ne(t, o);
29
+ let r = Le(t, o);
30
30
  for (; r === e; )
31
- r = Ne(t, o);
31
+ r = Le(t, o);
32
32
  return r;
33
33
  }, mt = (e, t) => {
34
34
  switch (t.type) {
@@ -50,7 +50,7 @@ const be = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Ne = (e, t) =>
50
50
  audioResetKey: e.audioResetKey + 1,
51
51
  curAudioState: { ...e.curAudioState, currentTime: 0 }
52
52
  };
53
- const r = Le(
53
+ const r = Ne(
54
54
  e.curIdx,
55
55
  0,
56
56
  e.playList.length - 1
@@ -85,7 +85,7 @@ const be = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Ne = (e, t) =>
85
85
  curAudioState: { ...e.curAudioState, currentTime: 0 }
86
86
  };
87
87
  if (e.curAudioState.repeatType === "SHUFFLE") {
88
- const n = Le(
88
+ const n = Ne(
89
89
  e.curIdx,
90
90
  0,
91
91
  e.playList.length - 1
@@ -223,18 +223,18 @@ const be = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Ne = (e, t) =>
223
223
  default:
224
224
  throw new Error("Unhandled action");
225
225
  }
226
- }, he = $(null);
226
+ }, he = H(null);
227
227
  he.displayName = "PlaybackContext";
228
- const Te = $(null);
228
+ const Te = H(null);
229
229
  Te.displayName = "AudioAttrsContext";
230
- const ge = $(null);
230
+ const ge = H(null);
231
231
  ge.displayName = "TrackContext";
232
- const fe = $(null);
232
+ const fe = H(null);
233
233
  fe.displayName = "UIContext";
234
- const Ee = $(null);
235
- Ee.displayName = "ResourceContext";
236
- const Ae = $(null);
237
- Ae.displayName = "TimeContext";
234
+ const Ae = H(null);
235
+ Ae.displayName = "ResourceContext";
236
+ const Ee = H(null);
237
+ Ee.displayName = "TimeContext";
238
238
  function pt(e) {
239
239
  const {
240
240
  playList: t,
@@ -253,7 +253,7 @@ function pt(e) {
253
253
  playListPlacement: (a == null ? void 0 : a.playList) || "bottom",
254
254
  interfacePlacement: (a == null ? void 0 : a.interface) || {
255
255
  templateArea: {
256
- playButton: L.templateArea.playButton
256
+ playButton: k.templateArea.playButton
257
257
  }
258
258
  },
259
259
  volumeSliderPlacement: a == null ? void 0 : a.volumeSlider
@@ -262,7 +262,7 @@ function pt(e) {
262
262
  playList: t,
263
263
  curPlayId: (o == null ? void 0 : o.curPlayId) || 1,
264
264
  curIdx: o != null && o.curPlayId ? t.findIndex(
265
- (p) => p.id === (o == null ? void 0 : o.curPlayId)
265
+ (m) => m.id === (o == null ? void 0 : o.curPlayId)
266
266
  ) : 0,
267
267
  curAudioState: c,
268
268
  activeUI: l,
@@ -278,7 +278,7 @@ const yt = ({
278
278
  colorScheme: t,
279
279
  ...o
280
280
  }) => {
281
- var d, y;
281
+ var d, p;
282
282
  const [r, a] = nt(
283
283
  mt,
284
284
  o,
@@ -335,21 +335,21 @@ const yt = ({
335
335
  r.volumeSliderPlacement,
336
336
  t
337
337
  ]
338
- ), { audioInitialState: u } = o, p = D(() => {
338
+ ), { audioInitialState: u } = o, m = D(() => {
339
339
  if (!u) return {};
340
340
  const {
341
- isPlaying: v,
342
- repeatType: h,
343
- isLoadedMetaData: g,
344
- currentTime: C,
341
+ isPlaying: h,
342
+ repeatType: v,
343
+ isLoadedMetaData: T,
344
+ currentTime: L,
345
345
  duration: N,
346
- volume: W,
347
- muted: H,
346
+ volume: B,
347
+ muted: R,
348
348
  curPlayId: G,
349
349
  ...ae
350
350
  } = u;
351
351
  return ae;
352
- }, [u]), m = D(
352
+ }, [u]), y = D(
353
353
  () => ({
354
354
  elementRefs: r.elementRefs,
355
355
  customIcons: r.customIcons,
@@ -357,12 +357,12 @@ const yt = ({
357
357
  }),
358
358
  [
359
359
  (d = r.elementRefs) == null ? void 0 : d.audioEl,
360
- (y = r.elementRefs) == null ? void 0 : y.waveformInst,
360
+ (p = r.elementRefs) == null ? void 0 : p.waveformInst,
361
361
  r.customIcons,
362
362
  r.coverImgsCss
363
363
  ]
364
364
  );
365
- return /* @__PURE__ */ i(Ae.Provider, { value: s, children: /* @__PURE__ */ i(he.Provider, { value: n, children: /* @__PURE__ */ i(ge.Provider, { value: c, children: /* @__PURE__ */ i(fe.Provider, { value: l, children: /* @__PURE__ */ i(Ee.Provider, { value: m, children: /* @__PURE__ */ i(Te.Provider, { value: p, children: /* @__PURE__ */ i(w.Provider, { value: a, children: e }) }) }) }) }) }) });
365
+ return /* @__PURE__ */ i(Ee.Provider, { value: s, children: /* @__PURE__ */ i(he.Provider, { value: n, children: /* @__PURE__ */ i(ge.Provider, { value: c, children: /* @__PURE__ */ i(fe.Provider, { value: l, children: /* @__PURE__ */ i(Ae.Provider, { value: y, children: /* @__PURE__ */ i(Te.Provider, { value: m, children: /* @__PURE__ */ i(w.Provider, { value: a, children: e }) }) }) }) }) }) });
366
366
  }, f = (e) => {
367
367
  const t = st(e);
368
368
  if (!t) {
@@ -435,26 +435,26 @@ const ht = ({
435
435
  ...l
436
436
  }, u) => {
437
437
  if (!t) return null;
438
- const p = {
438
+ const m = {
439
439
  gridArea: o,
440
440
  width: r,
441
441
  justifySelf: a,
442
442
  padding: s ?? "0 5px",
443
443
  ...c
444
444
  };
445
- return /* @__PURE__ */ i("div", { ref: u, className: n, style: p, ...l, children: e });
445
+ return /* @__PURE__ */ i("div", { ref: u, className: n, style: m, ...l, children: e });
446
446
  }
447
447
  );
448
448
  Me.displayName = "GridItem";
449
449
  const M = Tt;
450
450
  M.Item = Me;
451
- const b = () => f(he), re = () => f(Ae), V = () => f(ge), P = () => f(Ee), xe = ({
451
+ const C = () => f(he), re = () => f(Ee), V = () => f(ge), P = () => f(Ae), xe = ({
452
452
  children: e,
453
453
  id: t,
454
454
  ...o
455
455
  }) => {
456
- var p, m;
457
- const r = b(), a = re(), s = V(), n = O(), c = P(), l = {
456
+ var m, y;
457
+ const r = C(), a = re(), s = V(), n = O(), c = P(), l = {
458
458
  curAudioState: {
459
459
  isPlaying: r.isPlaying,
460
460
  volume: r.volume,
@@ -469,7 +469,7 @@ const b = () => f(he), re = () => f(Ae), V = () => f(ge), P = () => f(Ee), xe =
469
469
  ...s,
470
470
  ...n,
471
471
  ...c
472
- }, u = (m = (p = n.interfacePlacement) == null ? void 0 : p.customComponentsArea) == null ? void 0 : m[t];
472
+ }, u = (y = (m = n.interfacePlacement) == null ? void 0 : m.customComponentsArea) == null ? void 0 : y[t];
473
473
  return /* @__PURE__ */ i(
474
474
  M.Item,
475
475
  {
@@ -485,17 +485,17 @@ const b = () => f(he), re = () => f(Ae), V = () => f(ge), P = () => f(Ee), xe =
485
485
  volume: t,
486
486
  repeatType: o,
487
487
  audioResetKey: r
488
- } = b(), { currentTime: a, seekRequestKey: s } = re(), { elementRefs: n } = P(), c = f(w), l = T(
489
- (y) => {
490
- if (y.currentTarget.readyState === 0) return;
491
- const v = y.currentTarget.currentTime;
488
+ } = C(), { currentTime: a, seekRequestKey: s } = re(), { elementRefs: n } = P(), c = f(w), l = g(
489
+ (p) => {
490
+ if (p.currentTarget.readyState === 0) return;
491
+ const h = p.currentTarget.currentTime;
492
492
  c({
493
493
  type: "SET_AUDIO_STATE",
494
- audioState: { currentTime: v }
494
+ audioState: { currentTime: h }
495
495
  });
496
496
  },
497
497
  [c]
498
- ), u = T(() => {
498
+ ), u = g(() => {
499
499
  if (n != null && n.audioEl) {
500
500
  if (o === "ONE") {
501
501
  ut(() => {
@@ -505,45 +505,45 @@ const b = () => f(he), re = () => f(Ae), V = () => f(ge), P = () => f(Ee), xe =
505
505
  }
506
506
  c({ type: "NEXT_AUDIO" });
507
507
  }
508
- }, [c, o, n == null ? void 0 : n.audioEl]), p = T(
509
- (y) => {
510
- const { duration: v } = y.currentTarget;
511
- t != null && (y.currentTarget.volume = t), c({
508
+ }, [c, o, n == null ? void 0 : n.audioEl]), m = g(
509
+ (p) => {
510
+ const { duration: h } = p.currentTarget;
511
+ t != null && (p.currentTarget.volume = t), c({
512
512
  type: "SET_AUDIO_STATE",
513
- audioState: { isLoadedMetaData: !0, duration: v }
513
+ audioState: { isLoadedMetaData: !0, duration: h }
514
514
  });
515
515
  },
516
516
  [c, t]
517
- ), m = E(!1);
518
- A(() => {
517
+ ), y = A(!1);
518
+ E(() => {
519
519
  if (n != null && n.audioEl) {
520
- if (!m.current) {
521
- m.current = !0;
520
+ if (!y.current) {
521
+ y.current = !0;
522
522
  return;
523
523
  }
524
524
  n.audioEl.currentTime = 0;
525
525
  }
526
- }, [r, n == null ? void 0 : n.audioEl]), A(() => {
526
+ }, [r, n == null ? void 0 : n.audioEl]), E(() => {
527
527
  n != null && n.audioEl && (e ? n.audioEl.play().catch(() => {
528
528
  c({
529
529
  type: "SET_AUDIO_STATE",
530
530
  audioState: { isPlaying: !1 }
531
531
  });
532
532
  }) : n.audioEl.pause());
533
- }, [n == null ? void 0 : n.audioEl, e, c]), A(() => {
533
+ }, [n == null ? void 0 : n.audioEl, e, c]), E(() => {
534
534
  !(n != null && n.audioEl) || t == null || (n.audioEl.volume = t);
535
535
  }, [n == null ? void 0 : n.audioEl, t]);
536
- const d = E(0);
537
- return A(() => {
536
+ const d = A(0);
537
+ return E(() => {
538
538
  if (s === d.current) return;
539
539
  d.current = s;
540
- const y = n == null ? void 0 : n.audioEl;
541
- if (!y || a == null) return;
542
- y.currentTime = a;
543
- const v = n == null ? void 0 : n.waveformInst, h = y.duration, g = Number.isFinite(h) && h > 0;
544
- if (!v || !g) return;
545
- const C = a / h, N = Math.min(1, Math.max(0, C));
546
- v.seekTo(N);
540
+ const p = n == null ? void 0 : n.audioEl;
541
+ if (!p || a == null) return;
542
+ p.currentTime = a;
543
+ const h = n == null ? void 0 : n.waveformInst, v = p.duration, T = Number.isFinite(v) && v > 0;
544
+ if (!h || !T) return;
545
+ const L = a / v, N = Math.min(1, Math.max(0, L));
546
+ h.seekTo(N);
547
547
  }, [
548
548
  s,
549
549
  a,
@@ -552,13 +552,13 @@ const b = () => f(he), re = () => f(Ae), V = () => f(ge), P = () => f(Ee), xe =
552
552
  ]), {
553
553
  onTimeUpdate: l,
554
554
  onEnded: u,
555
- onLoadedMetadata: p
555
+ onLoadedMetadata: m
556
556
  };
557
557
  }, _e = te.memo(({ audioRef: e }) => {
558
- const t = E(null), { muted: o } = b(), { curPlayId: r, playList: a } = V(), s = gt(), n = f(w), c = a.find(
558
+ const t = A(null), { muted: o } = C(), { curPlayId: r, playList: a } = V(), s = gt(), n = f(w), c = a.find(
559
559
  (u) => u.id === r
560
560
  ), l = ft();
561
- return A(() => {
561
+ return E(() => {
562
562
  t.current && (n({
563
563
  type: "SET_ELEMENT_REFS",
564
564
  elementRefs: { audioEl: t.current }
@@ -576,7 +576,7 @@ const b = () => f(he), re = () => f(Ae), V = () => f(ge), P = () => f(Ee), xe =
576
576
  );
577
577
  });
578
578
  _e.displayName = "Audio";
579
- const q = ve(({ className: e, type: t = "button", ...o }, r) => /* @__PURE__ */ i(
579
+ const Y = ve(({ className: e, type: t = "button", ...o }, r) => /* @__PURE__ */ i(
580
580
  "button",
581
581
  {
582
582
  ref: r,
@@ -585,7 +585,7 @@ const q = ve(({ className: e, type: t = "button", ...o }, r) => /* @__PURE__ */
585
585
  ...o
586
586
  }
587
587
  ));
588
- q.displayName = "StyledBtn";
588
+ Y.displayName = "StyledBtn";
589
589
  const Ie = (e) => (
590
590
  // eslint-disable-next-line react/display-name
591
591
  ({ size: t = "1em", color: o, style: r, ...a }) => /* @__PURE__ */ i(
@@ -606,7 +606,7 @@ const Ie = (e) => (
606
606
  dangerouslySetInnerHTML: { __html: e }
607
607
  }
608
608
  )
609
- ), Y = (e) => (
609
+ ), q = (e) => (
610
610
  // eslint-disable-next-line react/display-name
611
611
  ({ size: t = "1em", color: o, style: r, ...a }) => /* @__PURE__ */ i(
612
612
  "svg",
@@ -660,31 +660,31 @@ const Ve = Ie(
660
660
  '<path fill="none" d="M0 0h24v24H0z"/><path d="M3 10h11v2H3zM3 6h11v2H3zM3 14h7v2H3zM16 13v8l6-4z"/>'
661
661
  );
662
662
  Ve.displayName = "MdPlaylistPlay";
663
- const Be = Y(
663
+ const Be = q(
664
664
  '<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"/>'
665
665
  );
666
666
  Be.displayName = "TbRepeat";
667
- const Ke = Y(
667
+ const Ke = q(
668
668
  '<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"/>'
669
669
  );
670
670
  Ke.displayName = "TbRepeatOnce";
671
- const Fe = Y(
671
+ const $e = q(
672
672
  '<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"/>'
673
673
  );
674
- Fe.displayName = "TbRepeatOff";
675
- const $e = Y(
674
+ $e.displayName = "TbRepeatOff";
675
+ const Fe = q(
676
676
  '<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"/>'
677
677
  );
678
- $e.displayName = "TbArrowsShuffle";
679
- const He = Y(
678
+ Fe.displayName = "TbArrowsShuffle";
679
+ const He = q(
680
680
  '<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"/>'
681
681
  );
682
682
  He.displayName = "TbVolume";
683
- const Re = Y(
683
+ const Re = q(
684
684
  '<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"/>'
685
685
  );
686
686
  Re.displayName = "TbVolume2";
687
- const ze = Y(
687
+ const ze = q(
688
688
  '<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"/>'
689
689
  );
690
690
  ze.displayName = "TbVolume3";
@@ -696,10 +696,10 @@ const Ge = De(
696
696
  '<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"/>'
697
697
  );
698
698
  Ge.displayName = "ImNext";
699
- const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(R, { children: t ?? e }), Et = z(function() {
700
- const { isPlaying: t } = b(), { customIcons: o } = P(), r = f(w);
699
+ const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(z, { children: t ?? e }), At = W(function() {
700
+ const { isPlaying: t } = C(), { customIcons: o } = P(), r = f(w);
701
701
  return /* @__PURE__ */ i(
702
- q,
702
+ Y,
703
703
  {
704
704
  type: "button",
705
705
  "aria-label": t ? "Pause" : "Play",
@@ -715,10 +715,10 @@ const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(R, { children: t ?
715
715
  ) : /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(Oe, {}), customIcon: o == null ? void 0 : o.play })
716
716
  }
717
717
  );
718
- }), At = z(function({ isVisible: t }) {
718
+ }), Et = W(function({ isVisible: t }) {
719
719
  const { customIcons: o, elementRefs: r } = P(), a = f(w);
720
720
  return t ? /* @__PURE__ */ i(
721
- q,
721
+ Y,
722
722
  {
723
723
  type: "button",
724
724
  "aria-label": "Previous track",
@@ -732,10 +732,10 @@ const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(R, { children: t ?
732
732
  children: /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(We, {}), customIcon: o == null ? void 0 : o.prev })
733
733
  }
734
734
  ) : null;
735
- }), It = z(function({ isVisible: t }) {
735
+ }), It = W(function({ isVisible: t }) {
736
736
  const { customIcons: o } = P(), r = f(w);
737
737
  return t ? /* @__PURE__ */ i(
738
- q,
738
+ Y,
739
739
  {
740
740
  type: "button",
741
741
  "aria-label": "Next track",
@@ -757,15 +757,15 @@ const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(R, { children: t ?
757
757
  ONE: "NONE",
758
758
  NONE: "SHUFFLE",
759
759
  SHUFFLE: "ALL"
760
- }, Pt = z(function() {
761
- const { repeatType: t } = b(), { customIcons: o } = P(), r = f(w), a = () => {
760
+ }, Pt = W(function() {
761
+ const { repeatType: t } = C(), { customIcons: o } = P(), r = f(w), a = () => {
762
762
  r({
763
763
  type: "SET_REPEAT_TYPE",
764
764
  repeatType: wt[t]
765
765
  });
766
766
  };
767
767
  return /* @__PURE__ */ S(
768
- q,
768
+ Y,
769
769
  {
770
770
  type: "button",
771
771
  "aria-label": St[t],
@@ -776,28 +776,28 @@ const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(R, { children: t ?
776
776
  children: [
777
777
  t === "ALL" && /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(Be, {}), customIcon: o == null ? void 0 : o.repeatAll }),
778
778
  t === "ONE" && /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(Ke, {}), customIcon: o == null ? void 0 : o.repeatOne }),
779
- t === "NONE" && /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i(Fe, {}), customIcon: o == null ? void 0 : o.repeatNone }),
779
+ t === "NONE" && /* @__PURE__ */ i(x, { render: /* @__PURE__ */ i($e, {}), customIcon: o == null ? void 0 : o.repeatNone }),
780
780
  t === "SHUFFLE" && /* @__PURE__ */ i(
781
781
  x,
782
782
  {
783
- render: /* @__PURE__ */ i($e, {}),
783
+ render: /* @__PURE__ */ i(Fe, {}),
784
784
  customIcon: o == null ? void 0 : o.repeatShuffle
785
785
  }
786
786
  )
787
787
  ]
788
788
  }
789
789
  );
790
- }), me = { size: "100%" }, je = z(
790
+ }), me = { size: "100%" }, je = W(
791
791
  ve((e, t) => {
792
- var m;
793
- const { volume: o, muted: r } = b(), { customIcons: a, elementRefs: s } = P(), n = f(
792
+ var y;
793
+ const { volume: o, muted: r } = C(), { customIcons: a, elementRefs: s } = P(), n = f(
794
794
  w
795
- ), c = T(
795
+ ), c = g(
796
796
  () => n({ type: "SET_MUTED", muted: !r }),
797
797
  [n, r]
798
- ), l = o ?? ((m = s == null ? void 0 : s.audioEl) == null ? void 0 : m.volume) ?? 0, u = l > 0 && l <= 0.5, p = l > 0.5;
798
+ ), l = o ?? ((y = s == null ? void 0 : s.audioEl) == null ? void 0 : y.volume) ?? 0, u = l > 0 && l <= 0.5, m = l > 0.5;
799
799
  return /* @__PURE__ */ i(
800
- q,
800
+ Y,
801
801
  {
802
802
  type: "button",
803
803
  "aria-label": r ? "Unmute" : "Mute",
@@ -819,7 +819,7 @@ const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(R, { children: t ?
819
819
  render: /* @__PURE__ */ i(Re, { ...me }),
820
820
  customIcon: a == null ? void 0 : a.volumeHalf
821
821
  }
822
- ) : p ? /* @__PURE__ */ i(
822
+ ) : m ? /* @__PURE__ */ i(
823
823
  x,
824
824
  {
825
825
  render: /* @__PURE__ */ i(He, { ...me }),
@@ -831,10 +831,10 @@ const x = ({ render: e, customIcon: t }) => /* @__PURE__ */ i(R, { children: t ?
831
831
  })
832
832
  );
833
833
  je.displayName = "VolumeTriggerBtn";
834
- const le = $(null);
834
+ const le = H(null);
835
835
  le.displayName = "DrawerContext";
836
- const qe = (e, t) => {
837
- A(() => {
836
+ const Ye = (e, t) => {
837
+ E(() => {
838
838
  const o = (r) => {
839
839
  const a = e.current, { target: s } = r;
840
840
  !r || !a || a.contains(s) || t(r);
@@ -848,22 +848,22 @@ const qe = (e, t) => {
848
848
  isOpen: r,
849
849
  onOpenChange: a
850
850
  }) => {
851
- const s = E(null), [n, c] = te.Children.toArray(o), [l, u] = k(!1), p = ke();
852
- qe(s, () => {
851
+ const s = A(null), [n, c] = te.Children.toArray(o), [l, u] = b(!1), m = ke();
852
+ Ye(s, () => {
853
853
  e && (u(!1), a && a(!1));
854
- }), A(() => {
854
+ }), E(() => {
855
855
  r !== void 0 && u(r);
856
856
  }, [r]);
857
- const m = D(
858
- () => ({ isOpen: l, setIsOpen: u, onOpenChange: a, drawerId: p }),
859
- [l, u, a, p]
857
+ const y = D(
858
+ () => ({ isOpen: l, setIsOpen: u, onOpenChange: a, drawerId: m }),
859
+ [l, u, a, m]
860
860
  );
861
- return /* @__PURE__ */ i("div", { className: "rmap-drawer-container", ref: s, children: /* @__PURE__ */ i(le.Provider, { value: m, children: /* @__PURE__ */ S(R, { children: [
861
+ return /* @__PURE__ */ i("div", { className: "rmap-drawer-container", ref: s, children: /* @__PURE__ */ i(le.Provider, { value: y, children: /* @__PURE__ */ S(z, { children: [
862
862
  t === "top" && c,
863
863
  n,
864
864
  t === "bottom" && c
865
865
  ] }) }) });
866
- }, Ye = typeof window < "u", pe = Ye ? it : A, Se = ({
866
+ }, qe = typeof window < "u", pe = qe ? it : E, Se = ({
867
867
  visible: e,
868
868
  name: t,
869
869
  leaveTime: o,
@@ -873,65 +873,65 @@ const qe = (e, t) => {
873
873
  onEntered: n,
874
874
  children: c
875
875
  }) => {
876
- const [l, u] = k(""), [p, m] = k(!1), d = E(n), y = E(s), v = E(t), h = E(r), g = E(o), C = E(a);
876
+ const [l, u] = b(""), [m, y] = b(!1), d = A(n), p = A(s), h = A(t), v = A(r), T = A(o), L = A(a);
877
877
  return pe(() => {
878
- d.current = n, y.current = s, v.current = t, h.current = r, g.current = o, C.current = a;
878
+ d.current = n, p.current = s, h.current = t, v.current = r, T.current = o, L.current = a;
879
879
  }), pe(() => {
880
- const N = e ? "enter" : "leave", W = v.current, H = e ? h.current : g.current;
881
- e && !p && m(!0), u(`${W}-${N}`);
880
+ const N = e ? "enter" : "leave", B = h.current, R = e ? v.current : T.current;
881
+ e && !m && y(!0), u(`${B}-${N}`);
882
882
  const G = setTimeout(() => {
883
883
  var X, oe;
884
884
  u(
885
- `${W}-${N} ${W}-${N}-active`
886
- ), N === "leave" ? (X = y.current) == null || X.call(y) : (oe = d.current) == null || oe.call(d);
887
- }, H), ae = setTimeout(() => {
888
- e || (u(W), m(!1));
889
- }, H + C.current);
885
+ `${B}-${N} ${B}-${N}-active`
886
+ ), N === "leave" ? (X = p.current) == null || X.call(p) : (oe = d.current) == null || oe.call(d);
887
+ }, R), ae = setTimeout(() => {
888
+ e || (u(B), y(!1));
889
+ }, R + L.current);
890
890
  return () => {
891
891
  clearTimeout(G), clearTimeout(ae);
892
892
  };
893
- }, [e, p]), p ? lt(c, {
893
+ }, [e, m]), m ? lt(c, {
894
894
  className: `${c.props.className} ${l}`
895
895
  }) : null;
896
- }, Nt = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [role="button"]:not([aria-disabled="true"])', Lt = ({
896
+ }, Lt = '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 = ({
897
897
  children: e,
898
898
  isWithAnimation: t = !0,
899
899
  "aria-label": o = "Dialog"
900
900
  }) => {
901
- const { isOpen: r, setIsOpen: a, onOpenChange: s, drawerId: n } = f(le), c = E(null), l = E(null), u = T(
901
+ const { isOpen: r, setIsOpen: a, onOpenChange: s, drawerId: n } = f(le), c = A(null), l = A(null), u = g(
902
902
  () => {
903
- var h;
904
- return (h = c.current) == null ? void 0 : h.querySelectorAll(Nt);
903
+ var v;
904
+ return (v = c.current) == null ? void 0 : v.querySelectorAll(Lt);
905
905
  },
906
906
  []
907
- ), p = T(() => {
908
- var h, g;
909
- (g = (h = u()) == null ? void 0 : h[0]) == null || g.focus();
910
- }, [u]), m = T(() => {
911
- l.current = document.activeElement, p();
912
- }, [p]), d = T(() => {
913
- var h;
914
- (h = l.current) == null || h.focus();
907
+ ), m = g(() => {
908
+ var v, T;
909
+ (T = (v = u()) == null ? void 0 : v[0]) == null || T.focus();
910
+ }, [u]), y = g(() => {
911
+ l.current = document.activeElement, m();
912
+ }, [m]), d = g(() => {
913
+ var v;
914
+ (v = l.current) == null || v.focus();
915
915
  }, []);
916
- A(() => {
917
- var h;
918
- r && !t ? (l.current = document.activeElement, p()) : !r && !t && ((h = l.current) == null || h.focus());
919
- }, [r, t, p]);
920
- const y = T(
921
- (h) => {
922
- if (h.key === "Escape") {
916
+ E(() => {
917
+ var v;
918
+ r && !t ? (l.current = document.activeElement, m()) : !r && !t && ((v = l.current) == null || v.focus());
919
+ }, [r, t, m]);
920
+ const p = g(
921
+ (v) => {
922
+ if (v.key === "Escape") {
923
923
  a(!1), s && s(!1);
924
924
  return;
925
925
  }
926
- if (h.key === "Tab") {
927
- const g = u();
928
- if (!g || g.length === 0) return;
929
- const C = g[0], N = g[g.length - 1];
930
- h.shiftKey ? document.activeElement === C && (h.preventDefault(), N.focus()) : document.activeElement === N && (h.preventDefault(), C.focus());
926
+ if (v.key === "Tab") {
927
+ const T = u();
928
+ if (!T || T.length === 0) return;
929
+ const L = T[0], N = T[T.length - 1];
930
+ v.shiftKey ? document.activeElement === L && (v.preventDefault(), N.focus()) : document.activeElement === N && (v.preventDefault(), L.focus());
931
931
  }
932
932
  },
933
933
  [a, s, u]
934
- ), v = /* @__PURE__ */ i(
934
+ ), h = /* @__PURE__ */ i(
935
935
  "div",
936
936
  {
937
937
  ref: c,
@@ -940,7 +940,7 @@ const qe = (e, t) => {
940
940
  "aria-modal": "true",
941
941
  "aria-label": o,
942
942
  id: n,
943
- onKeyDown: y,
943
+ onKeyDown: p,
944
944
  children: e
945
945
  }
946
946
  );
@@ -952,22 +952,22 @@ const qe = (e, t) => {
952
952
  enterTime: 20,
953
953
  leaveTime: 60,
954
954
  clearTime: 300,
955
- onEntered: m,
955
+ onEntered: y,
956
956
  onExited: d,
957
- children: v
957
+ children: h
958
958
  }
959
- ) : r ? v : null;
959
+ ) : r ? h : null;
960
960
  }, kt = ({
961
961
  children: e,
962
962
  "aria-label": t,
963
963
  "data-testid": o
964
964
  }) => {
965
- const { isOpen: r, setIsOpen: a, onOpenChange: s, drawerId: n } = f(le), c = T(() => {
965
+ const { isOpen: r, setIsOpen: a, onOpenChange: s, drawerId: n } = f(le), c = g(() => {
966
966
  const l = !r;
967
967
  a(l), s == null || s(l);
968
968
  }, [r, a, s]);
969
969
  return /* @__PURE__ */ i(
970
- q,
970
+ Y,
971
971
  {
972
972
  className: "rmap-drawer-trigger",
973
973
  type: "button",
@@ -980,7 +980,7 @@ const qe = (e, t) => {
980
980
  }
981
981
  );
982
982
  };
983
- se.Content = Lt;
983
+ se.Content = Nt;
984
984
  se.Trigger = kt;
985
985
  const ye = ({ children: e }) => /* @__PURE__ */ i("ul", { className: "rmap-sortable-list-container", "aria-label": "Sortable list", children: e }), bt = ({
986
986
  index: e,
@@ -1010,18 +1010,18 @@ const ye = ({ children: e }) => /* @__PURE__ */ i("ul", { className: "rmap-sorta
1010
1010
  },
1011
1011
  onDrop: (l) => {
1012
1012
  l.stopPropagation(), l.currentTarget.classList.remove("rmap-drag-over");
1013
- const u = [...o], p = o[t];
1013
+ const u = [...o], m = o[t];
1014
1014
  u.splice(t, 1);
1015
- const m = (t < e ? [
1015
+ const y = (t < e ? [
1016
1016
  ...u.slice(0, e),
1017
- p,
1017
+ m,
1018
1018
  ...u.slice(e, u.length)
1019
1019
  ] : [
1020
1020
  ...u.slice(0, e),
1021
- p,
1021
+ m,
1022
1022
  ...u.slice(e, u.length)
1023
- ]).map((d, y) => ({ ...d, index: y }));
1024
- n == null || n(l, m);
1023
+ ]).map((d, p) => ({ ...d, index: p }));
1024
+ n == null || n(l, y);
1025
1025
  },
1026
1026
  onClick: (l) => {
1027
1027
  l.stopPropagation(), c == null || c(l);
@@ -1031,7 +1031,7 @@ const ye = ({ children: e }) => /* @__PURE__ */ i("ul", { className: "rmap-sorta
1031
1031
  return /* @__PURE__ */ i("li", { className: "rmap-sortable-item", ...r, children: /* @__PURE__ */ i("div", { className: "rmap-sortable-item-inner", children: t }) });
1032
1032
  };
1033
1033
  ye.Item = Ct;
1034
- const Mt = z(function({
1034
+ const Mt = W(function({
1035
1035
  data: t
1036
1036
  }) {
1037
1037
  const { curPlayId: o } = V(), { coverImgsCss: r } = P(), a = o === t.id;
@@ -1061,7 +1061,7 @@ const Mt = z(function({
1061
1061
  }), xt = ({
1062
1062
  setIsOpen: e
1063
1063
  }) => {
1064
- const { playList: t } = V(), { activeUI: o } = O(), r = f(w), [a, s] = k(0), n = T(
1064
+ const { playList: t } = V(), { activeUI: o } = O(), r = f(w), [a, s] = b(0), n = g(
1065
1065
  (c) => {
1066
1066
  r({
1067
1067
  type: "SET_CURRENT_AUDIO",
@@ -1120,7 +1120,7 @@ const Mt = z(function({
1120
1120
  }
1121
1121
  ),
1122
1122
  document.querySelector(".rmap-sortable-playlist") ?? document.body
1123
- ) : /* @__PURE__ */ i(R, {});
1123
+ ) : /* @__PURE__ */ i(z, {});
1124
1124
  }, Dt = () => {
1125
1125
  const { customIcons: e } = P();
1126
1126
  return /* @__PURE__ */ i(
@@ -1141,15 +1141,15 @@ const Mt = z(function({
1141
1141
  const r = e / t;
1142
1142
  return isFinite(r) ? r : o;
1143
1143
  }, Xe = () => {
1144
- const { isLoadedMetaData: e } = b(), { elementRefs: t } = P(), [o, r] = k(!1), a = T(
1144
+ const { isLoadedMetaData: e } = C(), { elementRefs: t } = P(), [o, r] = b(!1), a = g(
1145
1145
  (s) => {
1146
1146
  if (!(t != null && t.audioEl) || !e) return;
1147
- const { clientX: n } = s, { clientWidth: c } = s.currentTarget, l = s.currentTarget.getBoundingClientRect(), u = n - l.x, p = ce(u, c) * t.audioEl.duration;
1148
- t.audioEl.currentTime = p;
1147
+ const { clientX: n } = s, { clientWidth: c } = s.currentTarget, l = s.currentTarget.getBoundingClientRect(), u = n - l.x, m = ce(u, c) * t.audioEl.duration;
1148
+ t.audioEl.currentTime = m;
1149
1149
  },
1150
1150
  [e, t == null ? void 0 : t.audioEl]
1151
1151
  );
1152
- return A(() => {
1152
+ return E(() => {
1153
1153
  if (!o) return;
1154
1154
  const s = (n) => n.preventDefault();
1155
1155
  return document.addEventListener("selectstart", s), () => {
@@ -1163,8 +1163,8 @@ const Mt = z(function({
1163
1163
  onClick: a
1164
1164
  };
1165
1165
  }, Qe = (e) => {
1166
- const { isLoadedMetaData: t } = b(), { elementRefs: o } = P();
1167
- return T(
1166
+ const { isLoadedMetaData: t } = C(), { elementRefs: o } = P();
1167
+ return g(
1168
1168
  (r) => {
1169
1169
  if (!(o != null && o.audioEl) || !t) return;
1170
1170
  const a = o.audioEl;
@@ -1190,15 +1190,15 @@ const Mt = z(function({
1190
1190
  [o == null ? void 0 : o.audioEl, t, e]
1191
1191
  );
1192
1192
  }, Ut = () => {
1193
- const { currentTime: e, duration: t } = re(), o = E(null), [r, a] = k(0);
1194
- A(() => {
1193
+ const { currentTime: e, duration: t } = re(), o = A(null), [r, a] = b(0);
1194
+ E(() => {
1195
1195
  const u = o.current;
1196
1196
  if (!u) return;
1197
1197
  a(u.offsetWidth);
1198
- const p = new ResizeObserver(([m]) => {
1199
- a(m.contentBoxSize[0].inlineSize);
1198
+ const m = new ResizeObserver(([y]) => {
1199
+ a(y.contentBoxSize[0].inlineSize);
1200
1200
  });
1201
- return p.observe(u), () => p.disconnect();
1201
+ return m.observe(u), () => m.disconnect();
1202
1202
  }, []);
1203
1203
  const s = ce(e, t), n = Xe(), c = Qe(), l = s * r;
1204
1204
  return /* @__PURE__ */ S(
@@ -1239,7 +1239,7 @@ const Mt = z(function({
1239
1239
  }
1240
1240
  );
1241
1241
  }, Vt = (e, t) => {
1242
- const o = E(), r = T(() => {
1242
+ const o = A(), r = g(() => {
1243
1243
  const a = document.getElementsByClassName("rmap-player-provider")[0];
1244
1244
  if (!a) return;
1245
1245
  const s = Object.entries(
@@ -1262,21 +1262,26 @@ const Mt = z(function({
1262
1262
  progressColor: "--rm-audio-player-waveform-bar",
1263
1263
  waveColor: "--rm-audio-player-waveform-background"
1264
1264
  }, Kt = (e) => {
1265
- const t = f(w), { isPlaying: o } = b(), { curPlayId: r } = V(), { elementRefs: a } = P(), { colorScheme: s } = O(), n = Vt(Bt, s), c = E(a == null ? void 0 : a.waveformInst);
1266
- c.current = a == null ? void 0 : a.waveformInst, A(() => {
1267
- var d, y;
1268
- if (a != null && a.waveformInst || !((d = n.current) != null && d.progressColor) || !((y = n.current) != null && y.waveColor))
1265
+ const t = e.backend;
1266
+ if (!(!(t != null && t.media) || !t.mediaListeners))
1267
+ for (const [o, r] of Object.entries(t.mediaListeners))
1268
+ t.media.removeEventListener(o, r);
1269
+ }, $t = (e) => {
1270
+ const t = f(w), { isPlaying: o } = C(), { curPlayId: r } = V(), { elementRefs: a } = P(), { colorScheme: s } = O(), n = Vt(Bt, s), c = A(a == null ? void 0 : a.waveformInst);
1271
+ c.current = a == null ? void 0 : a.waveformInst, E(() => {
1272
+ var p, h;
1273
+ if (a != null && a.waveformInst || !((p = n.current) != null && p.progressColor) || !((h = n.current) != null && h.waveColor))
1269
1274
  return;
1270
- let m = !1;
1275
+ let d = !1;
1271
1276
  return import("./wavesurfer-_j5aw4gZ.mjs").then((v) => v.w).then(({ default: v }) => {
1272
- var g, C;
1273
- if (m || !e.current || !((g = n.current) != null && g.progressColor) || !((C = n.current) != null && C.waveColor)) {
1277
+ var L, N;
1278
+ if (d || !e.current || !((L = n.current) != null && L.progressColor) || !((N = n.current) != null && N.waveColor)) {
1274
1279
  console.error("[useWaveSurfer] missing required dependencies");
1275
1280
  return;
1276
1281
  }
1277
- let h;
1282
+ let T;
1278
1283
  try {
1279
- h = v.create({
1284
+ T = v.create({
1280
1285
  barWidth: 1,
1281
1286
  cursorWidth: 2,
1282
1287
  container: e.current,
@@ -1288,50 +1293,50 @@ const Mt = z(function({
1288
1293
  backend: "MediaElement",
1289
1294
  removeMediaElementOnDestroy: !1
1290
1295
  });
1291
- } catch (N) {
1296
+ } catch (B) {
1292
1297
  console.error(
1293
1298
  "[useWaveSurfer] failed to create WaveSurfer instance",
1294
- N
1299
+ B
1295
1300
  );
1296
1301
  return;
1297
1302
  }
1298
1303
  t({
1299
1304
  type: "SET_ELEMENT_REFS",
1300
- elementRefs: { waveformInst: h }
1305
+ elementRefs: { waveformInst: T }
1301
1306
  });
1302
1307
  }).catch((v) => {
1303
1308
  console.error("[useWaveSurfer] failed to load wavesurfer.js", v);
1304
1309
  }), () => {
1305
- m = !0;
1310
+ d = !0;
1306
1311
  };
1307
1312
  }, [a == null ? void 0 : a.waveformInst, t, n]);
1308
- const l = E(r);
1309
- A(() => {
1313
+ const l = A(r);
1314
+ E(() => {
1310
1315
  if (!(a != null && a.audioEl) || !(a != null && a.waveformInst)) return;
1311
- const m = a.audioEl, d = a.waveformInst, y = l.current !== r;
1316
+ const d = a.audioEl, p = a.waveformInst, h = l.current !== r;
1312
1317
  l.current = r;
1313
- const v = y ? 0 : m.currentTime, h = o;
1314
- d.load(m);
1315
- const g = () => {
1316
- !y && v > 0 && m.duration && (m.currentTime = v, d.seekTo(v / m.duration)), h && m.play();
1318
+ const v = h ? 0 : d.currentTime, T = o;
1319
+ Kt(p), p.load(d);
1320
+ const L = () => {
1321
+ !h && v > 0 && d.duration && (d.currentTime = v, p.seekTo(v / d.duration)), T && d.play();
1317
1322
  };
1318
- return d.on("ready", g), () => {
1319
- d.un("ready", g);
1323
+ return p.on("ready", L), () => {
1324
+ p.un("ready", L);
1320
1325
  };
1321
- }, [r, a == null ? void 0 : a.audioEl, a == null ? void 0 : a.waveformInst]), A(() => {
1326
+ }, [r, a == null ? void 0 : a.audioEl, a == null ? void 0 : a.waveformInst]), E(() => {
1322
1327
  if (!e.current || !(a != null && a.waveformInst)) return;
1323
- const m = () => {
1324
- var y, v;
1325
- (v = (y = a.waveformInst) == null ? void 0 : y.drawer) == null || v.fireEvent("redraw");
1326
- }, d = new ResizeObserver(m);
1327
- return d.observe(e.current), () => {
1328
- d.disconnect();
1328
+ const d = () => {
1329
+ var h, v;
1330
+ (v = (h = a.waveformInst) == null ? void 0 : h.drawer) == null || v.fireEvent("redraw");
1331
+ }, p = new ResizeObserver(d);
1332
+ return p.observe(e.current), () => {
1333
+ p.disconnect();
1329
1334
  };
1330
- }, [a == null ? void 0 : a.waveformInst, e]), A(
1335
+ }, [a == null ? void 0 : a.waveformInst, e]), E(
1331
1336
  () => () => {
1332
- var d, y;
1333
- const m = (d = e.current) == null ? void 0 : d.querySelector("wave");
1334
- m && m.remove(), (y = c.current) == null || y.destroy(), t({
1337
+ var p, h;
1338
+ const d = (p = e.current) == null ? void 0 : p.querySelector("wave");
1339
+ d && d.remove(), (h = c.current) == null || h.destroy(), t({
1335
1340
  type: "SET_ELEMENT_REFS",
1336
1341
  elementRefs: { waveformInst: void 0 }
1337
1342
  });
@@ -1339,30 +1344,25 @@ const Mt = z(function({
1339
1344
  // eslint-disable-next-line react-hooks/exhaustive-deps
1340
1345
  [t]
1341
1346
  );
1342
- const u = E(void 0);
1343
- u.current = () => {
1344
- var d, y;
1345
- const m = (d = e.current) == null ? void 0 : d.querySelector("wave");
1346
- m && m.remove(), (y = a == null ? void 0 : a.waveformInst) == null || y.destroy(), t({
1347
- type: "SET_ELEMENT_REFS",
1348
- elementRefs: { waveformInst: void 0 }
1349
- });
1350
- }, A(() => {
1351
- const m = () => {
1352
- var y;
1353
- return (y = u.current) == null ? void 0 : y.call(u);
1354
- }, d = window.matchMedia("(prefers-color-scheme: dark)");
1355
- return d.addEventListener("change", m), () => d.removeEventListener("change", m);
1347
+ const u = () => {
1348
+ var v, T;
1349
+ const d = c.current;
1350
+ if (!(d != null && d.isReady)) return;
1351
+ const p = (v = n.current) == null ? void 0 : v.waveColor, h = (T = n.current) == null ? void 0 : T.progressColor;
1352
+ p && d.setWaveColor(p), h && d.setProgressColor(h);
1353
+ }, m = A(u);
1354
+ m.current = u;
1355
+ const y = A(s);
1356
+ E(() => {
1357
+ y.current !== s && (y.current = s, m.current());
1358
+ }, [s, a == null ? void 0 : a.waveformInst]), E(() => {
1359
+ const d = () => m.current(), p = window.matchMedia("(prefers-color-scheme: dark)");
1360
+ return p.addEventListener("change", d), () => p.removeEventListener("change", d);
1356
1361
  }, []);
1357
- const p = E(s);
1358
- A(() => {
1359
- var m;
1360
- p.current !== s && (p.current = s, (m = u.current) == null || m.call(u));
1361
- }, [s]);
1362
1362
  }, Ft = ({ isActive: e }) => {
1363
- var l, u, p, m;
1364
- const t = E(null), { isLoadedMetaData: o, isPlaying: r } = b(), { elementRefs: a } = P();
1365
- Kt(t), A(() => {
1363
+ var l, u, m, y;
1364
+ const t = A(null), { isLoadedMetaData: o, isPlaying: r } = C(), { elementRefs: a } = P();
1365
+ $t(t), E(() => {
1366
1366
  if (!e || !(a != null && a.waveformInst) || !(a != null && a.audioEl) || !o || r)
1367
1367
  return;
1368
1368
  const d = ce(
@@ -1377,10 +1377,10 @@ const Mt = z(function({
1377
1377
  a == null ? void 0 : a.audioEl,
1378
1378
  r
1379
1379
  ]);
1380
- const s = Xe(), n = T(
1381
- (d, y) => {
1382
- var v;
1383
- y && ((v = a == null ? void 0 : a.waveformInst) == null || v.seekTo(ce(d, y)));
1380
+ const s = Xe(), n = g(
1381
+ (d, p) => {
1382
+ var h;
1383
+ p && ((h = a == null ? void 0 : a.waveformInst) == null || h.seekTo(ce(d, p)));
1384
1384
  },
1385
1385
  [a == null ? void 0 : a.waveformInst]
1386
1386
  ), c = Qe(n);
@@ -1398,35 +1398,35 @@ const Mt = z(function({
1398
1398
  (((l = a == null ? void 0 : a.audioEl) == null ? void 0 : l.currentTime) ?? 0) / (((u = a == null ? void 0 : a.audioEl) == null ? void 0 : u.duration) || 1) * 100
1399
1399
  ),
1400
1400
  "aria-valuetext": `${ee(
1401
- ((p = a == null ? void 0 : a.audioEl) == null ? void 0 : p.currentTime) ?? 0
1402
- )} of ${ee(((m = a == null ? void 0 : a.audioEl) == null ? void 0 : m.duration) ?? 0)}`,
1401
+ ((m = a == null ? void 0 : a.audioEl) == null ? void 0 : m.currentTime) ?? 0
1402
+ )} of ${ee(((y = a == null ? void 0 : a.audioEl) == null ? void 0 : y.duration) ?? 0)}`,
1403
1403
  onKeyDown: c,
1404
1404
  ...s
1405
1405
  }
1406
1406
  ) });
1407
- }, $t = () => {
1408
- const { activeUI: e } = O(), t = e.progress ?? (e.all ? "bar" : !1), o = t === "waveform", r = t === "bar", [a, s] = k(o);
1409
- return A(() => {
1407
+ }, Ht = () => {
1408
+ const { activeUI: e } = O(), t = e.progress ?? (e.all ? "bar" : !1), o = t === "waveform", r = t === "bar", [a, s] = b(o);
1409
+ return E(() => {
1410
1410
  o && !a && s(!0);
1411
1411
  }, [o, a]), /* @__PURE__ */ S("div", { className: "rmap-progress-container", children: [
1412
1412
  a && /* @__PURE__ */ i(Ft, { isActive: o }),
1413
1413
  r && /* @__PURE__ */ i(Ut, {})
1414
1414
  ] });
1415
- }, Ht = ({
1415
+ }, Rt = ({
1416
1416
  placement: e
1417
1417
  }) => {
1418
- var m;
1419
- const t = E(null), { volume: o, muted: r } = b(), { elementRefs: a } = P(), s = f(w), n = T(
1418
+ var y;
1419
+ const t = A(null), { volume: o, muted: r } = C(), { elementRefs: a } = P(), s = f(w), n = g(
1420
1420
  (d) => {
1421
1421
  d.stopPropagation(), d.preventDefault(), r && s({ type: "SET_MUTED", muted: !1 });
1422
- const { value: y } = d.target, v = parseFloat(y);
1422
+ const { value: p } = d.target, h = parseFloat(p);
1423
1423
  s({
1424
1424
  type: "SET_VOLUME",
1425
- volume: v
1425
+ volume: h
1426
1426
  });
1427
1427
  },
1428
1428
  [r, s]
1429
- ), c = o ?? ((m = a == null ? void 0 : a.audioEl) == null ? void 0 : m.volume) ?? 0, l = c * 100, u = Math.round(l), p = D(
1429
+ ), c = o ?? ((y = a == null ? void 0 : a.audioEl) == null ? void 0 : y.volume) ?? 0, l = c * 100, u = Math.round(l), m = D(
1430
1430
  () => ({
1431
1431
  "--rm-audio-player-volume-value": `${l}%`
1432
1432
  }),
@@ -1439,7 +1439,7 @@ const Mt = z(function({
1439
1439
  className: "rmap-volume-container",
1440
1440
  "data-placement": e,
1441
1441
  "data-testid": "volume-slider",
1442
- style: p,
1442
+ style: m,
1443
1443
  children: /* @__PURE__ */ i("div", { className: "rmap-volume-panel", children: /* @__PURE__ */ i(
1444
1444
  "input",
1445
1445
  {
@@ -1457,7 +1457,7 @@ const Mt = z(function({
1457
1457
  ) })
1458
1458
  }
1459
1459
  );
1460
- }, ue = $(null);
1460
+ }, ue = H(null);
1461
1461
  ue.displayName = "DropdownContext";
1462
1462
  const Je = ({
1463
1463
  clickArea: e,
@@ -1466,23 +1466,23 @@ const Je = ({
1466
1466
  setIsOpen: r,
1467
1467
  onOpenChange: a
1468
1468
  }) => {
1469
- const s = E(), n = (p) => {
1470
- const m = () => {
1469
+ const s = A(), n = (m) => {
1470
+ const y = () => {
1471
1471
  clearTimeout(s.current), s.current = void 0;
1472
- }, d = (y) => {
1473
- r(y), a && a(y), m();
1472
+ }, d = (p) => {
1473
+ r(p), a && a(p), y();
1474
1474
  };
1475
- if (m(), p) {
1475
+ if (y(), m) {
1476
1476
  s.current = window.setTimeout(() => d(!0), 100);
1477
1477
  return;
1478
1478
  }
1479
1479
  s.current = window.setTimeout(() => d(!1), 100);
1480
- }, c = (p) => {
1481
- t === "hover" && n(p);
1480
+ }, c = (m) => {
1481
+ t === "hover" && n(m);
1482
1482
  };
1483
1483
  return {
1484
- onClick: e === "content" ? (p) => {
1485
- p.stopPropagation(), p.nativeEvent.stopImmediatePropagation();
1484
+ onClick: e === "content" ? (m) => {
1485
+ m.stopPropagation(), m.nativeEvent.stopImmediatePropagation();
1486
1486
  } : () => {
1487
1487
  t === "click" && (r(!o), a && a(!o));
1488
1488
  },
@@ -1502,40 +1502,40 @@ const Je = ({
1502
1502
  onOpenChange: n,
1503
1503
  "data-testid": c
1504
1504
  }) => {
1505
- const l = E(null), [u, p] = te.Children.toArray(o), [m, d] = k(!1), y = Je({
1505
+ const l = A(null), [u, m] = te.Children.toArray(o), [y, d] = b(!1), p = Je({
1506
1506
  setIsOpen: d,
1507
- isOpen: m,
1507
+ isOpen: y,
1508
1508
  triggerType: e,
1509
1509
  clickArea: "root"
1510
- }), v = ke();
1511
- qe(l, () => t && d(!1)), A(() => {
1510
+ }), h = ke();
1511
+ Ye(l, () => t && d(!1)), E(() => {
1512
1512
  r !== void 0 && d(r);
1513
1513
  }, [r]);
1514
- const h = D(
1514
+ const v = D(
1515
1515
  () => ({
1516
1516
  dropdownRef: l,
1517
1517
  placement: a,
1518
- isOpen: m,
1518
+ isOpen: y,
1519
1519
  setIsOpen: d,
1520
1520
  onOpenChange: n,
1521
- dropdownId: v
1521
+ dropdownId: h
1522
1522
  }),
1523
- [a, m, n, v]
1523
+ [a, y, n, h]
1524
1524
  );
1525
- return /* @__PURE__ */ i(ue.Provider, { value: h, children: /* @__PURE__ */ i(
1525
+ return /* @__PURE__ */ i(ue.Provider, { value: v, children: /* @__PURE__ */ i(
1526
1526
  "div",
1527
1527
  {
1528
1528
  className: "rmap-dropdown-container",
1529
1529
  ref: l,
1530
1530
  "data-testid": c,
1531
- ...y,
1532
- children: /* @__PURE__ */ S(R, { children: [
1531
+ ...p,
1532
+ children: /* @__PURE__ */ S(z, { children: [
1533
1533
  u,
1534
- !s && p
1534
+ !s && m
1535
1535
  ] })
1536
1536
  }
1537
1537
  ) });
1538
- }, Rt = (e, t) => D(() => {
1538
+ }, zt = (e, t) => D(() => {
1539
1539
  if (t)
1540
1540
  return {
1541
1541
  position: "absolute",
@@ -1546,29 +1546,29 @@ const Je = ({
1546
1546
  left: e === "right" ? `${t.width}px` : void 0,
1547
1547
  right: e === "left" ? `${t.width}px` : void 0
1548
1548
  };
1549
- }, [t, e]), zt = ({
1549
+ }, [t, e]), Wt = ({
1550
1550
  children: e,
1551
1551
  isWithAnimation: t = !0,
1552
1552
  ...o
1553
1553
  }) => {
1554
- const { dropdownRef: r, placement: a, isOpen: s, setIsOpen: n, dropdownId: c } = f(ue), [l, u] = k(), { onClick: p } = Je({
1554
+ const { dropdownRef: r, placement: a, isOpen: s, setIsOpen: n, dropdownId: c } = f(ue), [l, u] = b(), { onClick: m } = Je({
1555
1555
  setIsOpen: n,
1556
1556
  isOpen: s,
1557
1557
  clickArea: "content"
1558
- }), m = () => n(!1), d = () => n(!0);
1559
- A(() => {
1558
+ }), y = () => n(!1), d = () => n(!0);
1559
+ E(() => {
1560
1560
  r.current && u({
1561
1561
  width: r.current.offsetWidth,
1562
1562
  height: r.current.offsetHeight
1563
1563
  });
1564
1564
  }, [r]);
1565
- const y = Rt(a, l), v = l ? /* @__PURE__ */ i(
1565
+ const p = zt(a, l), h = l ? /* @__PURE__ */ i(
1566
1566
  "div",
1567
1567
  {
1568
1568
  ...o,
1569
1569
  id: c,
1570
- style: { ...y, ...o.style },
1571
- onClick: p,
1570
+ style: { ...p, ...o.style },
1571
+ onClick: m,
1572
1572
  children: e
1573
1573
  }
1574
1574
  ) : null;
@@ -1580,12 +1580,12 @@ const Je = ({
1580
1580
  enterTime: 20,
1581
1581
  leaveTime: 60,
1582
1582
  clearTime: 300,
1583
- onExited: m,
1583
+ onExited: y,
1584
1584
  onEntered: d,
1585
- children: v
1585
+ children: h
1586
1586
  }
1587
- ) : s ? v : null;
1588
- }, Wt = ({ children: e }) => {
1587
+ ) : s ? h : null;
1588
+ }, Gt = ({ children: e }) => {
1589
1589
  const { isOpen: t, setIsOpen: o, dropdownId: r } = f(ue);
1590
1590
  return /* @__PURE__ */ i(
1591
1591
  "div",
@@ -1602,14 +1602,14 @@ const Je = ({
1602
1602
  }
1603
1603
  );
1604
1604
  };
1605
- ie.Content = zt;
1606
- ie.Trigger = Wt;
1607
- const Gt = ({
1605
+ ie.Content = Wt;
1606
+ ie.Trigger = Gt;
1607
+ const jt = ({
1608
1608
  triggerRef: e,
1609
1609
  initialState: t
1610
1610
  }) => {
1611
- const { playerPlacement: o } = O(), [r, a] = k(t);
1612
- return A(() => {
1611
+ const { playerPlacement: o } = O(), [r, a] = b(t);
1612
+ return E(() => {
1613
1613
  if (e.current) {
1614
1614
  const s = () => e.current.getBoundingClientRect().top < window.innerHeight / 2 ? "bottom" : "top", n = setTimeout(() => {
1615
1615
  a(s());
@@ -1619,11 +1619,11 @@ const Gt = ({
1619
1619
  };
1620
1620
  }
1621
1621
  }, [o, e]), r;
1622
- }, jt = () => {
1623
- const e = E(null), {
1622
+ }, Yt = () => {
1623
+ const e = A(null), {
1624
1624
  activeUI: { volumeSlider: t },
1625
1625
  volumeSliderPlacement: o
1626
- } = O(), r = Gt({
1626
+ } = O(), r = jt({
1627
1627
  triggerRef: e,
1628
1628
  initialState: "bottom"
1629
1629
  });
@@ -1637,7 +1637,7 @@ const Gt = ({
1637
1637
  children: [
1638
1638
  /* @__PURE__ */ i(ie.Trigger, { children: /* @__PURE__ */ i(je, { ref: e }) }),
1639
1639
  /* @__PURE__ */ i(ie.Content, { role: "tooltip", children: /* @__PURE__ */ i(
1640
- Ht,
1640
+ Rt,
1641
1641
  {
1642
1642
  placement: o || r
1643
1643
  }
@@ -1646,22 +1646,22 @@ const Gt = ({
1646
1646
  }
1647
1647
  );
1648
1648
  }, qt = () => {
1649
- var r, a, s, n, c, l, u, p, m, d;
1649
+ var r, a, s, n, c, l, u, m, y, d;
1650
1650
  const { interfacePlacement: e, activeUI: t } = O(), o = !!(t.prevNnext ?? t.all);
1651
- return /* @__PURE__ */ S(R, { children: [
1651
+ return /* @__PURE__ */ S(z, { children: [
1652
1652
  /* @__PURE__ */ i(
1653
1653
  M.Item,
1654
1654
  {
1655
- 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) || L.templateArea.progress,
1655
+ 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) || k.templateArea.progress,
1656
1656
  width: "100%",
1657
1657
  visible: !!(t.progress !== void 0 ? t.progress : t.all),
1658
- children: /* @__PURE__ */ i($t, {})
1658
+ children: /* @__PURE__ */ i(Ht, {})
1659
1659
  }
1660
1660
  ),
1661
1661
  /* @__PURE__ */ i(
1662
1662
  M.Item,
1663
1663
  {
1664
- 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) || L.templateArea.repeatType,
1664
+ 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) || k.templateArea.repeatType,
1665
1665
  visible: !!(t.repeatType ?? t.all),
1666
1666
  children: /* @__PURE__ */ i(Pt, {})
1667
1667
  }
@@ -1669,11 +1669,11 @@ const Gt = ({
1669
1669
  /* @__PURE__ */ i(
1670
1670
  M.Item,
1671
1671
  {
1672
- gridArea: ((c = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : c.playButton) || ((l = e == null ? void 0 : e.templateArea) == null ? void 0 : l.playButton) || L.templateArea.playButton,
1672
+ gridArea: ((c = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : c.playButton) || ((l = e == null ? void 0 : e.templateArea) == null ? void 0 : l.playButton) || k.templateArea.playButton,
1673
1673
  visible: !!(t.playButton ?? t.all),
1674
1674
  children: /* @__PURE__ */ S("div", { className: "rmap-ctrl-btn-wrapper", children: [
1675
- /* @__PURE__ */ i(At, { isVisible: o }),
1676
- /* @__PURE__ */ i(Et, {}),
1675
+ /* @__PURE__ */ i(Et, { isVisible: o }),
1676
+ /* @__PURE__ */ i(At, {}),
1677
1677
  /* @__PURE__ */ i(It, { isVisible: o })
1678
1678
  ] })
1679
1679
  }
@@ -1681,21 +1681,21 @@ const Gt = ({
1681
1681
  /* @__PURE__ */ i(
1682
1682
  M.Item,
1683
1683
  {
1684
- gridArea: ((u = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : u.volume) || ((p = e == null ? void 0 : e.templateArea) == null ? void 0 : p.volume) || L.templateArea.volume,
1684
+ gridArea: ((u = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : u.volume) || ((m = e == null ? void 0 : e.templateArea) == null ? void 0 : m.volume) || k.templateArea.volume,
1685
1685
  visible: !!(t.volume ?? t.all),
1686
- children: /* @__PURE__ */ i(jt, {})
1686
+ children: /* @__PURE__ */ i(Yt, {})
1687
1687
  }
1688
1688
  ),
1689
1689
  /* @__PURE__ */ i(
1690
1690
  M.Item,
1691
1691
  {
1692
- gridArea: ((m = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : m.playList) || ((d = e == null ? void 0 : e.templateArea) == null ? void 0 : d.playList) || L.templateArea.playList,
1692
+ gridArea: ((y = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : y.playList) || ((d = e == null ? void 0 : e.templateArea) == null ? void 0 : d.playList) || k.templateArea.playList,
1693
1693
  visible: !!(t.playList ?? t.all),
1694
1694
  children: /* @__PURE__ */ i(Ot, {})
1695
1695
  }
1696
1696
  )
1697
1697
  ] });
1698
- }, Yt = z(function() {
1698
+ }, Xt = W(function() {
1699
1699
  const { playList: t, curIdx: o } = V(), { coverImgsCss: r } = P(), a = t[o], s = [a == null ? void 0 : a.writer, a == null ? void 0 : a.name].filter(Boolean).join(" - ") || "Album artwork";
1700
1700
  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(
1701
1701
  "div",
@@ -1707,9 +1707,9 @@ const Gt = ({
1707
1707
  children: (a == null ? void 0 : a.name) || "♪"
1708
1708
  }
1709
1709
  ) });
1710
- }), Xt = z(function() {
1710
+ }), Qt = W(function() {
1711
1711
  const { playList: t, curIdx: o } = V(), r = t[o];
1712
- return /* @__PURE__ */ i("div", { className: "rmap-track-info-container", children: r != null && r.customTrackInfo ? r.customTrackInfo : /* @__PURE__ */ S(R, { children: [
1712
+ return /* @__PURE__ */ i("div", { className: "rmap-track-info-container", children: r != null && r.customTrackInfo ? r.customTrackInfo : /* @__PURE__ */ S(z, { children: [
1713
1713
  (r == null ? void 0 : r.name) && /* @__PURE__ */ i("span", { className: "title", "data-testid": "track-title", children: r.name }),
1714
1714
  (r == null ? void 0 : r.writer) && /* @__PURE__ */ i("span", { className: "writer", children: r.writer })
1715
1715
  ] }) });
@@ -1721,7 +1721,7 @@ const Gt = ({
1721
1721
  ...r,
1722
1722
  children: o
1723
1723
  }
1724
- ), Qt = ({ position: e }) => {
1724
+ ), Jt = ({ position: e }) => {
1725
1725
  const { currentTime: t } = re();
1726
1726
  return /* @__PURE__ */ i(Ze, { position: e, className: "rmap-track-time-current", children: /* @__PURE__ */ i(
1727
1727
  "span",
@@ -1731,7 +1731,7 @@ const Gt = ({
1731
1731
  children: ee(t)
1732
1732
  }
1733
1733
  ) });
1734
- }, Jt = ({ position: e }) => {
1734
+ }, Zt = ({ position: e }) => {
1735
1735
  const { duration: t } = re();
1736
1736
  return /* @__PURE__ */ i(
1737
1737
  Ze,
@@ -1741,18 +1741,18 @@ const Gt = ({
1741
1741
  children: /* @__PURE__ */ i("span", { className: "rmap-track-duration", children: ee(t) })
1742
1742
  }
1743
1743
  );
1744
- }, Zt = () => {
1745
- var c, l, u, p, m, d, y, v;
1746
- const { interfacePlacement: e, activeUI: t } = O(), o = T(
1747
- (h) => +h.split(/[^\d]/).join(""),
1744
+ }, er = () => {
1745
+ var c, l, u, m, y, d, p, h;
1746
+ const { interfacePlacement: e, activeUI: t } = O(), o = g(
1747
+ (v) => +v.split(/[^\d]/).join(""),
1748
1748
  []
1749
1749
  ), r = o(
1750
- ((c = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : c.trackTimeCurrent) || ((l = e == null ? void 0 : e.templateArea) == null ? void 0 : l.trackTimeCurrent) || L.templateArea.trackTimeCurrent
1750
+ ((c = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : c.trackTimeCurrent) || ((l = e == null ? void 0 : e.templateArea) == null ? void 0 : l.trackTimeCurrent) || k.templateArea.trackTimeCurrent
1751
1751
  ), a = o(
1752
- ((u = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : u.trackTimeDuration) || ((p = e == null ? void 0 : e.templateArea) == null ? void 0 : p.trackTimeDuration) || L.templateArea.trackTimeDuration
1753
- ), s = T(
1754
- (h) => {
1755
- switch (h) {
1752
+ ((u = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : u.trackTimeDuration) || ((m = e == null ? void 0 : e.templateArea) == null ? void 0 : m.trackTimeDuration) || k.templateArea.trackTimeDuration
1753
+ ), s = g(
1754
+ (v) => {
1755
+ switch (v) {
1756
1756
  case 1:
1757
1757
  return "right";
1758
1758
  case -1:
@@ -1766,133 +1766,133 @@ const Gt = ({
1766
1766
  current: s(r - a),
1767
1767
  duration: s(a - r)
1768
1768
  };
1769
- return /* @__PURE__ */ S(R, { children: [
1769
+ return /* @__PURE__ */ S(z, { children: [
1770
1770
  /* @__PURE__ */ i(
1771
1771
  M.Item,
1772
1772
  {
1773
- gridArea: ((m = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : m.trackTimeCurrent) || ((d = e == null ? void 0 : e.templateArea) == null ? void 0 : d.trackTimeCurrent) || L.templateArea.trackTimeCurrent,
1773
+ gridArea: ((y = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : y.trackTimeCurrent) || ((d = e == null ? void 0 : e.templateArea) == null ? void 0 : d.trackTimeCurrent) || k.templateArea.trackTimeCurrent,
1774
1774
  visible: !!(t.trackTime ?? t.all),
1775
- children: /* @__PURE__ */ i(Qt, { position: n.current })
1775
+ children: /* @__PURE__ */ i(Jt, { position: n.current })
1776
1776
  }
1777
1777
  ),
1778
1778
  /* @__PURE__ */ i(
1779
1779
  M.Item,
1780
1780
  {
1781
- gridArea: ((y = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : y.trackTimeDuration) || ((v = e == null ? void 0 : e.templateArea) == null ? void 0 : v.trackTimeDuration) || L.templateArea.trackTimeDuration,
1781
+ gridArea: ((p = e == null ? void 0 : e.itemCustomArea) == null ? void 0 : p.trackTimeDuration) || ((h = e == null ? void 0 : e.templateArea) == null ? void 0 : h.trackTimeDuration) || k.templateArea.trackTimeDuration,
1782
1782
  visible: !!(t.trackTime ?? t.all),
1783
- children: /* @__PURE__ */ i(Jt, { position: n.duration })
1783
+ children: /* @__PURE__ */ i(Zt, { position: n.duration })
1784
1784
  }
1785
1785
  )
1786
1786
  ] });
1787
- }, er = () => {
1788
- var s, n, c, l, u, p, m, d;
1787
+ }, tr = () => {
1788
+ var s, n, c, l, u, m, y, d;
1789
1789
  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);
1790
- return /* @__PURE__ */ S(R, { children: [
1790
+ return /* @__PURE__ */ S(z, { children: [
1791
1791
  /* @__PURE__ */ i(
1792
1792
  M.Item,
1793
1793
  {
1794
- gridArea: ((l = o == null ? void 0 : o.itemCustomArea) == null ? void 0 : l.artwork) || ((u = o == null ? void 0 : o.templateArea) == null ? void 0 : u.artwork) || L.templateArea.artwork,
1795
- visible: !!((p = e[t]) != null && p.img && (r.artwork ?? r.all)),
1796
- children: /* @__PURE__ */ i(Yt, {})
1794
+ gridArea: ((l = o == null ? void 0 : o.itemCustomArea) == null ? void 0 : l.artwork) || ((u = o == null ? void 0 : o.templateArea) == null ? void 0 : u.artwork) || k.templateArea.artwork,
1795
+ visible: !!((m = e[t]) != null && m.img && (r.artwork ?? r.all)),
1796
+ children: /* @__PURE__ */ i(Xt, {})
1797
1797
  }
1798
1798
  ),
1799
1799
  /* @__PURE__ */ i(
1800
1800
  M.Item,
1801
1801
  {
1802
- gridArea: ((m = o == null ? void 0 : o.itemCustomArea) == null ? void 0 : m.trackInfo) || ((d = o == null ? void 0 : o.templateArea) == null ? void 0 : d.trackInfo) || L.templateArea.trackInfo,
1802
+ gridArea: ((y = o == null ? void 0 : o.itemCustomArea) == null ? void 0 : y.trackInfo) || ((d = o == null ? void 0 : o.templateArea) == null ? void 0 : d.trackInfo) || k.templateArea.trackInfo,
1803
1803
  visible: a,
1804
- children: /* @__PURE__ */ i(Xt, {})
1804
+ children: /* @__PURE__ */ i(Qt, {})
1805
1805
  }
1806
1806
  ),
1807
- /* @__PURE__ */ i(Zt, {})
1807
+ /* @__PURE__ */ i(er, {})
1808
1808
  ] });
1809
- }, tr = (e, t, o) => {
1810
- const r = T(
1811
- (d, y, v) => {
1812
- const h = Object.keys(
1813
- L.templateArea
1814
- ).filter((I) => (I === "trackTimeCurrent" || I === "trackTimeDuration") && d.trackTime === !1 ? !1 : d[I] !== void 0 ? d[I] : !0), g = d.all ? h : Object.entries(d).filter(([, I]) => I).map(([I]) => I);
1809
+ }, rr = (e, t, o) => {
1810
+ const r = g(
1811
+ (d, p, h) => {
1812
+ const v = Object.keys(
1813
+ k.templateArea
1814
+ ).filter((I) => (I === "trackTimeCurrent" || I === "trackTimeDuration") && d.trackTime === !1 ? !1 : d[I] !== void 0 ? d[I] : !0), T = d.all ? v : Object.entries(d).filter(([, I]) => I).map(([I]) => I);
1815
1815
  (() => {
1816
- g.find((I) => I === "trackTime") && (g.splice(g.indexOf("trackTime"), 1), g.push("trackTimeCurrent"), g.push("trackTimeDuration"));
1816
+ T.find((I) => I === "trackTime") && (T.splice(T.indexOf("trackTime"), 1), T.push("trackTimeCurrent"), T.push("trackTimeDuration"));
1817
1817
  })();
1818
1818
  const N = {
1819
- ...L.templateArea,
1820
- ...y
1821
- }, W = Object.entries(
1819
+ ...k.templateArea,
1820
+ ...p
1821
+ }, B = Object.entries(
1822
1822
  N
1823
- ).filter(([I]) => g.includes(I));
1824
- let H = 1;
1823
+ ).filter(([I]) => T.includes(I));
1824
+ let R = 1;
1825
1825
  const G = {}, ae = [
1826
- ...W,
1827
- ...Object.entries(v || {})
1826
+ ...B,
1827
+ ...Object.entries(h || {})
1828
1828
  ].flatMap(([I, _]) => {
1829
1829
  if (_ == null) return [];
1830
- const [B, K] = _.split("-"), j = +B.split("row")[1];
1831
- return H = Math.max(H, j), G[j] = G[j] ? G[j] + 1 : 1, [
1830
+ const [K, $] = _.split("-"), j = +K.split("row")[1];
1831
+ return R = Math.max(R, j), G[j] = G[j] ? G[j] + 1 : 1, [
1832
1832
  {
1833
1833
  key: I,
1834
1834
  row: j,
1835
- col: +K
1835
+ col: +$
1836
1836
  }
1837
1837
  ];
1838
1838
  }).sort((I, _) => I.col - _.col), X = Math.max(...Object.values(G));
1839
1839
  let oe;
1840
- const et = new Array(H).fill("").map((I, _) => {
1841
- let B = "", K;
1842
- const j = ae.filter((U) => U.row !== _ + 1 ? !1 : (U.key === "progress" && (K = U), !0));
1843
- if (K) {
1840
+ const et = new Array(R).fill("").map((I, _) => {
1841
+ let K = "", $;
1842
+ const j = ae.filter((U) => U.row !== _ + 1 ? !1 : (U.key === "progress" && ($ = U), !0));
1843
+ if ($) {
1844
1844
  const U = /* @__PURE__ */ new Map();
1845
1845
  j.forEach((Q) => U.set(Q.col, Q));
1846
- const de = `row${_ + 1}-${K.col}`, ne = [];
1846
+ const de = `row${_ + 1}-${$.col}`, ne = [];
1847
1847
  for (let Q = 0; Q < X; Q++) {
1848
1848
  const Pe = Q + 1;
1849
1849
  U.has(Pe) ? ne.push(`row${_ + 1}-${Pe}`) : ne.push(de);
1850
1850
  }
1851
1851
  const at = ne.indexOf(de), ot = ne.lastIndexOf(de);
1852
- oe = Math.floor((at + ot) / 2), B = " " + ne.join(" ");
1852
+ oe = Math.floor((at + ot) / 2), K = " " + ne.join(" ");
1853
1853
  } else
1854
1854
  for (let U = 0; U < X; U++)
1855
- B += ` row${_ + 1}-${U + 1}`;
1856
- return B.trimStart();
1857
- }), tt = Ye ? window.innerWidth - 100 : 1500, rt = new Array(H).fill("").map((I, _) => {
1858
- let B = "";
1859
- for (let K = 0; K < X; K++) {
1860
- if (oe === K && _ === 0) {
1861
- B += " 1fr";
1855
+ K += ` row${_ + 1}-${U + 1}`;
1856
+ return K.trimStart();
1857
+ }), tt = qe ? window.innerWidth - 100 : 1500, rt = new Array(R).fill("").map((I, _) => {
1858
+ let K = "";
1859
+ for (let $ = 0; $ < X; $++) {
1860
+ if (oe === $ && _ === 0) {
1861
+ K += " 1fr";
1862
1862
  continue;
1863
1863
  }
1864
- B += ` fit-content(${tt}px)`;
1864
+ K += ` fit-content(${tt}px)`;
1865
1865
  }
1866
- return B.trimStart();
1866
+ return K.trimStart();
1867
1867
  });
1868
1868
  return { gridAreas: et, gridColumns: rt };
1869
1869
  },
1870
1870
  []
1871
- ), [a, s] = k(e), [n, c] = k({
1871
+ ), [a, s] = b(e), [n, c] = b({
1872
1872
  templateArea: t,
1873
1873
  customComponentsArea: o
1874
- }), [l, u] = k();
1874
+ }), [l, u] = b();
1875
1875
  if (!l) {
1876
- const { gridAreas: d, gridColumns: y } = r(
1876
+ const { gridAreas: d, gridColumns: p } = r(
1877
1877
  a,
1878
1878
  n.templateArea,
1879
1879
  n.customComponentsArea
1880
1880
  );
1881
- return u({ gridAreas: d, gridColumns: y }), [d, y];
1881
+ return u({ gridAreas: d, gridColumns: p }), [d, p];
1882
1882
  }
1883
1883
  if (a !== e || n.templateArea !== t || n.customComponentsArea !== o) {
1884
1884
  s(e), c({ templateArea: t, customComponentsArea: o });
1885
- const { gridAreas: d, gridColumns: y } = r(
1885
+ const { gridAreas: d, gridColumns: p } = r(
1886
1886
  e,
1887
1887
  t,
1888
1888
  o
1889
1889
  );
1890
- u({ gridAreas: d, gridColumns: y });
1890
+ u({ gridAreas: d, gridColumns: p });
1891
1891
  }
1892
- const { gridAreas: p, gridColumns: m } = l;
1893
- return [p, m];
1894
- }, rr = ({ children: e }) => {
1895
- const { interfacePlacement: t, activeUI: o, playListPlacement: r } = O(), a = te.Children.toArray(e), [s, n] = tr(
1892
+ const { gridAreas: m, gridColumns: y } = l;
1893
+ return [m, y];
1894
+ }, ar = ({ children: e }) => {
1895
+ const { interfacePlacement: t, activeUI: o, playListPlacement: r } = O(), a = te.Children.toArray(e), [s, n] = rr(
1896
1896
  o,
1897
1897
  t == null ? void 0 : t.templateArea,
1898
1898
  t == null ? void 0 : t.customComponentsArea
@@ -1916,7 +1916,7 @@ const Gt = ({
1916
1916
  columns: n,
1917
1917
  UNSAFE_className: "rmap-interface-grid",
1918
1918
  children: [
1919
- /* @__PURE__ */ i(er, {}),
1919
+ /* @__PURE__ */ i(tr, {}),
1920
1920
  /* @__PURE__ */ i(qt, {}),
1921
1921
  a
1922
1922
  ]
@@ -1927,14 +1927,14 @@ const Gt = ({
1927
1927
  }
1928
1928
  );
1929
1929
  }, Z = (e, t) => {
1930
- const o = E(!1);
1931
- A(() => {
1930
+ const o = A(!1);
1931
+ E(() => {
1932
1932
  if (o.current)
1933
1933
  return e();
1934
- }, t), A(() => (o.current = !0, () => {
1934
+ }, t), E(() => (o.current = !0, () => {
1935
1935
  o.current = !1;
1936
1936
  }), []);
1937
- }, ar = ({
1937
+ }, or = ({
1938
1938
  placement: e = {},
1939
1939
  activeUI: t,
1940
1940
  coverImgsCss: o,
@@ -1948,14 +1948,14 @@ const Gt = ({
1948
1948
  player: c,
1949
1949
  playList: l,
1950
1950
  interface: u,
1951
- volumeSlider: p
1951
+ volumeSlider: m
1952
1952
  } = e;
1953
1953
  n({
1954
1954
  type: "SET_PLACEMENTS",
1955
1955
  playerPlacement: c,
1956
1956
  playListPlacement: l,
1957
1957
  interfacePlacement: u,
1958
- volumeSliderPlacement: p
1958
+ volumeSliderPlacement: m
1959
1959
  });
1960
1960
  }, [n, e]), Z(() => {
1961
1961
  t && n({ type: "SET_ACTIVE_UI", activeUI: t });
@@ -1972,33 +1972,33 @@ const Gt = ({
1972
1972
  }, [n, a]), Z(() => {
1973
1973
  s && n({ type: "SET_CUSTOM_ICONS", customIcons: s });
1974
1974
  }, [s, n]);
1975
- }, or = ({
1975
+ }, nr = ({
1976
1976
  audioRef: e,
1977
1977
  children: t,
1978
1978
  ...o
1979
- }) => (ar(o), /* @__PURE__ */ S("div", { id: "rm-audio-player", className: "rmap-player-container", children: [
1979
+ }) => (or(o), /* @__PURE__ */ S("div", { id: "rm-audio-player", className: "rmap-player-container", children: [
1980
1980
  /* @__PURE__ */ i(_e, { audioRef: e }),
1981
- /* @__PURE__ */ i(rr, { children: t })
1981
+ /* @__PURE__ */ i(ar, { children: t })
1982
1982
  ] }));
1983
1983
  function we({
1984
1984
  rootContainerProps: e,
1985
1985
  ...t
1986
1986
  }) {
1987
- return /* @__PURE__ */ i(yt, { ...t, children: /* @__PURE__ */ i(Ce, { rootContainerProps: e, children: /* @__PURE__ */ i(or, { ...t }) }) });
1987
+ return /* @__PURE__ */ i(yt, { ...t, children: /* @__PURE__ */ i(Ce, { rootContainerProps: e, children: /* @__PURE__ */ i(nr, { ...t }) }) });
1988
1988
  }
1989
1989
  we.displayName = "AudioPlayerWithProviders";
1990
1990
  we.CustomComponent = xe;
1991
- const nr = () => {
1992
- const e = f(w), { isPlaying: t, repeatType: o } = b(), r = T(() => {
1991
+ const sr = () => {
1992
+ const e = f(w), { isPlaying: t, repeatType: o } = C(), r = g(() => {
1993
1993
  e({ type: "CHANGE_PLAYING_STATE", state: !0 });
1994
- }, [e]), a = T(() => {
1994
+ }, [e]), a = g(() => {
1995
1995
  e({ type: "CHANGE_PLAYING_STATE", state: !1 });
1996
- }, [e]), s = T(() => {
1996
+ }, [e]), s = g(() => {
1997
1997
  e({ type: "CHANGE_PLAYING_STATE" });
1998
1998
  }, [e]);
1999
1999
  return { isPlaying: t, repeatType: o, play: r, pause: a, togglePlay: s };
2000
- }, sr = () => {
2001
- const e = f(w), { playList: t, curIdx: o, curPlayId: r } = V(), { elementRefs: a } = P(), s = T(
2000
+ }, ir = () => {
2001
+ const e = f(w), { playList: t, curIdx: o, curPlayId: r } = V(), { elementRefs: a } = P(), s = g(
2002
2002
  (l) => {
2003
2003
  const u = t[l];
2004
2004
  u && e({
@@ -2008,9 +2008,9 @@ const nr = () => {
2008
2008
  });
2009
2009
  },
2010
2010
  [e, t]
2011
- ), n = T(() => {
2011
+ ), n = g(() => {
2012
2012
  t.length !== 0 && e({ type: "NEXT_AUDIO" });
2013
- }, [e, t.length]), c = T(() => {
2013
+ }, [e, t.length]), c = g(() => {
2014
2014
  var u;
2015
2015
  if (t.length === 0) return;
2016
2016
  const l = ((u = a == null ? void 0 : a.audioEl) == null ? void 0 : u.currentTime) ?? 0;
@@ -2025,26 +2025,26 @@ const nr = () => {
2025
2025
  next: n,
2026
2026
  prev: c
2027
2027
  };
2028
- }, ir = () => {
2029
- const e = f(w), { volume: t, muted: o } = b(), r = T(
2028
+ }, lr = () => {
2029
+ const e = f(w), { volume: t, muted: o } = C(), r = g(
2030
2030
  (s) => {
2031
2031
  e({ type: "SET_VOLUME", volume: s });
2032
2032
  },
2033
2033
  [e]
2034
- ), a = T(() => {
2034
+ ), a = g(() => {
2035
2035
  e({ type: "SET_MUTED", muted: !o });
2036
2036
  }, [e, o]);
2037
2037
  return { volume: t, muted: o, setVolume: r, toggleMute: a };
2038
- }, lr = () => {
2039
- const e = f(w), { currentTime: t, duration: o } = re(), r = T(
2038
+ }, cr = () => {
2039
+ const e = f(w), { currentTime: t, duration: o } = re(), r = g(
2040
2040
  (a) => {
2041
2041
  e({ type: "SEEK", time: a });
2042
2042
  },
2043
2043
  [e]
2044
2044
  );
2045
2045
  return { currentTime: t, duration: o, seek: r };
2046
- }, pr = () => {
2047
- const e = nr(), t = sr(), o = ir(), r = lr();
2046
+ }, yr = () => {
2047
+ const e = sr(), t = ir(), o = lr(), r = cr();
2048
2048
  return {
2049
2049
  isPlaying: e.isPlaying,
2050
2050
  volume: o.volume,
@@ -2065,7 +2065,7 @@ const nr = () => {
2065
2065
  toggleMute: o.toggleMute,
2066
2066
  setTrack: t.setTrack
2067
2067
  };
2068
- }, yr = () => {
2068
+ }, vr = () => {
2069
2069
  const { elementRefs: e } = P();
2070
2070
  return {
2071
2071
  audioEl: e == null ? void 0 : e.audioEl,
@@ -2074,7 +2074,7 @@ const nr = () => {
2074
2074
  };
2075
2075
  we.CustomComponent = xe;
2076
2076
  export {
2077
- or as AudioPlayer,
2077
+ nr as AudioPlayer,
2078
2078
  Ce as AudioPlayerContainer,
2079
2079
  yt as AudioPlayerStateProvider,
2080
2080
  F as DEFAULT_AUDIO_STATE,
@@ -2082,17 +2082,17 @@ export {
2082
2082
  w as audioPlayerDispatchContext,
2083
2083
  mt as audioPlayerReducer,
2084
2084
  we as default,
2085
- L as defaultInterfacePlacement,
2086
- mr as defaultInterfacePlacementMaxLength,
2085
+ k as defaultInterfacePlacement,
2086
+ pr as defaultInterfacePlacementMaxLength,
2087
2087
  he as playbackContext,
2088
- Ee as resourceContext,
2089
- Ae as timeContext,
2088
+ Ae as resourceContext,
2089
+ Ee as timeContext,
2090
2090
  ge as trackContext,
2091
2091
  fe as uiContext,
2092
- pr as useAudioPlayer,
2093
- yr as useAudioPlayerElement,
2094
- nr as useAudioPlayerPlayback,
2095
- lr as useAudioPlayerTime,
2096
- sr as useAudioPlayerTrack,
2097
- ir as useAudioPlayerVolume
2092
+ yr as useAudioPlayer,
2093
+ vr as useAudioPlayerElement,
2094
+ sr as useAudioPlayerPlayback,
2095
+ cr as useAudioPlayerTime,
2096
+ ir as useAudioPlayerTrack,
2097
+ lr as useAudioPlayerVolume
2098
2098
  };