UNPKG

twist-aplayer

Version:
51 lines (48 loc) 47.5 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react");function Br(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const ce=Br(f);var Te={exports:{}},ye={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var tr;function zr(){if(tr)return ye;tr=1;var e=f,t=Symbol.for("react.element"),a=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function h(y,s,g){var E,c={},m=null,x=null;g!==void 0&&(m=""+g),s.key!==void 0&&(m=""+s.key),s.ref!==void 0&&(x=s.ref);for(E in s)n.call(s,E)&&!d.hasOwnProperty(E)&&(c[E]=s[E]);if(y&&y.defaultProps)for(E in s=y.defaultProps,s)c[E]===void 0&&(c[E]=s[E]);return{$$typeof:t,type:y,key:m,ref:x,props:c,_owner:i.current}}return ye.Fragment=a,ye.jsx=h,ye.jsxs=h,ye}var be={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var nr;function Hr(){return nr||(nr=1,process.env.NODE_ENV!=="production"&&function(){var e=f,t=Symbol.for("react.element"),a=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),y=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),c=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),_=Symbol.iterator,o="@@iterator";function l(r){if(r===null||typeof r!="object")return null;var u=_&&r[_]||r[o];return typeof u=="function"?u:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function T(r){{for(var u=arguments.length,p=new Array(u>1?u-1:0),S=1;S<u;S++)p[S-1]=arguments[S];O("error",r,p)}}function O(r,u,p){{var S=b.ReactDebugCurrentFrame,R=S.getStackAddendum();R!==""&&(u+="%s",p=p.concat([R]));var C=p.map(function(j){return String(j)});C.unshift("Warning: "+u),Function.prototype.apply.call(console[r],console,C)}}var M=!1,J=!1,X=!1,F=!1,Q=!1,te;te=Symbol.for("react.module.reference");function fe(r){return!!(typeof r=="string"||typeof r=="function"||r===n||r===d||Q||r===i||r===g||r===E||F||r===x||M||J||X||typeof r=="object"&&r!==null&&(r.$$typeof===m||r.$$typeof===c||r.$$typeof===h||r.$$typeof===y||r.$$typeof===s||r.$$typeof===te||r.getModuleId!==void 0))}function de(r,u,p){var S=r.displayName;if(S)return S;var R=u.displayName||u.name||"";return R!==""?p+"("+R+")":p}function ne(r){return r.displayName||"Context"}function D(r){if(r==null)return null;if(typeof r.tag=="number"&&T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case n:return"Fragment";case a:return"Portal";case d:return"Profiler";case i:return"StrictMode";case g:return"Suspense";case E:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case y:var u=r;return ne(u)+".Consumer";case h:var p=r;return ne(p._context)+".Provider";case s:return de(r,r.render,"ForwardRef");case c:var S=r.displayName||null;return S!==null?S:D(r.type)||"Memo";case m:{var R=r,C=R._payload,j=R._init;try{return D(j(C))}catch{return null}}}return null}var B=Object.assign,z=0,H,W,$,U,ve,xe,me;function Se(){}Se.__reactDisabledLog=!0;function Pe(){{if(z===0){H=console.log,W=console.info,$=console.warn,U=console.error,ve=console.group,xe=console.groupCollapsed,me=console.groupEnd;var r={configurable:!0,enumerable:!0,value:Se,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}z++}}function Me(){{if(z--,z===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},r,{value:H}),info:B({},r,{value:W}),warn:B({},r,{value:$}),error:B({},r,{value:U}),group:B({},r,{value:ve}),groupCollapsed:B({},r,{value:xe}),groupEnd:B({},r,{value:me})})}z<0&&T("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=b.ReactCurrentDispatcher,he;function K(r,u,p){{if(he===void 0)try{throw Error()}catch(R){var S=R.stack.trim().match(/\n( *(at )?)/);he=S&&S[1]||""}return` `+he+r}}var ae=!1,Z;{var I=typeof WeakMap=="function"?WeakMap:Map;Z=new I}function ie(r,u){if(!r||ae)return"";{var p=Z.get(r);if(p!==void 0)return p}var S;ae=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var C;C=pe.current,pe.current=null,Pe();try{if(u){var j=function(){throw Error()};if(Object.defineProperty(j.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(j,[])}catch(q){S=q}Reflect.construct(r,[],j)}else{try{j.call()}catch(q){S=q}r.call(j.prototype)}}else{try{throw Error()}catch(q){S=q}r()}}catch(q){if(q&&S&&typeof q.stack=="string"){for(var w=q.stack.split(` `),N=S.stack.split(` `),L=w.length-1,k=N.length-1;L>=1&&k>=0&&w[L]!==N[k];)k--;for(;L>=1&&k>=0;L--,k--)if(w[L]!==N[k]){if(L!==1||k!==1)do if(L--,k--,k<0||w[L]!==N[k]){var V=` `+w[L].replace(" at new "," at ");return r.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",r.displayName)),typeof r=="function"&&Z.set(r,V),V}while(L>=1&&k>=0);break}}}finally{ae=!1,pe.current=C,Me(),Error.prepareStackTrace=R}var se=r?r.displayName||r.name:"",ee=se?K(se):"";return typeof r=="function"&&Z.set(r,ee),ee}function _e(r,u,p){return ie(r,!1)}function we(r){var u=r.prototype;return!!(u&&u.isReactComponent)}function ue(r,u,p){if(r==null)return"";if(typeof r=="function")return ie(r,we(r));if(typeof r=="string")return K(r);switch(r){case g:return K("Suspense");case E:return K("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case s:return _e(r.render);case c:return ue(r.type,u,p);case m:{var S=r,R=S._payload,C=S._init;try{return ue(C(R),u,p)}catch{}}}return""}var Y=Object.prototype.hasOwnProperty,Be={},ze=b.ReactDebugCurrentFrame;function je(r){if(r){var u=r._owner,p=ue(r.type,r._source,u?u.type:null);ze.setExtraStackFrame(p)}else ze.setExtraStackFrame(null)}function Er(r,u,p,S,R){{var C=Function.call.bind(Y);for(var j in r)if(C(r,j)){var w=void 0;try{if(typeof r[j]!="function"){var N=Error((S||"React class")+": "+p+" type `"+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[j]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw N.name="Invariant Violation",N}w=r[j](u,j,S,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(L){w=L}w&&!(w instanceof Error)&&(je(R),T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",S||"React class",p,j,typeof w),je(null)),w instanceof Error&&!(w.message in Be)&&(Be[w.message]=!0,je(R),T("Failed %s type: %s",p,w.message),je(null))}}}var xr=Array.isArray;function Le(r){return xr(r)}function Sr(r){{var u=typeof Symbol=="function"&&Symbol.toStringTag,p=u&&r[Symbol.toStringTag]||r.constructor.name||"Object";return p}}function _r(r){try{return He(r),!1}catch{return!0}}function He(r){return""+r}function We(r){if(_r(r))return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Sr(r)),He(r)}var Ue=b.ReactCurrentOwner,wr={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ge;function jr(r){if(Y.call(r,"ref")){var u=Object.getOwnPropertyDescriptor(r,"ref").get;if(u&&u.isReactWarning)return!1}return r.ref!==void 0}function Tr(r){if(Y.call(r,"key")){var u=Object.getOwnPropertyDescriptor(r,"key").get;if(u&&u.isReactWarning)return!1}return r.key!==void 0}function Or(r,u){typeof r.ref=="string"&&Ue.current}function Rr(r,u){{var p=function(){Ye||(Ye=!0,T("%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://reactjs.org/link/special-props)",u))};p.isReactWarning=!0,Object.defineProperty(r,"key",{get:p,configurable:!0})}}function Cr(r,u){{var p=function(){Ge||(Ge=!0,T("%s: `ref` 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://reactjs.org/link/special-props)",u))};p.isReactWarning=!0,Object.defineProperty(r,"ref",{get:p,configurable:!0})}}var Pr=function(r,u,p,S,R,C,j){var w={$$typeof:t,type:r,key:u,ref:p,props:j,_owner:C};return w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(w,"_self",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(w,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w};function Mr(r,u,p,S,R){{var C,j={},w=null,N=null;p!==void 0&&(We(p),w=""+p),Tr(u)&&(We(u.key),w=""+u.key),jr(u)&&(N=u.ref,Or(u,R));for(C in u)Y.call(u,C)&&!wr.hasOwnProperty(C)&&(j[C]=u[C]);if(r&&r.defaultProps){var L=r.defaultProps;for(C in L)j[C]===void 0&&(j[C]=L[C])}if(w||N){var k=typeof r=="function"?r.displayName||r.name||"Unknown":r;w&&Rr(j,k),N&&Cr(j,k)}return Pr(r,w,N,R,S,Ue.current,j)}}var $e=b.ReactCurrentOwner,Ke=b.ReactDebugCurrentFrame;function oe(r){if(r){var u=r._owner,p=ue(r.type,r._source,u?u.type:null);Ke.setExtraStackFrame(p)}else Ke.setExtraStackFrame(null)}var ke;ke=!1;function Ae(r){return typeof r=="object"&&r!==null&&r.$$typeof===t}function Je(){{if($e.current){var r=D($e.current.type);if(r)return` Check the render method of \``+r+"`."}return""}}function Lr(r){return""}var Xe={};function $r(r){{var u=Je();if(!u){var p=typeof r=="string"?r:r.displayName||r.name;p&&(u=` Check the top-level render call using <`+p+">.")}return u}}function Qe(r,u){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var p=$r(u);if(Xe[p])return;Xe[p]=!0;var S="";r&&r._owner&&r._owner!==$e.current&&(S=" It was passed a child from "+D(r._owner.type)+"."),oe(r),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',p,S),oe(null)}}function Ze(r,u){{if(typeof r!="object")return;if(Le(r))for(var p=0;p<r.length;p++){var S=r[p];Ae(S)&&Qe(S,u)}else if(Ae(r))r._store&&(r._store.validated=!0);else if(r){var R=l(r);if(typeof R=="function"&&R!==r.entries)for(var C=R.call(r),j;!(j=C.next()).done;)Ae(j.value)&&Qe(j.value,u)}}}function kr(r){{var u=r.type;if(u==null||typeof u=="string")return;var p;if(typeof u=="function")p=u.propTypes;else if(typeof u=="object"&&(u.$$typeof===s||u.$$typeof===c))p=u.propTypes;else return;if(p){var S=D(u);Er(p,r.props,"prop",S,r)}else if(u.PropTypes!==void 0&&!ke){ke=!0;var R=D(u);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof u.getDefaultProps=="function"&&!u.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ar(r){{for(var u=Object.keys(r.props),p=0;p<u.length;p++){var S=u[p];if(S!=="children"&&S!=="key"){oe(r),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),oe(null);break}}r.ref!==null&&(oe(r),T("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}}var er={};function rr(r,u,p,S,R,C){{var j=fe(r);if(!j){var w="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(w+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var N=Lr();N?w+=N:w+=Je();var L;r===null?L="null":Le(r)?L="array":r!==void 0&&r.$$typeof===t?(L="<"+(D(r.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):L=typeof r,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",L,w)}var k=Mr(r,u,p,R,C);if(k==null)return k;if(j){var V=u.children;if(V!==void 0)if(S)if(Le(V)){for(var se=0;se<V.length;se++)Ze(V[se],r);Object.freeze&&Object.freeze(V)}else T("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 Ze(V,r)}if(Y.call(u,"key")){var ee=D(r),q=Object.keys(u).filter(function(Fr){return Fr!=="key"}),Ne=q.length>0?"{key: someKey, "+q.join(": ..., ")+": ...}":"{key: someKey}";if(!er[ee+Ne]){var Vr=q.length>0?"{"+q.join(": ..., ")+": ...}":"{}";T(`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} />`,Ne,ee,Vr,ee),er[ee+Ne]=!0}}return r===n?Ar(k):kr(k),k}}function Nr(r,u,p){return rr(r,u,p,!0)}function qr(r,u,p){return rr(r,u,p,!1)}var Dr=qr,Ir=Nr;be.Fragment=n,be.jsx=Dr,be.jsxs=Ir}()),be}var ar;function Wr(){return ar||(ar=1,process.env.NODE_ENV==="production"?Te.exports=zr():Te.exports=Hr()),Te.exports}var v=Wr(),Oe=e=>`--${e}`,ir=e=>`var(--${e})`,ur=(e,t)=>`--${e}: ${t};`;function Ur(e,t){const a=n=>t;return{b:()=>`${a()}-${e}`,be:n=>`${a()}-${e}__${n}`,bm:n=>`${a()}-${e}--${n}`,bem:(n,i)=>`${a()}-${e}__${n}--${i}`,bs:n=>`${a()}-${e}-${n}`,ns:n=>`${a()}-${n}`,cb:()=>`.${a()}-${e}`,cbe:n=>`.${a()}-${e}__${n}`,cbm:n=>`.${a()}-${e}--${n}`,cbem:(n,i)=>`.${a()}-${e}__${n}--${i}`,cbs:n=>`.${a()}-${e}-${n}`,cns:n=>`.${a()}-${n}`,cv:n=>Oe(`${a()}-${e}-${n}`),cvm:(n,i={})=>{const d=a();for(const h of Object.keys(n))i[Oe(`${d}-${e}-${h}`)]=n[h];return i},gcv:n=>ir(`${a()}-${e}-${n}`),scv:(n,i)=>ur(`${a()}-${e}-${n}`,i),nv:n=>Oe(`${a()}-${n}`),nvm:(n,i={})=>{const d=a();for(const h of Object.keys(n))i[Oe(`${d}-${h}`)]=n[h];return i},gnv:n=>ir(`${a()}-${n}`),snv:(n,i)=>ur(`${a()}-${n}`,i)}}function G(e){return f.useMemo(()=>Ur(e,"twist"),[e])}var pr={color:void 0,size:void 0,className:void 0,style:void 0,attrs:void 0},Fe=ce.createContext(pr);Fe.Provider;function ge(e){"@babel/helpers - typeof";return ge=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},ge(e)}var Yr=["attrs","size","title","spin","rotate","color"];function Gr(e,t){return Xr(e)||Jr(e,t)||hr(e,t)||Kr()}function Kr(){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 Jr(e,t){var a=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(a!=null){var n,i,d,h,y=[],s=!0,g=!1;try{if(d=(a=a.call(e)).next,t!==0)for(;!(s=(n=d.call(a)).done)&&(y.push(n.value),y.length!==t);s=!0);}catch(E){g=!0,i=E}finally{try{if(!s&&a.return!=null&&(h=a.return(),Object(h)!==h))return}finally{if(g)throw i}}return y}}function Xr(e){if(Array.isArray(e))return e}function Qr(e,t){var a=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=hr(e))||t){a&&(e=a);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(g){throw g},f:i}}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 d,h=!0,y=!1;return{s:function(){a=a.call(e)},n:function(){var g=a.next();return h=g.done,g},e:function(g){y=!0,d=g},f:function(){try{h||a.return==null||a.return()}finally{if(y)throw d}}}}function hr(e,t){if(e){if(typeof e=="string")return or(e,t);var a={}.toString.call(e).slice(8,-1);return a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set"?Array.from(e):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?or(e,t):void 0}}function or(e,t){(t==null||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a<t;a++)n[a]=e[a];return n}function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Ce.apply(null,arguments)}function sr(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),a.push.apply(a,n)}return a}function Ee(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?sr(Object(a),!0).forEach(function(n){Zr(e,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):sr(Object(a)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))})}return e}function Zr(e,t,a){return(t=et(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function et(e){var t=rt(e,"string");return ge(t)=="symbol"?t:t+""}function rt(e,t){if(ge(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var n=a.call(e,t);if(ge(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tt(e,t){if(e==null)return{};var a,n,i=nt(e,t);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);for(n=0;n<d.length;n++)a=d[n],t.includes(a)||{}.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}function nt(e,t){if(e==null)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;a[n]=e[n]}return a}function at(e){var t=e.attrs,a=e.size,n=e.title,i=e.spin,d=e.rotate,h=e.color,y=tt(e,Yr),s=function(E){var c=a||E.size||"1em",m,x="",_="";return E.className&&(m=E.className),e.className&&(m=m?"".concat(m," ").concat(e.className):e.className),i&&(m?m+=" twist-icon-loading":m="twist-icon-loading"),d&&(x="rotate(".concat(d,"deg)"),_="rotate(".concat(d,"deg)")),ce.createElement("svg",Ce({xmlns:"http://www.w3.org/2000/svg"},E.attrs,t,y,{className:m,style:Ee(Ee({color:h||E.color,msTransform:x,transform:_},E.style),e.style),width:c,height:c}),n&&ce.createElement("title",null,n),e.children)};return Fe!==void 0?ce.createElement(Fe.Consumer,null,function(g){return s(g)}):s(pr)}function it(e){var t={},a=e.split(";"),n=Qr(a),i;try{for(n.s();!(i=n.n()).done;){var d=i.value,h=d.split(":"),y=Gr(h,2),s=y[0],g=y[1];if(s&&g){var E=s.trim().replace(/-./g,function(c){return c.charAt(1).toUpperCase()});t[E]=g.trim()}}}catch(c){n.e(c)}finally{n.f()}return t}function yr(e){return e&&e.map(function(t,a){return ce.createElement(t.tag,Ee(Ee({},t.attrs),{},{key:a,style:t.attrs.style?it(t.attrs.style):null}),yr(t.children))})}function A(e){return function(t){return ce.createElement(at,Ce({attrs:Ee({},e.attrs)},t),yr(e.children))}}function ut(e){return A({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 ot(e){return A({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 st(e){return A({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 lr(e){return A({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 lt(e){return A({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 ct(e){return A({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"}}]})(e)}function ft(e){return A({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 dt(e){return A({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 vt(e){return A({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 mt(e){return A({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 pt(e){return A({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14 19V5h4v14zm-8 0V5h4v14z"}}]})(e)}function ht(e){return A({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 yt(e){return A({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 bt(e){return A({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 gt(e){return A({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 Et(e){return A({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7 15V9h4l5-5v16l-5-5z"}}]})(e)}function xt(e){return A({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 St(e){return A({attrs:{viewBox:"0 0 24 24"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M18.25 12L8.5 17.629V6.37z"}}]})(e)}function qe(e,t){if(!t.current)return 0;let a=(e.clientX-t.current.getBoundingClientRect().left)/t.current.clientWidth;return a=Math.max(a,0),a=Math.min(a,1),a=Math.floor(a*100)/100,a}function De(e,t){if(!t.current)return 0;let a=1-(e.clientY-t.current.getBoundingClientRect().top)/t.current.clientHeight;return a=Math.max(a,0),a=Math.min(a,1),a=Math.floor(a*100)/100,a}function br(e){var t,a,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(a=br(e[t]))&&(n&&(n+=" "),n+=a)}else for(a in e)e[a]&&(n&&(n+=" "),n+=a);return n}function P(){for(var e,t,a=0,n="",i=arguments.length;a<i;a++)(e=arguments[a])&&(t=br(e))&&(n&&(n+=" "),n+=t);return n}function _t({bufferedPercentage:e,playedPercentage:t,onSeek:a}){const n=G("aplayer-bar"),i=G("aplayer-icon"),d=f.useRef(null),[h,y]=f.useState(t),s=f.useRef(!1);f.useEffect(()=>{s.current||y(t)},[t]);const g=f.useCallback(E=>{s.current=!0;const c=qe(E,d);y(c);const m=_=>{const o=qe(_,d);y(o)},x=_=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",x);const o=qe(_,d);y(o),a==null||a(o),s.current=!1};document.addEventListener("mousemove",m),document.addEventListener("mouseup",x)},[a]);return v.jsx("div",{ref:d,className:P(n.b(),n.bs("vars")),onMouseDown:g,role:"slider","aria-label":"Audio progress","aria-valuenow":h?h*100:0,"aria-valuemin":0,"aria-valuemax":100,"aria-live":"polite",children:v.jsxs("div",{className:n.be("inner"),children:[typeof e<"u"?v.jsx("div",{className:n.be("loaded"),style:{width:`${e*100}%`}}):null,typeof h<"u"?v.jsx("div",{className:n.be("played"),style:{width:`${h*100}%`},children:v.jsx("span",{className:n.be("thumb"),children:v.jsx("span",{className:P(i.bs("loading")),children:v.jsx(st,{})})})}):null]})})}function wt({volume:e,muted:t,onToggleMuted:a,onChangeVolume:n}){const i=G("aplayer-volumn"),d=G("aplayer-icon"),h=f.useRef(null),[y,s]=f.useState(!1),g=f.useCallback(E=>{n(De(E,h)),s(!0);const c=x=>{n(De(x,h))},m=x=>{document.removeEventListener("mouseup",m),document.removeEventListener("mousemove",c),s(!1),n(De(x,h))};document.addEventListener("mousemove",c),document.addEventListener("mouseup",m)},[n]);return v.jsxs("div",{className:P(i.b(),i.bs("vars")),children:[v.jsx("button",{type:"button",className:P(d.b(),d.bs("volume-down")),onClick:()=>a(),"aria-label":t||!e?"Muted":"unMuted",children:t||!e?v.jsx(Et,{}):e>=1?v.jsx(xt,{}):v.jsx(gt,{})}),v.jsx("div",{className:P(i.be("bar-wrap"),{[i.bem("bar-wrap","active")]:y}),ref:h,onMouseDown:g,children:v.jsx("div",{className:i.be("bar"),children:v.jsx("div",{className:i.be("thumb"),style:{height:t?0:`${e*100}%`}})})})]})}function cr(e){if(typeof e>"u")return"--:--";if(Number.isNaN(e))return"00:00";const t=h=>h<10?`0${h}`:`${h}`,a=Math.trunc(e/60),n=Math.trunc(e-a*60),i=Math.trunc(a/60),d=Math.trunc(e/60-60*Math.trunc(e/60/60));return e>=3600?`${t(i)}:${t(d)}:${t(n)}`:`${t(a)}:${t(n)}`}function jt({volume:e,onChangeVolume:t,muted:a,currentTime:n,audioDurationSeconds:i,bufferedSeconds:d,onToggleMenu:h,onToggleMuted:y,order:s,onOrderChange:g,loop:E,onLoopChange:c,onSeek:m,isPlaying:x,onTogglePlay:_,onSkipForward:o,onSkipBack:l,showLyrics:b=!0,onToggleLyrics:T}){const O=G("aplayer-controller"),M=G("aplayer-icon"),J=f.useCallback(()=>{const F={list:"random",random:"list"}[s];g(F)},[s,g]),X=f.useCallback(()=>{const F={all:"one",one:"none",none:"all"}[E];c(F)},[E,c]);return v.jsxs("div",{className:P(O.b(),O.bs("vars")),role:"group","aria-label":"Audio Controls",children:[v.jsx(_t,{playedPercentage:typeof n>"u"||typeof i>"u"?void 0:n/i,bufferedPercentage:typeof d>"u"||typeof i>"u"?void 0:d/i,onSeek:F=>m==null?void 0:m(F*i)}),v.jsxs("div",{className:O.be("time"),children:[v.jsxs("span",{className:O.be("time-inner"),"aria-live":"polite",children:[v.jsx("span",{className:O.be("ptime"),children:cr(n)})," / ",v.jsx("span",{className:O.be("dtime"),children:cr(i)})]}),v.jsx("button",{className:P(M.b(),M.bs("back")),onClick:l,type:"button","aria-label":"Previous track",children:v.jsx(ut,{})}),v.jsx("button",{className:P(M.b(),M.bs("play")),onClick:_,type:"button","aria-label":x?"Pause audio":"Play audio",children:x?v.jsx(pt,{}):v.jsx(ht,{})}),v.jsx("button",{className:P(M.b(),M.bs("forward")),onClick:o,type:"button","aria-label":"Next track",children:v.jsx(ot,{})}),v.jsx(wt,{volume:e,muted:a,onToggleMuted:y,onChangeVolume:t}),v.jsx("button",{className:P(M.b(),M.bs("order")),onClick:J,type:"button","aria-label":`Playback order: ${s}`,children:{list:v.jsx(vt,{}),random:v.jsx(dt,{})}[s]}),v.jsx("button",{className:P(M.b(),M.bs("order")),onClick:X,type:"button","aria-label":`Loop mode: ${E}`,children:{all:v.jsx(bt,{}),one:v.jsx(yt,{}),none:v.jsx(ft,{})}[E]}),v.jsx("button",{type:"button",className:P(M.b(),M.bs("menu")),onClick:()=>h==null?void 0:h(),"aria-label":"Toggle playlist menu",children:v.jsx(ct,{})}),v.jsx("button",{type:"button",className:P(M.b(),M.bs("lrc"),{[M.ns("lrc-inactivity")]:!b}),onClick:T,"aria-label":b?"Hide lyrics":"Show lyrics","aria-pressed":b,children:v.jsx(mt,{})})]})]})}function Tt({open:e,audio:t,playingAudioUrl:a,onPlayAudio:n,listMaxHeight:i,isMiniExpanded:d,isSuperMiniExpanded:h}){const y=G("aplayer-list"),s=i?{maxHeight:i}:void 0,g=f.useCallback(c=>c?typeof c=="string"?c:c.name??"Audio artist":"Audio artist",[]),E=f.useRef(null);return f.useEffect(()=>{if(E.current){const c=E.current;return c.style.maxHeight=`${Math.min(c.scrollHeight,i??1/0)}px`,()=>{c.removeAttribute("style")}}},[i,d,h]),v.jsx("div",{ref:E,className:P(y.b(),{[y.bm("hide")]:!e,[y.bs("vars")]:!0}),"aria-label":"Audio playlist","aria-live":"polite",children:v.jsx("ol",{style:s,children:t.map((c,m)=>v.jsxs("li",{className:P({[y.bm("active")]:c.url===a}),onClick:()=>{c.url!==a&&(n==null||n(c))},role:"button","aria-label":`${c.name??"Audio name"} by ${g(c.artist)}}`,children:[v.jsx("span",{className:y.be("cur")}),v.jsx("span",{className:y.be("index"),children:m+1}),v.jsx("span",{className:y.be("title"),children:c.name??"Audio name"}),v.jsx("span",{className:y.be("author"),children:g(c.artist)})]},c.name||m))})})}function fr({show:e,lrcText:t,currentTime:a}){const n=G("aplayer-lrc"),i=f.useMemo(()=>Ot(t),[t]),d=f.useMemo(()=>{for(let y=0;y<i.length;y++){const s=i[y],g=i[y+1];if(a>=s[0]&&(!g||a<g[0]))return y}return 0},[a,i]),h=f.useMemo(()=>({transform:`translateY(${-d*16}px)`,WebkitTransform:`translateY(${-d*16}px)`}),[d]);return v.jsx("div",{className:P(n.b(),{[n.bm("hide")]:!e}),children:t?v.jsx("div",{className:n.be("contents"),style:h,children:i.map(([,y],s)=>v.jsx("p",{className:P({[n.be("current")]:s===d}),children:y},s))}):null})}function Ot(e){if(e){e=e.replace(/([^\]^\n])\[/g,(i,d)=>`${d} [`);const t=e.split(` `),a=[],n=t.length;for(let i=0;i<n;i++){const d=t[i].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g),h=t[i].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/g,"").replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g,"").replace(/^\s+|\s+$/g,"");if(d){const y=d.length;for(let s=0;s<y;s++){const g=/\[(\d{2}):(\d{2})(\.(\d{2,3}))?\]/.exec(d[s]),E=g[1]*60,c=Number.parseInt(g[2]),m=g[4]?Number.parseInt(g[4])/(`${g[4]}`.length===2?100:1e3):0,x=E+c+m;a.push([x,h])}}}return a.sort((i,d)=>i[0]-d[0]),a}else return[]}var Re={exports:{}},Ie={};/** * @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 dr;function Rt(){if(dr)return Ie;dr=1;var e=f;function t(c,m){return c===m&&(c!==0||1/c===1/m)||c!==c&&m!==m}var a=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,d=e.useLayoutEffect,h=e.useDebugValue;function y(c,m){var x=m(),_=n({inst:{value:x,getSnapshot:m}}),o=_[0].inst,l=_[1];return d(function(){o.value=x,o.getSnapshot=m,s(o)&&l({inst:o})},[c,x,m]),i(function(){return s(o)&&l({inst:o}),c(function(){s(o)&&l({inst:o})})},[c]),h(x),x}function s(c){var m=c.getSnapshot;c=c.value;try{var x=m();return!a(c,x)}catch{return!0}}function g(c,m){return m()}var E=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:y;return Ie.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:E,Ie}var Ve={};/** * @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 vr;function Ct(){return vr||(vr=1,process.env.NODE_ENV!=="production"&&function(){function e(x,_){return x===_&&(x!==0||1/x===1/_)||x!==x&&_!==_}function t(x,_){E||i.startTransition===void 0||(E=!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 o=_();if(!c){var l=_();d(o,l)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}l=h({inst:{value:o,getSnapshot:_}});var b=l[0].inst,T=l[1];return s(function(){b.value=o,b.getSnapshot=_,a(b)&&T({inst:b})},[x,o,_]),y(function(){return a(b)&&T({inst:b}),x(function(){a(b)&&T({inst:b})})},[x]),g(o),o}function a(x){var _=x.getSnapshot;x=x.value;try{var o=_();return!d(x,o)}catch{return!0}}function n(x,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=f,d=typeof Object.is=="function"?Object.is:e,h=i.useState,y=i.useEffect,s=i.useLayoutEffect,g=i.useDebugValue,E=!1,c=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Ve.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ve}var mr;function Pt(){return mr||(mr=1,process.env.NODE_ENV==="production"?Re.exports=Rt():Re.exports=Ct()),Re.exports}var re=Pt();const le=[];function Mt(e){const t=f.useRef();return f.useEffect(()=>{if(typeof window<"u"&&!t.current){const a=t.current=document.createElement("audio");typeof(e==null?void 0:e.src)<"u"&&(a.src=e.src),typeof(e==null?void 0:e.autoPlay)<"u"&&(a.autoplay=e.autoPlay),typeof(e==null?void 0:e.initialVolume)<"u"&&(a.volume=e.initialVolume),le.includes(a)||le.push(a)}},[e==null?void 0:e.autoPlay,e==null?void 0:e.initialVolume,e==null?void 0:e.src]),f.useEffect(()=>{if(typeof window>"u")return;const a=t.current;if(a&&(e!=null&&e.onError))return a.addEventListener("error",e.onError),()=>{a.removeEventListener("error",e.onError)}},[e==null?void 0:e.onError]),f.useEffect(()=>{if(typeof window>"u")return;const a=t.current;if(a&&(e!=null&&e.onEnded))return a.addEventListener("ended",e.onEnded),()=>{a.removeEventListener("ended",e.onEnded)}},[e==null?void 0:e.onEnded]),f.useEffect(()=>()=>{const a=t.current;if(a){a.pause(),a.currentTime=0;const n=le.indexOf(a);n!==-1&&le.splice(n,1)}t.current=void 0},[]),t}function Lt(e){const t=Mt(e),a=f.useCallback(o=>{for(let l=0;l<le.length;l++){const b=le[l];b!==o&&!b.paused&&b.pause()}},[]),n=f.useCallback(async o=>{var b;const l=t.current;if(l){e.mutex&&a(l),l.src!==o&&(l.pause(),l.currentTime=0,l.src=o);try{await((b=t.current)==null?void 0:b.play())}catch{}}},[t,e.mutex,a]),i=f.useCallback(o=>{const l=t.current;l&&(l.paused?n(o):l.pause())},[t,n]),d=f.useCallback(o=>{Number.isFinite(o)&&(t.current.currentTime=o)},[t]),h=f.useCallback(()=>{t.current&&(t.current.muted=!t.current.muted)},[t]),y=f.useCallback(o=>{t.current&&(t.current.volume=o)},[t]),s=re.useSyncExternalStore(f.useCallback(o=>{var l;return(l=t.current)==null||l.addEventListener("volumechange",o),()=>{var b;(b=t.current)==null||b.removeEventListener("volumechange",o)}},[t]),()=>{var o;return(o=t.current)==null?void 0:o.volume},()=>{}),g=re.useSyncExternalStore(f.useCallback(o=>{var l;return(l=t.current)==null||l.addEventListener("volumechange",o),()=>{var b;(b=t.current)==null||b.removeEventListener("volumechange",o)}},[t]),()=>{var o;return(o=t.current)==null?void 0:o.muted},()=>{}),E=re.useSyncExternalStore(f.useCallback(o=>{var l;return(l=t.current)==null||l.addEventListener("timeupdate",o),()=>{var b;(b=t.current)==null||b.removeEventListener("timeupdate",o)}},[t]),()=>{if(t.current)return Math.round(t.current.currentTime)},()=>{}),c=re.useSyncExternalStore(f.useCallback(o=>{var l;return(l=t.current)==null||l.addEventListener("durationchange",o),()=>{var b;(b=t.current)==null||b.removeEventListener("durationchange",o)}},[t]),()=>{var o;return(o=t.current)==null?void 0:o.duration},()=>{}),m=re.useSyncExternalStore(f.useCallback(o=>{var l;return(l=t.current)==null||l.addEventListener("progress",o),()=>{var b;(b=t.current)==null||b.removeEventListener("progress",o)}},[t]),()=>{const o=t.current;return o&&o.buffered.length>0?o.buffered.end(o.buffered.length-1):0},()=>{}),x=re.useSyncExternalStore(f.useCallback(o=>{var l,b;return(l=t.current)==null||l.addEventListener("play",o),(b=t.current)==null||b.addEventListener("pause",o),()=>{var T,O;(T=t.current)==null||T.removeEventListener("play",o),(O=t.current)==null||O.removeEventListener("pause",o)}},[t]),()=>{const o=t.current;return o?!o.paused:!1},()=>{}),_=re.useSyncExternalStore(f.useCallback(o=>{var l,b;return(l=t.current)==null||l.addEventListener("playing",o),(b=t.current)==null||b.addEventListener("waiting",o),()=>{var T,O;(T=t.current)==null||T.removeEventListener("playing",o),(O=t.current)==null||O.removeEventListener("waiting",o)}},[t]),()=>{const o=t.current;return o?o.networkState===o.NETWORK_LOADING:!1},()=>{});return{audio:t.current,playAudio:n,togglePlay:i,seek:d,toggleMuted:h,setVolume:y,volume:s,muted:g,currentTime:E,duration:c,bufferedSeconds:m,isPlaying:x,isLoading:_}}function $t(e,t){return f.useMemo(()=>{const a={...t};for(const n in e)e[n]!==void 0&&(a[n]=e[n]);return a},[e,t])}function kt(e){const[t,a]=f.useState(e),[n,i]=f.useState(!1);return f.useEffect(()=>{a(e)},[e]),{mini:t,setMini:a,expanded:n,setExpanded:i,toggleExpanded:()=>i(y=>!y),isMiniCollapsed:t&&!n,isMiniExpanded:t&&n}}function At(e){const[t,a]=f.useState(e),[n,i]=f.useState(!1);return f.useEffect(()=>{a(e)},[e]),{superMini:t,setSuperMini:a,expanded:n,setExpanded:i,toggleExpanded:()=>i(y=>!y),isSuperMiniCollapsed:t&&!n,isSuperMiniExpanded:t&&n}}function gr(){const e=f.useRef([]);return f.useEffect(()=>{const a=e.current;return()=>{for(const n of a)clearTimeout(n)}},[]),f.useCallback((a,n)=>{const i=setTimeout(a,n);return e.current.push(i),i},[])}function Nt(){const e=f.useRef(null),[t,a]=f.useState({text:"",style:{opacity:0}}),n=gr(),i=f.useCallback((d,h=2e3)=>{e.current&&clearTimeout(e.current),a({text:d,style:{opacity:1}}),e.current=n(()=>{a({text:d,style:{opacity:0}})},h)},[n]);return[t,i]}function qt(e){const t=$t(e,{appearance:"normal",volume:.7,autoPlay:!1,listMaxHeight:250,mini:!1,superMini:!1,mutex:!0,listFolded:!1,theme:"light",border:!1}),{audio:a,appearance:n,initialLoop:i,initialOrder:d,volume:h,autoPlay:y,listMaxHeight:s,listFolded:g,mutex:E,theme:c,border:m,mini:x,superMini:_}=t,o=f.useMemo(()=>Array.isArray(a)?a:[a],[a]),l=Vt(o,{initialLoop:i,initialOrder:d}),[b,T]=Nt(),{mini:O,expanded:M,toggleExpanded:J,isMiniCollapsed:X,isMiniExpanded:F}=kt(x),{superMini:Q,expanded:te,toggleExpanded:fe,isSuperMiniCollapsed:de,isSuperMiniExpanded:ne}=At(_),D=!Q&&O,B=Q&&!O,z=gr(),H=f.useRef(null),W=f.useCallback(()=>{H.current&&(clearTimeout(H.current),H.current=null)},[]),$=f.useRef(!1),U=Lt({src:l.currentSong.url,initialVolume:h,autoPlay:y,mutex:E,onError(I){const{error:ie}=I.target;ie&&T("An audio error has occurred, player will skip forward in 2 seconds."),l.hasNextSong&&(H.current=z(()=>{l.next()},2e3))},onEnded(){const{list:I,currentSong:ie,loop:_e,prioritize:we,hasNextSong:ue}=l,{audio:Y}=U;if(_e==="one"){we({...ie});return}if(!ue&&_e==="none"){$.current=!0,Y.currentTime=0,Y.pause(),Y.src=I[0].url,we(I[0]);return}l.next()}}),ve=l.length>1,xe=f.useCallback(()=>{W(),U.togglePlay(l.currentSong.url)},[U,W,l.currentSong.url]),{prioritize:me}=l,Se=f.useCallback(I=>{W(),me(I)},[W,me]),[Pe,Me]=f.useState(()=>ve&&!g),[pe,he]=f.useState(n!=="fixed"),K=f.useRef(null);f.useEffect(()=>{y&&U.playAudio(l.currentSong.url)},[]);const ae=f.useRef(!0),Z=f.useRef(l.currentSong);return f.useEffect(()=>{if(ae.current){ae.current=!1;return}if($.current){$.current=!1;return}l.currentSong&&(l.loop==="one"||l.currentSong!==Z.current)&&(Z.current=l.currentSong,U.playAudio(l.currentSong.url))},[l.currentSong]),f.useEffect(()=>{if(n==="fixed"&&K.current){const I=K.current;return I.style.width="calc(100% - 18px)",I.style.maxWidth="382px",()=>{I.removeAttribute("style")}}},[n]),{bodyRef:K,appearance:n,volume:h,listMaxHeight:s,theme:c,border:m,notice:b,audioControl:U,audio:o,handlePlayButtonClick:xe,handlePlayAudioFromList:Se,isPlaylistOpen:Pe,setPlaylistOpen:Me,mini:O,displayLyrics:pe,setDisplayLyrics:he,playlist:l,hasPlaylist:ve,superMini:Q,showSuperMini:B,superMiniExpanded:te,toggleSuperMiniExpanded:fe,isSuperMiniCollapsed:de,isSuperMiniExpanded:ne,showMini:D,miniExpanded:M,toggleMiniExpanded:J,isMiniCollapsed:X,isMiniExpanded:F}}function Dt(e){return It(e.slice())}function It(e){let t=e.length,a;for(;t!==0;)a=Math.floor(Math.random()*t),t--,[e[t],e[a]]=[e[a],e[t]];return e}function Vt(e,t){const{initialLoop:a="all",initialOrder:n="list"}=t,[i,d]=f.useState(a),[h,y]=f.useState(n),s=f.useMemo(()=>h==="list"?e:Dt(e),[e,h]),[g,E]=f.useState(s[0]),c=f.useCallback(l=>l.url,[]),m=f.useMemo(()=>s.findIndex(b=>c(b)===c(g))<s.length-1||i!=="none",[s,g,i,c]),x=f.useCallback(()=>{E(l=>{const b=s.findIndex(T=>c(T)===c(l));return b<s.length-1?s[b+1]:{...s[0]}})},[i,s,c]),_=f.useCallback(()=>{E(l=>{const b=s.indexOf(l);return b>0?s[b-1]:l})},[s]),o=f.useCallback(l=>{E(l)},[]);return f.useEffect(()=>{const l=s.find(b=>c(b)===c(g));E(l||s[0])},[s,c,g]),{list:s,currentSong:g,hasNextSong:m,next:x,previous:_,prioritize:o,order:h,setOrder:y,loop:i,setLoop:d,length:s.length}}function Ft(e){var z,H,W;const{className:t,style:a}=e,n=G("aplayer"),{bodyRef:i,appearance:d,volume:h,listMaxHeight:y,theme:s,border:g,notice:E,audio:c,audioControl:m,handlePlayButtonClick:x,handlePlayAudioFromList:_,isPlaylistOpen:o,setPlaylistOpen:l,displayLyrics:b,setDisplayLyrics:T,playlist:O,hasPlaylist:M,showSuperMini:J,superMiniExpanded:X,toggleSuperMiniExpanded:F,isSuperMiniCollapsed:Q,isSuperMiniExpanded:te,showMini:fe,toggleMiniExpanded:de,isMiniCollapsed:ne,isMiniExpanded:D}=qt(e),B=f.useCallback($=>$?typeof $=="string"?$:$.url?v.jsx("a",{href:$.url,target:"_blank",rel:"noreferrer",children:$.name??"Audio artist"}):$.name??"Audio artist":"Audio artist",[]);return v.jsxs("div",{className:P(n.b(),{[n.bs(s)]:!0,[n.bs("vars")]:!0,[n.bm(d)]:!0,[n.bm("loading")]:m.isLoading,[n.bm("withlist")]:M,[n.bm("list-expanded")]:o,[n.bm("list-collapsed")]:!o,[n.bm("withlrc")]:!!O.currentSong.lrc&&d!=="fixed",[n.bm("border")]:g,[n.bm("mini")]:fe,[n.bm("mini-collapsed")]:ne,[n.bm("mini-expanded")]:D,[n.bm("super-mini")]:J,[n.bm("super-mini-collapsed")]:Q,[n.bm("super-mini-expanded")]:te},t),style:a,role:"region","aria-label":"Audio Player",children:[v.jsxs("div",{ref:i,className:n.be("body"),children:[v.jsx("div",{className:n.be("pic"),onClick:x,style:{backgroundImage:`url("${(z=O.currentSong)==null?void 0:z.cover}")`},role:"button","aria-label":m.isPlaying?"Pause audio":"Play audio",children:v.jsx("div",{className:P(n.be("button"),m.isPlaying?n.bm("pause"):n.bm("play")),role:"presentation",children:m.isPlaying?v.jsx(lt,{}):v.jsx(St,{})})}),v.jsxs("div",{className:P(n.be("info")),children:[v.jsxs("div",{className:P(n.be("music")),children:[v.jsx("span",{className:P(n.be("title")),children:((H=O.currentSong)==null?void 0:H.name)??"Audio name"}),v.jsxs("span",{className:P(n.be("author")),children:[" ","-"," ",B((W=O.currentSong)==null?void 0:W.artist)]})]}),d!=="fixed"?v.jsx(fr,{show:b,lrcText:O.currentSong.lrc,currentTime:m.currentTime??0}):null,v.jsx(jt,{volume:m.volume??h,onChangeVolume:m.setVolume,muted:m.muted??!1,onToggleMuted:()=>m.toggleMuted(),currentTime:m.currentTime,audioDurationSeconds:m.duration,bufferedSeconds:m.bufferedSeconds,onSeek:$=>m.seek($),onToggleMenu:()=>l($=>!$),order:O.order,onOrderChange:O.setOrder,loop:O.loop,onLoopChange:O.setLoop,isPlaying:m.isPlaying??!1,onTogglePlay:x,onSkipForward:()=>{O.hasNextSong&&O.next()},onSkipBack:()=>{O.previous()},showLyrics:b,onToggleLyrics:()=>{T($=>!$)}})]}),v.jsx("div",{className:n.be("notice"),style:E.style,children:E.text}),v.jsx("div",{className:n.be("miniswitcher"),onClick:de,children:v.jsx("button",{className:P(n.bs("icon"),n.bs("icon-right")),type:"button",children:v.jsx(lr,{})})}),v.jsx("div",{className:n.be("super-miniswitcher"),onClick:F,children:v.jsx("button",{className:P(n.bs("icon"),n.bs("icon-right")),type:"button",children:v.jsx(lr,{})})})]}),M?v.jsx(Tt,{open:o,audio:c,playingAudioUrl:O.currentSong.url,onPlayAudio:_,listMaxHeight:y,isMiniExpanded:D,isSuperMiniExpanded:X}):null,d==="fixed"?v.jsx(fr,{show:b,lrcText:O.currentSong.lrc,currentTime:m.currentTime??0}):null]})}exports.TwistAPlayer=Ft;