UNPKG

react-audio-wave-with-segments

Version:
16 lines (15 loc) 44.1 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@babel/runtime-corejs3/helpers/defineProperty"),require("@babel/runtime-corejs3/helpers/asyncToGenerator"),require("@babel/runtime-corejs3/helpers/slicedToArray"),require("@babel/runtime-corejs3/core-js/instance/map"),require("@babel/runtime-corejs3/core-js/object/keys"),require("@babel/runtime-corejs3/core-js/object/get-own-property-symbols"),require("@babel/runtime-corejs3/core-js/instance/filter"),require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"),require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptors"),require("@babel/runtime-corejs3/core-js/object/define-properties"),require("@babel/runtime-corejs3/core-js/object/define-property"),require("@babel/runtime-corejs3/regenerator"),require("react"),require("@babel/runtime-corejs3/helpers/objectWithoutProperties"),require("@babel/runtime-corejs3/helpers/classCallCheck"),require("@babel/runtime-corejs3/helpers/createClass"),require("@babel/runtime-corejs3/core-js/promise"),require("@babel/runtime-corejs3/core-js/instance/includes"),require("@babel/runtime-corejs3/core-js/number/parse-float"),require("@babel/runtime-corejs3/core-js/object/entries"),require("@babel/runtime-corejs3/core-js/number/parse-int"),require("@babel/runtime-corejs3/helpers/classPrivateFieldGet"),require("@babel/runtime-corejs3/core-js/map"),require("@babel/runtime-corejs3/core-js/instance/index-of"),require("@babel/runtime-corejs3/core-js/instance/splice"),require("@babel/runtime-corejs3/core-js/weak-map")):"function"==typeof define&&define.amd?define(["exports","@babel/runtime-corejs3/helpers/defineProperty","@babel/runtime-corejs3/helpers/asyncToGenerator","@babel/runtime-corejs3/helpers/slicedToArray","@babel/runtime-corejs3/core-js/instance/map","@babel/runtime-corejs3/core-js/object/keys","@babel/runtime-corejs3/core-js/object/get-own-property-symbols","@babel/runtime-corejs3/core-js/instance/filter","@babel/runtime-corejs3/core-js/object/get-own-property-descriptor","@babel/runtime-corejs3/core-js/object/get-own-property-descriptors","@babel/runtime-corejs3/core-js/object/define-properties","@babel/runtime-corejs3/core-js/object/define-property","@babel/runtime-corejs3/regenerator","react","@babel/runtime-corejs3/helpers/objectWithoutProperties","@babel/runtime-corejs3/helpers/classCallCheck","@babel/runtime-corejs3/helpers/createClass","@babel/runtime-corejs3/core-js/promise","@babel/runtime-corejs3/core-js/instance/includes","@babel/runtime-corejs3/core-js/number/parse-float","@babel/runtime-corejs3/core-js/object/entries","@babel/runtime-corejs3/core-js/number/parse-int","@babel/runtime-corejs3/helpers/classPrivateFieldGet","@babel/runtime-corejs3/core-js/map","@babel/runtime-corejs3/core-js/instance/index-of","@babel/runtime-corejs3/core-js/instance/splice","@babel/runtime-corejs3/core-js/weak-map"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactAudioWave={},e._defineProperty,e._asyncToGenerator,e._slicedToArray,e._map,e._keys,e["_get-own-property-symbols"],e._filter,e["_get-own-property-descriptor"],e["_get-own-property-descriptors"],e["_define-properties"],e["_define-property"],e._regenerator,e.React,e._objectWithoutProperties,e._classCallCheck,e._createClass,e._promise,e._includes,e["_parse-float"],e._entries,e["_parse-int"],e._classPrivateFieldGet,e._map,e["_index-of"],e._splice,e["_weak-map"])}(this,(function(e,t,r,n,o,i,a,s,u,c,l,f,d,p,h,v,m,b,y,g,w,_,j,E,O,x,k){"use strict";function S(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var C={exports:{}}; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(e){!function(){var t={}.hasOwnProperty;function r(){for(var e=[],n=0;n<arguments.length;n++){var o=arguments[n];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o)){if(o.length){var a=r.apply(null,o);a&&e.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){e.push(o.toString());continue}for(var s in o)t.call(o,s)&&o[s]&&e.push(s)}}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):window.classNames=r}()}(C);var R=S(C.exports),T=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var r=-1;return e.some((function(e,n){return e[0]===t&&(r=n,!0)})),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var r=e(this.__entries__,t),n=this.__entries__[r];return n&&n[1]},t.prototype.set=function(t,r){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=r:this.__entries__.push([t,r])},t.prototype.delete=function(t){var r=this.__entries__,n=e(r,t);~n&&r.splice(n,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var r=0,n=this.__entries__;r<n.length;r++){var o=n[r];e.call(t,o[1],o[0])}},t}()}(),P="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,M="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),A="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(M):function(e){return setTimeout((function(){return e(Date.now())}),1e3/60)};var L=["top","right","bottom","left","width","height","size","weight"],N="undefined"!=typeof MutationObserver,D=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var r=!1,n=!1,o=0;function i(){r&&(r=!1,e()),n&&s()}function a(){A(i)}function s(){var e=Date.now();if(r){if(e-o<2)return;n=!0}else r=!0,n=!1,setTimeout(a,t);o=e}return s}(this.refresh.bind(this),20)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,r=t.indexOf(e);~r&&t.splice(r,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter((function(e){return e.gatherActive(),e.hasActive()}));return e.forEach((function(e){return e.broadcastActive()})),e.length>0},e.prototype.connect_=function(){P&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),N?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){P&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,r=void 0===t?"":t;L.some((function(e){return!!~r.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),I=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},F=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||M},q=V(0,0,0,0);function W(e){return parseFloat(e)||0}function $(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(t,r){return t+W(e["border-"+r+"-width"])}),0)}function z(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return q;var n=F(e).getComputedStyle(e),o=function(e){for(var t={},r=0,n=["top","right","bottom","left"];r<n.length;r++){var o=n[r],i=e["padding-"+o];t[o]=W(i)}return t}(n),i=o.left+o.right,a=o.top+o.bottom,s=W(n.width),u=W(n.height);if("border-box"===n.boxSizing&&(Math.round(s+i)!==t&&(s-=$(n,"left","right")+i),Math.round(u+a)!==r&&(u-=$(n,"top","bottom")+a)),!function(e){return e===F(e).document.documentElement}(e)){var c=Math.round(s+i)-t,l=Math.round(u+a)-r;1!==Math.abs(c)&&(s-=c),1!==Math.abs(l)&&(u-=l)}return V(o.left,o.top,s,u)}var G="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof F(e).SVGGraphicsElement}:function(e){return e instanceof F(e).SVGElement&&"function"==typeof e.getBBox};function U(e){return P?G(e)?function(e){var t=e.getBBox();return V(0,0,t.width,t.height)}(e):z(e):q}function V(e,t,r,n){return{x:e,y:t,width:r,height:n}}var B=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=V(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=U(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),H=function(e,t){var r,n,o,i,a,s,u,c=(n=(r=t).x,o=r.y,i=r.width,a=r.height,s="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,u=Object.create(s.prototype),I(u,{x:n,y:o,width:i,height:a,top:o,right:n+i,bottom:a+o,left:n}),u);I(this,{target:e,contentRect:c})},Y=function(){function e(e,t,r){if(this.activeObservations_=[],this.observations_=new T,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=r}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof F(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new B(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof F(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach((function(t){t.isActive()&&e.activeObservations_.push(t)}))},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map((function(e){return new H(e.target,e.broadcastRect())}));this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),X="undefined"!=typeof WeakMap?new WeakMap:new T,J=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=D.getInstance(),n=new Y(t,r,this);X.set(this,n)};["observe","unobserve","disconnect"].forEach((function(e){J.prototype[e]=function(){var t;return(t=X.get(this))[e].apply(t,arguments)}}));var K,Q=void 0!==M.ResizeObserver?M.ResizeObserver:J,Z=function(e,t){var r=p.useState({width:void 0,height:void 0}),o=n(r,2),i=o[0],a=o[1];return p.useLayoutEffect((function(){var r;if(r="function"==typeof e?e():"current"in e?e.current:e){var n=new Q((function(e){e.forEach((function(e){var r=e.target,n={width:r.clientWidth,height:r.clientHeight};null==t||t(n),a(n)}))}));return n.observe(r),function(){n.disconnect()}}}),[t,e]),i},ee={exports:{}},te={};var re,ne={}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */"production"===process.env.NODE_ENV?ee.exports=function(){if(K)return te;K=1;var e=p,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(e,r,a){var s,u={},c=null,l=null;for(s in void 0!==a&&(c=""+a),void 0!==r.key&&(c=""+r.key),void 0!==r.ref&&(l=r.ref),r)n.call(r,s)&&!i.hasOwnProperty(s)&&(u[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===u[s]&&(u[s]=r[s]);return{$$typeof:t,type:e,key:c,ref:l,props:u,_owner:o.current}}return te.Fragment=r,te.jsx=a,te.jsxs=a,te}():ee.exports=(re||(re=1,"production"!==process.env.NODE_ENV&&function(){var e=p,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),v=Symbol.iterator,m="@@iterator",b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=b.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}("error",e,r)}var g,w=!1,_=!1,j=!1,E=!1,O=!1;function x(e){return e.displayName||"Context"}function k(e){if(null==e)return null;if("number"==typeof e.tag&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case n:return"Fragment";case r:return"Portal";case i:return"Profiler";case o:return"StrictMode";case c:return"Suspense";case l:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case s:return x(e)+".Consumer";case a:return x(e._context)+".Provider";case u:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case f:var t=e.displayName||null;return null!==t?t:k(e.type)||"Memo";case d:var p=e,h=p._payload,v=p._init;try{return k(v(h))}catch(e){return null}}return null}g=Symbol.for("react.module.reference");var S,C,R,T,P,M,A,L=Object.assign,N=0;function D(){}D.__reactDisabledLog=!0;var I,F=b.ReactCurrentDispatcher;function q(e,t,r){if(void 0===I)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);I=n&&n[1]||""}return"\n"+I+e}var W,$=!1,z="function"==typeof WeakMap?WeakMap:Map;function G(e,t){if(!e||$)return"";var r,n=W.get(e);if(void 0!==n)return n;$=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=F.current,F.current=null,function(){if(0===N){S=console.log,C=console.info,R=console.warn,T=console.error,P=console.group,M=console.groupCollapsed,A=console.groupEnd;var e={configurable:!0,enumerable:!0,value:D,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){r=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){r=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),u=r.stack.split("\n"),c=s.length-1,l=u.length-1;c>=1&&l>=0&&s[c]!==u[l];)l--;for(;c>=1&&l>=0;c--,l--)if(s[c]!==u[l]){if(1!==c||1!==l)do{if(c--,--l<0||s[c]!==u[l]){var f="\n"+s[c].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&W.set(e,f),f}}while(c>=1&&l>=0);break}}}finally{$=!1,F.current=o,function(){if(0==--N){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},e,{value:S}),info:L({},e,{value:C}),warn:L({},e,{value:R}),error:L({},e,{value:T}),group:L({},e,{value:P}),groupCollapsed:L({},e,{value:M}),groupEnd:L({},e,{value:A})})}N<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var d=e?e.displayName||e.name:"",p=d?q(d):"";return"function"==typeof e&&W.set(e,p),p}function U(e,t,r){if(null==e)return"";if("function"==typeof e)return G(e,!(!(n=e.prototype)||!n.isReactComponent));var n;if("string"==typeof e)return q(e);switch(e){case c:return q("Suspense");case l:return q("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return G(e.render,!1);case f:return U(e.type,t,r);case d:var o=e,i=o._payload,a=o._init;try{return U(a(i),t,r)}catch(e){}}return""}W=new z;var V=Object.prototype.hasOwnProperty,B={},H=b.ReactDebugCurrentFrame;function Y(e){if(e){var t=e._owner,r=U(e.type,e._source,t?t.type:null);H.setExtraStackFrame(r)}else H.setExtraStackFrame(null)}var X=Array.isArray;function J(e){return X(e)}function K(e){return""+e}function Q(e){if(function(e){try{return K(e),!1}catch(e){return!0}}(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),K(e)}var Z,ee,te,re=b.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0};te={};var ie=function(e,r,n,o,i,a,s){var u={$$typeof:t,type:e,key:r,ref:n,props:s,_owner:a,_store:{}};return Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function ae(e,t,r,n,o){var i,a={},s=null,u=null;for(i in void 0!==r&&(Q(r),s=""+r),function(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(Q(t.key),s=""+t.key),function(e){if(V.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(u=t.ref,function(e,t){if("string"==typeof e.ref&&re.current&&t&&re.current.stateNode!==t){var r=k(re.current.type);te[r]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',k(re.current.type),e.ref),te[r]=!0)}}(t,o)),t)V.call(t,i)&&!oe.hasOwnProperty(i)&&(a[i]=t[i]);if(e&&e.defaultProps){var c=e.defaultProps;for(i in c)void 0===a[i]&&(a[i]=c[i])}if(s||u){var l="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var r=function(){Z||(Z=!0,y("%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)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(a,l),u&&function(e,t){var r=function(){ee||(ee=!0,y("%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)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(a,l)}return ie(e,s,u,o,n,re.current,a)}var se,ue=b.ReactCurrentOwner,ce=b.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,r=U(e.type,e._source,t?t.type:null);ce.setExtraStackFrame(r)}else ce.setExtraStackFrame(null)}function fe(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function de(){if(ue.current){var e=k(ue.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}se=!1;var pe={};function he(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=de();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!pe[r]){pe[r]=!0;var n="";e&&e._owner&&e._owner!==ue.current&&(n=" It was passed a child from "+k(e._owner.type)+"."),le(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),le(null)}}}function ve(e,t){if("object"==typeof e)if(J(e))for(var r=0;r<e.length;r++){var n=e[r];fe(n)&&he(n,t)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=v&&e[v]||e[m];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,a=o.call(e);!(i=a.next()).done;)fe(i.value)&&he(i.value,t)}}function me(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==u&&r.$$typeof!==f)return;t=r.propTypes}if(t){var n=k(r);!function(e,t,r,n,o){var i=Function.call.bind(V);for(var a in e)if(i(e,a)){var s=void 0;try{if("function"!=typeof e[a]){var u=Error((n||"React class")+": "+r+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}s=e[a](t,a,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(Y(o),y("%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).",n||"React class",r,a,typeof s),Y(null)),s instanceof Error&&!(s.message in B)&&(B[s.message]=!0,Y(o),y("Failed %s type: %s",r,s.message),Y(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||se||(se=!0,y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function be(e,r,p,v,m,b){var x=function(e){return"string"==typeof e||"function"==typeof e||!!(e===n||e===i||O||e===o||e===c||e===l||E||e===h||w||_||j)||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===f||e.$$typeof===a||e.$$typeof===s||e.$$typeof===u||e.$$typeof===g||void 0!==e.getModuleId)}(e);if(!x){var S="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(S+=" 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 C,R=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(m);S+=R||de(),null===e?C="null":J(e)?C="array":void 0!==e&&e.$$typeof===t?(C="<"+(k(e.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):C=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,S)}var T=ae(e,r,p,m,b);if(null==T)return T;if(x){var P=r.children;if(void 0!==P)if(v)if(J(P)){for(var M=0;M<P.length;M++)ve(P[M],e);Object.freeze&&Object.freeze(P)}else y("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 ve(P,e)}return e===n?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){le(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),le(null);break}}null!==e.ref&&(le(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}(T):me(T),T}var ye=function(e,t,r){return be(e,t,r,!1)},ge=function(e,t,r){return be(e,t,r,!0)};ne.Fragment=n,ne.jsx=ye,ne.jsxs=ge}()),ne);var oe=ee.exports,ie=function(e){var t=e.width,r=e.height,n=e.peaks,o=e.color,i=e.bits,a=e.barGap,s=e.barWidth,u=e.className,c=e.pixelRatio,l=e.offset,f=void 0===l?0:l,d=p.useRef(null);return p.useEffect((function(){var e=t/c,u=d.current.getContext("2d"),l=r/c/2,p=Math.pow(2,i-1),h=s+a;u.clearRect(0,0,t,r),u.save(),u.fillStyle=o,u.scale(c,c);for(var v=0;v<e;v+=h){var m=n[2*(v+f)]/p,b=n[2*(v+f)+1]/p,y=Math.abs(m*l),g=Math.abs(b*l);u.fillRect(v,l-g,s,g+y)}u.restore()}),[a,s,i,o,r,f,n,c,t]),oe.jsx("canvas",{width:t,height:r,ref:d,className:R(u),children:"Your browser does not support HTML5 canvas."})},ae=p.memo(ie);function se(e,t){var r=i(e);if(a){var n=a(e);t&&(n=s(n).call(n,(function(t){return u(e,t).enumerable}))),r.push.apply(r,n)}return r}function ue(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?se(Object(n),!0).forEach((function(r){t(e,r,n[r])})):c?l(e,c(n)):se(Object(n)).forEach((function(t){f(e,t,u(n,t))}))}return e}var ce=p.forwardRef((function(e,t){var r=e.className,o=e.progressColor,i=e.progressStyle,a=e.children,s=e.cursorColor,u=e.progressCursorVisible,c=p.useState(0),l=n(c,2),f=l[0],d=l[1];return p.useImperativeHandle(t,(function(){return{changeOffsetPixels:function(e){void 0!==e&&d(e)}}})),oe.jsx("div",{className:R(r),style:ue(ue({},i),{},{width:f,borderRight:u?"1px solid ".concat(s||o):"none"}),children:a})})),le=p.memo(ce),fe=p.forwardRef((function(e,t){var r=p.useState(),o=n(r,2),i=o[0],a=o[1];return p.useImperativeHandle(t,(function(){return{changeLoadedPercent:function(e){void 0!==e&&a(e)}}})),oe.jsx("span",{children:i})})),de=p.memo(fe);function pe(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}pe(".cursor-time{align-items:center;bottom:0;box-sizing:border-box;display:flex;left:0;position:absolute;top:0;width:auto}.cursor-time,.cursor-time .time{pointer-events:none}");var he=["backgroundColor","color","padding","fontSize"];function ve(e,t){var r=i(e);if(a){var n=a(e);t&&(n=s(n).call(n,(function(t){return u(e,t).enumerable}))),r.push.apply(r,n)}return r}function me(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ve(Object(n),!0).forEach((function(r){t(e,r,n[r])})):c?l(e,c(n)):ve(Object(n)).forEach((function(t){f(e,t,u(n,t))}))}return e}var be=p.forwardRef((function(e,t){var r=e.config,o=e.cursorColor,i=e.cursorVisible,a=e.timeFormat,s=r||{},u=s.zIndex,c=void 0===u?4:u,l=s.customShowTimeStyle||{},f=l.backgroundColor,d=void 0===f?o:f,v=l.color,m=void 0===v?"#fff":v,b=l.padding,y=void 0===b?"2px":b,g=l.fontSize,w=void 0===g?"10px":g,_=h(l,he),j=p.useState(0),E=n(j,2),O=E[0],x=E[1],k=p.useState(0),S=n(k,2),C=S[0],R=S[1],T=p.useState(!1),P=n(T,2),M=P[0],A=P[1],L=p.useState((function(){return(null==a?void 0:a(0))||"00:00:00"})),N=n(L,2),D=N[0],I=N[1],F=p.useRef(null),q=Z(F).width;return p.useImperativeHandle(t,(function(){return{updateCursorPosition:function(e,t,r,n){var o=null==a?void 0:a(e);I(o),R(1),A(n<r+q),x(t)},hideCursor:function(){R(0)},showCursor:function(){R(1)}}})),i?oe.jsx("div",{className:"cursor-time",style:{opacity:C,zIndex:c,left:O,borderLeftStyle:"solid",borderLeftWidth:1,borderLeftColor:d},children:oe.jsx("div",{ref:F,className:"time",style:me({backgroundColor:d,color:m,padding:y,fontSize:w,marginLeft:M?-q:0},_),children:D})}):null})),ye=p.memo(be);function ge(e){for(var t,r=1/0,n=-1/0,o=0,i=e.length;o<i;o++)r>(t=e[o])&&(r=t),n<t&&(n=t);return{min:r,max:n}}function we(e,t){var r=Math.pow(2,t-1),n=e<0?e*r:e*(r-1);return Math.max(-r,Math.min(r-1,n))}function _e(e,t,r){var n,o,i,a,s,u,c=e.length,l=Math.ceil(c/t),f=je(r,2*l);for(n=0;n<l;n++)o=n*t,i=(n+1)*t>c?c:(n+1)*t,s=we((u=ge(e.subarray(o,i))).min,r),a=we(u.max,r),f[2*n]=s,f[2*n+1]=a;return f}function je(e,t){return new(new Function(`return Int${e}Array`)())(t)}function Ee(e,t){return"number"==typeof e?e:t}var Oe=S((function(e,t,r,n,o,i){if(t=Ee(t,1e3),i=Ee(i,16),null==r&&(r=!0),[8,16,32].indexOf(i)<0)throw new Error("Invalid number of bits specified for peaks.");var a,s,u=e.numberOfChannels,c=[];if(n=Ee(n,0),o=Ee(o,e.length),void 0===e.subarray)for(a=0;a<u;a++)s=e.getChannelData(a).subarray(n,o),c.push(_e(s,t,i));else c.push(_e(e.subarray(n,o),t,i));return r&&c.length>1&&(c=function(e,t){var r,n,o=e.length,i=1/o,a=e[0].length/2,s=0,u=0,c=je(t,2*a);for(u=0;u<a;u++){for(r=0,n=0,s=0;s<o;s++)r+=i*e[s][2*u],n+=i*e[s][2*u+1];c[2*u]=r,c[2*u+1]=n}return[c]}(c,i)),{length:c[0].length/2,data:c,bits:i}}));function xe(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return y(t=[Number.isNaN(e),void 0===e,null===e]).call(t,!0)?"":y(r=[0,"0"]).call(r,e)?"0":"".concat(g(String((100*Number(e)).toFixed(n))),"%")}var ke=function(){function e(r){v(this,e),t(this,"audioContext",void 0),t(this,"buffer",void 0),t(this,"source",void 0),t(this,"gain",void 0),t(this,"peakData",void 0),t(this,"duration",void 0),t(this,"lastOffsetPixels",void 0),t(this,"pausedAtOffsetTime",void 0),t(this,"currentOffsetTime",void 0),t(this,"startTime",void 0),t(this,"samplesPerPixel",void 0),t(this,"volume",void 0),t(this,"playing",void 0),t(this,"supportPlaybackRate",void 0),t(this,"hasEndedListener",void 0),t(this,"audioMedia",void 0),t(this,"pixelRatio",void 0),this.supportPlaybackRate=r,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.source=null,this.gain=null,this.peakData={length:0,data:[],bits:8},this.samplesPerPixel=1e3,this.duration=0,this.volume=1,this.pausedAtOffsetTime=0,this.currentOffsetTime=0,this.startTime=0,this.lastOffsetPixels=0,this.playing=!1,this.audioMedia=null,this.hasEndedListener=!1,this.pixelRatio=Math.max(1,Math.floor(window.devicePixelRatio))}return m(e,[{key:"initWebAudio",value:function(e,t,r){var n=this;try{this.audioContext.decodeAudioData(e,(function(e){n.buffer=e,n.duration=e.duration,t(n.duration)}))}catch(e){null==r||r(e)}}},{key:"initAudioElement",value:function(e,t){this.supportPlaybackRate&&(this.audioMedia&&(this.audioMedia.remove(),this.audioMedia=null),this.audioMedia=document.createElement("audio"),this.audioMedia.preload="auto",this.audioMedia.controls=!1,this.audioMedia.src=e,t.append(this.audioMedia))}},{key:"getWebaudioPeaks",value:function(e,t){if(e&&this.buffer)return this.samplesPerPixel=Math.floor(this.buffer.length/e),this.peakData=Oe(this.buffer,this.samplesPerPixel,t),this.peakData}},{key:"getCurrentOffsetTime",value:function(){return this.supportPlaybackRate?(this.currentOffsetTime=this.audioMedia.currentTime,this.currentOffsetTime):(this.currentOffsetTime=this.playing?this.audioContext.currentTime-this.startTime+this.pausedAtOffsetTime:this.pausedAtOffsetTime,this.currentOffsetTime)}},{key:"getCurrentOffsetPixels",value:function(){var e,t,r,n=(e=this.currentOffsetTime,t=this.samplesPerPixel,r=this.buffer.sampleRate,Math.ceil(e*r/t));if(n!==this.lastOffsetPixels)return this.lastOffsetPixels=n,n}},{key:"getPixelsToSeconds",value:function(e){return t=e,r=this.samplesPerPixel,n=this.buffer.sampleRate,t*r/n;var t,r,n}},{key:"updateCurrentOffsetPositon",value:function(e){this.supportPlaybackRate?this.audioMedia.currentTime=e:(this.currentOffsetTime=e,this.pausedAtOffsetTime=e)}},{key:"pause",value:function(){var e;this.playing=!1,this.supportPlaybackRate?this.audioMedia.pause():(this.pausedAtOffsetTime+=this.audioContext.currentTime-this.startTime,null===(e=this.source)||void 0===e||e.stop(),this.source.disconnect())}},{key:"ended",value:function(){var e,t,r;if(this.playing=!1,this.currentOffsetTime=0,this.lastOffsetPixels=0,this.hasEndedListener=!1,this.supportPlaybackRate)return this.audioMedia.currentTime=0,void this.audioMedia.pause();null===(e=this.source)||void 0===e||e.stop(0),null===(t=this.source)||void 0===t||t.disconnect(),null===(r=this.gain)||void 0===r||r.disconnect(),this.pausedAtOffsetTime=0,this.startTime=0,this.source=null,this.gain=null}},{key:"updateAudioSource",value:function(){var e=this;return new b((function(t){var r=function r(){var n,o,i,a;(t(!0),e.supportPlaybackRate)?null===(i=e.audioMedia)||void 0===i||null===(a=i.removeEventListener)||void 0===a||a.call(i,"ended",r):null===(n=e.source)||void 0===n||null===(o=n.removeEventListener)||void 0===o||o.call(n,"ended",r)};e.supportPlaybackRate?e.hasEndedListener||(e.audioMedia.addEventListener("ended",r),e.hasEndedListener=!0):(e.gain=e.audioContext.createGain(),e.source=e.audioContext.createBufferSource(),e.source.buffer=e.buffer,e.gain.gain.value=e.volume,e.source.connect(e.gain),e.gain.connect(e.audioContext.destination),e.source.loop=!1,e.source.addEventListener("ended",r))}))}},{key:"play",value:function(){var e;this.playing=!0,this.supportPlaybackRate?this.audioMedia.play():(this.startTime=this.audioContext.currentTime,null===(e=this.source)||void 0===e||e.start(this.startTime,this.pausedAtOffsetTime,this.duration))}},{key:"changeVolume",value:function(e){this.volume=e,this.supportPlaybackRate?this.audioMedia.volume=e:this.gain&&(this.gain.gain.value=e)}},{key:"changePlaybackRate",value:function(e){this.supportPlaybackRate&&(this.audioMedia.playbackRate=e)}}]),e}();function Se(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}var Ce=new k,Re=function(){function e(){v(this,e),Se(this,Ce,{writable:!0,value:new E})}return m(e,[{key:"on",value:function(e){var t,r=j(this,Ce).get(e);r||j(this,Ce).set(e,r=[]);for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];(t=r).push.apply(t,o)}},{key:"off",value:function(e,t){if(!t)return j(this,Ce).delete(e);var r=j(this,Ce).get(e);if(!r)return!1;var n=O(r).call(r,t);return!(n<0)&&(x(r).call(r,n,1),0===r.length&&j(this,Ce).delete(e),!0)}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=j(this,Ce).get(e);o&&o.forEach((function(e){try{e.apply(void 0,r)}catch(e){console.log(e)}}))}}]),e}();function Te(e,t){if(!e)throw new Error("fetch url missing");var r=0,o=0,i=new Re,a=new Headers,s=new Request(e),u=t||{},c=u.headers,l=u.responseType,f=void 0===l?"arraybuffer":l,d=u.method,p=void 0===d?"GET":d,h=u.mode,v=void 0===h?"cors":h,m=u.credentials,b=void 0===m?"same-origin":m,y=u.cache,g=void 0===y?"default":y,j=u.redirect,E=void 0===j?"follow":j,O=u.referrer,x=void 0===O?"client":O;i.controller=new AbortController,c&&w(t.headers).forEach((function(e){var t=n(e,2),r=t[0],o=t[1];a.append(r,o)}));var k={method:p,mode:v,credentials:b,cache:g,redirect:E,referrer:x,headers:a,signal:i.controller.signal};return fetch(s,k).then((function(e){var t=!0;e.body||(t=!1);var n=e.headers.get("content-length");if(r=_(n,10),null===n&&(t=!1),!t)return e;var a=e.body.getReader();return new Response(new ReadableStream({start:function(e){!function t(){a.read().then((function(n){var a=n.done,s=n.value;if(a)return i.emit("progress",{loaded:o,total:r,lengthComputable:!1}),void e.close();o+=s.byteLength,i.emit("progress",{loaded:o,total:r,lengthComputable:!(0===r)}),e.enqueue(s),t()})).catch((function(t){e.error(t)}))}()}}),k)})).then((function(e){var t;if(e.ok)switch(f){case"arraybuffer":return e.arrayBuffer();case"json":return e.json();case"blob":return e.blob();case"text":return e.text();default:t="Unknown responseType: ".concat(f)}throw t||(t="HTTP error status: ".concat(e.status)),new Error(t)})).then((function(e){i.emit("success",e)})).catch((function(e){i.emit("error",e)})),i.fetchRequest=s,i}pe(".wave-container{box-sizing:border-box;overflow:hidden;position:relative}.wave-container .channel{position:relative;z-index:1}.wave-container .channel .progress{bottom:0;box-sizing:border-box;left:0;overflow:hidden;position:absolute;top:0;z-index:4}.wave-container .channel .wave-canvas{margin:0;padding:0}.error-container{align-items:center;display:flex;height:100%}.error-container .wave-error-text{color:#ff4d4f}");function Pe(e,t){var r=i(e);if(a){var n=a(e);t&&(n=s(n).call(n,(function(t){return u(e,t).enumerable}))),r.push.apply(r,n)}return r}function Me(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Pe(Object(n),!0).forEach((function(r){t(e,r,n[r])})):c?l(e,c(n)):Pe(Object(n)).forEach((function(t){f(e,t,u(n,t))}))}return e}pe(".segment-time{align-items:center;bottom:0;box-sizing:border-box;display:flex;height:100%;left:0;position:absolute;top:0;width:auto}.segment-time,.segment-time .time{pointer-events:none}");var Ae,Le=function(e){var t=e.onClick,r=e.className,n=e.pixelRatio,o=e.segmentStyle,i=e.segment,a=e.children;return oe.jsx("div",{className:R(r),style:Me(Me({},o),{},{width:"".concat(i.duration*n,"pt"),left:"".concat(i.position*n,"pt")}),onClick:function(){return t(i)},children:a})};function Ne(e,t){var r=i(e);if(a){var n=a(e);t&&(n=s(n).call(n,(function(t){return u(e,t).enumerable}))),r.push.apply(r,n)}return r}function De(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Ne(Object(n),!0).forEach((function(r){t(e,r,n[r])})):c?l(e,c(n)):Ne(Object(n)).forEach((function(t){f(e,t,u(n,t))}))}return e}e.LoadStateEnum=void 0,(Ae=e.LoadStateEnum||(e.LoadStateEnum={}))[Ae.EMPTY=-1]="EMPTY",Ae[Ae.INIT=0]="INIT",Ae[Ae.LOADING=1]="LOADING",Ae[Ae.SUCCESS=2]="SUCCESS",Ae[Ae.ERROR=3]="ERROR";var Ie=function(e){return oe.jsx("div",{className:"error-container",children:oe.jsxs("span",{className:"wave-error-text",children:["Decoding failed: ",e]})})},Fe=p.forwardRef((function(i,a){var s=i.audioSrc,u=i.waveHeight,c=i.colors,l=i.progressStyle,f=i.onChangeLoadState,h=i.onCurrentTimeChange,v=i.onPlayEnded,m=i.onWaveSeekClick,b=i.cursorTimeConfig,y=i.className,g=i.children,w=i.timeFormat,_=i.onWaveSizeChange,j=i.placeholder,E=i.barGap,O=void 0===E?0:E,x=i.barWidth,k=void 0===x?1:x,S=i.mono,C=void 0===S||S,T=i.cursorVisible,P=void 0===T||T,M=i.progressCursorVisible,A=void 0===M||M,L=i.supportPlaybackRate,N=void 0!==L&&L,D=i.emptyElement,I=void 0===D?oe.jsx("span",{children:"no audio content"}):D,F=i.renderErrorElement,q=void 0===F?Ie:F,W=i.segments,$=p.useState(e.LoadStateEnum.INIT),z=n($,2),G=z[0],U=z[1],V=p.useRef(null),B=p.useRef(null),H=p.useRef(null),Y=p.useRef(null),X=p.useRef(null),J=p.useRef(null),K=p.useRef(null),Q=p.useRef(null),ee=Z(B,_).width;p.useRef(ee).current=ee,V.current||(V.current=new ke(N));var te=c.progressColor,re=c.waveColor,ne=c.cursorColor,ie=c.waveBackground,se=void 0===ie?"transparent":ie,ue=p.useCallback((function(t){K.current=t,U(e.LoadStateEnum.ERROR),null==f||f(e.LoadStateEnum.ERROR)}),[f]),ce=p.useCallback(r(d.mark((function t(){var r;return d.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,U(e.LoadStateEnum.LOADING),null==f||f(e.LoadStateEnum.LOADING),t.next=5,Te(s);case 5:(r=t.sent).on("success",(function(t){if(0===t.byteLength)return U(e.LoadStateEnum.EMPTY),void(null==f||f(e.LoadStateEnum.EMPTY));V.current.initWebAudio(t,(function(t){K.current=null,U(e.LoadStateEnum.SUCCESS),null==f||f(e.LoadStateEnum.SUCCESS,t)}),ue)})),r.on("progress",(function(e){void 0!==e&&J.current.changeLoadedPercent(xe(e.loaded/e.total))})),r.on("error",ue),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),ue(t.t0);case 14:case"end":return t.stop()}}),t,null,[[0,11]])}))),[s,ue,f]),fe=p.useCallback((function(){var e,t=V.current.getCurrentOffsetTime(),r=V.current.getCurrentOffsetPixels();null===(e=Y.current)||void 0===e||e.changeOffsetPixels(r),null==h||h(t)}),[h]),pe=p.useCallback((function(){V.current.playing?(fe(),H.current=window.requestAnimationFrame(pe)):window.cancelAnimationFrame(H.current)}),[fe]),he=p.useCallback((function(){V.current.pause(),window.cancelAnimationFrame(H.current)}),[]),ve=p.useCallback((function(){Q.current=V.current.updateAudioSource(),V.current.play(),pe(),Q.current.then((function(e){e&&V.current.playing&&(V.current.ended(),Y.current.changeOffsetPixels(0),null==v||v(),null==h||h(0),window.cancelAnimationFrame(H.current))}))}),[h,v,pe]),me=p.useCallback((function(e,t){var r=V.current.playing;if(!1===r)return V.current.updateCurrentOffsetPositon(e),fe(),void(!0===t&&ve());if(!0===r){if(N)return V.current.updateCurrentOffsetPositon(e),void(!1===t&&(he(),fe()));if(!0===t||void 0===t)return he(),V.current.updateCurrentOffsetPositon(e),void Q.current.then((function(){ve()}));he(),V.current.updateCurrentOffsetPositon(e),fe()}}),[fe,he,ve,N]),be=p.useCallback((function(e){V.current.changeVolume(e)}),[]),ge=p.useCallback((function(e){V.current.changePlaybackRate(e)}),[]),we=p.useCallback((function(){V.current.playing&&he(),V.current=null,U(e.LoadStateEnum.INIT)}),[he]),_e=function(e){var t=B.current.getBoundingClientRect(),r=e.clientX-t.left;return{x:r,time:Math.max(0,V.current.getPixelsToSeconds(r)),clientX:e.clientX,right:t.right}};p.useImperativeHandle(a,(function(){return{seekTo:me,destroy:we,play:ve,pause:he,volume:be,playbackRate:ge}})),p.useEffect((function(){ce()}),[ce]),p.useEffect((function(){V.current.initAudioElement(s,B.current)}),[s]);var je,Ee=p.useMemo((function(){if(ee&&G===e.LoadStateEnum.SUCCESS){var t,r=V.current.getWebaudioPeaks(ee,C);return o(t=r.data).call(t,(function(e,t){var n,i=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:ee,a={pixelRatio:V.current.pixelRatio,color:re,peaks:e,bits:r.bits,width:i,height:u,className:"wave-canvas",barGap:O,barWidth:k};return oe.jsxs("div",{className:"channel",style:{height:u,width:i,backgroundColor:se},children:[oe.jsx(le,{ref:Y,progressStyle:l,progressCursorVisible:A,progressColor:te,cursorColor:ne,className:"progress",children:oe.jsx(ae,De(De({},a),{},{color:te}))}),oe.jsx(ye,{ref:X,timeFormat:w,config:b,cursorColor:ne,cursorVisible:P}),null==W?void 0:o(W).call(W,(function(e){return oe.jsx(Le,{className:"segment-time",segment:e,pixelRatio:a.pixelRatio,segmentStyle:e.style,onClick:e.onClick,children:e.children},e.id)})),oe.jsx(ae,De({},a))]},t)}))}}),[O,k,ne,b,P,G,C,te,A,l,se,re,u,ee,W,w]);return oe.jsx("div",{className:R("wave-container",t({},y,!!y)),style:{height:u},ref:B,onMouseMove:function(t){var r;if(P&&G===e.LoadStateEnum.SUCCESS){var n=_e(t),o=n.time,i=n.x,a=n.clientX,s=n.right;null===(r=X.current)||void 0===r||r.updateCursorPosition(o,i,a,s)}},onMouseLeave:function(){var t;P&&G===e.LoadStateEnum.SUCCESS&&(null===(t=X.current)||void 0===t||t.hideCursor())},onMouseEnter:function(){var t;P&&G===e.LoadStateEnum.SUCCESS&&(null===(t=X.current)||void 0===t||t.showCursor())},onClick:function(e){var t=_e(e).time;me(t),null==m||m({offsetTime:t})},children:G===e.LoadStateEnum.EMPTY?I:G===e.LoadStateEnum.LOADING?oe.jsx(j,{children:oe.jsx(de,{ref:J})}):G===e.LoadStateEnum.ERROR?null==q?void 0:q(null===(je=K.current)||void 0===je?void 0:je.toString()):oe.jsxs(oe.Fragment,{children:[g,Ee]})})})),qe=p.memo(Fe);e.ReactAudioWave=qe}));