react-voice-recorder-player
Version:
Voice Recorder Component for React
47 lines (44 loc) • 67 kB
JavaScript
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".voice-recorder_waveformcontainer{border-top-left-radius:inherit;border-top-right-radius:inherit;background-color:#efefef96;background-image:-webkit-linear-gradient(top,rgb(243,242,242),white)}.voice-recorder_defaultcontainer{align-items:center;display:flex;height:100%;padding:0 15px;width:100%}.voice-recorder_defaultcontainer p{font-style:italic}.voice-recorder_recordcontainer{height:100%;margin:0 20px}.voice-recorder_recordcontainer canvas{height:100%;width:100%}.voice-recorder_playbackcontainer{height:100%;margin:0 20px}.voice-recorder_playbackcontainer #playback,.voice-recorder_playbackcontainer audio{display:none}.voice-recorder_playbackcontainer canvas{width:100%;height:100%}.voice-recorder_playbackcontainer .voice-recorder_canvascontainer{position:relative;height:100%}.voice-recorder_playbackcontainer .voice-recorder_canvascontainer .progressbar,.voice-recorder_playbackcontainer .voice-recorder_canvascontainer .waveformgraph-played-graph{position:absolute;left:0}.voice-recorder_controlscontainer{align-items:center;background-color:#efefef;border-top:1px solid #d8d5d5;border-bottom-left-radius:10px;border-bottom-right-radius:10px;display:flex;justify-content:flex-start;padding:0 15px}.voice-recorder_controlscontainer .voice-recorder_controls{align-items:center;display:flex;height:100%;width:100%}.voice-recorder_controlscontainer .voice-recorder_controlgeneric{all:unset;background:none;border:none;height:70%;transition:all .2s ease-in-out}.voice-recorder_controlscontainer .voice-recorder_controlgeneric:disabled{pointer-events:none;opacity:.5}.voice-recorder_controlscontainer .voice-recorder_controlgeneric:hover{cursor:pointer;opacity:.8}.voice-recorder_controlscontainer .voice-recorder_controlgeneric svg{height:auto;width:65%;transition:all .1s ease-in-out}.voice-recorder_controlscontainer .voice-recorder_controlgeneric>svg:hover{cursor:pointer;opacity:.8}.voice-recorder_controlscontainer .voice-recorder_control{align-items:center;aspect-ratio:1;background:rgba(128,128,128,.1607843137);background-image:-webkit-linear-gradient(283deg,rgba(236,236,236,.83) 50%,#dbdbdb 65%);border:1px solid #d8d5d5;border-radius:100%;box-shadow:0 0 8px #d2d2d2;display:flex;justify-content:center;margin-right:10px;position:relative;transition:all .2s ease-in-out}.voice-recorder_controlscontainer .voice-recorder_stopcontainer{align-items:center;background-color:#bebcbc29;border-radius:50px;display:flex;font-size:small;height:100%;justify-content:space-between;padding:0}.voice-recorder_controlscontainer .voice-recorder_stopcontainer .voice-recorder_stopwatch{margin-right:10px}.voice-recorder_controlscontainer .voice-recorder_stopcontainer .voice-recorder_control{height:100%}.voice-recorder_controlscontainer .voice-recorder_showblinking{animation:blinker 2s ease-in-out infinite}@keyframes blinker{50%{opacity:.5}}.voice-recorder_controlscontainer .voice-recorder_download{align-items:center;display:flex;height:100%;margin-left:auto;justify-content:end}@-webkit-keyframes rotating{0%{-webkit-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotating{0%{-ms-transform:rotate(0deg);-moz-transform:rotate(0deg);-webkit-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0)}to{-ms-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}.voice-recorder_controlscontainer .voice-recorder_rotate{-webkit-animation:rotating 1.5s linear infinite;-moz-animation:rotating 1.5s linear infinite;-ms-animation:rotating 1.5s linear infinite;-o-animation:rotating 1.5s linear infinite;animation:rotating 1.5s linear infinite}.voice-recorder_maincontainer{aspect-ratio:3/1;border:0px solid #d8d5d5;border-radius:10px;box-shadow:0 4px 8px #cecbcb;display:grid;grid-template-rows:2fr 1fr;margin:10px 30px;width:400px;color:#717171;font-family:Inter,Avenir,Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;font-weight:400;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}.voice-recorder_maincontainer canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}@media (max-width: 600px){.voice-recorder_maincontainer{aspect-ratio:auto;margin:0;width:100%;height:150px}}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
(function(he,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],O):(he=typeof globalThis<"u"?globalThis:he||self,O(he.VoiceRecorder={},he.React))})(this,function(he,O){"use strict";function Tr(r){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const f in r)if(f!=="default"){const s=Object.getOwnPropertyDescriptor(r,f);Object.defineProperty(u,f,s.get?s:{enumerable:!0,get:()=>r[f]})}}return u.default=r,Object.freeze(u)}const D=Tr(O);var _r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Fe={exports:{}},Ce={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ze;function Rr(){if(ze)return Ce;ze=1;var r=O,u=Symbol.for("react.element"),f=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,m=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function C(n,c,t){var b,g={},S=null,P=null;t!==void 0&&(S=""+t),c.key!==void 0&&(S=""+c.key),c.ref!==void 0&&(P=c.ref);for(b in c)s.call(c,b)&&!p.hasOwnProperty(b)&&(g[b]=c[b]);if(n&&n.defaultProps)for(b in c=n.defaultProps,c)g[b]===void 0&&(g[b]=c[b]);return{$$typeof:u,type:n,key:S,ref:P,props:g,_owner:m.current}}return Ce.Fragment=f,Ce.jsx=C,Ce.jsxs=C,Ce}var Se={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var He;function Pr(){return He||(He=1,process.env.NODE_ENV!=="production"&&function(){var r=O,u=Symbol.for("react.element"),f=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),n=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),t=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),B=Symbol.iterator,x="@@iterator";function R(e){if(e===null||typeof e!="object")return null;var a=B&&e[B]||e[x];return typeof a=="function"?a:null}var h=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l(e){{for(var a=arguments.length,v=new Array(a>1?a-1:0),A=1;A<a;A++)v[A-1]=arguments[A];d("error",e,v)}}function d(e,a,v){{var A=h.ReactDebugCurrentFrame,H=A.getStackAddendum();H!==""&&(a+="%s",v=v.concat([H]));var te=v.map(function(G){return String(G)});te.unshift("Warning: "+a),Function.prototype.apply.call(console[e],console,te)}}var T=!1,o=!1,L=!1,z=!1,j=!1,w;w=Symbol.for("react.module.reference");function _(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===p||j||e===m||e===t||e===b||z||e===P||T||o||L||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===g||e.$$typeof===C||e.$$typeof===n||e.$$typeof===c||e.$$typeof===w||e.getModuleId!==void 0))}function K(e,a,v){var A=e.displayName;if(A)return A;var H=a.displayName||a.name||"";return H!==""?v+"("+H+")":v}function re(e){return e.displayName||"Context"}function V(e){if(e==null)return null;if(typeof e.tag=="number"&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case s:return"Fragment";case f:return"Portal";case p:return"Profiler";case m:return"StrictMode";case t:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case n:var a=e;return re(a)+".Consumer";case C:var v=e;return re(v._context)+".Provider";case c:return K(e,e.render,"ForwardRef");case g:var A=e.displayName||null;return A!==null?A:V(e.type)||"Memo";case S:{var H=e,te=H._payload,G=H._init;try{return V(G(te))}catch{return null}}}return null}var Q=Object.assign,oe=0,ee,ne,le,ie,i,E,k;function $(){}$.__reactDisabledLog=!0;function F(){{if(oe===0){ee=console.log,ne=console.info,le=console.warn,ie=console.error,i=console.group,E=console.groupCollapsed,k=console.groupEnd;var e={configurable:!0,enumerable:!0,value:$,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}oe++}}function q(){{if(oe--,oe===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Q({},e,{value:ee}),info:Q({},e,{value:ne}),warn:Q({},e,{value:le}),error:Q({},e,{value:ie}),group:Q({},e,{value:i}),groupCollapsed:Q({},e,{value:E}),groupEnd:Q({},e,{value:k})})}oe<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var M=h.ReactCurrentDispatcher,I;function N(e,a,v){{if(I===void 0)try{throw Error()}catch(H){var A=H.stack.trim().match(/\n( *(at )?)/);I=A&&A[1]||""}return`
`+I+e}}var W=!1,U;{var ce=typeof WeakMap=="function"?WeakMap:Map;U=new ce}function y(e,a){if(!e||W)return"";{var v=U.get(e);if(v!==void 0)return v}var A;W=!0;var H=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var te;te=M.current,M.current=null,F();try{if(a){var G=function(){throw Error()};if(Object.defineProperty(G.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(G,[])}catch(ve){A=ve}Reflect.construct(e,[],G)}else{try{G.call()}catch(ve){A=ve}e.call(G.prototype)}}else{try{throw Error()}catch(ve){A=ve}e()}}catch(ve){if(ve&&A&&typeof ve.stack=="string"){for(var Y=ve.stack.split(`
`),ue=A.stack.split(`
`),ae=Y.length-1,se=ue.length-1;ae>=1&&se>=0&&Y[ae]!==ue[se];)se--;for(;ae>=1&&se>=0;ae--,se--)if(Y[ae]!==ue[se]){if(ae!==1||se!==1)do if(ae--,se--,se<0||Y[ae]!==ue[se]){var de=`
`+Y[ae].replace(" at new "," at ");return e.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,de),de}while(ae>=1&&se>=0);break}}}finally{W=!1,M.current=te,q(),Error.prepareStackTrace=H}var Ee=e?e.displayName||e.name:"",Sr=Ee?N(Ee):"";return typeof e=="function"&&U.set(e,Sr),Sr}function fe(e,a,v){return y(e,!1)}function be(e){var a=e.prototype;return!!(a&&a.isReactComponent)}function ye(e,a,v){if(e==null)return"";if(typeof e=="function")return y(e,be(e));if(typeof e=="string")return N(e);switch(e){case t:return N("Suspense");case b:return N("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return fe(e.render);case g:return ye(e.type,a,v);case S:{var A=e,H=A._payload,te=A._init;try{return ye(te(H),a,v)}catch{}}}return""}var ke=Object.prototype.hasOwnProperty,fr={},dr=h.ReactDebugCurrentFrame;function Ae(e){if(e){var a=e._owner,v=ye(e.type,e._source,a?a.type:null);dr.setExtraStackFrame(v)}else dr.setExtraStackFrame(null)}function dt(e,a,v,A,H){{var te=Function.call.bind(ke);for(var G in e)if(te(e,G)){var Y=void 0;try{if(typeof e[G]!="function"){var ue=Error((A||"React class")+": "+v+" type `"+G+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[G]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ue.name="Invariant Violation",ue}Y=e[G](a,G,A,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ae){Y=ae}Y&&!(Y instanceof Error)&&(Ae(H),l("%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).",A||"React class",v,G,typeof Y),Ae(null)),Y instanceof Error&&!(Y.message in fr)&&(fr[Y.message]=!0,Ae(H),l("Failed %s type: %s",v,Y.message),Ae(null))}}}var pt=Array.isArray;function qe(e){return pt(e)}function vt(e){{var a=typeof Symbol=="function"&&Symbol.toStringTag,v=a&&e[Symbol.toStringTag]||e.constructor.name||"Object";return v}}function gt(e){try{return pr(e),!1}catch{return!0}}function pr(e){return""+e}function vr(e){if(gt(e))return l("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vt(e)),pr(e)}var xe=h.ReactCurrentOwner,ht={key:!0,ref:!0,__self:!0,__source:!0},gr,hr,Ue;Ue={};function yt(e){if(ke.call(e,"ref")){var a=Object.getOwnPropertyDescriptor(e,"ref").get;if(a&&a.isReactWarning)return!1}return e.ref!==void 0}function mt(e){if(ke.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function bt(e,a){if(typeof e.ref=="string"&&xe.current&&a&&xe.current.stateNode!==a){var v=V(xe.current.type);Ue[v]||(l('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',V(xe.current.type),e.ref),Ue[v]=!0)}}function wt(e,a){{var v=function(){gr||(gr=!0,l("%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))};v.isReactWarning=!0,Object.defineProperty(e,"key",{get:v,configurable:!0})}}function Et(e,a){{var v=function(){hr||(hr=!0,l("%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))};v.isReactWarning=!0,Object.defineProperty(e,"ref",{get:v,configurable:!0})}}var Ct=function(e,a,v,A,H,te,G){var Y={$$typeof:u,type:e,key:a,ref:v,props:G,_owner:te};return Y._store={},Object.defineProperty(Y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:A}),Object.defineProperty(Y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:H}),Object.freeze&&(Object.freeze(Y.props),Object.freeze(Y)),Y};function St(e,a,v,A,H){{var te,G={},Y=null,ue=null;v!==void 0&&(vr(v),Y=""+v),mt(a)&&(vr(a.key),Y=""+a.key),yt(a)&&(ue=a.ref,bt(a,H));for(te in a)ke.call(a,te)&&!ht.hasOwnProperty(te)&&(G[te]=a[te]);if(e&&e.defaultProps){var ae=e.defaultProps;for(te in ae)G[te]===void 0&&(G[te]=ae[te])}if(Y||ue){var se=typeof e=="function"?e.displayName||e.name||"Unknown":e;Y&&wt(G,se),ue&&Et(G,se)}return Ct(e,Y,ue,H,A,xe.current,G)}}var We=h.ReactCurrentOwner,yr=h.ReactDebugCurrentFrame;function we(e){if(e){var a=e._owner,v=ye(e.type,e._source,a?a.type:null);yr.setExtraStackFrame(v)}else yr.setExtraStackFrame(null)}var Ye;Ye=!1;function Ge(e){return typeof e=="object"&&e!==null&&e.$$typeof===u}function mr(){{if(We.current){var e=V(We.current.type);if(e)return`
Check the render method of \``+e+"`."}return""}}function Tt(e){{if(e!==void 0){var a=e.fileName.replace(/^.*[\\\/]/,""),v=e.lineNumber;return`
Check your code at `+a+":"+v+"."}return""}}var br={};function _t(e){{var a=mr();if(!a){var v=typeof e=="string"?e:e.displayName||e.name;v&&(a=`
Check the top-level render call using <`+v+">.")}return a}}function wr(e,a){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var v=_t(a);if(br[v])return;br[v]=!0;var A="";e&&e._owner&&e._owner!==We.current&&(A=" It was passed a child from "+V(e._owner.type)+"."),we(e),l('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,A),we(null)}}function Er(e,a){{if(typeof e!="object")return;if(qe(e))for(var v=0;v<e.length;v++){var A=e[v];Ge(A)&&wr(A,a)}else if(Ge(e))e._store&&(e._store.validated=!0);else if(e){var H=R(e);if(typeof H=="function"&&H!==e.entries)for(var te=H.call(e),G;!(G=te.next()).done;)Ge(G.value)&&wr(G.value,a)}}}function xt(e){{var a=e.type;if(a==null||typeof a=="string")return;var v;if(typeof a=="function")v=a.propTypes;else if(typeof a=="object"&&(a.$$typeof===c||a.$$typeof===g))v=a.propTypes;else return;if(v){var A=V(a);dt(v,e.props,"prop",A,e)}else if(a.PropTypes!==void 0&&!Ye){Ye=!0;var H=V(a);l("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",H||"Unknown")}typeof a.getDefaultProps=="function"&&!a.getDefaultProps.isReactClassApproved&&l("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Rt(e){{for(var a=Object.keys(e.props),v=0;v<a.length;v++){var A=a[v];if(A!=="children"&&A!=="key"){we(e),l("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",A),we(null);break}}e.ref!==null&&(we(e),l("Invalid attribute `ref` supplied to `React.Fragment`."),we(null))}}function Cr(e,a,v,A,H,te){{var G=_(e);if(!G){var Y="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(Y+=" 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 ue=Tt(H);ue?Y+=ue:Y+=mr();var ae;e===null?ae="null":qe(e)?ae="array":e!==void 0&&e.$$typeof===u?(ae="<"+(V(e.type)||"Unknown")+" />",Y=" Did you accidentally export a JSX literal instead of a component?"):ae=typeof e,l("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ae,Y)}var se=St(e,a,v,H,te);if(se==null)return se;if(G){var de=a.children;if(de!==void 0)if(A)if(qe(de)){for(var Ee=0;Ee<de.length;Ee++)Er(de[Ee],e);Object.freeze&&Object.freeze(de)}else l("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 Er(de,e)}return e===s?Rt(se):xt(se),se}}function Pt(e,a,v){return Cr(e,a,v,!0)}function Ot(e,a,v){return Cr(e,a,v,!1)}var kt=Ot,At=Pt;Se.Fragment=s,Se.jsx=kt,Se.jsxs=At}()),Se}process.env.NODE_ENV==="production"?Fe.exports=Rr():Fe.exports=Pr();var Je=Fe.exports;const J=Je.jsx,ge=Je.jsxs;var Me={exports:{}},Re={exports:{}},X={};/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Xe;function Or(){if(Xe)return X;Xe=1;var r=typeof Symbol=="function"&&Symbol.for,u=r?Symbol.for("react.element"):60103,f=r?Symbol.for("react.portal"):60106,s=r?Symbol.for("react.fragment"):60107,m=r?Symbol.for("react.strict_mode"):60108,p=r?Symbol.for("react.profiler"):60114,C=r?Symbol.for("react.provider"):60109,n=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,t=r?Symbol.for("react.concurrent_mode"):60111,b=r?Symbol.for("react.forward_ref"):60112,g=r?Symbol.for("react.suspense"):60113,S=r?Symbol.for("react.suspense_list"):60120,P=r?Symbol.for("react.memo"):60115,B=r?Symbol.for("react.lazy"):60116,x=r?Symbol.for("react.block"):60121,R=r?Symbol.for("react.fundamental"):60117,h=r?Symbol.for("react.responder"):60118,l=r?Symbol.for("react.scope"):60119;function d(o){if(typeof o=="object"&&o!==null){var L=o.$$typeof;switch(L){case u:switch(o=o.type,o){case c:case t:case s:case p:case m:case g:return o;default:switch(o=o&&o.$$typeof,o){case n:case b:case B:case P:case C:return o;default:return L}}case f:return L}}}function T(o){return d(o)===t}return X.AsyncMode=c,X.ConcurrentMode=t,X.ContextConsumer=n,X.ContextProvider=C,X.Element=u,X.ForwardRef=b,X.Fragment=s,X.Lazy=B,X.Memo=P,X.Portal=f,X.Profiler=p,X.StrictMode=m,X.Suspense=g,X.isAsyncMode=function(o){return T(o)||d(o)===c},X.isConcurrentMode=T,X.isContextConsumer=function(o){return d(o)===n},X.isContextProvider=function(o){return d(o)===C},X.isElement=function(o){return typeof o=="object"&&o!==null&&o.$$typeof===u},X.isForwardRef=function(o){return d(o)===b},X.isFragment=function(o){return d(o)===s},X.isLazy=function(o){return d(o)===B},X.isMemo=function(o){return d(o)===P},X.isPortal=function(o){return d(o)===f},X.isProfiler=function(o){return d(o)===p},X.isStrictMode=function(o){return d(o)===m},X.isSuspense=function(o){return d(o)===g},X.isValidElementType=function(o){return typeof o=="string"||typeof o=="function"||o===s||o===t||o===p||o===m||o===g||o===S||typeof o=="object"&&o!==null&&(o.$$typeof===B||o.$$typeof===P||o.$$typeof===C||o.$$typeof===n||o.$$typeof===b||o.$$typeof===R||o.$$typeof===h||o.$$typeof===l||o.$$typeof===x)},X.typeOf=d,X}var Z={};/** @license React v16.13.1
* react-is.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ze;function kr(){return Ze||(Ze=1,process.env.NODE_ENV!=="production"&&function(){var r=typeof Symbol=="function"&&Symbol.for,u=r?Symbol.for("react.element"):60103,f=r?Symbol.for("react.portal"):60106,s=r?Symbol.for("react.fragment"):60107,m=r?Symbol.for("react.strict_mode"):60108,p=r?Symbol.for("react.profiler"):60114,C=r?Symbol.for("react.provider"):60109,n=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,t=r?Symbol.for("react.concurrent_mode"):60111,b=r?Symbol.for("react.forward_ref"):60112,g=r?Symbol.for("react.suspense"):60113,S=r?Symbol.for("react.suspense_list"):60120,P=r?Symbol.for("react.memo"):60115,B=r?Symbol.for("react.lazy"):60116,x=r?Symbol.for("react.block"):60121,R=r?Symbol.for("react.fundamental"):60117,h=r?Symbol.for("react.responder"):60118,l=r?Symbol.for("react.scope"):60119;function d(y){return typeof y=="string"||typeof y=="function"||y===s||y===t||y===p||y===m||y===g||y===S||typeof y=="object"&&y!==null&&(y.$$typeof===B||y.$$typeof===P||y.$$typeof===C||y.$$typeof===n||y.$$typeof===b||y.$$typeof===R||y.$$typeof===h||y.$$typeof===l||y.$$typeof===x)}function T(y){if(typeof y=="object"&&y!==null){var fe=y.$$typeof;switch(fe){case u:var be=y.type;switch(be){case c:case t:case s:case p:case m:case g:return be;default:var ye=be&&be.$$typeof;switch(ye){case n:case b:case B:case P:case C:return ye;default:return fe}}case f:return fe}}}var o=c,L=t,z=n,j=C,w=u,_=b,K=s,re=B,V=P,Q=f,oe=p,ee=m,ne=g,le=!1;function ie(y){return le||(le=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),i(y)||T(y)===c}function i(y){return T(y)===t}function E(y){return T(y)===n}function k(y){return T(y)===C}function $(y){return typeof y=="object"&&y!==null&&y.$$typeof===u}function F(y){return T(y)===b}function q(y){return T(y)===s}function M(y){return T(y)===B}function I(y){return T(y)===P}function N(y){return T(y)===f}function W(y){return T(y)===p}function U(y){return T(y)===m}function ce(y){return T(y)===g}Z.AsyncMode=o,Z.ConcurrentMode=L,Z.ContextConsumer=z,Z.ContextProvider=j,Z.Element=w,Z.ForwardRef=_,Z.Fragment=K,Z.Lazy=re,Z.Memo=V,Z.Portal=Q,Z.Profiler=oe,Z.StrictMode=ee,Z.Suspense=ne,Z.isAsyncMode=ie,Z.isConcurrentMode=i,Z.isContextConsumer=E,Z.isContextProvider=k,Z.isElement=$,Z.isForwardRef=F,Z.isFragment=q,Z.isLazy=M,Z.isMemo=I,Z.isPortal=N,Z.isProfiler=W,Z.isStrictMode=U,Z.isSuspense=ce,Z.isValidElementType=d,Z.typeOf=T}()),Z}var Ke;function Qe(){return Ke||(Ke=1,process.env.NODE_ENV==="production"?Re.exports=Or():Re.exports=kr()),Re.exports}/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var je,er;function Ar(){if(er)return je;er=1;var r=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;function s(p){if(p==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(p)}function m(){try{if(!Object.assign)return!1;var p=new String("abc");if(p[5]="de",Object.getOwnPropertyNames(p)[0]==="5")return!1;for(var C={},n=0;n<10;n++)C["_"+String.fromCharCode(n)]=n;var c=Object.getOwnPropertyNames(C).map(function(b){return C[b]});if(c.join("")!=="0123456789")return!1;var t={};return"abcdefghijklmnopqrst".split("").forEach(function(b){t[b]=b}),Object.keys(Object.assign({},t)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return je=m()?Object.assign:function(p,C){for(var n,c=s(p),t,b=1;b<arguments.length;b++){n=Object(arguments[b]);for(var g in n)u.call(n,g)&&(c[g]=n[g]);if(r){t=r(n);for(var S=0;S<t.length;S++)f.call(n,t[S])&&(c[t[S]]=n[t[S]])}}return c},je}var Ie,rr;function De(){if(rr)return Ie;rr=1;var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ie=r,Ie}var Be,tr;function nr(){return tr||(tr=1,Be=Function.call.bind(Object.prototype.hasOwnProperty)),Be}var $e,or;function Fr(){if(or)return $e;or=1;var r=function(){};if(process.env.NODE_ENV!=="production"){var u=De(),f={},s=nr();r=function(p){var C="Warning: "+p;typeof console<"u"&&console.error(C);try{throw new Error(C)}catch{}}}function m(p,C,n,c,t){if(process.env.NODE_ENV!=="production"){for(var b in p)if(s(p,b)){var g;try{if(typeof p[b]!="function"){var S=Error((c||"React class")+": "+n+" type `"+b+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof p[b]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}g=p[b](C,b,c,n,null,u)}catch(B){g=B}if(g&&!(g instanceof Error)&&r((c||"React class")+": type specification of "+n+" `"+b+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof g+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),g instanceof Error&&!(g.message in f)){f[g.message]=!0;var P=t?t():"";r("Failed "+n+" type: "+g.message+(P??""))}}}}return m.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(f={})},$e=m,$e}var Le,ar;function Mr(){if(ar)return Le;ar=1;var r=Qe(),u=Ar(),f=De(),s=nr(),m=Fr(),p=function(){};process.env.NODE_ENV!=="production"&&(p=function(n){var c="Warning: "+n;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function C(){return null}return Le=function(n,c){var t=typeof Symbol=="function"&&Symbol.iterator,b="@@iterator";function g(i){var E=i&&(t&&i[t]||i[b]);if(typeof E=="function")return E}var S="<<anonymous>>",P={array:h("array"),bigint:h("bigint"),bool:h("boolean"),func:h("function"),number:h("number"),object:h("object"),string:h("string"),symbol:h("symbol"),any:l(),arrayOf:d,element:T(),elementType:o(),instanceOf:L,node:_(),objectOf:j,oneOf:z,oneOfType:w,shape:re,exact:V};function B(i,E){return i===E?i!==0||1/i===1/E:i!==i&&E!==E}function x(i,E){this.message=i,this.data=E&&typeof E=="object"?E:{},this.stack=""}x.prototype=Error.prototype;function R(i){if(process.env.NODE_ENV!=="production")var E={},k=0;function $(q,M,I,N,W,U,ce){if(N=N||S,U=U||I,ce!==f){if(c){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var fe=N+":"+I;!E[fe]&&k<3&&(p("You are manually calling a React.PropTypes validation function for the `"+U+"` prop on `"+N+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),E[fe]=!0,k++)}}return M[I]==null?q?M[I]===null?new x("The "+W+" `"+U+"` is marked as required "+("in `"+N+"`, but its value is `null`.")):new x("The "+W+" `"+U+"` is marked as required in "+("`"+N+"`, but its value is `undefined`.")):null:i(M,I,N,W,U)}var F=$.bind(null,!1);return F.isRequired=$.bind(null,!0),F}function h(i){function E(k,$,F,q,M,I){var N=k[$],W=ee(N);if(W!==i){var U=ne(N);return new x("Invalid "+q+" `"+M+"` of type "+("`"+U+"` supplied to `"+F+"`, expected ")+("`"+i+"`."),{expectedType:i})}return null}return R(E)}function l(){return R(C)}function d(i){function E(k,$,F,q,M){if(typeof i!="function")return new x("Property `"+M+"` of component `"+F+"` has invalid PropType notation inside arrayOf.");var I=k[$];if(!Array.isArray(I)){var N=ee(I);return new x("Invalid "+q+" `"+M+"` of type "+("`"+N+"` supplied to `"+F+"`, expected an array."))}for(var W=0;W<I.length;W++){var U=i(I,W,F,q,M+"["+W+"]",f);if(U instanceof Error)return U}return null}return R(E)}function T(){function i(E,k,$,F,q){var M=E[k];if(!n(M)){var I=ee(M);return new x("Invalid "+F+" `"+q+"` of type "+("`"+I+"` supplied to `"+$+"`, expected a single ReactElement."))}return null}return R(i)}function o(){function i(E,k,$,F,q){var M=E[k];if(!r.isValidElementType(M)){var I=ee(M);return new x("Invalid "+F+" `"+q+"` of type "+("`"+I+"` supplied to `"+$+"`, expected a single ReactElement type."))}return null}return R(i)}function L(i){function E(k,$,F,q,M){if(!(k[$]instanceof i)){var I=i.name||S,N=ie(k[$]);return new x("Invalid "+q+" `"+M+"` of type "+("`"+N+"` supplied to `"+F+"`, expected ")+("instance of `"+I+"`."))}return null}return R(E)}function z(i){if(!Array.isArray(i))return process.env.NODE_ENV!=="production"&&(arguments.length>1?p("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):p("Invalid argument supplied to oneOf, expected an array.")),C;function E(k,$,F,q,M){for(var I=k[$],N=0;N<i.length;N++)if(B(I,i[N]))return null;var W=JSON.stringify(i,function(ce,y){var fe=ne(y);return fe==="symbol"?String(y):y});return new x("Invalid "+q+" `"+M+"` of value `"+String(I)+"` "+("supplied to `"+F+"`, expected one of "+W+"."))}return R(E)}function j(i){function E(k,$,F,q,M){if(typeof i!="function")return new x("Property `"+M+"` of component `"+F+"` has invalid PropType notation inside objectOf.");var I=k[$],N=ee(I);if(N!=="object")return new x("Invalid "+q+" `"+M+"` of type "+("`"+N+"` supplied to `"+F+"`, expected an object."));for(var W in I)if(s(I,W)){var U=i(I,W,F,q,M+"."+W,f);if(U instanceof Error)return U}return null}return R(E)}function w(i){if(!Array.isArray(i))return process.env.NODE_ENV!=="production"&&p("Invalid argument supplied to oneOfType, expected an instance of array."),C;for(var E=0;E<i.length;E++){var k=i[E];if(typeof k!="function")return p("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+le(k)+" at index "+E+"."),C}function $(F,q,M,I,N){for(var W=[],U=0;U<i.length;U++){var ce=i[U],y=ce(F,q,M,I,N,f);if(y==null)return null;y.data&&s(y.data,"expectedType")&&W.push(y.data.expectedType)}var fe=W.length>0?", expected one of type ["+W.join(", ")+"]":"";return new x("Invalid "+I+" `"+N+"` supplied to "+("`"+M+"`"+fe+"."))}return R($)}function _(){function i(E,k,$,F,q){return Q(E[k])?null:new x("Invalid "+F+" `"+q+"` supplied to "+("`"+$+"`, expected a ReactNode."))}return R(i)}function K(i,E,k,$,F){return new x((i||"React class")+": "+E+" type `"+k+"."+$+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+F+"`.")}function re(i){function E(k,$,F,q,M){var I=k[$],N=ee(I);if(N!=="object")return new x("Invalid "+q+" `"+M+"` of type `"+N+"` "+("supplied to `"+F+"`, expected `object`."));for(var W in i){var U=i[W];if(typeof U!="function")return K(F,q,M,W,ne(U));var ce=U(I,W,F,q,M+"."+W,f);if(ce)return ce}return null}return R(E)}function V(i){function E(k,$,F,q,M){var I=k[$],N=ee(I);if(N!=="object")return new x("Invalid "+q+" `"+M+"` of type `"+N+"` "+("supplied to `"+F+"`, expected `object`."));var W=u({},k[$],i);for(var U in W){var ce=i[U];if(s(i,U)&&typeof ce!="function")return K(F,q,M,U,ne(ce));if(!ce)return new x("Invalid "+q+" `"+M+"` key `"+U+"` supplied to `"+F+"`.\nBad object: "+JSON.stringify(k[$],null," ")+`
Valid keys: `+JSON.stringify(Object.keys(i),null," "));var y=ce(I,U,F,q,M+"."+U,f);if(y)return y}return null}return R(E)}function Q(i){switch(typeof i){case"number":case"string":case"undefined":return!0;case"boolean":return!i;case"object":if(Array.isArray(i))return i.every(Q);if(i===null||n(i))return!0;var E=g(i);if(E){var k=E.call(i),$;if(E!==i.entries){for(;!($=k.next()).done;)if(!Q($.value))return!1}else for(;!($=k.next()).done;){var F=$.value;if(F&&!Q(F[1]))return!1}}else return!1;return!0;default:return!1}}function oe(i,E){return i==="symbol"?!0:E?E["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&E instanceof Symbol:!1}function ee(i){var E=typeof i;return Array.isArray(i)?"array":i instanceof RegExp?"object":oe(E,i)?"symbol":E}function ne(i){if(typeof i>"u"||i===null)return""+i;var E=ee(i);if(E==="object"){if(i instanceof Date)return"date";if(i instanceof RegExp)return"regexp"}return E}function le(i){var E=ne(i);switch(E){case"array":case"object":return"an "+E;case"boolean":case"date":case"regexp":return"a "+E;default:return E}}function ie(i){return!i.constructor||!i.constructor.name?S:i.constructor.name}return P.checkPropTypes=m,P.resetWarningCache=m.resetWarningCache,P.PropTypes=P,P},Le}var Ne,ir;function jr(){if(ir)return Ne;ir=1;var r=De();function u(){}function f(){}return f.resetWarningCache=u,Ne=function(){function s(C,n,c,t,b,g){if(g!==r){var S=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw S.name="Invariant Violation",S}}s.isRequired=s;function m(){return s}var p={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:m,element:s,elementType:s,instanceOf:m,node:s,objectOf:m,oneOf:m,oneOfType:m,shape:m,exact:m,checkPropTypes:f,resetWarningCache:u};return p.PropTypes=p,p},Ne}if(process.env.NODE_ENV!=="production"){var Ir=Qe(),Dr=!0;Me.exports=Mr()(Ir.isElement,Dr)}else Me.exports=jr()();var Br=Me.exports;const Te=xr(Br),sr=O.createContext({audioStatus:"",audioFile:void 0,audioRecording:void 0,audioFileProcessing:!1,updateAudioStatus:()=>{},updateAudioRecording:()=>{},convertAudioFile:()=>{},setAudioFileProcessing:()=>{}});function $r({children:r}){const[u,f]=O.useState(""),[s,m]=O.useState(),[p,C]=O.useState(),[n,c]=O.useState(!1),S={audioStatus:u,audioRecording:s,updateAudioStatus:P=>f(P),updateAudioRecording:P=>m(P),convertAudioFile:P=>C(P),audioFile:p,setAudioFileProcessing:c,audioFileProcessing:n};return J(sr.Provider,{value:S,children:r})}function me(){const r=O.useContext(sr);if(r===void 0)throw new Error("useAudio must be used within a AudioProvider");return r}const cr=O.createContext({mainContainerStyle:{},controllerContainerStyle:{},controllerStyle:{},waveContainerStyle:{},graphColor:"#000",graphShaded:!1,height:"inherit",width:"inherit",downloadable:!1,uploadAudioFile:!0,onAudioDownload:()=>{},onRecordingStart:()=>{},onRecordingEnd:()=>{},onPlayStart:()=>{},onPlayEnd:()=>{},onRecordingPause:()=>{},onPlayPause:()=>{},rootElementId:""});function Lr({userPropsValue:r,children:u}){return J(cr.Provider,{value:r,children:u})}function _e(){const r=O.useContext(cr);if(r===void 0)throw new Error("useUserProps must be used within a UserPropsProvider");return r}const Nr=(r,u)=>{if(!r.length)return null;const f=[];return r.forEach(s=>{const m=u==null?void 0:u.getElementsByClassName(s);return m!=null&&m.length&&f.push(m[0]),m}),f.length?f:null},Vr=r=>{r&&r.forEach(u=>{u.remove()})},qr=r=>r.map(f=>{const s=document.createElement("canvas");return s.className=f,s}),Ur=(r,u)=>{r.forEach(f=>{const s=f.getContext("2d");s&&(s.clearRect(0,0,f.width,f.height),s.clearRect(0,0,f.width,f.height),f.width=((u==null?void 0:u.clientWidth)??1)*devicePixelRatio,f.height=((u==null?void 0:u.clientHeight)??1)*devicePixelRatio,s==null||s.scale(devicePixelRatio,devicePixelRatio))})},Wr=(r,u)=>{r.forEach(f=>{f.style.width=(u==null?void 0:u.clientWidth)+"px",f.style.height=(u==null?void 0:u.clientHeight)+"px"})},Yr=(r,u)=>{r.forEach(f=>{u==null||u.appendChild(f)})},Pe=(r,u,f)=>{try{const m=document.getElementById(r).querySelector(f),p=Nr(u,m);Vr(p);const C=qr(u);return Ur(C,m),Wr(C,m),Yr(C,m),C}catch(s){return console.error("Error in setUpCanvas: ",s),null}},Oe={solid:"rgb(54, 54, 54)",faded:"rgb(210, 209, 208)"},Gr=(r,u,f)=>{const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);if(!s)return Oe;const m=parseInt(s[1],16),p=parseInt(s[2],16),C=parseInt(s[3],16);if(u&&f){const n=Math.round(m*u/100),c=Math.round(p*u/100),t=Math.round(C*u/100);return{solid:`rgb(${n}, ${c}, ${t})`,faded:`rgb(${n}, ${c}, ${t}, 0.5)`}}return{solid:`rgb(${m}, ${p}, ${C})`,faded:`rgb(${m}, ${p}, ${C}, 0.5)`}},zr=r=>{const u=new Option().style;return u.color=r,u.color==r},Hr=r=>{const u={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return typeof u[r.toLowerCase()]<"u"?u[r.toLowerCase()]:"#000"},Ve=(r,u,f)=>{try{if(!r||!zr(r))return Oe;const s=Hr(r);return Gr(s,u,f)}catch{return Oe}},Ft="",Jr=100;function Xr(){const{audioStatus:r="",updateAudioRecording:u}=me(),{graphColor:f,graphShaded:s,rootElementId:m,onRecordingEnd:p}=_e(),[C,n]=O.useState(0),c=O.useRef(null),t=O.useRef({}),b=O.useRef(r);O.useEffect(()=>{var x,R,h,l,d,T,o,L,z,j,w,_;b.current=r,r==="recording"&&(((R=(x=t==null?void 0:t.current)==null?void 0:x.audioContext)==null?void 0:R.state)==="suspended"?(t.current.audioContext.resume().then(P),(l=(h=t.current)==null?void 0:h.mediaRecorder)==null||l.resume()):(T=(d=t==null?void 0:t.current)==null?void 0:d.audioContext)!=null&&T.state||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(S)),r==="stopped"&&((L=(o=t==null?void 0:t.current)==null?void 0:o.mediaRecorder)==null||L.stop()),r==="paused_recording"&&((j=(z=t==null?void 0:t.current)==null?void 0:z.audioContext)==null||j.suspend(),(_=(w=t==null?void 0:t.current)==null?void 0:w.mediaRecorder)==null||_.pause())},[r]),O.useEffect(()=>{g(),window.addEventListener("resize",g)},[]);const g=()=>{const x=Pe(m,["waveformgraph-record"],".voice-recorder_recordcontainer");x&&(c.current=x[0])},S=x=>{var R;try{const h=window.AudioContext||(window==null?void 0:window.webkitAudioContext),l=new h;t.current.audioContext=l;const d=l.createMediaStreamSource(x);t.current.analyserNode=l.createAnalyser(),d.connect((R=t==null?void 0:t.current)==null?void 0:R.analyserNode),t.current.analyserNode.fftSize=128;const T=t.current.analyserNode.frequencyBinCount,o=new Float32Array(T);t.current.dataArray=o;const L=new MediaRecorder(x);t.current.mediaRecorder=L,L.start(),L.addEventListener("dataavailable",async z=>{const j=await z.data.arrayBuffer(),w=await l.decodeAudioData(j),_={blob:z.data,duration:w.duration,graphData:t.current.graphData??[]};p==null||p(z.data),u(_)}),L.addEventListener("stop",()=>{x.getTracks().forEach(z=>z.stop()),d.disconnect(),l.close()}),P()}catch(h){console.log("error",h)}},P=()=>{var h,l,d,T,o,L,z,j,w,_,K;const x=(h=c==null?void 0:c.current)==null?void 0:h.getContext("2d");if(b.current!=="recording")return null;x==null||x.clearRect(0,0,((l=c==null?void 0:c.current)==null?void 0:l.width)??1,((d=c==null?void 0:c.current)==null?void 0:d.height)??1);let R=-1/0;if(Number(performance.now())>C){if(n(Number(performance.now()/Jr)),!((T=t==null?void 0:t.current)!=null&&T.dataArray))return null;(z=(o=t==null?void 0:t.current)==null?void 0:o.analyserNode)==null||z.getFloatTimeDomainData((L=t==null?void 0:t.current)==null?void 0:L.dataArray),R=Math.max(0,...((j=t==null?void 0:t.current)==null?void 0:j.dataArray)??[]);const re=Math.max(1,Math.floor(R*550));t.current.graphData===void 0&&(t.current.graphData=[]),(K=t.current)==null||K.graphData.push({x:((w=c==null?void 0:c.current)==null?void 0:w.offsetWidth)??1,y:(((_=c==null?void 0:c.current)==null?void 0:_.offsetHeight)??1)/2-re/2,height:re,width:2})}B(),requestAnimationFrame(P)},B=()=>{var R,h,l,d;const x=(R=c==null?void 0:c.current)==null?void 0:R.getContext("2d");if(!x||!((h=t.current)!=null&&h.graphData))return null;for(let T=0;T<((l=t.current)==null?void 0:l.graphData.length);T++){const o=(d=t.current)==null?void 0:d.graphData[T];o&&(x.fillStyle=Ve(f,o.height,s).solid,x==null||x.fillRect(o.x,o.y,o.width,o.height),o.x=o.x-2)}};return J("div",{className:"voice-recorder_recordcontainer"})}const Zr=.06;function Kr(){const[r,u]=O.useState([]),{audioRecording:f,audioStatus:s,updateAudioStatus:m}=me(),{graphColor:p,graphShaded:C,rootElementId:n,onPlayEnd:c}=_e(),t=O.useRef(null),b=O.useRef(null),g=O.useRef(null),S=O.useRef(null),P=O.useRef(),{blob:B,duration:x=0,graphData:R=[]}=f||{},h=O.useRef(R);O.useEffect(()=>{window.addEventListener("resize",z)},[]),O.useEffect(()=>{B&&(s==="playing_requested"?o():s==="playing"?j():s==="paused_playing"?(T(),window.clearInterval(P.current)):s==="stopped"&&window.clearInterval(P.current))},[s]),O.useEffect(()=>{h.current=R;try{R.length&&z()}catch(w){console.log("error",w)}},[R]);const l=w=>{var K,re,V;const _=(K=w==null?void 0:w.current)==null?void 0:K.getContext("2d");_==null||_.clearRect(0,0,((re=w==null?void 0:w.current)==null?void 0:re.width)??1,((V=w==null?void 0:w.current)==null?void 0:V.height)??1)},d=()=>{const w=Pe(n,["waveformgraph-unplayed-graph","waveformgraph-played-graph","progressbar"],".voice-recorder_canvascontainer");t.current=w==null?void 0:w.find(_=>_.className==="waveformgraph-unplayed-graph"),b.current=w==null?void 0:w.find(_=>_.className==="waveformgraph-played-graph"),g.current=w==null?void 0:w.find(_=>_.className==="progressbar")},T=()=>{var w;return(w=S==null?void 0:S.current)==null?void 0:w.pause()},o=()=>{const _=document.getElementById(n).querySelector("#playback_audio");if(_.autoplay=!0,_.readyState!==4){const K=window.URL.createObjectURL(new Blob([B],{type:"audio/mpeg"}));_.src=K,_.onloadeddata=()=>{_.play(),m("playing")}}else _.paused?(_.play(),m("playing")):(_.currentTime=0,_.play(),m("playing"));_.onended=()=>{B&&(c==null||c(B)),m("stopped")}},L=()=>{var K;const w=[];if(!(h!=null&&h.current.length))return w;const _=(((K=t==null?void 0:t.current)==null?void 0:K.offsetWidth)??1)/(h==null?void 0:h.current.length);return h==null||h.current.forEach((re,V)=>{var oe;const Q=((oe=w[V-1])==null?void 0:oe.x)||0;w.push({...re,x:Q+_,width:_})}),u(w),w},z=()=>{var _;d();const w=(_=t==null?void 0:t.current)==null?void 0:_.getContext("2d");if(w){const K=L();for(let re=0;re<K.length;re++){const V=K[re];w.fillStyle=Ve(p,V.height,C).faded,w.fillRect(V.x,V.y,V.width,V.height)}}},j=()=>{var ie,i,E;(((ie=S==null?void 0:S.current)==null?void 0:ie.currentTime)??1)>0||l(b);const _=Math.abs(x-Zr),K=R.length,re=_/K*1e3;let V=0,Q,oe;const ee=(i=g==null?void 0:g.current)==null?void 0:i.getContext("2d"),ne=(E=b==null?void 0:b.current)==null?void 0:E.getContext("2d");function le(){var $,F,q,M,I,N,W;if(!ne||!ee||(V=Math.round(K*(((($=S==null?void 0:S.current)==null?void 0:$.currentTime)??1)/_)),oe===((F=S==null?void 0:S.current)==null?void 0:F.currentTime)||Q===V))return;if(oe=(q=S==null?void 0:S.current)==null?void 0:q.currentTime,Q=V,V>=K){window.clearInterval(P.current);return}const k=r[V];ne.fillStyle=Ve(p,k.height,C).solid,ne==null||ne.fillRect(k.x,k.y,k.width,k.height),+k.x.toFixed(3)<(((M=g==null?void 0:g.current)==null?void 0:M.offsetWidth)??1)&&(ee==null||ee.clearRect(0,0,((I=g==null?void 0:g.current)==null?void 0:I.width)??1,((N=g==null?void 0:g.current)==null?void 0:N.height)??1),ee==null||ee.fillRect(k.x,0,1,((W=g==null?void 0:g.current)==null?void 0:W.offsetHeight)??1))}le(),P.current=window.setInterval(le,re)};return ge("div",{className:"voice-recorder_playbackcontainer",children:[J("audio",{ref:S,controls:!0,id:"playback_audio",children:J("track",{src:"captions.vtt",kind:"captions",srcLang:"en",label:"English"})}),J("div",{className:"voice-recorder_canvascontainer"})]})}function Qr(){const[r,u]=O.useState(!1),{updateAudioRecording:f,updateAudioStatus:s,audioFile:m,setAudioFileProcessing:p}=me(),{rootElementId:C}=_e(),n=O.useRef(null),c=O.useRef({});O.useEffect(()=>{const b=Pe(C,["waveformgraph-record"],".voice-recorder_recordcontainer");return b&&(n.current=b[0]),p(!0),t(),()=>p(!1)},[]);const t=async()=>{if(!m)return;const b=Pe(C,["waveformgraph-record"],".voice-recorder_recordcontainer");b&&(n.current=b[0]);const g=await m.arrayBuffer(),S=new Blob([new Uint8Array(g)],{type:m.type});c.current.blob=S;const P=window.AudioContext||(window==null?void 0:window.webkitAudioContext),B=new P,x=B.createGain(),R=await B.decodeAudioData(g);c.current.audioBuffer=R;const h=B.createAnalyser(),l=B.createBufferSource();l.buffer=R,l.connect(x),x.connect(B.destination),l.connect(h),l.playbackRate.value=2,l.start(),x.gain.setValueAtTime(0,B.currentTime);const d=h.frequencyBinCount,T=[],o=()=>{const L=new Float32Array(d);if(h.getFloatTimeDomainData(L),T.push(L),B.currentTime*2>R.duration&&Math.abs(B.currentTime*2-R.duration)<=.1){u(!0);return}requestAnimationFrame(o)};o(),c.current.dataArray=T};return O.useEffect(()=>{var b,g;if(r&&c.current.dataArray){const S=[];for(const P of c.current.dataArray){let B=-1/0;B=Math.max(0,...P??[]);const x=Math.max(1,Math.floor(B*550));S.push({x:((b=n==null?void 0:n.current)==null?void 0:b.offsetWidth)??1,y:(((g=n==null?void 0:n.current)==null?void 0:g.offsetHeight)??1)/2-x/2,height:x,width:2})}if(c.current.blob&&c.current.audioBuffer){const P={blob:c.current.blob,duration:c.current.audioBuffer.duration,graphData:S??[]};f(P),s("playing_requested")}}},[r]),J("div",{className:"voice-recorder_recordcontainer"})}function et(){const{audioStatus:r}=me(),{waveContainerStyle:u}=_e(),[f,s]=O.useState("");return O.useEffect(()=>{s(r==="playing"||r==="playing_requested"||r==="paused_playing"||r==="stopped"?"playing":r==="processing"?"prerecord":"recording")},[r]),ge("div",{className:"voice-recorder_waveformcontainer",style:u,children:[f==="playing"?J(Kr,{}):null,f==="prerecord"?J(Qr,{}):null,f==="recording"?J(Xr,{}):null]})}const rt=r=>D.createElement("svg",{width:"100px",height:"100px",viewBox:"-40 -25 600 600",xmlns:"http://www.w3.org/2000/svg",fill:"#000000",...r},D.createElement("g",{id:"SVGRepo_bgCarrier",strokeWidth:0}),D.createElement("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"}),D.createElement("g",{id:"SVG