ecplayer 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/dist/ecplayer.es.js +937 -1562
- package/dist/ecplayer.umd.js +40 -69
- package/package.json +5 -4
- package/media/nanoaudioplayer.png +0 -0
- package/media/videoplayer.png +0 -0
- package/media/visualizeplayer.png +0 -0
- package/media/waveaudioplayer.png +0 -0
package/dist/ecplayer.umd.js
CHANGED
|
@@ -1,116 +1,87 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var at;function ht(){if(at)return $e;at=1;var c=n,d=Symbol.for("react.element"),p=Symbol.for("react.fragment"),h=Object.prototype.hasOwnProperty,P=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m={key:!0,ref:!0,__self:!0,__source:!0};function k(b,N,_){var M,O={},A=null,V=null;_!==void 0&&(A=""+_),N.key!==void 0&&(A=""+N.key),N.ref!==void 0&&(V=N.ref);for(M in N)h.call(N,M)&&!m.hasOwnProperty(M)&&(O[M]=N[M]);if(b&&b.defaultProps)for(M in N=b.defaultProps,N)O[M]===void 0&&(O[M]=N[M]);return{$$typeof:d,type:b,key:A,ref:V,props:O,_owner:P.current}}return $e.Fragment=p,$e.jsx=k,$e.jsxs=k,$e}var Ge={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var st;function yt(){return st||(st=1,process.env.NODE_ENV!=="production"&&function(){var c=n,d=Symbol.for("react.element"),p=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),b=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),U=Symbol.iterator,Y="@@iterator";function K(t){if(t===null||typeof t!="object")return null;var a=U&&t[U]||t[Y];return typeof a=="function"?a:null}var E=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(t){{for(var a=arguments.length,u=new Array(a>1?a-1:0),y=1;y<a;y++)u[y-1]=arguments[y];je("error",t,u)}}function je(t,a,u){{var y=E.ReactDebugCurrentFrame,D=y.getStackAddendum();D!==""&&(a+="%s",u=u.concat([D]));var W=u.map(function(F){return String(F)});W.unshift("Warning: "+a),Function.prototype.apply.call(console[t],console,W)}}var pe=!1,Ee=!1,ne=!1,oe=!1,he=!1,me;me=Symbol.for("react.module.reference");function J(t){return!!(typeof t=="string"||typeof t=="function"||t===h||t===m||he||t===P||t===_||t===M||oe||t===V||pe||Ee||ne||typeof t=="object"&&t!==null&&(t.$$typeof===A||t.$$typeof===O||t.$$typeof===k||t.$$typeof===b||t.$$typeof===N||t.$$typeof===me||t.getModuleId!==void 0))}function we(t,a,u){var y=t.displayName;if(y)return y;var D=a.displayName||a.name||"";return D!==""?u+"("+D+")":u}function H(t){return t.displayName||"Context"}function L(t){if(t==null)return null;if(typeof t.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case h:return"Fragment";case p:return"Portal";case m:return"Profiler";case P:return"StrictMode";case _:return"Suspense";case M:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case b:var a=t;return H(a)+".Consumer";case k:var u=t;return H(u._context)+".Provider";case N:return we(t,t.render,"ForwardRef");case O:var y=t.displayName||null;return y!==null?y:L(t.type)||"Memo";case A:{var D=t,W=D._payload,F=D._init;try{return L(F(W))}catch{return null}}}return null}var z=Object.assign,ue=0,ye,ie,ae,C,x,B,se;function ke(){}ke.__reactDisabledLog=!0;function X(){{if(ue===0){ye=console.log,ie=console.info,ae=console.warn,C=console.error,x=console.group,B=console.groupCollapsed,se=console.groupEnd;var t={configurable:!0,enumerable:!0,value:ke,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}ue++}}function de(){{if(ue--,ue===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},t,{value:ye}),info:z({},t,{value:ie}),warn:z({},t,{value:ae}),error:z({},t,{value:C}),group:z({},t,{value:x}),groupCollapsed:z({},t,{value:B}),groupEnd:z({},t,{value:se})})}ue<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=E.ReactCurrentDispatcher,S;function le(t,a,u){{if(S===void 0)try{throw Error()}catch(D){var y=D.stack.trim().match(/\n( *(at )?)/);S=y&&y[1]||""}return`
|
|
18
|
-
`+S+t}}var re=!1,l;{var g=typeof WeakMap=="function"?WeakMap:Map;l=new g}function R(t,a){if(!t||re)return"";{var u=l.get(t);if(u!==void 0)return u}var y;re=!0;var D=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var W;W=te.current,te.current=null,X();try{if(a){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(xe){y=xe}Reflect.construct(t,[],F)}else{try{F.call()}catch(xe){y=xe}t.call(F.prototype)}}else{try{throw Error()}catch(xe){y=xe}t()}}catch(xe){if(xe&&y&&typeof xe.stack=="string"){for(var T=xe.stack.split(`
|
|
19
|
-
`),fe=y.stack.split(`
|
|
20
|
-
`),Z=T.length-1,ee=fe.length-1;Z>=1&&ee>=0&&T[Z]!==fe[ee];)ee--;for(;Z>=1&&ee>=0;Z--,ee--)if(T[Z]!==fe[ee]){if(Z!==1||ee!==1)do if(Z--,ee--,ee<0||T[Z]!==fe[ee]){var ve=`
|
|
21
|
-
`+T[Z].replace(" at new "," at ");return t.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",t.displayName)),typeof t=="function"&&l.set(t,ve),ve}while(Z>=1&&ee>=0);break}}}finally{re=!1,te.current=W,de(),Error.prepareStackTrace=D}var Ke=t?t.displayName||t.name:"",He=Ke?le(Ke):"";return typeof t=="function"&&l.set(t,He),He}function $(t,a,u){return R(t,!1)}function G(t){var a=t.prototype;return!!(a&&a.isReactComponent)}function q(t,a,u){if(t==null)return"";if(typeof t=="function")return R(t,G(t));if(typeof t=="string")return le(t);switch(t){case _:return le("Suspense");case M:return le("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case N:return $(t.render);case O:return q(t.type,a,u);case A:{var y=t,D=y._payload,W=y._init;try{return q(W(D),a,u)}catch{}}}return""}var f=Object.prototype.hasOwnProperty,j={},be=E.ReactDebugCurrentFrame;function Pe(t){if(t){var a=t._owner,u=q(t.type,t._source,a?a.type:null);be.setExtraStackFrame(u)}else be.setExtraStackFrame(null)}function Le(t,a,u,y,D){{var W=Function.call.bind(f);for(var F in t)if(W(t,F)){var T=void 0;try{if(typeof t[F]!="function"){var fe=Error((y||"React class")+": "+u+" type `"+F+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[F]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw fe.name="Invariant Violation",fe}T=t[F](a,F,y,u,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Z){T=Z}T&&!(T instanceof Error)&&(Pe(D),v("%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).",y||"React class",u,F,typeof T),Pe(null)),T instanceof Error&&!(T.message in j)&&(j[T.message]=!0,Pe(D),v("Failed %s type: %s",u,T.message),Pe(null))}}}var Re=Array.isArray;function Ae(t){return Re(t)}function Ce(t){{var a=typeof Symbol=="function"&&Symbol.toStringTag,u=a&&t[Symbol.toStringTag]||t.constructor.name||"Object";return u}}function We(t){try{return Me(t),!1}catch{return!0}}function Me(t){return""+t}function Oe(t){if(We(t))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ce(t)),Me(t)}var ze=E.ReactCurrentOwner,Ve={key:!0,ref:!0,__self:!0,__source:!0},Ue,Ye;function Ie(t){if(f.call(t,"ref")){var a=Object.getOwnPropertyDescriptor(t,"ref").get;if(a&&a.isReactWarning)return!1}return t.ref!==void 0}function Je(t){if(f.call(t,"key")){var a=Object.getOwnPropertyDescriptor(t,"key").get;if(a&&a.isReactWarning)return!1}return t.key!==void 0}function Fe(t,a){typeof t.ref=="string"&&ze.current}function Se(t,a){{var u=function(){Ue||(Ue=!0,v("%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)",a))};u.isReactWarning=!0,Object.defineProperty(t,"key",{get:u,configurable:!0})}}function De(t,a){{var u=function(){Ye||(Ye=!0,v("%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)",a))};u.isReactWarning=!0,Object.defineProperty(t,"ref",{get:u,configurable:!0})}}var r=function(t,a,u,y,D,W,F){var T={$$typeof:d,type:t,key:a,ref:u,props:F,_owner:W};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:y}),Object.defineProperty(T,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T};function s(t,a,u,y,D){{var W,F={},T=null,fe=null;u!==void 0&&(Oe(u),T=""+u),Je(a)&&(Oe(a.key),T=""+a.key),Ie(a)&&(fe=a.ref,Fe(a,D));for(W in a)f.call(a,W)&&!Ve.hasOwnProperty(W)&&(F[W]=a[W]);if(t&&t.defaultProps){var Z=t.defaultProps;for(W in Z)F[W]===void 0&&(F[W]=Z[W])}if(T||fe){var ee=typeof t=="function"?t.displayName||t.name||"Unknown":t;T&&Se(F,ee),fe&&De(F,ee)}return r(t,T,fe,D,y,ze.current,F)}}var o=E.ReactCurrentOwner,i=E.ReactDebugCurrentFrame;function w(t){if(t){var a=t._owner,u=q(t.type,t._source,a?a.type:null);i.setExtraStackFrame(u)}else i.setExtraStackFrame(null)}var I;I=!1;function ce(t){return typeof t=="object"&&t!==null&&t.$$typeof===d}function Te(){{if(o.current){var t=L(o.current.type);if(t)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+t+"`."}return""}}function Be(t){return""}var Q={};function Xe(t){{var a=Te();if(!a){var u=typeof t=="string"?t:t.displayName||t.name;u&&(a=`
|
|
24
|
-
|
|
25
|
-
Check the top-level render call using <`+u+">.")}return a}}function xt(t,a){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var u=Xe(a);if(Q[u])return;Q[u]=!0;var y="";t&&t._owner&&t._owner!==o.current&&(y=" It was passed a child from "+L(t._owner.type)+"."),w(t),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',u,y),w(null)}}function gt(t,a){{if(typeof t!="object")return;if(Ae(t))for(var u=0;u<t.length;u++){var y=t[u];ce(y)&&xt(y,a)}else if(ce(t))t._store&&(t._store.validated=!0);else if(t){var D=K(t);if(typeof D=="function"&&D!==t.entries)for(var W=D.call(t),F;!(F=W.next()).done;)ce(F.value)&&xt(F.value,a)}}}function _t(t){{var a=t.type;if(a==null||typeof a=="string")return;var u;if(typeof a=="function")u=a.propTypes;else if(typeof a=="object"&&(a.$$typeof===N||a.$$typeof===O))u=a.propTypes;else return;if(u){var y=L(a);Le(u,t.props,"prop",y,t)}else if(a.PropTypes!==void 0&&!I){I=!0;var D=L(a);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof a.getDefaultProps=="function"&&!a.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Pt(t){{for(var a=Object.keys(t.props),u=0;u<a.length;u++){var y=a[u];if(y!=="children"&&y!=="key"){w(t),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",y),w(null);break}}t.ref!==null&&(w(t),v("Invalid attribute `ref` supplied to `React.Fragment`."),w(null))}}var pt={};function mt(t,a,u,y,D,W){{var F=J(t);if(!F){var T="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).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 fe=Be();fe?T+=fe:T+=Te();var Z;t===null?Z="null":Ae(t)?Z="array":t!==void 0&&t.$$typeof===d?(Z="<"+(L(t.type)||"Unknown")+" />",T=" Did you accidentally export a JSX literal instead of a component?"):Z=typeof t,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Z,T)}var ee=s(t,a,u,D,W);if(ee==null)return ee;if(F){var ve=a.children;if(ve!==void 0)if(y)if(Ae(ve)){for(var Ke=0;Ke<ve.length;Ke++)gt(ve[Ke],t);Object.freeze&&Object.freeze(ve)}else v("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 gt(ve,t)}if(f.call(a,"key")){var He=L(t),xe=Object.keys(a).filter(function(zt){return zt!=="key"}),nt=xe.length>0?"{key: someKey, "+xe.join(": ..., ")+": ...}":"{key: someKey}";if(!pt[He+nt]){var Ot=xe.length>0?"{"+xe.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
-
let props = %s;
|
|
27
|
-
<%s {...props} />
|
|
28
|
-
React keys must be passed directly to JSX without using spread:
|
|
29
|
-
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,nt,He,Ot,He),pt[He+nt]=!0}}return t===h?Pt(ee):_t(ee),ee}}function At(t,a,u){return mt(t,a,u,!0)}function Ft(t,a,u){return mt(t,a,u,!1)}var Lt=Ft,Mt=At;Ge.Fragment=h,Ge.jsx=Lt,Ge.jsxs=Mt}()),Ge}process.env.NODE_ENV==="production"?et.exports=ht():et.exports=yt();var e=et.exports;/**
|
|
1
|
+
(function(J,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],e):(J=typeof globalThis<"u"?globalThis:J||self,e(J.EcPlayer={},J.ReactJSXRuntime,J.React))})(this,function(J,e,r){"use strict";/**
|
|
31
2
|
* @license lucide-react v0.540.0 - ISC
|
|
32
3
|
*
|
|
33
4
|
* This source code is licensed under the ISC license.
|
|
34
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/const
|
|
6
|
+
*/const Qe=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ge=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,f,p)=>p?p.toUpperCase():f.toLowerCase()),Ie=o=>{const c=Ge(o);return c.charAt(0).toUpperCase()+c.slice(1)},He=(...o)=>o.filter((c,f,p)=>!!c&&c.trim()!==""&&p.indexOf(c)===f).join(" ").trim(),Ke=o=>{for(const c in o)if(c.startsWith("aria-")||c==="role"||c==="title")return!0};/**
|
|
36
7
|
* @license lucide-react v0.540.0 - ISC
|
|
37
8
|
*
|
|
38
9
|
* This source code is licensed under the ISC license.
|
|
39
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/var
|
|
11
|
+
*/var Xe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
41
12
|
* @license lucide-react v0.540.0 - ISC
|
|
42
13
|
*
|
|
43
14
|
* This source code is licensed under the ISC license.
|
|
44
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/const
|
|
16
|
+
*/const Ze=r.forwardRef(({color:o="currentColor",size:c=24,strokeWidth:f=2,absoluteStrokeWidth:p,className:N="",children:g,iconNode:b,...x},q)=>r.createElement("svg",{ref:q,...Xe,width:c,height:c,stroke:o,strokeWidth:p?Number(f)*24/Number(c):f,className:He("lucide",N),...!g&&!Ke(x)&&{"aria-hidden":"true"},...x},[...b.map(([E,O])=>r.createElement(E,O)),...Array.isArray(g)?g:[g]]));/**
|
|
46
17
|
* @license lucide-react v0.540.0 - ISC
|
|
47
18
|
*
|
|
48
19
|
* This source code is licensed under the ISC license.
|
|
49
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/const
|
|
21
|
+
*/const ae=(o,c)=>{const f=r.forwardRef(({className:p,...N},g)=>r.createElement(Ze,{ref:g,iconNode:c,className:He(`lucide-${Qe(Ie(o))}`,`lucide-${o}`,p),...N}));return f.displayName=Ie(o),f};/**
|
|
51
22
|
* @license lucide-react v0.540.0 - ISC
|
|
52
23
|
*
|
|
53
24
|
* This source code is licensed under the ISC license.
|
|
54
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const
|
|
26
|
+
*/const Je=ae("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
|
|
56
27
|
* @license lucide-react v0.540.0 - ISC
|
|
57
28
|
*
|
|
58
29
|
* This source code is licensed under the ISC license.
|
|
59
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/const
|
|
31
|
+
*/const Ye=ae("minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/**
|
|
61
32
|
* @license lucide-react v0.540.0 - ISC
|
|
62
33
|
*
|
|
63
34
|
* This source code is licensed under the ISC license.
|
|
64
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const
|
|
36
|
+
*/const $e=ae("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);/**
|
|
66
37
|
* @license lucide-react v0.540.0 - ISC
|
|
67
38
|
*
|
|
68
39
|
* This source code is licensed under the ISC license.
|
|
69
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const
|
|
41
|
+
*/const Ee=ae("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);/**
|
|
71
42
|
* @license lucide-react v0.540.0 - ISC
|
|
72
43
|
*
|
|
73
44
|
* This source code is licensed under the ISC license.
|
|
74
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const
|
|
46
|
+
*/const Re=ae("repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
|
|
76
47
|
* @license lucide-react v0.540.0 - ISC
|
|
77
48
|
*
|
|
78
49
|
* This source code is licensed under the ISC license.
|
|
79
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const
|
|
51
|
+
*/const Ce=ae("sliders-vertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
|
|
81
52
|
* @license lucide-react v0.540.0 - ISC
|
|
82
53
|
*
|
|
83
54
|
* This source code is licensed under the ISC license.
|
|
84
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const
|
|
56
|
+
*/const De=ae("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
86
57
|
* @license lucide-react v0.540.0 - ISC
|
|
87
58
|
*
|
|
88
59
|
* This source code is licensed under the ISC license.
|
|
89
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const
|
|
61
|
+
*/const et=ae("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);/**
|
|
91
62
|
* @license lucide-react v0.540.0 - ISC
|
|
92
63
|
*
|
|
93
64
|
* This source code is licensed under the ISC license.
|
|
94
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const
|
|
66
|
+
*/const Ae=ae("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
|
96
67
|
* @license lucide-react v0.540.0 - ISC
|
|
97
68
|
*
|
|
98
69
|
* This source code is licensed under the ISC license.
|
|
99
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const rt=Ne("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),_e={rainbow:{name:"Rainbow",bg:"linear-gradient(135deg, #ef444422 0%, #f9731622 15%, #f59e0b22 30%, #10b98122 45%, #06b6d422 60%, #3b82f622 75%, #6366f122 85%, #a855f722 92%, #ec489922 100%)",bars:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e"],peak:"#a0a0a0ff",button:"#ec4899",buttonHover:"#d946ef",slider:"#ec4899"},ocean:{name:"Ocean Blue",bg:"linear-gradient(135deg, #667eea43 0%, #764ba243 100%)",bars:["#0ea5e9","#38bdf8","#06b6d4","#22d3ee"],peak:"#0369a1",button:"#0ea5e9",buttonHover:"#0284c7",slider:"#0ea5e9"},sunset:{name:"Sunset",bg:"linear-gradient(135deg, #f093fb43 0%, #f5576c43 100%)",bars:["#f43f5e","#fb7185","#fda4af","#fecdd3"],peak:"#be123c",button:"#f43f5e",buttonHover:"#e11d48",slider:"#f43f5e"},forest:{name:"Forest Green",bg:"linear-gradient(135deg, #0ba36043 0%, #3cba9243 100%)",bars:["#10b981","#34d399","#6ee7b7","#a7f3d0"],peak:"#047857",button:"#10b981",buttonHover:"#059669",slider:"#10b981"},midnight:{name:"Midnight",bg:"linear-gradient(135deg, #2c3e5043 0%, #3498db43 100%)",bars:["#3b82f6","#60a5fa","#93c5fd","#bfdbfe"],peak:"#1e40af",button:"#3b82f6",buttonHover:"#2563eb",slider:"#3b82f6"},neon:{name:"Neon Cyan",bg:"linear-gradient(135deg, #13547a43 0%, #80d0c743 100%)",bars:["#06b6d4","#22d3ee","#67e8f9","#a5f3fc"],peak:"#0e7490",button:"#06b6d4",buttonHover:"#0891b2",slider:"#06b6d4"},purple:{name:"Royal Purple",bg:"linear-gradient(135deg, #2f1c5622 0%, #764ba243 100%)",bars:["#8b5cf6","#a78bfa","#baabf9ff","#ddd6fe"],peak:"#6d28d9",button:"#8b5cf6",buttonHover:"#7c3aed",slider:"#8b5cf6"},amber:{name:"Amber Gold",bg:"linear-gradient(135deg, #f59e0b43 0%, #d9770643 100%)",bars:["#f59e0b","#fbbf24","#fcd34d","#fde68a"],peak:"#b45309",button:"#f59e0b",buttonHover:"#d97706",slider:"#f59e0b"},rose:{name:"Rose Pink",bg:"linear-gradient(135deg, #ec489943 0%, #be185d43 100%)",bars:["#ec4899","#f472b6","#f9a8d4","#fbcfe8"],peak:"#9f1239",button:"#ec4899",buttonHover:"#db2777",slider:"#ec4899"}};function ct({theme:c,setTheme:d,close:p}){const h=Object.keys(_e).map(P=>({key:P,name:_e[P].name,colors:_e[P].bars}));return e.jsxs("div",{className:"container-glass rounded-xl p-6 mb-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-800",children:"Choose Color Palette"}),e.jsx("button",{onClick:()=>p(),className:"text-gray-500 hover:text-gray-700 text-sm font-medium",children:"Close"})]}),e.jsx("div",{className:"theme-selector grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:h.map(P=>e.jsxs("div",{className:`theme-card bg-white p-4 rounded-lg cursor-pointer border-2 transition-all ${c===P.key?"border-current shadow-lg":"border-transparent"}`,onClick:()=>d(P.key),children:[e.jsx("div",{className:"color-preview h-10 rounded mb-2",style:{background:`linear-gradient(to right, ${P.colors.join(", ")})`}}),e.jsx("div",{className:"text-sm font-medium text-gray-700",children:P.name})]},P.key))})]})}function ut({audio:c,name:d="No track loaded",author:p,theme:h="rainbow",volume:P=100,thumbnail:m=null,controls:k={play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,loop:!0,trackName:!0,equalizer:!0,speed:!0},mode:b="light",bands:N=null,transparent:_=!1,autoPlay:M=!1,equalizer:O={bass:0,mid:0,treble:0}}){const[A,V]=n.useState(!1),[U,Y]=n.useState(0),[K,E]=n.useState(0),[v,je]=n.useState(P||100),[pe,Ee]=n.useState(!1),[ne,oe]=n.useState(!1),[he,me]=n.useState(!1),[J,we]=n.useState([]),[H,L]=n.useState(!1),[z,ue]=n.useState({bass:O.bass||0,mid:O.mid||0,treble:O.treble||0}),[ye,ie]=n.useState(1),[ae,C]=n.useState(0),x=n.useRef(null),B=n.useRef(null),se=n.useRef(null),ke=n.useRef(null),X=n.useRef(null),de=n.useRef(null),te=n.useRef(null),S=n.useRef(null),le=n.useRef(null),re=n.useRef(null);n.useEffect(()=>{const r=re.current;if(!r)return;const s=new ResizeObserver(o=>{for(let i of o)C(i.contentRect.width)});return s.observe(r),()=>s.disconnect()},[]),n.useEffect(()=>{const r=[];if(c&&typeof c!="string"&&r.push(["TypeError","audio must be a string (URL or path)"]),d&&typeof d!="string"&&r.push(["TypeError","name must be a string"]),h&&typeof h!="string"&&typeof h!="object")r.push(["TypeError","theme must be a string or a valid theme object"]);else if(typeof h=="object"){const s=["name","bg","bars","peak","button","buttonHover","slider"];for(const o of s)o in h||r.push(["ThemeError",`theme object missing key: ${o}`])}(typeof P!="number"||P<0||P>100)&&r.push(["TypeError","volume must be a number between 0 and 100"]),typeof k!="object"||Array.isArray(k)?r.push(["TypeError","controls must be an object"]):["play","pause","stop","seekbar","volume","loop","trackName","equalizer"].forEach(o=>{k&&o in k&&typeof k[o]!="boolean"&&r.push(["TypeError",`controls.${o} must be a boolean`])}),N&&(Array.isArray(N)?N.length===0?r.push(["ValueError","bands array cannot be empty"]):N.forEach((s,o)=>{typeof s.freq!="number"&&r.push(["TypeError",`bands[${o}].freq must be a number`])}):r.push(["TypeError","bands must be an array"])),r.length>0?(we(r),console.group("%cVisualizePlayer: Prop validation failed","color:red"),r.forEach(s=>console.error(`${s[0]}: ${s[1]}`)),console.groupEnd()):we([])},[c,d,h,P,k,b,N]);const l=N||[{freq:0},{freq:10},{freq:20},{freq:25},{freq:31.5},{freq:40},{freq:50},{freq:63},{freq:80},{freq:100},{freq:125},{freq:160},{freq:200},{freq:250},{freq:315},{freq:400},{freq:500},{freq:630},{freq:800},{freq:1e3},{freq:1250},{freq:1600},{freq:2e3},{freq:2500},{freq:3150},{freq:4e3},{freq:5e3},{freq:6300},{freq:8e3},{freq:1e4},{freq:12500}],g=n.useRef(l.map(()=>0)),R=n.useRef(l.map(()=>0)),$=n.useRef(l.map(()=>0)),G=n.useRef(!1),q=n.useRef(typeof h=="string"?h:"purple");let f=typeof h=="string"?_e[h]||_e.purple:typeof h=="object"?h:_e.purple;const j=b==="dark",be=typeof k=="object"&&Object.keys(k).length===0;n.useEffect(()=>{typeof h=="string"?q.current=h:q.current="purple",Ce()},[h]),n.useEffect(()=>{x.current||(x.current=new Audio);const r=x.current,s=()=>{he||Y(r.currentTime)},o=()=>{E(r.duration)},i=()=>{ne||(V(!1),S.current&&cancelAnimationFrame(S.current))},w=()=>V(!0),I=()=>V(!1);return r.addEventListener("timeupdate",s),r.addEventListener("loadedmetadata",o),r.addEventListener("ended",i),r.addEventListener("play",w),r.addEventListener("pause",I),()=>{r.removeEventListener("timeupdate",s),r.removeEventListener("loadedmetadata",o),r.removeEventListener("ended",i),r.removeEventListener("play",w),r.removeEventListener("pause",I)}},[he,ne]),n.useEffect(()=>()=>{x.current&&(x.current.pause(),x.current.src="",x.current.load()),B.current&&B.current.close().catch(r=>console.warn("AudioContext cleanup error:",r)),S.current&&cancelAnimationFrame(S.current)},[]),n.useEffect(()=>{if(c){const r=A,s=v,o=ne;if(S.current&&(cancelAnimationFrame(S.current),S.current=null),ke.current){try{ke.current.disconnect()}catch(Q){console.warn("Source disconnect error:",Q)}ke.current=null}if(se.current){try{se.current.disconnect()}catch(Q){console.warn("Analyser disconnect error:",Q)}se.current=null}if(X.current){try{X.current.disconnect()}catch(Q){console.warn("Bass filter disconnect error:",Q)}X.current=null}if(de.current){try{de.current.disconnect()}catch(Q){console.warn("Mid filter disconnect error:",Q)}de.current=null}if(te.current){try{te.current.disconnect()}catch(Q){console.warn("Treble filter disconnect error:",Q)}te.current=null}B.current&&(B.current.close().catch(Q=>console.warn("AudioContext close error:",Q)),B.current=null),x.current&&(x.current.pause(),x.current.src="",x.current.load()),x.current=new Audio;try{x.current.crossOrigin="anonymous"}catch(Q){console.debug("Could not set crossOrigin on audio element",Q)}x.current.src=c,x.current.preload="auto",x.current.muted=!1,x.current.volume=pe?0:s/100,x.current.loop=o,x.current.load();const i=x.current,w=()=>{he||Y(i.currentTime)},I=()=>{E(i.duration)},ce=()=>{ne||(V(!1),S.current&&cancelAnimationFrame(S.current))},Te=()=>V(!0),Be=()=>V(!1);i.addEventListener("timeupdate",w),i.addEventListener("loadedmetadata",I),i.addEventListener("ended",ce),i.addEventListener("play",Te),i.addEventListener("pause",Be),Y(0),V(!1),console.debug("Audio element created",{src:x.current.src,volume:x.current.volume,loop:x.current.loop}),g.current=l.map(()=>0),R.current=l.map(()=>0),$.current=l.map(()=>0),Ce(),r&&x.current.play().catch(Q=>console.error("Play failed:",Q))}},[c]),n.useEffect(()=>{x.current&&(x.current.volume=pe?0:v/100)},[v,pe]),n.useEffect(()=>{x.current&&(x.current.loop=ne)},[ne]),n.useEffect(()=>{x.current&&(x.current.playbackRate=ye)},[ye]),n.useEffect(()=>{B.current&&(X.current&&(X.current.gain.value=z.bass),de.current&&(de.current.gain.value=z.mid),te.current&&(te.current.gain.value=z.treble))},[z]),n.useEffect(()=>{G.current=A,S.current&&(cancelAnimationFrame(S.current),S.current=null),A?(B.current||Pe(),Ae()):Re()},[A]);const Pe=()=>{if(!B.current&&x.current)try{const r=window.AudioContext||window.webkitAudioContext;if(r){const s=new r;B.current=s;const o=s.createBiquadFilter();o.type="lowshelf",o.frequency.value=320,o.gain.value=z.bass;const i=s.createBiquadFilter();i.type="peaking",i.frequency.value=1e3,i.Q.value=.5,i.gain.value=z.mid;const w=s.createBiquadFilter();w.type="highshelf",w.frequency.value=3200,w.gain.value=z.treble;const I=s.createAnalyser();I.fftSize=8192,I.smoothingTimeConstant=.7;const ce=s.createMediaElementSource(x.current);ce.connect(o),o.connect(i),i.connect(w),w.connect(I),I.connect(s.destination),X.current=o,de.current=i,te.current=w,se.current=I,ke.current=ce}}catch(r){console.error("Failed to setup audio context:",r)}},Le=r=>{const s=B.current,o=se.current;if(!s||!o)return 0;const i=s.sampleRate/2,w=Math.round(r/i*o.frequencyBinCount);return Math.min(w,o.frequencyBinCount-1)},Re=()=>{if(G.current)return;g.current=g.current.map(i=>i*.7);const r=Date.now();R.current=R.current.map((i,w)=>r-$.current[w]>1500?i*.95:i),Ce();const s=Math.max(...g.current),o=Math.max(...R.current);s>.01||o>.01?S.current=requestAnimationFrame(Re):(G.current||(g.current=l.map(()=>0),R.current=l.map(()=>0),$.current=l.map(()=>0),Ce()),S.current&&cancelAnimationFrame(S.current),S.current=null)},Ae=()=>{if(!se.current||!G.current)return;const r=se.current.frequencyBinCount,s=new Uint8Array(r);se.current.getByteFrequencyData(s),l.forEach((o,i)=>{const w=Le(o.freq),I=i<l.length-1?Le(l[i+1].freq):s.length;let ce=0,Te=0;for(let Xe=w;Xe<I;Xe++)ce+=s[Xe],Te++;let Be=Te>0?ce/Te/255:0;Be=Math.pow(Be,.6),g.current[i]=g.current[i]*.8+Be*.2;const Q=Date.now();g.current[i]>R.current[i]?(R.current[i]=g.current[i],$.current[i]=Q):Q-$.current[i]>1500&&(R.current[i]*=.95)}),Ce(),S.current=requestAnimationFrame(Ae)},Ce=()=>{if(!le.current)return;const r=_e[q.current]||_e.rainbow;let s="";l.forEach((o,i)=>{const w=g.current[i]*100,I=100-R.current[i]*100,ce=Math.floor(i/l.length*r.bars.length),Te=r.bars[Math.min(ce,r.bars.length-1)];s+=`
|
|
71
|
+
*/const je=ae("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),oe={rainbow:{name:"Rainbow",bg:"linear-gradient(135deg, #ef444422 0%, #f9731622 15%, #f59e0b22 30%, #10b98122 45%, #06b6d422 60%, #3b82f622 75%, #6366f122 85%, #a855f722 92%, #ec489922 100%)",bars:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e"],peak:"#a0a0a0ff",button:"#ec4899",buttonHover:"#d946ef",slider:"#ec4899"},ocean:{name:"Ocean Blue",bg:"linear-gradient(135deg, #667eea43 0%, #764ba243 100%)",bars:["#0ea5e9","#38bdf8","#06b6d4","#22d3ee"],peak:"#0369a1",button:"#0ea5e9",buttonHover:"#0284c7",slider:"#0ea5e9"},sunset:{name:"Sunset",bg:"linear-gradient(135deg, #f093fb43 0%, #f5576c43 100%)",bars:["#f43f5e","#fb7185","#fda4af","#fecdd3"],peak:"#be123c",button:"#f43f5e",buttonHover:"#e11d48",slider:"#f43f5e"},forest:{name:"Forest Green",bg:"linear-gradient(135deg, #0ba36043 0%, #3cba9243 100%)",bars:["#10b981","#34d399","#6ee7b7","#a7f3d0"],peak:"#047857",button:"#10b981",buttonHover:"#059669",slider:"#10b981"},midnight:{name:"Midnight",bg:"linear-gradient(135deg, #2c3e5043 0%, #3498db43 100%)",bars:["#3b82f6","#60a5fa","#93c5fd","#bfdbfe"],peak:"#1e40af",button:"#3b82f6",buttonHover:"#2563eb",slider:"#3b82f6"},neon:{name:"Neon Cyan",bg:"linear-gradient(135deg, #13547a43 0%, #80d0c743 100%)",bars:["#06b6d4","#22d3ee","#67e8f9","#a5f3fc"],peak:"#0e7490",button:"#06b6d4",buttonHover:"#0891b2",slider:"#06b6d4"},purple:{name:"Royal Purple",bg:"linear-gradient(135deg, #2f1c5622 0%, #764ba243 100%)",bars:["#8b5cf6","#a78bfa","#baabf9ff","#ddd6fe"],peak:"#6d28d9",button:"#8b5cf6",buttonHover:"#7c3aed",slider:"#8b5cf6"},amber:{name:"Amber Gold",bg:"linear-gradient(135deg, #f59e0b43 0%, #d9770643 100%)",bars:["#f59e0b","#fbbf24","#fcd34d","#fde68a"],peak:"#b45309",button:"#f59e0b",buttonHover:"#d97706",slider:"#f59e0b"},rose:{name:"Rose Pink",bg:"linear-gradient(135deg, #ec489943 0%, #be185d43 100%)",bars:["#ec4899","#f472b6","#f9a8d4","#fbcfe8"],peak:"#9f1239",button:"#ec4899",buttonHover:"#db2777",slider:"#ec4899"}};function Oe({theme:o,setTheme:c,close:f}){const p=Object.keys(oe).map(N=>({key:N,name:oe[N].name,colors:oe[N].bars}));return e.jsxs("div",{className:"container-glass rounded-xl p-6 mb-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-800",children:"Choose Color Palette"}),e.jsx("button",{onClick:()=>f(),className:"text-gray-500 hover:text-gray-700 text-sm font-medium",children:"Close"})]}),e.jsx("div",{className:"theme-selector grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:p.map(N=>e.jsxs("div",{className:`theme-card bg-white p-4 rounded-lg cursor-pointer border-2 transition-all ${o===N.key?"border-current shadow-lg":"border-transparent"}`,onClick:()=>c(N.key),children:[e.jsx("div",{className:"color-preview h-10 rounded mb-2",style:{background:`linear-gradient(to right, ${N.colors.join(", ")})`}}),e.jsx("div",{className:"text-sm font-medium text-gray-700",children:N.name})]},N.key))})]})}function Ve({audio:o,name:c="No track loaded",author:f,theme:p="rainbow",volume:N=100,thumbnail:g=null,controls:b={play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,loop:!0,trackName:!0,equalizer:!0,speed:!0},mode:x="light",bands:q=null,transparent:E=!1,autoPlay:O=!1,equalizer:z={bass:0,mid:0,treble:0}}){const[S,I]=r.useState(!1),[B,A]=r.useState(0),[j,w]=r.useState(0),[$,ce]=r.useState(N||100),[re,fe]=r.useState(!1),[U,W]=r.useState(!1),[ne,se]=r.useState(!1),[H,ie]=r.useState([]),[T,L]=r.useState(!1),[M,le]=r.useState({bass:z.bass||0,mid:z.mid||0,treble:z.treble||0}),[de,Y]=r.useState(1),[Q,v]=r.useState(0),u=r.useRef(null),P=r.useRef(null),G=r.useRef(null),ge=r.useRef(null),D=r.useRef(null),R=r.useRef(null),K=r.useRef(null),k=r.useRef(null),ee=r.useRef(null),X=r.useRef(null);r.useEffect(()=>{const t=X.current;if(!t)return;const a=new ResizeObserver(s=>{for(let l of s)v(l.contentRect.width)});return a.observe(t),()=>a.disconnect()},[]),r.useEffect(()=>{const t=[];if(o&&typeof o!="string"&&t.push(["TypeError","audio must be a string (URL or path)"]),c&&typeof c!="string"&&t.push(["TypeError","name must be a string"]),p&&typeof p!="string"&&typeof p!="object")t.push(["TypeError","theme must be a string or a valid theme object"]);else if(typeof p=="object"){const a=["name","bg","bars","peak","button","buttonHover","slider"];for(const s of a)s in p||t.push(["ThemeError",`theme object missing key: ${s}`])}(typeof N!="number"||N<0||N>100)&&t.push(["TypeError","volume must be a number between 0 and 100"]),typeof b!="object"||Array.isArray(b)?t.push(["TypeError","controls must be an object"]):["play","pause","stop","seekbar","volume","loop","trackName","equalizer"].forEach(s=>{b&&s in b&&typeof b[s]!="boolean"&&t.push(["TypeError",`controls.${s} must be a boolean`])}),q&&(Array.isArray(q)?q.length===0?t.push(["ValueError","bands array cannot be empty"]):q.forEach((a,s)=>{typeof a.freq!="number"&&t.push(["TypeError",`bands[${s}].freq must be a number`])}):t.push(["TypeError","bands must be an array"])),t.length>0?(ie(t),console.group("%cVisualizePlayer: Prop validation failed","color:red"),t.forEach(a=>console.error(`${a[0]}: ${a[1]}`)),console.groupEnd()):ie([])},[o,c,p,N,b,x,q]);const n=q||[{freq:0},{freq:10},{freq:20},{freq:25},{freq:31.5},{freq:40},{freq:50},{freq:63},{freq:80},{freq:100},{freq:125},{freq:160},{freq:200},{freq:250},{freq:315},{freq:400},{freq:500},{freq:630},{freq:800},{freq:1e3},{freq:1250},{freq:1600},{freq:2e3},{freq:2500},{freq:3150},{freq:4e3},{freq:5e3},{freq:6300},{freq:8e3},{freq:1e4},{freq:12500}],d=r.useRef(n.map(()=>0)),y=r.useRef(n.map(()=>0)),F=r.useRef(n.map(()=>0)),_=r.useRef(!1),Z=r.useRef(typeof p=="string"?p:"purple");let i=typeof p=="string"?oe[p]||oe.purple:typeof p=="object"?p:oe.purple;const h=x==="dark",ue=typeof b=="object"&&Object.keys(b).length===0;r.useEffect(()=>{typeof p=="string"?Z.current=p:Z.current="purple",pe()},[p]),r.useEffect(()=>{u.current||(u.current=new Audio);const t=u.current,a=()=>{ne||A(t.currentTime)},s=()=>{w(t.duration)},l=()=>{U||(I(!1),k.current&&cancelAnimationFrame(k.current))},m=()=>I(!0),C=()=>I(!1);return t.addEventListener("timeupdate",a),t.addEventListener("loadedmetadata",s),t.addEventListener("ended",l),t.addEventListener("play",m),t.addEventListener("pause",C),()=>{t.removeEventListener("timeupdate",a),t.removeEventListener("loadedmetadata",s),t.removeEventListener("ended",l),t.removeEventListener("play",m),t.removeEventListener("pause",C)}},[ne,U]),r.useEffect(()=>()=>{u.current&&(u.current.pause(),u.current.src="",u.current.load()),P.current&&P.current.close().catch(t=>console.warn("AudioContext cleanup error:",t)),k.current&&cancelAnimationFrame(k.current)},[]),r.useEffect(()=>{if(o){const t=S,a=$,s=U;if(k.current&&(cancelAnimationFrame(k.current),k.current=null),ge.current){try{ge.current.disconnect()}catch(V){console.warn("Source disconnect error:",V)}ge.current=null}if(G.current){try{G.current.disconnect()}catch(V){console.warn("Analyser disconnect error:",V)}G.current=null}if(D.current){try{D.current.disconnect()}catch(V){console.warn("Bass filter disconnect error:",V)}D.current=null}if(R.current){try{R.current.disconnect()}catch(V){console.warn("Mid filter disconnect error:",V)}R.current=null}if(K.current){try{K.current.disconnect()}catch(V){console.warn("Treble filter disconnect error:",V)}K.current=null}P.current&&(P.current.close().catch(V=>console.warn("AudioContext close error:",V)),P.current=null),u.current&&(u.current.pause(),u.current.src="",u.current.load()),u.current=new Audio;try{u.current.crossOrigin="anonymous"}catch(V){console.debug("Could not set crossOrigin on audio element",V)}u.current.src=o,u.current.preload="auto",u.current.muted=!1,u.current.volume=re?0:a/100,u.current.loop=s,u.current.load();const l=u.current,m=()=>{ne||A(l.currentTime)},C=()=>{w(l.duration)},te=()=>{U||(I(!1),k.current&&cancelAnimationFrame(k.current))},be=()=>I(!0),Ne=()=>I(!1);l.addEventListener("timeupdate",m),l.addEventListener("loadedmetadata",C),l.addEventListener("ended",te),l.addEventListener("play",be),l.addEventListener("pause",Ne),A(0),I(!1),console.debug("Audio element created",{src:u.current.src,volume:u.current.volume,loop:u.current.loop}),d.current=n.map(()=>0),y.current=n.map(()=>0),F.current=n.map(()=>0),pe(),t&&u.current.play().catch(V=>console.error("Play failed:",V))}},[o]),r.useEffect(()=>{u.current&&(u.current.volume=re?0:$/100)},[$,re]),r.useEffect(()=>{u.current&&(u.current.loop=U)},[U]),r.useEffect(()=>{u.current&&(u.current.playbackRate=de)},[de]),r.useEffect(()=>{P.current&&(D.current&&(D.current.gain.value=M.bass),R.current&&(R.current.gain.value=M.mid),K.current&&(K.current.gain.value=M.treble))},[M]),r.useEffect(()=>{_.current=S,k.current&&(cancelAnimationFrame(k.current),k.current=null),S?(P.current||qe(),ve()):he()},[S]);const qe=()=>{if(!P.current&&u.current)try{const t=window.AudioContext||window.webkitAudioContext;if(t){const a=new t;P.current=a;const s=a.createBiquadFilter();s.type="lowshelf",s.frequency.value=320,s.gain.value=M.bass;const l=a.createBiquadFilter();l.type="peaking",l.frequency.value=1e3,l.Q.value=.5,l.gain.value=M.mid;const m=a.createBiquadFilter();m.type="highshelf",m.frequency.value=3200,m.gain.value=M.treble;const C=a.createAnalyser();C.fftSize=8192,C.smoothingTimeConstant=.7;const te=a.createMediaElementSource(u.current);te.connect(s),s.connect(l),l.connect(m),m.connect(C),C.connect(a.destination),D.current=s,R.current=l,K.current=m,G.current=C,ge.current=te}}catch(t){console.error("Failed to setup audio context:",t)}},me=t=>{const a=P.current,s=G.current;if(!a||!s)return 0;const l=a.sampleRate/2,m=Math.round(t/l*s.frequencyBinCount);return Math.min(m,s.frequencyBinCount-1)},he=()=>{if(_.current)return;d.current=d.current.map(l=>l*.7);const t=Date.now();y.current=y.current.map((l,m)=>t-F.current[m]>1500?l*.95:l),pe();const a=Math.max(...d.current),s=Math.max(...y.current);a>.01||s>.01?k.current=requestAnimationFrame(he):(_.current||(d.current=n.map(()=>0),y.current=n.map(()=>0),F.current=n.map(()=>0),pe()),k.current&&cancelAnimationFrame(k.current),k.current=null)},ve=()=>{if(!G.current||!_.current)return;const t=G.current.frequencyBinCount,a=new Uint8Array(t);G.current.getByteFrequencyData(a),n.forEach((s,l)=>{const m=me(s.freq),C=l<n.length-1?me(n[l+1].freq):a.length;let te=0,be=0;for(let _e=m;_e<C;_e++)te+=a[_e],be++;let Ne=be>0?te/be/255:0;Ne=Math.pow(Ne,.6),d.current[l]=d.current[l]*.8+Ne*.2;const V=Date.now();d.current[l]>y.current[l]?(y.current[l]=d.current[l],F.current[l]=V):V-F.current[l]>1500&&(y.current[l]*=.95)}),pe(),k.current=requestAnimationFrame(ve)},pe=()=>{if(!ee.current)return;const t=oe[Z.current]||oe.rainbow;let a="";n.forEach((s,l)=>{const m=d.current[l]*100,C=100-y.current[l]*100,te=Math.floor(l/n.length*t.bars.length),be=t.bars[Math.min(te,t.bars.length-1)];a+=`
|
|
101
72
|
<div class="flex-1 h-full relative flex flex-col justify-end">
|
|
102
|
-
<div class="rounded-t transition-all duration-75" style="height: ${
|
|
103
|
-
${
|
|
73
|
+
<div class="rounded-t transition-all duration-75" style="height: ${m}%; background: ${be};">
|
|
74
|
+
${y.current[l]>.1?`<div class="absolute w-full h-0.5 transition-all duration-100" style="top: ${C}%; background: ${t.peak};"></div>`:""}
|
|
104
75
|
</div>
|
|
105
76
|
</div>
|
|
106
|
-
`}),
|
|
77
|
+
`}),ee.current.innerHTML=a},Se=()=>{!u.current||!o||(S?u.current.pause():(P.current&&P.current.state==="suspended"&&P.current.resume(),u.current.play().catch(t=>console.error("Play failed:",t))))},Pe=()=>{u.current&&(u.current.pause(),u.current.currentTime=0,I(!1),A(0),d.current=n.map(()=>0),y.current=n.map(()=>0),F.current=n.map(()=>0),pe())},Te=t=>{const s=parseFloat(t.target.value)/100*j;A(s),u.current&&!ne&&(u.current.currentTime=s)},Le=()=>{se(!0)},Me=()=>{u.current&&(u.current.currentTime=B),se(!1)},Fe=t=>{const a=parseInt(t.target.value);ce(a),fe(a===0)},ze=()=>{fe(!re)},we=t=>{Y(parseFloat(t.target.value))},Be=()=>{W(!U)},xe=(t,a)=>{le(s=>({...s,[t]:a}))},ye=()=>{le({bass:0,mid:0,treble:0})};r.useEffect(()=>{((typeof b=="object"&&Object.keys(b).length===0||!b)&&!S||O)&&Se()},[b]);const ke=t=>{if(isNaN(t))return"0:00";const a=Math.floor(t/60),s=Math.floor(t%60);return`${a}:${s.toString().padStart(2,"0")}`};return H&&H.length>0?H.map((t,a)=>e.jsxs("div",{className:"text-red-500 text-sm bg-red-50 p-3 rounded mb-4 border border-red-300",children:[e.jsxs("strong",{children:[t[0],":"]})," ",t[1]]},a)):e.jsx("div",{ref:X,className:"w-full rounded-xl overflow-hidden",style:{backgroundColor:ue||E?void 0:h?"#6060606a":"#ffffffab"},children:e.jsxs("div",{style:{background:ue||E?void 0:i.bg},className:ue||E?"":"p-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:`${E&&T?"opacity-30":""} ${ue||E?"":h?"bg-black/40":"bg-white/70"} rounded-lg ${ue?"":"mb-6"} ${ue||E?"":"p-4"} shadow-sm`,children:e.jsx("div",{className:"flex justify-center items-end gap-1 h-64",ref:ee})}),T&&e.jsxs("div",{className:`absolute inset-0 flex flex-col w-full justify-center z-10 ${!(ue||E)&&(h?"bg-black/50":"bg-white/80")} rounded-lg p-4 shadow-sm transition-all duration-300`,children:[e.jsx("h3",{className:`text-sm font-medium mb-4 ${h?"text-gray-200":"text-gray-700"}`,children:"Equalizer"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:"Bass"}),e.jsxs("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:[M.bass," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:M.bass,onChange:t=>xe("bass",parseInt(t.target.value)),className:"flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${i.slider} ${(M.bass+20)/40*100}%, ${i.slider+"30"} ${(M.bass+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:"Mid"}),e.jsxs("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:[M.mid," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:M.mid,onChange:t=>xe("mid",parseInt(t.target.value)),className:"flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${i.slider} ${(M.mid+20)/40*100}%, ${i.slider+"30"} ${(M.mid+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:"Treble"}),e.jsxs("span",{className:`text-xs ${h?"text-gray-300":"text-gray-600"}`,children:[M.treble," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:M.treble,onChange:t=>xe("treble",parseInt(t.target.value)),className:"flex-1 h-8 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${i.slider} ${(M.treble+20)/40*100}%, ${i.slider+"30"} ${(M.treble+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${h?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]})]}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx("button",{onClick:ye,className:`px-3 py-1 rounded text-xs ${h?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Reset"})})]})]}),b.trackName&&e.jsxs("div",{className:"mb-6 flex items-center",children:[g&&e.jsx("div",{className:"mr-2",children:e.jsx("img",{src:g,alt:"",className:`${S?"animation-spin":""} h-12 w-12 rounded-full`})}),e.jsxs("div",{children:[e.jsx("div",{className:`${h?"text-gray-100":"text-gray-700"} font-medium truncate`,children:c}),f&&typeof f=="string"&&e.jsx("div",{className:`${h?"text-gray-300":"text-gray-500"} text-xs`,children:f})]})]}),b.seekbar&&e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex items-center md:gap-1",children:[e.jsx("span",{className:`text-xs ${h?"text-gray-100":"text-gray-600"} font-mono w-12`,children:ke(B)}),e.jsx("input",{type:"range",min:"0",max:"100",value:j>0?B/j*100:0,onChange:Te,onMouseDown:Le,onMouseUp:Me,onTouchStart:Le,onTouchEnd:Me,disabled:!o,className:"flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:o&&j>0?`linear-gradient(to right, ${i.slider} ${B/j*100}%, ${i.slider+"30"} ${B/j*100}%)`:i.slider+"30"}}),e.jsx("span",{className:`text-xs ${h?"text-gray-100":"text-gray-600"} font-mono w-12 text-right`,children:ke(j)})]})}),e.jsxs("div",{className:`flex flex-wrap items-center ${Q<330?"gap-2":"gap-3"}`,children:[b.play&&e.jsxs("button",{onClick:Se,disabled:!o,className:`${Q<350?"px-3 py-5":"px-4 py-2 md:w-24"} rounded-full text-sm font-medium text-white disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all hover:opacity-90`,style:{backgroundColor:i.button},children:[e.jsxs("div",{className:"relative w-4 flex items-center",children:[e.jsx($e,{size:16,className:`${S?"":"scale-0 translate-y-10"} transition-all absolute`}),e.jsx(Ee,{size:16,className:`${S?"scale-0 -translate-y-10":""} transition-all absolute`})]}),e.jsx("span",{style:{display:Q<350?"none":"block"},children:S?"Pause":"Play"})]}),b.stop&&e.jsxs("button",{onClick:Pe,disabled:!o,className:`${h?"bg-gray-100 text-black":"bg-gray-700 text-white"} ${Q<600?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium ${h?"hover:bg-gray-300":"hover:bg-gray-800"} disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,children:[e.jsx(De,{size:16}),e.jsx("span",{style:{display:Q<600?"none":"block"},children:"Stop"})]}),b.equalizer&&e.jsxs("button",{onClick:()=>L(!T),disabled:!o,className:`${Q<600?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${T?"text-white":"bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,style:T?{backgroundColor:i.button}:{},children:[e.jsx(Ce,{size:16}),e.jsx("span",{style:{display:Q<600?"none":"block"},children:"EQ"})]}),b.loop&&e.jsxs("button",{onClick:Be,disabled:!o,className:`${Q<700?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${U?"text-white":"bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,style:U?{backgroundColor:i.button}:{},children:[e.jsx(Re,{size:16,className:`${U?"rotate-180":""} transition-all`}),e.jsx("span",{style:{display:Q<700?"none":"block"},children:"Loop"})]}),b.speed&&e.jsx("div",{className:"flex items-center",children:e.jsxs("select",{value:de,onChange:we,className:`rounded-full text-sm font-medium border-none outline-none cursor-pointer transition-all bg-transparent ${h?"text-gray-200":"text-gray-800"}`,children:[e.jsx("option",{value:"0.5",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"0.5x"}),e.jsx("option",{value:"0.75",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"0.75x"}),e.jsx("option",{value:"1",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"1x"}),e.jsx("option",{value:"1.25",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"1.25x"}),e.jsx("option",{value:"1.5",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"1.5x"}),e.jsx("option",{value:"2",className:h?"bg-gray-800 text-gray-100":"bg-white text-gray-800",children:"2x"})]})}),b.volume&&e.jsxs("div",{className:"flex items-center gap-1 md:gap-3 ml-auto",children:[e.jsx("button",{onClick:ze,className:"p-2 rounded-full hover:bg-gray-100/50 transition-all",children:re||$===0?e.jsx(je,{size:20,className:h?"text-gray-100":"text-gray-600"}):e.jsx(Ae,{size:20,className:h?"text-gray-100":"text-gray-600"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:$,onChange:Fe,className:"hide-for-xs w-24 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, ${i.slider} ${$}%, ${i.slider+"30"} ${$}%)`,display:Q<460?"none":"block"}}),e.jsxs("span",{style:{display:Q<800?"none":"block"},className:`hidden sm:block text-xs ${h?"text-gray-100":"text-gray-700"} font-mono w-10 text-right`,children:[$,"%"]})]})]}),e.jsx("style",{children:`
|
|
107
78
|
input[type="range"]::-webkit-slider-thumb {
|
|
108
79
|
-webkit-appearance: none;
|
|
109
80
|
appearance: none;
|
|
110
81
|
width: 16px;
|
|
111
82
|
height: 16px;
|
|
112
83
|
border-radius: 50%;
|
|
113
|
-
background: ${
|
|
84
|
+
background: ${i.slider};
|
|
114
85
|
cursor: pointer;
|
|
115
86
|
border: 2px solid white;
|
|
116
87
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
@@ -120,7 +91,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
120
91
|
width: 16px;
|
|
121
92
|
height: 16px;
|
|
122
93
|
border-radius: 50%;
|
|
123
|
-
background: ${
|
|
94
|
+
background: ${i.slider};
|
|
124
95
|
cursor: pointer;
|
|
125
96
|
border: 2px solid white;
|
|
126
97
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
@@ -161,7 +132,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
161
132
|
transform: rotate(360deg)
|
|
162
133
|
}
|
|
163
134
|
}
|
|
164
|
-
`})]})})}function
|
|
135
|
+
`})]})})}function Ue({audio:o,gradient:c=["#cd7eff","#ff00f2"],background:f="#f4e4ffff",autoPlay:p=!1,thumbnail:N=null,width:g,equalizer:b={bass:0,mid:0,treble:0},mode:x="light"}){const[q,E]=r.useState(!1),[O,z]=r.useState(0),[S,I]=r.useState(0),[B,A]=r.useState(!1),[j,w]=r.useState(80),[$,ce]=r.useState(1),[re,fe]=r.useState([]),[U,W]=r.useState(null),[ne,se]=r.useState(!1),[H,ie]=r.useState({bass:b.bass||0,mid:b.mid||0,treble:b.treble||0}),T=r.useRef(null),L=r.useRef(null),M=r.useRef(null),le=r.useRef(null),de=r.useRef(null),Y=r.useRef(null),Q=()=>{const n=[];for(let d=0;d<100;d++){const y=20+Math.random()*60;n.push(y)}return n};r.useEffect(()=>{if(!o)return;if(!Array.isArray(c)||c.length<2){W("Gradient must be an array with at least 2 colors");return}const n=T.current;if(!n)return;const d=()=>z(n.currentTime),y=()=>{I(n.duration),fe(Q())},F=()=>E(!1),_=Z=>{var i,h;W(`Audio error: ${((h=(i=Z.target)==null?void 0:i.error)==null?void 0:h.message)||"Failed to load audio"}`)};return n.addEventListener("timeupdate",d),n.addEventListener("loadedmetadata",y),n.addEventListener("ended",F),n.addEventListener("error",_),()=>{n.removeEventListener("timeupdate",d),n.removeEventListener("loadedmetadata",y),n.removeEventListener("ended",F),n.removeEventListener("error",_)}},[o,c,x]),r.useEffect(()=>{o&&T.current&&p&&(T.current.play().catch(n=>{console.error("Play failed:",n),E(!1)}),E(!0))},[o]),r.useEffect(()=>{if(T.current&&!L.current&&T.current){const n=window.AudioContext||window.webkitAudioContext;if(n){const d=new n;L.current=d;const y=d.createMediaElementSource(T.current);M.current=y;const F=d.createBiquadFilter();F.type="lowshelf",F.frequency.value=200,le.current=F;const _=d.createBiquadFilter();_.type="peaking",_.frequency.value=1e3,_.Q.value=1,de.current=_;const Z=d.createBiquadFilter();Z.type="highshelf",Z.frequency.value=3e3,Y.current=Z,y.connect(F).connect(_).connect(Z).connect(d.destination)}}},[o]),r.useEffect(()=>{T.current&&(T.current.volume=B?0:j/100)},[j,B]),r.useEffect(()=>{T.current&&(T.current.playbackRate=$)},[$]);const v=()=>{T.current&&(q?T.current.pause():T.current.play().catch(n=>{W(`Playback failed: ${n instanceof Error?n.message:String(n)}`)}),E(!q))},u=()=>{A(!B)},P=n=>{w(parseInt(n.target.value)),B&&parseInt(n.target.value)>0&&A(!1)},G=n=>{ce(parseFloat(n.target.value))},ge=n=>{const d=n.currentTarget.getBoundingClientRect(),_=(n.clientX-d.left)/d.width*S;T.current&&(T.current.currentTime=_,z(_))},D=(n,d)=>{ie(y=>({...y,[n]:d})),n==="bass"&&le.current&&(le.current.gain.value=d),n==="mid"&&de.current&&(de.current.gain.value=d),n==="treble"&&Y.current&&(Y.current.gain.value=d)},R=()=>{D("bass",0),D("mid",0),D("treble",0)},K=n=>{if(isNaN(n))return"0:00";const d=Math.floor(n/60),y=Math.floor(n%60);return`${d}:${y.toString().padStart(2,"0")}`},k=S>0?O/S*100:0;if(U)return e.jsx("div",{className:"w-lg p-6 rounded-xl",style:{background:f},children:e.jsxs("div",{className:`text-center ${x==="dark"?"text-red-300":"text-red-600"}`,children:[e.jsx("p",{className:"font-medium",children:"Error"}),e.jsx("p",{className:"text-sm",children:U})]})});if(!o)return null;const ee=x==="dark"?"text-gray-300":"text-gray-700",X=x==="dark"?"text-gray-400":"text-gray-500";return e.jsxs("div",{className:"w-full max-w-lg relative",style:{width:g+"px"},children:[e.jsx("audio",{ref:T,src:o}),e.jsx("div",{className:"rounded-2xl shadow-2xl",children:e.jsxs("div",{className:"rounded-2xl p-6 backdrop-blur-xl",style:{background:f},children:[N&&e.jsx("div",{className:"w-full p-4",children:e.jsx("img",{src:N,alt:"",className:"w-full aspect-square rounded-xl"})}),e.jsxs("div",{className:"relative h-20 mb-6 cursor-pointer",onClick:ge,children:[e.jsx("div",{className:"absolute inset-0 flex items-end justify-center h-full w-full gap-px",children:re.map((n,d)=>{const F=d/re.length*100<=k;return e.jsx("div",{className:"w-1 rounded-t transition-all duration-150",style:{height:`${n}%`,background:F?c[0]:c[1],opacity:F?1:.4}},d)})}),e.jsx("div",{className:"absolute top-0 h-full w-1 bg-white border-r border-black rounded-full transition-all duration-150",style:{left:`${k}%`,transform:"translateX(-50%)"}})]}),e.jsxs("div",{className:`flex justify-between text-sm ${X} mb-6`,children:[e.jsx("span",{children:K(O)}),e.jsx("span",{children:K(S)})]}),e.jsxs("div",{className:"grid grid-cols-3 items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:u,className:"p-2 rounded-full transition-all",style:{background:`linear-gradient(135deg, ${c[0]}, ${c[1]})`},children:B||j===0?e.jsx(je,{className:"w-4 h-4 text-white"}):e.jsx(Ae,{className:"w-4 h-4 text-white"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:j,onChange:P,className:`${g?"":"hidden sm:block"} w-20 h-1.5 rounded-lg appearance-none cursor-pointer`,style:{background:`linear-gradient(to right, ${c[0]} ${j}%, ${x==="dark"?"#374151":"#d1d5db"} ${j}%)`,display:g&&g<400?"none":void 0}}),g&&g<400&&e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("button",{onClick:()=>se(!ne),className:"p-2 rounded-full transition-all",style:{background:`linear-gradient(135deg, ${c[0]}, ${c[1]})`},children:e.jsx(Ce,{className:"w-4 h-4 text-white"})})})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx("button",{onClick:v,className:"p-4 rounded-full transition-all hover:scale-105 shadow-lg",style:{background:`linear-gradient(135deg, ${c[0]}, ${c[1]})`},children:q?e.jsx($e,{className:"w-6 h-6 text-white fill-white"}):e.jsx(Ee,{className:"w-6 h-6 text-white fill-white"})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex items-center justify-end",children:e.jsxs("select",{value:$,style:{background:f,color:c[0]},onChange:G,className:`py-1 px-2 rounded-lg text-sm ${ee} ${x==="dark"?"bg-gray-800":"bg-gray-100"}`,children:[e.jsx("option",{value:"0.5",children:"0.5x"}),e.jsx("option",{value:"0.75",children:"0.75x"}),e.jsx("option",{value:"1",children:"1x"}),e.jsx("option",{value:"1.25",children:"1.25x"}),e.jsx("option",{value:"1.5",children:"1.5x"}),e.jsx("option",{value:"2",children:"2x"})]})}),!(g&&g<400)&&e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("button",{onClick:()=>se(!ne),className:"p-2 rounded-full transition-all",style:{background:`linear-gradient(135deg, ${c[0]}, ${c[1]})`},children:e.jsx(Ce,{className:"w-4 h-4 text-white"})})})]})]})]})}),ne&&e.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-20 flex items-center justify-center z-10 rounded-2xl p-4",children:e.jsxs("div",{className:`max-w-xs w-full p-4 pt-2 rounded-xl ${x==="dark"?"bg-gray-800":"bg-white"}`,children:[e.jsx("h3",{className:`text-lg font-medium mb-2 ${x==="dark"?"text-gray-200":"text-gray-700"}`,children:"Equalizer"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:"Bass"}),e.jsxs("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:[H.bass," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:H.bass,onChange:n=>D("bass",parseInt(n.target.value)),className:"flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${c[0]} ${(H.bass+20)/40*100}%, ${c[1]+"30"} ${(H.bass+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:"Mid"}),e.jsxs("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:[H.mid," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:H.mid,onChange:n=>D("mid",parseInt(n.target.value)),className:"flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${c[0]} ${(H.mid+20)/40*100}%, ${c[1]+"30"} ${(H.mid+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:"Treble"}),e.jsxs("span",{className:`text-xs ${x==="dark"?"text-gray-300":"text-gray-600"}`,children:[H.treble," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:H.treble,onChange:n=>D("treble",parseInt(n.target.value)),className:"flex-1 h-4 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${c[0]} ${(H.treble+20)/40*100}%, ${c[1]+"30"} ${(H.treble+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${x==="dark"?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]})]}),e.jsxs("div",{className:"flex justify-between mt-6",children:[e.jsx("button",{onClick:R,className:`px-3 py-1 rounded text-xs ${x==="dark"?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Reset"}),e.jsx("button",{onClick:()=>se(!1),className:`px-3 py-1 rounded text-xs ${x==="dark"?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Close"})]})]})}),e.jsx("style",{children:`
|
|
165
136
|
input[type="range"].eq-slider::-webkit-slider-thumb {
|
|
166
137
|
-webkit-appearance: none;
|
|
167
138
|
appearance: none;
|
|
@@ -178,53 +149,53 @@ React keys must be passed directly to JSX without using spread:
|
|
|
178
149
|
border: none;
|
|
179
150
|
box-shadow: none;
|
|
180
151
|
}
|
|
181
|
-
`})]})}function
|
|
152
|
+
`})]})}function We({audio:o,thumbnail:c,gradient:f=["#cd7eff","#fe59f6"],background:p="#1f273a",autoPlay:N=!1}){const[g,b]=r.useState(!1),[,x]=r.useState(0),q=r.useRef(null),[E,O]=r.useState(0),[z,S]=r.useState(0),[I,B]=r.useState(0);r.useEffect(()=>{const w=q.current;if(!w)return;const $=()=>x(w.currentTime);return w.addEventListener("timeupdate",$),()=>w.removeEventListener("timeupdate",$)},[]),r.useEffect(()=>{const w=setInterval(()=>{g&&O($=>$+.1)},100);return()=>clearInterval(w)},[g]),r.useEffect(()=>{const w=setInterval(()=>{g&&B($=>$+.1)},100);return()=>clearInterval(w)},[g]),r.useEffect(()=>{o&&q.current&&N&&(q.current.play().catch(()=>b(!1)),b(!0))},[o]),r.useEffect(()=>{const w=q.current;if(!w)return;const $=()=>{S(w.duration),console.log("Audio duration:",w.duration)};return B(0),w.addEventListener("loadedmetadata",$),()=>{w.removeEventListener("loadedmetadata",$)}},[o]);const A=()=>{q.current&&(g?q.current.pause():q.current.play().catch(w=>console.error("NanoPlayer play failed:",w)),b(!g))};if(!o)return null;const j={background:`linear-gradient(135deg, ${f[0]}, ${f[1]})`};return e.jsxs("div",{style:{backgroundColor:p},className:`
|
|
182
153
|
relative overflow-hidden inline-flex flex-col
|
|
183
|
-
${
|
|
154
|
+
${c?"rounded-2xl":"rounded-full"}
|
|
184
155
|
px-3 py-2 shadow-lg
|
|
185
|
-
${
|
|
186
|
-
`,children:[e.jsx("audio",{ref:
|
|
156
|
+
${c?"w-[120px] h-[150px]":"w-[110px] h-[40px]"}
|
|
157
|
+
`,children:[e.jsx("audio",{ref:q,src:o,onEnded:()=>{b(!1),B(0)}}),e.jsx("div",{style:{width:`${(z>0?I/z:0)*100}%`,backgroundImage:j.background},className:"absolute top-0 left-0 h-full opacity-20"}),e.jsxs("div",{className:"absolute flex flex-col",children:[c&&e.jsx("div",{className:"w-24 pb-2",children:e.jsx("img",{src:c,alt:"",className:"w-24 aspect-square rounded-xl"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:A,style:j,className:"p-1.5 rounded-full hover:scale-110 transition-transform flex-shrink-0",children:g?e.jsx($e,{fill:p,className:"w-3 h-3 text-transparent"}):e.jsx(Ee,{fill:p,className:"w-3 h-3 text-transparent"})}),e.jsx("div",{className:"flex w-full min-w-12 items-center gap-0.5 h-6",children:[...Array(12)].map((w,$)=>e.jsx("div",{className:"rounded-full transition-all duration-200",style:{width:"100%",background:`linear-gradient(to top, ${f[0]}, ${f[1]})`,height:g?`${8+Math.sin((E*8+$)*.6)*10}px`:"8px",opacity:g?.8:.4}},$))})]})]})]})}function tt({video:o,name:c="No video loaded",audioVisual:f=null,volume:p=100,thumbnail:N=null,controls:g={play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,fullscreen:!0,videoName:!0,equalizer:!0,speed:!0},mode:b="light",transparent:x=!1,autoPlay:q=!1,color:E="#3b82f6",equalizer:O={bass:0,mid:0,treble:0}}){const[z,S]=r.useState(!1),[I,B]=r.useState(0),[A,j]=r.useState(0),[w,$]=r.useState(p||100),[ce,re]=r.useState(!1),[fe,U]=r.useState(!1),[W,ne]=r.useState(!1),[se,H]=r.useState([]),[ie,T]=r.useState(!1),[L,M]=r.useState({bass:O.bass||0,mid:O.mid||0,treble:O.treble||0}),[le,de]=r.useState(1),[Y,Q]=r.useState(0),v=r.useRef(null),u=r.useRef(null),P=r.useRef(null),G=r.useRef(null),ge=r.useRef(null),D=r.useRef(null),R=r.useRef(null),K=r.useRef(null),k=r.useRef(null),ee=r.useRef(null),X=r.useRef(0),n=r.useRef(0),d=r.useRef(0),y=r.useRef(0),F=r.useRef(0),_=r.useRef(0),Z=r.useRef(!1),i=b==="dark"||W,h=typeof g=="object"&&Object.keys(g).length===0;r.useEffect(()=>{const t=u.current;if(!t)return;const a=new ResizeObserver(s=>{for(let l of s)Q(l.contentRect.width)});return a.observe(t),()=>a.disconnect()},[]),r.useEffect(()=>{const t=[];o&&typeof o!="string"&&t.push(["TypeError","video must be a string (URL or path)"]),c&&typeof c!="string"&&t.push(["TypeError","name must be a string"]),(typeof p!="number"||p<0||p>100)&&t.push(["TypeError","volume must be a number between 0 and 100"]),f&&typeof f!="object"?t.push(["TypeError","audioVisual must be an object"]):f&&(["left","right","top","bottom"].includes(f.side)||t.push(["ValueError","audioVisual.side must be 'left', 'right', 'top', or 'bottom'"])),t.length>0?(H(t),console.group("%cVideoPlayer: Prop validation failed","color:red"),t.forEach(a=>console.error(`${a[0]}: ${a[1]}`)),console.groupEnd()):H([])},[o,c,p,f,g,b]),r.useEffect(()=>{if(!v.current)return;const t=v.current,a=()=>{fe||B(t.currentTime)},s=()=>{j(t.duration)},l=()=>{S(!1),k.current&&cancelAnimationFrame(k.current)},m=()=>S(!0),C=()=>S(!1);return t.addEventListener("timeupdate",a),t.addEventListener("loadedmetadata",s),t.addEventListener("ended",l),t.addEventListener("play",m),t.addEventListener("pause",C),()=>{t.removeEventListener("timeupdate",a),t.removeEventListener("loadedmetadata",s),t.removeEventListener("ended",l),t.removeEventListener("play",m),t.removeEventListener("pause",C)}},[fe]),r.useEffect(()=>{if(o){const t=z,a=w;if(v.current&&v.current.pause(),v.current){v.current.pause(),v.current.src=o,v.current.volume=ce?0:a/100;const s=()=>{t&&v.current&&v.current.play().catch(l=>console.error("Play failed:",l)),v.current&&v.current.removeEventListener("canplay",s)};v.current.addEventListener("canplay",s),v.current.load()}B(0),S(!1),X.current=0,n.current=0,d.current=0,y.current=0,F.current=0,_.current=0,he()}},[o]),r.useEffect(()=>{v.current&&(v.current.volume=ce?0:w/100)},[w,ce]),r.useEffect(()=>{v.current&&(v.current.playbackRate=le)},[le]),r.useEffect(()=>{P.current&&(D.current&&(D.current.gain.value=L.bass),R.current&&(R.current.gain.value=L.mid),K.current&&(K.current.gain.value=L.treble))},[L]),r.useEffect(()=>{Z.current=z,k.current&&(cancelAnimationFrame(k.current),k.current=null),z&&f?(P.current||ue(),me()):!z&&f&&qe()},[z,f]),r.useEffect(()=>{const t=()=>{ne(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),r.useEffect(()=>()=>{k.current&&cancelAnimationFrame(k.current),P.current&&P.current.close().catch(t=>console.warn("AudioContext cleanup error:",t))},[]);const ue=()=>{if(!P.current&&v.current)try{const t=window.AudioContext||window.webkitAudioContext;if(t){const a=new t;P.current=a;const s=a.createBiquadFilter();s.type="lowshelf",s.frequency.value=320,s.gain.value=L.bass;const l=a.createBiquadFilter();l.type="peaking",l.frequency.value=1e3,l.Q.value=.5,l.gain.value=L.mid;const m=a.createBiquadFilter();m.type="highshelf",m.frequency.value=3200,m.gain.value=L.treble;const C=a.createAnalyser();C.fftSize=2048,C.smoothingTimeConstant=.8;const te=a.createMediaElementSource(v.current);te.connect(s),s.connect(l),l.connect(m),m.connect(C),m.connect(a.destination),D.current=s,R.current=l,K.current=m,G.current=C,ge.current=te}}catch(t){console.error("Failed to setup audio context:",t)}},qe=()=>{if(Z.current)return;X.current*=.7,n.current*=.7;const t=Date.now();t-F.current>1500&&(d.current*=.95),t-_.current>1500&&(y.current*=.95),he();const a=Math.max(X.current,n.current),s=Math.max(d.current,y.current);a>.01||s>.01?k.current=requestAnimationFrame(qe):(Z.current||(X.current=0,n.current=0,d.current=0,y.current=0,he()),k.current&&cancelAnimationFrame(k.current),k.current=null)},me=()=>{if(!G.current||!Z.current)return;const t=G.current.frequencyBinCount,a=new Uint8Array(t);G.current.getByteFrequencyData(a);let s=0;for(let C=0;C<t;C++)s+=a[C];let l=s/t/255;l=Math.pow(l,.5),X.current=X.current*.7+l*.3,n.current=n.current*.7+l*.3;const m=Date.now();X.current>d.current?(d.current=X.current,F.current=m):m-F.current>1500&&(d.current*=.95),n.current>y.current?(y.current=n.current,_.current=m):m-_.current>1500&&(y.current*=.95),he(),k.current=requestAnimationFrame(me)},he=()=>{if(!ee.current||!f)return;const t=f.color||"#00ff00",a=f.peak||"#ff0000",s=X.current*100,l=n.current*100,m=100-d.current*100,C=100-y.current*100;f.side==="top"||f.side==="bottom"?ee.current.innerHTML=`
|
|
187
158
|
<div class="flex flex-col gap-1 h-full justify-center">
|
|
188
159
|
<div class="flex items-center justify-center gap-2">
|
|
189
|
-
<div class="text-xs ${
|
|
160
|
+
<div class="text-xs ${i?"text-gray-100":"text-gray-900"} opacity-80 w-4 text-center">L</div>
|
|
190
161
|
<div class="relative flex-1 h-3 bg-black/40 rounded-full overflow-hidden flex justify-end">
|
|
191
|
-
<div class="h-full rounded-l-full transition-all duration-75" style="width: ${
|
|
192
|
-
${
|
|
162
|
+
<div class="h-full rounded-l-full transition-all duration-75" style="width: ${s}%; background: ${t};"></div>
|
|
163
|
+
${d.current>.1?`<div class="absolute top-0 w-1 h-full transition-all duration-100" style="right: ${d.current*100}%; background: ${a};"></div>`:""}
|
|
193
164
|
</div>
|
|
194
165
|
<div class="w-px h-4 bg-white/20"></div>
|
|
195
166
|
<div class="relative flex-1 h-3 bg-black/40 rounded-full overflow-hidden flex justify-start">
|
|
196
|
-
<div class="h-full rounded-r-full transition-all duration-75" style="width: ${
|
|
197
|
-
${
|
|
167
|
+
<div class="h-full rounded-r-full transition-all duration-75" style="width: ${l}%; background: ${t};"></div>
|
|
168
|
+
${y.current>.1?`<div class="absolute top-0 w-1 h-full transition-all duration-100" style="left: ${y.current*100}%; background: ${a};"></div>`:""}
|
|
198
169
|
</div>
|
|
199
|
-
<div class="text-xs ${
|
|
170
|
+
<div class="text-xs ${i?"text-gray-100":"text-gray-900"} opacity-80 w-4 text-center">R</div>
|
|
200
171
|
</div>
|
|
201
172
|
</div>
|
|
202
|
-
`:
|
|
173
|
+
`:ee.current.innerHTML=`
|
|
203
174
|
<div class="flex gap-2 h-full">
|
|
204
175
|
<div class="flex-1 flex flex-col">
|
|
205
176
|
<div class="text-xs text-white opacity-70 text-center mb-1">L</div>
|
|
206
177
|
<div class="flex-1 relative flex flex-col justify-end bg-black/30 rounded-lg overflow-hidden">
|
|
207
|
-
<div class="rounded-t transition-all duration-75" style="height: ${
|
|
208
|
-
${
|
|
178
|
+
<div class="rounded-t transition-all duration-75" style="height: ${s}%; background: ${t};">
|
|
179
|
+
${d.current>.1?`<div class="absolute w-full h-1 transition-all duration-100" style="top: ${m}%; background: ${a};"></div>`:""}
|
|
209
180
|
</div>
|
|
210
181
|
</div>
|
|
211
182
|
</div>
|
|
212
183
|
<div class="flex-1 flex flex-col">
|
|
213
184
|
<div class="text-xs text-white opacity-70 text-center mb-1">R</div>
|
|
214
185
|
<div class="flex-1 relative flex flex-col justify-end bg-black/30 rounded-lg overflow-hidden">
|
|
215
|
-
<div class="rounded-t transition-all duration-75" style="height: ${
|
|
216
|
-
${
|
|
186
|
+
<div class="rounded-t transition-all duration-75" style="height: ${l}%; background: ${t};">
|
|
187
|
+
${y.current>.1?`<div class="absolute w-full h-1 transition-all duration-100" style="top: ${C}%; background: ${a};"></div>`:""}
|
|
217
188
|
</div>
|
|
218
189
|
</div>
|
|
219
190
|
</div>
|
|
220
|
-
`},Ae=()=>{!C.current||!c||(O?C.current.pause():(B.current&&B.current.state==="suspended"&&B.current.resume(),C.current.play().catch(r=>console.error("Play failed:",r))))},Ce=()=>{C.current&&(C.current.pause(),C.current.currentTime=0,A(!1),U(0),re.current=0,l.current=0,g.current=0,R.current=0,Re())},We=r=>{const o=parseFloat(r.target.value)/100*Y;U(o),C.current&&!Ee&&(C.current.currentTime=o)},Me=()=>ne(!0),Oe=()=>{C.current&&(C.current.currentTime=V),ne(!1)},ze=r=>{const s=parseInt(r.target.value);v(s),pe(s===0)},Ve=r=>{ye(parseFloat(r.target.value))},Ue=()=>pe(!je),Ye=()=>{x.current&&(document.fullscreenElement?document.exitFullscreen():x.current.requestFullscreen().catch(r=>console.error("Fullscreen failed:",r)))},Ie=(r,s)=>{z(o=>({...o,[r]:s})),B.current&&(r==="bass"&&X.current&&(X.current.gain.value=s),r==="mid"&&de.current&&(de.current.gain.value=s),r==="treble"&&te.current&&(te.current.gain.value=s))},Je=()=>{z({bass:0,mid:0,treble:0})},Fe=r=>{if(isNaN(r))return"0:00";const s=Math.floor(r/60),o=Math.floor(r%60);return`${s}:${o.toString().padStart(2,"0")}`};if(n.useEffect(()=>{(j&&!O||N)&&Ae()},[m]),me&&me.length>0)return me.map((r,s)=>e.jsxs("div",{className:"text-red-500 text-sm bg-red-50 p-3 rounded mb-4 border border-red-300",children:[e.jsxs("strong",{children:[r[0],":"]})," ",r[1]]},s));const Se=p?p.side:null,De=Se==="top"||Se==="bottom";return e.jsx("div",{ref:x,className:`rounded-xl overflow-hidden transition-all duration-300 ${oe?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"relative"}`,style:{backgroundColor:j||b?void 0:f?"#49494937":"white"},children:e.jsxs("div",{style:{background:j||b?void 0:f?"#1a1a1ab0":"#f5f5f5",height:oe?"100%":"auto"},className:`${j||b?"":"p-4"} ${oe?"flex flex-col flex-1":""}`,children:[m.videoName&&!oe&&e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:`${f?"text-gray-100":"text-gray-700"} font-medium`,children:d})}),e.jsxs("div",{className:`relative ${De?"flex flex-col gap-3":"flex gap-3"} ${oe?"flex-1 min-h-0":"mb-4"}`,children:[p&&Se==="top"&&e.jsx("div",{className:"w-full h-12",ref:le}),e.jsxs("div",{className:`flex ${!De&&"flex-1"} gap-3`,children:[p&&Se==="left"&&e.jsx("div",{className:"w-12 bg-black/50 rounded-lg p-1",ref:le}),e.jsxs("div",{className:`flex-1 ${f?"bg-black/70":"bg-white/70"} rounded-lg overflow-hidden relative`,children:[e.jsxs("video",{ref:C,className:"w-full h-full object-contain",poster:P||void 0,children:[c&&e.jsx("source",{src:c}),"Your browser does not support the video tag."]}),we&&e.jsx("div",{className:"absolute inset-0 flex flex-col w-full justify-center z-10 rounded-lg p-4 shadow-sm transition-all duration-300",children:e.jsxs("div",{className:`max-w-[600px] w-full mx-auto flex flex-col justify-center z-10 ${f?"bg-black/70":"bg-white/80"} rounded-lg p-4 shadow-sm transition-all duration-300`,children:[e.jsx("h3",{className:`text-sm font-medium mb-4 ${f?"text-gray-200":"text-gray-700"}`,children:"Equalizer"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${f?"text-gray-300":"text-gray-600"}`,children:"Bass"}),e.jsxs("span",{className:`text-xs ${f?"text-gray-300":"text-gray-600"}`,children:[L.bass," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${f?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.bass,onChange:r=>Ie("bass",parseInt(r.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${_} ${(L.bass+20)/40*100}%, #e5e7eb ${(L.bass+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${f?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${f?"text-gray-300":"text-gray-600"}`,children:"Mid"}),e.jsxs("span",{className:`text-xs ${f?"text-gray-300":"text-gray-600"}`,children:[L.mid," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${f?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.mid,onChange:r=>Ie("mid",parseInt(r.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${_} ${(L.mid+20)/40*100}%, #e5e7eb ${(L.mid+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${f?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${f?"text-gray-300":"text-gray-600"}`,children:"Treble"}),e.jsxs("span",{className:`text-xs ${f?"text-gray-300":"text-gray-600"}`,children:[L.treble," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${f?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.treble,onChange:r=>Ie("treble",parseInt(r.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${_} ${(L.treble+20)/40*100}%, #e5e7eb ${(L.treble+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${f?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]})]}),e.jsxs("div",{className:"flex justify-between mt-6",children:[e.jsx("button",{onClick:Je,className:`px-3 py-1 rounded text-xs ${f?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Reset"}),e.jsx("button",{onClick:()=>H(!1),className:`ml-2 px-3 py-1 rounded text-xs ${f?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Close"})]})]})})]}),p&&Se==="right"&&e.jsx("div",{className:"w-12 bg-black/50 rounded-lg p-1",ref:le})]}),p&&Se==="bottom"&&e.jsx("div",{className:"w-full h-12",ref:le})]}),m.seekbar&&e.jsx("div",{className:`mb-4 ${oe?"mt-3":""}`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${f?"text-gray-100":"text-gray-600"} font-mono w-12`,children:Fe(V)}),e.jsx("input",{type:"range",min:"0",max:"100",value:Y>0?V/Y*100:0,onChange:We,onMouseDown:Me,onMouseUp:Oe,onTouchStart:Me,onTouchEnd:Oe,disabled:!c,className:"flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:c&&Y>0?`linear-gradient(to right, ${_} ${V/Y*100}%, #e5e7eb ${V/Y*100}%)`:"#e5e7eb"}}),e.jsx("span",{className:`text-xs ${f?"text-gray-100":"text-gray-600"} font-mono w-12 text-right`,children:Fe(Y)})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[m.play&&e.jsxs("button",{onClick:Ae,disabled:!c,style:{backgroundColor:_},className:`${ie>400?" px-4 py-2":"px-3 py-5"} rounded-full text-sm font-medium text-white hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,children:[e.jsxs("div",{className:"relative w-4 flex items-center",children:[e.jsx(Qe,{size:16,className:`${O?"":"scale-0 translate-y-10"} transition-all absolute`}),e.jsx(Ze,{size:16,className:`${O?"scale-0 -translate-y-10":""} transition-all absolute`})]}),ie>400&&(O?"Pause":"Play")]}),m.stop&&e.jsx("button",{onClick:Ce,disabled:!c,className:`${f?"bg-gray-100 text-black hover:bg-gray-300":"bg-gray-700 text-white hover:bg-gray-800"} px-3 py-3 rounded-full text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,children:e.jsx(it,{size:16})}),m.fullscreen&&e.jsxs("button",{onClick:Ye,className:`${ie<800?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${f?"bg-gray-100 text-black hover:bg-gray-300":"bg-gray-700 text-white hover:bg-gray-800"}`,children:[oe?e.jsx(Et,{size:16}):e.jsx(Nt,{size:16}),e.jsx("span",{style:{display:ie<800?"none":"block"},children:oe?"Exit":"Full"})]}),m.equalizer&&e.jsxs("button",{onClick:()=>H(!we),disabled:!c,className:`${ie<700?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${we?"text-white":"bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,style:we?{backgroundColor:_}:{},children:[e.jsx(qe,{size:16}),e.jsx("span",{style:{display:ie<700?"none":"block"},children:"EQ"})]}),m.speed&&e.jsx("div",{className:"flex items-center",children:e.jsxs("select",{value:ue,onChange:Ve,className:`rounded-full text-sm font-medium border-none outline-none cursor-pointer transition-all bg-transparent ${f?"text-gray-200":"text-gray-800"}`,children:[e.jsx("option",{value:"0.5",className:f?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"0.5x"}),e.jsx("option",{value:"0.75",className:f?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"0.75x"}),e.jsx("option",{value:"1",className:f?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1x"}),e.jsx("option",{value:"1.25",className:f?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1.25x"}),e.jsx("option",{value:"1.5",className:f?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1.5x"}),e.jsx("option",{value:"2",className:f?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"2x"})]})}),m.volume&&e.jsxs("div",{className:"flex items-center gap-1 md:gap-3 ml-auto",children:[e.jsx("button",{onClick:Ue,className:"p-2 rounded-lg hover:bg-gray-100 transition-all",children:je||E===0?e.jsx(rt,{size:20,className:f?"text-gray-100":"text-gray-600"}):e.jsx(tt,{size:20,className:f?"text-gray-100":"text-gray-600"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:E,onChange:ze,className:"hide-for-xs w-24 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, ${_} ${E}%, #e5e7eb ${E}%)`,display:ie<460?"none":"block"}}),e.jsxs("span",{style:{display:ie<800?"none":"block"},className:`text-xs ${f?"text-gray-100":"text-gray-700"} font-mono w-10 text-right`,children:[E,"%"]})]})]}),e.jsx("style",{children:`
|
|
191
|
+
`},ve=()=>{!v.current||!o||(z?v.current.pause():(P.current&&P.current.state==="suspended"&&P.current.resume(),v.current.play().catch(t=>console.error("Play failed:",t))))},pe=()=>{v.current&&(v.current.pause(),v.current.currentTime=0,S(!1),B(0),X.current=0,n.current=0,d.current=0,y.current=0,he())},Se=t=>{const s=parseFloat(t.target.value)/100*A;B(s),v.current&&!fe&&(v.current.currentTime=s)},Pe=()=>U(!0),Te=()=>{v.current&&(v.current.currentTime=I),U(!1)},Le=t=>{const a=parseInt(t.target.value);$(a),re(a===0)},Me=t=>{de(parseFloat(t.target.value))},Fe=()=>re(!ce),ze=()=>{u.current&&(document.fullscreenElement?document.exitFullscreen():u.current.requestFullscreen().catch(t=>console.error("Fullscreen failed:",t)))},we=(t,a)=>{M(s=>({...s,[t]:a})),P.current&&(t==="bass"&&D.current&&(D.current.gain.value=a),t==="mid"&&R.current&&(R.current.gain.value=a),t==="treble"&&K.current&&(K.current.gain.value=a))},Be=()=>{M({bass:0,mid:0,treble:0})},xe=t=>{if(isNaN(t))return"0:00";const a=Math.floor(t/60),s=Math.floor(t%60);return`${a}:${s.toString().padStart(2,"0")}`};if(r.useEffect(()=>{(h&&!z||q)&&ve()},[g]),se&&se.length>0)return se.map((t,a)=>e.jsxs("div",{className:"text-red-500 text-sm bg-red-50 p-3 rounded mb-4 border border-red-300",children:[e.jsxs("strong",{children:[t[0],":"]})," ",t[1]]},a));const ye=f?f.side:null,ke=ye==="top"||ye==="bottom";return e.jsx("div",{ref:u,className:`rounded-xl overflow-hidden transition-all duration-300 ${W?"fixed inset-0 z-[9999] flex flex-col h-screen w-screen bg-black":"relative"}`,style:{backgroundColor:h||x?void 0:i?"#49494937":"white"},children:e.jsxs("div",{style:{background:h||x?void 0:i?"#1a1a1ab0":"#f5f5f5",height:W?"100%":"auto"},className:`${h||x?"":"p-4"} ${W?"flex flex-col flex-1":""}`,children:[g.videoName&&!W&&e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:`${i?"text-gray-100":"text-gray-700"} font-medium`,children:c})}),e.jsxs("div",{className:`relative ${ke?"flex flex-col gap-3":"flex gap-3"} ${W?"flex-1 min-h-0":"mb-4"}`,children:[f&&ye==="top"&&e.jsx("div",{className:"w-full h-12",ref:ee}),e.jsxs("div",{className:`flex ${!ke&&"flex-1"} gap-3`,children:[f&&ye==="left"&&e.jsx("div",{className:"w-12 bg-black/50 rounded-lg p-1",ref:ee}),e.jsxs("div",{className:`flex-1 ${i?"bg-black/70":"bg-white/70"} rounded-lg overflow-hidden relative`,children:[e.jsxs("video",{ref:v,className:"w-full h-full object-contain",poster:N||void 0,children:[o&&e.jsx("source",{src:o}),"Your browser does not support the video tag."]}),ie&&e.jsx("div",{className:"absolute inset-0 flex flex-col w-full justify-center z-10 rounded-lg p-4 shadow-sm transition-all duration-300",children:e.jsxs("div",{className:`max-w-[600px] w-full mx-auto flex flex-col justify-center z-10 ${i?"bg-black/70":"bg-white/80"} rounded-lg p-4 shadow-sm transition-all duration-300`,children:[e.jsx("h3",{className:`text-sm font-medium mb-4 ${i?"text-gray-200":"text-gray-700"}`,children:"Equalizer"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:"Bass"}),e.jsxs("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:[L.bass," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.bass,onChange:t=>we("bass",parseInt(t.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${E} ${(L.bass+20)/40*100}%, #e5e7eb ${(L.bass+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:"Mid"}),e.jsxs("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:[L.mid," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.mid,onChange:t=>we("mid",parseInt(t.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${E} ${(L.mid+20)/40*100}%, #e5e7eb ${(L.mid+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:"Treble"}),e.jsxs("span",{className:`text-xs ${i?"text-gray-300":"text-gray-600"}`,children:[L.treble," dB"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"-20"}),e.jsx("input",{type:"range",min:"-20",max:"20",value:L.treble,onChange:t=>we("treble",parseInt(t.target.value)),className:"flex-1 h-6 bg-gray-300 rounded-lg appearance-none cursor-pointer eq-slider",style:{background:`linear-gradient(to right, ${E} ${(L.treble+20)/40*100}%, #e5e7eb ${(L.treble+20)/40*100}%)`}}),e.jsx("span",{className:`text-xs ${i?"text-gray-400":"text-gray-500"}`,children:"+20"})]})]})]}),e.jsxs("div",{className:"flex justify-between mt-6",children:[e.jsx("button",{onClick:Be,className:`px-3 py-1 rounded text-xs ${i?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Reset"}),e.jsx("button",{onClick:()=>T(!1),className:`ml-2 px-3 py-1 rounded text-xs ${i?"bg-gray-700 text-gray-200 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"} transition-all`,children:"Close"})]})]})})]}),f&&ye==="right"&&e.jsx("div",{className:"w-12 bg-black/50 rounded-lg p-1",ref:ee})]}),f&&ye==="bottom"&&e.jsx("div",{className:"w-full h-12",ref:ee})]}),g.seekbar&&e.jsx("div",{className:`mb-4 ${W?"mt-3":""}`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-xs ${i?"text-gray-100":"text-gray-600"} font-mono w-12`,children:xe(I)}),e.jsx("input",{type:"range",min:"0",max:"100",value:A>0?I/A*100:0,onChange:Se,onMouseDown:Pe,onMouseUp:Te,onTouchStart:Pe,onTouchEnd:Te,disabled:!o,className:"flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:o&&A>0?`linear-gradient(to right, ${E} ${I/A*100}%, #e5e7eb ${I/A*100}%)`:"#e5e7eb"}}),e.jsx("span",{className:`text-xs ${i?"text-gray-100":"text-gray-600"} font-mono w-12 text-right`,children:xe(A)})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[g.play&&e.jsxs("button",{onClick:ve,disabled:!o,style:{backgroundColor:E},className:`${Y>400?" px-4 py-2":"px-3 py-5"} rounded-full text-sm font-medium text-white hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,children:[e.jsxs("div",{className:"relative w-4 flex items-center",children:[e.jsx($e,{size:16,className:`${z?"":"scale-0 translate-y-10"} transition-all absolute`}),e.jsx(Ee,{size:16,className:`${z?"scale-0 -translate-y-10":""} transition-all absolute`})]}),Y>400&&(z?"Pause":"Play")]}),g.stop&&e.jsx("button",{onClick:pe,disabled:!o,className:`${i?"bg-gray-100 text-black hover:bg-gray-300":"bg-gray-700 text-white hover:bg-gray-800"} px-3 py-3 rounded-full text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-2 transition-all`,children:e.jsx(De,{size:16})}),g.fullscreen&&e.jsxs("button",{onClick:ze,className:`${Y<800?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${i?"bg-gray-100 text-black hover:bg-gray-300":"bg-gray-700 text-white hover:bg-gray-800"}`,children:[W?e.jsx(Ye,{size:16}):e.jsx(Je,{size:16}),e.jsx("span",{style:{display:Y<800?"none":"block"},children:W?"Exit":"Full"})]}),g.equalizer&&e.jsxs("button",{onClick:()=>T(!ie),disabled:!o,className:`${Y<700?"px-3 py-3":"px-4 py-2"} rounded-full text-sm font-medium flex items-center gap-2 transition-all ${ie?"text-white":"bg-gray-100 text-gray-700 hover:bg-gray-300"} disabled:opacity-40 disabled:cursor-not-allowed`,style:ie?{backgroundColor:E}:{},children:[e.jsx(Ce,{size:16}),e.jsx("span",{style:{display:Y<700?"none":"block"},children:"EQ"})]}),g.speed&&e.jsx("div",{className:"flex items-center",children:e.jsxs("select",{value:le,onChange:Me,className:`rounded-full text-sm font-medium border-none outline-none cursor-pointer transition-all bg-transparent ${i?"text-gray-200":"text-gray-800"}`,children:[e.jsx("option",{value:"0.5",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"0.5x"}),e.jsx("option",{value:"0.75",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"0.75x"}),e.jsx("option",{value:"1",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1x"}),e.jsx("option",{value:"1.25",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1.25x"}),e.jsx("option",{value:"1.5",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"1.5x"}),e.jsx("option",{value:"2",className:i?"bg-gray-800 text-gray-100":"bg-gray-100 text-gray-800",children:"2x"})]})}),g.volume&&e.jsxs("div",{className:"flex items-center gap-1 md:gap-3 ml-auto",children:[e.jsx("button",{onClick:Fe,className:"p-2 rounded-lg hover:bg-gray-100 transition-all",children:ce||w===0?e.jsx(je,{size:20,className:i?"text-gray-100":"text-gray-600"}):e.jsx(Ae,{size:20,className:i?"text-gray-100":"text-gray-600"})}),e.jsx("input",{type:"range",min:"0",max:"100",value:w,onChange:Le,className:"hide-for-xs w-24 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, ${E} ${w}%, #e5e7eb ${w}%)`,display:Y<460?"none":"block"}}),e.jsxs("span",{style:{display:Y<800?"none":"block"},className:`text-xs ${i?"text-gray-100":"text-gray-700"} font-mono w-10 text-right`,children:[w,"%"]})]})]}),e.jsx("style",{children:`
|
|
221
192
|
input[type="range"]::-webkit-slider-thumb {
|
|
222
193
|
-webkit-appearance: none;
|
|
223
194
|
appearance: none;
|
|
224
195
|
width: 16px;
|
|
225
196
|
height: 16px;
|
|
226
197
|
border-radius: 50%;
|
|
227
|
-
background: ${
|
|
198
|
+
background: ${E};
|
|
228
199
|
cursor: pointer;
|
|
229
200
|
border: 2px solid white;
|
|
230
201
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
@@ -234,7 +205,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
234
205
|
width: 16px;
|
|
235
206
|
height: 16px;
|
|
236
207
|
border-radius: 50%;
|
|
237
|
-
background: ${
|
|
208
|
+
background: ${E};
|
|
238
209
|
cursor: pointer;
|
|
239
210
|
border: 2px solid white;
|
|
240
211
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
@@ -263,4 +234,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
263
234
|
display: none;
|
|
264
235
|
}
|
|
265
236
|
}
|
|
266
|
-
`})]})})}function
|
|
237
|
+
`})]})})}function rt(){const[o,c]=r.useState(null),[f,p]=r.useState("No track loaded"),[N,g]=r.useState("purple"),[b,x]=r.useState(!1),[q,E]=r.useState(!1),[O,z]=r.useState("light"),S=r.useRef(null),I=A=>{var w;const j=(w=A.target.files)==null?void 0:w[0];if(j){const $=URL.createObjectURL(j);c($),p(j.name)}},B=()=>{var A;(A=S.current)==null||A.click()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 md:p-8",style:{backgroundColor:O==="dark"?"#222":"white"},children:e.jsxs("div",{className:"w-full h-full md:h-auto md:max-w-4xl",children:[b&&e.jsx(Oe,{theme:N,setTheme:g,close:()=>x(!1)}),e.jsxs("div",{className:"container-glass rounded-xl p-8",children:[e.jsxs("div",{className:"mb-6 flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("h1",{className:`text-2xl font-semibold ${O==="dark"?"text-gray-200":"text-gray-800"} mb-1`,children:"Audio Visualizer"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Professional frequency analyzer"})]}),e.jsxs("button",{onClick:()=>x(!b),className:"bg-white border border-gray-300 text-gray-700 px-4 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",children:[e.jsx("span",{children:"🎨"})," Themes"]})]}),e.jsx(Ve,{audio:o||void 0,name:f||void 0,author:"K.Prabhasha",theme:N,autoPlay:!1,thumbnail:"https://cdn-icons-png.flaticon.com/512/3845/3845874.png",mode:O,transparent:q,volume:70,controls:{play:!0,pause:!0,stop:!0,seekbar:!0,volume:!0,loop:!0,trackName:!0}}),e.jsx(Ue,{audio:o||"",width:400,thumbnail:"https://cdn-icons-png.flaticon.com/512/8316/8316619.png",autoPlay:!1,gradient:["#26ce3aff","#39eed9ff"],background:"#c0ffefff"}),e.jsx(We,{audio:o||"",thumbnail:"https://cdn-icons-png.flaticon.com/512/17524/17524837.png",autoPlay:!1,gradient:["#26ce3aff","#39eed9ff"],background:"#c0ffefff"}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"file",ref:S,onChange:I,accept:"audio/*",className:"hidden"}),e.jsxs("button",{onClick:B,className:"bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",children:[e.jsx(et,{size:16}),"Load Audio"]}),e.jsx("button",{onClick:()=>z(O==="dark"?"light":"dark"),className:"bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",children:O==="dark"?"Light":"Dark"}),e.jsxs("button",{onClick:()=>E(!q),className:"bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 flex items-center gap-2",children:["Transparent: ",String(q)]})]})]})]})})}J.DemoVisualizePlayer=rt,J.NanoAudioPlayer=We,J.ThemeSelector=Oe,J.VideoPlayer=tt,J.VisualizePlayer=Ve,J.WaveAudioPlayer=Ue,J.themes=oe,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})});
|