@lucaismyname/ginger 0.0.57 → 0.0.59
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/README.md +26 -0
- package/dist/client.cjs +1 -1
- package/dist/client.js +2 -2
- package/dist/components/tracks/GingerDeclarativeMergeContext.d.ts +12 -0
- package/dist/components/tracks/GingerDeclarativeMergeContext.d.ts.map +1 -0
- package/dist/components/tracks/GingerTrack.d.ts +17 -0
- package/dist/components/tracks/GingerTrack.d.ts.map +1 -0
- package/dist/components/tracks/GingerTracks.d.ts +21 -0
- package/dist/components/tracks/GingerTracks.d.ts.map +1 -0
- package/dist/components/tracks/GingerTracks.test.d.ts +2 -0
- package/dist/components/tracks/GingerTracks.test.d.ts.map +1 -0
- package/dist/components/tracks/GingerTracksRegistryContext.d.ts +13 -0
- package/dist/components/tracks/GingerTracksRegistryContext.d.ts.map +1 -0
- package/dist/components/tracks/index.d.ts +5 -0
- package/dist/components/tracks/index.d.ts.map +1 -0
- package/dist/components/tracks/mergeDeclarativeQueue.d.ts +6 -0
- package/dist/components/tracks/mergeDeclarativeQueue.d.ts.map +1 -0
- package/dist/context/GingerProvider.d.ts.map +1 -1
- package/dist/{ginger-BHu7Ofna.js → ginger-Bc_8qZYi.js} +902 -766
- package/dist/ginger-Bc_8qZYi.js.map +1 -0
- package/dist/ginger-DJwWdIp0.cjs +2 -0
- package/dist/ginger-DJwWdIp0.cjs.map +1 -0
- package/dist/ginger.d.ts +5 -0
- package/dist/ginger.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/{useGingerChapterProgress-DAIWjAtG.js → useGingerChapterProgress-CGe9W-te.js} +2 -2
- package/dist/{useGingerChapterProgress-DAIWjAtG.js.map → useGingerChapterProgress-CGe9W-te.js.map} +1 -1
- package/dist/{useGingerChapterProgress-DLx-LayX.cjs → useGingerChapterProgress-EbJNY5jt.cjs} +2 -2
- package/dist/{useGingerChapterProgress-DLx-LayX.cjs.map → useGingerChapterProgress-EbJNY5jt.cjs.map} +1 -1
- package/package.json +2 -2
- package/dist/ginger-B-W73LQC.cjs +0 -2
- package/dist/ginger-B-W73LQC.cjs.map +0 -1
- package/dist/ginger-BHu7Ofna.js.map +0 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { jsx as c, jsxs as N, Fragment as yr } from "react/jsx-runtime";
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { c as
|
|
4
|
-
import { f as
|
|
5
|
-
import { b as ze, g as
|
|
6
|
-
import { t as
|
|
7
|
-
const Tr =
|
|
8
|
-
function
|
|
9
|
-
const e =
|
|
2
|
+
import { useContext as fe, createContext as me, useRef as w, useState as xt, useEffect as E, useMemo as A, useId as It, useLayoutEffect as Et, useReducer as Pt, useCallback as I, Children as St, isValidElement as At, cloneElement as Rt } from "react";
|
|
3
|
+
import { c as C, u as le, g as hr, d as S, G as wt, f as Gt, h as _t, i as Nt } from "./GingerSplitContexts-DQ3rESBu.js";
|
|
4
|
+
import { f as ge } from "./formatTime-DUWvzW21.js";
|
|
5
|
+
import { b as ze, g as de, r as Lt, a as Dt, p as vr, e as Ut, d as kr } from "./selectors-BT3WSsKN.js";
|
|
6
|
+
import { t as Qe, d as Ct, b as Ft, s as br, f as Ye, e as q, g as Vt, h as lr, m as Bt, i as dr, j as pr, r as Ot, c as gr } from "./transitions-CmNkf3sd.js";
|
|
7
|
+
const Tr = me(null);
|
|
8
|
+
function $t() {
|
|
9
|
+
const e = fe(Tr);
|
|
10
10
|
if (!e) throw new Error("Ginger components must be used within <Ginger.Provider>");
|
|
11
11
|
return e;
|
|
12
12
|
}
|
|
13
13
|
function fr(e) {
|
|
14
|
-
const { buffered: r, duration:
|
|
15
|
-
return !(
|
|
14
|
+
const { buffered: r, duration: n } = e;
|
|
15
|
+
return !(n > 0) || r.length === 0 ? 0 : Math.min(1, r.end(r.length - 1) / n);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function Yt({
|
|
18
18
|
className: e,
|
|
19
19
|
style: r,
|
|
20
|
-
preload:
|
|
20
|
+
preload: n = "metadata",
|
|
21
21
|
crossOrigin: a,
|
|
22
|
-
respectReducedMotion:
|
|
22
|
+
respectReducedMotion: t = !1
|
|
23
23
|
}) {
|
|
24
24
|
var x;
|
|
25
|
-
const { audioRef: i, dispatch: o, state: u, notifyEnded:
|
|
25
|
+
const { audioRef: i, dispatch: o, state: u, notifyEnded: p } = $t(), l = ((x = u.tracks[u.currentIndex]) == null ? void 0 : x.fileUrl) ?? "", f = w({
|
|
26
26
|
currentTime: -1,
|
|
27
27
|
duration: -1,
|
|
28
28
|
bufferedFraction: -1
|
|
29
|
-
}), m =
|
|
29
|
+
}), m = w(""), [M, g] = xt(!1);
|
|
30
30
|
E(() => {
|
|
31
|
-
if (!
|
|
32
|
-
const y = window.matchMedia("(prefers-reduced-motion: reduce)"),
|
|
33
|
-
return
|
|
34
|
-
}, [
|
|
35
|
-
const h = (y,
|
|
36
|
-
const
|
|
31
|
+
if (!t || typeof window > "u") return;
|
|
32
|
+
const y = window.matchMedia("(prefers-reduced-motion: reduce)"), v = () => g(y.matches);
|
|
33
|
+
return v(), y.addEventListener("change", v), () => y.removeEventListener("change", v);
|
|
34
|
+
}, [t]);
|
|
35
|
+
const h = (y, v = !1) => {
|
|
36
|
+
const G = {
|
|
37
37
|
currentTime: y.currentTime,
|
|
38
38
|
duration: y.duration,
|
|
39
39
|
bufferedFraction: fr(y)
|
|
40
|
-
},
|
|
41
|
-
!
|
|
40
|
+
}, R = f.current, Z = M ? 0.5 : 0.25, ye = Math.abs(G.currentTime - R.currentTime) >= Z || Math.abs(G.duration - R.duration) >= 0.01 || Math.abs(G.bufferedFraction - R.bufferedFraction) >= 0.01;
|
|
41
|
+
!v && !ye || (f.current = G, o({
|
|
42
42
|
type: "MEDIA_TIME_UPDATE",
|
|
43
|
-
payload:
|
|
43
|
+
payload: G
|
|
44
44
|
}));
|
|
45
45
|
};
|
|
46
46
|
return E(() => {
|
|
@@ -49,20 +49,20 @@ function Fn({
|
|
|
49
49
|
}, [i, u.volume, u.muted]), E(() => {
|
|
50
50
|
const y = i.current;
|
|
51
51
|
if (y) {
|
|
52
|
-
if (!
|
|
52
|
+
if (!l) {
|
|
53
53
|
y.removeAttribute("src"), f.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, m.current !== "" && o({ type: "MEDIA_SOURCE_CLEARED" }), m.current = "";
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
y.getAttribute("src") !==
|
|
56
|
+
y.getAttribute("src") !== l && (y.src = l, y.load(), f.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), m.current = l, y.playbackRate = u.playbackRate;
|
|
57
57
|
}
|
|
58
|
-
}, [i, o,
|
|
58
|
+
}, [i, o, l, u.playbackRate]), /* @__PURE__ */ c(
|
|
59
59
|
"audio",
|
|
60
60
|
{
|
|
61
61
|
"data-ginger-component": "Player",
|
|
62
62
|
ref: i,
|
|
63
63
|
className: e,
|
|
64
64
|
style: r,
|
|
65
|
-
preload:
|
|
65
|
+
preload: n,
|
|
66
66
|
crossOrigin: a,
|
|
67
67
|
controls: !1,
|
|
68
68
|
playsInline: !0,
|
|
@@ -70,39 +70,39 @@ function Fn({
|
|
|
70
70
|
h(y.currentTarget);
|
|
71
71
|
},
|
|
72
72
|
onLoadedMetadata: (y) => {
|
|
73
|
-
const
|
|
73
|
+
const v = y.currentTarget;
|
|
74
74
|
f.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, o({
|
|
75
75
|
type: "MEDIA_LOADED_METADATA",
|
|
76
76
|
payload: {
|
|
77
|
-
duration:
|
|
78
|
-
bufferedFraction: fr(
|
|
77
|
+
duration: v.duration,
|
|
78
|
+
bufferedFraction: fr(v)
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
},
|
|
82
82
|
onSeeking: (y) => h(y.currentTarget, !0),
|
|
83
83
|
onSeeked: (y) => h(y.currentTarget, !0),
|
|
84
|
-
onEnded: () =>
|
|
84
|
+
onEnded: () => p(),
|
|
85
85
|
onPlay: () => o({ type: "MEDIA_PLAY" }),
|
|
86
86
|
onPause: () => o({ type: "MEDIA_PAUSE" }),
|
|
87
87
|
onWaiting: () => o({ type: "MEDIA_WAITING" }),
|
|
88
88
|
onCanPlay: () => o({ type: "MEDIA_CANPLAY" }),
|
|
89
89
|
onProgress: (y) => h(y.currentTarget, !0),
|
|
90
90
|
onVolumeChange: (y) => {
|
|
91
|
-
const
|
|
91
|
+
const v = y.currentTarget;
|
|
92
92
|
o({
|
|
93
93
|
type: "MEDIA_VOLUME_SYNC",
|
|
94
|
-
payload: { volume:
|
|
94
|
+
payload: { volume: v.volume, muted: v.muted }
|
|
95
95
|
});
|
|
96
96
|
},
|
|
97
97
|
onError: () => {
|
|
98
|
-
var
|
|
99
|
-
const y = i.current,
|
|
100
|
-
o({ type: "MEDIA_ERROR", payload: { message:
|
|
98
|
+
var R;
|
|
99
|
+
const y = i.current, v = (R = y == null ? void 0 : y.error) == null ? void 0 : R.code;
|
|
100
|
+
o({ type: "MEDIA_ERROR", payload: { message: v === 1 ? "MEDIA_ERR_ABORTED" : v === 2 ? "MEDIA_ERR_NETWORK" : v === 3 ? "MEDIA_ERR_DECODE" : v === 4 ? "MEDIA_ERR_SRC_NOT_SUPPORTED" : "MEDIA_ERR_UNKNOWN" } });
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
|
-
const
|
|
105
|
+
const Ve = {
|
|
106
106
|
seek: "Seek",
|
|
107
107
|
volume: "Volume",
|
|
108
108
|
playbackSpeed: "Playback speed",
|
|
@@ -123,42 +123,42 @@ const Ce = {
|
|
|
123
123
|
playbackRateNormal: "1× normal",
|
|
124
124
|
playbackRateTimes: (e) => `${e}×`
|
|
125
125
|
};
|
|
126
|
-
function
|
|
126
|
+
function Ht(e) {
|
|
127
127
|
return e ? {
|
|
128
|
-
...
|
|
128
|
+
...Ve,
|
|
129
129
|
...e,
|
|
130
|
-
repeat: { ...
|
|
131
|
-
} :
|
|
130
|
+
repeat: { ...Ve.repeat, ...e.repeat }
|
|
131
|
+
} : Ve;
|
|
132
132
|
}
|
|
133
|
-
const Mr =
|
|
134
|
-
function
|
|
133
|
+
const Mr = me(Ve);
|
|
134
|
+
function Qt({
|
|
135
135
|
locale: e,
|
|
136
136
|
children: r
|
|
137
137
|
}) {
|
|
138
|
-
const
|
|
139
|
-
return /* @__PURE__ */ c(Mr.Provider, { value:
|
|
138
|
+
const n = Ht(e);
|
|
139
|
+
return /* @__PURE__ */ c(Mr.Provider, { value: n, children: r });
|
|
140
140
|
}
|
|
141
141
|
function F() {
|
|
142
|
-
return
|
|
142
|
+
return fe(Mr);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
const e =
|
|
146
|
-
r.seek(Number(
|
|
144
|
+
function jt() {
|
|
145
|
+
const e = C(), r = le(), n = F(), a = A(() => hr(e, r), [e, r]), t = ze(a), i = t > 0 ? a.currentTime : 0, o = Number.isFinite(i) ? i : 0, u = t > 0 ? `${ge(o)} of ${ge(t)}` : ge(o), p = (l) => {
|
|
146
|
+
r.seek(Number(l.currentTarget.value));
|
|
147
147
|
};
|
|
148
148
|
return {
|
|
149
149
|
state: a,
|
|
150
150
|
value: o,
|
|
151
151
|
min: 0,
|
|
152
|
-
max:
|
|
152
|
+
max: t > 0 ? t : 1,
|
|
153
153
|
step: "any",
|
|
154
154
|
ariaValueText: u,
|
|
155
|
-
ariaLabel:
|
|
156
|
-
onSeekInput:
|
|
157
|
-
onSeekChange:
|
|
155
|
+
ariaLabel: n.seek,
|
|
156
|
+
onSeekInput: p,
|
|
157
|
+
onSeekChange: p
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
const e =
|
|
160
|
+
function zt() {
|
|
161
|
+
const e = C(), r = le(), n = F(), a = A(() => hr(e, r), [e, r]), t = (i) => {
|
|
162
162
|
r.setVolume(Number(i.currentTarget.value));
|
|
163
163
|
};
|
|
164
164
|
return {
|
|
@@ -168,30 +168,30 @@ function On() {
|
|
|
168
168
|
max: 1,
|
|
169
169
|
step: "any",
|
|
170
170
|
ariaValueText: `${Math.round(a.volume * 100)}%`,
|
|
171
|
-
ariaLabel:
|
|
172
|
-
onVolumeInput:
|
|
173
|
-
onVolumeChange:
|
|
171
|
+
ariaLabel: n.volume,
|
|
172
|
+
onVolumeInput: t,
|
|
173
|
+
onVolumeChange: t
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
const r =
|
|
176
|
+
function Wt(e) {
|
|
177
|
+
const r = C(), n = F(), a = (e == null ? void 0 : e.playAriaLabel) ?? n.play, t = (e == null ? void 0 : e.pauseAriaLabel) ?? n.pause;
|
|
178
178
|
return {
|
|
179
179
|
isPaused: r.isPaused,
|
|
180
180
|
toggle: r.togglePlayPause,
|
|
181
|
-
ariaLabel: r.isPaused ? a :
|
|
181
|
+
ariaLabel: r.isPaused ? a : t
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function V(e) {
|
|
185
185
|
const {
|
|
186
186
|
className: r,
|
|
187
|
-
width:
|
|
187
|
+
width: n,
|
|
188
188
|
height: a,
|
|
189
|
-
viewBox:
|
|
189
|
+
viewBox: t,
|
|
190
190
|
fill: i,
|
|
191
191
|
stroke: o,
|
|
192
192
|
strokeWidth: u,
|
|
193
|
-
strokeLinecap:
|
|
194
|
-
strokeLinejoin:
|
|
193
|
+
strokeLinecap: p,
|
|
194
|
+
strokeLinejoin: l,
|
|
195
195
|
children: f,
|
|
196
196
|
...m
|
|
197
197
|
} = e;
|
|
@@ -200,14 +200,14 @@ function U(e) {
|
|
|
200
200
|
{
|
|
201
201
|
"data-ginger-component": "Wrapper",
|
|
202
202
|
xmlns: "http://www.w3.org/2000/svg",
|
|
203
|
-
width:
|
|
203
|
+
width: n ?? 24,
|
|
204
204
|
height: a ?? 24,
|
|
205
|
-
viewBox:
|
|
205
|
+
viewBox: t ?? "0 0 24 24",
|
|
206
206
|
fill: "none",
|
|
207
207
|
stroke: o ?? "currentColor",
|
|
208
208
|
strokeWidth: u ?? 2,
|
|
209
|
-
strokeLinecap:
|
|
210
|
-
strokeLinejoin:
|
|
209
|
+
strokeLinecap: p ?? "round",
|
|
210
|
+
strokeLinejoin: l ?? "round",
|
|
211
211
|
className: r,
|
|
212
212
|
"aria-hidden": !0,
|
|
213
213
|
role: "presentation",
|
|
@@ -217,12 +217,12 @@ function U(e) {
|
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
219
|
function xr() {
|
|
220
|
-
return /* @__PURE__ */ c(
|
|
220
|
+
return /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c("path", { "data-ginger-component": "Pause", d: "M6 4h4v16H6zM14 4h4v16h-4z" }) });
|
|
221
221
|
}
|
|
222
222
|
function Ir() {
|
|
223
|
-
return /* @__PURE__ */ c(
|
|
223
|
+
return /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c("path", { "data-ginger-component": "Play", d: "M5 3L19 12 5 21 5 3z" }) });
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function He() {
|
|
226
226
|
return /* @__PURE__ */ N(yr, { children: [
|
|
227
227
|
/* @__PURE__ */ c("path", { d: "m17 2 4 4-4 4" }),
|
|
228
228
|
/* @__PURE__ */ c("path", { d: "M3 11v-1a4 4 0 0 1 4-4h14" }),
|
|
@@ -231,16 +231,16 @@ function $e() {
|
|
|
231
231
|
] });
|
|
232
232
|
}
|
|
233
233
|
function Er({ mode: e }) {
|
|
234
|
-
return e === "one" ? /* @__PURE__ */ N(
|
|
235
|
-
/* @__PURE__ */ c(
|
|
234
|
+
return e === "one" ? /* @__PURE__ */ N(V, { children: [
|
|
235
|
+
/* @__PURE__ */ c(He, {}),
|
|
236
236
|
/* @__PURE__ */ c("path", { "data-ginger-component": "RepeatGlyph", d: "M11 10h1v4" })
|
|
237
|
-
] }) : e === "all" ? /* @__PURE__ */ c(
|
|
238
|
-
/* @__PURE__ */ c(
|
|
237
|
+
] }) : e === "all" ? /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(He, {}) }) : /* @__PURE__ */ N(V, { children: [
|
|
238
|
+
/* @__PURE__ */ c(He, {}),
|
|
239
239
|
/* @__PURE__ */ c("line", { "data-ginger-component": "RepeatGlyph", x1: "3", x2: "21", y1: "3", y2: "21" })
|
|
240
240
|
] });
|
|
241
241
|
}
|
|
242
242
|
function Pr() {
|
|
243
|
-
return /* @__PURE__ */ N(
|
|
243
|
+
return /* @__PURE__ */ N(V, { children: [
|
|
244
244
|
/* @__PURE__ */ c("path", { d: "m18 14 4 4-4 4" }),
|
|
245
245
|
/* @__PURE__ */ c("path", { d: "m18 2 4 4-4 4" }),
|
|
246
246
|
/* @__PURE__ */ c(
|
|
@@ -254,8 +254,8 @@ function Pr() {
|
|
|
254
254
|
/* @__PURE__ */ c("path", { d: "M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45" })
|
|
255
255
|
] });
|
|
256
256
|
}
|
|
257
|
-
function
|
|
258
|
-
return /* @__PURE__ */ N(
|
|
257
|
+
function Sr() {
|
|
258
|
+
return /* @__PURE__ */ N(V, { children: [
|
|
259
259
|
/* @__PURE__ */ c(
|
|
260
260
|
"path",
|
|
261
261
|
{
|
|
@@ -266,8 +266,8 @@ function Ar() {
|
|
|
266
266
|
/* @__PURE__ */ c("path", { d: "M3 20V4" })
|
|
267
267
|
] });
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
return /* @__PURE__ */ N(
|
|
269
|
+
function Ar() {
|
|
270
|
+
return /* @__PURE__ */ N(V, { children: [
|
|
271
271
|
/* @__PURE__ */ c("path", { d: "M21 4v16" }),
|
|
272
272
|
/* @__PURE__ */ c(
|
|
273
273
|
"path",
|
|
@@ -278,8 +278,8 @@ function Rr() {
|
|
|
278
278
|
)
|
|
279
279
|
] });
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return /* @__PURE__ */ N(
|
|
281
|
+
function Rr() {
|
|
282
|
+
return /* @__PURE__ */ N(V, { children: [
|
|
283
283
|
/* @__PURE__ */ c(
|
|
284
284
|
"path",
|
|
285
285
|
{
|
|
@@ -292,7 +292,7 @@ function Sr() {
|
|
|
292
292
|
] });
|
|
293
293
|
}
|
|
294
294
|
function wr() {
|
|
295
|
-
return /* @__PURE__ */ N(
|
|
295
|
+
return /* @__PURE__ */ N(V, { children: [
|
|
296
296
|
/* @__PURE__ */ c(
|
|
297
297
|
"path",
|
|
298
298
|
{
|
|
@@ -304,18 +304,18 @@ function wr() {
|
|
|
304
304
|
/* @__PURE__ */ c("line", { x1: "16", x2: "22", y1: "9", y2: "15" })
|
|
305
305
|
] });
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function Gr({
|
|
308
308
|
playLabel: e = "Play",
|
|
309
309
|
pauseLabel: r = "Pause",
|
|
310
|
-
playAriaLabel:
|
|
310
|
+
playAriaLabel: n,
|
|
311
311
|
pauseAriaLabel: a,
|
|
312
|
-
children:
|
|
312
|
+
children: t,
|
|
313
313
|
type: i = "button",
|
|
314
314
|
onClick: o,
|
|
315
315
|
...u
|
|
316
316
|
}) {
|
|
317
|
-
const
|
|
318
|
-
playAriaLabel:
|
|
317
|
+
const p = F(), l = typeof e == "string" ? e : p.play, f = typeof r == "string" ? r : p.pause, m = Wt({
|
|
318
|
+
playAriaLabel: n ?? l,
|
|
319
319
|
pauseAriaLabel: a ?? f
|
|
320
320
|
});
|
|
321
321
|
return /* @__PURE__ */ c(
|
|
@@ -328,41 +328,41 @@ function _r({
|
|
|
328
328
|
onClick: (M) => {
|
|
329
329
|
m.toggle(), o == null || o(M);
|
|
330
330
|
},
|
|
331
|
-
children:
|
|
331
|
+
children: t ?? (m.isPaused ? /* @__PURE__ */ c(Ir, {}) : /* @__PURE__ */ c(xr, {}))
|
|
332
332
|
}
|
|
333
333
|
);
|
|
334
334
|
}
|
|
335
|
-
|
|
336
|
-
function
|
|
337
|
-
const { repeatMode: i, cycleRepeat: o } =
|
|
335
|
+
Gr.displayName = "Ginger.Control.PlayPause";
|
|
336
|
+
function _r({ type: e = "button", ariaLabel: r, onClick: n, children: a, ...t }) {
|
|
337
|
+
const { repeatMode: i, cycleRepeat: o } = C(), p = F().repeat[i];
|
|
338
338
|
return /* @__PURE__ */ c(
|
|
339
339
|
"button",
|
|
340
340
|
{
|
|
341
341
|
"data-ginger-component": "Repeat",
|
|
342
|
-
...
|
|
342
|
+
...t,
|
|
343
343
|
type: e,
|
|
344
|
-
"aria-label": r ??
|
|
345
|
-
onClick: (
|
|
346
|
-
o(),
|
|
344
|
+
"aria-label": r ?? p,
|
|
345
|
+
onClick: (l) => {
|
|
346
|
+
o(), n == null || n(l);
|
|
347
347
|
},
|
|
348
348
|
children: a ?? /* @__PURE__ */ c(Er, { mode: i })
|
|
349
349
|
}
|
|
350
350
|
);
|
|
351
351
|
}
|
|
352
|
-
|
|
353
|
-
function Nr({ type: e = "button", children: r, ariaLabel:
|
|
354
|
-
const { next: i } =
|
|
352
|
+
_r.displayName = "Ginger.Control.Repeat";
|
|
353
|
+
function Nr({ type: e = "button", children: r, ariaLabel: n, onClick: a, ...t }) {
|
|
354
|
+
const { next: i } = C(), o = F();
|
|
355
355
|
return /* @__PURE__ */ c(
|
|
356
356
|
"button",
|
|
357
357
|
{
|
|
358
358
|
"data-ginger-component": "Next",
|
|
359
|
-
...
|
|
359
|
+
...t,
|
|
360
360
|
type: e,
|
|
361
|
-
"aria-label":
|
|
361
|
+
"aria-label": n ?? o.nextTrack,
|
|
362
362
|
onClick: (u) => {
|
|
363
363
|
i(), a == null || a(u);
|
|
364
364
|
},
|
|
365
|
-
children: r ?? /* @__PURE__ */ c(
|
|
365
|
+
children: r ?? /* @__PURE__ */ c(Ar, {})
|
|
366
366
|
}
|
|
367
367
|
);
|
|
368
368
|
}
|
|
@@ -370,51 +370,51 @@ Nr.displayName = "Ginger.Control.Next";
|
|
|
370
370
|
function Lr({
|
|
371
371
|
type: e = "button",
|
|
372
372
|
children: r,
|
|
373
|
-
ariaLabel:
|
|
373
|
+
ariaLabel: n,
|
|
374
374
|
onClick: a,
|
|
375
|
-
...
|
|
375
|
+
...t
|
|
376
376
|
}) {
|
|
377
|
-
const { prev: i } =
|
|
377
|
+
const { prev: i } = C(), o = F();
|
|
378
378
|
return /* @__PURE__ */ c(
|
|
379
379
|
"button",
|
|
380
380
|
{
|
|
381
381
|
"data-ginger-component": "Previous",
|
|
382
|
-
...
|
|
382
|
+
...t,
|
|
383
383
|
type: e,
|
|
384
|
-
"aria-label":
|
|
384
|
+
"aria-label": n ?? o.previousTrack,
|
|
385
385
|
onClick: (u) => {
|
|
386
386
|
i(), a == null || a(u);
|
|
387
387
|
},
|
|
388
|
-
children: r ?? /* @__PURE__ */ c(
|
|
388
|
+
children: r ?? /* @__PURE__ */ c(Sr, {})
|
|
389
389
|
}
|
|
390
390
|
);
|
|
391
391
|
}
|
|
392
392
|
Lr.displayName = "Ginger.Control.Previous";
|
|
393
|
-
function Dr({ type: e = "button", children: r, ariaLabel:
|
|
394
|
-
const { isShuffled: i, toggleShuffle: o } =
|
|
393
|
+
function Dr({ type: e = "button", children: r, ariaLabel: n, onClick: a, ...t }) {
|
|
394
|
+
const { isShuffled: i, toggleShuffle: o } = C(), u = F();
|
|
395
395
|
return /* @__PURE__ */ c(
|
|
396
396
|
"button",
|
|
397
397
|
{
|
|
398
398
|
"data-ginger-component": "Shuffle",
|
|
399
|
-
...
|
|
399
|
+
...t,
|
|
400
400
|
type: e,
|
|
401
401
|
"aria-pressed": i,
|
|
402
|
-
"aria-label":
|
|
403
|
-
onClick: (
|
|
404
|
-
o(), a == null || a(
|
|
402
|
+
"aria-label": n ?? u.shuffle,
|
|
403
|
+
onClick: (p) => {
|
|
404
|
+
o(), a == null || a(p);
|
|
405
405
|
},
|
|
406
406
|
children: r ?? /* @__PURE__ */ c(Pr, {})
|
|
407
407
|
}
|
|
408
408
|
);
|
|
409
409
|
}
|
|
410
410
|
Dr.displayName = "Ginger.Control.Shuffle";
|
|
411
|
-
function
|
|
412
|
-
const i =
|
|
411
|
+
function Ur({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: a, ...t }) {
|
|
412
|
+
const i = jt(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
413
413
|
return /* @__PURE__ */ c(
|
|
414
414
|
"input",
|
|
415
415
|
{
|
|
416
416
|
"data-ginger-component": "SeekBar",
|
|
417
|
-
...
|
|
417
|
+
...t,
|
|
418
418
|
type: "range",
|
|
419
419
|
min: i.min,
|
|
420
420
|
max: i.max,
|
|
@@ -428,14 +428,14 @@ function Cr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: a, ...n }) {
|
|
|
428
428
|
}
|
|
429
429
|
);
|
|
430
430
|
}
|
|
431
|
-
|
|
432
|
-
function
|
|
433
|
-
const i =
|
|
431
|
+
Ur.displayName = "Ginger.Control.SeekBar";
|
|
432
|
+
function Cr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: a, ...t }) {
|
|
433
|
+
const i = zt(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
434
434
|
return /* @__PURE__ */ c(
|
|
435
435
|
"input",
|
|
436
436
|
{
|
|
437
437
|
"data-ginger-component": "Volume",
|
|
438
|
-
...
|
|
438
|
+
...t,
|
|
439
439
|
type: "range",
|
|
440
440
|
min: i.min,
|
|
441
441
|
max: i.max,
|
|
@@ -449,17 +449,17 @@ function Fr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: a, ...n }) {
|
|
|
449
449
|
}
|
|
450
450
|
);
|
|
451
451
|
}
|
|
452
|
-
|
|
453
|
-
function
|
|
452
|
+
Cr.displayName = "Ginger.Control.Volume";
|
|
453
|
+
function Fr({
|
|
454
454
|
ariaLabel: e,
|
|
455
455
|
muteLabel: r,
|
|
456
|
-
unmuteLabel:
|
|
456
|
+
unmuteLabel: n,
|
|
457
457
|
type: a = "button",
|
|
458
|
-
onClick:
|
|
458
|
+
onClick: t,
|
|
459
459
|
children: i,
|
|
460
460
|
...o
|
|
461
461
|
}) {
|
|
462
|
-
const { muted: u, toggleMute:
|
|
462
|
+
const { muted: u, toggleMute: p } = le(), l = F();
|
|
463
463
|
return /* @__PURE__ */ c(
|
|
464
464
|
"button",
|
|
465
465
|
{
|
|
@@ -467,142 +467,142 @@ function Ur({
|
|
|
467
467
|
...o,
|
|
468
468
|
type: a,
|
|
469
469
|
"aria-pressed": u,
|
|
470
|
-
"aria-label": e ?? (u ?
|
|
470
|
+
"aria-label": e ?? (u ? l.unmute : l.mute),
|
|
471
471
|
onClick: (f) => {
|
|
472
|
-
|
|
472
|
+
p(), t == null || t(f);
|
|
473
473
|
},
|
|
474
|
-
children: i ?? (u ?
|
|
474
|
+
children: i ?? (u ? n ?? /* @__PURE__ */ c(wr, {}) : r ?? /* @__PURE__ */ c(Rr, {}))
|
|
475
475
|
}
|
|
476
476
|
);
|
|
477
477
|
}
|
|
478
|
-
|
|
479
|
-
const
|
|
478
|
+
Fr.displayName = "Ginger.Control.Mute";
|
|
479
|
+
const Xt = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
480
480
|
function Vr({
|
|
481
|
-
rates: e =
|
|
481
|
+
rates: e = Xt,
|
|
482
482
|
style: r,
|
|
483
|
-
ariaLabel:
|
|
483
|
+
ariaLabel: n,
|
|
484
484
|
children: a,
|
|
485
|
-
...
|
|
485
|
+
...t
|
|
486
486
|
}) {
|
|
487
|
-
const { playbackRate: i, setPlaybackRate: o } =
|
|
488
|
-
() => Array.from(/* @__PURE__ */ new Set([...e, i])).sort((
|
|
487
|
+
const { playbackRate: i, setPlaybackRate: o } = le(), u = F(), p = A(
|
|
488
|
+
() => Array.from(/* @__PURE__ */ new Set([...e, i])).sort((l, f) => l - f),
|
|
489
489
|
[e, i]
|
|
490
490
|
);
|
|
491
491
|
return /* @__PURE__ */ c(
|
|
492
492
|
"select",
|
|
493
493
|
{
|
|
494
494
|
"data-ginger-component": "PlaybackRate",
|
|
495
|
-
...
|
|
496
|
-
"aria-label":
|
|
495
|
+
...t,
|
|
496
|
+
"aria-label": n ?? u.playbackSpeed,
|
|
497
497
|
value: String(i),
|
|
498
498
|
style: r,
|
|
499
|
-
onChange: (
|
|
500
|
-
children: a ??
|
|
499
|
+
onChange: (l) => o(Number(l.currentTarget.value)),
|
|
500
|
+
children: a ?? p.map((l) => /* @__PURE__ */ c("option", { value: String(l), children: l === 1 ? u.playbackRateNormal : u.playbackRateTimes(l) }, l))
|
|
501
501
|
}
|
|
502
502
|
);
|
|
503
503
|
}
|
|
504
504
|
Vr.displayName = "Ginger.Control.PlaybackRate";
|
|
505
|
-
function
|
|
506
|
-
function
|
|
507
|
-
const
|
|
505
|
+
function re(e, r) {
|
|
506
|
+
function n(a) {
|
|
507
|
+
const t = S(), o = (r(t) ?? "").trim(), { className: u, style: p, fallback: l, empty: f, children: m } = a;
|
|
508
508
|
if (!o) {
|
|
509
|
-
const M = f ??
|
|
510
|
-
return M ? /* @__PURE__ */ c("span", { className: u, style:
|
|
509
|
+
const M = f ?? l ?? null;
|
|
510
|
+
return M ? /* @__PURE__ */ c("span", { className: u, style: p, children: M }) : null;
|
|
511
511
|
}
|
|
512
|
-
return m ? /* @__PURE__ */ c("span", { className: u, style:
|
|
512
|
+
return m ? /* @__PURE__ */ c("span", { className: u, style: p, children: m(o, t) }) : /* @__PURE__ */ c("span", { className: u, style: p, children: o });
|
|
513
513
|
}
|
|
514
|
-
return
|
|
514
|
+
return n.displayName = e, n;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
517
|
-
return
|
|
516
|
+
function te(e, r) {
|
|
517
|
+
return re(e, (n) => r(de(n)));
|
|
518
518
|
}
|
|
519
|
-
const
|
|
519
|
+
const Kt = te("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), qt = te("Ginger.Current.Artist", (e) => e == null ? void 0 : e.artist), Jt = re("Ginger.Current.Album", (e) => Lt(e)), Zt = te(
|
|
520
520
|
"Ginger.Current.Description",
|
|
521
521
|
(e) => e == null ? void 0 : e.description
|
|
522
|
-
),
|
|
523
|
-
var
|
|
524
|
-
const r =
|
|
525
|
-
return (r == null ? void 0 : r.copyright) ?? ((
|
|
526
|
-
}),
|
|
522
|
+
), en = re("Ginger.Current.Copyright", (e) => {
|
|
523
|
+
var n;
|
|
524
|
+
const r = de(e);
|
|
525
|
+
return (r == null ? void 0 : r.copyright) ?? ((n = e.playlistMeta) == null ? void 0 : n.copyright);
|
|
526
|
+
}), rn = te("Ginger.Current.Genre", (e) => e == null ? void 0 : e.genre), tn = te("Ginger.Current.Label", (e) => e == null ? void 0 : e.label), nn = te("Ginger.Current.Isrc", (e) => e == null ? void 0 : e.isrc), an = te(
|
|
527
527
|
"Ginger.Current.TrackNumber",
|
|
528
528
|
(e) => (e == null ? void 0 : e.trackNumber) != null ? String(e.trackNumber) : void 0
|
|
529
529
|
);
|
|
530
|
-
function Br({ className: e, style: r, fallback:
|
|
531
|
-
var
|
|
532
|
-
const o =
|
|
530
|
+
function Br({ className: e, style: r, fallback: n, empty: a, children: t, format: i }) {
|
|
531
|
+
var l;
|
|
532
|
+
const o = S(), u = (l = de(o)) == null ? void 0 : l.year;
|
|
533
533
|
if (typeof u != "number" || !Number.isFinite(u)) {
|
|
534
|
-
const f = a ??
|
|
534
|
+
const f = a ?? n ?? null;
|
|
535
535
|
return f ? /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: f }) : null;
|
|
536
536
|
}
|
|
537
|
-
const
|
|
538
|
-
return
|
|
537
|
+
const p = i ? i(u) : String(u);
|
|
538
|
+
return t ? /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: t(p, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: p });
|
|
539
539
|
}
|
|
540
540
|
Br.displayName = "Ginger.Current.Year";
|
|
541
541
|
function Or({
|
|
542
542
|
className: e,
|
|
543
543
|
style: r,
|
|
544
|
-
fallback:
|
|
544
|
+
fallback: n,
|
|
545
545
|
empty: a,
|
|
546
|
-
children:
|
|
546
|
+
children: t,
|
|
547
547
|
preserveWhitespace: i = !0,
|
|
548
548
|
unstyled: o = !1
|
|
549
549
|
}) {
|
|
550
550
|
var m;
|
|
551
|
-
const u =
|
|
552
|
-
if (!
|
|
553
|
-
const M = a ??
|
|
551
|
+
const u = S(), p = ((m = de(u)) == null ? void 0 : m.lyrics) ?? "", l = i ? p.replace(/^\s+|\s+$/g, "") : p.trim();
|
|
552
|
+
if (!l) {
|
|
553
|
+
const M = a ?? n ?? null;
|
|
554
554
|
return M ? /* @__PURE__ */ c("span", { "data-ginger-component": "Lyrics", className: e, style: r, children: M }) : null;
|
|
555
555
|
}
|
|
556
556
|
const f = !o && i ? { whiteSpace: "pre-wrap" } : void 0;
|
|
557
|
-
return
|
|
557
|
+
return t ? /* @__PURE__ */ c("span", { className: e, style: { ...f, ...r }, children: t(l, u) }) : /* @__PURE__ */ c("span", { className: e, style: { ...f, ...r }, children: l });
|
|
558
558
|
}
|
|
559
559
|
Or.displayName = "Ginger.Current.Lyrics";
|
|
560
560
|
const mr = /\[(\d{1,2}):(\d{2})(?:\.(\d{1,3}))?\]/g;
|
|
561
|
-
function
|
|
561
|
+
function on(e) {
|
|
562
562
|
const r = [];
|
|
563
|
-
for (const
|
|
564
|
-
const a = [...
|
|
563
|
+
for (const n of e.split(/\r?\n/)) {
|
|
564
|
+
const a = [...n.matchAll(mr)];
|
|
565
565
|
if (a.length === 0) continue;
|
|
566
|
-
const
|
|
566
|
+
const t = n.replace(mr, "").trim();
|
|
567
567
|
for (const i of a) {
|
|
568
|
-
const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0),
|
|
569
|
-
Number.isFinite(
|
|
568
|
+
const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0), p = Number((i[3] ?? "0").padEnd(3, "0")), l = o * 60 + u + p / 1e3;
|
|
569
|
+
Number.isFinite(l) && l >= 0 && r.push({ time: l, text: t });
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
-
return r.sort((
|
|
572
|
+
return r.sort((n, a) => n.time - a.time);
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
const { tracks: e, currentIndex: r } =
|
|
576
|
-
for (let o =
|
|
577
|
-
if (
|
|
574
|
+
function cn() {
|
|
575
|
+
const { tracks: e, currentIndex: r } = C(), { currentTime: n } = le(), a = e[r], t = A(() => a ? Array.isArray(a.lyricsTimed) && a.lyricsTimed.length > 0 ? [...a.lyricsTimed].filter((o) => Number.isFinite(o.time) && o.time >= 0).sort((o, u) => o.time - u.time) : typeof a.lyrics == "string" ? on(a.lyrics) : [] : [], [a]), i = A(() => {
|
|
576
|
+
for (let o = t.length - 1; o >= 0; o -= 1)
|
|
577
|
+
if (n >= t[o].time) return o;
|
|
578
578
|
return -1;
|
|
579
|
-
}, [
|
|
579
|
+
}, [n, t]);
|
|
580
580
|
return {
|
|
581
|
-
lines:
|
|
581
|
+
lines: t,
|
|
582
582
|
activeIndex: i,
|
|
583
|
-
activeLine: i >= 0 ?
|
|
583
|
+
activeLine: i >= 0 ? t[i] ?? null : null
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
586
|
function $r({
|
|
587
587
|
className: e,
|
|
588
588
|
style: r,
|
|
589
|
-
fallback:
|
|
589
|
+
fallback: n,
|
|
590
590
|
empty: a,
|
|
591
|
-
unstyled:
|
|
591
|
+
unstyled: t = !1,
|
|
592
592
|
activeClassName: i,
|
|
593
593
|
lineClassName: o,
|
|
594
594
|
children: u
|
|
595
595
|
}) {
|
|
596
|
-
const
|
|
596
|
+
const p = S(), l = F(), { lines: f, activeIndex: m } = cn();
|
|
597
597
|
if (f.length === 0) {
|
|
598
|
-
const g = a ??
|
|
598
|
+
const g = a ?? n ?? null;
|
|
599
599
|
return g ? /* @__PURE__ */ c("span", { "data-ginger-component": "LyricsSynced", className: e, style: r, children: g }) : null;
|
|
600
600
|
}
|
|
601
601
|
return /* @__PURE__ */ c(
|
|
602
602
|
"ul",
|
|
603
603
|
{
|
|
604
604
|
className: e,
|
|
605
|
-
style: { ...
|
|
605
|
+
style: { ...t ? {} : {
|
|
606
606
|
listStyle: "none",
|
|
607
607
|
margin: 0,
|
|
608
608
|
padding: 0,
|
|
@@ -610,7 +610,7 @@ function $r({
|
|
|
610
610
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
611
611
|
color: "var(--ginger-primary-color, #111827)"
|
|
612
612
|
}, ...r },
|
|
613
|
-
"aria-label":
|
|
613
|
+
"aria-label": l.syncedLyricsList,
|
|
614
614
|
children: f.map((g, h) => {
|
|
615
615
|
const x = h === m;
|
|
616
616
|
return /* @__PURE__ */ c(
|
|
@@ -619,12 +619,12 @@ function $r({
|
|
|
619
619
|
"aria-current": x ? "true" : void 0,
|
|
620
620
|
"data-ginger-active": x || void 0,
|
|
621
621
|
className: [o, x ? i : void 0].filter(Boolean).join(" ") || void 0,
|
|
622
|
-
style:
|
|
622
|
+
style: t ? void 0 : {
|
|
623
623
|
padding: "var(--ginger-playlist-row-padding, 4px 8px)",
|
|
624
624
|
fontWeight: x ? 600 : 400,
|
|
625
625
|
opacity: x ? 1 : 0.75
|
|
626
626
|
},
|
|
627
|
-
children: u ? u(g, h, x,
|
|
627
|
+
children: u ? u(g, h, x, p) : g.text
|
|
628
628
|
},
|
|
629
629
|
`${g.time}-${h}`
|
|
630
630
|
);
|
|
@@ -633,22 +633,22 @@ function $r({
|
|
|
633
633
|
);
|
|
634
634
|
}
|
|
635
635
|
$r.displayName = "Ginger.Current.LyricsSynced";
|
|
636
|
-
function
|
|
637
|
-
const { tracks: e, currentIndex: r } =
|
|
636
|
+
function sn() {
|
|
637
|
+
const { tracks: e, currentIndex: r } = C(), { currentTime: n, seek: a } = le(), t = A(() => {
|
|
638
638
|
var u;
|
|
639
|
-
return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((
|
|
640
|
-
}, [r, e]), i =
|
|
641
|
-
if (
|
|
642
|
-
for (let o =
|
|
643
|
-
if (
|
|
639
|
+
return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((p) => p && Number.isFinite(p.startSeconds) && p.startSeconds >= 0).sort((p, l) => p.startSeconds - l.startSeconds);
|
|
640
|
+
}, [r, e]), i = A(() => {
|
|
641
|
+
if (t.length === 0) return -1;
|
|
642
|
+
for (let o = t.length - 1; o >= 0; o -= 1)
|
|
643
|
+
if (n >= t[o].startSeconds) return o;
|
|
644
644
|
return -1;
|
|
645
|
-
}, [
|
|
645
|
+
}, [n, t]);
|
|
646
646
|
return {
|
|
647
|
-
list:
|
|
647
|
+
list: t,
|
|
648
648
|
activeIndex: i,
|
|
649
|
-
active: i >= 0 ?
|
|
649
|
+
active: i >= 0 ? t[i] ?? null : null,
|
|
650
650
|
seekTo: (o) => {
|
|
651
|
-
const u =
|
|
651
|
+
const u = t[o];
|
|
652
652
|
u && a(u.startSeconds);
|
|
653
653
|
}
|
|
654
654
|
};
|
|
@@ -656,25 +656,25 @@ function rt() {
|
|
|
656
656
|
function Yr({
|
|
657
657
|
className: e,
|
|
658
658
|
style: r,
|
|
659
|
-
fallback:
|
|
659
|
+
fallback: n,
|
|
660
660
|
empty: a,
|
|
661
|
-
unstyled:
|
|
662
|
-
formatStart: i =
|
|
661
|
+
unstyled: t = !1,
|
|
662
|
+
formatStart: i = ge,
|
|
663
663
|
children: o
|
|
664
664
|
}) {
|
|
665
|
-
const u =
|
|
666
|
-
if (
|
|
667
|
-
const g = a ??
|
|
665
|
+
const u = S(), p = F(), { list: l, activeIndex: f, seekTo: m } = sn();
|
|
666
|
+
if (l.length === 0) {
|
|
667
|
+
const g = a ?? n ?? null;
|
|
668
668
|
return g ? /* @__PURE__ */ c("span", { "data-ginger-component": "Chapters", className: e, style: r, children: g }) : null;
|
|
669
669
|
}
|
|
670
|
-
return /* @__PURE__ */ c("ul", { className: e, style: { ...
|
|
670
|
+
return /* @__PURE__ */ c("ul", { className: e, style: { ...t ? {} : {
|
|
671
671
|
listStyle: "none",
|
|
672
672
|
margin: 0,
|
|
673
673
|
padding: 0,
|
|
674
674
|
fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
|
|
675
675
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
676
676
|
color: "var(--ginger-primary-color, #111827)"
|
|
677
|
-
}, ...r }, "aria-label":
|
|
677
|
+
}, ...r }, "aria-label": p.chaptersList, children: l.map((g, h) => {
|
|
678
678
|
const x = h === f;
|
|
679
679
|
return /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
|
|
680
680
|
"button",
|
|
@@ -684,16 +684,16 @@ function Yr({
|
|
|
684
684
|
"data-ginger-active": x || void 0,
|
|
685
685
|
onClick: () => m(h),
|
|
686
686
|
style: {
|
|
687
|
-
width:
|
|
688
|
-
textAlign:
|
|
689
|
-
border:
|
|
690
|
-
background:
|
|
691
|
-
color:
|
|
692
|
-
font:
|
|
693
|
-
cursor:
|
|
694
|
-
padding:
|
|
687
|
+
width: t ? void 0 : "100%",
|
|
688
|
+
textAlign: t ? void 0 : "left",
|
|
689
|
+
border: t ? void 0 : "none",
|
|
690
|
+
background: t ? void 0 : x ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
|
|
691
|
+
color: t ? void 0 : "inherit",
|
|
692
|
+
font: t ? void 0 : "inherit",
|
|
693
|
+
cursor: t ? void 0 : "pointer",
|
|
694
|
+
padding: t ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)"
|
|
695
695
|
},
|
|
696
|
-
children: o ? o(g, h, x, u) :
|
|
696
|
+
children: o ? o(g, h, x, u) : t ? /* @__PURE__ */ N(yr, { children: [
|
|
697
697
|
i(g.startSeconds),
|
|
698
698
|
" ",
|
|
699
699
|
g.title
|
|
@@ -709,37 +709,37 @@ Yr.displayName = "Ginger.Current.Chapters";
|
|
|
709
709
|
function Hr({
|
|
710
710
|
visible: e = !1,
|
|
711
711
|
className: r,
|
|
712
|
-
style:
|
|
712
|
+
style: n,
|
|
713
713
|
fallback: a,
|
|
714
|
-
empty:
|
|
714
|
+
empty: t,
|
|
715
715
|
children: i
|
|
716
716
|
}) {
|
|
717
|
-
var
|
|
718
|
-
const o =
|
|
717
|
+
var p;
|
|
718
|
+
const o = S();
|
|
719
719
|
if (!e) return null;
|
|
720
|
-
const u = ((
|
|
720
|
+
const u = ((p = de(o)) == null ? void 0 : p.fileUrl) ?? "";
|
|
721
721
|
if (!u) {
|
|
722
|
-
const
|
|
723
|
-
return
|
|
722
|
+
const l = t ?? a ?? null;
|
|
723
|
+
return l ? /* @__PURE__ */ c("span", { className: r, style: n, children: l }) : null;
|
|
724
724
|
}
|
|
725
|
-
return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "FileUrl", className: r, style:
|
|
725
|
+
return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "FileUrl", className: r, style: n, children: i(u, o) }) : /* @__PURE__ */ c("span", { className: r, style: n, children: u });
|
|
726
726
|
}
|
|
727
727
|
Hr.displayName = "Ginger.Current.FileUrl";
|
|
728
728
|
function Qr({
|
|
729
729
|
className: e,
|
|
730
730
|
style: r,
|
|
731
|
-
fallback:
|
|
731
|
+
fallback: n,
|
|
732
732
|
empty: a,
|
|
733
|
-
sizes:
|
|
733
|
+
sizes: t,
|
|
734
734
|
loading: i,
|
|
735
735
|
onError: o,
|
|
736
736
|
decoding: u,
|
|
737
|
-
unstyled:
|
|
738
|
-
imgStyle:
|
|
737
|
+
unstyled: p = !1,
|
|
738
|
+
imgStyle: l
|
|
739
739
|
}) {
|
|
740
|
-
const f =
|
|
740
|
+
const f = S(), m = de(f), M = Dt(f);
|
|
741
741
|
if (!M) {
|
|
742
|
-
const h = a ??
|
|
742
|
+
const h = a ?? n ?? null;
|
|
743
743
|
return h ? /* @__PURE__ */ c("span", { className: e, style: r, children: h }) : null;
|
|
744
744
|
}
|
|
745
745
|
const g = [m == null ? void 0 : m.title, m == null ? void 0 : m.artist].filter(Boolean).join(" — ") || "Artwork";
|
|
@@ -748,7 +748,7 @@ function Qr({
|
|
|
748
748
|
{
|
|
749
749
|
"data-ginger-component": "Artwork",
|
|
750
750
|
className: e,
|
|
751
|
-
style:
|
|
751
|
+
style: p ? { ...r } : {
|
|
752
752
|
background: "var(--ginger-artwork-bg, transparent)",
|
|
753
753
|
borderRadius: "var(--ginger-artwork-radius, 0)",
|
|
754
754
|
overflow: "hidden",
|
|
@@ -759,16 +759,16 @@ function Qr({
|
|
|
759
759
|
{
|
|
760
760
|
src: M,
|
|
761
761
|
alt: g,
|
|
762
|
-
sizes:
|
|
762
|
+
sizes: t,
|
|
763
763
|
loading: i,
|
|
764
764
|
decoding: u,
|
|
765
765
|
onError: o,
|
|
766
766
|
style: {
|
|
767
|
-
display:
|
|
768
|
-
width:
|
|
769
|
-
height:
|
|
770
|
-
objectFit:
|
|
771
|
-
...
|
|
767
|
+
display: p ? void 0 : "block",
|
|
768
|
+
width: p ? void 0 : "100%",
|
|
769
|
+
height: p ? void 0 : "100%",
|
|
770
|
+
objectFit: p ? void 0 : "cover",
|
|
771
|
+
...l
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
)
|
|
@@ -779,96 +779,96 @@ Qr.displayName = "Ginger.Current.Artwork";
|
|
|
779
779
|
function jr({
|
|
780
780
|
base: e = 0,
|
|
781
781
|
className: r,
|
|
782
|
-
style:
|
|
782
|
+
style: n,
|
|
783
783
|
fallback: a,
|
|
784
|
-
empty:
|
|
784
|
+
empty: t,
|
|
785
785
|
children: i
|
|
786
786
|
}) {
|
|
787
|
-
const o =
|
|
787
|
+
const o = S();
|
|
788
788
|
if (o.tracks.length === 0) {
|
|
789
|
-
const
|
|
790
|
-
return
|
|
789
|
+
const l = t ?? a ?? null;
|
|
790
|
+
return l ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: n, children: l }) : null;
|
|
791
791
|
}
|
|
792
|
-
const
|
|
793
|
-
return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style:
|
|
792
|
+
const p = String(o.currentIndex + e);
|
|
793
|
+
return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: n, children: i(p, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: n, children: p });
|
|
794
794
|
}
|
|
795
795
|
jr.displayName = "Ginger.Current.QueueIndex";
|
|
796
|
-
function zr({ className: e, style: r, fallback:
|
|
797
|
-
const i =
|
|
796
|
+
function zr({ className: e, style: r, fallback: n, empty: a, children: t }) {
|
|
797
|
+
const i = S(), o = String(i.tracks.length);
|
|
798
798
|
if (i.tracks.length === 0) {
|
|
799
|
-
const u = a ??
|
|
799
|
+
const u = a ?? n ?? null;
|
|
800
800
|
return u ? /* @__PURE__ */ c("span", { className: e, style: r, children: u }) : null;
|
|
801
801
|
}
|
|
802
|
-
return
|
|
802
|
+
return t ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: t(o, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: o });
|
|
803
803
|
}
|
|
804
804
|
zr.displayName = "Ginger.Current.QueueLength";
|
|
805
805
|
function Wr({
|
|
806
806
|
base: e = 0,
|
|
807
807
|
separator: r = " / ",
|
|
808
|
-
className:
|
|
808
|
+
className: n,
|
|
809
809
|
style: a,
|
|
810
|
-
fallback:
|
|
810
|
+
fallback: t,
|
|
811
811
|
empty: i,
|
|
812
812
|
children: o
|
|
813
813
|
}) {
|
|
814
|
-
const u =
|
|
815
|
-
if (
|
|
816
|
-
const M = i ??
|
|
817
|
-
return M ? /* @__PURE__ */ c("span", { className:
|
|
814
|
+
const u = S(), p = u.tracks.length;
|
|
815
|
+
if (p === 0) {
|
|
816
|
+
const M = i ?? t ?? null;
|
|
817
|
+
return M ? /* @__PURE__ */ c("span", { className: n, style: a, children: M }) : null;
|
|
818
818
|
}
|
|
819
|
-
const
|
|
820
|
-
return o ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className:
|
|
819
|
+
const l = String(u.currentIndex + e), f = String(p), m = `${l}${r}${f}`;
|
|
820
|
+
return o ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: n, style: a, children: o({ index: l, length: f, label: m }, u) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: n, style: a, children: m });
|
|
821
821
|
}
|
|
822
822
|
Wr.displayName = "Ginger.Current.QueuePosition";
|
|
823
|
-
function We(e, r,
|
|
824
|
-
const { className: a, style:
|
|
823
|
+
function We(e, r, n) {
|
|
824
|
+
const { className: a, style: t, fallback: i, empty: o, children: u, format: p = ge } = n;
|
|
825
825
|
if (!(e >= 0) || !Number.isFinite(e)) {
|
|
826
826
|
const f = o ?? i ?? null;
|
|
827
|
-
return f ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style:
|
|
827
|
+
return f ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: t, children: f }) : null;
|
|
828
828
|
}
|
|
829
|
-
const
|
|
830
|
-
return u ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style:
|
|
829
|
+
const l = p(e);
|
|
830
|
+
return u ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: t, children: u(l, r) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: t, children: l });
|
|
831
831
|
}
|
|
832
832
|
function Xr(e) {
|
|
833
|
-
const r =
|
|
833
|
+
const r = S();
|
|
834
834
|
return We(r.currentTime, r, e);
|
|
835
835
|
}
|
|
836
836
|
Xr.displayName = "Ginger.Current.Elapsed";
|
|
837
837
|
function Kr(e) {
|
|
838
|
-
const r =
|
|
838
|
+
const r = S();
|
|
839
839
|
return We(ze(r), r, e);
|
|
840
840
|
}
|
|
841
841
|
Kr.displayName = "Ginger.Current.Duration";
|
|
842
842
|
function qr(e) {
|
|
843
|
-
const r =
|
|
844
|
-
return We(
|
|
843
|
+
const r = S();
|
|
844
|
+
return We(Ut(r), r, e);
|
|
845
845
|
}
|
|
846
846
|
qr.displayName = "Ginger.Current.Remaining";
|
|
847
|
-
function Jr({ className: e, style: r, fallback:
|
|
848
|
-
const i =
|
|
847
|
+
function Jr({ className: e, style: r, fallback: n, empty: a, children: t }) {
|
|
848
|
+
const i = S(), o = ze(i), u = vr(i);
|
|
849
849
|
if (!(o > 0)) {
|
|
850
|
-
const
|
|
851
|
-
return
|
|
850
|
+
const p = a ?? n ?? null;
|
|
851
|
+
return p ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: p }) : null;
|
|
852
852
|
}
|
|
853
|
-
return
|
|
853
|
+
return t ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: t({ fraction: u, currentTime: i.currentTime, duration: o }, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: `${Math.round(u * 100)}%` });
|
|
854
854
|
}
|
|
855
855
|
Jr.displayName = "Ginger.Current.Progress";
|
|
856
856
|
function Zr({
|
|
857
857
|
className: e,
|
|
858
858
|
style: r,
|
|
859
|
-
height:
|
|
859
|
+
height: n = 4,
|
|
860
860
|
showBuffered: a = !1,
|
|
861
|
-
unstyled:
|
|
861
|
+
unstyled: t = !1
|
|
862
862
|
}) {
|
|
863
|
-
const i =
|
|
863
|
+
const i = S(), o = `${Math.round(vr(i) * 100)}%`, u = `${Math.round(Math.min(1, Math.max(0, i.bufferedFraction)) * 100)}%`;
|
|
864
864
|
return /* @__PURE__ */ N(
|
|
865
865
|
"div",
|
|
866
866
|
{
|
|
867
867
|
"data-ginger-component": "TimeRail",
|
|
868
868
|
className: e,
|
|
869
|
-
style:
|
|
869
|
+
style: t ? { ...r } : {
|
|
870
870
|
width: "100%",
|
|
871
|
-
height:
|
|
871
|
+
height: n,
|
|
872
872
|
background: "var(--ginger-muted-color, #e5e7eb)",
|
|
873
873
|
borderRadius: 999,
|
|
874
874
|
overflow: "hidden",
|
|
@@ -882,12 +882,12 @@ function Zr({
|
|
|
882
882
|
{
|
|
883
883
|
"data-ginger-component": "TimeRail",
|
|
884
884
|
style: {
|
|
885
|
-
position:
|
|
886
|
-
left:
|
|
887
|
-
top:
|
|
888
|
-
height:
|
|
885
|
+
position: t ? void 0 : "absolute",
|
|
886
|
+
left: t ? void 0 : 0,
|
|
887
|
+
top: t ? void 0 : 0,
|
|
888
|
+
height: t ? void 0 : "100%",
|
|
889
889
|
width: u,
|
|
890
|
-
background:
|
|
890
|
+
background: t ? void 0 : "var(--ginger-buffer-color, rgba(107, 114, 128, 0.35))"
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
893
|
) : null,
|
|
@@ -896,10 +896,10 @@ function Zr({
|
|
|
896
896
|
{
|
|
897
897
|
"data-ginger-component": "TimeRail",
|
|
898
898
|
style: {
|
|
899
|
-
position:
|
|
899
|
+
position: t ? void 0 : "relative",
|
|
900
900
|
width: o,
|
|
901
|
-
height:
|
|
902
|
-
background:
|
|
901
|
+
height: t ? void 0 : "100%",
|
|
902
|
+
background: t ? void 0 : "var(--ginger-primary-color, #111827)"
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
)
|
|
@@ -908,8 +908,8 @@ function Zr({
|
|
|
908
908
|
);
|
|
909
909
|
}
|
|
910
910
|
Zr.displayName = "Ginger.Current.TimeRail";
|
|
911
|
-
function
|
|
912
|
-
const
|
|
911
|
+
function et({ className: e, style: r, height: n = 4, unstyled: a = !1 }) {
|
|
912
|
+
const t = S(), i = `${Math.round(Math.min(1, Math.max(0, t.bufferedFraction)) * 100)}%`;
|
|
913
913
|
return /* @__PURE__ */ c(
|
|
914
914
|
"div",
|
|
915
915
|
{
|
|
@@ -917,7 +917,7 @@ function en({ className: e, style: r, height: t = 4, unstyled: a = !1 }) {
|
|
|
917
917
|
className: e,
|
|
918
918
|
style: a ? { ...r } : {
|
|
919
919
|
width: "100%",
|
|
920
|
-
height:
|
|
920
|
+
height: n,
|
|
921
921
|
background: "var(--ginger-muted-color, #e5e7eb)",
|
|
922
922
|
borderRadius: 999,
|
|
923
923
|
overflow: "hidden",
|
|
@@ -938,24 +938,24 @@ function en({ className: e, style: r, height: t = 4, unstyled: a = !1 }) {
|
|
|
938
938
|
}
|
|
939
939
|
);
|
|
940
940
|
}
|
|
941
|
-
|
|
942
|
-
function
|
|
943
|
-
const i =
|
|
944
|
-
return
|
|
941
|
+
et.displayName = "Ginger.Current.BufferRail";
|
|
942
|
+
function rt({ className: e, style: r, fallback: n, empty: a, children: t }) {
|
|
943
|
+
const i = S(), o = kr(i);
|
|
944
|
+
return t ? /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: t(o, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: o });
|
|
945
945
|
}
|
|
946
|
-
|
|
947
|
-
function
|
|
946
|
+
rt.displayName = "Ginger.Current.PlaybackState";
|
|
947
|
+
function tt({
|
|
948
948
|
className: e,
|
|
949
949
|
style: r,
|
|
950
|
-
fallback:
|
|
950
|
+
fallback: n,
|
|
951
951
|
empty: a,
|
|
952
|
-
live:
|
|
952
|
+
live: t = "polite",
|
|
953
953
|
children: i
|
|
954
954
|
}) {
|
|
955
|
-
const o =
|
|
955
|
+
const o = S(), u = o.errorMessage ?? "";
|
|
956
956
|
if (!u) {
|
|
957
|
-
const
|
|
958
|
-
return
|
|
957
|
+
const p = a ?? n ?? null;
|
|
958
|
+
return p ? /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, children: p }) : null;
|
|
959
959
|
}
|
|
960
960
|
return i ? /* @__PURE__ */ c(
|
|
961
961
|
"span",
|
|
@@ -963,29 +963,29 @@ function nn({
|
|
|
963
963
|
"data-ginger-component": "ErrorMessage",
|
|
964
964
|
className: e,
|
|
965
965
|
style: r,
|
|
966
|
-
"aria-live":
|
|
966
|
+
"aria-live": t,
|
|
967
967
|
children: i(u, o)
|
|
968
968
|
}
|
|
969
|
-
) : /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, "aria-live":
|
|
969
|
+
) : /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, "aria-live": t, children: u });
|
|
970
970
|
}
|
|
971
|
-
|
|
972
|
-
const
|
|
973
|
-
function
|
|
974
|
-
const e =
|
|
971
|
+
tt.displayName = "Ginger.Current.ErrorMessage";
|
|
972
|
+
const je = me(null);
|
|
973
|
+
function un() {
|
|
974
|
+
const e = fe(je);
|
|
975
975
|
if (!e)
|
|
976
976
|
throw new Error("Ginger.Playlist.Track must be used inside <Ginger.Playlist>");
|
|
977
977
|
return e;
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function nt({
|
|
980
980
|
children: e,
|
|
981
981
|
unstyled: r = !1,
|
|
982
|
-
rowStyle:
|
|
982
|
+
rowStyle: n,
|
|
983
983
|
renderTrack: a,
|
|
984
|
-
playOnSelect:
|
|
984
|
+
playOnSelect: t = !0,
|
|
985
985
|
style: i,
|
|
986
986
|
...o
|
|
987
987
|
}) {
|
|
988
|
-
const { tracks: u, currentIndex:
|
|
988
|
+
const { tracks: u, currentIndex: p, playTrackAt: l, selectTrackAt: f } = C(), m = r ? { ...i } : {
|
|
989
989
|
listStyle: "none",
|
|
990
990
|
margin: 0,
|
|
991
991
|
padding: 0,
|
|
@@ -994,14 +994,14 @@ function tn({
|
|
|
994
994
|
color: "var(--ginger-primary-color, #111827)",
|
|
995
995
|
...i
|
|
996
996
|
};
|
|
997
|
-
return e !== void 0 ? /* @__PURE__ */ c(
|
|
998
|
-
const x = h ===
|
|
997
|
+
return e !== void 0 ? /* @__PURE__ */ c(je.Provider, { value: { playOnSelect: t }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: m, ...o, children: e }) }) : /* @__PURE__ */ c(je.Provider, { value: { playOnSelect: t }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: m, ...o, children: u.map((g, h) => {
|
|
998
|
+
const x = h === p;
|
|
999
999
|
return /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
|
|
1000
1000
|
"button",
|
|
1001
1001
|
{
|
|
1002
1002
|
type: "button",
|
|
1003
1003
|
onClick: () => {
|
|
1004
|
-
|
|
1004
|
+
t ? l(h) : f(h);
|
|
1005
1005
|
},
|
|
1006
1006
|
style: {
|
|
1007
1007
|
width: r ? void 0 : "100%",
|
|
@@ -1012,28 +1012,28 @@ function tn({
|
|
|
1012
1012
|
font: r ? void 0 : "inherit",
|
|
1013
1013
|
cursor: r ? void 0 : "pointer",
|
|
1014
1014
|
padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
|
|
1015
|
-
...
|
|
1015
|
+
...n
|
|
1016
1016
|
},
|
|
1017
1017
|
children: a ? a(g, h, x) : /* @__PURE__ */ N("span", { children: [
|
|
1018
1018
|
g.title,
|
|
1019
1019
|
g.artist ? ` — ${g.artist}` : ""
|
|
1020
1020
|
] })
|
|
1021
1021
|
}
|
|
1022
|
-
) }, `${h}-${
|
|
1022
|
+
) }, `${h}-${Qe(g)}`);
|
|
1023
1023
|
}) }) });
|
|
1024
1024
|
}
|
|
1025
|
-
|
|
1026
|
-
function
|
|
1025
|
+
nt.displayName = "Ginger.Playlist";
|
|
1026
|
+
function at({
|
|
1027
1027
|
index: e,
|
|
1028
1028
|
unstyled: r = !1,
|
|
1029
|
-
className:
|
|
1029
|
+
className: n,
|
|
1030
1030
|
style: a,
|
|
1031
|
-
children:
|
|
1031
|
+
children: t,
|
|
1032
1032
|
liProps: i,
|
|
1033
1033
|
onClick: o,
|
|
1034
1034
|
...u
|
|
1035
1035
|
}) {
|
|
1036
|
-
const { playOnSelect:
|
|
1036
|
+
const { playOnSelect: p } = un(), { tracks: l, currentIndex: f, playTrackAt: m, selectTrackAt: M } = C(), g = e === f, h = l[e], x = h != null ? /* @__PURE__ */ N("span", { "data-ginger-component": "PlaylistTrack", children: [
|
|
1037
1037
|
h.title,
|
|
1038
1038
|
h.artist ? ` — ${h.artist}` : ""
|
|
1039
1039
|
] }) : null;
|
|
@@ -1044,7 +1044,7 @@ function an({
|
|
|
1044
1044
|
"data-ginger-component": "PlaylistTrackButton",
|
|
1045
1045
|
"aria-current": g ? "true" : void 0,
|
|
1046
1046
|
"data-ginger-active": g || void 0,
|
|
1047
|
-
className:
|
|
1047
|
+
className: n,
|
|
1048
1048
|
style: {
|
|
1049
1049
|
width: r ? void 0 : "100%",
|
|
1050
1050
|
textAlign: r ? void 0 : "left",
|
|
@@ -1058,55 +1058,55 @@ function an({
|
|
|
1058
1058
|
},
|
|
1059
1059
|
...u,
|
|
1060
1060
|
onClick: (y) => {
|
|
1061
|
-
o == null || o(y), !y.defaultPrevented && (
|
|
1061
|
+
o == null || o(y), !y.defaultPrevented && (p ? m(e) : M(e));
|
|
1062
1062
|
},
|
|
1063
|
-
children:
|
|
1063
|
+
children: t ?? x
|
|
1064
1064
|
}
|
|
1065
1065
|
) });
|
|
1066
1066
|
}
|
|
1067
|
-
|
|
1068
|
-
const
|
|
1069
|
-
Track:
|
|
1070
|
-
}),
|
|
1067
|
+
at.displayName = "Ginger.Playlist.Track";
|
|
1068
|
+
const ln = Object.assign(nt, {
|
|
1069
|
+
Track: at
|
|
1070
|
+
}), dn = re("Ginger.Queue.Title", (e) => {
|
|
1071
1071
|
var r;
|
|
1072
1072
|
return (r = e.playlistMeta) == null ? void 0 : r.title;
|
|
1073
|
-
}),
|
|
1073
|
+
}), pn = re("Ginger.Queue.Subtitle", (e) => {
|
|
1074
1074
|
var r;
|
|
1075
1075
|
return (r = e.playlistMeta) == null ? void 0 : r.subtitle;
|
|
1076
|
-
}),
|
|
1076
|
+
}), gn = re(
|
|
1077
1077
|
"Ginger.Queue.Description",
|
|
1078
1078
|
(e) => {
|
|
1079
1079
|
var r;
|
|
1080
1080
|
return (r = e.playlistMeta) == null ? void 0 : r.description;
|
|
1081
1081
|
}
|
|
1082
|
-
),
|
|
1082
|
+
), fn = re(
|
|
1083
1083
|
"Ginger.Queue.Copyright",
|
|
1084
1084
|
(e) => {
|
|
1085
1085
|
var r;
|
|
1086
1086
|
return (r = e.playlistMeta) == null ? void 0 : r.copyright;
|
|
1087
1087
|
}
|
|
1088
1088
|
);
|
|
1089
|
-
function
|
|
1089
|
+
function it({
|
|
1090
1090
|
className: e,
|
|
1091
1091
|
style: r,
|
|
1092
|
-
fallback:
|
|
1092
|
+
fallback: n,
|
|
1093
1093
|
empty: a,
|
|
1094
|
-
unstyled:
|
|
1094
|
+
unstyled: t = !1,
|
|
1095
1095
|
imgStyle: i
|
|
1096
1096
|
}) {
|
|
1097
|
-
var
|
|
1098
|
-
const o =
|
|
1097
|
+
var l, f;
|
|
1098
|
+
const o = S(), u = (l = o.playlistMeta) == null ? void 0 : l.artworkUrl;
|
|
1099
1099
|
if (!u) {
|
|
1100
|
-
const m = a ??
|
|
1100
|
+
const m = a ?? n ?? null;
|
|
1101
1101
|
return m ? /* @__PURE__ */ c("span", { "data-ginger-component": "Artwork", className: e, style: r, children: m }) : null;
|
|
1102
1102
|
}
|
|
1103
|
-
const
|
|
1103
|
+
const p = ((f = o.playlistMeta) == null ? void 0 : f.title) ?? "Playlist artwork";
|
|
1104
1104
|
return /* @__PURE__ */ c(
|
|
1105
1105
|
"span",
|
|
1106
1106
|
{
|
|
1107
1107
|
"data-ginger-component": "Artwork",
|
|
1108
1108
|
className: e,
|
|
1109
|
-
style:
|
|
1109
|
+
style: t ? { ...r } : {
|
|
1110
1110
|
display: "inline-block",
|
|
1111
1111
|
background: "var(--ginger-artwork-bg, #f3f4f6)",
|
|
1112
1112
|
borderRadius: "var(--ginger-artwork-radius, 6px)",
|
|
@@ -1117,12 +1117,12 @@ function on({
|
|
|
1117
1117
|
"img",
|
|
1118
1118
|
{
|
|
1119
1119
|
src: u,
|
|
1120
|
-
alt:
|
|
1120
|
+
alt: p,
|
|
1121
1121
|
style: {
|
|
1122
|
-
display:
|
|
1123
|
-
width:
|
|
1124
|
-
height:
|
|
1125
|
-
objectFit:
|
|
1122
|
+
display: t ? void 0 : "block",
|
|
1123
|
+
width: t ? void 0 : "100%",
|
|
1124
|
+
height: t ? void 0 : "100%",
|
|
1125
|
+
objectFit: t ? void 0 : "cover",
|
|
1126
1126
|
...i
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
@@ -1130,8 +1130,136 @@ function on({
|
|
|
1130
1130
|
}
|
|
1131
1131
|
);
|
|
1132
1132
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1133
|
+
it.displayName = "Ginger.Queue.Artwork";
|
|
1134
|
+
const ot = me(null);
|
|
1135
|
+
function mn({
|
|
1136
|
+
children: e,
|
|
1137
|
+
value: r
|
|
1138
|
+
}) {
|
|
1139
|
+
return /* @__PURE__ */ c(ot.Provider, { value: r, children: e });
|
|
1140
|
+
}
|
|
1141
|
+
function yn() {
|
|
1142
|
+
const e = fe(ot);
|
|
1143
|
+
if (!e)
|
|
1144
|
+
throw new Error("Ginger.Track must be used inside <Ginger.Tracks>");
|
|
1145
|
+
return e;
|
|
1146
|
+
}
|
|
1147
|
+
function hn(e) {
|
|
1148
|
+
const r = e.fileUrl ?? e.src;
|
|
1149
|
+
if (!r || r === "")
|
|
1150
|
+
throw new Error("Ginger.Track requires a non-empty fileUrl or src.");
|
|
1151
|
+
const {
|
|
1152
|
+
src: n,
|
|
1153
|
+
fileUrl: a,
|
|
1154
|
+
title: t,
|
|
1155
|
+
id: i,
|
|
1156
|
+
artist: o,
|
|
1157
|
+
copyright: u,
|
|
1158
|
+
description: p,
|
|
1159
|
+
album: l,
|
|
1160
|
+
artworkUrl: f,
|
|
1161
|
+
genre: m,
|
|
1162
|
+
year: M,
|
|
1163
|
+
label: g,
|
|
1164
|
+
isrc: h,
|
|
1165
|
+
trackNumber: x,
|
|
1166
|
+
lyrics: y,
|
|
1167
|
+
lyricsTimed: v,
|
|
1168
|
+
chapters: G,
|
|
1169
|
+
durationSeconds: R,
|
|
1170
|
+
metadata: Z
|
|
1171
|
+
} = e;
|
|
1172
|
+
return {
|
|
1173
|
+
...i !== void 0 ? { id: i } : {},
|
|
1174
|
+
title: t,
|
|
1175
|
+
fileUrl: r,
|
|
1176
|
+
...o !== void 0 ? { artist: o } : {},
|
|
1177
|
+
...u !== void 0 ? { copyright: u } : {},
|
|
1178
|
+
...p !== void 0 ? { description: p } : {},
|
|
1179
|
+
...l !== void 0 ? { album: l } : {},
|
|
1180
|
+
...f !== void 0 ? { artworkUrl: f } : {},
|
|
1181
|
+
...m !== void 0 ? { genre: m } : {},
|
|
1182
|
+
...M !== void 0 ? { year: M } : {},
|
|
1183
|
+
...g !== void 0 ? { label: g } : {},
|
|
1184
|
+
...h !== void 0 ? { isrc: h } : {},
|
|
1185
|
+
...x !== void 0 ? { trackNumber: x } : {},
|
|
1186
|
+
...y !== void 0 ? { lyrics: y } : {},
|
|
1187
|
+
...v !== void 0 ? { lyricsTimed: v } : {},
|
|
1188
|
+
...G !== void 0 ? { chapters: G } : {},
|
|
1189
|
+
...R !== void 0 ? { durationSeconds: R } : {},
|
|
1190
|
+
...Z !== void 0 ? { metadata: Z } : {}
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
function ct(e) {
|
|
1194
|
+
const r = yn(), n = It().replace(/:/g, ""), a = e.id ?? `ginger-decl:${n}`, t = hn({ ...e, id: a });
|
|
1195
|
+
return r.slots.set(a, t), r.order.push(a), null;
|
|
1196
|
+
}
|
|
1197
|
+
ct.displayName = "Ginger.Track";
|
|
1198
|
+
const st = me(
|
|
1199
|
+
null
|
|
1200
|
+
);
|
|
1201
|
+
function vn({
|
|
1202
|
+
children: e,
|
|
1203
|
+
value: r
|
|
1204
|
+
}) {
|
|
1205
|
+
return /* @__PURE__ */ c(st.Provider, { value: r, children: e });
|
|
1206
|
+
}
|
|
1207
|
+
function kn() {
|
|
1208
|
+
return fe(st);
|
|
1209
|
+
}
|
|
1210
|
+
function bn(e, r, n) {
|
|
1211
|
+
switch (e) {
|
|
1212
|
+
case "append":
|
|
1213
|
+
return [...r, ...n];
|
|
1214
|
+
case "prepend":
|
|
1215
|
+
return [...n, ...r];
|
|
1216
|
+
case "replace":
|
|
1217
|
+
return [...n];
|
|
1218
|
+
default:
|
|
1219
|
+
return [...r, ...n];
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
function Tn(e, r) {
|
|
1223
|
+
if (e.length !== r.length) return !1;
|
|
1224
|
+
for (let n = 0; n < e.length; n++) {
|
|
1225
|
+
const a = e[n], t = r[n];
|
|
1226
|
+
if (a !== t && (a.title !== t.title || a.fileUrl !== t.fileUrl || (a.id ?? "") !== (t.id ?? "") || (a.artist ?? "") !== (t.artist ?? "")))
|
|
1227
|
+
return !1;
|
|
1228
|
+
}
|
|
1229
|
+
return !0;
|
|
1230
|
+
}
|
|
1231
|
+
function Mn({
|
|
1232
|
+
merge: e,
|
|
1233
|
+
registry: r
|
|
1234
|
+
}) {
|
|
1235
|
+
const { dispatch: n, tracks: a, currentIndex: t } = C(), i = kn(), o = r.order.map((l) => {
|
|
1236
|
+
const f = r.slots.get(l);
|
|
1237
|
+
return f ? `${l}:${f.fileUrl}:${f.title}` : "";
|
|
1238
|
+
}).join("|"), p = ((i == null ? void 0 : i.getInitialTracksSnapshot()) ?? []).map((l) => `${l.id ?? ""}:${l.fileUrl}:${l.title}`).join("|");
|
|
1239
|
+
return Et(() => {
|
|
1240
|
+
const l = (i == null ? void 0 : i.getInitialTracksSnapshot()) ?? [], f = r.order.map((g) => r.slots.get(g)).filter((g) => g != null), m = bn(e, l, f);
|
|
1241
|
+
if (Tn(m, a)) return;
|
|
1242
|
+
const M = Math.min(t, Math.max(0, m.length - 1));
|
|
1243
|
+
n({ type: "SET_QUEUE", payload: { tracks: m, currentIndex: M } });
|
|
1244
|
+
}, [e, o, p, i, n, r, a, t]), null;
|
|
1245
|
+
}
|
|
1246
|
+
function ut({
|
|
1247
|
+
children: e,
|
|
1248
|
+
merge: r = "append",
|
|
1249
|
+
style: n,
|
|
1250
|
+
hidden: a,
|
|
1251
|
+
...t
|
|
1252
|
+
}) {
|
|
1253
|
+
const i = w(null);
|
|
1254
|
+
i.current || (i.current = { slots: /* @__PURE__ */ new Map(), order: [] });
|
|
1255
|
+
const o = i.current;
|
|
1256
|
+
return o.slots.clear(), o.order.length = 0, /* @__PURE__ */ N(mn, { value: o, children: [
|
|
1257
|
+
/* @__PURE__ */ c("div", { "data-ginger-component": "Tracks", style: { display: "contents", ...n }, ...t, children: e }),
|
|
1258
|
+
/* @__PURE__ */ c(Mn, { merge: r, registry: o })
|
|
1259
|
+
] });
|
|
1260
|
+
}
|
|
1261
|
+
ut.displayName = "Ginger.Tracks";
|
|
1262
|
+
function Be(e) {
|
|
1135
1263
|
return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 1;
|
|
1136
1264
|
}
|
|
1137
1265
|
function Xe(e) {
|
|
@@ -1143,63 +1271,63 @@ const J = {
|
|
|
1143
1271
|
bufferedFraction: 0,
|
|
1144
1272
|
isBuffering: !1,
|
|
1145
1273
|
errorMessage: null
|
|
1146
|
-
},
|
|
1274
|
+
}, xn = {
|
|
1147
1275
|
...J,
|
|
1148
1276
|
volume: 1,
|
|
1149
1277
|
muted: !1,
|
|
1150
1278
|
playbackRate: 1
|
|
1151
1279
|
};
|
|
1152
|
-
function
|
|
1280
|
+
function lt(e) {
|
|
1153
1281
|
const r = [...e.tracks];
|
|
1154
|
-
let
|
|
1155
|
-
return e.isShuffled && r.length > 1 && (a = [...r],
|
|
1156
|
-
tracks:
|
|
1157
|
-
currentIndex:
|
|
1282
|
+
let n = q(e.currentIndex ?? 0, r.length), a = null, t = r;
|
|
1283
|
+
return e.isShuffled && r.length > 1 && (a = [...r], t = br(r, n), n = 0), {
|
|
1284
|
+
tracks: t,
|
|
1285
|
+
currentIndex: n,
|
|
1158
1286
|
playbackMode: e.playbackMode ?? "playlist",
|
|
1159
1287
|
isPaused: e.isPaused ?? !0,
|
|
1160
|
-
isShuffled: !!(e.isShuffled &&
|
|
1288
|
+
isShuffled: !!(e.isShuffled && t.length > 1),
|
|
1161
1289
|
repeatMode: e.repeatMode ?? "off",
|
|
1162
1290
|
originalTracks: a,
|
|
1163
1291
|
playlistMeta: e.playlistMeta ?? null,
|
|
1164
|
-
...
|
|
1165
|
-
volume:
|
|
1292
|
+
...xn,
|
|
1293
|
+
volume: Be(e.volume ?? 1),
|
|
1166
1294
|
muted: e.muted ?? !1,
|
|
1167
1295
|
playbackRate: Xe(e.playbackRate ?? 1)
|
|
1168
1296
|
};
|
|
1169
1297
|
}
|
|
1170
|
-
function
|
|
1298
|
+
function In(e, r) {
|
|
1171
1299
|
switch (r.type) {
|
|
1172
1300
|
case "INIT": {
|
|
1173
1301
|
const {
|
|
1174
|
-
tracks:
|
|
1302
|
+
tracks: n,
|
|
1175
1303
|
currentIndex: a,
|
|
1176
|
-
playlistMeta:
|
|
1304
|
+
playlistMeta: t,
|
|
1177
1305
|
isPaused: i,
|
|
1178
1306
|
isShuffled: o,
|
|
1179
1307
|
repeatMode: u,
|
|
1180
|
-
playbackMode:
|
|
1181
|
-
volume:
|
|
1308
|
+
playbackMode: p,
|
|
1309
|
+
volume: l,
|
|
1182
1310
|
muted: f,
|
|
1183
1311
|
playbackRate: m
|
|
1184
1312
|
} = r.payload;
|
|
1185
|
-
return
|
|
1186
|
-
tracks:
|
|
1313
|
+
return lt({
|
|
1314
|
+
tracks: n,
|
|
1187
1315
|
currentIndex: a,
|
|
1188
|
-
playlistMeta:
|
|
1316
|
+
playlistMeta: t ?? null,
|
|
1189
1317
|
isPaused: i ?? !0,
|
|
1190
1318
|
isShuffled: o ?? !1,
|
|
1191
1319
|
repeatMode: u ?? "off",
|
|
1192
|
-
playbackMode:
|
|
1193
|
-
volume:
|
|
1320
|
+
playbackMode: p ?? "playlist",
|
|
1321
|
+
volume: l,
|
|
1194
1322
|
muted: f,
|
|
1195
1323
|
playbackRate: m
|
|
1196
1324
|
});
|
|
1197
1325
|
}
|
|
1198
1326
|
case "SET_QUEUE": {
|
|
1199
|
-
const { tracks:
|
|
1327
|
+
const { tracks: n, currentIndex: a } = r.payload, t = [...n], i = q(a ?? e.currentIndex, t.length);
|
|
1200
1328
|
return {
|
|
1201
1329
|
...e,
|
|
1202
|
-
tracks:
|
|
1330
|
+
tracks: t,
|
|
1203
1331
|
currentIndex: i,
|
|
1204
1332
|
isShuffled: !1,
|
|
1205
1333
|
originalTracks: null,
|
|
@@ -1207,9 +1335,9 @@ function ut(e, r) {
|
|
|
1207
1335
|
};
|
|
1208
1336
|
}
|
|
1209
1337
|
case "INSERT_TRACK": {
|
|
1210
|
-
const
|
|
1338
|
+
const n = r.payload.index ?? e.tracks.length, a = pr(e.tracks, r.payload.track, n);
|
|
1211
1339
|
if (r.payload.autoPlay) {
|
|
1212
|
-
const o = q(
|
|
1340
|
+
const o = q(n, a.length);
|
|
1213
1341
|
return {
|
|
1214
1342
|
...e,
|
|
1215
1343
|
tracks: a,
|
|
@@ -1220,57 +1348,57 @@ function ut(e, r) {
|
|
|
1220
1348
|
...J
|
|
1221
1349
|
};
|
|
1222
1350
|
}
|
|
1223
|
-
const
|
|
1351
|
+
const t = n <= e.currentIndex ? e.currentIndex + 1 : e.currentIndex, i = e.isShuffled && e.originalTracks ? pr(e.originalTracks, r.payload.track, e.originalTracks.length) : e.originalTracks;
|
|
1224
1352
|
return {
|
|
1225
1353
|
...e,
|
|
1226
1354
|
tracks: a,
|
|
1227
1355
|
originalTracks: i,
|
|
1228
|
-
currentIndex: q(
|
|
1356
|
+
currentIndex: q(t, a.length)
|
|
1229
1357
|
};
|
|
1230
1358
|
}
|
|
1231
1359
|
case "REMOVE_TRACK": {
|
|
1232
|
-
const
|
|
1233
|
-
const u = e.tracks[
|
|
1234
|
-
return dr(e.originalTracks,
|
|
1360
|
+
const n = r.payload.index, a = dr(e.tracks, n), t = n < e.currentIndex ? e.currentIndex - 1 : n === e.currentIndex ? Math.min(e.currentIndex, Math.max(0, a.length - 1)) : e.currentIndex, i = e.isShuffled && e.originalTracks ? (() => {
|
|
1361
|
+
const u = e.tracks[n], p = Ye(e.originalTracks, u);
|
|
1362
|
+
return dr(e.originalTracks, p);
|
|
1235
1363
|
})() : e.originalTracks, o = e.isShuffled && a.length > 1;
|
|
1236
1364
|
return {
|
|
1237
1365
|
...e,
|
|
1238
1366
|
tracks: a,
|
|
1239
1367
|
isShuffled: o,
|
|
1240
1368
|
originalTracks: o ? i : null,
|
|
1241
|
-
currentIndex: q(
|
|
1242
|
-
...
|
|
1369
|
+
currentIndex: q(t, a.length),
|
|
1370
|
+
...n === e.currentIndex ? J : {}
|
|
1243
1371
|
};
|
|
1244
1372
|
}
|
|
1245
1373
|
case "MOVE_TRACK": {
|
|
1246
|
-
const { fromIndex:
|
|
1374
|
+
const { fromIndex: n, toIndex: a } = r.payload, t = Bt(e.tracks, n, a);
|
|
1247
1375
|
let i = e.currentIndex;
|
|
1248
|
-
return e.currentIndex ===
|
|
1376
|
+
return e.currentIndex === n ? i = a : n < e.currentIndex && a >= e.currentIndex ? i -= 1 : n > e.currentIndex && a <= e.currentIndex && (i += 1), {
|
|
1249
1377
|
...e,
|
|
1250
|
-
tracks:
|
|
1378
|
+
tracks: t,
|
|
1251
1379
|
isShuffled: !1,
|
|
1252
1380
|
originalTracks: null,
|
|
1253
|
-
currentIndex: q(i,
|
|
1381
|
+
currentIndex: q(i, t.length)
|
|
1254
1382
|
};
|
|
1255
1383
|
}
|
|
1256
1384
|
case "ADD_NEXT": {
|
|
1257
|
-
const
|
|
1258
|
-
const
|
|
1385
|
+
const n = lr(e.tracks, e.currentIndex, r.payload.track), a = e.isShuffled && e.originalTracks ? (() => {
|
|
1386
|
+
const t = e.tracks[e.currentIndex], i = Ye(e.originalTracks, t);
|
|
1259
1387
|
return lr(e.originalTracks, i, r.payload.track);
|
|
1260
1388
|
})() : e.originalTracks;
|
|
1261
1389
|
return {
|
|
1262
1390
|
...e,
|
|
1263
|
-
tracks:
|
|
1391
|
+
tracks: n,
|
|
1264
1392
|
originalTracks: a
|
|
1265
1393
|
};
|
|
1266
1394
|
}
|
|
1267
1395
|
case "SET_INDEX": {
|
|
1268
|
-
const
|
|
1396
|
+
const n = q(r.payload.index, e.tracks.length), a = r.payload.autoPlay, t = a === !0 ? !1 : a === !1 ? !0 : e.isPaused;
|
|
1269
1397
|
return {
|
|
1270
1398
|
...e,
|
|
1271
|
-
currentIndex:
|
|
1399
|
+
currentIndex: n,
|
|
1272
1400
|
...J,
|
|
1273
|
-
isPaused:
|
|
1401
|
+
isPaused: t
|
|
1274
1402
|
};
|
|
1275
1403
|
}
|
|
1276
1404
|
case "PLAY":
|
|
@@ -1282,11 +1410,11 @@ function ut(e, r) {
|
|
|
1282
1410
|
case "SET_REPEAT":
|
|
1283
1411
|
return { ...e, repeatMode: r.payload };
|
|
1284
1412
|
case "CYCLE_REPEAT":
|
|
1285
|
-
return { ...e, repeatMode:
|
|
1413
|
+
return { ...e, repeatMode: Vt(e.repeatMode) };
|
|
1286
1414
|
case "TOGGLE_SHUFFLE": {
|
|
1287
1415
|
if (e.tracks.length <= 1) return { ...e, isShuffled: !1, originalTracks: null };
|
|
1288
1416
|
if (!e.isShuffled) {
|
|
1289
|
-
const i = [...e.tracks], o =
|
|
1417
|
+
const i = [...e.tracks], o = br(i, e.currentIndex);
|
|
1290
1418
|
return {
|
|
1291
1419
|
...e,
|
|
1292
1420
|
isShuffled: !0,
|
|
@@ -1295,29 +1423,29 @@ function ut(e, r) {
|
|
|
1295
1423
|
currentIndex: 0
|
|
1296
1424
|
};
|
|
1297
1425
|
}
|
|
1298
|
-
const
|
|
1426
|
+
const n = e.originalTracks ? [...e.originalTracks] : [...e.tracks], a = e.tracks[e.currentIndex], t = Ye(n, a);
|
|
1299
1427
|
return {
|
|
1300
1428
|
...e,
|
|
1301
1429
|
isShuffled: !1,
|
|
1302
1430
|
originalTracks: null,
|
|
1303
|
-
tracks:
|
|
1304
|
-
currentIndex: q(
|
|
1431
|
+
tracks: n,
|
|
1432
|
+
currentIndex: q(t, n.length)
|
|
1305
1433
|
};
|
|
1306
1434
|
}
|
|
1307
1435
|
case "NEXT": {
|
|
1308
|
-
const
|
|
1436
|
+
const n = Ft(e), a = n === e.currentIndex;
|
|
1309
1437
|
return {
|
|
1310
1438
|
...e,
|
|
1311
|
-
currentIndex:
|
|
1439
|
+
currentIndex: n,
|
|
1312
1440
|
...a ? {} : J,
|
|
1313
1441
|
isPaused: a ? e.isPaused : !1
|
|
1314
1442
|
};
|
|
1315
1443
|
}
|
|
1316
1444
|
case "PREV": {
|
|
1317
|
-
const
|
|
1445
|
+
const n = Ct(e), a = n === e.currentIndex;
|
|
1318
1446
|
return {
|
|
1319
1447
|
...e,
|
|
1320
|
-
currentIndex:
|
|
1448
|
+
currentIndex: n,
|
|
1321
1449
|
...a ? {} : J,
|
|
1322
1450
|
isPaused: a ? e.isPaused : !1
|
|
1323
1451
|
};
|
|
@@ -1361,7 +1489,7 @@ function ut(e, r) {
|
|
|
1361
1489
|
case "MEDIA_SOURCE_CLEARED":
|
|
1362
1490
|
return { ...e, ...J };
|
|
1363
1491
|
case "SET_VOLUME":
|
|
1364
|
-
return { ...e, volume:
|
|
1492
|
+
return { ...e, volume: Be(r.payload) };
|
|
1365
1493
|
case "SET_MUTED":
|
|
1366
1494
|
return { ...e, muted: r.payload };
|
|
1367
1495
|
case "TOGGLE_MUTE":
|
|
@@ -1369,46 +1497,46 @@ function ut(e, r) {
|
|
|
1369
1497
|
case "SET_PLAYBACK_RATE":
|
|
1370
1498
|
return { ...e, playbackRate: Xe(r.payload) };
|
|
1371
1499
|
case "MEDIA_VOLUME_SYNC": {
|
|
1372
|
-
const { volume:
|
|
1373
|
-
return
|
|
1500
|
+
const { volume: n, muted: a } = r.payload, t = Be(n);
|
|
1501
|
+
return t === e.volume && a === e.muted ? e : { ...e, volume: t, muted: a };
|
|
1374
1502
|
}
|
|
1375
1503
|
default:
|
|
1376
1504
|
return e;
|
|
1377
1505
|
}
|
|
1378
1506
|
}
|
|
1379
|
-
function
|
|
1507
|
+
function Fe() {
|
|
1380
1508
|
return typeof navigator > "u" || !("mediaSession" in navigator) ? null : navigator.mediaSession;
|
|
1381
1509
|
}
|
|
1382
|
-
function
|
|
1510
|
+
function En(e, r, n, a = {}) {
|
|
1383
1511
|
var M;
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1386
|
-
const i = r.tracks[r.currentIndex], o = i == null ? void 0 : i.title, u = i == null ? void 0 : i.artist,
|
|
1512
|
+
const t = w(r);
|
|
1513
|
+
t.current = r;
|
|
1514
|
+
const i = r.tracks[r.currentIndex], o = i == null ? void 0 : i.title, u = i == null ? void 0 : i.artist, p = i == null ? void 0 : i.album, l = Ot(i, (M = r.playlistMeta) == null ? void 0 : M.artworkUrl);
|
|
1387
1515
|
E(() => {
|
|
1388
|
-
const g =
|
|
1516
|
+
const g = Fe();
|
|
1389
1517
|
!e || !g || (g.metadata = new MediaMetadata({
|
|
1390
1518
|
title: o ?? "Unknown track",
|
|
1391
1519
|
artist: u,
|
|
1392
|
-
album:
|
|
1393
|
-
artwork:
|
|
1520
|
+
album: p,
|
|
1521
|
+
artwork: l ? [{ src: l }] : void 0
|
|
1394
1522
|
}));
|
|
1395
|
-
}, [e, o, u,
|
|
1396
|
-
const g =
|
|
1523
|
+
}, [e, o, u, p, l]), E(() => {
|
|
1524
|
+
const g = Fe();
|
|
1397
1525
|
!e || !g || (g.playbackState = r.isPaused ? "paused" : "playing");
|
|
1398
1526
|
}, [e, r.isPaused]);
|
|
1399
1527
|
const f = a.seekForwardSeconds, m = a.seekBackwardSeconds;
|
|
1400
1528
|
E(() => {
|
|
1401
|
-
const g =
|
|
1529
|
+
const g = Fe();
|
|
1402
1530
|
if (!(!e || !g)) {
|
|
1403
1531
|
try {
|
|
1404
|
-
g.setActionHandler("play",
|
|
1405
|
-
typeof h.seekTime == "number" && Number.isFinite(h.seekTime) &&
|
|
1532
|
+
g.setActionHandler("play", n.play), g.setActionHandler("pause", n.pause), g.setActionHandler("nexttrack", n.next), g.setActionHandler("previoustrack", n.prev), g.setActionHandler("seekto", (h) => {
|
|
1533
|
+
typeof h.seekTime == "number" && Number.isFinite(h.seekTime) && n.seek(h.seekTime);
|
|
1406
1534
|
}), typeof f == "number" && f > 0 ? g.setActionHandler("seekforward", () => {
|
|
1407
|
-
const h =
|
|
1408
|
-
|
|
1535
|
+
const h = t.current, x = h.currentTime + f, y = h.duration, v = Number.isFinite(y) && y > 0 ? y : x;
|
|
1536
|
+
n.seek(Math.min(x, v));
|
|
1409
1537
|
}) : g.setActionHandler("seekforward", null), typeof m == "number" && m > 0 ? g.setActionHandler("seekbackward", () => {
|
|
1410
|
-
const h =
|
|
1411
|
-
|
|
1538
|
+
const h = t.current;
|
|
1539
|
+
n.seek(Math.max(0, h.currentTime - m));
|
|
1412
1540
|
}) : g.setActionHandler("seekbackward", null);
|
|
1413
1541
|
} catch {
|
|
1414
1542
|
}
|
|
@@ -1419,17 +1547,17 @@ function lt(e, r, t, a = {}) {
|
|
|
1419
1547
|
}
|
|
1420
1548
|
};
|
|
1421
1549
|
}
|
|
1422
|
-
}, [e,
|
|
1423
|
-
var
|
|
1424
|
-
const g =
|
|
1550
|
+
}, [e, n, f, m]), E(() => {
|
|
1551
|
+
var v, G;
|
|
1552
|
+
const g = Fe();
|
|
1425
1553
|
if (!e || !g || !a.positionState) return;
|
|
1426
1554
|
const h = r.duration, x = r.currentTime, y = r.playbackRate;
|
|
1427
1555
|
try {
|
|
1428
1556
|
if (!Number.isFinite(h) || h <= 0) {
|
|
1429
|
-
(
|
|
1557
|
+
(v = g.setPositionState) == null || v.call(g);
|
|
1430
1558
|
return;
|
|
1431
1559
|
}
|
|
1432
|
-
(
|
|
1560
|
+
(G = g.setPositionState) == null || G.call(g, {
|
|
1433
1561
|
duration: h,
|
|
1434
1562
|
playbackRate: Number.isFinite(y) && y > 0 ? y : 1,
|
|
1435
1563
|
position: Math.min(Math.max(0, x), h)
|
|
@@ -1437,15 +1565,15 @@ function lt(e, r, t, a = {}) {
|
|
|
1437
1565
|
} catch {
|
|
1438
1566
|
}
|
|
1439
1567
|
return () => {
|
|
1440
|
-
var
|
|
1568
|
+
var R;
|
|
1441
1569
|
try {
|
|
1442
|
-
(
|
|
1570
|
+
(R = g.setPositionState) == null || R.call(g);
|
|
1443
1571
|
} catch {
|
|
1444
1572
|
}
|
|
1445
1573
|
};
|
|
1446
1574
|
}, [e, a.positionState, r.currentTime, r.duration, r.playbackRate]);
|
|
1447
1575
|
}
|
|
1448
|
-
const
|
|
1576
|
+
const Pn = {
|
|
1449
1577
|
"--ginger-primary-color": "#111827",
|
|
1450
1578
|
"--ginger-muted-color": "#6b7280",
|
|
1451
1579
|
"--ginger-font-size": "14px",
|
|
@@ -1457,17 +1585,17 @@ const dt = {
|
|
|
1457
1585
|
"--ginger-buffer-color": "rgba(107, 114, 128, 0.35)",
|
|
1458
1586
|
"--ginger-focus-ring": "0 0 0 2px rgba(59, 130, 246, 0.45)"
|
|
1459
1587
|
};
|
|
1460
|
-
function
|
|
1588
|
+
function Sn({
|
|
1461
1589
|
children: e,
|
|
1462
1590
|
initialTracks: r = [],
|
|
1463
|
-
initialIndex:
|
|
1591
|
+
initialIndex: n = 0,
|
|
1464
1592
|
initialPlaylistMeta: a = null,
|
|
1465
|
-
initialShuffle:
|
|
1593
|
+
initialShuffle: t = !1,
|
|
1466
1594
|
initialRepeatMode: i = "off",
|
|
1467
1595
|
initialPlaybackMode: o = "playlist",
|
|
1468
1596
|
initialPaused: u = !0,
|
|
1469
|
-
initialVolume:
|
|
1470
|
-
initialMuted:
|
|
1597
|
+
initialVolume: p = 1,
|
|
1598
|
+
initialMuted: l = !1,
|
|
1471
1599
|
initialPlaybackRate: f = 1,
|
|
1472
1600
|
initialStateKey: m,
|
|
1473
1601
|
locale: M,
|
|
@@ -1475,214 +1603,214 @@ function pt({
|
|
|
1475
1603
|
beforePlay: h,
|
|
1476
1604
|
onPlayBlocked: x,
|
|
1477
1605
|
retryOnError: y,
|
|
1478
|
-
persistence:
|
|
1479
|
-
hydrateOnMount:
|
|
1480
|
-
resumeOnTrackChange:
|
|
1481
|
-
unstyled:
|
|
1482
|
-
asChild:
|
|
1606
|
+
persistence: v,
|
|
1607
|
+
hydrateOnMount: G = !1,
|
|
1608
|
+
resumeOnTrackChange: R = !1,
|
|
1609
|
+
unstyled: Z = !1,
|
|
1610
|
+
asChild: ye = !1,
|
|
1483
1611
|
className: Ke,
|
|
1484
|
-
style:
|
|
1485
|
-
dir:
|
|
1612
|
+
style: Oe,
|
|
1613
|
+
dir: dt,
|
|
1486
1614
|
prevRestartThresholdSeconds: qe = 3,
|
|
1487
|
-
onTrackChange:
|
|
1488
|
-
onPlay:
|
|
1489
|
-
onPause:
|
|
1490
|
-
onQueueEnd:
|
|
1491
|
-
onError:
|
|
1492
|
-
onVolumeChange:
|
|
1493
|
-
onPlaybackRateChange:
|
|
1615
|
+
onTrackChange: he,
|
|
1616
|
+
onPlay: ve,
|
|
1617
|
+
onPause: ke,
|
|
1618
|
+
onQueueEnd: be,
|
|
1619
|
+
onError: Te,
|
|
1620
|
+
onVolumeChange: Me,
|
|
1621
|
+
onPlaybackRateChange: xe,
|
|
1494
1622
|
onSeek: H,
|
|
1495
1623
|
debugLabel: Je
|
|
1496
1624
|
}) {
|
|
1497
1625
|
var ur;
|
|
1498
|
-
const D =
|
|
1499
|
-
|
|
1626
|
+
const D = w(null), [s, b] = Pt(
|
|
1627
|
+
In,
|
|
1500
1628
|
void 0,
|
|
1501
|
-
() =>
|
|
1629
|
+
() => lt({
|
|
1502
1630
|
tracks: r,
|
|
1503
|
-
currentIndex:
|
|
1631
|
+
currentIndex: n,
|
|
1504
1632
|
playlistMeta: a,
|
|
1505
1633
|
isPaused: u,
|
|
1506
|
-
isShuffled:
|
|
1634
|
+
isShuffled: t,
|
|
1507
1635
|
repeatMode: i,
|
|
1508
1636
|
playbackMode: o,
|
|
1509
|
-
volume:
|
|
1510
|
-
muted:
|
|
1637
|
+
volume: p,
|
|
1638
|
+
muted: l,
|
|
1511
1639
|
playbackRate: f
|
|
1512
1640
|
})
|
|
1513
|
-
),
|
|
1641
|
+
), ee = w(s), Ie = w({
|
|
1514
1642
|
tracks: r,
|
|
1515
|
-
currentIndex:
|
|
1643
|
+
currentIndex: n,
|
|
1516
1644
|
playlistMeta: a,
|
|
1517
1645
|
isPaused: u,
|
|
1518
|
-
isShuffled:
|
|
1646
|
+
isShuffled: t,
|
|
1519
1647
|
repeatMode: i,
|
|
1520
1648
|
playbackMode: o,
|
|
1521
|
-
volume:
|
|
1522
|
-
muted:
|
|
1649
|
+
volume: p,
|
|
1650
|
+
muted: l,
|
|
1523
1651
|
playbackRate: f
|
|
1524
1652
|
});
|
|
1525
|
-
|
|
1653
|
+
Ie.current = {
|
|
1526
1654
|
tracks: r,
|
|
1527
|
-
currentIndex:
|
|
1655
|
+
currentIndex: n,
|
|
1528
1656
|
playlistMeta: a,
|
|
1529
1657
|
isPaused: u,
|
|
1530
|
-
isShuffled:
|
|
1658
|
+
isShuffled: t,
|
|
1531
1659
|
repeatMode: i,
|
|
1532
1660
|
playbackMode: o,
|
|
1533
|
-
volume:
|
|
1534
|
-
muted:
|
|
1661
|
+
volume: p,
|
|
1662
|
+
muted: l,
|
|
1535
1663
|
playbackRate: f
|
|
1536
1664
|
};
|
|
1537
|
-
const
|
|
1665
|
+
const pe = w(void 0);
|
|
1538
1666
|
E(() => {
|
|
1539
1667
|
if (m === void 0) {
|
|
1540
|
-
|
|
1668
|
+
pe.current = void 0;
|
|
1541
1669
|
return;
|
|
1542
1670
|
}
|
|
1543
|
-
if (
|
|
1544
|
-
|
|
1671
|
+
if (pe.current === void 0) {
|
|
1672
|
+
pe.current = m;
|
|
1545
1673
|
return;
|
|
1546
1674
|
}
|
|
1547
|
-
if (
|
|
1548
|
-
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1675
|
+
if (pe.current === m) return;
|
|
1676
|
+
pe.current = m;
|
|
1677
|
+
const d = Ie.current;
|
|
1678
|
+
b({
|
|
1551
1679
|
type: "INIT",
|
|
1552
1680
|
payload: {
|
|
1553
|
-
tracks:
|
|
1554
|
-
currentIndex:
|
|
1555
|
-
playlistMeta:
|
|
1556
|
-
isPaused:
|
|
1557
|
-
isShuffled:
|
|
1558
|
-
repeatMode:
|
|
1559
|
-
playbackMode:
|
|
1560
|
-
volume:
|
|
1561
|
-
muted:
|
|
1562
|
-
playbackRate:
|
|
1681
|
+
tracks: d.tracks,
|
|
1682
|
+
currentIndex: d.currentIndex,
|
|
1683
|
+
playlistMeta: d.playlistMeta,
|
|
1684
|
+
isPaused: d.isPaused,
|
|
1685
|
+
isShuffled: d.isShuffled,
|
|
1686
|
+
repeatMode: d.repeatMode,
|
|
1687
|
+
playbackMode: d.playbackMode,
|
|
1688
|
+
volume: d.volume,
|
|
1689
|
+
muted: d.muted,
|
|
1690
|
+
playbackRate: d.playbackRate
|
|
1563
1691
|
}
|
|
1564
1692
|
});
|
|
1565
1693
|
}, [m]), E(() => {
|
|
1566
|
-
|
|
1694
|
+
ee.current = s;
|
|
1567
1695
|
}, [s]);
|
|
1568
1696
|
const Ze = s.tracks[s.currentIndex] ?? null;
|
|
1569
1697
|
E(() => {
|
|
1570
|
-
|
|
1571
|
-
}, [Ze, s.currentIndex,
|
|
1572
|
-
s.errorMessage && (
|
|
1573
|
-
}, [s.errorMessage,
|
|
1574
|
-
const
|
|
1698
|
+
he == null || he(Ze, s.currentIndex);
|
|
1699
|
+
}, [Ze, s.currentIndex, he]), E(() => {
|
|
1700
|
+
s.errorMessage && (Te == null || Te(s.errorMessage));
|
|
1701
|
+
}, [s.errorMessage, Te]);
|
|
1702
|
+
const Ee = w(0), er = w(void 0), _ = y ? typeof y == "object" ? y : {} : null, rr = (_ == null ? void 0 : _.maxRetries) ?? 3, tr = (_ == null ? void 0 : _.delayMs) ?? 1500, nr = (_ == null ? void 0 : _.retryableErrors) ?? ["MEDIA_ERR_NETWORK"], ar = (_ == null ? void 0 : _.skipOnUnrecoverable) ?? !1;
|
|
1575
1703
|
E(() => {
|
|
1576
|
-
var
|
|
1577
|
-
const
|
|
1578
|
-
er.current !==
|
|
1704
|
+
var k;
|
|
1705
|
+
const d = (k = s.tracks[s.currentIndex]) == null ? void 0 : k.fileUrl;
|
|
1706
|
+
er.current !== d && (Ee.current = 0, er.current = d);
|
|
1579
1707
|
}, [s.currentIndex, s.tracks]), E(() => {
|
|
1580
1708
|
if (!_ || !s.errorMessage) return;
|
|
1581
|
-
if (!
|
|
1709
|
+
if (!nr.some((L) => s.errorMessage.includes(L))) {
|
|
1582
1710
|
if (ar && s.tracks.length > 1) {
|
|
1583
|
-
const
|
|
1584
|
-
return () => clearTimeout(
|
|
1711
|
+
const L = setTimeout(() => b({ type: "NEXT" }), 500);
|
|
1712
|
+
return () => clearTimeout(L);
|
|
1585
1713
|
}
|
|
1586
1714
|
return;
|
|
1587
1715
|
}
|
|
1588
|
-
if (
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1716
|
+
if (Ee.current >= rr) return;
|
|
1717
|
+
const k = Ee.current, T = tr * 2 ** k, P = setTimeout(() => {
|
|
1718
|
+
Ee.current = k + 1, b({ type: "MEDIA_CANPLAY" });
|
|
1719
|
+
const L = D.current;
|
|
1720
|
+
L && (L.load(), b({ type: "PLAY" }));
|
|
1593
1721
|
}, T);
|
|
1594
1722
|
return () => clearTimeout(P);
|
|
1595
1723
|
}, [
|
|
1596
1724
|
_,
|
|
1597
1725
|
rr,
|
|
1598
|
-
nr,
|
|
1599
1726
|
tr,
|
|
1727
|
+
nr,
|
|
1600
1728
|
ar,
|
|
1601
1729
|
s.errorMessage,
|
|
1602
1730
|
s.tracks.length
|
|
1603
1731
|
]);
|
|
1604
|
-
const
|
|
1732
|
+
const Pe = w(void 0);
|
|
1605
1733
|
E(() => {
|
|
1606
|
-
if (
|
|
1607
|
-
|
|
1734
|
+
if (Pe.current === void 0) {
|
|
1735
|
+
Pe.current = s.isPaused;
|
|
1608
1736
|
return;
|
|
1609
1737
|
}
|
|
1610
|
-
|
|
1611
|
-
}, [s.isPaused,
|
|
1612
|
-
const
|
|
1738
|
+
Pe.current !== s.isPaused && (s.isPaused ? ke == null || ke() : ve == null || ve()), Pe.current = s.isPaused;
|
|
1739
|
+
}, [s.isPaused, ke, ve]);
|
|
1740
|
+
const Se = w(void 0), Ae = w(void 0);
|
|
1613
1741
|
E(() => {
|
|
1614
|
-
if (
|
|
1615
|
-
|
|
1742
|
+
if (Se.current === void 0 || Ae.current === void 0) {
|
|
1743
|
+
Se.current = s.volume, Ae.current = s.muted;
|
|
1616
1744
|
return;
|
|
1617
1745
|
}
|
|
1618
|
-
(
|
|
1619
|
-
}, [s.volume, s.muted,
|
|
1620
|
-
const
|
|
1746
|
+
(Se.current !== s.volume || Ae.current !== s.muted) && (Me == null || Me(s.volume, s.muted)), Se.current = s.volume, Ae.current = s.muted;
|
|
1747
|
+
}, [s.volume, s.muted, Me]);
|
|
1748
|
+
const Re = w(void 0);
|
|
1621
1749
|
E(() => {
|
|
1622
|
-
if (
|
|
1623
|
-
|
|
1750
|
+
if (Re.current === void 0) {
|
|
1751
|
+
Re.current = s.playbackRate;
|
|
1624
1752
|
return;
|
|
1625
1753
|
}
|
|
1626
|
-
|
|
1627
|
-
}, [s.playbackRate,
|
|
1754
|
+
Re.current !== s.playbackRate && (xe == null || xe(s.playbackRate)), Re.current = s.playbackRate;
|
|
1755
|
+
}, [s.playbackRate, xe]);
|
|
1628
1756
|
const B = I(() => {
|
|
1629
|
-
|
|
1757
|
+
b({ type: "PLAY" });
|
|
1630
1758
|
}, []), O = I(() => {
|
|
1631
|
-
var
|
|
1632
|
-
|
|
1759
|
+
var d;
|
|
1760
|
+
b({ type: "PAUSE" }), (d = D.current) == null || d.pause();
|
|
1633
1761
|
}, []), ne = I(() => {
|
|
1634
|
-
|
|
1635
|
-
}, [O, B]),
|
|
1636
|
-
(
|
|
1637
|
-
const
|
|
1638
|
-
|
|
1762
|
+
ee.current.isPaused ? B() : O();
|
|
1763
|
+
}, [O, B]), U = I(
|
|
1764
|
+
(d) => {
|
|
1765
|
+
const k = D.current;
|
|
1766
|
+
k && Number.isFinite(d) && (k.currentTime = Math.max(0, d), H == null || H(Math.max(0, d)));
|
|
1639
1767
|
},
|
|
1640
1768
|
[H]
|
|
1641
|
-
), Q = I((
|
|
1642
|
-
|
|
1643
|
-
}, []), j = I((
|
|
1644
|
-
|
|
1769
|
+
), Q = I((d) => {
|
|
1770
|
+
b({ type: "SET_VOLUME", payload: Be(d) });
|
|
1771
|
+
}, []), j = I((d) => {
|
|
1772
|
+
b({ type: "SET_MUTED", payload: d });
|
|
1645
1773
|
}, []), z = I(() => {
|
|
1646
|
-
|
|
1647
|
-
}, []), W = I((
|
|
1648
|
-
|
|
1774
|
+
b({ type: "TOGGLE_MUTE" });
|
|
1775
|
+
}, []), W = I((d) => {
|
|
1776
|
+
b({ type: "SET_PLAYBACK_RATE", payload: Xe(d) });
|
|
1649
1777
|
}, []), X = I(() => {
|
|
1650
|
-
|
|
1778
|
+
b({ type: "NEXT" });
|
|
1651
1779
|
}, []), K = I(() => {
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1654
|
-
}, [qe, H]),
|
|
1655
|
-
|
|
1656
|
-
}, []), ae = I(() => {
|
|
1657
|
-
k({ type: "CYCLE_REPEAT" });
|
|
1780
|
+
const d = D.current, k = qe ?? 3;
|
|
1781
|
+
d && k > 0 && d.currentTime > k ? (d.currentTime = 0, H == null || H(0)) : b({ type: "PREV" });
|
|
1782
|
+
}, [qe, H]), ae = I((d) => {
|
|
1783
|
+
b({ type: "SET_REPEAT", payload: d });
|
|
1658
1784
|
}, []), ie = I(() => {
|
|
1659
|
-
|
|
1660
|
-
}, []),
|
|
1661
|
-
|
|
1662
|
-
}, []),
|
|
1663
|
-
|
|
1664
|
-
}, []),
|
|
1665
|
-
|
|
1666
|
-
}, []),
|
|
1667
|
-
|
|
1668
|
-
}, []),
|
|
1669
|
-
|
|
1670
|
-
}, []),
|
|
1671
|
-
|
|
1672
|
-
}, []),
|
|
1673
|
-
|
|
1674
|
-
}, []),
|
|
1675
|
-
|
|
1676
|
-
}, []),
|
|
1677
|
-
|
|
1678
|
-
}, []),
|
|
1679
|
-
|
|
1785
|
+
b({ type: "CYCLE_REPEAT" });
|
|
1786
|
+
}, []), oe = I(() => {
|
|
1787
|
+
b({ type: "TOGGLE_SHUFFLE" });
|
|
1788
|
+
}, []), we = I((d, k) => {
|
|
1789
|
+
b({ type: "SET_QUEUE", payload: { tracks: d, currentIndex: k } });
|
|
1790
|
+
}, []), Ge = I((d, k, T) => {
|
|
1791
|
+
b({ type: "INSERT_TRACK", payload: { track: d, index: k, autoPlay: T } });
|
|
1792
|
+
}, []), _e = I((d) => {
|
|
1793
|
+
b({ type: "REMOVE_TRACK", payload: { index: d } });
|
|
1794
|
+
}, []), Ne = I((d, k) => {
|
|
1795
|
+
b({ type: "MOVE_TRACK", payload: { fromIndex: d, toIndex: k } });
|
|
1796
|
+
}, []), Le = I((d) => {
|
|
1797
|
+
b({ type: "ADD_NEXT", payload: { track: d } });
|
|
1798
|
+
}, []), ce = I((d) => {
|
|
1799
|
+
b({ type: "SET_INDEX", payload: { index: d, autoPlay: !0 } });
|
|
1800
|
+
}, []), De = I((d) => {
|
|
1801
|
+
b({ type: "SET_INDEX", payload: { index: d, autoPlay: !1 } });
|
|
1802
|
+
}, []), Ue = I((d) => {
|
|
1803
|
+
b({ type: "SET_PLAYLIST_META", payload: d });
|
|
1804
|
+
}, []), se = I((d) => {
|
|
1805
|
+
b({ type: "SET_PLAYBACK_MODE", payload: d });
|
|
1806
|
+
}, []), Ce = I((d) => {
|
|
1807
|
+
b({ type: "INIT", payload: d });
|
|
1680
1808
|
}, []);
|
|
1681
1809
|
E(() => {
|
|
1682
|
-
if (!(!
|
|
1810
|
+
if (!(!v || !G))
|
|
1683
1811
|
try {
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1812
|
+
const d = v.get("ginger:volume"), k = v.get("ginger:muted"), T = v.get("ginger:playbackRate"), P = v.get("ginger:repeatMode"), L = v.get("ginger:currentIndex"), Y = Ie.current;
|
|
1813
|
+
b({
|
|
1686
1814
|
type: "INIT",
|
|
1687
1815
|
payload: {
|
|
1688
1816
|
tracks: Y.tracks,
|
|
@@ -1690,171 +1818,171 @@ function pt({
|
|
|
1690
1818
|
isPaused: Y.isPaused,
|
|
1691
1819
|
isShuffled: Y.isShuffled,
|
|
1692
1820
|
playbackMode: Y.playbackMode,
|
|
1693
|
-
currentIndex: typeof
|
|
1821
|
+
currentIndex: typeof L == "number" ? L : Y.currentIndex,
|
|
1694
1822
|
repeatMode: P === "off" || P === "all" || P === "one" ? P : Y.repeatMode,
|
|
1695
|
-
volume: typeof
|
|
1696
|
-
muted: typeof
|
|
1823
|
+
volume: typeof d == "number" ? d : Y.volume,
|
|
1824
|
+
muted: typeof k == "boolean" ? k : Y.muted,
|
|
1697
1825
|
playbackRate: typeof T == "number" ? T : Y.playbackRate
|
|
1698
1826
|
}
|
|
1699
1827
|
});
|
|
1700
|
-
} catch (
|
|
1701
|
-
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.get() threw during hydration:",
|
|
1828
|
+
} catch (d) {
|
|
1829
|
+
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.get() threw during hydration:", d);
|
|
1702
1830
|
}
|
|
1703
|
-
}, [
|
|
1704
|
-
if (
|
|
1831
|
+
}, [G, v]), E(() => {
|
|
1832
|
+
if (v)
|
|
1705
1833
|
try {
|
|
1706
|
-
|
|
1707
|
-
} catch (
|
|
1708
|
-
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw:",
|
|
1834
|
+
v.set("ginger:volume", s.volume), v.set("ginger:muted", s.muted), v.set("ginger:playbackRate", s.playbackRate), v.set("ginger:repeatMode", s.repeatMode), v.set("ginger:currentIndex", s.currentIndex);
|
|
1835
|
+
} catch (d) {
|
|
1836
|
+
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw:", d);
|
|
1709
1837
|
}
|
|
1710
1838
|
}, [
|
|
1711
|
-
|
|
1839
|
+
v,
|
|
1712
1840
|
s.volume,
|
|
1713
1841
|
s.muted,
|
|
1714
1842
|
s.playbackRate,
|
|
1715
1843
|
s.repeatMode,
|
|
1716
1844
|
s.currentIndex
|
|
1717
1845
|
]), E(() => {
|
|
1718
|
-
if (!
|
|
1719
|
-
const
|
|
1720
|
-
if (!
|
|
1721
|
-
const
|
|
1846
|
+
if (!v || !R) return;
|
|
1847
|
+
const d = s.tracks[s.currentIndex];
|
|
1848
|
+
if (!d) return;
|
|
1849
|
+
const k = `ginger:resume:${Qe(d)}`;
|
|
1722
1850
|
try {
|
|
1723
|
-
const T =
|
|
1724
|
-
typeof T == "number" && Number.isFinite(T) &&
|
|
1851
|
+
const T = v.get(k);
|
|
1852
|
+
typeof T == "number" && Number.isFinite(T) && U(T);
|
|
1725
1853
|
} catch (T) {
|
|
1726
1854
|
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.get() threw during resume:", T);
|
|
1727
1855
|
}
|
|
1728
|
-
}, [
|
|
1729
|
-
if (!
|
|
1730
|
-
const
|
|
1731
|
-
const
|
|
1732
|
-
if (!T || !(
|
|
1733
|
-
const P = `ginger:resume:${
|
|
1856
|
+
}, [v, R, s.currentIndex, s.tracks, U]), E(() => {
|
|
1857
|
+
if (!v || !R) return;
|
|
1858
|
+
const d = setInterval(() => {
|
|
1859
|
+
const k = ee.current, T = k.tracks[k.currentIndex];
|
|
1860
|
+
if (!T || !(k.currentTime >= 0)) return;
|
|
1861
|
+
const P = `ginger:resume:${Qe(T)}`;
|
|
1734
1862
|
try {
|
|
1735
|
-
|
|
1736
|
-
} catch (
|
|
1737
|
-
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw during resume save:",
|
|
1863
|
+
v.set(P, k.currentTime);
|
|
1864
|
+
} catch (L) {
|
|
1865
|
+
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw during resume save:", L);
|
|
1738
1866
|
}
|
|
1739
1867
|
}, 5e3);
|
|
1740
|
-
return () => clearInterval(
|
|
1741
|
-
}, [
|
|
1742
|
-
const
|
|
1868
|
+
return () => clearInterval(d);
|
|
1869
|
+
}, [v, R]);
|
|
1870
|
+
const pt = (ur = s.tracks[s.currentIndex]) == null ? void 0 : ur.fileUrl;
|
|
1743
1871
|
E(() => {
|
|
1744
|
-
const
|
|
1745
|
-
if (!
|
|
1872
|
+
const d = D.current;
|
|
1873
|
+
if (!d) return;
|
|
1746
1874
|
if (s.isPaused) {
|
|
1747
|
-
|
|
1875
|
+
d.pause();
|
|
1748
1876
|
return;
|
|
1749
1877
|
}
|
|
1750
|
-
if (
|
|
1751
|
-
|
|
1878
|
+
if (d.ended && gr(ee.current).kind === "stop") {
|
|
1879
|
+
b({ type: "PAUSE" });
|
|
1752
1880
|
return;
|
|
1753
1881
|
}
|
|
1754
|
-
let
|
|
1882
|
+
let k = !1;
|
|
1755
1883
|
return (async () => {
|
|
1756
1884
|
if (h) {
|
|
1757
1885
|
let T = !1;
|
|
1758
1886
|
try {
|
|
1759
1887
|
T = await h();
|
|
1760
1888
|
} catch (P) {
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1889
|
+
const L = P instanceof Error ? P.message : "beforePlay rejected";
|
|
1890
|
+
b({ type: "MEDIA_ERROR", payload: { message: L } });
|
|
1763
1891
|
return;
|
|
1764
1892
|
}
|
|
1765
1893
|
if (!T) {
|
|
1766
|
-
|
|
1894
|
+
k || (b({ type: "PAUSE" }), x == null || x());
|
|
1767
1895
|
return;
|
|
1768
1896
|
}
|
|
1769
1897
|
}
|
|
1770
|
-
|
|
1898
|
+
k || d.play().catch((T) => {
|
|
1771
1899
|
const P = T instanceof Error ? T.message : typeof T == "string" ? T : "Playback failed (e.g. autoplay blocked or unavailable source)";
|
|
1772
|
-
|
|
1900
|
+
b({ type: "MEDIA_ERROR", payload: { message: P } });
|
|
1773
1901
|
});
|
|
1774
1902
|
})(), () => {
|
|
1775
|
-
|
|
1903
|
+
k = !0;
|
|
1776
1904
|
};
|
|
1777
|
-
}, [h,
|
|
1778
|
-
const
|
|
1905
|
+
}, [h, pt, x, s.isPaused]);
|
|
1906
|
+
const ue = I(() => {
|
|
1779
1907
|
var T;
|
|
1780
|
-
const
|
|
1781
|
-
if (
|
|
1908
|
+
const d = gr(ee.current);
|
|
1909
|
+
if (d.kind === "replay_same") {
|
|
1782
1910
|
const P = D.current;
|
|
1783
|
-
P && (P.currentTime = 0),
|
|
1911
|
+
P && (P.currentTime = 0), b({ type: "PLAY" });
|
|
1784
1912
|
return;
|
|
1785
1913
|
}
|
|
1786
|
-
if (
|
|
1787
|
-
(T = D.current) == null || T.pause(),
|
|
1914
|
+
if (d.kind === "stop") {
|
|
1915
|
+
(T = D.current) == null || T.pause(), b({ type: "PAUSE" }), be == null || be();
|
|
1788
1916
|
return;
|
|
1789
1917
|
}
|
|
1790
|
-
const
|
|
1791
|
-
|
|
1792
|
-
}, [
|
|
1793
|
-
() => ({ play: B, pause: O, next: X, prev: K, seek:
|
|
1794
|
-
[B, O, X, K,
|
|
1795
|
-
),
|
|
1918
|
+
const k = d.nextIndex;
|
|
1919
|
+
b({ type: "SET_INDEX", payload: { index: k, autoPlay: !0 } });
|
|
1920
|
+
}, [be]), gt = A(
|
|
1921
|
+
() => ({ play: B, pause: O, next: X, prev: K, seek: U }),
|
|
1922
|
+
[B, O, X, K, U]
|
|
1923
|
+
), ft = typeof g == "object" ? !0 : !!g, mt = A(
|
|
1796
1924
|
() => typeof g == "object" ? g : {},
|
|
1797
1925
|
[g]
|
|
1798
1926
|
);
|
|
1799
|
-
|
|
1800
|
-
const ir =
|
|
1927
|
+
En(ft, s, gt, mt);
|
|
1928
|
+
const ir = dt ?? (M != null && M.seek && /[\u0590-\u08FF]/.test(M.seek) ? "rtl" : "ltr"), yt = A(
|
|
1801
1929
|
() => ({
|
|
1802
1930
|
state: s,
|
|
1803
|
-
dispatch:
|
|
1931
|
+
dispatch: b,
|
|
1804
1932
|
audioRef: D,
|
|
1805
|
-
notifyEnded:
|
|
1806
|
-
init:
|
|
1933
|
+
notifyEnded: ue,
|
|
1934
|
+
init: Ce,
|
|
1807
1935
|
play: B,
|
|
1808
1936
|
pause: O,
|
|
1809
1937
|
togglePlayPause: ne,
|
|
1810
|
-
seek:
|
|
1938
|
+
seek: U,
|
|
1811
1939
|
setVolume: Q,
|
|
1812
1940
|
setMuted: j,
|
|
1813
1941
|
toggleMute: z,
|
|
1814
1942
|
setPlaybackRate: W,
|
|
1815
1943
|
next: X,
|
|
1816
1944
|
prev: K,
|
|
1817
|
-
setRepeatMode:
|
|
1818
|
-
cycleRepeat:
|
|
1819
|
-
toggleShuffle:
|
|
1820
|
-
setQueue:
|
|
1821
|
-
insertTrackAt:
|
|
1822
|
-
removeTrackAt:
|
|
1823
|
-
moveTrack:
|
|
1824
|
-
enqueueNext:
|
|
1825
|
-
playTrackAt:
|
|
1826
|
-
selectTrackAt:
|
|
1827
|
-
setPlaylistMeta:
|
|
1828
|
-
setPlaybackMode:
|
|
1945
|
+
setRepeatMode: ae,
|
|
1946
|
+
cycleRepeat: ie,
|
|
1947
|
+
toggleShuffle: oe,
|
|
1948
|
+
setQueue: we,
|
|
1949
|
+
insertTrackAt: Ge,
|
|
1950
|
+
removeTrackAt: _e,
|
|
1951
|
+
moveTrack: Ne,
|
|
1952
|
+
enqueueNext: Le,
|
|
1953
|
+
playTrackAt: ce,
|
|
1954
|
+
selectTrackAt: De,
|
|
1955
|
+
setPlaylistMeta: Ue,
|
|
1956
|
+
setPlaybackMode: se
|
|
1829
1957
|
}),
|
|
1830
1958
|
[
|
|
1831
|
-
|
|
1832
|
-
|
|
1959
|
+
ie,
|
|
1960
|
+
Ce,
|
|
1833
1961
|
X,
|
|
1834
|
-
|
|
1962
|
+
ue,
|
|
1835
1963
|
O,
|
|
1836
1964
|
B,
|
|
1837
|
-
|
|
1838
|
-
Re,
|
|
1839
|
-
Se,
|
|
1840
|
-
we,
|
|
1841
|
-
_e,
|
|
1965
|
+
ce,
|
|
1842
1966
|
Ge,
|
|
1967
|
+
_e,
|
|
1968
|
+
Ne,
|
|
1969
|
+
Le,
|
|
1970
|
+
De,
|
|
1843
1971
|
K,
|
|
1844
|
-
|
|
1972
|
+
U,
|
|
1845
1973
|
j,
|
|
1846
1974
|
W,
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1975
|
+
we,
|
|
1976
|
+
ae,
|
|
1977
|
+
Ue,
|
|
1978
|
+
se,
|
|
1851
1979
|
Q,
|
|
1852
1980
|
s,
|
|
1853
1981
|
z,
|
|
1854
1982
|
ne,
|
|
1855
|
-
|
|
1983
|
+
oe
|
|
1856
1984
|
]
|
|
1857
|
-
),
|
|
1985
|
+
), ht = A(
|
|
1858
1986
|
() => ({
|
|
1859
1987
|
tracks: s.tracks,
|
|
1860
1988
|
currentIndex: s.currentIndex,
|
|
@@ -1863,26 +1991,26 @@ function pt({
|
|
|
1863
1991
|
repeatMode: s.repeatMode,
|
|
1864
1992
|
originalTracks: s.originalTracks,
|
|
1865
1993
|
playlistMeta: s.playlistMeta,
|
|
1866
|
-
init:
|
|
1994
|
+
init: Ce,
|
|
1867
1995
|
play: B,
|
|
1868
1996
|
pause: O,
|
|
1869
1997
|
togglePlayPause: ne,
|
|
1870
1998
|
next: X,
|
|
1871
1999
|
prev: K,
|
|
1872
|
-
setRepeatMode:
|
|
1873
|
-
cycleRepeat:
|
|
1874
|
-
toggleShuffle:
|
|
2000
|
+
setRepeatMode: ae,
|
|
2001
|
+
cycleRepeat: ie,
|
|
2002
|
+
toggleShuffle: oe,
|
|
1875
2003
|
playbackMode: s.playbackMode,
|
|
1876
|
-
setQueue:
|
|
1877
|
-
insertTrackAt:
|
|
1878
|
-
removeTrackAt:
|
|
1879
|
-
moveTrack:
|
|
1880
|
-
enqueueNext:
|
|
1881
|
-
playTrackAt:
|
|
1882
|
-
selectTrackAt:
|
|
1883
|
-
setPlaylistMeta:
|
|
1884
|
-
setPlaybackMode:
|
|
1885
|
-
dispatch:
|
|
2004
|
+
setQueue: we,
|
|
2005
|
+
insertTrackAt: Ge,
|
|
2006
|
+
removeTrackAt: _e,
|
|
2007
|
+
moveTrack: Ne,
|
|
2008
|
+
enqueueNext: Le,
|
|
2009
|
+
playTrackAt: ce,
|
|
2010
|
+
selectTrackAt: De,
|
|
2011
|
+
setPlaylistMeta: Ue,
|
|
2012
|
+
setPlaybackMode: se,
|
|
2013
|
+
dispatch: b
|
|
1886
2014
|
}),
|
|
1887
2015
|
[
|
|
1888
2016
|
s.tracks,
|
|
@@ -1893,26 +2021,26 @@ function pt({
|
|
|
1893
2021
|
s.playbackMode,
|
|
1894
2022
|
s.originalTracks,
|
|
1895
2023
|
s.playlistMeta,
|
|
1896
|
-
|
|
2024
|
+
Ce,
|
|
1897
2025
|
B,
|
|
1898
2026
|
O,
|
|
1899
2027
|
ne,
|
|
1900
2028
|
X,
|
|
1901
2029
|
K,
|
|
1902
|
-
te,
|
|
1903
2030
|
ae,
|
|
1904
2031
|
ie,
|
|
1905
|
-
Ae,
|
|
1906
|
-
Re,
|
|
1907
|
-
Se,
|
|
1908
|
-
we,
|
|
1909
|
-
_e,
|
|
1910
2032
|
oe,
|
|
2033
|
+
we,
|
|
1911
2034
|
Ge,
|
|
2035
|
+
_e,
|
|
1912
2036
|
Ne,
|
|
1913
|
-
|
|
2037
|
+
Le,
|
|
2038
|
+
ce,
|
|
2039
|
+
De,
|
|
2040
|
+
Ue,
|
|
2041
|
+
se
|
|
1914
2042
|
]
|
|
1915
|
-
),
|
|
2043
|
+
), vt = A(
|
|
1916
2044
|
() => ({
|
|
1917
2045
|
currentTime: s.currentTime,
|
|
1918
2046
|
duration: s.duration,
|
|
@@ -1922,14 +2050,14 @@ function pt({
|
|
|
1922
2050
|
volume: s.volume,
|
|
1923
2051
|
muted: s.muted,
|
|
1924
2052
|
playbackRate: s.playbackRate,
|
|
1925
|
-
seek:
|
|
2053
|
+
seek: U,
|
|
1926
2054
|
setVolume: Q,
|
|
1927
2055
|
setMuted: j,
|
|
1928
2056
|
toggleMute: z,
|
|
1929
2057
|
setPlaybackRate: W,
|
|
1930
2058
|
audioRef: D,
|
|
1931
|
-
notifyEnded:
|
|
1932
|
-
dispatch:
|
|
2059
|
+
notifyEnded: ue,
|
|
2060
|
+
dispatch: b
|
|
1933
2061
|
}),
|
|
1934
2062
|
[
|
|
1935
2063
|
s.currentTime,
|
|
@@ -1940,14 +2068,14 @@ function pt({
|
|
|
1940
2068
|
s.volume,
|
|
1941
2069
|
s.muted,
|
|
1942
2070
|
s.playbackRate,
|
|
1943
|
-
|
|
2071
|
+
U,
|
|
1944
2072
|
Q,
|
|
1945
2073
|
j,
|
|
1946
2074
|
z,
|
|
1947
2075
|
W,
|
|
1948
|
-
|
|
2076
|
+
ue
|
|
1949
2077
|
]
|
|
1950
|
-
),
|
|
2078
|
+
), kt = A(
|
|
1951
2079
|
() => ({
|
|
1952
2080
|
currentTime: s.currentTime,
|
|
1953
2081
|
duration: s.duration,
|
|
@@ -1962,35 +2090,35 @@ function pt({
|
|
|
1962
2090
|
s.isBuffering,
|
|
1963
2091
|
s.errorMessage
|
|
1964
2092
|
]
|
|
1965
|
-
),
|
|
2093
|
+
), bt = A(
|
|
1966
2094
|
() => ({
|
|
1967
2095
|
volume: s.volume,
|
|
1968
2096
|
muted: s.muted,
|
|
1969
2097
|
playbackRate: s.playbackRate,
|
|
1970
|
-
seek:
|
|
2098
|
+
seek: U,
|
|
1971
2099
|
setVolume: Q,
|
|
1972
2100
|
setMuted: j,
|
|
1973
2101
|
toggleMute: z,
|
|
1974
2102
|
setPlaybackRate: W,
|
|
1975
2103
|
audioRef: D,
|
|
1976
|
-
notifyEnded:
|
|
1977
|
-
dispatch:
|
|
2104
|
+
notifyEnded: ue,
|
|
2105
|
+
dispatch: b
|
|
1978
2106
|
}),
|
|
1979
2107
|
[
|
|
1980
2108
|
s.volume,
|
|
1981
2109
|
s.muted,
|
|
1982
2110
|
s.playbackRate,
|
|
1983
|
-
|
|
2111
|
+
U,
|
|
1984
2112
|
Q,
|
|
1985
2113
|
j,
|
|
1986
2114
|
z,
|
|
1987
2115
|
W,
|
|
1988
|
-
|
|
2116
|
+
ue
|
|
1989
2117
|
]
|
|
1990
|
-
), or =
|
|
1991
|
-
() =>
|
|
1992
|
-
[
|
|
1993
|
-
), $ =
|
|
2118
|
+
), or = kr(s), cr = A(
|
|
2119
|
+
() => Z ? Oe : { ...Pn, ...Oe },
|
|
2120
|
+
[Oe, Z]
|
|
2121
|
+
), $ = A(
|
|
1994
2122
|
() => ({
|
|
1995
2123
|
className: Ke,
|
|
1996
2124
|
style: cr,
|
|
@@ -1998,22 +2126,22 @@ function pt({
|
|
|
1998
2126
|
dir: ir
|
|
1999
2127
|
}),
|
|
2000
2128
|
[Ke, cr, or, ir]
|
|
2001
|
-
),
|
|
2129
|
+
), $e = w(null), sr = w({
|
|
2002
2130
|
play: B,
|
|
2003
2131
|
pause: O,
|
|
2004
2132
|
togglePlayPause: ne,
|
|
2005
2133
|
next: X,
|
|
2006
2134
|
prev: K,
|
|
2007
|
-
seek:
|
|
2135
|
+
seek: U,
|
|
2008
2136
|
setVolume: Q,
|
|
2009
2137
|
setMuted: j,
|
|
2010
2138
|
toggleMute: z,
|
|
2011
2139
|
setPlaybackRate: W,
|
|
2012
|
-
setRepeatMode:
|
|
2013
|
-
cycleRepeat:
|
|
2014
|
-
toggleShuffle:
|
|
2015
|
-
playTrackAt:
|
|
2016
|
-
setPlaybackMode:
|
|
2140
|
+
setRepeatMode: ae,
|
|
2141
|
+
cycleRepeat: ie,
|
|
2142
|
+
toggleShuffle: oe,
|
|
2143
|
+
playTrackAt: ce,
|
|
2144
|
+
setPlaybackMode: se
|
|
2017
2145
|
});
|
|
2018
2146
|
sr.current = {
|
|
2019
2147
|
play: B,
|
|
@@ -2021,44 +2149,44 @@ function pt({
|
|
|
2021
2149
|
togglePlayPause: ne,
|
|
2022
2150
|
next: X,
|
|
2023
2151
|
prev: K,
|
|
2024
|
-
seek:
|
|
2152
|
+
seek: U,
|
|
2025
2153
|
setVolume: Q,
|
|
2026
2154
|
setMuted: j,
|
|
2027
2155
|
toggleMute: z,
|
|
2028
2156
|
setPlaybackRate: W,
|
|
2029
|
-
setRepeatMode:
|
|
2030
|
-
cycleRepeat:
|
|
2031
|
-
toggleShuffle:
|
|
2032
|
-
playTrackAt:
|
|
2033
|
-
setPlaybackMode:
|
|
2157
|
+
setRepeatMode: ae,
|
|
2158
|
+
cycleRepeat: ie,
|
|
2159
|
+
toggleShuffle: oe,
|
|
2160
|
+
playTrackAt: ce,
|
|
2161
|
+
setPlaybackMode: se
|
|
2034
2162
|
}, E(() => {
|
|
2035
2163
|
var T;
|
|
2036
|
-
const
|
|
2037
|
-
if (!
|
|
2038
|
-
const
|
|
2039
|
-
return
|
|
2164
|
+
const d = typeof window < "u" ? window.__GINGER_DEVTOOLS__ : null;
|
|
2165
|
+
if (!d || typeof d.register != "function") return;
|
|
2166
|
+
const k = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `ginger-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
2167
|
+
return $e.current = k, d.register(k, {
|
|
2040
2168
|
label: Je,
|
|
2041
|
-
state:
|
|
2169
|
+
state: ee.current,
|
|
2042
2170
|
actions: sr.current,
|
|
2043
2171
|
audioSrc: ((T = D.current) == null ? void 0 : T.src) ?? null
|
|
2044
2172
|
}), () => {
|
|
2045
|
-
|
|
2173
|
+
d.unregister(k), $e.current = null;
|
|
2046
2174
|
};
|
|
2047
2175
|
}, [Je]), E(() => {
|
|
2048
|
-
const
|
|
2049
|
-
if (!
|
|
2050
|
-
const
|
|
2176
|
+
const d = typeof window < "u" ? window.__GINGER_DEVTOOLS__ : null;
|
|
2177
|
+
if (!d || typeof d.update != "function") return;
|
|
2178
|
+
const k = setInterval(() => {
|
|
2051
2179
|
var P;
|
|
2052
|
-
const T =
|
|
2053
|
-
T &&
|
|
2054
|
-
state:
|
|
2180
|
+
const T = $e.current;
|
|
2181
|
+
T && d.update(T, {
|
|
2182
|
+
state: ee.current,
|
|
2055
2183
|
audioSrc: ((P = D.current) == null ? void 0 : P.src) ?? null
|
|
2056
2184
|
});
|
|
2057
2185
|
}, 250);
|
|
2058
|
-
return () => clearInterval(
|
|
2186
|
+
return () => clearInterval(k);
|
|
2059
2187
|
}, []);
|
|
2060
|
-
const
|
|
2061
|
-
if (!
|
|
2188
|
+
const Tt = A(() => {
|
|
2189
|
+
if (!ye)
|
|
2062
2190
|
return /* @__PURE__ */ c(
|
|
2063
2191
|
"div",
|
|
2064
2192
|
{
|
|
@@ -2069,36 +2197,44 @@ function pt({
|
|
|
2069
2197
|
children: e
|
|
2070
2198
|
}
|
|
2071
2199
|
);
|
|
2072
|
-
const
|
|
2073
|
-
if (!
|
|
2200
|
+
const d = St.only(e);
|
|
2201
|
+
if (!At(d))
|
|
2074
2202
|
throw new Error("Ginger.Provider asChild expects a single React element child.");
|
|
2075
|
-
const
|
|
2076
|
-
return
|
|
2077
|
-
className:
|
|
2203
|
+
const k = d, T = k.props.style;
|
|
2204
|
+
return Rt(k, {
|
|
2205
|
+
className: An(k.props.className, $.className),
|
|
2078
2206
|
style: T && typeof T == "object" ? { ...T, ...$.style } : $.style,
|
|
2079
2207
|
"data-ginger-playback": $["data-ginger-playback"],
|
|
2080
2208
|
dir: $.dir
|
|
2081
2209
|
});
|
|
2082
|
-
}, [
|
|
2083
|
-
|
|
2210
|
+
}, [ye, e, $]), Mt = A(
|
|
2211
|
+
() => ({
|
|
2212
|
+
getInitialTracksSnapshot: () => Ie.current.tracks
|
|
2213
|
+
}),
|
|
2214
|
+
[]
|
|
2215
|
+
);
|
|
2216
|
+
return /* @__PURE__ */ c(Qt, { locale: M, children: /* @__PURE__ */ c(vn, { value: Mt, children: /* @__PURE__ */ c(wt.Provider, { value: ht, children: /* @__PURE__ */ c(Gt.Provider, { value: kt, children: /* @__PURE__ */ c(_t.Provider, { value: bt, children: /* @__PURE__ */ c(Nt.Provider, { value: vt, children: /* @__PURE__ */ c(Tr.Provider, { value: yt, children: Tt }) }) }) }) }) }) });
|
|
2084
2217
|
}
|
|
2085
|
-
function
|
|
2086
|
-
const
|
|
2087
|
-
return
|
|
2218
|
+
function An(e, r) {
|
|
2219
|
+
const n = [e, r].filter(Boolean).join(" ");
|
|
2220
|
+
return n === "" ? void 0 : n;
|
|
2088
2221
|
}
|
|
2089
|
-
const
|
|
2090
|
-
|
|
2091
|
-
|
|
2222
|
+
const Rn = Object.assign(ut, {
|
|
2223
|
+
Track: ct
|
|
2224
|
+
}), Un = {
|
|
2225
|
+
Provider: Sn,
|
|
2226
|
+
Player: Yt,
|
|
2227
|
+
Tracks: Rn,
|
|
2092
2228
|
Current: {
|
|
2093
|
-
Title:
|
|
2094
|
-
Artist:
|
|
2095
|
-
Album:
|
|
2096
|
-
Description:
|
|
2097
|
-
Copyright:
|
|
2098
|
-
Genre:
|
|
2099
|
-
Label:
|
|
2100
|
-
Isrc:
|
|
2101
|
-
TrackNumber:
|
|
2229
|
+
Title: Kt,
|
|
2230
|
+
Artist: qt,
|
|
2231
|
+
Album: Jt,
|
|
2232
|
+
Description: Zt,
|
|
2233
|
+
Copyright: en,
|
|
2234
|
+
Genre: rn,
|
|
2235
|
+
Label: tn,
|
|
2236
|
+
Isrc: nn,
|
|
2237
|
+
TrackNumber: an,
|
|
2102
2238
|
Year: Br,
|
|
2103
2239
|
Lyrics: Or,
|
|
2104
2240
|
LyricsSynced: $r,
|
|
@@ -2113,65 +2249,65 @@ const kt = {
|
|
|
2113
2249
|
Remaining: qr,
|
|
2114
2250
|
Progress: Jr,
|
|
2115
2251
|
TimeRail: Zr,
|
|
2116
|
-
BufferRail:
|
|
2117
|
-
PlaybackState:
|
|
2118
|
-
ErrorMessage:
|
|
2252
|
+
BufferRail: et,
|
|
2253
|
+
PlaybackState: rt,
|
|
2254
|
+
ErrorMessage: tt
|
|
2119
2255
|
},
|
|
2120
2256
|
Queue: {
|
|
2121
|
-
Title:
|
|
2122
|
-
Subtitle:
|
|
2123
|
-
Description:
|
|
2124
|
-
Copyright:
|
|
2125
|
-
Artwork:
|
|
2257
|
+
Title: dn,
|
|
2258
|
+
Subtitle: pn,
|
|
2259
|
+
Description: gn,
|
|
2260
|
+
Copyright: fn,
|
|
2261
|
+
Artwork: it
|
|
2126
2262
|
},
|
|
2127
2263
|
Control: {
|
|
2128
|
-
PlayPause:
|
|
2129
|
-
Repeat:
|
|
2264
|
+
PlayPause: Gr,
|
|
2265
|
+
Repeat: _r,
|
|
2130
2266
|
Next: Nr,
|
|
2131
2267
|
Previous: Lr,
|
|
2132
2268
|
Shuffle: Dr,
|
|
2133
|
-
SeekBar:
|
|
2134
|
-
Volume:
|
|
2135
|
-
Mute:
|
|
2269
|
+
SeekBar: Ur,
|
|
2270
|
+
Volume: Cr,
|
|
2271
|
+
Mute: Fr,
|
|
2136
2272
|
PlaybackRate: Vr
|
|
2137
2273
|
},
|
|
2138
2274
|
Icon: {
|
|
2139
2275
|
Play: Ir,
|
|
2140
2276
|
Pause: xr,
|
|
2141
|
-
SkipForward:
|
|
2142
|
-
SkipBack:
|
|
2277
|
+
SkipForward: Ar,
|
|
2278
|
+
SkipBack: Sr,
|
|
2143
2279
|
Shuffle: Pr,
|
|
2144
|
-
Volume2:
|
|
2280
|
+
Volume2: Rr,
|
|
2145
2281
|
VolumeX: wr,
|
|
2146
2282
|
RepeatGlyph: Er,
|
|
2147
|
-
Wrapper:
|
|
2283
|
+
Wrapper: V
|
|
2148
2284
|
},
|
|
2149
|
-
Playlist:
|
|
2285
|
+
Playlist: ln
|
|
2150
2286
|
};
|
|
2151
2287
|
export {
|
|
2152
2288
|
Yr as C,
|
|
2153
|
-
|
|
2289
|
+
Un as G,
|
|
2154
2290
|
$r as L,
|
|
2155
2291
|
xr as P,
|
|
2156
2292
|
Er as R,
|
|
2157
2293
|
Pr as S,
|
|
2158
|
-
|
|
2159
|
-
|
|
2294
|
+
Rr as V,
|
|
2295
|
+
V as W,
|
|
2160
2296
|
Ir as a,
|
|
2161
|
-
|
|
2162
|
-
|
|
2297
|
+
Sr as b,
|
|
2298
|
+
Ar as c,
|
|
2163
2299
|
wr as d,
|
|
2164
2300
|
Xe as e,
|
|
2165
|
-
|
|
2166
|
-
|
|
2301
|
+
Be as f,
|
|
2302
|
+
Ve as g,
|
|
2167
2303
|
F as h,
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2304
|
+
cn as i,
|
|
2305
|
+
Wt as j,
|
|
2306
|
+
jt as k,
|
|
2307
|
+
zt as l,
|
|
2308
|
+
lt as m,
|
|
2309
|
+
In as n,
|
|
2310
|
+
on as p,
|
|
2311
|
+
sn as u
|
|
2176
2312
|
};
|
|
2177
|
-
//# sourceMappingURL=ginger-
|
|
2313
|
+
//# sourceMappingURL=ginger-Bc_8qZYi.js.map
|