@lucaismyname/ginger 0.0.23 → 0.0.25
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.
- package/dist/client.cjs +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -2
- package/dist/components/controls/Controls.d.ts +6 -3
- package/dist/components/controls/Controls.d.ts.map +1 -1
- package/dist/{ginger-BoNnuade.js → ginger-Dj-zM_lq.js} +475 -470
- package/dist/ginger-Dj-zM_lq.js.map +1 -0
- package/dist/ginger-R_CXoaE2.cjs +2 -0
- package/dist/ginger-R_CXoaE2.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/testing/helpers.d.ts.map +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/{useNextTrackPrefetch-BUx0bK_a.js → useNextTrackPrefetch-CmfCP_Vz.js} +2 -2
- package/dist/{useNextTrackPrefetch-BUx0bK_a.js.map → useNextTrackPrefetch-CmfCP_Vz.js.map} +1 -1
- package/dist/{useNextTrackPrefetch-CaTRhYHd.cjs → useNextTrackPrefetch-iqM3_D0L.cjs} +2 -2
- package/dist/{useNextTrackPrefetch-CaTRhYHd.cjs.map → useNextTrackPrefetch-iqM3_D0L.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/ginger-BKmH7kWx.cjs +0 -2
- package/dist/ginger-BKmH7kWx.cjs.map +0 -1
- package/dist/ginger-BoNnuade.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
1
|
+
import { jsx as d, jsxs as q } from "react/jsx-runtime";
|
|
2
2
|
import { useContext as Ge, createContext as Ne, useRef as O, useState as Nr, useEffect as E, useMemo as P, useReducer as wr, useCallback as v } from "react";
|
|
3
3
|
import { c as I, b as _, u as j, g as $e, G as Cr, d as Lr } from "./GingerSplitContexts-BzBExb95.js";
|
|
4
4
|
const Oe = Ne(null);
|
|
@@ -15,27 +15,27 @@ function Fr({
|
|
|
15
15
|
className: e,
|
|
16
16
|
style: r,
|
|
17
17
|
preload: n = "metadata",
|
|
18
|
-
crossOrigin:
|
|
19
|
-
respectReducedMotion:
|
|
18
|
+
crossOrigin: t,
|
|
19
|
+
respectReducedMotion: a = !1
|
|
20
20
|
}) {
|
|
21
21
|
var S;
|
|
22
|
-
const { audioRef: i, dispatch: o, state: u, notifyEnded:
|
|
22
|
+
const { audioRef: i, dispatch: o, state: u, notifyEnded: l } = Dr(), s = ((S = u.tracks[u.currentIndex]) == null ? void 0 : S.fileUrl) ?? "", g = O({
|
|
23
23
|
currentTime: -1,
|
|
24
24
|
duration: -1,
|
|
25
25
|
bufferedFraction: -1
|
|
26
26
|
}), m = O(""), [y, k] = Nr(!1);
|
|
27
27
|
E(() => {
|
|
28
|
-
if (!
|
|
29
|
-
const p = window.matchMedia("(prefers-reduced-motion: reduce)"),
|
|
30
|
-
return
|
|
31
|
-
}, [
|
|
32
|
-
const b = (p,
|
|
28
|
+
if (!a || typeof window > "u") return;
|
|
29
|
+
const p = window.matchMedia("(prefers-reduced-motion: reduce)"), x = () => k(p.matches);
|
|
30
|
+
return x(), p.addEventListener("change", x), () => p.removeEventListener("change", x);
|
|
31
|
+
}, [a]);
|
|
32
|
+
const b = (p, x = !1) => {
|
|
33
33
|
const R = {
|
|
34
34
|
currentTime: p.currentTime,
|
|
35
35
|
duration: p.duration,
|
|
36
36
|
bufferedFraction: Ue(p)
|
|
37
37
|
}, w = g.current, Se = y ? 0.5 : 0.25, K = Math.abs(R.currentTime - w.currentTime) >= Se || Math.abs(R.duration - w.duration) >= 0.01 || Math.abs(R.bufferedFraction - w.bufferedFraction) >= 0.01;
|
|
38
|
-
!
|
|
38
|
+
!x && !K || (g.current = R, o({
|
|
39
39
|
type: "MEDIA_TIME_UPDATE",
|
|
40
40
|
payload: R
|
|
41
41
|
}));
|
|
@@ -46,57 +46,57 @@ function Fr({
|
|
|
46
46
|
}, [i, u.volume, u.muted]), E(() => {
|
|
47
47
|
const p = i.current;
|
|
48
48
|
if (p) {
|
|
49
|
-
if (!
|
|
49
|
+
if (!s) {
|
|
50
50
|
p.removeAttribute("src"), g.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, m.current !== "" && o({ type: "MEDIA_SOURCE_CLEARED" }), m.current = "";
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
p.getAttribute("src") !==
|
|
53
|
+
p.getAttribute("src") !== s && (p.src = s, p.load(), g.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), m.current = s;
|
|
54
54
|
}
|
|
55
|
-
}, [i, o, u.currentIndex, u.tracks,
|
|
55
|
+
}, [i, o, u.currentIndex, u.tracks, s]), E(() => {
|
|
56
56
|
const p = i.current;
|
|
57
57
|
p && (p.playbackRate = u.playbackRate);
|
|
58
|
-
}, [i, u.playbackRate,
|
|
58
|
+
}, [i, u.playbackRate, s]), /* @__PURE__ */ d(
|
|
59
59
|
"audio",
|
|
60
60
|
{
|
|
61
61
|
ref: i,
|
|
62
62
|
className: e,
|
|
63
63
|
style: r,
|
|
64
64
|
preload: n,
|
|
65
|
-
crossOrigin:
|
|
65
|
+
crossOrigin: t,
|
|
66
66
|
controls: !1,
|
|
67
67
|
playsInline: !0,
|
|
68
68
|
onTimeUpdate: (p) => {
|
|
69
69
|
b(p.currentTarget);
|
|
70
70
|
},
|
|
71
71
|
onLoadedMetadata: (p) => {
|
|
72
|
-
const
|
|
72
|
+
const x = p.currentTarget;
|
|
73
73
|
g.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, o({
|
|
74
74
|
type: "MEDIA_LOADED_METADATA",
|
|
75
75
|
payload: {
|
|
76
|
-
duration:
|
|
77
|
-
bufferedFraction: Ue(
|
|
76
|
+
duration: x.duration,
|
|
77
|
+
bufferedFraction: Ue(x)
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
},
|
|
81
81
|
onSeeking: (p) => b(p.currentTarget, !0),
|
|
82
82
|
onSeeked: (p) => b(p.currentTarget, !0),
|
|
83
|
-
onEnded: () =>
|
|
83
|
+
onEnded: () => l(),
|
|
84
84
|
onPlay: () => o({ type: "MEDIA_PLAY" }),
|
|
85
85
|
onPause: () => o({ type: "MEDIA_PAUSE" }),
|
|
86
86
|
onWaiting: () => o({ type: "MEDIA_WAITING" }),
|
|
87
87
|
onCanPlay: () => o({ type: "MEDIA_CANPLAY" }),
|
|
88
88
|
onProgress: (p) => b(p.currentTarget, !0),
|
|
89
89
|
onVolumeChange: (p) => {
|
|
90
|
-
const
|
|
90
|
+
const x = p.currentTarget;
|
|
91
91
|
o({
|
|
92
92
|
type: "MEDIA_VOLUME_SYNC",
|
|
93
|
-
payload: { volume:
|
|
93
|
+
payload: { volume: x.volume, muted: x.muted }
|
|
94
94
|
});
|
|
95
95
|
},
|
|
96
96
|
onError: () => {
|
|
97
97
|
var w;
|
|
98
|
-
const p = i.current,
|
|
99
|
-
o({ type: "MEDIA_ERROR", payload: { message:
|
|
98
|
+
const p = i.current, x = (w = p == null ? void 0 : p.error) == null ? void 0 : w.code;
|
|
99
|
+
o({ type: "MEDIA_ERROR", payload: { message: x === 1 ? "MEDIA_ERR_ABORTED" : x === 2 ? "MEDIA_ERR_NETWORK" : x === 3 ? "MEDIA_ERR_DECODE" : x === 4 ? "MEDIA_ERR_SRC_NOT_SUPPORTED" : "MEDIA_ERR_UNKNOWN" } });
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
);
|
|
@@ -108,12 +108,12 @@ function Be(e, r) {
|
|
|
108
108
|
if (e.length <= 1) return [...e];
|
|
109
109
|
const n = e[r];
|
|
110
110
|
if (!n) return [...e];
|
|
111
|
-
const
|
|
112
|
-
for (let
|
|
113
|
-
const i = Math.floor(Math.random() * (
|
|
114
|
-
[a
|
|
111
|
+
const t = e.filter((a, i) => i !== r);
|
|
112
|
+
for (let a = t.length - 1; a > 0; a--) {
|
|
113
|
+
const i = Math.floor(Math.random() * (a + 1));
|
|
114
|
+
[t[a], t[i]] = [t[i], t[a]];
|
|
115
115
|
}
|
|
116
|
-
return [n, ...
|
|
116
|
+
return [n, ...t];
|
|
117
117
|
}
|
|
118
118
|
function W(e) {
|
|
119
119
|
return e ? e.id != null && e.id !== "" ? `id:${e.id}` : `file:${e.fileUrl}` : "";
|
|
@@ -121,23 +121,23 @@ function W(e) {
|
|
|
121
121
|
function Ur(e, r) {
|
|
122
122
|
var o, u;
|
|
123
123
|
if (!r) return 0;
|
|
124
|
-
const n = e.findIndex((
|
|
124
|
+
const n = e.findIndex((l) => l === r);
|
|
125
125
|
if (n !== -1) return n;
|
|
126
|
-
const
|
|
127
|
-
if (!
|
|
128
|
-
const
|
|
129
|
-
for (let
|
|
130
|
-
W(e[
|
|
131
|
-
if (
|
|
132
|
-
if (
|
|
126
|
+
const t = W(r);
|
|
127
|
+
if (!t) return 0;
|
|
128
|
+
const a = [];
|
|
129
|
+
for (let l = 0; l < e.length; l += 1)
|
|
130
|
+
W(e[l]) === t && a.push(l);
|
|
131
|
+
if (a.length === 0) return 0;
|
|
132
|
+
if (a.length === 1) return a[0];
|
|
133
133
|
const i = typeof globalThis < "u" && "process" in globalThis ? (u = (o = globalThis.process) == null ? void 0 : o.env) == null ? void 0 : u.NODE_ENV : void 0;
|
|
134
134
|
return i != null && i !== "production" && console.warn(
|
|
135
135
|
"[@lucaismyname/ginger] Ambiguous track identity: multiple queue rows share the same fileUrl without a unique `id`. Resolving to the first match."
|
|
136
|
-
),
|
|
136
|
+
), a[0];
|
|
137
137
|
}
|
|
138
138
|
function Ye(e, r, n) {
|
|
139
|
-
const
|
|
140
|
-
return
|
|
139
|
+
const t = [...e], a = Math.max(0, Math.min(t.length, n ?? t.length));
|
|
140
|
+
return t.splice(a, 0, r), t;
|
|
141
141
|
}
|
|
142
142
|
function Vr(e, r) {
|
|
143
143
|
if (r < 0 || r >= e.length) return [...e];
|
|
@@ -147,23 +147,23 @@ function Vr(e, r) {
|
|
|
147
147
|
function $r(e, r, n) {
|
|
148
148
|
if (r === n || r < 0 || r >= e.length || n < 0 || n >= e.length)
|
|
149
149
|
return [...e];
|
|
150
|
-
const
|
|
151
|
-
return
|
|
150
|
+
const t = [...e], [a] = t.splice(r, 1);
|
|
151
|
+
return a ? (t.splice(n, 0, a), t) : [...e];
|
|
152
152
|
}
|
|
153
153
|
function Or(e, r, n) {
|
|
154
154
|
return Ye(e, n, Math.max(0, Math.min(e.length, r + 1)));
|
|
155
155
|
}
|
|
156
156
|
function Br(e) {
|
|
157
|
-
const { tracks: r, currentIndex: n, repeatMode:
|
|
158
|
-
return i === 0 ? { kind: "stop", nextIndex: 0 } :
|
|
157
|
+
const { tracks: r, currentIndex: n, repeatMode: t, playbackMode: a } = e, i = r.length;
|
|
158
|
+
return i === 0 ? { kind: "stop", nextIndex: 0 } : t === "one" ? { kind: "replay_same" } : a === "single" ? { kind: "stop", nextIndex: A(n, i) } : n < i - 1 ? { kind: "advance", nextIndex: n + 1 } : t === "all" ? { kind: "wrap", nextIndex: 0 } : { kind: "stop", nextIndex: A(n, i) };
|
|
159
159
|
}
|
|
160
160
|
function Yr(e) {
|
|
161
|
-
const { tracks: r, currentIndex: n, repeatMode:
|
|
162
|
-
return i === 0 ? 0 :
|
|
161
|
+
const { tracks: r, currentIndex: n, repeatMode: t, playbackMode: a } = e, i = r.length;
|
|
162
|
+
return i === 0 ? 0 : a === "single" ? A(n, i) : n < i - 1 ? n + 1 : t === "all" ? 0 : A(n, i);
|
|
163
163
|
}
|
|
164
164
|
function Qr(e) {
|
|
165
|
-
const { tracks: r, currentIndex: n, repeatMode:
|
|
166
|
-
return i === 0 ? 0 :
|
|
165
|
+
const { tracks: r, currentIndex: n, repeatMode: t, playbackMode: a } = e, i = r.length;
|
|
166
|
+
return i === 0 ? 0 : a === "single" ? A(n, i) : n > 0 ? n - 1 : t === "all" ? i - 1 : 0;
|
|
167
167
|
}
|
|
168
168
|
function Hr(e) {
|
|
169
169
|
return e === "off" ? "all" : e === "all" ? "one" : "off";
|
|
@@ -180,19 +180,19 @@ function V(e) {
|
|
|
180
180
|
function He(e) {
|
|
181
181
|
return e.errorMessage ? "error" : e.tracks.length === 0 ? "idle" : e.isBuffering ? "loading" : e.isPaused ? Number.isFinite(e.duration) && e.duration > 0 && e.currentTime >= e.duration - 0.05 ? "ended" : "paused" : "playing";
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
var
|
|
183
|
+
function J(e) {
|
|
184
|
+
var t;
|
|
185
185
|
const r = e.duration;
|
|
186
186
|
if (Number.isFinite(r) && r > 0) return r;
|
|
187
|
-
const n = (
|
|
187
|
+
const n = (t = e.tracks[e.currentIndex]) == null ? void 0 : t.durationSeconds;
|
|
188
188
|
return typeof n == "number" && Number.isFinite(n) && n > 0 ? n : 0;
|
|
189
189
|
}
|
|
190
190
|
function Kr(e) {
|
|
191
|
-
const n =
|
|
191
|
+
const n = J(e) - e.currentTime;
|
|
192
192
|
return Number.isFinite(n) ? Math.max(0, n) : 0;
|
|
193
193
|
}
|
|
194
194
|
function je(e) {
|
|
195
|
-
const r =
|
|
195
|
+
const r = J(e);
|
|
196
196
|
return r > 0 ? Math.min(1, Math.max(0, e.currentTime / r)) : 0;
|
|
197
197
|
}
|
|
198
198
|
function Xr(e) {
|
|
@@ -206,13 +206,13 @@ function zr(e) {
|
|
|
206
206
|
return jr(r, (n = e.playlistMeta) == null ? void 0 : n.subtitle);
|
|
207
207
|
}
|
|
208
208
|
function B(e, r) {
|
|
209
|
-
function n(
|
|
210
|
-
const
|
|
209
|
+
function n(t) {
|
|
210
|
+
const a = I(), o = (r(a) ?? "").trim(), { className: u, style: l, fallback: s, empty: g, children: m } = t;
|
|
211
211
|
if (!o) {
|
|
212
|
-
const y = g ??
|
|
213
|
-
return y ? /* @__PURE__ */ d("span", { className: u, style:
|
|
212
|
+
const y = g ?? s ?? null;
|
|
213
|
+
return y ? /* @__PURE__ */ d("span", { className: u, style: l, children: y }) : null;
|
|
214
214
|
}
|
|
215
|
-
return m ? /* @__PURE__ */ d("span", { className: u, style:
|
|
215
|
+
return m ? /* @__PURE__ */ d("span", { className: u, style: l, children: m(o, a) }) : /* @__PURE__ */ d("span", { className: u, style: l, children: o });
|
|
216
216
|
}
|
|
217
217
|
return n.displayName = e, n;
|
|
218
218
|
}
|
|
@@ -227,77 +227,77 @@ const Wr = Y("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), qr =
|
|
|
227
227
|
"Ginger.Current.TrackNumber",
|
|
228
228
|
(e) => (e == null ? void 0 : e.trackNumber) != null ? String(e.trackNumber) : void 0
|
|
229
229
|
);
|
|
230
|
-
function Ke({ className: e, style: r, fallback: n, empty:
|
|
231
|
-
var
|
|
232
|
-
const o = I(), u = (
|
|
230
|
+
function Ke({ className: e, style: r, fallback: n, empty: t, children: a, format: i }) {
|
|
231
|
+
var s;
|
|
232
|
+
const o = I(), u = (s = V(o)) == null ? void 0 : s.year;
|
|
233
233
|
if (typeof u != "number" || !Number.isFinite(u)) {
|
|
234
|
-
const g =
|
|
234
|
+
const g = t ?? n ?? null;
|
|
235
235
|
return g ? /* @__PURE__ */ d("span", { className: e, style: r, children: g }) : null;
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
return
|
|
237
|
+
const l = i ? i(u) : String(u);
|
|
238
|
+
return a ? /* @__PURE__ */ d("span", { className: e, style: r, children: a(l, o) }) : /* @__PURE__ */ d("span", { className: e, style: r, children: l });
|
|
239
239
|
}
|
|
240
240
|
Ke.displayName = "Ginger.Current.Year";
|
|
241
|
-
function Xe({ className: e, style: r, fallback: n, empty:
|
|
241
|
+
function Xe({ className: e, style: r, fallback: n, empty: t, children: a, preserveWhitespace: i = !0 }) {
|
|
242
242
|
var g;
|
|
243
|
-
const o = I(), u = ((g = V(o)) == null ? void 0 : g.lyrics) ?? "",
|
|
244
|
-
if (!
|
|
245
|
-
const m =
|
|
243
|
+
const o = I(), u = ((g = V(o)) == null ? void 0 : g.lyrics) ?? "", l = i ? u.replace(/^\s+|\s+$/g, "") : u.trim();
|
|
244
|
+
if (!l) {
|
|
245
|
+
const m = t ?? n ?? null;
|
|
246
246
|
return m ? /* @__PURE__ */ d("span", { className: e, style: r, children: m }) : null;
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
return
|
|
248
|
+
const s = i ? { whiteSpace: "pre-wrap" } : void 0;
|
|
249
|
+
return a ? /* @__PURE__ */ d("span", { className: e, style: { ...s, ...r }, children: a(l, o) }) : /* @__PURE__ */ d("span", { className: e, style: { ...s, ...r }, children: l });
|
|
250
250
|
}
|
|
251
251
|
Xe.displayName = "Ginger.Current.Lyrics";
|
|
252
252
|
const Ve = /\[(\d{1,2}):(\d{2})(?:\.(\d{1,3}))?\]/g;
|
|
253
253
|
function on(e) {
|
|
254
254
|
const r = [];
|
|
255
255
|
for (const n of e.split(/\r?\n/)) {
|
|
256
|
-
const
|
|
257
|
-
if (
|
|
258
|
-
const
|
|
259
|
-
for (const i of
|
|
260
|
-
const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0),
|
|
261
|
-
Number.isFinite(
|
|
256
|
+
const t = [...n.matchAll(Ve)];
|
|
257
|
+
if (t.length === 0) continue;
|
|
258
|
+
const a = n.replace(Ve, "").trim();
|
|
259
|
+
for (const i of t) {
|
|
260
|
+
const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0), l = Number((i[3] ?? "0").padEnd(3, "0")), s = o * 60 + u + l / 1e3;
|
|
261
|
+
Number.isFinite(s) && s >= 0 && r.push({ time: s, text: a });
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
return r.sort((n,
|
|
264
|
+
return r.sort((n, t) => n.time - t.time);
|
|
265
265
|
}
|
|
266
266
|
function un() {
|
|
267
|
-
const { tracks: e, currentIndex: r } = _(), { currentTime: n } = j(),
|
|
268
|
-
for (let o =
|
|
269
|
-
if (n >=
|
|
267
|
+
const { tracks: e, currentIndex: r } = _(), { currentTime: n } = j(), t = e[r], a = P(() => t ? Array.isArray(t.lyricsTimed) && t.lyricsTimed.length > 0 ? [...t.lyricsTimed].filter((o) => Number.isFinite(o.time) && o.time >= 0).sort((o, u) => o.time - u.time) : typeof t.lyrics == "string" ? on(t.lyrics) : [] : [], [t]), i = P(() => {
|
|
268
|
+
for (let o = a.length - 1; o >= 0; o -= 1)
|
|
269
|
+
if (n >= a[o].time) return o;
|
|
270
270
|
return -1;
|
|
271
|
-
}, [n,
|
|
271
|
+
}, [n, a]);
|
|
272
272
|
return {
|
|
273
|
-
lines:
|
|
273
|
+
lines: a,
|
|
274
274
|
activeIndex: i,
|
|
275
|
-
activeLine: i >= 0 ?
|
|
275
|
+
activeLine: i >= 0 ? a[i] ?? null : null
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
278
|
function ze({
|
|
279
279
|
className: e,
|
|
280
280
|
style: r,
|
|
281
281
|
fallback: n,
|
|
282
|
-
empty:
|
|
283
|
-
unstyled:
|
|
282
|
+
empty: t,
|
|
283
|
+
unstyled: a = !1,
|
|
284
284
|
activeClassName: i,
|
|
285
285
|
lineClassName: o,
|
|
286
286
|
children: u
|
|
287
287
|
}) {
|
|
288
|
-
const
|
|
289
|
-
if (
|
|
290
|
-
const y =
|
|
288
|
+
const l = I(), { lines: s, activeIndex: g } = un();
|
|
289
|
+
if (s.length === 0) {
|
|
290
|
+
const y = t ?? n ?? null;
|
|
291
291
|
return y ? /* @__PURE__ */ d("span", { className: e, style: r, children: y }) : null;
|
|
292
292
|
}
|
|
293
|
-
return /* @__PURE__ */ d("ul", { className: e, style: { ...
|
|
293
|
+
return /* @__PURE__ */ d("ul", { className: e, style: { ...a ? {} : {
|
|
294
294
|
listStyle: "none",
|
|
295
295
|
margin: 0,
|
|
296
296
|
padding: 0,
|
|
297
297
|
fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
|
|
298
298
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
299
299
|
color: "var(--ginger-primary-color, #111827)"
|
|
300
|
-
}, ...r }, "aria-label": "Synced lyrics", children:
|
|
300
|
+
}, ...r }, "aria-label": "Synced lyrics", children: s.map((y, k) => {
|
|
301
301
|
const b = k === g;
|
|
302
302
|
return /* @__PURE__ */ d(
|
|
303
303
|
"li",
|
|
@@ -305,12 +305,12 @@ function ze({
|
|
|
305
305
|
"aria-current": b ? "true" : void 0,
|
|
306
306
|
"data-ginger-active": b || void 0,
|
|
307
307
|
className: [o, b ? i : void 0].filter(Boolean).join(" ") || void 0,
|
|
308
|
-
style:
|
|
308
|
+
style: a ? void 0 : {
|
|
309
309
|
padding: "var(--ginger-playlist-row-padding, 4px 8px)",
|
|
310
310
|
fontWeight: b ? 600 : 400,
|
|
311
311
|
opacity: b ? 1 : 0.75
|
|
312
312
|
},
|
|
313
|
-
children: u ? u(y, k, b,
|
|
313
|
+
children: u ? u(y, k, b, l) : y.text
|
|
314
314
|
},
|
|
315
315
|
`${y.time}-${k}`
|
|
316
316
|
);
|
|
@@ -318,22 +318,22 @@ function ze({
|
|
|
318
318
|
}
|
|
319
319
|
ze.displayName = "Ginger.Current.LyricsSynced";
|
|
320
320
|
function sn() {
|
|
321
|
-
const { tracks: e, currentIndex: r } = _(), { currentTime: n, seek:
|
|
321
|
+
const { tracks: e, currentIndex: r } = _(), { currentTime: n, seek: t } = j(), a = P(() => {
|
|
322
322
|
var u;
|
|
323
|
-
return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((
|
|
323
|
+
return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((l) => l && Number.isFinite(l.startSeconds) && l.startSeconds >= 0).sort((l, s) => l.startSeconds - s.startSeconds);
|
|
324
324
|
}, [r, e]), i = P(() => {
|
|
325
|
-
if (
|
|
326
|
-
for (let o =
|
|
327
|
-
if (n >=
|
|
325
|
+
if (a.length === 0) return -1;
|
|
326
|
+
for (let o = a.length - 1; o >= 0; o -= 1)
|
|
327
|
+
if (n >= a[o].startSeconds) return o;
|
|
328
328
|
return -1;
|
|
329
|
-
}, [n,
|
|
329
|
+
}, [n, a]);
|
|
330
330
|
return {
|
|
331
|
-
list:
|
|
331
|
+
list: a,
|
|
332
332
|
activeIndex: i,
|
|
333
|
-
active: i >= 0 ?
|
|
333
|
+
active: i >= 0 ? a[i] ?? null : null,
|
|
334
334
|
seekTo: (o) => {
|
|
335
|
-
const u =
|
|
336
|
-
u &&
|
|
335
|
+
const u = a[o];
|
|
336
|
+
u && t(u.startSeconds);
|
|
337
337
|
}
|
|
338
338
|
};
|
|
339
339
|
}
|
|
@@ -346,25 +346,25 @@ function We({
|
|
|
346
346
|
className: e,
|
|
347
347
|
style: r,
|
|
348
348
|
fallback: n,
|
|
349
|
-
empty:
|
|
350
|
-
unstyled:
|
|
349
|
+
empty: t,
|
|
350
|
+
unstyled: a = !1,
|
|
351
351
|
formatStart: i = z,
|
|
352
352
|
children: o
|
|
353
353
|
}) {
|
|
354
|
-
const u = I(), { list:
|
|
355
|
-
if (
|
|
356
|
-
const y =
|
|
354
|
+
const u = I(), { list: l, activeIndex: s, seekTo: g } = sn();
|
|
355
|
+
if (l.length === 0) {
|
|
356
|
+
const y = t ?? n ?? null;
|
|
357
357
|
return y ? /* @__PURE__ */ d("span", { className: e, style: r, children: y }) : null;
|
|
358
358
|
}
|
|
359
|
-
return /* @__PURE__ */ d("ul", { className: e, style: { ...
|
|
359
|
+
return /* @__PURE__ */ d("ul", { className: e, style: { ...a ? {} : {
|
|
360
360
|
listStyle: "none",
|
|
361
361
|
margin: 0,
|
|
362
362
|
padding: 0,
|
|
363
363
|
fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
|
|
364
364
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
365
365
|
color: "var(--ginger-primary-color, #111827)"
|
|
366
|
-
}, ...r }, "aria-label": "Chapters", children:
|
|
367
|
-
const b = k ===
|
|
366
|
+
}, ...r }, "aria-label": "Chapters", children: l.map((y, k) => {
|
|
367
|
+
const b = k === s;
|
|
368
368
|
return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d(
|
|
369
369
|
"button",
|
|
370
370
|
{
|
|
@@ -373,16 +373,16 @@ function We({
|
|
|
373
373
|
"data-ginger-active": b || void 0,
|
|
374
374
|
onClick: () => g(k),
|
|
375
375
|
style: {
|
|
376
|
-
width:
|
|
377
|
-
textAlign:
|
|
378
|
-
border:
|
|
379
|
-
background:
|
|
380
|
-
color:
|
|
381
|
-
font:
|
|
382
|
-
cursor:
|
|
383
|
-
padding:
|
|
376
|
+
width: a ? void 0 : "100%",
|
|
377
|
+
textAlign: a ? void 0 : "left",
|
|
378
|
+
border: a ? void 0 : "none",
|
|
379
|
+
background: a ? void 0 : b ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
|
|
380
|
+
color: a ? void 0 : "inherit",
|
|
381
|
+
font: a ? void 0 : "inherit",
|
|
382
|
+
cursor: a ? void 0 : "pointer",
|
|
383
|
+
padding: a ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)"
|
|
384
384
|
},
|
|
385
|
-
children: o ? o(y, k, b, u) : /* @__PURE__ */
|
|
385
|
+
children: o ? o(y, k, b, u) : /* @__PURE__ */ q("span", { children: [
|
|
386
386
|
/* @__PURE__ */ d("span", { style: { opacity: 0.75, marginRight: "0.35em" }, children: i(y.startSeconds) }),
|
|
387
387
|
y.title
|
|
388
388
|
] })
|
|
@@ -391,14 +391,14 @@ function We({
|
|
|
391
391
|
}) });
|
|
392
392
|
}
|
|
393
393
|
We.displayName = "Ginger.Current.Chapters";
|
|
394
|
-
function qe({ visible: e = !1, className: r, style: n, fallback:
|
|
395
|
-
var
|
|
394
|
+
function qe({ visible: e = !1, className: r, style: n, fallback: t, empty: a, children: i }) {
|
|
395
|
+
var l;
|
|
396
396
|
const o = I();
|
|
397
397
|
if (!e) return null;
|
|
398
|
-
const u = ((
|
|
398
|
+
const u = ((l = V(o)) == null ? void 0 : l.fileUrl) ?? "";
|
|
399
399
|
if (!u) {
|
|
400
|
-
const
|
|
401
|
-
return
|
|
400
|
+
const s = a ?? t ?? null;
|
|
401
|
+
return s ? /* @__PURE__ */ d("span", { className: r, style: n, children: s }) : null;
|
|
402
402
|
}
|
|
403
403
|
return i ? /* @__PURE__ */ d("span", { className: r, style: n, children: i(u, o) }) : /* @__PURE__ */ d("span", { className: r, style: n, children: u });
|
|
404
404
|
}
|
|
@@ -407,17 +407,17 @@ function Je({
|
|
|
407
407
|
className: e,
|
|
408
408
|
style: r,
|
|
409
409
|
fallback: n,
|
|
410
|
-
empty:
|
|
411
|
-
sizes:
|
|
410
|
+
empty: t,
|
|
411
|
+
sizes: a,
|
|
412
412
|
loading: i,
|
|
413
413
|
onError: o,
|
|
414
414
|
decoding: u,
|
|
415
|
-
unstyled:
|
|
416
|
-
imgStyle:
|
|
415
|
+
unstyled: l = !1,
|
|
416
|
+
imgStyle: s
|
|
417
417
|
}) {
|
|
418
418
|
const g = I(), m = V(g), y = Xr(g);
|
|
419
419
|
if (!y) {
|
|
420
|
-
const b =
|
|
420
|
+
const b = t ?? n ?? null;
|
|
421
421
|
return b ? /* @__PURE__ */ d("span", { className: e, style: r, children: b }) : null;
|
|
422
422
|
}
|
|
423
423
|
const k = [m == null ? void 0 : m.title, m == null ? void 0 : m.artist].filter(Boolean).join(" — ") || "Artwork";
|
|
@@ -425,7 +425,7 @@ function Je({
|
|
|
425
425
|
"div",
|
|
426
426
|
{
|
|
427
427
|
className: e,
|
|
428
|
-
style:
|
|
428
|
+
style: l ? { ...r } : {
|
|
429
429
|
background: "var(--ginger-artwork-bg, transparent)",
|
|
430
430
|
borderRadius: "var(--ginger-artwork-radius, 0)",
|
|
431
431
|
overflow: "hidden",
|
|
@@ -436,16 +436,16 @@ function Je({
|
|
|
436
436
|
{
|
|
437
437
|
src: y,
|
|
438
438
|
alt: k,
|
|
439
|
-
sizes:
|
|
439
|
+
sizes: a,
|
|
440
440
|
loading: i,
|
|
441
441
|
decoding: u,
|
|
442
442
|
onError: o,
|
|
443
443
|
style: {
|
|
444
|
-
display:
|
|
445
|
-
width:
|
|
446
|
-
height:
|
|
447
|
-
objectFit:
|
|
448
|
-
...
|
|
444
|
+
display: l ? void 0 : "block",
|
|
445
|
+
width: l ? void 0 : "100%",
|
|
446
|
+
height: l ? void 0 : "100%",
|
|
447
|
+
objectFit: l ? void 0 : "cover",
|
|
448
|
+
...s
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
)
|
|
@@ -453,51 +453,51 @@ function Je({
|
|
|
453
453
|
);
|
|
454
454
|
}
|
|
455
455
|
Je.displayName = "Ginger.Current.Artwork";
|
|
456
|
-
function Ze({ base: e = 0, className: r, style: n, fallback:
|
|
456
|
+
function Ze({ base: e = 0, className: r, style: n, fallback: t, empty: a, children: i }) {
|
|
457
457
|
const o = I();
|
|
458
458
|
if (o.tracks.length === 0) {
|
|
459
|
-
const
|
|
460
|
-
return
|
|
459
|
+
const s = a ?? t ?? null;
|
|
460
|
+
return s ? /* @__PURE__ */ d("span", { className: r, style: n, children: s }) : null;
|
|
461
461
|
}
|
|
462
|
-
const
|
|
463
|
-
return i ? /* @__PURE__ */ d("span", { className: r, style: n, children: i(
|
|
462
|
+
const l = String(o.currentIndex + e);
|
|
463
|
+
return i ? /* @__PURE__ */ d("span", { className: r, style: n, children: i(l, o) }) : /* @__PURE__ */ d("span", { className: r, style: n, children: l });
|
|
464
464
|
}
|
|
465
465
|
Ze.displayName = "Ginger.Current.QueueIndex";
|
|
466
|
-
function er({ className: e, style: r, fallback: n, empty:
|
|
466
|
+
function er({ className: e, style: r, fallback: n, empty: t, children: a }) {
|
|
467
467
|
const i = I(), o = String(i.tracks.length);
|
|
468
468
|
if (i.tracks.length === 0) {
|
|
469
|
-
const u =
|
|
469
|
+
const u = t ?? n ?? null;
|
|
470
470
|
return u ? /* @__PURE__ */ d("span", { className: e, style: r, children: u }) : null;
|
|
471
471
|
}
|
|
472
|
-
return
|
|
472
|
+
return a ? /* @__PURE__ */ d("span", { className: e, style: r, children: a(o, i) }) : /* @__PURE__ */ d("span", { className: e, style: r, children: o });
|
|
473
473
|
}
|
|
474
474
|
er.displayName = "Ginger.Current.QueueLength";
|
|
475
475
|
function rr({
|
|
476
476
|
base: e = 0,
|
|
477
477
|
separator: r = " / ",
|
|
478
478
|
className: n,
|
|
479
|
-
style:
|
|
480
|
-
fallback:
|
|
479
|
+
style: t,
|
|
480
|
+
fallback: a,
|
|
481
481
|
empty: i,
|
|
482
482
|
children: o
|
|
483
483
|
}) {
|
|
484
|
-
const u = I(),
|
|
485
|
-
if (
|
|
486
|
-
const y = i ??
|
|
487
|
-
return y ? /* @__PURE__ */ d("span", { className: n, style:
|
|
484
|
+
const u = I(), l = u.tracks.length;
|
|
485
|
+
if (l === 0) {
|
|
486
|
+
const y = i ?? a ?? null;
|
|
487
|
+
return y ? /* @__PURE__ */ d("span", { className: n, style: t, children: y }) : null;
|
|
488
488
|
}
|
|
489
|
-
const
|
|
490
|
-
return o ? /* @__PURE__ */ d("span", { className: n, style:
|
|
489
|
+
const s = String(u.currentIndex + e), g = String(l), m = `${s}${r}${g}`;
|
|
490
|
+
return o ? /* @__PURE__ */ d("span", { className: n, style: t, children: o({ index: s, length: g, label: m }, u) }) : /* @__PURE__ */ d("span", { className: n, style: t, children: m });
|
|
491
491
|
}
|
|
492
492
|
rr.displayName = "Ginger.Current.QueuePosition";
|
|
493
493
|
function we(e, r, n) {
|
|
494
|
-
const { className:
|
|
494
|
+
const { className: t, style: a, fallback: i, empty: o, children: u, format: l = z } = n;
|
|
495
495
|
if (!(e >= 0) || !Number.isFinite(e)) {
|
|
496
496
|
const g = o ?? i ?? null;
|
|
497
|
-
return g ? /* @__PURE__ */ d("span", { className:
|
|
497
|
+
return g ? /* @__PURE__ */ d("span", { className: t, style: a, children: g }) : null;
|
|
498
498
|
}
|
|
499
|
-
const
|
|
500
|
-
return u ? /* @__PURE__ */ d("span", { className:
|
|
499
|
+
const s = l(e);
|
|
500
|
+
return u ? /* @__PURE__ */ d("span", { className: t, style: a, children: u(s, r) }) : /* @__PURE__ */ d("span", { className: t, style: a, children: s });
|
|
501
501
|
}
|
|
502
502
|
function nr(e) {
|
|
503
503
|
const r = I();
|
|
@@ -506,7 +506,7 @@ function nr(e) {
|
|
|
506
506
|
nr.displayName = "Ginger.Current.Elapsed";
|
|
507
507
|
function tr(e) {
|
|
508
508
|
const r = I();
|
|
509
|
-
return we(
|
|
509
|
+
return we(J(r), r, e);
|
|
510
510
|
}
|
|
511
511
|
tr.displayName = "Ginger.Current.Duration";
|
|
512
512
|
function ar(e) {
|
|
@@ -514,28 +514,28 @@ function ar(e) {
|
|
|
514
514
|
return we(Kr(r), r, e);
|
|
515
515
|
}
|
|
516
516
|
ar.displayName = "Ginger.Current.Remaining";
|
|
517
|
-
function ir({ className: e, style: r, fallback: n, empty:
|
|
518
|
-
const i = I(), o =
|
|
517
|
+
function ir({ className: e, style: r, fallback: n, empty: t, children: a }) {
|
|
518
|
+
const i = I(), o = J(i), u = je(i);
|
|
519
519
|
if (!(o > 0)) {
|
|
520
|
-
const
|
|
521
|
-
return
|
|
520
|
+
const l = t ?? n ?? null;
|
|
521
|
+
return l ? /* @__PURE__ */ d("span", { className: e, style: r, children: l }) : null;
|
|
522
522
|
}
|
|
523
|
-
return
|
|
523
|
+
return a ? /* @__PURE__ */ d("span", { className: e, style: r, children: a({ fraction: u, currentTime: i.currentTime, duration: o }, i) }) : /* @__PURE__ */ d("span", { className: e, style: r, children: `${Math.round(u * 100)}%` });
|
|
524
524
|
}
|
|
525
525
|
ir.displayName = "Ginger.Current.Progress";
|
|
526
526
|
function or({
|
|
527
527
|
className: e,
|
|
528
528
|
style: r,
|
|
529
529
|
height: n = 4,
|
|
530
|
-
showBuffered:
|
|
531
|
-
unstyled:
|
|
530
|
+
showBuffered: t = !1,
|
|
531
|
+
unstyled: a = !1
|
|
532
532
|
}) {
|
|
533
533
|
const i = I(), o = `${Math.round(je(i) * 100)}%`, u = `${Math.round(Math.min(1, Math.max(0, i.bufferedFraction)) * 100)}%`;
|
|
534
|
-
return /* @__PURE__ */
|
|
534
|
+
return /* @__PURE__ */ q(
|
|
535
535
|
"div",
|
|
536
536
|
{
|
|
537
537
|
className: e,
|
|
538
|
-
style:
|
|
538
|
+
style: a ? { ...r } : {
|
|
539
539
|
width: "100%",
|
|
540
540
|
height: n,
|
|
541
541
|
background: "var(--ginger-muted-color, #e5e7eb)",
|
|
@@ -546,16 +546,16 @@ function or({
|
|
|
546
546
|
},
|
|
547
547
|
"aria-hidden": !0,
|
|
548
548
|
children: [
|
|
549
|
-
|
|
549
|
+
t ? /* @__PURE__ */ d(
|
|
550
550
|
"div",
|
|
551
551
|
{
|
|
552
552
|
style: {
|
|
553
|
-
position:
|
|
554
|
-
left:
|
|
555
|
-
top:
|
|
556
|
-
height:
|
|
553
|
+
position: a ? void 0 : "absolute",
|
|
554
|
+
left: a ? void 0 : 0,
|
|
555
|
+
top: a ? void 0 : 0,
|
|
556
|
+
height: a ? void 0 : "100%",
|
|
557
557
|
width: u,
|
|
558
|
-
background:
|
|
558
|
+
background: a ? void 0 : "var(--ginger-buffer-color, rgba(107, 114, 128, 0.35))"
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
) : null,
|
|
@@ -563,10 +563,10 @@ function or({
|
|
|
563
563
|
"div",
|
|
564
564
|
{
|
|
565
565
|
style: {
|
|
566
|
-
position:
|
|
566
|
+
position: a ? void 0 : "relative",
|
|
567
567
|
width: o,
|
|
568
|
-
height:
|
|
569
|
-
background:
|
|
568
|
+
height: a ? void 0 : "100%",
|
|
569
|
+
background: a ? void 0 : "var(--ginger-primary-color, #111827)"
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
)
|
|
@@ -575,13 +575,13 @@ function or({
|
|
|
575
575
|
);
|
|
576
576
|
}
|
|
577
577
|
or.displayName = "Ginger.Current.TimeRail";
|
|
578
|
-
function ur({ className: e, style: r, height: n = 4, unstyled:
|
|
579
|
-
const
|
|
578
|
+
function ur({ className: e, style: r, height: n = 4, unstyled: t = !1 }) {
|
|
579
|
+
const a = I(), i = `${Math.round(Math.min(1, Math.max(0, a.bufferedFraction)) * 100)}%`;
|
|
580
580
|
return /* @__PURE__ */ d(
|
|
581
581
|
"div",
|
|
582
582
|
{
|
|
583
583
|
className: e,
|
|
584
|
-
style:
|
|
584
|
+
style: t ? { ...r } : {
|
|
585
585
|
width: "100%",
|
|
586
586
|
height: n,
|
|
587
587
|
background: "var(--ginger-muted-color, #e5e7eb)",
|
|
@@ -595,8 +595,8 @@ function ur({ className: e, style: r, height: n = 4, unstyled: a = !1 }) {
|
|
|
595
595
|
{
|
|
596
596
|
style: {
|
|
597
597
|
width: i,
|
|
598
|
-
height:
|
|
599
|
-
background:
|
|
598
|
+
height: t ? void 0 : "100%",
|
|
599
|
+
background: t ? void 0 : "var(--ginger-buffer-color, rgba(107, 114, 128, 0.35))"
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
)
|
|
@@ -604,21 +604,21 @@ function ur({ className: e, style: r, height: n = 4, unstyled: a = !1 }) {
|
|
|
604
604
|
);
|
|
605
605
|
}
|
|
606
606
|
ur.displayName = "Ginger.Current.BufferRail";
|
|
607
|
-
function sr({ className: e, style: r, fallback: n, empty:
|
|
607
|
+
function sr({ className: e, style: r, fallback: n, empty: t, children: a }) {
|
|
608
608
|
const i = I(), o = He(i);
|
|
609
|
-
return
|
|
609
|
+
return a ? /* @__PURE__ */ d("span", { className: e, style: r, children: a(o, i) }) : /* @__PURE__ */ d("span", { className: e, style: r, children: o });
|
|
610
610
|
}
|
|
611
611
|
sr.displayName = "Ginger.Current.PlaybackState";
|
|
612
|
-
function lr({ className: e, style: r, fallback: n, empty:
|
|
612
|
+
function lr({ className: e, style: r, fallback: n, empty: t, live: a = "polite", children: i }) {
|
|
613
613
|
const o = I(), u = o.errorMessage ?? "";
|
|
614
614
|
if (!u) {
|
|
615
|
-
const
|
|
616
|
-
return
|
|
615
|
+
const l = t ?? n ?? null;
|
|
616
|
+
return l ? /* @__PURE__ */ d("span", { className: e, style: r, children: l }) : null;
|
|
617
617
|
}
|
|
618
|
-
return i ? /* @__PURE__ */ d("span", { className: e, style: r, "aria-live":
|
|
618
|
+
return i ? /* @__PURE__ */ d("span", { className: e, style: r, "aria-live": a, children: i(u, o) }) : /* @__PURE__ */ d("span", { className: e, style: r, "aria-live": a, children: u });
|
|
619
619
|
}
|
|
620
620
|
lr.displayName = "Ginger.Current.ErrorMessage";
|
|
621
|
-
const
|
|
621
|
+
const Ee = {
|
|
622
622
|
seek: "Seek",
|
|
623
623
|
volume: "Volume",
|
|
624
624
|
playbackSpeed: "Playback speed",
|
|
@@ -639,12 +639,12 @@ const Ie = {
|
|
|
639
639
|
};
|
|
640
640
|
function ln(e) {
|
|
641
641
|
return e ? {
|
|
642
|
-
...
|
|
642
|
+
...Ee,
|
|
643
643
|
...e,
|
|
644
|
-
repeat: { ...
|
|
645
|
-
} :
|
|
644
|
+
repeat: { ...Ee.repeat, ...e.repeat }
|
|
645
|
+
} : Ee;
|
|
646
646
|
}
|
|
647
|
-
const cr = Ne(
|
|
647
|
+
const cr = Ne(Ee);
|
|
648
648
|
function cn({
|
|
649
649
|
locale: e,
|
|
650
650
|
children: r
|
|
@@ -656,58 +656,58 @@ function N() {
|
|
|
656
656
|
return Ge(cr);
|
|
657
657
|
}
|
|
658
658
|
function dn() {
|
|
659
|
-
const e = _(), r = j(), n = N(),
|
|
660
|
-
r.seek(Number(
|
|
659
|
+
const e = _(), r = j(), n = N(), t = P(() => $e(e, r), [e, r]), a = J(t), i = a > 0 ? t.currentTime : 0, o = Number.isFinite(i) ? i : 0, u = a > 0 ? `${z(o)} of ${z(a)}` : z(o), l = (s) => {
|
|
660
|
+
r.seek(Number(s.currentTarget.value));
|
|
661
661
|
};
|
|
662
662
|
return {
|
|
663
|
-
state:
|
|
663
|
+
state: t,
|
|
664
664
|
value: o,
|
|
665
665
|
min: 0,
|
|
666
|
-
max:
|
|
666
|
+
max: a > 0 ? a : 1,
|
|
667
667
|
step: "any",
|
|
668
668
|
ariaValueText: u,
|
|
669
669
|
ariaLabel: n.seek,
|
|
670
|
-
onSeekInput:
|
|
671
|
-
onSeekChange:
|
|
670
|
+
onSeekInput: l,
|
|
671
|
+
onSeekChange: l
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
674
|
function fn() {
|
|
675
|
-
const e = _(), r = j(), n = N(),
|
|
675
|
+
const e = _(), r = j(), n = N(), t = P(() => $e(e, r), [e, r]), a = (i) => {
|
|
676
676
|
r.setVolume(Number(i.currentTarget.value));
|
|
677
677
|
};
|
|
678
678
|
return {
|
|
679
|
-
state:
|
|
680
|
-
value:
|
|
679
|
+
state: t,
|
|
680
|
+
value: t.volume,
|
|
681
681
|
min: 0,
|
|
682
682
|
max: 1,
|
|
683
683
|
step: "any",
|
|
684
|
-
ariaValueText: `${Math.round(
|
|
684
|
+
ariaValueText: `${Math.round(t.volume * 100)}%`,
|
|
685
685
|
ariaLabel: n.volume,
|
|
686
|
-
onVolumeInput:
|
|
687
|
-
onVolumeChange:
|
|
686
|
+
onVolumeInput: a,
|
|
687
|
+
onVolumeChange: a
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
690
|
function pn(e) {
|
|
691
|
-
const r = _(), n = N(),
|
|
691
|
+
const r = _(), n = N(), t = (e == null ? void 0 : e.playAriaLabel) ?? n.play, a = (e == null ? void 0 : e.pauseAriaLabel) ?? n.pause;
|
|
692
692
|
return {
|
|
693
693
|
isPaused: r.isPaused,
|
|
694
694
|
toggle: r.togglePlayPause,
|
|
695
|
-
ariaLabel: r.isPaused ?
|
|
695
|
+
ariaLabel: r.isPaused ? t : a
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
698
|
function dr({
|
|
699
699
|
playLabel: e = "Play",
|
|
700
700
|
pauseLabel: r = "Pause",
|
|
701
701
|
playAriaLabel: n,
|
|
702
|
-
pauseAriaLabel:
|
|
703
|
-
children:
|
|
702
|
+
pauseAriaLabel: t,
|
|
703
|
+
children: a,
|
|
704
704
|
type: i = "button",
|
|
705
705
|
onClick: o,
|
|
706
706
|
...u
|
|
707
707
|
}) {
|
|
708
|
-
const
|
|
709
|
-
playAriaLabel: n ??
|
|
710
|
-
pauseAriaLabel:
|
|
708
|
+
const l = N(), s = typeof e == "string" ? e : l.play, g = typeof r == "string" ? r : l.pause, m = pn({
|
|
709
|
+
playAriaLabel: n ?? s,
|
|
710
|
+
pauseAriaLabel: t ?? g
|
|
711
711
|
});
|
|
712
712
|
return /* @__PURE__ */ d(
|
|
713
713
|
"button",
|
|
@@ -718,23 +718,23 @@ function dr({
|
|
|
718
718
|
onClick: (y) => {
|
|
719
719
|
m.toggle(), o == null || o(y);
|
|
720
720
|
},
|
|
721
|
-
children:
|
|
721
|
+
children: a ?? (m.isPaused ? e : r)
|
|
722
722
|
}
|
|
723
723
|
);
|
|
724
724
|
}
|
|
725
725
|
dr.displayName = "Ginger.Control.PlayPause";
|
|
726
|
-
function fr({ type: e = "button", ariaLabel: r, onClick: n, ...a }) {
|
|
727
|
-
const { repeatMode:
|
|
726
|
+
function fr({ type: e = "button", ariaLabel: r, onClick: n, children: t, ...a }) {
|
|
727
|
+
const { repeatMode: i, cycleRepeat: o } = _(), l = N().repeat[i];
|
|
728
728
|
return /* @__PURE__ */ d(
|
|
729
729
|
"button",
|
|
730
730
|
{
|
|
731
731
|
...a,
|
|
732
732
|
type: e,
|
|
733
|
-
"aria-label": r ??
|
|
733
|
+
"aria-label": r ?? l,
|
|
734
734
|
onClick: (s) => {
|
|
735
|
-
|
|
735
|
+
o(), n == null || n(s);
|
|
736
736
|
},
|
|
737
|
-
children:
|
|
737
|
+
children: t ?? l
|
|
738
738
|
}
|
|
739
739
|
);
|
|
740
740
|
}
|
|
@@ -743,20 +743,20 @@ function pr({
|
|
|
743
743
|
type: e = "button",
|
|
744
744
|
children: r = "Next",
|
|
745
745
|
ariaLabel: n,
|
|
746
|
-
onClick:
|
|
747
|
-
...
|
|
746
|
+
onClick: t,
|
|
747
|
+
...a
|
|
748
748
|
}) {
|
|
749
749
|
const { next: i } = _(), o = N();
|
|
750
750
|
return /* @__PURE__ */ d(
|
|
751
751
|
"button",
|
|
752
752
|
{
|
|
753
|
-
...
|
|
753
|
+
...a,
|
|
754
754
|
type: e,
|
|
755
755
|
"aria-label": n ?? o.nextTrack,
|
|
756
756
|
onClick: (u) => {
|
|
757
|
-
i(),
|
|
757
|
+
i(), t == null || t(u);
|
|
758
758
|
},
|
|
759
|
-
children: r
|
|
759
|
+
children: r ?? o.previousTrack
|
|
760
760
|
}
|
|
761
761
|
);
|
|
762
762
|
}
|
|
@@ -765,18 +765,18 @@ function gr({
|
|
|
765
765
|
type: e = "button",
|
|
766
766
|
children: r = "Previous",
|
|
767
767
|
ariaLabel: n,
|
|
768
|
-
onClick:
|
|
769
|
-
...
|
|
768
|
+
onClick: t,
|
|
769
|
+
...a
|
|
770
770
|
}) {
|
|
771
771
|
const { prev: i } = _(), o = N();
|
|
772
772
|
return /* @__PURE__ */ d(
|
|
773
773
|
"button",
|
|
774
774
|
{
|
|
775
|
-
...
|
|
775
|
+
...a,
|
|
776
776
|
type: e,
|
|
777
777
|
"aria-label": n ?? o.previousTrack,
|
|
778
778
|
onClick: (u) => {
|
|
779
|
-
i(),
|
|
779
|
+
i(), t == null || t(u);
|
|
780
780
|
},
|
|
781
781
|
children: r
|
|
782
782
|
}
|
|
@@ -787,37 +787,37 @@ function mr({
|
|
|
787
787
|
type: e = "button",
|
|
788
788
|
children: r = "Shuffle",
|
|
789
789
|
ariaLabel: n,
|
|
790
|
-
onClick:
|
|
791
|
-
...
|
|
790
|
+
onClick: t,
|
|
791
|
+
...a
|
|
792
792
|
}) {
|
|
793
793
|
const { isShuffled: i, toggleShuffle: o } = _(), u = N();
|
|
794
794
|
return /* @__PURE__ */ d(
|
|
795
795
|
"button",
|
|
796
796
|
{
|
|
797
|
-
...
|
|
797
|
+
...a,
|
|
798
798
|
type: e,
|
|
799
799
|
"aria-pressed": i,
|
|
800
800
|
"aria-label": n ?? u.shuffle,
|
|
801
|
-
onClick: (
|
|
802
|
-
o(),
|
|
801
|
+
onClick: (l) => {
|
|
802
|
+
o(), t == null || t(l);
|
|
803
803
|
},
|
|
804
|
-
children: r
|
|
804
|
+
children: r ?? u.shuffle
|
|
805
805
|
}
|
|
806
806
|
);
|
|
807
807
|
}
|
|
808
808
|
mr.displayName = "Ginger.Control.Shuffle";
|
|
809
|
-
function yr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel:
|
|
809
|
+
function yr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: t, ...a }) {
|
|
810
810
|
const i = dn(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
811
811
|
return /* @__PURE__ */ d(
|
|
812
812
|
"input",
|
|
813
813
|
{
|
|
814
|
-
...
|
|
814
|
+
...a,
|
|
815
815
|
type: "range",
|
|
816
816
|
min: i.min,
|
|
817
817
|
max: i.max,
|
|
818
818
|
step: i.step,
|
|
819
819
|
value: i.value,
|
|
820
|
-
"aria-label":
|
|
820
|
+
"aria-label": t ?? i.ariaLabel,
|
|
821
821
|
"aria-valuetext": i.ariaValueText,
|
|
822
822
|
onInput: i.onSeekInput,
|
|
823
823
|
onChange: i.onSeekChange,
|
|
@@ -826,18 +826,18 @@ function yr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: a, ...t }) {
|
|
|
826
826
|
);
|
|
827
827
|
}
|
|
828
828
|
yr.displayName = "Ginger.Control.SeekBar";
|
|
829
|
-
function hr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel:
|
|
829
|
+
function hr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: t, ...a }) {
|
|
830
830
|
const i = fn(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
831
831
|
return /* @__PURE__ */ d(
|
|
832
832
|
"input",
|
|
833
833
|
{
|
|
834
|
-
...
|
|
834
|
+
...a,
|
|
835
835
|
type: "range",
|
|
836
836
|
min: i.min,
|
|
837
837
|
max: i.max,
|
|
838
838
|
step: i.step,
|
|
839
839
|
value: i.value,
|
|
840
|
-
"aria-label":
|
|
840
|
+
"aria-label": t ?? i.ariaLabel,
|
|
841
841
|
"aria-valuetext": i.ariaValueText,
|
|
842
842
|
onInput: i.onVolumeInput,
|
|
843
843
|
onChange: i.onVolumeChange,
|
|
@@ -850,22 +850,23 @@ function br({
|
|
|
850
850
|
ariaLabel: e,
|
|
851
851
|
muteLabel: r,
|
|
852
852
|
unmuteLabel: n,
|
|
853
|
-
type:
|
|
854
|
-
onClick:
|
|
855
|
-
|
|
853
|
+
type: t = "button",
|
|
854
|
+
onClick: a,
|
|
855
|
+
children: i,
|
|
856
|
+
...o
|
|
856
857
|
}) {
|
|
857
|
-
const { muted:
|
|
858
|
+
const { muted: u, toggleMute: l } = j(), s = N(), g = r ?? s.mute, m = n ?? s.unmute;
|
|
858
859
|
return /* @__PURE__ */ d(
|
|
859
860
|
"button",
|
|
860
861
|
{
|
|
861
|
-
...
|
|
862
|
-
type:
|
|
863
|
-
"aria-pressed":
|
|
864
|
-
"aria-label": e ?? (
|
|
865
|
-
onClick: (
|
|
866
|
-
|
|
862
|
+
...o,
|
|
863
|
+
type: t,
|
|
864
|
+
"aria-pressed": u,
|
|
865
|
+
"aria-label": e ?? (u ? s.unmute : s.mute),
|
|
866
|
+
onClick: (y) => {
|
|
867
|
+
l(), a == null || a(y);
|
|
867
868
|
},
|
|
868
|
-
children:
|
|
869
|
+
children: i ?? (u ? m : g)
|
|
869
870
|
}
|
|
870
871
|
);
|
|
871
872
|
}
|
|
@@ -875,21 +876,25 @@ function vr({
|
|
|
875
876
|
rates: e = gn,
|
|
876
877
|
style: r,
|
|
877
878
|
ariaLabel: n,
|
|
879
|
+
children: t,
|
|
878
880
|
...a
|
|
879
881
|
}) {
|
|
880
|
-
const { playbackRate:
|
|
881
|
-
() => Array.from(/* @__PURE__ */ new Set([...e,
|
|
882
|
-
[e,
|
|
882
|
+
const { playbackRate: i, setPlaybackRate: o } = j(), u = N(), l = P(
|
|
883
|
+
() => Array.from(/* @__PURE__ */ new Set([...e, i])).sort((s, g) => s - g),
|
|
884
|
+
[e, i]
|
|
883
885
|
);
|
|
884
|
-
return /* @__PURE__ */
|
|
886
|
+
return /* @__PURE__ */ q(
|
|
885
887
|
"select",
|
|
886
888
|
{
|
|
887
889
|
...a,
|
|
888
|
-
"aria-label": n ??
|
|
889
|
-
value: String(
|
|
890
|
+
"aria-label": n ?? u.playbackSpeed,
|
|
891
|
+
value: String(i),
|
|
890
892
|
style: r,
|
|
891
|
-
onChange: (s) =>
|
|
892
|
-
children:
|
|
893
|
+
onChange: (s) => o(Number(s.currentTarget.value)),
|
|
894
|
+
children: [
|
|
895
|
+
t ?? u.playbackSpeed,
|
|
896
|
+
l.map((s) => /* @__PURE__ */ d("option", { value: String(s), children: s === 1 ? u.playbackRateNormal : u.playbackRateTimes(s) }, s))
|
|
897
|
+
]
|
|
893
898
|
}
|
|
894
899
|
);
|
|
895
900
|
}
|
|
@@ -905,12 +910,12 @@ function kr({
|
|
|
905
910
|
children: e,
|
|
906
911
|
unstyled: r = !1,
|
|
907
912
|
rowStyle: n,
|
|
908
|
-
renderTrack:
|
|
909
|
-
playOnSelect:
|
|
913
|
+
renderTrack: t,
|
|
914
|
+
playOnSelect: a = !0,
|
|
910
915
|
style: i,
|
|
911
916
|
...o
|
|
912
917
|
}) {
|
|
913
|
-
const { tracks: u, currentIndex:
|
|
918
|
+
const { tracks: u, currentIndex: l, playTrackAt: s, selectTrackAt: g } = _(), m = r ? { ...i } : {
|
|
914
919
|
listStyle: "none",
|
|
915
920
|
margin: 0,
|
|
916
921
|
padding: 0,
|
|
@@ -919,14 +924,14 @@ function kr({
|
|
|
919
924
|
color: "var(--ginger-primary-color, #111827)",
|
|
920
925
|
...i
|
|
921
926
|
};
|
|
922
|
-
return e !== void 0 ? /* @__PURE__ */ d(_e.Provider, { value: { playOnSelect:
|
|
923
|
-
const S = b ===
|
|
927
|
+
return e !== void 0 ? /* @__PURE__ */ d(_e.Provider, { value: { playOnSelect: a }, children: /* @__PURE__ */ d("ul", { style: m, ...o, children: e }) }) : /* @__PURE__ */ d(_e.Provider, { value: { playOnSelect: a }, children: /* @__PURE__ */ d("ul", { style: m, ...o, children: u.map((k, b) => {
|
|
928
|
+
const S = b === l;
|
|
924
929
|
return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d(
|
|
925
930
|
"button",
|
|
926
931
|
{
|
|
927
932
|
type: "button",
|
|
928
933
|
onClick: () => {
|
|
929
|
-
|
|
934
|
+
a ? s(b) : g(b);
|
|
930
935
|
},
|
|
931
936
|
style: {
|
|
932
937
|
width: r ? void 0 : "100%",
|
|
@@ -939,7 +944,7 @@ function kr({
|
|
|
939
944
|
padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
|
|
940
945
|
...n
|
|
941
946
|
},
|
|
942
|
-
children:
|
|
947
|
+
children: t ? t(k, b, S) : /* @__PURE__ */ q("span", { children: [
|
|
943
948
|
k.title,
|
|
944
949
|
k.artist ? ` — ${k.artist}` : ""
|
|
945
950
|
] })
|
|
@@ -952,13 +957,13 @@ function Mr({
|
|
|
952
957
|
index: e,
|
|
953
958
|
unstyled: r = !1,
|
|
954
959
|
className: n,
|
|
955
|
-
style:
|
|
956
|
-
children:
|
|
960
|
+
style: t,
|
|
961
|
+
children: a,
|
|
957
962
|
liProps: i,
|
|
958
963
|
onClick: o,
|
|
959
964
|
...u
|
|
960
965
|
}) {
|
|
961
|
-
const { playOnSelect:
|
|
966
|
+
const { playOnSelect: l } = mn(), { tracks: s, currentIndex: g, playTrackAt: m, selectTrackAt: y } = _(), k = e === g, b = s[e], S = b != null ? /* @__PURE__ */ q("span", { children: [
|
|
962
967
|
b.title,
|
|
963
968
|
b.artist ? ` — ${b.artist}` : ""
|
|
964
969
|
] }) : null;
|
|
@@ -978,13 +983,13 @@ function Mr({
|
|
|
978
983
|
font: r ? void 0 : "inherit",
|
|
979
984
|
cursor: r ? void 0 : "pointer",
|
|
980
985
|
padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
|
|
981
|
-
...
|
|
986
|
+
...t
|
|
982
987
|
},
|
|
983
988
|
...u,
|
|
984
989
|
onClick: (p) => {
|
|
985
|
-
o == null || o(p), !p.defaultPrevented && (
|
|
990
|
+
o == null || o(p), !p.defaultPrevented && (l ? m(e) : y(e));
|
|
986
991
|
},
|
|
987
|
-
children:
|
|
992
|
+
children: a ?? S
|
|
988
993
|
}
|
|
989
994
|
) });
|
|
990
995
|
}
|
|
@@ -1004,19 +1009,19 @@ const yn = Object.assign(kr, {
|
|
|
1004
1009
|
var r;
|
|
1005
1010
|
return (r = e.playlistMeta) == null ? void 0 : r.copyright;
|
|
1006
1011
|
});
|
|
1007
|
-
function
|
|
1008
|
-
var
|
|
1009
|
-
const o = I(), u = (
|
|
1012
|
+
function Tr({ className: e, style: r, fallback: n, empty: t, unstyled: a = !1, imgStyle: i }) {
|
|
1013
|
+
var s, g;
|
|
1014
|
+
const o = I(), u = (s = o.playlistMeta) == null ? void 0 : s.artworkUrl;
|
|
1010
1015
|
if (!u) {
|
|
1011
|
-
const m =
|
|
1016
|
+
const m = t ?? n ?? null;
|
|
1012
1017
|
return m ? /* @__PURE__ */ d("span", { className: e, style: r, children: m }) : null;
|
|
1013
1018
|
}
|
|
1014
|
-
const
|
|
1019
|
+
const l = ((g = o.playlistMeta) == null ? void 0 : g.title) ?? "Playlist artwork";
|
|
1015
1020
|
return /* @__PURE__ */ d(
|
|
1016
1021
|
"span",
|
|
1017
1022
|
{
|
|
1018
1023
|
className: e,
|
|
1019
|
-
style:
|
|
1024
|
+
style: a ? { ...r } : {
|
|
1020
1025
|
display: "inline-block",
|
|
1021
1026
|
background: "var(--ginger-artwork-bg, #f3f4f6)",
|
|
1022
1027
|
borderRadius: "var(--ginger-artwork-radius, 6px)",
|
|
@@ -1027,12 +1032,12 @@ function xr({ className: e, style: r, fallback: n, empty: a, unstyled: t = !1, i
|
|
|
1027
1032
|
"img",
|
|
1028
1033
|
{
|
|
1029
1034
|
src: u,
|
|
1030
|
-
alt:
|
|
1035
|
+
alt: l,
|
|
1031
1036
|
style: {
|
|
1032
|
-
display:
|
|
1033
|
-
width:
|
|
1034
|
-
height:
|
|
1035
|
-
objectFit:
|
|
1037
|
+
display: a ? void 0 : "block",
|
|
1038
|
+
width: a ? void 0 : "100%",
|
|
1039
|
+
height: a ? void 0 : "100%",
|
|
1040
|
+
objectFit: a ? void 0 : "cover",
|
|
1036
1041
|
...i
|
|
1037
1042
|
}
|
|
1038
1043
|
}
|
|
@@ -1040,8 +1045,8 @@ function xr({ className: e, style: r, fallback: n, empty: a, unstyled: t = !1, i
|
|
|
1040
1045
|
}
|
|
1041
1046
|
);
|
|
1042
1047
|
}
|
|
1043
|
-
|
|
1044
|
-
function
|
|
1048
|
+
Tr.displayName = "Ginger.Queue.Artwork";
|
|
1049
|
+
function Ae(e) {
|
|
1045
1050
|
return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 1;
|
|
1046
1051
|
}
|
|
1047
1052
|
function Ce(e) {
|
|
@@ -1059,57 +1064,57 @@ const U = {
|
|
|
1059
1064
|
muted: !1,
|
|
1060
1065
|
playbackRate: 1
|
|
1061
1066
|
};
|
|
1062
|
-
function
|
|
1067
|
+
function xr(e) {
|
|
1063
1068
|
const r = [...e.tracks];
|
|
1064
|
-
let n = A(e.currentIndex ?? 0, r.length),
|
|
1065
|
-
return e.isShuffled && r.length > 1 && (
|
|
1066
|
-
tracks:
|
|
1069
|
+
let n = A(e.currentIndex ?? 0, r.length), t = null, a = r;
|
|
1070
|
+
return e.isShuffled && r.length > 1 && (t = [...r], a = Be(r, n), n = 0), {
|
|
1071
|
+
tracks: a,
|
|
1067
1072
|
currentIndex: n,
|
|
1068
1073
|
playbackMode: e.playbackMode ?? "playlist",
|
|
1069
1074
|
isPaused: e.isPaused ?? !0,
|
|
1070
|
-
isShuffled: !!(e.isShuffled &&
|
|
1075
|
+
isShuffled: !!(e.isShuffled && a.length > 1),
|
|
1071
1076
|
repeatMode: e.repeatMode ?? "off",
|
|
1072
|
-
originalTracks:
|
|
1077
|
+
originalTracks: t,
|
|
1073
1078
|
playlistMeta: e.playlistMeta ?? null,
|
|
1074
1079
|
...Mn,
|
|
1075
|
-
volume:
|
|
1080
|
+
volume: Ae(e.volume ?? 1),
|
|
1076
1081
|
muted: e.muted ?? !1,
|
|
1077
1082
|
playbackRate: Ce(e.playbackRate ?? 1)
|
|
1078
1083
|
};
|
|
1079
1084
|
}
|
|
1080
|
-
function
|
|
1085
|
+
function Tn(e, r) {
|
|
1081
1086
|
switch (r.type) {
|
|
1082
1087
|
case "INIT": {
|
|
1083
1088
|
const {
|
|
1084
1089
|
tracks: n,
|
|
1085
|
-
currentIndex:
|
|
1086
|
-
playlistMeta:
|
|
1090
|
+
currentIndex: t,
|
|
1091
|
+
playlistMeta: a,
|
|
1087
1092
|
isPaused: i,
|
|
1088
1093
|
isShuffled: o,
|
|
1089
1094
|
repeatMode: u,
|
|
1090
|
-
playbackMode:
|
|
1091
|
-
volume:
|
|
1095
|
+
playbackMode: l,
|
|
1096
|
+
volume: s,
|
|
1092
1097
|
muted: g,
|
|
1093
1098
|
playbackRate: m
|
|
1094
1099
|
} = r.payload;
|
|
1095
|
-
return
|
|
1100
|
+
return xr({
|
|
1096
1101
|
tracks: n,
|
|
1097
|
-
currentIndex:
|
|
1098
|
-
playlistMeta:
|
|
1102
|
+
currentIndex: t,
|
|
1103
|
+
playlistMeta: a ?? null,
|
|
1099
1104
|
isPaused: i ?? !0,
|
|
1100
1105
|
isShuffled: o ?? !1,
|
|
1101
1106
|
repeatMode: u ?? "off",
|
|
1102
|
-
playbackMode:
|
|
1103
|
-
volume:
|
|
1107
|
+
playbackMode: l ?? "playlist",
|
|
1108
|
+
volume: s,
|
|
1104
1109
|
muted: g,
|
|
1105
1110
|
playbackRate: m
|
|
1106
1111
|
});
|
|
1107
1112
|
}
|
|
1108
1113
|
case "SET_QUEUE": {
|
|
1109
|
-
const { tracks: n, currentIndex:
|
|
1114
|
+
const { tracks: n, currentIndex: t } = r.payload, a = [...n], i = A(t ?? e.currentIndex, a.length);
|
|
1110
1115
|
return {
|
|
1111
1116
|
...e,
|
|
1112
|
-
tracks:
|
|
1117
|
+
tracks: a,
|
|
1113
1118
|
currentIndex: i,
|
|
1114
1119
|
isShuffled: !1,
|
|
1115
1120
|
originalTracks: null,
|
|
@@ -1117,12 +1122,12 @@ function xn(e, r) {
|
|
|
1117
1122
|
};
|
|
1118
1123
|
}
|
|
1119
1124
|
case "INSERT_TRACK": {
|
|
1120
|
-
const n = r.payload.index ?? e.tracks.length,
|
|
1125
|
+
const n = r.payload.index ?? e.tracks.length, t = Ye(e.tracks, r.payload.track, n);
|
|
1121
1126
|
if (r.payload.autoPlay) {
|
|
1122
|
-
const i = A(n,
|
|
1127
|
+
const i = A(n, t.length);
|
|
1123
1128
|
return {
|
|
1124
1129
|
...e,
|
|
1125
|
-
tracks:
|
|
1130
|
+
tracks: t,
|
|
1126
1131
|
currentIndex: i,
|
|
1127
1132
|
isShuffled: !1,
|
|
1128
1133
|
originalTracks: null,
|
|
@@ -1130,35 +1135,35 @@ function xn(e, r) {
|
|
|
1130
1135
|
...U
|
|
1131
1136
|
};
|
|
1132
1137
|
}
|
|
1133
|
-
const
|
|
1138
|
+
const a = n <= e.currentIndex ? e.currentIndex + 1 : e.currentIndex;
|
|
1134
1139
|
return {
|
|
1135
1140
|
...e,
|
|
1136
|
-
tracks:
|
|
1141
|
+
tracks: t,
|
|
1137
1142
|
isShuffled: !1,
|
|
1138
1143
|
originalTracks: null,
|
|
1139
|
-
currentIndex: A(
|
|
1144
|
+
currentIndex: A(a, t.length)
|
|
1140
1145
|
};
|
|
1141
1146
|
}
|
|
1142
1147
|
case "REMOVE_TRACK": {
|
|
1143
|
-
const n = r.payload.index,
|
|
1148
|
+
const n = r.payload.index, t = Vr(e.tracks, n), a = n < e.currentIndex ? e.currentIndex - 1 : n === e.currentIndex ? Math.min(e.currentIndex, Math.max(0, t.length - 1)) : e.currentIndex;
|
|
1144
1149
|
return {
|
|
1145
1150
|
...e,
|
|
1146
|
-
tracks:
|
|
1151
|
+
tracks: t,
|
|
1147
1152
|
isShuffled: !1,
|
|
1148
1153
|
originalTracks: null,
|
|
1149
|
-
currentIndex: A(
|
|
1154
|
+
currentIndex: A(a, t.length),
|
|
1150
1155
|
...n === e.currentIndex ? U : {}
|
|
1151
1156
|
};
|
|
1152
1157
|
}
|
|
1153
1158
|
case "MOVE_TRACK": {
|
|
1154
|
-
const { fromIndex: n, toIndex:
|
|
1159
|
+
const { fromIndex: n, toIndex: t } = r.payload, a = $r(e.tracks, n, t);
|
|
1155
1160
|
let i = e.currentIndex;
|
|
1156
|
-
return e.currentIndex === n ? i =
|
|
1161
|
+
return e.currentIndex === n ? i = t : n < e.currentIndex && t >= e.currentIndex ? i -= 1 : n > e.currentIndex && t <= e.currentIndex && (i += 1), {
|
|
1157
1162
|
...e,
|
|
1158
|
-
tracks:
|
|
1163
|
+
tracks: a,
|
|
1159
1164
|
isShuffled: !1,
|
|
1160
1165
|
originalTracks: null,
|
|
1161
|
-
currentIndex: A(i,
|
|
1166
|
+
currentIndex: A(i, a.length)
|
|
1162
1167
|
};
|
|
1163
1168
|
}
|
|
1164
1169
|
case "ADD_NEXT": {
|
|
@@ -1171,12 +1176,12 @@ function xn(e, r) {
|
|
|
1171
1176
|
};
|
|
1172
1177
|
}
|
|
1173
1178
|
case "SET_INDEX": {
|
|
1174
|
-
const n = A(r.payload.index, e.tracks.length),
|
|
1179
|
+
const n = A(r.payload.index, e.tracks.length), t = r.payload.autoPlay, a = t === !0 ? !1 : t === !1 ? !0 : e.isPaused;
|
|
1175
1180
|
return {
|
|
1176
1181
|
...e,
|
|
1177
1182
|
currentIndex: n,
|
|
1178
1183
|
...U,
|
|
1179
|
-
isPaused:
|
|
1184
|
+
isPaused: a
|
|
1180
1185
|
};
|
|
1181
1186
|
}
|
|
1182
1187
|
case "PLAY":
|
|
@@ -1201,31 +1206,31 @@ function xn(e, r) {
|
|
|
1201
1206
|
currentIndex: 0
|
|
1202
1207
|
};
|
|
1203
1208
|
}
|
|
1204
|
-
const n = e.originalTracks ? [...e.originalTracks] : [...e.tracks],
|
|
1209
|
+
const n = e.originalTracks ? [...e.originalTracks] : [...e.tracks], t = e.tracks[e.currentIndex], a = Ur(n, t);
|
|
1205
1210
|
return {
|
|
1206
1211
|
...e,
|
|
1207
1212
|
isShuffled: !1,
|
|
1208
1213
|
originalTracks: null,
|
|
1209
1214
|
tracks: n,
|
|
1210
|
-
currentIndex: A(
|
|
1215
|
+
currentIndex: A(a, n.length)
|
|
1211
1216
|
};
|
|
1212
1217
|
}
|
|
1213
1218
|
case "NEXT": {
|
|
1214
|
-
const n = Yr(e),
|
|
1219
|
+
const n = Yr(e), t = n === e.currentIndex;
|
|
1215
1220
|
return {
|
|
1216
1221
|
...e,
|
|
1217
1222
|
currentIndex: n,
|
|
1218
|
-
...
|
|
1219
|
-
isPaused:
|
|
1223
|
+
...t ? {} : U,
|
|
1224
|
+
isPaused: t ? e.isPaused : !1
|
|
1220
1225
|
};
|
|
1221
1226
|
}
|
|
1222
1227
|
case "PREV": {
|
|
1223
|
-
const n = Qr(e),
|
|
1228
|
+
const n = Qr(e), t = n === e.currentIndex;
|
|
1224
1229
|
return {
|
|
1225
1230
|
...e,
|
|
1226
1231
|
currentIndex: n,
|
|
1227
|
-
...
|
|
1228
|
-
isPaused:
|
|
1232
|
+
...t ? {} : U,
|
|
1233
|
+
isPaused: t ? e.isPaused : !1
|
|
1229
1234
|
};
|
|
1230
1235
|
}
|
|
1231
1236
|
case "MEDIA_TIME_UPDATE":
|
|
@@ -1267,7 +1272,7 @@ function xn(e, r) {
|
|
|
1267
1272
|
case "MEDIA_SOURCE_CLEARED":
|
|
1268
1273
|
return { ...e, ...U };
|
|
1269
1274
|
case "SET_VOLUME":
|
|
1270
|
-
return { ...e, volume:
|
|
1275
|
+
return { ...e, volume: Ae(r.payload) };
|
|
1271
1276
|
case "SET_MUTED":
|
|
1272
1277
|
return { ...e, muted: r.payload };
|
|
1273
1278
|
case "TOGGLE_MUTE":
|
|
@@ -1275,8 +1280,8 @@ function xn(e, r) {
|
|
|
1275
1280
|
case "SET_PLAYBACK_RATE":
|
|
1276
1281
|
return { ...e, playbackRate: Ce(r.payload) };
|
|
1277
1282
|
case "MEDIA_VOLUME_SYNC": {
|
|
1278
|
-
const { volume: n, muted:
|
|
1279
|
-
return
|
|
1283
|
+
const { volume: n, muted: t } = r.payload, a = Ae(n);
|
|
1284
|
+
return a === e.volume && t === e.muted ? e : { ...e, volume: a, muted: t };
|
|
1280
1285
|
}
|
|
1281
1286
|
default:
|
|
1282
1287
|
return e;
|
|
@@ -1285,32 +1290,32 @@ function xn(e, r) {
|
|
|
1285
1290
|
function Re() {
|
|
1286
1291
|
return typeof navigator > "u" || !("mediaSession" in navigator) ? null : navigator.mediaSession;
|
|
1287
1292
|
}
|
|
1288
|
-
function
|
|
1289
|
-
var
|
|
1290
|
-
const
|
|
1293
|
+
function xn(e, r, n) {
|
|
1294
|
+
var l;
|
|
1295
|
+
const t = r.tracks[r.currentIndex], a = t == null ? void 0 : t.title, i = t == null ? void 0 : t.artist, o = t == null ? void 0 : t.album, u = Qe(t, (l = r.playlistMeta) == null ? void 0 : l.artworkUrl);
|
|
1291
1296
|
E(() => {
|
|
1292
|
-
const
|
|
1293
|
-
!e || !
|
|
1294
|
-
title:
|
|
1297
|
+
const s = Re();
|
|
1298
|
+
!e || !s || (s.metadata = new MediaMetadata({
|
|
1299
|
+
title: a ?? "Unknown track",
|
|
1295
1300
|
artist: i,
|
|
1296
1301
|
album: o,
|
|
1297
1302
|
artwork: u ? [{ src: u }] : void 0
|
|
1298
1303
|
}));
|
|
1299
|
-
}, [e,
|
|
1300
|
-
const
|
|
1301
|
-
!e || !
|
|
1304
|
+
}, [e, a, i, o, u]), E(() => {
|
|
1305
|
+
const s = Re();
|
|
1306
|
+
!e || !s || (s.playbackState = r.isPaused ? "paused" : "playing");
|
|
1302
1307
|
}, [e, r.isPaused]), E(() => {
|
|
1303
|
-
const
|
|
1304
|
-
if (!(!e || !
|
|
1308
|
+
const s = Re();
|
|
1309
|
+
if (!(!e || !s)) {
|
|
1305
1310
|
try {
|
|
1306
|
-
|
|
1311
|
+
s.setActionHandler("play", n.play), s.setActionHandler("pause", n.pause), s.setActionHandler("nexttrack", n.next), s.setActionHandler("previoustrack", n.prev), s.setActionHandler("seekto", (g) => {
|
|
1307
1312
|
typeof g.seekTime == "number" && Number.isFinite(g.seekTime) && n.seek(g.seekTime);
|
|
1308
1313
|
});
|
|
1309
1314
|
} catch {
|
|
1310
1315
|
}
|
|
1311
1316
|
return () => {
|
|
1312
1317
|
try {
|
|
1313
|
-
|
|
1318
|
+
s.setActionHandler("play", null), s.setActionHandler("pause", null), s.setActionHandler("nexttrack", null), s.setActionHandler("previoustrack", null), s.setActionHandler("seekto", null);
|
|
1314
1319
|
} catch {
|
|
1315
1320
|
}
|
|
1316
1321
|
};
|
|
@@ -1333,13 +1338,13 @@ function En({
|
|
|
1333
1338
|
children: e,
|
|
1334
1339
|
initialTracks: r = [],
|
|
1335
1340
|
initialIndex: n = 0,
|
|
1336
|
-
initialPlaylistMeta:
|
|
1337
|
-
initialShuffle:
|
|
1341
|
+
initialPlaylistMeta: t = null,
|
|
1342
|
+
initialShuffle: a = !1,
|
|
1338
1343
|
initialRepeatMode: i = "off",
|
|
1339
1344
|
initialPlaybackMode: o = "playlist",
|
|
1340
1345
|
initialPaused: u = !0,
|
|
1341
|
-
initialVolume:
|
|
1342
|
-
initialMuted:
|
|
1346
|
+
initialVolume: l = 1,
|
|
1347
|
+
initialMuted: s = !1,
|
|
1343
1348
|
initialPlaybackRate: g = 1,
|
|
1344
1349
|
initialStateKey: m,
|
|
1345
1350
|
locale: y,
|
|
@@ -1347,55 +1352,55 @@ function En({
|
|
|
1347
1352
|
beforePlay: b,
|
|
1348
1353
|
onPlayBlocked: S,
|
|
1349
1354
|
persistence: p,
|
|
1350
|
-
hydrateOnMount:
|
|
1355
|
+
hydrateOnMount: x = !1,
|
|
1351
1356
|
resumeOnTrackChange: R = !1,
|
|
1352
1357
|
unstyled: w = !1,
|
|
1353
1358
|
className: Se,
|
|
1354
1359
|
style: K,
|
|
1355
|
-
onTrackChange:
|
|
1356
|
-
onPlay:
|
|
1357
|
-
onPause:
|
|
1358
|
-
onQueueEnd:
|
|
1359
|
-
onError:
|
|
1360
|
+
onTrackChange: Z,
|
|
1361
|
+
onPlay: ee,
|
|
1362
|
+
onPause: re,
|
|
1363
|
+
onQueueEnd: ne,
|
|
1364
|
+
onError: te
|
|
1360
1365
|
}) {
|
|
1361
1366
|
var Fe;
|
|
1362
1367
|
const $ = O(null), [c, h] = wr(
|
|
1363
|
-
|
|
1368
|
+
Tn,
|
|
1364
1369
|
void 0,
|
|
1365
|
-
() =>
|
|
1370
|
+
() => xr({
|
|
1366
1371
|
tracks: r,
|
|
1367
1372
|
currentIndex: n,
|
|
1368
|
-
playlistMeta:
|
|
1373
|
+
playlistMeta: t,
|
|
1369
1374
|
isPaused: u,
|
|
1370
|
-
isShuffled:
|
|
1375
|
+
isShuffled: a,
|
|
1371
1376
|
repeatMode: i,
|
|
1372
1377
|
playbackMode: o,
|
|
1373
|
-
volume:
|
|
1374
|
-
muted:
|
|
1378
|
+
volume: l,
|
|
1379
|
+
muted: s,
|
|
1375
1380
|
playbackRate: g
|
|
1376
1381
|
})
|
|
1377
1382
|
), Le = O(c), Pe = O({
|
|
1378
1383
|
tracks: r,
|
|
1379
1384
|
currentIndex: n,
|
|
1380
|
-
playlistMeta:
|
|
1385
|
+
playlistMeta: t,
|
|
1381
1386
|
isPaused: u,
|
|
1382
|
-
isShuffled:
|
|
1387
|
+
isShuffled: a,
|
|
1383
1388
|
repeatMode: i,
|
|
1384
1389
|
playbackMode: o,
|
|
1385
|
-
volume:
|
|
1386
|
-
muted:
|
|
1390
|
+
volume: l,
|
|
1391
|
+
muted: s,
|
|
1387
1392
|
playbackRate: g
|
|
1388
1393
|
});
|
|
1389
1394
|
Pe.current = {
|
|
1390
1395
|
tracks: r,
|
|
1391
1396
|
currentIndex: n,
|
|
1392
|
-
playlistMeta:
|
|
1397
|
+
playlistMeta: t,
|
|
1393
1398
|
isPaused: u,
|
|
1394
|
-
isShuffled:
|
|
1399
|
+
isShuffled: a,
|
|
1395
1400
|
repeatMode: i,
|
|
1396
1401
|
playbackMode: o,
|
|
1397
|
-
volume:
|
|
1398
|
-
muted:
|
|
1402
|
+
volume: l,
|
|
1403
|
+
muted: s,
|
|
1399
1404
|
playbackRate: g
|
|
1400
1405
|
};
|
|
1401
1406
|
const X = O(void 0);
|
|
@@ -1431,70 +1436,70 @@ function En({
|
|
|
1431
1436
|
}, [c]);
|
|
1432
1437
|
const De = c.tracks[c.currentIndex] ?? null;
|
|
1433
1438
|
E(() => {
|
|
1434
|
-
|
|
1435
|
-
}, [De, c.currentIndex,
|
|
1436
|
-
c.errorMessage && (
|
|
1437
|
-
}, [c.errorMessage,
|
|
1438
|
-
const
|
|
1439
|
+
Z == null || Z(De, c.currentIndex);
|
|
1440
|
+
}, [De, c.currentIndex, Z]), E(() => {
|
|
1441
|
+
c.errorMessage && (te == null || te(c.errorMessage));
|
|
1442
|
+
}, [c.errorMessage, te]);
|
|
1443
|
+
const ae = O(void 0);
|
|
1439
1444
|
E(() => {
|
|
1440
|
-
if (
|
|
1441
|
-
|
|
1445
|
+
if (ae.current === void 0) {
|
|
1446
|
+
ae.current = c.isPaused;
|
|
1442
1447
|
return;
|
|
1443
1448
|
}
|
|
1444
|
-
|
|
1445
|
-
}, [c.isPaused,
|
|
1449
|
+
ae.current !== c.isPaused && (c.isPaused ? re == null || re() : ee == null || ee()), ae.current = c.isPaused;
|
|
1450
|
+
}, [c.isPaused, re, ee]);
|
|
1446
1451
|
const L = v(() => {
|
|
1447
1452
|
h({ type: "PLAY" });
|
|
1448
1453
|
}, []), D = v(() => {
|
|
1449
1454
|
var f;
|
|
1450
1455
|
h({ type: "PAUSE" }), (f = $.current) == null || f.pause();
|
|
1451
|
-
}, []),
|
|
1456
|
+
}, []), ie = v(() => {
|
|
1452
1457
|
c.isPaused ? L() : D();
|
|
1453
1458
|
}, [D, L, c.isPaused]), F = v((f) => {
|
|
1454
1459
|
const M = $.current;
|
|
1455
1460
|
M && Number.isFinite(f) && (M.currentTime = Math.max(0, f));
|
|
1456
|
-
}, []), ie = v((f) => {
|
|
1457
|
-
h({ type: "SET_VOLUME", payload: Ee(f) });
|
|
1458
1461
|
}, []), oe = v((f) => {
|
|
1462
|
+
h({ type: "SET_VOLUME", payload: Ae(f) });
|
|
1463
|
+
}, []), ue = v((f) => {
|
|
1459
1464
|
h({ type: "SET_MUTED", payload: f });
|
|
1460
|
-
}, []),
|
|
1465
|
+
}, []), se = v(() => {
|
|
1461
1466
|
h({ type: "TOGGLE_MUTE" });
|
|
1462
|
-
}, []),
|
|
1467
|
+
}, []), le = v((f) => {
|
|
1463
1468
|
h({ type: "SET_PLAYBACK_RATE", payload: Ce(f) });
|
|
1464
1469
|
}, []), Q = v(() => {
|
|
1465
1470
|
h({ type: "NEXT" });
|
|
1466
1471
|
}, []), H = v(() => {
|
|
1467
1472
|
h({ type: "PREV" });
|
|
1468
|
-
}, []),
|
|
1473
|
+
}, []), ce = v((f) => {
|
|
1469
1474
|
h({ type: "SET_REPEAT", payload: f });
|
|
1470
|
-
}, []), ce = v(() => {
|
|
1471
|
-
h({ type: "CYCLE_REPEAT" });
|
|
1472
1475
|
}, []), de = v(() => {
|
|
1476
|
+
h({ type: "CYCLE_REPEAT" });
|
|
1477
|
+
}, []), fe = v(() => {
|
|
1473
1478
|
h({ type: "TOGGLE_SHUFFLE" });
|
|
1474
|
-
}, []),
|
|
1479
|
+
}, []), pe = v((f, M) => {
|
|
1475
1480
|
h({ type: "SET_QUEUE", payload: { tracks: f, currentIndex: M } });
|
|
1476
|
-
}, []),
|
|
1477
|
-
h({ type: "INSERT_TRACK", payload: { track: f, index: M, autoPlay:
|
|
1478
|
-
}, []),
|
|
1481
|
+
}, []), ge = v((f, M, T) => {
|
|
1482
|
+
h({ type: "INSERT_TRACK", payload: { track: f, index: M, autoPlay: T } });
|
|
1483
|
+
}, []), me = v((f) => {
|
|
1479
1484
|
h({ type: "REMOVE_TRACK", payload: { index: f } });
|
|
1480
|
-
}, []),
|
|
1485
|
+
}, []), ye = v((f, M) => {
|
|
1481
1486
|
h({ type: "MOVE_TRACK", payload: { fromIndex: f, toIndex: M } });
|
|
1482
|
-
}, []), ye = v((f) => {
|
|
1483
|
-
h({ type: "ADD_NEXT", payload: { track: f } });
|
|
1484
1487
|
}, []), he = v((f) => {
|
|
1485
|
-
h({ type: "
|
|
1488
|
+
h({ type: "ADD_NEXT", payload: { track: f } });
|
|
1486
1489
|
}, []), be = v((f) => {
|
|
1487
|
-
h({ type: "SET_INDEX", payload: { index: f, autoPlay: !
|
|
1490
|
+
h({ type: "SET_INDEX", payload: { index: f, autoPlay: !0 } });
|
|
1488
1491
|
}, []), ve = v((f) => {
|
|
1489
|
-
h({ type: "
|
|
1492
|
+
h({ type: "SET_INDEX", payload: { index: f, autoPlay: !1 } });
|
|
1490
1493
|
}, []), ke = v((f) => {
|
|
1491
|
-
h({ type: "
|
|
1494
|
+
h({ type: "SET_PLAYLIST_META", payload: f });
|
|
1492
1495
|
}, []), Me = v((f) => {
|
|
1496
|
+
h({ type: "SET_PLAYBACK_MODE", payload: f });
|
|
1497
|
+
}, []), Te = v((f) => {
|
|
1493
1498
|
h({ type: "INIT", payload: f });
|
|
1494
1499
|
}, []);
|
|
1495
1500
|
E(() => {
|
|
1496
|
-
if (!p || !
|
|
1497
|
-
const f = p.get("ginger:volume"), M = p.get("ginger:muted"),
|
|
1501
|
+
if (!p || !x) return;
|
|
1502
|
+
const f = p.get("ginger:volume"), M = p.get("ginger:muted"), T = p.get("ginger:playbackRate"), C = p.get("ginger:repeatMode"), Ie = p.get("ginger:currentIndex"), G = Pe.current;
|
|
1498
1503
|
h({
|
|
1499
1504
|
type: "INIT",
|
|
1500
1505
|
payload: {
|
|
@@ -1503,27 +1508,27 @@ function En({
|
|
|
1503
1508
|
isPaused: G.isPaused,
|
|
1504
1509
|
isShuffled: G.isShuffled,
|
|
1505
1510
|
playbackMode: G.playbackMode,
|
|
1506
|
-
currentIndex: typeof
|
|
1511
|
+
currentIndex: typeof Ie == "number" ? Ie : G.currentIndex,
|
|
1507
1512
|
repeatMode: C === "off" || C === "all" || C === "one" ? C : G.repeatMode,
|
|
1508
1513
|
volume: typeof f == "number" ? f : G.volume,
|
|
1509
1514
|
muted: typeof M == "boolean" ? M : G.muted,
|
|
1510
|
-
playbackRate: typeof
|
|
1515
|
+
playbackRate: typeof T == "number" ? T : G.playbackRate
|
|
1511
1516
|
}
|
|
1512
1517
|
});
|
|
1513
|
-
}, [
|
|
1518
|
+
}, [x, p]), E(() => {
|
|
1514
1519
|
p && (p.set("ginger:volume", c.volume), p.set("ginger:muted", c.muted), p.set("ginger:playbackRate", c.playbackRate), p.set("ginger:repeatMode", c.repeatMode), p.set("ginger:currentIndex", c.currentIndex));
|
|
1515
1520
|
}, [p, c.volume, c.muted, c.playbackRate, c.repeatMode, c.currentIndex]), E(() => {
|
|
1516
1521
|
if (!p || !R) return;
|
|
1517
1522
|
const f = c.tracks[c.currentIndex];
|
|
1518
1523
|
if (!f) return;
|
|
1519
|
-
const M = `ginger:resume:${W(f)}`,
|
|
1520
|
-
typeof
|
|
1524
|
+
const M = `ginger:resume:${W(f)}`, T = p.get(M);
|
|
1525
|
+
typeof T == "number" && Number.isFinite(T) && F(T);
|
|
1521
1526
|
}, [p, R, c.currentIndex, c.tracks, F]), E(() => {
|
|
1522
1527
|
if (!p || !R) return;
|
|
1523
1528
|
const f = c.tracks[c.currentIndex];
|
|
1524
1529
|
if (!f || !(c.currentTime >= 0)) return;
|
|
1525
|
-
const M = `ginger:resume:${W(f)}`,
|
|
1526
|
-
return () => clearTimeout(
|
|
1530
|
+
const M = `ginger:resume:${W(f)}`, T = setTimeout(() => p.set(M, c.currentTime), 250);
|
|
1531
|
+
return () => clearTimeout(T);
|
|
1527
1532
|
}, [p, R, c.currentIndex, c.tracks, c.currentTime]);
|
|
1528
1533
|
const Ir = (Fe = c.tracks[c.currentIndex]) == null ? void 0 : Fe.fileUrl;
|
|
1529
1534
|
E(() => {
|
|
@@ -1536,21 +1541,21 @@ function En({
|
|
|
1536
1541
|
let M = !1;
|
|
1537
1542
|
return (async () => {
|
|
1538
1543
|
if (b) {
|
|
1539
|
-
let
|
|
1544
|
+
let T = !1;
|
|
1540
1545
|
try {
|
|
1541
|
-
|
|
1546
|
+
T = await b();
|
|
1542
1547
|
} catch (C) {
|
|
1543
|
-
const
|
|
1544
|
-
h({ type: "MEDIA_ERROR", payload: { message:
|
|
1548
|
+
const Ie = C instanceof Error ? C.message : "beforePlay rejected";
|
|
1549
|
+
h({ type: "MEDIA_ERROR", payload: { message: Ie } });
|
|
1545
1550
|
return;
|
|
1546
1551
|
}
|
|
1547
|
-
if (!
|
|
1552
|
+
if (!T) {
|
|
1548
1553
|
M || (h({ type: "PAUSE" }), S == null || S());
|
|
1549
1554
|
return;
|
|
1550
1555
|
}
|
|
1551
1556
|
}
|
|
1552
|
-
M || f.play().catch((
|
|
1553
|
-
const C =
|
|
1557
|
+
M || f.play().catch((T) => {
|
|
1558
|
+
const C = T instanceof Error ? T.message : typeof T == "string" ? T : "Playback failed (e.g. autoplay blocked or unavailable source)";
|
|
1554
1559
|
h({ type: "MEDIA_ERROR", payload: { message: C } });
|
|
1555
1560
|
});
|
|
1556
1561
|
})(), () => {
|
|
@@ -1560,78 +1565,78 @@ function En({
|
|
|
1560
1565
|
const xe = v(() => {
|
|
1561
1566
|
const f = Br(Le.current);
|
|
1562
1567
|
if (f.kind === "replay_same") {
|
|
1563
|
-
const
|
|
1564
|
-
|
|
1568
|
+
const T = $.current;
|
|
1569
|
+
T && (T.currentTime = 0), h({ type: "PLAY" });
|
|
1565
1570
|
return;
|
|
1566
1571
|
}
|
|
1567
1572
|
if (f.kind === "stop") {
|
|
1568
|
-
h({ type: "PAUSE" }),
|
|
1573
|
+
h({ type: "PAUSE" }), ne == null || ne();
|
|
1569
1574
|
return;
|
|
1570
1575
|
}
|
|
1571
1576
|
const M = f.nextIndex;
|
|
1572
1577
|
h({ type: "SET_INDEX", payload: { index: M, autoPlay: !0 } });
|
|
1573
|
-
}, [
|
|
1578
|
+
}, [ne]), Er = P(
|
|
1574
1579
|
() => ({ play: L, pause: D, next: Q, prev: H, seek: F }),
|
|
1575
1580
|
[L, D, Q, H, F]
|
|
1576
1581
|
);
|
|
1577
|
-
|
|
1582
|
+
xn(!!k, c, Er);
|
|
1578
1583
|
const Ar = y != null && y.seek && /[\u0590-\u08FF]/.test(y.seek) ? "rtl" : "ltr", Sr = P(
|
|
1579
1584
|
() => ({
|
|
1580
1585
|
state: c,
|
|
1581
1586
|
dispatch: h,
|
|
1582
1587
|
audioRef: $,
|
|
1583
1588
|
notifyEnded: xe,
|
|
1584
|
-
init:
|
|
1589
|
+
init: Te,
|
|
1585
1590
|
play: L,
|
|
1586
1591
|
pause: D,
|
|
1587
|
-
togglePlayPause:
|
|
1592
|
+
togglePlayPause: ie,
|
|
1588
1593
|
seek: F,
|
|
1589
|
-
setVolume:
|
|
1590
|
-
setMuted:
|
|
1591
|
-
toggleMute:
|
|
1592
|
-
setPlaybackRate:
|
|
1594
|
+
setVolume: oe,
|
|
1595
|
+
setMuted: ue,
|
|
1596
|
+
toggleMute: se,
|
|
1597
|
+
setPlaybackRate: le,
|
|
1593
1598
|
next: Q,
|
|
1594
1599
|
prev: H,
|
|
1595
|
-
setRepeatMode:
|
|
1596
|
-
cycleRepeat:
|
|
1597
|
-
toggleShuffle:
|
|
1598
|
-
setQueue:
|
|
1599
|
-
insertTrackAt:
|
|
1600
|
-
removeTrackAt:
|
|
1601
|
-
moveTrack:
|
|
1602
|
-
enqueueNext:
|
|
1603
|
-
playTrackAt:
|
|
1604
|
-
selectTrackAt:
|
|
1605
|
-
setPlaylistMeta:
|
|
1606
|
-
setPlaybackMode:
|
|
1600
|
+
setRepeatMode: ce,
|
|
1601
|
+
cycleRepeat: de,
|
|
1602
|
+
toggleShuffle: fe,
|
|
1603
|
+
setQueue: pe,
|
|
1604
|
+
insertTrackAt: ge,
|
|
1605
|
+
removeTrackAt: me,
|
|
1606
|
+
moveTrack: ye,
|
|
1607
|
+
enqueueNext: he,
|
|
1608
|
+
playTrackAt: be,
|
|
1609
|
+
selectTrackAt: ve,
|
|
1610
|
+
setPlaylistMeta: ke,
|
|
1611
|
+
setPlaybackMode: Me
|
|
1607
1612
|
}),
|
|
1608
1613
|
[
|
|
1609
|
-
|
|
1614
|
+
de,
|
|
1610
1615
|
h,
|
|
1611
|
-
|
|
1616
|
+
Te,
|
|
1612
1617
|
Q,
|
|
1613
1618
|
xe,
|
|
1614
1619
|
D,
|
|
1615
1620
|
L,
|
|
1616
|
-
|
|
1617
|
-
pe,
|
|
1621
|
+
be,
|
|
1618
1622
|
ge,
|
|
1619
1623
|
me,
|
|
1620
1624
|
ye,
|
|
1621
|
-
|
|
1625
|
+
he,
|
|
1626
|
+
ve,
|
|
1622
1627
|
H,
|
|
1623
1628
|
F,
|
|
1624
|
-
|
|
1625
|
-
se,
|
|
1626
|
-
fe,
|
|
1629
|
+
ue,
|
|
1627
1630
|
le,
|
|
1628
|
-
|
|
1631
|
+
pe,
|
|
1632
|
+
ce,
|
|
1629
1633
|
ke,
|
|
1630
|
-
|
|
1634
|
+
Me,
|
|
1635
|
+
oe,
|
|
1631
1636
|
c,
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1637
|
+
se,
|
|
1638
|
+
ie,
|
|
1639
|
+
fe
|
|
1635
1640
|
]
|
|
1636
1641
|
), Pr = P(
|
|
1637
1642
|
() => ({
|
|
@@ -1642,25 +1647,25 @@ function En({
|
|
|
1642
1647
|
repeatMode: c.repeatMode,
|
|
1643
1648
|
originalTracks: c.originalTracks,
|
|
1644
1649
|
playlistMeta: c.playlistMeta,
|
|
1645
|
-
init:
|
|
1650
|
+
init: Te,
|
|
1646
1651
|
play: L,
|
|
1647
1652
|
pause: D,
|
|
1648
|
-
togglePlayPause:
|
|
1653
|
+
togglePlayPause: ie,
|
|
1649
1654
|
next: Q,
|
|
1650
1655
|
prev: H,
|
|
1651
|
-
setRepeatMode:
|
|
1652
|
-
cycleRepeat:
|
|
1653
|
-
toggleShuffle:
|
|
1656
|
+
setRepeatMode: ce,
|
|
1657
|
+
cycleRepeat: de,
|
|
1658
|
+
toggleShuffle: fe,
|
|
1654
1659
|
playbackMode: c.playbackMode,
|
|
1655
|
-
setQueue:
|
|
1656
|
-
insertTrackAt:
|
|
1657
|
-
removeTrackAt:
|
|
1658
|
-
moveTrack:
|
|
1659
|
-
enqueueNext:
|
|
1660
|
-
playTrackAt:
|
|
1661
|
-
selectTrackAt:
|
|
1662
|
-
setPlaylistMeta:
|
|
1663
|
-
setPlaybackMode:
|
|
1660
|
+
setQueue: pe,
|
|
1661
|
+
insertTrackAt: ge,
|
|
1662
|
+
removeTrackAt: me,
|
|
1663
|
+
moveTrack: ye,
|
|
1664
|
+
enqueueNext: he,
|
|
1665
|
+
playTrackAt: be,
|
|
1666
|
+
selectTrackAt: ve,
|
|
1667
|
+
setPlaylistMeta: ke,
|
|
1668
|
+
setPlaybackMode: Me,
|
|
1664
1669
|
dispatch: h
|
|
1665
1670
|
}),
|
|
1666
1671
|
[
|
|
@@ -1672,13 +1677,12 @@ function En({
|
|
|
1672
1677
|
c.playbackMode,
|
|
1673
1678
|
c.originalTracks,
|
|
1674
1679
|
c.playlistMeta,
|
|
1675
|
-
|
|
1680
|
+
Te,
|
|
1676
1681
|
L,
|
|
1677
1682
|
D,
|
|
1678
|
-
|
|
1683
|
+
ie,
|
|
1679
1684
|
Q,
|
|
1680
1685
|
H,
|
|
1681
|
-
le,
|
|
1682
1686
|
ce,
|
|
1683
1687
|
de,
|
|
1684
1688
|
fe,
|
|
@@ -1690,6 +1694,7 @@ function En({
|
|
|
1690
1694
|
be,
|
|
1691
1695
|
ve,
|
|
1692
1696
|
ke,
|
|
1697
|
+
Me,
|
|
1693
1698
|
h
|
|
1694
1699
|
]
|
|
1695
1700
|
), Rr = P(
|
|
@@ -1703,10 +1708,10 @@ function En({
|
|
|
1703
1708
|
muted: c.muted,
|
|
1704
1709
|
playbackRate: c.playbackRate,
|
|
1705
1710
|
seek: F,
|
|
1706
|
-
setVolume:
|
|
1707
|
-
setMuted:
|
|
1708
|
-
toggleMute:
|
|
1709
|
-
setPlaybackRate:
|
|
1711
|
+
setVolume: oe,
|
|
1712
|
+
setMuted: ue,
|
|
1713
|
+
toggleMute: se,
|
|
1714
|
+
setPlaybackRate: le,
|
|
1710
1715
|
audioRef: $,
|
|
1711
1716
|
notifyEnded: xe,
|
|
1712
1717
|
dispatch: h
|
|
@@ -1721,10 +1726,10 @@ function En({
|
|
|
1721
1726
|
c.muted,
|
|
1722
1727
|
c.playbackRate,
|
|
1723
1728
|
F,
|
|
1724
|
-
ie,
|
|
1725
1729
|
oe,
|
|
1726
1730
|
ue,
|
|
1727
1731
|
se,
|
|
1732
|
+
le,
|
|
1728
1733
|
$,
|
|
1729
1734
|
xe,
|
|
1730
1735
|
h
|
|
@@ -1780,7 +1785,7 @@ const Rn = {
|
|
|
1780
1785
|
Subtitle: bn,
|
|
1781
1786
|
Description: vn,
|
|
1782
1787
|
Copyright: kn,
|
|
1783
|
-
Artwork:
|
|
1788
|
+
Artwork: Tr
|
|
1784
1789
|
},
|
|
1785
1790
|
Control: {
|
|
1786
1791
|
PlayPause: dr,
|
|
@@ -1799,10 +1804,10 @@ export {
|
|
|
1799
1804
|
We as C,
|
|
1800
1805
|
Rn as G,
|
|
1801
1806
|
ze as L,
|
|
1802
|
-
|
|
1807
|
+
Ae as a,
|
|
1803
1808
|
He as b,
|
|
1804
1809
|
Ce as c,
|
|
1805
|
-
|
|
1810
|
+
Ee as d,
|
|
1806
1811
|
N as e,
|
|
1807
1812
|
un as f,
|
|
1808
1813
|
pn as g,
|
|
@@ -1811,11 +1816,11 @@ export {
|
|
|
1811
1816
|
Xr as j,
|
|
1812
1817
|
je as k,
|
|
1813
1818
|
Kr as l,
|
|
1814
|
-
|
|
1819
|
+
J as m,
|
|
1815
1820
|
V as n,
|
|
1816
1821
|
Yr as o,
|
|
1817
1822
|
on as p,
|
|
1818
1823
|
zr as r,
|
|
1819
1824
|
sn as u
|
|
1820
1825
|
};
|
|
1821
|
-
//# sourceMappingURL=ginger-
|
|
1826
|
+
//# sourceMappingURL=ginger-Dj-zM_lq.js.map
|