@lucaismyname/ginger 0.0.42 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer/useGingerLiveAnalyzer.d.ts.map +1 -1
- package/dist/audio/GingerPlayer.d.ts.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.js +2 -2
- package/dist/context/GingerProvider.d.ts.map +1 -1
- package/dist/ginger-9lWCvbHv.cjs +2 -0
- package/dist/ginger-9lWCvbHv.cjs.map +1 -0
- package/dist/{ginger-B2DgE-2a.js → ginger-XgXdGRB-.js} +287 -294
- package/dist/ginger-XgXdGRB-.js.map +1 -0
- package/dist/index.cjs +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-Cqa9_CyH.cjs +2 -0
- package/dist/useGingerChapterProgress-Cqa9_CyH.cjs.map +1 -0
- package/dist/useGingerChapterProgress-DgqqoY5F.js +324 -0
- package/dist/useGingerChapterProgress-DgqqoY5F.js.map +1 -0
- package/package.json +1 -1
- package/dist/ginger-B2DgE-2a.js.map +0 -1
- package/dist/ginger-Dv3iO_xQ.cjs +0 -2
- package/dist/ginger-Dv3iO_xQ.cjs.map +0 -1
- package/dist/useGingerChapterProgress-D2pdmyjg.cjs +0 -2
- package/dist/useGingerChapterProgress-D2pdmyjg.cjs.map +0 -1
- package/dist/useGingerChapterProgress-wxAmN_uo.js +0 -323
- package/dist/useGingerChapterProgress-wxAmN_uo.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { jsx as c, jsxs as w, Fragment as ir } from "react/jsx-runtime";
|
|
|
2
2
|
import { useContext as $e, createContext as He, useRef as L, useState as on, useEffect as I, useMemo as A, useReducer as cn, useCallback as E, Children as sn, isValidElement as un, cloneElement as ln } from "react";
|
|
3
3
|
import { b as D, u as X, g as or, c as P, G as dn, d as pn } from "./GingerSplitContexts-BzBExb95.js";
|
|
4
4
|
import { b as Ye, g as K, r as gn, a as fn, p as cr, e as mn, d as sr } from "./selectors-BT3WSsKN.js";
|
|
5
|
-
import { t as Be, d as yn, b as hn, s as ur, f as Ue, e as H, g as vn, h as Ze, m as
|
|
5
|
+
import { t as Be, d as yn, b as hn, s as ur, f as Ue, e as H, g as vn, h as Ze, m as bn, i as er, j as rr, r as kn, c as nr } from "./transitions-CmNkf3sd.js";
|
|
6
6
|
const lr = He(null);
|
|
7
7
|
function Tn() {
|
|
8
8
|
const e = $e(lr);
|
|
@@ -17,15 +17,15 @@ function xn({
|
|
|
17
17
|
className: e,
|
|
18
18
|
style: r,
|
|
19
19
|
preload: t = "metadata",
|
|
20
|
-
crossOrigin:
|
|
20
|
+
crossOrigin: a,
|
|
21
21
|
respectReducedMotion: n = !1
|
|
22
22
|
}) {
|
|
23
|
-
var
|
|
24
|
-
const { audioRef:
|
|
23
|
+
var k;
|
|
24
|
+
const { audioRef: i, dispatch: o, state: s, notifyEnded: l } = Tn(), d = ((k = s.tracks[s.currentIndex]) == null ? void 0 : k.fileUrl) ?? "", m = L({
|
|
25
25
|
currentTime: -1,
|
|
26
26
|
duration: -1,
|
|
27
27
|
bufferedFraction: -1
|
|
28
|
-
}), y = L(""), [
|
|
28
|
+
}), y = L(""), [b, g] = on(!1);
|
|
29
29
|
I(() => {
|
|
30
30
|
if (!n || typeof window > "u") return;
|
|
31
31
|
const f = window.matchMedia("(prefers-reduced-motion: reduce)"), M = () => g(f.matches);
|
|
@@ -36,36 +36,33 @@ function xn({
|
|
|
36
36
|
currentTime: f.currentTime,
|
|
37
37
|
duration: f.duration,
|
|
38
38
|
bufferedFraction: tr(f)
|
|
39
|
-
}, N = m.current, Z =
|
|
39
|
+
}, N = m.current, Z = b ? 0.5 : 0.25, ee = Math.abs(S.currentTime - N.currentTime) >= Z || Math.abs(S.duration - N.duration) >= 0.01 || Math.abs(S.bufferedFraction - N.bufferedFraction) >= 0.01;
|
|
40
40
|
!M && !ee || (m.current = S, o({
|
|
41
41
|
type: "MEDIA_TIME_UPDATE",
|
|
42
42
|
payload: S
|
|
43
43
|
}));
|
|
44
44
|
};
|
|
45
45
|
return I(() => {
|
|
46
|
-
const f =
|
|
46
|
+
const f = i.current;
|
|
47
47
|
f && (f.volume = s.volume, f.muted = s.muted);
|
|
48
|
-
}, [
|
|
49
|
-
const f =
|
|
48
|
+
}, [i, s.volume, s.muted]), I(() => {
|
|
49
|
+
const f = i.current;
|
|
50
50
|
if (f) {
|
|
51
51
|
if (!d) {
|
|
52
52
|
f.removeAttribute("src"), m.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, y.current !== "" && o({ type: "MEDIA_SOURCE_CLEARED" }), y.current = "";
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
f.getAttribute("src") !== d && (f.src = d, f.load(), m.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), y.current = d;
|
|
55
|
+
f.getAttribute("src") !== d && (f.src = d, f.load(), m.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), y.current = d, f.playbackRate = s.playbackRate;
|
|
56
56
|
}
|
|
57
|
-
}, [
|
|
58
|
-
const f = a.current;
|
|
59
|
-
f && (f.playbackRate = s.playbackRate);
|
|
60
|
-
}, [a, s.playbackRate, d]), /* @__PURE__ */ c(
|
|
57
|
+
}, [i, o, d, s.playbackRate]), /* @__PURE__ */ c(
|
|
61
58
|
"audio",
|
|
62
59
|
{
|
|
63
60
|
"data-ginger-component": "Player",
|
|
64
|
-
ref:
|
|
61
|
+
ref: i,
|
|
65
62
|
className: e,
|
|
66
63
|
style: r,
|
|
67
64
|
preload: t,
|
|
68
|
-
crossOrigin:
|
|
65
|
+
crossOrigin: a,
|
|
69
66
|
controls: !1,
|
|
70
67
|
playsInline: !0,
|
|
71
68
|
onTimeUpdate: (f) => {
|
|
@@ -98,7 +95,7 @@ function xn({
|
|
|
98
95
|
},
|
|
99
96
|
onError: () => {
|
|
100
97
|
var N;
|
|
101
|
-
const f =
|
|
98
|
+
const f = i.current, M = (N = f == null ? void 0 : f.error) == null ? void 0 : N.code;
|
|
102
99
|
o({ type: "MEDIA_ERROR", payload: { message: M === 1 ? "MEDIA_ERR_ABORTED" : M === 2 ? "MEDIA_ERR_NETWORK" : M === 3 ? "MEDIA_ERR_DECODE" : M === 4 ? "MEDIA_ERR_SRC_NOT_SUPPORTED" : "MEDIA_ERR_UNKNOWN" } });
|
|
103
100
|
}
|
|
104
101
|
}
|
|
@@ -149,11 +146,11 @@ function J(e) {
|
|
|
149
146
|
return `${Math.floor(e / 60)}:${r.toString().padStart(2, "0")}`;
|
|
150
147
|
}
|
|
151
148
|
function In() {
|
|
152
|
-
const e = D(), r = X(), t = G(),
|
|
149
|
+
const e = D(), r = X(), t = G(), a = A(() => or(e, r), [e, r]), n = Ye(a), i = n > 0 ? a.currentTime : 0, o = Number.isFinite(i) ? i : 0, s = n > 0 ? `${J(o)} of ${J(n)}` : J(o), l = (d) => {
|
|
153
150
|
r.seek(Number(d.currentTarget.value));
|
|
154
151
|
};
|
|
155
152
|
return {
|
|
156
|
-
state:
|
|
153
|
+
state: a,
|
|
157
154
|
value: o,
|
|
158
155
|
min: 0,
|
|
159
156
|
max: n > 0 ? n : 1,
|
|
@@ -165,36 +162,36 @@ function In() {
|
|
|
165
162
|
};
|
|
166
163
|
}
|
|
167
164
|
function Pn() {
|
|
168
|
-
const e = D(), r = X(), t = G(),
|
|
169
|
-
r.setVolume(Number(
|
|
165
|
+
const e = D(), r = X(), t = G(), a = A(() => or(e, r), [e, r]), n = (i) => {
|
|
166
|
+
r.setVolume(Number(i.currentTarget.value));
|
|
170
167
|
};
|
|
171
168
|
return {
|
|
172
|
-
state:
|
|
173
|
-
value:
|
|
169
|
+
state: a,
|
|
170
|
+
value: a.volume,
|
|
174
171
|
min: 0,
|
|
175
172
|
max: 1,
|
|
176
173
|
step: "any",
|
|
177
|
-
ariaValueText: `${Math.round(
|
|
174
|
+
ariaValueText: `${Math.round(a.volume * 100)}%`,
|
|
178
175
|
ariaLabel: t.volume,
|
|
179
176
|
onVolumeInput: n,
|
|
180
177
|
onVolumeChange: n
|
|
181
178
|
};
|
|
182
179
|
}
|
|
183
180
|
function An(e) {
|
|
184
|
-
const r = D(), t = G(),
|
|
181
|
+
const r = D(), t = G(), a = (e == null ? void 0 : e.playAriaLabel) ?? t.play, n = (e == null ? void 0 : e.pauseAriaLabel) ?? t.pause;
|
|
185
182
|
return {
|
|
186
183
|
isPaused: r.isPaused,
|
|
187
184
|
toggle: r.togglePlayPause,
|
|
188
|
-
ariaLabel: r.isPaused ?
|
|
185
|
+
ariaLabel: r.isPaused ? a : n
|
|
189
186
|
};
|
|
190
187
|
}
|
|
191
188
|
function _(e) {
|
|
192
189
|
const {
|
|
193
190
|
className: r,
|
|
194
191
|
width: t,
|
|
195
|
-
height:
|
|
192
|
+
height: a,
|
|
196
193
|
viewBox: n,
|
|
197
|
-
fill:
|
|
194
|
+
fill: i,
|
|
198
195
|
stroke: o,
|
|
199
196
|
strokeWidth: s,
|
|
200
197
|
strokeLinecap: l,
|
|
@@ -208,7 +205,7 @@ function _(e) {
|
|
|
208
205
|
"data-ginger-component": "Wrapper",
|
|
209
206
|
xmlns: "http://www.w3.org/2000/svg",
|
|
210
207
|
width: t ?? 24,
|
|
211
|
-
height:
|
|
208
|
+
height: a ?? 24,
|
|
212
209
|
viewBox: n ?? "0 0 24 24",
|
|
213
210
|
fill: "none",
|
|
214
211
|
stroke: o ?? "currentColor",
|
|
@@ -298,7 +295,7 @@ function vr() {
|
|
|
298
295
|
/* @__PURE__ */ c("path", { d: "M19.364 18.364a9 9 0 0 0 0-12.728" })
|
|
299
296
|
] });
|
|
300
297
|
}
|
|
301
|
-
function
|
|
298
|
+
function br() {
|
|
302
299
|
return /* @__PURE__ */ w(_, { children: [
|
|
303
300
|
/* @__PURE__ */ c(
|
|
304
301
|
"path",
|
|
@@ -311,37 +308,37 @@ function kr() {
|
|
|
311
308
|
/* @__PURE__ */ c("line", { x1: "16", x2: "22", y1: "9", y2: "15" })
|
|
312
309
|
] });
|
|
313
310
|
}
|
|
314
|
-
function
|
|
311
|
+
function kr({
|
|
315
312
|
playLabel: e = "Play",
|
|
316
313
|
pauseLabel: r = "Pause",
|
|
317
314
|
playAriaLabel: t,
|
|
318
|
-
pauseAriaLabel:
|
|
315
|
+
pauseAriaLabel: a,
|
|
319
316
|
children: n,
|
|
320
|
-
type:
|
|
317
|
+
type: i = "button",
|
|
321
318
|
onClick: o,
|
|
322
319
|
...s
|
|
323
320
|
}) {
|
|
324
321
|
const l = G(), d = typeof e == "string" ? e : l.play, m = typeof r == "string" ? r : l.pause, y = An({
|
|
325
322
|
playAriaLabel: t ?? d,
|
|
326
|
-
pauseAriaLabel:
|
|
323
|
+
pauseAriaLabel: a ?? m
|
|
327
324
|
});
|
|
328
325
|
return /* @__PURE__ */ c(
|
|
329
326
|
"button",
|
|
330
327
|
{
|
|
331
328
|
"data-ginger-component": "PlayPause",
|
|
332
329
|
...s,
|
|
333
|
-
type:
|
|
330
|
+
type: i,
|
|
334
331
|
"aria-label": y.ariaLabel,
|
|
335
|
-
onClick: (
|
|
336
|
-
y.toggle(), o == null || o(
|
|
332
|
+
onClick: (b) => {
|
|
333
|
+
y.toggle(), o == null || o(b);
|
|
337
334
|
},
|
|
338
335
|
children: n ?? (y.isPaused ? /* @__PURE__ */ c(gr, {}) : /* @__PURE__ */ c(pr, {}))
|
|
339
336
|
}
|
|
340
337
|
);
|
|
341
338
|
}
|
|
342
|
-
|
|
343
|
-
function Tr({ type: e = "button", ariaLabel: r, onClick: t, children:
|
|
344
|
-
const { repeatMode:
|
|
339
|
+
kr.displayName = "Ginger.Control.PlayPause";
|
|
340
|
+
function Tr({ type: e = "button", ariaLabel: r, onClick: t, children: a, ...n }) {
|
|
341
|
+
const { repeatMode: i, cycleRepeat: o } = D(), l = G().repeat[i];
|
|
345
342
|
return /* @__PURE__ */ c(
|
|
346
343
|
"button",
|
|
347
344
|
{
|
|
@@ -352,13 +349,13 @@ function Tr({ type: e = "button", ariaLabel: r, onClick: t, children: i, ...n })
|
|
|
352
349
|
onClick: (d) => {
|
|
353
350
|
o(), t == null || t(d);
|
|
354
351
|
},
|
|
355
|
-
children:
|
|
352
|
+
children: a ?? /* @__PURE__ */ c(fr, { mode: i })
|
|
356
353
|
}
|
|
357
354
|
);
|
|
358
355
|
}
|
|
359
356
|
Tr.displayName = "Ginger.Control.Repeat";
|
|
360
|
-
function xr({ type: e = "button", children: r, ariaLabel: t, onClick:
|
|
361
|
-
const { next:
|
|
357
|
+
function xr({ type: e = "button", children: r, ariaLabel: t, onClick: a, ...n }) {
|
|
358
|
+
const { next: i } = D(), o = G();
|
|
362
359
|
return /* @__PURE__ */ c(
|
|
363
360
|
"button",
|
|
364
361
|
{
|
|
@@ -367,7 +364,7 @@ function xr({ type: e = "button", children: r, ariaLabel: t, onClick: i, ...n })
|
|
|
367
364
|
type: e,
|
|
368
365
|
"aria-label": t ?? o.nextTrack,
|
|
369
366
|
onClick: (s) => {
|
|
370
|
-
|
|
367
|
+
i(), a == null || a(s);
|
|
371
368
|
},
|
|
372
369
|
children: r ?? /* @__PURE__ */ c(hr, {})
|
|
373
370
|
}
|
|
@@ -378,10 +375,10 @@ function Mr({
|
|
|
378
375
|
type: e = "button",
|
|
379
376
|
children: r,
|
|
380
377
|
ariaLabel: t,
|
|
381
|
-
onClick:
|
|
378
|
+
onClick: a,
|
|
382
379
|
...n
|
|
383
380
|
}) {
|
|
384
|
-
const { prev:
|
|
381
|
+
const { prev: i } = D(), o = G();
|
|
385
382
|
return /* @__PURE__ */ c(
|
|
386
383
|
"button",
|
|
387
384
|
{
|
|
@@ -390,68 +387,68 @@ function Mr({
|
|
|
390
387
|
type: e,
|
|
391
388
|
"aria-label": t ?? o.previousTrack,
|
|
392
389
|
onClick: (s) => {
|
|
393
|
-
|
|
390
|
+
i(), a == null || a(s);
|
|
394
391
|
},
|
|
395
392
|
children: r ?? /* @__PURE__ */ c(yr, {})
|
|
396
393
|
}
|
|
397
394
|
);
|
|
398
395
|
}
|
|
399
396
|
Mr.displayName = "Ginger.Control.Previous";
|
|
400
|
-
function Er({ type: e = "button", children: r, ariaLabel: t, onClick:
|
|
401
|
-
const { isShuffled:
|
|
397
|
+
function Er({ type: e = "button", children: r, ariaLabel: t, onClick: a, ...n }) {
|
|
398
|
+
const { isShuffled: i, toggleShuffle: o } = D(), s = G();
|
|
402
399
|
return /* @__PURE__ */ c(
|
|
403
400
|
"button",
|
|
404
401
|
{
|
|
405
402
|
"data-ginger-component": "Shuffle",
|
|
406
403
|
...n,
|
|
407
404
|
type: e,
|
|
408
|
-
"aria-pressed":
|
|
405
|
+
"aria-pressed": i,
|
|
409
406
|
"aria-label": t ?? s.shuffle,
|
|
410
407
|
onClick: (l) => {
|
|
411
|
-
o(),
|
|
408
|
+
o(), a == null || a(l);
|
|
412
409
|
},
|
|
413
410
|
children: r ?? /* @__PURE__ */ c(mr, {})
|
|
414
411
|
}
|
|
415
412
|
);
|
|
416
413
|
}
|
|
417
414
|
Er.displayName = "Ginger.Control.Shuffle";
|
|
418
|
-
function Ir({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel:
|
|
419
|
-
const
|
|
415
|
+
function Ir({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: a, ...n }) {
|
|
416
|
+
const i = In(), o = t ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
420
417
|
return /* @__PURE__ */ c(
|
|
421
418
|
"input",
|
|
422
419
|
{
|
|
423
420
|
"data-ginger-component": "SeekBar",
|
|
424
421
|
...n,
|
|
425
422
|
type: "range",
|
|
426
|
-
min:
|
|
427
|
-
max:
|
|
428
|
-
step:
|
|
429
|
-
value:
|
|
430
|
-
"aria-label":
|
|
431
|
-
"aria-valuetext":
|
|
432
|
-
onInput:
|
|
433
|
-
onChange:
|
|
423
|
+
min: i.min,
|
|
424
|
+
max: i.max,
|
|
425
|
+
step: i.step,
|
|
426
|
+
value: i.value,
|
|
427
|
+
"aria-label": a ?? i.ariaLabel,
|
|
428
|
+
"aria-valuetext": i.ariaValueText,
|
|
429
|
+
onInput: i.onSeekInput,
|
|
430
|
+
onChange: i.onSeekChange,
|
|
434
431
|
style: o
|
|
435
432
|
}
|
|
436
433
|
);
|
|
437
434
|
}
|
|
438
435
|
Ir.displayName = "Ginger.Control.SeekBar";
|
|
439
|
-
function Pr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel:
|
|
440
|
-
const
|
|
436
|
+
function Pr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: a, ...n }) {
|
|
437
|
+
const i = Pn(), o = t ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
441
438
|
return /* @__PURE__ */ c(
|
|
442
439
|
"input",
|
|
443
440
|
{
|
|
444
441
|
"data-ginger-component": "Volume",
|
|
445
442
|
...n,
|
|
446
443
|
type: "range",
|
|
447
|
-
min:
|
|
448
|
-
max:
|
|
449
|
-
step:
|
|
450
|
-
value:
|
|
451
|
-
"aria-label":
|
|
452
|
-
"aria-valuetext":
|
|
453
|
-
onInput:
|
|
454
|
-
onChange:
|
|
444
|
+
min: i.min,
|
|
445
|
+
max: i.max,
|
|
446
|
+
step: i.step,
|
|
447
|
+
value: i.value,
|
|
448
|
+
"aria-label": a ?? i.ariaLabel,
|
|
449
|
+
"aria-valuetext": i.ariaValueText,
|
|
450
|
+
onInput: i.onVolumeInput,
|
|
451
|
+
onChange: i.onVolumeChange,
|
|
455
452
|
style: o
|
|
456
453
|
}
|
|
457
454
|
);
|
|
@@ -461,9 +458,9 @@ function Ar({
|
|
|
461
458
|
ariaLabel: e,
|
|
462
459
|
muteLabel: r,
|
|
463
460
|
unmuteLabel: t,
|
|
464
|
-
type:
|
|
461
|
+
type: a = "button",
|
|
465
462
|
onClick: n,
|
|
466
|
-
children:
|
|
463
|
+
children: i,
|
|
467
464
|
...o
|
|
468
465
|
}) {
|
|
469
466
|
const { muted: s, toggleMute: l } = X(), d = G();
|
|
@@ -472,13 +469,13 @@ function Ar({
|
|
|
472
469
|
{
|
|
473
470
|
"data-ginger-component": "Mute",
|
|
474
471
|
...o,
|
|
475
|
-
type:
|
|
472
|
+
type: a,
|
|
476
473
|
"aria-pressed": s,
|
|
477
474
|
"aria-label": e ?? (s ? d.unmute : d.mute),
|
|
478
475
|
onClick: (m) => {
|
|
479
476
|
l(), n == null || n(m);
|
|
480
477
|
},
|
|
481
|
-
children:
|
|
478
|
+
children: i ?? (s ? t ?? /* @__PURE__ */ c(br, {}) : r ?? /* @__PURE__ */ c(vr, {}))
|
|
482
479
|
}
|
|
483
480
|
);
|
|
484
481
|
}
|
|
@@ -488,12 +485,12 @@ function Sr({
|
|
|
488
485
|
rates: e = Sn,
|
|
489
486
|
style: r,
|
|
490
487
|
ariaLabel: t,
|
|
491
|
-
children:
|
|
488
|
+
children: a,
|
|
492
489
|
...n
|
|
493
490
|
}) {
|
|
494
|
-
const { playbackRate:
|
|
495
|
-
() => Array.from(/* @__PURE__ */ new Set([...e,
|
|
496
|
-
[e,
|
|
491
|
+
const { playbackRate: i, setPlaybackRate: o } = X(), s = G(), l = A(
|
|
492
|
+
() => Array.from(/* @__PURE__ */ new Set([...e, i])).sort((d, m) => d - m),
|
|
493
|
+
[e, i]
|
|
497
494
|
);
|
|
498
495
|
return /* @__PURE__ */ c(
|
|
499
496
|
"select",
|
|
@@ -501,20 +498,20 @@ function Sr({
|
|
|
501
498
|
"data-ginger-component": "PlaybackRate",
|
|
502
499
|
...n,
|
|
503
500
|
"aria-label": t ?? s.playbackSpeed,
|
|
504
|
-
value: String(
|
|
501
|
+
value: String(i),
|
|
505
502
|
style: r,
|
|
506
503
|
onChange: (d) => o(Number(d.currentTarget.value)),
|
|
507
|
-
children:
|
|
504
|
+
children: a ?? l.map((d) => /* @__PURE__ */ c("option", { value: String(d), children: d === 1 ? s.playbackRateNormal : s.playbackRateTimes(d) }, d))
|
|
508
505
|
}
|
|
509
506
|
);
|
|
510
507
|
}
|
|
511
508
|
Sr.displayName = "Ginger.Control.PlaybackRate";
|
|
512
509
|
function Q(e, r) {
|
|
513
|
-
function t(
|
|
514
|
-
const n = P(), o = (r(n) ?? "").trim(), { className: s, style: l, fallback: d, empty: m, children: y } =
|
|
510
|
+
function t(a) {
|
|
511
|
+
const n = P(), o = (r(n) ?? "").trim(), { className: s, style: l, fallback: d, empty: m, children: y } = a;
|
|
515
512
|
if (!o) {
|
|
516
|
-
const
|
|
517
|
-
return
|
|
513
|
+
const b = m ?? d ?? null;
|
|
514
|
+
return b ? /* @__PURE__ */ c("span", { className: s, style: l, children: b }) : null;
|
|
518
515
|
}
|
|
519
516
|
return y ? /* @__PURE__ */ c("span", { className: s, style: l, children: y(o, n) }) : /* @__PURE__ */ c("span", { className: s, style: l, children: o });
|
|
520
517
|
}
|
|
@@ -534,14 +531,14 @@ const Rn = j("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), wn =
|
|
|
534
531
|
"Ginger.Current.TrackNumber",
|
|
535
532
|
(e) => (e == null ? void 0 : e.trackNumber) != null ? String(e.trackNumber) : void 0
|
|
536
533
|
);
|
|
537
|
-
function Rr({ className: e, style: r, fallback: t, empty:
|
|
534
|
+
function Rr({ className: e, style: r, fallback: t, empty: a, children: n, format: i }) {
|
|
538
535
|
var d;
|
|
539
536
|
const o = P(), s = (d = K(o)) == null ? void 0 : d.year;
|
|
540
537
|
if (typeof s != "number" || !Number.isFinite(s)) {
|
|
541
|
-
const m =
|
|
538
|
+
const m = a ?? t ?? null;
|
|
542
539
|
return m ? /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: m }) : null;
|
|
543
540
|
}
|
|
544
|
-
const l =
|
|
541
|
+
const l = i ? i(s) : String(s);
|
|
545
542
|
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: n(l, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: l });
|
|
546
543
|
}
|
|
547
544
|
Rr.displayName = "Ginger.Current.Year";
|
|
@@ -549,18 +546,18 @@ function wr({
|
|
|
549
546
|
className: e,
|
|
550
547
|
style: r,
|
|
551
548
|
fallback: t,
|
|
552
|
-
empty:
|
|
549
|
+
empty: a,
|
|
553
550
|
children: n,
|
|
554
|
-
preserveWhitespace:
|
|
551
|
+
preserveWhitespace: i = !0,
|
|
555
552
|
unstyled: o = !1
|
|
556
553
|
}) {
|
|
557
554
|
var y;
|
|
558
|
-
const s = P(), l = ((y = K(s)) == null ? void 0 : y.lyrics) ?? "", d =
|
|
555
|
+
const s = P(), l = ((y = K(s)) == null ? void 0 : y.lyrics) ?? "", d = i ? l.replace(/^\s+|\s+$/g, "") : l.trim();
|
|
559
556
|
if (!d) {
|
|
560
|
-
const
|
|
561
|
-
return
|
|
557
|
+
const b = a ?? t ?? null;
|
|
558
|
+
return b ? /* @__PURE__ */ c("span", { "data-ginger-component": "Lyrics", className: e, style: r, children: b }) : null;
|
|
562
559
|
}
|
|
563
|
-
const m = !o &&
|
|
560
|
+
const m = !o && i ? { whiteSpace: "pre-wrap" } : void 0;
|
|
564
561
|
return n ? /* @__PURE__ */ c("span", { className: e, style: { ...m, ...r }, children: n(d, s) }) : /* @__PURE__ */ c("span", { className: e, style: { ...m, ...r }, children: d });
|
|
565
562
|
}
|
|
566
563
|
wr.displayName = "Ginger.Current.Lyrics";
|
|
@@ -568,41 +565,41 @@ const ar = /\[(\d{1,2}):(\d{2})(?:\.(\d{1,3}))?\]/g;
|
|
|
568
565
|
function Un(e) {
|
|
569
566
|
const r = [];
|
|
570
567
|
for (const t of e.split(/\r?\n/)) {
|
|
571
|
-
const
|
|
572
|
-
if (
|
|
568
|
+
const a = [...t.matchAll(ar)];
|
|
569
|
+
if (a.length === 0) continue;
|
|
573
570
|
const n = t.replace(ar, "").trim();
|
|
574
|
-
for (const
|
|
575
|
-
const o = Number(
|
|
571
|
+
for (const i of a) {
|
|
572
|
+
const o = Number(i[1] ?? 0), s = Number(i[2] ?? 0), l = Number((i[3] ?? "0").padEnd(3, "0")), d = o * 60 + s + l / 1e3;
|
|
576
573
|
Number.isFinite(d) && d >= 0 && r.push({ time: d, text: n });
|
|
577
574
|
}
|
|
578
575
|
}
|
|
579
|
-
return r.sort((t,
|
|
576
|
+
return r.sort((t, a) => t.time - a.time);
|
|
580
577
|
}
|
|
581
578
|
function Vn() {
|
|
582
|
-
const { tracks: e, currentIndex: r } = D(), { currentTime: t } = X(),
|
|
579
|
+
const { tracks: e, currentIndex: r } = D(), { currentTime: t } = X(), a = e[r], n = A(() => a ? Array.isArray(a.lyricsTimed) && a.lyricsTimed.length > 0 ? [...a.lyricsTimed].filter((o) => Number.isFinite(o.time) && o.time >= 0).sort((o, s) => o.time - s.time) : typeof a.lyrics == "string" ? Un(a.lyrics) : [] : [], [a]), i = A(() => {
|
|
583
580
|
for (let o = n.length - 1; o >= 0; o -= 1)
|
|
584
581
|
if (t >= n[o].time) return o;
|
|
585
582
|
return -1;
|
|
586
583
|
}, [t, n]);
|
|
587
584
|
return {
|
|
588
585
|
lines: n,
|
|
589
|
-
activeIndex:
|
|
590
|
-
activeLine:
|
|
586
|
+
activeIndex: i,
|
|
587
|
+
activeLine: i >= 0 ? n[i] ?? null : null
|
|
591
588
|
};
|
|
592
589
|
}
|
|
593
590
|
function Nr({
|
|
594
591
|
className: e,
|
|
595
592
|
style: r,
|
|
596
593
|
fallback: t,
|
|
597
|
-
empty:
|
|
594
|
+
empty: a,
|
|
598
595
|
unstyled: n = !1,
|
|
599
|
-
activeClassName:
|
|
596
|
+
activeClassName: i,
|
|
600
597
|
lineClassName: o,
|
|
601
598
|
children: s
|
|
602
599
|
}) {
|
|
603
600
|
const l = P(), d = G(), { lines: m, activeIndex: y } = Vn();
|
|
604
601
|
if (m.length === 0) {
|
|
605
|
-
const g =
|
|
602
|
+
const g = a ?? t ?? null;
|
|
606
603
|
return g ? /* @__PURE__ */ c("span", { "data-ginger-component": "LyricsSynced", className: e, style: r, children: g }) : null;
|
|
607
604
|
}
|
|
608
605
|
return /* @__PURE__ */ c(
|
|
@@ -619,19 +616,19 @@ function Nr({
|
|
|
619
616
|
}, ...r },
|
|
620
617
|
"aria-label": d.syncedLyricsList,
|
|
621
618
|
children: m.map((g, h) => {
|
|
622
|
-
const
|
|
619
|
+
const k = h === y;
|
|
623
620
|
return /* @__PURE__ */ c(
|
|
624
621
|
"li",
|
|
625
622
|
{
|
|
626
|
-
"aria-current":
|
|
627
|
-
"data-ginger-active":
|
|
628
|
-
className: [o,
|
|
623
|
+
"aria-current": k ? "true" : void 0,
|
|
624
|
+
"data-ginger-active": k || void 0,
|
|
625
|
+
className: [o, k ? i : void 0].filter(Boolean).join(" ") || void 0,
|
|
629
626
|
style: n ? void 0 : {
|
|
630
627
|
padding: "var(--ginger-playlist-row-padding, 4px 8px)",
|
|
631
|
-
fontWeight:
|
|
632
|
-
opacity:
|
|
628
|
+
fontWeight: k ? 600 : 400,
|
|
629
|
+
opacity: k ? 1 : 0.75
|
|
633
630
|
},
|
|
634
|
-
children: s ? s(g, h,
|
|
631
|
+
children: s ? s(g, h, k, l) : g.text
|
|
635
632
|
},
|
|
636
633
|
`${g.time}-${h}`
|
|
637
634
|
);
|
|
@@ -641,10 +638,10 @@ function Nr({
|
|
|
641
638
|
}
|
|
642
639
|
Nr.displayName = "Ginger.Current.LyricsSynced";
|
|
643
640
|
function Bn() {
|
|
644
|
-
const { tracks: e, currentIndex: r } = D(), { currentTime: t, seek:
|
|
641
|
+
const { tracks: e, currentIndex: r } = D(), { currentTime: t, seek: a } = X(), n = A(() => {
|
|
645
642
|
var s;
|
|
646
643
|
return [...((s = e[r]) == null ? void 0 : s.chapters) ?? []].filter((l) => l && Number.isFinite(l.startSeconds) && l.startSeconds >= 0).sort((l, d) => l.startSeconds - d.startSeconds);
|
|
647
|
-
}, [r, e]),
|
|
644
|
+
}, [r, e]), i = A(() => {
|
|
648
645
|
if (n.length === 0) return -1;
|
|
649
646
|
for (let o = n.length - 1; o >= 0; o -= 1)
|
|
650
647
|
if (t >= n[o].startSeconds) return o;
|
|
@@ -652,11 +649,11 @@ function Bn() {
|
|
|
652
649
|
}, [t, n]);
|
|
653
650
|
return {
|
|
654
651
|
list: n,
|
|
655
|
-
activeIndex:
|
|
656
|
-
active:
|
|
652
|
+
activeIndex: i,
|
|
653
|
+
active: i >= 0 ? n[i] ?? null : null,
|
|
657
654
|
seekTo: (o) => {
|
|
658
655
|
const s = n[o];
|
|
659
|
-
s &&
|
|
656
|
+
s && a(s.startSeconds);
|
|
660
657
|
}
|
|
661
658
|
};
|
|
662
659
|
}
|
|
@@ -664,14 +661,14 @@ function Gr({
|
|
|
664
661
|
className: e,
|
|
665
662
|
style: r,
|
|
666
663
|
fallback: t,
|
|
667
|
-
empty:
|
|
664
|
+
empty: a,
|
|
668
665
|
unstyled: n = !1,
|
|
669
|
-
formatStart:
|
|
666
|
+
formatStart: i = J,
|
|
670
667
|
children: o
|
|
671
668
|
}) {
|
|
672
669
|
const s = P(), l = G(), { list: d, activeIndex: m, seekTo: y } = Bn();
|
|
673
670
|
if (d.length === 0) {
|
|
674
|
-
const g =
|
|
671
|
+
const g = a ?? t ?? null;
|
|
675
672
|
return g ? /* @__PURE__ */ c("span", { "data-ginger-component": "Chapters", className: e, style: r, children: g }) : null;
|
|
676
673
|
}
|
|
677
674
|
return /* @__PURE__ */ c("ul", { className: e, style: { ...n ? {} : {
|
|
@@ -682,30 +679,30 @@ function Gr({
|
|
|
682
679
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
683
680
|
color: "var(--ginger-primary-color, #111827)"
|
|
684
681
|
}, ...r }, "aria-label": l.chaptersList, children: d.map((g, h) => {
|
|
685
|
-
const
|
|
682
|
+
const k = h === m;
|
|
686
683
|
return /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
|
|
687
684
|
"button",
|
|
688
685
|
{
|
|
689
686
|
type: "button",
|
|
690
|
-
"aria-current":
|
|
691
|
-
"data-ginger-active":
|
|
687
|
+
"aria-current": k ? "true" : void 0,
|
|
688
|
+
"data-ginger-active": k || void 0,
|
|
692
689
|
onClick: () => y(h),
|
|
693
690
|
style: {
|
|
694
691
|
width: n ? void 0 : "100%",
|
|
695
692
|
textAlign: n ? void 0 : "left",
|
|
696
693
|
border: n ? void 0 : "none",
|
|
697
|
-
background: n ? void 0 :
|
|
694
|
+
background: n ? void 0 : k ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
|
|
698
695
|
color: n ? void 0 : "inherit",
|
|
699
696
|
font: n ? void 0 : "inherit",
|
|
700
697
|
cursor: n ? void 0 : "pointer",
|
|
701
698
|
padding: n ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)"
|
|
702
699
|
},
|
|
703
|
-
children: o ? o(g, h,
|
|
704
|
-
|
|
700
|
+
children: o ? o(g, h, k, s) : n ? /* @__PURE__ */ w(ir, { children: [
|
|
701
|
+
i(g.startSeconds),
|
|
705
702
|
" ",
|
|
706
703
|
g.title
|
|
707
704
|
] }) : /* @__PURE__ */ w("span", { children: [
|
|
708
|
-
/* @__PURE__ */ c("span", { style: { opacity: 0.75, marginRight: "0.35em" }, children:
|
|
705
|
+
/* @__PURE__ */ c("span", { style: { opacity: 0.75, marginRight: "0.35em" }, children: i(g.startSeconds) }),
|
|
709
706
|
g.title
|
|
710
707
|
] })
|
|
711
708
|
}
|
|
@@ -717,36 +714,36 @@ function Lr({
|
|
|
717
714
|
visible: e = !1,
|
|
718
715
|
className: r,
|
|
719
716
|
style: t,
|
|
720
|
-
fallback:
|
|
717
|
+
fallback: a,
|
|
721
718
|
empty: n,
|
|
722
|
-
children:
|
|
719
|
+
children: i
|
|
723
720
|
}) {
|
|
724
721
|
var l;
|
|
725
722
|
const o = P();
|
|
726
723
|
if (!e) return null;
|
|
727
724
|
const s = ((l = K(o)) == null ? void 0 : l.fileUrl) ?? "";
|
|
728
725
|
if (!s) {
|
|
729
|
-
const d = n ??
|
|
726
|
+
const d = n ?? a ?? null;
|
|
730
727
|
return d ? /* @__PURE__ */ c("span", { className: r, style: t, children: d }) : null;
|
|
731
728
|
}
|
|
732
|
-
return
|
|
729
|
+
return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "FileUrl", className: r, style: t, children: i(s, o) }) : /* @__PURE__ */ c("span", { className: r, style: t, children: s });
|
|
733
730
|
}
|
|
734
731
|
Lr.displayName = "Ginger.Current.FileUrl";
|
|
735
732
|
function _r({
|
|
736
733
|
className: e,
|
|
737
734
|
style: r,
|
|
738
735
|
fallback: t,
|
|
739
|
-
empty:
|
|
736
|
+
empty: a,
|
|
740
737
|
sizes: n,
|
|
741
|
-
loading:
|
|
738
|
+
loading: i,
|
|
742
739
|
onError: o,
|
|
743
740
|
decoding: s,
|
|
744
741
|
unstyled: l = !1,
|
|
745
742
|
imgStyle: d
|
|
746
743
|
}) {
|
|
747
|
-
const m = P(), y = K(m),
|
|
748
|
-
if (!
|
|
749
|
-
const h =
|
|
744
|
+
const m = P(), y = K(m), b = fn(m);
|
|
745
|
+
if (!b) {
|
|
746
|
+
const h = a ?? t ?? null;
|
|
750
747
|
return h ? /* @__PURE__ */ c("span", { className: e, style: r, children: h }) : null;
|
|
751
748
|
}
|
|
752
749
|
const g = [y == null ? void 0 : y.title, y == null ? void 0 : y.artist].filter(Boolean).join(" — ") || "Artwork";
|
|
@@ -764,10 +761,10 @@ function _r({
|
|
|
764
761
|
children: /* @__PURE__ */ c(
|
|
765
762
|
"img",
|
|
766
763
|
{
|
|
767
|
-
src:
|
|
764
|
+
src: b,
|
|
768
765
|
alt: g,
|
|
769
766
|
sizes: n,
|
|
770
|
-
loading:
|
|
767
|
+
loading: i,
|
|
771
768
|
decoding: s,
|
|
772
769
|
onError: o,
|
|
773
770
|
style: {
|
|
@@ -787,54 +784,54 @@ function Dr({
|
|
|
787
784
|
base: e = 0,
|
|
788
785
|
className: r,
|
|
789
786
|
style: t,
|
|
790
|
-
fallback:
|
|
787
|
+
fallback: a,
|
|
791
788
|
empty: n,
|
|
792
|
-
children:
|
|
789
|
+
children: i
|
|
793
790
|
}) {
|
|
794
791
|
const o = P();
|
|
795
792
|
if (o.tracks.length === 0) {
|
|
796
|
-
const d = n ??
|
|
793
|
+
const d = n ?? a ?? null;
|
|
797
794
|
return d ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: t, children: d }) : null;
|
|
798
795
|
}
|
|
799
796
|
const l = String(o.currentIndex + e);
|
|
800
|
-
return
|
|
797
|
+
return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: t, children: i(l, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: t, children: l });
|
|
801
798
|
}
|
|
802
799
|
Dr.displayName = "Ginger.Current.QueueIndex";
|
|
803
|
-
function Cr({ className: e, style: r, fallback: t, empty:
|
|
804
|
-
const
|
|
805
|
-
if (
|
|
806
|
-
const s =
|
|
800
|
+
function Cr({ className: e, style: r, fallback: t, empty: a, children: n }) {
|
|
801
|
+
const i = P(), o = String(i.tracks.length);
|
|
802
|
+
if (i.tracks.length === 0) {
|
|
803
|
+
const s = a ?? t ?? null;
|
|
807
804
|
return s ? /* @__PURE__ */ c("span", { className: e, style: r, children: s }) : null;
|
|
808
805
|
}
|
|
809
|
-
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: n(o,
|
|
806
|
+
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: n(o, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: o });
|
|
810
807
|
}
|
|
811
808
|
Cr.displayName = "Ginger.Current.QueueLength";
|
|
812
809
|
function Fr({
|
|
813
810
|
base: e = 0,
|
|
814
811
|
separator: r = " / ",
|
|
815
812
|
className: t,
|
|
816
|
-
style:
|
|
813
|
+
style: a,
|
|
817
814
|
fallback: n,
|
|
818
|
-
empty:
|
|
815
|
+
empty: i,
|
|
819
816
|
children: o
|
|
820
817
|
}) {
|
|
821
818
|
const s = P(), l = s.tracks.length;
|
|
822
819
|
if (l === 0) {
|
|
823
|
-
const
|
|
824
|
-
return
|
|
820
|
+
const b = i ?? n ?? null;
|
|
821
|
+
return b ? /* @__PURE__ */ c("span", { className: t, style: a, children: b }) : null;
|
|
825
822
|
}
|
|
826
823
|
const d = String(s.currentIndex + e), m = String(l), y = `${d}${r}${m}`;
|
|
827
|
-
return o ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: t, style:
|
|
824
|
+
return o ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: t, style: a, children: o({ index: d, length: m, label: y }, s) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: t, style: a, children: y });
|
|
828
825
|
}
|
|
829
826
|
Fr.displayName = "Ginger.Current.QueuePosition";
|
|
830
827
|
function Qe(e, r, t) {
|
|
831
|
-
const { className:
|
|
828
|
+
const { className: a, style: n, fallback: i, empty: o, children: s, format: l = J } = t;
|
|
832
829
|
if (!(e >= 0) || !Number.isFinite(e)) {
|
|
833
|
-
const m = o ??
|
|
834
|
-
return m ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className:
|
|
830
|
+
const m = o ?? i ?? null;
|
|
831
|
+
return m ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: n, children: m }) : null;
|
|
835
832
|
}
|
|
836
833
|
const d = l(e);
|
|
837
|
-
return s ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className:
|
|
834
|
+
return s ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: n, children: s(d, r) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: n, children: d });
|
|
838
835
|
}
|
|
839
836
|
function Ur(e) {
|
|
840
837
|
const r = P();
|
|
@@ -851,23 +848,23 @@ function Br(e) {
|
|
|
851
848
|
return Qe(mn(r), r, e);
|
|
852
849
|
}
|
|
853
850
|
Br.displayName = "Ginger.Current.Remaining";
|
|
854
|
-
function Or({ className: e, style: r, fallback: t, empty:
|
|
855
|
-
const
|
|
851
|
+
function Or({ className: e, style: r, fallback: t, empty: a, children: n }) {
|
|
852
|
+
const i = P(), o = Ye(i), s = cr(i);
|
|
856
853
|
if (!(o > 0)) {
|
|
857
|
-
const l =
|
|
854
|
+
const l = a ?? t ?? null;
|
|
858
855
|
return l ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: l }) : null;
|
|
859
856
|
}
|
|
860
|
-
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: n({ fraction: s, currentTime:
|
|
857
|
+
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: n({ fraction: s, currentTime: i.currentTime, duration: o }, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: `${Math.round(s * 100)}%` });
|
|
861
858
|
}
|
|
862
859
|
Or.displayName = "Ginger.Current.Progress";
|
|
863
860
|
function $r({
|
|
864
861
|
className: e,
|
|
865
862
|
style: r,
|
|
866
863
|
height: t = 4,
|
|
867
|
-
showBuffered:
|
|
864
|
+
showBuffered: a = !1,
|
|
868
865
|
unstyled: n = !1
|
|
869
866
|
}) {
|
|
870
|
-
const
|
|
867
|
+
const i = P(), o = `${Math.round(cr(i) * 100)}%`, s = `${Math.round(Math.min(1, Math.max(0, i.bufferedFraction)) * 100)}%`;
|
|
871
868
|
return /* @__PURE__ */ w(
|
|
872
869
|
"div",
|
|
873
870
|
{
|
|
@@ -884,7 +881,7 @@ function $r({
|
|
|
884
881
|
},
|
|
885
882
|
"aria-hidden": !0,
|
|
886
883
|
children: [
|
|
887
|
-
|
|
884
|
+
a ? /* @__PURE__ */ c(
|
|
888
885
|
"div",
|
|
889
886
|
{
|
|
890
887
|
"data-ginger-component": "TimeRail",
|
|
@@ -915,14 +912,14 @@ function $r({
|
|
|
915
912
|
);
|
|
916
913
|
}
|
|
917
914
|
$r.displayName = "Ginger.Current.TimeRail";
|
|
918
|
-
function Hr({ className: e, style: r, height: t = 4, unstyled:
|
|
919
|
-
const n = P(),
|
|
915
|
+
function Hr({ className: e, style: r, height: t = 4, unstyled: a = !1 }) {
|
|
916
|
+
const n = P(), i = `${Math.round(Math.min(1, Math.max(0, n.bufferedFraction)) * 100)}%`;
|
|
920
917
|
return /* @__PURE__ */ c(
|
|
921
918
|
"div",
|
|
922
919
|
{
|
|
923
920
|
"data-ginger-component": "BufferRail",
|
|
924
921
|
className: e,
|
|
925
|
-
style:
|
|
922
|
+
style: a ? { ...r } : {
|
|
926
923
|
width: "100%",
|
|
927
924
|
height: t,
|
|
928
925
|
background: "var(--ginger-muted-color, #e5e7eb)",
|
|
@@ -936,9 +933,9 @@ function Hr({ className: e, style: r, height: t = 4, unstyled: i = !1 }) {
|
|
|
936
933
|
{
|
|
937
934
|
"data-ginger-component": "BufferRail",
|
|
938
935
|
style: {
|
|
939
|
-
width:
|
|
940
|
-
height:
|
|
941
|
-
background:
|
|
936
|
+
width: i,
|
|
937
|
+
height: a ? void 0 : "100%",
|
|
938
|
+
background: a ? void 0 : "var(--ginger-buffer-color, rgba(107, 114, 128, 0.35))"
|
|
942
939
|
}
|
|
943
940
|
}
|
|
944
941
|
)
|
|
@@ -946,32 +943,32 @@ function Hr({ className: e, style: r, height: t = 4, unstyled: i = !1 }) {
|
|
|
946
943
|
);
|
|
947
944
|
}
|
|
948
945
|
Hr.displayName = "Ginger.Current.BufferRail";
|
|
949
|
-
function Yr({ className: e, style: r, fallback: t, empty:
|
|
950
|
-
const
|
|
951
|
-
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: n(o,
|
|
946
|
+
function Yr({ className: e, style: r, fallback: t, empty: a, children: n }) {
|
|
947
|
+
const i = P(), o = sr(i);
|
|
948
|
+
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: n(o, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: o });
|
|
952
949
|
}
|
|
953
950
|
Yr.displayName = "Ginger.Current.PlaybackState";
|
|
954
951
|
function Qr({
|
|
955
952
|
className: e,
|
|
956
953
|
style: r,
|
|
957
954
|
fallback: t,
|
|
958
|
-
empty:
|
|
955
|
+
empty: a,
|
|
959
956
|
live: n = "polite",
|
|
960
|
-
children:
|
|
957
|
+
children: i
|
|
961
958
|
}) {
|
|
962
959
|
const o = P(), s = o.errorMessage ?? "";
|
|
963
960
|
if (!s) {
|
|
964
|
-
const l =
|
|
961
|
+
const l = a ?? t ?? null;
|
|
965
962
|
return l ? /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, children: l }) : null;
|
|
966
963
|
}
|
|
967
|
-
return
|
|
964
|
+
return i ? /* @__PURE__ */ c(
|
|
968
965
|
"span",
|
|
969
966
|
{
|
|
970
967
|
"data-ginger-component": "ErrorMessage",
|
|
971
968
|
className: e,
|
|
972
969
|
style: r,
|
|
973
970
|
"aria-live": n,
|
|
974
|
-
children:
|
|
971
|
+
children: i(s, o)
|
|
975
972
|
}
|
|
976
973
|
) : /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, "aria-live": n, children: s });
|
|
977
974
|
}
|
|
@@ -987,22 +984,22 @@ function jr({
|
|
|
987
984
|
children: e,
|
|
988
985
|
unstyled: r = !1,
|
|
989
986
|
rowStyle: t,
|
|
990
|
-
renderTrack:
|
|
987
|
+
renderTrack: a,
|
|
991
988
|
playOnSelect: n = !0,
|
|
992
|
-
style:
|
|
989
|
+
style: i,
|
|
993
990
|
...o
|
|
994
991
|
}) {
|
|
995
|
-
const { tracks: s, currentIndex: l, playTrackAt: d, selectTrackAt: m } = D(), y = r ? { ...
|
|
992
|
+
const { tracks: s, currentIndex: l, playTrackAt: d, selectTrackAt: m } = D(), y = r ? { ...i } : {
|
|
996
993
|
listStyle: "none",
|
|
997
994
|
margin: 0,
|
|
998
995
|
padding: 0,
|
|
999
996
|
fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
|
|
1000
997
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
1001
998
|
color: "var(--ginger-primary-color, #111827)",
|
|
1002
|
-
...
|
|
999
|
+
...i
|
|
1003
1000
|
};
|
|
1004
1001
|
return e !== void 0 ? /* @__PURE__ */ c(Oe.Provider, { value: { playOnSelect: n }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: y, ...o, children: e }) }) : /* @__PURE__ */ c(Oe.Provider, { value: { playOnSelect: n }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: y, ...o, children: s.map((g, h) => {
|
|
1005
|
-
const
|
|
1002
|
+
const k = h === l;
|
|
1006
1003
|
return /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
|
|
1007
1004
|
"button",
|
|
1008
1005
|
{
|
|
@@ -1014,14 +1011,14 @@ function jr({
|
|
|
1014
1011
|
width: r ? void 0 : "100%",
|
|
1015
1012
|
textAlign: r ? void 0 : "left",
|
|
1016
1013
|
border: r ? void 0 : "none",
|
|
1017
|
-
background: r ? void 0 :
|
|
1014
|
+
background: r ? void 0 : k ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
|
|
1018
1015
|
color: r ? void 0 : "inherit",
|
|
1019
1016
|
font: r ? void 0 : "inherit",
|
|
1020
1017
|
cursor: r ? void 0 : "pointer",
|
|
1021
1018
|
padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
|
|
1022
1019
|
...t
|
|
1023
1020
|
},
|
|
1024
|
-
children:
|
|
1021
|
+
children: a ? a(g, h, k) : /* @__PURE__ */ w("span", { children: [
|
|
1025
1022
|
g.title,
|
|
1026
1023
|
g.artist ? ` — ${g.artist}` : ""
|
|
1027
1024
|
] })
|
|
@@ -1034,17 +1031,17 @@ function zr({
|
|
|
1034
1031
|
index: e,
|
|
1035
1032
|
unstyled: r = !1,
|
|
1036
1033
|
className: t,
|
|
1037
|
-
style:
|
|
1034
|
+
style: a,
|
|
1038
1035
|
children: n,
|
|
1039
|
-
liProps:
|
|
1036
|
+
liProps: i,
|
|
1040
1037
|
onClick: o,
|
|
1041
1038
|
...s
|
|
1042
1039
|
}) {
|
|
1043
|
-
const { playOnSelect: l } = On(), { tracks: d, currentIndex: m, playTrackAt: y, selectTrackAt:
|
|
1040
|
+
const { playOnSelect: l } = On(), { tracks: d, currentIndex: m, playTrackAt: y, selectTrackAt: b } = D(), g = e === m, h = d[e], k = h != null ? /* @__PURE__ */ w("span", { "data-ginger-component": "PlaylistTrack", children: [
|
|
1044
1041
|
h.title,
|
|
1045
1042
|
h.artist ? ` — ${h.artist}` : ""
|
|
1046
1043
|
] }) : null;
|
|
1047
|
-
return /* @__PURE__ */ c("li", { ...
|
|
1044
|
+
return /* @__PURE__ */ c("li", { ...i, "data-ginger-component": "PlaylistTrack", children: /* @__PURE__ */ c(
|
|
1048
1045
|
"button",
|
|
1049
1046
|
{
|
|
1050
1047
|
type: "button",
|
|
@@ -1061,13 +1058,13 @@ function zr({
|
|
|
1061
1058
|
font: r ? void 0 : "inherit",
|
|
1062
1059
|
cursor: r ? void 0 : "pointer",
|
|
1063
1060
|
padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
|
|
1064
|
-
...
|
|
1061
|
+
...a
|
|
1065
1062
|
},
|
|
1066
1063
|
...s,
|
|
1067
1064
|
onClick: (f) => {
|
|
1068
|
-
o == null || o(f), !f.defaultPrevented && (l ? y(e) :
|
|
1065
|
+
o == null || o(f), !f.defaultPrevented && (l ? y(e) : b(e));
|
|
1069
1066
|
},
|
|
1070
|
-
children: n ??
|
|
1067
|
+
children: n ?? k
|
|
1071
1068
|
}
|
|
1072
1069
|
) });
|
|
1073
1070
|
}
|
|
@@ -1097,14 +1094,14 @@ function Wr({
|
|
|
1097
1094
|
className: e,
|
|
1098
1095
|
style: r,
|
|
1099
1096
|
fallback: t,
|
|
1100
|
-
empty:
|
|
1097
|
+
empty: a,
|
|
1101
1098
|
unstyled: n = !1,
|
|
1102
|
-
imgStyle:
|
|
1099
|
+
imgStyle: i
|
|
1103
1100
|
}) {
|
|
1104
1101
|
var d, m;
|
|
1105
1102
|
const o = P(), s = (d = o.playlistMeta) == null ? void 0 : d.artworkUrl;
|
|
1106
1103
|
if (!s) {
|
|
1107
|
-
const y =
|
|
1104
|
+
const y = a ?? t ?? null;
|
|
1108
1105
|
return y ? /* @__PURE__ */ c("span", { "data-ginger-component": "Artwork", className: e, style: r, children: y }) : null;
|
|
1109
1106
|
}
|
|
1110
1107
|
const l = ((m = o.playlistMeta) == null ? void 0 : m.title) ?? "Playlist artwork";
|
|
@@ -1130,7 +1127,7 @@ function Wr({
|
|
|
1130
1127
|
width: n ? void 0 : "100%",
|
|
1131
1128
|
height: n ? void 0 : "100%",
|
|
1132
1129
|
objectFit: n ? void 0 : "cover",
|
|
1133
|
-
...
|
|
1130
|
+
...i
|
|
1134
1131
|
}
|
|
1135
1132
|
}
|
|
1136
1133
|
)
|
|
@@ -1158,15 +1155,15 @@ const Y = {
|
|
|
1158
1155
|
};
|
|
1159
1156
|
function Xr(e) {
|
|
1160
1157
|
const r = [...e.tracks];
|
|
1161
|
-
let t = H(e.currentIndex ?? 0, r.length),
|
|
1162
|
-
return e.isShuffled && r.length > 1 && (
|
|
1158
|
+
let t = H(e.currentIndex ?? 0, r.length), a = null, n = r;
|
|
1159
|
+
return e.isShuffled && r.length > 1 && (a = [...r], n = ur(r, t), t = 0), {
|
|
1163
1160
|
tracks: n,
|
|
1164
1161
|
currentIndex: t,
|
|
1165
1162
|
playbackMode: e.playbackMode ?? "playlist",
|
|
1166
1163
|
isPaused: e.isPaused ?? !0,
|
|
1167
1164
|
isShuffled: !!(e.isShuffled && n.length > 1),
|
|
1168
1165
|
repeatMode: e.repeatMode ?? "off",
|
|
1169
|
-
originalTracks:
|
|
1166
|
+
originalTracks: a,
|
|
1170
1167
|
playlistMeta: e.playlistMeta ?? null,
|
|
1171
1168
|
...zn,
|
|
1172
1169
|
volume: _e(e.volume ?? 1),
|
|
@@ -1179,9 +1176,9 @@ function Wn(e, r) {
|
|
|
1179
1176
|
case "INIT": {
|
|
1180
1177
|
const {
|
|
1181
1178
|
tracks: t,
|
|
1182
|
-
currentIndex:
|
|
1179
|
+
currentIndex: a,
|
|
1183
1180
|
playlistMeta: n,
|
|
1184
|
-
isPaused:
|
|
1181
|
+
isPaused: i,
|
|
1185
1182
|
isShuffled: o,
|
|
1186
1183
|
repeatMode: s,
|
|
1187
1184
|
playbackMode: l,
|
|
@@ -1191,9 +1188,9 @@ function Wn(e, r) {
|
|
|
1191
1188
|
} = r.payload;
|
|
1192
1189
|
return Xr({
|
|
1193
1190
|
tracks: t,
|
|
1194
|
-
currentIndex:
|
|
1191
|
+
currentIndex: a,
|
|
1195
1192
|
playlistMeta: n ?? null,
|
|
1196
|
-
isPaused:
|
|
1193
|
+
isPaused: i ?? !0,
|
|
1197
1194
|
isShuffled: o ?? !1,
|
|
1198
1195
|
repeatMode: s ?? "off",
|
|
1199
1196
|
playbackMode: l ?? "playlist",
|
|
@@ -1203,23 +1200,23 @@ function Wn(e, r) {
|
|
|
1203
1200
|
});
|
|
1204
1201
|
}
|
|
1205
1202
|
case "SET_QUEUE": {
|
|
1206
|
-
const { tracks: t, currentIndex:
|
|
1203
|
+
const { tracks: t, currentIndex: a } = r.payload, n = [...t], i = H(a ?? e.currentIndex, n.length);
|
|
1207
1204
|
return {
|
|
1208
1205
|
...e,
|
|
1209
1206
|
tracks: n,
|
|
1210
|
-
currentIndex:
|
|
1207
|
+
currentIndex: i,
|
|
1211
1208
|
isShuffled: !1,
|
|
1212
1209
|
originalTracks: null,
|
|
1213
1210
|
...Y
|
|
1214
1211
|
};
|
|
1215
1212
|
}
|
|
1216
1213
|
case "INSERT_TRACK": {
|
|
1217
|
-
const t = r.payload.index ?? e.tracks.length,
|
|
1214
|
+
const t = r.payload.index ?? e.tracks.length, a = rr(e.tracks, r.payload.track, t);
|
|
1218
1215
|
if (r.payload.autoPlay) {
|
|
1219
|
-
const o = H(t,
|
|
1216
|
+
const o = H(t, a.length);
|
|
1220
1217
|
return {
|
|
1221
1218
|
...e,
|
|
1222
|
-
tracks:
|
|
1219
|
+
tracks: a,
|
|
1223
1220
|
currentIndex: o,
|
|
1224
1221
|
isShuffled: !1,
|
|
1225
1222
|
originalTracks: null,
|
|
@@ -1227,52 +1224,52 @@ function Wn(e, r) {
|
|
|
1227
1224
|
...Y
|
|
1228
1225
|
};
|
|
1229
1226
|
}
|
|
1230
|
-
const n = t <= e.currentIndex ? e.currentIndex + 1 : e.currentIndex,
|
|
1227
|
+
const n = t <= e.currentIndex ? e.currentIndex + 1 : e.currentIndex, i = e.isShuffled && e.originalTracks ? rr(e.originalTracks, r.payload.track, e.originalTracks.length) : e.originalTracks;
|
|
1231
1228
|
return {
|
|
1232
1229
|
...e,
|
|
1233
|
-
tracks:
|
|
1234
|
-
originalTracks:
|
|
1235
|
-
currentIndex: H(n,
|
|
1230
|
+
tracks: a,
|
|
1231
|
+
originalTracks: i,
|
|
1232
|
+
currentIndex: H(n, a.length)
|
|
1236
1233
|
};
|
|
1237
1234
|
}
|
|
1238
1235
|
case "REMOVE_TRACK": {
|
|
1239
|
-
const t = r.payload.index,
|
|
1236
|
+
const t = r.payload.index, a = er(e.tracks, t), n = t < e.currentIndex ? e.currentIndex - 1 : t === e.currentIndex ? Math.min(e.currentIndex, Math.max(0, a.length - 1)) : e.currentIndex, i = e.isShuffled && e.originalTracks ? (() => {
|
|
1240
1237
|
const s = e.tracks[t], l = Ue(e.originalTracks, s);
|
|
1241
1238
|
return er(e.originalTracks, l);
|
|
1242
|
-
})() : e.originalTracks, o = e.isShuffled &&
|
|
1239
|
+
})() : e.originalTracks, o = e.isShuffled && a.length > 1;
|
|
1243
1240
|
return {
|
|
1244
1241
|
...e,
|
|
1245
|
-
tracks:
|
|
1242
|
+
tracks: a,
|
|
1246
1243
|
isShuffled: o,
|
|
1247
|
-
originalTracks: o ?
|
|
1248
|
-
currentIndex: H(n,
|
|
1244
|
+
originalTracks: o ? i : null,
|
|
1245
|
+
currentIndex: H(n, a.length),
|
|
1249
1246
|
...t === e.currentIndex ? Y : {}
|
|
1250
1247
|
};
|
|
1251
1248
|
}
|
|
1252
1249
|
case "MOVE_TRACK": {
|
|
1253
|
-
const { fromIndex: t, toIndex:
|
|
1254
|
-
let
|
|
1255
|
-
return e.currentIndex === t ?
|
|
1250
|
+
const { fromIndex: t, toIndex: a } = r.payload, n = bn(e.tracks, t, a);
|
|
1251
|
+
let i = e.currentIndex;
|
|
1252
|
+
return e.currentIndex === t ? i = a : t < e.currentIndex && a >= e.currentIndex ? i -= 1 : t > e.currentIndex && a <= e.currentIndex && (i += 1), {
|
|
1256
1253
|
...e,
|
|
1257
1254
|
tracks: n,
|
|
1258
1255
|
isShuffled: !1,
|
|
1259
1256
|
originalTracks: null,
|
|
1260
|
-
currentIndex: H(
|
|
1257
|
+
currentIndex: H(i, n.length)
|
|
1261
1258
|
};
|
|
1262
1259
|
}
|
|
1263
1260
|
case "ADD_NEXT": {
|
|
1264
|
-
const t = Ze(e.tracks, e.currentIndex, r.payload.track),
|
|
1265
|
-
const n = e.tracks[e.currentIndex],
|
|
1266
|
-
return Ze(e.originalTracks,
|
|
1261
|
+
const t = Ze(e.tracks, e.currentIndex, r.payload.track), a = e.isShuffled && e.originalTracks ? (() => {
|
|
1262
|
+
const n = e.tracks[e.currentIndex], i = Ue(e.originalTracks, n);
|
|
1263
|
+
return Ze(e.originalTracks, i, r.payload.track);
|
|
1267
1264
|
})() : e.originalTracks;
|
|
1268
1265
|
return {
|
|
1269
1266
|
...e,
|
|
1270
1267
|
tracks: t,
|
|
1271
|
-
originalTracks:
|
|
1268
|
+
originalTracks: a
|
|
1272
1269
|
};
|
|
1273
1270
|
}
|
|
1274
1271
|
case "SET_INDEX": {
|
|
1275
|
-
const t = H(r.payload.index, e.tracks.length),
|
|
1272
|
+
const t = H(r.payload.index, e.tracks.length), a = r.payload.autoPlay, n = a === !0 ? !1 : a === !1 ? !0 : e.isPaused;
|
|
1276
1273
|
return {
|
|
1277
1274
|
...e,
|
|
1278
1275
|
currentIndex: t,
|
|
@@ -1293,16 +1290,16 @@ function Wn(e, r) {
|
|
|
1293
1290
|
case "TOGGLE_SHUFFLE": {
|
|
1294
1291
|
if (e.tracks.length <= 1) return { ...e, isShuffled: !1, originalTracks: null };
|
|
1295
1292
|
if (!e.isShuffled) {
|
|
1296
|
-
const
|
|
1293
|
+
const i = [...e.tracks], o = ur(i, e.currentIndex);
|
|
1297
1294
|
return {
|
|
1298
1295
|
...e,
|
|
1299
1296
|
isShuffled: !0,
|
|
1300
|
-
originalTracks:
|
|
1297
|
+
originalTracks: i,
|
|
1301
1298
|
tracks: o,
|
|
1302
1299
|
currentIndex: 0
|
|
1303
1300
|
};
|
|
1304
1301
|
}
|
|
1305
|
-
const t = e.originalTracks ? [...e.originalTracks] : [...e.tracks],
|
|
1302
|
+
const t = e.originalTracks ? [...e.originalTracks] : [...e.tracks], a = e.tracks[e.currentIndex], n = Ue(t, a);
|
|
1306
1303
|
return {
|
|
1307
1304
|
...e,
|
|
1308
1305
|
isShuffled: !1,
|
|
@@ -1312,21 +1309,21 @@ function Wn(e, r) {
|
|
|
1312
1309
|
};
|
|
1313
1310
|
}
|
|
1314
1311
|
case "NEXT": {
|
|
1315
|
-
const t = hn(e),
|
|
1312
|
+
const t = hn(e), a = t === e.currentIndex;
|
|
1316
1313
|
return {
|
|
1317
1314
|
...e,
|
|
1318
1315
|
currentIndex: t,
|
|
1319
|
-
...
|
|
1320
|
-
isPaused:
|
|
1316
|
+
...a ? {} : Y,
|
|
1317
|
+
isPaused: a ? e.isPaused : !1
|
|
1321
1318
|
};
|
|
1322
1319
|
}
|
|
1323
1320
|
case "PREV": {
|
|
1324
|
-
const t = yn(e),
|
|
1321
|
+
const t = yn(e), a = t === e.currentIndex;
|
|
1325
1322
|
return {
|
|
1326
1323
|
...e,
|
|
1327
1324
|
currentIndex: t,
|
|
1328
|
-
...
|
|
1329
|
-
isPaused:
|
|
1325
|
+
...a ? {} : Y,
|
|
1326
|
+
isPaused: a ? e.isPaused : !1
|
|
1330
1327
|
};
|
|
1331
1328
|
}
|
|
1332
1329
|
case "MEDIA_TIME_UPDATE":
|
|
@@ -1376,8 +1373,8 @@ function Wn(e, r) {
|
|
|
1376
1373
|
case "SET_PLAYBACK_RATE":
|
|
1377
1374
|
return { ...e, playbackRate: je(r.payload) };
|
|
1378
1375
|
case "MEDIA_VOLUME_SYNC": {
|
|
1379
|
-
const { volume: t, muted:
|
|
1380
|
-
return n === e.volume &&
|
|
1376
|
+
const { volume: t, muted: a } = r.payload, n = _e(t);
|
|
1377
|
+
return n === e.volume && a === e.muted ? e : { ...e, volume: n, muted: a };
|
|
1381
1378
|
}
|
|
1382
1379
|
default:
|
|
1383
1380
|
return e;
|
|
@@ -1386,11 +1383,11 @@ function Wn(e, r) {
|
|
|
1386
1383
|
function Ge() {
|
|
1387
1384
|
return typeof navigator > "u" || !("mediaSession" in navigator) ? null : navigator.mediaSession;
|
|
1388
1385
|
}
|
|
1389
|
-
function Xn(e, r, t,
|
|
1390
|
-
var
|
|
1386
|
+
function Xn(e, r, t, a = {}) {
|
|
1387
|
+
var b;
|
|
1391
1388
|
const n = L(r);
|
|
1392
1389
|
n.current = r;
|
|
1393
|
-
const
|
|
1390
|
+
const i = r.tracks[r.currentIndex], o = i == null ? void 0 : i.title, s = i == null ? void 0 : i.artist, l = i == null ? void 0 : i.album, d = kn(i, (b = r.playlistMeta) == null ? void 0 : b.artworkUrl);
|
|
1394
1391
|
I(() => {
|
|
1395
1392
|
const g = Ge();
|
|
1396
1393
|
!e || !g || (g.metadata = new MediaMetadata({
|
|
@@ -1403,7 +1400,7 @@ function Xn(e, r, t, i = {}) {
|
|
|
1403
1400
|
const g = Ge();
|
|
1404
1401
|
!e || !g || (g.playbackState = r.isPaused ? "paused" : "playing");
|
|
1405
1402
|
}, [e, r.isPaused]);
|
|
1406
|
-
const m =
|
|
1403
|
+
const m = a.seekForwardSeconds, y = a.seekBackwardSeconds;
|
|
1407
1404
|
I(() => {
|
|
1408
1405
|
const g = Ge();
|
|
1409
1406
|
if (!(!e || !g)) {
|
|
@@ -1411,8 +1408,8 @@ function Xn(e, r, t, i = {}) {
|
|
|
1411
1408
|
g.setActionHandler("play", t.play), g.setActionHandler("pause", t.pause), g.setActionHandler("nexttrack", t.next), g.setActionHandler("previoustrack", t.prev), g.setActionHandler("seekto", (h) => {
|
|
1412
1409
|
typeof h.seekTime == "number" && Number.isFinite(h.seekTime) && t.seek(h.seekTime);
|
|
1413
1410
|
}), typeof m == "number" && m > 0 ? g.setActionHandler("seekforward", () => {
|
|
1414
|
-
const h = n.current,
|
|
1415
|
-
t.seek(Math.min(
|
|
1411
|
+
const h = n.current, k = h.currentTime + m, f = h.duration, M = Number.isFinite(f) && f > 0 ? f : k;
|
|
1412
|
+
t.seek(Math.min(k, M));
|
|
1416
1413
|
}) : g.setActionHandler("seekforward", null), typeof y == "number" && y > 0 ? g.setActionHandler("seekbackward", () => {
|
|
1417
1414
|
const h = n.current;
|
|
1418
1415
|
t.seek(Math.max(0, h.currentTime - y));
|
|
@@ -1429,8 +1426,8 @@ function Xn(e, r, t, i = {}) {
|
|
|
1429
1426
|
}, [e, t, m, y]), I(() => {
|
|
1430
1427
|
var M, S;
|
|
1431
1428
|
const g = Ge();
|
|
1432
|
-
if (!e || !g || !
|
|
1433
|
-
const h = r.duration,
|
|
1429
|
+
if (!e || !g || !a.positionState) return;
|
|
1430
|
+
const h = r.duration, k = r.currentTime, f = r.playbackRate;
|
|
1434
1431
|
try {
|
|
1435
1432
|
if (!Number.isFinite(h) || h <= 0) {
|
|
1436
1433
|
(M = g.setPositionState) == null || M.call(g);
|
|
@@ -1439,7 +1436,7 @@ function Xn(e, r, t, i = {}) {
|
|
|
1439
1436
|
(S = g.setPositionState) == null || S.call(g, {
|
|
1440
1437
|
duration: h,
|
|
1441
1438
|
playbackRate: Number.isFinite(f) && f > 0 ? f : 1,
|
|
1442
|
-
position: Math.min(Math.max(0,
|
|
1439
|
+
position: Math.min(Math.max(0, k), h)
|
|
1443
1440
|
});
|
|
1444
1441
|
} catch {
|
|
1445
1442
|
}
|
|
@@ -1450,7 +1447,7 @@ function Xn(e, r, t, i = {}) {
|
|
|
1450
1447
|
} catch {
|
|
1451
1448
|
}
|
|
1452
1449
|
};
|
|
1453
|
-
}, [e,
|
|
1450
|
+
}, [e, a.positionState, r.currentTime, r.duration, r.playbackRate]);
|
|
1454
1451
|
}
|
|
1455
1452
|
const Kn = {
|
|
1456
1453
|
"--ginger-primary-color": "#111827",
|
|
@@ -1468,19 +1465,19 @@ function qn({
|
|
|
1468
1465
|
children: e,
|
|
1469
1466
|
initialTracks: r = [],
|
|
1470
1467
|
initialIndex: t = 0,
|
|
1471
|
-
initialPlaylistMeta:
|
|
1468
|
+
initialPlaylistMeta: a = null,
|
|
1472
1469
|
initialShuffle: n = !1,
|
|
1473
|
-
initialRepeatMode:
|
|
1470
|
+
initialRepeatMode: i = "off",
|
|
1474
1471
|
initialPlaybackMode: o = "playlist",
|
|
1475
1472
|
initialPaused: s = !0,
|
|
1476
1473
|
initialVolume: l = 1,
|
|
1477
1474
|
initialMuted: d = !1,
|
|
1478
1475
|
initialPlaybackRate: m = 1,
|
|
1479
1476
|
initialStateKey: y,
|
|
1480
|
-
locale:
|
|
1477
|
+
locale: b,
|
|
1481
1478
|
mediaSession: g = !1,
|
|
1482
1479
|
beforePlay: h,
|
|
1483
|
-
onPlayBlocked:
|
|
1480
|
+
onPlayBlocked: k,
|
|
1484
1481
|
persistence: f,
|
|
1485
1482
|
hydrateOnMount: M = !1,
|
|
1486
1483
|
resumeOnTrackChange: S = !1,
|
|
@@ -1497,19 +1494,19 @@ function qn({
|
|
|
1497
1494
|
onError: ie,
|
|
1498
1495
|
onVolumeChange: oe,
|
|
1499
1496
|
onPlaybackRateChange: ce,
|
|
1500
|
-
onSeek:
|
|
1497
|
+
onSeek: U
|
|
1501
1498
|
}) {
|
|
1502
1499
|
var Je;
|
|
1503
|
-
const
|
|
1500
|
+
const V = L(null), [u, v] = cn(
|
|
1504
1501
|
Wn,
|
|
1505
1502
|
void 0,
|
|
1506
1503
|
() => Xr({
|
|
1507
1504
|
tracks: r,
|
|
1508
1505
|
currentIndex: t,
|
|
1509
|
-
playlistMeta:
|
|
1506
|
+
playlistMeta: a,
|
|
1510
1507
|
isPaused: s,
|
|
1511
1508
|
isShuffled: n,
|
|
1512
|
-
repeatMode:
|
|
1509
|
+
repeatMode: i,
|
|
1513
1510
|
playbackMode: o,
|
|
1514
1511
|
volume: l,
|
|
1515
1512
|
muted: d,
|
|
@@ -1518,10 +1515,10 @@ function qn({
|
|
|
1518
1515
|
), Ce = L(u), Fe = L({
|
|
1519
1516
|
tracks: r,
|
|
1520
1517
|
currentIndex: t,
|
|
1521
|
-
playlistMeta:
|
|
1518
|
+
playlistMeta: a,
|
|
1522
1519
|
isPaused: s,
|
|
1523
1520
|
isShuffled: n,
|
|
1524
|
-
repeatMode:
|
|
1521
|
+
repeatMode: i,
|
|
1525
1522
|
playbackMode: o,
|
|
1526
1523
|
volume: l,
|
|
1527
1524
|
muted: d,
|
|
@@ -1530,10 +1527,10 @@ function qn({
|
|
|
1530
1527
|
Fe.current = {
|
|
1531
1528
|
tracks: r,
|
|
1532
1529
|
currentIndex: t,
|
|
1533
|
-
playlistMeta:
|
|
1530
|
+
playlistMeta: a,
|
|
1534
1531
|
isPaused: s,
|
|
1535
1532
|
isShuffled: n,
|
|
1536
|
-
repeatMode:
|
|
1533
|
+
repeatMode: i,
|
|
1537
1534
|
playbackMode: o,
|
|
1538
1535
|
volume: l,
|
|
1539
1536
|
muted: d,
|
|
@@ -1567,7 +1564,7 @@ function qn({
|
|
|
1567
1564
|
playbackRate: p.playbackRate
|
|
1568
1565
|
}
|
|
1569
1566
|
});
|
|
1570
|
-
}, [y
|
|
1567
|
+
}, [y]), I(() => {
|
|
1571
1568
|
Ce.current = u;
|
|
1572
1569
|
}, [u]);
|
|
1573
1570
|
const We = u.tracks[u.currentIndex] ?? null;
|
|
@@ -1604,15 +1601,15 @@ function qn({
|
|
|
1604
1601
|
v({ type: "PLAY" });
|
|
1605
1602
|
}, []), O = E(() => {
|
|
1606
1603
|
var p;
|
|
1607
|
-
v({ type: "PAUSE" }), (p =
|
|
1604
|
+
v({ type: "PAUSE" }), (p = V.current) == null || p.pause();
|
|
1608
1605
|
}, []), pe = E(() => {
|
|
1609
1606
|
u.isPaused ? B() : O();
|
|
1610
1607
|
}, [O, B, u.isPaused]), $ = E(
|
|
1611
1608
|
(p) => {
|
|
1612
|
-
const T =
|
|
1613
|
-
T && Number.isFinite(p) && (T.currentTime = Math.max(0, p),
|
|
1609
|
+
const T = V.current;
|
|
1610
|
+
T && Number.isFinite(p) && (T.currentTime = Math.max(0, p), U == null || U(Math.max(0, p)));
|
|
1614
1611
|
},
|
|
1615
|
-
[
|
|
1612
|
+
[U]
|
|
1616
1613
|
), ge = E((p) => {
|
|
1617
1614
|
v({ type: "SET_VOLUME", payload: _e(p) });
|
|
1618
1615
|
}, []), fe = E((p) => {
|
|
@@ -1624,15 +1621,15 @@ function qn({
|
|
|
1624
1621
|
}, []), z = E(() => {
|
|
1625
1622
|
v({ type: "NEXT" });
|
|
1626
1623
|
}, []), W = E(() => {
|
|
1627
|
-
const p =
|
|
1628
|
-
p && T > 0 && p.currentTime > T ? (p.currentTime = 0,
|
|
1629
|
-
}, [ze,
|
|
1624
|
+
const p = V.current, T = ze ?? 3;
|
|
1625
|
+
p && T > 0 && p.currentTime > T ? (p.currentTime = 0, U == null || U(0)) : v({ type: "PREV" });
|
|
1626
|
+
}, [ze, U]), he = E((p) => {
|
|
1630
1627
|
v({ type: "SET_REPEAT", payload: p });
|
|
1631
1628
|
}, []), ve = E(() => {
|
|
1632
1629
|
v({ type: "CYCLE_REPEAT" });
|
|
1633
|
-
}, []),
|
|
1630
|
+
}, []), be = E(() => {
|
|
1634
1631
|
v({ type: "TOGGLE_SHUFFLE" });
|
|
1635
|
-
}, []),
|
|
1632
|
+
}, []), ke = E((p, T) => {
|
|
1636
1633
|
v({ type: "SET_QUEUE", payload: { tracks: p, currentIndex: T } });
|
|
1637
1634
|
}, []), Te = E((p, T, x) => {
|
|
1638
1635
|
v({ type: "INSERT_TRACK", payload: { track: p, index: T, autoPlay: x } });
|
|
@@ -1715,7 +1712,7 @@ function qn({
|
|
|
1715
1712
|
}, [f, S, u.currentIndex, u.tracks, u.currentTime]);
|
|
1716
1713
|
const qr = (Je = u.tracks[u.currentIndex]) == null ? void 0 : Je.fileUrl;
|
|
1717
1714
|
I(() => {
|
|
1718
|
-
const p =
|
|
1715
|
+
const p = V.current;
|
|
1719
1716
|
if (!p) return;
|
|
1720
1717
|
if (u.isPaused) {
|
|
1721
1718
|
p.pause();
|
|
@@ -1737,7 +1734,7 @@ function qn({
|
|
|
1737
1734
|
return;
|
|
1738
1735
|
}
|
|
1739
1736
|
if (!x) {
|
|
1740
|
-
T || (v({ type: "PAUSE" }),
|
|
1737
|
+
T || (v({ type: "PAUSE" }), k == null || k());
|
|
1741
1738
|
return;
|
|
1742
1739
|
}
|
|
1743
1740
|
}
|
|
@@ -1748,17 +1745,17 @@ function qn({
|
|
|
1748
1745
|
})(), () => {
|
|
1749
1746
|
T = !0;
|
|
1750
1747
|
};
|
|
1751
|
-
}, [h, qr,
|
|
1748
|
+
}, [h, qr, k, u.isPaused]);
|
|
1752
1749
|
const we = E(() => {
|
|
1753
1750
|
var x;
|
|
1754
1751
|
const p = nr(Ce.current);
|
|
1755
1752
|
if (p.kind === "replay_same") {
|
|
1756
|
-
const R =
|
|
1753
|
+
const R = V.current;
|
|
1757
1754
|
R && (R.currentTime = 0), v({ type: "PLAY" });
|
|
1758
1755
|
return;
|
|
1759
1756
|
}
|
|
1760
1757
|
if (p.kind === "stop") {
|
|
1761
|
-
(x =
|
|
1758
|
+
(x = V.current) == null || x.pause(), v({ type: "PAUSE" }), ae == null || ae();
|
|
1762
1759
|
return;
|
|
1763
1760
|
}
|
|
1764
1761
|
const T = p.nextIndex;
|
|
@@ -1771,11 +1768,11 @@ function qn({
|
|
|
1771
1768
|
[g]
|
|
1772
1769
|
);
|
|
1773
1770
|
Xn(Zr, u, Jr, en);
|
|
1774
|
-
const Xe = Kr ?? (
|
|
1771
|
+
const Xe = Kr ?? (b != null && b.seek && /[\u0590-\u08FF]/.test(b.seek) ? "rtl" : "ltr"), rn = A(
|
|
1775
1772
|
() => ({
|
|
1776
1773
|
state: u,
|
|
1777
1774
|
dispatch: v,
|
|
1778
|
-
audioRef:
|
|
1775
|
+
audioRef: V,
|
|
1779
1776
|
notifyEnded: we,
|
|
1780
1777
|
init: Re,
|
|
1781
1778
|
play: B,
|
|
@@ -1790,8 +1787,8 @@ function qn({
|
|
|
1790
1787
|
prev: W,
|
|
1791
1788
|
setRepeatMode: he,
|
|
1792
1789
|
cycleRepeat: ve,
|
|
1793
|
-
toggleShuffle:
|
|
1794
|
-
setQueue:
|
|
1790
|
+
toggleShuffle: be,
|
|
1791
|
+
setQueue: ke,
|
|
1795
1792
|
insertTrackAt: Te,
|
|
1796
1793
|
removeTrackAt: xe,
|
|
1797
1794
|
moveTrack: Me,
|
|
@@ -1803,7 +1800,6 @@ function qn({
|
|
|
1803
1800
|
}),
|
|
1804
1801
|
[
|
|
1805
1802
|
ve,
|
|
1806
|
-
v,
|
|
1807
1803
|
Re,
|
|
1808
1804
|
z,
|
|
1809
1805
|
we,
|
|
@@ -1819,7 +1815,7 @@ function qn({
|
|
|
1819
1815
|
$,
|
|
1820
1816
|
fe,
|
|
1821
1817
|
ye,
|
|
1822
|
-
|
|
1818
|
+
ke,
|
|
1823
1819
|
he,
|
|
1824
1820
|
Ae,
|
|
1825
1821
|
Se,
|
|
@@ -1827,7 +1823,7 @@ function qn({
|
|
|
1827
1823
|
u,
|
|
1828
1824
|
me,
|
|
1829
1825
|
pe,
|
|
1830
|
-
|
|
1826
|
+
be
|
|
1831
1827
|
]
|
|
1832
1828
|
), nn = A(
|
|
1833
1829
|
() => ({
|
|
@@ -1846,9 +1842,9 @@ function qn({
|
|
|
1846
1842
|
prev: W,
|
|
1847
1843
|
setRepeatMode: he,
|
|
1848
1844
|
cycleRepeat: ve,
|
|
1849
|
-
toggleShuffle:
|
|
1845
|
+
toggleShuffle: be,
|
|
1850
1846
|
playbackMode: u.playbackMode,
|
|
1851
|
-
setQueue:
|
|
1847
|
+
setQueue: ke,
|
|
1852
1848
|
insertTrackAt: Te,
|
|
1853
1849
|
removeTrackAt: xe,
|
|
1854
1850
|
moveTrack: Me,
|
|
@@ -1876,8 +1872,8 @@ function qn({
|
|
|
1876
1872
|
W,
|
|
1877
1873
|
he,
|
|
1878
1874
|
ve,
|
|
1879
|
-
ke,
|
|
1880
1875
|
be,
|
|
1876
|
+
ke,
|
|
1881
1877
|
Te,
|
|
1882
1878
|
xe,
|
|
1883
1879
|
Me,
|
|
@@ -1885,8 +1881,7 @@ function qn({
|
|
|
1885
1881
|
Ie,
|
|
1886
1882
|
Pe,
|
|
1887
1883
|
Ae,
|
|
1888
|
-
Se
|
|
1889
|
-
v
|
|
1884
|
+
Se
|
|
1890
1885
|
]
|
|
1891
1886
|
), tn = A(
|
|
1892
1887
|
() => ({
|
|
@@ -1903,7 +1898,7 @@ function qn({
|
|
|
1903
1898
|
setMuted: fe,
|
|
1904
1899
|
toggleMute: me,
|
|
1905
1900
|
setPlaybackRate: ye,
|
|
1906
|
-
audioRef:
|
|
1901
|
+
audioRef: V,
|
|
1907
1902
|
notifyEnded: we,
|
|
1908
1903
|
dispatch: v
|
|
1909
1904
|
}),
|
|
@@ -1921,9 +1916,7 @@ function qn({
|
|
|
1921
1916
|
fe,
|
|
1922
1917
|
me,
|
|
1923
1918
|
ye,
|
|
1924
|
-
|
|
1925
|
-
we,
|
|
1926
|
-
v
|
|
1919
|
+
we
|
|
1927
1920
|
]
|
|
1928
1921
|
), Ke = sr(u), qe = A(
|
|
1929
1922
|
() => N ? De : { ...Kn, ...De },
|
|
@@ -1959,7 +1952,7 @@ function qn({
|
|
|
1959
1952
|
dir: C.dir
|
|
1960
1953
|
});
|
|
1961
1954
|
}, [Z, e, C]);
|
|
1962
|
-
return /* @__PURE__ */ c(En, { locale:
|
|
1955
|
+
return /* @__PURE__ */ c(En, { locale: b, children: /* @__PURE__ */ c(dn.Provider, { value: nn, children: /* @__PURE__ */ c(pn.Provider, { value: tn, children: /* @__PURE__ */ c(lr.Provider, { value: rn, children: an }) }) }) });
|
|
1963
1956
|
}
|
|
1964
1957
|
function Jn(e, r) {
|
|
1965
1958
|
const t = [e, r].filter(Boolean).join(" ");
|
|
@@ -2004,7 +1997,7 @@ const at = {
|
|
|
2004
1997
|
Artwork: Wr
|
|
2005
1998
|
},
|
|
2006
1999
|
Control: {
|
|
2007
|
-
PlayPause:
|
|
2000
|
+
PlayPause: kr,
|
|
2008
2001
|
Repeat: Tr,
|
|
2009
2002
|
Next: xr,
|
|
2010
2003
|
Previous: Mr,
|
|
@@ -2021,7 +2014,7 @@ const at = {
|
|
|
2021
2014
|
SkipBack: yr,
|
|
2022
2015
|
Shuffle: mr,
|
|
2023
2016
|
Volume2: vr,
|
|
2024
|
-
VolumeX:
|
|
2017
|
+
VolumeX: br,
|
|
2025
2018
|
RepeatGlyph: fr,
|
|
2026
2019
|
Wrapper: _
|
|
2027
2020
|
},
|
|
@@ -2039,7 +2032,7 @@ export {
|
|
|
2039
2032
|
gr as a,
|
|
2040
2033
|
yr as b,
|
|
2041
2034
|
hr as c,
|
|
2042
|
-
|
|
2035
|
+
br as d,
|
|
2043
2036
|
je as e,
|
|
2044
2037
|
_e as f,
|
|
2045
2038
|
Le as g,
|
|
@@ -2053,4 +2046,4 @@ export {
|
|
|
2053
2046
|
Un as p,
|
|
2054
2047
|
Bn as u
|
|
2055
2048
|
};
|
|
2056
|
-
//# sourceMappingURL=ginger-
|
|
2049
|
+
//# sourceMappingURL=ginger-XgXdGRB-.js.map
|