UNPKG

twist-aplayer

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