@lucaismyname/ginger 0.0.23 → 0.0.25

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