carta1 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var r,e;r=this,e=()=>(()=>{var r={d:(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},e={};function t(r){throw new Error(r)}function n(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];var o=t.map(function(e){return e(r)});return function(r){return o.reduce(function(r,e){return e(r)},r)}}function o(r,e){for(var t=e[r.length],n=0;n<r.length;n++)t[n]=r[r.length-1-n];return t}r.r(e),r.d(e,{AeaFile:()=>ie,AudioProcessor:()=>Be,BFU_START_LONG:()=>d,BufferPool:()=>jr,EncoderOptions:()=>_r,FFT:()=>X,SCALE_FACTORS:()=>H,SPECS_PER_BFU:()=>h,WORD_LENGTH_BITS:()=>L,decode:()=>Kr,dequantize:()=>wr,deserializeFrame:()=>ae,encode:()=>Vr,mdctStage:()=>Nr,pipe:()=>n,qmfAnalysisStage:()=>Hr,quantize:()=>mr,serializeFrame:()=>oe});var a=new Uint8Array([0,8,0,0]),i=2048,u=212,f=8*u,l=40,c=52,s=10,h=new Int32Array([8,8,8,8,4,4,4,4,8,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,9,9,9,9,10,10,10,10,12,12,12,12,12,12,12,12,20,20,20,20,20,20,20,20]),v=new Int32Array([20,28,32,36,40,44,48,52]),y=new Int32Array([20,36,52]),d=new Int32Array([0,8,16,24,32,36,40,44,48,56,64,72,80,86,92,98,104,110,116,122,128,134,140,146,152,159,166,173,180,189,198,207,216,226,236,246,256,268,280,292,304,316,328,340,352,372,392,412,432,452,472,492]),b=new Int32Array([0,32,64,96,8,40,72,104,12,44,76,108,20,52,84,116,26,58,90,122,128,160,192,224,134,166,198,230,141,173,205,237,150,182,214,246,256,288,320,352,384,416,448,480,268,300,332,364,396,428,460,492]),p=64,m=256,w=512,g=function(){for(var r=new Float64Array(32),e=0;e<32;e++)r[e]=Math.sin((e+.5)*Math.PI/64);return r}(),S=46,k=new Float32Array([-1461907e-11,-9205479e-11,-56157569e-12,.00030117269,.0002422519,-.00085293897,-.0005205574,.0020340169,.00078333891,-.0042153862,-.00075614988,.0078402944,-61169922e-12,-.01344162,.0024626821,.021736089,-.007801671,-.034090221,.01880949,.054326009,-.043596379,-.099384367,.13207909,.46424159]),A=function(){for(var r=new Float32Array(48),e=0;e<24;e++)r[e]=2*k[e],r[47-e]=2*k[e];return r}(),M=function(){for(var r=new Float32Array(24),e=0;e<24;e++)r[e]=A[2*e];return r}(),F=function(){for(var r=new Float32Array(24),e=0;e<24;e++)r[e]=A[2*e+1];return r}(),B=128,O=128,j=256,T=[{size:128,windowStart:48},{size:128,windowStart:48},{size:256,windowStart:112}],P=32,z=32,C=16,I=32767,q=32768,x=16,E=4,_=6,D=1,U=15,L=new Int32Array([0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),H=function(){for(var r=new Float64Array(64),e=0;e<64;e++)r[e]=Math.pow(2,e/3-21);return r}(),W=function(){for(var r=L[U],e=new Float64Array(r+1),t=0;t<=r;t++)e[t]=Math.pow(2,-t);return e}();function N(r,e){var n,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=r.length,u=i>>1,f=null!==(n=null==a||null===(o=a.delay)||void 0===o?void 0:o[i])&&void 0!==n?n:t("qmfAnalysis: qmfWorkBuffers.delay[".concat(i,"] is required"));f.set(e),f.set(r,e.length);for(var l=new Float32Array(u),c=new Float32Array(u),s=0;s<u;s++){for(var h=0,v=0,y=2*s,d=0;d<24;d++)h+=f[y+47-2*d]*M[d],v+=f[y+46-2*d]*F[d];l[s]=h+v,c[s]=h-v}return{lowBand:l,highBand:c,newDelay:f.slice(-S)}}function R(r,e,n){var o,a,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,u=r.length,f=2*u,l=null!==(o=null==i||null===(a=i.delay)||void 0===a?void 0:a[f])&&void 0!==o?o:t("qmfSynthesis: qmfWorkBuffers.delay[".concat(f,"] is required"));l.set(n);for(var c=0;c<u;c++){var s=r[c],h=e[c],v=S+2*c;l[v]=.5*(s+h),l[v+1]=.5*(s-h)}for(var y=new Float32Array(f),d=0;d<u;d++){for(var b=2*d,p=0,m=0,w=0;w<24;w++){var g=b+2*w;p+=l[g]*M[w],m+=l[g+1]*F[w]}y[2*d]=m,y[2*d+1]=p}return{output:y,newDelay:l.slice(-S)}}function V(r){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},V(r)}function G(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,$(n.key),n)}}function $(r){var e=function(r,e){if("object"!=V(r)||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==V(e)?e:e+""}var J,K,Q,X=function(){function r(){!function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r)}return e=r,n=[{key:"fft",value:function(e,t){var n=e.length;if(n!==t.length)throw new Error("Real and imaginary arrays must have the same length.");if(n&n-1)throw new Error("Input size must be a power of 2.");if(!(n<=1)){var o=r._cache.get(n);if(!o){for(var a=Math.log2(n),i=new Uint32Array(n),u=1;u<n;u++)i[u]=i[u>>>1]>>>1|(1&u)<<a-1;for(var f=new Float64Array(n/2),l=new Float64Array(n/2),c=0;c<n/2;c++){var s=-2*Math.PI*c/n,h=Math.cos(s),v=Math.sin(s),y=1/Math.hypot(h,v);f[c]=h*y,l[c]=v*y}o={bitRev:i,cos:f,sin:l},r._cache.set(n,o)}for(var d=o,b=d.bitRev,p=d.cos,m=d.sin,w=!(e instanceof Float64Array&&t instanceof Float64Array),g=w?new Float64Array(e):e,S=w?new Float64Array(t):t,k=0;k<n;k++){var A=b[k];if(A>k){var M=g[k];g[k]=g[A],g[A]=M,M=S[k],S[k]=S[A],S[A]=M}}for(var F=0;F<n;F+=2){var B=F+1,O=g[F],j=S[F],T=g[B],P=S[B];g[F]=O+T,S[F]=j+P,g[B]=O-T,S[B]=j-P}if(n>=4)for(var z=0;z<n;z+=4){var C=z,I=z+2,q=g[C],x=S[C],E=g[I],_=S[I];g[C]=q+E,S[C]=x+_,g[I]=q-E,S[I]=x-_;var D=z+1,U=z+3,L=S[U],H=-g[U],W=g[D],N=S[D];g[D]=W+L,S[D]=N+H,g[U]=W-L,S[U]=N-H}for(var R=8;R<=n;R<<=1)for(var V=R>>>1,G=n/R|0,$=0;$<n;$+=R)for(var J=0,K=0;K<V;K++,J+=G){var Q=$+K,X=Q+V,Y=p[J],Z=m[J],rr=g[X],er=S[X],tr=rr*Y-er*Z,nr=rr*Z+er*Y,or=g[Q],ar=S[Q];g[Q]=or+tr,S[Q]=ar+nr,g[X]=or-tr,S[X]=ar-nr}if(w)for(var ir=0;ir<n;ir++)e[ir]=g[ir],t[ir]=S[ir]}}}],(t=null)&&G(e.prototype,t),n&&G(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function Y(r){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Y(r)}function Z(r,e,t){return e=er(e),function(r,e){if(e&&("object"==Y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}(r)}(r,rr()?Reflect.construct(e,t||[],er(r).constructor):e.apply(r,t))}function rr(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(rr=function(){return!!r})()}function er(r){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},er(r)}function tr(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&nr(r,e)}function nr(r,e){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,e){return r.__proto__=e,r},nr(r,e)}function or(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,ir(n.key),n)}}function ar(r,e,t){return e&&or(r.prototype,e),t&&or(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function ir(r){var e=function(r,e){if("object"!=Y(r)||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==Y(e)?e:e+""}function ur(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}J=X,K="_cache",Q=new Map,(K=$(K))in J?Object.defineProperty(J,K,{value:Q,enumerable:!0,configurable:!0,writable:!0}):J[K]=Q;var fr=ar(function r(e,t){ur(this,r),this.size=e,this.halfSize=e>>1,this.quarterSize=e>>2,this.fftSize=this.halfSize>>1;var n=2*Math.PI/(8*e),o=2*Math.PI/e,a=Math.sqrt(t/e);this.sinCosTable=new Float64Array(this.halfSize);for(var i=0;i<this.quarterSize;i++){var u=o*i+n;this.sinCosTable[2*i]=a*Math.cos(u),this.sinCosTable[2*i+1]=a*Math.sin(u)}}),lr=function(r){function e(r,t){return ur(this,e),Z(this,e,[r,t])}return tr(e,r),ar(e,[{key:"transform",value:function(r){var e,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=null!==(e=null==a?void 0:a[this.fftSize])&&void 0!==e?e:t("MDCT.transform: mdctBuffers[".concat(this.fftSize,"] is required")),u=null!==(n=null==i?void 0:i.real)&&void 0!==n?n:t("MDCT.transform: mdctBuffers[".concat(this.fftSize,"].real is required")),f=null!==(o=null==i?void 0:i.imag)&&void 0!==o?o:t("MDCT.transform: mdctBuffers[".concat(this.fftSize,"].imag is required")),l=this.quarterSize,c=3*l;u.fill(0),f.fill(0);for(var s=0;s<l;s+=2){var h=c+s,v=l+s,y=l-1-s,d=r[c-1-s]+r[h],b=r[v]-r[y],p=this.sinCosTable[s],m=this.sinCosTable[s+1];u[s>>1]=d*p+b*m,f[s>>1]=b*p-d*m}for(var w=l;w<this.halfSize;w+=2){var g=w>>1,S=w-l,k=l+w,A=5*l-1-w,M=r[c-1-w]-r[S],F=r[k]+r[A],B=this.sinCosTable[w],O=this.sinCosTable[w+1];u[g]=M*B+F*O,f[g]=F*B-M*O}X.fft(u,f);for(var j=new Float32Array(this.halfSize),T=0;T<this.fftSize;T++){var P=this.sinCosTable[2*T],z=this.sinCosTable[2*T+1],C=u[T],I=f[T];j[2*T]=-C*P-I*z,j[this.halfSize-1-2*T]=-C*z+I*P}return j}}])}(fr),cr=function(r){function e(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return ur(this,e),Z(this,e,[r,t||r])}return tr(e,r),ar(e,[{key:"transform",value:function(r){var e,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=null!==(e=null==a?void 0:a[this.fftSize])&&void 0!==e?e:t("IMDCT.transform: mdctBuffers[".concat(this.fftSize,"] is required")),u=null!==(n=null==i?void 0:i.real)&&void 0!==n?n:t("IMDCT.transform: mdctBuffers[".concat(this.fftSize,"].real is required")),f=null!==(o=null==i?void 0:i.imag)&&void 0!==o?o:t("IMDCT.transform: mdctBuffers[".concat(this.fftSize,"].imag is required")),l=this.quarterSize,c=3*l;u.fill(0),f.fill(0);for(var s=0;s<this.fftSize;s++){var h=2*s,v=-r[h],y=-r[this.halfSize-1-h],d=this.sinCosTable[h],b=this.sinCosTable[h+1];u[s]=y*b+v*d,f[s]=y*d-v*b}X.fft(u,f);for(var p=new Float32Array(this.size),m=0;m<this.fftSize/2;m++){var w=2*m,g=this.sinCosTable[w],S=this.sinCosTable[w+1],k=u[m],A=f[m],M=k*g+A*S,F=k*S-A*g;p[c-1-w]=M,p[c+w]=M,p[l+w]=F,p[l-1-w]=-F}for(var B=this.fftSize/2;B<this.fftSize;B++){var O=2*(B-this.fftSize/2)+l,j=2*B,T=this.sinCosTable[j],P=this.sinCosTable[j+1],z=u[B],C=f[B],I=z*T+C*P,q=z*P-C*T;p[c-1-O]=I,p[O-l]=-I,p[l+O]=q,p[5*l-1-O]=q}return p}}])}(fr),sr=new lr(p,.5),hr=new lr(m,.5),vr=new lr(w,1),yr=new cr(p,8*p),dr=new cr(m,8*m),br=new cr(w,4*w);function pr(r,e,t){for(var n=r.length,o=new Float32Array(2*n),a=0;a<n;a++){var i=t[a],u=t[2*n-1-a],f=r[a],l=e[n-1-a];o[a]=f*u-l*i,o[2*n-1-a]=f*i+l*u}return o}function mr(r,e,t){var n=r.length,o=new Int32Array(n);if(0===t||0===e)return o.fill(0,0,n),o;for(var a=H[e],i=(1<<t-D)-1,u=i/a,f=i,l=-i,c=0;c<n;c++){var s=r[c]*u,h=s+(s>=0?.5:-.5)|0;o[c]=h>f?f:h<l?l:h}return o}function wr(r,e,t){if(0===t||0===e)return new Float32Array(r.length);for(var n=H[e],o=(1<<t-D)-1,a=new Float32Array(r.length),i=0;i<r.length;i++)a[i]=r[i]*n/o;return a}function gr(r,e,t){var n=t,o=function(r,e,t,n){for(var o=new Int32Array(c),a=new Int32Array(r),i=[],u=[],f=function(r,e,t){var n=o[r],a=H[n];if(0===a)return 0;var i=0|L[e],u=0|L[t];return a*((0===i?2:W[i])-W[u])},l=0;l<r;l++){var s=0|t[l];if(0!==s){var h=Sr(e[l].subarray(0,s));if(o[l]=h,0!==h){var v=0,y=1,d=L[y]-L[v]|0;if(!(d<=0)){var b=f(l,v,y);i.push(l),u.push(b/d)}}}}for(var p=(i.length>>1)-1;p>=0;p--)Ar(i,u,p);for(;n>0&&i.length>0;){var m=i[0],w=0|a[m],g=w+1,S=0|t[m],k=(L[g]-L[w]|0)*S;if(k>n||k<=0)kr(i,u);else if(n-=k,a[m]=g,g<U){var A=g+1,M=L[A]-L[g]|0;M>0?(u[0]=f(m,g,A)/M,Ar(i,u,0)):kr(i,u)}else kr(i,u)}return{wordLengths:a,scaleFactorIndices:o}}(n,r,e,f-l-n*s);return{bfuCount:n,allocation:o.wordLengths,scaleFactorIndices:o.scaleFactorIndices}}function Sr(r){for(var e=0,t=0;t<r.length;t++){var n=Math.abs(r[t]);n>e&&(e=n)}if(0===e)return 0;var o=Math.ceil(3*(Math.log2(e)+21));return Math.max(0,Math.min(63,o))}function kr(r,e){var t=r.length-1;r[0]=r[t],e[0]=e[t],r.pop(),e.pop(),r.length&&Ar(r,e,0)}function Ar(r,e,t){for(var n=r.length,o=t,a=r[o],i=e[o];;){var u=1+(o<<1),f=u+1,l=o,c=i;if(u<n&&e[u]>c&&(l=u,c=e[u]),f<n&&e[f]>c&&(l=f),l===o)break;r[o]=r[l],e[o]=e[l],o=l}r[o]=a,e[o]=i}function Mr(r){return Mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Mr(r)}function Fr(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,Or(n.key),n)}}function Br(r,e,t){return e&&Fr(r.prototype,e),t&&Fr(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function Or(r){var e=function(r,e){if("object"!=Mr(r)||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=Mr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==Mr(e)?e:e+""}var jr=Br(function r(){!function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),this.transformBuffers={64:new Float32Array(64),128:new Float32Array(128),256:new Float32Array(256),512:new Float32Array(512)},this.qmfWorkBuffers={delay:{128:new Float32Array(S+128),256:new Float32Array(S+256),512:new Float32Array(S+512)},highBandDelay:{128:new Float32Array(167),256:new Float32Array(295)}},this.qmfDelays={lowBand:new Float32Array(S),midBand:new Float32Array(S),highBand:new Float32Array(39)},this.transientDetection=[new Float32Array(64),new Float32Array(64),new Float32Array(128)],this.mdctBuffers={16:{real:new Float32Array(16),imag:new Float32Array(16)},64:{real:new Float32Array(64),imag:new Float32Array(64)},128:{real:new Float32Array(128),imag:new Float32Array(128)}},this.mdctOverlap=[new Float32Array(32),new Float32Array(32),new Float32Array(32)],this.imdctOverlap=[new Float32Array(256),new Float32Array(256),new Float32Array(512)],this.reversalBuffers={32:new Float32Array(32),128:new Float32Array(128),256:new Float32Array(256)}});function Tr(r){return Tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Tr(r)}function Pr(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),t.push.apply(t,n)}return t}function zr(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?Pr(Object(t),!0).forEach(function(e){Cr(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Pr(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}function Cr(r,e,t){return(e=Er(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ir(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,o,a,i,u=[],f=!0,l=!1;try{if(a=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;f=!1}else for(;!(f=(n=a.call(t)).done)&&(u.push(n.value),u.length!==e);f=!0);}catch(r){l=!0,o=r}finally{try{if(!f&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(r,e)||function(r,e){if(r){if("string"==typeof r)return qr(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?qr(r,e):void 0}}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qr(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function xr(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,Er(n.key),n)}}function Er(r){var e=function(r,e){if("object"!=Tr(r)||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=Tr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==Tr(e)?e:e+""}var _r=function(){return function(r,e,t){return e&&xr(r.prototype,e),t&&xr(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}(function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),this.values={transientThresholdLow:1,transientThresholdMid:1.5,transientThresholdHigh:2},this.metadata={transientThresholdLow:{default:this.values.transientThresholdLow,name:"Low Band Transient Threshold",description:"Controls the transient detection threshold for the low frequency band (0-5.5kHz). Lower values make detection more sensitive, triggering short blocks more easily. Higher values require stronger transients.",range:[.01,2],step:.01},transientThresholdMid:{default:this.values.transientThresholdMid,name:"Mid Band Transient Threshold",description:"Controls the transient detection threshold for the mid frequency band (5.5-11kHz). Lower values make detection more sensitive, triggering short blocks more easily. Higher values require stronger transients.",range:[.01,3],step:.01},transientThresholdHigh:{default:this.values.transientThresholdHigh,name:"High Band Transient Threshold",description:"Controls the transient detection threshold for the high frequency band (11-22kHz). Lower values make detection more sensitive, triggering short blocks more easily. Higher values require stronger transients.",range:[.01,4],step:.01}},e&&this.setOptions(e)},[{key:"setOptions",value:function(r){for(var e=0,t=Object.entries(r);e<t.length;e++){var n=Ir(t[e],2),o=n[0],a=n[1];o in this.values&&this.setValue(o,a)}}},{key:"setValue",value:function(r,e){if(!(r in this.metadata))throw new Error("Unknown option: ".concat(r));var t=Ir(this.metadata[r].range,2),n=t[0],o=t[1];if(e<n||e>o)throw new Error("Value for ".concat(r," must be between ").concat(n," and ").concat(o,", got ").concat(e));this.values[r]=e}},{key:"getValue",value:function(r){if(!(r in this.values))throw new Error("Unknown option: ".concat(r));return this.values[r]}},{key:"transientThresholdLow",get:function(){return this.values.transientThresholdLow}},{key:"transientThresholdMid",get:function(){return this.values.transientThresholdMid}},{key:"transientThresholdHigh",get:function(){return this.values.transientThresholdHigh}},{key:"getMetadata",value:function(r){return this.metadata[r]}},{key:"getAllMetadata",value:function(){return zr({},this.metadata)}},{key:"reset",value:function(){for(var r=0,e=Object.entries(this.metadata);r<e.length;r++){var t=Ir(e[r],2),n=t[0],o=t[1];this.values[n]=o.default}}},{key:"toObject",value:function(){return{values:zr({},this.values),metadata:zr({},this.metadata)}}}])}();function Dr(r,e,t){if(!e)return!1;var n=function(r,e){var t=function(r,e){for(var t=0,n=0,o=0;o<r.length;o++){var a=Math.abs(r[o]),i=a-Math.abs(e[o]);i>0&&(t+=i),n+=a*a}var u=Math.sqrt(n)||1e-6;return t/u}(r,e),n=Ur(r),o=Ur(e),a=Math.abs(n-o),i=Lr(r),u=Lr(e),f=Math.abs(i-u),l=function(r,e){for(var t=0,n=0,o=0;o<r.length;o++)t+=r[o]*r[o],n+=e[o]*e[o];t=Math.max(t,1e-10),n=Math.max(n,1e-10);var a=10*Math.log10(t/n);return Math.max(0,a)}(r,e);return{spectralFlux:t,flatnessChange:a,hfChange:f,energyChange:l}}(r,e),o=function(r){var e=r.spectralFlux,t=r.flatnessChange,n=r.hfChange,o=r.energyChange,a=e,i=Math.sqrt(t),u=Math.log1p(10*n)/Math.log1p(10),f=Math.min(o/30,1);return(a+i+u+f)/4}(n);return o>t}function Ur(r){for(var e=0,t=0,n=0,o=0;o<r.length;o++){var a=Math.abs(r[o]);a>1e-10&&(e+=Math.log(a),t+=a,n++)}if(0===n)return 0;var i=Math.exp(e/n),u=t/n;return u>1e-10?i/u:0}function Lr(r){for(var e=Math.floor(r.length/2),t=0,n=0,o=0;o<e;o++)t+=r[o]*r[o];for(var a=e;a<r.length;a++)n+=r[a]*r[a];var i=t+n;return i>0?n/i:0}function Hr(r){var e,n=null!==(e=null==r?void 0:r.bufferPool)&&void 0!==e?e:t("qmfAnalysisStage: bufferPool is required"),o=n.qmfDelays;return function(r){var e=N(r,o.lowBand,n.qmfWorkBuffers);o.lowBand=e.newDelay;var t=N(e.lowBand,o.midBand,n.qmfWorkBuffers);o.midBand=t.newDelay;var a=n.qmfWorkBuffers.highBandDelay[e.highBand.length];a.set(o.highBand),a.set(e.highBand,o.highBand.length);var i=a.slice(0,e.highBand.length);return o.highBand=a.slice(e.highBand.length),{bands:[t.lowBand,t.highBand,i]}}}function Wr(r){var e,n,o=null!==(e=null==r?void 0:r.bufferPool)&&void 0!==e?e:t("blockSelectorStage: bufferPool is required"),a=null!==(n=null==r?void 0:r.options)&&void 0!==n?n:t("blockSelectorStage: options is required");return function(r){var e=r.bands,t=[B,O,j],n=e.map(function(r,e){var n=function(r,e){var t=new Float32Array(e),n=new Float32Array(e),o=Math.min(r.length,e);t.set(r.subarray(0,o)),X.fft(t,n);for(var a=new Float32Array(e/2),i=0;i<e/2;i++)a[i]=Math.sqrt(t[i]*t[i]+n[i]*n[i]);return a}(r,t[e]),i=Dr(n,o.transientDetection[e],a.transientThresholdLow);return o.transientDetection[e]=n,i*Math.max(e+1,2)});return{bands:e,blockModes:n}}}function Nr(r){var e,n=null!==(e=null==r?void 0:r.bufferPool)&&void 0!==e?e:t("mdctStage: bufferPool is required"),a=n.mdctOverlap,i=[hr,hr,vr];function u(r,e,t,n,a){var u=T[e];return 0===t?function(r,e,t,n,a,i){var u=2===e?w:m,l=i.transformBuffers[u];l.fill(0),l.set(a,t.windowStart),f(r,a,t.size),l.set(r,t.windowStart+z);var c=n.transform(l,i.mdctBuffers);return e>0&&(c=o(c,i.reversalBuffers)),c}(r,e,u,i[e],n,a):function(r,e,t,n,a){for(var i=1<<(256===t.size?3:2),u=new Float32Array(t.size),l=0;l<i;l++){var c=l*P,s=r.subarray(c,c+P),h=a.transformBuffers[p];h.fill(0),h.set(n,0),f(s,n,P),h.set(s,z);var v=sr.transform(h,a.mdctBuffers);e>0&&(v=o(v,a.reversalBuffers)),u.set(v,c)}return u}(r,e,u,n,a)}function f(r,e,t){for(var n=t-z,o=0;o<z;o++){var a=r[n+o];e[o]=g[o]*a,r[n+o]=a*g[31-o]}}return function(r){var e=r.bands,t=r.blockModes,o=r.originalFrame,i=new Float32Array(512);return e.forEach(function(r,e){var o=u(r,e,t[e],a[e],n),f=function(r){return 0===r?0:1===r?128:256}(e);i.set(o,f)}),{bands:e,coefficients:i,blockModes:t,originalFrame:o}}}function Rr(){return function(r){for(var e=r.coefficients,t=r.blockModes,n=function(r,e){for(var t=[],n=[],o=0,a=0,i=0;i<3;i++){for(var u=o,f=2===i?256:128,l=i<2?y[i]:h.length,c=0===e[i]?d:b;a<l;){var s=h[a],v=c[a]-u,p=v+s,m=new Float32Array(s);if(v>=0&&p<=f)m.set(r.subarray(u+v,u+p));else if(m.fill(0),v<f&&p>0){var w=Math.max(0,v),g=Math.min(f,p);m.set(r.subarray(u+w,u+g),Math.max(0,-v))}t.push(m),n.push(s),a++}o+=f}return{bfuData:t,bfuSizes:n,bfuCount:a}}(e,t),o=n.bfuData,a=n.bfuSizes,i=gr(o,a,n.bfuCount),u=i.bfuCount,f=i.allocation,l=i.scaleFactorIndices,c=[],s=0;s<u;s++){var v=o[s].subarray(0,a[s]),p=f[s],m=L[p],w=mr(v,l[s],m);c.push(w)}return{nBfu:u,scaleFactorIndices:l,wordLengthIndices:f.slice(0,u),quantizedCoefficients:c,blockModes:t}}}function Vr(){return n({options:arguments.length>0&&void 0!==arguments[0]?arguments[0]:new _r,bufferPool:arguments.length>1&&void 0!==arguments[1]?arguments[1]:new jr},Hr,Wr,Nr,Rr)}function Gr(){return function(r){for(var e=new Float32Array(512),t=r.nBfu,n=r.scaleFactorIndices,o=r.wordLengthIndices,a=r.quantizedCoefficients,i=r.blockModes,u=0;u<t;u++){var f=L[o[u]],l=0;u>=y[0]&&(l=1),u>=y[1]&&(l=2);var c=0===i[l]?d[u]:b[u];if(f>0){var s=wr(a[u],n[u],f);e.set(s,c)}}return{coefficients:e,blockModes:i}}}function $r(r){var e,n=null!==(e=null==r?void 0:r.bufferPool)&&void 0!==e?e:t("imdctStage: bufferPool is required"),a=n.imdctOverlap,i=[dr,dr,br];function u(r,e,t,n,a,u){return 0===t?function(r,e,t,n,a,i){var u=r;e>0&&(u=o(r,n.reversalBuffers));var f=i.transform(u,n.mdctBuffers),l=f.length/4,c=n.transformBuffers[w];c.fill(0);for(var s=0;s<a.size;s++)c[s]=f[l+s];var h=t.slice(2*a.size-C,2*a.size),v=pr(h.slice(0,C),c.slice(0,C),g);t.set(v,0);for(var y=0;y<C;y++)h[y]=c[C+y];for(var d=2===e?240:112,b=0;b<d;b++)t[32+b]=c[C+b];for(var p=0;p<C;p++)t[2*a.size-C+p]=c[a.size-C+p];return t.slice(0,a.size)}(r,e,n,a,u,i[e]):function(r,e,t,n,a){var i=1<<(256===a.size?3:2),u=n.transformBuffers[w];u.fill(0);for(var f=t.slice(2*a.size-C,2*a.size),l=0,c=0,s=0;s<i;s++){var h=r.slice(c,c+P);e>0&&(h=o(h,n.reversalBuffers));for(var v=yr.transform(h,n.mdctBuffers),y=v.length/4,d=0;d<P;d++)u[l+d]=v[y+d];var b=pr(f.slice(0,C),u.slice(l,l+C),g);t.set(b,l);for(var p=0;p<C;p++)f[p]=u[l+C+p];l+=P,c+=P}for(var m=0;m<C;m++)t[2*a.size-C+m]=u[a.size-C+m];return t.slice(0,a.size)}(r,e,n,a,u)}return function(r){var e=r.coefficients,t=r.blockModes;return T.map(function(r,o){var i=function(r,e){var t=[0,128,256,512];return r.subarray(t[e],t[e+1])}(e,o);return u(i,o,t[o],a[o],n,r)})}}function Jr(r){var e,n=null!==(e=null==r?void 0:r.bufferPool)&&void 0!==e?e:t("qmfSynthesisStage: bufferPool is required"),o=n.qmfDelays;return function(r){var e=n.qmfWorkBuffers.highBandDelay[r[2].length];e.set(o.highBand),e.set(r[2],o.highBand.length);var t=e.slice(0,2*r[0].length);o.highBand=e.slice(2*r[0].length);var a=R(r[0],r[1],o.midBand,n.qmfWorkBuffers);o.midBand=a.newDelay;var i=R(a.output,t,o.lowBand,n.qmfWorkBuffers);return o.lowBand=i.newDelay,i.output}}function Kr(){return n({bufferPool:arguments.length>0&&void 0!==arguments[0]?arguments[0]:new jr},Gr,$r,Jr)}function Qr(r,e,t,n){if(0!==n){var o=Math.floor(e/8),a=e%8;t&=(1<<n)-1;for(var i=0;i<n&&o<r.length;){var u=8-a,f=Math.min(n-i,u),l=t>>n-i-f&(1<<f)-1,c=(1<<f)-1<<u-f;r[o]=r[o]&~c|l<<u-f,i+=f,o++,a=0}}}function Xr(r,e,t){if(0===t)return 0;for(var n=Math.floor(e/8),o=e%8,a=0,i=0;i<t&&n<r.length;){var u=8-o,f=Math.min(t-i,u),l=(1<<f)-1;a=a<<f|r[n]>>u-f&l,i+=f,n++,o=0}return a}function Yr(r,e,t){var n=Xr(r,e,t);return n>=1<<t-1?n-(1<<t):n}function Zr(r){return Zr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Zr(r)}function re(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,ee(n.key),n)}}function ee(r){var e=function(r,e){if("object"!=Zr(r)||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=Zr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==Zr(e)?e:e+""}function te(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=function(r,e){if(r){if("string"==typeof r)return ne(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ne(r,e):void 0}}(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,o=function(){};return{s:o,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return i=r.done,r},e:function(r){u=!0,a=r},f:function(){try{i||null==t.return||t.return()}finally{if(u)throw a}}}}function ne(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function oe(r){var e=new Uint8Array(u),t=new DataView(e.buffer),n=v.indexOf(r.nBfu),o=2-r.blockModes[0]<<14|2-r.blockModes[1]<<12|3-r.blockModes[2]<<10|n<<5;t.setUint16(0,o,!1);for(var a=x,i=0;i<r.nBfu;i++)Qr(e,a,r.wordLengthIndices[i],E),a+=E;for(var f=0;f<r.nBfu;f++)Qr(e,a,r.scaleFactorIndices[f],_),a+=_;for(var l=0;l<r.nBfu;l++){var c=L[r.wordLengthIndices[l]];if(c>0){var s,h=te(r.quantizedCoefficients[l]);try{for(h.s();!(s=h.n()).done;){var y=s.value;Qr(e,a,y<0?y+(1<<c):y,c),a+=c}}catch(r){h.e(r)}finally{h.f()}}}return e[u-3]=0,e[u-2]=0,e[u-1]=0,e}function ae(r){if(r.length!==u)throw new Error("Frame must be ".concat(u," bytes"));for(var e=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,!1),t=[2-(e>>14&3),2-(e>>12&3),3-(e>>10&3)],n=v[e>>5&7],o=x,a=new Int32Array(n),i=0;i<n;i++)a[i]=Xr(r,o,E),o+=E;for(var f=new Int32Array(n),l=0;l<n;l++)f[l]=Xr(r,o,_),o+=_;for(var c=[],s=0;s<n;s++){var y=L[a[s]],d=h[s],b=new Int32Array(d);if(y>0)for(var p=0;p<d;p++)b[p]=Yr(r,o,y),o+=y;c.push(b)}return{nBfu:n,scaleFactorIndices:f,wordLengthIndices:a,quantizedCoefficients:c,blockModes:t}}var ie=function(){return function(r,e,t){return e&&re(r.prototype,e),t&&re(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}(function r(){!function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r)},null,[{key:"createHeader",value:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=new Uint8Array(i),o=new DataView(n.buffer);n.set(a,0);var u=(new TextEncoder).encode(r);return n.set(u.subarray(0,Math.min(u.length,255)),4),o.setUint32(260,e,!0),n[264]=t,n}},{key:"parseHeader",value:function(r){if(r.length!==i)throw new Error("Header must be ".concat(i," bytes"));for(var e=0;e<a.length;e++)if(r[e]!==a[e])throw new Error("Invalid AEA file");var t=new DataView(r.buffer,r.byteOffset,r.byteLength),n=r.indexOf(0,4),o=-1===n?256:n-4;return{title:(new TextDecoder).decode(r.subarray(4,4+o)),frameCount:t.getUint32(260,!0),channelCount:r[264]}}}])}();function ue(r){return ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ue(r)}function fe(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=he(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,o=function(){};return{s:o,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return i=r.done,r},e:function(r){u=!0,a=r},f:function(){try{i||null==t.return||t.return()}finally{if(u)throw a}}}}function le(r,e,t,n,o,a,i){try{var u=r[a](i),f=u.value}catch(r){return void t(r)}u.done?e(f):Promise.resolve(f).then(n,o)}function ce(r){return function(){var e=this,t=arguments;return new Promise(function(n,o){var a=r.apply(e,t);function i(r){le(a,n,o,i,u,"next",r)}function u(r){le(a,n,o,i,u,"throw",r)}i(void 0)})}}function se(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,o,a,i,u=[],f=!0,l=!1;try{if(a=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;f=!1}else for(;!(f=(n=a.call(t)).done)&&(u.push(n.value),u.length!==e);f=!0);}catch(r){l=!0,o=r}finally{try{if(!f&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(r,e)||he(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function he(r,e){if(r){if("string"==typeof r)return ve(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ve(r,e):void 0}}function ve(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function ye(r){if(null!=r){var e=r["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],t=0;if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length))return{next:function(){return r&&t>=r.length&&(r=void 0),{value:r&&r[t++],done:!r}}}}throw new TypeError(ue(r)+" is not iterable")}function de(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function a(t,n,o,a){var f=n&&n.prototype instanceof u?n:u,l=Object.create(f.prototype);return be(l,"_invoke",function(t,n,o){var a,u,f,l=0,c=o||[],s=!1,h={p:0,n:0,v:r,a:v,f:v.bind(r,4),d:function(e,t){return a=e,u=0,f=r,h.n=t,i}};function v(t,n){for(u=t,f=n,e=0;!s&&l&&!o&&e<c.length;e++){var o,a=c[e],v=h.p,y=a[2];t>3?(o=y===n)&&(f=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=r):a[0]<=v&&((o=t<2&&v<a[1])?(u=0,h.v=n,h.n=a[1]):v<y&&(o=t<3||a[0]>n||n>y)&&(a[4]=t,a[5]=n,h.n=y,u=0))}if(o||t>1)return i;throw s=!0,n}return function(o,c,y){if(l>1)throw TypeError("Generator is already running");for(s&&1===c&&v(c,y),u=c,f=y;(e=u<2?r:f)||!s;){a||(u?u<3?(u>1&&(h.n=-1),v(u,f)):h.n=f:h.v=f);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,f)))throw TypeError("iterator result is not an object");if(!e.done)return e;f=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(f=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=r}else if((e=(s=h.n<0)?f:t.call(n,h))!==i)break}catch(e){a=r,u=1,f=e}finally{l=1}}return{value:e,done:s}}}(t,o,a),!0),l}var i={};function u(){}function f(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(be(e={},n,function(){return this}),e),s=l.prototype=u.prototype=Object.create(c);function h(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,l):(r.__proto__=l,be(r,o,"GeneratorFunction")),r.prototype=Object.create(s),r}return f.prototype=l,be(s,"constructor",l),be(l,"constructor",f),f.displayName="GeneratorFunction",be(l,o,"GeneratorFunction"),be(s),be(s,o,"Generator"),be(s,n,function(){return this}),be(s,"toString",function(){return"[object Generator]"}),(de=function(){return{w:a,m:h}})()}function be(r,e,t,n){var o=Object.defineProperty;try{o({},"",{})}catch(r){o=0}be=function(r,e,t,n){if(e)o?o(r,e,{value:t,enumerable:!n,configurable:!n,writable:!n}):r[e]=t;else{var a=function(e,t){be(r,e,function(r){return this._invoke(e,t,r)})};a("next",0),a("throw",1),a("return",2)}},be(r,e,t,n)}function pe(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,me(n.key),n)}}function me(r){var e=function(r,e){if("object"!=ue(r)||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=ue(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==ue(e)?e:e+""}function we(r){return function(){return new ge(r.apply(this,arguments))}}function ge(r){var e,t;function n(e,t){try{var a=r[e](t),i=a.value,u=i instanceof Ae;Promise.resolve(u?i.v:i).then(function(t){if(u){var f="return"===e?"return":"next";if(!i.k||t.done)return n(f,t);t=r[f](t).value}o(a.done?"return":"normal",t)},function(r){n("throw",r)})}catch(r){o("throw",r)}}function o(r,o){switch(r){case"return":e.resolve({value:o,done:!0});break;case"throw":e.reject(o);break;default:e.resolve({value:o,done:!1})}(e=e.next)?n(e.key,e.arg):t=null}this._invoke=function(r,o){return new Promise(function(a,i){var u={key:r,arg:o,resolve:a,reject:i,next:null};t?t=t.next=u:(e=t=u,n(r,o))})},"function"!=typeof r.return&&(this.return=void 0)}function Se(r){return new Ae(r,0)}function ke(r){var e={},t=!1;function n(e,n){return t=!0,n=new Promise(function(t){t(r[e](n))}),{done:!1,value:new Ae(n,1)}}return e["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},e.next=function(r){return t?(t=!1,r):n("next",r)},"function"==typeof r.throw&&(e.throw=function(r){if(t)throw t=!1,r;return n("throw",r)}),"function"==typeof r.return&&(e.return=function(r){return t?(t=!1,r):n("return",r)}),e}function Ae(r,e){this.v=r,this.k=e}function Me(r){var e,t,n,o=2;for("undefined"!=typeof Symbol&&(t=Symbol.asyncIterator,n=Symbol.iterator);o--;){if(t&&null!=(e=r[t]))return e.call(r);if(n&&null!=(e=r[n]))return new Fe(e.call(r));t="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function Fe(r){function e(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var e=r.done;return Promise.resolve(r.value).then(function(r){return{value:r,done:e}})}return Fe=function(r){this.s=r,this.n=r.next},Fe.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(r){var t=this.s.return;return void 0===t?Promise.resolve({value:r,done:!0}):e(t.apply(this.s,arguments))},throw:function(r){var t=this.s.return;return void 0===t?Promise.reject(r):e(t.apply(this.s,arguments))}},new Fe(r)}ge.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},ge.prototype.next=function(r){return this._invoke("next",r)},ge.prototype.throw=function(r){return this._invoke("throw",r)},ge.prototype.return=function(r){return this._invoke("return",r)};var Be=function(){function r(){!function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r)}return function(r,e,t){return e&&pe(r.prototype,e),t&&pe(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}(r,null,[{key:"encodeStream",value:function(e){return we(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return de().m(function n(){var o,a,i,u;return de().w(function(n){for(;;)switch(n.n){case 0:if(o=t.channelCount,a=void 0===o?1:o,i=t.onProgress,u=t.encoderOptions,1!==a){n.n=2;break}return n.d(ye(ke(Me(r._encodeMonoStream(e,i,u)))),1);case 1:case 3:n.n=5;break;case 2:if(2!==a){n.n=4;break}return n.d(ye(ke(Me(r._encodeStereoStream(e,i,u)))),3);case 4:throw new Error("Unsupported channel count: ".concat(a));case 5:return n.a(2)}},n)})()}).apply(this,arguments)}},{key:"_encodeMonoStream",value:function(r,e,t){return we(de().m(function n(){var o,a,i,u,f,l,c,s,h,v,y;return de().w(function(n){for(;;)switch(n.n){case 0:o=t||new _r,a=Vr(o),i=0,u=!1,f=!1,n.p=1,c=Me(r);case 2:return n.n=3,Se(c.next());case 3:if(!(u=!(s=n.v).done)){n.n=6;break}return h=s.value,v=a(h),n.n=4,v;case 4:e&&e(i++);case 5:u=!1,n.n=2;break;case 6:n.n=8;break;case 7:n.p=7,y=n.v,f=!0,l=y;case 8:if(n.p=8,n.p=9,!u||null==c.return){n.n=10;break}return n.n=10,Se(c.return());case 10:if(n.p=10,!f){n.n=11;break}throw l;case 11:return n.f(10);case 12:return n.f(8);case 13:return n.a(2)}},n,null,[[9,,10,12],[1,7,8,13]])}))()}},{key:"_encodeStereoStream",value:function(r,e,t){return we(de().m(function n(){var o,a,i,u,f,l,c,s,h,v,y,d,b,p,m;return de().w(function(n){for(;;)switch(n.n){case 0:o=t||new _r,a=Vr(o),i=Vr(o),u=0,f=!1,l=!1,n.p=1,s=Me(r);case 2:return n.n=3,Se(s.next());case 3:if(!(f=!(h=n.v).done)){n.n=7;break}return v=se(h.value,2),y=v[0],d=v[1],b=a(y),p=i(d),n.n=4,b;case 4:return n.n=5,p;case 5:e&&e(u++);case 6:f=!1,n.n=2;break;case 7:n.n=9;break;case 8:n.p=8,m=n.v,l=!0,c=m;case 9:if(n.p=9,n.p=10,!f||null==s.return){n.n=11;break}return n.n=11,Se(s.return());case 11:if(n.p=11,!l){n.n=12;break}throw c;case 12:return n.f(11);case 13:return n.f(9);case 14:return n.a(2)}},n,null,[[10,,11,13],[1,8,9,14]])}))()}},{key:"decodeStream",value:function(e){return we(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return de().m(function n(){var o,a,i;return de().w(function(n){for(;;)switch(n.n){case 0:if(o=t.channelCount,a=void 0===o?1:o,i=t.onProgress,1!==a){n.n=2;break}return n.d(ye(ke(Me(r._decodeMonoStream(e,i)))),1);case 1:case 3:n.n=5;break;case 2:if(2!==a){n.n=4;break}return n.d(ye(ke(Me(r._decodeStereoStream(e,i)))),3);case 4:throw new Error("Unsupported channel count: ".concat(a));case 5:return n.a(2)}},n)})()}).apply(this,arguments)}},{key:"_decodeMonoStream",value:function(r,e){return we(de().m(function t(){var n,o,a;return de().w(function(t){for(;;)switch(t.n){case 0:return n=Kr(),o=0,a=function(){var t=we(de().m(function t(){var a,i,u,f,l,c,s,h;return de().w(function(t){for(;;)switch(t.n){case 0:a=!1,i=!1,t.p=1,f=Me(r);case 2:return t.n=3,Se(f.next());case 3:if(!(a=!(l=t.v).done)){t.n=6;break}return c=l.value,s=n(c),t.n=4,s;case 4:e&&e(o++);case 5:a=!1,t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,h=t.v,i=!0,u=h;case 8:if(t.p=8,t.p=9,!a||null==f.return){t.n=10;break}return t.n=10,Se(f.return());case 10:if(t.p=10,!i){t.n=11;break}throw u;case 11:return t.f(10);case 12:return t.f(8);case 13:return t.a(2)}},t,null,[[9,,10,12],[1,7,8,13]])}));return function(){return t.apply(this,arguments)}}(),t.d(ye(ke(Me(a()))),1);case 1:return t.a(2)}},t)}))()}},{key:"_decodeStereoStream",value:function(e,t){return we(de().m(function n(){var o,a,i,u;return de().w(function(n){for(;;)switch(n.n){case 0:return o=Kr(),a=Kr(),i=0,u=function(){var n=we(de().m(function n(){var u,f,l,c,s,h,v,y,d,b,p,m,w,g,S;return de().w(function(n){for(;;)switch(n.n){case 0:u=null,f=!0,l=!1,c=!1,n.p=1,h=Me(e);case 2:return n.n=3,Se(h.next());case 3:if(!(l=!(v=n.v).done)){n.n=8;break}if(y=v.value,!f){n.n=4;break}u=y,n.n=6;break;case 4:return d=y,b=o(u),p=a(d),n.n=5,[b,p];case 5:t&&t(i++);case 6:f=!f;case 7:l=!1,n.n=2;break;case 8:n.n=10;break;case 9:n.p=9,S=n.v,c=!0,s=S;case 10:if(n.p=10,n.p=11,!l||null==h.return){n.n=12;break}return n.n=12,Se(h.return());case 12:if(n.p=12,!c){n.n=13;break}throw s;case 13:return n.f(12);case 14:return n.f(10);case 15:if(f||!u){n.n=17;break}return m=r._createDummyFrame(),w=o(u),g=a(m),n.n=16,[w,g];case 16:t&&t(i++);case 17:return n.a(2)}},n,null,[[11,,12,14],[1,9,10,15]])}));return function(){return n.apply(this,arguments)}}(),n.d(ye(ke(Me(u()))),1);case 1:return n.a(2)}},n)}))()}},{key:"frameBufferToFrames",value:function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:512;return de().m(function t(){var n,o,a,i,u,f,l,c,s,h,v,y,d,b,p,m;return de().w(function(t){for(;;)switch(t.n){case 0:if(1!==(n=r.length)){t.n=4;break}o=se(r,1),a=o[0],i=0;case 1:if(!(i<a.length)){t.n=3;break}for(u=new Float32Array(e),f=Math.min(i+e,a.length),l=0;l<f-i;l++)u[l]=a[i+l];return t.n=2,u;case 2:i+=e,t.n=1;break;case 3:t.n=9;break;case 4:if(2!==n){t.n=8;break}c=se(r,2),s=c[0],h=c[1],v=Math.max(s.length,h.length),y=0;case 5:if(!(y<v)){t.n=7;break}for(d=new Float32Array(e),b=new Float32Array(e),p=Math.min(y+e,v),m=0;m<p-y;m++)d[m]=y+m<s.length?s[y+m]:0,b[m]=y+m<h.length?h[y+m]:0;return t.n=6,[d,b];case 6:y+=e,t.n=5;break;case 7:t.n=9;break;case 8:throw new Error("Unsupported channel count: ".concat(n));case 9:return t.a(2)}},t)})()}},{key:"collectFrames",value:(n=ce(de().m(function r(e){var t,n,o,a,i,u,f,l;return de().w(function(r){for(;;)switch(r.n){case 0:t=[],n=!1,o=!1,r.p=1,i=Me(e);case 2:return r.n=3,i.next();case 3:if(!(n=!(u=r.v).done)){r.n=5;break}f=u.value,t.push(f);case 4:n=!1,r.n=2;break;case 5:r.n=7;break;case 6:r.p=6,l=r.v,o=!0,a=l;case 7:if(r.p=7,r.p=8,!n||null==i.return){r.n=9;break}return r.n=9,i.return();case 9:if(r.p=9,!o){r.n=10;break}throw a;case 10:return r.f(9);case 11:return r.f(7);case 12:return r.a(2,t)}},r,null,[[8,,9,11],[1,6,7,12]])})),function(r){return n.apply(this,arguments)})},{key:"_createDummyFrame",value:function(){return{nBfu:0,blockModes:[0,0,0],scaleFactorIndices:new Int32Array(0),wordLengthIndices:new Int32Array(0),quantizedCoefficients:[]}}},{key:"createAeaBlob",value:(t=ce(de().m(function r(e){var t,n,o,a,i,u,f,l,c,s,h,v,y,d,b,p,m,w,g,S,k=arguments;return de().w(function(r){for(;;)switch(r.n){case 0:n=(t=k.length>1&&void 0!==k[1]?k[1]:{}).title,o=void 0===n?"encoded by atrac1.js":n,a=t.channelCount,i=void 0===a?1:a,u=[],f=!1,l=!1,r.p=1,s=Me(e);case 2:return r.n=3,s.next();case 3:if(!(f=!(h=r.v).done)){r.n=5;break}v=h.value,u.push(oe(v));case 4:f=!1,r.n=2;break;case 5:r.n=7;break;case 6:r.p=6,S=r.v,l=!0,c=S;case 7:if(r.p=7,r.p=8,!f||null==s.return){r.n=9;break}return r.n=9,s.return();case 9:if(r.p=9,!l){r.n=10;break}throw c;case 10:return r.f(9);case 11:return r.f(7);case 12:for(y=ie.createHeader(o,u.length,i),d=y.length+u.reduce(function(r,e){return r+e.length},0),(b=new Uint8Array(d)).set(y,0),p=y.length,m=0,w=u;m<w.length;m++)g=w[m],b.set(g,p),p+=g.length;return r.a(2,new Blob([b],{type:"application/octet-stream"}))}},r,null,[[8,,9,11],[1,6,7,12]])})),function(r){return t.apply(this,arguments)})},{key:"createWavBlob",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:44100,o=Array.isArray(e)?e:[e];if(1===t)return r._createMonoWavBlob(o,n);if(2===t)return r._createStereoWavBlob(o,n);throw new Error("Unsupported channel count: ".concat(t))}},{key:"_createMonoWavBlob",value:function(e,t){var n=e.reduce(function(r,e){return r+e.length},0),o=new ArrayBuffer(44+2*n),a=new DataView(o);r._writeWavHeader(a,n,1,t);var i,u=44,f=fe(e);try{for(f.s();!(i=f.n()).done;)for(var l=i.value,c=0;c<l.length;c++){var s=Math.max(-1,Math.min(1,l[c]));a.setInt16(u,s<0?s*q:s*I,!0),u+=2}}catch(r){f.e(r)}finally{f.f()}return new Blob([o],{type:"audio/wav"})}},{key:"_createStereoWavBlob",value:function(e,t){var n=e.reduce(function(r,e){var t=se(e,2),n=t[0],o=t[1];return r+Math.max(n.length,o.length)},0),o=new ArrayBuffer(44+2*n*2),a=new DataView(o);r._writeWavHeader(a,n,2,t);var i,u=44,f=fe(e);try{for(f.s();!(i=f.n()).done;)for(var l=se(i.value,2),c=l[0],s=l[1],h=Math.max(c.length,s.length),v=0;v<h;v++){var y=v<c.length?c[v]:0,d=v<s.length?s[v]:0,b=Math.max(-1,Math.min(1,y)),p=Math.max(-1,Math.min(1,d));a.setInt16(u,b<0?b*q:b*I,!0),u+=2,a.setInt16(u,p<0?p*q:p*I,!0),u+=2}}catch(r){f.e(r)}finally{f.f()}return new Blob([o],{type:"audio/wav"})}},{key:"_writeWavHeader",value:function(r,e,t,n){var o=n*t*2,a=2*t,i=e*a,u=36+i,f=0,l=function(e,t){for(var n=0;n<t.length;n++)r.setUint8(e+n,t.charCodeAt(n))};l(f,"RIFF"),f+=4,r.setUint32(f,u,!0),l(f+=4,"WAVE"),l(f+=4,"fmt "),f+=4,r.setUint32(f,16,!0),f+=4,r.setUint16(f,1,!0),f+=2,r.setUint16(f,t,!0),f+=2,r.setUint32(f,n,!0),f+=4,r.setUint32(f,o,!0),f+=4,r.setUint16(f,a,!0),f+=2,r.setUint16(f,16,!0),l(f+=2,"data"),f+=4,r.setUint32(f,i,!0)}},{key:"parseAeaBlob",value:(e=ce(de().m(function r(e){var t,n,o,a,f,l;return de().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,e.arrayBuffer();case 1:for(t=r.v,n=new Uint8Array(t.slice(0,i)),o=ie.parseHeader(n),a=[],f=i;f<t.byteLength;f+=u)(l=new Uint8Array(t.slice(f,f+u))).length===u&&a.push(l);return r.a(2,{info:o,frameData:a})}},r)})),function(r){return e.apply(this,arguments)})},{key:"deserializedFrameStream",value:de().m(function r(e){var t,n,o,a;return de().w(function(r){for(;;)switch(r.n){case 0:t=fe(e),r.p=1,t.s();case 2:if((n=t.n()).done){r.n=4;break}return o=n.value,r.n=3,ae(o);case 3:r.n=2;break;case 4:r.n=6;break;case 5:r.p=5,a=r.v,t.e(a);case 6:return r.p=6,t.f(),r.f(6);case 7:return r.a(2)}},r,null,[[1,5,6,7]])})},{key:"assemblePcmFrames",value:function(r,e){if(1===e){var t,n=r.reduce(function(r,e){return r+e.length},0),o=new Float32Array(n),a=0,i=fe(r);try{for(i.s();!(t=i.n()).done;){var u=t.value;o.set(u,a),a+=u.length}}catch(r){i.e(r)}finally{i.f()}return o}if(2===e){var f,l=r.reduce(function(r,e){var t=se(e,2),n=t[0],o=t[1];return r+Math.max(n.length,o.length)},0),c=new Float32Array(2*l),s=0,h=fe(r);try{for(h.s();!(f=h.n()).done;)for(var v=se(f.value,2),y=v[0],d=v[1],b=Math.max(y.length,d.length),p=0;p<b;p++)c[2*s]=p<y.length?y[p]:0,c[2*s+1]=p<d.length?d[p]:0,s++}catch(r){h.e(r)}finally{h.f()}return c}throw new Error("Unsupported channel count: ".concat(e))}}]);var e,t,n}();return e})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Carta1=e():r.Carta1=e();
1
+ var e,r;e=this,r=()=>(()=>{var e={d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};function t(e){throw new Error(e)}function n(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];var o=t.map(function(r){return r(e)});return function(e){return o.reduce(function(e,r){return r(e)},e)}}function o(e,r){for(var t=r[e.length],n=0;n<e.length;n++)t[n]=e[e.length-1-n];return t}e.r(r),e.d(r,{AeaFile:()=>nr,AudioProcessor:()=>Ar,BFU_START_LONG:()=>d,BufferPool:()=>Fe,EncoderOptions:()=>qe,FFT:()=>J,SCALE_FACTORS:()=>H,SPECS_PER_BFU:()=>h,WORD_LENGTH_BITS:()=>L,decode:()=>Re,dequantize:()=>be,deserializeFrame:()=>tr,encode:()=>We,mdctStage:()=>Le,pipe:()=>n,qmfAnalysisStage:()=>De,quantize:()=>de,serializeFrame:()=>rr});var a=new Uint8Array([0,8,0,0]),i=2048,u=212,f=8*u,l=40,c=52,s=10,h=new Int32Array([8,8,8,8,4,4,4,4,8,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,9,9,9,9,10,10,10,10,12,12,12,12,12,12,12,12,20,20,20,20,20,20,20,20]),v=new Int32Array([20,28,32,36,40,44,48,52]),y=new Int32Array([20,36,52]),d=new Int32Array([0,8,16,24,32,36,40,44,48,56,64,72,80,86,92,98,104,110,116,122,128,134,140,146,152,159,166,173,180,189,198,207,216,226,236,246,256,268,280,292,304,316,328,340,352,372,392,412,432,452,472,492]),b=new Int32Array([0,32,64,96,8,40,72,104,12,44,76,108,20,52,84,116,26,58,90,122,128,160,192,224,134,166,198,230,141,173,205,237,150,182,214,246,256,288,320,352,384,416,448,480,268,300,332,364,396,428,460,492]),p=64,m=256,w=512,g=function(){for(var e=new Float64Array(32),r=0;r<32;r++)e[r]=Math.sin((r+.5)*Math.PI/64);return e}(),S=46,k=new Float32Array([-1461907e-11,-9205479e-11,-56157569e-12,.00030117269,.0002422519,-.00085293897,-.0005205574,.0020340169,.00078333891,-.0042153862,-.00075614988,.0078402944,-61169922e-12,-.01344162,.0024626821,.021736089,-.007801671,-.034090221,.01880949,.054326009,-.043596379,-.099384367,.13207909,.46424159]),A=function(){for(var e=new Float32Array(48),r=0;r<24;r++)e[r]=2*k[r],e[47-r]=2*k[r];return e}(),M=function(){for(var e=new Float32Array(24),r=0;r<24;r++)e[r]=A[2*r];return e}(),F=function(){for(var e=new Float32Array(24),r=0;r<24;r++)e[r]=A[2*r+1];return e}(),B=128,O=128,j=256,T=[{size:128,windowStart:48},{size:128,windowStart:48},{size:256,windowStart:112}],P=32,z=32,C=16,I=32767,q=32768,x=16,E=4,_=6,D=1,U=15,L=new Int32Array([0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),H=function(){for(var e=new Float64Array(64),r=0;r<64;r++)e[r]=Math.pow(2,r/3-21);return e}(),W=function(){for(var e=L[U],r=new Float64Array(e+1),t=0;t<=e;t++)r[t]=Math.pow(2,-t);return r}();function N(e,r){var n,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.length,u=i>>1,f=null!==(n=null==a||null===(o=a.delay)||void 0===o?void 0:o[i])&&void 0!==n?n:t("qmfAnalysis: qmfWorkBuffers.delay[".concat(i,"] is required"));f.set(r),f.set(e,r.length);for(var l=new Float32Array(u),c=new Float32Array(u),s=0;s<u;s++){for(var h=0,v=0,y=2*s,d=0;d<24;d++)h+=f[y+47-2*d]*M[d],v+=f[y+46-2*d]*F[d];l[s]=h+v,c[s]=h-v}return{lowBand:l,highBand:c,newDelay:f.slice(-S)}}function V(e,r,n){var o,a,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,u=e.length,f=2*u,l=null!==(o=null==i||null===(a=i.delay)||void 0===a?void 0:a[f])&&void 0!==o?o:t("qmfSynthesis: qmfWorkBuffers.delay[".concat(f,"] is required"));l.set(n);for(var c=0;c<u;c++){var s=e[c],h=r[c],v=S+2*c;l[v]=.5*(s+h),l[v+1]=.5*(s-h)}for(var y=new Float32Array(f),d=0;d<u;d++){for(var b=2*d,p=0,m=0,w=0;w<24;w++){var g=b+2*w;p+=l[g]*M[w],m+=l[g+1]*F[w]}y[2*d]=m,y[2*d+1]=p}return{output:y,newDelay:l.slice(-S)}}function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function R(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,$(n.key),n)}}function $(e){var r=function(e,r){if("object"!=G(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=G(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==G(r)?r:r+""}var J=function(){return e=function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"fft",value:function(e,r){var t=e.length;if(1!==t){for(var n=Math.log2(t),o=0;o<t;o++){for(var a=0,i=o,u=0;u<n;u++)a=a<<1|1&i,i>>=1;if(a>o){var f=[e[a],e[o]];e[o]=f[0],e[a]=f[1];var l=[r[a],r[o]];r[o]=l[0],r[a]=l[1]}}for(var c=2;c<=t;c<<=1)for(var s=c>>1,h=-2*Math.PI/c,v=Math.cos(h),y=Math.sin(h),d=0;d<t;d+=c)for(var b=1,p=0,m=0;m<s;m++){var w=d+m,g=w+s,S=e[w],k=r[w],A=e[g],M=r[g],F=A*b-M*p,B=A*p+M*b;e[w]=S+F,r[w]=k+B,e[g]=S-F,r[g]=k-B;var O=b*v-p*y;p=b*y+p*v,b=O}}}}],(r=null)&&R(e.prototype,r),t&&R(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,t}();function K(e){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},K(e)}function Q(e,r,t){return r=Y(r),function(e,r){if(r&&("object"==K(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,X()?Reflect.construct(r,t||[],Y(e).constructor):r.apply(e,t))}function X(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(X=function(){return!!e})()}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}function Z(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&ee(e,r)}function ee(e,r){return ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},ee(e,r)}function re(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ne(n.key),n)}}function te(e,r,t){return r&&re(e.prototype,r),t&&re(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ne(e){var r=function(e,r){if("object"!=K(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=K(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==K(r)?r:r+""}function oe(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var ae=te(function e(r,t){oe(this,e),this.size=r,this.halfSize=r>>1,this.quarterSize=r>>2,this.fftSize=this.halfSize>>1;var n=2*Math.PI/(8*r),o=2*Math.PI/r,a=Math.sqrt(t/r);this.sinCosTable=new Float64Array(this.halfSize);for(var i=0;i<this.quarterSize;i++){var u=o*i+n;this.sinCosTable[2*i]=a*Math.cos(u),this.sinCosTable[2*i+1]=a*Math.sin(u)}}),ie=function(e){function r(e,t){return oe(this,r),Q(this,r,[e,t])}return Z(r,e),te(r,[{key:"transform",value:function(e){var r,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=null!==(r=null==a?void 0:a[this.fftSize])&&void 0!==r?r:t("MDCT.transform: mdctBuffers[".concat(this.fftSize,"] is required")),u=null!==(n=null==i?void 0:i.real)&&void 0!==n?n:t("MDCT.transform: mdctBuffers[".concat(this.fftSize,"].real is required")),f=null!==(o=null==i?void 0:i.imag)&&void 0!==o?o:t("MDCT.transform: mdctBuffers[".concat(this.fftSize,"].imag is required")),l=this.quarterSize,c=3*l;u.fill(0),f.fill(0);for(var s=0;s<l;s+=2){var h=c+s,v=l+s,y=l-1-s,d=e[c-1-s]+e[h],b=e[v]-e[y],p=this.sinCosTable[s],m=this.sinCosTable[s+1];u[s>>1]=d*p+b*m,f[s>>1]=b*p-d*m}for(var w=l;w<this.halfSize;w+=2){var g=w>>1,S=w-l,k=l+w,A=5*l-1-w,M=e[c-1-w]-e[S],F=e[k]+e[A],B=this.sinCosTable[w],O=this.sinCosTable[w+1];u[g]=M*B+F*O,f[g]=F*B-M*O}J.fft(u,f);for(var j=new Float32Array(this.halfSize),T=0;T<this.fftSize;T++){var P=this.sinCosTable[2*T],z=this.sinCosTable[2*T+1],C=u[T],I=f[T];j[2*T]=-C*P-I*z,j[this.halfSize-1-2*T]=-C*z+I*P}return j}}])}(ae),ue=function(e){function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return oe(this,r),Q(this,r,[e,t||e])}return Z(r,e),te(r,[{key:"transform",value:function(e){var r,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=null!==(r=null==a?void 0:a[this.fftSize])&&void 0!==r?r:t("IMDCT.transform: mdctBuffers[".concat(this.fftSize,"] is required")),u=null!==(n=null==i?void 0:i.real)&&void 0!==n?n:t("IMDCT.transform: mdctBuffers[".concat(this.fftSize,"].real is required")),f=null!==(o=null==i?void 0:i.imag)&&void 0!==o?o:t("IMDCT.transform: mdctBuffers[".concat(this.fftSize,"].imag is required")),l=this.quarterSize,c=3*l;u.fill(0),f.fill(0);for(var s=0;s<this.fftSize;s++){var h=2*s,v=-e[h],y=-e[this.halfSize-1-h],d=this.sinCosTable[h],b=this.sinCosTable[h+1];u[s]=y*b+v*d,f[s]=y*d-v*b}J.fft(u,f);for(var p=new Float32Array(this.size),m=0;m<this.fftSize/2;m++){var w=2*m,g=this.sinCosTable[w],S=this.sinCosTable[w+1],k=u[m],A=f[m],M=k*g+A*S,F=k*S-A*g;p[c-1-w]=M,p[c+w]=M,p[l+w]=F,p[l-1-w]=-F}for(var B=this.fftSize/2;B<this.fftSize;B++){var O=2*(B-this.fftSize/2)+l,j=2*B,T=this.sinCosTable[j],P=this.sinCosTable[j+1],z=u[B],C=f[B],I=z*T+C*P,q=z*P-C*T;p[c-1-O]=I,p[O-l]=-I,p[l+O]=q,p[5*l-1-O]=q}return p}}])}(ae),fe=new ie(p,.5),le=new ie(m,.5),ce=new ie(w,1),se=new ue(p,8*p),he=new ue(m,8*m),ve=new ue(w,4*w);function ye(e,r,t){for(var n=e.length,o=new Float32Array(2*n),a=0;a<n;a++){var i=t[a],u=t[2*n-1-a],f=e[a],l=r[n-1-a];o[a]=f*u-l*i,o[2*n-1-a]=f*i+l*u}return o}function de(e,r,t){var n=e.length,o=new Int32Array(n);if(0===t||0===r)return o.fill(0,0,n),o;for(var a=H[r],i=(1<<t-D)-1,u=i/a,f=i,l=-i,c=0;c<n;c++){var s=e[c]*u,h=s+(s>=0?.5:-.5)|0;o[c]=h>f?f:h<l?l:h}return o}function be(e,r,t){if(0===t||0===r)return new Float32Array(e.length);for(var n=H[r],o=(1<<t-D)-1,a=new Float32Array(e.length),i=0;i<e.length;i++)a[i]=e[i]*n/o;return a}function pe(e,r,t){var n=t,o=function(e,r,t,n){for(var o=new Int32Array(c),a=new Int32Array(e),i=[],u=[],f=function(e,r,t){var n=o[e],a=H[n];if(0===a)return 0;var i=0|L[r],u=0|L[t];return a*((0===i?2:W[i])-W[u])},l=0;l<e;l++){var s=0|t[l];if(0!==s){var h=me(r[l].subarray(0,s));if(o[l]=h,0!==h){var v=0,y=1,d=L[y]-L[v]|0;if(!(d<=0)){var b=f(l,v,y);i.push(l),u.push(b/d)}}}}for(var p=(i.length>>1)-1;p>=0;p--)ge(i,u,p);for(;n>0&&i.length>0;){var m=i[0],w=0|a[m],g=w+1,S=0|t[m],k=(L[g]-L[w]|0)*S;if(k>n||k<=0)we(i,u);else if(n-=k,a[m]=g,g<U){var A=g+1,M=L[A]-L[g]|0;M>0?(u[0]=f(m,g,A)/M,ge(i,u,0)):we(i,u)}else we(i,u)}return{wordLengths:a,scaleFactorIndices:o}}(n,e,r,f-l-n*s);return{bfuCount:n,allocation:o.wordLengths,scaleFactorIndices:o.scaleFactorIndices}}function me(e){for(var r=0,t=0;t<e.length;t++){var n=Math.abs(e[t]);n>r&&(r=n)}if(0===r)return 0;var o=Math.ceil(3*(Math.log2(r)+21));return Math.max(0,Math.min(63,o))}function we(e,r){var t=e.length-1;e[0]=e[t],r[0]=r[t],e.pop(),r.pop(),e.length&&ge(e,r,0)}function ge(e,r,t){for(var n=e.length,o=t,a=e[o],i=r[o];;){var u=1+(o<<1),f=u+1,l=o,c=i;if(u<n&&r[u]>c&&(l=u,c=r[u]),f<n&&r[f]>c&&(l=f),l===o)break;e[o]=e[l],r[o]=r[l],o=l}e[o]=a,r[o]=i}function Se(e){return Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Se(e)}function ke(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Me(n.key),n)}}function Ae(e,r,t){return r&&ke(e.prototype,r),t&&ke(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Me(e){var r=function(e,r){if("object"!=Se(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=Se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==Se(r)?r:r+""}var Fe=Ae(function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.transformBuffers={64:new Float32Array(64),128:new Float32Array(128),256:new Float32Array(256),512:new Float32Array(512)},this.qmfWorkBuffers={delay:{128:new Float32Array(S+128),256:new Float32Array(S+256),512:new Float32Array(S+512)},highBandDelay:{128:new Float32Array(167),256:new Float32Array(295)}},this.qmfDelays={lowBand:new Float32Array(S),midBand:new Float32Array(S),highBand:new Float32Array(39)},this.transientDetection=[new Float32Array(64),new Float32Array(64),new Float32Array(128)],this.mdctBuffers={16:{real:new Float32Array(16),imag:new Float32Array(16)},64:{real:new Float32Array(64),imag:new Float32Array(64)},128:{real:new Float32Array(128),imag:new Float32Array(128)}},this.mdctOverlap=[new Float32Array(32),new Float32Array(32),new Float32Array(32)],this.imdctOverlap=[new Float32Array(256),new Float32Array(256),new Float32Array(512)],this.reversalBuffers={32:new Float32Array(32),128:new Float32Array(128),256:new Float32Array(256)}});function Be(e){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(e)}function Oe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function je(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Oe(Object(t),!0).forEach(function(r){Te(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Oe(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function Te(e,r,t){return(r=Ie(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Pe(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,a,i,u=[],f=!0,l=!1;try{if(a=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;f=!1}else for(;!(f=(n=a.call(t)).done)&&(u.push(n.value),u.length!==r);f=!0);}catch(e){l=!0,o=e}finally{try{if(!f&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(e,r)||function(e,r){if(e){if("string"==typeof e)return ze(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ze(e,r):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ze(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function Ce(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ie(n.key),n)}}function Ie(e){var r=function(e,r){if("object"!=Be(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=Be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==Be(r)?r:r+""}var qe=function(){return e=function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.values={transientThresholdLow:1,transientThresholdMid:1.5,transientThresholdHigh:2},this.metadata={transientThresholdLow:{default:this.values.transientThresholdLow,name:"Low Band Transient Threshold",description:"Controls the transient detection threshold for the low frequency band (0-5.5kHz). Lower values make detection more sensitive, triggering short blocks more easily. Higher values require stronger transients.",range:[.01,2],step:.01},transientThresholdMid:{default:this.values.transientThresholdMid,name:"Mid Band Transient Threshold",description:"Controls the transient detection threshold for the mid frequency band (5.5-11kHz). Lower values make detection more sensitive, triggering short blocks more easily. Higher values require stronger transients.",range:[.01,3],step:.01},transientThresholdHigh:{default:this.values.transientThresholdHigh,name:"High Band Transient Threshold",description:"Controls the transient detection threshold for the high frequency band (11-22kHz). Lower values make detection more sensitive, triggering short blocks more easily. Higher values require stronger transients.",range:[.01,4],step:.01}},r&&this.setOptions(r)},(r=[{key:"setOptions",value:function(e){for(var r=0,t=Object.entries(e);r<t.length;r++){var n=Pe(t[r],2),o=n[0],a=n[1];o in this.values&&this.setValue(o,a)}}},{key:"setValue",value:function(e,r){if(!(e in this.metadata))throw new Error("Unknown option: ".concat(e));var t=Pe(this.metadata[e].range,2),n=t[0],o=t[1];if(r<n||r>o)throw new Error("Value for ".concat(e," must be between ").concat(n," and ").concat(o,", got ").concat(r));this.values[e]=r}},{key:"getValue",value:function(e){if(!(e in this.values))throw new Error("Unknown option: ".concat(e));return this.values[e]}},{key:"transientThresholdLow",get:function(){return this.values.transientThresholdLow}},{key:"transientThresholdMid",get:function(){return this.values.transientThresholdMid}},{key:"transientThresholdHigh",get:function(){return this.values.transientThresholdHigh}},{key:"getMetadata",value:function(e){return this.metadata[e]}},{key:"getAllMetadata",value:function(){return je({},this.metadata)}},{key:"reset",value:function(){for(var e=0,r=Object.entries(this.metadata);e<r.length;e++){var t=Pe(r[e],2),n=t[0],o=t[1];this.values[n]=o.default}}},{key:"toObject",value:function(){return{values:je({},this.values),metadata:je({},this.metadata)}}}])&&Ce(e.prototype,r),t&&Ce(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,t}();function xe(e,r,t){if(!r)return!1;var n=function(e,r){var t=function(e,r){for(var t=0,n=0,o=0;o<e.length;o++){var a=Math.abs(e[o]),i=a-Math.abs(r[o]);i>0&&(t+=i),n+=a*a}var u=Math.sqrt(n)||1e-6;return t/u}(e,r),n=Ee(e),o=Ee(r),a=Math.abs(n-o),i=_e(e),u=_e(r),f=Math.abs(i-u),l=function(e,r){for(var t=0,n=0,o=0;o<e.length;o++)t+=e[o]*e[o],n+=r[o]*r[o];t=Math.max(t,1e-10),n=Math.max(n,1e-10);var a=10*Math.log10(t/n);return Math.max(0,a)}(e,r);return{spectralFlux:t,flatnessChange:a,hfChange:f,energyChange:l}}(e,r),o=function(e){var r=e.spectralFlux,t=e.flatnessChange,n=e.hfChange,o=e.energyChange,a=r,i=Math.sqrt(t),u=Math.log1p(10*n)/Math.log1p(10),f=Math.min(o/30,1);return(a+i+u+f)/4}(n);return o>t}function Ee(e){for(var r=0,t=0,n=0,o=0;o<e.length;o++){var a=Math.abs(e[o]);a>1e-10&&(r+=Math.log(a),t+=a,n++)}if(0===n)return 0;var i=Math.exp(r/n),u=t/n;return u>1e-10?i/u:0}function _e(e){for(var r=Math.floor(e.length/2),t=0,n=0,o=0;o<r;o++)t+=e[o]*e[o];for(var a=r;a<e.length;a++)n+=e[a]*e[a];var i=t+n;return i>0?n/i:0}function De(e){var r,n=null!==(r=null==e?void 0:e.bufferPool)&&void 0!==r?r:t("qmfAnalysisStage: bufferPool is required"),o=n.qmfDelays;return function(e){var r=N(e,o.lowBand,n.qmfWorkBuffers);o.lowBand=r.newDelay;var t=N(r.lowBand,o.midBand,n.qmfWorkBuffers);o.midBand=t.newDelay;var a=n.qmfWorkBuffers.highBandDelay[r.highBand.length];a.set(o.highBand),a.set(r.highBand,o.highBand.length);var i=a.slice(0,r.highBand.length);return o.highBand=a.slice(r.highBand.length),{bands:[t.lowBand,t.highBand,i]}}}function Ue(e){var r,n,o=null!==(r=null==e?void 0:e.bufferPool)&&void 0!==r?r:t("blockSelectorStage: bufferPool is required"),a=null!==(n=null==e?void 0:e.options)&&void 0!==n?n:t("blockSelectorStage: options is required");return function(e){var r=e.bands,t=[B,O,j],n=r.map(function(e,r){var n=function(e,r){var t=new Float32Array(r),n=new Float32Array(r),o=Math.min(e.length,r);t.set(e.subarray(0,o)),J.fft(t,n);for(var a=new Float32Array(r/2),i=0;i<r/2;i++)a[i]=Math.sqrt(t[i]*t[i]+n[i]*n[i]);return a}(e,t[r]),i=xe(n,o.transientDetection[r],a.transientThresholdLow);return o.transientDetection[r]=n,i*Math.max(r+1,2)});return{bands:r,blockModes:n}}}function Le(e){var r,n=null!==(r=null==e?void 0:e.bufferPool)&&void 0!==r?r:t("mdctStage: bufferPool is required"),a=n.mdctOverlap,i=[le,le,ce];function u(e,r,t,n,a){var u=T[r];return 0===t?function(e,r,t,n,a,i){var u=2===r?w:m,l=i.transformBuffers[u];l.fill(0),l.set(a,t.windowStart),f(e,a,t.size),l.set(e,t.windowStart+z);var c=n.transform(l,i.mdctBuffers);return r>0&&(c=o(c,i.reversalBuffers)),c}(e,r,u,i[r],n,a):function(e,r,t,n,a){for(var i=1<<(256===t.size?3:2),u=new Float32Array(t.size),l=0;l<i;l++){var c=l*P,s=e.subarray(c,c+P),h=a.transformBuffers[p];h.fill(0),h.set(n,0),f(s,n,P),h.set(s,z);var v=fe.transform(h,a.mdctBuffers);r>0&&(v=o(v,a.reversalBuffers)),u.set(v,c)}return u}(e,r,u,n,a)}function f(e,r,t){for(var n=t-z,o=0;o<z;o++){var a=e[n+o];r[o]=g[o]*a,e[n+o]=a*g[31-o]}}return function(e){var r=e.bands,t=e.blockModes,o=e.originalFrame,i=new Float32Array(512);return r.forEach(function(e,r){var o=u(e,r,t[r],a[r],n),f=function(e){return 0===e?0:1===e?128:256}(r);i.set(o,f)}),{bands:r,coefficients:i,blockModes:t,originalFrame:o}}}function He(){return function(e){for(var r=e.coefficients,t=e.blockModes,n=function(e,r){for(var t=[],n=[],o=0,a=0,i=0;i<3;i++){for(var u=o,f=2===i?256:128,l=i<2?y[i]:h.length,c=0===r[i]?d:b;a<l;){var s=h[a],v=c[a]-u,p=v+s,m=new Float32Array(s);if(v>=0&&p<=f)m.set(e.subarray(u+v,u+p));else if(m.fill(0),v<f&&p>0){var w=Math.max(0,v),g=Math.min(f,p);m.set(e.subarray(u+w,u+g),Math.max(0,-v))}t.push(m),n.push(s),a++}o+=f}return{bfuData:t,bfuSizes:n,bfuCount:a}}(r,t),o=n.bfuData,a=n.bfuSizes,i=pe(o,a,n.bfuCount),u=i.bfuCount,f=i.allocation,l=i.scaleFactorIndices,c=[],s=0;s<u;s++){var v=o[s].subarray(0,a[s]),p=f[s],m=L[p],w=de(v,l[s],m);c.push(w)}return{nBfu:u,scaleFactorIndices:l,wordLengthIndices:f.slice(0,u),quantizedCoefficients:c,blockModes:t}}}function We(){return n({options:arguments.length>0&&void 0!==arguments[0]?arguments[0]:new qe,bufferPool:arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe},De,Ue,Le,He)}function Ne(){return function(e){for(var r=new Float32Array(512),t=e.nBfu,n=e.scaleFactorIndices,o=e.wordLengthIndices,a=e.quantizedCoefficients,i=e.blockModes,u=0;u<t;u++){var f=L[o[u]],l=0;u>=y[0]&&(l=1),u>=y[1]&&(l=2);var c=0===i[l]?d[u]:b[u];if(f>0){var s=be(a[u],n[u],f);r.set(s,c)}}return{coefficients:r,blockModes:i}}}function Ve(e){var r,n=null!==(r=null==e?void 0:e.bufferPool)&&void 0!==r?r:t("imdctStage: bufferPool is required"),a=n.imdctOverlap,i=[he,he,ve];function u(e,r,t,n,a,u){return 0===t?function(e,r,t,n,a,i){var u=e;r>0&&(u=o(e,n.reversalBuffers));var f=i.transform(u,n.mdctBuffers),l=f.length/4,c=n.transformBuffers[w];c.fill(0);for(var s=0;s<a.size;s++)c[s]=f[l+s];var h=t.slice(2*a.size-C,2*a.size),v=ye(h.slice(0,C),c.slice(0,C),g);t.set(v,0);for(var y=0;y<C;y++)h[y]=c[C+y];for(var d=2===r?240:112,b=0;b<d;b++)t[32+b]=c[C+b];for(var p=0;p<C;p++)t[2*a.size-C+p]=c[a.size-C+p];return t.slice(0,a.size)}(e,r,n,a,u,i[r]):function(e,r,t,n,a){var i=1<<(256===a.size?3:2),u=n.transformBuffers[w];u.fill(0);for(var f=t.slice(2*a.size-C,2*a.size),l=0,c=0,s=0;s<i;s++){var h=e.slice(c,c+P);r>0&&(h=o(h,n.reversalBuffers));for(var v=se.transform(h,n.mdctBuffers),y=v.length/4,d=0;d<P;d++)u[l+d]=v[y+d];var b=ye(f.slice(0,C),u.slice(l,l+C),g);t.set(b,l);for(var p=0;p<C;p++)f[p]=u[l+C+p];l+=P,c+=P}for(var m=0;m<C;m++)t[2*a.size-C+m]=u[a.size-C+m];return t.slice(0,a.size)}(e,r,n,a,u)}return function(e){var r=e.coefficients,t=e.blockModes;return T.map(function(e,o){var i=function(e,r){var t=[0,128,256,512];return e.subarray(t[r],t[r+1])}(r,o);return u(i,o,t[o],a[o],n,e)})}}function Ge(e){var r,n=null!==(r=null==e?void 0:e.bufferPool)&&void 0!==r?r:t("qmfSynthesisStage: bufferPool is required"),o=n.qmfDelays;return function(e){var r=n.qmfWorkBuffers.highBandDelay[e[2].length];r.set(o.highBand),r.set(e[2],o.highBand.length);var t=r.slice(0,2*e[0].length);o.highBand=r.slice(2*e[0].length);var a=V(e[0],e[1],o.midBand,n.qmfWorkBuffers);o.midBand=a.newDelay;var i=V(a.output,t,o.lowBand,n.qmfWorkBuffers);return o.lowBand=i.newDelay,i.output}}function Re(){return n({bufferPool:arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Fe},Ne,Ve,Ge)}function $e(e,r,t,n){if(0!==n){var o=Math.floor(r/8),a=r%8;t&=(1<<n)-1;for(var i=0;i<n&&o<e.length;){var u=8-a,f=Math.min(n-i,u),l=t>>n-i-f&(1<<f)-1,c=(1<<f)-1<<u-f;e[o]=e[o]&~c|l<<u-f,i+=f,o++,a=0}}}function Je(e,r,t){if(0===t)return 0;for(var n=Math.floor(r/8),o=r%8,a=0,i=0;i<t&&n<e.length;){var u=8-o,f=Math.min(t-i,u),l=(1<<f)-1;a=a<<f|e[n]>>u-f&l,i+=f,n++,o=0}return a}function Ke(e,r,t){var n=Je(e,r,t);return n>=1<<t-1?n-(1<<t):n}function Qe(e){return Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qe(e)}function Xe(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ye(n.key),n)}}function Ye(e){var r=function(e,r){if("object"!=Qe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=Qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==Qe(r)?r:r+""}function Ze(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return er(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?er(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){u=!0,a=e},f:function(){try{i||null==t.return||t.return()}finally{if(u)throw a}}}}function er(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function rr(e){var r=new Uint8Array(u),t=new DataView(r.buffer),n=v.indexOf(e.nBfu),o=2-e.blockModes[0]<<14|2-e.blockModes[1]<<12|3-e.blockModes[2]<<10|n<<5;t.setUint16(0,o,!1);for(var a=x,i=0;i<e.nBfu;i++)$e(r,a,e.wordLengthIndices[i],E),a+=E;for(var f=0;f<e.nBfu;f++)$e(r,a,e.scaleFactorIndices[f],_),a+=_;for(var l=0;l<e.nBfu;l++){var c=L[e.wordLengthIndices[l]];if(c>0){var s,h=Ze(e.quantizedCoefficients[l]);try{for(h.s();!(s=h.n()).done;){var y=s.value;$e(r,a,y<0?y+(1<<c):y,c),a+=c}}catch(e){h.e(e)}finally{h.f()}}}return r[u-3]=0,r[u-2]=0,r[u-1]=0,r}function tr(e){if(e.length!==u)throw new Error("Frame must be ".concat(u," bytes"));for(var r=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0,!1),t=[2-(r>>14&3),2-(r>>12&3),3-(r>>10&3)],n=v[r>>5&7],o=x,a=new Int32Array(n),i=0;i<n;i++)a[i]=Je(e,o,E),o+=E;for(var f=new Int32Array(n),l=0;l<n;l++)f[l]=Je(e,o,_),o+=_;for(var c=[],s=0;s<n;s++){var y=L[a[s]],d=h[s],b=new Int32Array(d);if(y>0)for(var p=0;p<d;p++)b[p]=Ke(e,o,y),o+=y;c.push(b)}return{nBfu:n,scaleFactorIndices:f,wordLengthIndices:a,quantizedCoefficients:c,blockModes:t}}var nr=function(){return e=function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"createHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=new Uint8Array(i),o=new DataView(n.buffer);n.set(a,0);var u=(new TextEncoder).encode(e);return n.set(u.subarray(0,Math.min(u.length,255)),4),o.setUint32(260,r,!0),n[264]=t,n}},{key:"parseHeader",value:function(e){if(e.length!==i)throw new Error("Header must be ".concat(i," bytes"));for(var r=0;r<a.length;r++)if(e[r]!==a[r])throw new Error("Invalid AEA file");var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=e.indexOf(0,4),o=-1===n?256:n-4;return{title:(new TextDecoder).decode(e.subarray(4,4+o)),frameCount:t.getUint32(260,!0),channelCount:e[264]}}}],(r=null)&&Xe(e.prototype,r),t&&Xe(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,t}();function or(e){return or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},or(e)}function ar(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=lr(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){u=!0,a=e},f:function(){try{i||null==t.return||t.return()}finally{if(u)throw a}}}}function ir(e,r,t,n,o,a,i){try{var u=e[a](i),f=u.value}catch(e){return void t(e)}u.done?r(f):Promise.resolve(f).then(n,o)}function ur(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var a=e.apply(r,t);function i(e){ir(a,n,o,i,u,"next",e)}function u(e){ir(a,n,o,i,u,"throw",e)}i(void 0)})}}function fr(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,a,i,u=[],f=!0,l=!1;try{if(a=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;f=!1}else for(;!(f=(n=a.call(t)).done)&&(u.push(n.value),u.length!==r);f=!0);}catch(e){l=!0,o=e}finally{try{if(!f&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(e,r)||lr(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lr(e,r){if(e){if("string"==typeof e)return cr(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?cr(e,r):void 0}}function cr(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function sr(e){if(null!=e){var r=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],t=0;if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}}throw new TypeError(or(e)+" is not iterable")}function hr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function a(t,n,o,a){var f=n&&n.prototype instanceof u?n:u,l=Object.create(f.prototype);return vr(l,"_invoke",function(t,n,o){var a,u,f,l=0,c=o||[],s=!1,h={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function(r,t){return a=r,u=0,f=e,h.n=t,i}};function v(t,n){for(u=t,f=n,r=0;!s&&l&&!o&&r<c.length;r++){var o,a=c[r],v=h.p,y=a[2];t>3?(o=y===n)&&(f=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=e):a[0]<=v&&((o=t<2&&v<a[1])?(u=0,h.v=n,h.n=a[1]):v<y&&(o=t<3||a[0]>n||n>y)&&(a[4]=t,a[5]=n,h.n=y,u=0))}if(o||t>1)return i;throw s=!0,n}return function(o,c,y){if(l>1)throw TypeError("Generator is already running");for(s&&1===c&&v(c,y),u=c,f=y;(r=u<2?e:f)||!s;){a||(u?u<3?(u>1&&(h.n=-1),v(u,f)):h.n=f:h.v=f);try{if(l=2,a){if(u||(o="next"),r=a[o]){if(!(r=r.call(a,f)))throw TypeError("iterator result is not an object");if(!r.done)return r;f=r.value,u<2&&(u=0)}else 1===u&&(r=a.return)&&r.call(a),u<2&&(f=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=e}else if((r=(s=h.n<0)?f:t.call(n,h))!==i)break}catch(r){a=e,u=1,f=r}finally{l=1}}return{value:r,done:s}}}(t,o,a),!0),l}var i={};function u(){}function f(){}function l(){}r=Object.getPrototypeOf;var c=[][n]?r(r([][n]())):(vr(r={},n,function(){return this}),r),s=l.prototype=u.prototype=Object.create(c);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,vr(e,o,"GeneratorFunction")),e.prototype=Object.create(s),e}return f.prototype=l,vr(s,"constructor",l),vr(l,"constructor",f),f.displayName="GeneratorFunction",vr(l,o,"GeneratorFunction"),vr(s),vr(s,o,"Generator"),vr(s,n,function(){return this}),vr(s,"toString",function(){return"[object Generator]"}),(hr=function(){return{w:a,m:h}})()}function vr(e,r,t,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}vr=function(e,r,t,n){if(r)o?o(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t;else{var a=function(r,t){vr(e,r,function(e){return this._invoke(r,t,e)})};a("next",0),a("throw",1),a("return",2)}},vr(e,r,t,n)}function yr(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,dr(n.key),n)}}function dr(e){var r=function(e,r){if("object"!=or(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=or(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==or(r)?r:r+""}function br(e){return function(){return new pr(e.apply(this,arguments))}}function pr(e){var r,t;function n(r,t){try{var a=e[r](t),i=a.value,u=i instanceof gr;Promise.resolve(u?i.v:i).then(function(t){if(u){var f="return"===r?"return":"next";if(!i.k||t.done)return n(f,t);t=e[f](t).value}o(a.done?"return":"normal",t)},function(e){n("throw",e)})}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":r.resolve({value:o,done:!0});break;case"throw":r.reject(o);break;default:r.resolve({value:o,done:!1})}(r=r.next)?n(r.key,r.arg):t=null}this._invoke=function(e,o){return new Promise(function(a,i){var u={key:e,arg:o,resolve:a,reject:i,next:null};t?t=t.next=u:(r=t=u,n(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function mr(e){return new gr(e,0)}function wr(e){var r={},t=!1;function n(r,n){return t=!0,n=new Promise(function(t){t(e[r](n))}),{done:!1,value:new gr(n,1)}}return r["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},r.next=function(e){return t?(t=!1,e):n("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(t)throw t=!1,e;return n("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return t?(t=!1,e):n("return",e)}),r}function gr(e,r){this.v=e,this.k=r}function Sr(e){var r,t,n,o=2;for("undefined"!=typeof Symbol&&(t=Symbol.asyncIterator,n=Symbol.iterator);o--;){if(t&&null!=(r=e[t]))return r.call(e);if(n&&null!=(r=e[n]))return new kr(r.call(e));t="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function kr(e){function r(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return kr=function(e){this.s=e,this.n=e.next},kr.prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new kr(e)}pr.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},pr.prototype.next=function(e){return this._invoke("next",e)},pr.prototype.throw=function(e){return this._invoke("throw",e)},pr.prototype.return=function(e){return this._invoke("return",e)};var Ar=function(){function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e)}return r=e,t=null,n=[{key:"encodeStream",value:function(r){return br(function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return hr().m(function n(){var o,a,i,u;return hr().w(function(n){for(;;)switch(n.n){case 0:if(o=t.channelCount,a=void 0===o?1:o,i=t.onProgress,u=t.encoderOptions,1!==a){n.n=2;break}return n.d(sr(wr(Sr(e._encodeMonoStream(r,i,u)))),1);case 1:case 3:n.n=5;break;case 2:if(2!==a){n.n=4;break}return n.d(sr(wr(Sr(e._encodeStereoStream(r,i,u)))),3);case 4:throw new Error("Unsupported channel count: ".concat(a));case 5:return n.a(2)}},n)})()}).apply(this,arguments)}},{key:"_encodeMonoStream",value:function(e,r,t){return br(hr().m(function n(){var o,a,i,u,f,l,c,s,h,v,y;return hr().w(function(n){for(;;)switch(n.n){case 0:o=t||new qe,a=We(o),i=0,u=!1,f=!1,n.p=1,c=Sr(e);case 2:return n.n=3,mr(c.next());case 3:if(!(u=!(s=n.v).done)){n.n=6;break}return h=s.value,v=a(h),n.n=4,v;case 4:r&&r(i++);case 5:u=!1,n.n=2;break;case 6:n.n=8;break;case 7:n.p=7,y=n.v,f=!0,l=y;case 8:if(n.p=8,n.p=9,!u||null==c.return){n.n=10;break}return n.n=10,mr(c.return());case 10:if(n.p=10,!f){n.n=11;break}throw l;case 11:return n.f(10);case 12:return n.f(8);case 13:return n.a(2)}},n,null,[[9,,10,12],[1,7,8,13]])}))()}},{key:"_encodeStereoStream",value:function(e,r,t){return br(hr().m(function n(){var o,a,i,u,f,l,c,s,h,v,y,d,b,p,m;return hr().w(function(n){for(;;)switch(n.n){case 0:o=t||new qe,a=We(o),i=We(o),u=0,f=!1,l=!1,n.p=1,s=Sr(e);case 2:return n.n=3,mr(s.next());case 3:if(!(f=!(h=n.v).done)){n.n=7;break}return v=fr(h.value,2),y=v[0],d=v[1],b=a(y),p=i(d),n.n=4,b;case 4:return n.n=5,p;case 5:r&&r(u++);case 6:f=!1,n.n=2;break;case 7:n.n=9;break;case 8:n.p=8,m=n.v,l=!0,c=m;case 9:if(n.p=9,n.p=10,!f||null==s.return){n.n=11;break}return n.n=11,mr(s.return());case 11:if(n.p=11,!l){n.n=12;break}throw c;case 12:return n.f(11);case 13:return n.f(9);case 14:return n.a(2)}},n,null,[[10,,11,13],[1,8,9,14]])}))()}},{key:"decodeStream",value:function(r){return br(function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return hr().m(function n(){var o,a,i;return hr().w(function(n){for(;;)switch(n.n){case 0:if(o=t.channelCount,a=void 0===o?1:o,i=t.onProgress,1!==a){n.n=2;break}return n.d(sr(wr(Sr(e._decodeMonoStream(r,i)))),1);case 1:case 3:n.n=5;break;case 2:if(2!==a){n.n=4;break}return n.d(sr(wr(Sr(e._decodeStereoStream(r,i)))),3);case 4:throw new Error("Unsupported channel count: ".concat(a));case 5:return n.a(2)}},n)})()}).apply(this,arguments)}},{key:"_decodeMonoStream",value:function(e,r){return br(hr().m(function t(){var n,o,a;return hr().w(function(t){for(;;)switch(t.n){case 0:return n=Re(),o=0,a=function(){var t=br(hr().m(function t(){var a,i,u,f,l,c,s,h;return hr().w(function(t){for(;;)switch(t.n){case 0:a=!1,i=!1,t.p=1,f=Sr(e);case 2:return t.n=3,mr(f.next());case 3:if(!(a=!(l=t.v).done)){t.n=6;break}return c=l.value,s=n(c),t.n=4,s;case 4:r&&r(o++);case 5:a=!1,t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,h=t.v,i=!0,u=h;case 8:if(t.p=8,t.p=9,!a||null==f.return){t.n=10;break}return t.n=10,mr(f.return());case 10:if(t.p=10,!i){t.n=11;break}throw u;case 11:return t.f(10);case 12:return t.f(8);case 13:return t.a(2)}},t,null,[[9,,10,12],[1,7,8,13]])}));return function(){return t.apply(this,arguments)}}(),t.d(sr(wr(Sr(a()))),1);case 1:return t.a(2)}},t)}))()}},{key:"_decodeStereoStream",value:function(r,t){return br(hr().m(function n(){var o,a,i,u;return hr().w(function(n){for(;;)switch(n.n){case 0:return o=Re(),a=Re(),i=0,u=function(){var n=br(hr().m(function n(){var u,f,l,c,s,h,v,y,d,b,p,m,w,g,S;return hr().w(function(n){for(;;)switch(n.n){case 0:u=null,f=!0,l=!1,c=!1,n.p=1,h=Sr(r);case 2:return n.n=3,mr(h.next());case 3:if(!(l=!(v=n.v).done)){n.n=8;break}if(y=v.value,!f){n.n=4;break}u=y,n.n=6;break;case 4:return d=y,b=o(u),p=a(d),n.n=5,[b,p];case 5:t&&t(i++);case 6:f=!f;case 7:l=!1,n.n=2;break;case 8:n.n=10;break;case 9:n.p=9,S=n.v,c=!0,s=S;case 10:if(n.p=10,n.p=11,!l||null==h.return){n.n=12;break}return n.n=12,mr(h.return());case 12:if(n.p=12,!c){n.n=13;break}throw s;case 13:return n.f(12);case 14:return n.f(10);case 15:if(f||!u){n.n=17;break}return m=e._createDummyFrame(),w=o(u),g=a(m),n.n=16,[w,g];case 16:t&&t(i++);case 17:return n.a(2)}},n,null,[[11,,12,14],[1,9,10,15]])}));return function(){return n.apply(this,arguments)}}(),n.d(sr(wr(Sr(u()))),1);case 1:return n.a(2)}},n)}))()}},{key:"frameBufferToFrames",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:512;return hr().m(function t(){var n,o,a,i,u,f,l,c,s,h,v,y,d,b,p,m;return hr().w(function(t){for(;;)switch(t.n){case 0:if(1!==(n=e.length)){t.n=4;break}o=fr(e,1),a=o[0],i=0;case 1:if(!(i<a.length)){t.n=3;break}for(u=new Float32Array(r),f=Math.min(i+r,a.length),l=0;l<f-i;l++)u[l]=a[i+l];return t.n=2,u;case 2:i+=r,t.n=1;break;case 3:t.n=9;break;case 4:if(2!==n){t.n=8;break}c=fr(e,2),s=c[0],h=c[1],v=Math.max(s.length,h.length),y=0;case 5:if(!(y<v)){t.n=7;break}for(d=new Float32Array(r),b=new Float32Array(r),p=Math.min(y+r,v),m=0;m<p-y;m++)d[m]=y+m<s.length?s[y+m]:0,b[m]=y+m<h.length?h[y+m]:0;return t.n=6,[d,b];case 6:y+=r,t.n=5;break;case 7:t.n=9;break;case 8:throw new Error("Unsupported channel count: ".concat(n));case 9:return t.a(2)}},t)})()}},{key:"collectFrames",value:(f=ur(hr().m(function e(r){var t,n,o,a,i,u,f,l;return hr().w(function(e){for(;;)switch(e.n){case 0:t=[],n=!1,o=!1,e.p=1,i=Sr(r);case 2:return e.n=3,i.next();case 3:if(!(n=!(u=e.v).done)){e.n=5;break}f=u.value,t.push(f);case 4:n=!1,e.n=2;break;case 5:e.n=7;break;case 6:e.p=6,l=e.v,o=!0,a=l;case 7:if(e.p=7,e.p=8,!n||null==i.return){e.n=9;break}return e.n=9,i.return();case 9:if(e.p=9,!o){e.n=10;break}throw a;case 10:return e.f(9);case 11:return e.f(7);case 12:return e.a(2,t)}},e,null,[[8,,9,11],[1,6,7,12]])})),function(e){return f.apply(this,arguments)})},{key:"_createDummyFrame",value:function(){return{nBfu:0,blockModes:[0,0,0],scaleFactorIndices:new Int32Array(0),wordLengthIndices:new Int32Array(0),quantizedCoefficients:[]}}},{key:"createAeaBlob",value:(a=ur(hr().m(function e(r){var t,n,o,a,i,u,f,l,c,s,h,v,y,d,b,p,m,w,g,S,k=arguments;return hr().w(function(e){for(;;)switch(e.n){case 0:n=(t=k.length>1&&void 0!==k[1]?k[1]:{}).title,o=void 0===n?"encoded by atrac1.js":n,a=t.channelCount,i=void 0===a?1:a,u=[],f=!1,l=!1,e.p=1,s=Sr(r);case 2:return e.n=3,s.next();case 3:if(!(f=!(h=e.v).done)){e.n=5;break}v=h.value,u.push(rr(v));case 4:f=!1,e.n=2;break;case 5:e.n=7;break;case 6:e.p=6,S=e.v,l=!0,c=S;case 7:if(e.p=7,e.p=8,!f||null==s.return){e.n=9;break}return e.n=9,s.return();case 9:if(e.p=9,!l){e.n=10;break}throw c;case 10:return e.f(9);case 11:return e.f(7);case 12:for(y=nr.createHeader(o,u.length,i),d=y.length+u.reduce(function(e,r){return e+r.length},0),(b=new Uint8Array(d)).set(y,0),p=y.length,m=0,w=u;m<w.length;m++)g=w[m],b.set(g,p),p+=g.length;return e.a(2,new Blob([b],{type:"application/octet-stream"}))}},e,null,[[8,,9,11],[1,6,7,12]])})),function(e){return a.apply(this,arguments)})},{key:"createWavBlob",value:function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:44100,o=Array.isArray(r)?r:[r];if(1===t)return e._createMonoWavBlob(o,n);if(2===t)return e._createStereoWavBlob(o,n);throw new Error("Unsupported channel count: ".concat(t))}},{key:"_createMonoWavBlob",value:function(r,t){var n=r.reduce(function(e,r){return e+r.length},0),o=new ArrayBuffer(44+2*n),a=new DataView(o);e._writeWavHeader(a,n,1,t);var i,u=44,f=ar(r);try{for(f.s();!(i=f.n()).done;)for(var l=i.value,c=0;c<l.length;c++){var s=Math.max(-1,Math.min(1,l[c]));a.setInt16(u,s<0?s*q:s*I,!0),u+=2}}catch(e){f.e(e)}finally{f.f()}return new Blob([o],{type:"audio/wav"})}},{key:"_createStereoWavBlob",value:function(r,t){var n=r.reduce(function(e,r){var t=fr(r,2),n=t[0],o=t[1];return e+Math.max(n.length,o.length)},0),o=new ArrayBuffer(44+2*n*2),a=new DataView(o);e._writeWavHeader(a,n,2,t);var i,u=44,f=ar(r);try{for(f.s();!(i=f.n()).done;)for(var l=fr(i.value,2),c=l[0],s=l[1],h=Math.max(c.length,s.length),v=0;v<h;v++){var y=v<c.length?c[v]:0,d=v<s.length?s[v]:0,b=Math.max(-1,Math.min(1,y)),p=Math.max(-1,Math.min(1,d));a.setInt16(u,b<0?b*q:b*I,!0),u+=2,a.setInt16(u,p<0?p*q:p*I,!0),u+=2}}catch(e){f.e(e)}finally{f.f()}return new Blob([o],{type:"audio/wav"})}},{key:"_writeWavHeader",value:function(e,r,t,n){var o=n*t*2,a=2*t,i=r*a,u=36+i,f=0,l=function(r,t){for(var n=0;n<t.length;n++)e.setUint8(r+n,t.charCodeAt(n))};l(f,"RIFF"),f+=4,e.setUint32(f,u,!0),l(f+=4,"WAVE"),l(f+=4,"fmt "),f+=4,e.setUint32(f,16,!0),f+=4,e.setUint16(f,1,!0),f+=2,e.setUint16(f,t,!0),f+=2,e.setUint32(f,n,!0),f+=4,e.setUint32(f,o,!0),f+=4,e.setUint16(f,a,!0),f+=2,e.setUint16(f,16,!0),l(f+=2,"data"),f+=4,e.setUint32(f,i,!0)}},{key:"parseAeaBlob",value:(o=ur(hr().m(function e(r){var t,n,o,a,f,l;return hr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,r.arrayBuffer();case 1:for(t=e.v,n=new Uint8Array(t.slice(0,i)),o=nr.parseHeader(n),a=[],f=i;f<t.byteLength;f+=u)(l=new Uint8Array(t.slice(f,f+u))).length===u&&a.push(l);return e.a(2,{info:o,frameData:a})}},e)})),function(e){return o.apply(this,arguments)})},{key:"deserializedFrameStream",value:hr().m(function e(r){var t,n,o,a;return hr().w(function(e){for(;;)switch(e.n){case 0:t=ar(r),e.p=1,t.s();case 2:if((n=t.n()).done){e.n=4;break}return o=n.value,e.n=3,tr(o);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,a=e.v,t.e(a);case 6:return e.p=6,t.f(),e.f(6);case 7:return e.a(2)}},e,null,[[1,5,6,7]])})},{key:"assemblePcmFrames",value:function(e,r){if(1===r){var t,n=e.reduce(function(e,r){return e+r.length},0),o=new Float32Array(n),a=0,i=ar(e);try{for(i.s();!(t=i.n()).done;){var u=t.value;o.set(u,a),a+=u.length}}catch(e){i.e(e)}finally{i.f()}return o}if(2===r){var f,l=e.reduce(function(e,r){var t=fr(r,2),n=t[0],o=t[1];return e+Math.max(n.length,o.length)},0),c=new Float32Array(2*l),s=0,h=ar(e);try{for(h.s();!(f=h.n()).done;)for(var v=fr(f.value,2),y=v[0],d=v[1],b=Math.max(y.length,d.length),p=0;p<b;p++)c[2*s]=p<y.length?y[p]:0,c[2*s+1]=p<d.length?d[p]:0,s++}catch(e){h.e(e)}finally{h.f()}return c}throw new Error("Unsupported channel count: ".concat(r))}}],t&&yr(r.prototype,t),n&&yr(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,t,n,o,a,f}();return r})(),"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Carta1=r():e.Carta1=r();
2
2
  //# sourceMappingURL=carta1.min.js.map