-
Notifications
You must be signed in to change notification settings - Fork 14
/
recorder.mp3.min.js
6 lines (6 loc) · 162 KB
/
recorder.mp3.min.js
1
2
3
4
5
6
/*
录音
https://github.com/xiangyuecn/Recorder
src: recorder-core.js,engine/mp3.js,engine/mp3-engine.js
*/
!function(k){"use strict";var S=function(){},O=function(e){return new t(e)};O.LM="2023-07-01 20:46";var x="Recorder",M="getUserMedia",V="srcSampleRate",N="sampleRate",y="catch";O.IsOpen=function(){var e=O.Stream;if(e){var t=e.getTracks&&e.getTracks()||e.audioTracks||[],a=t[0];if(a){var s=a.readyState;return"live"==s||s==a.LIVE}}return!1},O.BufferSize=4096,O.Destroy=function(){for(var e in C(x+" Destroy"),A(),a)a[e]()};var a={};O.BindDestroy=function(e,t){a[e]=t},O.Support=function(){var e=navigator.mediaDevices||{};return e[M]||(e=navigator)[M]||(e[M]=e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia),!!e[M]&&(O.Scope=e,!!O.GetContext())},O.GetContext=function(e){var t=k.AudioContext;if(t||(t=k.webkitAudioContext),!t)return null;var a=O.Ctx;if(a&&"closed"!=a.state||(a=O.Ctx=new t,O.NewCtxs=O.NewCtxs||[],O.BindDestroy("Ctx",function(){var e=O.Ctx;e&&e.close&&(e.close(),O.Ctx=0);var t=O.NewCtxs;O.NewCtxs=[];for(var a=0;a<t.length;a++)t[a].close()})),e&&a.close)try{a=new t,O.NewCtxs.push(a)}catch(e){C("GetContext tryNew异常",1,e)}return a},O.CloseNewCtx=function(e){if(e&&e!=O.Ctx){e.close&&e.close();for(var t=O.NewCtxs||[],a=t.length,s=0;s<t.length;s++)if(t[s]==e){t.splice(s,1);break}C("剩"+a+"-1="+t.length+"个GetContext未close",t.length?3:0)}};var w=function(e){var t=e.state,a="ctx.state="+t;return"suspended"==t&&(a+="(注意:ctx不是running状态,rec.open和start至少要有一个在用户操作(触摸、点击等)时进行调用,否则将在rec.start时尝试进行ctx.resume,可能会产生兼容性问题(仅iOS),请参阅文档中runningContext配置)"),a},T="ConnectEnableWebM";O[T]=!0;var E="ConnectEnableWorklet";O[E]=!1;var R=function(e,_){var l=e.BufferSize||O.BufferSize,f=e.Stream,c=f._RC||f._c||O.GetContext(!0);f._c=c;var h,a,u,i=function(e){var t=f._m=c.createMediaStreamSource(f),a=c.destination,s="createMediaStreamDestination";c[s]&&(a=f._d=c[s]()),t.connect(e),e.connect(a)},m="",p=f._call,b=function(e){for(var t in p){for(var a=e.length,s=new Int16Array(a),n=0,r=0;r<a;r++){var i=Math.max(-1,Math.min(1,e[r]));i=i<0?32768*i:32767*i,s[r]=i,n+=Math.abs(i)}for(var o in p)p[o](s,n);return}},v="ScriptProcessor",d="audioWorklet",o=x+" "+d,g="RecProc",S="MediaRecorder",M=S+".WebM.PCM",w=c.createScriptProcessor||c.createJavaScriptNode,R="。由于"+d+"内部1秒375次回调,在移动端可能会有性能问题导致回调丢失录音变短,PC端无影响,暂不建议开启"+d+"。",A=function(){a=f.isWorklet=!1,s(f),C("Connect采用老的"+v+","+(O[E]?"但已":"可")+"设置"+x+"."+E+"=true尝试启用"+d+m+R,3);var e=f._p=w.call(c,l,1,1);i(e),e.onaudioprocess=function(e){var t=e.inputBuffer.getChannelData(0);b(t)}},B=function(){h=f.isWebM=!1,P(f),a=f.isWorklet=!w||O[E];var t=k.AudioWorkletNode;if(a&&c[d]&&t){var s=function(){return a&&f._na},n=f._na=function(){""!==u&&(clearTimeout(u),u=setTimeout(function(){u=0,s()&&(C(d+"未返回任何音频,恢复使用"+v,3),w&&A())},500))},r=function(){if(s()){var e=f._n=new t(c,g,{processorOptions:{bufferSize:l}});i(e),e.port.onmessage=function(e){u&&(clearTimeout(u),u=""),s()?b(e.data.val):a||C(d+"多余回调",3)},C("Connect采用"+d+",设置"+x+"."+E+"=false可恢复老式"+v+m+R,3)}};c.resume()[p&&"finally"](function(){if(s())if(c[g])r();else{var e,t,a=(t="class "+g+" extends AudioWorkletProcessor{",t+="constructor "+(e=function(e){return e.toString().replace(/^function|DEL_/g,"").replace(/\$RA/g,o)})(function(e){DEL_super(e);var t=this,a=e.processorOptions.bufferSize;t.bufferSize=a,t.buffer=new Float32Array(2*a),t.pos=0,t.port.onmessage=function(e){e.data.kill&&(t.kill=!0,$C.log("$RA kill call"))},$C.log("$RA .ctor call",e)}),t+="process "+e(function(e,t,a){var s=this,n=s.bufferSize,r=s.buffer,i=s.pos;if((e=(e[0]||[])[0]||[]).length){r.set(e,i);var o=~~((i+=e.length)/n)*n;if(o){this.port.postMessage({val:r.slice(0,o)});var _=r.subarray(o,i);(r=new Float32Array(2*n)).set(_),i=_.length,s.buffer=r}s.pos=i}return!s.kill}),t=(t+='}try{registerProcessor("'+g+'", '+g+')}catch(e){$C.error("'+o+'注册失败",e)}').replace(/\$C\./g,"console."),"data:text/javascript;base64,"+btoa(unescape(encodeURIComponent(t))));c[d].addModule(a).then(function(e){s()&&(c[g]=1,r(),u&&n())})[y](function(e){C(d+".addModule失败",1,e),s()&&A()})}})}else A()};!function(){var e=k[S],t="ondataavailable",a="audio/webm; codecs=pcm";h=f.isWebM=O[T];var s=e&&t in e.prototype&&e.isTypeSupported(a);if(m=s?"":"(此浏览器不支持"+M+")",!_||!h||!s)return B();var n=function(){return h&&f._ra},r=(f._ra=function(){""!==u&&(clearTimeout(u),u=setTimeout(function(){n()&&(C(S+"未返回任何音频,降级使用"+d,3),B())},500))},Object.assign({mimeType:a},O.ConnectWebMOptions)),i=f._r=new e(f,r),o=f._rd={sampleRate:c[N]};i[t]=function(e){var t=new FileReader;t.onloadend=function(){if(n()){var e=I(new Uint8Array(t.result),o);if(!e)return;if(-1==e)return void B();u&&(clearTimeout(u),u=""),b(e)}else h||C(S+"多余回调",3)},t.readAsArrayBuffer(e.data)},i.start(~~(l/48)),C("Connect采用"+M+",设置"+x+"."+T+"=false可恢复使用"+d+"或老式"+v)}()},s=function(e){e._na=null,e._n&&(e._n.port.postMessage({kill:!0}),e._n.disconnect(),e._n=null)},P=function(e){e._ra=null,e._r&&(e._r.stop(),e._r=null)},A=function(e){var t=(e=e||O)==O,a=e.Stream;a&&(a._m&&(a._m.disconnect(),a._m=null),!a._RC&&a._c&&O.CloseNewCtx(a._c),a._RC=null,a._c=null,a._d&&(n(a._d.stream),a._d=null),a._p&&(a._p.disconnect(),a._p.onaudioprocess=a._p=null),s(a),P(a),t&&n(a)),e.Stream=0},n=O.StopS_=function(e){for(var t=e.getTracks&&e.getTracks()||e.audioTracks||[],a=0;a<t.length;a++){var s=t[a];s.stop&&s.stop()}e.stop&&e.stop()};O.SampleData=function(e,t,a,s,n){var r="SampleData";s||(s={});var i=s.index||0,o=s.offset||0,_=s.filter;if(_&&_.fn&&_.sr!=t&&(_=null,C(r+"的filter采样率变了,重设滤波",3)),!_){var l=3*t/4<a?0:a/2*3/4;_={fn:l?O.IIRFilter(!0,t,l):0}}_.sr=t;var f=_.fn,c=s.frameNext||[];n||(n={});var h=n.frameSize||1;n.frameType&&(h="mp3"==n.frameType?1152:1);var u=e.length;u+1<i&&C(r+"似乎传入了未重置chunk "+i+">"+u,3);for(var m=0,p=i;p<u;p++)m+=e[p].length;m=Math.max(0,m-Math.floor(o));var b=t/a;1<b?m=Math.floor(m/b):(b=1,a=t),m+=c.length;for(var v=new Int16Array(m),d=0,p=0;p<c.length;p++)v[d]=c[p],d++;for(;i<u;i++){for(var g=e[i],p=o,S=g.length,M=f&&f.Embed,w=0,R=0,A=0,B=0,k=0,x=0;k<S;k++,x++)if(x<S&&(M?(A=g[x],B=M.b0*A+M.b1*M.x1+M.b0*M.x2-M.a1*M.y1-M.a2*M.y2,M.x2=M.x1,M.x1=A,M.y2=M.y1,M.y1=B):B=f?f(g[x]):g[x]),w=R,R=B,0!=x){var y=Math.floor(p);if(k==y){var T=Math.ceil(p),E=p-y,P=w,I=T<S?R:P;v[d]=P+(I-P)*E,d++,p+=b}}else k--;o=Math.max(0,p-S)}c=null;var L=v.length%h;if(0<L){var H=2*(v.length-L);c=new Int16Array(v.buffer.slice(H)),v=new Int16Array(v.buffer.slice(0,H))}return{index:i,offset:o,filter:_,frameNext:c,sampleRate:a,data:v}},O.IIRFilter=function(e,t,a){var s=2*Math.PI*a/t,n=Math.sin(s),r=Math.cos(s),i=n/2,o=1+i,_=-2*r/o,l=(1-i)/o;if(e)var f=(1-r)/2/o,c=(1-r)/o;else var f=(1+r)/2/o,c=-(1+r)/o;var h=0,u=0,m=0,p=0,b=0,v=function(e){return m=f*e+c*h+f*u-_*p-l*b,u=h,h=e,b=p,p=m};return v.Embed={x1:0,x2:0,y1:0,y2:0,b0:f,b1:c,a1:_,a2:l},v},O.PowerLevel=function(e,t){var a=e/t||0;return a<1251?Math.round(a/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(a/1e4)/Math.log(10)))))},O.PowerDBFS=function(e){var t=Math.max(.1,e||0);return t=Math.min(t,32767),t=20*Math.log(t/32767)/Math.log(10),Math.max(-100,Math.round(t))},O.CLog=function(e,t){var a=new Date,s=("0"+a.getMinutes()).substr(-2)+":"+("0"+a.getSeconds()).substr(-2)+"."+("00"+a.getMilliseconds()).substr(-3),n=this&&this.envIn&&this.envCheck&&this.id,r=["["+s+" "+x+(n?":"+n:"")+"]"+e],i=arguments,o=k.console||{},_=2,l=o.log;for("number"==typeof t?l=1==t?o.error:3==t?o.warn:l:_=1;_<i.length;_++)r.push(i[_]);f?l&&l("[IsLoser]"+r[0],1<r.length?r:""):l.apply(o,r)};var C=function(){O.CLog.apply(this,arguments)},f=!0;try{f=!console.log.apply}catch(e){}var r=0;function t(e){this.id=++r,i();var t={type:"mp3",bitRate:16,sampleRate:16e3,onProcess:S};for(var a in e)t[a]=e[a];this.set=t,this._S=9,this.Sync={O:9,C:9}}O.Sync={O:9,C:9},O.prototype=t.prototype={CLog:C,_streamStore:function(){return this.set.sourceStream?this:O},_streamCtx:function(){var e=this._streamStore().Stream;return e&&e._c},open:function(e,a){var s=this,n=s.set,r=s._streamStore(),i=0;e=e||S;var o=function(e,t){t=!!t,s.CLog("录音open失败:"+e+",isUserNotAllow:"+t,1),i&&O.CloseNewCtx(i),a&&a(e,t)},_=function(){s.CLog("open ok id:"+s.id),e(),s._SO=0},l=r.Sync,f=++l.O,c=l.C;s._O=s._O_=f,s._SO=s._S;var t=s.envCheck({envName:"H5",canProcess:!0});if(t)o("不能录音:"+t);else if(n.sourceStream){if(!O.GetContext())return void o("不支持此浏览器从流中获取录音");A(r);var h=s.Stream=n.sourceStream;h._RC=n.runningContext,h._call={};try{R(r)}catch(e){return A(r),void o("从流中打开录音失败:"+e.message)}_()}else{var u=function(e,t){try{k.top.a}catch(e){return void o('无权录音(跨域,请尝试给iframe添加麦克风访问策略,如allow="camera;microphone")')}/Permission|Allow/i.test(e)?o("用户拒绝了录音权限",!0):!1===k.isSecureContext?o("浏览器禁止不安全页面录音,可开启https解决"):/Found/i.test(e)?o(t+",无可用麦克风"):o(t)};if(O.IsOpen())_();else if(O.Support()){var m=n.runningContext;m||(m=i=O.GetContext(!0));var p=function(t){setTimeout(function(){t._call={};var e=O.Stream;e&&(A(),t._call=e._call),(O.Stream=t)._c=m,t._RC=n.runningContext,function(){if(c!=l.C||!s._O){var e="open被取消";return f==l.O?s.close():e="open被中断",o(e),!0}}()||(O.IsOpen()?(e&&s.CLog("发现同时多次调用open",1),R(r,1),_()):o("录音功能无效:无音频流"))},100)},b=function(e){var t=e.name||e.message||e.code+":"+e;s.CLog("请求录音权限错误",1,e),u(t,"无法录音:"+t)},v=n.audioTrackSet||{};v[N]=m[N];var d={audio:v};try{var g=O.Scope[M](d,p,b)}catch(e){s.CLog(M,3,e),d={audio:!0},g=O.Scope[M](d,p,b)}s.CLog(M+"("+JSON.stringify(d)+") "+w(m)+",一般默认会降噪和回声消除,移动端可能会降低系统播放音量,请参阅文档中audioTrackSet配置"),g&&g.then&&g.then(p)[y](b)}else u("","此浏览器不支持录音")}},close:function(e){e=e||S;var t=this,a=t._streamStore();t._stop();var s=a.Sync;if(t._O=0,t._O_!=s.O)return t.CLog("close被忽略(因为同时open了多个rec,只有最后一个会真正close)",3),void e();s.C++,A(a),t.CLog("close"),e()},mock:function(e,t){var a=this;return a._stop(),a.isMock=1,a.mockEnvInfo=null,a.buffers=[e],a.recSize=e.length,a[V]=t,a},envCheck:function(e){var t,a=this.set,s="CPU_BE";if(t||O[s]||!k.Int8Array||new Int8Array(new Int32Array([1]).buffer)[0]||(i(s),t="不支持CPU_BE架构"),!t){var n=a.type;this[n+"_envCheck"]?t=this[n+"_envCheck"](e,a):a.takeoffEncodeChunk&&(t=n+"类型"+(this[n]?"":"(未加载编码器)")+"不支持设置takeoffEncodeChunk")}return t||""},envStart:function(e,t){var a=this,s=a.set;a.isMock=e?1:0,a.mockEnvInfo=e,a.buffers=[],a.recSize=0,a.envInLast=0,a.envInFirst=0,a.envInFix=0,a.envInFixTs=[];var n=s[N];if(t<n?s[N]=t:n=0,a[V]=t,a.CLog(V+": "+t+" set."+N+": "+s[N]+(n?" 忽略"+n:""),n?3:0),a.engineCtx=0,a[s.type+"_start"]){var r=a.engineCtx=a[s.type+"_start"](s);r&&(r.pcmDatas=[],r.pcmSize=0)}},envResume:function(){this.envInFixTs=[]},envIn:function(e,t){var n=this,r=n.set,i=n.engineCtx,a=n[V],s=e.length,o=O.PowerLevel(t,s),_=n.buffers,l=_.length;_.push(e);var f=_,c=l,h=Date.now(),u=Math.round(s/a*1e3);n.envInLast=h,1==n.buffers.length&&(n.envInFirst=h-u);var m=n.envInFixTs;m.splice(0,0,{t:h,d:u});for(var p=h,b=0,v=0;v<m.length;v++){var d=m[v];if(3e3<h-d.t){m.length=v;break}p=d.t,b+=d.d}var g=m[1],S=h-p;if(S/3<S-b&&(g&&1e3<S||6<=m.length)){var M=h-g.t-u;if(u/5<M){var w=!r.disableEnvInFix;if(n.CLog("["+h+"]"+(w?"":"未")+"补偿"+M+"ms",3),n.envInFix+=M,w){var R=new Int16Array(M*a/1e3);s+=R.length,_.push(R)}}}var A=n.recSize,B=s,k=A+B;if(n.recSize=k,i){var x=O.SampleData(_,a,r[N],i.chunkInfo);i.chunkInfo=x,k=(A=i.pcmSize)+(B=x.data.length),i.pcmSize=k,_=i.pcmDatas,l=_.length,_.push(x.data),a=x[N]}var y=Math.round(k/a*1e3),T=_.length,E=f.length,P=function(){for(var e=I?0:-B,t=null==_[0],a=l;a<T;a++){var s=_[a];null==s?t=1:(e+=s.length,i&&s.length&&n[r.type+"_encode"](i,s))}if(t&&i)for(a=c,f[0]&&(a=0);a<E;a++)f[a]=null;t&&(e=I?B:0,_[0]=null),i?i.pcmSize+=e:n.recSize+=e},I=0,L="rec.set.onProcess";try{I=r.onProcess(_,o,y,a,l,P)}catch(e){console.error(L+"回调出错是不允许的,需保证不会抛异常",e)}var H=Date.now()-h;if(10<H&&1e3<n.envInFirst-h&&n.CLog(L+"低性能,耗时"+H+"ms",3),!0===I){var C=0;for(v=l;v<T;v++)null==_[v]?C=1:_[v]=new Int16Array(0);C?n.CLog("未进入异步前不能清除buffers",3):i?i.pcmSize-=B:n.recSize-=B}else P()},start:function(){var t=this,e=1;if(t.set.sourceStream?t.Stream||(e=0):O.IsOpen()||(e=0),e){var a=t._streamCtx();if(t.CLog("start 开始录音 "+w(a)),t._stop(),t.state=3,t.envStart(null,a[N]),t._SO&&t._SO+1!=t._S)t.CLog("start被中断",3);else{t._SO=0;var s=function(){3==t.state&&(t.state=1,t.resume())};if("suspended"==a.state){var n="AudioContext resume: ";t.CLog(n+"wait..."),a.resume().then(function(){t.CLog(n+a.state),s()})[y](function(e){t.CLog(n+a.state+" 可能无法录音:"+e.message,1,e),s()})}else s()}}else t.CLog("未open",1)},pause:function(){var e=this;e.state&&(e.state=2,e.CLog("pause"),delete e._streamStore().Stream._call[e.id])},resume:function(){var e,a=this;if(a.state){a.state=1,a.CLog("resume"),a.envResume();var t=a._streamStore().Stream;t._call[a.id]=function(e,t){1==a.state&&a.envIn(e,t)},(e=t)._na&&e._na(),e._ra&&e._ra()}},_stop:function(e){var t=this,a=t.set;t.isMock||t._S++,t.state&&(t.pause(),t.state=0),!e&&t[a.type+"_stop"]&&(t[a.type+"_stop"](t.engineCtx),t.engineCtx=0)},stop:function(a,t,e){var s,n=this,r=n.set,i=n.envInLast-n.envInFirst,o=i&&n.buffers.length;n.CLog("stop 和start时差"+(i?i+"ms 补偿"+n.envInFix+"ms envIn:"+o+" fps:"+(o/i*1e3).toFixed(1):"-")+" LM:"+O.LM);var _=function(){n._stop(),e&&n.close()},l=function(e){n.CLog("结束录音失败:"+e,1),t&&t(e),_()},f=function(e,t){if(n.CLog("结束录音 编码花"+(Date.now()-s)+"ms 音频时长"+t+"ms 文件大小"+e.size+"b"),r.takeoffEncodeChunk)n.CLog("启用takeoffEncodeChunk后stop返回的blob长度为0不提供音频数据",3);else if(e.size<Math.max(100,t/2))return void l("生成的"+r.type+"无效");a&&a(e,t),_()};if(!n.isMock){var c=3==n.state;if(!n.state||c)return void l("未开始录音"+(c?",开始录音前无用户交互导致AudioContext未运行":""));n._stop(!0)}var h=n.recSize;if(h)if(n.buffers[0])if(n[r.type]){if(n.isMock){var u=n.envCheck(n.mockEnvInfo||{envName:"mock",canProcess:!1});if(u)return void l("录音错误:"+u)}var m=n.engineCtx;if(n[r.type+"_complete"]&&m){var p=Math.round(m.pcmSize/r[N]*1e3);return s=Date.now(),void n[r.type+"_complete"](m,function(e){f(e,p)},l)}s=Date.now();var b=O.SampleData(n.buffers,n[V],r[N]);r[N]=b[N];var v=b.data;p=Math.round(v.length/r[N]*1e3),n.CLog("采样"+h+"->"+v.length+" 花:"+(Date.now()-s)+"ms"),setTimeout(function(){s=Date.now(),n[r.type](v,function(e){f(e,p)},function(e){l(e)})})}else l("未加载"+r.type+"编码器");else l("音频buffers被释放");else l("未采集到录音")}},k[x]&&(C("重复引入"+x,3),k[x].Destroy()),k[x]=O;var I=function(e,t){t.pos||(t.pos=[0],t.tracks={},t.bytes=[]);var a=t.tracks,s=[t.pos[0]],n=function(){t.pos[0]=s[0]},r=t.bytes.length,i=new Uint8Array(r+e.length);if(i.set(t.bytes),i.set(e,r),t.bytes=i,!t._ht){if(D(i,s),Y(i,s),!L(D(i,s),[24,83,128,103]))return;for(D(i,s);s[0]<i.length;){var o=D(i,s),_=Y(i,s),l=[0],f=0;if(!_)return;if(L(o,[22,84,174,107])){for(;l[0]<_.length;){var c=D(_,l),h=Y(_,l),u=[0],m={channels:0,sampleRate:0};if(L(c,[174]))for(;u[0]<h.length;){var p=D(h,u),b=Y(h,u),v=[0];if(L(p,[215])){var d=H(b);m.number=d,a[d]=m}else if(L(p,[131])){var d=H(b);1==d?m.type="video":2==d?(m.type="audio",f||(t.track0=m),m.idx=f++):m.type="Type-"+d}else if(L(p,[134])){for(var g="",S=0;S<b.length;S++)g+=String.fromCharCode(b[S]);m.codec=g}else if(L(p,[225]))for(;v[0]<b.length;){var M=D(b,v),w=Y(b,v);if(L(M,[181])){var d=0,R=new Uint8Array(w.reverse()).buffer;4==w.length?d=new Float32Array(R)[0]:8==w.length?d=new Float64Array(R)[0]:C("WebM Track !Float",1,w),m[N]=Math.round(d)}else L(M,[98,100])?m.bitDepth=H(w):L(M,[159])&&(m.channels=H(w))}}}t._ht=1,C("WebM Tracks",a),n();break}}}var A=t.track0;if(A){if(16==A.bitDepth&&/FLOAT/i.test(A.codec)&&(A.bitDepth=32,C("WebM 16改32位",3)),A[N]!=t[N]||32!=A.bitDepth||A.channels<1||!/(\b|_)PCM\b/i.test(A.codec))return t.bytes=[],t.bad||C("WebM Track非预期",3,t),-(t.bad=1);for(var B=[],k=0;s[0]<i.length;){var c=D(i,s),h=Y(i,s);if(!h)break;if(L(c,[163])){var x=15&h[0],m=a[x];if(m){if(0===m.idx){for(var y=new Uint8Array(h.length-4),S=4;S<h.length;S++)y[S-4]=h[S];B.push(y),k+=y.length}}else C("WebM !Track"+x,1,a)}n()}if(k){var T=new Uint8Array(i.length-t.pos[0]);T.set(i.subarray(t.pos[0])),t.bytes=T,t.pos[0]=0;for(var y=new Uint8Array(k),S=0,E=0;S<B.length;S++)y.set(B[S],E),E+=B[S].length;var R=new Float32Array(y.buffer);if(1<A.channels){for(var P=[],S=0;S<R.length;)P.push(R[S]),S+=A.channels;R=new Float32Array(P)}return R}}},L=function(e,t){if(!e||e.length!=t.length)return!1;if(1==e.length)return e[0]==t[0];for(var a=0;a<e.length;a++)if(e[a]!=t[a])return!1;return!0},H=function(e){for(var t="",a=0;a<e.length;a++){var s=e[a];t+=(s<16?"0":"")+s.toString(16)}return parseInt(t,16)||0},D=function(e,t,a){var s=t[0];if(!(s>=e.length)){var n=e[s],r=("0000000"+n.toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(r);if(i){var o=i[1].length,_=[];if(!(s+o>e.length)){for(var l=0;l<o;l++)_[l]=e[s],s++;return a&&(_[0]=parseInt(i[2]||"0",2)),t[0]=s,_}}}},Y=function(e,t){var a=D(e,t,1);if(a){var s=H(a),n=t[0],r=[];if(s<2147483647){if(n+s>e.length)return;for(var i=0;i<s;i++)r[i]=e[n],n++}return t[0]=n,r}};O.TrafficImgUrl="//ia.51.la/go1?id=20469973&pvFlag=1";var i=O.Traffic=function(e){e=e?"/"+x+"/Report/"+e:"";var t=O.TrafficImgUrl;if(t){var a=O.Traffic,s=/^(https?:..[^\/#]*\/?)[^#]*/i.exec(location.href)||[],n=s[1]||"http://file/",r=(s[0]||n)+e;if(0==t.indexOf("//")&&(t=/^https:/i.test(r)?"https:"+t:"http:"+t),e&&(t=t+"&cu="+encodeURIComponent(n+e)),!a[r]){a[r]=1;var i=new Image;i.src=t,C("Traffic Analysis Image: "+(e||x+".TrafficImgUrl="+O.TrafficImgUrl))}}}}(window),"function"==typeof define&&define.amd&&define(function(){return Recorder}),"object"==typeof module&&module.exports&&(module.exports=Recorder),function(){"use strict";var i;Recorder.prototype.enc_mp3={stable:!0,testmsg:"采样率范围48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000"},Recorder.prototype.mp3=function(a,s,e){var n=this.set,r=a.length,t=this.mp3_start(n);if(t)return this.mp3_encode(t,a),void this.mp3_complete(t,s,e,1);var i=new Recorder.lamejs.Mp3Encoder(1,n.sampleRate,n.bitRate),o=[],_=0,l=0,f=function(){if(_<r){0<(e=i.encodeBuffer(a.subarray(_,_+57600))).length&&(l+=e.buffer.byteLength,o.push(e.buffer)),_+=57600,setTimeout(f)}else{var e;0<(e=i.flush()).length&&(l+=e.buffer.byteLength,o.push(e.buffer));var t=c.fn(o,l,r,n.sampleRate);h(t,n),s(new Blob(o,{type:"audio/mp3"}))}};f()},Recorder.BindDestroy("mp3Worker",function(){Recorder.CLog("mp3Worker Destroy"),i&&i.terminate(),i=null}),Recorder.prototype.mp3_envCheck=function(e,t){var a="";return t.takeoffEncodeChunk&&(e.canProcess?s()||(a="当前浏览器版本太低,无法实时处理"):a=e.envName+"环境不支持实时处理"),a},Recorder.prototype.mp3_start=function(e){return s(e)};var o={id:0},s=function(e){var t=i;try{if(!t){var a=");wk_lame();var wk_ctxs={};self.onmessage="+function(e){var t=e.data,a=wk_ctxs[t.id];if("init"==t.action)wk_ctxs[t.id]={sampleRate:t.sampleRate,bitRate:t.bitRate,takeoff:t.takeoff,mp3Size:0,pcmSize:0,encArr:[],encObj:new wk_lame.Mp3Encoder(1,t.sampleRate,t.bitRate)};else if(!a)return;switch(t.action){case"stop":a.encObj=null,delete wk_ctxs[t.id];break;case"encode":a.pcmSize+=t.pcm.length,0<(s=a.encObj.encodeBuffer(t.pcm)).length&&(a.takeoff?self.postMessage({action:"takeoff",id:t.id,chunk:s}):(a.mp3Size+=s.buffer.byteLength,a.encArr.push(s.buffer)));break;case"complete":var s;0<(s=a.encObj.flush()).length&&(a.takeoff?self.postMessage({action:"takeoff",id:t.id,chunk:s}):(a.mp3Size+=s.buffer.byteLength,a.encArr.push(s.buffer)));var n=wk_mp3TrimFix.fn(a.encArr,a.mp3Size,a.pcmSize,a.sampleRate);self.postMessage({action:t.action,id:t.id,blob:new Blob(a.encArr,{type:"audio/mp3"}),meta:n})}};a+=";var wk_mp3TrimFix={rm:"+c.rm+",fn:"+c.fn+"}";var s=Recorder.lamejs.toString(),n=(window.URL||webkitURL).createObjectURL(new Blob(["var wk_lame=(",s,a],{type:"text/javascript"}));t=new Worker(n),setTimeout(function(){(window.URL||webkitURL).revokeObjectURL(n)},1e4),t.onmessage=function(e){var t=e.data,a=o[t.id];a&&("takeoff"==t.action?a.set.takeoffEncodeChunk(new Uint8Array(t.chunk.buffer)):(a.call&&a.call(t),a.call=null))}}var r={worker:t,set:e,takeoffQueue:[]};return e?(r.id=++o.id,o[r.id]=r,t.postMessage({action:"init",id:r.id,sampleRate:e.sampleRate,bitRate:e.bitRate,takeoff:!!e.takeoffEncodeChunk,x:new Int16Array(5)})):t.postMessage({x:new Int16Array(5)}),i=t,r}catch(e){return t&&t.terminate(),console.error(e),null}};Recorder.prototype.mp3_stop=function(e){if(e&&e.worker){e.worker.postMessage({action:"stop",id:e.id}),e.worker=null,delete o[e.id];var t=-1;for(var a in o)t++;t&&Recorder.CLog("mp3 worker剩"+t+"个在串行等待",3)}},Recorder.prototype.mp3_encode=function(e,t){e&&e.worker&&e.worker.postMessage({action:"encode",id:e.id,pcm:t})},Recorder.prototype.mp3_complete=function(t,a,e,s){var n=this;t&&t.worker?(t.call=function(e){h(e.meta,t.set),a(e.blob),s&&n.mp3_stop(t)},t.worker.postMessage({action:"complete",id:t.id})):e("mp3编码器未打开")},Recorder.mp3ReadMeta=function(e,t){var a="object"==typeof window?window.parseInt:self.parseInt,s=new Uint8Array(e[0]||[]);if(s.length<4)return null;var n=function(e,t){return("0000000"+((t||s)[e]||0).toString(2)).substr(-8)},r=n(0)+n(1),i=n(2)+n(3);if(!/^1{11}/.test(r))return null;var o={"00":2.5,10:2,11:1}[r.substr(11,2)],_={"01":3}[r.substr(13,2)],l={1:[44100,48e3,32e3],2:[22050,24e3,16e3],2.5:[11025,12e3,8e3]}[o];l&&(l=l[a(i.substr(4,2),2)]);var f=[[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160],[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320]][1==o?1:0][a(i.substr(0,4),2)];if(!(o&&_&&f&&l))return null;for(var c=Math.round(8*t/f),h=1==_?384:2==_?1152:1==o?1152:576,u=h/l*1e3,m=Math.floor(h*f/8/l*1e3),p=0,b=0,v=0;v<e.length;v++){var d=e[v];if(m+3<=(b+=d.byteLength)){var g=new Uint8Array(d);p="1"==n(d.byteLength-(b-(m+3)+1),g).charAt(6);break}}return p&&m++,{version:o,layer:_,sampleRate:l,bitRate:f,duration:c,size:t,hasPadding:p,frameSize:m,frameDurationFloat:u}};var c={rm:Recorder.mp3ReadMeta,fn:function(e,t,a,s){var n=this.rm(e,t);if(!n)return{err:"mp3非预定格式"};var r=Math.round(a/s*1e3),i=Math.floor((n.duration-r)/n.frameDurationFloat);if(0<i){var o=i*n.frameSize-(n.hasPadding?1:0);t-=o;for(var _=0,l=[],f=0;f<e.length;f++){var c=e[f];if(o<=0)break;o>=c.byteLength?(o-=c.byteLength,l.push(c),e.splice(f,1),f--):(e[f]=c.slice(o),_=c,o=0)}if(!this.rm(e,t)){_&&(e[0]=_);for(f=0;f<l.length;f++)e.splice(f,0,l[f]);n.err="fix后数据错误,已还原,错误原因不明"}var h=n.trimFix={};h.remove=i,h.removeDuration=Math.round(i*n.frameDurationFloat),h.duration=Math.round(8*t/n.bitRate)}return n}},h=function(e,t){var a="MP3信息 ";(e.sampleRate&&e.sampleRate!=t.sampleRate||e.bitRate&&e.bitRate!=t.bitRate)&&(Recorder.CLog(a+"和设置的不匹配set:"+t.bitRate+"kbps "+t.sampleRate+"hz,已更新set:"+e.bitRate+"kbps "+e.sampleRate+"hz",3,t),t.sampleRate=e.sampleRate,t.bitRate=e.bitRate);var s=e.trimFix;s?(a+="Fix移除"+s.remove+"帧"+s.removeDuration+"ms -> "+s.duration+"ms",2<s.remove&&(e.err=(e.err?e.err+", ":"")+"移除帧数过多")):a+=(e.duration||"-")+"ms",e.err?Recorder.CLog(a,1,e.err,e):Recorder.CLog(a,e)}}(),function(){"use strict";function t(){var B=function(e){return Math.log(e)/Math.log(10)};function A(e){return new Int8Array(e)}function n(e){return new Int16Array(e)}function Ae(e){return new Int32Array(e)}function Be(e){return new Float32Array(e)}function s(e){return new Float64Array(e)}function ke(e){if(1==e.length)return Be(e[0]);var t=e[0];e=e.slice(1);for(var a=[],s=0;s<t;s++)a.push(ke(e));return a}function Y(e){if(1==e.length)return Ae(e[0]);var t=e[0];e=e.slice(1);for(var a=[],s=0;s<t;s++)a.push(Y(e));return a}function p(e){if(1==e.length)return n(e[0]);var t=e[0];e=e.slice(1);for(var a=[],s=0;s<t;s++)a.push(p(e));return a}function V(e){if(1==e.length)return new Array(e[0]);var t=e[0];e=e.slice(1);for(var a=[],s=0;s<t;s++)a.push(V(e));return a}var xe={fill:function(e,t,a,s){if(2==arguments.length)for(var n=0;n<e.length;n++)e[n]=t;else for(n=t;n<a;n++)e[n]=s}},$={arraycopy:function(e,t,a,s,n){for(var r=t+n;t<r;)a[s++]=e[t++]}},ee={};function ye(e){this.ordinal=e}ee.SQRT2=1.4142135623730951,ee.FAST_LOG10=function(e){return B(e)},ee.FAST_LOG10_X=function(e,t){return B(e)*t},ye.short_block_allowed=new ye(0),ye.short_block_coupled=new ye(1),ye.short_block_dispensed=new ye(2),ye.short_block_forced=new ye(3);var Z={};function Te(e){this.ordinal=e}Z.MAX_VALUE=3.4028235e38,Te.vbr_off=new Te(0),Te.vbr_mt=new Te(1),Te.vbr_rh=new Te(2),Te.vbr_abr=new Te(3),Te.vbr_mtrh=new Te(4),Te.vbr_default=Te.vbr_mtrh;function Ee(e){var t=e;this.ordinal=function(){return t}}function k(){var M=null;function v(e){this.bits=0|e}this.qupvt=null,this.setModules=function(e){this.qupvt=e,M=e};var n=[[0,0],[0,0],[0,0],[0,0],[0,0],[0,1],[1,1],[1,1],[1,2],[2,2],[2,3],[2,3],[3,4],[3,4],[3,4],[4,5],[4,5],[4,6],[5,6],[5,6],[5,7],[6,7],[6,7]];function w(e,t,a,s,n,r){var i=.5946/t;for(e>>=1;0!=e--;)n[r++]=i>a[s++]?0:1,n[r++]=i>a[s++]?0:1}function R(e,t,a,s,n,r){var i=(e>>=1)%2;for(e>>=1;0!=e--;){var o,_,l,f,c,h,u,m;o=a[s++]*t,_=a[s++]*t,c=0|o,l=a[s++]*t,h=0|_,f=a[s++]*t,u=0|l,o+=M.adj43[c],m=0|f,_+=M.adj43[h],n[r++]=0|o,l+=M.adj43[u],n[r++]=0|_,f+=M.adj43[m],n[r++]=0|l,n[r++]=0|f}0!=i&&(c=0|(o=a[s++]*t),h=0|(_=a[s++]*t),o+=M.adj43[c],_+=M.adj43[h],n[r++]=0|o,n[r++]=0|_)}var o=[1,2,5,7,7,10,10,13,13,13,13,13,13,13,13];function d(e,t,a,s){var n=function(e,t,a){var s=0,n=0;do{var r=e[t++],i=e[t++];s<r&&(s=r),n<i&&(n=i)}while(t<a);return s<n&&(s=n),s}(e,t,a);switch(n){case 0:return n;case 1:return function(e,t,a,s){var n=0,r=F.ht[1].hlen;do{var i=2*e[t+0]+e[t+1];t+=2,n+=r[i]}while(t<a);return s.bits+=n,1}(e,t,a,s);case 2:case 3:return function(e,t,a,s,n){var r,i,o=0,_=F.ht[s].xlen;i=2==s?F.table23:F.table56;do{var l=e[t+0]*_+e[t+1];t+=2,o+=i[l]}while(t<a);return(r=65535&o)<(o>>=16)&&(o=r,s++),n.bits+=o,s}(e,t,a,o[n-1],s);case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:return function(e,t,a,s,n){var r=0,i=0,o=0,_=F.ht[s].xlen,l=F.ht[s].hlen,f=F.ht[s+1].hlen,c=F.ht[s+2].hlen;do{var h=e[t+0]*_+e[t+1];t+=2,r+=l[h],i+=f[h],o+=c[h]}while(t<a);var u=s;return i<r&&(r=i,u++),o<r&&(r=o,u=s+2),n.bits+=r,u}(e,t,a,o[n-1],s);default:if(T.IXMAX_VAL<n)return s.bits=T.LARGE_BITS,-1;var r,i;for(n-=15,r=24;r<32&&!(F.ht[r].linmax>=n);r++);for(i=r-8;i<24&&!(F.ht[i].linmax>=n);i++);return function(e,t,a,s,n,r){var i,o=65536*F.ht[s].xlen+F.ht[n].xlen,_=0;do{var l=e[t++],f=e[t++];0!=l&&(14<l&&(l=15,_+=o),l*=16),0!=f&&(14<f&&(f=15,_+=o),l+=f),_+=F.largetbl[l]}while(t<a);return(i=65535&_)<(_>>=16)&&(_=i,s=n),r.bits+=_,s}(e,t,a,i,r,s)}}function u(e,t,a,s,n,r,i,o){for(var _=t.big_values,l=2;l<Pe.SBMAX_l+1;l++){var f=e.scalefac_band.l[l];if(_<=f)break;var c=n[l-2]+t.count1bits;if(a.part2_3_length<=c)break;var h=new v(c),u=d(s,f,_,h);c=h.bits,a.part2_3_length<=c||(a.assign(t),a.part2_3_length=c,a.region0_count=r[l-2],a.region1_count=l-2-r[l-2],a.table_select[0]=i[l-2],a.table_select[1]=o[l-2],a.table_select[2]=u)}}this.noquant_count_bits=function(e,t,a){var s=t.l3_enc,n=Math.min(576,t.max_nonzero_coeff+2>>1<<1);for(null!=a&&(a.sfb_count1=0);1<n&&0==(s[n-1]|s[n-2]);n-=2);t.count1=n;for(var r=0,i=0;3<n;n-=4){var o;if(1<(2147483647&(s[n-1]|s[n-2]|s[n-3]|s[n-4])))break;o=2*(2*(2*s[n-4]+s[n-3])+s[n-2])+s[n-1],r+=F.t32l[o],i+=F.t33l[o]}var _=r;if(t.count1table_select=0,i<r&&(_=i,t.count1table_select=1),t.count1bits=_,0==(t.big_values=n))return _;if(t.block_type==Pe.SHORT_TYPE)(r=3*e.scalefac_band.s[3])>t.big_values&&(r=t.big_values),i=t.big_values;else if(t.block_type==Pe.NORM_TYPE){if(r=t.region0_count=e.bv_scf[n-2],i=t.region1_count=e.bv_scf[n-1],i=e.scalefac_band.l[r+i+2],r=e.scalefac_band.l[r+1],i<n){var l=new v(_);t.table_select[2]=d(s,i,n,l),_=l.bits}}else t.region0_count=7,t.region1_count=Pe.SBMAX_l-1-7-1,(i=n)<(r=e.scalefac_band.l[8])&&(r=i);if(r=Math.min(r,n),i=Math.min(i,n),0<r){l=new v(_);t.table_select[0]=d(s,0,r,l),_=l.bits}if(r<i){l=new v(_);t.table_select[1]=d(s,r,i,l),_=l.bits}if(2==e.use_best_huffman&&(t.part2_3_length=_,best_huffman_divide(e,t),_=t.part2_3_length),null!=a&&t.block_type==Pe.NORM_TYPE){for(var f=0;e.scalefac_band.l[f]<t.big_values;)f++;a.sfb_count1=f}return _},this.count_bits=function(e,t,a,s){var n=a.l3_enc,r=T.IXMAX_VAL/M.IPOW20(a.global_gain);if(a.xrpow_max>r)return T.LARGE_BITS;if(function(e,t,a,s,n){var r,i,o,_=0,l=0,f=0,c=0,h=t,u=0,m=h,p=0,b=e,v=0;for(o=null!=n&&s.global_gain==n.global_gain,i=s.block_type==Pe.SHORT_TYPE?38:21,r=0;r<=i;r++){var d=-1;if((o||s.block_type==Pe.NORM_TYPE)&&(d=s.global_gain-(s.scalefac[r]+(0!=s.preflag?M.pretab[r]:0)<<s.scalefac_scale+1)-8*s.subblock_gain[s.window[r]]),o&&n.step[r]==d)0!=l&&(R(l,a,b,v,m,p),l=0),0!=f&&(w(f,a,b,v,m,p),f=0);else{var g,S=s.width[r];if(_+s.width[r]>s.max_nonzero_coeff&&(g=s.max_nonzero_coeff-_+1,xe.fill(t,s.max_nonzero_coeff,576,0),(S=g)<0&&(S=0),r=i+1),0==l&&0==f&&(m=h,p=u,b=e,v=c),null!=n&&0<n.sfb_count1&&r>=n.sfb_count1&&0<n.step[r]&&d>=n.step[r]?(0!=l&&(R(l,a,b,v,m,p),l=0,m=h,p=u,b=e,v=c),f+=S):(0!=f&&(w(f,a,b,v,m,p),f=0,m=h,p=u,b=e,v=c),l+=S),S<=0){0!=f&&(w(f,a,b,v,m,p),f=0),0!=l&&(R(l,a,b,v,m,p),l=0);break}}r<=i&&(u+=s.width[r],c+=s.width[r],_+=s.width[r])}0!=l&&(R(l,a,b,v,m,p),l=0),0!=f&&(w(f,a,b,v,m,p),f=0)}(t,n,M.IPOW20(a.global_gain),a,s),0!=(2&e.substep_shaping))for(var i=0,o=a.global_gain+a.scalefac_scale,_=.634521682242439/M.IPOW20(o),l=0;l<a.sfbmax;l++){var f,c=a.width[l];if(0==e.pseudohalf[l])i+=c;else for(f=i,i+=c;f<i;++f)n[f]=t[f]>=_?n[f]:0}return this.noquant_count_bits(e,a,s)},this.best_huffman_divide=function(e,t){var a=new y,s=t.l3_enc,n=Ae(23),r=Ae(23),i=Ae(23),o=Ae(23);if(t.block_type!=Pe.SHORT_TYPE||1!=e.mode_gr){a.assign(t),t.block_type==Pe.NORM_TYPE&&(!function(e,t,a,s,n,r,i){for(var o=t.big_values,_=0;_<=22;_++)s[_]=T.LARGE_BITS;for(_=0;_<16;_++){var l=e.scalefac_band.l[_+1];if(o<=l)break;var f=0,c=new v(f),h=d(a,0,l,c);f=c.bits;for(var u=0;u<8;u++){var m=e.scalefac_band.l[_+u+2];if(o<=m)break;var p=f,b=d(a,l,m,c=new v(p));p=c.bits,s[_+u]>p&&(s[_+u]=p,r[(n[_+u]=_)+u]=h,i[_+u]=b)}}}(e,t,s,n,r,i,o),u(e,a,t,s,n,r,i,o));var _=a.big_values;if(!(0==_||1<(s[_-2]|s[_-1])||576<(_=t.count1+2))){a.assign(t),a.count1=_;for(var l=0,f=0;_>a.big_values;_-=4){var c=2*(2*(2*s[_-4]+s[_-3])+s[_-2])+s[_-1];l+=F.t32l[c],f+=F.t33l[c]}if(a.big_values=_,a.count1table_select=0,f<l&&(l=f,a.count1table_select=1),a.count1bits=l,a.block_type==Pe.NORM_TYPE)u(e,a,t,s,n,r,i,o);else{if(a.part2_3_length=l,_<(l=e.scalefac_band.l[8])&&(l=_),0<l){var h=new v(a.part2_3_length);a.table_select[0]=d(s,0,l,h),a.part2_3_length=h.bits}if(l<_){h=new v(a.part2_3_length);a.table_select[1]=d(s,l,_,h),a.part2_3_length=h.bits}t.part2_3_length>a.part2_3_length&&t.assign(a)}}}};var h=[1,1,1,1,8,2,2,2,4,4,4,8,8,8,16,16],m=[1,2,4,8,1,2,4,8,2,4,8,2,4,8,4,8],p=[0,0,0,0,3,1,1,1,2,2,2,3,3,3,4,4],b=[0,1,2,3,0,1,2,3,1,2,3,1,2,3,2,3];k.slen1_tab=p,k.slen2_tab=b,this.best_scalefac_store=function(e,t,a,s){var n,r,i,o,_=s.tt[t][a],l=0;for(n=i=0;n<_.sfbmax;n++){var f=_.width[n];for(i+=f,o=-f;o<0&&0==_.l3_enc[o+i];o++);0==o&&(_.scalefac[n]=l=-2)}if(0==_.scalefac_scale&&0==_.preflag){var c=0;for(n=0;n<_.sfbmax;n++)0<_.scalefac[n]&&(c|=_.scalefac[n]);if(0==(1&c)&&0!=c){for(n=0;n<_.sfbmax;n++)0<_.scalefac[n]&&(_.scalefac[n]>>=1);_.scalefac_scale=l=1}}if(0==_.preflag&&_.block_type!=Pe.SHORT_TYPE&&2==e.mode_gr){for(n=11;n<Pe.SBPSY_l&&!(_.scalefac[n]<M.pretab[n]&&-2!=_.scalefac[n]);n++);if(n==Pe.SBPSY_l){for(n=11;n<Pe.SBPSY_l;n++)0<_.scalefac[n]&&(_.scalefac[n]-=M.pretab[n]);_.preflag=l=1}}for(r=0;r<4;r++)s.scfsi[a][r]=0;for(2==e.mode_gr&&1==t&&s.tt[0][a].block_type!=Pe.SHORT_TYPE&&s.tt[1][a].block_type!=Pe.SHORT_TYPE&&(!function(e,t){for(var a,s=t.tt[1][e],n=t.tt[0][e],r=0;r<F.scfsi_band.length-1;r++){for(a=F.scfsi_band[r];a<F.scfsi_band[r+1]&&!(n.scalefac[a]!=s.scalefac[a]&&0<=s.scalefac[a]);a++);if(a==F.scfsi_band[r+1]){for(a=F.scfsi_band[r];a<F.scfsi_band[r+1];a++)s.scalefac[a]=-1;t.scfsi[e][r]=1}}var i=0,o=0;for(a=0;a<11;a++)-1!=s.scalefac[a]&&(o++,i<s.scalefac[a]&&(i=s.scalefac[a]));for(var _=0,l=0;a<Pe.SBPSY_l;a++)-1!=s.scalefac[a]&&(l++,_<s.scalefac[a]&&(_=s.scalefac[a]));for(r=0;r<16;r++)if(i<h[r]&&_<m[r]){var f=p[r]*o+b[r]*l;s.part2_length>f&&(s.part2_length=f,s.scalefac_compress=r)}}(a,s),l=0),n=0;n<_.sfbmax;n++)-2==_.scalefac[n]&&(_.scalefac[n]=0);0!=l&&(2==e.mode_gr?this.scale_bitcount(_):this.scale_bitcount_lsf(e,_))};var _=[0,18,36,54,54,36,54,72,54,72,90,72,90,108,108,126],l=[0,18,36,54,51,35,53,71,52,70,88,69,87,105,104,122],f=[0,10,20,30,33,21,31,41,32,42,52,43,53,63,64,74];this.scale_bitcount=function(e){var t,a,s,n=0,r=0,i=e.scalefac;if(e.block_type==Pe.SHORT_TYPE)s=_,0!=e.mixed_block_flag&&(s=l);else if(s=f,0==e.preflag){for(a=11;a<Pe.SBPSY_l&&!(i[a]<M.pretab[a]);a++);if(a==Pe.SBPSY_l)for(e.preflag=1,a=11;a<Pe.SBPSY_l;a++)i[a]-=M.pretab[a]}for(a=0;a<e.sfbdivide;a++)n<i[a]&&(n=i[a]);for(;a<e.sfbmax;a++)r<i[a]&&(r=i[a]);for(e.part2_length=T.LARGE_BITS,t=0;t<16;t++)n<h[t]&&r<m[t]&&e.part2_length>s[t]&&(e.part2_length=s[t],e.scalefac_compress=t);return e.part2_length==T.LARGE_BITS};var g=[[15,15,7,7],[15,15,7,0],[7,3,0,0],[15,31,31,0],[7,7,7,0],[3,3,0,0]];this.scale_bitcount_lsf=function(e,t){var a,s,n,r,i,o,_,l,f=Ae(4),c=t.scalefac;for(a=0!=t.preflag?2:0,_=0;_<4;_++)f[_]=0;if(t.block_type==Pe.SHORT_TYPE){s=1;var h=M.nr_of_sfb_block[a][s];for(n=l=0;n<4;n++)for(r=h[n]/3,_=0;_<r;_++,l++)for(i=0;i<3;i++)c[3*l+i]>f[n]&&(f[n]=c[3*l+i])}else{s=0;h=M.nr_of_sfb_block[a][s];for(n=l=0;n<4;n++)for(r=h[n],_=0;_<r;_++,l++)c[l]>f[n]&&(f[n]=c[l])}for(o=!1,n=0;n<4;n++)f[n]>g[a][n]&&(o=!0);if(!o){var u,m,p,b;for(t.sfb_partition_table=M.nr_of_sfb_block[a][s],n=0;n<4;n++)t.slen[n]=S[f[n]];switch(u=t.slen[0],m=t.slen[1],p=t.slen[2],b=t.slen[3],a){case 0:t.scalefac_compress=(5*u+m<<4)+(p<<2)+b;break;case 1:t.scalefac_compress=400+(5*u+m<<2)+p;break;case 2:t.scalefac_compress=500+3*u+m;break;default:$.err.printf("intensity stereo not implemented yet\n")}}if(!o)for(n=t.part2_length=0;n<4;n++)t.part2_length+=t.slen[n]*t.sfb_partition_table[n];return o};var S=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];this.huffman_init=function(e){for(var t=2;t<=576;t+=2){for(var a,s=0;e.scalefac_band.l[++s]<t;);for(a=n[s][0];e.scalefac_band.l[a+1]>t;)a--;for(a<0&&(a=n[s][0]),e.bv_scf[t-2]=a,a=n[s][1];e.scalefac_band.l[a+e.bv_scf[t-2]+2]>t;)a--;a<0&&(a=n[s][1]),e.bv_scf[t-1]=a}}}function X(){}function M(){this.setModules=function(e,t,a){e,t,a};var o=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];this.updateMusicCRC=function(e,t,a,s){for(var n=0;n<s;++n)e[0]=(r=t[a+n],i=(i=e[0])>>8^o[255&(i^r)]);var r,i}}function q(){var _=this,s=32773,c=null,h=null,r=null,u=null;this.setModules=function(e,t,a,s){c=e,h=t,r=a,u=s};var m=null,l=0,p=0,b=0;function v(e,t,a){for(;0<a;){var s;0==b&&(b=8,p++,e.header[e.w_ptr].write_timing==l&&(n=e,$.arraycopy(n.header[n.w_ptr].buf,0,m,p,n.sideinfo_len),p+=n.sideinfo_len,l+=8*n.sideinfo_len,n.w_ptr=n.w_ptr+1&G.MAX_HEADER_BUF-1),m[p]=0),a-=s=Math.min(a,b),b-=s,m[p]|=t>>a<<b,l+=s}var n}function i(e,t,a){for(;0<a;){var s;0==b&&(b=8,m[++p]=0),a-=s=Math.min(a,b),b-=s,m[p]|=t>>a<<b,l+=s}}function o(e,t){var a,s=e.internal_flags;if(8<=t&&(v(s,76,8),t-=8),8<=t&&(v(s,65,8),t-=8),8<=t&&(v(s,77,8),t-=8),8<=t&&(v(s,69,8),t-=8),32<=t){var n=r.getLameShortVersion();if(32<=t)for(a=0;a<n.length&&8<=t;++a)t-=8,v(s,n.charCodeAt(a),8)}for(;1<=t;t-=1)v(s,s.ancillary_flag,1),s.ancillary_flag^=e.disable_reservoir?0:1}function f(e,t,a){for(var s=e.header[e.h_ptr].ptr;0<a;){var n=Math.min(a,8-(7&s));a-=n,e.header[e.h_ptr].buf[s>>3]|=t>>a<<8-(7&s)-n,s+=n}e.header[e.h_ptr].ptr=s}function n(e,t){e<<=8;for(var a=0;a<8;a++)0!=(65536&((t<<=1)^(e<<=1)))&&(t^=s);return t}function d(e,t){var a,s=F.ht[t.count1table_select+32],n=0,r=t.big_values,i=t.big_values;for(a=(t.count1-t.big_values)/4;0<a;--a){var o=0,_=0;0!=t.l3_enc[r+0]&&(_+=8,t.xr[i+0]<0&&o++),0!=t.l3_enc[r+1]&&(_+=4,o*=2,t.xr[i+1]<0&&o++),0!=t.l3_enc[r+2]&&(_+=2,o*=2,t.xr[i+2]<0&&o++),0!=t.l3_enc[r+3]&&(_++,o*=2,t.xr[i+3]<0&&o++),r+=4,i+=4,v(e,o+s.table[_],s.hlen[_]),n+=s.hlen[_]}return n}function g(e,t,a,s,n){var r=F.ht[t],i=0;if(0==t)return i;for(var o=a;o<s;o+=2){var _=0,l=0,f=r.xlen,c=r.xlen,h=0,u=n.l3_enc[o],m=n.l3_enc[o+1];if(0!=u&&(n.xr[o]<0&&h++,_--),15<t){if(14<u)h|=u-15<<1,l=f,u=15;if(14<m)h<<=f,h|=m-15,l+=f,m=15;c=16}0!=m&&(h<<=1,n.xr[o+1]<0&&h++,_--),u=u*c+m,l-=_,_+=r.hlen[u],v(e,r.table[u],_),v(e,h,l),i+=_+l}return i}function S(e,t){var a=3*e.scalefac_band.s[3];a>t.big_values&&(a=t.big_values);var s=g(e,t.table_select[0],0,a,t);return s+=g(e,t.table_select[1],a,t.big_values,t)}function M(e,t){var a,s,n,r;a=t.big_values;var i=t.region0_count+1;return n=e.scalefac_band.l[i],i+=t.region1_count+1,a<n&&(n=a),a<(r=e.scalefac_band.l[i])&&(r=a),s=g(e,t.table_select[0],0,n,t),s+=g(e,t.table_select[1],n,r,t),s+=g(e,t.table_select[2],r,a,t)}function w(){this.total=0}function R(e,t){var a,s,n,r,i,o=e.internal_flags;return i=o.w_ptr,-1==(r=o.h_ptr-1)&&(r=G.MAX_HEADER_BUF-1),a=o.header[r].write_timing-l,0<=(t.total=a)&&(s=1+r-i,r<i&&(s=1+r-i+G.MAX_HEADER_BUF),a-=8*s*o.sideinfo_len),a+=n=_.getframebits(e),t.total+=n,t.total%8!=0?t.total=1+t.total/8:t.total=t.total/8,t.total+=p+1,a<0&&$.err.println("strange error flushing buffer ... \n"),a}this.getframebits=function(e){var t,a=e.internal_flags;return t=0!=a.bitrate_index?F.bitrate_table[e.version][a.bitrate_index]:e.brate,8*(0|72e3*(e.version+1)*t/e.out_samplerate+a.padding)},this.CRC_writeheader=function(e,t){var a=65535;a=n(255&t[2],a),a=n(255&t[3],a);for(var s=6;s<e.sideinfo_len;s++)a=n(255&t[s],a);t[4]=byte(a>>8),t[5]=byte(255&a)},this.flush_bitstream=function(e){var t,a,s=e.internal_flags,n=s.h_ptr-1;if(-1==n&&(n=G.MAX_HEADER_BUF-1),t=s.l3_side,!((a=R(e,new w))<0)){if(o(e,a),s.ResvSize=0,t.main_data_begin=0,s.findReplayGain){var r=c.GetTitleGain(s.rgdata);s.RadioGain=0|Math.floor(10*r+.5)}s.findPeakSample&&(s.noclipGainChange=0|Math.ceil(20*B(s.PeakSample/32767)*10),0<s.noclipGainChange&&(EQ(e.scale,1)||EQ(e.scale,0))?s.noclipScale=Math.floor(32767/s.PeakSample*100)/100:s.noclipScale=-1)}},this.add_dummy_byte=function(e,t,a){for(var s,n=e.internal_flags;0<a--;)for(i(0,t,8),s=0;s<G.MAX_HEADER_BUF;++s)n.header[s].write_timing+=8},this.format_bitstream=function(e){var t,a=e.internal_flags;t=a.l3_side;var s=this.getframebits(e);o(e,t.resvDrain_pre),function(e,t){var a,s,n,r=e.internal_flags;if(a=r.l3_side,r.header[r.h_ptr].ptr=0,xe.fill(r.header[r.h_ptr].buf,0,r.sideinfo_len,0),e.out_samplerate<16e3?f(r,4094,12):f(r,4095,12),f(r,e.version,1),f(r,1,2),f(r,e.error_protection?0:1,1),f(r,r.bitrate_index,4),f(r,r.samplerate_index,2),f(r,r.padding,1),f(r,e.extension,1),f(r,e.mode.ordinal(),2),f(r,r.mode_ext,2),f(r,e.copyright,1),f(r,e.original,1),f(r,e.emphasis,2),e.error_protection&&f(r,0,16),1==e.version){for(f(r,a.main_data_begin,9),2==r.channels_out?f(r,a.private_bits,3):f(r,a.private_bits,5),n=0;n<r.channels_out;n++){var i;for(i=0;i<4;i++)f(r,a.scfsi[n][i],1)}for(s=0;s<2;s++)for(n=0;n<r.channels_out;n++)f(r,(o=a.tt[s][n]).part2_3_length+o.part2_length,12),f(r,o.big_values/2,9),f(r,o.global_gain,8),f(r,o.scalefac_compress,4),o.block_type!=Pe.NORM_TYPE?(f(r,1,1),f(r,o.block_type,2),f(r,o.mixed_block_flag,1),14==o.table_select[0]&&(o.table_select[0]=16),f(r,o.table_select[0],5),14==o.table_select[1]&&(o.table_select[1]=16),f(r,o.table_select[1],5),f(r,o.subblock_gain[0],3),f(r,o.subblock_gain[1],3),f(r,o.subblock_gain[2],3)):(f(r,0,1),14==o.table_select[0]&&(o.table_select[0]=16),f(r,o.table_select[0],5),14==o.table_select[1]&&(o.table_select[1]=16),f(r,o.table_select[1],5),14==o.table_select[2]&&(o.table_select[2]=16),f(r,o.table_select[2],5),f(r,o.region0_count,4),f(r,o.region1_count,3)),f(r,o.preflag,1),f(r,o.scalefac_scale,1),f(r,o.count1table_select,1)}else for(f(r,a.main_data_begin,8),f(r,a.private_bits,r.channels_out),n=s=0;n<r.channels_out;n++){var o;f(r,(o=a.tt[s][n]).part2_3_length+o.part2_length,12),f(r,o.big_values/2,9),f(r,o.global_gain,8),f(r,o.scalefac_compress,9),o.block_type!=Pe.NORM_TYPE?(f(r,1,1),f(r,o.block_type,2),f(r,o.mixed_block_flag,1),14==o.table_select[0]&&(o.table_select[0]=16),f(r,o.table_select[0],5),14==o.table_select[1]&&(o.table_select[1]=16),f(r,o.table_select[1],5),f(r,o.subblock_gain[0],3),f(r,o.subblock_gain[1],3),f(r,o.subblock_gain[2],3)):(f(r,0,1),14==o.table_select[0]&&(o.table_select[0]=16),f(r,o.table_select[0],5),14==o.table_select[1]&&(o.table_select[1]=16),f(r,o.table_select[1],5),14==o.table_select[2]&&(o.table_select[2]=16),f(r,o.table_select[2],5),f(r,o.region0_count,4),f(r,o.region1_count,3)),f(r,o.scalefac_scale,1),f(r,o.count1table_select,1)}e.error_protection&&CRC_writeheader(r,r.header[r.h_ptr].buf);var _=r.h_ptr;r.h_ptr=_+1&G.MAX_HEADER_BUF-1,r.header[r.h_ptr].write_timing=r.header[_].write_timing+t,r.h_ptr==r.w_ptr&&$.err.println("Error: MAX_HEADER_BUF too small in bitstream.c \n")}(e,s);var n=8*a.sideinfo_len;if(n+=function(e){var t,a,s,n,r=0,i=e.internal_flags,o=i.l3_side;if(1==e.version)for(t=0;t<2;t++)for(a=0;a<i.channels_out;a++){var _=o.tt[t][a],l=k.slen1_tab[_.scalefac_compress],f=k.slen2_tab[_.scalefac_compress];for(s=n=0;s<_.sfbdivide;s++)-1!=_.scalefac[s]&&(v(i,_.scalefac[s],l),n+=l);for(;s<_.sfbmax;s++)-1!=_.scalefac[s]&&(v(i,_.scalefac[s],f),n+=f);_.block_type==Pe.SHORT_TYPE?n+=S(i,_):n+=M(i,_),r+=n+=d(i,_)}else for(a=t=0;a<i.channels_out;a++){var c,h,u=0;if(h=s=n=0,(_=o.tt[t][a]).block_type==Pe.SHORT_TYPE){for(;h<4;h++){var m=_.sfb_partition_table[h]/3,p=_.slen[h];for(c=0;c<m;c++,s++)v(i,Math.max(_.scalefac[3*s+0],0),p),v(i,Math.max(_.scalefac[3*s+1],0),p),v(i,Math.max(_.scalefac[3*s+2],0),p),u+=3*p}n+=S(i,_)}else{for(;h<4;h++)for(m=_.sfb_partition_table[h],p=_.slen[h],c=0;c<m;c++,s++)v(i,Math.max(_.scalefac[s],0),p),u+=p;n+=M(i,_)}r+=u+(n+=d(i,_))}return r}(e),o(e,t.resvDrain_post),n+=t.resvDrain_post,t.main_data_begin+=(s-n)/8,R(e,new w)!=a.ResvSize&&$.err.println("Internal buffer inconsistency. flushbits <> ResvSize"),8*t.main_data_begin!=a.ResvSize&&($.err.printf("bit reservoir error: \nl3_side.main_data_begin: %d \nResvoir size: %d \nresv drain (post) %d \nresv drain (pre) %d \nheader and sideinfo: %d \ndata bits: %d \ntotal bits: %d (remainder: %d) \nbitsperframe: %d \n",8*t.main_data_begin,a.ResvSize,t.resvDrain_post,t.resvDrain_pre,8*a.sideinfo_len,n-t.resvDrain_post-8*a.sideinfo_len,n,n%8,s),$.err.println("This is a fatal error. It has several possible causes:"),$.err.println("90%% LAME compiled with buggy version of gcc using advanced optimizations"),$.err.println(" 9%% Your system is overclocked"),$.err.println(" 1%% bug in LAME encoding library"),a.ResvSize=8*t.main_data_begin),1e9<l){var r;for(r=0;r<G.MAX_HEADER_BUF;++r)a.header[r].write_timing-=l;l=0}return 0},this.copy_buffer=function(e,t,a,s,n){var r=p+1;if(r<=0)return 0;if(0!=s&&s<r)return-1;if($.arraycopy(m,0,t,a,r),p=-1,(b=0)!=n){var i=Ae(1);if(i[0]=e.nMusicCRC,u.updateMusicCRC(i,t,a,r),e.nMusicCRC=i[0],0<r&&(e.VBR_seek_table.nBytesWritten+=r),e.decode_on_the_fly)for(var o,_=ke([2,1152]),l=r,f=-1;0!=f;)if(f=h.hip_decode1_unclipped(e.hip,t,a,l,_[0],_[1]),l=0,-1==f&&(f=0),0<f){if(e.findPeakSample){for(o=0;o<f;o++)_[0][o]>e.PeakSample?e.PeakSample=_[0][o]:-_[0][o]>e.PeakSample&&(e.PeakSample=-_[0][o]);if(1<e.channels_out)for(o=0;o<f;o++)_[1][o]>e.PeakSample?e.PeakSample=_[1][o]:-_[1][o]>e.PeakSample&&(e.PeakSample=-_[1][o])}if(e.findReplayGain&&c.AnalyzeSamples(e.rgdata,_[0],0,_[1],0,f,e.channels_out)==X.GAIN_ANALYSIS_ERROR)return-6}}return r},this.init_bit_stream_w=function(e){m=A(U.LAME_MAXMP3BUFFER),e.h_ptr=e.w_ptr=0,e.header[e.h_ptr].write_timing=0,p=-1,l=b=0}}function e(e,t,a,s){this.xlen=e,this.linmax=t,this.table=a,this.hlen=s}Ee.STEREO=new Ee(0),Ee.JOINT_STEREO=new Ee(1),Ee.DUAL_CHANNEL=new Ee(2),Ee.MONO=new Ee(3),Ee.NOT_SET=new Ee(4),X.STEPS_per_dB=100,X.MAX_dB=120,X.GAIN_NOT_ENOUGH_SAMPLES=-24601,X.GAIN_ANALYSIS_ERROR=0,X.GAIN_ANALYSIS_OK=1,X.INIT_GAIN_ANALYSIS_ERROR=0,X.INIT_GAIN_ANALYSIS_OK=1,X.MAX_ORDER=X.YULE_ORDER=10,X.MAX_SAMPLES_PER_WINDOW=(X.MAX_SAMP_FREQ=48e3)*(X.RMS_WINDOW_TIME_NUMERATOR=1)/(X.RMS_WINDOW_TIME_DENOMINATOR=20)+1,M.NUMTOCENTRIES=100,M.MAXFRAMESIZE=2880,q.EQ=function(e,t){return Math.abs(e)>Math.abs(t)?Math.abs(e-t)<=1e-6*Math.abs(e):Math.abs(e-t)<=1e-6*Math.abs(t)},q.NEQ=function(e,t){return!q.EQ(e,t)};var F={};function j(e){this.bits=e}function x(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}function r(e,t,a,s){this.l=Ae(1+Pe.SBMAX_l),this.s=Ae(1+Pe.SBMAX_s),this.psfb21=Ae(1+Pe.PSFB21),this.psfb12=Ae(1+Pe.PSFB12);var n=this.l,r=this.s;4==arguments.length&&(this.arrL=e,this.arrS=t,this.arr21=a,this.arr12=s,$.arraycopy(this.arrL,0,n,0,Math.min(this.arrL.length,this.l.length)),$.arraycopy(this.arrS,0,r,0,Math.min(this.arrS.length,this.s.length)),$.arraycopy(this.arr21,0,this.psfb21,0,Math.min(this.arr21.length,this.psfb21.length)),$.arraycopy(this.arr12,0,this.psfb12,0,Math.min(this.arr12.length,this.psfb12.length)))}function T(){var l=null,m=null,s=null;this.setModules=function(e,t,a){l=e,m=t,s=a},this.IPOW20=function(e){return u[e]};var y=2.220446049250313e-16,f=T.IXMAX_VAL+2,c=T.Q_MAX,h=T.Q_MAX2,n=100;this.nr_of_sfb_block=[[[6,5,5,5],[9,9,9,9],[6,9,9,9]],[[6,5,7,3],[9,9,12,6],[6,9,12,6]],[[11,10,0,0],[18,18,0,0],[15,18,0,0]],[[7,7,7,0],[12,12,12,0],[6,15,12,0]],[[6,6,6,3],[12,9,9,6],[6,12,9,6]],[[8,8,5,0],[15,12,9,0],[6,18,9,0]]];var w=[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0];this.pretab=w,this.sfBandIndex=[new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,24,32,42,56,74,100,132,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,332,394,464,540,576],[0,4,8,12,18,26,36,48,62,80,104,136,180,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,44,52,62,74,90,110,134,162,196,238,288,342,418,576],[0,4,8,12,16,22,30,40,52,66,84,106,136,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,42,50,60,72,88,106,128,156,190,230,276,330,384,576],[0,4,8,12,16,22,28,38,50,64,80,100,126,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576],[0,4,8,12,16,22,30,42,58,78,104,138,180,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576],[0,8,16,24,36,52,72,96,124,160,162,164,166,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0])];var R=Be(c+h+1),u=Be(c),p=Be(f),b=Be(f);function v(e,t){var a=s.ATHformula(t,e);return a-=n,a=Math.pow(10,a/10+e.ATHlower)}function A(e){this.s=e}this.adj43=b,this.iteration_init=function(e){var t,a=e.internal_flags,s=a.l3_side;if(0==a.iteration_init_init){for(a.iteration_init_init=1,s.main_data_begin=0,function(e){for(var t=e.internal_flags.ATH.l,a=e.internal_flags.ATH.psfb21,s=e.internal_flags.ATH.s,n=e.internal_flags.ATH.psfb12,r=e.internal_flags,i=e.out_samplerate,o=0;o<Pe.SBMAX_l;o++){var _=r.scalefac_band.l[o],l=r.scalefac_band.l[o+1];t[o]=Z.MAX_VALUE;for(var f=_;f<l;f++){var c=v(e,f*i/1152);t[o]=Math.min(t[o],c)}}for(o=0;o<Pe.PSFB21;o++)for(_=r.scalefac_band.psfb21[o],l=r.scalefac_band.psfb21[o+1],a[o]=Z.MAX_VALUE,f=_;f<l;f++)c=v(e,f*i/1152),a[o]=Math.min(a[o],c);for(o=0;o<Pe.SBMAX_s;o++){for(_=r.scalefac_band.s[o],l=r.scalefac_band.s[o+1],s[o]=Z.MAX_VALUE,f=_;f<l;f++)c=v(e,f*i/384),s[o]=Math.min(s[o],c);s[o]*=r.scalefac_band.s[o+1]-r.scalefac_band.s[o]}for(o=0;o<Pe.PSFB12;o++){for(_=r.scalefac_band.psfb12[o],l=r.scalefac_band.psfb12[o+1],n[o]=Z.MAX_VALUE,f=_;f<l;f++)c=v(e,f*i/384),n[o]=Math.min(n[o],c);n[o]*=r.scalefac_band.s[13]-r.scalefac_band.s[12]}if(e.noATH){for(o=0;o<Pe.SBMAX_l;o++)t[o]=1e-20;for(o=0;o<Pe.PSFB21;o++)a[o]=1e-20;for(o=0;o<Pe.SBMAX_s;o++)s[o]=1e-20;for(o=0;o<Pe.PSFB12;o++)n[o]=1e-20}r.ATH.floor=10*B(v(e,-1))}(e),p[0]=0,t=1;t<f;t++)p[t]=Math.pow(t,4/3);for(t=0;t<f-1;t++)b[t]=t+1-Math.pow(.5*(p[t]+p[t+1]),.75);for(b[t]=.5,t=0;t<c;t++)u[t]=Math.pow(2,-.1875*(t-210));for(t=0;t<=c+h;t++)R[t]=Math.pow(2,.25*(t-210-h));var n,r,i,o;for(l.huffman_init(a),32<=(t=e.exp_nspsytune>>2&63)&&(t-=64),n=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>8&63)&&(t-=64),r=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>14&63)&&(t-=64),i=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>20&63)&&(t-=64),o=i*Math.pow(10,t/4/10),t=0;t<Pe.SBMAX_l;t++){_=t<=6?n:t<=13?r:t<=20?i:o,a.nsPsy.longfact[t]=_}for(t=0;t<Pe.SBMAX_s;t++){var _;_=t<=5?n:t<=10?r:t<=11?i:o,a.nsPsy.shortfact[t]=_}}},this.on_pe=function(e,t,a,s,n,r){var i,o,_=e.internal_flags,l=0,f=Ae(2),c=new j(l),h=m.ResvMaxBits(e,s,c,r),u=(l=c.bits)+h;for(G.MAX_BITS_PER_GRANULE<u&&(u=G.MAX_BITS_PER_GRANULE),o=i=0;o<_.channels_out;++o)a[o]=Math.min(G.MAX_BITS_PER_CHANNEL,l/_.channels_out),f[o]=0|a[o]*t[n][o]/700-a[o],f[o]>3*s/4&&(f[o]=3*s/4),f[o]<0&&(f[o]=0),f[o]+a[o]>G.MAX_BITS_PER_CHANNEL&&(f[o]=Math.max(0,G.MAX_BITS_PER_CHANNEL-a[o])),i+=f[o];if(h<i)for(o=0;o<_.channels_out;++o)f[o]=h*f[o]/i;for(o=0;o<_.channels_out;++o)a[o]+=f[o],h-=f[o];for(o=i=0;o<_.channels_out;++o)i+=a[o];if(G.MAX_BITS_PER_GRANULE<i){for(o=0;o<_.channels_out;++o)a[o]*=G.MAX_BITS_PER_GRANULE,a[o]/=i,a[o]}return u},this.reduce_side=function(e,t,a,s){var n=.33*(.5-t)/.5;n<0&&(n=0),.5<n&&(n=.5);var r=0|.5*n*(e[0]+e[1]);r>G.MAX_BITS_PER_CHANNEL-e[0]&&(r=G.MAX_BITS_PER_CHANNEL-e[0]),r<0&&(r=0),125<=e[1]&&(125<e[1]-r?(e[0]<a&&(e[0]+=r),e[1]-=r):(e[0]+=e[1]-125,e[1]=125)),s<(r=e[0]+e[1])&&(e[0]=s*e[0]/r,e[1]=s*e[1]/r)},this.athAdjust=function(e,t,a){var s=90.30873362,n=ee.FAST_LOG10_X(t,10),r=e*e,i=0;return n-=a,1e-20<r&&(i=1+ee.FAST_LOG10_X(r,10/s)),i<0&&(i=0),n*=i,n+=a+s-94.82444863,Math.pow(10,.1*n)},this.calc_xmin=function(e,t,a,s){var n,r=0,i=e.internal_flags,o=0,_=0,l=i.ATH,f=a.xr,c=e.VBR==Te.vbr_mtrh?1:0,h=i.masking_lower;for(e.VBR!=Te.vbr_mtrh&&e.VBR!=Te.vbr_mt||(h=1),n=0;n<a.psy_lmax;n++){S=(g=e.VBR==Te.vbr_rh||e.VBR==Te.vbr_mtrh?athAdjust(l.adjust,l.l[n],l.floor):l.adjust*l.l[n])/(b=a.width[n]),M=y,B=b>>1,A=0;do{A+=k=f[o]*f[o],M+=k<S?k:S,A+=x=f[++o]*f[o],M+=x<S?x:S,o++}while(0<--B);if(g<A&&_++,n==Pe.SBPSY_l)M<(R=g*i.nsPsy.longfact[n])&&(M=R);if(0!=c&&(g=M),!e.ATHonly)if(0<(w=t.en.l[n]))R=A*t.thm.l[n]*h/w,0!=c&&(R*=i.nsPsy.longfact[n]),g<R&&(g=R);s[r++]=0!=c?g:g*i.nsPsy.longfact[n]}var u=575;if(a.block_type!=Pe.SHORT_TYPE)for(var m=576;0!=m--&&q.EQ(f[m],0);)u=m;a.max_nonzero_coeff=u;for(var p=a.sfb_smin;n<a.psymax;p++,n+=3){var b,v,d;for(d=e.VBR==Te.vbr_rh||e.VBR==Te.vbr_mtrh?athAdjust(l.adjust,l.s[p],l.floor):l.adjust*l.s[p],b=a.width[n],v=0;v<3;v++){var g,S,M,w,R,A=0,B=b>>1;S=d/b,M=y;do{var k,x;A+=k=f[o]*f[o],M+=k<S?k:S,A+=x=f[++o]*f[o],M+=x<S?x:S,o++}while(0<--B);if(d<A&&_++,p==Pe.SBPSY_s)M<(R=d*i.nsPsy.shortfact[p])&&(M=R);if(g=0!=c?M:d,!e.ATHonly&&!e.ATHshort)if(0<(w=t.en.s[p][v]))R=A*t.thm.s[p][v]*h/w,0!=c&&(R*=i.nsPsy.shortfact[p]),g<R&&(g=R);s[r++]=0!=c?g:g*i.nsPsy.shortfact[p]}e.useTemporal&&(s[r-3]>s[r-3+1]&&(s[r-3+1]+=(s[r-3]-s[r-3+1])*i.decay),s[r-3+1]>s[r-3+2]&&(s[r-3+2]+=(s[r-3+1]-s[r-3+2])*i.decay))}return _},this.calc_noise_core=function(e,t,a,s){var n=0,r=t.s,i=e.l3_enc;if(r>e.count1)for(;0!=a--;){_=e.xr[r],r++,n+=_*_,_=e.xr[r],r++,n+=_*_}else if(r>e.big_values){var o=Be(2);for(o[0]=0,o[1]=s;0!=a--;){_=Math.abs(e.xr[r])-o[i[r]],r++,n+=_*_,_=Math.abs(e.xr[r])-o[i[r]],r++,n+=_*_}}else for(;0!=a--;){var _;_=Math.abs(e.xr[r])-p[i[r]]*s,r++,n+=_*_,_=Math.abs(e.xr[r])-p[i[r]]*s,r++,n+=_*_}return t.s=r,n},this.calc_noise=function(e,t,a,s,n){var r,i,o=0,_=0,l=0,f=0,c=0,h=-20,u=0,m=e.scalefac,p=0;for(r=s.over_SSD=0;r<e.psymax;r++){var b,v=e.global_gain-(m[p++]+(0!=e.preflag?w[r]:0)<<e.scalefac_scale+1)-8*e.subblock_gain[e.window[r]],d=0;if(null!=n&&n.step[r]==v)d=n.noise[r],u+=e.width[r],a[o++]=d/t[_++],d=n.noise_log[r];else{var g,S=R[v+T.Q_MAX2];if(i=e.width[r]>>1,u+e.width[r]>e.max_nonzero_coeff)i=0<(g=e.max_nonzero_coeff-u+1)?g>>1:0;var M=new A(u);d=this.calc_noise_core(e,M,i,S),u=M.s,null!=n&&(n.step[r]=v,n.noise[r]=d),d=a[o++]=d/t[_++],d=ee.FAST_LOG10(Math.max(d,1e-20)),null!=n&&(n.noise_log[r]=d)}if(null!=n&&(n.global_gain=e.global_gain),c+=d,0<d)b=Math.max(0|10*d+.5,1),s.over_SSD+=b*b,l++,f+=d;h=Math.max(h,d)}return s.over_count=l,s.tot_noise=c,s.over_noise=f,s.max_noise=h,l},this.set_pinfo=function(e,t,a,s,n){var r,i,o,_,l,f=e.internal_flags,c=0==t.scalefac_scale?.5:1,h=t.scalefac,u=Be(z.SFBMAX),m=Be(z.SFBMAX),p=new x;calc_xmin(e,a,t,u),calc_noise(t,u,m,p,null);var b=0;for(i=t.sfb_lmax,t.block_type!=Pe.SHORT_TYPE&&0==t.mixed_block_flag&&(i=22),r=0;r<i;r++){var v=f.scalefac_band.l[r],d=(g=f.scalefac_band.l[r+1])-v;for(_=0;b<g;b++)_+=t.xr[b]*t.xr[b];_/=d,l=1e15,f.pinfo.en[s][n][r]=l*_,f.pinfo.xfsf[s][n][r]=l*u[r]*m[r]/d,0<a.en.l[r]&&!e.ATHonly?_/=a.en.l[r]:_=0,f.pinfo.thr[s][n][r]=l*Math.max(_*a.thm.l[r],f.ATH.l[r]),(f.pinfo.LAMEsfb[s][n][r]=0)!=t.preflag&&11<=r&&(f.pinfo.LAMEsfb[s][n][r]=-c*w[r]),r<Pe.SBPSY_l&&(f.pinfo.LAMEsfb[s][n][r]-=c*h[r])}if(t.block_type==Pe.SHORT_TYPE)for(i=r,r=t.sfb_smin;r<Pe.SBMAX_s;r++){v=f.scalefac_band.s[r],d=(g=f.scalefac_band.s[r+1])-v;for(var g,S=0;S<3;S++){for(_=0,o=v;o<g;o++)_+=t.xr[b]*t.xr[b],b++;_=Math.max(_/d,1e-20),l=1e15,f.pinfo.en_s[s][n][3*r+S]=l*_,f.pinfo.xfsf_s[s][n][3*r+S]=l*u[i]*m[i]/d,0<a.en.s[r][S]?_/=a.en.s[r][S]:_=0,(e.ATHonly||e.ATHshort)&&(_=0),f.pinfo.thr_s[s][n][3*r+S]=l*Math.max(_*a.thm.s[r][S],f.ATH.s[r]),f.pinfo.LAMEsfb_s[s][n][3*r+S]=-2*t.subblock_gain[S],r<Pe.SBPSY_s&&(f.pinfo.LAMEsfb_s[s][n][3*r+S]-=c*h[i]),i++}}f.pinfo.LAMEqss[s][n]=t.global_gain,f.pinfo.LAMEmainbits[s][n]=t.part2_3_length+t.part2_length,f.pinfo.LAMEsfbits[s][n]=t.part2_length,f.pinfo.over[s][n]=p.over_count,f.pinfo.max_noise[s][n]=10*p.max_noise,f.pinfo.over_noise[s][n]=10*p.over_noise,f.pinfo.tot_noise[s][n]=10*p.tot_noise,f.pinfo.over_SSD[s][n]=p.over_SSD}}function y(){this.xr=Be(576),this.l3_enc=Ae(576),this.scalefac=Ae(z.SFBMAX),this.xrpow_max=0,this.part2_3_length=0,this.big_values=0,this.count1=0,this.global_gain=0,this.scalefac_compress=0,this.block_type=0,this.mixed_block_flag=0,this.table_select=Ae(3),this.subblock_gain=Ae(4),this.region0_count=0,this.region1_count=0,this.preflag=0,this.scalefac_scale=0,this.count1table_select=0,this.part2_length=0,this.sfb_lmax=0,this.sfb_smin=0,this.psy_lmax=0,this.sfbmax=0,this.psymax=0,this.sfbdivide=0,this.width=Ae(z.SFBMAX),this.window=Ae(z.SFBMAX),this.count1bits=0,this.sfb_partition_table=null,this.slen=Ae(4),this.max_nonzero_coeff=0;var a=this;function s(e){return new Int32Array(e)}this.assign=function(e){var t;a.xr=(t=e.xr,new Float32Array(t)),a.l3_enc=s(e.l3_enc),a.scalefac=s(e.scalefac),a.xrpow_max=e.xrpow_max,a.part2_3_length=e.part2_3_length,a.big_values=e.big_values,a.count1=e.count1,a.global_gain=e.global_gain,a.scalefac_compress=e.scalefac_compress,a.block_type=e.block_type,a.mixed_block_flag=e.mixed_block_flag,a.table_select=s(e.table_select),a.subblock_gain=s(e.subblock_gain),a.region0_count=e.region0_count,a.region1_count=e.region1_count,a.preflag=e.preflag,a.scalefac_scale=e.scalefac_scale,a.count1table_select=e.count1table_select,a.part2_length=e.part2_length,a.sfb_lmax=e.sfb_lmax,a.sfb_smin=e.sfb_smin,a.psy_lmax=e.psy_lmax,a.sfbmax=e.sfbmax,a.psymax=e.psymax,a.sfbdivide=e.sfbdivide,a.width=s(e.width),a.window=s(e.window),a.count1bits=e.count1bits,a.sfb_partition_table=e.sfb_partition_table.slice(0),a.slen=s(e.slen),a.max_nonzero_coeff=e.max_nonzero_coeff}}F.t1HB=[1,1,1,0],F.t2HB=[1,2,1,3,1,1,3,2,0],F.t3HB=[3,2,1,1,1,1,3,2,0],F.t5HB=[1,2,6,5,3,1,4,4,7,5,7,1,6,1,1,0],F.t6HB=[7,3,5,1,6,2,3,2,5,4,4,1,3,3,2,0],F.t7HB=[1,2,10,19,16,10,3,3,7,10,5,3,11,4,13,17,8,4,12,11,18,15,11,2,7,6,9,14,3,1,6,4,5,3,2,0],F.t8HB=[3,4,6,18,12,5,5,1,2,16,9,3,7,3,5,14,7,3,19,17,15,13,10,4,13,5,8,11,5,1,12,4,4,1,1,0],F.t9HB=[7,5,9,14,15,7,6,4,5,5,6,7,7,6,8,8,8,5,15,6,9,10,5,1,11,7,9,6,4,1,14,4,6,2,6,0],F.t10HB=[1,2,10,23,35,30,12,17,3,3,8,12,18,21,12,7,11,9,15,21,32,40,19,6,14,13,22,34,46,23,18,7,20,19,33,47,27,22,9,3,31,22,41,26,21,20,5,3,14,13,10,11,16,6,5,1,9,8,7,8,4,4,2,0],F.t11HB=[3,4,10,24,34,33,21,15,5,3,4,10,32,17,11,10,11,7,13,18,30,31,20,5,25,11,19,59,27,18,12,5,35,33,31,58,30,16,7,5,28,26,32,19,17,15,8,14,14,12,9,13,14,9,4,1,11,4,6,6,6,3,2,0],F.t12HB=[9,6,16,33,41,39,38,26,7,5,6,9,23,16,26,11,17,7,11,14,21,30,10,7,17,10,15,12,18,28,14,5,32,13,22,19,18,16,9,5,40,17,31,29,17,13,4,2,27,12,11,15,10,7,4,1,27,12,8,12,6,3,1,0],F.t13HB=[1,5,14,21,34,51,46,71,42,52,68,52,67,44,43,19,3,4,12,19,31,26,44,33,31,24,32,24,31,35,22,14,15,13,23,36,59,49,77,65,29,40,30,40,27,33,42,16,22,20,37,61,56,79,73,64,43,76,56,37,26,31,25,14,35,16,60,57,97,75,114,91,54,73,55,41,48,53,23,24,58,27,50,96,76,70,93,84,77,58,79,29,74,49,41,17,47,45,78,74,115,94,90,79,69,83,71,50,59,38,36,15,72,34,56,95,92,85,91,90,86,73,77,65,51,44,43,42,43,20,30,44,55,78,72,87,78,61,46,54,37,30,20,16,53,25,41,37,44,59,54,81,66,76,57,54,37,18,39,11,35,33,31,57,42,82,72,80,47,58,55,21,22,26,38,22,53,25,23,38,70,60,51,36,55,26,34,23,27,14,9,7,34,32,28,39,49,75,30,52,48,40,52,28,18,17,9,5,45,21,34,64,56,50,49,45,31,19,12,15,10,7,6,3,48,23,20,39,36,35,53,21,16,23,13,10,6,1,4,2,16,15,17,27,25,20,29,11,17,12,16,8,1,1,0,1],F.t15HB=[7,12,18,53,47,76,124,108,89,123,108,119,107,81,122,63,13,5,16,27,46,36,61,51,42,70,52,83,65,41,59,36,19,17,15,24,41,34,59,48,40,64,50,78,62,80,56,33,29,28,25,43,39,63,55,93,76,59,93,72,54,75,50,29,52,22,42,40,67,57,95,79,72,57,89,69,49,66,46,27,77,37,35,66,58,52,91,74,62,48,79,63,90,62,40,38,125,32,60,56,50,92,78,65,55,87,71,51,73,51,70,30,109,53,49,94,88,75,66,122,91,73,56,42,64,44,21,25,90,43,41,77,73,63,56,92,77,66,47,67,48,53,36,20,71,34,67,60,58,49,88,76,67,106,71,54,38,39,23,15,109,53,51,47,90,82,58,57,48,72,57,41,23,27,62,9,86,42,40,37,70,64,52,43,70,55,42,25,29,18,11,11,118,68,30,55,50,46,74,65,49,39,24,16,22,13,14,7,91,44,39,38,34,63,52,45,31,52,28,19,14,8,9,3,123,60,58,53,47,43,32,22,37,24,17,12,15,10,2,1,71,37,34,30,28,20,17,26,21,16,10,6,8,6,2,0],F.t16HB=[1,5,14,44,74,63,110,93,172,149,138,242,225,195,376,17,3,4,12,20,35,62,53,47,83,75,68,119,201,107,207,9,15,13,23,38,67,58,103,90,161,72,127,117,110,209,206,16,45,21,39,69,64,114,99,87,158,140,252,212,199,387,365,26,75,36,68,65,115,101,179,164,155,264,246,226,395,382,362,9,66,30,59,56,102,185,173,265,142,253,232,400,388,378,445,16,111,54,52,100,184,178,160,133,257,244,228,217,385,366,715,10,98,48,91,88,165,157,148,261,248,407,397,372,380,889,884,8,85,84,81,159,156,143,260,249,427,401,392,383,727,713,708,7,154,76,73,141,131,256,245,426,406,394,384,735,359,710,352,11,139,129,67,125,247,233,229,219,393,743,737,720,885,882,439,4,243,120,118,115,227,223,396,746,742,736,721,712,706,223,436,6,202,224,222,218,216,389,386,381,364,888,443,707,440,437,1728,4,747,211,210,208,370,379,734,723,714,1735,883,877,876,3459,865,2,377,369,102,187,726,722,358,711,709,866,1734,871,3458,870,434,0,12,10,7,11,10,17,11,9,13,12,10,7,5,3,1,3],F.t24HB=[15,13,46,80,146,262,248,434,426,669,653,649,621,517,1032,88,14,12,21,38,71,130,122,216,209,198,327,345,319,297,279,42,47,22,41,74,68,128,120,221,207,194,182,340,315,295,541,18,81,39,75,70,134,125,116,220,204,190,178,325,311,293,271,16,147,72,69,135,127,118,112,210,200,188,352,323,306,285,540,14,263,66,129,126,119,114,214,202,192,180,341,317,301,281,262,12,249,123,121,117,113,215,206,195,185,347,330,308,291,272,520,10,435,115,111,109,211,203,196,187,353,332,313,298,283,531,381,17,427,212,208,205,201,193,186,177,169,320,303,286,268,514,377,16,335,199,197,191,189,181,174,333,321,305,289,275,521,379,371,11,668,184,183,179,175,344,331,314,304,290,277,530,383,373,366,10,652,346,171,168,164,318,309,299,287,276,263,513,375,368,362,6,648,322,316,312,307,302,292,284,269,261,512,376,370,364,359,4,620,300,296,294,288,282,273,266,515,380,374,369,365,361,357,2,1033,280,278,274,267,264,259,382,378,372,367,363,360,358,356,0,43,20,19,17,15,13,11,9,7,6,4,7,5,3,1,3],F.t32HB=[1,10,8,20,12,20,16,32,14,12,24,0,28,16,24,16],F.t33HB=[15,28,26,48,22,40,36,64,14,24,20,32,12,16,8,0],F.t1l=[1,4,3,5],F.t2l=[1,4,7,4,5,7,6,7,8],F.t3l=[2,3,7,4,4,7,6,7,8],F.t5l=[1,4,7,8,4,5,8,9,7,8,9,10,8,8,9,10],F.t6l=[3,4,6,8,4,4,6,7,5,6,7,8,7,7,8,9],F.t7l=[1,4,7,9,9,10,4,6,8,9,9,10,7,7,9,10,10,11,8,9,10,11,11,11,8,9,10,11,11,12,9,10,11,12,12,12],F.t8l=[2,4,7,9,9,10,4,4,6,10,10,10,7,6,8,10,10,11,9,10,10,11,11,12,9,9,10,11,12,12,10,10,11,11,13,13],F.t9l=[3,4,6,7,9,10,4,5,6,7,8,10,5,6,7,8,9,10,7,7,8,9,9,10,8,8,9,9,10,11,9,9,10,10,11,11],F.t10l=[1,4,7,9,10,10,10,11,4,6,8,9,10,11,10,10,7,8,9,10,11,12,11,11,8,9,10,11,12,12,11,12,9,10,11,12,12,12,12,12,10,11,12,12,13,13,12,13,9,10,11,12,12,12,13,13,10,10,11,12,12,13,13,13],F.t11l=[2,4,6,8,9,10,9,10,4,5,6,8,10,10,9,10,6,7,8,9,10,11,10,10,8,8,9,11,10,12,10,11,9,10,10,11,11,12,11,12,9,10,11,12,12,13,12,13,9,9,9,10,11,12,12,12,9,9,10,11,12,12,12,12],F.t12l=[4,4,6,8,9,10,10,10,4,5,6,7,9,9,10,10,6,6,7,8,9,10,9,10,7,7,8,8,9,10,10,10,8,8,9,9,10,10,10,11,9,9,10,10,10,11,10,11,9,9,9,10,10,11,11,12,10,10,10,11,11,11,11,12],F.t13l=[1,5,7,8,9,10,10,11,10,11,12,12,13,13,14,14,4,6,8,9,10,10,11,11,11,11,12,12,13,14,14,14,7,8,9,10,11,11,12,12,11,12,12,13,13,14,15,15,8,9,10,11,11,12,12,12,12,13,13,13,13,14,15,15,9,9,11,11,12,12,13,13,12,13,13,14,14,15,15,16,10,10,11,12,12,12,13,13,13,13,14,13,15,15,16,16,10,11,12,12,13,13,13,13,13,14,14,14,15,15,16,16,11,11,12,13,13,13,14,14,14,14,15,15,15,16,18,18,10,10,11,12,12,13,13,14,14,14,14,15,15,16,17,17,11,11,12,12,13,13,13,15,14,15,15,16,16,16,18,17,11,12,12,13,13,14,14,15,14,15,16,15,16,17,18,19,12,12,12,13,14,14,14,14,15,15,15,16,17,17,17,18,12,13,13,14,14,15,14,15,16,16,17,17,17,18,18,18,13,13,14,15,15,15,16,16,16,16,16,17,18,17,18,18,14,14,14,15,15,15,17,16,16,19,17,17,17,19,18,18,13,14,15,16,16,16,17,16,17,17,18,18,21,20,21,18],F.t15l=[3,5,6,8,8,9,10,10,10,11,11,12,12,12,13,14,5,5,7,8,9,9,10,10,10,11,11,12,12,12,13,13,6,7,7,8,9,9,10,10,10,11,11,12,12,13,13,13,7,8,8,9,9,10,10,11,11,11,12,12,12,13,13,13,8,8,9,9,10,10,11,11,11,11,12,12,12,13,13,13,9,9,9,10,10,10,11,11,11,11,12,12,13,13,13,14,10,9,10,10,10,11,11,11,11,12,12,12,13,13,14,14,10,10,10,11,11,11,11,12,12,12,12,12,13,13,13,14,10,10,10,11,11,11,11,12,12,12,12,13,13,14,14,14,10,10,11,11,11,11,12,12,12,13,13,13,13,14,14,14,11,11,11,11,12,12,12,12,12,13,13,13,13,14,15,14,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,15,12,12,11,12,12,12,13,13,13,13,13,13,14,14,15,15,12,12,12,12,12,13,13,13,13,14,14,14,14,14,15,15,13,13,13,13,13,13,13,13,14,14,14,14,15,15,14,15,13,13,13,13,13,13,13,14,14,14,14,14,15,15,15,15],F.t16_5l=[1,5,7,9,10,10,11,11,12,12,12,13,13,13,14,11,4,6,8,9,10,11,11,11,12,12,12,13,14,13,14,11,7,8,9,10,11,11,12,12,13,12,13,13,13,14,14,12,9,9,10,11,11,12,12,12,13,13,14,14,14,15,15,13,10,10,11,11,12,12,13,13,13,14,14,14,15,15,15,12,10,10,11,11,12,13,13,14,13,14,14,15,15,15,16,13,11,11,11,12,13,13,13,13,14,14,14,14,15,15,16,13,11,11,12,12,13,13,13,14,14,15,15,15,15,17,17,13,11,12,12,13,13,13,14,14,15,15,15,15,16,16,16,13,12,12,12,13,13,14,14,15,15,15,15,16,15,16,15,14,12,13,12,13,14,14,14,14,15,16,16,16,17,17,16,13,13,13,13,13,14,14,15,16,16,16,16,16,16,15,16,14,13,14,14,14,14,15,15,15,15,17,16,16,16,16,18,14,15,14,14,14,15,15,16,16,16,18,17,17,17,19,17,14,14,15,13,14,16,16,15,16,16,17,18,17,19,17,16,14,11,11,11,12,12,13,13,13,14,14,14,14,14,14,14,12],F.t16l=[1,5,7,9,10,10,11,11,12,12,12,13,13,13,14,10,4,6,8,9,10,11,11,11,12,12,12,13,14,13,14,10,7,8,9,10,11,11,12,12,13,12,13,13,13,14,14,11,9,9,10,11,11,12,12,12,13,13,14,14,14,15,15,12,10,10,11,11,12,12,13,13,13,14,14,14,15,15,15,11,10,10,11,11,12,13,13,14,13,14,14,15,15,15,16,12,11,11,11,12,13,13,13,13,14,14,14,14,15,15,16,12,11,11,12,12,13,13,13,14,14,15,15,15,15,17,17,12,11,12,12,13,13,13,14,14,15,15,15,15,16,16,16,12,12,12,12,13,13,14,14,15,15,15,15,16,15,16,15,13,12,13,12,13,14,14,14,14,15,16,16,16,17,17,16,12,13,13,13,13,14,14,15,16,16,16,16,16,16,15,16,13,13,14,14,14,14,15,15,15,15,17,16,16,16,16,18,13,15,14,14,14,15,15,16,16,16,18,17,17,17,19,17,13,14,15,13,14,16,16,15,16,16,17,18,17,19,17,16,13,10,10,10,11,11,12,12,12,13,13,13,13,13,13,13,10],F.t24l=[4,5,7,8,9,10,10,11,11,12,12,12,12,12,13,10,5,6,7,8,9,10,10,11,11,11,12,12,12,12,12,10,7,7,8,9,9,10,10,11,11,11,11,12,12,12,13,9,8,8,9,9,10,10,10,11,11,11,11,12,12,12,12,9,9,9,9,10,10,10,10,11,11,11,12,12,12,12,13,9,10,9,10,10,10,10,11,11,11,11,12,12,12,12,12,9,10,10,10,10,10,11,11,11,11,12,12,12,12,12,13,9,11,10,10,10,11,11,11,11,12,12,12,12,12,13,13,10,11,11,11,11,11,11,11,11,11,12,12,12,12,13,13,10,11,11,11,11,11,11,11,12,12,12,12,12,13,13,13,10,12,11,11,11,11,12,12,12,12,12,12,13,13,13,13,10,12,12,11,11,11,12,12,12,12,12,12,13,13,13,13,10,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,10,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,10,13,12,12,12,12,12,12,13,13,13,13,13,13,13,13,10,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,6],F.t32l=[1,5,5,7,5,8,7,9,5,7,7,9,7,9,9,10],F.t33l=[4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8],F.ht=[new e(0,0,null,null),new e(2,0,F.t1HB,F.t1l),new e(3,0,F.t2HB,F.t2l),new e(3,0,F.t3HB,F.t3l),new e(0,0,null,null),new e(4,0,F.t5HB,F.t5l),new e(4,0,F.t6HB,F.t6l),new e(6,0,F.t7HB,F.t7l),new e(6,0,F.t8HB,F.t8l),new e(6,0,F.t9HB,F.t9l),new e(8,0,F.t10HB,F.t10l),new e(8,0,F.t11HB,F.t11l),new e(8,0,F.t12HB,F.t12l),new e(16,0,F.t13HB,F.t13l),new e(0,0,null,F.t16_5l),new e(16,0,F.t15HB,F.t15l),new e(1,1,F.t16HB,F.t16l),new e(2,3,F.t16HB,F.t16l),new e(3,7,F.t16HB,F.t16l),new e(4,15,F.t16HB,F.t16l),new e(6,63,F.t16HB,F.t16l),new e(8,255,F.t16HB,F.t16l),new e(10,1023,F.t16HB,F.t16l),new e(13,8191,F.t16HB,F.t16l),new e(4,15,F.t24HB,F.t24l),new e(5,31,F.t24HB,F.t24l),new e(6,63,F.t24HB,F.t24l),new e(7,127,F.t24HB,F.t24l),new e(8,255,F.t24HB,F.t24l),new e(9,511,F.t24HB,F.t24l),new e(11,2047,F.t24HB,F.t24l),new e(13,8191,F.t24HB,F.t24l),new e(0,0,F.t32HB,F.t32l),new e(0,0,F.t33HB,F.t33l)],F.largetbl=[65540,327685,458759,589832,655369,655370,720906,720907,786443,786444,786444,851980,851980,851980,917517,655370,262149,393222,524295,589832,655369,720906,720906,720907,786443,786443,786444,851980,917516,851980,917516,655370,458759,524295,589832,655369,720905,720906,786442,786443,851979,786443,851979,851980,851980,917516,917517,720905,589832,589832,655369,720905,720906,786442,786442,786443,851979,851979,917515,917516,917516,983052,983052,786441,655369,655369,720905,720906,786442,786442,851978,851979,851979,917515,917516,917516,983052,983052,983053,720905,655370,655369,720906,720906,786442,851978,851979,917515,851979,917515,917516,983052,983052,983052,1048588,786441,720906,720906,720906,786442,851978,851979,851979,851979,917515,917516,917516,917516,983052,983052,1048589,786441,720907,720906,786442,786442,851979,851979,851979,917515,917516,983052,983052,983052,983052,1114125,1114125,786442,720907,786443,786443,851979,851979,851979,917515,917515,983051,983052,983052,983052,1048588,1048589,1048589,786442,786443,786443,786443,851979,851979,917515,917515,983052,983052,983052,983052,1048588,983053,1048589,983053,851978,786444,851979,786443,851979,917515,917516,917516,917516,983052,1048588,1048588,1048589,1114125,1114125,1048589,786442,851980,851980,851979,851979,917515,917516,983052,1048588,1048588,1048588,1048588,1048589,1048589,983053,1048589,851978,851980,917516,917516,917516,917516,983052,983052,983052,983052,1114124,1048589,1048589,1048589,1048589,1179661,851978,983052,917516,917516,917516,983052,983052,1048588,1048588,1048589,1179661,1114125,1114125,1114125,1245197,1114125,851978,917517,983052,851980,917516,1048588,1048588,983052,1048589,1048589,1114125,1179661,1114125,1245197,1114125,1048589,851978,655369,655369,655369,720905,720905,786441,786441,786441,851977,851977,851977,851978,851978,851978,851978,655366],F.table23=[65538,262147,458759,262148,327684,458759,393222,458759,524296],F.table56=[65539,262148,458758,524296,262148,327684,524294,589831,458757,524294,589831,655368,524295,524295,589832,655369],F.bitrate_table=[[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1],[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],[0,8,16,24,32,40,48,56,64,-1,-1,-1,-1,-1,-1,-1]],F.samplerate_table=[[22050,24e3,16e3,-1],[44100,48e3,32e3,-1],[11025,12e3,8e3,-1]],F.scfsi_band=[0,6,11,16,21],T.Q_MAX=257,T.Q_MAX2=116,T.LARGE_BITS=1e5,T.IXMAX_VAL=8206;var z={};function w(){var v,g,M;this.rv=null,this.qupvt=null;var w,n=new function(){this.setModules=function(e,t){}};function R(e){this.ordinal=e}function o(e){for(var t=0;t<e.sfbmax;t++)if(e.scalefac[t]+e.subblock_gain[e.window[t]]==0)return!1;return!0}function A(e,t,a,s,n){var r;switch(e){default:case 9:0<t.over_count?(r=a.over_SSD<=t.over_SSD,a.over_SSD==t.over_SSD&&(r=a.bits<t.bits)):r=a.max_noise<0&&10*a.max_noise+a.bits<=10*t.max_noise+t.bits;break;case 0:r=a.over_count<t.over_count||a.over_count==t.over_count&&a.over_noise<t.over_noise||a.over_count==t.over_count&&q.EQ(a.over_noise,t.over_noise)&&a.tot_noise<t.tot_noise;break;case 8:a.max_noise=function(e,t){for(var a,s=1e-37,n=0;n<t.psymax;n++)s+=(a=e[n],ee.FAST_LOG10(.368+.632*a*a*a));return Math.max(1e-20,s)}(n,s);case 1:r=a.max_noise<t.max_noise;break;case 2:r=a.tot_noise<t.tot_noise;break;case 3:r=a.tot_noise<t.tot_noise&&a.max_noise<t.max_noise;break;case 4:r=a.max_noise<=0&&.2<t.max_noise||a.max_noise<=0&&t.max_noise<0&&t.max_noise>a.max_noise-.2&&a.tot_noise<t.tot_noise||a.max_noise<=0&&0<t.max_noise&&t.max_noise>a.max_noise-.2&&a.tot_noise<t.tot_noise+t.over_noise||0<a.max_noise&&-.05<t.max_noise&&t.max_noise>a.max_noise-.1&&a.tot_noise+a.over_noise<t.tot_noise+t.over_noise||0<a.max_noise&&-.1<t.max_noise&&t.max_noise>a.max_noise-.15&&a.tot_noise+a.over_noise+a.over_noise<t.tot_noise+t.over_noise+t.over_noise;break;case 5:r=a.over_noise<t.over_noise||q.EQ(a.over_noise,t.over_noise)&&a.tot_noise<t.tot_noise;break;case 6:r=a.over_noise<t.over_noise||q.EQ(a.over_noise,t.over_noise)&&(a.max_noise<t.max_noise||q.EQ(a.max_noise,t.max_noise)&&a.tot_noise<=t.tot_noise);break;case 7:r=a.over_count<t.over_count||a.over_noise<t.over_noise}return 0==t.over_count&&(r=r&&a.bits<t.bits),r}function B(e,t,a,s,n){var r=e.internal_flags;!function(e,t,a,s,n){var r,i=e.internal_flags;r=0==t.scalefac_scale?1.2968395546510096:1.6817928305074292;for(var o=0,_=0;_<t.sfbmax;_++)o<a[_]&&(o=a[_]);var l=i.noise_shaping_amp;switch(3==l&&(l=n?2:1),l){case 2:break;case 1:1<o?o=Math.pow(o,.5):o*=.95;break;case 0:default:1<o?o=1:o*=.95}var f=0;for(_=0;_<t.sfbmax;_++){var c,h=t.width[_];if(f+=h,!(a[_]<o)){if(0!=(2&i.substep_shaping)&&(i.pseudohalf[_]=0==i.pseudohalf[_]?1:0,0==i.pseudohalf[_]&&2==i.noise_shaping_amp))return;for(t.scalefac[_]++,c=-h;c<0;c++)s[f+c]*=r,s[f+c]>t.xrpow_max&&(t.xrpow_max=s[f+c]);if(2==i.noise_shaping_amp)return}}}(e,t,a,s,n);var i=o(t);return!i&&(!(i=2==r.mode_gr?w.scale_bitcount(t):w.scale_bitcount_lsf(r,t))||(1<r.noise_shaping&&(xe.fill(r.pseudohalf,0),0==t.scalefac_scale?(!function(e,t){for(var a=0,s=0;s<e.sfbmax;s++){var n=e.width[s],r=e.scalefac[s];if(0!=e.preflag&&(r+=M.pretab[s]),a+=n,0!=(1&r)){r++;for(var i=-n;i<0;i++)t[a+i]*=1.2968395546510096,t[a+i]>e.xrpow_max&&(e.xrpow_max=t[a+i])}e.scalefac[s]=r>>1}e.preflag=0,e.scalefac_scale=1}(t,s),i=!1):t.block_type==Pe.SHORT_TYPE&&0<r.subblock_gain&&(i=function(e,t,a){var s,n=t.scalefac;for(s=0;s<t.sfb_lmax;s++)if(16<=n[s])return!0;for(var r=0;r<3;r++){var i=0,o=0;for(s=t.sfb_lmax+r;s<t.sfbdivide;s+=3)i<n[s]&&(i=n[s]);for(;s<t.sfbmax;s+=3)o<n[s]&&(o=n[s]);if(!(i<16&&o<8)){if(7<=t.subblock_gain[r])return!0;t.subblock_gain[r]++;var _=e.scalefac_band.l[t.sfb_lmax];for(s=t.sfb_lmax+r;s<t.sfbmax;s+=3){var l=t.width[s],f=n[s];if(0<=(f-=4>>t.scalefac_scale))n[s]=f,_+=3*l;else{n[s]=0;var c=210+(f<<t.scalefac_scale+1);u=M.IPOW20(c),_+=l*(r+1);for(var h=-l;h<0;h++)a[_+h]*=u,a[_+h]>t.xrpow_max&&(t.xrpow_max=a[_+h]);_+=l*(3-r-1)}}var u=M.IPOW20(202);for(_+=t.width[s]*(r+1),h=-t.width[s];h<0;h++)a[_+h]*=u,a[_+h]>t.xrpow_max&&(t.xrpow_max=a[_+h])}}return!1}(r,t,s)||o(t))),i||(i=2==r.mode_gr?w.scale_bitcount(t):w.scale_bitcount_lsf(r,t)),!i))}this.setModules=function(e,t,a,s){v=e,g=t,this.rv=t,M=a,this.qupvt=a,w=s,n.setModules(M,w)},this.ms_convert=function(e,t){for(var a=0;a<576;++a){var s=e.tt[t][0].xr[a],n=e.tt[t][1].xr[a];e.tt[t][0].xr[a]=(s+n)*(.5*ee.SQRT2),e.tt[t][1].xr[a]=(s-n)*(.5*ee.SQRT2)}},this.init_xrpow=function(e,t,a){var s=0,n=0|t.max_nonzero_coeff;if(t.xrpow_max=0,xe.fill(a,n,576,0),1e-20<(s=function(e,t,a,s){for(var n=s=0;n<=a;++n){var r=Math.abs(e.xr[n]);s+=r,t[n]=Math.sqrt(r*Math.sqrt(r)),t[n]>e.xrpow_max&&(e.xrpow_max=t[n])}return s}(t,a,n,s))){var r=0;0!=(2&e.substep_shaping)&&(r=1);for(var i=0;i<t.psymax;i++)e.pseudohalf[i]=r;return!0}return xe.fill(t.l3_enc,0,576,0),!1},this.init_outer_loop=function(e,t){t.part2_3_length=0,t.big_values=0,t.count1=0,t.global_gain=210,t.scalefac_compress=0,t.table_select[0]=0,t.table_select[1]=0,t.table_select[2]=0,t.subblock_gain[0]=0,t.subblock_gain[1]=0,t.subblock_gain[2]=0,t.subblock_gain[3]=0,t.region0_count=0,t.region1_count=0,t.preflag=0,t.scalefac_scale=0,t.count1table_select=0,t.part2_length=0,t.sfb_lmax=Pe.SBPSY_l,t.sfb_smin=Pe.SBPSY_s,t.psy_lmax=e.sfb21_extra?Pe.SBMAX_l:Pe.SBPSY_l,t.psymax=t.psy_lmax,t.sfbmax=t.sfb_lmax,t.sfbdivide=11;for(var a=0;a<Pe.SBMAX_l;a++)t.width[a]=e.scalefac_band.l[a+1]-e.scalefac_band.l[a],t.window[a]=3;if(t.block_type==Pe.SHORT_TYPE){var s=Be(576);t.sfb_smin=0,(t.sfb_lmax=0)!=t.mixed_block_flag&&(t.sfb_smin=3,t.sfb_lmax=2*e.mode_gr+4),t.psymax=t.sfb_lmax+3*((e.sfb21_extra?Pe.SBMAX_s:Pe.SBPSY_s)-t.sfb_smin),t.sfbmax=t.sfb_lmax+3*(Pe.SBPSY_s-t.sfb_smin),t.sfbdivide=t.sfbmax-18,t.psy_lmax=t.sfb_lmax;var n=e.scalefac_band.l[t.sfb_lmax];$.arraycopy(t.xr,0,s,0,576);for(a=t.sfb_smin;a<Pe.SBMAX_s;a++)for(var r=e.scalefac_band.s[a],i=e.scalefac_band.s[a+1],o=0;o<3;o++)for(var _=r;_<i;_++)t.xr[n++]=s[3*_+o];var l=t.sfb_lmax;for(a=t.sfb_smin;a<Pe.SBMAX_s;a++)t.width[l]=t.width[l+1]=t.width[l+2]=e.scalefac_band.s[a+1]-e.scalefac_band.s[a],t.window[l]=0,t.window[l+1]=1,t.window[l+2]=2,l+=3}t.count1bits=0,t.sfb_partition_table=M.nr_of_sfb_block[0][0],t.slen[0]=0,t.slen[1]=0,t.slen[2]=0,t.slen[3]=0,t.max_nonzero_coeff=575,xe.fill(t.scalefac,0),function(e,t){var a=e.ATH,s=t.xr;if(t.block_type!=Pe.SHORT_TYPE)for(var n=!1,r=Pe.PSFB21-1;0<=r&&!n;r--){var i=e.scalefac_band.psfb21[r],o=e.scalefac_band.psfb21[r+1],_=M.athAdjust(a.adjust,a.psfb21[r],a.floor);1e-12<e.nsPsy.longfact[21]&&(_*=e.nsPsy.longfact[21]);for(var l=o-1;i<=l;l--){if(!(Math.abs(s[l])<_)){n=!0;break}s[l]=0}}else for(var f=0;f<3;f++)for(n=!1,r=Pe.PSFB12-1;0<=r&&!n;r--){o=(i=3*e.scalefac_band.s[12]+(e.scalefac_band.s[13]-e.scalefac_band.s[12])*f+(e.scalefac_band.psfb12[r]-e.scalefac_band.psfb12[0]))+(e.scalefac_band.psfb12[r+1]-e.scalefac_band.psfb12[r]);var c=M.athAdjust(a.adjust,a.psfb12[r],a.floor);for(1e-12<e.nsPsy.shortfact[12]&&(c*=e.nsPsy.shortfact[12]),l=o-1;i<=l;l--){if(!(Math.abs(s[l])<c)){n=!0;break}s[l]=0}}}(e,t)},R.BINSEARCH_NONE=new R(0),R.BINSEARCH_UP=new R(1),R.BINSEARCH_DOWN=new R(2),this.trancate_smallspectrums=function(e,t,a,s){var n=Be(z.SFBMAX);if((0!=(4&e.substep_shaping)||t.block_type!=Pe.SHORT_TYPE)&&0==(128&e.substep_shaping)){M.calc_noise(t,a,n,new x,null);for(var r=0;r<576;r++){var i=0;0!=t.l3_enc[r]&&(i=Math.abs(t.xr[r])),s[r]=i}r=0;var o=8;t.block_type==Pe.SHORT_TYPE&&(o=6);do{var _,l,f,c,h=t.width[o];if(r+=h,!(1<=n[o]||(xe.sort(s,r-h,h),q.EQ(s[r-1],0)))){_=(1-n[o])*a[o],c=l=0;do{var u;for(f=1;c+f<h&&!q.NEQ(s[c+r-h],s[c+r+f-h]);f++);if(_<(u=s[c+r-h]*s[c+r-h]*f)){0!=c&&(l=s[c+r-h-1]);break}_-=u,c+=f}while(c<h);if(!q.EQ(l,0))for(;Math.abs(t.xr[r-h])<=l&&(t.l3_enc[r-h]=0),0<--h;);}}while(++o<t.psymax);t.part2_3_length=w.noquant_count_bits(e,t,null)}},this.outer_loop=function(e,t,a,s,n,r){var i=e.internal_flags,o=new y,_=Be(576),l=Be(z.SFBMAX),f=new x,c=new function(){this.global_gain=0,this.sfb_count1=0,this.step=Ae(39),this.noise=Be(39),this.noise_log=Be(39)},h=9999999,u=!1,m=!1,p=0;if(function(e,t,a,s,n){var r,i=e.CurrentStep[s],o=!1,_=e.OldValue[s],l=R.BINSEARCH_NONE;for(t.global_gain=_,a-=t.part2_length;;){var f;if(r=w.count_bits(e,n,t,null),1==i||r==a)break;a<r?(l==R.BINSEARCH_DOWN&&(o=!0),o&&(i/=2),l=R.BINSEARCH_UP,f=i):(l==R.BINSEARCH_UP&&(o=!0),o&&(i/=2),l=R.BINSEARCH_DOWN,f=-i),t.global_gain+=f,t.global_gain<0&&(o=!(t.global_gain=0)),255<t.global_gain&&(t.global_gain=255,o=!0)}for(;a<r&&t.global_gain<255;)t.global_gain++,r=w.count_bits(e,n,t,null);e.CurrentStep[s]=4<=_-t.global_gain?4:2,e.OldValue[s]=t.global_gain,t.part2_3_length=r}(i,t,r,n,s),0==i.noise_shaping)return 100;M.calc_noise(t,a,l,f,c),f.bits=t.part2_3_length,o.assign(t);var b=0;for($.arraycopy(s,0,_,0,576);!u;){do{var v,d=new x,g=255;if(v=0!=(2&i.substep_shaping)?20:3,i.sfb21_extra){if(1<l[o.sfbmax])break;if(o.block_type==Pe.SHORT_TYPE&&(1<l[o.sfbmax+1]||1<l[o.sfbmax+2]))break}if(!B(e,o,l,s,m))break;0!=o.scalefac_scale&&(g=254);var S=r-o.part2_length;if(S<=0)break;for(;(o.part2_3_length=w.count_bits(i,s,o,c))>S&&o.global_gain<=g;)o.global_gain++;if(o.global_gain>g)break;if(0==f.over_count){for(;(o.part2_3_length=w.count_bits(i,s,o,c))>h&&o.global_gain<=g;)o.global_gain++;if(o.global_gain>g)break}if(M.calc_noise(o,a,l,d,c),d.bits=o.part2_3_length,0!=(A(t.block_type!=Pe.SHORT_TYPE?e.quant_comp:e.quant_comp_short,f,d,o,l)?1:0))h=t.part2_3_length,f=d,t.assign(o),b=0,$.arraycopy(s,0,_,0,576);else if(0==i.full_outer_loop){if(++b>v&&0==f.over_count)break;if(3==i.noise_shaping_amp&&m&&30<b)break;if(3==i.noise_shaping_amp&&m&&15<o.global_gain-p)break}}while(o.global_gain+o.scalefac_scale<255);3==i.noise_shaping_amp?m?u=!0:(o.assign(t),$.arraycopy(_,0,s,0,576),b=0,p=o.global_gain,m=!0):u=!0}return e.VBR==Te.vbr_rh||e.VBR==Te.vbr_mtrh?$.arraycopy(_,0,s,0,576):0!=(1&i.substep_shaping)&&trancate_smallspectrums(i,t,a,s),f.over_count},this.iteration_finish_one=function(e,t,a){var s=e.l3_side,n=s.tt[t][a];w.best_scalefac_store(e,t,a,s),1==e.use_best_huffman&&w.best_huffman_divide(e,n),g.ResvAdjust(e,n)},this.VBR_encode_granule=function(e,t,a,s,n,r,i){var o,_=e.internal_flags,l=new y,f=Be(576),c=i,h=i+1,u=(i+r)/2,m=0,p=_.sfb21_extra;for(xe.fill(l.l3_enc,0);_.sfb21_extra=!(c-42<u)&&p,outer_loop(e,t,a,s,n,u)<=0?(m=1,h=t.part2_3_length,l.assign(t),$.arraycopy(s,0,f,0,576),o=(i=h-32)-r,u=(i+r)/2):(o=i-(r=u+32),u=(i+r)/2,0!=m&&(m=2,t.assign(l),$.arraycopy(f,0,s,0,576))),12<o;);_.sfb21_extra=p,2==m&&$.arraycopy(l.l3_enc,0,t.l3_enc,0,576)},this.get_framebits=function(e,t){var a=e.internal_flags;a.bitrate_index=a.VBR_min_bitrate;var s=v.getframebits(e);a.bitrate_index=1,s=v.getframebits(e);for(var n=1;n<=a.VBR_max_bitrate;n++){a.bitrate_index=n;var r=new j(s);t[n]=g.ResvFrameBegin(e,r),s=r.bits}},this.VBR_old_prepare=function(e,t,a,s,n,r,i,o,_){var l,f=e.internal_flags,c=0,h=1,u=0;f.bitrate_index=f.VBR_max_bitrate;var m=g.ResvFrameBegin(e,new j(0))/f.mode_gr;get_framebits(e,r);for(var p=0;p<f.mode_gr;p++){var b=M.on_pe(e,t,o[p],m,p,0);f.mode_ext==Pe.MPG_MD_MS_LR&&(ms_convert(f.l3_side,p),M.reduce_side(o[p],a[p],m,b));for(var v=0;v<f.channels_out;++v){var d=f.l3_side.tt[p][v];d.block_type!=Pe.SHORT_TYPE?(c=1.28/(1+Math.exp(3.5-t[p][v]/300))-.05,l=f.PSY.mask_adjust-c):(c=2.56/(1+Math.exp(3.5-t[p][v]/300))-.14,l=f.PSY.mask_adjust_short-c),f.masking_lower=Math.pow(10,.1*l),init_outer_loop(f,d),_[p][v]=M.calc_xmin(e,s[p][v],d,n[p][v]),0!=_[p][v]&&(h=0),i[p][v]=126,u+=o[p][v]}}for(p=0;p<f.mode_gr;p++)for(v=0;v<f.channels_out;v++)u>r[f.VBR_max_bitrate]&&(o[p][v]*=r[f.VBR_max_bitrate],o[p][v]/=u),i[p][v]>o[p][v]&&(i[p][v]=o[p][v]);return h},this.bitpressure_strategy=function(e,t,a,s){for(var n=0;n<e.mode_gr;n++)for(var r=0;r<e.channels_out;r++){for(var i=e.l3_side.tt[n][r],o=t[n][r],_=0,l=0;l<i.psy_lmax;l++)o[_++]*=1+.029*l*l/Pe.SBMAX_l/Pe.SBMAX_l;if(i.block_type==Pe.SHORT_TYPE)for(l=i.sfb_smin;l<Pe.SBMAX_s;l++)o[_++]*=1+.029*l*l/Pe.SBMAX_s/Pe.SBMAX_s,o[_++]*=1+.029*l*l/Pe.SBMAX_s/Pe.SBMAX_s,o[_++]*=1+.029*l*l/Pe.SBMAX_s/Pe.SBMAX_s;s[n][r]=0|Math.max(a[n][r],.9*s[n][r])}},this.VBR_new_prepare=function(e,t,a,s,n,r){var i,o=e.internal_flags,_=1,l=0,f=0;if(e.free_format){o.bitrate_index=0;c=new j(l);i=g.ResvFrameBegin(e,c),l=c.bits,n[0]=i}else{o.bitrate_index=o.VBR_max_bitrate;var c=new j(l);g.ResvFrameBegin(e,c),l=c.bits,get_framebits(e,n),i=n[o.VBR_max_bitrate]}for(var h=0;h<o.mode_gr;h++){M.on_pe(e,t,r[h],l,h,0),o.mode_ext==Pe.MPG_MD_MS_LR&&ms_convert(o.l3_side,h);for(var u=0;u<o.channels_out;++u){var m=o.l3_side.tt[h][u];o.masking_lower=Math.pow(10,.1*o.PSY.mask_adjust),init_outer_loop(o,m),0!=M.calc_xmin(e,a[h][u],m,s[h][u])&&(_=0),f+=r[h][u]}}for(h=0;h<o.mode_gr;h++)for(u=0;u<o.channels_out;u++)i<f&&(r[h][u]*=i,r[h][u]/=f);return _},this.calc_target_bits=function(e,t,a,s,n,r){var i,o,_,l,f=e.internal_flags,c=f.l3_side,h=0;f.bitrate_index=f.VBR_max_bitrate;var u=new j(h);for(r[0]=g.ResvFrameBegin(e,u),h=u.bits,f.bitrate_index=1,h=v.getframebits(e)-8*f.sideinfo_len,n[0]=h/(f.mode_gr*f.channels_out),h=e.VBR_mean_bitrate_kbps*e.framesize*1e3,0!=(1&f.substep_shaping)&&(h*=1.09),h/=e.out_samplerate,h-=8*f.sideinfo_len,h/=f.mode_gr*f.channels_out,(i=.93+.07*(11-e.compression_ratio)/5.5)<.9&&(i=.9),1<i&&(i=1),o=0;o<f.mode_gr;o++){var m=0;for(_=0;_<f.channels_out;_++){if(s[o][_]=int(i*h),700<t[o][_]){var p=int((t[o][_]-700)/1.4),b=c.tt[o][_];s[o][_]=int(i*h),b.block_type==Pe.SHORT_TYPE&&p<h/2&&(p=h/2),3*h/2<p?p=3*h/2:p<0&&(p=0),s[o][_]+=p}s[o][_]>G.MAX_BITS_PER_CHANNEL&&(s[o][_]=G.MAX_BITS_PER_CHANNEL),m+=s[o][_]}if(G.MAX_BITS_PER_GRANULE<m)for(_=0;_<f.channels_out;++_)s[o][_]*=G.MAX_BITS_PER_GRANULE,s[o][_]/=m}if(f.mode_ext==Pe.MPG_MD_MS_LR)for(o=0;o<f.mode_gr;o++)M.reduce_side(s[o],a[o],h*f.channels_out,G.MAX_BITS_PER_GRANULE);for(o=l=0;o<f.mode_gr;o++)for(_=0;_<f.channels_out;_++)s[o][_]>G.MAX_BITS_PER_CHANNEL&&(s[o][_]=G.MAX_BITS_PER_CHANNEL),l+=s[o][_];if(l>r[0])for(o=0;o<f.mode_gr;o++)for(_=0;_<f.channels_out;_++)s[o][_]*=r[0],s[o][_]/=l}}function N(){this.thm=new i,this.en=new i}function Pe(){var E=Pe.FFTOFFSET,P=Pe.MPG_MD_MS_LR,I=null,L=this.psy=null,H=null,C=null;this.setModules=function(e,t,a,s){I=e,this.psy=t,L=t,H=s,C=a};var O=new function(){var h=[-.1482523854003001,32.308141959636465,296.40344946382766,883.1344870032432,11113.947376231741,1057.2713659324597,305.7402417275812,30.825928907280012,3.8533188138216365,59.42900443849514,709.5899960123345,5281.91112291017,-5829.66483675846,-817.6293103748613,-76.91656988279972,-4.594269939176596,.9063471690191471,.1960342806591213,-.15466694054279598,34.324387823855965,301.8067566458425,817.599602898885,11573.795901679885,1181.2520595540152,321.59731579894424,31.232021761053772,3.7107095756221318,53.650946155329365,684.167428119626,5224.56624370173,-6366.391851890084,-908.9766368219582,-89.83068876699639,-5.411397422890401,.8206787908286602,.3901806440322567,-.16070888947830023,36.147034243915876,304.11815768187864,732.7429163887613,11989.60988270091,1300.012278487897,335.28490093152146,31.48816102859945,3.373875931311736,47.232241542899175,652.7371796173471,5132.414255594984,-6909.087078780055,-1001.9990371107289,-103.62185754286375,-6.104916304710272,.7416505462720353,.5805693545089249,-.16636367662261495,37.751650073343995,303.01103387567713,627.9747488785183,12358.763425278165,1412.2779918482834,346.7496836825721,31.598286663170416,3.1598635433980946,40.57878626349686,616.1671130880391,5007.833007176154,-7454.040671756168,-1095.7960341867115,-118.24411666465777,-6.818469345853504,.6681786379192989,.7653668647301797,-.1716176790982088,39.11551877123304,298.3413246578966,503.5259106886539,12679.589408408976,1516.5821921214542,355.9850766329023,31.395241710249053,2.9164211881972335,33.79716964664243,574.8943997801362,4853.234992253242,-7997.57021486075,-1189.7624067269965,-133.6444792601766,-7.7202770609839915,.5993769336819237,.9427934736519954,-.17645823955292173,40.21879108166477,289.9982036694474,359.3226160751053,12950.259102786438,1612.1013903507662,362.85067106591504,31.045922092242872,2.822222032597987,26.988862316190684,529.8996541764288,4671.371946949588,-8535.899136645805,-1282.5898586244496,-149.58553632943463,-8.643494270763135,.5345111359507916,1.111140466039205,-.36174739330527045,41.04429910497807,277.5463268268618,195.6386023135583,13169.43812144731,1697.6433561479398,367.40983966190305,30.557037410382826,2.531473372857427,20.070154905927314,481.50208566532336,4464.970341588308,-9065.36882077239,-1373.62841526722,-166.1660487028118,-9.58289321133207,.4729647758913199,1.268786568327291,-.36970682634889585,41.393213350082036,261.2935935556502,12.935476055240873,13336.131683328815,1772.508612059496,369.76534388639965,29.751323653701338,2.4023193045459172,13.304795348228817,430.5615775526625,4237.0568611071185,-9581.931701634761,-1461.6913552409758,-183.12733958476446,-10.718010163869403,.41421356237309503,1.414213562373095,-.37677560326535325,41.619486213528496,241.05423794991074,-187.94665032361226,13450.063605744153,1836.153896465782,369.4908799925761,29.001847876923147,2.0714759319987186,6.779591200894186,377.7767837205709,3990.386575512536,-10081.709459700915,-1545.947424837898,-200.3762958015653,-11.864482073055006,.3578057213145241,1.546020906725474,-.3829366947518991,41.1516456456653,216.47684307105183,-406.1569483347166,13511.136535077321,1887.8076599260432,367.3025214564151,28.136213436723654,1.913880671464418,.3829366947518991,323.85365704338597,3728.1472257487526,-10561.233882199509,-1625.2025997821418,-217.62525175416,-13.015432208941645,.3033466836073424,1.66293922460509,-.5822628872992417,40.35639251440489,188.20071124269245,-640.2706748618148,13519.21490106562,1927.6022433578062,362.8197642637487,26.968821921868447,1.7463817695935329,-5.62650678237171,269.3016715297017,3453.386536448852,-11016.145278780888,-1698.6569643425091,-234.7658734267683,-14.16351421663124,.2504869601913055,1.76384252869671,-.5887180101749253,39.23429103868072,155.76096234403798,-889.2492977967378,13475.470561874661,1955.0535223723712,356.4450994756727,25.894952980042156,1.5695032905781554,-11.181939564328772,214.80884394039484,3169.1640829158237,-11443.321309975563,-1765.1588461316153,-251.68908574481912,-15.49755935939164,.198912367379658,1.847759065022573,-.7912582233652842,37.39369355329111,119.699486012458,-1151.0956593239027,13380.446257078214,1970.3952110853447,348.01959814116185,24.731487364283044,1.3850130831637748,-16.421408865300393,161.05030052864092,2878.3322807850063,-11838.991423510031,-1823.985884688674,-268.2854986386903,-16.81724543849939,.1483359875383474,1.913880671464418,-.7960642926861912,35.2322109610459,80.01928065061526,-1424.0212633405113,13235.794061869668,1973.804052543835,337.9908651258184,23.289159354463873,1.3934255946442087,-21.099669467133474,108.48348407242611,2583.700758091299,-12199.726194855148,-1874.2780658979746,-284.2467154529415,-18.11369784385905,.09849140335716425,1.961570560806461,-.998795456205172,32.56307803611191,36.958364584370486,-1706.075448829146,13043.287458812016,1965.3831106103316,326.43182772364605,22.175018750622293,1.198638339011324,-25.371248002043963,57.53505923036915,2288.41886619975,-12522.674544337233,-1914.8400385312243,-299.26241273417224,-19.37805630698734,.04912684976946725,1.990369453344394,.035780907*ee.SQRT2*.5/2384e-9,.017876148*ee.SQRT2*.5/2384e-9,.003134727*ee.SQRT2*.5/2384e-9,.002457142*ee.SQRT2*.5/2384e-9,971317e-9*ee.SQRT2*.5/2384e-9,218868e-9*ee.SQRT2*.5/2384e-9,101566e-9*ee.SQRT2*.5/2384e-9,13828e-9*ee.SQRT2*.5/2384e-9,12804.797818791945,1945.5515939597317,313.4244966442953,49591e-9/2384e-9,1995.1556208053692,21458e-9/2384e-9,-69618e-9/2384e-9],z=[[2.382191739347913e-13,6.423305872147834e-13,9.400849094049688e-13,1.122435026096556e-12,1.183840321267481e-12,1.122435026096556e-12,9.40084909404969e-13,6.423305872147839e-13,2.382191739347918e-13,5.456116108943412e-12,4.878985199565852e-12,4.240448995017367e-12,3.559909094758252e-12,2.858043359288075e-12,2.156177623817898e-12,1.475637723558783e-12,8.371015190102974e-13,2.599706096327376e-13,-5.456116108943412e-12,-4.878985199565852e-12,-4.240448995017367e-12,-3.559909094758252e-12,-2.858043359288076e-12,-2.156177623817898e-12,-1.475637723558783e-12,-8.371015190102975e-13,-2.599706096327376e-13,-2.382191739347923e-13,-6.423305872147843e-13,-9.400849094049696e-13,-1.122435026096556e-12,-1.183840321267481e-12,-1.122435026096556e-12,-9.400849094049694e-13,-6.42330587214784e-13,-2.382191739347918e-13],[2.382191739347913e-13,6.423305872147834e-13,9.400849094049688e-13,1.122435026096556e-12,1.183840321267481e-12,1.122435026096556e-12,9.400849094049688e-13,6.423305872147841e-13,2.382191739347918e-13,5.456116108943413e-12,4.878985199565852e-12,4.240448995017367e-12,3.559909094758253e-12,2.858043359288075e-12,2.156177623817898e-12,1.475637723558782e-12,8.371015190102975e-13,2.599706096327376e-13,-5.461314069809755e-12,-4.921085770524055e-12,-4.343405037091838e-12,-3.732668368707687e-12,-3.093523840190885e-12,-2.430835727329465e-12,-1.734679010007751e-12,-9.74825365660928e-13,-2.797435120168326e-13,0,0,0,0,0,0,-2.283748241799531e-13,-4.037858874020686e-13,-2.146547464825323e-13],[.1316524975873958,.414213562373095,.7673269879789602,1.091308501069271,1.303225372841206,1.56968557711749,1.920982126971166,2.414213562373094,3.171594802363212,4.510708503662055,7.595754112725146,22.90376554843115,.984807753012208,.6427876096865394,.3420201433256688,.9396926207859084,-.1736481776669303,-.7660444431189779,.8660254037844387,.5,-.5144957554275265,-.4717319685649723,-.3133774542039019,-.1819131996109812,-.09457419252642064,-.04096558288530405,-.01419856857247115,-.003699974673760037,.8574929257125442,.8817419973177052,.9496286491027329,.9833145924917901,.9955178160675857,.9991605581781475,.999899195244447,.9999931550702802],[0,0,0,0,0,0,2.283748241799531e-13,4.037858874020686e-13,2.146547464825323e-13,5.461314069809755e-12,4.921085770524055e-12,4.343405037091838e-12,3.732668368707687e-12,3.093523840190885e-12,2.430835727329466e-12,1.734679010007751e-12,9.74825365660928e-13,2.797435120168326e-13,-5.456116108943413e-12,-4.878985199565852e-12,-4.240448995017367e-12,-3.559909094758253e-12,-2.858043359288075e-12,-2.156177623817898e-12,-1.475637723558782e-12,-8.371015190102975e-13,-2.599706096327376e-13,-2.382191739347913e-13,-6.423305872147834e-13,-9.400849094049688e-13,-1.122435026096556e-12,-1.183840321267481e-12,-1.122435026096556e-12,-9.400849094049688e-13,-6.423305872147841e-13,-2.382191739347918e-13]],G=z[Pe.SHORT_TYPE],Z=z[Pe.SHORT_TYPE],K=z[Pe.SHORT_TYPE],U=z[Pe.SHORT_TYPE],Q=[0,1,16,17,8,9,24,25,4,5,20,21,12,13,28,29,2,3,18,19,10,11,26,27,6,7,22,23,14,15,30,31];function W(e,t,a){for(var s,n,r,i=10,o=t+238-14-286,_=-15;_<0;_++){var l,f,c;l=h[i+-10],f=e[o+-224]*l,c=e[t+224]*l,l=h[i+-9],f+=e[o+-160]*l,c+=e[t+160]*l,l=h[i+-8],f+=e[o+-96]*l,c+=e[t+96]*l,l=h[i+-7],f+=e[o+-32]*l,c+=e[t+32]*l,l=h[i+-6],f+=e[o+32]*l,c+=e[t+-32]*l,l=h[i+-5],f+=e[o+96]*l,c+=e[t+-96]*l,l=h[i+-4],f+=e[o+160]*l,c+=e[t+-160]*l,l=h[i+-3],f+=e[o+224]*l,c+=e[t+-224]*l,l=h[i+-2],f+=e[t+-256]*l,c-=e[o+256]*l,l=h[i+-1],f+=e[t+-192]*l,c-=e[o+192]*l,l=h[i+0],f+=e[t+-128]*l,c-=e[o+128]*l,l=h[i+1],f+=e[t+-64]*l,c-=e[o+64]*l,l=h[i+2],f+=e[t+0]*l,c-=e[o+0]*l,l=h[i+3],f+=e[t+64]*l,c-=e[o+-64]*l,l=h[i+4],f+=e[t+128]*l,c-=e[o+-128]*l,l=h[i+5],f+=e[t+192]*l,l=(c-=e[o+-192]*l)-(f*=h[i+6]),a[30+2*_]=c+f,a[31+2*_]=h[i+7]*l,i+=18,t--,o++}c=e[t+-16]*h[i+-10],f=e[t+-32]*h[i+-2],c+=(e[t+-48]-e[t+16])*h[i+-9],f+=e[t+-96]*h[i+-1],c+=(e[t+-80]+e[t+48])*h[i+-8],f+=e[t+-160]*h[i+0],c+=(e[t+-112]-e[t+80])*h[i+-7],f+=e[t+-224]*h[i+1],c+=(e[t+-144]+e[t+112])*h[i+-6],f-=e[t+32]*h[i+2],c+=(e[t+-176]-e[t+144])*h[i+-5],f-=e[t+96]*h[i+3],c+=(e[t+-208]+e[t+176])*h[i+-4],f-=e[t+160]*h[i+4],c+=(e[t+-240]-e[t+208])*h[i+-3],s=(f-=e[t+224])-c,n=f+c,c=a[14],f=a[15]-c,a[31]=n+c,a[30]=s+f,a[15]=s-f,a[14]=n-c,r=a[28]-a[0],a[0]+=a[28],a[28]=r*h[i+-36+7],r=a[29]-a[1],a[1]+=a[29],a[29]=r*h[i+-36+7],r=a[26]-a[2],a[2]+=a[26],a[26]=r*h[i+-72+7],r=a[27]-a[3],a[3]+=a[27],a[27]=r*h[i+-72+7],r=a[24]-a[4],a[4]+=a[24],a[24]=r*h[i+-108+7],r=a[25]-a[5],a[5]+=a[25],a[25]=r*h[i+-108+7],r=a[22]-a[6],a[6]+=a[22],a[22]=r*ee.SQRT2,r=a[23]-a[7],a[7]+=a[23],a[23]=r*ee.SQRT2-a[7],a[7]-=a[6],a[22]-=a[7],a[23]-=a[22],r=a[6],a[6]=a[31]-r,a[31]=a[31]+r,r=a[7],a[7]=a[30]-r,a[30]=a[30]+r,r=a[22],a[22]=a[15]-r,a[15]=a[15]+r,r=a[23],a[23]=a[14]-r,a[14]=a[14]+r,r=a[20]-a[8],a[8]+=a[20],a[20]=r*h[i+-180+7],r=a[21]-a[9],a[9]+=a[21],a[21]=r*h[i+-180+7],r=a[18]-a[10],a[10]+=a[18],a[18]=r*h[i+-216+7],r=a[19]-a[11],a[11]+=a[19],a[19]=r*h[i+-216+7],r=a[16]-a[12],a[12]+=a[16],a[16]=r*h[i+-252+7],r=a[17]-a[13],a[13]+=a[17],a[17]=r*h[i+-252+7],r=-a[20]+a[24],a[20]+=a[24],a[24]=r*h[i+-216+7],r=-a[21]+a[25],a[21]+=a[25],a[25]=r*h[i+-216+7],r=a[4]-a[8],a[4]+=a[8],a[8]=r*h[i+-216+7],r=a[5]-a[9],a[5]+=a[9],a[9]=r*h[i+-216+7],r=a[0]-a[12],a[0]+=a[12],a[12]=r*h[i+-72+7],r=a[1]-a[13],a[1]+=a[13],a[13]=r*h[i+-72+7],r=a[16]-a[28],a[16]+=a[28],a[28]=r*h[i+-72+7],r=-a[17]+a[29],a[17]+=a[29],a[29]=r*h[i+-72+7],r=ee.SQRT2*(a[2]-a[10]),a[2]+=a[10],a[10]=r,r=ee.SQRT2*(a[3]-a[11]),a[3]+=a[11],a[11]=r,r=ee.SQRT2*(-a[18]+a[26]),a[18]+=a[26],a[26]=r-a[18],r=ee.SQRT2*(-a[19]+a[27]),a[19]+=a[27],a[27]=r-a[19],r=a[2],a[19]-=a[3],a[3]-=r,a[2]=a[31]-r,a[31]+=r,r=a[3],a[11]-=a[19],a[18]-=r,a[3]=a[30]-r,a[30]+=r,r=a[18],a[27]-=a[11],a[19]-=r,a[18]=a[15]-r,a[15]+=r,r=a[19],a[10]-=r,a[19]=a[14]-r,a[14]+=r,r=a[10],a[11]-=r,a[10]=a[23]-r,a[23]+=r,r=a[11],a[26]-=r,a[11]=a[22]-r,a[22]+=r,r=a[26],a[27]-=r,a[26]=a[7]-r,a[7]+=r,r=a[27],a[27]=a[6]-r,a[6]+=r,r=ee.SQRT2*(a[0]-a[4]),a[0]+=a[4],a[4]=r,r=ee.SQRT2*(a[1]-a[5]),a[1]+=a[5],a[5]=r,r=ee.SQRT2*(a[16]-a[20]),a[16]+=a[20],a[20]=r,r=ee.SQRT2*(a[17]-a[21]),a[17]+=a[21],a[21]=r,r=-ee.SQRT2*(a[8]-a[12]),a[8]+=a[12],a[12]=r-a[8],r=-ee.SQRT2*(a[9]-a[13]),a[9]+=a[13],a[13]=r-a[9],r=-ee.SQRT2*(a[25]-a[29]),a[25]+=a[29],a[29]=r-a[25],r=-ee.SQRT2*(a[24]+a[28]),a[24]-=a[28],a[28]=r-a[24],r=a[24]-a[16],a[24]=r,r=a[20]-r,a[20]=r,r=a[28]-r,a[28]=r,r=a[25]-a[17],a[25]=r,r=a[21]-r,a[21]=r,r=a[29]-r,a[29]=r,r=a[17]-a[1],a[17]=r,r=a[9]-r,a[9]=r,r=a[25]-r,a[25]=r,r=a[5]-r,a[5]=r,r=a[21]-r,a[21]=r,r=a[13]-r,a[13]=r,r=a[29]-r,a[29]=r,r=a[1]-a[0],a[1]=r,r=a[16]-r,a[16]=r,r=a[17]-r,a[17]=r,r=a[8]-r,a[8]=r,r=a[9]-r,a[9]=r,r=a[24]-r,a[24]=r,r=a[25]-r,a[25]=r,r=a[4]-r,a[4]=r,r=a[5]-r,a[5]=r,r=a[20]-r,a[20]=r,r=a[21]-r,a[21]=r,r=a[12]-r,a[12]=r,r=a[13]-r,a[13]=r,r=a[28]-r,a[28]=r,r=a[29]-r,a[29]=r,r=a[0],a[0]+=a[31],a[31]-=r,r=a[1],a[1]+=a[30],a[30]-=r,r=a[16],a[16]+=a[15],a[15]-=r,r=a[17],a[17]+=a[14],a[14]-=r,r=a[8],a[8]+=a[23],a[23]-=r,r=a[9],a[9]+=a[22],a[22]-=r,r=a[24],a[24]+=a[7],a[7]-=r,r=a[25],a[25]+=a[6],a[6]-=r,r=a[4],a[4]+=a[27],a[27]-=r,r=a[5],a[5]+=a[26],a[26]-=r,r=a[20],a[20]+=a[11],a[11]-=r,r=a[21],a[21]+=a[10],a[10]-=r,r=a[12],a[12]+=a[19],a[19]-=r,r=a[13],a[13]+=a[18],a[18]-=r,r=a[28],a[28]+=a[3],a[3]-=r,r=a[29],a[29]+=a[2],a[2]-=r}function J(e,t){for(var a=0;a<3;a++){var s,n,r,i,o,_;n=(i=e[t+6]*z[Pe.SHORT_TYPE][0]-e[t+15])+(s=e[t+0]*z[Pe.SHORT_TYPE][2]-e[t+9]),r=i-s,o=(i=e[t+15]*z[Pe.SHORT_TYPE][0]+e[t+6])+(s=e[t+9]*z[Pe.SHORT_TYPE][2]+e[t+0]),_=-i+s,s=2.069978111953089e-11*(e[t+3]*z[Pe.SHORT_TYPE][1]-e[t+12]),i=2.069978111953089e-11*(e[t+12]*z[Pe.SHORT_TYPE][1]+e[t+3]),e[t+0]=1.90752519173728e-11*n+s,e[t+15]=1.90752519173728e-11*-o+i,r=.8660254037844387*r*1.907525191737281e-11,o=.5*o*1.907525191737281e-11+i,e[t+3]=r-o,e[t+6]=r+o,n=.5*n*1.907525191737281e-11-s,_=.8660254037844387*_*1.907525191737281e-11,e[t+9]=n+_,e[t+12]=n-_,t++}}this.mdct_sub48=function(e,t,a){for(var s,n,r,i,o,_,l,f,c,h,u,m,p,b,v,d,g,S,M,w,R,A=t,B=286,k=0;k<e.channels_out;k++){for(var x=0;x<e.mode_gr;x++){for(var y,T=e.l3_side.tt[x][k],E=T.xr,P=0,I=e.sb_sample[k][1-x],L=0,H=0;H<9;H++)for(W(A,B,I[L]),W(A,B+32,I[L+1]),L+=2,B+=64,y=1;y<32;y+=2)I[L-1][y]*=-1;for(y=0;y<32;y++,P+=18){var C=T.block_type,O=e.sb_sample[k][x],V=e.sb_sample[k][1-x];if(0!=T.mixed_block_flag&&y<2&&(C=0),e.amp_filter[y]<1e-12)xe.fill(E,P+0,P+18,0);else{if(e.amp_filter[y]<1)for(H=0;H<18;H++)V[H][Q[y]]*=e.amp_filter[y];if(C==Pe.SHORT_TYPE){for(H=-3;H<0;H++){var N=z[Pe.SHORT_TYPE][H+3];E[P+3*H+9]=O[9+H][Q[y]]*N-O[8-H][Q[y]],E[P+3*H+18]=O[14-H][Q[y]]*N+O[15+H][Q[y]],E[P+3*H+10]=O[15+H][Q[y]]*N-O[14-H][Q[y]],E[P+3*H+19]=V[2-H][Q[y]]*N+V[3+H][Q[y]],E[P+3*H+11]=V[3+H][Q[y]]*N-V[2-H][Q[y]],E[P+3*H+20]=V[8-H][Q[y]]*N+V[9+H][Q[y]]}J(E,P)}else{var D=Be(18);for(H=-9;H<0;H++){var Y,X;Y=z[C][H+27]*V[H+9][Q[y]]+z[C][H+36]*V[8-H][Q[y]],X=z[C][H+9]*O[H+9][Q[y]]-z[C][H+18]*O[8-H][Q[y]],D[H+9]=Y-X*G[3+H+9],D[H+18]=Y*G[3+H+9]+X}s=E,n=P,R=w=M=S=g=d=v=b=p=m=u=h=c=f=l=_=o=i=void 0,_=(r=D)[17]-r[9],f=r[15]-r[11],c=r[14]-r[12],h=r[0]+r[8],u=r[1]+r[7],m=r[2]+r[6],p=r[3]+r[5],s[n+17]=h+m-p-(u-r[4]),o=(h+m-p)*Z[19]+(u-r[4]),i=(_-f-c)*Z[18],s[n+5]=i+o,s[n+6]=i-o,l=(r[16]-r[10])*Z[18],u=u*Z[19]+r[4],i=_*Z[12]+l+f*Z[13]+c*Z[14],o=-h*Z[16]+u-m*Z[17]+p*Z[15],s[n+1]=i+o,s[n+2]=i-o,i=_*Z[13]-l-f*Z[14]+c*Z[12],o=-h*Z[17]+u-m*Z[15]+p*Z[16],s[n+9]=i+o,s[n+10]=i-o,i=_*Z[14]-l+f*Z[12]-c*Z[13],o=h*Z[15]-u+m*Z[16]-p*Z[17],s[n+13]=i+o,s[n+14]=i-o,b=r[8]-r[0],d=r[6]-r[2],g=r[5]-r[3],S=r[17]+r[9],M=r[16]+r[10],w=r[15]+r[11],R=r[14]+r[12],s[n+0]=S+w+R+(M+r[13]),i=(S+w+R)*Z[19]-(M+r[13]),o=(b-d+g)*Z[18],s[n+11]=i+o,s[n+12]=i-o,v=(r[7]-r[1])*Z[18],M=r[13]-M*Z[19],i=S*Z[15]-M+w*Z[16]+R*Z[17],o=b*Z[14]+v+d*Z[12]+g*Z[13],s[n+3]=i+o,s[n+4]=i-o,i=-S*Z[17]+M-w*Z[15]-R*Z[16],o=b*Z[13]+v-d*Z[14]-g*Z[12],s[n+7]=i+o,s[n+8]=i-o,i=-S*Z[16]+M-w*Z[17]-R*Z[15],o=b*Z[12]-v+d*Z[13]-g*Z[14],s[n+15]=i+o,s[n+16]=i-o}}if(C!=Pe.SHORT_TYPE&&0!=y)for(H=7;0<=H;--H){var q,F;q=E[P+H]*K[20+H]+E[P+-1-H]*U[28+H],F=E[P+H]*U[28+H]-E[P+-1-H]*K[20+H],E[P+-1-H]=q,E[P+H]=F}}}if(A=a,B=286,1==e.mode_gr)for(var j=0;j<18;j++)$.arraycopy(e.sb_sample[k][1][j],0,e.sb_sample[k][0][j],0,32)}}};this.lame_encode_mp3_frame=function(e,t,a,s,n,r){var i,o=V([2,2]);o[0][0]=new N,o[0][1]=new N,o[1][0]=new N,o[1][1]=new N;var _,l=V([2,2]);l[0][0]=new N,l[0][1]=new N,l[1][0]=new N,l[1][1]=new N;var f,c,h,u=[null,null],m=e.internal_flags,p=ke([2,4]),b=[.5,.5],v=[[0,0],[0,0]],d=[[0,0],[0,0]];if(u[0]=t,u[1]=a,0==m.lame_encode_frame_init&&function(e,t){var a,s,n=e.internal_flags;if(0==n.lame_encode_frame_init){var r,i,o=Be(2014),_=Be(2014);for(n.lame_encode_frame_init=1,i=r=0;r<286+576*(1+n.mode_gr);++r)r<576*n.mode_gr?(o[r]=0,2==n.channels_out&&(_[r]=0)):(o[r]=t[0][i],2==n.channels_out&&(_[r]=t[1][i]),++i);for(s=0;s<n.mode_gr;s++)for(a=0;a<n.channels_out;a++)n.l3_side.tt[s][a].block_type=Pe.SHORT_TYPE;O.mdct_sub48(n,o,_)}}(e,u),m.padding=0,(m.slot_lag-=m.frac_SpF)<0&&(m.slot_lag+=e.out_samplerate,m.padding=1),0!=m.psymodel){var g=[null,null],S=0,M=Ae(2);for(h=0;h<m.mode_gr;h++){for(c=0;c<m.channels_out;c++)g[c]=u[c],S=576+576*h-Pe.FFTOFFSET;if(0!=(e.VBR==Te.vbr_mtrh||e.VBR==Te.vbr_mt?L.L3psycho_anal_vbr(e,g,S,h,o,l,v[h],d[h],p[h],M):L.L3psycho_anal_ns(e,g,S,h,o,l,v[h],d[h],p[h],M)))return-4;for(e.mode==Ee.JOINT_STEREO&&(b[h]=p[h][2]+p[h][3],0<b[h]&&(b[h]=p[h][3]/b[h])),c=0;c<m.channels_out;c++){var w=m.l3_side.tt[h][c];w.block_type=M[c],w.mixed_block_flag=0}}}else for(h=0;h<m.mode_gr;h++)for(c=0;c<m.channels_out;c++)m.l3_side.tt[h][c].block_type=Pe.NORM_TYPE,m.l3_side.tt[h][c].mixed_block_flag=0,d[h][c]=v[h][c]=700;if(function(e){var t,a;if(0!=e.ATH.useAdjust)if(a=e.loudness_sq[0][0],t=e.loudness_sq[1][0],2==e.channels_out?(a+=e.loudness_sq[0][1],t+=e.loudness_sq[1][1]):(a+=a,t+=t),2==e.mode_gr&&(a=Math.max(a,t)),a*=.5,.03125<(a*=e.ATH.aaSensitivityP))1<=e.ATH.adjust?e.ATH.adjust=1:e.ATH.adjust<e.ATH.adjustLimit&&(e.ATH.adjust=e.ATH.adjustLimit),e.ATH.adjustLimit=1;else{var s=31.98*a+625e-6;e.ATH.adjust>=s?(e.ATH.adjust*=.075*s+.925,e.ATH.adjust<s&&(e.ATH.adjust=s)):e.ATH.adjustLimit>=s?e.ATH.adjust=s:e.ATH.adjust<e.ATH.adjustLimit&&(e.ATH.adjust=e.ATH.adjustLimit),e.ATH.adjustLimit=s}else e.ATH.adjust=1}(m),O.mdct_sub48(m,u[0],u[1]),m.mode_ext=Pe.MPG_MD_LR_LR,e.force_ms)m.mode_ext=Pe.MPG_MD_MS_LR;else if(e.mode==Ee.JOINT_STEREO){var R=0,A=0;for(h=0;h<m.mode_gr;h++)for(c=0;c<m.channels_out;c++)R+=d[h][c],A+=v[h][c];if(R<=1*A){var B=m.l3_side.tt[0],k=m.l3_side.tt[m.mode_gr-1];B[0].block_type==B[1].block_type&&k[0].block_type==k[1].block_type&&(m.mode_ext=Pe.MPG_MD_MS_LR)}}if(m.mode_ext==P?(_=l,f=d):(_=o,f=v),e.analysis&&null!=m.pinfo)for(h=0;h<m.mode_gr;h++)for(c=0;c<m.channels_out;c++)m.pinfo.ms_ratio[h]=m.ms_ratio[h],m.pinfo.ms_ener_ratio[h]=b[h],m.pinfo.blocktype[h][c]=m.l3_side.tt[h][c].block_type,m.pinfo.pe[h][c]=f[h][c],$.arraycopy(m.l3_side.tt[h][c].xr,0,m.pinfo.xr[h][c],0,576),m.mode_ext==P&&(m.pinfo.ers[h][c]=m.pinfo.ers[h][c+2],$.arraycopy(m.pinfo.energy[h][c+2],0,m.pinfo.energy[h][c],0,m.pinfo.energy[h][c].length));if(e.VBR==Te.vbr_off||e.VBR==Te.vbr_abr){var x,y;for(x=0;x<18;x++)m.nsPsy.pefirbuf[x]=m.nsPsy.pefirbuf[x+1];for(h=y=0;h<m.mode_gr;h++)for(c=0;c<m.channels_out;c++)y+=f[h][c];for(m.nsPsy.pefirbuf[18]=y,y=m.nsPsy.pefirbuf[9],x=0;x<9;x++)y+=(m.nsPsy.pefirbuf[x]+m.nsPsy.pefirbuf[18-x])*Pe.fircoef[x];for(y=3350*m.mode_gr*m.channels_out/y,h=0;h<m.mode_gr;h++)for(c=0;c<m.channels_out;c++)f[h][c]*=y}if(m.iteration_loop.iteration_loop(e,f,b,_),I.format_bitstream(e),i=I.copy_buffer(m,s,n,r,1),e.bWriteVbrTag&&H.addVbrFrame(e),e.analysis&&null!=m.pinfo){for(c=0;c<m.channels_out;c++){var T;for(T=0;T<E;T++)m.pinfo.pcmdata[c][T]=m.pinfo.pcmdata[c][T+e.framesize];for(T=E;T<1600;T++)m.pinfo.pcmdata[c][T]=u[c][T-E]}C.set_frame_pinfo(e,_)}return function(e){var t,a;for(e.bitrate_stereoMode_Hist[e.bitrate_index][4]++,e.bitrate_stereoMode_Hist[15][4]++,2==e.channels_out&&(e.bitrate_stereoMode_Hist[e.bitrate_index][e.mode_ext]++,e.bitrate_stereoMode_Hist[15][e.mode_ext]++),t=0;t<e.mode_gr;++t)for(a=0;a<e.channels_out;++a){var s=0|e.l3_side.tt[t][a].block_type;0!=e.l3_side.tt[t][a].mixed_block_flag&&(s=4),e.bitrate_blockType_Hist[e.bitrate_index][s]++,e.bitrate_blockType_Hist[e.bitrate_index][5]++,e.bitrate_blockType_Hist[15][s]++,e.bitrate_blockType_Hist[15][5]++}}(m),i}}function i(){this.l=Be(Pe.SBMAX_l),this.s=ke([Pe.SBMAX_s,3]);var s=this;this.assign=function(e){$.arraycopy(e.l,0,s.l,0,Pe.SBMAX_l);for(var t=0;t<Pe.SBMAX_s;t++)for(var a=0;a<3;a++)s.s[t][a]=e.s[t][a]}}function G(){var e=40;function t(){this.write_timing=0,this.ptr=0,this.buf=A(e)}this.Class_ID=0,this.lame_encode_frame_init=0,this.iteration_init_init=0,this.fill_buffer_resample_init=0,this.mfbuf=ke([2,G.MFSIZE]),this.mode_gr=0,this.channels_in=0,this.channels_out=0,this.resample_ratio=0,this.mf_samples_to_encode=0,this.mf_size=0,this.VBR_min_bitrate=0,this.VBR_max_bitrate=0,this.bitrate_index=0,this.samplerate_index=0,this.mode_ext=0,this.lowpass1=0,this.lowpass2=0,this.highpass1=0,this.highpass2=0,this.noise_shaping=0,this.noise_shaping_amp=0,this.substep_shaping=0,this.psymodel=0,this.noise_shaping_stop=0,this.subblock_gain=0,this.use_best_huffman=0,this.full_outer_loop=0,this.l3_side=new function(){this.tt=[[null,null],[null,null]],this.main_data_begin=0,this.private_bits=0,this.resvDrain_pre=0,this.resvDrain_post=0,this.scfsi=[Ae(4),Ae(4)];for(var e=0;e<2;e++)for(var t=0;t<2;t++)this.tt[e][t]=new y},this.ms_ratio=Be(2),this.padding=0,this.frac_SpF=0,this.slot_lag=0,this.tag_spec=null,this.nMusicCRC=0,this.OldValue=Ae(2),this.CurrentStep=Ae(2),this.masking_lower=0,this.bv_scf=Ae(576),this.pseudohalf=Ae(z.SFBMAX),this.sfb21_extra=!1,this.inbuf_old=new Array(2),this.blackfilt=new Array(2*G.BPC+1),this.itime=s(2),this.sideinfo_len=0,this.sb_sample=ke([2,2,18,Pe.SBLIMIT]),this.amp_filter=Be(32),this.header=new Array(G.MAX_HEADER_BUF),this.h_ptr=0,this.w_ptr=0,this.ancillary_flag=0,this.ResvSize=0,this.ResvMax=0,this.scalefac_band=new r,this.minval_l=Be(Pe.CBANDS),this.minval_s=Be(Pe.CBANDS),this.nb_1=ke([4,Pe.CBANDS]),this.nb_2=ke([4,Pe.CBANDS]),this.nb_s1=ke([4,Pe.CBANDS]),this.nb_s2=ke([4,Pe.CBANDS]),this.s3_ss=null,this.s3_ll=null,this.decay=0,this.thm=new Array(4),this.en=new Array(4),this.tot_ener=Be(4),this.loudness_sq=ke([2,2]),this.loudness_sq_save=Be(2),this.mld_l=Be(Pe.SBMAX_l),this.mld_s=Be(Pe.SBMAX_s),this.bm_l=Ae(Pe.SBMAX_l),this.bo_l=Ae(Pe.SBMAX_l),this.bm_s=Ae(Pe.SBMAX_s),this.bo_s=Ae(Pe.SBMAX_s),this.npart_l=0,this.npart_s=0,this.s3ind=Y([Pe.CBANDS,2]),this.s3ind_s=Y([Pe.CBANDS,2]),this.numlines_s=Ae(Pe.CBANDS),this.numlines_l=Ae(Pe.CBANDS),this.rnumlines_l=Be(Pe.CBANDS),this.mld_cb_l=Be(Pe.CBANDS),this.mld_cb_s=Be(Pe.CBANDS),this.numlines_s_num1=0,this.numlines_l_num1=0,this.pe=Be(4),this.ms_ratio_s_old=0,this.ms_ratio_l_old=0,this.ms_ener_ratio_old=0,this.blocktype_old=Ae(2),this.nsPsy=new function(){this.last_en_subshort=ke([4,9]),this.lastAttacks=Ae(4),this.pefirbuf=Be(19),this.longfact=Be(Pe.SBMAX_l),this.shortfact=Be(Pe.SBMAX_s),this.attackthre=0,this.attackthre_s=0},this.VBR_seek_table=new function(){this.sum=0,this.seen=0,this.want=0,this.pos=0,this.size=0,this.bag=null,this.nVbrNumFrames=0,this.nBytesWritten=0,this.TotalFrameSize=0},this.ATH=null,this.PSY=null,this.nogap_total=0,this.nogap_current=0,this.decode_on_the_fly=!0,this.findReplayGain=!0,this.findPeakSample=!0,this.PeakSample=0,this.RadioGain=0,this.AudiophileGain=0,this.rgdata=null,this.noclipGainChange=0,this.noclipScale=0,this.bitrate_stereoMode_Hist=Y([16,5]),this.bitrate_blockType_Hist=Y([16,6]),this.pinfo=null,this.hip=null,this.in_buffer_nsamples=0,this.in_buffer_0=null,this.in_buffer_1=null,this.iteration_loop=null;for(var a=0;a<this.en.length;a++)this.en[a]=new i;for(a=0;a<this.thm.length;a++)this.thm[a]=new i;for(a=0;a<this.header.length;a++)this.header[a]=new t}function K(){var B=new function(){var u=Be(Pe.BLKSIZE),p=Be(Pe.BLKSIZE_s/2),x=[.9238795325112867,.3826834323650898,.9951847266721969,.0980171403295606,.9996988186962042,.02454122852291229,.9999811752826011,.006135884649154475];function b(e,t,a){var s,n,r,i=0,o=t+(a<<=1);s=4;do{var _,l,f,c,h,u,m;for(m=s>>1,u=(h=(c=s)<<1)+c,s=h<<1,r=(n=t)+m;M=e[n+0]-e[n+c],S=e[n+0]+e[n+c],B=e[n+h]-e[n+u],R=e[n+h]+e[n+u],e[n+h]=S-R,e[n+0]=S+R,e[n+u]=M-B,e[n+c]=M+B,M=e[r+0]-e[r+c],S=e[r+0]+e[r+c],B=ee.SQRT2*e[r+u],R=ee.SQRT2*e[r+h],e[r+h]=S-R,e[r+0]=S+R,e[r+u]=M-B,e[r+c]=M+B,r+=s,(n+=s)<o;);for(l=x[i+0],_=x[i+1],f=1;f<m;f++){var p,b;p=1-2*_*_,b=2*_*l,n=t+f,r=t+c-f;do{var v,d,g,S,M,w,R,A,B,k;d=b*e[n+c]-p*e[r+c],v=p*e[n+c]+b*e[r+c],M=e[n+0]-v,S=e[n+0]+v,w=e[r+0]-d,g=e[r+0]+d,d=b*e[n+u]-p*e[r+u],v=p*e[n+u]+b*e[r+u],B=e[n+h]-v,R=e[n+h]+v,k=e[r+h]-d,A=e[r+h]+d,d=_*R-l*k,v=l*R+_*k,e[n+h]=S-v,e[n+0]=S+v,e[r+u]=w-d,e[r+c]=w+d,d=l*A-_*B,v=_*A+l*B,e[r+h]=g-v,e[r+0]=g+v,e[n+u]=M-d,e[n+c]=M+d,r+=s,n+=s}while(n<o);l=(p=l)*x[i+0]-_*x[i+1],_=p*x[i+1]+_*x[i+0]}i+=2}while(s<a)}var v=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254];this.fft_short=function(e,t,a,s,n){for(var r=0;r<3;r++){var i=Pe.BLKSIZE_s/2,o=65535&192*(r+1),_=Pe.BLKSIZE_s/8-1;do{var l,f,c,h,u,m=255&v[_<<2];f=(l=p[m]*s[a][n+m+o])-(u=p[127-m]*s[a][n+m+o+128]),l+=u,h=(c=p[m+64]*s[a][n+m+o+64])-(u=p[63-m]*s[a][n+m+o+192]),c+=u,i-=4,t[r][i+0]=l+c,t[r][i+2]=l-c,t[r][i+1]=f+h,t[r][i+3]=f-h,f=(l=p[m+1]*s[a][n+m+o+1])-(u=p[126-m]*s[a][n+m+o+129]),l+=u,h=(c=p[m+65]*s[a][n+m+o+65])-(u=p[62-m]*s[a][n+m+o+193]),c+=u,t[r][i+Pe.BLKSIZE_s/2+0]=l+c,t[r][i+Pe.BLKSIZE_s/2+2]=l-c,t[r][i+Pe.BLKSIZE_s/2+1]=f+h,t[r][i+Pe.BLKSIZE_s/2+3]=f-h}while(0<=--_);b(t[r],i,Pe.BLKSIZE_s/2)}},this.fft_long=function(e,t,a,s,n){var r=Pe.BLKSIZE/8-1,i=Pe.BLKSIZE/2;do{var o,_,l,f,c,h=255&v[r];_=(o=u[h]*s[a][n+h])-(c=u[h+512]*s[a][n+h+512]),o+=c,f=(l=u[h+256]*s[a][n+h+256])-(c=u[h+768]*s[a][n+h+768]),l+=c,t[0+(i-=4)]=o+l,t[i+2]=o-l,t[i+1]=_+f,t[i+3]=_-f,_=(o=u[h+1]*s[a][n+h+1])-(c=u[h+513]*s[a][n+h+513]),o+=c,f=(l=u[h+257]*s[a][n+h+257])-(c=u[h+769]*s[a][n+h+769]),l+=c,t[i+Pe.BLKSIZE/2+0]=o+l,t[i+Pe.BLKSIZE/2+2]=o-l,t[i+Pe.BLKSIZE/2+1]=_+f,t[i+Pe.BLKSIZE/2+3]=_-f}while(0<=--r);b(t,i,Pe.BLKSIZE/2)},this.init_fft=function(e){for(var t=0;t<Pe.BLKSIZE;t++)u[t]=.42-.5*Math.cos(2*Math.PI*(t+.5)/Pe.BLKSIZE)+.08*Math.cos(4*Math.PI*(t+.5)/Pe.BLKSIZE);for(t=0;t<Pe.BLKSIZE_s/2;t++)p[t]=.5*(1-Math.cos(2*Math.PI*(t+.5)/Pe.BLKSIZE_s))}},k=2.302585092994046,_e=2,le=16,d=2,g=16,E=.34,n=1/217621504/(Pe.BLKSIZE/2),fe=.3,ce=21,S=.2302585093;function M(e){return e}function N(e,t){for(var a=0,s=0;s<Pe.BLKSIZE/2;++s)a+=e[s]*t.ATH.eql_w[s];return a*=n}function he(e,t,a,s,n,r,i,o,_,l,f){var c=e.internal_flags;if(_<2)B.fft_long(c,s[n],_,l,f),B.fft_short(c,r[i],_,l,f);else if(2==_){for(var h=Pe.BLKSIZE-1;0<=h;--h){var u=s[n+0][h],m=s[n+1][h];s[n+0][h]=(u+m)*ee.SQRT2*.5,s[n+1][h]=(u-m)*ee.SQRT2*.5}for(var p=2;0<=p;--p)for(h=Pe.BLKSIZE_s-1;0<=h;--h){u=r[i+0][p][h],m=r[i+1][p][h];r[i+0][p][h]=(u+m)*ee.SQRT2*.5,r[i+1][p][h]=(u-m)*ee.SQRT2*.5}}t[0]=M(s[n+0][0]),t[0]*=t[0];for(h=Pe.BLKSIZE/2-1;0<=h;--h){var b=s[n+0][Pe.BLKSIZE/2-h],v=s[n+0][Pe.BLKSIZE/2+h];t[Pe.BLKSIZE/2-h]=M(.5*(b*b+v*v))}for(p=2;0<=p;--p){a[p][0]=r[i+0][p][0],a[p][0]*=a[p][0];for(h=Pe.BLKSIZE_s/2-1;0<=h;--h){b=r[i+0][p][Pe.BLKSIZE_s/2-h],v=r[i+0][p][Pe.BLKSIZE_s/2+h];a[p][Pe.BLKSIZE_s/2-h]=M(.5*(b*b+v*v))}}var d=0;for(h=11;h<Pe.HBLKSIZE;h++)d+=t[h];if(c.tot_ener[_]=d,e.analysis){for(h=0;h<Pe.HBLKSIZE;h++)c.pinfo.energy[o][_][h]=c.pinfo.energy_save[_][h],c.pinfo.energy_save[_][h]=t[h];c.pinfo.pe[o][_]=c.pe[_]}2==e.athaa_loudapprox&&_<2&&(c.loudness_sq[o][_]=c.loudness_sq_save[_],c.loudness_sq_save[_]=N(t,c))}var x,y,T,P=8,I=23,L=15,ue=[1,.79433,.63096,.63096,.63096,.63096,.63096,.25119,.11749];var f=[3.3246*3.3246,3.23837*3.23837,9.9500500969,9.0247369744,8.1854926609,7.0440875649,2.46209*2.46209,2.284*2.284,4.4892710641,1.96552*1.96552,1.82335*1.82335,1.69146*1.69146,2.4621061921,2.1508568964,1.37074*1.37074,1.31036*1.31036,1.5691069696,1.4555939904,1.16203*1.16203,1.2715945225,1.09428*1.09428,1.0659*1.0659,1.0779838276,1.0382591025,1],c=[1.7782755904,1.35879*1.35879,1.38454*1.38454,1.39497*1.39497,1.40548*1.40548,1.3537*1.3537,1.6999465924,1.22321*1.22321,1.3169398564,1],h=[5.5396212496,2.29259*2.29259,4.9868695969,2.12675*2.12675,2.02545*2.02545,1.87894*1.87894,1.74303*1.74303,1.61695*1.61695,2.2499700001,1.39148*1.39148,1.29083*1.29083,1.19746*1.19746,1.2339655056,1.0779838276];function me(e,t,a,s,n,r){var i;if(e<t){if(!(t<e*y))return e+t;i=t/e}else{if(t*y<=e)return e+t;i=e/t}if(e+=t,s+3<=6){if(x<=i)return e;var o=0|ee.FAST_LOG10_X(i,16);return e*c[o]}var _,l;o=0|ee.FAST_LOG10_X(i,16);return t=0!=r?n.ATH.cb_s[a]*n.ATH.adjust:n.ATH.cb_l[a]*n.ATH.adjust,e<T*t?t<e?(_=1,o<=13&&(_=h[o]),l=ee.FAST_LOG10_X(e/t,10/15),e*((f[o]-_)*l+_)):13<o?e:e*h[o]:e*f[o]}var r=[1.7782755904,1.35879*1.35879,1.38454*1.38454,1.39497*1.39497,1.40548*1.40548,1.3537*1.3537,1.6999465924,1.22321*1.22321,1.3169398564,1];function A(e,t,a){var s;if(e<0&&(e=0),t<0&&(t=0),e<=0)return t;if(t<=0)return e;if(s=e<t?t/e:e/t,-2<=a&&a<=2){if(x<=s)return e+t;var n=0|ee.FAST_LOG10_X(s,16);return(e+t)*r[n]}return s<y?e+t:(e<t&&(e=t),e)}function pe(e,t,a,s,n){var r,i,o=0,_=0;for(r=i=0;r<Pe.SBMAX_s;++i,++r){for(var l=e.bo_s[r],f=e.npart_s,c=l<f?l:f;i<c;)o+=t[i],_+=a[i],i++;if(e.en[s].s[r][n]=o,e.thm[s].s[r][n]=_,f<=i){++r;break}var h=e.PSY.bo_s_weight[r],u=1-h;o=h*t[i],_=h*a[i],e.en[s].s[r][n]+=o,e.thm[s].s[r][n]+=_,o=u*t[i],_=u*a[i]}for(;r<Pe.SBMAX_s;++r)e.en[s].s[r][n]=0,e.thm[s].s[r][n]=0}function be(e,t,a,s){var n,r,i=0,o=0;for(n=r=0;n<Pe.SBMAX_l;++r,++n){for(var _=e.bo_l[n],l=e.npart_l,f=_<l?_:l;r<f;)i+=t[r],o+=a[r],r++;if(e.en[s].l[n]=i,e.thm[s].l[n]=o,l<=r){++n;break}var c=e.PSY.bo_l_weight[n],h=1-c;i=c*t[r],o=c*a[r],e.en[s].l[n]+=i,e.thm[s].l[n]+=o,i=h*t[r],o=h*a[r]}for(;n<Pe.SBMAX_l;++n)e.en[s].l[n]=0,e.thm[s].l[n]=0}function ve(e,t,a,s,n,r){var i,o,_=e.internal_flags;for(o=i=0;o<_.npart_s;++o){for(var l=0,f=0,c=_.numlines_s[o],h=0;h<c;++h,++i){var u=t[r][i];l+=u,f<u&&(f=u)}a[o]=l}for(i=o=0;o<_.npart_s;o++){var m=_.s3ind_s[o][0],p=_.s3_ss[i++]*a[m];for(++m;m<=_.s3ind_s[o][1];)p+=_.s3_ss[i]*a[m],++i,++m;var b=d*_.nb_s1[n][o];if(s[o]=Math.min(p,b),_.blocktype_old[1&n]==Pe.SHORT_TYPE){b=g*_.nb_s2[n][o];var v=s[o];s[o]=Math.min(b,v)}_.nb_s2[n][o]=_.nb_s1[n][o],_.nb_s1[n][o]=p}for(;o<=Pe.CBANDS;++o)a[o]=0,s[o]=0}function de(e,t,a){return 1<=a?e:a<=0?t:0<t?Math.pow(e/t,a)*t:0}var _=[11.8,13.6,17.2,32,46.5,51.3,57.5,67.1,71.5,84.6,97.6,130];function ge(e,t){for(var a=309.07,s=0;s<Pe.SBMAX_s-1;s++)for(var n=0;n<3;n++){var r=e.thm.s[s][n];if(0<r){var i=r*t,o=e.en.s[s][n];i<o&&(a+=1e10*i<o?_[s]*(10*k):_[s]*ee.FAST_LOG10(o/i))}}return a}var o=[6.8,5.8,5.8,6.4,6.5,9.9,12.1,14.4,15,18.9,21.6,26.9,34.2,40.2,46.8,56.5,60.7,73.9,85.7,93.4,126.1];function Se(e,t){for(var a=281.0575,s=0;s<Pe.SBMAX_l-1;s++){var n=e.thm.l[s];if(0<n){var r=n*t,i=e.en.l[s];r<i&&(a+=1e10*r<i?o[s]*(10*k):o[s]*ee.FAST_LOG10(i/r))}}return a}function Me(e,t,a,s,n){var r,i;for(r=i=0;r<e.npart_l;++r){var o,_=0,l=0;for(o=0;o<e.numlines_l[r];++o,++i){var f=t[i];_+=f,l<f&&(l=f)}a[r]=_,s[r]=l,n[r]=_*e.rnumlines_l[r]}}function we(e,t,a,s){var n=ue.length-1,r=0,i=a[r]+a[r+1];0<i?((o=t[r])<t[r+1]&&(o=t[r+1]),n<(_=0|(i=20*(2*o-i)/(i*(e.numlines_l[r]+e.numlines_l[r+1]-1))))&&(_=n),s[r]=_):s[r]=0;for(r=1;r<e.npart_l-1;r++){var o,_;if(0<(i=a[r-1]+a[r]+a[r+1]))(o=t[r-1])<t[r]&&(o=t[r]),o<t[r+1]&&(o=t[r+1]),n<(_=0|(i=20*(3*o-i)/(i*(e.numlines_l[r-1]+e.numlines_l[r]+e.numlines_l[r+1]-1))))&&(_=n),s[r]=_;else s[r]=0}0<(i=a[r-1]+a[r])?((o=t[r-1])<t[r]&&(o=t[r]),n<(_=0|(i=20*(2*o-i)/(i*(e.numlines_l[r-1]+e.numlines_l[r]-1))))&&(_=n),s[r]=_):s[r]=0}var Re=[-1.730326e-17,-.01703172,-1.349528e-17,.0418072,-6.73278e-17,-.0876324,-3.0835e-17,.1863476,-1.104424e-16,-.627638];function D(e,t,a,s,n,r,i,o){var _=e.internal_flags;if(s<2)B.fft_long(_,i[o],s,t,a);else if(2==s)for(var l=Pe.BLKSIZE-1;0<=l;--l){var f=i[o+0][l],c=i[o+1][l];i[o+0][l]=(f+c)*ee.SQRT2*.5,i[o+1][l]=(f-c)*ee.SQRT2*.5}r[0]=M(i[o+0][0]),r[0]*=r[0];for(l=Pe.BLKSIZE/2-1;0<=l;--l){var h=i[o+0][Pe.BLKSIZE/2-l],u=i[o+0][Pe.BLKSIZE/2+l];r[Pe.BLKSIZE/2-l]=M(.5*(h*h+u*u))}var m=0;for(l=11;l<Pe.HBLKSIZE;l++)m+=r[l];if(_.tot_ener[s]=m,e.analysis){for(l=0;l<Pe.HBLKSIZE;l++)_.pinfo.energy[n][s][l]=_.pinfo.energy_save[s][l],_.pinfo.energy_save[s][l]=r[l];_.pinfo.pe[n][s]=_.pe[s]}}function Y(e,t,a,s,n,r,i,o){var _=e.internal_flags;if(0==n&&s<2&&B.fft_short(_,i[o],s,t,a),2==s)for(var l=Pe.BLKSIZE_s-1;0<=l;--l){var f=i[o+0][n][l],c=i[o+1][n][l];i[o+0][n][l]=(f+c)*ee.SQRT2*.5,i[o+1][n][l]=(f-c)*ee.SQRT2*.5}r[n][0]=i[o+0][n][0],r[n][0]*=r[n][0];for(l=Pe.BLKSIZE_s/2-1;0<=l;--l){var h=i[o+0][n][Pe.BLKSIZE_s/2-l],u=i[o+0][n][Pe.BLKSIZE_s/2+l];r[n][Pe.BLKSIZE_s/2-l]=M(.5*(h*h+u*u))}}this.L3psycho_anal_ns=function(e,t,a,s,n,r,i,o,_,l){var f,c,h,u,m,p,b,v,d,g,S=e.internal_flags,M=ke([2,Pe.BLKSIZE]),w=ke([2,3,Pe.BLKSIZE_s]),R=Be(Pe.CBANDS+1),A=Be(Pe.CBANDS+1),B=Be(Pe.CBANDS+2),k=Ae(2),x=Ae(2),y=ke([2,576]),T=Ae(Pe.CBANDS+2),E=Ae(Pe.CBANDS+2);for(xe.fill(E,0),f=S.channels_out,e.mode==Ee.JOINT_STEREO&&(f=4),d=e.VBR==Te.vbr_off?0==S.ResvMax?0:S.ResvSize/S.ResvMax*.5:e.VBR==Te.vbr_rh||e.VBR==Te.vbr_mtrh||e.VBR==Te.vbr_mt?.6:1,c=0;c<S.channels_out;c++){var P=t[c],I=a+576-350-ce+192;for(u=0;u<576;u++){var L,H;for(L=P[I+u+10],m=H=0;m<(ce-1)/2-1;m+=2)L+=Re[m]*(P[I+u+m]+P[I+u+ce-m]),H+=Re[m+1]*(P[I+u+m+1]+P[I+u+ce-m-1]);y[c][u]=L+H}n[s][c].en.assign(S.en[c]),n[s][c].thm.assign(S.thm[c]),2<f&&(r[s][c].en.assign(S.en[c+2]),r[s][c].thm.assign(S.thm[c+2]))}for(c=0;c<f;c++){var C,O=Be(12),V=[0,0,0,0],N=Be(12),D=1,Y=Be(Pe.CBANDS),X=Be(Pe.CBANDS),q=[0,0,0,0],F=Be(Pe.HBLKSIZE),j=ke([3,Pe.HBLKSIZE_s]);for(u=0;u<3;u++)O[u]=S.nsPsy.last_en_subshort[c][u+6],N[u]=O[u]/S.nsPsy.last_en_subshort[c][u+4],V[0]+=O[u];if(2==c)for(u=0;u<576;u++){var z,G;z=y[0][u],G=y[1][u],y[0][u]=z+G,y[1][u]=z-G}var Z=y[1&c],K=0;for(u=0;u<9;u++){for(var U=K+64,Q=1;K<U;K++)Q<Math.abs(Z[K])&&(Q=Math.abs(Z[K]));S.nsPsy.last_en_subshort[c][u]=O[u+3]=Q,V[1+u/3]+=Q,Q>O[u+3-2]?Q/=O[u+3-2]:Q=O[u+3-2]>10*Q?O[u+3-2]/(10*Q):0,N[u+3]=Q}if(e.analysis){var W=N[0];for(u=1;u<12;u++)W<N[u]&&(W=N[u]);S.pinfo.ers[s][c]=S.pinfo.ers_save[c],S.pinfo.ers_save[c]=W}for(C=3==c?S.nsPsy.attackthre_s:S.nsPsy.attackthre,u=0;u<12;u++)0==q[u/3]&&N[u]>C&&(q[u/3]=u%3+1);for(u=1;u<4;u++){(V[u-1]>V[u]?V[u-1]/V[u]:V[u]/V[u-1])<1.7&&(q[u]=0,1==u&&(q[0]=0))}for(0!=q[0]&&0!=S.nsPsy.lastAttacks[c]&&(q[0]=0),3!=S.nsPsy.lastAttacks[c]&&q[0]+q[1]+q[2]+q[3]==0||((D=0)!=q[1]&&0!=q[0]&&(q[1]=0),0!=q[2]&&0!=q[1]&&(q[2]=0),0!=q[3]&&0!=q[2]&&(q[3]=0)),c<2?x[c]=D:0==D&&(x[0]=x[1]=0),_[c]=S.tot_ener[c],he(e,F,j,M,1&c,w,1&c,s,c,t,a),Me(S,F,R,Y,X),we(S,Y,X,T),v=0;v<3;v++){var J,$;for(ve(e,j,A,B,c,v),pe(S,A,B,c,v),b=0;b<Pe.SBMAX_s;b++){if($=S.thm[c].s[b][v],$*=.8,2<=q[v]||1==q[v+1]){var ee=0!=v?v-1:2;Q=de(S.thm[c].s[b][ee],$,.6*d);$=Math.min($,Q)}if(1==q[v]){ee=0!=v?v-1:2,Q=de(S.thm[c].s[b][ee],$,fe*d);$=Math.min($,Q)}else if(0!=v&&3==q[v-1]||0==v&&3==S.nsPsy.lastAttacks[c]){ee=2!=v?v+1:0,Q=de(S.thm[c].s[b][ee],$,fe*d);$=Math.min($,Q)}J=O[3*v+3]+O[3*v+4]+O[3*v+5],6*O[3*v+5]<J&&($*=.5,6*O[3*v+4]<J&&($*=.5)),S.thm[c].s[b][v]=$}}for(S.nsPsy.lastAttacks[c]=q[2],h=p=0;h<S.npart_l;h++){for(var te=S.s3ind[h][0],ae=R[te]*ue[T[te]],se=S.s3_ll[p++]*ae;++te<=S.s3ind[h][1];)ae=R[te]*ue[T[te]],se=me(se,S.s3_ll[p++]*ae,te,te-h,S,0);se*=.158489319246111,S.blocktype_old[1&c]==Pe.SHORT_TYPE?B[h]=se:B[h]=de(Math.min(se,Math.min(_e*S.nb_1[c][h],le*S.nb_2[c][h])),se,d),S.nb_2[c][h]=S.nb_1[c][h],S.nb_1[c][h]=se}for(;h<=Pe.CBANDS;++h)R[h]=0,B[h]=0;be(S,R,B,c)}(e.mode!=Ee.STEREO&&e.mode!=Ee.JOINT_STEREO||0<e.interChRatio&&function(e,t){var a=e.internal_flags;if(1<a.channels_out){for(var s=0;s<Pe.SBMAX_l;s++){var n=a.thm[0].l[s],r=a.thm[1].l[s];a.thm[0].l[s]+=r*t,a.thm[1].l[s]+=n*t}for(s=0;s<Pe.SBMAX_s;s++)for(var i=0;i<3;i++)n=a.thm[0].s[s][i],r=a.thm[1].s[s][i],a.thm[0].s[s][i]+=r*t,a.thm[1].s[s][i]+=n*t}}(e,e.interChRatio),e.mode==Ee.JOINT_STEREO)&&(!function(e){for(var t=0;t<Pe.SBMAX_l;t++)if(!(e.thm[0].l[t]>1.58*e.thm[1].l[t]||e.thm[1].l[t]>1.58*e.thm[0].l[t])){var a=e.mld_l[t]*e.en[3].l[t],s=Math.max(e.thm[2].l[t],Math.min(e.thm[3].l[t],a));a=e.mld_l[t]*e.en[2].l[t];var n=Math.max(e.thm[3].l[t],Math.min(e.thm[2].l[t],a));e.thm[2].l[t]=s,e.thm[3].l[t]=n}for(t=0;t<Pe.SBMAX_s;t++)for(var r=0;r<3;r++)e.thm[0].s[t][r]>1.58*e.thm[1].s[t][r]||e.thm[1].s[t][r]>1.58*e.thm[0].s[t][r]||(a=e.mld_s[t]*e.en[3].s[t][r],s=Math.max(e.thm[2].s[t][r],Math.min(e.thm[3].s[t][r],a)),a=e.mld_s[t]*e.en[2].s[t][r],n=Math.max(e.thm[3].s[t][r],Math.min(e.thm[2].s[t][r],a)),e.thm[2].s[t][r]=s,e.thm[3].s[t][r]=n)}(S),g=e.msfix,0<Math.abs(g)&&function(e,t,a){var s=t,n=Math.pow(10,a);t*=2,s*=2;for(var r=0;r<Pe.SBMAX_l;r++)f=e.ATH.cb_l[e.bm_l[r]]*n,(o=Math.min(Math.max(e.thm[0].l[r],f),Math.max(e.thm[1].l[r],f)))*t<(_=Math.max(e.thm[2].l[r],f))+(l=Math.max(e.thm[3].l[r],f))&&(_*=c=o*s/(_+l),l*=c),e.thm[2].l[r]=Math.min(_,e.thm[2].l[r]),e.thm[3].l[r]=Math.min(l,e.thm[3].l[r]);for(n*=Pe.BLKSIZE_s/Pe.BLKSIZE,r=0;r<Pe.SBMAX_s;r++)for(var i=0;i<3;i++){var o,_,l,f,c;f=e.ATH.cb_s[e.bm_s[r]]*n,(o=Math.min(Math.max(e.thm[0].s[r][i],f),Math.max(e.thm[1].s[r][i],f)))*t<(_=Math.max(e.thm[2].s[r][i],f))+(l=Math.max(e.thm[3].s[r][i],f))&&(_*=c=o*t/(_+l),l*=c),e.thm[2].s[r][i]=Math.min(e.thm[2].s[r][i],_),e.thm[3].s[r][i]=Math.min(e.thm[3].s[r][i],l)}}(S,g,e.ATHlower*S.ATH.adjust));for(function(e,t,a,s){var n=e.internal_flags;e.short_blocks!=ye.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var r=0;r<n.channels_out;r++)s[r]=Pe.NORM_TYPE,e.short_blocks==ye.short_block_dispensed&&(t[r]=1),e.short_blocks==ye.short_block_forced&&(t[r]=0),0!=t[r]?n.blocktype_old[r]==Pe.SHORT_TYPE&&(s[r]=Pe.STOP_TYPE):(s[r]=Pe.SHORT_TYPE,n.blocktype_old[r]==Pe.NORM_TYPE&&(n.blocktype_old[r]=Pe.START_TYPE),n.blocktype_old[r]==Pe.STOP_TYPE&&(n.blocktype_old[r]=Pe.SHORT_TYPE)),a[r]=n.blocktype_old[r],n.blocktype_old[r]=s[r]}(e,x,l,k),c=0;c<f;c++){var ne,re,ie,oe=0;1<c?(ne=o,oe=-2,re=Pe.NORM_TYPE,l[0]!=Pe.SHORT_TYPE&&l[1]!=Pe.SHORT_TYPE||(re=Pe.SHORT_TYPE),ie=r[s][c-2]):(ne=i,oe=0,re=l[c],ie=n[s][c]),ne[oe+c]=re==Pe.SHORT_TYPE?ge(ie,S.masking_lower):Se(ie,S.masking_lower),e.analysis&&(S.pinfo.pe[s][c]=ne[oe+c])}return 0};var X=[-1.730326e-17,-.01703172,-1.349528e-17,.0418072,-6.73278e-17,-.0876324,-3.0835e-17,.1863476,-1.104424e-16,-.627638];function q(e,t,a){if(0==a)for(var s=0;s<e.npart_s;s++)e.nb_s2[t][s]=e.nb_s1[t][s],e.nb_s1[t][s]=0}function F(e,t){for(var a=0;a<e.npart_l;a++)e.nb_2[t][a]=e.nb_1[t][a],e.nb_1[t][a]=0}function j(e,t,a,s,n,r){var i,o,_,l=e.internal_flags,f=new float[Pe.CBANDS],c=Be(Pe.CBANDS),h=new int[Pe.CBANDS];for(_=o=0;_<l.npart_s;++_){var u=0,m=0,p=l.numlines_s[_];for(i=0;i<p;++i,++o){var b=t[r][o];u+=b,m<b&&(m=b)}a[_]=u,f[_]=m,c[_]=u/p}for(;_<Pe.CBANDS;++_)f[_]=0,c[_]=0;for(function(e,t,a,s){var n=ue.length-1,r=0,i=a[r]+a[r+1];for(0<i?((o=t[r])<t[r+1]&&(o=t[r+1]),n<(_=0|(i=20*(2*o-i)/(i*(e.numlines_s[r]+e.numlines_s[r+1]-1))))&&(_=n),s[r]=_):s[r]=0,r=1;r<e.npart_s-1;r++){var o,_;0<(i=a[r-1]+a[r]+a[r+1])?((o=t[r-1])<t[r]&&(o=t[r]),o<t[r+1]&&(o=t[r+1]),n<(_=0|(i=20*(3*o-i)/(i*(e.numlines_s[r-1]+e.numlines_s[r]+e.numlines_s[r+1]-1))))&&(_=n),s[r]=_):s[r]=0}0<(i=a[r-1]+a[r])?((o=t[r-1])<t[r]&&(o=t[r]),n<(_=0|(i=20*(2*o-i)/(i*(e.numlines_s[r-1]+e.numlines_s[r]-1))))&&(_=n),s[r]=_):s[r]=0}(l,f,c,h),o=_=0;_<l.npart_s;_++){var v,d,g,S,M,w=l.s3ind_s[_][0],R=l.s3ind_s[_][1];for(v=h[w],d=1,S=l.s3_ss[o]*a[w]*ue[h[w]],++o,++w;w<=R;)v+=h[w],d+=1,S=A(S,g=l.s3_ss[o]*a[w]*ue[h[w]],w-_),++o,++w;S*=M=.5*ue[v=(1+2*v)/(2*d)],s[_]=S,l.nb_s2[n][_]=l.nb_s1[n][_],l.nb_s1[n][_]=S,g=f[_],g*=l.minval_s[_],g*=M,s[_]>g&&(s[_]=g),1<l.masking_lower&&(s[_]*=l.masking_lower),s[_]>a[_]&&(s[_]=a[_]),l.masking_lower<1&&(s[_]*=l.masking_lower)}for(;_<Pe.CBANDS;++_)a[_]=0,s[_]=0}function z(e,t,a,s,n){var r,i=Be(Pe.CBANDS),o=Be(Pe.CBANDS),_=Ae(Pe.CBANDS+2);Me(e,t,a,i,o),we(e,i,o,_);var l=0;for(r=0;r<e.npart_l;r++){var f,c,h,u=e.s3ind[r][0],m=e.s3ind[r][1],p=0,b=0;for(p=_[u],b+=1,c=e.s3_ll[l]*a[u]*ue[_[u]],++l,++u;u<=m;)p+=_[u],b+=1,c=A(c,f=e.s3_ll[l]*a[u]*ue[_[u]],u-r),++l,++u;if(c*=h=.5*ue[p=(1+2*p)/(2*b)],e.blocktype_old[1&n]==Pe.SHORT_TYPE){var v=_e*e.nb_1[n][r];s[r]=0<v?Math.min(c,v):Math.min(c,a[r]*fe)}else{var d=le*e.nb_2[n][r],g=_e*e.nb_1[n][r];d<=0&&(d=c),g<=0&&(g=c),v=e.blocktype_old[1&n]==Pe.NORM_TYPE?Math.min(g,d):g,s[r]=Math.min(c,v)}e.nb_2[n][r]=e.nb_1[n][r],e.nb_1[n][r]=c,f=i[r],f*=e.minval_l[r],f*=h,s[r]>f&&(s[r]=f),1<e.masking_lower&&(s[r]*=e.masking_lower),s[r]>a[r]&&(s[r]=a[r]),e.masking_lower<1&&(s[r]*=e.masking_lower)}for(;r<Pe.CBANDS;++r)a[r]=0,s[r]=0}function G(e,t,a,s,n,r,i){for(var o,_,l=2*r,f=0<r?Math.pow(10,n):1,c=0;c<i;++c){var h=e[2][c],u=e[3][c],m=t[0][c],p=t[1][c],b=t[2][c],v=t[3][c];if(m<=1.58*p&&p<=1.58*m){var d=a[c]*u,g=a[c]*h;_=Math.max(b,Math.min(v,d)),o=Math.max(v,Math.min(b,g))}else _=b,o=v;if(0<r){var S,M,w=s[c]*f;if(S=Math.min(Math.max(m,w),Math.max(p,w)),0<(M=(b=Math.max(_,w))+(v=Math.max(o,w)))&&S*l<M){var R=S*l/M;b*=R,v*=R}_=Math.min(b,_),o=Math.min(v,o)}h<_&&(_=h),u<o&&(o=u),t[2][c]=_,t[3][c]=o}}function w(e,t){var a;return(a=0<=e?27*-e:e*t)<=-72?0:Math.exp(a*S)}function R(e){var t,a,s=0;for(s=0;1e-20<w(s,e);s-=1);for(n=s,r=0;1e-12<Math.abs(r-n);)0<w(s=(r+n)/2,e)?r=s:n=s;t=n;var n,r;s=0;for(s=0;1e-20<w(s,e);s+=1);for(n=0,r=s;1e-12<Math.abs(r-n);)0<w(s=(r+n)/2,e)?n=s:r=s;a=r;var i,o=0;for(i=0;i<=1e3;++i){o+=w(s=t+i*(a-t)/1e3,e)}return 1001/(o*(a-t))}function H(e){return e<0&&(e=0),e*=.001,13*Math.atan(.76*e)+3.5*Math.atan(e*e/56.25)}function C(e,t,a,s,n,r,i,o,_,l,f,c){var h,u=Be(Pe.CBANDS+1),m=o/(15<c?1152:384),p=Ae(Pe.HBLKSIZE);o/=_;var b=0,v=0;for(h=0;h<Pe.CBANDS;h++){var d;for(x=H(o*b),u[h]=o*b,d=b;H(o*d)-x<E&&d<=_/2;d++);for(e[h]=d-b,v=h+1;b<d;)p[b++]=h;if(_/2<b){b=_/2,++h;break}}u[h]=o*b;for(var g=0;g<c;g++){var S,M,w,R,A;w=l[g],R=l[g+1],(S=0|Math.floor(.5+f*(w-.5)))<0&&(S=0),_/2<(M=0|Math.floor(.5+f*(R-.5)))&&(M=_/2),a[g]=(p[S]+p[M])/2,t[g]=p[M];var B=m*R;i[g]=(B-u[t[g]])/(u[t[g]+1]-u[t[g]]),i[g]<0?i[g]=0:1<i[g]&&(i[g]=1),A=H(o*l[g]*f),A=Math.min(A,15.5)/15.5,r[g]=Math.pow(10,1.25*(1-Math.cos(Math.PI*A))-2.5)}for(var k=b=0;k<v;k++){var x,y,T=e[k];x=H(o*b),y=H(o*(b+T-1)),s[k]=.5*(x+y),x=H(o*(b-.5)),y=H(o*(b+T-.5)),n[k]=y-x,b+=T}return v}function O(e,t,a,s,n,r){var i,o,_,l,f,c,h=ke([Pe.CBANDS,Pe.CBANDS]),u=0;if(r)for(var m=0;m<t;m++)for(i=0;i<t;i++){var p=(o=a[m]-a[i],c=f=l=_=void 0,_=o,l=.5<=(_*=0<=_?3:1.5)&&_<=2.5?8*((c=_-.5)*c-2*c):0,((f=15.811389+7.5*(_+=.474)-17.5*Math.sqrt(1+_*_))<=-60?0:(_=Math.exp((l+f)*S),_/=.6609193))*s[i]);h[m][i]=p*n[m]}else for(i=0;i<t;i++){var b=15+Math.min(21/a[i],12),v=R(b);for(m=0;m<t;m++){p=v*w(a[m]-a[i],b)*s[i];h[m][i]=p*n[m]}}for(m=0;m<t;m++){for(i=0;i<t&&!(0<h[m][i]);i++);for(e[m][0]=i,i=t-1;0<i&&!(0<h[m][i]);i--);e[m][1]=i,u+=e[m][1]-e[m][0]+1}var d=Be(u),g=0;for(m=0;m<t;m++)for(i=e[m][0];i<=e[m][1];i++)d[g++]=h[m][i];return d}function V(e){var t=H(e);return t=Math.min(t,15.5)/15.5,Math.pow(10,1.25*(1-Math.cos(Math.PI*t))-2.5)}function s(e,t){return e<-.3&&(e=3410),e/=1e3,e=Math.max(.1,e),3.64*Math.pow(e,-.8)-6.8*Math.exp(-.6*Math.pow(e-3.4,2))+6*Math.exp(-.15*Math.pow(e-8.7,2))+.001*(.6+.04*t)*Math.pow(e,4)}this.L3psycho_anal_vbr=function(e,t,a,s,n,r,i,o,_,l){var f,c,h,u,m,p=e.internal_flags,b=Be(Pe.HBLKSIZE),v=ke([3,Pe.HBLKSIZE_s]),d=ke([2,Pe.BLKSIZE]),g=ke([2,3,Pe.BLKSIZE_s]),S=ke([4,Pe.CBANDS]),M=ke([4,Pe.CBANDS]),w=ke([4,3]),R=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],A=Ae(2),B=e.mode==Ee.JOINT_STEREO?4:p.channels_out;!function(e,t,a,s,n,r,i,o,_,l){for(var f=ke([2,576]),c=e.internal_flags,h=c.channels_out,u=e.mode==Ee.JOINT_STEREO?4:h,m=0;m<h;m++){firbuf=t[m];for(var p=a+576-350-ce+192,b=0;b<576;b++){var v,d;v=firbuf[p+b+10];for(var g=d=0;g<(ce-1)/2-1;g+=2)v+=X[g]*(firbuf[p+b+g]+firbuf[p+b+ce-g]),d+=X[g+1]*(firbuf[p+b+g+1]+firbuf[p+b+ce-g-1]);f[m][b]=v+d}n[s][m].en.assign(c.en[m]),n[s][m].thm.assign(c.thm[m]),2<u&&(r[s][m].en.assign(c.en[m+2]),r[s][m].thm.assign(c.thm[m+2]))}for(m=0;m<u;m++){var S=Be(12),M=Be(12),w=[0,0,0,0],R=f[1&m],A=0,B=3==m?c.nsPsy.attackthre_s:c.nsPsy.attackthre,k=1;if(2==m)for(b=0,g=576;0<g;++b,--g){var x=f[0][b],y=f[1][b];f[0][b]=x+y,f[1][b]=x-y}for(b=0;b<3;b++)M[b]=c.nsPsy.last_en_subshort[m][b+6],S[b]=M[b]/c.nsPsy.last_en_subshort[m][b+4],w[0]+=M[b];for(b=0;b<9;b++){for(var T=A+64,E=1;A<T;A++)E<Math.abs(R[A])&&(E=Math.abs(R[A]));c.nsPsy.last_en_subshort[m][b]=M[b+3]=E,w[1+b/3]+=E,E>M[b+3-2]?E/=M[b+3-2]:E=M[b+3-2]>10*E?M[b+3-2]/(10*E):0,S[b+3]=E}for(b=0;b<3;++b){var P=M[3*b+3]+M[3*b+4]+M[3*b+5],I=1;6*M[3*b+5]<P&&(I*=.5,6*M[3*b+4]<P&&(I*=.5)),o[m][b]=I}if(e.analysis){var L=S[0];for(b=1;b<12;b++)L<S[b]&&(L=S[b]);c.pinfo.ers[s][m]=c.pinfo.ers_save[m],c.pinfo.ers_save[m]=L}for(b=0;b<12;b++)0==_[m][b/3]&&S[b]>B&&(_[m][b/3]=b%3+1);for(b=1;b<4;b++){var H=w[b-1],C=w[b];Math.max(H,C)<4e4&&H<1.7*C&&C<1.7*H&&(1==b&&_[m][0]<=_[m][b]&&(_[m][0]=0),_[m][b]=0)}_[m][0]<=c.nsPsy.lastAttacks[m]&&(_[m][0]=0),3!=c.nsPsy.lastAttacks[m]&&_[m][0]+_[m][1]+_[m][2]+_[m][3]==0||((k=0)!=_[m][1]&&0!=_[m][0]&&(_[m][1]=0),0!=_[m][2]&&0!=_[m][1]&&(_[m][2]=0),0!=_[m][3]&&0!=_[m][2]&&(_[m][3]=0)),m<2?l[m]=k:0==k&&(l[0]=l[1]=0),i[m]=c.tot_ener[m]}}(e,t,a,s,n,r,_,w,R,A),function(e,t){var a=e.internal_flags;e.short_blocks!=ye.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var s=0;s<a.channels_out;s++)e.short_blocks==ye.short_block_dispensed&&(t[s]=1),e.short_blocks==ye.short_block_forced&&(t[s]=0)}(e,A);for(var k=0;k<B;k++){D(e,t,a,k,s,b,d,y=1&k),c=s,h=k,u=b,m=void 0,m=(f=e).internal_flags,2==f.athaa_loudapprox&&h<2&&(m.loudness_sq[c][h]=m.loudness_sq_save[h],m.loudness_sq_save[h]=N(u,m)),0!=A[y]?z(p,b,S[k],M[k],k):F(p,k)}A[0]+A[1]==2&&e.mode==Ee.JOINT_STEREO&&G(S,M,p.mld_cb_l,p.ATH.cb_l,e.ATHlower*p.ATH.adjust,e.msfix,p.npart_l);for(k=0;k<B;k++){0!=A[y=1&k]&&be(p,S[k],M[k],k)}for(var x=0;x<3;x++){for(k=0;k<B;++k){0!=A[y=1&k]?q(p,k,x):(Y(e,t,a,k,x,v,g,y),j(e,v,S[k],M[k],k,x))}A[0]+A[1]==0&&e.mode==Ee.JOINT_STEREO&&G(S,M,p.mld_cb_s,p.ATH.cb_s,e.ATHlower*p.ATH.adjust,e.msfix,p.npart_s);for(k=0;k<B;++k){0==A[y=1&k]&&pe(p,S[k],M[k],k,x)}}for(k=0;k<B;k++){var y;if(0==A[y=1&k])for(var T=0;T<Pe.SBMAX_s;T++){var E=Be(3);for(x=0;x<3;x++){var P=p.thm[k].s[T][x];if(P*=.8,2<=R[k][x]||1==R[k][x+1]){var I=0!=x?x-1:2,L=de(p.thm[k].s[T][I],P,.36);P=Math.min(P,L)}else if(1==R[k][x]){I=0!=x?x-1:2,L=de(p.thm[k].s[T][I],P,.6*fe);P=Math.min(P,L)}else if(0!=x&&3==R[k][x-1]||0==x&&3==p.nsPsy.lastAttacks[k]){I=2!=x?x+1:0,L=de(p.thm[k].s[T][I],P,.6*fe);P=Math.min(P,L)}P*=w[k][x],E[x]=P}for(x=0;x<3;x++)p.thm[k].s[T][x]=E[x]}}for(k=0;k<B;k++)p.nsPsy.lastAttacks[k]=R[k][2];!function(e,t,a){for(var s=e.internal_flags,n=0;n<s.channels_out;n++){var r=Pe.NORM_TYPE;0!=t[n]?s.blocktype_old[n]==Pe.SHORT_TYPE&&(r=Pe.STOP_TYPE):(r=Pe.SHORT_TYPE,s.blocktype_old[n]==Pe.NORM_TYPE&&(s.blocktype_old[n]=Pe.START_TYPE),s.blocktype_old[n]==Pe.STOP_TYPE&&(s.blocktype_old[n]=Pe.SHORT_TYPE)),a[n]=s.blocktype_old[n],s.blocktype_old[n]=r}}(e,A,l);for(k=0;k<B;k++){var H,C,O,V;1<k?(H=o,C=-2,O=Pe.NORM_TYPE,l[0]!=Pe.SHORT_TYPE&&l[1]!=Pe.SHORT_TYPE||(O=Pe.SHORT_TYPE),V=r[s][k-2]):(H=i,C=0,O=l[k],V=n[s][k]),H[C+k]=O==Pe.SHORT_TYPE?ge(V,p.masking_lower):Se(V,p.masking_lower),e.analysis&&(p.pinfo.pe[s][k]=H[C+k])}return 0},this.psymodel_init=function(e){var t,a=e.internal_flags,s=!0,n=13,r=0,i=0,o=-8.25,_=-4.5,l=Be(Pe.CBANDS),f=Be(Pe.CBANDS),c=Be(Pe.CBANDS),h=e.out_samplerate;switch(e.experimentalZ){default:case 0:s=!0;break;case 1:s=e.VBR!=Te.vbr_mtrh&&e.VBR!=Te.vbr_mt;break;case 2:s=!1;break;case 3:n=8,r=-1.75,i=-.0125,o=-8.25,_=-2.25}for(a.ms_ener_ratio_old=.25,a.blocktype_old[0]=a.blocktype_old[1]=Pe.NORM_TYPE,t=0;t<4;++t){for(var u=0;u<Pe.CBANDS;++u)a.nb_1[t][u]=1e20,a.nb_2[t][u]=1e20,a.nb_s1[t][u]=a.nb_s2[t][u]=1;for(var m=0;m<Pe.SBMAX_l;m++)a.en[t].l[m]=1e20,a.thm[t].l[m]=1e20;for(u=0;u<3;++u){for(m=0;m<Pe.SBMAX_s;m++)a.en[t].s[m][u]=1e20,a.thm[t].s[m][u]=1e20;a.nsPsy.lastAttacks[t]=0}for(u=0;u<9;u++)a.nsPsy.last_en_subshort[t][u]=10}for(a.loudness_sq_save[0]=a.loudness_sq_save[1]=0,a.npart_l=C(a.numlines_l,a.bo_l,a.bm_l,l,f,a.mld_l,a.PSY.bo_l_weight,h,Pe.BLKSIZE,a.scalefac_band.l,Pe.BLKSIZE/1152,Pe.SBMAX_l),t=0;t<a.npart_l;t++){var p=r;l[t]>=n&&(p=i*(l[t]-n)/(24-n)+r*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),0<a.numlines_l[t]?a.rnumlines_l[t]=1/a.numlines_l[t]:a.rnumlines_l[t]=0}a.s3_ll=O(a.s3ind,a.npart_l,l,f,c,s);var b;u=0;for(t=0;t<a.npart_l;t++){g=Z.MAX_VALUE;for(var v=0;v<a.numlines_l[t];v++,u++){var d=h*u/(1e3*Pe.BLKSIZE);S=this.ATHformula(1e3*d,e)-20,S=Math.pow(10,.1*S),(S*=a.numlines_l[t])<g&&(g=S)}a.ATH.cb_l[t]=g,6<(g=20*l[t]/10-20)&&(g=100),g<-15&&(g=-15),g-=8,a.minval_l[t]=Math.pow(10,g/10)*a.numlines_l[t]}for(a.npart_s=C(a.numlines_s,a.bo_s,a.bm_s,l,f,a.mld_s,a.PSY.bo_s_weight,h,Pe.BLKSIZE_s,a.scalefac_band.s,Pe.BLKSIZE_s/384,Pe.SBMAX_s),t=u=0;t<a.npart_s;t++){var g;p=o;l[t]>=n&&(p=_*(l[t]-n)/(24-n)+o*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),g=Z.MAX_VALUE;for(v=0;v<a.numlines_s[t];v++,u++){var S;d=h*u/(1e3*Pe.BLKSIZE_s);S=this.ATHformula(1e3*d,e)-20,S=Math.pow(10,.1*S),(S*=a.numlines_s[t])<g&&(g=S)}a.ATH.cb_s[t]=g,g=7*l[t]/12-7,12<l[t]&&(g*=1+3.1*Math.log(1+g)),l[t]<12&&(g*=1+2.3*Math.log(1-g)),g<-15&&(g=-15),g-=8,a.minval_s[t]=Math.pow(10,g/10)*a.numlines_s[t]}a.s3_ss=O(a.s3ind_s,a.npart_s,l,f,c,s),x=Math.pow(10,(P+1)/16),y=Math.pow(10,(I+1)/16),T=Math.pow(10,L/10),B.init_fft(a),a.decay=Math.exp(-1*k/(.01*h/192)),b=3.5,0!=(2&e.exp_nspsytune)&&(b=1),0<Math.abs(e.msfix)&&(b=e.msfix),e.msfix=b;for(var M=0;M<a.npart_l;M++)a.s3ind[M][1]>a.npart_l-1&&(a.s3ind[M][1]=a.npart_l-1);var w=576*a.mode_gr/h;if(a.ATH.decay=Math.pow(10,-1.2*w),a.ATH.adjust=.01,-(a.ATH.adjustLimit=1)!=e.ATHtype){var R=e.out_samplerate/Pe.BLKSIZE,A=0;for(t=d=0;t<Pe.BLKSIZE/2;++t)d+=R,a.ATH.eql_w[t]=1/Math.pow(10,this.ATHformula(d,e)/10),A+=a.ATH.eql_w[t];for(A=1/A,t=Pe.BLKSIZE/2;0<=--t;)a.ATH.eql_w[t]*=A}for(M=u=0;M<a.npart_s;++M)for(t=0;t<a.numlines_s[M];++t)++u;for(M=u=0;M<a.npart_l;++M)for(t=0;t<a.numlines_l[M];++t)++u;for(t=u=0;t<a.npart_l;t++){d=h*(u+a.numlines_l[t]/2)/(1*Pe.BLKSIZE);a.mld_cb_l[t]=V(d),u+=a.numlines_l[t]}for(;t<Pe.CBANDS;++t)a.mld_cb_l[t]=1;for(t=u=0;t<a.npart_s;t++){d=h*(u+a.numlines_s[t]/2)/(1*Pe.BLKSIZE_s);a.mld_cb_s[t]=V(d),u+=a.numlines_s[t]}for(;t<Pe.CBANDS;++t)a.mld_cb_s[t]=1;return 0},this.ATHformula=function(e,t){var a;switch(t.ATHtype){case 0:a=s(e,9);break;case 1:a=s(e,-1);break;case 2:a=s(e,0);break;case 3:a=s(e,1)+6;break;case 4:a=s(e,t.ATHcurve);break;default:a=s(e,0)}return a}}function U(){var o=this;U.V9=410,U.V8=420,U.V7=430,U.V6=440,U.V5=450,U.V4=460,U.V3=470,U.V2=480,U.V1=490,U.V0=500,U.R3MIX=1e3,U.STANDARD=1001,U.EXTREME=1002,U.INSANE=1003,U.STANDARD_FAST=1004,U.EXTREME_FAST=1005,U.MEDIUM=1006,U.MEDIUM_FAST=1007;var w,R,g,S,M;U.LAME_MAXMP3BUFFER=147456;var A,B,k,x=new K;function y(){this.lowerlimit=0}function n(e,t){this.lowpass=t}this.enc=new Pe,this.setModules=function(e,t,a,s,n,r,i,o,_){w=e,R=t,g=a,S=s,M=n,A=r,i,B=o,k=_,this.enc.setModules(R,x,S,A)};var T=4294479419;function E(e){return 1<e?0:e<=0?1:Math.cos(Math.PI/2*e)}function P(e,t){switch(e){case 44100:return t.version=1,0;case 48e3:return t.version=1;case 32e3:return t.version=1,2;case 22050:return t.version=0;case 24e3:return t.version=0,1;case 16e3:return t.version=0,2;case 11025:return t.version=0;case 12e3:return t.version=0,1;case 8e3:return t.version=0,2;default:return t.version=0,-1}}function I(e,t,a){a<16e3&&(t=2);for(var s=F.bitrate_table[t][1],n=2;n<=14;n++)0<F.bitrate_table[t][n]&&Math.abs(F.bitrate_table[t][n]-e)<Math.abs(s-e)&&(s=F.bitrate_table[t][n]);return s}function L(e,t,a){a<16e3&&(t=2);for(var s=0;s<=14;s++)if(0<F.bitrate_table[t][s]&&F.bitrate_table[t][s]==e)return s;return-1}function H(e,t){var a=[new n(8,2e3),new n(16,3700),new n(24,3900),new n(32,5500),new n(40,7e3),new n(48,7500),new n(56,1e4),new n(64,11e3),new n(80,13500),new n(96,15100),new n(112,15600),new n(128,17e3),new n(160,17500),new n(192,18600),new n(224,19400),new n(256,19700),new n(320,20500)],s=o.nearestBitrateFullIndex(t);e.lowerlimit=a[s].lowpass}function C(e){var t=Pe.BLKSIZE+e.framesize-Pe.FFTOFFSET;return t=Math.max(t,512+e.framesize-32)}function O(e,t,a,s,n,r){var i=o.enc.lame_encode_mp3_frame(e,t,a,s,n,r);return e.frameNum++,i}function V(){this.n_in=0,this.n_out=0}function f(){this.num_used=0}function N(e,t,a){var s=Math.PI*t;(e/=a)<0&&(e=0),1<e&&(e=1);var n=e-.5,r=.42-.5*Math.cos(2*e*Math.PI)+.08*Math.cos(4*e*Math.PI);return Math.abs(n)<1e-9?s/Math.PI:r*Math.sin(a*s*n)/(Math.PI*a*n)}function c(e,t,a,s,n,r,i,o,_){var l,f,c=e.internal_flags,h=0,u=e.out_samplerate/function e(t,a){return 0!=a?e(a,t%a):t}(e.out_samplerate,e.in_samplerate);G.BPC<u&&(u=G.BPC);var m=Math.abs(c.resample_ratio-Math.floor(.5+c.resample_ratio))<1e-4?1:0,p=1/c.resample_ratio;1<p&&(p=1);var b=31;0==b%2&&--b;var v=(b+=m)+1;if(0==c.fill_buffer_resample_init){for(c.inbuf_old[0]=Be(v),c.inbuf_old[1]=Be(v),l=0;l<=2*u;++l)c.blackfilt[l]=Be(v);for(c.itime[0]=0,h=c.itime[1]=0;h<=2*u;h++){var d=0,g=(h-u)/(2*u);for(l=0;l<=b;l++)d+=c.blackfilt[h][l]=N(l-g,p,b);for(l=0;l<=b;l++)c.blackfilt[h][l]/=d}c.fill_buffer_resample_init=1}var S=c.inbuf_old[_];for(f=0;f<s;f++){var M,w;if(M=f*c.resample_ratio,i<=b+(h=0|Math.floor(M-c.itime[_]))-b/2)break;g=M-c.itime[_]-(h+b%2*.5);w=0|Math.floor(2*g*u+u+.5);var R=0;for(l=0;l<=b;++l){var A=l+h-b/2;R+=(A<0?S[v+A]:n[r+A])*c.blackfilt[w][l]}t[a+f]=R}if(o.num_used=Math.min(i,b+h-b/2),c.itime[_]+=o.num_used-f*c.resample_ratio,o.num_used>=v)for(l=0;l<v;l++)S[l]=n[r+o.num_used+l-v];else{var B=v-o.num_used;for(l=0;l<B;++l)S[l]=S[l+o.num_used];for(h=0;l<v;++l,++h)S[l]=n[r+h]}return f}function D(e,t,a,s,n,r){var i=e.internal_flags;if(i.resample_ratio<.9999||1.0001<i.resample_ratio)for(var o=0;o<i.channels_out;o++){var _=new f;r.n_out=c(e,t[o],i.mf_size,e.framesize,a[o],s,n,_,o),r.n_in=_.num_used}else{r.n_out=Math.min(e.framesize,n),r.n_in=r.n_out;for(var l=0;l<r.n_out;++l)t[0][i.mf_size+l]=a[0][s+l],2==i.channels_out&&(t[1][i.mf_size+l]=a[1][s+l])}}this.lame_init=function(){var e,t,a=new function(){this.class_id=0,this.num_samples=0,this.num_channels=0,this.in_samplerate=0,this.out_samplerate=0,this.scale=0,this.scale_left=0,this.scale_right=0,this.analysis=!1,this.bWriteVbrTag=!1,this.decode_only=!1,this.quality=0,this.mode=Ee.STEREO,this.force_ms=!1,this.free_format=!1,this.findReplayGain=!1,this.decode_on_the_fly=!1,this.write_id3tag_automatic=!1,this.brate=0,this.compression_ratio=0,this.copyright=0,this.original=0,this.extension=0,this.emphasis=0,this.error_protection=0,this.strict_ISO=!1,this.disable_reservoir=!1,this.quant_comp=0,this.quant_comp_short=0,this.experimentalY=!1,this.experimentalZ=0,this.exp_nspsytune=0,this.preset=0,this.VBR=null,this.VBR_q_frac=0,this.VBR_q=0,this.VBR_mean_bitrate_kbps=0,this.VBR_min_bitrate_kbps=0,this.VBR_max_bitrate_kbps=0,this.VBR_hard_min=0,this.lowpassfreq=0,this.highpassfreq=0,this.lowpasswidth=0,this.highpasswidth=0,this.maskingadjust=0,this.maskingadjust_short=0,this.ATHonly=!1,this.ATHshort=!1,this.noATH=!1,this.ATHtype=0,this.ATHcurve=0,this.ATHlower=0,this.athaa_type=0,this.athaa_loudapprox=0,this.athaa_sensitivity=0,this.short_blocks=null,this.useTemporal=!1,this.interChRatio=0,this.msfix=0,this.tune=!1,this.tune_value_a=0,this.version=0,this.encoder_delay=0,this.encoder_padding=0,this.framesize=0,this.frameNum=0,this.lame_allocated_gfp=0,this.internal_flags=null};return 0!=((e=a).class_id=T,t=e.internal_flags=new G,e.mode=Ee.NOT_SET,e.original=1,e.in_samplerate=44100,e.num_channels=2,e.num_samples=-1,e.bWriteVbrTag=!0,e.quality=-1,e.short_blocks=null,t.subblock_gain=-1,e.lowpassfreq=0,e.highpassfreq=0,e.lowpasswidth=-1,e.highpasswidth=-1,e.VBR=Te.vbr_off,e.VBR_q=4,e.ATHcurve=-1,e.VBR_mean_bitrate_kbps=128,e.VBR_min_bitrate_kbps=0,e.VBR_max_bitrate_kbps=0,e.VBR_hard_min=0,t.VBR_min_bitrate=1,t.VBR_max_bitrate=13,e.quant_comp=-1,e.quant_comp_short=-1,e.msfix=-1,t.resample_ratio=1,t.OldValue[0]=180,t.OldValue[1]=180,t.CurrentStep[0]=4,t.CurrentStep[1]=4,t.masking_lower=1,t.nsPsy.attackthre=-1,t.nsPsy.attackthre_s=-1,e.scale=-1,e.athaa_type=-1,e.ATHtype=-1,e.athaa_loudapprox=-1,e.athaa_sensitivity=0,e.useTemporal=null,e.interChRatio=-1,t.mf_samples_to_encode=Pe.ENCDELAY+Pe.POSTDELAY,e.encoder_padding=0,t.mf_size=Pe.ENCDELAY-Pe.MDCTDELAY,e.findReplayGain=!1,e.decode_on_the_fly=!1,t.decode_on_the_fly=!1,t.findReplayGain=!1,t.findPeakSample=!1,t.RadioGain=0,t.AudiophileGain=0,t.noclipGainChange=0,t.noclipScale=-1,e.preset=0,e.write_id3tag_automatic=!0,0)?null:(a.lame_allocated_gfp=1,a)},this.nearestBitrateFullIndex=function(e){var t=[8,16,24,32,40,48,56,64,80,96,112,128,160,192,224,256,320],a=0,s=0,n=0,r=0;r=t[16],s=t[n=16],a=16;for(var i=0;i<16;i++)if(Math.max(e,t[i+1])!=e){r=t[i+1],n=i+1,s=t[i],a=i;break}return e-s<r-e?a:n},this.lame_init_params=function(e){var t,a,s,n=e.internal_flags;if(n.Class_ID=0,null==n.ATH&&(n.ATH=new function(){this.useAdjust=0,this.aaSensitivityP=0,this.adjust=0,this.adjustLimit=0,this.decay=0,this.floor=0,this.l=Be(Pe.SBMAX_l),this.s=Be(Pe.SBMAX_s),this.psfb21=Be(Pe.PSFB21),this.psfb12=Be(Pe.PSFB12),this.cb_l=Be(Pe.CBANDS),this.cb_s=Be(Pe.CBANDS),this.eql_w=Be(Pe.BLKSIZE/2)}),null==n.PSY&&(n.PSY=new function(){this.mask_adjust=0,this.mask_adjust_short=0,this.bo_l_weight=Be(Pe.SBMAX_l),this.bo_s_weight=Be(Pe.SBMAX_s)}),null==n.rgdata&&(n.rgdata=new function(){}),n.channels_in=e.num_channels,1==n.channels_in&&(e.mode=Ee.MONO),n.channels_out=e.mode==Ee.MONO?1:2,n.mode_ext=Pe.MPG_MD_MS_LR,e.mode==Ee.MONO&&(e.force_ms=!1),e.VBR==Te.vbr_off&&128!=e.VBR_mean_bitrate_kbps&&0==e.brate&&(e.brate=e.VBR_mean_bitrate_kbps),e.VBR==Te.vbr_off||e.VBR==Te.vbr_mtrh||e.VBR==Te.vbr_mt||(e.free_format=!1),e.VBR==Te.vbr_off&&0==e.brate&&q.EQ(e.compression_ratio,0)&&(e.compression_ratio=11.025),e.VBR==Te.vbr_off&&0<e.compression_ratio&&(0==e.out_samplerate&&(e.out_samplerate=map2MP3Frequency(int(.97*e.in_samplerate))),e.brate=0|16*e.out_samplerate*n.channels_out/(1e3*e.compression_ratio),n.samplerate_index=P(e.out_samplerate,e),e.free_format||(e.brate=I(e.brate,e.version,e.out_samplerate))),0!=e.out_samplerate&&(e.out_samplerate<16e3?(e.VBR_mean_bitrate_kbps=Math.max(e.VBR_mean_bitrate_kbps,8),e.VBR_mean_bitrate_kbps=Math.min(e.VBR_mean_bitrate_kbps,64)):e.out_samplerate<32e3?(e.VBR_mean_bitrate_kbps=Math.max(e.VBR_mean_bitrate_kbps,8),e.VBR_mean_bitrate_kbps=Math.min(e.VBR_mean_bitrate_kbps,160)):(e.VBR_mean_bitrate_kbps=Math.max(e.VBR_mean_bitrate_kbps,32),e.VBR_mean_bitrate_kbps=Math.min(e.VBR_mean_bitrate_kbps,320))),0==e.lowpassfreq){var r=16e3;switch(e.VBR){case Te.vbr_off:H(i=new y,e.brate),r=i.lowerlimit;break;case Te.vbr_abr:var i;H(i=new y,e.VBR_mean_bitrate_kbps),r=i.lowerlimit;break;case Te.vbr_rh:var o=[19500,19e3,18600,18e3,17500,16e3,15600,14900,12500,1e4,3950];if(0<=e.VBR_q&&e.VBR_q<=9){var _=o[e.VBR_q],l=o[e.VBR_q+1],f=e.VBR_q_frac;r=linear_int(_,l,f)}else r=19500;break;default:o=[19500,19e3,18500,18e3,17500,16500,15500,14500,12500,9500,3950];if(0<=e.VBR_q&&e.VBR_q<=9){_=o[e.VBR_q],l=o[e.VBR_q+1],f=e.VBR_q_frac;r=linear_int(_,l,f)}else r=19500}e.mode!=Ee.MONO||e.VBR!=Te.vbr_off&&e.VBR!=Te.vbr_abr||(r*=1.5),e.lowpassfreq=0|r}if(0==e.out_samplerate&&(2*e.lowpassfreq>e.in_samplerate&&(e.lowpassfreq=e.in_samplerate/2),e.out_samplerate=(t=0|e.lowpassfreq,a=e.in_samplerate,s=44100,48e3<=a?s=48e3:44100<=a?s=44100:32e3<=a?s=32e3:24e3<=a?s=24e3:22050<=a?s=22050:16e3<=a?s=16e3:12e3<=a?s=12e3:11025<=a?s=11025:8e3<=a&&(s=8e3),-1==t?s:(t<=15960&&(s=44100),t<=15250&&(s=32e3),t<=11220&&(s=24e3),t<=9970&&(s=22050),t<=7230&&(s=16e3),t<=5420&&(s=12e3),t<=4510&&(s=11025),t<=3970&&(s=8e3),a<s?44100<a?48e3:32e3<a?44100:24e3<a?32e3:22050<a?24e3:16e3<a?22050:12e3<a?16e3:11025<a?12e3:8e3<a?11025:8e3:s))),e.lowpassfreq=Math.min(20500,e.lowpassfreq),e.lowpassfreq=Math.min(e.out_samplerate/2,e.lowpassfreq),e.VBR==Te.vbr_off&&(e.compression_ratio=16*e.out_samplerate*n.channels_out/(1e3*e.brate)),e.VBR==Te.vbr_abr&&(e.compression_ratio=16*e.out_samplerate*n.channels_out/(1e3*e.VBR_mean_bitrate_kbps)),e.bWriteVbrTag||(e.findReplayGain=!1,e.decode_on_the_fly=!1,n.findPeakSample=!1),n.findReplayGain=e.findReplayGain,n.decode_on_the_fly=e.decode_on_the_fly,n.decode_on_the_fly&&(n.findPeakSample=!0),n.findReplayGain&&w.InitGainAnalysis(n.rgdata,e.out_samplerate)==X.INIT_GAIN_ANALYSIS_ERROR)return e.internal_flags=null,-6;switch(n.decode_on_the_fly&&!e.decode_only&&(null!=n.hip&&k.hip_decode_exit(n.hip),n.hip=k.hip_decode_init()),n.mode_gr=e.out_samplerate<=24e3?1:2,e.framesize=576*n.mode_gr,e.encoder_delay=Pe.ENCDELAY,n.resample_ratio=e.in_samplerate/e.out_samplerate,e.VBR){case Te.vbr_mt:case Te.vbr_rh:case Te.vbr_mtrh:e.compression_ratio=[5.7,6.5,7.3,8.2,10,11.9,13,14,15,16.5][e.VBR_q];break;case Te.vbr_abr:e.compression_ratio=16*e.out_samplerate*n.channels_out/(1e3*e.VBR_mean_bitrate_kbps);break;default:e.compression_ratio=16*e.out_samplerate*n.channels_out/(1e3*e.brate)}if(e.mode==Ee.NOT_SET&&(e.mode=Ee.JOINT_STEREO),0<e.highpassfreq?(n.highpass1=2*e.highpassfreq,0<=e.highpasswidth?n.highpass2=2*(e.highpassfreq+e.highpasswidth):n.highpass2=2*e.highpassfreq,n.highpass1/=e.out_samplerate,n.highpass2/=e.out_samplerate):(n.highpass1=0,n.highpass2=0),0<e.lowpassfreq?(n.lowpass2=2*e.lowpassfreq,0<=e.lowpasswidth?(n.lowpass1=2*(e.lowpassfreq-e.lowpasswidth),n.lowpass1<0&&(n.lowpass1=0)):n.lowpass1=2*e.lowpassfreq,n.lowpass1/=e.out_samplerate,n.lowpass2/=e.out_samplerate):(n.lowpass1=0,n.lowpass2=0),function(e){var t=e.internal_flags,a=32,s=-1;if(0<t.lowpass1){for(var n=999,r=0;r<=31;r++)(l=r/31)>=t.lowpass2&&(a=Math.min(a,r)),t.lowpass1<l&&l<t.lowpass2&&(n=Math.min(n,r));t.lowpass1=999==n?(a-.75)/31:(n-.75)/31,t.lowpass2=a/31}if(0<t.highpass2&&t.highpass2<.75/31*.9&&(t.highpass1=0,t.highpass2=0,$.err.println("Warning: highpass filter disabled. highpass frequency too small\n")),0<t.highpass2){var i=-1;for(r=0;r<=31;r++)(l=r/31)<=t.highpass1&&(s=Math.max(s,r)),t.highpass1<l&&l<t.highpass2&&(i=Math.max(i,r));t.highpass1=s/31,t.highpass2=-1==i?(s+.75)/31:(i+.75)/31}for(r=0;r<32;r++){var o,_,l=r/31;o=t.highpass2>t.highpass1?E((t.highpass2-l)/(t.highpass2-t.highpass1+1e-20)):1,_=t.lowpass2>t.lowpass1?E((l-t.lowpass1)/(t.lowpass2-t.lowpass1+1e-20)):1,t.amp_filter[r]=o*_}}(e),n.samplerate_index=P(e.out_samplerate,e),n.samplerate_index<0)return e.internal_flags=null,-1;if(e.VBR==Te.vbr_off){if(e.free_format)n.bitrate_index=0;else if(e.brate=I(e.brate,e.version,e.out_samplerate),n.bitrate_index=L(e.brate,e.version,e.out_samplerate),n.bitrate_index<=0)return e.internal_flags=null,-1}else n.bitrate_index=1;e.analysis&&(e.bWriteVbrTag=!1),null!=n.pinfo&&(e.bWriteVbrTag=!1),R.init_bit_stream_w(n);for(var c,h,u,m=n.samplerate_index+3*e.version+6*(e.out_samplerate<16e3?1:0),p=0;p<Pe.SBMAX_l+1;p++)n.scalefac_band.l[p]=S.sfBandIndex[m].l[p];for(p=0;p<Pe.PSFB21+1;p++){var b=(n.scalefac_band.l[22]-n.scalefac_band.l[21])/Pe.PSFB21,v=n.scalefac_band.l[21]+p*b;n.scalefac_band.psfb21[p]=v}n.scalefac_band.psfb21[Pe.PSFB21]=576;for(p=0;p<Pe.SBMAX_s+1;p++)n.scalefac_band.s[p]=S.sfBandIndex[m].s[p];for(p=0;p<Pe.PSFB12+1;p++){b=(n.scalefac_band.s[13]-n.scalefac_band.s[12])/Pe.PSFB12,v=n.scalefac_band.s[12]+p*b;n.scalefac_band.psfb12[p]=v}for(n.scalefac_band.psfb12[Pe.PSFB12]=192,1==e.version?n.sideinfo_len=1==n.channels_out?21:36:n.sideinfo_len=1==n.channels_out?13:21,e.error_protection&&(n.sideinfo_len+=2),h=(c=e).internal_flags,c.frameNum=0,c.write_id3tag_automatic&&B.id3tag_write_v2(c),h.bitrate_stereoMode_Hist=Y([16,5]),h.bitrate_blockType_Hist=Y([16,6]),h.PeakSample=0,c.bWriteVbrTag&&A.InitVbrTag(c),n.Class_ID=T,u=0;u<19;u++)n.nsPsy.pefirbuf[u]=700*n.mode_gr*n.channels_out;switch(-1==e.ATHtype&&(e.ATHtype=4),e.VBR){case Te.vbr_mt:e.VBR=Te.vbr_mtrh;case Te.vbr_mtrh:null==e.useTemporal&&(e.useTemporal=!1),g.apply_preset(e,500-10*e.VBR_q,0),e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),e.quality<5&&(e.quality=0),5<e.quality&&(e.quality=5),n.PSY.mask_adjust=e.maskingadjust,n.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?n.sfb21_extra=!1:n.sfb21_extra=44e3<e.out_samplerate,n.iteration_loop=new VBRNewIterationLoop(M);break;case Te.vbr_rh:g.apply_preset(e,500-10*e.VBR_q,0),n.PSY.mask_adjust=e.maskingadjust,n.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?n.sfb21_extra=!1:n.sfb21_extra=44e3<e.out_samplerate,6<e.quality&&(e.quality=6),e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),n.iteration_loop=new VBROldIterationLoop(M);break;default:var d;n.sfb21_extra=!1,e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),(d=e.VBR)==Te.vbr_off&&(e.VBR_mean_bitrate_kbps=e.brate),g.apply_preset(e,e.VBR_mean_bitrate_kbps,0),e.VBR=d,n.PSY.mask_adjust=e.maskingadjust,n.PSY.mask_adjust_short=e.maskingadjust_short,n.iteration_loop=d==Te.vbr_off?new function(e){var t=e;this.quantize=t,this.iteration_loop=function(e,t,a,s){var n,r=e.internal_flags,i=Be(z.SFBMAX),o=Be(576),_=Ae(2),l=0,f=r.l3_side,c=new j(l);this.quantize.rv.ResvFrameBegin(e,c),l=c.bits;for(var h=0;h<r.mode_gr;h++){n=this.quantize.qupvt.on_pe(e,t,_,l,h,h),r.mode_ext==Pe.MPG_MD_MS_LR&&(this.quantize.ms_convert(r.l3_side,h),this.quantize.qupvt.reduce_side(_,a[h],l,n));for(var u=0;u<r.channels_out;u++){var m,p,b=f.tt[h][u];b.block_type!=Pe.SHORT_TYPE?(m=0,p=r.PSY.mask_adjust-m):(m=0,p=r.PSY.mask_adjust_short-m),r.masking_lower=Math.pow(10,.1*p),this.quantize.init_outer_loop(r,b),this.quantize.init_xrpow(r,b,o)&&(this.quantize.qupvt.calc_xmin(e,s[h][u],b,i),this.quantize.outer_loop(e,b,i,o,u,_[u])),this.quantize.iteration_finish_one(r,h,u)}}this.quantize.rv.ResvFrameEnd(r,l)}}(M):new ABRIterationLoop(M)}if(e.VBR!=Te.vbr_off){if(n.VBR_min_bitrate=1,n.VBR_max_bitrate=14,e.out_samplerate<16e3&&(n.VBR_max_bitrate=8),0!=e.VBR_min_bitrate_kbps&&(e.VBR_min_bitrate_kbps=I(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),n.VBR_min_bitrate=L(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),n.VBR_min_bitrate<0))return-1;if(0!=e.VBR_max_bitrate_kbps&&(e.VBR_max_bitrate_kbps=I(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),n.VBR_max_bitrate=L(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),n.VBR_max_bitrate<0))return-1;e.VBR_min_bitrate_kbps=F.bitrate_table[e.version][n.VBR_min_bitrate],e.VBR_max_bitrate_kbps=F.bitrate_table[e.version][n.VBR_max_bitrate],e.VBR_mean_bitrate_kbps=Math.min(F.bitrate_table[e.version][n.VBR_max_bitrate],e.VBR_mean_bitrate_kbps),e.VBR_mean_bitrate_kbps=Math.max(F.bitrate_table[e.version][n.VBR_min_bitrate],e.VBR_mean_bitrate_kbps)}return e.tune&&(n.PSY.mask_adjust+=e.tune_value_a,n.PSY.mask_adjust_short+=e.tune_value_a),function(e){var t=e.internal_flags;switch(e.quality){default:case 9:t.psymodel=0,t.noise_shaping=0,t.noise_shaping_amp=0,t.noise_shaping_stop=0,t.use_best_huffman=0,t.full_outer_loop=0;break;case 8:e.quality=7;case 7:t.psymodel=1,t.noise_shaping=0,t.noise_shaping_amp=0,t.noise_shaping_stop=0,t.use_best_huffman=0,t.full_outer_loop=0;break;case 6:case 5:t.psymodel=1,0==t.noise_shaping&&(t.noise_shaping=1),t.noise_shaping_amp=0,t.noise_shaping_stop=0,-1==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=0,t.full_outer_loop=0;break;case 4:t.psymodel=1,0==t.noise_shaping&&(t.noise_shaping=1),t.noise_shaping_amp=0,t.noise_shaping_stop=0,-1==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=1,t.full_outer_loop=0;break;case 3:t.psymodel=1,0==t.noise_shaping&&(t.noise_shaping=1),t.noise_shaping_amp=1,-(t.noise_shaping_stop=1)==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=1,t.full_outer_loop=0;break;case 2:t.psymodel=1,0==t.noise_shaping&&(t.noise_shaping=1),0==t.substep_shaping&&(t.substep_shaping=2),t.noise_shaping_amp=1,-(t.noise_shaping_stop=1)==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=1,t.full_outer_loop=0;break;case 1:case 0:t.psymodel=1,0==t.noise_shaping&&(t.noise_shaping=1),0==t.substep_shaping&&(t.substep_shaping=2),t.noise_shaping_amp=2,-(t.noise_shaping_stop=1)==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=1,t.full_outer_loop=0}}(e),e.athaa_type<0?n.ATH.useAdjust=3:n.ATH.useAdjust=e.athaa_type,n.ATH.aaSensitivityP=Math.pow(10,e.athaa_sensitivity/-10),null==e.short_blocks&&(e.short_blocks=ye.short_block_allowed),e.short_blocks!=ye.short_block_allowed||e.mode!=Ee.JOINT_STEREO&&e.mode!=Ee.STEREO||(e.short_blocks=ye.short_block_coupled),e.quant_comp<0&&(e.quant_comp=1),e.quant_comp_short<0&&(e.quant_comp_short=0),e.msfix<0&&(e.msfix=0),e.exp_nspsytune=1|e.exp_nspsytune,e.internal_flags.nsPsy.attackthre<0&&(e.internal_flags.nsPsy.attackthre=K.NSATTACKTHRE),e.internal_flags.nsPsy.attackthre_s<0&&(e.internal_flags.nsPsy.attackthre_s=K.NSATTACKTHRE_S),e.scale<0&&(e.scale=1),e.ATHtype<0&&(e.ATHtype=4),e.ATHcurve<0&&(e.ATHcurve=4),e.athaa_loudapprox<0&&(e.athaa_loudapprox=2),e.interChRatio<0&&(e.interChRatio=0),null==e.useTemporal&&(e.useTemporal=!0),n.slot_lag=n.frac_SpF=0,e.VBR==Te.vbr_off&&(n.slot_lag=n.frac_SpF=72e3*(e.version+1)*e.brate%e.out_samplerate|0),S.iteration_init(e),x.psymodel_init(e),0},this.lame_encode_flush=function(e,t,a,s){var n,r,i,o,_=e.internal_flags,l=p([2,1152]),f=0,c=_.mf_samples_to_encode-Pe.POSTDELAY,h=C(e);if(_.mf_samples_to_encode<1)return 0;for(n=0,e.in_samplerate!=e.out_samplerate&&(c+=16*e.out_samplerate/e.in_samplerate),(i=e.framesize-c%e.framesize)<576&&(i+=e.framesize),o=(c+(e.encoder_padding=i))/e.framesize;0<o&&0<=f;){var u=h-_.mf_size,m=e.frameNum;u*=e.in_samplerate,1152<(u/=e.out_samplerate)&&(u=1152),u<1&&(u=1),r=s-n,0==s&&(r=0),a+=f=this.lame_encode_buffer(e,l[0],l[1],u,t,a,r),n+=f,o-=m!=e.frameNum?1:0}if(f<(_.mf_samples_to_encode=0))return f;if(r=s-n,0==s&&(r=0),R.flush_bitstream(e),(f=R.copy_buffer(_,t,a,r,1))<0)return f;if(a+=f,r=s-(n+=f),0==s&&(r=0),e.write_id3tag_automatic){if(B.id3tag_write_v1(e),(f=R.copy_buffer(_,t,a,r,0))<0)return f;n+=f}return n},this.lame_encode_buffer=function(e,t,a,s,n,r,i){var o,_,l=e.internal_flags,f=[null,null];if(l.Class_ID!=T)return-3;if(0==s)return 0;_=s,(null==(o=l).in_buffer_0||o.in_buffer_nsamples<_)&&(o.in_buffer_0=Be(_),o.in_buffer_1=Be(_),o.in_buffer_nsamples=_),f[0]=l.in_buffer_0,f[1]=l.in_buffer_1;for(var c=0;c<s;c++)f[0][c]=t[c],1<l.channels_in&&(f[1][c]=a[c]);return function(e,t,a,s,n,r,i){var o,_,l,f,c,h=e.internal_flags,u=0,m=[null,null],p=[null,null];if(h.Class_ID!=T)return-3;if(0==s)return 0;if((c=R.copy_buffer(h,n,r,i,0))<0)return c;if(r+=c,u+=c,p[0]=t,p[1]=a,q.NEQ(e.scale,0)&&q.NEQ(e.scale,1))for(_=0;_<s;++_)p[0][_]*=e.scale,2==h.channels_out&&(p[1][_]*=e.scale);if(q.NEQ(e.scale_left,0)&&q.NEQ(e.scale_left,1))for(_=0;_<s;++_)p[0][_]*=e.scale_left;if(q.NEQ(e.scale_right,0)&&q.NEQ(e.scale_right,1))for(_=0;_<s;++_)p[1][_]*=e.scale_right;if(2==e.num_channels&&1==h.channels_out)for(_=0;_<s;++_)p[0][_]=.5*(p[0][_]+p[1][_]),p[1][_]=0;f=C(e),m[0]=h.mfbuf[0],m[1]=h.mfbuf[1];var b=0;for(;0<s;){var v=[null,null],d=0,g=0;v[0]=p[0],v[1]=p[1];var S=new V;if(D(e,m,v,b,s,S),d=S.n_in,g=S.n_out,h.findReplayGain&&!h.decode_on_the_fly&&w.AnalyzeSamples(h.rgdata,m[0],h.mf_size,m[1],h.mf_size,g,h.channels_out)==X.GAIN_ANALYSIS_ERROR)return-6;if(s-=d,b+=d,h.channels_out,h.mf_size+=g,h.mf_samples_to_encode<1&&(h.mf_samples_to_encode=Pe.ENCDELAY+Pe.POSTDELAY),h.mf_samples_to_encode+=g,h.mf_size>=f){var M=i-u;if(0==i&&(M=0),(o=O(e,m[0],m[1],n,r,M))<0)return o;for(r+=o,u+=o,h.mf_size-=e.framesize,h.mf_samples_to_encode-=e.framesize,l=0;l<h.channels_out;l++)for(_=0;_<h.mf_size;_++)m[l][_]=m[l][_+e.framesize]}}return u}(e,f[0],f[1],s,n,r,i)}}z.SFBMAX=3*Pe.SBMAX_s,Pe.ENCDELAY=576,Pe.POSTDELAY=1152,Pe.FFTOFFSET=224+(Pe.MDCTDELAY=48),Pe.DECDELAY=528,Pe.SBLIMIT=32,Pe.CBANDS=64,Pe.SBPSY_l=21,Pe.SBPSY_s=12,Pe.SBMAX_l=22,Pe.SBMAX_s=13,Pe.PSFB21=6,Pe.PSFB12=6,Pe.HBLKSIZE=(Pe.BLKSIZE=1024)/2+1,Pe.HBLKSIZE_s=(Pe.BLKSIZE_s=256)/2+1,Pe.NORM_TYPE=0,Pe.START_TYPE=1,Pe.SHORT_TYPE=2,Pe.STOP_TYPE=3,Pe.MPG_MD_LR_LR=0,Pe.MPG_MD_LR_I=1,Pe.MPG_MD_MS_LR=2,Pe.MPG_MD_MS_I=3,Pe.fircoef=[-.1039435,-.1892065,5*-.0432472,-.155915,3.898045e-17,.0467745*5,.50455,.756825,.187098*5],G.MFSIZE=3456+Pe.ENCDELAY-Pe.MDCTDELAY,G.MAX_HEADER_BUF=256,G.MAX_BITS_PER_CHANNEL=4095,G.MAX_BITS_PER_GRANULE=7680,G.BPC=320,z.SFBMAX=3*Pe.SBMAX_s,t.Mp3Encoder=function(s,e,t){3!=arguments.length&&(console.error("WARN: Mp3Encoder(channels, samplerate, kbps) not specified"),s=1,e=44100,t=128);var n=new U,a=new function(){this.setModules=function(e,t){}},r=new X,i=new q,o=new function(){function e(e,t,a,s,n,r,i,o,_,l,f,c,h,u,m){this.vbr_q=e,this.quant_comp=t,this.quant_comp_s=a,this.expY=s,this.st_lrm=n,this.st_s=r,this.masking_adj=i,this.masking_adj_short=o,this.ath_lower=_,this.ath_curve=l,this.ath_sensitivity=f,this.interch=c,this.safejoint=h,this.sfb21mod=u,this.msfix=m}function t(e,t,a,s,n,r,i,o,_,l,f,c,h,u){this.quant_comp=t,this.quant_comp_s=a,this.safejoint=s,this.nsmsfix=n,this.st_lrm=r,this.st_s=i,this.nsbass=o,this.scale=_,this.masking_adj=l,this.ath_lower=f,this.ath_curve=c,this.interch=h,this.sfscale=u}var i;this.setModules=function(e){i=e};var f=[new e(0,9,9,0,5.2,125,-4.2,-6.3,4.8,1,0,0,2,21,.97),new e(1,9,9,0,5.3,125,-3.6,-5.6,4.5,1.5,0,0,2,21,1.35),new e(2,9,9,0,5.6,125,-2.2,-3.5,2.8,2,0,0,2,21,1.49),new e(3,9,9,1,5.8,130,-1.8,-2.8,2.6,3,-4,0,2,20,1.64),new e(4,9,9,1,6,135,-.7,-1.1,1.1,3.5,-8,0,2,0,1.79),new e(5,9,9,1,6.4,140,.5,.4,-7.5,4,-12,2e-4,0,0,1.95),new e(6,9,9,1,6.6,145,.67,.65,-14.7,6.5,-19,4e-4,0,0,2.3),new e(7,9,9,1,6.6,145,.8,.75,-19.7,8,-22,6e-4,0,0,2.7),new e(8,9,9,1,6.6,145,1.2,1.15,-27.5,10,-23,7e-4,0,0,0),new e(9,9,9,1,6.6,145,1.6,1.6,-36,11,-25,8e-4,0,0,0),new e(10,9,9,1,6.6,145,2,2,-36,12,-25,8e-4,0,0,0)],c=[new e(0,9,9,0,4.2,25,-7,-4,7.5,1,0,0,2,26,.97),new e(1,9,9,0,4.2,25,-5.6,-3.6,4.5,1.5,0,0,2,21,1.35),new e(2,9,9,0,4.2,25,-4.4,-1.8,2,2,0,0,2,18,1.49),new e(3,9,9,1,4.2,25,-3.4,-1.25,1.1,3,-4,0,2,15,1.64),new e(4,9,9,1,4.2,25,-2.2,.1,0,3.5,-8,0,2,0,1.79),new e(5,9,9,1,4.2,25,-1,1.65,-7.7,4,-12,2e-4,0,0,1.95),new e(6,9,9,1,4.2,25,-0,2.47,-7.7,6.5,-19,4e-4,0,0,2),new e(7,9,9,1,4.2,25,.5,2,-14.5,8,-22,6e-4,0,0,2),new e(8,9,9,1,4.2,25,1,2.4,-22,10,-23,7e-4,0,0,2),new e(9,9,9,1,4.2,25,1.5,2.95,-30,11,-25,8e-4,0,0,2),new e(10,9,9,1,4.2,25,2,2.95,-36,12,-30,8e-4,0,0,2)];function s(e,t,a){var s,n,r=e.VBR==Te.vbr_rh?f:c,i=e.VBR_q_frac,o=r[t],_=r[t+1],l=o;o.st_lrm=o.st_lrm+i*(_.st_lrm-o.st_lrm),o.st_s=o.st_s+i*(_.st_s-o.st_s),o.masking_adj=o.masking_adj+i*(_.masking_adj-o.masking_adj),o.masking_adj_short=o.masking_adj_short+i*(_.masking_adj_short-o.masking_adj_short),o.ath_lower=o.ath_lower+i*(_.ath_lower-o.ath_lower),o.ath_curve=o.ath_curve+i*(_.ath_curve-o.ath_curve),o.ath_sensitivity=o.ath_sensitivity+i*(_.ath_sensitivity-o.ath_sensitivity),o.interch=o.interch+i*(_.interch-o.interch),o.msfix=o.msfix+i*(_.msfix-o.msfix),s=e,(n=l.vbr_q)<0&&(n=0),9<n&&(n=9),s.VBR_q=n,(s.VBR_q_frac=0)!=a?e.quant_comp=l.quant_comp:0<Math.abs(e.quant_comp- -1)||(e.quant_comp=l.quant_comp),0!=a?e.quant_comp_short=l.quant_comp_s:0<Math.abs(e.quant_comp_short- -1)||(e.quant_comp_short=l.quant_comp_s),0!=l.expY&&(e.experimentalY=0!=l.expY),0!=a?e.internal_flags.nsPsy.attackthre=l.st_lrm:0<Math.abs(e.internal_flags.nsPsy.attackthre- -1)||(e.internal_flags.nsPsy.attackthre=l.st_lrm),0!=a?e.internal_flags.nsPsy.attackthre_s=l.st_s:0<Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)||(e.internal_flags.nsPsy.attackthre_s=l.st_s),0!=a?e.maskingadjust=l.masking_adj:0<Math.abs(e.maskingadjust-0)||(e.maskingadjust=l.masking_adj),0!=a?e.maskingadjust_short=l.masking_adj_short:0<Math.abs(e.maskingadjust_short-0)||(e.maskingadjust_short=l.masking_adj_short),0!=a?e.ATHlower=-l.ath_lower/10:0<Math.abs(10*-e.ATHlower-0)||(e.ATHlower=-l.ath_lower/10),0!=a?e.ATHcurve=l.ath_curve:0<Math.abs(e.ATHcurve- -1)||(e.ATHcurve=l.ath_curve),0!=a?e.athaa_sensitivity=l.ath_sensitivity:0<Math.abs(e.athaa_sensitivity- -1)||(e.athaa_sensitivity=l.ath_sensitivity),0<l.interch&&(0!=a?e.interChRatio=l.interch:0<Math.abs(e.interChRatio- -1)||(e.interChRatio=l.interch)),0<l.safejoint&&(e.exp_nspsytune=e.exp_nspsytune|l.safejoint),0<l.sfb21mod&&(e.exp_nspsytune=e.exp_nspsytune|l.sfb21mod<<20),0!=a?e.msfix=l.msfix:0<Math.abs(e.msfix- -1)||(e.msfix=l.msfix),0==a&&(e.VBR_q=t,e.VBR_q_frac=i)}var o=[new t(8,9,9,0,0,6.6,145,0,.95,0,-30,11,.0012,1),new t(16,9,9,0,0,6.6,145,0,.95,0,-25,11,.001,1),new t(24,9,9,0,0,6.6,145,0,.95,0,-20,11,.001,1),new t(32,9,9,0,0,6.6,145,0,.95,0,-15,11,.001,1),new t(40,9,9,0,0,6.6,145,0,.95,0,-10,11,9e-4,1),new t(48,9,9,0,0,6.6,145,0,.95,0,-10,11,9e-4,1),new t(56,9,9,0,0,6.6,145,0,.95,0,-6,11,8e-4,1),new t(64,9,9,0,0,6.6,145,0,.95,0,-2,11,8e-4,1),new t(80,9,9,0,0,6.6,145,0,.95,0,0,8,7e-4,1),new t(96,9,9,0,2.5,6.6,145,0,.95,0,1,5.5,6e-4,1),new t(112,9,9,0,2.25,6.6,145,0,.95,0,2,4.5,5e-4,1),new t(128,9,9,0,1.95,6.4,140,0,.95,0,3,4,2e-4,1),new t(160,9,9,1,1.79,6,135,0,.95,-2,5,3.5,0,1),new t(192,9,9,1,1.49,5.6,125,0,.97,-4,7,3,0,0),new t(224,9,9,1,1.25,5.2,125,0,.98,-6,9,2,0,0),new t(256,9,9,1,.97,5.2,125,0,1,-8,10,1,0,0),new t(320,9,9,1,.9,5.2,125,0,1,-10,12,0,0,0)];function n(e,t,a){var s=t,n=i.nearestBitrateFullIndex(t);if(e.VBR=Te.vbr_abr,e.VBR_mean_bitrate_kbps=s,e.VBR_mean_bitrate_kbps=Math.min(e.VBR_mean_bitrate_kbps,320),e.VBR_mean_bitrate_kbps=Math.max(e.VBR_mean_bitrate_kbps,8),e.brate=e.VBR_mean_bitrate_kbps,320<e.VBR_mean_bitrate_kbps&&(e.disable_reservoir=!0),0<o[n].safejoint&&(e.exp_nspsytune=2|e.exp_nspsytune),0<o[n].sfscale&&(e.internal_flags.noise_shaping=2),0<Math.abs(o[n].nsbass)){var r=int(4*o[n].nsbass);r<0&&(r+=64),e.exp_nspsytune=e.exp_nspsytune|r<<2}return 0!=a?e.quant_comp=o[n].quant_comp:0<Math.abs(e.quant_comp- -1)||(e.quant_comp=o[n].quant_comp),0!=a?e.quant_comp_short=o[n].quant_comp_s:0<Math.abs(e.quant_comp_short- -1)||(e.quant_comp_short=o[n].quant_comp_s),0!=a?e.msfix=o[n].nsmsfix:0<Math.abs(e.msfix- -1)||(e.msfix=o[n].nsmsfix),0!=a?e.internal_flags.nsPsy.attackthre=o[n].st_lrm:0<Math.abs(e.internal_flags.nsPsy.attackthre- -1)||(e.internal_flags.nsPsy.attackthre=o[n].st_lrm),0!=a?e.internal_flags.nsPsy.attackthre_s=o[n].st_s:0<Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)||(e.internal_flags.nsPsy.attackthre_s=o[n].st_s),0!=a?e.scale=o[n].scale:0<Math.abs(e.scale- -1)||(e.scale=o[n].scale),0!=a?e.maskingadjust=o[n].masking_adj:0<Math.abs(e.maskingadjust-0)||(e.maskingadjust=o[n].masking_adj),0<o[n].masking_adj?0!=a?e.maskingadjust_short=.9*o[n].masking_adj:0<Math.abs(e.maskingadjust_short-0)||(e.maskingadjust_short=.9*o[n].masking_adj):0!=a?e.maskingadjust_short=1.1*o[n].masking_adj:0<Math.abs(e.maskingadjust_short-0)||(e.maskingadjust_short=1.1*o[n].masking_adj),0!=a?e.ATHlower=-o[n].ath_lower/10:0<Math.abs(10*-e.ATHlower-0)||(e.ATHlower=-o[n].ath_lower/10),0!=a?e.ATHcurve=o[n].ath_curve:0<Math.abs(e.ATHcurve- -1)||(e.ATHcurve=o[n].ath_curve),0!=a?e.interChRatio=o[n].interch:0<Math.abs(e.interChRatio- -1)||(e.interChRatio=o[n].interch),t}this.apply_preset=function(e,t,a){switch(t){case U.R3MIX:t=U.V3,e.VBR=Te.vbr_mtrh;break;case U.MEDIUM:t=U.V4,e.VBR=Te.vbr_rh;break;case U.MEDIUM_FAST:t=U.V4,e.VBR=Te.vbr_mtrh;break;case U.STANDARD:t=U.V2,e.VBR=Te.vbr_rh;break;case U.STANDARD_FAST:t=U.V2,e.VBR=Te.vbr_mtrh;break;case U.EXTREME:t=U.V0,e.VBR=Te.vbr_rh;break;case U.EXTREME_FAST:t=U.V0,e.VBR=Te.vbr_mtrh;break;case U.INSANE:return t=320,e.preset=t,n(e,t,a),e.VBR=Te.vbr_off,t}switch(e.preset=t){case U.V9:return s(e,9,a),t;case U.V8:return s(e,8,a),t;case U.V7:return s(e,7,a),t;case U.V6:return s(e,6,a),t;case U.V5:return s(e,5,a),t;case U.V4:return s(e,4,a),t;case U.V3:return s(e,3,a),t;case U.V2:return s(e,2,a),t;case U.V1:return s(e,1,a),t;case U.V0:return s(e,0,a),t}return 8<=t&&t<=320?n(e,t,a):(e.preset=0,t)}},_=new T,l=new w,f=new M,c=new function(){this.getLameVersion=function(){return"3.98.4"},this.getLameShortVersion=function(){return"3.98.4"},this.getLameVeryShortVersion=function(){return"LAME3.98r"},this.getPsyVersion=function(){return"0.93"},this.getLameUrl=function(){return"http://www.mp3dev.org/"},this.getLameOsBitness=function(){return"32bits"}},h=new function(){this.setModules=function(e,t){}},u=new function(){var _;this.setModules=function(e){_=e},this.ResvFrameBegin=function(e,t){var a,s=e.internal_flags,n=s.l3_side,r=_.getframebits(e);t.bits=(r-8*s.sideinfo_len)/s.mode_gr;var i=2048*s.mode_gr-8;320<e.brate?a=8*int(1e3*e.brate/(e.out_samplerate/1152)/8+.5):(a=11520,e.strict_ISO&&(a=8*int(32e4/(e.out_samplerate/1152)/8+.5))),s.ResvMax=a-r,s.ResvMax>i&&(s.ResvMax=i),(s.ResvMax<0||e.disable_reservoir)&&(s.ResvMax=0);var o=t.bits*s.mode_gr+Math.min(s.ResvSize,s.ResvMax);return a<o&&(o=a),n.resvDrain_pre=0,null!=s.pinfo&&(s.pinfo.mean_bits=t.bits/2,s.pinfo.resvsize=s.ResvSize),o},this.ResvMaxBits=function(e,t,a,s){var n,r=e.internal_flags,i=r.ResvSize,o=r.ResvMax;0!=s&&(i+=t),0!=(1&r.substep_shaping)&&(o*=.9),a.bits=t,9*o<10*i?(n=i-9*o/10,a.bits+=n,r.substep_shaping|=128):(n=0,r.substep_shaping&=127,e.disable_reservoir||0!=(1&r.substep_shaping)||(a.bits-=.1*t));var _=i<6*r.ResvMax/10?i:6*r.ResvMax/10;return(_-=n)<0&&(_=0),_},this.ResvAdjust=function(e,t){e.ResvSize-=t.part2_3_length+t.part2_length},this.ResvFrameEnd=function(e,t){var a,s=e.l3_side;e.ResvSize+=t*e.mode_gr;var n=0;s.resvDrain_post=0,(s.resvDrain_pre=0)!=(a=e.ResvSize%8)&&(n+=a),0<(a=e.ResvSize-n-e.ResvMax)&&(n+=a);var r=Math.min(8*s.main_data_begin,n)/8;s.resvDrain_pre+=8*r,n-=8*r,e.ResvSize-=8*r,s.main_data_begin-=r,s.resvDrain_post+=n,e.ResvSize-=n}},m=new k,p=new function(){this.setModules=function(e,t,a){}},b=new function(){};n.setModules(r,i,o,_,l,f,c,h,b),i.setModules(r,b,c,f),h.setModules(i,c),o.setModules(n),l.setModules(i,u,_,m),_.setModules(m,u,n.enc.psy),u.setModules(i),m.setModules(_),f.setModules(n,i,c),a.setModules(p,b),p.setModules(c,h,o);var v=n.lame_init();v.num_channels=s,v.in_samplerate=e,v.out_samplerate=e,v.brate=t,v.mode=Ee.STEREO,v.quality=3,v.bWriteVbrTag=!1,v.disable_reservoir=!0,v.write_id3tag_automatic=!1,n.lame_init_params(v);var d=1152,g=0|1.25*d+7200,S=A(g);this.encodeBuffer=function(e,t){1==s&&(t=e),e.length>d&&(d=e.length,S=A(g=0|1.25*d+7200));var a=n.lame_encode_buffer(v,e,t,e.length,S,0,g);return new Int8Array(S.subarray(0,a))},this.flush=function(){var e=n.lame_encode_flush(v,S,0,g);return new Int8Array(S.subarray(0,e))}}}t(),Recorder.lamejs=t}();