twist-aplayer
Version:
A shadui theme aplayer
1,525 lines (1,524 loc) • 55.3 kB
JavaScript
import * as W from "react";
import pe, { useMemo as B, useRef as M, useState as V, useEffect as q, useCallback as S } from "react";
var oe = { exports: {} }, Q = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ge;
function ke() {
if (ge) return Q;
ge = 1;
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
function r(n, a, u) {
var f = null;
if (u !== void 0 && (f = "" + u), a.key !== void 0 && (f = "" + a.key), "key" in a) {
u = {};
for (var b in a)
b !== "key" && (u[b] = a[b]);
} else u = a;
return a = u.ref, {
$$typeof: e,
type: n,
key: f,
ref: a !== void 0 ? a : null,
props: u
};
}
return Q.Fragment = t, Q.jsx = r, Q.jsxs = r, Q;
}
var Z = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var xe;
function Ie() {
return xe || (xe = 1, process.env.NODE_ENV !== "production" && function() {
function e(o) {
if (o == null) return null;
if (typeof o == "function")
return o.$$typeof === re ? null : o.displayName || o.name || null;
if (typeof o == "string") return o;
switch (o) {
case i:
return "Fragment";
case v:
return "Profiler";
case l:
return "StrictMode";
case C:
return "Suspense";
case k:
return "SuspenseList";
case O:
return "Activity";
}
if (typeof o == "object")
switch (typeof o.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), o.$$typeof) {
case y:
return "Portal";
case E:
return (o.displayName || "Context") + ".Provider";
case _:
return (o._context.displayName || "Context") + ".Consumer";
case j:
var x = o.render;
return o = o.displayName, o || (o = x.displayName || x.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
case A:
return x = o.displayName || null, x !== null ? x : e(o.type) || "Memo";
case D:
x = o._payload, o = o._init;
try {
return e(o(x));
} catch {
}
}
return null;
}
function t(o) {
return "" + o;
}
function r(o) {
try {
t(o);
var x = !1;
} catch {
x = !0;
}
if (x) {
x = console;
var T = x.error, L = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
return T.call(
x,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
L
), t(o);
}
}
function n(o) {
if (o === i) return "<>";
if (typeof o == "object" && o !== null && o.$$typeof === D)
return "<...>";
try {
var x = e(o);
return x ? "<" + x + ">" : "<...>";
} catch {
return "<...>";
}
}
function a() {
var o = G.A;
return o === null ? null : o.getOwner();
}
function u() {
return Error("react-stack-top-frame");
}
function f(o) {
if (ne.call(o, "key")) {
var x = Object.getOwnPropertyDescriptor(o, "key").get;
if (x && x.isReactWarning) return !1;
}
return o.key !== void 0;
}
function b(o, x) {
function T() {
ae || (ae = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
x
));
}
T.isReactWarning = !0, Object.defineProperty(o, "key", {
get: T,
configurable: !0
});
}
function s() {
var o = e(this.type);
return Y[o] || (Y[o] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), o = this.props.ref, o !== void 0 ? o : null;
}
function d(o, x, T, L, $, I, le, de) {
return T = I.ref, o = {
$$typeof: p,
type: o,
key: x,
props: I,
_owner: $
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(o, "ref", {
enumerable: !1,
get: s
}) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(o, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(o, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: le
}), Object.defineProperty(o, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: de
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
}
function m(o, x, T, L, $, I, le, de) {
var N = x.children;
if (N !== void 0)
if (L)
if (ce(N)) {
for (L = 0; L < N.length; L++)
h(N[L]);
Object.freeze && Object.freeze(N);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else h(N);
if (ne.call(x, "key")) {
N = e(o);
var F = Object.keys(x).filter(function(Ce) {
return Ce !== "key";
});
L = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", P[N + L] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
L,
N,
F,
N
), P[N + L] = !0);
}
if (N = null, T !== void 0 && (r(T), N = "" + T), f(x) && (r(x.key), N = "" + x.key), "key" in x) {
T = {};
for (var fe in x)
fe !== "key" && (T[fe] = x[fe]);
} else T = x;
return N && b(
T,
typeof o == "function" ? o.displayName || o.name || "Unknown" : o
), d(
o,
N,
I,
$,
a(),
T,
le,
de
);
}
function h(o) {
typeof o == "object" && o !== null && o.$$typeof === p && o._store && (o._store.validated = 1);
}
var g = pe, p = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), E = Symbol.for("react.context"), j = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), k = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), re = Symbol.for("react.client.reference"), G = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ne = Object.prototype.hasOwnProperty, ce = Array.isArray, J = console.createTask ? console.createTask : function() {
return null;
};
g = {
"react-stack-bottom-frame": function(o) {
return o();
}
};
var ae, Y = {}, K = g["react-stack-bottom-frame"].bind(
g,
u
)(), X = J(n(u)), P = {};
Z.Fragment = i, Z.jsx = function(o, x, T, L, $) {
var I = 1e4 > G.recentlyCreatedOwnerStacks++;
return m(
o,
x,
T,
!1,
L,
$,
I ? Error("react-stack-top-frame") : K,
I ? J(n(o)) : X
);
}, Z.jsxs = function(o, x, T, L, $) {
var I = 1e4 > G.recentlyCreatedOwnerStacks++;
return m(
o,
x,
T,
!0,
L,
$,
I ? Error("react-stack-top-frame") : K,
I ? J(n(o)) : X
);
};
}()), Z;
}
var Ee;
function Ve() {
return Ee || (Ee = 1, process.env.NODE_ENV === "production" ? oe.exports = ke() : oe.exports = Ie()), oe.exports;
}
var c = Ve(), ie = (e) => `--${e}`, Se = (e) => `var(--${e})`, Te = (e, t) => `--${e}: ${t};`;
function ze(e, t) {
const r = (n) => t;
return {
b: () => `${r()}-${e}`,
be: (n) => `${r()}-${e}__${n}`,
bm: (n) => `${r()}-${e}--${n}`,
bem: (n, a) => `${r()}-${e}__${n}--${a}`,
bs: (n) => `${r()}-${e}-${n}`,
ns: (n) => `${r()}-${n}`,
cb: () => `.${r()}-${e}`,
cbe: (n) => `.${r()}-${e}__${n}`,
cbm: (n) => `.${r()}-${e}--${n}`,
cbem: (n, a) => `.${r()}-${e}__${n}--${a}`,
cbs: (n) => `.${r()}-${e}-${n}`,
cns: (n) => `.${r()}-${n}`,
cv: (n) => ie(`${r()}-${e}-${n}`),
cvm: (n, a = {}) => {
const u = r();
for (const f of Object.keys(n))
a[ie(`${u}-${e}-${f}`)] = n[f];
return a;
},
gcv: (n) => Se(`${r()}-${e}-${n}`),
scv: (n, a) => Te(`${r()}-${e}-${n}`, a),
nv: (n) => ie(`${r()}-${n}`),
nvm: (n, a = {}) => {
const u = r();
for (const f of Object.keys(n))
a[ie(`${u}-${f}`)] = n[f];
return a;
},
gnv: (n) => Se(`${r()}-${n}`),
snv: (n, a) => Te(`${r()}-${n}`, a)
};
}
function z(e) {
return B(() => ze(e, "twist"), [e]);
}
var Ne = {
color: void 0,
size: void 0,
className: void 0,
style: void 0,
attrs: void 0
}, be = /* @__PURE__ */ W.createContext(Ne);
be.Provider;
function ee(e) {
"@babel/helpers - typeof";
return ee = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
return typeof t;
} : function(t) {
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
}, ee(e);
}
var De = ["attrs", "size", "title", "spin", "rotate", "color"];
function Be(e, t) {
return Fe(e) || Ye(e, t) || Pe(e, t) || He();
}
function He() {
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function Ye(e, t) {
var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
if (r != null) {
var n, a, u, f, b = [], s = !0, d = !1;
try {
if (u = (r = r.call(e)).next, t !== 0) for (; !(s = (n = u.call(r)).done) && (b.push(n.value), b.length !== t); s = !0) ;
} catch (m) {
d = !0, a = m;
} finally {
try {
if (!s && r.return != null && (f = r.return(), Object(f) !== f)) return;
} finally {
if (d) throw a;
}
}
return b;
}
}
function Fe(e) {
if (Array.isArray(e)) return e;
}
function Ue(e, t) {
var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
if (!r) {
if (Array.isArray(e) || (r = Pe(e)) || t) {
r && (e = r);
var n = 0, a = function() {
};
return { s: a, n: function() {
return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
}, e: function(d) {
throw d;
}, f: a };
}
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
var u, f = !0, b = !1;
return { s: function() {
r = r.call(e);
}, n: function() {
var d = r.next();
return f = d.done, d;
}, e: function(d) {
b = !0, u = d;
}, f: function() {
try {
f || r.return == null || r.return();
} finally {
if (b) throw u;
}
} };
}
function Pe(e, t) {
if (e) {
if (typeof e == "string") return je(e, t);
var r = {}.toString.call(e).slice(8, -1);
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? je(e, t) : void 0;
}
}
function je(e, t) {
(t == null || t > e.length) && (t = e.length);
for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
return n;
}
function se() {
return se = Object.assign ? Object.assign.bind() : function(e) {
for (var t = 1; t < arguments.length; t++) {
var r = arguments[t];
for (var n in r) ({}).hasOwnProperty.call(r, n) && (e[n] = r[n]);
}
return e;
}, se.apply(null, arguments);
}
function we(e, t) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
t && (n = n.filter(function(a) {
return Object.getOwnPropertyDescriptor(e, a).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function te(e) {
for (var t = 1; t < arguments.length; t++) {
var r = arguments[t] != null ? arguments[t] : {};
t % 2 ? we(Object(r), !0).forEach(function(n) {
We(e, n, r[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : we(Object(r)).forEach(function(n) {
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
});
}
return e;
}
function We(e, t, r) {
return (t = Ge(t)) in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
}
function Ge(e) {
var t = Je(e, "string");
return ee(t) == "symbol" ? t : t + "";
}
function Je(e, t) {
if (ee(e) != "object" || !e) return e;
var r = e[Symbol.toPrimitive];
if (r !== void 0) {
var n = r.call(e, t);
if (ee(n) != "object") return n;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (t === "string" ? String : Number)(e);
}
function Ke(e, t) {
if (e == null) return {};
var r, n, a = Xe(e, t);
if (Object.getOwnPropertySymbols) {
var u = Object.getOwnPropertySymbols(e);
for (n = 0; n < u.length; n++) r = u[n], t.includes(r) || {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
}
return a;
}
function Xe(e, t) {
if (e == null) return {};
var r = {};
for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
if (t.includes(n)) continue;
r[n] = e[n];
}
return r;
}
function Qe(e) {
var t = e.attrs, r = e.size, n = e.title, a = e.spin, u = e.rotate, f = e.color, b = Ke(e, De), s = function(m) {
var h = r || m.size || "1em", g, p = "", y = "";
return m.className && (g = m.className), e.className && (g = g ? "".concat(g, " ").concat(e.className) : e.className), a && (g ? g += " twist-icon-loading" : g = "twist-icon-loading"), u && (p = "rotate(".concat(u, "deg)"), y = "rotate(".concat(u, "deg)")), /* @__PURE__ */ W.createElement("svg", se({
xmlns: "http://www.w3.org/2000/svg"
}, m.attrs, t, b, {
className: g,
style: te(te({
color: f || m.color,
msTransform: p,
transform: y
}, m.style), e.style),
width: h,
height: h
}), n && /* @__PURE__ */ W.createElement("title", null, n), e.children);
};
return be !== void 0 ? /* @__PURE__ */ W.createElement(be.Consumer, null, function(d) {
return s(d);
}) : s(Ne);
}
function Ze(e) {
var t = {}, r = e.split(";"), n = Ue(r), a;
try {
for (n.s(); !(a = n.n()).done; ) {
var u = a.value, f = u.split(":"), b = Be(f, 2), s = b[0], d = b[1];
if (s && d) {
var m = s.trim().replace(/-./g, function(h) {
return h.charAt(1).toUpperCase();
});
t[m] = d.trim();
}
}
} catch (h) {
n.e(h);
} finally {
n.f();
}
return t;
}
function $e(e) {
return e && e.map(function(t, r) {
return /* @__PURE__ */ W.createElement(t.tag, te(te({}, t.attrs), {}, {
key: r,
style: t.attrs.style ? Ze(t.attrs.style) : null
}), $e(t.children));
});
}
function R(e) {
return function(t) {
return /* @__PURE__ */ W.createElement(Qe, se({
attrs: te({}, e.attrs)
}, t), $e(e.children));
};
}
function et(e) {
return R({ attrs: { viewBox: "0 0 1024 1024" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M485.6 249.9L198.2 498c-8.3 7.1-8.3 20.8 0 27.9l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9m320 0L518.2 498a18.6 18.6 0 0 0-6.2 14c0 5.2 2.1 10.4 6.2 14l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9" } }] })(e);
}
function tt(e) {
return R({ attrs: { viewBox: "0 0 1024 1024" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M825.8 498L538.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L825.8 526c8.3-7.2 8.3-20.8 0-28m-320 0L218.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L505.8 526c4.1-3.6 6.2-8.8 6.2-14s-2.1-10.4-6.2-14" } }] })(e);
}
function rt(e) {
return R({ attrs: { viewBox: "0 0 1024 1024" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M512 1024c-69.1 0-136.2-13.5-199.3-40.2C251.7 958 197 921 150 874S66 772.3 40.2 711.3C13.5 648.2 0 581.1 0 512c0-19.9 16.1-36 36-36s36 16.1 36 36c0 59.4 11.6 117 34.6 171.3c22.2 52.4 53.9 99.5 94.3 139.9s87.5 72.2 139.9 94.3C395 940.4 452.6 952 512 952s117-11.6 171.3-34.6c52.4-22.2 99.5-53.9 139.9-94.3s72.2-87.5 94.3-139.9C940.4 629 952 571.4 952 512s-11.6-117-34.6-171.3a440.5 440.5 0 0 0-94.3-139.9a437.7 437.7 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.2C772.3 66 827 103 874 150s83.9 101.8 109.7 162.7c26.7 63.1 40.2 130.2 40.2 199.3s-13.5 136.2-40.2 199.3C958 772.3 921 827 874 874s-101.8 83.9-162.7 109.7c-63.1 26.8-130.2 40.3-199.3 40.3" } }] })(e);
}
function nt(e) {
return R({ attrs: { viewBox: "0 0 512 512" }, children: [{ tag: "path", attrs: { d: "M294.1 256L167 129c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.3 34 0L345 239c9.1 9.1 9.3 23.7.7 33.1L201.1 417c-4.7 4.7-10.9 7-17 7s-12.3-2.3-17-7c-9.4-9.4-9.4-24.6 0-33.9l127-127.1z", fill: "currentColor" } }] })(e);
}
function at(e) {
return R({ attrs: { viewBox: "0 0 512 512" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M208 432h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16m144 0h-48a16 16 0 0 1-16-16V96a16 16 0 0 1 16-16h48a16 16 0 0 1 16 16v320a16 16 0 0 1-16 16" } }] })(e);
}
function ot(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z" } }] })(e);
}
function it(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2 5.27L3.28 4L20 20.72L18.73 22l-3-3H7v3l-4-4l4-4v3h6.73L7 10.27V11H5V8.27zM17 13h2v4.18l-2-2zm0-8V2l4 4l-4 4V7H8.82l-2-2z" } }] })(e);
}
function ut(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "m17 3l5.25 4.5L17 12l5.25 4.5L17 21v-3h-2.74l-2.82-2.82l2.12-2.12L15.5 15H17V9h-1.5l-9 9H2v-3h3.26l9-9H17zM2 6h4.5l2.82 2.82l-2.12 2.12L5.26 9H2z" } }] })(e);
}
function st(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M16.15 13H5q-.425 0-.712-.288T4 12t.288-.712T5 11h11.15L13.3 8.15q-.3-.3-.288-.7t.288-.7q.3-.3.713-.312t.712.287L19.3 11.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-4.575 4.575q-.3.3-.712.288t-.713-.313q-.275-.3-.288-.7t.288-.7z" } }] })(e);
}
function ct(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M10.5 17q1.05 0 1.775-.725T13 14.5V9h3V7h-4v5.5q-.325-.225-.7-.363T10.5 12q-1.05 0-1.775.725T8 14.5t.725 1.775T10.5 17M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.587 1.413T20 20z" } }] })(e);
}
function lt(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14 19V5h4v14zm-8 0V5h4v14z" } }] })(e);
}
function dt(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8 17.175V6.825q0-.425.3-.713t.7-.287q.125 0 .263.037t.262.113l8.15 5.175q.225.15.338.375t.112.475t-.112.475t-.338.375l-8.15 5.175q-.125.075-.262.113T9 18.175q-.4 0-.7-.288t-.3-.712" } }] })(e);
}
function ft(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.5 10.5h-.75q-.325 0-.537-.213T10 9.75t.213-.537T10.75 9H12q.425 0 .713.288T13 10v4.25q0 .325-.213.538T12.25 15t-.537-.213t-.213-.537zM6.85 19l.85.85q.3.3.288.7t-.288.7q-.3.3-.712.313t-.713-.288L3.7 18.7q-.15-.15-.213-.325T3.426 18t.063-.375t.212-.325l2.575-2.575q.3-.3.713-.287t.712.312q.275.3.288.7t-.288.7l-.85.85H17v-3q0-.425.288-.712T18 13t.713.288T19 14v3q0 .825-.587 1.413T17 19zm10.3-12H7v3q0 .425-.288.713T6 11t-.712-.288T5 10V7q0-.825.588-1.412T7 5h10.15l-.85-.85q-.3-.3-.288-.7t.288-.7q.3-.3.712-.312t.713.287L20.3 5.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-2.575 2.575q-.3.3-.712.288T16.3 9.25q-.275-.3-.288-.7t.288-.7z" } }] })(e);
}
function mt(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "m6.85 19l.85.85q.3.3.288.7t-.288.7q-.3.3-.712.313t-.713-.288L3.7 18.7q-.15-.15-.213-.325T3.426 18t.063-.375t.212-.325l2.575-2.575q.3-.3.713-.287t.712.312q.275.3.288.7t-.288.7l-.85.85H17v-3q0-.425.288-.712T18 13t.713.288T19 14v3q0 .825-.587 1.413T17 19zm10.3-12H7v3q0 .425-.288.713T6 11t-.712-.288T5 10V7q0-.825.588-1.412T7 5h10.15l-.85-.85q-.3-.3-.288-.7t.288-.7q.3-.3.712-.312t.713.287L20.3 5.3q.15.15.213.325t.062.375t-.062.375t-.213.325l-2.575 2.575q-.3.3-.712.288T16.3 9.25q-.275-.3-.288-.7t.288-.7z" } }] })(e);
}
function vt(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9 15H6q-.425 0-.712-.288T5 14v-4q0-.425.288-.712T6 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T12.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.512.013T16 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2" } }] })(e);
}
function ht(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7 15V9h4l5-5v16l-5-5z" } }] })(e);
}
function yt(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M19 11.975q0-2.075-1.1-3.787t-2.95-2.563q-.375-.175-.55-.537t-.05-.738q.15-.4.538-.575t.787 0Q18.1 4.85 19.55 7.063T21 11.974t-1.45 4.913t-3.875 3.287q-.4.175-.788 0t-.537-.575q-.125-.375.05-.737t.55-.538q1.85-.85 2.95-2.562t1.1-3.788M7 15H4q-.425 0-.712-.288T3 14v-4q0-.425.288-.712T4 9h3l3.3-3.3q.475-.475 1.088-.213t.612.938v11.15q0 .675-.612.938T10.3 18.3zm9.5-3q0 1.05-.475 1.988t-1.25 1.537q-.25.15-.513.013T14 15.1V8.85q0-.3.263-.437t.512.012q.775.625 1.25 1.575t.475 2" } }] })(e);
}
function bt(e) {
return R({ attrs: { viewBox: "0 0 24 24" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M18.25 12L8.5 17.629V6.37z" } }] })(e);
}
function me(e, t) {
if (!t.current) return 0;
let r = (e.clientX - t.current.getBoundingClientRect().left) / t.current.clientWidth;
return r = Math.max(r, 0), r = Math.min(r, 1), r = Math.floor(r * 100) / 100, r;
}
function ve(e, t) {
if (!t.current) return 0;
let r = 1 - (e.clientY - t.current.getBoundingClientRect().top) / t.current.clientHeight;
return r = Math.max(r, 0), r = Math.min(r, 1), r = Math.floor(r * 100) / 100, r;
}
function Me(e) {
var t, r, n = "";
if (typeof e == "string" || typeof e == "number") n += e;
else if (typeof e == "object") if (Array.isArray(e)) {
var a = e.length;
for (t = 0; t < a; t++) e[t] && (r = Me(e[t])) && (n && (n += " "), n += r);
} else for (r in e) e[r] && (n && (n += " "), n += r);
return n;
}
function w() {
for (var e, t, r = 0, n = "", a = arguments.length; r < a; r++) (e = arguments[r]) && (t = Me(e)) && (n && (n += " "), n += t);
return n;
}
function pt({
bufferedPercentage: e,
playedPercentage: t,
onSeek: r
}) {
const n = z("aplayer-bar"), a = z("aplayer-icon"), u = M(null), [f, b] = V(t), s = M(!1);
q(() => {
s.current || b(t);
}, [t]);
const d = S(
(m) => {
s.current = !0;
const h = me(m, u);
b(h);
const g = (y) => {
const i = me(y, u);
b(i);
}, p = (y) => {
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", p);
const i = me(y, u);
b(i), r == null || r(i), s.current = !1;
};
document.addEventListener("mousemove", g), document.addEventListener("mouseup", p);
},
[r]
);
return /* @__PURE__ */ c.jsx(
"div",
{
ref: u,
className: w(n.b(), n.bs("vars")),
onMouseDown: d,
role: "slider",
"aria-label": "Audio progress",
"aria-valuenow": f ? f * 100 : 0,
"aria-valuemin": 0,
"aria-valuemax": 100,
"aria-live": "polite",
children: /* @__PURE__ */ c.jsxs("div", { className: n.be("inner"), children: [
typeof e < "u" ? /* @__PURE__ */ c.jsx(
"div",
{
className: n.be("loaded"),
style: { width: `${e * 100}%` }
}
) : null,
typeof f < "u" ? /* @__PURE__ */ c.jsx(
"div",
{
className: n.be("played"),
style: {
width: `${f * 100}%`
},
children: /* @__PURE__ */ c.jsx(
"span",
{
className: n.be("thumb"),
children: /* @__PURE__ */ c.jsx("span", { className: w(a.bs("loading")), children: /* @__PURE__ */ c.jsx(rt, {}) })
}
)
}
) : null
] })
}
);
}
function gt({
volume: e,
muted: t,
onToggleMuted: r,
onChangeVolume: n
}) {
const a = z("aplayer-volumn"), u = z("aplayer-icon"), f = M(null), [b, s] = V(!1), d = S(
(m) => {
n(ve(m, f)), s(!0);
const h = (p) => {
n(ve(p, f));
}, g = (p) => {
document.removeEventListener("mouseup", g), document.removeEventListener("mousemove", h), s(!1), n(ve(p, f));
};
document.addEventListener("mousemove", h), document.addEventListener("mouseup", g);
},
[n]
);
return /* @__PURE__ */ c.jsxs("div", { className: w(a.b(), a.bs("vars")), children: [
/* @__PURE__ */ c.jsx(
"button",
{
type: "button",
className: w(u.b(), u.bs("volume-down")),
onClick: () => r(),
"aria-label": t || !e ? "Muted" : "unMuted",
children: t || !e ? /* @__PURE__ */ c.jsx(ht, {}) : e >= 1 ? /* @__PURE__ */ c.jsx(yt, {}) : /* @__PURE__ */ c.jsx(vt, {})
}
),
/* @__PURE__ */ c.jsx(
"div",
{
className: w(a.be("bar-wrap"), {
[a.bem("bar-wrap", "active")]: b
}),
ref: f,
onMouseDown: d,
children: /* @__PURE__ */ c.jsx("div", { className: a.be("bar"), children: /* @__PURE__ */ c.jsx(
"div",
{
className: a.be("thumb"),
style: {
height: t ? 0 : `${e * 100}%`
}
}
) })
}
)
] });
}
function _e(e) {
if (typeof e > "u")
return "--:--";
if (Number.isNaN(e))
return "00:00";
const t = (f) => f < 10 ? `0${f}` : `${f}`, r = Math.trunc(e / 60), n = Math.trunc(e - r * 60), a = Math.trunc(r / 60), u = Math.trunc(
e / 60 - 60 * Math.trunc(e / 60 / 60)
);
return e >= 3600 ? `${t(a)}:${t(u)}:${t(n)}` : `${t(r)}:${t(n)}`;
}
function xt({
volume: e,
onChangeVolume: t,
muted: r,
currentTime: n,
audioDurationSeconds: a,
bufferedSeconds: u,
onToggleMenu: f,
onToggleMuted: b,
order: s,
onOrderChange: d,
loop: m,
onLoopChange: h,
onSeek: g,
isPlaying: p,
onTogglePlay: y,
onSkipForward: i,
onSkipBack: l,
showLyrics: v = !0,
onToggleLyrics: _
}) {
const E = z("aplayer-controller"), j = z("aplayer-icon"), C = S(() => {
const A = {
list: "random",
random: "list"
}[s];
d(A);
}, [s, d]), k = S(() => {
const A = {
all: "one",
one: "none",
none: "all"
}[m];
h(A);
}, [m, h]);
return /* @__PURE__ */ c.jsxs(
"div",
{
className: w(E.b(), E.bs("vars")),
role: "group",
"aria-label": "Audio Controls",
children: [
/* @__PURE__ */ c.jsx(
pt,
{
playedPercentage: typeof n > "u" || typeof a > "u" ? void 0 : n / a,
bufferedPercentage: typeof u > "u" || typeof a > "u" ? void 0 : u / a,
onSeek: (A) => g == null ? void 0 : g(A * a)
}
),
/* @__PURE__ */ c.jsxs("div", { className: E.be("time"), children: [
/* @__PURE__ */ c.jsxs("span", { className: E.be("time-inner"), "aria-live": "polite", children: [
/* @__PURE__ */ c.jsx("span", { className: E.be("ptime"), children: _e(n) }),
" / ",
/* @__PURE__ */ c.jsx("span", { className: E.be("dtime"), children: _e(a) })
] }),
/* @__PURE__ */ c.jsx(
"button",
{
className: w(j.b(), j.bs("back")),
onClick: l,
type: "button",
"aria-label": "Previous track",
children: /* @__PURE__ */ c.jsx(et, {})
}
),
/* @__PURE__ */ c.jsx(
"button",
{
className: w(j.b(), j.bs("play")),
onClick: y,
type: "button",
"aria-label": p ? "Pause audio" : "Play audio",
children: p ? /* @__PURE__ */ c.jsx(lt, {}) : /* @__PURE__ */ c.jsx(dt, {})
}
),
/* @__PURE__ */ c.jsx(
"button",
{
className: w(j.b(), j.bs("forward")),
onClick: i,
type: "button",
"aria-label": "Next track",
children: /* @__PURE__ */ c.jsx(tt, {})
}
),
/* @__PURE__ */ c.jsx(
gt,
{
volume: e,
muted: r,
onToggleMuted: b,
onChangeVolume: t
}
),
/* @__PURE__ */ c.jsx(
"button",
{
className: w(j.b(), j.bs("order")),
onClick: C,
type: "button",
"aria-label": `Playback order: ${s}`,
children: { list: /* @__PURE__ */ c.jsx(st, {}), random: /* @__PURE__ */ c.jsx(ut, {}) }[s]
}
),
/* @__PURE__ */ c.jsx(
"button",
{
className: w(j.b(), j.bs("order")),
onClick: k,
type: "button",
"aria-label": `Loop mode: ${m}`,
children: {
all: /* @__PURE__ */ c.jsx(mt, {}),
one: /* @__PURE__ */ c.jsx(ft, {}),
none: /* @__PURE__ */ c.jsx(it, {})
}[m]
}
),
/* @__PURE__ */ c.jsx(
"button",
{
type: "button",
className: w(j.b(), j.bs("menu")),
onClick: () => f == null ? void 0 : f(),
"aria-label": "Toggle playlist menu",
children: /* @__PURE__ */ c.jsx(ot, {})
}
),
/* @__PURE__ */ c.jsx(
"button",
{
type: "button",
className: w(j.b(), j.bs("lrc"), {
[j.ns("lrc-inactivity")]: !v
}),
onClick: _,
"aria-label": v ? "Hide lyrics" : "Show lyrics",
"aria-pressed": v,
children: /* @__PURE__ */ c.jsx(ct, {})
}
)
] })
]
}
);
}
function Et({
open: e,
audio: t,
playingAudioUrl: r,
onPlayAudio: n,
listMaxHeight: a
}) {
const u = z("aplayer-list"), f = a ? { maxHeight: a } : void 0, b = S((d) => d ? typeof d == "string" ? d : d.name ?? "Audio artist" : "Audio artist", []), s = M(null);
return q(() => {
if (s.current) {
const d = s.current;
return d.style.maxHeight = `${Math.min(
d.scrollHeight,
a ?? 1 / 0
)}px`, () => {
d.removeAttribute("style");
};
}
}, [a]), /* @__PURE__ */ c.jsx(
"div",
{
ref: s,
className: w(u.b(), {
[u.bm("hide")]: !e,
[u.bs("vars")]: !0
}),
"aria-label": "Audio playlist",
"aria-live": "polite",
children: /* @__PURE__ */ c.jsx("ol", { style: f, children: t.map((d, m) => /* @__PURE__ */ c.jsxs(
"li",
{
className: w({
[u.bm("active")]: d.url === r
}),
onClick: () => {
d.url !== r && (n == null || n(d));
},
role: "button",
"aria-label": `${d.name ?? "Audio name"} by ${b(d.artist)}}`,
children: [
/* @__PURE__ */ c.jsx("span", { className: u.be("cur") }),
/* @__PURE__ */ c.jsx("span", { className: u.be("index"), children: m + 1 }),
/* @__PURE__ */ c.jsx("span", { className: u.be("title"), children: d.name ?? "Audio name" }),
/* @__PURE__ */ c.jsx("span", { className: u.be("author"), children: b(d.artist) })
]
},
d.name || m
)) })
}
);
}
function Oe({ show: e, lrcText: t, currentTime: r }) {
const n = z("aplayer-lrc"), a = B(() => St(t), [t]), u = B(() => {
for (let b = 0; b < a.length; b++) {
const s = a[b], d = a[b + 1];
if (r >= s[0] && (!d || r < d[0]))
return b;
}
return 0;
}, [r, a]), f = B(() => ({
transform: `translateY(${-u * 16}px)`,
WebkitTransform: `translateY(${-u * 16}px)`
}), [u]);
return /* @__PURE__ */ c.jsx(
"div",
{
className: w(n.b(), {
[n.bm("hide")]: !e
}),
children: t ? /* @__PURE__ */ c.jsx("div", { className: n.be("contents"), style: f, children: a.map(([, b], s) => /* @__PURE__ */ c.jsx(
"p",
{
className: w({
[n.be("current")]: s === u
}),
children: b
},
s
)) }) : null
}
);
}
function St(e) {
if (e) {
e = e.replace(/([^\]^\n])\[/g, (a, u) => `${u}
[`);
const t = e.split(`
`), r = [], n = t.length;
for (let a = 0; a < n; a++) {
const u = t[a].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g), f = t[a].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g, "").replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g, "").replace(/^\s+|\s+$/g, "");
if (u) {
const b = u.length;
for (let s = 0; s < b; s++) {
const d = /\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/.exec(u[s]), m = d[1] * 60, h = Number.parseInt(d[2]), g = d[4] ? Number.parseInt(d[4]) / (`${d[4]}`.length === 2 ? 100 : 1e3) : 0, p = m + h + g;
r.push([p, f]);
}
}
}
return r.sort((a, u) => a[0] - u[0]), r;
} else
return [];
}
var ue = { exports: {} }, he = {};
/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Le;
function Tt() {
if (Le) return he;
Le = 1;
var e = pe;
function t(h, g) {
return h === g && (h !== 0 || 1 / h === 1 / g) || h !== h && g !== g;
}
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, a = e.useEffect, u = e.useLayoutEffect, f = e.useDebugValue;
function b(h, g) {
var p = g(), y = n({ inst: { value: p, getSnapshot: g } }), i = y[0].inst, l = y[1];
return u(
function() {
i.value = p, i.getSnapshot = g, s(i) && l({ inst: i });
},
[h, p, g]
), a(
function() {
return s(i) && l({ inst: i }), h(function() {
s(i) && l({ inst: i });
});
},
[h]
), f(p), p;
}
function s(h) {
var g = h.getSnapshot;
h = h.value;
try {
var p = g();
return !r(h, p);
} catch {
return !0;
}
}
function d(h, g) {
return g();
}
var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : b;
return he.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : m, he;
}
var ye = {};
/**
* @license React
* use-sync-external-store-shim.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Re;
function jt() {
return Re || (Re = 1, process.env.NODE_ENV !== "production" && function() {
function e(p, y) {
return p === y && (p !== 0 || 1 / p === 1 / y) || p !== p && y !== y;
}
function t(p, y) {
m || a.startTransition === void 0 || (m = !0, console.error(
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
));
var i = y();
if (!h) {
var l = y();
u(i, l) || (console.error(
"The result of getSnapshot should be cached to avoid an infinite loop"
), h = !0);
}
l = f({
inst: { value: i, getSnapshot: y }
});
var v = l[0].inst, _ = l[1];
return s(
function() {
v.value = i, v.getSnapshot = y, r(v) && _({ inst: v });
},
[p, i, y]
), b(
function() {
return r(v) && _({ inst: v }), p(function() {
r(v) && _({ inst: v });
});
},
[p]
), d(i), i;
}
function r(p) {
var y = p.getSnapshot;
p = p.value;
try {
var i = y();
return !u(p, i);
} catch {
return !0;
}
}
function n(p, y) {
return y();
}
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
var a = pe, u = typeof Object.is == "function" ? Object.is : e, f = a.useState, b = a.useEffect, s = a.useLayoutEffect, d = a.useDebugValue, m = !1, h = !1, g = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : t;
ye.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : g, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
}()), ye;
}
var Ae;
function wt() {
return Ae || (Ae = 1, process.env.NODE_ENV === "production" ? ue.exports = Tt() : ue.exports = jt()), ue.exports;
}
var H = wt();
const U = [];
function _t(e) {
const t = M(null);
return q(() => {
if (typeof window < "u" && !t.current) {
const r = t.current = document.createElement("audio");
typeof (e == null ? void 0 : e.src) < "u" && (r.src = e.src), typeof (e == null ? void 0 : e.autoPlay) < "u" && (r.autoplay = e.autoPlay), typeof (e == null ? void 0 : e.initialVolume) < "u" && (r.volume = e.initialVolume), U.includes(r) || U.push(r);
}
}, [e == null ? void 0 : e.autoPlay, e == null ? void 0 : e.initialVolume, e == null ? void 0 : e.src]), q(() => {
if (typeof window > "u") return;
const r = t.current;
if (r && (e != null && e.onError))
return r.addEventListener("error", e.onError), () => {
r.removeEventListener("error", e.onError);
};
}, [e == null ? void 0 : e.onError]), q(() => {
if (typeof window > "u") return;
const r = t.current;
if (r && (e != null && e.onEnded))
return r.addEventListener("ended", e.onEnded), () => {
r.removeEventListener("ended", e.onEnded);
};
}, [e == null ? void 0 : e.onEnded]), q(() => () => {
const r = t.current;
if (r) {
r.pause(), r.currentTime = 0;
const n = U.indexOf(r);
n !== -1 && U.splice(n, 1);
}
t.current = null;
}, []), t;
}
function Ot(e) {
const t = _t(e), r = S((i) => {
for (let l = 0; l < U.length; l++) {
const v = U[l];
v !== i && !v.paused && v.pause();
}
}, []), n = S(
async (i) => {
var v;
const l = t.current;
if (l) {
e.mutex && r(l), l.src !== i && (l.pause(), l.currentTime = 0, l.src = i);
try {
await ((v = t.current) == null ? void 0 : v.play());
} catch {
}
}
},
[t, e.mutex, r]
), a = S(
(i) => {
const l = t.current;
l && (l.paused ? n(i) : l.pause());
},
[t, n]
), u = S(
(i) => {
t.current.currentTime = i;
},
[t]
), f = S(() => {
t.current && (t.current.muted = !t.current.muted);
}, [t]), b = S(
(i) => {
t.current && (t.current.volume = i);
},
[t]
), s = H.useSyncExternalStore(
S(
(i) => {
var l;
return (l = t.current) == null || l.addEventListener(
"volumechange",
i
), () => {
var v;
(v = t.current) == null || v.removeEventListener(
"volumechange",
i
);
};
},
[t]
),
() => {
var i;
return (i = t.current) == null ? void 0 : i.volume;
},
() => {
}
), d = H.useSyncExternalStore(
S(
(i) => {
var l;
return (l = t.current) == null || l.addEventListener(
"volumechange",
i
), () => {
var v;
(v = t.current) == null || v.removeEventListener(
"volumechange",
i
);
};
},
[t]
),
() => {
var i;
return (i = t.current) == null ? void 0 : i.muted;
},
() => {
}
), m = H.useSyncExternalStore(
S(
(i) => {
var l;
return (l = t.current) == null || l.addEventListener("timeupdate", i), () => {
var v;
(v = t.current) == null || v.removeEventListener(
"timeupdate",
i
);
};
},
[t]
),
() => {
if (t.current)
return Math.round(t.current.currentTime);
},
() => {
}
), h = H.useSyncExternalStore(
S(
(i) => {
var l;
return (l = t.current) == null || l.addEventListener(
"durationchange",
i
), () => {
var v;
(v = t.current) == null || v.removeEventListener(
"durationchange",
i
);
};
},
[t]
),
() => {
var i;
return (i = t.current) == null ? void 0 : i.duration;
},
() => {
}
), g = H.useSyncExternalStore(
S(
(i) => {
var l;
return (l = t.current) == null || l.addEventListener("progress", i), () => {
var v;
(v = t.current) == null || v.removeEventListener(
"progress",
i
);
};
},
[t]
),
() => {
const i = t.current;
return i && i.buffered.length > 0 ? i.buffered.end(i.buffered.length - 1) : 0;
},
() => {
}
), p = H.useSyncExternalStore(
S(
(i) => {
var l, v;
return (l = t.current) == null || l.addEventListener("play", i), (v = t.current) == null || v.addEventListener("pause", i), () => {
var _, E;
(_ = t.current) == null || _.removeEventListener("play", i), (E = t.current) == null || E.removeEventListener("pause", i);
};
},
[t]
),
() => {
const i = t.current;
return i ? !i.paused : !1;
},
() => {
}
), y = H.useSyncExternalStore(
S(
(i) => {
var l, v;
return (l = t.current) == null || l.addEventListener("playing", i), (v = t.current) == null || v.addEventListener("waiting", i), () => {
var _, E;
(_ = t.current) == null || _.removeEventListener(
"playing",
i
), (E = t.current) == null || E.removeEventListener(
"waiting",
i
);
};
},
[t]
),
() => {
const i = t.current;
return i ? i.networkState === i.NETWORK_LOADING : !1;
},
() => {
}
);
return {
audio: t.current,
playAudio: n,
togglePlay: a,
seek: u,
toggleMuted: f,
setVolume: b,
volume: s,
muted: d,
currentTime: m,
duration: h,
bufferedSeconds: g,
isPlaying: p,
isLoading: y
};
}
function Lt(e, t) {
return B(() => {
const r = { ...t };
for (const n in e)
e[n] !== void 0 && (r[n] = e[n]);
return r;
}, [e, t]);
}
function Rt(e) {
const [t, r] = V(e);
return q(() => {
r(e);
}, [e]), {
mini: t,
setMini: r
};
}
function qe() {
const e = M([]);
return q(() => {
const r = e.current;
return () => {
for (const n of r)
clearTimeout(n);
};
}, []), S((r, n) => {
const a = setTimeout(r, n);
return e.current.push(a), a;
}, []);
}
function At() {
const e = M(null), [t, r] = V({ text: "", style: { opacity: 0 } }), n = qe(), a = S(
(u, f = 2e3) => {
e.current && clearTimeout(e.current), r({ text: u, style: { opacity: 1 } }), e.current = n(() => {
r({ text: u, style: { opacity: 0 } });
}, f);
},
[n]
);
return [t, a];
}
function Nt(e) {
return Pt(e.slice());
}
function Pt(e) {
let t = e.length, r;
for (; t !== 0; )
r = Math.floor(Math.random() * t), t--, [e[t], e[r]] = [
e[r],
e[t]
];
return e;
}
function $t(e, t) {
const { initialLoop: r = "all", initialOrder: n = "list" } = t, [a, u] = V(r), [f, b] = V(n), s = B(() => f === "list" ? e : Nt(e), [e, f]), [d, m] = V(s[0]), h = S((l) => l.url, []), g = B(() => s.findIndex((v) => h(v) === h(d)) < s.length - 1 || a !== "none", [s, d, a, h]), p = S(() => {
m((l) => {
const v = s.findIndex((_) => h(_) === h(l));
return v < s.length - 1 ? s[v + 1] : { ...s[0] };
});
}, [a, s, h]), y = S(() => {
m((l) => {
const v = s.indexOf(l);
return v > 0 ? s[v - 1] : l;
});
}, [s]), i = S((l) => {
m(l);
}, []);
return q(() => {
const l = s.find(
(v) => h(v) === h(d)
);
m(l || s[0]);
}, [s, h, d]), {
list: s,
currentSong: d,
hasNextSong: g,
next: p,
previous: y,
prioritize: i,
order: f,
setOrder: b,
loop: a,
setLoop: u,
length: s.length
};
}
function Mt(e) {
const t = Lt(e, {
appearance: "normal",
volume: 0.7,
autoPlay: !1,
listMaxHeight: 250,
mini: !1,
mutex: !0,
listFolded: !1,
theme: "light",
border: !1
}), {
audio: r,
appearance: n,
initialLoop: a,
initialOrder: u,
volume: f,
autoPlay: b,
listMaxHeight: s,
listFolded: d,
mutex: m,
theme: h,
border: g
} = t, p = B(
() => Array.isArray(r) ? r : [r],
[r]
), y = $t(p, {
initialLoop: a,
initialOrder: u
}), [i, l] = At(), { mini: v, setMini: _ } = Rt(t.mini), E = qe(), j = M(null), C = S(() => {
j.current && (clearTimeout(j.current), j.current = null);
}, []), k = M(!1), A = Ot({
src: y.currentSong.url,
initialVolume: f,
autoPlay: b,
mutex: m,
onError(P) {
const { error: o } = P.target;
o && l(
"An audio error has occurred, player will skip forward in 2 seconds."
), y.hasNextSong && (j.current = E(() => {
y.next();
}, 2e3));
},
onEnded() {
const { list: P, currentSong: o, loop: x, prioritize: T, hasNextSong: L } = y, { audio: $ } = A;
if (x === "one") {
T({ ...o });
return;
}
if (!L && x === "none") {
k.current = !0, $.currentTime = 0, $.pause(), $.src = P[0].url, T(P[0]);
return;
}
y.next();
}
}), D = y.length > 1, O = S(() => {
C(), A.togglePlay(y.currentSong.url);
}, [A, C, y.currentSong.url]), { prioritize: re } = y, G = S(
(P) => {
C(), re(P);
},
[C, re]
), [ne, ce] = V(() => D && !d), [J, ae] = V(!0), Y = M(null);
q(() => {
b && A.playAudio(y.currentSong.url);
}, []);
const K = M(!0), X = M(y.currentSong);
return q(() => {
if (K.current) {
K.current = !1;
return;
}
if (k.current) {
k.current = !1;
return;
}
y.currentSong && (y.loop === "one" || y.currentSong !== X.current) && (X.current = y.currentSong, A.playAudio(y.currentSong.url));
}, [y.currentSong]), q(() => {
if (n === "fixed" && Y.current) {
const P = Y.current;
return P.style.width = `${P.offsetWidth - 18}px`, () => {
P.removeAttribute("style");
};
}
}, [n]), {
bodyRef: Y,
appearance: n,
volume: f,
listMaxHeight: s,
theme: h,
border: g,
notice: i,
audioControl: A,
audio: p,
handlePlayButtonClick: O,
handlePlayAudioFromList: G,
isPlaylistOpen: ne,
setPlaylistOpen: ce,
mini: v,
displayLyrics: J,
setDisplayLyrics: ae,
setMini: _,
playlist: y,