diff --git a/README.md b/README.md index df7026f..c5a0f21 100644 --- a/README.md +++ b/README.md @@ -438,9 +438,9 @@ App端建议使用原生插件来录音,没有这些框架缺陷带来的性 浏览器Audio Media[兼容性](https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats#Browser_compatibility)mp3最好,wav还行,其他要么不支持播放,要么不支持编码;因此本库最佳推荐使用mp3、wav格式,代码也是优先照顾这两种格式。 -**留意中途来电话**:在移动端录音时,如果录音中途来电话,或者通话过程中打开录音,是不一定能进行录音的;经过简单测试发现,IOS上Safari将暂停返回音频数据,直到通话结束才开始继续有音频数据返回;小米上Chrome不管是来电还是通话中开始录音都能对麦克风输入的声音进行录音;只是简单测试,更多机器和浏览器并未做测试,不过整体上来看来电话或通话中进行录音的可行性并不理想,也不赞成在这种过程中进行录音;但只要通话结束后录音还是会正常进行,影响基本不大。 +**留意中途来电话**:在移动端录音时,如果录音中途来电话,或者通话过程中打开录音,是不一定能进行录音的;经过简单测试发现,iOS上Safari将暂停返回音频数据,直到通话结束才开始继续有音频数据返回;小米上Chrome不管是来电还是通话中开始录音都能对麦克风输入的声音进行录音;只是简单测试,更多机器和浏览器并未做测试,不过整体上来看来电话或通话中进行录音的可行性并不理想,也不赞成在这种过程中进行录音;但只要通话结束后录音还是会正常进行,影响基本不大。 -**录音时对播放音频的影响**:仅在移动端,如果录音参数中启用了降噪+回声消除,打开录音后,如果同时播放音频,此时播放声音可能会变得很小;PC上 和 禁用降噪+回声消除后 似乎无此影响。 +**录音时对播放音频的影响**:仅在移动端,如果录音配置中未禁用降噪+回声消除(浏览器默认开启降噪+回声),打开录音后,如果同时播放音频,此时系统播放音量可能会变得很小;PC上 和 禁用降噪+回声消除后 似乎无此影响,但iOS上如果禁用又可能会导致无法正常录音,详细请阅读配置文档中的`audioTrackSet`参数说明。 **移动端锁屏录音**:手机锁屏后浏览器的运行状态是一个玄学,是否能录音不可控;不同手机、甚至同一手机在不同状态下,有可能能录又有可能不能录,且无法检测;可以调用 `navigator.wakeLock` 来阻止手机自动锁屏,不支持的直接简单粗暴的 循环+静音 播放一段视频,来阻止锁屏,就是有点费电,具体实现可参考H5在线测试页面内的`wakeLockClick`方法。 @@ -527,9 +527,14 @@ set={ //比如:audio、video标签dom节点的captureStream方法(实验特性,不同浏览器支持程度不高)返回的流;WebRTC中的remote流;自己创建的流等 //注意:流内必须至少存在一条音轨(Audio Track),比如audio标签必须等待到可以开始播放后才会有音轨,否则open会失败 - //,audioTrackSet:{ deviceId:"",groupId:"", autoGainControl:true, echoCancellation:true, noiseSuppression:true } - //普通麦克风录音时getUserMedia方法的audio配置参数;注意:提供的任何配置值都不一定会生效 - //回声消除、降噪开关这两个已默认明确关闭,开启可能会导致移动端表现的很怪异,包括系统播放声音变小,如需开启请测试好后再开启 + /*,audioTrackSet:{ + deviceId:"",groupId:"" //指定设备的麦克风,通过navigator.mediaDevices.enumerateDevices拉取设备列表,其中kind为audioinput的是麦克风 + ,noiseSuppression:true //降噪(ANS)开关,不设置时由浏览器控制(一般为默认打开),设为true明确打开,设为false明确关闭 + ,echoCancellation:true //回声消除(AEC)开关,取值和降噪开关一样 + ,autoGainControl:true //自动增益(AGC)开关,取值和降噪开关一样 + }*/ + //普通麦克风录音时getUserMedia方法的audio配置参数;注意:不同浏览器的支持程度不同,提供的任何配置值都不一定会生效 + //回声消除、降噪开关这两个参数浏览器一般默认为打开, 注意:移动端打开降噪、回声消除可能会表现的很怪异(包括系统播放音量变小),但iOS上如果关闭又可能导致录音没有声音,如需更改配置请Android和iOS分别配置,并测试好,PC端没有这些问题 //由于麦克风是全局共享的,所以新配置后需要close掉以前的再重新open //更多参考: https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints diff --git a/assets/demo-ts/dist/index.js b/assets/demo-ts/dist/index.js index 9523dce..269f24b 100644 --- a/assets/demo-ts/dist/index.js +++ b/assets/demo-ts/dist/index.js @@ -1 +1 @@ -!function(e){var t={};function a(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,s){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(s,n,function(t){return e[t]}.bind(null,n));return s},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=s(a(1));a(2),a(3),a(4);var r,i,o,_=window,l=document,f=function(){for(var e=[],t=0;t用户主动点击的弹窗",1)}},_.recClose=function(){r?(r.close(),f("已关闭")):f("未打开录音",1)},_.recStart=function(){r&&n.default.IsOpen()?(o=null,r.start(),f("已开始录音...")):f("未打开录音",1)},_.recPause=function(){r&&n.default.IsOpen()?r.pause():f("未打开录音",1)},_.recResume=function(){r&&n.default.IsOpen()?r.resume():f("未打开录音",1)},_.recStop=function(){r&&n.default.IsOpen()?r.stop((function(e,t){console.log(e,(_.URL||webkitURL).createObjectURL(e),"时长:"+t+"ms"),o=e,f("已录制mp3:"+p(t)+"ms "+e.size+"字节,可以点击播放、上传了",2)}),(function(e){f("录音失败:"+e,1)})):f("未打开录音",1)},_.recPlay=function(){if(o){var e=("a"+Math.random()).replace(".","");f('播放中: ');var t=l.createElement("audio");t.controls=!0,l.querySelector("."+e).appendChild(t),t.src=(_.URL||webkitURL).createObjectURL(o),t.play(),setTimeout((function(){(_.URL||webkitURL).revokeObjectURL(t.src)}),5e3)}else f("请先录音,然后停止后再播放",1)},_.recUpload=function(){var e=o;if(e){var t="https://xx.xx/test_request",a=function(e){return function(){4==r.readyState&&(200==r.status?f(e+"上传成功",2):(f(e+"没有完成上传,演示上传地址无需关注上传结果,只要浏览器控制台内Network面板内看到的请求数据结构是预期的就ok了。","#d8c1a0"),console.error(e+"上传失败",r.status,r.responseText)))}};f("开始上传到"+t+",请求稍后...");var s=new _.FileReader;s.onloadend=function(){var n="";n+="mime="+encodeURIComponent(e.type),n+="&upfile_b64="+encodeURIComponent((/.+;\s*base64\s*,\s*(.+)$/i.exec(s.result)||[])[1]);var r=new XMLHttpRequest;r.open("POST",t),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.onreadystatechange=a("上传方式一【Base64】"),r.send(n)},s.readAsDataURL(e);var n=new FormData;n.append("upfile",e,"recorder.mp3");var r=new XMLHttpRequest;r.open("POST",t),r.onreadystatechange=a("上传方式二【FormData】"),r.send(n)}else f("请先录音,然后停止后再上传",1)};var c,h=function(){c=setTimeout((function(){!function(){if(/mobile/i.test(navigator.userAgent)){u();var e=l.createElement("div");l.body.appendChild(e),e.innerHTML='
录音功能需要麦克风权限,请允许;如果未看到任何请求,请点击忽略~
忽略
'}}()}),8e3)},u=function(){clearTimeout(c);for(var e=l.querySelectorAll(".waitDialog"),t=0;t0?(a<10?"0":"")+a+":":"")+(t||a>0||s>0?("0"+s).substr(-2)+"″":"")+("00"+e%1e3).substr(-3)}},function(e,t,a){var s;!function(e){"use strict";var t=function(){},a=function(e){return new h(e)};a.LM="2022-08-06 20:51";var s="Recorder";a.IsOpen=function(){var e=a.Stream;if(e){var t=(e.getTracks&&e.getTracks()||e.audioTracks||[])[0];if(t){var s=t.readyState;return"live"==s||s==t.LIVE}}return!1},a.BufferSize=4096,a.Destroy=function(){for(var e in l(s+" Destroy"),_(),n)n[e]()};var n={};a.BindDestroy=function(e,t){n[e]=t},a.Support=function(){var t=e.AudioContext;if(t||(t=e.webkitAudioContext),!t)return!1;var s=navigator.mediaDevices||{};return s.getUserMedia||(s=navigator).getUserMedia||(s.getUserMedia=s.webkitGetUserMedia||s.mozGetUserMedia||s.msGetUserMedia),!!s.getUserMedia&&(a.Scope=s,a.Ctx&&"closed"!=a.Ctx.state||(a.Ctx=new t,a.BindDestroy("Ctx",(function(){var e=a.Ctx;e&&e.close&&(e.close(),a.Ctx=0)}))),!0)},a.ConnectEnableWebM=!0,a.ConnectEnableWorklet=!1;var r=function(t,n){var r,_,f,c=t.BufferSize||a.BufferSize,h=a.Ctx,p=t.Stream,m=function(e){var t=p._m=h.createMediaStreamSource(p),a=h.destination,s="createMediaStreamDestination";h[s]&&(a=h[s]()),t.connect(e),e.connect(a)},b="",d=p._call,v=function(e){for(var t in d){for(var a=e.length,s=new Int16Array(a),n=0,r=0;rf+1&&l("SampleData似乎传入了未重置chunk "+r+">"+f,3);for(var c=0,h=r;h1?c=Math.floor(c/u):(u=1,a=t),c+=o.length;var p=new Int16Array(c),m=0;for(h=0;h0){var k=2*(p.length-R);o=new Int16Array(p.buffer.slice(k)),p=new Int16Array(p.buffer.slice(0,k))}return{index:r,offset:i,frameNext:o,sampleRate:a,data:p}},a.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)))))};var l=function(t,a){var n=new Date,r=("0"+n.getMinutes()).substr(-2)+":"+("0"+n.getSeconds()).substr(-2)+"."+("00"+n.getMilliseconds()).substr(-3),i=this&&this.envIn&&this.envCheck&&this.id,o=["["+r+" "+s+(i?":"+i:"")+"]"+t],_=arguments,l=e.console||{},c=2,h=l.log;for("number"==typeof a?h=1==a?l.error:3==a?l.warn:h:c=1;c<_.length;c++)o.push(_[c]);f?h&&h("[IsLoser]"+o[0],o.length>1?o:""):h.apply(l,o)},f=!0;try{f=!console.log.apply}catch(e){}a.CLog=l;var c=0;function h(e){this.id=++c,v();var a={type:"mp3",bitRate:16,sampleRate:16e3,onProcess:t};for(var s in e)a[s]=e[s];this.set=a,this._S=9,this.Sync={O:9,C:9}}a.Sync={O:9,C:9},a.prototype=h.prototype={CLog:l,_streamStore:function(){return this.set.sourceStream?this:a},open:function(s,n){var i=this,o=i._streamStore();s=s||t;var l=function(e,t){t=!!t,i.CLog("录音open失败:"+e+",isUserNotAllow:"+t,1),n&&n(e,t)},f=function(){i.CLog("open ok id:"+i.id),s(),i._SO=0},c=o.Sync,h=++c.O,u=c.C;i._O=i._O_=h,i._SO=i._S;var p=i.envCheck({envName:"H5",canProcess:!0});if(p)l("不能录音:"+p);else if(i.set.sourceStream){if(!a.Support())return void l("不支持此浏览器从流中获取录音");_(o),i.Stream=i.set.sourceStream,i.Stream._call={};try{r(o)}catch(e){return void l("从流中打开录音失败:"+e.message)}f()}else{var m=function(t,a){try{e.top.a}catch(e){return void l('无权录音(跨域,请尝试给iframe添加麦克风访问策略,如allow="camera;microphone")')}/Permission|Allow/i.test(t)?l("用户拒绝了录音权限",!0):!1===e.isSecureContext?l("浏览器禁止不安全页面录音,可开启https解决"):/Found/i.test(t)?l(a+",无可用麦克风"):l(a)};if(a.IsOpen())f();else if(a.Support()){var b=function(e){setTimeout((function(){e._call={};var t=a.Stream;t&&(_(),e._call=t._call),a.Stream=e,function(){if(u!=c.C||!i._O){var e="open被取消";return h==c.O?i.close():e="open被中断",l(e),!0}}()||(a.IsOpen()?(t&&i.CLog("发现同时多次调用open",1),r(o,1),f()):l("录音功能无效:无音频流"))}),100)},d=function(e){var t=e.name||e.message||e.code+":"+e;i.CLog("请求录音权限错误",1,e),m(t,"无法录音:"+t)},v={noiseSuppression:!1,echoCancellation:!1},g=i.set.audioTrackSet;for(var S in g)v[S]=g[S];v.sampleRate=a.Ctx.sampleRate;try{var M=a.Scope.getUserMedia({audio:v},b,d)}catch(e){i.CLog("getUserMedia",3,e),M=a.Scope.getUserMedia({audio:!0},b,d)}M&&M.then&&M.then(b)[s&&"catch"](d)}else m("","此浏览器不支持录音")}},close:function(e){e=e||t;var a=this._streamStore();this._stop();var s=a.Sync;if(this._O=0,this._O_!=s.O)return this.CLog("close被忽略(因为同时open了多个rec,只有最后一个会真正close)",3),void e();s.C++,_(a),this.CLog("close"),e()},mock:function(e,t){return this._stop(),this.isMock=1,this.mockEnvInfo=null,this.buffers=[e],this.recSize=e.length,this.srcSampleRate=t,this},envCheck:function(t){var s,n=this.set,r="CPU_BE";if(s||a[r]||!e.Int8Array||new Int8Array(new Int32Array([1]).buffer)[0]||(v(r),s="不支持CPU_BE架构"),!s){var i=n.type;this[i+"_envCheck"]?s=this[i+"_envCheck"](t,n):n.takeoffEncodeChunk&&(s=i+"类型"+(this[i]?"":"(未加载编码器)")+"不支持设置takeoffEncodeChunk")}return s||""},envStart:function(e,t){var a=this.set;this.isMock=e?1:0,this.mockEnvInfo=e,this.buffers=[],this.recSize=0,this.envInLast=0,this.envInFirst=0,this.envInFix=0,this.envInFixTs=[];var s=a.sampleRate;if(s>t?a.sampleRate=t:s=0,this.srcSampleRate=t,this.CLog("srcSampleRate: "+t+" set.sampleRate: "+a.sampleRate+(s?" 忽略"+s:""),s?3:0),this.engineCtx=0,this[a.type+"_start"]){var n=this.engineCtx=this[a.type+"_start"](a);n&&(n.pcmDatas=[],n.pcmSize=0)}},envResume:function(){this.envInFixTs=[]},envIn:function(e,t){var s=this,n=s.set,r=s.engineCtx,i=s.srcSampleRate,o=e.length,_=a.PowerLevel(t,o),l=s.buffers,f=l.length;l.push(e);var c=l,h=f,u=Date.now(),p=Math.round(o/i*1e3);s.envInLast=u,1==s.buffers.length&&(s.envInFirst=u-p);var m=s.envInFixTs;m.splice(0,0,{t:u,d:p});for(var b=u,d=0,v=0;v3e3){m.length=v;break}b=g.t,d+=g.d}var S=m[1],M=u-b;if(M-d>M/3&&(S&&M>1e3||m.length>=6)){var w=u-S.t-p;if(w>p/5){var R=!n.disableEnvInFix;if(s.CLog("["+u+"]"+(R?"":"未")+"补偿"+w+"ms",3),s.envInFix+=w,R){var k=new Int16Array(w*i/1e3);o+=k.length,l.push(k)}}}var A=s.recSize,B=o,y=A+B;if(s.recSize=y,r){var T=a.SampleData(l,i,n.sampleRate,r.chunkInfo);r.chunkInfo=T,y=(A=r.pcmSize)+(B=T.data.length),r.pcmSize=y,l=r.pcmDatas,f=l.length,l.push(T.data),i=T.sampleRate}var x=Math.round(y/i*1e3),E=l.length,P=c.length,L=function(){for(var e=I?0:-B,t=null==l[0],a=f;a10&&s.envInFirst-u>1e3&&s.CLog("rec.set.onProcess低性能,耗时"+H+"ms",3),!0===I){var O=0;for(v=f;v"+v.length+" 花:"+(Date.now()-n)+"ms"),setTimeout((function(){n=Date.now(),r[i.type](v,(function(e){c(e,b)}),(function(e){f(e)}))}))}else f("未加载"+i.type+"编码器");else f("音频buffers被释放");else f("未采集到录音")}},e[s]&&(l("重复引入"+s,3),e[s].Destroy()),e[s]=a;var u=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(b(i,s),d(i,s),!p(b(i,s),[24,83,128,103]))return;for(b(i,s);s[0]1){var O=[];for(A=0;A=e.length)){var n=("0000000"+e[s].toString(2)).substr(-8),r=/^(0*1)(\d*)$/.exec(n);if(r){var i=r[1].length,o=[];if(!(s+i>e.length)){for(var _=0;_e.length)return;for(var i=0;i0&&(c+=a.buffer.byteLength,l.push(a.buffer)),f+=57600,setTimeout(h)}else{var a;(a=_.flush()).length>0&&(c+=a.buffer.byteLength,l.push(a.buffer));var o=s.fn(l,c,i,r.sampleRate);n(o,r),t(new Blob(l,{type:"audio/mp3"}))}};h()},Recorder.BindDestroy("mp3Worker",(function(){console.log("mp3Worker Destroy"),e&&e.terminate(),e=null})),Recorder.prototype.mp3_envCheck=function(e,t){var s="";return t.takeoffEncodeChunk&&(e.canProcess?a()||(s="当前浏览器版本太低,无法实时处理"):s=e.envName+"环境不支持实时处理"),s},Recorder.prototype.mp3_start=function(e){return a(e)};var t={id:0},a=function(a){var n=e;try{if(!n){var r=");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,(s=a.encObj.encodeBuffer(t.pcm)).length>0&&(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;(s=a.encObj.flush()).length>0&&(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})}};r+=";var wk_mp3TrimFix={rm:"+s.rm+",fn:"+s.fn+"}";var i=Recorder.lamejs.toString(),o=(window.URL||webkitURL).createObjectURL(new Blob(["var wk_lame=(",i,r],{type:"text/javascript"}));n=new Worker(o),setTimeout((function(){(window.URL||webkitURL).revokeObjectURL(o)}),1e4),n.onmessage=function(e){var a=e.data,s=t[a.id];s&&("takeoff"==a.action?s.set.takeoffEncodeChunk(new Uint8Array(a.chunk.buffer)):(s.call&&s.call(a),s.call=null))}}var _={worker:n,set:a,takeoffQueue:[]};return a?(_.id=++t.id,t[_.id]=_,n.postMessage({action:"init",id:_.id,sampleRate:a.sampleRate,bitRate:a.bitRate,takeoff:!!a.takeoffEncodeChunk,x:new Int16Array(5)})):n.postMessage({x:new Int16Array(5)}),e=n,_}catch(e){return n&&n.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 t[e.id];var a=-1;for(var s in t)a++;a&&console.warn("mp3 worker剩"+a+"个在串行等待")}},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(e,t,a,s){var r=this;e&&e.worker?(e.call=function(a){n(a.meta,e.set),t(a.blob),s&&r.mp3_stop(e)},e.worker.postMessage({action:"complete",id:e.id})):a("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==_||1==o?1152:576,u=h/l*1e3,p=Math.floor(h*f/8/l*1e3),m=0,b=0,d=0;d=p+3){var g=new Uint8Array(v);m="1"==n(v.byteLength-(b-(p+3)+1),g).charAt(6);break}}return m&&p++,{version:o,layer:_,sampleRate:l,bitRate:f,duration:c,size:t,hasPadding:m,frameSize:p,frameDurationFloat:u}};var s={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(i>0){var o=i*n.frameSize-(n.hasPadding?1:0);t-=o;for(var _=0,l=[],f=0;f=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 "+s.duration+"ms",s.remove>2&&(e.err=(e.err?e.err+", ":"")+"移除帧数过多")):a+=(e.duration||"-")+"ms",e.err?console.error(a,e.err,e):console.log(a,e)}}()},function(e,t){!function(){"use strict";function e(){var t=function(e){return Math.log(e)/Math.log(10)};function a(e){return new Int8Array(e)}function s(e){return new Int16Array(e)}function n(e){return new Int32Array(e)}function r(e){return new Float32Array(e)}function i(e){return new Float64Array(e)}function o(e){if(1==e.length)return r(e[0]);var t=e[0];e=e.slice(1);for(var a=[],s=0;s>=1;0!=e--;)n[r++]=i>a[s++]?0:1,n[r++]=i>a[s++]?0:1}function r(t,a,s,n,r,i){var o=(t>>=1)%2;for(t>>=1;0!=t--;){var _,l,f,c,h,u,p,m;_=s[n++]*a,l=s[n++]*a,h=0|_,f=s[n++]*a,u=0|l,c=s[n++]*a,p=0|f,_+=e.adj43[h],m=0|c,l+=e.adj43[u],r[i++]=0|_,f+=e.adj43[p],r[i++]=0|l,c+=e.adj43[m],r[i++]=0|f,r[i++]=0|c}0!=o&&(h=0|(_=s[n++]*a),u=0|(l=s[n++]*a),_+=e.adj43[h],l+=e.adj43[u],r[i++]=0|_,r[i++]=0|l)}var i=[1,2,5,7,7,10,10,13,13,13,13,13,13,13,13];function o(e,t,a,s){var n=function(e,t,a){var s=0,n=0;do{var r=e[t++],i=e[t++];s>=16)>r&&(o=r,s++),n.bits+=o,s}(e,t,a,i[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,_=B.ht[s].xlen,l=B.ht[s].hlen,f=B.ht[s+1].hlen,c=B.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(ti&&(r=i,u++),r>o&&(r=o,u=s+2),n.bits+=r,u}(e,t,a,i[n-1],s);default:if(n>O.IXMAX_VAL)return s.bits=O.LARGE_BITS,-1;var r,o;for(n-=15,r=24;r<32&&!(B.ht[r].linmax>=n);r++);for(o=r-8;o<24&&!(B.ht[o].linmax>=n);o++);return function(e,t,a,s,n,r){var i,o=65536*B.ht[s].xlen+B.ht[n].xlen,_=0;do{var l=e[t++],f=e[t++];0!=l&&(l>14&&(l=15,_+=o),l*=16),0!=f&&(f>14&&(f=15,_+=o),l+=f),_+=B.largetbl[l]}while(t>=16)>i&&(_=i,s=n),r.bits+=_,s}(e,t,a,o,r,s)}}function _(e,a,s,n,r,i,_,l){for(var f=a.big_values,c=2;c=f)break;var u=r[c-2]+a.count1bits;if(s.part2_3_length<=u)break;var p=new t(u),m=o(n,h,f,p);u=p.bits,s.part2_3_length<=u||(s.assign(a),s.part2_3_length=u,s.region0_count=i[c-2],s.region1_count=c-2-i[c-2],s.table_select[0]=_[c-2],s.table_select[1]=l[c-2],s.table_select[2]=m)}}this.noquant_count_bits=function(e,a,s){var n=a.l3_enc,r=Math.min(576,a.max_nonzero_coeff+2>>1<<1);for(null!=s&&(s.sfb_count1=0);r>1&&0==(n[r-1]|n[r-2]);r-=2);a.count1=r;for(var i=0,_=0;r>3;r-=4){var l;if((2147483647&(n[r-1]|n[r-2]|n[r-3]|n[r-4]))>1)break;l=2*(2*(2*n[r-4]+n[r-3])+n[r-2])+n[r-1],i+=B.t32l[l],_+=B.t33l[l]}var f=i;if(a.count1table_select=0,i>_&&(f=_,a.count1table_select=1),a.count1bits=f,a.big_values=r,0==r)return f;if(a.block_type==X.SHORT_TYPE)(i=3*e.scalefac_band.s[3])>a.big_values&&(i=a.big_values),_=a.big_values;else if(a.block_type==X.NORM_TYPE){if(i=a.region0_count=e.bv_scf[r-2],_=a.region1_count=e.bv_scf[r-1],_=e.scalefac_band.l[i+_+2],i=e.scalefac_band.l[i+1],_(_=r)&&(i=_);if(i=Math.min(i,r),_=Math.min(_,r),0_)return O.LARGE_BITS;if(function(t,a,n,i,o){var _,l,f,h=0,u=0,p=0,m=0,b=a,d=0,v=b,g=0,S=t,M=0;for(f=null!=o&&i.global_gain==o.global_gain,l=i.block_type==X.SHORT_TYPE?38:21,_=0;_<=l;_++){var w=-1;if((f||i.block_type==X.NORM_TYPE)&&(w=i.global_gain-(i.scalefac[_]+(0!=i.preflag?e.pretab[_]:0)<i.max_nonzero_coeff)R=i.max_nonzero_coeff-h+1,c.fill(a,i.max_nonzero_coeff,576,0),(k=R)<0&&(k=0),_=l+1;if(0==u&&0==p&&(v=b,g=d,S=t,M=m),null!=o&&o.sfb_count1>0&&_>=o.sfb_count1&&o.step[_]>0&&w>=o.step[_]?(0!=u&&(r(u,n,S,M,v,g),u=0,v=b,g=d,S=t,M=m),p+=k):(0!=p&&(s(p,n,S,M,v,g),p=0,v=b,g=d,S=t,M=m),u+=k),k<=0){0!=p&&(s(p,n,S,M,v,g),p=0),0!=u&&(r(u,n,S,M,v,g),u=0);break}}_<=l&&(d+=i.width[_],m+=i.width[_],h+=i.width[_])}0!=u&&(r(u,n,S,M,v,g),u=0),0!=p&&(s(p,n,S,M,v,g),p=0)}(a,o,e.IPOW20(n.global_gain),n,i),0!=(2&t.substep_shaping))for(var l=0,f=n.global_gain+n.scalefac_scale,h=.634521682242439/e.IPOW20(f),u=0;u=h?o[p]:0}return this.noquant_count_bits(t,n,i)},this.best_huffman_divide=function(e,a){var s=new V,r=a.l3_enc,i=n(23),l=n(23),f=n(23),c=n(23);if(a.block_type!=X.SHORT_TYPE||1!=e.mode_gr){s.assign(a),a.block_type==X.NORM_TYPE&&(!function(e,a,s,n,r,i,_){for(var l=a.big_values,f=0;f<=22;f++)n[f]=O.LARGE_BITS;for(f=0;f<16;f++){var c=e.scalefac_band.l[f+1];if(c>=l)break;var h=0,u=new t(h),p=o(s,0,c,u);h=u.bits;for(var m=0;m<8;m++){var b=e.scalefac_band.l[f+m+2];if(b>=l)break;var d=h,v=o(s,c,b,u=new t(d));d=u.bits,n[f+m]>d&&(n[f+m]=d,r[f+m]=f,i[f+m]=p,_[f+m]=v)}}}(e,a,r,i,l,f,c),_(e,s,a,r,i,l,f,c));var h=s.big_values;if(!(0==h||(r[h-2]|r[h-1])>1||(h=a.count1+2)>576)){s.assign(a),s.count1=h;for(var u=0,p=0;h>s.big_values;h-=4){var m=2*(2*(2*r[h-4]+r[h-3])+r[h-2])+r[h-1];u+=B.t32l[m],p+=B.t33l[m]}if(s.big_values=h,s.count1table_select=0,u>p&&(u=p,s.count1table_select=1),s.count1bits=u,s.block_type==X.NORM_TYPE)_(e,s,a,r,i,l,f,c);else{if(s.part2_3_length=u,(u=e.scalefac_band.l[8])>h&&(u=h),u>0){var b=new t(s.part2_3_length);s.table_select[0]=o(r,0,u,b),s.part2_3_length=b.bits}if(h>u){b=new t(s.part2_3_length);s.table_select[1]=o(r,u,h,b),s.part2_3_length=b.bits}a.part2_3_length>s.part2_3_length&&a.assign(s)}}}};var l=[1,1,1,1,8,2,2,2,4,4,4,8,8,8,16,16],f=[1,2,4,8,1,2,4,8,2,4,8,2,4,8,4,8],u=[0,0,0,0,3,1,1,1,2,2,2,3,3,3,4,4],p=[0,1,2,3,0,1,2,3,1,2,3,1,2,3,2,3];g.slen1_tab=u,g.slen2_tab=p,this.best_scalefac_store=function(t,a,s,n){var r,i,o,_,c=n.tt[a][s],h=0;for(o=0,r=0;r0&&(b|=c.scalefac[r]);if(0==(1&b)&&0!=b){for(r=0;r0&&(c.scalefac[r]>>=1);c.scalefac_scale=h=1}}if(0==c.preflag&&c.block_type!=X.SHORT_TYPE&&2==t.mode_gr){for(r=11;r0&&(c.scalefac[r]-=e.pretab[r]);c.preflag=h=1}}for(i=0;i<4;i++)n.scfsi[s][i]=0;for(2==t.mode_gr&&1==a&&n.tt[0][s].block_type!=X.SHORT_TYPE&&n.tt[1][s].block_type!=X.SHORT_TYPE&&(!function(e,t){for(var a,s=t.tt[1][e],n=t.tt[0][e],r=0;r=0);a++);if(a==B.scfsi_band[r+1]){for(a=B.scfsi_band[r];ah&&(s.part2_length=h,s.scalefac_compress=r)}}(s,n),h=0),r=0;rn[a]&&(t.part2_length=n[a],t.scalefac_compress=a);return t.part2_length==O.LARGE_BITS};var v=[[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(t,a){var s,r,i,o,_,l,f,c,u=n(4),p=a.scalefac;for(s=0!=a.preflag?2:0,f=0;f<4;f++)u[f]=0;if(a.block_type==X.SHORT_TYPE){r=1;var m=e.nr_of_sfb_block[s][r];for(c=0,i=0;i<4;i++)for(o=m[i]/3,f=0;fu[i]&&(u[i]=p[3*c+_])}else{r=0;m=e.nr_of_sfb_block[s][r];for(c=0,i=0;i<4;i++)for(o=m[i],f=0;fu[i]&&(u[i]=p[c])}for(l=!1,i=0;i<4;i++)u[i]>v[s][i]&&(l=!0);if(!l){var b,d,g,M;for(a.sfb_partition_table=e.nr_of_sfb_block[s][r],i=0;i<4;i++)a.slen[i]=S[u[i]];switch(b=a.slen[0],d=a.slen[1],g=a.slen[2],M=a.slen[3],s){case 0:a.scalefac_compress=(5*b+d<<4)+(g<<2)+M;break;case 1:a.scalefac_compress=400+(5*b+d<<2)+g;break;case 2:a.scalefac_compress=500+3*b+d;break;default:h.err.printf("intensity stereo not implemented yet\n")}}if(!l)for(a.part2_length=0,i=0;i<4;i++)a.part2_length+=a.slen[i]*a.sfb_partition_table[i];return l};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 s,n=0;e.scalefac_band.l[++n]t;)s--;for(s<0&&(s=a[n][0]),e.bv_scf[t-2]=s,s=a[n][1];e.scalefac_band.l[s+e.bv_scf[t-2]+2]>t;)s--;s<0&&(s=a[n][1]),e.bv_scf[t-1]=s}}}function S(){}function M(){function e(e,t,a,s,n,r,i,o,_,l,f,c,h,u,p){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=p}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 a;this.setModules=function(e){a=e};var s=[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)],n=[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 r(e,t,a){var r=e.VBR==b.vbr_rh?s:n,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),function(e,t){var a=0;0>t&&(a=-1,t=0);90||(e.quant_comp=l.quant_comp),0!=a?e.quant_comp_short=l.quant_comp_s:Math.abs(e.quant_comp_short- -1)>0||(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:Math.abs(e.internal_flags.nsPsy.attackthre- -1)>0||(e.internal_flags.nsPsy.attackthre=l.st_lrm),0!=a?e.internal_flags.nsPsy.attackthre_s=l.st_s:Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)>0||(e.internal_flags.nsPsy.attackthre_s=l.st_s),0!=a?e.maskingadjust=l.masking_adj:Math.abs(e.maskingadjust-0)>0||(e.maskingadjust=l.masking_adj),0!=a?e.maskingadjust_short=l.masking_adj_short:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=l.masking_adj_short),0!=a?e.ATHlower=-l.ath_lower/10:Math.abs(10*-e.ATHlower-0)>0||(e.ATHlower=-l.ath_lower/10),0!=a?e.ATHcurve=l.ath_curve:Math.abs(e.ATHcurve- -1)>0||(e.ATHcurve=l.ath_curve),0!=a?e.athaa_sensitivity=l.ath_sensitivity:Math.abs(e.athaa_sensitivity- -1)>0||(e.athaa_sensitivity=l.ath_sensitivity),l.interch>0&&(0!=a?e.interChRatio=l.interch:Math.abs(e.interChRatio- -1)>0||(e.interChRatio=l.interch)),l.safejoint>0&&(e.exp_nspsytune=e.exp_nspsytune|l.safejoint),l.sfb21mod>0&&(e.exp_nspsytune=e.exp_nspsytune|l.sfb21mod<<20),0!=a?e.msfix=l.msfix:Math.abs(e.msfix- -1)>0||(e.msfix=l.msfix),0==a&&(e.VBR_q=t,e.VBR_q_frac=i)}var i=[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 o(e,t,s){var n=t,r=a.nearestBitrateFullIndex(t);if(e.VBR=b.vbr_abr,e.VBR_mean_bitrate_kbps=n,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,e.VBR_mean_bitrate_kbps>320&&(e.disable_reservoir=!0),i[r].safejoint>0&&(e.exp_nspsytune=2|e.exp_nspsytune),i[r].sfscale>0&&(e.internal_flags.noise_shaping=2),Math.abs(i[r].nsbass)>0){var o=int(4*i[r].nsbass);o<0&&(o+=64),e.exp_nspsytune=e.exp_nspsytune|o<<2}return 0!=s?e.quant_comp=i[r].quant_comp:Math.abs(e.quant_comp- -1)>0||(e.quant_comp=i[r].quant_comp),0!=s?e.quant_comp_short=i[r].quant_comp_s:Math.abs(e.quant_comp_short- -1)>0||(e.quant_comp_short=i[r].quant_comp_s),0!=s?e.msfix=i[r].nsmsfix:Math.abs(e.msfix- -1)>0||(e.msfix=i[r].nsmsfix),0!=s?e.internal_flags.nsPsy.attackthre=i[r].st_lrm:Math.abs(e.internal_flags.nsPsy.attackthre- -1)>0||(e.internal_flags.nsPsy.attackthre=i[r].st_lrm),0!=s?e.internal_flags.nsPsy.attackthre_s=i[r].st_s:Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)>0||(e.internal_flags.nsPsy.attackthre_s=i[r].st_s),0!=s?e.scale=i[r].scale:Math.abs(e.scale- -1)>0||(e.scale=i[r].scale),0!=s?e.maskingadjust=i[r].masking_adj:Math.abs(e.maskingadjust-0)>0||(e.maskingadjust=i[r].masking_adj),i[r].masking_adj>0?0!=s?e.maskingadjust_short=.9*i[r].masking_adj:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=.9*i[r].masking_adj):0!=s?e.maskingadjust_short=1.1*i[r].masking_adj:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=1.1*i[r].masking_adj),0!=s?e.ATHlower=-i[r].ath_lower/10:Math.abs(10*-e.ATHlower-0)>0||(e.ATHlower=-i[r].ath_lower/10),0!=s?e.ATHcurve=i[r].ath_curve:Math.abs(e.ATHcurve- -1)>0||(e.ATHcurve=i[r].ath_curve),0!=s?e.interChRatio=i[r].interch:Math.abs(e.interChRatio- -1)>0||(e.interChRatio=i[r].interch),t}this.apply_preset=function(e,t,a){switch(t){case W.R3MIX:t=W.V3,e.VBR=b.vbr_mtrh;break;case W.MEDIUM:t=W.V4,e.VBR=b.vbr_rh;break;case W.MEDIUM_FAST:t=W.V4,e.VBR=b.vbr_mtrh;break;case W.STANDARD:t=W.V2,e.VBR=b.vbr_rh;break;case W.STANDARD_FAST:t=W.V2,e.VBR=b.vbr_mtrh;break;case W.EXTREME:t=W.V0,e.VBR=b.vbr_rh;break;case W.EXTREME_FAST:t=W.V0,e.VBR=b.vbr_mtrh;break;case W.INSANE:return t=320,e.preset=t,o(e,t,a),e.VBR=b.vbr_off,t}switch(e.preset=t,t){case W.V9:return r(e,9,a),t;case W.V8:return r(e,8,a),t;case W.V7:return r(e,7,a),t;case W.V6:return r(e,6,a),t;case W.V5:return r(e,5,a),t;case W.V4:return r(e,4,a),t;case W.V3:return r(e,3,a),t;case W.V2:return r(e,2,a),t;case W.V1:return r(e,1,a),t;case W.V0:return r(e,0,a),t}return 8<=t&&t<=320?o(e,t,a):(e.preset=0,t)}}function w(){var e;this.setModules=function(t){e=t},this.ResvFrameBegin=function(t,a){var s,n=t.internal_flags,r=n.l3_side,i=e.getframebits(t);a.bits=(i-8*n.sideinfo_len)/n.mode_gr;var o=2048*n.mode_gr-8;t.brate>320?s=8*int(1e3*t.brate/(t.out_samplerate/1152)/8+.5):(s=11520,t.strict_ISO&&(s=8*int(32e4/(t.out_samplerate/1152)/8+.5))),n.ResvMax=s-i,n.ResvMax>o&&(n.ResvMax=o),(n.ResvMax<0||t.disable_reservoir)&&(n.ResvMax=0);var _=a.bits*n.mode_gr+Math.min(n.ResvSize,n.ResvMax);return _>s&&(_=s),r.resvDrain_pre=0,null!=n.pinfo&&(n.pinfo.mean_bits=a.bits/2,n.pinfo.resvsize=n.ResvSize),_},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,10*i>9*o?(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,0!=(a=e.ResvSize%8)&&(n+=a),(a=e.ResvSize-n-e.ResvMax)>0&&(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}}function R(){this.setModules=function(e,t,a){e,t,a};var e=[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];function t(t,a){return a=a>>8^e[255&(a^t)]}this.updateMusicCRC=function(e,a,s,n){for(var r=0;r0;){var s;0==p&&(p=8,u++,e.header[e.w_ptr].write_timing==f&&m(e),l[u]=0),a-=s=Math.min(a,p),p-=s,l[u]|=t>>a<0;){var s;0==p&&(p=8,u++,l[u]=0),a-=s=Math.min(a,p),p-=s,l[u]|=t>>a<=8&&(b(s,76,8),t-=8),t>=8&&(b(s,65,8),t-=8),t>=8&&(b(s,77,8),t-=8),t>=8&&(b(s,69,8),t-=8),t>=32){var n=i.getLameShortVersion();if(t>=32)for(a=0;a=8;++a)t-=8,b(s,n.charCodeAt(a),8)}for(;t>=1;t-=1)b(s,s.ancillary_flag,1),s.ancillary_flag^=e.disable_reservoir?0:1}function M(e,t,a){for(var s=e.header[e.h_ptr].ptr;a>0;){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 w(e,t){e<<=8;for(var a=0;a<8;a++)0!=(65536&((t<<=1)^(e<<=1)))&&(t^=32773);return t}function R(e,t){var a,s=B.ht[t.count1table_select+32],n=0,r=t.big_values,i=t.big_values;for(a=(t.count1-t.big_values)/4;a>0;--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,b(e,o+s.table[_],s.hlen[_]),n+=s.hlen[_]}return n}function k(e,t,a,s,n){var r=B.ht[t],i=0;if(0==t)return i;for(var o=a;o15){if(u>14)h|=u-15<<1,l=f,u=15;if(p>14)h<<=f,h|=p-15,l+=f,p=15;c=16}0!=p&&(h<<=1,n.xr[o+1]<0&&h++,_--),u=u*c+p,l-=_,_+=r.hlen[u],b(e,r.table[u],_),b(e,h,l),i+=_+l}return i}function A(e,t){var a=3*e.scalefac_band.s[3];a>t.big_values&&(a=t.big_values);var s=k(e,t.table_select[0],0,a,t);return s+=k(e,t.table_select[1],a,t.big_values,t)}function y(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,n>a&&(n=a),(r=e.scalefac_band.l[i])>a&&(r=a),s=k(e,t.table_select[0],0,n,t),s+=k(e,t.table_select[1],n,r,t),s+=k(e,t.table_select[2],r,a,t)}function T(){this.total=0}function x(t,a){var s,n,r,i,o,_=t.internal_flags;return o=_.w_ptr,-1==(i=_.h_ptr-1)&&(i=Z.MAX_HEADER_BUF-1),s=_.header[i].write_timing-f,a.total=s,s>=0&&(n=1+i-o,i>8),t[5]=byte(255&a)},this.flush_bitstream=function(e){var a,n,r=e.internal_flags,i=r.h_ptr-1;if(-1==i&&(i=Z.MAX_HEADER_BUF-1),a=r.l3_side,!((n=x(e,new T))<0)){if(v(e,n),r.ResvSize=0,a.main_data_begin=0,r.findReplayGain){var o=s.GetTitleGain(r.rgdata);r.RadioGain=0|Math.floor(10*o+.5)}r.findPeakSample&&(r.noclipGainChange=0|Math.ceil(20*t(r.PeakSample/32767)*10),r.noclipGainChange>0&&(EQ(e.scale,1)||EQ(e.scale,0))?r.noclipScale=Math.floor(32767/r.PeakSample*100)/100:r.noclipScale=-1)}},this.add_dummy_byte=function(e,t,a){for(var s,n=e.internal_flags;a-- >0;)for(d(0,t,8),s=0;s ResvSize"),8*t.main_data_begin!=a.ResvSize&&(h.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),h.err.println("This is a fatal error. It has several possible causes:"),h.err.println("90%% LAME compiled with buggy version of gcc using advanced optimizations"),h.err.println(" 9%% Your system is overclocked"),h.err.println(" 1%% bug in LAME encoding library"),a.ResvSize=8*t.main_data_begin),f>1e9){var r;for(r=0;ri)return-1;if(h.arraycopy(l,0,t,a,c),u=-1,p=0,0!=f){var m=n(1);if(m[0]=e.nMusicCRC,_.updateMusicCRC(m,t,a,c),e.nMusicCRC=m[0],c>0&&(e.VBR_seek_table.nBytesWritten+=c),e.decode_on_the_fly)for(var b,d=o([2,1152]),v=c,g=-1;0!=g;)if(g=r.hip_decode1_unclipped(e.hip,t,a,v,d[0],d[1]),v=0,-1==g&&(g=0),g>0){if(e.findPeakSample){for(b=0;be.PeakSample?e.PeakSample=d[0][b]:-d[0][b]>e.PeakSample&&(e.PeakSample=-d[0][b]);if(e.channels_out>1)for(b=0;be.PeakSample?e.PeakSample=d[1][b]:-d[1][b]>e.PeakSample&&(e.PeakSample=-d[1][b])}if(e.findReplayGain&&s.AnalyzeSamples(e.rgdata,d[0],0,d[1],0,g,e.channels_out)==S.GAIN_ANALYSIS_ERROR)return-6}}return c},this.init_bit_stream_w=function(e){l=a(W.LAME_MAXMP3BUFFER),e.h_ptr=e.w_ptr=0,e.header[e.h_ptr].write_timing=0,u=-1,p=0,f=0}}function A(e,t,a,s){this.xlen=e,this.linmax=t,this.table=a,this.hlen=s}d.STEREO=new d(0),d.JOINT_STEREO=new d(1),d.DUAL_CHANNEL=new d(2),d.MONO=new d(3),d.NOT_SET=new d(4),S.STEPS_per_dB=100,S.MAX_dB=120,S.GAIN_NOT_ENOUGH_SAMPLES=-24601,S.GAIN_ANALYSIS_ERROR=0,S.GAIN_ANALYSIS_OK=1,S.INIT_GAIN_ANALYSIS_ERROR=0,S.INIT_GAIN_ANALYSIS_OK=1,S.YULE_ORDER=10,S.MAX_ORDER=S.YULE_ORDER,S.MAX_SAMP_FREQ=48e3,S.RMS_WINDOW_TIME_NUMERATOR=1,S.RMS_WINDOW_TIME_DENOMINATOR=20,S.MAX_SAMPLES_PER_WINDOW=S.MAX_SAMP_FREQ*S.RMS_WINDOW_TIME_NUMERATOR/S.RMS_WINDOW_TIME_DENOMINATOR+1,R.NUMTOCENTRIES=100,R.MAXFRAMESIZE=2880,k.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)},k.NEQ=function(e,t){return!k.EQ(e,t)};var B={};function y(e){this.bits=e}function T(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}function x(){this.setModules=function(e,t){e,t}}function E(){this.useAdjust=0,this.aaSensitivityP=0,this.adjust=0,this.adjustLimit=0,this.decay=0,this.floor=0,this.l=r(X.SBMAX_l),this.s=r(X.SBMAX_s),this.psfb21=r(X.PSFB21),this.psfb12=r(X.PSFB12),this.cb_l=r(X.CBANDS),this.cb_s=r(X.CBANDS),this.eql_w=r(X.BLKSIZE/2)}function P(){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=d.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}function L(e){var t=e;this.quantize=t,this.iteration_loop=function(e,t,a,s){var i,o=e.internal_flags,_=r(N.SFBMAX),l=r(576),f=n(2),c=0,h=o.l3_side,u=new y(c);this.quantize.rv.ResvFrameBegin(e,u),c=u.bits;for(var p=0;p>2&63)>=32&&(s-=64),l=Math.pow(10,s/4/10),(s=a.exp_nspsytune>>8&63)>=32&&(s-=64),u=Math.pow(10,s/4/10),(s=a.exp_nspsytune>>14&63)>=32&&(s-=64),b=Math.pow(10,s/4/10),(s=a.exp_nspsytune>>20&63)>=32&&(s-=64),v=b*Math.pow(10,s/4/10),s=0;sZ.MAX_BITS_PER_GRANULE&&(m=Z.MAX_BITS_PER_GRANULE),_=0,l=0;l3*r/4&&(h[l]=3*r/4),h[l]<0&&(h[l]=0),h[l]+s[l]>Z.MAX_BITS_PER_CHANNEL&&(h[l]=Math.max(0,Z.MAX_BITS_PER_CHANNEL-s[l])),_+=h[l];if(_>p)for(l=0;lZ.MAX_BITS_PER_GRANULE){for(l=0;l.5&&(n=.5);var r=0|.5*n*(e[0]+e[1]);r>Z.MAX_BITS_PER_CHANNEL-e[0]&&(r=Z.MAX_BITS_PER_CHANNEL-e[0]),r<0&&(r=0),e[1]>=125&&(e[1]-r>125?(e[0]s&&(e[0]=s*e[0]/r,e[1]=s*e[1]/r)},this.athAdjust=function(e,t,a){var s=90.30873362,n=u.FAST_LOG10_X(t,10),r=e*e,i=0;return n-=a,r>1e-20&&(i=1+u.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==b.vbr_mtrh?1:0,h=i.masking_lower;for(e.VBR!=b.vbr_mtrh&&e.VBR!=b.vbr_mt||(h=1),n=0;n>1,B=0;do{B+=T=f[o]*f[o],w+=T0);if(B>S&&_++,n==X.SBPSY_l)w<(A=S*i.nsPsy.longfact[n])&&(w=A);if(0!=c&&(S=w),!e.ATHonly)if((R=t.en.l[n])>0)A=B*t.thm.l[n]*h/R,0!=c&&(A*=i.nsPsy.longfact[n]),S>1;M=g/d,w=2220446049250313e-31;do{var T,x;B+=T=f[o]*f[o],w+=T0);if(B>g&&_++,m==X.SBPSY_s)w<(A=g*i.nsPsy.shortfact[m])&&(w=A);if(S=0!=c?w:g,!e.ATHonly&&!e.ATHshort)if((R=t.en.s[m][v])>0)A=B*t.thm.s[m][v]*h/R,0!=c&&(A*=i.nsPsy.shortfact[m]),Ss[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,i=t.s,o=e.l3_enc;if(i>e.count1)for(;0!=a--;){l=e.xr[i],i++,n+=l*l,l=e.xr[i],i++,n+=l*l}else if(i>e.big_values){var _=r(2);for(_[0]=0,_[1]=s;0!=a--;){l=Math.abs(e.xr[i])-_[o[i]],i++,n+=l*l,l=Math.abs(e.xr[i])-_[o[i]],i++,n+=l*l}}else for(;0!=a--;){var l;l=Math.abs(e.xr[i])-h[o[i]]*s,i++,n+=l*l,l=Math.abs(e.xr[i])-h[o[i]]*s,i++,n+=l*l}return t.s=i,n},this.calc_noise=function(e,t,a,s,n){var r,i,o=0,_=0,c=0,h=0,p=0,m=-20,b=0,d=e.scalefac,g=0;for(s.over_SSD=0,r=0;r>1,b+e.width[r]>e.max_nonzero_coeff)i=(R=e.max_nonzero_coeff-b+1)>0?R>>1:0;var A=new v(b);w=this.calc_noise_core(e,A,i,k),b=A.s,null!=n&&(n.step[r]=M,n.noise[r]=w),w=a[o++]=w/t[_++],w=u.FAST_LOG10(Math.max(w,1e-20)),null!=n&&(n.noise_log[r]=w)}if(null!=n&&(n.global_gain=e.global_gain),p+=w,w>0)S=Math.max(0|10*w+.5,1),s.over_SSD+=S*S,c++,h+=w;m=Math.max(m,w)}return s.over_count=c,s.tot_noise=p,s.over_noise=h,s.max_noise=m,c},this.set_pinfo=function(e,t,a,s,n){var i,o,_,f,c,h=e.internal_flags,u=0==t.scalefac_scale?.5:1,p=t.scalefac,m=r(N.SFBMAX),b=r(N.SFBMAX),d=new T;calc_xmin(e,a,t,m),calc_noise(t,m,b,d,null);var v=0;for(o=t.sfb_lmax,t.block_type!=X.SHORT_TYPE&&0==t.mixed_block_flag&&(o=22),i=0;i0&&!e.ATHonly?f/=a.en.l[i]:f=0,h.pinfo.thr[s][n][i]=c*Math.max(f*a.thm.l[i],h.ATH.l[i]),h.pinfo.LAMEsfb[s][n][i]=0,0!=t.preflag&&i>=11&&(h.pinfo.LAMEsfb[s][n][i]=-u*l[i]),i0?f/=a.en.s[i][w]:f=0,(e.ATHonly||e.ATHshort)&&(f=0),h.pinfo.thr_s[s][n][3*i+w]=c*Math.max(f*a.thm.s[i][w],h.ATH.s[i]),h.pinfo.LAMEsfb_s[s][n][3*i+w]=-2*t.subblock_gain[w],i0?(r=a.over_SSD<=t.over_SSD,a.over_SSD==t.over_SSD&&(r=a.bits.2||a.max_noise<=0&&t.max_noise<0&&t.max_noise>a.max_noise-.2&&a.tot_noise0&&t.max_noise>a.max_noise-.2&&a.tot_noise0&&t.max_noise>-.05&&t.max_noise>a.max_noise-.1&&a.tot_noise+a.over_noise0&&t.max_noise>-.1&&t.max_noise>a.max_noise-.15&&a.tot_noise+a.over_noise+a.over_noise1?o=Math.pow(o,.5):o*=.95;break;case 0:default:o>1?o=1:o*=.95}var f=0;for(_=0;_t.xrpow_max&&(t.xrpow_max=s[f+c]);if(2==i.noise_shaping_amp)return}}}(e,t,n,r,i);var l=o(t);return!l&&(!(l=2==_.mode_gr?s.scale_bitcount(t):s.scale_bitcount_lsf(_,t))||(_.noise_shaping>1&&(c.fill(_.pseudohalf,0),0==t.scalefac_scale?(!function(e,t){for(var s=0,n=0;ne.xrpow_max&&(e.xrpow_max=t[s+o])}e.scalefac[n]=i>>1}e.preflag=0,e.scalefac_scale=1}(t,r),l=!1):t.block_type==X.SHORT_TYPE&&_.subblock_gain>0&&(l=function(e,t,s){var n,r=t.scalefac;for(n=0;n=16)return!0;for(var i=0;i<3;i++){var o=0,_=0;for(n=t.sfb_lmax+i;n=7)return!0;t.subblock_gain[i]++;var l=e.scalefac_band.l[t.sfb_lmax];for(n=t.sfb_lmax+i;n>t.scalefac_scale)>=0)r[n]=c,l+=3*f;else{r[n]=0;var h=210+(c<t.xrpow_max&&(t.xrpow_max=s[l+u]);l+=f*(3-i-1)}}var p=a.IPOW20(202);l+=t.width[n]*(i+1);for(u=-t.width[n];u<0;u++)s[l+u]*=p,s[l+u]>t.xrpow_max&&(t.xrpow_max=s[l+u])}}return!1}(_,t,r)||o(t))),l||(l=2==_.mode_gr?s.scale_bitcount(t):s.scale_bitcount_lsf(_,t)),!l))}this.setModules=function(r,i,o,_){e=r,t=i,this.rv=i,a=o,this.qupvt=o,s=_,n.setModules(a,s)},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*u.SQRT2),e.tt[t][1].xr[a]=(s-n)*(.5*u.SQRT2)}},this.init_xrpow=function(e,t,a){var s=0,n=0|t.max_nonzero_coeff;if(t.xrpow_max=0,c.fill(a,n,576,0),(s=function(e,t,a,s){s=0;for(var n=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))>1e-20){var r=0;0!=(2&e.substep_shaping)&&(r=1);for(var i=0;i=0&&!r;i--){var o=e.scalefac_band.psfb21[i],_=e.scalefac_band.psfb21[i+1],l=a.athAdjust(s.adjust,s.psfb21[i],s.floor);e.nsPsy.longfact[21]>1e-12&&(l*=e.nsPsy.longfact[21]);for(var f=_-1;f>=o;f--){if(!(Math.abs(n[f])=0&&!r;i--){_=(o=3*e.scalefac_band.s[12]+(e.scalefac_band.s[13]-e.scalefac_band.s[12])*c+(e.scalefac_band.psfb12[i]-e.scalefac_band.psfb12[0]))+(e.scalefac_band.psfb12[i+1]-e.scalefac_band.psfb12[i]);var h=a.athAdjust(s.adjust,s.psfb12[i],s.floor);e.nsPsy.shortfact[12]>1e-12&&(h*=e.nsPsy.shortfact[12]);for(f=_-1;f>=o;f--){if(!(Math.abs(n[f])=1||(c.sort(i,_-b,b),k.EQ(i[_-1],0)))){h=(1-o[f])*n[f],u=0,m=0;do{var d;for(p=1;m+p0)}}while(++fa?(c==i.BINSEARCH_DOWN&&(l=!0),l&&(_/=2),c=i.BINSEARCH_UP,h=_):(c==i.BINSEARCH_UP&&(l=!0),l&&(_/=2),c=i.BINSEARCH_DOWN,h=-_),t.global_gain+=h,t.global_gain<0&&(t.global_gain=0,l=!0),t.global_gain>255&&(t.global_gain=255,l=!0)}for(;o>a&&t.global_gain<255;)t.global_gain++,o=s.count_bits(e,r,t,null);e.CurrentStep[n]=f-t.global_gain>=4?4:2,e.OldValue[n]=t.global_gain,t.part2_3_length=o}(u,t,c,f,o),0==u.noise_shaping)return 100;a.calc_noise(t,n,d,v,g),v.bits=t.part2_3_length,p.assign(t);var k=0;for(h.arraycopy(o,0,m,0,576);!M;){do{var A,B=new T,y=255;if(A=0!=(2&u.substep_shaping)?20:3,u.sfb21_extra){if(d[p.sfbmax]>1)break;if(p.block_type==X.SHORT_TYPE&&(d[p.sfbmax+1]>1||d[p.sfbmax+2]>1))break}if(!l(e,p,d,o,w))break;0!=p.scalefac_scale&&(y=254);var x=c-p.part2_length;if(x<=0)break;for(;(p.part2_3_length=s.count_bits(u,o,p,g))>x&&p.global_gain<=y;)p.global_gain++;if(p.global_gain>y)break;if(0==v.over_count){for(;(p.part2_3_length=s.count_bits(u,o,p,g))>S&&p.global_gain<=y;)p.global_gain++;if(p.global_gain>y)break}if(a.calc_noise(p,n,d,B,g),B.bits=p.part2_3_length,0!=(_(t.block_type!=X.SHORT_TYPE?e.quant_comp:e.quant_comp_short,v,B,p,d)?1:0))S=t.part2_3_length,v=B,t.assign(p),k=0,h.arraycopy(o,0,m,0,576);else if(0==u.full_outer_loop){if(++k>A&&0==v.over_count)break;if(3==u.noise_shaping_amp&&w&&k>30)break;if(3==u.noise_shaping_amp&&w&&p.global_gain-R>15)break}}while(p.global_gain+p.scalefac_scale<255);3==u.noise_shaping_amp?w?M=!0:(p.assign(t),h.arraycopy(m,0,o,0,576),k=0,R=p.global_gain,w=!0):M=!0}return e.VBR==b.vbr_rh||e.VBR==b.vbr_mtrh?h.arraycopy(m,0,o,0,576):0!=(1&u.substep_shaping)&&trancate_smallspectrums(u,t,n,o),v.over_count},this.iteration_finish_one=function(e,a,n){var r=e.l3_side,i=r.tt[a][n];s.best_scalefac_store(e,a,n,r),1==e.use_best_huffman&&s.best_huffman_divide(e,i),t.ResvAdjust(e,i)},this.VBR_encode_granule=function(e,t,a,s,n,i,o){var _,l=e.internal_flags,f=new V,u=r(576),p=o,m=o+1,b=(o+i)/2,d=0,v=l.sfb21_extra;c.fill(f.l3_enc,0);do{l.sfb21_extra=!(b>p-42)&&v,outer_loop(e,t,a,s,n,b)<=0?(d=1,m=t.part2_3_length,f.assign(t),h.arraycopy(s,0,u,0,576),_=(o=m-32)-i,b=(o+i)/2):(_=o-(i=b+32),b=(o+i)/2,0!=d&&(d=2,t.assign(f),h.arraycopy(u,0,s,0,576)))}while(_>12);l.sfb21_extra=v,2==d&&h.arraycopy(f.l3_enc,0,t.l3_enc,0,576)},this.get_framebits=function(a,s){var n=a.internal_flags;n.bitrate_index=n.VBR_min_bitrate;var r=e.getframebits(a);n.bitrate_index=1,r=e.getframebits(a);for(var i=1;i<=n.VBR_max_bitrate;i++){n.bitrate_index=i;var o=new y(r);s[i]=t.ResvFrameBegin(a,o),r=o.bits}},this.VBR_old_prepare=function(e,s,n,r,i,o,_,l,f){var c,h=e.internal_flags,u=0,p=1,m=0;h.bitrate_index=h.VBR_max_bitrate;var b=t.ResvFrameBegin(e,new y(0))/h.mode_gr;get_framebits(e,o);for(var d=0;do[h.VBR_max_bitrate]&&(l[d][g]*=o[h.VBR_max_bitrate],l[d][g]/=m),_[d][g]>l[d][g]&&(_[d][g]=l[d][g]);return p},this.bitpressure_strategy=function(e,t,a,s){for(var n=0;n_&&(o[p][m]*=_,o[p][m]/=h);return f},this.calc_target_bits=function(s,n,r,i,o,_){var l,f,c,h,u=s.internal_flags,p=u.l3_side,m=0;u.bitrate_index=u.VBR_max_bitrate;var b=new y(m);for(_[0]=t.ResvFrameBegin(s,b),m=b.bits,u.bitrate_index=1,m=e.getframebits(s)-8*u.sideinfo_len,o[0]=m/(u.mode_gr*u.channels_out),m=s.VBR_mean_bitrate_kbps*s.framesize*1e3,0!=(1&u.substep_shaping)&&(m*=1.09),m/=s.out_samplerate,m-=8*u.sideinfo_len,m/=u.mode_gr*u.channels_out,(l=.93+.07*(11-s.compression_ratio)/5.5)<.9&&(l=.9),l>1&&(l=1),f=0;f700){var v=int((n[f][c]-700)/1.4),g=p.tt[f][c];i[f][c]=int(l*m),g.block_type==X.SHORT_TYPE&&v3*m/2?v=3*m/2:v<0&&(v=0),i[f][c]+=v}i[f][c]>Z.MAX_BITS_PER_CHANNEL&&(i[f][c]=Z.MAX_BITS_PER_CHANNEL),d+=i[f][c]}if(d>Z.MAX_BITS_PER_GRANULE)for(c=0;cZ.MAX_BITS_PER_CHANNEL&&(i[f][c]=Z.MAX_BITS_PER_CHANNEL),h+=i[f][c];if(h>_[0])for(f=0;f=0;--U){var ee,te;ee=q[j+U]*n[20+U]+q[j+-1-U]*i[28+U],te=q[j+U]*i[28+U]-q[j+-1-U]*n[20+U],q[j+-1-U]=ee,q[j+U]=te}}}if(O=u,C=286,1==e.mode_gr)for(var ae=0;ae<18;ae++)h.arraycopy(e.sb_sample[V][1][ae],0,e.sb_sample[V][0][ae],0,32)}}}function q(){this.thm=new z,this.en=new z}function X(){var e=X.FFTOFFSET,t=X.MPG_MD_MS_LR,a=null;this.psy=null;var s=null,i=null,_=null;this.setModules=function(e,t,n,r){a=e,this.psy=t,s=t,i=r,_=n};var l=new Y;this.lame_encode_mp3_frame=function(c,u,p,m,v,g){var S,M=f([2,2]);M[0][0]=new q,M[0][1]=new q,M[1][0]=new q,M[1][1]=new q;var w,R=f([2,2]);R[0][0]=new q,R[0][1]=new q,R[1][0]=new q,R[1][1]=new q;var k,A,B,y=[null,null],T=c.internal_flags,x=o([2,4]),E=[.5,.5],P=[[0,0],[0,0]],L=[[0,0],[0,0]];if(y[0]=u,y[1]=p,0==T.lame_encode_frame_init&&function(e,t){var a,s,n=e.internal_flags;if(0==n.lame_encode_frame_init){var i,o,_=r(2014),f=r(2014);for(n.lame_encode_frame_init=1,i=0,o=0;i<286+576*(1+n.mode_gr);++i)i<576*n.mode_gr?(_[i]=0,2==n.channels_out&&(f[i]=0)):(_[i]=t[0][o],2==n.channels_out&&(f[i]=t[1][o]),++o);for(s=0;s0&&(E[B]=x[B][3]/E[B])),A=0;A.03125)e.ATH.adjust>=1?e.ATH.adjust=1:e.ATH.adjust=s?(e.ATH.adjust*=.075*s+.925,e.ATH.adjust=s?e.ATH.adjust=s:e.ATH.adjust>1,m=(p=n<<1)+(h=n),n=p<<1,i=(r=t)+b;do{R=e[r+0]-e[r+h],w=e[r+0]+e[r+h],y=e[r+p]-e[r+m],A=e[r+p]+e[r+m],e[r+p]=w-A,e[r+0]=w+A,e[r+m]=R-y,e[r+h]=R+y,R=e[i+0]-e[i+h],w=e[i+0]+e[i+h],y=u.SQRT2*e[i+m],A=u.SQRT2*e[i+p],e[i+p]=w-A,e[i+0]=w+A,e[i+m]=R-y,e[i+h]=R+y,i+=n,r+=n}while(r<_);for(f=a[o+0],l=a[o+1],c=1;c=0);s(a[_],l,X.BLKSIZE_s/2)}},this.fft_long=function(t,a,r,i,o){var _=X.BLKSIZE/8-1,l=X.BLKSIZE/2;do{var f,c,h,u,p,m=255&n[_];c=(f=e[m]*i[r][o+m])-(p=e[m+512]*i[r][o+m+512]),f+=p,u=(h=e[m+256]*i[r][o+m+256])-(p=e[m+768]*i[r][o+m+768]),h+=p,a[(l-=4)+0]=f+h,a[l+2]=f-h,a[l+1]=c+u,a[l+3]=c-u,c=(f=e[m+1]*i[r][o+m+1])-(p=e[m+513]*i[r][o+m+513]),f+=p,u=(h=e[m+257]*i[r][o+m+257])-(p=e[m+769]*i[r][o+m+769]),h+=p,a[l+X.BLKSIZE/2+0]=f+h,a[l+X.BLKSIZE/2+2]=f-h,a[l+X.BLKSIZE/2+1]=c+u,a[l+X.BLKSIZE/2+3]=c-u}while(--_>=0);s(a,l,X.BLKSIZE/2)},this.init_fft=function(a){for(var s=0;s=0;--m){var b=r[i+0][m],d=r[i+1][m];r[i+0][m]=(b+d)*u.SQRT2*.5,r[i+1][m]=(b-d)*u.SQRT2*.5}for(var v=2;v>=0;--v)for(m=X.BLKSIZE_s-1;m>=0;--m){b=o[_+0][v][m],d=o[_+1][v][m];o[_+0][v][m]=(b+d)*u.SQRT2*.5,o[_+1][v][m]=(b-d)*u.SQRT2*.5}}a[0]=r[i+0][0],a[0]*=a[0];for(m=X.BLKSIZE/2-1;m>=0;--m){var g=r[i+0][X.BLKSIZE/2-m],S=r[i+0][X.BLKSIZE/2+m];a[X.BLKSIZE/2-m]=.5*(g*g+S*S)}for(v=2;v>=0;--v){n[v][0]=o[_+0][v][0],n[v][0]*=n[v][0];for(m=X.BLKSIZE_s/2-1;m>=0;--m){g=o[_+0][v][X.BLKSIZE_s/2-m],S=o[_+0][v][X.BLKSIZE_s/2+m];n[v][X.BLKSIZE_s/2-m]=.5*(g*g+S*S)}}var M=0;for(m=11;me){if(!(t=t*l)return e+t;i=e/t}if(e+=t,s+3<=6){if(i>=_)return e;var o=0|u.FAST_LOG10_X(i,16);return e*g[o]}var c,h;o=0|u.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,et?(c=1,o<=13&&(c=S[o]),h=u.FAST_LOG10_X(e/t,10/15),e*((v[o]-c)*h+c)):o>13?e:e*S[o]:e*v[o]}var w=[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 R(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=t>e?t/e:e/t,-2<=a&&a<=2){if(s>=_)return e+t;var n=0|u.FAST_LOG10_X(s,16);return(e+t)*w[n]}return s=f){++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=l){++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=1?e:a<=0?t:t>0?Math.pow(e/t,a)*t:0}var T=[11.8,13.6,17.2,32,46.5,51.3,57.5,67.1,71.5,84.6,97.6,130];function x(e,a){for(var s=309.07,n=0;n0){var o=i*a,_=e.en.s[n][r];_>o&&(s+=_>1e10*o?T[n]*(10*t):T[n]*u.FAST_LOG10(_/o))}}return s}var E=[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 P(e,a){for(var s=281.0575,n=0;n0){var i=r*a,o=e.en.l[n];o>i&&(s+=o>1e10*i?E[n]*(10*t):E[n]*u.FAST_LOG10(o/i))}}return s}function L(e,t,a,s,n){var r,i;for(r=i=0;r0?((o=t[r])n&&(_=n),s[r]=_):s[r]=0;for(r=1;r0)(o=t[r-1])n&&(_=n),s[r]=_;else s[r]=0}(i=a[r-1]+a[r])>0?((o=t[r-1])n&&(_=n),s[r]=_):s[r]=0}var H=[-1730326e-23,-.01703172,-1349528e-23,.0418072,-673278e-22,-.0876324,-30835e-21,.1863476,-1104424e-22,-.627638];function O(t,a,s,n,r,i,o,_){var l=t.internal_flags;if(n<2)e.fft_long(l,o[_],n,a,s);else if(2==n)for(var f=X.BLKSIZE-1;f>=0;--f){var c=o[_+0][f],h=o[_+1][f];o[_+0][f]=(c+h)*u.SQRT2*.5,o[_+1][f]=(c-h)*u.SQRT2*.5}i[0]=o[_+0][0],i[0]*=i[0];for(f=X.BLKSIZE/2-1;f>=0;--f){var p=o[_+0][X.BLKSIZE/2-f],m=o[_+0][X.BLKSIZE/2+f];i[X.BLKSIZE/2-f]=.5*(p*p+m*m)}var b=0;for(f=11;f=0;--f){var c=o[_+0][r][f],h=o[_+1][r][f];o[_+0][r][f]=(c+h)*u.SQRT2*.5,o[_+1][r][f]=(c-h)*u.SQRT2*.5}i[r][0]=o[_+0][r][0],i[r][0]*=i[r][0];for(f=X.BLKSIZE_s/2-1;f>=0;--f){var p=o[_+0][r][X.BLKSIZE_s/2-f],m=o[_+0][r][X.BLKSIZE_s/2+f];i[r][X.BLKSIZE_s/2-f]=.5*(p*p+m*m)}}function V(e,t,a,n){var r=e.internal_flags;2==e.athaa_loudapprox&&a<2&&(r.loudness_sq[t][a]=r.loudness_sq_save[a],r.loudness_sq_save[a]=s(n,r))}this.L3psycho_anal_ns=function(e,t,a,s,_,l,f,u,m,v){var g,S,w,R,T,E,O,C,V,N,D=e.internal_flags,Y=o([2,X.BLKSIZE]),q=o([2,3,X.BLKSIZE_s]),j=r(X.CBANDS+1),F=r(X.CBANDS+1),z=r(X.CBANDS+2),U=n(2),Z=n(2),K=o([2,576]),G=n(X.CBANDS+2),W=n(X.CBANDS+2);for(c.fill(W,0),g=D.channels_out,e.mode==d.JOINT_STEREO&&(g=4),V=e.VBR==b.vbr_off?0==D.ResvMax?0:D.ResvSize/D.ResvMax*.5:e.VBR==b.vbr_rh||e.VBR==b.vbr_mtrh||e.VBR==b.vbr_mt?.6:1,S=0;S2&&(l[s][S].en.assign(D.en[S+2]),l[s][S].thm.assign(D.thm[S+2]))}for(S=0;Sae[R+3-2]?be/=ae[R+3-2]:be=ae[R+3-2]>10*be?ae[R+3-2]/(10*be):0,ne[R+3]=be}if(e.analysis){var de=ne[0];for(R=1;R<12;R++)dete&&(_e[R/3]=R%3+1);for(R=1;R<4;R++){(se[R-1]>se[R]?se[R-1]/se[R]:se[R]/se[R-1])<1.7&&(_e[R]=0,1==R&&(_e[0]=0))}for(0!=_e[0]&&0!=D.nsPsy.lastAttacks[S]&&(_e[0]=0),3!=D.nsPsy.lastAttacks[S]&&_e[0]+_e[1]+_e[2]+_e[3]==0||(re=0,0!=_e[1]&&0!=_e[0]&&(_e[1]=0),0!=_e[2]&&0!=_e[1]&&(_e[2]=0),0!=_e[3]&&0!=_e[2]&&(_e[3]=0)),S<2?Z[S]=re:0==re&&(Z[0]=Z[1]=0),m[S]=D.tot_ener[S],i(e,le,fe,Y,1&S,q,1&S,s,S,t,a),L(D,le,j,ie,oe),I(D,ie,oe,G),C=0;C<3;C++){var ve,ge;for(B(e,fe,F,z,S,C),k(D,F,z,S,C),O=0;O=2||1==_e[C+1]){var Se=0!=C?C-1:2;be=y(D.thm[S].s[O][Se],ge,.6*V);ge=Math.min(ge,be)}if(1==_e[C]){Se=0!=C?C-1:2,be=y(D.thm[S].s[O][Se],ge,.3*V);ge=Math.min(ge,be)}else if(0!=C&&3==_e[C-1]||0==C&&3==D.nsPsy.lastAttacks[S]){Se=2!=C?C+1:0,be=y(D.thm[S].s[O][Se],ge,.3*V);ge=Math.min(ge,be)}ve=ae[3*C+3]+ae[3*C+4]+ae[3*C+5],6*ae[3*C+5]0&&function(e,t){var a=e.internal_flags;if(a.channels_out>1){for(var s=0;s1.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;t1.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}}(D),N=e.msfix,Math.abs(N)>0&&function(e,t,a){var s=t,n=Math.pow(10,a);t*=2,s*=2;for(var r=0;r1?(ke=u,ye=-2,Ae=X.NORM_TYPE,v[0]!=X.SHORT_TYPE&&v[1]!=X.SHORT_TYPE||(Ae=X.SHORT_TYPE),Be=l[s][S-2]):(ke=f,ye=0,Ae=v[S],Be=_[s][S]),Ae==X.SHORT_TYPE?ke[ye+S]=x(Be,D.masking_lower):ke[ye+S]=P(Be,D.masking_lower),e.analysis&&(D.pinfo.pe[s][S]=ke[ye+S])}return 0};var N=[-1730326e-23,-.01703172,-1349528e-23,.0418072,-673278e-22,-.0876324,-30835e-21,.1863476,-1104424e-22,-.627638];function D(e,t,a){if(0==a)for(var s=0;s0?((o=t[r])n&&(_=n),s[r]=_):s[r]=0,r=1;r0)(o=t[r-1])n&&(_=n),s[r]=_;else s[r]=0}(i=a[r-1]+a[r])>0?((o=t[r-1])n&&(_=n),s[r]=_):s[r]=0}(f,c,u,p),_=l=0;lM&&(s[l]=M),f.masking_lower>1&&(s[l]*=f.masking_lower),s[l]>a[l]&&(s[l]=a[l]),f.masking_lower<1&&(s[l]*=f.masking_lower)}for(;l0?Math.min(p,S):Math.min(p,.3*a[o])}else{var M=16*e.nb_2[i][o],w=2*e.nb_1[i][o];M<=0&&(M=p),w<=0&&(w=p),S=e.blocktype_old[1&i]==X.NORM_TYPE?Math.min(w,M):w,s[o]=Math.min(p,S)}e.nb_2[i][o]=e.nb_1[i][o],e.nb_1[i][o]=p,u=_[o],u*=e.minval_l[o],u*=m,s[o]>u&&(s[o]=u),e.masking_lower>1&&(s[o]*=e.masking_lower),s[o]>a[o]&&(s[o]=a[o]),e.masking_lower<1&&(s[o]*=e.masking_lower)}for(;o0?Math.pow(10,n):1,c=0;c0){var S,M,w=s[c]*f;if(S=Math.min(Math.max(p,w),Math.max(m,w)),(M=(b=Math.max(_,w))+(d=Math.max(o,w)))>0&&S*lh&&(_=h),o>u&&(o=u),t[2][c]=_,t[3][c]=o}}function z(e,t){var a;return(a=e>=0?27*-e:e*t)<=-72?0:Math.exp(.2302585093*a)}function U(e){var t,a,s=0;for(s=0;z(s,e)>1e-20;s-=1);for(n=s,r=0;Math.abs(r-n)>1e-12;)z(s=(r+n)/2,e)>0?r=s:n=s;t=n;var n,r;s=0;for(s=0;z(s,e)>1e-20;s+=1);for(n=0,r=s;Math.abs(r-n)>1e-12;)z(s=(r+n)/2,e)>0?n=s:r=s;a=r;var i,o=0,_=1e3;for(i=0;i<=_;++i){o+=z(s=t+i*(a-t)/_,e)}return 1001/(o*(a-t))}function Z(e){return e<0&&(e=0),e*=.001,13*Math.atan(.76*e)+3.5*Math.atan(e*e/56.25)}function G(e,t,a,s,i,o,_,l,f,c,h,u){var p,m=r(X.CBANDS+1),b=l/(u>15?1152:384),d=n(X.HBLKSIZE);l/=f;var v=0,g=0;for(p=0;pf/2){v=f/2,++p;break}}m[p]=l*v;for(var M=0;Mf/2&&(R=f/2),a[M]=(d[w]+d[R])/2,t[M]=d[R];var y=b*A;_[M]=(y-m[t[M]])/(m[t[M]+1]-m[t[M]]),_[M]<0?_[M]=0:_[M]>1&&(_[M]=1),B=Z(l*c[M]*h),B=Math.min(B,15.5)/15.5,o[M]=Math.pow(10,1.25*(1-Math.cos(Math.PI*B))-2.5)}v=0;for(var T=0;T=0?3:1.5)>=.5&&f<=2.5?8*((u=f-.5)*u-2*u):0,((h=15.811389+7.5*(f+=.474)-17.5*Math.sqrt(1+f*f))<=-60?0:(f=Math.exp(.2302585093*(c+h)),f/=.6609193))*s[_]);p[b][_]=d*n[b]}else for(_=0;_0);_++);for(e[b][0]=_,_=t-1;_>0&&!(p[b][_]>0);_--);e[b][1]=_,m+=e[b][1]-e[b][0]+1}var S=r(m),M=0;for(b=0;b2&&(i[s][b].en.assign(u.en[b+2]),i[s][b].thm.assign(u.thm[b+2]))}for(b=0;b0;++g,--w){var E=h[0][g],P=h[1][g];h[0][g]=E+P,h[1][g]=E-P}for(g=0;g<3;g++)k[g]=u.nsPsy.last_en_subshort[b][g+6],R[g]=k[g]/u.nsPsy.last_en_subshort[b][g+4],A[0]+=k[g];for(g=0;g<9;g++){for(var L=y+64,I=1;yk[g+3-2]?I/=k[g+3-2]:I=k[g+3-2]>10*I?k[g+3-2]/(10*I):0,R[g+3]=I}for(g=0;g<3;++g){var H=k[3*g+3]+k[3*g+4]+k[3*g+5],O=1;6*k[3*g+5]T&&(f[b][g/3]=g%3+1);for(g=1;g<4;g++){var V=A[g-1],D=A[g];Math.max(V,D)<4e4&&V<1.7*D&&D<1.7*V&&(1==g&&f[b][0]<=f[b][g]&&(f[b][0]=0),f[b][g]=0)}f[b][0]<=u.nsPsy.lastAttacks[b]&&(f[b][0]=0),3!=u.nsPsy.lastAttacks[b]&&f[b][0]+f[b][1]+f[b][2]+f[b][3]==0||(x=0,0!=f[b][1]&&0!=f[b][0]&&(f[b][1]=0),0!=f[b][2]&&0!=f[b][1]&&(f[b][2]=0),0!=f[b][3]&&0!=f[b][2]&&(f[b][3]=0)),b<2?c[b]=x:0==x&&(c[0]=c[1]=0),_[b]=u.tot_ener[b]}}(e,t,a,s,i,_,c,w,R,B),function(e,t){var a=e.internal_flags;e.short_blocks!=p.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var s=0;s=2||1==R[E][L+1]){var Z=0!=L?L-1:2,K=y(u.thm[E].s[H][Z],U,.36);U=Math.min(U,K)}else if(1==R[E][L]){Z=0!=L?L-1:2,K=y(u.thm[E].s[H][Z],U,.18);U=Math.min(U,K)}else if(0!=L&&3==R[E][L-1]||0==L&&3==u.nsPsy.lastAttacks[E]){Z=2!=L?L+1:0,K=y(u.thm[E].s[H][Z],U,.18);U=Math.min(U,K)}U*=w[E][L],z[L]=U}for(L=0;L<3;L++)u.thm[E].s[H][L]=z[L]}}for(E=0;E1?(G=f,W=-2,Q=X.NORM_TYPE,h[0]!=X.SHORT_TYPE&&h[1]!=X.SHORT_TYPE||(Q=X.SHORT_TYPE),J=_[s][E-2]):(G=l,W=0,Q=h[E],J=i[s][E]),Q==X.SHORT_TYPE?G[W+E]=x(J,u.masking_lower):G[W+E]=P(J,u.masking_lower),e.analysis&&(u.pinfo.pe[s][E]=G[W+E])}return 0},this.psymodel_init=function(a){var s,n=a.internal_flags,i=!0,o=13,c=0,h=0,u=-8.25,p=-4.5,d=r(X.CBANDS),v=r(X.CBANDS),g=r(X.CBANDS),S=a.out_samplerate;switch(a.experimentalZ){default:case 0:i=!0;break;case 1:i=a.VBR!=b.vbr_mtrh&&a.VBR!=b.vbr_mt;break;case 2:i=!1;break;case 3:o=8,c=-1.75,h=-.0125,u=-8.25,p=-2.25}for(n.ms_ener_ratio_old=.25,n.blocktype_old[0]=n.blocktype_old[1]=X.NORM_TYPE,s=0;s<4;++s){for(var M=0;M=o&&(R=h*(d[s]-o)/(24-o)+c*(24-d[s])/(24-o)),g[s]=Math.pow(10,R/10),n.numlines_l[s]>0?n.rnumlines_l[s]=1/n.numlines_l[s]:n.rnumlines_l[s]=0}n.s3_ll=W(n.s3ind,n.npart_l,d,v,g,i);var k;M=0;for(s=0;s(T*=n.numlines_l[s])&&(y=T)}n.ATH.cb_l[s]=y,(y=20*d[s]/10-20)>6&&(y=100),y<-15&&(y=-15),y-=8,n.minval_l[s]=Math.pow(10,y/10)*n.numlines_l[s]}for(n.npart_s=G(n.numlines_s,n.bo_s,n.bm_s,d,v,n.mld_s,n.PSY.bo_s_weight,S,X.BLKSIZE_s,n.scalefac_band.s,X.BLKSIZE_s/384,X.SBMAX_s),M=0,s=0;s=o&&(R=p*(d[s]-o)/(24-o)+u*(24-d[s])/(24-o)),g[s]=Math.pow(10,R/10),y=m.MAX_VALUE;for(A=0;A(T*=n.numlines_s[s])&&(y=T)}n.ATH.cb_s[s]=y,y=7*d[s]/12-7,d[s]>12&&(y*=1+3.1*Math.log(1+y)),d[s]<12&&(y*=1+2.3*Math.log(1-y)),y<-15&&(y=-15),y-=8,n.minval_s[s]=Math.pow(10,y/10)*n.numlines_s[s]}n.s3_ss=W(n.s3ind_s,n.npart_s,d,v,g,i),_=Math.pow(10,9/16),l=Math.pow(10,1.5),f=Math.pow(10,1.5),e.init_fft(n),n.decay=Math.exp(-1*t/(.01*S/192)),k=3.5,0!=(2&a.exp_nspsytune)&&(k=1),Math.abs(a.msfix)>0&&(k=a.msfix),a.msfix=k;for(var x=0;xn.npart_l-1&&(n.s3ind[x][1]=n.npart_l-1);var E=576*n.mode_gr/S;if(n.ATH.decay=Math.pow(10,-1.2*E),n.ATH.adjust=.01,n.ATH.adjustLimit=1,-1!=a.ATHtype){var P=a.out_samplerate/X.BLKSIZE,L=0;for(B=0,s=0;s=0;)n.ATH.eql_w[s]*=L}for(x=M=0;x1?0:e<=0?1:Math.cos(Math.PI/2*e)}function w(e,t){switch(e){case 44100:return t.version=1,0;case 48e3:return t.version=1,1;case 32e3:return t.version=1,2;case 22050:return t.version=0,0;case 24e3:return t.version=0,1;case 16e3:return t.version=0,2;case 11025:return t.version=0,0;case 12e3:return t.version=0,1;case 8e3:return t.version=0,2;default:return t.version=0,-1}}function R(e,t,a){a<16e3&&(t=2);for(var s=B.bitrate_table[t][1],n=2;n<=14;n++)B.bitrate_table[t][n]>0&&Math.abs(B.bitrate_table[t][n]-e)0&&B.bitrate_table[t][s]==e)return s;return-1}function y(t,a){var s=[new g(8,2e3),new g(16,3700),new g(24,3900),new g(32,5500),new g(40,7e3),new g(48,7500),new g(56,1e4),new g(64,11e3),new g(80,13500),new g(96,15100),new g(112,15600),new g(128,17e3),new g(160,17500),new g(192,18600),new g(224,19400),new g(256,19700),new g(320,20500)],n=e.nearestBitrateFullIndex(a);t.lowerlimit=s[n].lowpass}function T(e){var t=X.BLKSIZE+e.framesize-X.FFTOFFSET;return t=Math.max(t,512+e.framesize-32)}function x(t,a,s,n,r,i){var o=e.enc.lame_encode_mp3_frame(t,a,s,n,r,i);return t.frameNum++,o}function H(){this.n_in=0,this.n_out=0}function O(){this.num_used=0}function C(e,t,a){var s=Math.PI*t;(e/=a)<0&&(e=0),e>1&&(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 V(e,t,a,s,n,i,o,_,l){var f,c,h=e.internal_flags,u=0,p=e.out_samplerate/function e(t,a){return 0!=a?e(a,t%a):t}(e.out_samplerate,e.in_samplerate);p>Z.BPC&&(p=Z.BPC);var m=Math.abs(h.resample_ratio-Math.floor(.5+h.resample_ratio))<1e-4?1:0,b=1/h.resample_ratio;b>1&&(b=1);var d=31;0==d%2&&--d;var v=(d+=m)+1;if(0==h.fill_buffer_resample_init){for(h.inbuf_old[0]=r(v),h.inbuf_old[1]=r(v),f=0;f<=2*p;++f)h.blackfilt[f]=r(v);for(h.itime[0]=0,h.itime[1]=0,u=0;u<=2*p;u++){var g=0,S=(u-p)/(2*p);for(f=0;f<=d;f++)g+=h.blackfilt[u][f]=C(f-S,b,d);for(f=0;f<=d;f++)h.blackfilt[u][f]/=g}h.fill_buffer_resample_init=1}var M=h.inbuf_old[l];for(c=0;c=o)break;S=w-h.itime[l]-(u+d%2*.5);R=0|Math.floor(2*S*p+p+.5);var k=0;for(f=0;f<=d;++f){var A=f+u-d/2;k+=(A<0?M[v+A]:n[i+A])*h.blackfilt[R][f]}t[a+c]=k}if(_.num_used=Math.min(o,d+u-d/2),h.itime[l]+=_.num_used-c*h.resample_ratio,_.num_used>=v)for(f=0;f1.0001)for(var o=0;oe-s?a:n},this.lame_init_params=function(e){var r,l,g,T=e.internal_flags;if(T.Class_ID=0,null==T.ATH&&(T.ATH=new E),null==T.PSY&&(T.PSY=new m),null==T.rgdata&&(T.rgdata=new I),T.channels_in=e.num_channels,1==T.channels_in&&(e.mode=d.MONO),T.channels_out=e.mode==d.MONO?1:2,T.mode_ext=X.MPG_MD_MS_LR,e.mode==d.MONO&&(e.force_ms=!1),e.VBR==b.vbr_off&&128!=e.VBR_mean_bitrate_kbps&&0==e.brate&&(e.brate=e.VBR_mean_bitrate_kbps),e.VBR==b.vbr_off||e.VBR==b.vbr_mtrh||e.VBR==b.vbr_mt||(e.free_format=!1),e.VBR==b.vbr_off&&0==e.brate&&k.EQ(e.compression_ratio,0)&&(e.compression_ratio=11.025),e.VBR==b.vbr_off&&e.compression_ratio>0&&(0==e.out_samplerate&&(e.out_samplerate=map2MP3Frequency(int(.97*e.in_samplerate))),e.brate=0|16*e.out_samplerate*T.channels_out/(1e3*e.compression_ratio),T.samplerate_index=w(e.out_samplerate,e),e.free_format||(e.brate=R(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 x=16e3;switch(e.VBR){case b.vbr_off:y(P=new v,e.brate),x=P.lowerlimit;break;case b.vbr_abr:var P;y(P=new v,e.VBR_mean_bitrate_kbps),x=P.lowerlimit;break;case b.vbr_rh:var H=[19500,19e3,18600,18e3,17500,16e3,15600,14900,12500,1e4,3950];if(0<=e.VBR_q&&e.VBR_q<=9){var O=H[e.VBR_q],C=H[e.VBR_q+1],V=e.VBR_q_frac;x=linear_int(O,C,V)}else x=19500;break;default:H=[19500,19e3,18500,18e3,17500,16500,15500,14500,12500,9500,3950];if(0<=e.VBR_q&&e.VBR_q<=9){O=H[e.VBR_q],C=H[e.VBR_q+1],V=e.VBR_q_frac;x=linear_int(O,C,V)}else x=19500}e.mode!=d.MONO||e.VBR!=b.vbr_off&&e.VBR!=b.vbr_abr||(x*=1.5),e.lowpassfreq=0|x}if(0==e.out_samplerate&&(2*e.lowpassfreq>e.in_samplerate&&(e.lowpassfreq=e.in_samplerate/2),e.out_samplerate=(r=0|e.lowpassfreq,l=e.in_samplerate,g=44100,l>=48e3?g=48e3:l>=44100?g=44100:l>=32e3?g=32e3:l>=24e3?g=24e3:l>=22050?g=22050:l>=16e3?g=16e3:l>=12e3?g=12e3:l>=11025?g=11025:l>=8e3&&(g=8e3),-1==r?g:(r<=15960&&(g=44100),r<=15250&&(g=32e3),r<=11220&&(g=24e3),r<=9970&&(g=22050),r<=7230&&(g=16e3),r<=5420&&(g=12e3),r<=4510&&(g=11025),r<=3970&&(g=8e3),l44100?48e3:l>32e3?44100:l>24e3?32e3:l>22050?24e3:l>16e3?22050:l>12e3?16e3:l>11025?12e3:l>8e3?11025:8e3:g))),e.lowpassfreq=Math.min(20500,e.lowpassfreq),e.lowpassfreq=Math.min(e.out_samplerate/2,e.lowpassfreq),e.VBR==b.vbr_off&&(e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.brate)),e.VBR==b.vbr_abr&&(e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.VBR_mean_bitrate_kbps)),e.bWriteVbrTag||(e.findReplayGain=!1,e.decode_on_the_fly=!1,T.findPeakSample=!1),T.findReplayGain=e.findReplayGain,T.decode_on_the_fly=e.decode_on_the_fly,T.decode_on_the_fly&&(T.findPeakSample=!0),T.findReplayGain&&t.InitGainAnalysis(T.rgdata,e.out_samplerate)==S.INIT_GAIN_ANALYSIS_ERROR)return e.internal_flags=null,-6;switch(T.decode_on_the_fly&&!e.decode_only&&(null!=T.hip&&c.hip_decode_exit(T.hip),T.hip=c.hip_decode_init()),T.mode_gr=e.out_samplerate<=24e3?1:2,e.framesize=576*T.mode_gr,e.encoder_delay=X.ENCDELAY,T.resample_ratio=e.in_samplerate/e.out_samplerate,e.VBR){case b.vbr_mt:case b.vbr_rh:case b.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 b.vbr_abr:e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.VBR_mean_bitrate_kbps);break;default:e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.brate)}if(e.mode==d.NOT_SET&&(e.mode=d.JOINT_STEREO),e.highpassfreq>0?(T.highpass1=2*e.highpassfreq,e.highpasswidth>=0?T.highpass2=2*(e.highpassfreq+e.highpasswidth):T.highpass2=2*e.highpassfreq,T.highpass1/=e.out_samplerate,T.highpass2/=e.out_samplerate):(T.highpass1=0,T.highpass2=0),e.lowpassfreq>0?(T.lowpass2=2*e.lowpassfreq,e.lowpasswidth>=0?(T.lowpass1=2*(e.lowpassfreq-e.lowpasswidth),T.lowpass1<0&&(T.lowpass1=0)):T.lowpass1=2*e.lowpassfreq,T.lowpass1/=e.out_samplerate,T.lowpass2/=e.out_samplerate):(T.lowpass1=0,T.lowpass2=0),function(e){var t=e.internal_flags,a=32,s=-1;if(t.lowpass1>0){for(var n=999,r=0;r<=31;r++){(l=r/31)>=t.lowpass2&&(a=Math.min(a,r)),t.lowpass10&&t.highpass2<.75/31*.9&&(t.highpass1=0,t.highpass2=0,h.err.println("Warning: highpass filter disabled. highpass frequency too small\n")),t.highpass2>0){var i=-1;for(r=0;r<=31;r++){(l=r/31)<=t.highpass1&&(s=Math.max(s,r)),t.highpass1t.highpass1?M((t.highpass2-l)/(t.highpass2-t.highpass1+1e-20)):1,_=t.lowpass2>t.lowpass1?M((l-t.lowpass1)/(t.lowpass2-t.lowpass1+1e-20)):1,t.amp_filter[r]=o*_}}(e),T.samplerate_index=w(e.out_samplerate,e),T.samplerate_index<0)return e.internal_flags=null,-1;if(e.VBR==b.vbr_off){if(e.free_format)T.bitrate_index=0;else if(e.brate=R(e.brate,e.version,e.out_samplerate),T.bitrate_index=A(e.brate,e.version,e.out_samplerate),T.bitrate_index<=0)return e.internal_flags=null,-1}else T.bitrate_index=1;e.analysis&&(e.bWriteVbrTag=!1),null!=T.pinfo&&(e.bWriteVbrTag=!1),a.init_bit_stream_w(T);for(var N,D=T.samplerate_index+3*e.version+6*(e.out_samplerate<16e3?1:0),Y=0;Y5&&(e.quality=5),T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?T.sfb21_extra=!1:T.sfb21_extra=e.out_samplerate>44e3,T.iteration_loop=new VBRNewIterationLoop(i);break;case b.vbr_rh:s.apply_preset(e,500-10*e.VBR_q,0),T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?T.sfb21_extra=!1:T.sfb21_extra=e.out_samplerate>44e3,e.quality>6&&(e.quality=6),e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),T.iteration_loop=new VBROldIterationLoop(i);break;default:var F;T.sfb21_extra=!1,e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),(F=e.VBR)==b.vbr_off&&(e.VBR_mean_bitrate_kbps=e.brate),s.apply_preset(e,e.VBR_mean_bitrate_kbps,0),e.VBR=F,T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,F==b.vbr_off?T.iteration_loop=new L(i):T.iteration_loop=new ABRIterationLoop(i)}if(e.VBR!=b.vbr_off){if(T.VBR_min_bitrate=1,T.VBR_max_bitrate=14,e.out_samplerate<16e3&&(T.VBR_max_bitrate=8),0!=e.VBR_min_bitrate_kbps&&(e.VBR_min_bitrate_kbps=R(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),T.VBR_min_bitrate=A(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),T.VBR_min_bitrate<0))return-1;if(0!=e.VBR_max_bitrate_kbps&&(e.VBR_max_bitrate_kbps=R(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),T.VBR_max_bitrate=A(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),T.VBR_max_bitrate<0))return-1;e.VBR_min_bitrate_kbps=B.bitrate_table[e.version][T.VBR_min_bitrate],e.VBR_max_bitrate_kbps=B.bitrate_table[e.version][T.VBR_max_bitrate],e.VBR_mean_bitrate_kbps=Math.min(B.bitrate_table[e.version][T.VBR_max_bitrate],e.VBR_mean_bitrate_kbps),e.VBR_mean_bitrate_kbps=Math.max(B.bitrate_table[e.version][T.VBR_min_bitrate],e.VBR_mean_bitrate_kbps)}return e.tune&&(T.PSY.mask_adjust+=e.tune_value_a,T.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,-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,-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,-1==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=1,t.full_outer_loop=0}}(e),e.athaa_type<0?T.ATH.useAdjust=3:T.ATH.useAdjust=e.athaa_type,T.ATH.aaSensitivityP=Math.pow(10,e.athaa_sensitivity/-10),null==e.short_blocks&&(e.short_blocks=p.short_block_allowed),e.short_blocks!=p.short_block_allowed||e.mode!=d.JOINT_STEREO&&e.mode!=d.STEREO||(e.short_blocks=p.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=G.NSATTACKTHRE),e.internal_flags.nsPsy.attackthre_s<0&&(e.internal_flags.nsPsy.attackthre_s=G.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),T.slot_lag=T.frac_SpF=0,e.VBR==b.vbr_off&&(T.slot_lag=T.frac_SpF=72e3*(e.version+1)*e.brate%e.out_samplerate|0),n.iteration_init(e),u.psymodel_init(e),0},this.lame_encode_flush=function(e,t,s,n){var r,i,o,_,c=e.internal_flags,h=l([2,1152]),u=0,p=c.mf_samples_to_encode-X.POSTDELAY,m=T(e);if(c.mf_samples_to_encode<1)return 0;for(r=0,e.in_samplerate!=e.out_samplerate&&(p+=16*e.out_samplerate/e.in_samplerate),(o=e.framesize-p%e.framesize)<576&&(o+=e.framesize),e.encoder_padding=o,_=(p+o)/e.framesize;_>0&&u>=0;){var b=m-c.mf_size,d=e.frameNum;b*=e.in_samplerate,(b/=e.out_samplerate)>1152&&(b=1152),b<1&&(b=1),i=n-r,0==n&&(i=0),s+=u=this.lame_encode_buffer(e,h[0],h[1],b,t,s,i),r+=u,_-=d!=e.frameNum?1:0}if(c.mf_samples_to_encode=0,u<0)return u;if(i=n-r,0==n&&(i=0),a.flush_bitstream(e),(u=a.copy_buffer(c,t,s,i,1))<0)return u;if(s+=u,i=n-(r+=u),0==n&&(i=0),e.write_id3tag_automatic){if(f.id3tag_write_v1(e),(u=a.copy_buffer(c,t,s,i,0))<0)return u;r+=u}return r},this.lame_encode_buffer=function(e,s,n,i,o,_,l){var f=e.internal_flags,c=[null,null];if(4294479419!=f.Class_ID)return-3;if(0==i)return 0;!function(e,t){(null==e.in_buffer_0||e.in_buffer_nsamples1&&(c[1][h]=n[h]);return function(e,s,n,r,i,o,_){var l,f,c,h,u,p=e.internal_flags,m=0,b=[null,null],d=[null,null];if(4294479419!=p.Class_ID)return-3;if(0==r)return 0;if((u=a.copy_buffer(p,i,o,_,0))<0)return u;if(o+=u,m+=u,d[0]=s,d[1]=n,k.NEQ(e.scale,0)&&k.NEQ(e.scale,1))for(f=0;f0;){var g,M,w=[null,null];w[0]=d[0],w[1]=d[1];var R=new H;if(N(e,b,w,v,r,R),g=R.n_in,M=R.n_out,p.findReplayGain&&!p.decode_on_the_fly&&t.AnalyzeSamples(p.rgdata,b[0],p.mf_size,b[1],p.mf_size,M,p.channels_out)==S.GAIN_ANALYSIS_ERROR)return-6;if(r-=g,v+=g,p.channels_out,p.mf_size+=M,p.mf_samples_to_encode<1&&(p.mf_samples_to_encode=X.ENCDELAY+X.POSTDELAY),p.mf_samples_to_encode+=M,p.mf_size>=h){var A=_-m;if(0==_&&(A=0),(l=x(e,b[0],b[1],i,o,A))<0)return l;for(o+=l,m+=l,p.mf_size-=e.framesize,p.mf_samples_to_encode-=e.framesize,c=0;cy&&(y=t.length,x=a(T=0|1.25*y+7200));var r=n.lame_encode_buffer(B,t,s,t.length,x,0,T);return new Int8Array(x.subarray(0,r))},this.flush=function(){var e=n.lame_encode_flush(B,x,0,T);return new Int8Array(x.subarray(0,e))}}}e(),Recorder.lamejs=e}()},function(e,t){var a,s;a=function(e){return new s(e)},(s=function(e){var t={scale:2,speed:9,phase:21.8,fps:20,keep:!0,lineWidth:3,linear1:[0,"rgba(150,96,238,1)",.2,"rgba(170,79,249,1)",1,"rgba(53,199,253,1)"],linear2:[0,"rgba(209,130,255,0.6)",1,"rgba(53,199,255,0.6)"],linearBg:[0,"rgba(255,255,255,0.2)",1,"rgba(54,197,252,0.2)"]};for(var a in e)t[a]=e[a];this.set=e=t;var s=e.elem;s&&("string"==typeof s?s=document.querySelector(s):s.length&&(s=s[0])),s&&(e.width=s.offsetWidth,e.height=s.offsetHeight);var n=e.scale,r=e.width*n,i=e.height*n;if(!r||!i)throw new Error("WaveView无宽高");var o=this.elem=document.createElement("div"),_=["","transform-origin:0 0;","transform:scale("+1/n+");"];o.innerHTML='
';var l=this.canvas=o.querySelector("canvas"),f=this.ctx=l.getContext("2d");l.width=r,l.height=i,this.linear1=this.genLinear(f,r,e.linear1),this.linear2=this.genLinear(f,r,e.linear2),this.linearBg=this.genLinear(f,i,e.linearBg,!0),s&&(s.innerHTML="",s.appendChild(o)),this._phase=0}).prototype=a.prototype={genLinear:function(e,t,a,s){for(var n=e.createLinearGradient(0,0,s?0:t,s?t:0),r=0;r1300&&(clearInterval(e.timer),e.timer=0)}},draw:function(e){var t=this.set,a=this.ctx,s=t.scale,n=t.width*s,r=t.height*s,i=t.speed/t.fps,o=this._phase-=i,_=o+i*t.phase,l=e/100,f=this.genPath(2,l,o),c=this.genPath(1.8,l,_);a.clearRect(0,0,n,r),a.beginPath();for(var h=0,u=0;u=0;h--,u-=s)a.lineTo(u,c[h]);a.closePath(),a.fillStyle=this.linearBg,a.fill(),this.drawPath(c,this.linear2),this.drawPath(f,this.linear1)},drawPath:function(e,t){var a=this.set,s=this.ctx,n=a.scale,r=a.width*n;s.beginPath();for(var i=0,o=0;o用户主动点击的弹窗",1)}},_.recClose=function(){r?(r.close(),f("已关闭")):f("未打开录音",1)},_.recStart=function(){r&&n.default.IsOpen()?(o=null,r.start(),f("已开始录音...")):f("未打开录音",1)},_.recPause=function(){r&&n.default.IsOpen()?r.pause():f("未打开录音",1)},_.recResume=function(){r&&n.default.IsOpen()?r.resume():f("未打开录音",1)},_.recStop=function(){r&&n.default.IsOpen()?r.stop((function(e,t){console.log(e,(_.URL||webkitURL).createObjectURL(e),"时长:"+t+"ms"),o=e,f("已录制mp3:"+p(t)+"ms "+e.size+"字节,可以点击播放、上传了",2)}),(function(e){f("录音失败:"+e,1)})):f("未打开录音",1)},_.recPlay=function(){if(o){var e=("a"+Math.random()).replace(".","");f('播放中: ');var t=l.createElement("audio");t.controls=!0,l.querySelector("."+e).appendChild(t),t.src=(_.URL||webkitURL).createObjectURL(o),t.play(),setTimeout((function(){(_.URL||webkitURL).revokeObjectURL(t.src)}),5e3)}else f("请先录音,然后停止后再播放",1)},_.recUpload=function(){var e=o;if(e){var t="https://xx.xx/test_request",a=function(e){return function(){4==r.readyState&&(200==r.status?f(e+"上传成功",2):(f(e+"没有完成上传,演示上传地址无需关注上传结果,只要浏览器控制台内Network面板内看到的请求数据结构是预期的就ok了。","#d8c1a0"),console.error(e+"上传失败",r.status,r.responseText)))}};f("开始上传到"+t+",请求稍后...");var s=new _.FileReader;s.onloadend=function(){var n="";n+="mime="+encodeURIComponent(e.type),n+="&upfile_b64="+encodeURIComponent((/.+;\s*base64\s*,\s*(.+)$/i.exec(s.result)||[])[1]);var r=new XMLHttpRequest;r.open("POST",t),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.onreadystatechange=a("上传方式一【Base64】"),r.send(n)},s.readAsDataURL(e);var n=new FormData;n.append("upfile",e,"recorder.mp3");var r=new XMLHttpRequest;r.open("POST",t),r.onreadystatechange=a("上传方式二【FormData】"),r.send(n)}else f("请先录音,然后停止后再上传",1)};var c,h=function(){c=setTimeout((function(){!function(){if(/mobile/i.test(navigator.userAgent)){u();var e=l.createElement("div");l.body.appendChild(e),e.innerHTML='
录音功能需要麦克风权限,请允许;如果未看到任何请求,请点击忽略~
'}}()}),8e3)},u=function(){clearTimeout(c);for(var e=l.querySelectorAll(".waitDialog"),t=0;t0?(a<10?"0":"")+a+":":"")+(t||a>0||s>0?("0"+s).substr(-2)+"″":"")+("00"+e%1e3).substr(-3)}},function(e,t,a){var s;!function(e){"use strict";var t=function(){},a=function(e){return new h(e)};a.LM="2023-06-10 21:09";var s="Recorder";a.IsOpen=function(){var e=a.Stream;if(e){var t=(e.getTracks&&e.getTracks()||e.audioTracks||[])[0];if(t){var s=t.readyState;return"live"==s||s==t.LIVE}}return!1},a.BufferSize=4096,a.Destroy=function(){for(var e in l(s+" Destroy"),_(),n)n[e]()};var n={};a.BindDestroy=function(e,t){n[e]=t},a.Support=function(){var e=navigator.mediaDevices||{};return e.getUserMedia||(e=navigator).getUserMedia||(e.getUserMedia=e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia),!!e.getUserMedia&&(a.Scope=e,!!a.GetContext())},a.GetContext=function(){var t=e.AudioContext;return t||(t=e.webkitAudioContext),t?(a.Ctx&&"closed"!=a.Ctx.state||(a.Ctx=new t,a.BindDestroy("Ctx",(function(){var e=a.Ctx;e&&e.close&&(e.close(),a.Ctx=0)}))),a.Ctx):null},a.ConnectEnableWebM=!0,a.ConnectEnableWorklet=!1;var r=function(t,n){var r,_,f,c=t.BufferSize||a.BufferSize,h=a.Ctx,p=t.Stream,m=function(e){(p._m=h.createMediaStreamSource(p)).connect(e),e.connect(h.destination)},b="",d=p._call,v=function(e){for(var t in d){for(var a=e.length,s=new Int16Array(a),n=0,r=0;rf+1&&l("SampleData似乎传入了未重置chunk "+r+">"+f,3);for(var c=0,h=r;h1?c=Math.floor(c/u):(u=1,a=t),c+=o.length;var p=new Int16Array(c),m=0;for(h=0;h0){var k=2*(p.length-R);o=new Int16Array(p.buffer.slice(k)),p=new Int16Array(p.buffer.slice(0,k))}return{index:r,offset:i,frameNext:o,sampleRate:a,data:p}},a.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)))))},a.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))},a.CLog=function(t,a){var n=new Date,r=("0"+n.getMinutes()).substr(-2)+":"+("0"+n.getSeconds()).substr(-2)+"."+("00"+n.getMilliseconds()).substr(-3),i=this&&this.envIn&&this.envCheck&&this.id,o=["["+r+" "+s+(i?":"+i:"")+"]"+t],_=arguments,l=e.console||{},c=2,h=l.log;for("number"==typeof a?h=1==a?l.error:3==a?l.warn:h:c=1;c<_.length;c++)o.push(_[c]);f?h&&h("[IsLoser]"+o[0],o.length>1?o:""):h.apply(l,o)};var l=function(){a.CLog.apply(this,arguments)},f=!0;try{f=!console.log.apply}catch(e){}var c=0;function h(e){this.id=++c,v();var a={type:"mp3",bitRate:16,sampleRate:16e3,onProcess:t};for(var s in e)a[s]=e[s];this.set=a,this._S=9,this.Sync={O:9,C:9}}a.Sync={O:9,C:9},a.prototype=h.prototype={CLog:l,_streamStore:function(){return this.set.sourceStream?this:a},open:function(s,n){var i=this,o=i.set,l=i._streamStore();s=s||t;var f=function(e,t){t=!!t,i.CLog("录音open失败:"+e+",isUserNotAllow:"+t,1),n&&n(e,t)},c=function(){i.CLog("open ok id:"+i.id),s(),i._SO=0},h=l.Sync,u=++h.O,p=h.C;i._O=i._O_=u,i._SO=i._S;var m=i.envCheck({envName:"H5",canProcess:!0});if(m)f("不能录音:"+m);else if(o.sourceStream){if(!a.GetContext())return void f("不支持此浏览器从流中获取录音");_(l),i.Stream=o.sourceStream,i.Stream._call={};try{r(l)}catch(e){return void f("从流中打开录音失败:"+e.message)}c()}else{var b=function(t,a){try{e.top.a}catch(e){return void f('无权录音(跨域,请尝试给iframe添加麦克风访问策略,如allow="camera;microphone")')}/Permission|Allow/i.test(t)?f("用户拒绝了录音权限",!0):!1===e.isSecureContext?f("浏览器禁止不安全页面录音,可开启https解决"):/Found/i.test(t)?f(a+",无可用麦克风"):f(a)};if(a.IsOpen())c();else if(a.Support()){var d=function(e){setTimeout((function(){e._call={};var t=a.Stream;t&&(_(),e._call=t._call),a.Stream=e,function(){if(p!=h.C||!i._O){var e="open被取消";return u==h.O?i.close():e="open被中断",f(e),!0}}()||(a.IsOpen()?(t&&i.CLog("发现同时多次调用open",1),r(l,1),c()):f("录音功能无效:无音频流"))}),100)},v=function(e){var t=e.name||e.message||e.code+":"+e;i.CLog("请求录音权限错误",1,e),b(t,"无法录音:"+t)},g=o.audioTrackSet||{};g.sampleRate=a.Ctx.sampleRate;var S={audio:g};try{var M=a.Scope.getUserMedia(S,d,v)}catch(e){i.CLog("getUserMedia",3,e),S={audio:!0},M=a.Scope.getUserMedia(S,d,v)}i.CLog("getUserMedia("+JSON.stringify(S)+"),一般默认会降噪和回声消除,移动端可能会降低系统播放音量,请参阅文档中audioTrackSet配置"),M&&M.then&&M.then(d).catch(v)}else b("","此浏览器不支持录音")}},close:function(e){e=e||t;var a=this._streamStore();this._stop();var s=a.Sync;if(this._O=0,this._O_!=s.O)return this.CLog("close被忽略(因为同时open了多个rec,只有最后一个会真正close)",3),void e();s.C++,_(a),this.CLog("close"),e()},mock:function(e,t){return this._stop(),this.isMock=1,this.mockEnvInfo=null,this.buffers=[e],this.recSize=e.length,this.srcSampleRate=t,this},envCheck:function(t){var s,n=this.set,r="CPU_BE";if(s||a[r]||!e.Int8Array||new Int8Array(new Int32Array([1]).buffer)[0]||(v(r),s="不支持CPU_BE架构"),!s){var i=n.type;this[i+"_envCheck"]?s=this[i+"_envCheck"](t,n):n.takeoffEncodeChunk&&(s=i+"类型"+(this[i]?"":"(未加载编码器)")+"不支持设置takeoffEncodeChunk")}return s||""},envStart:function(e,t){var a=this.set;this.isMock=e?1:0,this.mockEnvInfo=e,this.buffers=[],this.recSize=0,this.envInLast=0,this.envInFirst=0,this.envInFix=0,this.envInFixTs=[];var s=a.sampleRate;if(s>t?a.sampleRate=t:s=0,this.srcSampleRate=t,this.CLog("srcSampleRate: "+t+" set.sampleRate: "+a.sampleRate+(s?" 忽略"+s:""),s?3:0),this.engineCtx=0,this[a.type+"_start"]){var n=this.engineCtx=this[a.type+"_start"](a);n&&(n.pcmDatas=[],n.pcmSize=0)}},envResume:function(){this.envInFixTs=[]},envIn:function(e,t){var s=this,n=s.set,r=s.engineCtx,i=s.srcSampleRate,o=e.length,_=a.PowerLevel(t,o),l=s.buffers,f=l.length;l.push(e);var c=l,h=f,u=Date.now(),p=Math.round(o/i*1e3);s.envInLast=u,1==s.buffers.length&&(s.envInFirst=u-p);var m=s.envInFixTs;m.splice(0,0,{t:u,d:p});for(var b=u,d=0,v=0;v3e3){m.length=v;break}b=g.t,d+=g.d}var S=m[1],M=u-b;if(M-d>M/3&&(S&&M>1e3||m.length>=6)){var w=u-S.t-p;if(w>p/5){var R=!n.disableEnvInFix;if(s.CLog("["+u+"]"+(R?"":"未")+"补偿"+w+"ms",3),s.envInFix+=w,R){var k=new Int16Array(w*i/1e3);o+=k.length,l.push(k)}}}var A=s.recSize,B=o,y=A+B;if(s.recSize=y,r){var T=a.SampleData(l,i,n.sampleRate,r.chunkInfo);r.chunkInfo=T,y=(A=r.pcmSize)+(B=T.data.length),r.pcmSize=y,l=r.pcmDatas,f=l.length,l.push(T.data),i=T.sampleRate}var x=Math.round(y/i*1e3),E=l.length,P=c.length,L=function(){for(var e=I?0:-B,t=null==l[0],a=f;a10&&s.envInFirst-u>1e3&&s.CLog("rec.set.onProcess低性能,耗时"+H+"ms",3),!0===I){var C=0;for(v=f;v"+v.length+" 花:"+(Date.now()-n)+"ms"),setTimeout((function(){n=Date.now(),r[i.type](v,(function(e){c(e,b)}),(function(e){f(e)}))}))}else f("未加载"+i.type+"编码器");else f("音频buffers被释放");else f("未采集到录音")}},e[s]&&(l("重复引入"+s,3),e[s].Destroy()),e[s]=a;var u=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(b(i,s),d(i,s),!p(b(i,s),[24,83,128,103]))return;for(b(i,s);s[0]1){var O=[];for(A=0;A=e.length)){var n=("0000000"+e[s].toString(2)).substr(-8),r=/^(0*1)(\d*)$/.exec(n);if(r){var i=r[1].length,o=[];if(!(s+i>e.length)){for(var _=0;_e.length)return;for(var i=0;i0&&(c+=a.buffer.byteLength,l.push(a.buffer)),f+=57600,setTimeout(h)}else{var a;(a=_.flush()).length>0&&(c+=a.buffer.byteLength,l.push(a.buffer));var o=s.fn(l,c,i,r.sampleRate);n(o,r),t(new Blob(l,{type:"audio/mp3"}))}};h()},Recorder.BindDestroy("mp3Worker",(function(){Recorder.CLog("mp3Worker Destroy"),e&&e.terminate(),e=null})),Recorder.prototype.mp3_envCheck=function(e,t){var s="";return t.takeoffEncodeChunk&&(e.canProcess?a()||(s="当前浏览器版本太低,无法实时处理"):s=e.envName+"环境不支持实时处理"),s},Recorder.prototype.mp3_start=function(e){return a(e)};var t={id:0},a=function(a){var n=e;try{if(!n){var r=");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,(s=a.encObj.encodeBuffer(t.pcm)).length>0&&(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;(s=a.encObj.flush()).length>0&&(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})}};r+=";var wk_mp3TrimFix={rm:"+s.rm+",fn:"+s.fn+"}";var i=Recorder.lamejs.toString(),o=(window.URL||webkitURL).createObjectURL(new Blob(["var wk_lame=(",i,r],{type:"text/javascript"}));n=new Worker(o),setTimeout((function(){(window.URL||webkitURL).revokeObjectURL(o)}),1e4),n.onmessage=function(e){var a=e.data,s=t[a.id];s&&("takeoff"==a.action?s.set.takeoffEncodeChunk(new Uint8Array(a.chunk.buffer)):(s.call&&s.call(a),s.call=null))}}var _={worker:n,set:a,takeoffQueue:[]};return a?(_.id=++t.id,t[_.id]=_,n.postMessage({action:"init",id:_.id,sampleRate:a.sampleRate,bitRate:a.bitRate,takeoff:!!a.takeoffEncodeChunk,x:new Int16Array(5)})):n.postMessage({x:new Int16Array(5)}),e=n,_}catch(e){return n&&n.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 t[e.id];var a=-1;for(var s in t)a++;a&&Recorder.CLog("mp3 worker剩"+a+"个在串行等待",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(e,t,a,s){var r=this;e&&e.worker?(e.call=function(a){n(a.meta,e.set),t(a.blob),s&&r.mp3_stop(e)},e.worker.postMessage({action:"complete",id:e.id})):a("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==_||1==o?1152:576,u=h/l*1e3,p=Math.floor(h*f/8/l*1e3),m=0,b=0,d=0;d=p+3){var g=new Uint8Array(v);m="1"==n(v.byteLength-(b-(p+3)+1),g).charAt(6);break}}return m&&p++,{version:o,layer:_,sampleRate:l,bitRate:f,duration:c,size:t,hasPadding:m,frameSize:p,frameDurationFloat:u}};var s={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(i>0){var o=i*n.frameSize-(n.hasPadding?1:0);t-=o;for(var _=0,l=[],f=0;f=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 "+s.duration+"ms",s.remove>2&&(e.err=(e.err?e.err+", ":"")+"移除帧数过多")):a+=(e.duration||"-")+"ms",e.err?Recorder.CLog(a,1,e.err,e):Recorder.CLog(a,e)}}()},function(e,t){!function(){"use strict";function e(){var t=function(e){return Math.log(e)/Math.log(10)};function a(e){return new Int8Array(e)}function s(e){return new Int16Array(e)}function n(e){return new Int32Array(e)}function r(e){return new Float32Array(e)}function i(e){return new Float64Array(e)}function o(e){if(1==e.length)return r(e[0]);var t=e[0];e=e.slice(1);for(var a=[],s=0;s>=1;0!=e--;)n[r++]=i>a[s++]?0:1,n[r++]=i>a[s++]?0:1}function r(t,a,s,n,r,i){var o=(t>>=1)%2;for(t>>=1;0!=t--;){var _,l,f,c,h,u,p,m;_=s[n++]*a,l=s[n++]*a,h=0|_,f=s[n++]*a,u=0|l,c=s[n++]*a,p=0|f,_+=e.adj43[h],m=0|c,l+=e.adj43[u],r[i++]=0|_,f+=e.adj43[p],r[i++]=0|l,c+=e.adj43[m],r[i++]=0|f,r[i++]=0|c}0!=o&&(h=0|(_=s[n++]*a),u=0|(l=s[n++]*a),_+=e.adj43[h],l+=e.adj43[u],r[i++]=0|_,r[i++]=0|l)}var i=[1,2,5,7,7,10,10,13,13,13,13,13,13,13,13];function o(e,t,a,s){var n=function(e,t,a){var s=0,n=0;do{var r=e[t++],i=e[t++];s>=16)>r&&(o=r,s++),n.bits+=o,s}(e,t,a,i[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,_=B.ht[s].xlen,l=B.ht[s].hlen,f=B.ht[s+1].hlen,c=B.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(ti&&(r=i,u++),r>o&&(r=o,u=s+2),n.bits+=r,u}(e,t,a,i[n-1],s);default:if(n>C.IXMAX_VAL)return s.bits=C.LARGE_BITS,-1;var r,o;for(n-=15,r=24;r<32&&!(B.ht[r].linmax>=n);r++);for(o=r-8;o<24&&!(B.ht[o].linmax>=n);o++);return function(e,t,a,s,n,r){var i,o=65536*B.ht[s].xlen+B.ht[n].xlen,_=0;do{var l=e[t++],f=e[t++];0!=l&&(l>14&&(l=15,_+=o),l*=16),0!=f&&(f>14&&(f=15,_+=o),l+=f),_+=B.largetbl[l]}while(t>=16)>i&&(_=i,s=n),r.bits+=_,s}(e,t,a,o,r,s)}}function _(e,a,s,n,r,i,_,l){for(var f=a.big_values,c=2;c=f)break;var u=r[c-2]+a.count1bits;if(s.part2_3_length<=u)break;var p=new t(u),m=o(n,h,f,p);u=p.bits,s.part2_3_length<=u||(s.assign(a),s.part2_3_length=u,s.region0_count=i[c-2],s.region1_count=c-2-i[c-2],s.table_select[0]=_[c-2],s.table_select[1]=l[c-2],s.table_select[2]=m)}}this.noquant_count_bits=function(e,a,s){var n=a.l3_enc,r=Math.min(576,a.max_nonzero_coeff+2>>1<<1);for(null!=s&&(s.sfb_count1=0);r>1&&0==(n[r-1]|n[r-2]);r-=2);a.count1=r;for(var i=0,_=0;r>3;r-=4){var l;if((2147483647&(n[r-1]|n[r-2]|n[r-3]|n[r-4]))>1)break;l=2*(2*(2*n[r-4]+n[r-3])+n[r-2])+n[r-1],i+=B.t32l[l],_+=B.t33l[l]}var f=i;if(a.count1table_select=0,i>_&&(f=_,a.count1table_select=1),a.count1bits=f,a.big_values=r,0==r)return f;if(a.block_type==X.SHORT_TYPE)(i=3*e.scalefac_band.s[3])>a.big_values&&(i=a.big_values),_=a.big_values;else if(a.block_type==X.NORM_TYPE){if(i=a.region0_count=e.bv_scf[r-2],_=a.region1_count=e.bv_scf[r-1],_=e.scalefac_band.l[i+_+2],i=e.scalefac_band.l[i+1],_(_=r)&&(i=_);if(i=Math.min(i,r),_=Math.min(_,r),0_)return C.LARGE_BITS;if(function(t,a,n,i,o){var _,l,f,h=0,u=0,p=0,m=0,b=a,d=0,v=b,g=0,S=t,M=0;for(f=null!=o&&i.global_gain==o.global_gain,l=i.block_type==X.SHORT_TYPE?38:21,_=0;_<=l;_++){var w=-1;if((f||i.block_type==X.NORM_TYPE)&&(w=i.global_gain-(i.scalefac[_]+(0!=i.preflag?e.pretab[_]:0)<i.max_nonzero_coeff)R=i.max_nonzero_coeff-h+1,c.fill(a,i.max_nonzero_coeff,576,0),(k=R)<0&&(k=0),_=l+1;if(0==u&&0==p&&(v=b,g=d,S=t,M=m),null!=o&&o.sfb_count1>0&&_>=o.sfb_count1&&o.step[_]>0&&w>=o.step[_]?(0!=u&&(r(u,n,S,M,v,g),u=0,v=b,g=d,S=t,M=m),p+=k):(0!=p&&(s(p,n,S,M,v,g),p=0,v=b,g=d,S=t,M=m),u+=k),k<=0){0!=p&&(s(p,n,S,M,v,g),p=0),0!=u&&(r(u,n,S,M,v,g),u=0);break}}_<=l&&(d+=i.width[_],m+=i.width[_],h+=i.width[_])}0!=u&&(r(u,n,S,M,v,g),u=0),0!=p&&(s(p,n,S,M,v,g),p=0)}(a,o,e.IPOW20(n.global_gain),n,i),0!=(2&t.substep_shaping))for(var l=0,f=n.global_gain+n.scalefac_scale,h=.634521682242439/e.IPOW20(f),u=0;u=h?o[p]:0}return this.noquant_count_bits(t,n,i)},this.best_huffman_divide=function(e,a){var s=new V,r=a.l3_enc,i=n(23),l=n(23),f=n(23),c=n(23);if(a.block_type!=X.SHORT_TYPE||1!=e.mode_gr){s.assign(a),a.block_type==X.NORM_TYPE&&(!function(e,a,s,n,r,i,_){for(var l=a.big_values,f=0;f<=22;f++)n[f]=C.LARGE_BITS;for(f=0;f<16;f++){var c=e.scalefac_band.l[f+1];if(c>=l)break;var h=0,u=new t(h),p=o(s,0,c,u);h=u.bits;for(var m=0;m<8;m++){var b=e.scalefac_band.l[f+m+2];if(b>=l)break;var d=h,v=o(s,c,b,u=new t(d));d=u.bits,n[f+m]>d&&(n[f+m]=d,r[f+m]=f,i[f+m]=p,_[f+m]=v)}}}(e,a,r,i,l,f,c),_(e,s,a,r,i,l,f,c));var h=s.big_values;if(!(0==h||(r[h-2]|r[h-1])>1||(h=a.count1+2)>576)){s.assign(a),s.count1=h;for(var u=0,p=0;h>s.big_values;h-=4){var m=2*(2*(2*r[h-4]+r[h-3])+r[h-2])+r[h-1];u+=B.t32l[m],p+=B.t33l[m]}if(s.big_values=h,s.count1table_select=0,u>p&&(u=p,s.count1table_select=1),s.count1bits=u,s.block_type==X.NORM_TYPE)_(e,s,a,r,i,l,f,c);else{if(s.part2_3_length=u,(u=e.scalefac_band.l[8])>h&&(u=h),u>0){var b=new t(s.part2_3_length);s.table_select[0]=o(r,0,u,b),s.part2_3_length=b.bits}if(h>u){b=new t(s.part2_3_length);s.table_select[1]=o(r,u,h,b),s.part2_3_length=b.bits}a.part2_3_length>s.part2_3_length&&a.assign(s)}}}};var l=[1,1,1,1,8,2,2,2,4,4,4,8,8,8,16,16],f=[1,2,4,8,1,2,4,8,2,4,8,2,4,8,4,8],u=[0,0,0,0,3,1,1,1,2,2,2,3,3,3,4,4],p=[0,1,2,3,0,1,2,3,1,2,3,1,2,3,2,3];g.slen1_tab=u,g.slen2_tab=p,this.best_scalefac_store=function(t,a,s,n){var r,i,o,_,c=n.tt[a][s],h=0;for(o=0,r=0;r0&&(b|=c.scalefac[r]);if(0==(1&b)&&0!=b){for(r=0;r0&&(c.scalefac[r]>>=1);c.scalefac_scale=h=1}}if(0==c.preflag&&c.block_type!=X.SHORT_TYPE&&2==t.mode_gr){for(r=11;r0&&(c.scalefac[r]-=e.pretab[r]);c.preflag=h=1}}for(i=0;i<4;i++)n.scfsi[s][i]=0;for(2==t.mode_gr&&1==a&&n.tt[0][s].block_type!=X.SHORT_TYPE&&n.tt[1][s].block_type!=X.SHORT_TYPE&&(!function(e,t){for(var a,s=t.tt[1][e],n=t.tt[0][e],r=0;r=0);a++);if(a==B.scfsi_band[r+1]){for(a=B.scfsi_band[r];ah&&(s.part2_length=h,s.scalefac_compress=r)}}(s,n),h=0),r=0;rn[a]&&(t.part2_length=n[a],t.scalefac_compress=a);return t.part2_length==C.LARGE_BITS};var v=[[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(t,a){var s,r,i,o,_,l,f,c,u=n(4),p=a.scalefac;for(s=0!=a.preflag?2:0,f=0;f<4;f++)u[f]=0;if(a.block_type==X.SHORT_TYPE){r=1;var m=e.nr_of_sfb_block[s][r];for(c=0,i=0;i<4;i++)for(o=m[i]/3,f=0;fu[i]&&(u[i]=p[3*c+_])}else{r=0;m=e.nr_of_sfb_block[s][r];for(c=0,i=0;i<4;i++)for(o=m[i],f=0;fu[i]&&(u[i]=p[c])}for(l=!1,i=0;i<4;i++)u[i]>v[s][i]&&(l=!0);if(!l){var b,d,g,M;for(a.sfb_partition_table=e.nr_of_sfb_block[s][r],i=0;i<4;i++)a.slen[i]=S[u[i]];switch(b=a.slen[0],d=a.slen[1],g=a.slen[2],M=a.slen[3],s){case 0:a.scalefac_compress=(5*b+d<<4)+(g<<2)+M;break;case 1:a.scalefac_compress=400+(5*b+d<<2)+g;break;case 2:a.scalefac_compress=500+3*b+d;break;default:h.err.printf("intensity stereo not implemented yet\n")}}if(!l)for(a.part2_length=0,i=0;i<4;i++)a.part2_length+=a.slen[i]*a.sfb_partition_table[i];return l};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 s,n=0;e.scalefac_band.l[++n]t;)s--;for(s<0&&(s=a[n][0]),e.bv_scf[t-2]=s,s=a[n][1];e.scalefac_band.l[s+e.bv_scf[t-2]+2]>t;)s--;s<0&&(s=a[n][1]),e.bv_scf[t-1]=s}}}function S(){}function M(){function e(e,t,a,s,n,r,i,o,_,l,f,c,h,u,p){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=p}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 a;this.setModules=function(e){a=e};var s=[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)],n=[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 r(e,t,a){var r=e.VBR==b.vbr_rh?s:n,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),function(e,t){var a=0;0>t&&(a=-1,t=0);90||(e.quant_comp=l.quant_comp),0!=a?e.quant_comp_short=l.quant_comp_s:Math.abs(e.quant_comp_short- -1)>0||(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:Math.abs(e.internal_flags.nsPsy.attackthre- -1)>0||(e.internal_flags.nsPsy.attackthre=l.st_lrm),0!=a?e.internal_flags.nsPsy.attackthre_s=l.st_s:Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)>0||(e.internal_flags.nsPsy.attackthre_s=l.st_s),0!=a?e.maskingadjust=l.masking_adj:Math.abs(e.maskingadjust-0)>0||(e.maskingadjust=l.masking_adj),0!=a?e.maskingadjust_short=l.masking_adj_short:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=l.masking_adj_short),0!=a?e.ATHlower=-l.ath_lower/10:Math.abs(10*-e.ATHlower-0)>0||(e.ATHlower=-l.ath_lower/10),0!=a?e.ATHcurve=l.ath_curve:Math.abs(e.ATHcurve- -1)>0||(e.ATHcurve=l.ath_curve),0!=a?e.athaa_sensitivity=l.ath_sensitivity:Math.abs(e.athaa_sensitivity- -1)>0||(e.athaa_sensitivity=l.ath_sensitivity),l.interch>0&&(0!=a?e.interChRatio=l.interch:Math.abs(e.interChRatio- -1)>0||(e.interChRatio=l.interch)),l.safejoint>0&&(e.exp_nspsytune=e.exp_nspsytune|l.safejoint),l.sfb21mod>0&&(e.exp_nspsytune=e.exp_nspsytune|l.sfb21mod<<20),0!=a?e.msfix=l.msfix:Math.abs(e.msfix- -1)>0||(e.msfix=l.msfix),0==a&&(e.VBR_q=t,e.VBR_q_frac=i)}var i=[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 o(e,t,s){var n=t,r=a.nearestBitrateFullIndex(t);if(e.VBR=b.vbr_abr,e.VBR_mean_bitrate_kbps=n,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,e.VBR_mean_bitrate_kbps>320&&(e.disable_reservoir=!0),i[r].safejoint>0&&(e.exp_nspsytune=2|e.exp_nspsytune),i[r].sfscale>0&&(e.internal_flags.noise_shaping=2),Math.abs(i[r].nsbass)>0){var o=int(4*i[r].nsbass);o<0&&(o+=64),e.exp_nspsytune=e.exp_nspsytune|o<<2}return 0!=s?e.quant_comp=i[r].quant_comp:Math.abs(e.quant_comp- -1)>0||(e.quant_comp=i[r].quant_comp),0!=s?e.quant_comp_short=i[r].quant_comp_s:Math.abs(e.quant_comp_short- -1)>0||(e.quant_comp_short=i[r].quant_comp_s),0!=s?e.msfix=i[r].nsmsfix:Math.abs(e.msfix- -1)>0||(e.msfix=i[r].nsmsfix),0!=s?e.internal_flags.nsPsy.attackthre=i[r].st_lrm:Math.abs(e.internal_flags.nsPsy.attackthre- -1)>0||(e.internal_flags.nsPsy.attackthre=i[r].st_lrm),0!=s?e.internal_flags.nsPsy.attackthre_s=i[r].st_s:Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)>0||(e.internal_flags.nsPsy.attackthre_s=i[r].st_s),0!=s?e.scale=i[r].scale:Math.abs(e.scale- -1)>0||(e.scale=i[r].scale),0!=s?e.maskingadjust=i[r].masking_adj:Math.abs(e.maskingadjust-0)>0||(e.maskingadjust=i[r].masking_adj),i[r].masking_adj>0?0!=s?e.maskingadjust_short=.9*i[r].masking_adj:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=.9*i[r].masking_adj):0!=s?e.maskingadjust_short=1.1*i[r].masking_adj:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=1.1*i[r].masking_adj),0!=s?e.ATHlower=-i[r].ath_lower/10:Math.abs(10*-e.ATHlower-0)>0||(e.ATHlower=-i[r].ath_lower/10),0!=s?e.ATHcurve=i[r].ath_curve:Math.abs(e.ATHcurve- -1)>0||(e.ATHcurve=i[r].ath_curve),0!=s?e.interChRatio=i[r].interch:Math.abs(e.interChRatio- -1)>0||(e.interChRatio=i[r].interch),t}this.apply_preset=function(e,t,a){switch(t){case W.R3MIX:t=W.V3,e.VBR=b.vbr_mtrh;break;case W.MEDIUM:t=W.V4,e.VBR=b.vbr_rh;break;case W.MEDIUM_FAST:t=W.V4,e.VBR=b.vbr_mtrh;break;case W.STANDARD:t=W.V2,e.VBR=b.vbr_rh;break;case W.STANDARD_FAST:t=W.V2,e.VBR=b.vbr_mtrh;break;case W.EXTREME:t=W.V0,e.VBR=b.vbr_rh;break;case W.EXTREME_FAST:t=W.V0,e.VBR=b.vbr_mtrh;break;case W.INSANE:return t=320,e.preset=t,o(e,t,a),e.VBR=b.vbr_off,t}switch(e.preset=t,t){case W.V9:return r(e,9,a),t;case W.V8:return r(e,8,a),t;case W.V7:return r(e,7,a),t;case W.V6:return r(e,6,a),t;case W.V5:return r(e,5,a),t;case W.V4:return r(e,4,a),t;case W.V3:return r(e,3,a),t;case W.V2:return r(e,2,a),t;case W.V1:return r(e,1,a),t;case W.V0:return r(e,0,a),t}return 8<=t&&t<=320?o(e,t,a):(e.preset=0,t)}}function w(){var e;this.setModules=function(t){e=t},this.ResvFrameBegin=function(t,a){var s,n=t.internal_flags,r=n.l3_side,i=e.getframebits(t);a.bits=(i-8*n.sideinfo_len)/n.mode_gr;var o=2048*n.mode_gr-8;t.brate>320?s=8*int(1e3*t.brate/(t.out_samplerate/1152)/8+.5):(s=11520,t.strict_ISO&&(s=8*int(32e4/(t.out_samplerate/1152)/8+.5))),n.ResvMax=s-i,n.ResvMax>o&&(n.ResvMax=o),(n.ResvMax<0||t.disable_reservoir)&&(n.ResvMax=0);var _=a.bits*n.mode_gr+Math.min(n.ResvSize,n.ResvMax);return _>s&&(_=s),r.resvDrain_pre=0,null!=n.pinfo&&(n.pinfo.mean_bits=a.bits/2,n.pinfo.resvsize=n.ResvSize),_},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,10*i>9*o?(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,0!=(a=e.ResvSize%8)&&(n+=a),(a=e.ResvSize-n-e.ResvMax)>0&&(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}}function R(){this.setModules=function(e,t,a){e,t,a};var e=[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];function t(t,a){return a=a>>8^e[255&(a^t)]}this.updateMusicCRC=function(e,a,s,n){for(var r=0;r0;){var s;0==p&&(p=8,u++,e.header[e.w_ptr].write_timing==f&&m(e),l[u]=0),a-=s=Math.min(a,p),p-=s,l[u]|=t>>a<0;){var s;0==p&&(p=8,u++,l[u]=0),a-=s=Math.min(a,p),p-=s,l[u]|=t>>a<=8&&(b(s,76,8),t-=8),t>=8&&(b(s,65,8),t-=8),t>=8&&(b(s,77,8),t-=8),t>=8&&(b(s,69,8),t-=8),t>=32){var n=i.getLameShortVersion();if(t>=32)for(a=0;a=8;++a)t-=8,b(s,n.charCodeAt(a),8)}for(;t>=1;t-=1)b(s,s.ancillary_flag,1),s.ancillary_flag^=e.disable_reservoir?0:1}function M(e,t,a){for(var s=e.header[e.h_ptr].ptr;a>0;){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 w(e,t){e<<=8;for(var a=0;a<8;a++)0!=(65536&((t<<=1)^(e<<=1)))&&(t^=32773);return t}function R(e,t){var a,s=B.ht[t.count1table_select+32],n=0,r=t.big_values,i=t.big_values;for(a=(t.count1-t.big_values)/4;a>0;--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,b(e,o+s.table[_],s.hlen[_]),n+=s.hlen[_]}return n}function k(e,t,a,s,n){var r=B.ht[t],i=0;if(0==t)return i;for(var o=a;o15){if(u>14)h|=u-15<<1,l=f,u=15;if(p>14)h<<=f,h|=p-15,l+=f,p=15;c=16}0!=p&&(h<<=1,n.xr[o+1]<0&&h++,_--),u=u*c+p,l-=_,_+=r.hlen[u],b(e,r.table[u],_),b(e,h,l),i+=_+l}return i}function A(e,t){var a=3*e.scalefac_band.s[3];a>t.big_values&&(a=t.big_values);var s=k(e,t.table_select[0],0,a,t);return s+=k(e,t.table_select[1],a,t.big_values,t)}function y(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,n>a&&(n=a),(r=e.scalefac_band.l[i])>a&&(r=a),s=k(e,t.table_select[0],0,n,t),s+=k(e,t.table_select[1],n,r,t),s+=k(e,t.table_select[2],r,a,t)}function T(){this.total=0}function x(t,a){var s,n,r,i,o,_=t.internal_flags;return o=_.w_ptr,-1==(i=_.h_ptr-1)&&(i=Z.MAX_HEADER_BUF-1),s=_.header[i].write_timing-f,a.total=s,s>=0&&(n=1+i-o,i>8),t[5]=byte(255&a)},this.flush_bitstream=function(e){var a,n,r=e.internal_flags,i=r.h_ptr-1;if(-1==i&&(i=Z.MAX_HEADER_BUF-1),a=r.l3_side,!((n=x(e,new T))<0)){if(v(e,n),r.ResvSize=0,a.main_data_begin=0,r.findReplayGain){var o=s.GetTitleGain(r.rgdata);r.RadioGain=0|Math.floor(10*o+.5)}r.findPeakSample&&(r.noclipGainChange=0|Math.ceil(20*t(r.PeakSample/32767)*10),r.noclipGainChange>0&&(EQ(e.scale,1)||EQ(e.scale,0))?r.noclipScale=Math.floor(32767/r.PeakSample*100)/100:r.noclipScale=-1)}},this.add_dummy_byte=function(e,t,a){for(var s,n=e.internal_flags;a-- >0;)for(d(0,t,8),s=0;s ResvSize"),8*t.main_data_begin!=a.ResvSize&&(h.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),h.err.println("This is a fatal error. It has several possible causes:"),h.err.println("90%% LAME compiled with buggy version of gcc using advanced optimizations"),h.err.println(" 9%% Your system is overclocked"),h.err.println(" 1%% bug in LAME encoding library"),a.ResvSize=8*t.main_data_begin),f>1e9){var r;for(r=0;ri)return-1;if(h.arraycopy(l,0,t,a,c),u=-1,p=0,0!=f){var m=n(1);if(m[0]=e.nMusicCRC,_.updateMusicCRC(m,t,a,c),e.nMusicCRC=m[0],c>0&&(e.VBR_seek_table.nBytesWritten+=c),e.decode_on_the_fly)for(var b,d=o([2,1152]),v=c,g=-1;0!=g;)if(g=r.hip_decode1_unclipped(e.hip,t,a,v,d[0],d[1]),v=0,-1==g&&(g=0),g>0){if(e.findPeakSample){for(b=0;be.PeakSample?e.PeakSample=d[0][b]:-d[0][b]>e.PeakSample&&(e.PeakSample=-d[0][b]);if(e.channels_out>1)for(b=0;be.PeakSample?e.PeakSample=d[1][b]:-d[1][b]>e.PeakSample&&(e.PeakSample=-d[1][b])}if(e.findReplayGain&&s.AnalyzeSamples(e.rgdata,d[0],0,d[1],0,g,e.channels_out)==S.GAIN_ANALYSIS_ERROR)return-6}}return c},this.init_bit_stream_w=function(e){l=a(W.LAME_MAXMP3BUFFER),e.h_ptr=e.w_ptr=0,e.header[e.h_ptr].write_timing=0,u=-1,p=0,f=0}}function A(e,t,a,s){this.xlen=e,this.linmax=t,this.table=a,this.hlen=s}d.STEREO=new d(0),d.JOINT_STEREO=new d(1),d.DUAL_CHANNEL=new d(2),d.MONO=new d(3),d.NOT_SET=new d(4),S.STEPS_per_dB=100,S.MAX_dB=120,S.GAIN_NOT_ENOUGH_SAMPLES=-24601,S.GAIN_ANALYSIS_ERROR=0,S.GAIN_ANALYSIS_OK=1,S.INIT_GAIN_ANALYSIS_ERROR=0,S.INIT_GAIN_ANALYSIS_OK=1,S.YULE_ORDER=10,S.MAX_ORDER=S.YULE_ORDER,S.MAX_SAMP_FREQ=48e3,S.RMS_WINDOW_TIME_NUMERATOR=1,S.RMS_WINDOW_TIME_DENOMINATOR=20,S.MAX_SAMPLES_PER_WINDOW=S.MAX_SAMP_FREQ*S.RMS_WINDOW_TIME_NUMERATOR/S.RMS_WINDOW_TIME_DENOMINATOR+1,R.NUMTOCENTRIES=100,R.MAXFRAMESIZE=2880,k.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)},k.NEQ=function(e,t){return!k.EQ(e,t)};var B={};function y(e){this.bits=e}function T(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}function x(){this.setModules=function(e,t){e,t}}function E(){this.useAdjust=0,this.aaSensitivityP=0,this.adjust=0,this.adjustLimit=0,this.decay=0,this.floor=0,this.l=r(X.SBMAX_l),this.s=r(X.SBMAX_s),this.psfb21=r(X.PSFB21),this.psfb12=r(X.PSFB12),this.cb_l=r(X.CBANDS),this.cb_s=r(X.CBANDS),this.eql_w=r(X.BLKSIZE/2)}function P(){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=d.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}function L(e){var t=e;this.quantize=t,this.iteration_loop=function(e,t,a,s){var i,o=e.internal_flags,_=r(N.SFBMAX),l=r(576),f=n(2),c=0,h=o.l3_side,u=new y(c);this.quantize.rv.ResvFrameBegin(e,u),c=u.bits;for(var p=0;p>2&63)>=32&&(s-=64),l=Math.pow(10,s/4/10),(s=a.exp_nspsytune>>8&63)>=32&&(s-=64),u=Math.pow(10,s/4/10),(s=a.exp_nspsytune>>14&63)>=32&&(s-=64),b=Math.pow(10,s/4/10),(s=a.exp_nspsytune>>20&63)>=32&&(s-=64),v=b*Math.pow(10,s/4/10),s=0;sZ.MAX_BITS_PER_GRANULE&&(m=Z.MAX_BITS_PER_GRANULE),_=0,l=0;l3*r/4&&(h[l]=3*r/4),h[l]<0&&(h[l]=0),h[l]+s[l]>Z.MAX_BITS_PER_CHANNEL&&(h[l]=Math.max(0,Z.MAX_BITS_PER_CHANNEL-s[l])),_+=h[l];if(_>p)for(l=0;lZ.MAX_BITS_PER_GRANULE){for(l=0;l.5&&(n=.5);var r=0|.5*n*(e[0]+e[1]);r>Z.MAX_BITS_PER_CHANNEL-e[0]&&(r=Z.MAX_BITS_PER_CHANNEL-e[0]),r<0&&(r=0),e[1]>=125&&(e[1]-r>125?(e[0]s&&(e[0]=s*e[0]/r,e[1]=s*e[1]/r)},this.athAdjust=function(e,t,a){var s=90.30873362,n=u.FAST_LOG10_X(t,10),r=e*e,i=0;return n-=a,r>1e-20&&(i=1+u.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==b.vbr_mtrh?1:0,h=i.masking_lower;for(e.VBR!=b.vbr_mtrh&&e.VBR!=b.vbr_mt||(h=1),n=0;n>1,B=0;do{B+=T=f[o]*f[o],w+=T0);if(B>S&&_++,n==X.SBPSY_l)w<(A=S*i.nsPsy.longfact[n])&&(w=A);if(0!=c&&(S=w),!e.ATHonly)if((R=t.en.l[n])>0)A=B*t.thm.l[n]*h/R,0!=c&&(A*=i.nsPsy.longfact[n]),S>1;M=g/d,w=2220446049250313e-31;do{var T,x;B+=T=f[o]*f[o],w+=T0);if(B>g&&_++,m==X.SBPSY_s)w<(A=g*i.nsPsy.shortfact[m])&&(w=A);if(S=0!=c?w:g,!e.ATHonly&&!e.ATHshort)if((R=t.en.s[m][v])>0)A=B*t.thm.s[m][v]*h/R,0!=c&&(A*=i.nsPsy.shortfact[m]),Ss[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,i=t.s,o=e.l3_enc;if(i>e.count1)for(;0!=a--;){l=e.xr[i],i++,n+=l*l,l=e.xr[i],i++,n+=l*l}else if(i>e.big_values){var _=r(2);for(_[0]=0,_[1]=s;0!=a--;){l=Math.abs(e.xr[i])-_[o[i]],i++,n+=l*l,l=Math.abs(e.xr[i])-_[o[i]],i++,n+=l*l}}else for(;0!=a--;){var l;l=Math.abs(e.xr[i])-h[o[i]]*s,i++,n+=l*l,l=Math.abs(e.xr[i])-h[o[i]]*s,i++,n+=l*l}return t.s=i,n},this.calc_noise=function(e,t,a,s,n){var r,i,o=0,_=0,c=0,h=0,p=0,m=-20,b=0,d=e.scalefac,g=0;for(s.over_SSD=0,r=0;r>1,b+e.width[r]>e.max_nonzero_coeff)i=(R=e.max_nonzero_coeff-b+1)>0?R>>1:0;var A=new v(b);w=this.calc_noise_core(e,A,i,k),b=A.s,null!=n&&(n.step[r]=M,n.noise[r]=w),w=a[o++]=w/t[_++],w=u.FAST_LOG10(Math.max(w,1e-20)),null!=n&&(n.noise_log[r]=w)}if(null!=n&&(n.global_gain=e.global_gain),p+=w,w>0)S=Math.max(0|10*w+.5,1),s.over_SSD+=S*S,c++,h+=w;m=Math.max(m,w)}return s.over_count=c,s.tot_noise=p,s.over_noise=h,s.max_noise=m,c},this.set_pinfo=function(e,t,a,s,n){var i,o,_,f,c,h=e.internal_flags,u=0==t.scalefac_scale?.5:1,p=t.scalefac,m=r(N.SFBMAX),b=r(N.SFBMAX),d=new T;calc_xmin(e,a,t,m),calc_noise(t,m,b,d,null);var v=0;for(o=t.sfb_lmax,t.block_type!=X.SHORT_TYPE&&0==t.mixed_block_flag&&(o=22),i=0;i0&&!e.ATHonly?f/=a.en.l[i]:f=0,h.pinfo.thr[s][n][i]=c*Math.max(f*a.thm.l[i],h.ATH.l[i]),h.pinfo.LAMEsfb[s][n][i]=0,0!=t.preflag&&i>=11&&(h.pinfo.LAMEsfb[s][n][i]=-u*l[i]),i0?f/=a.en.s[i][w]:f=0,(e.ATHonly||e.ATHshort)&&(f=0),h.pinfo.thr_s[s][n][3*i+w]=c*Math.max(f*a.thm.s[i][w],h.ATH.s[i]),h.pinfo.LAMEsfb_s[s][n][3*i+w]=-2*t.subblock_gain[w],i0?(r=a.over_SSD<=t.over_SSD,a.over_SSD==t.over_SSD&&(r=a.bits.2||a.max_noise<=0&&t.max_noise<0&&t.max_noise>a.max_noise-.2&&a.tot_noise0&&t.max_noise>a.max_noise-.2&&a.tot_noise0&&t.max_noise>-.05&&t.max_noise>a.max_noise-.1&&a.tot_noise+a.over_noise0&&t.max_noise>-.1&&t.max_noise>a.max_noise-.15&&a.tot_noise+a.over_noise+a.over_noise1?o=Math.pow(o,.5):o*=.95;break;case 0:default:o>1?o=1:o*=.95}var f=0;for(_=0;_t.xrpow_max&&(t.xrpow_max=s[f+c]);if(2==i.noise_shaping_amp)return}}}(e,t,n,r,i);var l=o(t);return!l&&(!(l=2==_.mode_gr?s.scale_bitcount(t):s.scale_bitcount_lsf(_,t))||(_.noise_shaping>1&&(c.fill(_.pseudohalf,0),0==t.scalefac_scale?(!function(e,t){for(var s=0,n=0;ne.xrpow_max&&(e.xrpow_max=t[s+o])}e.scalefac[n]=i>>1}e.preflag=0,e.scalefac_scale=1}(t,r),l=!1):t.block_type==X.SHORT_TYPE&&_.subblock_gain>0&&(l=function(e,t,s){var n,r=t.scalefac;for(n=0;n=16)return!0;for(var i=0;i<3;i++){var o=0,_=0;for(n=t.sfb_lmax+i;n=7)return!0;t.subblock_gain[i]++;var l=e.scalefac_band.l[t.sfb_lmax];for(n=t.sfb_lmax+i;n>t.scalefac_scale)>=0)r[n]=c,l+=3*f;else{r[n]=0;var h=210+(c<t.xrpow_max&&(t.xrpow_max=s[l+u]);l+=f*(3-i-1)}}var p=a.IPOW20(202);l+=t.width[n]*(i+1);for(u=-t.width[n];u<0;u++)s[l+u]*=p,s[l+u]>t.xrpow_max&&(t.xrpow_max=s[l+u])}}return!1}(_,t,r)||o(t))),l||(l=2==_.mode_gr?s.scale_bitcount(t):s.scale_bitcount_lsf(_,t)),!l))}this.setModules=function(r,i,o,_){e=r,t=i,this.rv=i,a=o,this.qupvt=o,s=_,n.setModules(a,s)},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*u.SQRT2),e.tt[t][1].xr[a]=(s-n)*(.5*u.SQRT2)}},this.init_xrpow=function(e,t,a){var s=0,n=0|t.max_nonzero_coeff;if(t.xrpow_max=0,c.fill(a,n,576,0),(s=function(e,t,a,s){s=0;for(var n=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))>1e-20){var r=0;0!=(2&e.substep_shaping)&&(r=1);for(var i=0;i=0&&!r;i--){var o=e.scalefac_band.psfb21[i],_=e.scalefac_band.psfb21[i+1],l=a.athAdjust(s.adjust,s.psfb21[i],s.floor);e.nsPsy.longfact[21]>1e-12&&(l*=e.nsPsy.longfact[21]);for(var f=_-1;f>=o;f--){if(!(Math.abs(n[f])=0&&!r;i--){_=(o=3*e.scalefac_band.s[12]+(e.scalefac_band.s[13]-e.scalefac_band.s[12])*c+(e.scalefac_band.psfb12[i]-e.scalefac_band.psfb12[0]))+(e.scalefac_band.psfb12[i+1]-e.scalefac_band.psfb12[i]);var h=a.athAdjust(s.adjust,s.psfb12[i],s.floor);e.nsPsy.shortfact[12]>1e-12&&(h*=e.nsPsy.shortfact[12]);for(f=_-1;f>=o;f--){if(!(Math.abs(n[f])=1||(c.sort(i,_-b,b),k.EQ(i[_-1],0)))){h=(1-o[f])*n[f],u=0,m=0;do{var d;for(p=1;m+p0)}}while(++fa?(c==i.BINSEARCH_DOWN&&(l=!0),l&&(_/=2),c=i.BINSEARCH_UP,h=_):(c==i.BINSEARCH_UP&&(l=!0),l&&(_/=2),c=i.BINSEARCH_DOWN,h=-_),t.global_gain+=h,t.global_gain<0&&(t.global_gain=0,l=!0),t.global_gain>255&&(t.global_gain=255,l=!0)}for(;o>a&&t.global_gain<255;)t.global_gain++,o=s.count_bits(e,r,t,null);e.CurrentStep[n]=f-t.global_gain>=4?4:2,e.OldValue[n]=t.global_gain,t.part2_3_length=o}(u,t,c,f,o),0==u.noise_shaping)return 100;a.calc_noise(t,n,d,v,g),v.bits=t.part2_3_length,p.assign(t);var k=0;for(h.arraycopy(o,0,m,0,576);!M;){do{var A,B=new T,y=255;if(A=0!=(2&u.substep_shaping)?20:3,u.sfb21_extra){if(d[p.sfbmax]>1)break;if(p.block_type==X.SHORT_TYPE&&(d[p.sfbmax+1]>1||d[p.sfbmax+2]>1))break}if(!l(e,p,d,o,w))break;0!=p.scalefac_scale&&(y=254);var x=c-p.part2_length;if(x<=0)break;for(;(p.part2_3_length=s.count_bits(u,o,p,g))>x&&p.global_gain<=y;)p.global_gain++;if(p.global_gain>y)break;if(0==v.over_count){for(;(p.part2_3_length=s.count_bits(u,o,p,g))>S&&p.global_gain<=y;)p.global_gain++;if(p.global_gain>y)break}if(a.calc_noise(p,n,d,B,g),B.bits=p.part2_3_length,0!=(_(t.block_type!=X.SHORT_TYPE?e.quant_comp:e.quant_comp_short,v,B,p,d)?1:0))S=t.part2_3_length,v=B,t.assign(p),k=0,h.arraycopy(o,0,m,0,576);else if(0==u.full_outer_loop){if(++k>A&&0==v.over_count)break;if(3==u.noise_shaping_amp&&w&&k>30)break;if(3==u.noise_shaping_amp&&w&&p.global_gain-R>15)break}}while(p.global_gain+p.scalefac_scale<255);3==u.noise_shaping_amp?w?M=!0:(p.assign(t),h.arraycopy(m,0,o,0,576),k=0,R=p.global_gain,w=!0):M=!0}return e.VBR==b.vbr_rh||e.VBR==b.vbr_mtrh?h.arraycopy(m,0,o,0,576):0!=(1&u.substep_shaping)&&trancate_smallspectrums(u,t,n,o),v.over_count},this.iteration_finish_one=function(e,a,n){var r=e.l3_side,i=r.tt[a][n];s.best_scalefac_store(e,a,n,r),1==e.use_best_huffman&&s.best_huffman_divide(e,i),t.ResvAdjust(e,i)},this.VBR_encode_granule=function(e,t,a,s,n,i,o){var _,l=e.internal_flags,f=new V,u=r(576),p=o,m=o+1,b=(o+i)/2,d=0,v=l.sfb21_extra;c.fill(f.l3_enc,0);do{l.sfb21_extra=!(b>p-42)&&v,outer_loop(e,t,a,s,n,b)<=0?(d=1,m=t.part2_3_length,f.assign(t),h.arraycopy(s,0,u,0,576),_=(o=m-32)-i,b=(o+i)/2):(_=o-(i=b+32),b=(o+i)/2,0!=d&&(d=2,t.assign(f),h.arraycopy(u,0,s,0,576)))}while(_>12);l.sfb21_extra=v,2==d&&h.arraycopy(f.l3_enc,0,t.l3_enc,0,576)},this.get_framebits=function(a,s){var n=a.internal_flags;n.bitrate_index=n.VBR_min_bitrate;var r=e.getframebits(a);n.bitrate_index=1,r=e.getframebits(a);for(var i=1;i<=n.VBR_max_bitrate;i++){n.bitrate_index=i;var o=new y(r);s[i]=t.ResvFrameBegin(a,o),r=o.bits}},this.VBR_old_prepare=function(e,s,n,r,i,o,_,l,f){var c,h=e.internal_flags,u=0,p=1,m=0;h.bitrate_index=h.VBR_max_bitrate;var b=t.ResvFrameBegin(e,new y(0))/h.mode_gr;get_framebits(e,o);for(var d=0;do[h.VBR_max_bitrate]&&(l[d][g]*=o[h.VBR_max_bitrate],l[d][g]/=m),_[d][g]>l[d][g]&&(_[d][g]=l[d][g]);return p},this.bitpressure_strategy=function(e,t,a,s){for(var n=0;n_&&(o[p][m]*=_,o[p][m]/=h);return f},this.calc_target_bits=function(s,n,r,i,o,_){var l,f,c,h,u=s.internal_flags,p=u.l3_side,m=0;u.bitrate_index=u.VBR_max_bitrate;var b=new y(m);for(_[0]=t.ResvFrameBegin(s,b),m=b.bits,u.bitrate_index=1,m=e.getframebits(s)-8*u.sideinfo_len,o[0]=m/(u.mode_gr*u.channels_out),m=s.VBR_mean_bitrate_kbps*s.framesize*1e3,0!=(1&u.substep_shaping)&&(m*=1.09),m/=s.out_samplerate,m-=8*u.sideinfo_len,m/=u.mode_gr*u.channels_out,(l=.93+.07*(11-s.compression_ratio)/5.5)<.9&&(l=.9),l>1&&(l=1),f=0;f700){var v=int((n[f][c]-700)/1.4),g=p.tt[f][c];i[f][c]=int(l*m),g.block_type==X.SHORT_TYPE&&v3*m/2?v=3*m/2:v<0&&(v=0),i[f][c]+=v}i[f][c]>Z.MAX_BITS_PER_CHANNEL&&(i[f][c]=Z.MAX_BITS_PER_CHANNEL),d+=i[f][c]}if(d>Z.MAX_BITS_PER_GRANULE)for(c=0;cZ.MAX_BITS_PER_CHANNEL&&(i[f][c]=Z.MAX_BITS_PER_CHANNEL),h+=i[f][c];if(h>_[0])for(f=0;f=0;--U){var ee,te;ee=q[j+U]*n[20+U]+q[j+-1-U]*i[28+U],te=q[j+U]*i[28+U]-q[j+-1-U]*n[20+U],q[j+-1-U]=ee,q[j+U]=te}}}if(C=u,O=286,1==e.mode_gr)for(var ae=0;ae<18;ae++)h.arraycopy(e.sb_sample[V][1][ae],0,e.sb_sample[V][0][ae],0,32)}}}function q(){this.thm=new z,this.en=new z}function X(){var e=X.FFTOFFSET,t=X.MPG_MD_MS_LR,a=null;this.psy=null;var s=null,i=null,_=null;this.setModules=function(e,t,n,r){a=e,this.psy=t,s=t,i=r,_=n};var l=new Y;this.lame_encode_mp3_frame=function(c,u,p,m,v,g){var S,M=f([2,2]);M[0][0]=new q,M[0][1]=new q,M[1][0]=new q,M[1][1]=new q;var w,R=f([2,2]);R[0][0]=new q,R[0][1]=new q,R[1][0]=new q,R[1][1]=new q;var k,A,B,y=[null,null],T=c.internal_flags,x=o([2,4]),E=[.5,.5],P=[[0,0],[0,0]],L=[[0,0],[0,0]];if(y[0]=u,y[1]=p,0==T.lame_encode_frame_init&&function(e,t){var a,s,n=e.internal_flags;if(0==n.lame_encode_frame_init){var i,o,_=r(2014),f=r(2014);for(n.lame_encode_frame_init=1,i=0,o=0;i<286+576*(1+n.mode_gr);++i)i<576*n.mode_gr?(_[i]=0,2==n.channels_out&&(f[i]=0)):(_[i]=t[0][o],2==n.channels_out&&(f[i]=t[1][o]),++o);for(s=0;s0&&(E[B]=x[B][3]/E[B])),A=0;A.03125)e.ATH.adjust>=1?e.ATH.adjust=1:e.ATH.adjust=s?(e.ATH.adjust*=.075*s+.925,e.ATH.adjust=s?e.ATH.adjust=s:e.ATH.adjust>1,m=(p=n<<1)+(h=n),n=p<<1,i=(r=t)+b;do{R=e[r+0]-e[r+h],w=e[r+0]+e[r+h],y=e[r+p]-e[r+m],A=e[r+p]+e[r+m],e[r+p]=w-A,e[r+0]=w+A,e[r+m]=R-y,e[r+h]=R+y,R=e[i+0]-e[i+h],w=e[i+0]+e[i+h],y=u.SQRT2*e[i+m],A=u.SQRT2*e[i+p],e[i+p]=w-A,e[i+0]=w+A,e[i+m]=R-y,e[i+h]=R+y,i+=n,r+=n}while(r<_);for(f=a[o+0],l=a[o+1],c=1;c=0);s(a[_],l,X.BLKSIZE_s/2)}},this.fft_long=function(t,a,r,i,o){var _=X.BLKSIZE/8-1,l=X.BLKSIZE/2;do{var f,c,h,u,p,m=255&n[_];c=(f=e[m]*i[r][o+m])-(p=e[m+512]*i[r][o+m+512]),f+=p,u=(h=e[m+256]*i[r][o+m+256])-(p=e[m+768]*i[r][o+m+768]),h+=p,a[(l-=4)+0]=f+h,a[l+2]=f-h,a[l+1]=c+u,a[l+3]=c-u,c=(f=e[m+1]*i[r][o+m+1])-(p=e[m+513]*i[r][o+m+513]),f+=p,u=(h=e[m+257]*i[r][o+m+257])-(p=e[m+769]*i[r][o+m+769]),h+=p,a[l+X.BLKSIZE/2+0]=f+h,a[l+X.BLKSIZE/2+2]=f-h,a[l+X.BLKSIZE/2+1]=c+u,a[l+X.BLKSIZE/2+3]=c-u}while(--_>=0);s(a,l,X.BLKSIZE/2)},this.init_fft=function(a){for(var s=0;s=0;--m){var b=r[i+0][m],d=r[i+1][m];r[i+0][m]=(b+d)*u.SQRT2*.5,r[i+1][m]=(b-d)*u.SQRT2*.5}for(var v=2;v>=0;--v)for(m=X.BLKSIZE_s-1;m>=0;--m){b=o[_+0][v][m],d=o[_+1][v][m];o[_+0][v][m]=(b+d)*u.SQRT2*.5,o[_+1][v][m]=(b-d)*u.SQRT2*.5}}a[0]=r[i+0][0],a[0]*=a[0];for(m=X.BLKSIZE/2-1;m>=0;--m){var g=r[i+0][X.BLKSIZE/2-m],S=r[i+0][X.BLKSIZE/2+m];a[X.BLKSIZE/2-m]=.5*(g*g+S*S)}for(v=2;v>=0;--v){n[v][0]=o[_+0][v][0],n[v][0]*=n[v][0];for(m=X.BLKSIZE_s/2-1;m>=0;--m){g=o[_+0][v][X.BLKSIZE_s/2-m],S=o[_+0][v][X.BLKSIZE_s/2+m];n[v][X.BLKSIZE_s/2-m]=.5*(g*g+S*S)}}var M=0;for(m=11;me){if(!(t=t*l)return e+t;i=e/t}if(e+=t,s+3<=6){if(i>=_)return e;var o=0|u.FAST_LOG10_X(i,16);return e*g[o]}var c,h;o=0|u.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,et?(c=1,o<=13&&(c=S[o]),h=u.FAST_LOG10_X(e/t,10/15),e*((v[o]-c)*h+c)):o>13?e:e*S[o]:e*v[o]}var w=[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 R(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=t>e?t/e:e/t,-2<=a&&a<=2){if(s>=_)return e+t;var n=0|u.FAST_LOG10_X(s,16);return(e+t)*w[n]}return s=f){++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=l){++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=1?e:a<=0?t:t>0?Math.pow(e/t,a)*t:0}var T=[11.8,13.6,17.2,32,46.5,51.3,57.5,67.1,71.5,84.6,97.6,130];function x(e,a){for(var s=309.07,n=0;n0){var o=i*a,_=e.en.s[n][r];_>o&&(s+=_>1e10*o?T[n]*(10*t):T[n]*u.FAST_LOG10(_/o))}}return s}var E=[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 P(e,a){for(var s=281.0575,n=0;n0){var i=r*a,o=e.en.l[n];o>i&&(s+=o>1e10*i?E[n]*(10*t):E[n]*u.FAST_LOG10(o/i))}}return s}function L(e,t,a,s,n){var r,i;for(r=i=0;r0?((o=t[r])n&&(_=n),s[r]=_):s[r]=0;for(r=1;r0)(o=t[r-1])n&&(_=n),s[r]=_;else s[r]=0}(i=a[r-1]+a[r])>0?((o=t[r-1])n&&(_=n),s[r]=_):s[r]=0}var H=[-1730326e-23,-.01703172,-1349528e-23,.0418072,-673278e-22,-.0876324,-30835e-21,.1863476,-1104424e-22,-.627638];function C(t,a,s,n,r,i,o,_){var l=t.internal_flags;if(n<2)e.fft_long(l,o[_],n,a,s);else if(2==n)for(var f=X.BLKSIZE-1;f>=0;--f){var c=o[_+0][f],h=o[_+1][f];o[_+0][f]=(c+h)*u.SQRT2*.5,o[_+1][f]=(c-h)*u.SQRT2*.5}i[0]=o[_+0][0],i[0]*=i[0];for(f=X.BLKSIZE/2-1;f>=0;--f){var p=o[_+0][X.BLKSIZE/2-f],m=o[_+0][X.BLKSIZE/2+f];i[X.BLKSIZE/2-f]=.5*(p*p+m*m)}var b=0;for(f=11;f=0;--f){var c=o[_+0][r][f],h=o[_+1][r][f];o[_+0][r][f]=(c+h)*u.SQRT2*.5,o[_+1][r][f]=(c-h)*u.SQRT2*.5}i[r][0]=o[_+0][r][0],i[r][0]*=i[r][0];for(f=X.BLKSIZE_s/2-1;f>=0;--f){var p=o[_+0][r][X.BLKSIZE_s/2-f],m=o[_+0][r][X.BLKSIZE_s/2+f];i[r][X.BLKSIZE_s/2-f]=.5*(p*p+m*m)}}function V(e,t,a,n){var r=e.internal_flags;2==e.athaa_loudapprox&&a<2&&(r.loudness_sq[t][a]=r.loudness_sq_save[a],r.loudness_sq_save[a]=s(n,r))}this.L3psycho_anal_ns=function(e,t,a,s,_,l,f,u,m,v){var g,S,w,R,T,E,C,O,V,N,D=e.internal_flags,Y=o([2,X.BLKSIZE]),q=o([2,3,X.BLKSIZE_s]),j=r(X.CBANDS+1),F=r(X.CBANDS+1),z=r(X.CBANDS+2),U=n(2),Z=n(2),K=o([2,576]),G=n(X.CBANDS+2),W=n(X.CBANDS+2);for(c.fill(W,0),g=D.channels_out,e.mode==d.JOINT_STEREO&&(g=4),V=e.VBR==b.vbr_off?0==D.ResvMax?0:D.ResvSize/D.ResvMax*.5:e.VBR==b.vbr_rh||e.VBR==b.vbr_mtrh||e.VBR==b.vbr_mt?.6:1,S=0;S2&&(l[s][S].en.assign(D.en[S+2]),l[s][S].thm.assign(D.thm[S+2]))}for(S=0;Sae[R+3-2]?be/=ae[R+3-2]:be=ae[R+3-2]>10*be?ae[R+3-2]/(10*be):0,ne[R+3]=be}if(e.analysis){var de=ne[0];for(R=1;R<12;R++)dete&&(_e[R/3]=R%3+1);for(R=1;R<4;R++){(se[R-1]>se[R]?se[R-1]/se[R]:se[R]/se[R-1])<1.7&&(_e[R]=0,1==R&&(_e[0]=0))}for(0!=_e[0]&&0!=D.nsPsy.lastAttacks[S]&&(_e[0]=0),3!=D.nsPsy.lastAttacks[S]&&_e[0]+_e[1]+_e[2]+_e[3]==0||(re=0,0!=_e[1]&&0!=_e[0]&&(_e[1]=0),0!=_e[2]&&0!=_e[1]&&(_e[2]=0),0!=_e[3]&&0!=_e[2]&&(_e[3]=0)),S<2?Z[S]=re:0==re&&(Z[0]=Z[1]=0),m[S]=D.tot_ener[S],i(e,le,fe,Y,1&S,q,1&S,s,S,t,a),L(D,le,j,ie,oe),I(D,ie,oe,G),O=0;O<3;O++){var ve,ge;for(B(e,fe,F,z,S,O),k(D,F,z,S,O),C=0;C=2||1==_e[O+1]){var Se=0!=O?O-1:2;be=y(D.thm[S].s[C][Se],ge,.6*V);ge=Math.min(ge,be)}if(1==_e[O]){Se=0!=O?O-1:2,be=y(D.thm[S].s[C][Se],ge,.3*V);ge=Math.min(ge,be)}else if(0!=O&&3==_e[O-1]||0==O&&3==D.nsPsy.lastAttacks[S]){Se=2!=O?O+1:0,be=y(D.thm[S].s[C][Se],ge,.3*V);ge=Math.min(ge,be)}ve=ae[3*O+3]+ae[3*O+4]+ae[3*O+5],6*ae[3*O+5]0&&function(e,t){var a=e.internal_flags;if(a.channels_out>1){for(var s=0;s1.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;t1.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}}(D),N=e.msfix,Math.abs(N)>0&&function(e,t,a){var s=t,n=Math.pow(10,a);t*=2,s*=2;for(var r=0;r1?(ke=u,ye=-2,Ae=X.NORM_TYPE,v[0]!=X.SHORT_TYPE&&v[1]!=X.SHORT_TYPE||(Ae=X.SHORT_TYPE),Be=l[s][S-2]):(ke=f,ye=0,Ae=v[S],Be=_[s][S]),Ae==X.SHORT_TYPE?ke[ye+S]=x(Be,D.masking_lower):ke[ye+S]=P(Be,D.masking_lower),e.analysis&&(D.pinfo.pe[s][S]=ke[ye+S])}return 0};var N=[-1730326e-23,-.01703172,-1349528e-23,.0418072,-673278e-22,-.0876324,-30835e-21,.1863476,-1104424e-22,-.627638];function D(e,t,a){if(0==a)for(var s=0;s0?((o=t[r])n&&(_=n),s[r]=_):s[r]=0,r=1;r0)(o=t[r-1])n&&(_=n),s[r]=_;else s[r]=0}(i=a[r-1]+a[r])>0?((o=t[r-1])n&&(_=n),s[r]=_):s[r]=0}(f,c,u,p),_=l=0;lM&&(s[l]=M),f.masking_lower>1&&(s[l]*=f.masking_lower),s[l]>a[l]&&(s[l]=a[l]),f.masking_lower<1&&(s[l]*=f.masking_lower)}for(;l0?Math.min(p,S):Math.min(p,.3*a[o])}else{var M=16*e.nb_2[i][o],w=2*e.nb_1[i][o];M<=0&&(M=p),w<=0&&(w=p),S=e.blocktype_old[1&i]==X.NORM_TYPE?Math.min(w,M):w,s[o]=Math.min(p,S)}e.nb_2[i][o]=e.nb_1[i][o],e.nb_1[i][o]=p,u=_[o],u*=e.minval_l[o],u*=m,s[o]>u&&(s[o]=u),e.masking_lower>1&&(s[o]*=e.masking_lower),s[o]>a[o]&&(s[o]=a[o]),e.masking_lower<1&&(s[o]*=e.masking_lower)}for(;o0?Math.pow(10,n):1,c=0;c0){var S,M,w=s[c]*f;if(S=Math.min(Math.max(p,w),Math.max(m,w)),(M=(b=Math.max(_,w))+(d=Math.max(o,w)))>0&&S*lh&&(_=h),o>u&&(o=u),t[2][c]=_,t[3][c]=o}}function z(e,t){var a;return(a=e>=0?27*-e:e*t)<=-72?0:Math.exp(.2302585093*a)}function U(e){var t,a,s=0;for(s=0;z(s,e)>1e-20;s-=1);for(n=s,r=0;Math.abs(r-n)>1e-12;)z(s=(r+n)/2,e)>0?r=s:n=s;t=n;var n,r;s=0;for(s=0;z(s,e)>1e-20;s+=1);for(n=0,r=s;Math.abs(r-n)>1e-12;)z(s=(r+n)/2,e)>0?n=s:r=s;a=r;var i,o=0,_=1e3;for(i=0;i<=_;++i){o+=z(s=t+i*(a-t)/_,e)}return 1001/(o*(a-t))}function Z(e){return e<0&&(e=0),e*=.001,13*Math.atan(.76*e)+3.5*Math.atan(e*e/56.25)}function G(e,t,a,s,i,o,_,l,f,c,h,u){var p,m=r(X.CBANDS+1),b=l/(u>15?1152:384),d=n(X.HBLKSIZE);l/=f;var v=0,g=0;for(p=0;pf/2){v=f/2,++p;break}}m[p]=l*v;for(var M=0;Mf/2&&(R=f/2),a[M]=(d[w]+d[R])/2,t[M]=d[R];var y=b*A;_[M]=(y-m[t[M]])/(m[t[M]+1]-m[t[M]]),_[M]<0?_[M]=0:_[M]>1&&(_[M]=1),B=Z(l*c[M]*h),B=Math.min(B,15.5)/15.5,o[M]=Math.pow(10,1.25*(1-Math.cos(Math.PI*B))-2.5)}v=0;for(var T=0;T=0?3:1.5)>=.5&&f<=2.5?8*((u=f-.5)*u-2*u):0,((h=15.811389+7.5*(f+=.474)-17.5*Math.sqrt(1+f*f))<=-60?0:(f=Math.exp(.2302585093*(c+h)),f/=.6609193))*s[_]);p[b][_]=d*n[b]}else for(_=0;_0);_++);for(e[b][0]=_,_=t-1;_>0&&!(p[b][_]>0);_--);e[b][1]=_,m+=e[b][1]-e[b][0]+1}var S=r(m),M=0;for(b=0;b2&&(i[s][b].en.assign(u.en[b+2]),i[s][b].thm.assign(u.thm[b+2]))}for(b=0;b0;++g,--w){var E=h[0][g],P=h[1][g];h[0][g]=E+P,h[1][g]=E-P}for(g=0;g<3;g++)k[g]=u.nsPsy.last_en_subshort[b][g+6],R[g]=k[g]/u.nsPsy.last_en_subshort[b][g+4],A[0]+=k[g];for(g=0;g<9;g++){for(var L=y+64,I=1;yk[g+3-2]?I/=k[g+3-2]:I=k[g+3-2]>10*I?k[g+3-2]/(10*I):0,R[g+3]=I}for(g=0;g<3;++g){var H=k[3*g+3]+k[3*g+4]+k[3*g+5],C=1;6*k[3*g+5]T&&(f[b][g/3]=g%3+1);for(g=1;g<4;g++){var V=A[g-1],D=A[g];Math.max(V,D)<4e4&&V<1.7*D&&D<1.7*V&&(1==g&&f[b][0]<=f[b][g]&&(f[b][0]=0),f[b][g]=0)}f[b][0]<=u.nsPsy.lastAttacks[b]&&(f[b][0]=0),3!=u.nsPsy.lastAttacks[b]&&f[b][0]+f[b][1]+f[b][2]+f[b][3]==0||(x=0,0!=f[b][1]&&0!=f[b][0]&&(f[b][1]=0),0!=f[b][2]&&0!=f[b][1]&&(f[b][2]=0),0!=f[b][3]&&0!=f[b][2]&&(f[b][3]=0)),b<2?c[b]=x:0==x&&(c[0]=c[1]=0),_[b]=u.tot_ener[b]}}(e,t,a,s,i,_,c,w,R,B),function(e,t){var a=e.internal_flags;e.short_blocks!=p.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var s=0;s=2||1==R[E][L+1]){var Z=0!=L?L-1:2,K=y(u.thm[E].s[H][Z],U,.36);U=Math.min(U,K)}else if(1==R[E][L]){Z=0!=L?L-1:2,K=y(u.thm[E].s[H][Z],U,.18);U=Math.min(U,K)}else if(0!=L&&3==R[E][L-1]||0==L&&3==u.nsPsy.lastAttacks[E]){Z=2!=L?L+1:0,K=y(u.thm[E].s[H][Z],U,.18);U=Math.min(U,K)}U*=w[E][L],z[L]=U}for(L=0;L<3;L++)u.thm[E].s[H][L]=z[L]}}for(E=0;E1?(G=f,W=-2,Q=X.NORM_TYPE,h[0]!=X.SHORT_TYPE&&h[1]!=X.SHORT_TYPE||(Q=X.SHORT_TYPE),J=_[s][E-2]):(G=l,W=0,Q=h[E],J=i[s][E]),Q==X.SHORT_TYPE?G[W+E]=x(J,u.masking_lower):G[W+E]=P(J,u.masking_lower),e.analysis&&(u.pinfo.pe[s][E]=G[W+E])}return 0},this.psymodel_init=function(a){var s,n=a.internal_flags,i=!0,o=13,c=0,h=0,u=-8.25,p=-4.5,d=r(X.CBANDS),v=r(X.CBANDS),g=r(X.CBANDS),S=a.out_samplerate;switch(a.experimentalZ){default:case 0:i=!0;break;case 1:i=a.VBR!=b.vbr_mtrh&&a.VBR!=b.vbr_mt;break;case 2:i=!1;break;case 3:o=8,c=-1.75,h=-.0125,u=-8.25,p=-2.25}for(n.ms_ener_ratio_old=.25,n.blocktype_old[0]=n.blocktype_old[1]=X.NORM_TYPE,s=0;s<4;++s){for(var M=0;M=o&&(R=h*(d[s]-o)/(24-o)+c*(24-d[s])/(24-o)),g[s]=Math.pow(10,R/10),n.numlines_l[s]>0?n.rnumlines_l[s]=1/n.numlines_l[s]:n.rnumlines_l[s]=0}n.s3_ll=W(n.s3ind,n.npart_l,d,v,g,i);var k;M=0;for(s=0;s(T*=n.numlines_l[s])&&(y=T)}n.ATH.cb_l[s]=y,(y=20*d[s]/10-20)>6&&(y=100),y<-15&&(y=-15),y-=8,n.minval_l[s]=Math.pow(10,y/10)*n.numlines_l[s]}for(n.npart_s=G(n.numlines_s,n.bo_s,n.bm_s,d,v,n.mld_s,n.PSY.bo_s_weight,S,X.BLKSIZE_s,n.scalefac_band.s,X.BLKSIZE_s/384,X.SBMAX_s),M=0,s=0;s=o&&(R=p*(d[s]-o)/(24-o)+u*(24-d[s])/(24-o)),g[s]=Math.pow(10,R/10),y=m.MAX_VALUE;for(A=0;A(T*=n.numlines_s[s])&&(y=T)}n.ATH.cb_s[s]=y,y=7*d[s]/12-7,d[s]>12&&(y*=1+3.1*Math.log(1+y)),d[s]<12&&(y*=1+2.3*Math.log(1-y)),y<-15&&(y=-15),y-=8,n.minval_s[s]=Math.pow(10,y/10)*n.numlines_s[s]}n.s3_ss=W(n.s3ind_s,n.npart_s,d,v,g,i),_=Math.pow(10,9/16),l=Math.pow(10,1.5),f=Math.pow(10,1.5),e.init_fft(n),n.decay=Math.exp(-1*t/(.01*S/192)),k=3.5,0!=(2&a.exp_nspsytune)&&(k=1),Math.abs(a.msfix)>0&&(k=a.msfix),a.msfix=k;for(var x=0;xn.npart_l-1&&(n.s3ind[x][1]=n.npart_l-1);var E=576*n.mode_gr/S;if(n.ATH.decay=Math.pow(10,-1.2*E),n.ATH.adjust=.01,n.ATH.adjustLimit=1,-1!=a.ATHtype){var P=a.out_samplerate/X.BLKSIZE,L=0;for(B=0,s=0;s=0;)n.ATH.eql_w[s]*=L}for(x=M=0;x1?0:e<=0?1:Math.cos(Math.PI/2*e)}function w(e,t){switch(e){case 44100:return t.version=1,0;case 48e3:return t.version=1,1;case 32e3:return t.version=1,2;case 22050:return t.version=0,0;case 24e3:return t.version=0,1;case 16e3:return t.version=0,2;case 11025:return t.version=0,0;case 12e3:return t.version=0,1;case 8e3:return t.version=0,2;default:return t.version=0,-1}}function R(e,t,a){a<16e3&&(t=2);for(var s=B.bitrate_table[t][1],n=2;n<=14;n++)B.bitrate_table[t][n]>0&&Math.abs(B.bitrate_table[t][n]-e)0&&B.bitrate_table[t][s]==e)return s;return-1}function y(t,a){var s=[new g(8,2e3),new g(16,3700),new g(24,3900),new g(32,5500),new g(40,7e3),new g(48,7500),new g(56,1e4),new g(64,11e3),new g(80,13500),new g(96,15100),new g(112,15600),new g(128,17e3),new g(160,17500),new g(192,18600),new g(224,19400),new g(256,19700),new g(320,20500)],n=e.nearestBitrateFullIndex(a);t.lowerlimit=s[n].lowpass}function T(e){var t=X.BLKSIZE+e.framesize-X.FFTOFFSET;return t=Math.max(t,512+e.framesize-32)}function x(t,a,s,n,r,i){var o=e.enc.lame_encode_mp3_frame(t,a,s,n,r,i);return t.frameNum++,o}function H(){this.n_in=0,this.n_out=0}function C(){this.num_used=0}function O(e,t,a){var s=Math.PI*t;(e/=a)<0&&(e=0),e>1&&(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 V(e,t,a,s,n,i,o,_,l){var f,c,h=e.internal_flags,u=0,p=e.out_samplerate/function e(t,a){return 0!=a?e(a,t%a):t}(e.out_samplerate,e.in_samplerate);p>Z.BPC&&(p=Z.BPC);var m=Math.abs(h.resample_ratio-Math.floor(.5+h.resample_ratio))<1e-4?1:0,b=1/h.resample_ratio;b>1&&(b=1);var d=31;0==d%2&&--d;var v=(d+=m)+1;if(0==h.fill_buffer_resample_init){for(h.inbuf_old[0]=r(v),h.inbuf_old[1]=r(v),f=0;f<=2*p;++f)h.blackfilt[f]=r(v);for(h.itime[0]=0,h.itime[1]=0,u=0;u<=2*p;u++){var g=0,S=(u-p)/(2*p);for(f=0;f<=d;f++)g+=h.blackfilt[u][f]=O(f-S,b,d);for(f=0;f<=d;f++)h.blackfilt[u][f]/=g}h.fill_buffer_resample_init=1}var M=h.inbuf_old[l];for(c=0;c=o)break;S=w-h.itime[l]-(u+d%2*.5);R=0|Math.floor(2*S*p+p+.5);var k=0;for(f=0;f<=d;++f){var A=f+u-d/2;k+=(A<0?M[v+A]:n[i+A])*h.blackfilt[R][f]}t[a+c]=k}if(_.num_used=Math.min(o,d+u-d/2),h.itime[l]+=_.num_used-c*h.resample_ratio,_.num_used>=v)for(f=0;f1.0001)for(var o=0;oe-s?a:n},this.lame_init_params=function(e){var r,l,g,T=e.internal_flags;if(T.Class_ID=0,null==T.ATH&&(T.ATH=new E),null==T.PSY&&(T.PSY=new m),null==T.rgdata&&(T.rgdata=new I),T.channels_in=e.num_channels,1==T.channels_in&&(e.mode=d.MONO),T.channels_out=e.mode==d.MONO?1:2,T.mode_ext=X.MPG_MD_MS_LR,e.mode==d.MONO&&(e.force_ms=!1),e.VBR==b.vbr_off&&128!=e.VBR_mean_bitrate_kbps&&0==e.brate&&(e.brate=e.VBR_mean_bitrate_kbps),e.VBR==b.vbr_off||e.VBR==b.vbr_mtrh||e.VBR==b.vbr_mt||(e.free_format=!1),e.VBR==b.vbr_off&&0==e.brate&&k.EQ(e.compression_ratio,0)&&(e.compression_ratio=11.025),e.VBR==b.vbr_off&&e.compression_ratio>0&&(0==e.out_samplerate&&(e.out_samplerate=map2MP3Frequency(int(.97*e.in_samplerate))),e.brate=0|16*e.out_samplerate*T.channels_out/(1e3*e.compression_ratio),T.samplerate_index=w(e.out_samplerate,e),e.free_format||(e.brate=R(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 x=16e3;switch(e.VBR){case b.vbr_off:y(P=new v,e.brate),x=P.lowerlimit;break;case b.vbr_abr:var P;y(P=new v,e.VBR_mean_bitrate_kbps),x=P.lowerlimit;break;case b.vbr_rh:var H=[19500,19e3,18600,18e3,17500,16e3,15600,14900,12500,1e4,3950];if(0<=e.VBR_q&&e.VBR_q<=9){var C=H[e.VBR_q],O=H[e.VBR_q+1],V=e.VBR_q_frac;x=linear_int(C,O,V)}else x=19500;break;default:H=[19500,19e3,18500,18e3,17500,16500,15500,14500,12500,9500,3950];if(0<=e.VBR_q&&e.VBR_q<=9){C=H[e.VBR_q],O=H[e.VBR_q+1],V=e.VBR_q_frac;x=linear_int(C,O,V)}else x=19500}e.mode!=d.MONO||e.VBR!=b.vbr_off&&e.VBR!=b.vbr_abr||(x*=1.5),e.lowpassfreq=0|x}if(0==e.out_samplerate&&(2*e.lowpassfreq>e.in_samplerate&&(e.lowpassfreq=e.in_samplerate/2),e.out_samplerate=(r=0|e.lowpassfreq,l=e.in_samplerate,g=44100,l>=48e3?g=48e3:l>=44100?g=44100:l>=32e3?g=32e3:l>=24e3?g=24e3:l>=22050?g=22050:l>=16e3?g=16e3:l>=12e3?g=12e3:l>=11025?g=11025:l>=8e3&&(g=8e3),-1==r?g:(r<=15960&&(g=44100),r<=15250&&(g=32e3),r<=11220&&(g=24e3),r<=9970&&(g=22050),r<=7230&&(g=16e3),r<=5420&&(g=12e3),r<=4510&&(g=11025),r<=3970&&(g=8e3),l44100?48e3:l>32e3?44100:l>24e3?32e3:l>22050?24e3:l>16e3?22050:l>12e3?16e3:l>11025?12e3:l>8e3?11025:8e3:g))),e.lowpassfreq=Math.min(20500,e.lowpassfreq),e.lowpassfreq=Math.min(e.out_samplerate/2,e.lowpassfreq),e.VBR==b.vbr_off&&(e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.brate)),e.VBR==b.vbr_abr&&(e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.VBR_mean_bitrate_kbps)),e.bWriteVbrTag||(e.findReplayGain=!1,e.decode_on_the_fly=!1,T.findPeakSample=!1),T.findReplayGain=e.findReplayGain,T.decode_on_the_fly=e.decode_on_the_fly,T.decode_on_the_fly&&(T.findPeakSample=!0),T.findReplayGain&&t.InitGainAnalysis(T.rgdata,e.out_samplerate)==S.INIT_GAIN_ANALYSIS_ERROR)return e.internal_flags=null,-6;switch(T.decode_on_the_fly&&!e.decode_only&&(null!=T.hip&&c.hip_decode_exit(T.hip),T.hip=c.hip_decode_init()),T.mode_gr=e.out_samplerate<=24e3?1:2,e.framesize=576*T.mode_gr,e.encoder_delay=X.ENCDELAY,T.resample_ratio=e.in_samplerate/e.out_samplerate,e.VBR){case b.vbr_mt:case b.vbr_rh:case b.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 b.vbr_abr:e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.VBR_mean_bitrate_kbps);break;default:e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.brate)}if(e.mode==d.NOT_SET&&(e.mode=d.JOINT_STEREO),e.highpassfreq>0?(T.highpass1=2*e.highpassfreq,e.highpasswidth>=0?T.highpass2=2*(e.highpassfreq+e.highpasswidth):T.highpass2=2*e.highpassfreq,T.highpass1/=e.out_samplerate,T.highpass2/=e.out_samplerate):(T.highpass1=0,T.highpass2=0),e.lowpassfreq>0?(T.lowpass2=2*e.lowpassfreq,e.lowpasswidth>=0?(T.lowpass1=2*(e.lowpassfreq-e.lowpasswidth),T.lowpass1<0&&(T.lowpass1=0)):T.lowpass1=2*e.lowpassfreq,T.lowpass1/=e.out_samplerate,T.lowpass2/=e.out_samplerate):(T.lowpass1=0,T.lowpass2=0),function(e){var t=e.internal_flags,a=32,s=-1;if(t.lowpass1>0){for(var n=999,r=0;r<=31;r++){(l=r/31)>=t.lowpass2&&(a=Math.min(a,r)),t.lowpass10&&t.highpass2<.75/31*.9&&(t.highpass1=0,t.highpass2=0,h.err.println("Warning: highpass filter disabled. highpass frequency too small\n")),t.highpass2>0){var i=-1;for(r=0;r<=31;r++){(l=r/31)<=t.highpass1&&(s=Math.max(s,r)),t.highpass1t.highpass1?M((t.highpass2-l)/(t.highpass2-t.highpass1+1e-20)):1,_=t.lowpass2>t.lowpass1?M((l-t.lowpass1)/(t.lowpass2-t.lowpass1+1e-20)):1,t.amp_filter[r]=o*_}}(e),T.samplerate_index=w(e.out_samplerate,e),T.samplerate_index<0)return e.internal_flags=null,-1;if(e.VBR==b.vbr_off){if(e.free_format)T.bitrate_index=0;else if(e.brate=R(e.brate,e.version,e.out_samplerate),T.bitrate_index=A(e.brate,e.version,e.out_samplerate),T.bitrate_index<=0)return e.internal_flags=null,-1}else T.bitrate_index=1;e.analysis&&(e.bWriteVbrTag=!1),null!=T.pinfo&&(e.bWriteVbrTag=!1),a.init_bit_stream_w(T);for(var N,D=T.samplerate_index+3*e.version+6*(e.out_samplerate<16e3?1:0),Y=0;Y5&&(e.quality=5),T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?T.sfb21_extra=!1:T.sfb21_extra=e.out_samplerate>44e3,T.iteration_loop=new VBRNewIterationLoop(i);break;case b.vbr_rh:s.apply_preset(e,500-10*e.VBR_q,0),T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?T.sfb21_extra=!1:T.sfb21_extra=e.out_samplerate>44e3,e.quality>6&&(e.quality=6),e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),T.iteration_loop=new VBROldIterationLoop(i);break;default:var F;T.sfb21_extra=!1,e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),(F=e.VBR)==b.vbr_off&&(e.VBR_mean_bitrate_kbps=e.brate),s.apply_preset(e,e.VBR_mean_bitrate_kbps,0),e.VBR=F,T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,F==b.vbr_off?T.iteration_loop=new L(i):T.iteration_loop=new ABRIterationLoop(i)}if(e.VBR!=b.vbr_off){if(T.VBR_min_bitrate=1,T.VBR_max_bitrate=14,e.out_samplerate<16e3&&(T.VBR_max_bitrate=8),0!=e.VBR_min_bitrate_kbps&&(e.VBR_min_bitrate_kbps=R(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),T.VBR_min_bitrate=A(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),T.VBR_min_bitrate<0))return-1;if(0!=e.VBR_max_bitrate_kbps&&(e.VBR_max_bitrate_kbps=R(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),T.VBR_max_bitrate=A(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),T.VBR_max_bitrate<0))return-1;e.VBR_min_bitrate_kbps=B.bitrate_table[e.version][T.VBR_min_bitrate],e.VBR_max_bitrate_kbps=B.bitrate_table[e.version][T.VBR_max_bitrate],e.VBR_mean_bitrate_kbps=Math.min(B.bitrate_table[e.version][T.VBR_max_bitrate],e.VBR_mean_bitrate_kbps),e.VBR_mean_bitrate_kbps=Math.max(B.bitrate_table[e.version][T.VBR_min_bitrate],e.VBR_mean_bitrate_kbps)}return e.tune&&(T.PSY.mask_adjust+=e.tune_value_a,T.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,-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,-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,-1==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=1,t.full_outer_loop=0}}(e),e.athaa_type<0?T.ATH.useAdjust=3:T.ATH.useAdjust=e.athaa_type,T.ATH.aaSensitivityP=Math.pow(10,e.athaa_sensitivity/-10),null==e.short_blocks&&(e.short_blocks=p.short_block_allowed),e.short_blocks!=p.short_block_allowed||e.mode!=d.JOINT_STEREO&&e.mode!=d.STEREO||(e.short_blocks=p.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=G.NSATTACKTHRE),e.internal_flags.nsPsy.attackthre_s<0&&(e.internal_flags.nsPsy.attackthre_s=G.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),T.slot_lag=T.frac_SpF=0,e.VBR==b.vbr_off&&(T.slot_lag=T.frac_SpF=72e3*(e.version+1)*e.brate%e.out_samplerate|0),n.iteration_init(e),u.psymodel_init(e),0},this.lame_encode_flush=function(e,t,s,n){var r,i,o,_,c=e.internal_flags,h=l([2,1152]),u=0,p=c.mf_samples_to_encode-X.POSTDELAY,m=T(e);if(c.mf_samples_to_encode<1)return 0;for(r=0,e.in_samplerate!=e.out_samplerate&&(p+=16*e.out_samplerate/e.in_samplerate),(o=e.framesize-p%e.framesize)<576&&(o+=e.framesize),e.encoder_padding=o,_=(p+o)/e.framesize;_>0&&u>=0;){var b=m-c.mf_size,d=e.frameNum;b*=e.in_samplerate,(b/=e.out_samplerate)>1152&&(b=1152),b<1&&(b=1),i=n-r,0==n&&(i=0),s+=u=this.lame_encode_buffer(e,h[0],h[1],b,t,s,i),r+=u,_-=d!=e.frameNum?1:0}if(c.mf_samples_to_encode=0,u<0)return u;if(i=n-r,0==n&&(i=0),a.flush_bitstream(e),(u=a.copy_buffer(c,t,s,i,1))<0)return u;if(s+=u,i=n-(r+=u),0==n&&(i=0),e.write_id3tag_automatic){if(f.id3tag_write_v1(e),(u=a.copy_buffer(c,t,s,i,0))<0)return u;r+=u}return r},this.lame_encode_buffer=function(e,s,n,i,o,_,l){var f=e.internal_flags,c=[null,null];if(4294479419!=f.Class_ID)return-3;if(0==i)return 0;!function(e,t){(null==e.in_buffer_0||e.in_buffer_nsamples1&&(c[1][h]=n[h]);return function(e,s,n,r,i,o,_){var l,f,c,h,u,p=e.internal_flags,m=0,b=[null,null],d=[null,null];if(4294479419!=p.Class_ID)return-3;if(0==r)return 0;if((u=a.copy_buffer(p,i,o,_,0))<0)return u;if(o+=u,m+=u,d[0]=s,d[1]=n,k.NEQ(e.scale,0)&&k.NEQ(e.scale,1))for(f=0;f0;){var g,M,w=[null,null];w[0]=d[0],w[1]=d[1];var R=new H;if(N(e,b,w,v,r,R),g=R.n_in,M=R.n_out,p.findReplayGain&&!p.decode_on_the_fly&&t.AnalyzeSamples(p.rgdata,b[0],p.mf_size,b[1],p.mf_size,M,p.channels_out)==S.GAIN_ANALYSIS_ERROR)return-6;if(r-=g,v+=g,p.channels_out,p.mf_size+=M,p.mf_samples_to_encode<1&&(p.mf_samples_to_encode=X.ENCDELAY+X.POSTDELAY),p.mf_samples_to_encode+=M,p.mf_size>=h){var A=_-m;if(0==_&&(A=0),(l=x(e,b[0],b[1],i,o,A))<0)return l;for(o+=l,m+=l,p.mf_size-=e.framesize,p.mf_samples_to_encode-=e.framesize,c=0;cy&&(y=t.length,x=a(T=0|1.25*y+7200));var r=n.lame_encode_buffer(B,t,s,t.length,x,0,T);return new Int8Array(x.subarray(0,r))},this.flush=function(){var e=n.lame_encode_flush(B,x,0,T);return new Int8Array(x.subarray(0,e))}}}e(),Recorder.lamejs=e}()},function(e,t){var a,s;a=function(e){return new s(e)},(s=function(e){var t={scale:2,speed:9,phase:21.8,fps:20,keep:!0,lineWidth:3,linear1:[0,"rgba(150,96,238,1)",.2,"rgba(170,79,249,1)",1,"rgba(53,199,253,1)"],linear2:[0,"rgba(209,130,255,0.6)",1,"rgba(53,199,255,0.6)"],linearBg:[0,"rgba(255,255,255,0.2)",1,"rgba(54,197,252,0.2)"]};for(var a in e)t[a]=e[a];this.set=e=t;var s=e.elem;s&&("string"==typeof s?s=document.querySelector(s):s.length&&(s=s[0])),s&&(e.width=s.offsetWidth,e.height=s.offsetHeight);var n=e.scale,r=e.width*n,i=e.height*n;if(!r||!i)throw new Error("WaveView无宽高");var o=this.elem=document.createElement("div"),_=["","transform-origin:0 0;","transform:scale("+1/n+");"];o.innerHTML='
';var l=this.canvas=o.querySelector("canvas"),f=this.ctx=l.getContext("2d");l.width=r,l.height=i,this.linear1=this.genLinear(f,r,e.linear1),this.linear2=this.genLinear(f,r,e.linear2),this.linearBg=this.genLinear(f,i,e.linearBg,!0),s&&(s.innerHTML="",s.appendChild(o)),this._phase=0}).prototype=a.prototype={genLinear:function(e,t,a,s){for(var n=e.createLinearGradient(0,0,s?0:t,s?t:0),r=0;r1300&&(clearInterval(e.timer),e.timer=0)}},draw:function(e){var t=this.set,a=this.ctx,s=t.scale,n=t.width*s,r=t.height*s,i=t.speed/t.fps,o=this._phase-=i,_=o+i*t.phase,l=e/100,f=this.genPath(2,l,o),c=this.genPath(1.8,l,_);a.clearRect(0,0,n,r),a.beginPath();for(var h=0,u=0;u=0;h--,u-=s)a.lineTo(u,c[h]);a.closePath(),a.fillStyle=this.linearBg,a.fill(),this.drawPath(c,this.linear2),this.drawPath(f,this.linear1)},drawPath:function(e,t){var a=this.set,s=this.ctx,n=a.scale,r=a.width*n;s.beginPath();for(var i=0,o=0;o=0&&Math.floor(t)===t&&isFinite(e)}function h(e){return s(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function d(e){return null==e?"":Array.isArray(e)||u(e)&&e.toString===f?JSON.stringify(e,null,2):String(e)}function v(e){var t=parseFloat(e);return isNaN(t)?e:t}function m(e,t){for(var n=Object.create(null),r=e.split(","),a=0;a-1)return e.splice(n,1)}}var w=Object.prototype.hasOwnProperty;function S(e,t){return w.call(e,t)}function x(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var k=/-(\w)/g,M=x((function(e){return e.replace(k,(function(e,t){return t?t.toUpperCase():""}))})),A=x((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),R=/\B([A-Z])/g,T=x((function(e){return e.replace(R,"-$1").toLowerCase()}));var B=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function E(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function C(e,t){for(var n in t)e[n]=t[n];return e}function P(e){for(var t={},n=0;n0,ee=G&&G.indexOf("edge/")>0,te=(G&&G.indexOf("android"),G&&/iphone|ipad|ipod|ios/.test(G)||"ios"===Z),ne=(G&&/chrome\/\d+/.test(G),G&&/phantomjs/.test(G),G&&G.match(/firefox\/(\d+)/)),re={}.watch,ae=!1;if(K)try{var ie={};Object.defineProperty(ie,"passive",{get:function(){ae=!0}}),window.addEventListener("test-passive",null,ie)}catch(e){}var se=function(){return void 0===z&&(z=!K&&!W&&void 0!==e&&(e.process&&"server"===e.process.env.VUE_ENV)),z},oe=K&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function le(e){return"function"==typeof e&&/native code/.test(e.toString())}var ce,fe="undefined"!=typeof Symbol&&le(Symbol)&&"undefined"!=typeof Reflect&&le(Reflect.ownKeys);ce="undefined"!=typeof Set&&le(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ue=O,_e=0,pe=function(){this.id=_e++,this.subs=[]};pe.prototype.addSub=function(e){this.subs.push(e)},pe.prototype.removeSub=function(e){y(this.subs,e)},pe.prototype.depend=function(){pe.target&&pe.target.addDep(this)},pe.prototype.notify=function(){var e=this.subs.slice();for(var t=0,n=e.length;t-1)if(i&&!S(a,"default"))s=!1;else if(""===s||s===T(e)){var l=Ye(String,a.type);(l<0||o0&&(pt((a=e(a,(n||"")+"_"+r))[0])&&pt(f)&&(u[c]=ye(f.text+a[0].text),a.shift()),u.push.apply(u,a)):l(a)?pt(f)?u[c]=ye(f.text+a):""!==a&&u.push(ye(a)):pt(a)&&pt(f)?u[c]=ye(f.text+a.text):(o(t._isVList)&&s(a.tag)&&i(a.key)&&s(n)&&(a.key="__vlist"+n+"_"+r+"__"),u.push(a)));return u}(e):void 0}function pt(e){return s(e)&&s(e.text)&&!1===e.isComment}function ht(e,t){if(e){for(var n=Object.create(null),r=fe?Reflect.ownKeys(e):Object.keys(e),a=0;a0,s=e?!!e.$stable:!i,o=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(s&&n&&n!==a&&o===n.$key&&!i&&!n.$hasNormal)return n;for(var l in r={},e)e[l]&&"$"!==l[0]&&(r[l]=bt(t,l,e[l]))}else r={};for(var c in t)c in r||(r[c]=gt(t,c));return e&&Object.isExtensible(e)&&(e._normalized=r),Y(r,"$stable",s),Y(r,"$key",o),Y(r,"$hasNormal",i),r}function bt(e,t,n){var a=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"===(void 0===e?"undefined":r(e))&&!Array.isArray(e)?[e]:_t(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:a,enumerable:!0,configurable:!0}),a}function gt(e,t){return function(){return e[t]}}function yt(e,t){var n,r,a,i,o;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,a=e.length;rdocument.createEvent("Event").timeStamp&&(un=function(){return _n.now()})}function pn(){var e,t;for(fn=un(),ln=!0,rn.sort((function(e,t){return e.id-t.id})),cn=0;cncn&&rn[n].id>e.id;)n--;rn.splice(n+1,0,e)}else rn.push(e);on||(on=!0,at(pn))}}(this)},dn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||c(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Xe(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},dn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},dn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},dn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||y(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var vn={enumerable:!0,configurable:!0,get:O,set:O};function mn(e,t,n){vn.get=function(){return this[t][n]},vn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,vn)}function bn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},a=e.$options._propKeys=[];e.$parent&&Ae(!1);var i=function(i){a.push(i);var s=Ve(i,t,n,e);Be(r,i,s),i in e||mn(e,"_props",i)};for(var s in t)i(s);Ae(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?O:B(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;u(t=e._data="function"==typeof t?function(e,t){de();try{return e.call(t,t)}catch(e){return Xe(e,t,"data()"),{}}finally{ve()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,a=(e.$options.methods,n.length);for(;a--;){var i=n[a];0,r&&S(r,i)||q(i)||mn(e,"_data",i)}Te(t,!0)}(e):Te(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=se();for(var a in t){var i=t[a],s="function"==typeof i?i:i.get;0,r||(n[a]=new dn(e,s||O,O,gn)),a in e||yn(e,a,i)}}(e,t.computed),t.watch&&t.watch!==re&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var a=0;a-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!_(e)&&e.test(t)}function En(e,t){var n=e.cache,r=e.keys,a=e._vnode;for(var i in n){var s=n[i];if(s){var o=Tn(s.componentOptions);o&&!t(o)&&Cn(n,i,r,a)}}}function Cn(e,t,n,r){var a=e[t];!a||r&&a.tag===r.tag||a.componentInstance.$destroy(),e[t]=null,y(n,t)}!function(e){e.prototype._init=function(e){var t=this;t._uid=kn++,t._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var a=r.componentOptions;n.propsData=a.propsData,n._parentListeners=a.listeners,n._renderChildren=a.children,n._componentTag=a.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(t,e):t.$options=De(Mn(t.constructor),e||{},t),t._renderProxy=t,t._self=t,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(t),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Gt(e,t)}(t),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,r=n&&n.context;e.$slots=dt(t._renderChildren,r),e.$scopedSlots=a,e._c=function(t,n,r,a){return Ft(e,t,n,r,a,!1)},e.$createElement=function(t,n,r,a){return Ft(e,t,n,r,a,!0)};var i=n&&n.data;Be(e,"$attrs",i&&i.attrs||a,null,!0),Be(e,"$listeners",t._parentListeners||a,null,!0)}(t),nn(t,"beforeCreate"),function(e){var t=ht(e.$options.inject,e);t&&(Ae(!1),Object.keys(t).forEach((function(n){Be(e,n,t[n])})),Ae(!0))}(t),bn(t),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(t),nn(t,"created"),t.$options.el&&t.$mount(t.$options.el)}}(An),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Ee,e.prototype.$delete=Ce,e.prototype.$watch=function(e,t,n){if(u(t))return xn(this,e,t,n);(n=n||{}).user=!0;var r=new dn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Xe(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(An),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var a=0,i=e.length;a1?E(n):n;for(var r=E(arguments,1),a='event handler for "'+e+'"',i=0,s=n.length;iparseInt(this.max)&&Cn(s,o[0],o,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return V}};Object.defineProperty(e,"config",t),e.util={warn:ue,extend:C,mergeOptions:De,defineReactive:Be},e.set=Ee,e.delete=Ce,e.nextTick=at,e.observable=function(e){return Te(e),e},e.options=Object.create(null),D.forEach((function(t){e.options[t+"s"]=Object.create(null)})),e.options._base=e,C(e.options.components,On),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=E(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),Rn(e),function(e){D.forEach((function(t){e[t]=function(e,n){return n?("component"===t&&u(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}}))}(e)}(An),Object.defineProperty(An.prototype,"$isServer",{get:se}),Object.defineProperty(An.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(An,"FunctionalRenderContext",{value:It}),An.version="2.6.10";var Ln=m("style,class"),In=m("input,textarea,option,select,progress"),Nn=function(e,t,n){return"value"===n&&In(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Hn=m("contenteditable,draggable,spellcheck"),$n=m("events,caret,typing,plaintext-only"),Dn=m("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),jn="http://www.w3.org/1999/xlink",Vn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Fn=function(e){return Vn(e)?e.slice(6,e.length):""},qn=function(e){return null==e||!1===e};function Yn(e){for(var t=e.data,n=e,r=e;s(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(t=Xn(r.data,t));for(;s(n=n.parent);)n&&n.data&&(t=Xn(t,n.data));return function(e,t){if(s(e)||s(t))return zn(e,Un(t));return""}(t.staticClass,t.class)}function Xn(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:s(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Un(e){return Array.isArray(e)?function(e){for(var t,n="",r=0,a=e.length;r-1?br(e,t,n):Dn(t)?qn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Hn(t)?e.setAttribute(t,function(e,t){return qn(t)||"false"===t?"false":"contenteditable"===e&&$n(t)?t:"true"}(t,n)):Vn(t)?qn(n)?e.removeAttributeNS(jn,Fn(t)):e.setAttributeNS(jn,t,n):br(e,t,n)}function br(e,t,n){if(qn(n))e.removeAttribute(t);else{if(Q&&!J&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){e.addEventListener("input",(function t(n){n.stopImmediatePropagation(),e.removeEventListener("input",t)})),e.__ieph=!0}e.setAttribute(t,n)}}var gr={create:vr,update:vr};function yr(e,t){var n=t.elm,r=t.data,a=e.data;if(!(i(r.staticClass)&&i(r.class)&&(i(a)||i(a.staticClass)&&i(a.class)))){var o=Yn(t),l=n._transitionClasses;s(l)&&(o=zn(o,Un(l))),o!==n._prevClass&&(n.setAttribute("class",o),n._prevClass=o)}}var wr,Sr,xr,kr,Mr,Ar,Rr={create:yr,update:yr},Tr=/[\w).+\-_$\]]/;function Br(e){var t,n,r,a,i,s=!1,o=!1,l=!1,c=!1,f=0,u=0,_=0,p=0;for(r=0;r=0&&" "===(d=e.charAt(h));h--);d&&Tr.test(d)||(c=!0)}}else void 0===a?(p=r+1,a=e.slice(0,r).trim()):v();function v(){(i||(i=[])).push(e.slice(p,r).trim()),p=r+1}if(void 0===a?a=e.slice(0,r).trim():0!==p&&v(),i)for(r=0;r-1?{exp:e.slice(0,kr),key:'"'+e.slice(kr+1)+'"'}:{exp:e,key:null};Sr=e,kr=Mr=Ar=0;for(;!zr();)Ur(xr=Xr())?Wr(xr):91===xr&&Kr(xr);return{exp:e.slice(0,Mr),key:e.slice(Mr+1,Ar)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Xr(){return Sr.charCodeAt(++kr)}function zr(){return kr>=wr}function Ur(e){return 34===e||39===e}function Kr(e){var t=1;for(Mr=kr;!zr();)if(Ur(e=Xr()))Wr(e);else if(91===e&&t++,93===e&&t--,0===t){Ar=kr;break}}function Wr(e){for(var t=e;!zr()&&(e=Xr())!==t;);}var Zr;function Gr(e,t,n){var r=Zr;return function a(){var i=t.apply(null,arguments);null!==i&&ea(e,a,n,r)}}var Qr=Ze&&!(ne&&Number(ne[1])<=53);function Jr(e,t,n,r){if(Qr){var a=fn,i=t;t=i._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=a||e.timeStamp<=0||e.target.ownerDocument!==document)return i.apply(this,arguments)}}Zr.addEventListener(e,t,ae?{capture:n,passive:r}:n)}function ea(e,t,n,r){(r||Zr).removeEventListener(e,t._wrapper||t,n)}function ta(e,t){if(!i(e.data.on)||!i(t.data.on)){var n=t.data.on||{},r=e.data.on||{};Zr=t.elm,function(e){if(s(e.__r)){var t=Q?"change":"input";e[t]=[].concat(e.__r,e[t]||[]),delete e.__r}s(e.__c)&&(e.change=[].concat(e.__c,e.change||[]),delete e.__c)}(n),ct(n,r,Jr,ea,Gr,t.context),Zr=void 0}}var na,ra={create:ta,update:ta};function aa(e,t){if(!i(e.data.domProps)||!i(t.data.domProps)){var n,r,a=t.elm,o=e.data.domProps||{},l=t.data.domProps||{};for(n in s(l.__ob__)&&(l=t.data.domProps=C({},l)),o)n in l||(a[n]="");for(n in l){if(r=l[n],"textContent"===n||"innerHTML"===n){if(t.children&&(t.children.length=0),r===o[n])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===n&&"PROGRESS"!==a.tagName){a._value=r;var c=i(r)?"":String(r);ia(a,c)&&(a.value=c)}else if("innerHTML"===n&&Zn(a.tagName)&&i(a.innerHTML)){(na=na||document.createElement("div")).innerHTML=""+r+"";for(var f=na.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;f.firstChild;)a.appendChild(f.firstChild)}else if(r!==o[n])try{a[n]=r}catch(e){}}}}function ia(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var n=e.value,r=e._vModifiers;if(s(r)){if(r.number)return v(n)!==v(t);if(r.trim)return n.trim()!==t.trim()}return n!==t}(e,t))}var sa={create:aa,update:aa},oa=x((function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach((function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}})),t}));function la(e){var t=ca(e.style);return e.staticStyle?C(e.staticStyle,t):t}function ca(e){return Array.isArray(e)?P(e):"string"==typeof e?oa(e):e}var fa,ua=/^--/,_a=/\s*!important$/,pa=function(e,t,n){if(ua.test(t))e.style.setProperty(t,n);else if(_a.test(n))e.style.setProperty(T(t),n.replace(_a,""),"important");else{var r=da(t);if(Array.isArray(n))for(var a=0,i=n.length;a-1?t.split(ba).forEach((function(t){return e.classList.add(t)})):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function ya(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(ba).forEach((function(t){return e.classList.remove(t)})):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function wa(e){if(e){if("object"===(void 0===e?"undefined":r(e))){var t={};return!1!==e.css&&C(t,Sa(e.name||"v")),C(t,e),t}return"string"==typeof e?Sa(e):void 0}}var Sa=x((function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}})),xa=K&&!J,ka="transition",Ma="transitionend",Aa="animation",Ra="animationend";xa&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ka="WebkitTransition",Ma="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Aa="WebkitAnimation",Ra="webkitAnimationEnd"));var Ta=K?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ba(e){Ta((function(){Ta(e)}))}function Ea(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),ga(e,t))}function Ca(e,t){e._transitionClasses&&y(e._transitionClasses,t),ya(e,t)}function Pa(e,t,n){var r=La(e,t),a=r.type,i=r.timeout,s=r.propCount;if(!a)return n();var o="transition"===a?Ma:Ra,l=0,c=function(){e.removeEventListener(o,f),n()},f=function(t){t.target===e&&++l>=s&&c()};setTimeout((function(){l0&&(n="transition",f=s,u=i.length):"animation"===t?c>0&&(n="animation",f=c,u=l.length):u=(n=(f=Math.max(s,c))>0?s>c?"transition":"animation":null)?"transition"===n?i.length:l.length:0,{type:n,timeout:f,propCount:u,hasTransform:"transition"===n&&Oa.test(r[ka+"Property"])}}function Ia(e,t){for(;e.length1}function Va(e,t){!0!==t.data.show&&Ha(t)}var Fa=function(e){var t,n,r={},a=e.modules,c=e.nodeOps;for(t=0;th?g(e,i(n[m+1])?null:n[m+1].elm,n,p,m,r):p>m&&w(0,t,_,h)}(_,v,m,n,f):s(m)?(s(e.text)&&c.setTextContent(_,""),g(_,null,m,0,m.length-1,n)):s(v)?w(0,v,0,v.length-1):s(e.text)&&c.setTextContent(_,""):e.text!==t.text&&c.setTextContent(_,t.text),s(h)&&s(p=h.hook)&&s(p=p.postpatch)&&p(e,t)}}}function M(e,t,n){if(o(n)&&s(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r-1,s.selected!==i&&(s.selected=i);else if(N(Ua(s),r))return void(e.selectedIndex!==o&&(e.selectedIndex=o));a||(e.selectedIndex=-1)}}function za(e,t){return t.every((function(t){return!N(t,e)}))}function Ua(e){return"_value"in e?e._value:e.value}function Ka(e){e.target.composing=!0}function Wa(e){e.target.composing&&(e.target.composing=!1,Za(e.target,"input"))}function Za(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Ga(e){return!e.componentInstance||e.data&&e.data.transition?e:Ga(e.componentInstance._vnode)}var Qa={model:qa,show:{bind:function(e,t,n){var r=t.value,a=(n=Ga(n)).data&&n.data.transition,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&a?(n.data.show=!0,Ha(n,(function(){e.style.display=i}))):e.style.display=r?i:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Ga(n)).data&&n.data.transition?(n.data.show=!0,r?Ha(n,(function(){e.style.display=e.__vOriginalDisplay})):$a(n,(function(){e.style.display="none"}))):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,a){a||(e.style.display=e.__vOriginalDisplay)}}},Ja={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ei(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?ei(Ut(t.children)):e}function ti(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var a=n._parentListeners;for(var i in a)t[M(i)]=a[i];return t}function ni(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var ri=function(e){return e.tag||zt(e)},ai=function(e){return"show"===e.name},ii={name:"transition",props:Ja,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(ri)).length){0;var r=this.mode;0;var a=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return a;var i=ei(a);if(!i)return a;if(this._leaving)return ni(e,a);var s="__transition-"+this._uid+"-";i.key=null==i.key?i.isComment?s+"comment":s+i.tag:l(i.key)?0===String(i.key).indexOf(s)?i.key:s+i.key:i.key;var o=(i.data||(i.data={})).transition=ti(this),c=this._vnode,f=ei(c);if(i.data.directives&&i.data.directives.some(ai)&&(i.data.show=!0),f&&f.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(i,f)&&!zt(f)&&(!f.componentInstance||!f.componentInstance._vnode.isComment)){var u=f.data.transition=C({},o);if("out-in"===r)return this._leaving=!0,ft(u,"afterLeave",(function(){t._leaving=!1,t.$forceUpdate()})),ni(e,a);if("in-out"===r){if(zt(i))return c;var _,p=function(){_()};ft(o,"afterEnter",p),ft(o,"enterCancelled",p),ft(u,"delayLeave",(function(e){_=e}))}}return a}}},si=C({tag:String,moveClass:String},Ja);function oi(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function li(e){e.data.newPos=e.elm.getBoundingClientRect()}function ci(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,a=t.top-n.top;if(r||a){e.data.moved=!0;var i=e.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+a+"px)",i.transitionDuration="0s"}}delete si.mode;var fi={Transition:ii,TransitionGroup:{props:si,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var a=Jt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,a(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,a=this.$slots.default||[],i=this.children=[],s=ti(this),o=0;o-1?Jn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Jn[e]=/HTMLUnknownElement/.test(t.toString())},C(An.options.directives,Qa),C(An.options.components,fi),An.prototype.__patch__=K?Fa:O,An.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=ge),nn(e,"beforeMount"),r=function(){e._update(e._render(),n)},new dn(e,r,O,{before:function(){e._isMounted&&!e._isDestroyed&&nn(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,nn(e,"mounted")),e}(this,e=e&&K?tr(e):void 0,t)},K&&setTimeout((function(){V.devtools&&oe&&oe.emit("init",An)}),0);var ui=/\{\{((?:.|\r?\n)+?)\}\}/g,_i=/[-.*+?^${}()|[\]\/\\]/g,pi=x((function(e){var t=e[0].replace(_i,"\\$&"),n=e[1].replace(_i,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")}));var hi={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=jr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Dr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var di,vi={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=jr(e,"style");n&&(e.staticStyle=JSON.stringify(oa(n)));var r=Dr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},mi=function(e){return(di=di||document.createElement("div")).innerHTML=e,di.textContent},bi=m("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),gi=m("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),yi=m("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),wi=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Si=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,xi="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+F.source+"]*",ki="((?:"+xi+"\\:)?"+xi+")",Mi=new RegExp("^<"+ki),Ai=/^\s*(\/?)>/,Ri=new RegExp("^<\\/"+ki+"[^>]*>"),Ti=/^]+>/i,Bi=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Li=/&(?:lt|gt|quot|amp|#39);/g,Ii=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ni=m("pre,textarea",!0),Hi=function(e,t){return e&&Ni(e)&&"\n"===t[0]};function $i(e,t){var n=t?Ii:Li;return e.replace(n,(function(e){return Oi[e]}))}var Di,ji,Vi,Fi,qi,Yi,Xi,zi,Ui=/^@|^v-on:/,Ki=/^v-|^@|^:/,Wi=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Zi=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Gi=/^\(|\)$/g,Qi=/^\[.*\]$/,Ji=/:(.*)$/,es=/^:|^\.|^v-bind:/,ts=/\.[^.\]]+(?=[^\]]*$)/g,ns=/^v-slot(:|$)|^#/,rs=/[\r\n]/,as=/\s+/g,is=x(mi);function ss(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:ps(t),rawAttrsMap:{},parent:n,children:[]}}function os(e,t){Di=t.warn||Cr,Yi=t.isPreTag||L,Xi=t.mustUseProp||L,zi=t.getTagNamespace||L;var n=t.isReservedTag||L;(function(e){return!!e.component||!n(e.tag)}),Vi=Pr(t.modules,"transformNode"),Fi=Pr(t.modules,"preTransformNode"),qi=Pr(t.modules,"postTransformNode"),ji=t.delimiters;var r,a,i=[],s=!1!==t.preserveWhitespace,o=t.whitespace,l=!1,c=!1;function f(e){if(u(e),l||e.processed||(e=ls(e,t)),i.length||e===r||r.if&&(e.elseif||e.else)&&fs(r,{exp:e.elseif,block:e}),a&&!e.forbidden)if(e.elseif||e.else)s=e,(o=function(e){for(var t=e.length;t--;){if(1===e[t].type)return e[t];e.pop()}}(a.children))&&o.if&&fs(o,{exp:s.elseif,block:s});else{if(e.slotScope){var n=e.slotTarget||'"default"';(a.scopedSlots||(a.scopedSlots={}))[n]=e}a.children.push(e),e.parent=a}var s,o;e.children=e.children.filter((function(e){return!e.slotScope})),u(e),e.pre&&(l=!1),Yi(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),_=e.replace(u,(function(e,n,r){return c=r.length,Ci(f)||"noscript"===f||(n=n.replace(//g,"$1").replace(//g,"$1")),Hi(f,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""}));l+=e.length-_.length,e=_,A(f,l-c,l)}else{var p=e.indexOf("<");if(0===p){if(Bi.test(e)){var h=e.indexOf("--\x3e");if(h>=0){t.shouldKeepComment&&t.comment(e.substring(4,h),l,l+h+3),x(h+3);continue}}if(Ei.test(e)){var d=e.indexOf("]>");if(d>=0){x(d+2);continue}}var v=e.match(Ti);if(v){x(v[0].length);continue}var m=e.match(Ri);if(m){var b=l;x(m[0].length),A(m[1],b,l);continue}var g=k();if(g){M(g),Hi(g.tagName,e)&&x(1);continue}}var y=void 0,w=void 0,S=void 0;if(p>=0){for(w=e.slice(p);!(Ri.test(w)||Mi.test(w)||Bi.test(w)||Ei.test(w)||(S=w.indexOf("<",1))<0);)p+=S,w=e.slice(p);y=e.substring(0,p)}p<0&&(y=e),y&&x(y.length),t.chars&&y&&t.chars(y,l-y.length,l)}if(e===n){t.chars&&t.chars(e);break}}function x(t){l+=t,e=e.substring(t)}function k(){var t=e.match(Mi);if(t){var n,r,a={tagName:t[1],attrs:[],start:l};for(x(t[0].length);!(n=e.match(Ai))&&(r=e.match(Si)||e.match(wi));)r.start=l,x(r[0].length),r.end=l,a.attrs.push(r);if(n)return a.unarySlash=n[1],x(n[0].length),a.end=l,a}}function M(e){var n=e.tagName,l=e.unarySlash;i&&("p"===r&&yi(n)&&A(r),o(n)&&r===n&&A(n));for(var c=s(n)||!!l,f=e.attrs.length,u=new Array(f),_=0;_=0&&a[s].lowerCasedTag!==o;s--);else s=0;if(s>=0){for(var c=a.length-1;c>=s;c--)t.end&&t.end(a[c].tag,n,i);a.length=s,r=s&&a[s-1].tag}else"br"===o?t.start&&t.start(e,[],!0,n,i):"p"===o&&(t.start&&t.start(e,[],!1,n,i),t.end&&t.end(e,n,i))}A()}(e,{warn:Di,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,n,s,o,u){var _=a&&a.ns||zi(e);Q&&"svg"===_&&(n=function(e){for(var t=[],n=0;nl&&(o.push(i=e.slice(l,a)),s.push(JSON.stringify(i)));var c=Br(r[1].trim());s.push("_s("+c+")"),o.push({"@binding":c}),l=a+r[0].length}return l-1"+("true"===i?":("+t+")":":_q("+t+","+i+")")),$r(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+i+"):("+s+");if(Array.isArray($$a)){var $$v="+(r?"_n("+a+")":a)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Yr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Yr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Yr(t,"$$c")+"}",null,!0)}(e,r,a);else if("input"===i&&"radio"===s)!function(e,t,n){var r=n&&n.number,a=Dr(e,"value")||"null";Or(e,"checked","_q("+t+","+(a=r?"_n("+a+")":a)+")"),$r(e,"change",Yr(t,a),null,!0)}(e,r,a);else if("input"===i||"textarea"===i)!function(e,t,n){var r=e.attrsMap.type;0;var a=n||{},i=a.lazy,s=a.number,o=a.trim,l=!i&&"range"!==r,c=i?"change":"range"===r?"__r":"input",f="$event.target.value";o&&(f="$event.target.value.trim()");s&&(f="_n("+f+")");var u=Yr(t,f);l&&(u="if($event.target.composing)return;"+u);Or(e,"value","("+t+")"),$r(e,c,u,null,!0),(o||s)&&$r(e,"blur","$forceUpdate()")}(e,r,a);else{if(!V.isReservedTag(i))return qr(e,r,a),!1}return!0},text:function(e,t){t.value&&Or(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Or(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:bi,mustUseProp:Nn,canBeLeftOpenTag:gi,isReservedTag:Gn,getTagNamespace:Qn,staticKeys:function(e){return e.reduce((function(e,t){return e.concat(t.staticKeys||[])}),[]).join(",")}(ms)},ws=x((function(e){return m("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))}));function Ss(e,t){e&&(bs=ws(t.staticKeys||""),gs=t.isReservedTag||L,function e(t){if(t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||b(e.tag)||!gs(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(bs)))}(t),1===t.type){if(!gs(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function\s*(?:[\w$]+)?\s*\(/,ks=/\([^)]*?\);*$/,Ms=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,As={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Rs={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Ts=function(e){return"if("+e+")return null;"},Bs={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Ts("$event.target !== $event.currentTarget"),ctrl:Ts("!$event.ctrlKey"),shift:Ts("!$event.shiftKey"),alt:Ts("!$event.altKey"),meta:Ts("!$event.metaKey"),left:Ts("'button' in $event && $event.button !== 0"),middle:Ts("'button' in $event && $event.button !== 1"),right:Ts("'button' in $event && $event.button !== 2")};function Es(e,t){var n=t?"nativeOn:":"on:",r="",a="";for(var i in e){var s=Cs(e[i]);e[i]&&e[i].dynamic?a+=i+","+s+",":r+='"'+i+'":'+s+","}return r="{"+r.slice(0,-1)+"}",a?n+"_d("+r+",["+a.slice(0,-1)+"])":n+r}function Cs(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map((function(e){return Cs(e)})).join(",")+"]";var t=Ms.test(e.value),n=xs.test(e.value),r=Ms.test(e.value.replace(ks,""));if(e.modifiers){var a="",i="",s=[];for(var o in e.modifiers)if(Bs[o])i+=Bs[o],As[o]&&s.push(o);else if("exact"===o){var l=e.modifiers;i+=Ts(["ctrl","shift","alt","meta"].filter((function(e){return!l[e]})).map((function(e){return"$event."+e+"Key"})).join("||"))}else s.push(o);return s.length&&(a+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(Ps).join("&&")+")return null;"}(s)),i&&(a+=i),"function($event){"+a+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ps(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=As[e],r=Rs[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Os={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:O},Ls=function(e){this.options=e,this.warn=e.warn||Cr,this.transforms=Pr(e.modules,"transformCode"),this.dataGenFns=Pr(e.modules,"genData"),this.directives=C(C({},Os),e.directives);var t=e.isReservedTag||L;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Is(e,t){var n=new Ls(t);return{render:"with(this){return "+(e?Ns(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ns(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Hs(e,t);if(e.once&&!e.onceProcessed)return $s(e,t);if(e.for&&!e.forProcessed)return js(e,t);if(e.if&&!e.ifProcessed)return Ds(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Ys(e,t),a="_t("+n+(r?","+r:""),i=e.attrs||e.dynamicAttrs?Us((e.attrs||[]).concat(e.dynamicAttrs||[]).map((function(e){return{name:M(e.name),value:e.value,dynamic:e.dynamic}}))):null,s=e.attrsMap["v-bind"];!i&&!s||r||(a+=",null");i&&(a+=","+i);s&&(a+=(i?"":",null")+","+s);return a+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Ys(t,n,!0);return"_c("+e+","+Vs(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Vs(e,t));var a=e.inlineTemplate?null:Ys(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(a?","+a:"")+")"}for(var i=0;i>>0}(s):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var i=function(e,t){var n=e.children[0];0;if(n&&1===n.type){var r=Is(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map((function(e){return"function(){"+e+"}"})).join(",")+"]}"}}(e,t);i&&(n+=i+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Us(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Fs(e){return 1===e.type&&("slot"===e.tag||e.children.some(Fs))}function qs(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Ds(e,t,qs,"null");if(e.for&&!e.forProcessed)return js(e,t,qs);var r="_empty_"===e.slotScope?"":String(e.slotScope),a="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(Ys(e,t)||"undefined")+":undefined":Ys(e,t)||"undefined":Ns(e,t))+"}",i=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+a+i+"}"}function Ys(e,t,n,r,a){var i=e.children;if(i.length){var s=i[0];if(1===i.length&&s.for&&"template"!==s.tag&&"slot"!==s.tag){var o=n?t.maybeComponent(s)?",1":",0":"";return""+(r||Ns)(s,t)+o}var l=n?function(e,t){for(var n=0,r=0;r':'
',Qs.innerHTML.indexOf(" ")>0}var no=!!K&&to(!1),ro=!!K&&to(!0),ao=x((function(e){var t=tr(e);return t&&t.innerHTML})),io=An.prototype.$mount;An.prototype.$mount=function(e,t){if((e=e&&tr(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=ao(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){0;var a=eo(r,{outputSourceRange:!1,shouldDecodeNewlines:no,shouldDecodeNewlinesForHref:ro,delimiters:n.delimiters,comments:n.comments},this),i=a.render,s=a.staticRenderFns;n.render=i,n.staticRenderFns=s}}return io.call(this,e,t)},An.compile=eo,t.default=An}).call(this,n(0),n(10).setImmediate)},function(e,t,n){"use strict";(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,a=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(a.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(a.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(11),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||void 0,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||void 0}).call(this,n(0))},function(e,t,n){"use strict";(function(e,t){!function(e,n){if(!e.setImmediate){var r,a,i,s,o,l=1,c={},f=!1,u=e.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(e);_=_&&_.setTimeout?_:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){h(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){h(e.data)},r=function(e){i.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(a=u.documentElement,r=function(e){var t=u.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,a.removeChild(t),t=null},a.appendChild(t)}):r=function(e){setTimeout(h,0,e)}:(s="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&h(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),r=function(t){e.postMessage(s+t,"*")}),_.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n1)for(var n=1;nf+1&&c("SampleData似乎传入了未重置chunk "+i+">"+f,3);for(var u=0,_=i;_1?u=Math.floor(u/p):(p=1,n=t),u+=o.length;var h=new Int16Array(u),d=0;for(_=0;_0){var k=2*(h.length-x);o=new Int16Array(h.buffer.slice(k)),h=new Int16Array(h.buffer.slice(0,k))}return{index:i,offset:s,frameNext:o,sampleRate:n,data:h}},n.PowerLevel=function(e,t){var n=e/t||0;return n<1251?Math.round(n/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(n/1e4)/Math.log(10)))))};var c=function(t,n){var a=new Date,i=("0"+a.getMinutes()).substr(-2)+":"+("0"+a.getSeconds()).substr(-2)+"."+("00"+a.getMilliseconds()).substr(-3),s=this&&this.envIn&&this.envCheck&&this.id,o=["["+i+" "+r+(s?":"+s:"")+"]"+t],l=arguments,c=e.console||{},u=2,_=c.log;for("number"==typeof n?_=1==n?c.error:3==n?c.warn:_:u=1;u1?o:""):_.apply(c,o)},f=!0;try{f=!console.log.apply}catch(e){}n.CLog=c;var u=0;function _(e){this.id=++u,b();var n={type:"mp3",bitRate:16,sampleRate:16e3,onProcess:t};for(var r in e)n[r]=e[r];this.set=n,this._S=9,this.Sync={O:9,C:9}}n.Sync={O:9,C:9},n.prototype=_.prototype={CLog:c,_streamStore:function(){return this.set.sourceStream?this:n},open:function(r,a){var s=this,o=s._streamStore();r=r||t;var c=function(e,t){t=!!t,s.CLog("录音open失败:"+e+",isUserNotAllow:"+t,1),a&&a(e,t)},f=function(){s.CLog("open ok id:"+s.id),r(),s._SO=0},u=o.Sync,_=++u.O,p=u.C;s._O=s._O_=_,s._SO=s._S;var h=s.envCheck({envName:"H5",canProcess:!0});if(h)c("不能录音:"+h);else if(s.set.sourceStream){if(!n.Support())return void c("不支持此浏览器从流中获取录音");l(o),s.Stream=s.set.sourceStream,s.Stream._call={};try{i(o)}catch(e){return void c("从流中打开录音失败:"+e.message)}f()}else{var d=function(t,n){try{e.top.a}catch(e){return void c('无权录音(跨域,请尝试给iframe添加麦克风访问策略,如allow="camera;microphone")')}/Permission|Allow/i.test(t)?c("用户拒绝了录音权限",!0):!1===e.isSecureContext?c("浏览器禁止不安全页面录音,可开启https解决"):/Found/i.test(t)?c(n+",无可用麦克风"):c(n)};if(n.IsOpen())f();else if(n.Support()){var v=function(e){setTimeout((function(){e._call={};var t=n.Stream;t&&(l(),e._call=t._call),n.Stream=e,function(){if(p!=u.C||!s._O){var e="open被取消";return _==u.O?s.close():e="open被中断",c(e),!0}}()||(n.IsOpen()?(t&&s.CLog("发现同时多次调用open",1),i(o,1),f()):c("录音功能无效:无音频流"))}),100)},m=function(e){var t=e.name||e.message||e.code+":"+e;s.CLog("请求录音权限错误",1,e),d(t,"无法录音:"+t)},b={noiseSuppression:!1,echoCancellation:!1},g=s.set.audioTrackSet;for(var y in g)b[y]=g[y];b.sampleRate=n.Ctx.sampleRate;try{var w=n.Scope.getUserMedia({audio:b},v,m)}catch(e){s.CLog("getUserMedia",3,e),w=n.Scope.getUserMedia({audio:!0},v,m)}w&&w.then&&w.then(v)[r&&"catch"](m)}else d("","此浏览器不支持录音")}},close:function(e){e=e||t;var n=this._streamStore();this._stop();var r=n.Sync;if(this._O=0,this._O_!=r.O)return this.CLog("close被忽略(因为同时open了多个rec,只有最后一个会真正close)",3),void e();r.C++,l(n),this.CLog("close"),e()},mock:function(e,t){return this._stop(),this.isMock=1,this.mockEnvInfo=null,this.buffers=[e],this.recSize=e.length,this.srcSampleRate=t,this},envCheck:function(t){var r,a=this.set,i="CPU_BE";if(r||n[i]||!e.Int8Array||new Int8Array(new Int32Array([1]).buffer)[0]||(b(i),r="不支持CPU_BE架构"),!r){var s=a.type;this[s+"_envCheck"]?r=this[s+"_envCheck"](t,a):a.takeoffEncodeChunk&&(r=s+"类型"+(this[s]?"":"(未加载编码器)")+"不支持设置takeoffEncodeChunk")}return r||""},envStart:function(e,t){var n=this.set;this.isMock=e?1:0,this.mockEnvInfo=e,this.buffers=[],this.recSize=0,this.envInLast=0,this.envInFirst=0,this.envInFix=0,this.envInFixTs=[];var r=n.sampleRate;if(r>t?n.sampleRate=t:r=0,this.srcSampleRate=t,this.CLog("srcSampleRate: "+t+" set.sampleRate: "+n.sampleRate+(r?" 忽略"+r:""),r?3:0),this.engineCtx=0,this[n.type+"_start"]){var a=this.engineCtx=this[n.type+"_start"](n);a&&(a.pcmDatas=[],a.pcmSize=0)}},envResume:function(){this.envInFixTs=[]},envIn:function(e,t){var r=this,a=r.set,i=r.engineCtx,s=r.srcSampleRate,o=e.length,l=n.PowerLevel(t,o),c=r.buffers,f=c.length;c.push(e);var u=c,_=f,p=Date.now(),h=Math.round(o/s*1e3);r.envInLast=p,1==r.buffers.length&&(r.envInFirst=p-h);var d=r.envInFixTs;d.splice(0,0,{t:p,d:h});for(var v=p,m=0,b=0;b3e3){d.length=b;break}v=g.t,m+=g.d}var y=d[1],w=p-v;if(w-m>w/3&&(y&&w>1e3||d.length>=6)){var S=p-y.t-h;if(S>h/5){var x=!a.disableEnvInFix;if(r.CLog("["+p+"]"+(x?"":"未")+"补偿"+S+"ms",3),r.envInFix+=S,x){var k=new Int16Array(S*s/1e3);o+=k.length,c.push(k)}}}var M=r.recSize,A=o,R=M+A;if(r.recSize=R,i){var T=n.SampleData(c,s,a.sampleRate,i.chunkInfo);i.chunkInfo=T,R=(M=i.pcmSize)+(A=T.data.length),i.pcmSize=R,c=i.pcmDatas,f=c.length,c.push(T.data),s=T.sampleRate}var B=Math.round(R/s*1e3),E=c.length,C=u.length,P=function(){for(var e=O?0:-A,t=null==c[0],n=f;n10&&r.envInFirst-p>1e3&&r.CLog("rec.set.onProcess低性能,耗时"+L+"ms",3),!0===O){var I=0;for(b=f;b"+b.length+" 花:"+(Date.now()-a)+"ms"),setTimeout((function(){a=Date.now(),i[s.type](b,(function(e){u(e,v)}),(function(e){f(e)}))}))}else f("未加载"+s.type+"编码器");else f("音频buffers被释放");else f("未采集到录音")}},e[r]&&(c("重复引入"+r,3),e[r].Destroy()),e[r]=n;var p=function(e,t){t.pos||(t.pos=[0],t.tracks={},t.bytes=[]);var n=t.tracks,r=[t.pos[0]],a=function(){t.pos[0]=r[0]},i=t.bytes.length,s=new Uint8Array(i+e.length);if(s.set(t.bytes),s.set(e,i),t.bytes=s,!t._ht){if(v(s,r),m(s,r),!h(v(s,r),[24,83,128,103]))return;for(v(s,r);r[0]1){var I=[];for(M=0;M=e.length)){var a=("0000000"+e[r].toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(a);if(i){var s=i[1].length,o=[];if(!(r+s>e.length)){for(var l=0;le.length)return;for(var s=0;s
';var c=this.canvas=o.querySelector("canvas"),f=this.ctx=c.getContext("2d");c.width=i,c.height=s,this.linear1=this.genLinear(f,i,e.linear1),this.linear2=this.genLinear(f,i,e.linear2),this.linearBg=this.genLinear(f,s,e.linearBg,!0),r&&(r.innerHTML="",r.appendChild(o)),this._phase=0}).prototype=r.prototype={genLinear:function(e,t,n,r){for(var a=e.createLinearGradient(0,0,r?0:t,r?t:0),i=0;i1300&&(clearInterval(e.timer),e.timer=0)}},draw:function(e){var t=this.set,n=this.ctx,r=t.scale,a=t.width*r,i=t.height*r,s=t.speed/t.fps,o=this._phase-=s,l=o+s*t.phase,c=e/100,f=this.genPath(2,c,o),u=this.genPath(1.8,c,l);n.clearRect(0,0,a,i),n.beginPath();for(var _=0,p=0;p=0;_--,p-=r)n.lineTo(p,u[_]);n.closePath(),n.fillStyle=this.linearBg,n.fill(),this.drawPath(u,this.linear2),this.drawPath(f,this.linear1)},drawPath:function(e,t){var n=this.set,r=this.ctx,a=n.scale,i=n.width*a;r.beginPath();for(var s=0,o=0;o\n \n\n \n\n '});window.vue_vue=r.default,window.vue_root=s,window.vue_main=s.$refs.mainView,console.log("Vue",r.default),console.log("Recorder",vue_main.Rec)},function(e,t,n){"use strict";n.r(t);var r=n(17),a=n(3);for(var i in a)"default"!==i&&function(e){n.d(t,e,(function(){return a[e]}))}(i);n(23);var s=n(1),o=Object(s.a)(a.default,r.a,r.b,!1,null,null,null);o.options.__file="component/recorder.vue",t.default=o.exports},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){var e;Recorder.prototype.enc_mp3={stable:!0,testmsg:"采样率范围48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000"},Recorder.prototype.mp3=function(e,t,n){var r=this.set,s=e.length,o=this.mp3_start(r);if(o)return this.mp3_encode(o,e),void this.mp3_complete(o,t,n,1);var l=new Recorder.lamejs.Mp3Encoder(1,r.sampleRate,r.bitRate),c=[],f=0,u=0;!function n(){if(f0&&(u+=o.buffer.byteLength,c.push(o.buffer)),f+=57600,setTimeout(n)}else{var o;(o=l.flush()).length>0&&(u+=o.buffer.byteLength,c.push(o.buffer));var _=a.fn(c,u,s,r.sampleRate);i(_,r),t(new Blob(c,{type:"audio/mp3"}))}}()},Recorder.BindDestroy("mp3Worker",(function(){console.log("mp3Worker Destroy"),e&&e.terminate(),e=null})),Recorder.prototype.mp3_envCheck=function(e,t){var r="";return t.takeoffEncodeChunk&&(e.canProcess?n()||(r="当前浏览器版本太低,无法实时处理"):r=e.envName+"环境不支持实时处理"),r},Recorder.prototype.mp3_start=function(e){return n(e)};var t={id:0},n=function(n){var r=e;try{if(!r){var i=");wk_lame();var wk_ctxs={};self.onmessage="+function(e){var t=e.data,n=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(!n)return;switch(t.action){case"stop":n.encObj=null,delete wk_ctxs[t.id];break;case"encode":n.pcmSize+=t.pcm.length,(r=n.encObj.encodeBuffer(t.pcm)).length>0&&(n.takeoff?self.postMessage({action:"takeoff",id:t.id,chunk:r}):(n.mp3Size+=r.buffer.byteLength,n.encArr.push(r.buffer)));break;case"complete":var r;(r=n.encObj.flush()).length>0&&(n.takeoff?self.postMessage({action:"takeoff",id:t.id,chunk:r}):(n.mp3Size+=r.buffer.byteLength,n.encArr.push(r.buffer)));var a=wk_mp3TrimFix.fn(n.encArr,n.mp3Size,n.pcmSize,n.sampleRate);self.postMessage({action:t.action,id:t.id,blob:new Blob(n.encArr,{type:"audio/mp3"}),meta:a})}};i+=";var wk_mp3TrimFix={rm:"+a.rm+",fn:"+a.fn+"}";var s=Recorder.lamejs.toString(),o=(window.URL||webkitURL).createObjectURL(new Blob(["var wk_lame=(",s,i],{type:"text/javascript"}));r=new Worker(o),setTimeout((function(){(window.URL||webkitURL).revokeObjectURL(o)}),1e4),r.onmessage=function(e){var n=e.data,r=t[n.id];r&&("takeoff"==n.action?r.set.takeoffEncodeChunk(new Uint8Array(n.chunk.buffer)):(r.call&&r.call(n),r.call=null))}}var l={worker:r,set:n,takeoffQueue:[]};return n?(l.id=++t.id,t[l.id]=l,r.postMessage({action:"init",id:l.id,sampleRate:n.sampleRate,bitRate:n.bitRate,takeoff:!!n.takeoffEncodeChunk,x:new Int16Array(5)})):r.postMessage({x:new Int16Array(5)}),e=r,l}catch(e){return r&&r.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 t[e.id];var n=-1;for(var r in t)n++;n&&console.warn("mp3 worker剩"+n+"个在串行等待")}},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(e,t,n,r){var a=this;e&&e.worker?(e.call=function(n){i(n.meta,e.set),t(n.blob),r&&a.mp3_stop(e)},e.worker.postMessage({action:"complete",id:e.id})):n("mp3编码器未打开")},Recorder.mp3ReadMeta=function(e,t){var n="object"==("undefined"==typeof window?"undefined":r(window))?window.parseInt:self.parseInt,a=new Uint8Array(e[0]||[]);if(a.length<4)return null;var i=function(e,t){return("0000000"+((t||a)[e]||0).toString(2)).substr(-8)},s=i(0)+i(1),o=i(2)+i(3);if(!/^1{11}/.test(s))return null;var l={"00":2.5,10:2,11:1}[s.substr(11,2)],c={"01":3}[s.substr(13,2)],f={1:[44100,48e3,32e3],2:[22050,24e3,16e3],2.5:[11025,12e3,8e3]}[l];f&&(f=f[n(o.substr(4,2),2)]);var u=[[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==l?1:0][n(o.substr(0,4),2)];if(!(l&&c&&u&&f))return null;for(var _=Math.round(8*t/u),p=1==c?384:2==c||1==l?1152:576,h=p/f*1e3,d=Math.floor(p*u/8/f*1e3),v=0,m=0,b=0;b=d+3){var y=new Uint8Array(g);v="1"==i(g.byteLength-(m-(d+3)+1),y).charAt(6);break}}return v&&d++,{version:l,layer:c,sampleRate:f,bitRate:u,duration:_,size:t,hasPadding:v,frameSize:d,frameDurationFloat:h}};var a={rm:Recorder.mp3ReadMeta,fn:function(e,t,n,r){var a=this.rm(e,t);if(!a)return{err:"mp3非预定格式"};var i=Math.round(n/r*1e3),s=Math.floor((a.duration-i)/a.frameDurationFloat);if(s>0){var o=s*a.frameSize-(a.hasPadding?1:0);t-=o;for(var l=0,c=[],f=0;f=u.byteLength?(o-=u.byteLength,c.push(u),e.splice(f,1),f--):(e[f]=u.slice(o),l=u,o=0)}if(!this.rm(e,t)){l&&(e[0]=l);for(f=0;f "+r.duration+"ms",r.remove>2&&(e.err=(e.err?e.err+", ":"")+"移除帧数过多")):n+=(e.duration||"-")+"ms",e.err?console.error(n,e.err,e):console.log(n,e)}}()},function(e,t,n){"use strict";!function(){function e(){var t=function(e){return Math.log(e)/Math.log(10)};function n(e){return new Int8Array(e)}function r(e){return new Int16Array(e)}function a(e){return new Int32Array(e)}function i(e){return new Float32Array(e)}function s(e){return new Float64Array(e)}function o(e){if(1==e.length)return i(e[0]);var t=e[0];e=e.slice(1);for(var n=[],r=0;r>=1;0!=e--;)a[i++]=s>n[r++]?0:1,a[i++]=s>n[r++]?0:1}function i(t,n,r,a,i,s){var o=(t>>=1)%2;for(t>>=1;0!=t--;){var l,c,f,u,_,p,h,d;l=r[a++]*n,c=r[a++]*n,_=0|l,f=r[a++]*n,p=0|c,u=r[a++]*n,h=0|f,l+=e.adj43[_],d=0|u,c+=e.adj43[p],i[s++]=0|l,f+=e.adj43[h],i[s++]=0|c,u+=e.adj43[d],i[s++]=0|f,i[s++]=0|u}0!=o&&(_=0|(l=r[a++]*n),p=0|(c=r[a++]*n),l+=e.adj43[_],c+=e.adj43[p],i[s++]=0|l,i[s++]=0|c)}var s=[1,2,5,7,7,10,10,13,13,13,13,13,13,13,13];function o(e,t,n,r){var a=function(e,t,n){var r=0,a=0;do{var i=e[t++],s=e[t++];r>=16)>i&&(o=i,r++),a.bits+=o,r}(e,t,n,s[a-1],r);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,n,r,a){var i=0,s=0,o=0,l=A.ht[r].xlen,c=A.ht[r].hlen,f=A.ht[r+1].hlen,u=A.ht[r+2].hlen;do{var _=e[t+0]*l+e[t+1];t+=2,i+=c[_],s+=f[_],o+=u[_]}while(ts&&(i=s,p++),i>o&&(i=o,p=r+2),a.bits+=i,p}(e,t,n,s[a-1],r);default:if(a>I.IXMAX_VAL)return r.bits=I.LARGE_BITS,-1;var i,o;for(a-=15,i=24;i<32&&!(A.ht[i].linmax>=a);i++);for(o=i-8;o<24&&!(A.ht[o].linmax>=a);o++);return function(e,t,n,r,a,i){var s,o=65536*A.ht[r].xlen+A.ht[a].xlen,l=0;do{var c=e[t++],f=e[t++];0!=c&&(c>14&&(c=15,l+=o),c*=16),0!=f&&(f>14&&(f=15,l+=o),c+=f),l+=A.largetbl[c]}while(t>=16)>s&&(l=s,r=a),i.bits+=l,r}(e,t,n,o,i,r)}}function l(e,n,r,a,i,s,l,c){for(var f=n.big_values,u=2;u=f)break;var p=i[u-2]+n.count1bits;if(r.part2_3_length<=p)break;var h=new t(p),d=o(a,_,f,h);p=h.bits,r.part2_3_length<=p||(r.assign(n),r.part2_3_length=p,r.region0_count=s[u-2],r.region1_count=u-2-s[u-2],r.table_select[0]=l[u-2],r.table_select[1]=c[u-2],r.table_select[2]=d)}}this.noquant_count_bits=function(e,n,r){var a=n.l3_enc,i=Math.min(576,n.max_nonzero_coeff+2>>1<<1);for(null!=r&&(r.sfb_count1=0);i>1&&0==(a[i-1]|a[i-2]);i-=2);n.count1=i;for(var s=0,l=0;i>3;i-=4){var c;if((2147483647&(a[i-1]|a[i-2]|a[i-3]|a[i-4]))>1)break;c=2*(2*(2*a[i-4]+a[i-3])+a[i-2])+a[i-1],s+=A.t32l[c],l+=A.t33l[c]}var f=s;if(n.count1table_select=0,s>l&&(f=l,n.count1table_select=1),n.count1bits=f,n.big_values=i,0==i)return f;if(n.block_type==F.SHORT_TYPE)(s=3*e.scalefac_band.s[3])>n.big_values&&(s=n.big_values),l=n.big_values;else if(n.block_type==F.NORM_TYPE){if(s=n.region0_count=e.bv_scf[i-2],l=n.region1_count=e.bv_scf[i-1],l=e.scalefac_band.l[s+l+2],s=e.scalefac_band.l[s+1],l(l=i)&&(s=l);if(s=Math.min(s,i),l=Math.min(l,i),0l)return I.LARGE_BITS;if(function(t,n,a,s,o){var l,c,f,_=0,p=0,h=0,d=0,v=n,m=0,b=v,g=0,y=t,w=0;for(f=null!=o&&s.global_gain==o.global_gain,c=s.block_type==F.SHORT_TYPE?38:21,l=0;l<=c;l++){var S=-1;if((f||s.block_type==F.NORM_TYPE)&&(S=s.global_gain-(s.scalefac[l]+(0!=s.preflag?e.pretab[l]:0)<s.max_nonzero_coeff)x=s.max_nonzero_coeff-_+1,u.fill(n,s.max_nonzero_coeff,576,0),(k=x)<0&&(k=0),l=c+1;if(0==p&&0==h&&(b=v,g=m,y=t,w=d),null!=o&&o.sfb_count1>0&&l>=o.sfb_count1&&o.step[l]>0&&S>=o.step[l]?(0!=p&&(i(p,a,y,w,b,g),p=0,b=v,g=m,y=t,w=d),h+=k):(0!=h&&(r(h,a,y,w,b,g),h=0,b=v,g=m,y=t,w=d),p+=k),k<=0){0!=h&&(r(h,a,y,w,b,g),h=0),0!=p&&(i(p,a,y,w,b,g),p=0);break}}l<=c&&(m+=s.width[l],d+=s.width[l],_+=s.width[l])}0!=p&&(i(p,a,y,w,b,g),p=0),0!=h&&(r(h,a,y,w,b,g),h=0)}(n,o,e.IPOW20(a.global_gain),a,s),0!=(2&t.substep_shaping))for(var c=0,f=a.global_gain+a.scalefac_scale,_=.634521682242439/e.IPOW20(f),p=0;p=_?o[h]:0}return this.noquant_count_bits(t,a,s)},this.best_huffman_divide=function(e,n){var r=new H,i=n.l3_enc,s=a(23),c=a(23),f=a(23),u=a(23);if(n.block_type!=F.SHORT_TYPE||1!=e.mode_gr){r.assign(n),n.block_type==F.NORM_TYPE&&(!function(e,n,r,a,i,s,l){for(var c=n.big_values,f=0;f<=22;f++)a[f]=I.LARGE_BITS;for(f=0;f<16;f++){var u=e.scalefac_band.l[f+1];if(u>=c)break;var _=0,p=new t(_),h=o(r,0,u,p);_=p.bits;for(var d=0;d<8;d++){var v=e.scalefac_band.l[f+d+2];if(v>=c)break;var m=_,b=o(r,u,v,p=new t(m));m=p.bits,a[f+d]>m&&(a[f+d]=m,i[f+d]=f,s[f+d]=h,l[f+d]=b)}}}(e,n,i,s,c,f,u),l(e,r,n,i,s,c,f,u));var _=r.big_values;if(!(0==_||(i[_-2]|i[_-1])>1||(_=n.count1+2)>576)){r.assign(n),r.count1=_;for(var p=0,h=0;_>r.big_values;_-=4){var d=2*(2*(2*i[_-4]+i[_-3])+i[_-2])+i[_-1];p+=A.t32l[d],h+=A.t33l[d]}if(r.big_values=_,r.count1table_select=0,p>h&&(p=h,r.count1table_select=1),r.count1bits=p,r.block_type==F.NORM_TYPE)l(e,r,n,i,s,c,f,u);else{if(r.part2_3_length=p,(p=e.scalefac_band.l[8])>_&&(p=_),p>0){var v=new t(r.part2_3_length);r.table_select[0]=o(i,0,p,v),r.part2_3_length=v.bits}if(_>p){v=new t(r.part2_3_length);r.table_select[1]=o(i,p,_,v),r.part2_3_length=v.bits}n.part2_3_length>r.part2_3_length&&n.assign(r)}}}};var c=[1,1,1,1,8,2,2,2,4,4,4,8,8,8,16,16],f=[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],h=[0,1,2,3,0,1,2,3,1,2,3,1,2,3,2,3];g.slen1_tab=p,g.slen2_tab=h,this.best_scalefac_store=function(t,n,r,a){var i,s,o,l,u=a.tt[n][r],_=0;for(o=0,i=0;i0&&(v|=u.scalefac[i]);if(0==(1&v)&&0!=v){for(i=0;i0&&(u.scalefac[i]>>=1);u.scalefac_scale=_=1}}if(0==u.preflag&&u.block_type!=F.SHORT_TYPE&&2==t.mode_gr){for(i=11;i0&&(u.scalefac[i]-=e.pretab[i]);u.preflag=_=1}}for(s=0;s<4;s++)a.scfsi[r][s]=0;for(2==t.mode_gr&&1==n&&a.tt[0][r].block_type!=F.SHORT_TYPE&&a.tt[1][r].block_type!=F.SHORT_TYPE&&(!function(e,t){for(var n,r=t.tt[1][e],a=t.tt[0][e],i=0;i=0);n++);if(n==A.scfsi_band[i+1]){for(n=A.scfsi_band[i];n_&&(r.part2_length=_,r.scalefac_compress=i)}}(r,a),_=0),i=0;ia[n]&&(t.part2_length=a[n],t.scalefac_compress=n);return t.part2_length==I.LARGE_BITS};var b=[[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(t,n){var r,i,s,o,l,c,f,u,p=a(4),h=n.scalefac;for(r=0!=n.preflag?2:0,f=0;f<4;f++)p[f]=0;if(n.block_type==F.SHORT_TYPE){i=1;var d=e.nr_of_sfb_block[r][i];for(u=0,s=0;s<4;s++)for(o=d[s]/3,f=0;fp[s]&&(p[s]=h[3*u+l])}else{i=0;d=e.nr_of_sfb_block[r][i];for(u=0,s=0;s<4;s++)for(o=d[s],f=0;fp[s]&&(p[s]=h[u])}for(c=!1,s=0;s<4;s++)p[s]>b[r][s]&&(c=!0);if(!c){var v,m,g,w;for(n.sfb_partition_table=e.nr_of_sfb_block[r][i],s=0;s<4;s++)n.slen[s]=y[p[s]];switch(v=n.slen[0],m=n.slen[1],g=n.slen[2],w=n.slen[3],r){case 0:n.scalefac_compress=(5*v+m<<4)+(g<<2)+w;break;case 1:n.scalefac_compress=400+(5*v+m<<2)+g;break;case 2:n.scalefac_compress=500+3*v+m;break;default:_.err.printf("intensity stereo not implemented yet\n")}}if(!c)for(n.part2_length=0,s=0;s<4;s++)n.part2_length+=n.slen[s]*n.sfb_partition_table[s];return c};var y=[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 r,a=0;e.scalefac_band.l[++a]t;)r--;for(r<0&&(r=n[a][0]),e.bv_scf[t-2]=r,r=n[a][1];e.scalefac_band.l[r+e.bv_scf[t-2]+2]>t;)r--;r<0&&(r=n[a][1]),e.bv_scf[t-1]=r}}}function y(){}function w(){function e(e,t,n,r,a,i,s,o,l,c,f,u,_,p,h){this.vbr_q=e,this.quant_comp=t,this.quant_comp_s=n,this.expY=r,this.st_lrm=a,this.st_s=i,this.masking_adj=s,this.masking_adj_short=o,this.ath_lower=l,this.ath_curve=c,this.ath_sensitivity=f,this.interch=u,this.safejoint=_,this.sfb21mod=p,this.msfix=h}function t(e,t,n,r,a,i,s,o,l,c,f,u,_,p){this.quant_comp=t,this.quant_comp_s=n,this.safejoint=r,this.nsmsfix=a,this.st_lrm=i,this.st_s=s,this.nsbass=o,this.scale=l,this.masking_adj=c,this.ath_lower=f,this.ath_curve=u,this.interch=_,this.sfscale=p}var n;this.setModules=function(e){n=e};var r=[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)],a=[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 i(e,t,n){var i=e.VBR==v.vbr_rh?r:a,s=e.VBR_q_frac,o=i[t],l=i[t+1],c=o;o.st_lrm=o.st_lrm+s*(l.st_lrm-o.st_lrm),o.st_s=o.st_s+s*(l.st_s-o.st_s),o.masking_adj=o.masking_adj+s*(l.masking_adj-o.masking_adj),o.masking_adj_short=o.masking_adj_short+s*(l.masking_adj_short-o.masking_adj_short),o.ath_lower=o.ath_lower+s*(l.ath_lower-o.ath_lower),o.ath_curve=o.ath_curve+s*(l.ath_curve-o.ath_curve),o.ath_sensitivity=o.ath_sensitivity+s*(l.ath_sensitivity-o.ath_sensitivity),o.interch=o.interch+s*(l.interch-o.interch),o.msfix=o.msfix+s*(l.msfix-o.msfix),function(e,t){var n=0;0>t&&(n=-1,t=0);90||(e.quant_comp=c.quant_comp),0!=n?e.quant_comp_short=c.quant_comp_s:Math.abs(e.quant_comp_short- -1)>0||(e.quant_comp_short=c.quant_comp_s),0!=c.expY&&(e.experimentalY=0!=c.expY),0!=n?e.internal_flags.nsPsy.attackthre=c.st_lrm:Math.abs(e.internal_flags.nsPsy.attackthre- -1)>0||(e.internal_flags.nsPsy.attackthre=c.st_lrm),0!=n?e.internal_flags.nsPsy.attackthre_s=c.st_s:Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)>0||(e.internal_flags.nsPsy.attackthre_s=c.st_s),0!=n?e.maskingadjust=c.masking_adj:Math.abs(e.maskingadjust-0)>0||(e.maskingadjust=c.masking_adj),0!=n?e.maskingadjust_short=c.masking_adj_short:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=c.masking_adj_short),0!=n?e.ATHlower=-c.ath_lower/10:Math.abs(10*-e.ATHlower-0)>0||(e.ATHlower=-c.ath_lower/10),0!=n?e.ATHcurve=c.ath_curve:Math.abs(e.ATHcurve- -1)>0||(e.ATHcurve=c.ath_curve),0!=n?e.athaa_sensitivity=c.ath_sensitivity:Math.abs(e.athaa_sensitivity- -1)>0||(e.athaa_sensitivity=c.ath_sensitivity),c.interch>0&&(0!=n?e.interChRatio=c.interch:Math.abs(e.interChRatio- -1)>0||(e.interChRatio=c.interch)),c.safejoint>0&&(e.exp_nspsytune=e.exp_nspsytune|c.safejoint),c.sfb21mod>0&&(e.exp_nspsytune=e.exp_nspsytune|c.sfb21mod<<20),0!=n?e.msfix=c.msfix:Math.abs(e.msfix- -1)>0||(e.msfix=c.msfix),0==n&&(e.VBR_q=t,e.VBR_q_frac=s)}var s=[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 o(e,t,r){var a=t,i=n.nearestBitrateFullIndex(t);if(e.VBR=v.vbr_abr,e.VBR_mean_bitrate_kbps=a,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,e.VBR_mean_bitrate_kbps>320&&(e.disable_reservoir=!0),s[i].safejoint>0&&(e.exp_nspsytune=2|e.exp_nspsytune),s[i].sfscale>0&&(e.internal_flags.noise_shaping=2),Math.abs(s[i].nsbass)>0){var o=int(4*s[i].nsbass);o<0&&(o+=64),e.exp_nspsytune=e.exp_nspsytune|o<<2}return 0!=r?e.quant_comp=s[i].quant_comp:Math.abs(e.quant_comp- -1)>0||(e.quant_comp=s[i].quant_comp),0!=r?e.quant_comp_short=s[i].quant_comp_s:Math.abs(e.quant_comp_short- -1)>0||(e.quant_comp_short=s[i].quant_comp_s),0!=r?e.msfix=s[i].nsmsfix:Math.abs(e.msfix- -1)>0||(e.msfix=s[i].nsmsfix),0!=r?e.internal_flags.nsPsy.attackthre=s[i].st_lrm:Math.abs(e.internal_flags.nsPsy.attackthre- -1)>0||(e.internal_flags.nsPsy.attackthre=s[i].st_lrm),0!=r?e.internal_flags.nsPsy.attackthre_s=s[i].st_s:Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)>0||(e.internal_flags.nsPsy.attackthre_s=s[i].st_s),0!=r?e.scale=s[i].scale:Math.abs(e.scale- -1)>0||(e.scale=s[i].scale),0!=r?e.maskingadjust=s[i].masking_adj:Math.abs(e.maskingadjust-0)>0||(e.maskingadjust=s[i].masking_adj),s[i].masking_adj>0?0!=r?e.maskingadjust_short=.9*s[i].masking_adj:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=.9*s[i].masking_adj):0!=r?e.maskingadjust_short=1.1*s[i].masking_adj:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=1.1*s[i].masking_adj),0!=r?e.ATHlower=-s[i].ath_lower/10:Math.abs(10*-e.ATHlower-0)>0||(e.ATHlower=-s[i].ath_lower/10),0!=r?e.ATHcurve=s[i].ath_curve:Math.abs(e.ATHcurve- -1)>0||(e.ATHcurve=s[i].ath_curve),0!=r?e.interChRatio=s[i].interch:Math.abs(e.interChRatio- -1)>0||(e.interChRatio=s[i].interch),t}this.apply_preset=function(e,t,n){switch(t){case Z.R3MIX:t=Z.V3,e.VBR=v.vbr_mtrh;break;case Z.MEDIUM:t=Z.V4,e.VBR=v.vbr_rh;break;case Z.MEDIUM_FAST:t=Z.V4,e.VBR=v.vbr_mtrh;break;case Z.STANDARD:t=Z.V2,e.VBR=v.vbr_rh;break;case Z.STANDARD_FAST:t=Z.V2,e.VBR=v.vbr_mtrh;break;case Z.EXTREME:t=Z.V0,e.VBR=v.vbr_rh;break;case Z.EXTREME_FAST:t=Z.V0,e.VBR=v.vbr_mtrh;break;case Z.INSANE:return t=320,e.preset=t,o(e,t,n),e.VBR=v.vbr_off,t}switch(e.preset=t,t){case Z.V9:return i(e,9,n),t;case Z.V8:return i(e,8,n),t;case Z.V7:return i(e,7,n),t;case Z.V6:return i(e,6,n),t;case Z.V5:return i(e,5,n),t;case Z.V4:return i(e,4,n),t;case Z.V3:return i(e,3,n),t;case Z.V2:return i(e,2,n),t;case Z.V1:return i(e,1,n),t;case Z.V0:return i(e,0,n),t}return 8<=t&&t<=320?o(e,t,n):(e.preset=0,t)}}function S(){var e;this.setModules=function(t){e=t},this.ResvFrameBegin=function(t,n){var r,a=t.internal_flags,i=a.l3_side,s=e.getframebits(t);n.bits=(s-8*a.sideinfo_len)/a.mode_gr;var o=2048*a.mode_gr-8;t.brate>320?r=8*int(1e3*t.brate/(t.out_samplerate/1152)/8+.5):(r=11520,t.strict_ISO&&(r=8*int(32e4/(t.out_samplerate/1152)/8+.5))),a.ResvMax=r-s,a.ResvMax>o&&(a.ResvMax=o),(a.ResvMax<0||t.disable_reservoir)&&(a.ResvMax=0);var l=n.bits*a.mode_gr+Math.min(a.ResvSize,a.ResvMax);return l>r&&(l=r),i.resvDrain_pre=0,null!=a.pinfo&&(a.pinfo.mean_bits=n.bits/2,a.pinfo.resvsize=a.ResvSize),l},this.ResvMaxBits=function(e,t,n,r){var a,i=e.internal_flags,s=i.ResvSize,o=i.ResvMax;0!=r&&(s+=t),0!=(1&i.substep_shaping)&&(o*=.9),n.bits=t,10*s>9*o?(a=s-9*o/10,n.bits+=a,i.substep_shaping|=128):(a=0,i.substep_shaping&=127,e.disable_reservoir||0!=(1&i.substep_shaping)||(n.bits-=.1*t));var l=s<6*i.ResvMax/10?s:6*i.ResvMax/10;return(l-=a)<0&&(l=0),l},this.ResvAdjust=function(e,t){e.ResvSize-=t.part2_3_length+t.part2_length},this.ResvFrameEnd=function(e,t){var n,r=e.l3_side;e.ResvSize+=t*e.mode_gr;var a=0;r.resvDrain_post=0,r.resvDrain_pre=0,0!=(n=e.ResvSize%8)&&(a+=n),(n=e.ResvSize-a-e.ResvMax)>0&&(a+=n);var i=Math.min(8*r.main_data_begin,a)/8;r.resvDrain_pre+=8*i,a-=8*i,e.ResvSize-=8*i,r.main_data_begin-=i,r.resvDrain_post+=a,e.ResvSize-=a}}function x(){this.setModules=function(e,t,n){e,t,n};var e=[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];function t(t,n){return n=n>>8^e[255&(n^t)]}this.updateMusicCRC=function(e,n,r,a){for(var i=0;i0;){var r;0==h&&(h=8,p++,e.header[e.w_ptr].write_timing==f&&d(e),c[p]=0),n-=r=Math.min(n,h),h-=r,c[p]|=t>>n<0;){var r;0==h&&(h=8,p++,c[p]=0),n-=r=Math.min(n,h),h-=r,c[p]|=t>>n<=8&&(v(r,76,8),t-=8),t>=8&&(v(r,65,8),t-=8),t>=8&&(v(r,77,8),t-=8),t>=8&&(v(r,69,8),t-=8),t>=32){var a=s.getLameShortVersion();if(t>=32)for(n=0;n=8;++n)t-=8,v(r,a.charCodeAt(n),8)}for(;t>=1;t-=1)v(r,r.ancillary_flag,1),r.ancillary_flag^=e.disable_reservoir?0:1}function w(e,t,n){for(var r=e.header[e.h_ptr].ptr;n>0;){var a=Math.min(n,8-(7&r));n-=a,e.header[e.h_ptr].buf[r>>3]|=t>>n<<8-(7&r)-a,r+=a}e.header[e.h_ptr].ptr=r}function S(e,t){e<<=8;for(var n=0;n<8;n++)0!=(65536&((t<<=1)^(e<<=1)))&&(t^=32773);return t}function x(e,t){var n,r=A.ht[t.count1table_select+32],a=0,i=t.big_values,s=t.big_values;for(n=(t.count1-t.big_values)/4;n>0;--n){var o=0,l=0;0!=t.l3_enc[i+0]&&(l+=8,t.xr[s+0]<0&&o++),0!=t.l3_enc[i+1]&&(l+=4,o*=2,t.xr[s+1]<0&&o++),0!=t.l3_enc[i+2]&&(l+=2,o*=2,t.xr[s+2]<0&&o++),0!=t.l3_enc[i+3]&&(l++,o*=2,t.xr[s+3]<0&&o++),i+=4,s+=4,v(e,o+r.table[l],r.hlen[l]),a+=r.hlen[l]}return a}function k(e,t,n,r,a){var i=A.ht[t],s=0;if(0==t)return s;for(var o=n;o15){if(p>14)_|=p-15<<1,c=f,p=15;if(h>14)_<<=f,_|=h-15,c+=f,h=15;u=16}0!=h&&(_<<=1,a.xr[o+1]<0&&_++,l--),p=p*u+h,c-=l,l+=i.hlen[p],v(e,i.table[p],l),v(e,_,c),s+=l+c}return s}function M(e,t){var n=3*e.scalefac_band.s[3];n>t.big_values&&(n=t.big_values);var r=k(e,t.table_select[0],0,n,t);return r+=k(e,t.table_select[1],n,t.big_values,t)}function R(e,t){var n,r,a,i;n=t.big_values;var s=t.region0_count+1;return a=e.scalefac_band.l[s],s+=t.region1_count+1,a>n&&(a=n),(i=e.scalefac_band.l[s])>n&&(i=n),r=k(e,t.table_select[0],0,a,t),r+=k(e,t.table_select[1],a,i,t),r+=k(e,t.table_select[2],i,n,t)}function T(){this.total=0}function B(t,n){var r,a,i,s,o,l=t.internal_flags;return o=l.w_ptr,-1==(s=l.h_ptr-1)&&(s=U.MAX_HEADER_BUF-1),r=l.header[s].write_timing-f,n.total=r,r>=0&&(a=1+s-o,s>8),t[5]=byte(255&n)},this.flush_bitstream=function(e){var n,a,i=e.internal_flags,s=i.h_ptr-1;if(-1==s&&(s=U.MAX_HEADER_BUF-1),n=i.l3_side,!((a=B(e,new T))<0)){if(b(e,a),i.ResvSize=0,n.main_data_begin=0,i.findReplayGain){var o=r.GetTitleGain(i.rgdata);i.RadioGain=0|Math.floor(10*o+.5)}i.findPeakSample&&(i.noclipGainChange=0|Math.ceil(20*t(i.PeakSample/32767)*10),i.noclipGainChange>0&&(EQ(e.scale,1)||EQ(e.scale,0))?i.noclipScale=Math.floor(32767/i.PeakSample*100)/100:i.noclipScale=-1)}},this.add_dummy_byte=function(e,t,n){for(var r,a=e.internal_flags;n-- >0;)for(m(0,t,8),r=0;r ResvSize"),8*t.main_data_begin!=n.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,n.ResvSize,t.resvDrain_post,t.resvDrain_pre,8*n.sideinfo_len,a-t.resvDrain_post-8*n.sideinfo_len,a,a%8,r),_.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"),n.ResvSize=8*t.main_data_begin),f>1e9){var i;for(i=0;is)return-1;if(_.arraycopy(c,0,t,n,u),p=-1,h=0,0!=f){var d=a(1);if(d[0]=e.nMusicCRC,l.updateMusicCRC(d,t,n,u),e.nMusicCRC=d[0],u>0&&(e.VBR_seek_table.nBytesWritten+=u),e.decode_on_the_fly)for(var v,m=o([2,1152]),b=u,g=-1;0!=g;)if(g=i.hip_decode1_unclipped(e.hip,t,n,b,m[0],m[1]),b=0,-1==g&&(g=0),g>0){if(e.findPeakSample){for(v=0;ve.PeakSample?e.PeakSample=m[0][v]:-m[0][v]>e.PeakSample&&(e.PeakSample=-m[0][v]);if(e.channels_out>1)for(v=0;ve.PeakSample?e.PeakSample=m[1][v]:-m[1][v]>e.PeakSample&&(e.PeakSample=-m[1][v])}if(e.findReplayGain&&r.AnalyzeSamples(e.rgdata,m[0],0,m[1],0,g,e.channels_out)==y.GAIN_ANALYSIS_ERROR)return-6}}return u},this.init_bit_stream_w=function(e){c=n(Z.LAME_MAXMP3BUFFER),e.h_ptr=e.w_ptr=0,e.header[e.h_ptr].write_timing=0,p=-1,h=0,f=0}}function M(e,t,n,r){this.xlen=e,this.linmax=t,this.table=n,this.hlen=r}m.STEREO=new m(0),m.JOINT_STEREO=new m(1),m.DUAL_CHANNEL=new m(2),m.MONO=new m(3),m.NOT_SET=new m(4),y.STEPS_per_dB=100,y.MAX_dB=120,y.GAIN_NOT_ENOUGH_SAMPLES=-24601,y.GAIN_ANALYSIS_ERROR=0,y.GAIN_ANALYSIS_OK=1,y.INIT_GAIN_ANALYSIS_ERROR=0,y.INIT_GAIN_ANALYSIS_OK=1,y.YULE_ORDER=10,y.MAX_ORDER=y.YULE_ORDER,y.MAX_SAMP_FREQ=48e3,y.RMS_WINDOW_TIME_NUMERATOR=1,y.RMS_WINDOW_TIME_DENOMINATOR=20,y.MAX_SAMPLES_PER_WINDOW=y.MAX_SAMP_FREQ*y.RMS_WINDOW_TIME_NUMERATOR/y.RMS_WINDOW_TIME_DENOMINATOR+1,x.NUMTOCENTRIES=100,x.MAXFRAMESIZE=2880,k.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)},k.NEQ=function(e,t){return!k.EQ(e,t)};var A={};function R(e){this.bits=e}function T(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}function B(){this.setModules=function(e,t){e,t}}function E(){this.useAdjust=0,this.aaSensitivityP=0,this.adjust=0,this.adjustLimit=0,this.decay=0,this.floor=0,this.l=i(F.SBMAX_l),this.s=i(F.SBMAX_s),this.psfb21=i(F.PSFB21),this.psfb12=i(F.PSFB12),this.cb_l=i(F.CBANDS),this.cb_s=i(F.CBANDS),this.eql_w=i(F.BLKSIZE/2)}function C(){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=m.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}function P(e){var t=e;this.quantize=t,this.iteration_loop=function(e,t,n,r){var s,o=e.internal_flags,l=i($.SFBMAX),c=i(576),f=a(2),u=0,_=o.l3_side,p=new R(u);this.quantize.rv.ResvFrameBegin(e,p),u=p.bits;for(var h=0;h>2&63)>=32&&(r-=64),c=Math.pow(10,r/4/10),(r=n.exp_nspsytune>>8&63)>=32&&(r-=64),p=Math.pow(10,r/4/10),(r=n.exp_nspsytune>>14&63)>=32&&(r-=64),v=Math.pow(10,r/4/10),(r=n.exp_nspsytune>>20&63)>=32&&(r-=64),b=v*Math.pow(10,r/4/10),r=0;rU.MAX_BITS_PER_GRANULE&&(d=U.MAX_BITS_PER_GRANULE),l=0,c=0;c3*i/4&&(_[c]=3*i/4),_[c]<0&&(_[c]=0),_[c]+r[c]>U.MAX_BITS_PER_CHANNEL&&(_[c]=Math.max(0,U.MAX_BITS_PER_CHANNEL-r[c])),l+=_[c];if(l>h)for(c=0;cU.MAX_BITS_PER_GRANULE){for(c=0;c.5&&(a=.5);var i=0|.5*a*(e[0]+e[1]);i>U.MAX_BITS_PER_CHANNEL-e[0]&&(i=U.MAX_BITS_PER_CHANNEL-e[0]),i<0&&(i=0),e[1]>=125&&(e[1]-i>125?(e[0]r&&(e[0]=r*e[0]/i,e[1]=r*e[1]/i)},this.athAdjust=function(e,t,n){var r=90.30873362,a=p.FAST_LOG10_X(t,10),i=e*e,s=0;return a-=n,i>1e-20&&(s=1+p.FAST_LOG10_X(i,10/r)),s<0&&(s=0),a*=s,a+=n+r-94.82444863,Math.pow(10,.1*a)},this.calc_xmin=function(e,t,n,r){var a,i=0,s=e.internal_flags,o=0,l=0,c=s.ATH,f=n.xr,u=e.VBR==v.vbr_mtrh?1:0,_=s.masking_lower;for(e.VBR!=v.vbr_mtrh&&e.VBR!=v.vbr_mt||(_=1),a=0;a>1,A=0;do{A+=T=f[o]*f[o],S+=T0);if(A>y&&l++,a==F.SBPSY_l)S<(M=y*s.nsPsy.longfact[a])&&(S=M);if(0!=u&&(y=S),!e.ATHonly)if((x=t.en.l[a])>0)M=A*t.thm.l[a]*_/x,0!=u&&(M*=s.nsPsy.longfact[a]),y>1;w=g/m,S=2220446049250313e-31;do{var T,B;A+=T=f[o]*f[o],S+=T0);if(A>g&&l++,d==F.SBPSY_s)S<(M=g*s.nsPsy.shortfact[d])&&(S=M);if(y=0!=u?S:g,!e.ATHonly&&!e.ATHshort)if((x=t.en.s[d][b])>0)M=A*t.thm.s[d][b]*_/x,0!=u&&(M*=s.nsPsy.shortfact[d]),yr[i-3+1]&&(r[i-3+1]+=(r[i-3]-r[i-3+1])*s.decay),r[i-3+1]>r[i-3+2]&&(r[i-3+2]+=(r[i-3+1]-r[i-3+2])*s.decay))}return l},this.calc_noise_core=function(e,t,n,r){var a=0,s=t.s,o=e.l3_enc;if(s>e.count1)for(;0!=n--;){c=e.xr[s],s++,a+=c*c,c=e.xr[s],s++,a+=c*c}else if(s>e.big_values){var l=i(2);for(l[0]=0,l[1]=r;0!=n--;){c=Math.abs(e.xr[s])-l[o[s]],s++,a+=c*c,c=Math.abs(e.xr[s])-l[o[s]],s++,a+=c*c}}else for(;0!=n--;){var c;c=Math.abs(e.xr[s])-_[o[s]]*r,s++,a+=c*c,c=Math.abs(e.xr[s])-_[o[s]]*r,s++,a+=c*c}return t.s=s,a},this.calc_noise=function(e,t,n,r,a){var i,s,o=0,l=0,u=0,_=0,h=0,d=-20,v=0,m=e.scalefac,g=0;for(r.over_SSD=0,i=0;i>1,v+e.width[i]>e.max_nonzero_coeff)s=(x=e.max_nonzero_coeff-v+1)>0?x>>1:0;var M=new b(v);S=this.calc_noise_core(e,M,s,k),v=M.s,null!=a&&(a.step[i]=w,a.noise[i]=S),S=n[o++]=S/t[l++],S=p.FAST_LOG10(Math.max(S,1e-20)),null!=a&&(a.noise_log[i]=S)}if(null!=a&&(a.global_gain=e.global_gain),h+=S,S>0)y=Math.max(0|10*S+.5,1),r.over_SSD+=y*y,u++,_+=S;d=Math.max(d,S)}return r.over_count=u,r.tot_noise=h,r.over_noise=_,r.max_noise=d,u},this.set_pinfo=function(e,t,n,r,a){var s,o,l,f,u,_=e.internal_flags,p=0==t.scalefac_scale?.5:1,h=t.scalefac,d=i($.SFBMAX),v=i($.SFBMAX),m=new T;calc_xmin(e,n,t,d),calc_noise(t,d,v,m,null);var b=0;for(o=t.sfb_lmax,t.block_type!=F.SHORT_TYPE&&0==t.mixed_block_flag&&(o=22),s=0;s0&&!e.ATHonly?f/=n.en.l[s]:f=0,_.pinfo.thr[r][a][s]=u*Math.max(f*n.thm.l[s],_.ATH.l[s]),_.pinfo.LAMEsfb[r][a][s]=0,0!=t.preflag&&s>=11&&(_.pinfo.LAMEsfb[r][a][s]=-p*c[s]),s0?f/=n.en.s[s][S]:f=0,(e.ATHonly||e.ATHshort)&&(f=0),_.pinfo.thr_s[r][a][3*s+S]=u*Math.max(f*n.thm.s[s][S],_.ATH.s[s]),_.pinfo.LAMEsfb_s[r][a][3*s+S]=-2*t.subblock_gain[S],s0?(i=n.over_SSD<=t.over_SSD,n.over_SSD==t.over_SSD&&(i=n.bits.2||n.max_noise<=0&&t.max_noise<0&&t.max_noise>n.max_noise-.2&&n.tot_noise0&&t.max_noise>n.max_noise-.2&&n.tot_noise0&&t.max_noise>-.05&&t.max_noise>n.max_noise-.1&&n.tot_noise+n.over_noise0&&t.max_noise>-.1&&t.max_noise>n.max_noise-.15&&n.tot_noise+n.over_noise+n.over_noise1?o=Math.pow(o,.5):o*=.95;break;case 0:default:o>1?o=1:o*=.95}var f=0;for(l=0;lt.xrpow_max&&(t.xrpow_max=r[f+u]);if(2==s.noise_shaping_amp)return}}}(e,t,a,i,s);var c=o(t);return!c&&(!(c=2==l.mode_gr?r.scale_bitcount(t):r.scale_bitcount_lsf(l,t))||(l.noise_shaping>1&&(u.fill(l.pseudohalf,0),0==t.scalefac_scale?(!function(e,t){for(var r=0,a=0;ae.xrpow_max&&(e.xrpow_max=t[r+o])}e.scalefac[a]=s>>1}e.preflag=0,e.scalefac_scale=1}(t,i),c=!1):t.block_type==F.SHORT_TYPE&&l.subblock_gain>0&&(c=function(e,t,r){var a,i=t.scalefac;for(a=0;a=16)return!0;for(var s=0;s<3;s++){var o=0,l=0;for(a=t.sfb_lmax+s;a=7)return!0;t.subblock_gain[s]++;var c=e.scalefac_band.l[t.sfb_lmax];for(a=t.sfb_lmax+s;a>t.scalefac_scale)>=0)i[a]=u,c+=3*f;else{i[a]=0;var _=210+(u<t.xrpow_max&&(t.xrpow_max=r[c+p]);c+=f*(3-s-1)}}var h=n.IPOW20(202);c+=t.width[a]*(s+1);for(p=-t.width[a];p<0;p++)r[c+p]*=h,r[c+p]>t.xrpow_max&&(t.xrpow_max=r[c+p])}}return!1}(l,t,i)||o(t))),c||(c=2==l.mode_gr?r.scale_bitcount(t):r.scale_bitcount_lsf(l,t)),!c))}this.setModules=function(i,s,o,l){e=i,t=s,this.rv=s,n=o,this.qupvt=o,r=l,a.setModules(n,r)},this.ms_convert=function(e,t){for(var n=0;n<576;++n){var r=e.tt[t][0].xr[n],a=e.tt[t][1].xr[n];e.tt[t][0].xr[n]=(r+a)*(.5*p.SQRT2),e.tt[t][1].xr[n]=(r-a)*(.5*p.SQRT2)}},this.init_xrpow=function(e,t,n){var r=0,a=0|t.max_nonzero_coeff;if(t.xrpow_max=0,u.fill(n,a,576,0),(r=function(e,t,n,r){r=0;for(var a=0;a<=n;++a){var i=Math.abs(e.xr[a]);r+=i,t[a]=Math.sqrt(i*Math.sqrt(i)),t[a]>e.xrpow_max&&(e.xrpow_max=t[a])}return r}(t,n,a,r))>1e-20){var i=0;0!=(2&e.substep_shaping)&&(i=1);for(var s=0;s=0&&!i;s--){var o=e.scalefac_band.psfb21[s],l=e.scalefac_band.psfb21[s+1],c=n.athAdjust(r.adjust,r.psfb21[s],r.floor);e.nsPsy.longfact[21]>1e-12&&(c*=e.nsPsy.longfact[21]);for(var f=l-1;f>=o;f--){if(!(Math.abs(a[f])=0&&!i;s--){l=(o=3*e.scalefac_band.s[12]+(e.scalefac_band.s[13]-e.scalefac_band.s[12])*u+(e.scalefac_band.psfb12[s]-e.scalefac_band.psfb12[0]))+(e.scalefac_band.psfb12[s+1]-e.scalefac_band.psfb12[s]);var _=n.athAdjust(r.adjust,r.psfb12[s],r.floor);e.nsPsy.shortfact[12]>1e-12&&(_*=e.nsPsy.shortfact[12]);for(f=l-1;f>=o;f--){if(!(Math.abs(a[f])<_)){i=!0;break}a[f]=0}}}(e,t)},s.BINSEARCH_NONE=new s(0),s.BINSEARCH_UP=new s(1),s.BINSEARCH_DOWN=new s(2),this.trancate_smallspectrums=function(e,t,a,s){var o=i($.SFBMAX);if((0!=(4&e.substep_shaping)||t.block_type!=F.SHORT_TYPE)&&0==(128&e.substep_shaping)){n.calc_noise(t,a,o,new T,null);for(var l=0;l<576;l++){var c=0;0!=t.l3_enc[l]&&(c=Math.abs(t.xr[l])),s[l]=c}l=0;var f=8;t.block_type==F.SHORT_TYPE&&(f=6);do{var _,p,h,d,v=t.width[f];if(l+=v,!(o[f]>=1||(u.sort(s,l-v,v),k.EQ(s[l-1],0)))){_=(1-o[f])*a[f],p=0,d=0;do{var m;for(h=1;d+h0)}}while(++fn?(u==s.BINSEARCH_DOWN&&(c=!0),c&&(l/=2),u=s.BINSEARCH_UP,_=l):(u==s.BINSEARCH_UP&&(c=!0),c&&(l/=2),u=s.BINSEARCH_DOWN,_=-l),t.global_gain+=_,t.global_gain<0&&(t.global_gain=0,c=!0),t.global_gain>255&&(t.global_gain=255,c=!0)}for(;o>n&&t.global_gain<255;)t.global_gain++,o=r.count_bits(e,i,t,null);e.CurrentStep[a]=f-t.global_gain>=4?4:2,e.OldValue[a]=t.global_gain,t.part2_3_length=o}(p,t,u,f,o),0==p.noise_shaping)return 100;n.calc_noise(t,a,m,b,g),b.bits=t.part2_3_length,h.assign(t);var k=0;for(_.arraycopy(o,0,d,0,576);!w;){do{var M,A=new T,R=255;if(M=0!=(2&p.substep_shaping)?20:3,p.sfb21_extra){if(m[h.sfbmax]>1)break;if(h.block_type==F.SHORT_TYPE&&(m[h.sfbmax+1]>1||m[h.sfbmax+2]>1))break}if(!c(e,h,m,o,S))break;0!=h.scalefac_scale&&(R=254);var B=u-h.part2_length;if(B<=0)break;for(;(h.part2_3_length=r.count_bits(p,o,h,g))>B&&h.global_gain<=R;)h.global_gain++;if(h.global_gain>R)break;if(0==b.over_count){for(;(h.part2_3_length=r.count_bits(p,o,h,g))>y&&h.global_gain<=R;)h.global_gain++;if(h.global_gain>R)break}if(n.calc_noise(h,a,m,A,g),A.bits=h.part2_3_length,0!=(l(t.block_type!=F.SHORT_TYPE?e.quant_comp:e.quant_comp_short,b,A,h,m)?1:0))y=t.part2_3_length,b=A,t.assign(h),k=0,_.arraycopy(o,0,d,0,576);else if(0==p.full_outer_loop){if(++k>M&&0==b.over_count)break;if(3==p.noise_shaping_amp&&S&&k>30)break;if(3==p.noise_shaping_amp&&S&&h.global_gain-x>15)break}}while(h.global_gain+h.scalefac_scale<255);3==p.noise_shaping_amp?S?w=!0:(h.assign(t),_.arraycopy(d,0,o,0,576),k=0,x=h.global_gain,S=!0):w=!0}return e.VBR==v.vbr_rh||e.VBR==v.vbr_mtrh?_.arraycopy(d,0,o,0,576):0!=(1&p.substep_shaping)&&trancate_smallspectrums(p,t,a,o),b.over_count},this.iteration_finish_one=function(e,n,a){var i=e.l3_side,s=i.tt[n][a];r.best_scalefac_store(e,n,a,i),1==e.use_best_huffman&&r.best_huffman_divide(e,s),t.ResvAdjust(e,s)},this.VBR_encode_granule=function(e,t,n,r,a,s,o){var l,c=e.internal_flags,f=new H,p=i(576),h=o,d=o+1,v=(o+s)/2,m=0,b=c.sfb21_extra;u.fill(f.l3_enc,0);do{c.sfb21_extra=!(v>h-42)&&b,outer_loop(e,t,n,r,a,v)<=0?(m=1,d=t.part2_3_length,f.assign(t),_.arraycopy(r,0,p,0,576),l=(o=d-32)-s,v=(o+s)/2):(l=o-(s=v+32),v=(o+s)/2,0!=m&&(m=2,t.assign(f),_.arraycopy(p,0,r,0,576)))}while(l>12);c.sfb21_extra=b,2==m&&_.arraycopy(f.l3_enc,0,t.l3_enc,0,576)},this.get_framebits=function(n,r){var a=n.internal_flags;a.bitrate_index=a.VBR_min_bitrate;var i=e.getframebits(n);a.bitrate_index=1,i=e.getframebits(n);for(var s=1;s<=a.VBR_max_bitrate;s++){a.bitrate_index=s;var o=new R(i);r[s]=t.ResvFrameBegin(n,o),i=o.bits}},this.VBR_old_prepare=function(e,r,a,i,s,o,l,c,f){var u,_=e.internal_flags,p=0,h=1,d=0;_.bitrate_index=_.VBR_max_bitrate;var v=t.ResvFrameBegin(e,new R(0))/_.mode_gr;get_framebits(e,o);for(var m=0;m<_.mode_gr;m++){var b=n.on_pe(e,r,c[m],v,m,0);_.mode_ext==F.MPG_MD_MS_LR&&(ms_convert(_.l3_side,m),n.reduce_side(c[m],a[m],v,b));for(var g=0;g<_.channels_out;++g){var y=_.l3_side.tt[m][g];y.block_type!=F.SHORT_TYPE?(p=1.28/(1+Math.exp(3.5-r[m][g]/300))-.05,u=_.PSY.mask_adjust-p):(p=2.56/(1+Math.exp(3.5-r[m][g]/300))-.14,u=_.PSY.mask_adjust_short-p),_.masking_lower=Math.pow(10,.1*u),init_outer_loop(_,y),f[m][g]=n.calc_xmin(e,i[m][g],y,s[m][g]),0!=f[m][g]&&(h=0),l[m][g]=126,d+=c[m][g]}}for(m=0;m<_.mode_gr;m++)for(g=0;g<_.channels_out;g++)d>o[_.VBR_max_bitrate]&&(c[m][g]*=o[_.VBR_max_bitrate],c[m][g]/=d),l[m][g]>c[m][g]&&(l[m][g]=c[m][g]);return h},this.bitpressure_strategy=function(e,t,n,r){for(var a=0;al&&(o[h][d]*=l,o[h][d]/=_);return f},this.calc_target_bits=function(r,a,i,s,o,l){var c,f,u,_,p=r.internal_flags,h=p.l3_side,d=0;p.bitrate_index=p.VBR_max_bitrate;var v=new R(d);for(l[0]=t.ResvFrameBegin(r,v),d=v.bits,p.bitrate_index=1,d=e.getframebits(r)-8*p.sideinfo_len,o[0]=d/(p.mode_gr*p.channels_out),d=r.VBR_mean_bitrate_kbps*r.framesize*1e3,0!=(1&p.substep_shaping)&&(d*=1.09),d/=r.out_samplerate,d-=8*p.sideinfo_len,d/=p.mode_gr*p.channels_out,(c=.93+.07*(11-r.compression_ratio)/5.5)<.9&&(c=.9),c>1&&(c=1),f=0;f700){var b=int((a[f][u]-700)/1.4),g=h.tt[f][u];s[f][u]=int(c*d),g.block_type==F.SHORT_TYPE&&b3*d/2?b=3*d/2:b<0&&(b=0),s[f][u]+=b}s[f][u]>U.MAX_BITS_PER_CHANNEL&&(s[f][u]=U.MAX_BITS_PER_CHANNEL),m+=s[f][u]}if(m>U.MAX_BITS_PER_GRANULE)for(u=0;uU.MAX_BITS_PER_CHANNEL&&(s[f][u]=U.MAX_BITS_PER_CHANNEL),_+=s[f][u];if(_>l[0])for(f=0;f=0;--z){var ee,te;ee=V[q+z]*a[20+z]+V[q+-1-z]*s[28+z],te=V[q+z]*s[28+z]-V[q+-1-z]*a[20+z],V[q+-1-z]=ee,V[q+z]=te}}}if(I=p,N=286,1==e.mode_gr)for(var ne=0;ne<18;ne++)_.arraycopy(e.sb_sample[H][1][ne],0,e.sb_sample[H][0][ne],0,32)}}}function V(){this.thm=new X,this.en=new X}function F(){var e=F.FFTOFFSET,t=F.MPG_MD_MS_LR,n=null;this.psy=null;var r=null,s=null,l=null;this.setModules=function(e,t,a,i){n=e,this.psy=t,r=t,s=i,l=a};var c=new j;this.lame_encode_mp3_frame=function(u,p,h,d,b,g){var y,w=f([2,2]);w[0][0]=new V,w[0][1]=new V,w[1][0]=new V,w[1][1]=new V;var S,x=f([2,2]);x[0][0]=new V,x[0][1]=new V,x[1][0]=new V,x[1][1]=new V;var k,M,A,R=[null,null],T=u.internal_flags,B=o([2,4]),E=[.5,.5],C=[[0,0],[0,0]],P=[[0,0],[0,0]];if(R[0]=p,R[1]=h,0==T.lame_encode_frame_init&&function(e,t){var n,r,a=e.internal_flags;if(0==a.lame_encode_frame_init){var s,o,l=i(2014),f=i(2014);for(a.lame_encode_frame_init=1,s=0,o=0;s<286+576*(1+a.mode_gr);++s)s<576*a.mode_gr?(l[s]=0,2==a.channels_out&&(f[s]=0)):(l[s]=t[0][o],2==a.channels_out&&(f[s]=t[1][o]),++o);for(r=0;r0&&(E[A]=B[A][3]/E[A])),M=0;M.03125)e.ATH.adjust>=1?e.ATH.adjust=1:e.ATH.adjust=r?(e.ATH.adjust*=.075*r+.925,e.ATH.adjust=r?e.ATH.adjust=r:e.ATH.adjust>1,d=(h=a<<1)+(_=a),a=h<<1,s=(i=t)+v;do{x=e[i+0]-e[i+_],S=e[i+0]+e[i+_],R=e[i+h]-e[i+d],M=e[i+h]+e[i+d],e[i+h]=S-M,e[i+0]=S+M,e[i+d]=x-R,e[i+_]=x+R,x=e[s+0]-e[s+_],S=e[s+0]+e[s+_],R=p.SQRT2*e[s+d],M=p.SQRT2*e[s+h],e[s+h]=S-M,e[s+0]=S+M,e[s+d]=x-R,e[s+_]=x+R,s+=a,i+=a}while(i=0);r(n[l],c,F.BLKSIZE_s/2)}},this.fft_long=function(t,n,i,s,o){var l=F.BLKSIZE/8-1,c=F.BLKSIZE/2;do{var f,u,_,p,h,d=255&a[l];u=(f=e[d]*s[i][o+d])-(h=e[d+512]*s[i][o+d+512]),f+=h,p=(_=e[d+256]*s[i][o+d+256])-(h=e[d+768]*s[i][o+d+768]),_+=h,n[(c-=4)+0]=f+_,n[c+2]=f-_,n[c+1]=u+p,n[c+3]=u-p,u=(f=e[d+1]*s[i][o+d+1])-(h=e[d+513]*s[i][o+d+513]),f+=h,p=(_=e[d+257]*s[i][o+d+257])-(h=e[d+769]*s[i][o+d+769]),_+=h,n[c+F.BLKSIZE/2+0]=f+_,n[c+F.BLKSIZE/2+2]=f-_,n[c+F.BLKSIZE/2+1]=u+p,n[c+F.BLKSIZE/2+3]=u-p}while(--l>=0);r(n,c,F.BLKSIZE/2)},this.init_fft=function(n){for(var r=0;r=0;--d){var v=i[s+0][d],m=i[s+1][d];i[s+0][d]=(v+m)*p.SQRT2*.5,i[s+1][d]=(v-m)*p.SQRT2*.5}for(var b=2;b>=0;--b)for(d=F.BLKSIZE_s-1;d>=0;--d){v=o[l+0][b][d],m=o[l+1][b][d];o[l+0][b][d]=(v+m)*p.SQRT2*.5,o[l+1][b][d]=(v-m)*p.SQRT2*.5}}n[0]=i[s+0][0],n[0]*=n[0];for(d=F.BLKSIZE/2-1;d>=0;--d){var g=i[s+0][F.BLKSIZE/2-d],y=i[s+0][F.BLKSIZE/2+d];n[F.BLKSIZE/2-d]=.5*(g*g+y*y)}for(b=2;b>=0;--b){a[b][0]=o[l+0][b][0],a[b][0]*=a[b][0];for(d=F.BLKSIZE_s/2-1;d>=0;--d){g=o[l+0][b][F.BLKSIZE_s/2-d],y=o[l+0][b][F.BLKSIZE_s/2+d];a[b][F.BLKSIZE_s/2-d]=.5*(g*g+y*y)}}var w=0;for(d=11;de){if(!(t=t*c)return e+t;s=e/t}if(e+=t,r+3<=6){if(s>=l)return e;var o=0|p.FAST_LOG10_X(s,16);return e*g[o]}var u,_;o=0|p.FAST_LOG10_X(s,16);return t=0!=i?a.ATH.cb_s[n]*a.ATH.adjust:a.ATH.cb_l[n]*a.ATH.adjust,et?(u=1,o<=13&&(u=y[o]),_=p.FAST_LOG10_X(e/t,10/15),e*((b[o]-u)*_+u)):o>13?e:e*y[o]:e*b[o]}var S=[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 x(e,t,n){var r;if(e<0&&(e=0),t<0&&(t=0),e<=0)return t;if(t<=0)return e;if(r=t>e?t/e:e/t,-2<=n&&n<=2){if(r>=l)return e+t;var a=0|p.FAST_LOG10_X(r,16);return(e+t)*S[a]}return r=f){++i;break}var _=e.PSY.bo_s_weight[i],p=1-_;o=_*t[s],l=_*n[s],e.en[r].s[i][a]+=o,e.thm[r].s[i][a]+=l,o=p*t[s],l=p*n[s]}for(;i=c){++a;break}var u=e.PSY.bo_l_weight[a],_=1-u;s=u*t[i],o=u*n[i],e.en[r].l[a]+=s,e.thm[r].l[a]+=o,s=_*t[i],o=_*n[i]}for(;a=1?e:n<=0?t:t>0?Math.pow(e/t,n)*t:0}var T=[11.8,13.6,17.2,32,46.5,51.3,57.5,67.1,71.5,84.6,97.6,130];function B(e,n){for(var r=309.07,a=0;a0){var o=s*n,l=e.en.s[a][i];l>o&&(r+=l>1e10*o?T[a]*(10*t):T[a]*p.FAST_LOG10(l/o))}}return r}var E=[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 C(e,n){for(var r=281.0575,a=0;a0){var s=i*n,o=e.en.l[a];o>s&&(r+=o>1e10*s?E[a]*(10*t):E[a]*p.FAST_LOG10(o/s))}}return r}function P(e,t,n,r,a){var i,s;for(i=s=0;i0?((o=t[i])a&&(l=a),r[i]=l):r[i]=0;for(i=1;i0)(o=t[i-1])a&&(l=a),r[i]=l;else r[i]=0}(s=n[i-1]+n[i])>0?((o=t[i-1])a&&(l=a),r[i]=l):r[i]=0}var L=[-1730326e-23,-.01703172,-1349528e-23,.0418072,-673278e-22,-.0876324,-30835e-21,.1863476,-1104424e-22,-.627638];function I(t,n,r,a,i,s,o,l){var c=t.internal_flags;if(a<2)e.fft_long(c,o[l],a,n,r);else if(2==a)for(var f=F.BLKSIZE-1;f>=0;--f){var u=o[l+0][f],_=o[l+1][f];o[l+0][f]=(u+_)*p.SQRT2*.5,o[l+1][f]=(u-_)*p.SQRT2*.5}s[0]=o[l+0][0],s[0]*=s[0];for(f=F.BLKSIZE/2-1;f>=0;--f){var h=o[l+0][F.BLKSIZE/2-f],d=o[l+0][F.BLKSIZE/2+f];s[F.BLKSIZE/2-f]=.5*(h*h+d*d)}var v=0;for(f=11;f=0;--f){var u=o[l+0][i][f],_=o[l+1][i][f];o[l+0][i][f]=(u+_)*p.SQRT2*.5,o[l+1][i][f]=(u-_)*p.SQRT2*.5}s[i][0]=o[l+0][i][0],s[i][0]*=s[i][0];for(f=F.BLKSIZE_s/2-1;f>=0;--f){var h=o[l+0][i][F.BLKSIZE_s/2-f],d=o[l+0][i][F.BLKSIZE_s/2+f];s[i][F.BLKSIZE_s/2-f]=.5*(h*h+d*d)}}function H(e,t,n,a){var i=e.internal_flags;2==e.athaa_loudapprox&&n<2&&(i.loudness_sq[t][n]=i.loudness_sq_save[n],i.loudness_sq_save[n]=r(a,i))}this.L3psycho_anal_ns=function(e,t,n,r,l,c,f,p,d,b){var g,y,S,x,T,E,I,N,H,$,D=e.internal_flags,j=o([2,F.BLKSIZE]),V=o([2,3,F.BLKSIZE_s]),q=i(F.CBANDS+1),Y=i(F.CBANDS+1),X=i(F.CBANDS+2),z=a(2),U=a(2),K=o([2,576]),W=a(F.CBANDS+2),Z=a(F.CBANDS+2);for(u.fill(Z,0),g=D.channels_out,e.mode==m.JOINT_STEREO&&(g=4),H=e.VBR==v.vbr_off?0==D.ResvMax?0:D.ResvSize/D.ResvMax*.5:e.VBR==v.vbr_rh||e.VBR==v.vbr_mtrh||e.VBR==v.vbr_mt?.6:1,y=0;y2&&(c[r][y].en.assign(D.en[y+2]),c[r][y].thm.assign(D.thm[y+2]))}for(y=0;yne[x+3-2]?ve/=ne[x+3-2]:ve=ne[x+3-2]>10*ve?ne[x+3-2]/(10*ve):0,ae[x+3]=ve}if(e.analysis){var me=ae[0];for(x=1;x<12;x++)mete&&(le[x/3]=x%3+1);for(x=1;x<4;x++){(re[x-1]>re[x]?re[x-1]/re[x]:re[x]/re[x-1])<1.7&&(le[x]=0,1==x&&(le[0]=0))}for(0!=le[0]&&0!=D.nsPsy.lastAttacks[y]&&(le[0]=0),3!=D.nsPsy.lastAttacks[y]&&le[0]+le[1]+le[2]+le[3]==0||(ie=0,0!=le[1]&&0!=le[0]&&(le[1]=0),0!=le[2]&&0!=le[1]&&(le[2]=0),0!=le[3]&&0!=le[2]&&(le[3]=0)),y<2?U[y]=ie:0==ie&&(U[0]=U[1]=0),d[y]=D.tot_ener[y],s(e,ce,fe,j,1&y,V,1&y,r,y,t,n),P(D,ce,q,se,oe),O(D,se,oe,W),N=0;N<3;N++){var be,ge;for(A(e,fe,Y,X,y,N),k(D,Y,X,y,N),I=0;I=2||1==le[N+1]){var ye=0!=N?N-1:2;ve=R(D.thm[y].s[I][ye],ge,.6*H);ge=Math.min(ge,ve)}if(1==le[N]){ye=0!=N?N-1:2,ve=R(D.thm[y].s[I][ye],ge,.3*H);ge=Math.min(ge,ve)}else if(0!=N&&3==le[N-1]||0==N&&3==D.nsPsy.lastAttacks[y]){ye=2!=N?N+1:0,ve=R(D.thm[y].s[I][ye],ge,.3*H);ge=Math.min(ge,ve)}be=ne[3*N+3]+ne[3*N+4]+ne[3*N+5],6*ne[3*N+5]0&&function(e,t){var n=e.internal_flags;if(n.channels_out>1){for(var r=0;r1.58*e.thm[1].l[t]||e.thm[1].l[t]>1.58*e.thm[0].l[t])){var n=e.mld_l[t]*e.en[3].l[t],r=Math.max(e.thm[2].l[t],Math.min(e.thm[3].l[t],n));n=e.mld_l[t]*e.en[2].l[t];var a=Math.max(e.thm[3].l[t],Math.min(e.thm[2].l[t],n));e.thm[2].l[t]=r,e.thm[3].l[t]=a}for(t=0;t1.58*e.thm[1].s[t][i]||e.thm[1].s[t][i]>1.58*e.thm[0].s[t][i])){n=e.mld_s[t]*e.en[3].s[t][i],r=Math.max(e.thm[2].s[t][i],Math.min(e.thm[3].s[t][i],n));n=e.mld_s[t]*e.en[2].s[t][i];a=Math.max(e.thm[3].s[t][i],Math.min(e.thm[2].s[t][i],n));e.thm[2].s[t][i]=r,e.thm[3].s[t][i]=a}}(D),$=e.msfix,Math.abs($)>0&&function(e,t,n){var r=t,a=Math.pow(10,n);t*=2,r*=2;for(var i=0;i1?(ke=p,Re=-2,Me=F.NORM_TYPE,b[0]!=F.SHORT_TYPE&&b[1]!=F.SHORT_TYPE||(Me=F.SHORT_TYPE),Ae=c[r][y-2]):(ke=f,Re=0,Me=b[y],Ae=l[r][y]),Me==F.SHORT_TYPE?ke[Re+y]=B(Ae,D.masking_lower):ke[Re+y]=C(Ae,D.masking_lower),e.analysis&&(D.pinfo.pe[r][y]=ke[Re+y])}return 0};var $=[-1730326e-23,-.01703172,-1349528e-23,.0418072,-673278e-22,-.0876324,-30835e-21,.1863476,-1104424e-22,-.627638];function D(e,t,n){if(0==n)for(var r=0;r0?((o=t[i])a&&(l=a),r[i]=l):r[i]=0,i=1;i0)(o=t[i-1])a&&(l=a),r[i]=l;else r[i]=0}(s=n[i-1]+n[i])>0?((o=t[i-1])a&&(l=a),r[i]=l):r[i]=0}(f,u,p,h),l=c=0;cw&&(r[c]=w),f.masking_lower>1&&(r[c]*=f.masking_lower),r[c]>n[c]&&(r[c]=n[c]),f.masking_lower<1&&(r[c]*=f.masking_lower)}for(;c0?Math.min(h,y):Math.min(h,.3*n[o])}else{var w=16*e.nb_2[s][o],S=2*e.nb_1[s][o];w<=0&&(w=h),S<=0&&(S=h),y=e.blocktype_old[1&s]==F.NORM_TYPE?Math.min(S,w):S,r[o]=Math.min(h,y)}e.nb_2[s][o]=e.nb_1[s][o],e.nb_1[s][o]=h,p=l[o],p*=e.minval_l[o],p*=d,r[o]>p&&(r[o]=p),e.masking_lower>1&&(r[o]*=e.masking_lower),r[o]>n[o]&&(r[o]=n[o]),e.masking_lower<1&&(r[o]*=e.masking_lower)}for(;o0?Math.pow(10,a):1,u=0;u0){var y,w,S=r[u]*f;if(y=Math.min(Math.max(h,S),Math.max(d,S)),(w=(v=Math.max(l,S))+(m=Math.max(o,S)))>0&&y*c_&&(l=_),o>p&&(o=p),t[2][u]=l,t[3][u]=o}}function X(e,t){var n;return(n=e>=0?27*-e:e*t)<=-72?0:Math.exp(.2302585093*n)}function z(e){var t,n,r=0;for(r=0;X(r,e)>1e-20;r-=1);for(a=r,i=0;Math.abs(i-a)>1e-12;)X(r=(i+a)/2,e)>0?i=r:a=r;t=a;var a,i;r=0;for(r=0;X(r,e)>1e-20;r+=1);for(a=0,i=r;Math.abs(i-a)>1e-12;)X(r=(i+a)/2,e)>0?a=r:i=r;n=i;var s,o=0,l=1e3;for(s=0;s<=l;++s){o+=X(r=t+s*(n-t)/l,e)}return 1001/(o*(n-t))}function U(e){return e<0&&(e=0),e*=.001,13*Math.atan(.76*e)+3.5*Math.atan(e*e/56.25)}function W(e,t,n,r,s,o,l,c,f,u,_,p){var h,d=i(F.CBANDS+1),v=c/(p>15?1152:384),m=a(F.HBLKSIZE);c/=f;var b=0,g=0;for(h=0;hf/2){b=f/2,++h;break}}d[h]=c*b;for(var w=0;wf/2&&(x=f/2),n[w]=(m[S]+m[x])/2,t[w]=m[x];var R=v*M;l[w]=(R-d[t[w]])/(d[t[w]+1]-d[t[w]]),l[w]<0?l[w]=0:l[w]>1&&(l[w]=1),A=U(c*u[w]*_),A=Math.min(A,15.5)/15.5,o[w]=Math.pow(10,1.25*(1-Math.cos(Math.PI*A))-2.5)}b=0;for(var T=0;T=0?3:1.5)>=.5&&f<=2.5?8*((p=f-.5)*p-2*p):0,((_=15.811389+7.5*(f+=.474)-17.5*Math.sqrt(1+f*f))<=-60?0:(f=Math.exp(.2302585093*(u+_)),f/=.6609193))*r[l]);h[v][l]=m*a[v]}else for(l=0;l0);l++);for(e[v][0]=l,l=t-1;l>0&&!(h[v][l]>0);l--);e[v][1]=l,d+=e[v][1]-e[v][0]+1}var y=i(d),w=0;for(v=0;v2&&(s[r][v].en.assign(p.en[v+2]),s[r][v].thm.assign(p.thm[v+2]))}for(v=0;v0;++g,--S){var E=_[0][g],C=_[1][g];_[0][g]=E+C,_[1][g]=E-C}for(g=0;g<3;g++)k[g]=p.nsPsy.last_en_subshort[v][g+6],x[g]=k[g]/p.nsPsy.last_en_subshort[v][g+4],M[0]+=k[g];for(g=0;g<9;g++){for(var P=R+64,O=1;Rk[g+3-2]?O/=k[g+3-2]:O=k[g+3-2]>10*O?k[g+3-2]/(10*O):0,x[g+3]=O}for(g=0;g<3;++g){var L=k[3*g+3]+k[3*g+4]+k[3*g+5],I=1;6*k[3*g+5]T&&(f[v][g/3]=g%3+1);for(g=1;g<4;g++){var H=M[g-1],D=M[g];Math.max(H,D)<4e4&&H<1.7*D&&D<1.7*H&&(1==g&&f[v][0]<=f[v][g]&&(f[v][0]=0),f[v][g]=0)}f[v][0]<=p.nsPsy.lastAttacks[v]&&(f[v][0]=0),3!=p.nsPsy.lastAttacks[v]&&f[v][0]+f[v][1]+f[v][2]+f[v][3]==0||(B=0,0!=f[v][1]&&0!=f[v][0]&&(f[v][1]=0),0!=f[v][2]&&0!=f[v][1]&&(f[v][2]=0),0!=f[v][3]&&0!=f[v][2]&&(f[v][3]=0)),v<2?u[v]=B:0==B&&(u[0]=u[1]=0),l[v]=p.tot_ener[v]}}(e,t,n,r,s,l,u,S,x,A),function(e,t){var n=e.internal_flags;e.short_blocks!=h.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var r=0;r=2||1==x[E][P+1]){var U=0!=P?P-1:2,K=R(p.thm[E].s[L][U],z,.36);z=Math.min(z,K)}else if(1==x[E][P]){U=0!=P?P-1:2,K=R(p.thm[E].s[L][U],z,.18);z=Math.min(z,K)}else if(0!=P&&3==x[E][P-1]||0==P&&3==p.nsPsy.lastAttacks[E]){U=2!=P?P+1:0,K=R(p.thm[E].s[L][U],z,.18);z=Math.min(z,K)}z*=S[E][P],X[P]=z}for(P=0;P<3;P++)p.thm[E].s[L][P]=X[P]}}for(E=0;E1?(W=f,Z=-2,G=F.NORM_TYPE,_[0]!=F.SHORT_TYPE&&_[1]!=F.SHORT_TYPE||(G=F.SHORT_TYPE),Q=l[r][E-2]):(W=c,Z=0,G=_[E],Q=s[r][E]),G==F.SHORT_TYPE?W[Z+E]=B(Q,p.masking_lower):W[Z+E]=C(Q,p.masking_lower),e.analysis&&(p.pinfo.pe[r][E]=W[Z+E])}return 0},this.psymodel_init=function(n){var r,a=n.internal_flags,s=!0,o=13,u=0,_=0,p=-8.25,h=-4.5,m=i(F.CBANDS),b=i(F.CBANDS),g=i(F.CBANDS),y=n.out_samplerate;switch(n.experimentalZ){default:case 0:s=!0;break;case 1:s=n.VBR!=v.vbr_mtrh&&n.VBR!=v.vbr_mt;break;case 2:s=!1;break;case 3:o=8,u=-1.75,_=-.0125,p=-8.25,h=-2.25}for(a.ms_ener_ratio_old=.25,a.blocktype_old[0]=a.blocktype_old[1]=F.NORM_TYPE,r=0;r<4;++r){for(var w=0;w=o&&(x=_*(m[r]-o)/(24-o)+u*(24-m[r])/(24-o)),g[r]=Math.pow(10,x/10),a.numlines_l[r]>0?a.rnumlines_l[r]=1/a.numlines_l[r]:a.rnumlines_l[r]=0}a.s3_ll=Z(a.s3ind,a.npart_l,m,b,g,s);var k;w=0;for(r=0;r(T*=a.numlines_l[r])&&(R=T)}a.ATH.cb_l[r]=R,(R=20*m[r]/10-20)>6&&(R=100),R<-15&&(R=-15),R-=8,a.minval_l[r]=Math.pow(10,R/10)*a.numlines_l[r]}for(a.npart_s=W(a.numlines_s,a.bo_s,a.bm_s,m,b,a.mld_s,a.PSY.bo_s_weight,y,F.BLKSIZE_s,a.scalefac_band.s,F.BLKSIZE_s/384,F.SBMAX_s),w=0,r=0;r=o&&(x=h*(m[r]-o)/(24-o)+p*(24-m[r])/(24-o)),g[r]=Math.pow(10,x/10),R=d.MAX_VALUE;for(M=0;M(T*=a.numlines_s[r])&&(R=T)}a.ATH.cb_s[r]=R,R=7*m[r]/12-7,m[r]>12&&(R*=1+3.1*Math.log(1+R)),m[r]<12&&(R*=1+2.3*Math.log(1-R)),R<-15&&(R=-15),R-=8,a.minval_s[r]=Math.pow(10,R/10)*a.numlines_s[r]}a.s3_ss=Z(a.s3ind_s,a.npart_s,m,b,g,s),l=Math.pow(10,9/16),c=Math.pow(10,1.5),f=Math.pow(10,1.5),e.init_fft(a),a.decay=Math.exp(-1*t/(.01*y/192)),k=3.5,0!=(2&n.exp_nspsytune)&&(k=1),Math.abs(n.msfix)>0&&(k=n.msfix),n.msfix=k;for(var B=0;Ba.npart_l-1&&(a.s3ind[B][1]=a.npart_l-1);var E=576*a.mode_gr/y;if(a.ATH.decay=Math.pow(10,-1.2*E),a.ATH.adjust=.01,a.ATH.adjustLimit=1,-1!=n.ATHtype){var C=n.out_samplerate/F.BLKSIZE,P=0;for(A=0,r=0;r=0;)a.ATH.eql_w[r]*=P}for(B=w=0;B1?0:e<=0?1:Math.cos(Math.PI/2*e)}function S(e,t){switch(e){case 44100:return t.version=1,0;case 48e3:return t.version=1,1;case 32e3:return t.version=1,2;case 22050:return t.version=0,0;case 24e3:return t.version=0,1;case 16e3:return t.version=0,2;case 11025:return t.version=0,0;case 12e3:return t.version=0,1;case 8e3:return t.version=0,2;default:return t.version=0,-1}}function x(e,t,n){n<16e3&&(t=2);for(var r=A.bitrate_table[t][1],a=2;a<=14;a++)A.bitrate_table[t][a]>0&&Math.abs(A.bitrate_table[t][a]-e)0&&A.bitrate_table[t][r]==e)return r;return-1}function R(t,n){var r=[new g(8,2e3),new g(16,3700),new g(24,3900),new g(32,5500),new g(40,7e3),new g(48,7500),new g(56,1e4),new g(64,11e3),new g(80,13500),new g(96,15100),new g(112,15600),new g(128,17e3),new g(160,17500),new g(192,18600),new g(224,19400),new g(256,19700),new g(320,20500)],a=e.nearestBitrateFullIndex(n);t.lowerlimit=r[a].lowpass}function T(e){var t=F.BLKSIZE+e.framesize-F.FFTOFFSET;return t=Math.max(t,512+e.framesize-32)}function B(t,n,r,a,i,s){var o=e.enc.lame_encode_mp3_frame(t,n,r,a,i,s);return t.frameNum++,o}function L(){this.n_in=0,this.n_out=0}function I(){this.num_used=0}function N(e,t,n){var r=Math.PI*t;(e/=n)<0&&(e=0),e>1&&(e=1);var a=e-.5,i=.42-.5*Math.cos(2*e*Math.PI)+.08*Math.cos(4*e*Math.PI);return Math.abs(a)<1e-9?r/Math.PI:i*Math.sin(n*r*a)/(Math.PI*n*a)}function H(e,t,n,r,a,s,o,l,c){var f,u,_=e.internal_flags,p=0,h=e.out_samplerate/function e(t,n){return 0!=n?e(n,t%n):t}(e.out_samplerate,e.in_samplerate);h>U.BPC&&(h=U.BPC);var d=Math.abs(_.resample_ratio-Math.floor(.5+_.resample_ratio))<1e-4?1:0,v=1/_.resample_ratio;v>1&&(v=1);var m=31;0==m%2&&--m;var b=(m+=d)+1;if(0==_.fill_buffer_resample_init){for(_.inbuf_old[0]=i(b),_.inbuf_old[1]=i(b),f=0;f<=2*h;++f)_.blackfilt[f]=i(b);for(_.itime[0]=0,_.itime[1]=0,p=0;p<=2*h;p++){var g=0,y=(p-h)/(2*h);for(f=0;f<=m;f++)g+=_.blackfilt[p][f]=N(f-y,v,m);for(f=0;f<=m;f++)_.blackfilt[p][f]/=g}_.fill_buffer_resample_init=1}var w=_.inbuf_old[c];for(u=0;u=o)break;y=S-_.itime[c]-(p+m%2*.5);x=0|Math.floor(2*y*h+h+.5);var k=0;for(f=0;f<=m;++f){var M=f+p-m/2;k+=(M<0?w[b+M]:a[s+M])*_.blackfilt[x][f]}t[n+u]=k}if(l.num_used=Math.min(o,m+p-m/2),_.itime[c]+=l.num_used-u*_.resample_ratio,l.num_used>=b)for(f=0;f1.0001)for(var o=0;oe-r?n:a},this.lame_init_params=function(e){var i,c,g,T=e.internal_flags;if(T.Class_ID=0,null==T.ATH&&(T.ATH=new E),null==T.PSY&&(T.PSY=new d),null==T.rgdata&&(T.rgdata=new O),T.channels_in=e.num_channels,1==T.channels_in&&(e.mode=m.MONO),T.channels_out=e.mode==m.MONO?1:2,T.mode_ext=F.MPG_MD_MS_LR,e.mode==m.MONO&&(e.force_ms=!1),e.VBR==v.vbr_off&&128!=e.VBR_mean_bitrate_kbps&&0==e.brate&&(e.brate=e.VBR_mean_bitrate_kbps),e.VBR==v.vbr_off||e.VBR==v.vbr_mtrh||e.VBR==v.vbr_mt||(e.free_format=!1),e.VBR==v.vbr_off&&0==e.brate&&k.EQ(e.compression_ratio,0)&&(e.compression_ratio=11.025),e.VBR==v.vbr_off&&e.compression_ratio>0&&(0==e.out_samplerate&&(e.out_samplerate=map2MP3Frequency(int(.97*e.in_samplerate))),e.brate=0|16*e.out_samplerate*T.channels_out/(1e3*e.compression_ratio),T.samplerate_index=S(e.out_samplerate,e),e.free_format||(e.brate=x(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 B=16e3;switch(e.VBR){case v.vbr_off:R(C=new b,e.brate),B=C.lowerlimit;break;case v.vbr_abr:var C;R(C=new b,e.VBR_mean_bitrate_kbps),B=C.lowerlimit;break;case v.vbr_rh:var L=[19500,19e3,18600,18e3,17500,16e3,15600,14900,12500,1e4,3950];if(0<=e.VBR_q&&e.VBR_q<=9){var I=L[e.VBR_q],N=L[e.VBR_q+1],H=e.VBR_q_frac;B=linear_int(I,N,H)}else B=19500;break;default:L=[19500,19e3,18500,18e3,17500,16500,15500,14500,12500,9500,3950];if(0<=e.VBR_q&&e.VBR_q<=9){I=L[e.VBR_q],N=L[e.VBR_q+1],H=e.VBR_q_frac;B=linear_int(I,N,H)}else B=19500}e.mode!=m.MONO||e.VBR!=v.vbr_off&&e.VBR!=v.vbr_abr||(B*=1.5),e.lowpassfreq=0|B}if(0==e.out_samplerate&&(2*e.lowpassfreq>e.in_samplerate&&(e.lowpassfreq=e.in_samplerate/2),e.out_samplerate=(i=0|e.lowpassfreq,c=e.in_samplerate,g=44100,c>=48e3?g=48e3:c>=44100?g=44100:c>=32e3?g=32e3:c>=24e3?g=24e3:c>=22050?g=22050:c>=16e3?g=16e3:c>=12e3?g=12e3:c>=11025?g=11025:c>=8e3&&(g=8e3),-1==i?g:(i<=15960&&(g=44100),i<=15250&&(g=32e3),i<=11220&&(g=24e3),i<=9970&&(g=22050),i<=7230&&(g=16e3),i<=5420&&(g=12e3),i<=4510&&(g=11025),i<=3970&&(g=8e3),c44100?48e3:c>32e3?44100:c>24e3?32e3:c>22050?24e3:c>16e3?22050:c>12e3?16e3:c>11025?12e3:c>8e3?11025:8e3:g))),e.lowpassfreq=Math.min(20500,e.lowpassfreq),e.lowpassfreq=Math.min(e.out_samplerate/2,e.lowpassfreq),e.VBR==v.vbr_off&&(e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.brate)),e.VBR==v.vbr_abr&&(e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.VBR_mean_bitrate_kbps)),e.bWriteVbrTag||(e.findReplayGain=!1,e.decode_on_the_fly=!1,T.findPeakSample=!1),T.findReplayGain=e.findReplayGain,T.decode_on_the_fly=e.decode_on_the_fly,T.decode_on_the_fly&&(T.findPeakSample=!0),T.findReplayGain&&t.InitGainAnalysis(T.rgdata,e.out_samplerate)==y.INIT_GAIN_ANALYSIS_ERROR)return e.internal_flags=null,-6;switch(T.decode_on_the_fly&&!e.decode_only&&(null!=T.hip&&u.hip_decode_exit(T.hip),T.hip=u.hip_decode_init()),T.mode_gr=e.out_samplerate<=24e3?1:2,e.framesize=576*T.mode_gr,e.encoder_delay=F.ENCDELAY,T.resample_ratio=e.in_samplerate/e.out_samplerate,e.VBR){case v.vbr_mt:case v.vbr_rh:case v.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 v.vbr_abr:e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.VBR_mean_bitrate_kbps);break;default:e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.brate)}if(e.mode==m.NOT_SET&&(e.mode=m.JOINT_STEREO),e.highpassfreq>0?(T.highpass1=2*e.highpassfreq,e.highpasswidth>=0?T.highpass2=2*(e.highpassfreq+e.highpasswidth):T.highpass2=2*e.highpassfreq,T.highpass1/=e.out_samplerate,T.highpass2/=e.out_samplerate):(T.highpass1=0,T.highpass2=0),e.lowpassfreq>0?(T.lowpass2=2*e.lowpassfreq,e.lowpasswidth>=0?(T.lowpass1=2*(e.lowpassfreq-e.lowpasswidth),T.lowpass1<0&&(T.lowpass1=0)):T.lowpass1=2*e.lowpassfreq,T.lowpass1/=e.out_samplerate,T.lowpass2/=e.out_samplerate):(T.lowpass1=0,T.lowpass2=0),function(e){var t=e.internal_flags,n=32,r=-1;if(t.lowpass1>0){for(var a=999,i=0;i<=31;i++){(c=i/31)>=t.lowpass2&&(n=Math.min(n,i)),t.lowpass10&&t.highpass2<.75/31*.9&&(t.highpass1=0,t.highpass2=0,_.err.println("Warning: highpass filter disabled. highpass frequency too small\n")),t.highpass2>0){var s=-1;for(i=0;i<=31;i++){(c=i/31)<=t.highpass1&&(r=Math.max(r,i)),t.highpass1t.highpass1?w((t.highpass2-c)/(t.highpass2-t.highpass1+1e-20)):1,l=t.lowpass2>t.lowpass1?w((c-t.lowpass1)/(t.lowpass2-t.lowpass1+1e-20)):1,t.amp_filter[i]=o*l}}(e),T.samplerate_index=S(e.out_samplerate,e),T.samplerate_index<0)return e.internal_flags=null,-1;if(e.VBR==v.vbr_off){if(e.free_format)T.bitrate_index=0;else if(e.brate=x(e.brate,e.version,e.out_samplerate),T.bitrate_index=M(e.brate,e.version,e.out_samplerate),T.bitrate_index<=0)return e.internal_flags=null,-1}else T.bitrate_index=1;e.analysis&&(e.bWriteVbrTag=!1),null!=T.pinfo&&(e.bWriteVbrTag=!1),n.init_bit_stream_w(T);for(var $,D=T.samplerate_index+3*e.version+6*(e.out_samplerate<16e3?1:0),j=0;j5&&(e.quality=5),T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?T.sfb21_extra=!1:T.sfb21_extra=e.out_samplerate>44e3,T.iteration_loop=new VBRNewIterationLoop(s);break;case v.vbr_rh:r.apply_preset(e,500-10*e.VBR_q,0),T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?T.sfb21_extra=!1:T.sfb21_extra=e.out_samplerate>44e3,e.quality>6&&(e.quality=6),e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),T.iteration_loop=new VBROldIterationLoop(s);break;default:var Y;T.sfb21_extra=!1,e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),(Y=e.VBR)==v.vbr_off&&(e.VBR_mean_bitrate_kbps=e.brate),r.apply_preset(e,e.VBR_mean_bitrate_kbps,0),e.VBR=Y,T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,Y==v.vbr_off?T.iteration_loop=new P(s):T.iteration_loop=new ABRIterationLoop(s)}if(e.VBR!=v.vbr_off){if(T.VBR_min_bitrate=1,T.VBR_max_bitrate=14,e.out_samplerate<16e3&&(T.VBR_max_bitrate=8),0!=e.VBR_min_bitrate_kbps&&(e.VBR_min_bitrate_kbps=x(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),T.VBR_min_bitrate=M(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),T.VBR_min_bitrate<0))return-1;if(0!=e.VBR_max_bitrate_kbps&&(e.VBR_max_bitrate_kbps=x(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),T.VBR_max_bitrate=M(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),T.VBR_max_bitrate<0))return-1;e.VBR_min_bitrate_kbps=A.bitrate_table[e.version][T.VBR_min_bitrate],e.VBR_max_bitrate_kbps=A.bitrate_table[e.version][T.VBR_max_bitrate],e.VBR_mean_bitrate_kbps=Math.min(A.bitrate_table[e.version][T.VBR_max_bitrate],e.VBR_mean_bitrate_kbps),e.VBR_mean_bitrate_kbps=Math.max(A.bitrate_table[e.version][T.VBR_min_bitrate],e.VBR_mean_bitrate_kbps)}return e.tune&&(T.PSY.mask_adjust+=e.tune_value_a,T.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,-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,-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,-1==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=1,t.full_outer_loop=0}}(e),e.athaa_type<0?T.ATH.useAdjust=3:T.ATH.useAdjust=e.athaa_type,T.ATH.aaSensitivityP=Math.pow(10,e.athaa_sensitivity/-10),null==e.short_blocks&&(e.short_blocks=h.short_block_allowed),e.short_blocks!=h.short_block_allowed||e.mode!=m.JOINT_STEREO&&e.mode!=m.STEREO||(e.short_blocks=h.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=W.NSATTACKTHRE),e.internal_flags.nsPsy.attackthre_s<0&&(e.internal_flags.nsPsy.attackthre_s=W.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),T.slot_lag=T.frac_SpF=0,e.VBR==v.vbr_off&&(T.slot_lag=T.frac_SpF=72e3*(e.version+1)*e.brate%e.out_samplerate|0),a.iteration_init(e),p.psymodel_init(e),0},this.lame_encode_flush=function(e,t,r,a){var i,s,o,l,u=e.internal_flags,_=c([2,1152]),p=0,h=u.mf_samples_to_encode-F.POSTDELAY,d=T(e);if(u.mf_samples_to_encode<1)return 0;for(i=0,e.in_samplerate!=e.out_samplerate&&(h+=16*e.out_samplerate/e.in_samplerate),(o=e.framesize-h%e.framesize)<576&&(o+=e.framesize),e.encoder_padding=o,l=(h+o)/e.framesize;l>0&&p>=0;){var v=d-u.mf_size,m=e.frameNum;v*=e.in_samplerate,(v/=e.out_samplerate)>1152&&(v=1152),v<1&&(v=1),s=a-i,0==a&&(s=0),r+=p=this.lame_encode_buffer(e,_[0],_[1],v,t,r,s),i+=p,l-=m!=e.frameNum?1:0}if(u.mf_samples_to_encode=0,p<0)return p;if(s=a-i,0==a&&(s=0),n.flush_bitstream(e),(p=n.copy_buffer(u,t,r,s,1))<0)return p;if(r+=p,s=a-(i+=p),0==a&&(s=0),e.write_id3tag_automatic){if(f.id3tag_write_v1(e),(p=n.copy_buffer(u,t,r,s,0))<0)return p;i+=p}return i},this.lame_encode_buffer=function(e,r,a,s,o,l,c){var f=e.internal_flags,u=[null,null];if(4294479419!=f.Class_ID)return-3;if(0==s)return 0;!function(e,t){(null==e.in_buffer_0||e.in_buffer_nsamples1&&(u[1][_]=a[_]);return function(e,r,a,i,s,o,l){var c,f,u,_,p,h=e.internal_flags,d=0,v=[null,null],m=[null,null];if(4294479419!=h.Class_ID)return-3;if(0==i)return 0;if((p=n.copy_buffer(h,s,o,l,0))<0)return p;if(o+=p,d+=p,m[0]=r,m[1]=a,k.NEQ(e.scale,0)&&k.NEQ(e.scale,1))for(f=0;f0;){var g,w,S=[null,null];S[0]=m[0],S[1]=m[1];var x=new L;if($(e,v,S,b,i,x),g=x.n_in,w=x.n_out,h.findReplayGain&&!h.decode_on_the_fly&&t.AnalyzeSamples(h.rgdata,v[0],h.mf_size,v[1],h.mf_size,w,h.channels_out)==y.GAIN_ANALYSIS_ERROR)return-6;if(i-=g,b+=g,h.channels_out,h.mf_size+=w,h.mf_samples_to_encode<1&&(h.mf_samples_to_encode=F.ENCDELAY+F.POSTDELAY),h.mf_samples_to_encode+=w,h.mf_size>=_){var M=l-d;if(0==l&&(M=0),(c=B(e,v[0],v[1],s,o,M))<0)return c;for(o+=c,d+=c,h.mf_size-=e.framesize,h.mf_samples_to_encode-=e.framesize,u=0;uR&&(R=t.length,B=n(T=0|1.25*R+7200));var i=a.lame_encode_buffer(A,t,r,t.length,B,0,T);return new Int8Array(B.subarray(0,i))},this.flush=function(){var e=a.lame_encode_flush(A,B,0,T);return new Int8Array(B.subarray(0,e))}}}e(),Recorder.lamejs=e}()},function(e,t,n){"use strict";var r=n(5);n.n(r).a},function(e,t,n){(e.exports=n(15)(!1)).push([e.i,"\nbody{\r\n word-wrap: break-word;\r\n background:#f5f5f5 center top no-repeat;\r\n background-size: auto 680px;\n}\npre{\r\n white-space:pre-wrap;\n}\na{\r\n text-decoration: none;\r\n color:#06c;\n}\na:hover{\r\n color:#f00;\n}\n.main{\r\n max-width:700px;\r\n margin:0 auto;\r\n padding-bottom:80px\n}\n.mainBox{\r\n margin-top:12px;\r\n padding: 12px;\r\n border-radius: 6px;\r\n background: #fff;\r\n --border: 1px solid #0b1;\r\n box-shadow: 2px 2px 3px #aaa;\n}\n.btns button{\r\n display: inline-block;\r\n cursor: pointer;\r\n border: none;\r\n border-radius: 3px;\r\n background: #0b1;\r\n color:#fff;\r\n padding: 0 15px;\r\n margin:3px 20px 3px 0;\r\n line-height: 36px;\r\n height: 36px;\r\n overflow: hidden;\r\n vertical-align: middle;\n}\n.btns button:active{\r\n background: #0a1;\n}\n.pd{\r\n\tpadding:0 0 6px 0;\n}\n.lb{\r\n\tdisplay:inline-block;\r\n\tvertical-align: middle;\r\n\tbackground:#00940e;\r\n\tcolor:#fff;\r\n\tfont-size:14px;\r\n\tpadding:2px 8px;\r\n\tborder-radius: 99px;\n}\r\n",""])}]); \ No newline at end of file + */function i(e){return null==e}function s(e){return null!=e}function o(e){return!0===e}function l(e){return"string"==typeof e||"number"==typeof e||"symbol"===(void 0===e?"undefined":r(e))||"boolean"==typeof e}function c(e){return null!==e&&"object"===(void 0===e?"undefined":r(e))}var f=Object.prototype.toString;function u(e){return"[object Object]"===f.call(e)}function _(e){return"[object RegExp]"===f.call(e)}function p(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function h(e){return s(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function d(e){return null==e?"":Array.isArray(e)||u(e)&&e.toString===f?JSON.stringify(e,null,2):String(e)}function v(e){var t=parseFloat(e);return isNaN(t)?e:t}function m(e,t){for(var n=Object.create(null),r=e.split(","),a=0;a-1)return e.splice(n,1)}}var w=Object.prototype.hasOwnProperty;function S(e,t){return w.call(e,t)}function x(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var k=/-(\w)/g,M=x((function(e){return e.replace(k,(function(e,t){return t?t.toUpperCase():""}))})),A=x((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),R=/\B([A-Z])/g,T=x((function(e){return e.replace(R,"-$1").toLowerCase()}));var B=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function E(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function C(e,t){for(var n in t)e[n]=t[n];return e}function P(e){for(var t={},n=0;n0,ee=G&&G.indexOf("edge/")>0,te=(G&&G.indexOf("android"),G&&/iphone|ipad|ipod|ios/.test(G)||"ios"===Z),ne=(G&&/chrome\/\d+/.test(G),G&&/phantomjs/.test(G),G&&G.match(/firefox\/(\d+)/)),re={}.watch,ae=!1;if(K)try{var ie={};Object.defineProperty(ie,"passive",{get:function(){ae=!0}}),window.addEventListener("test-passive",null,ie)}catch(e){}var se=function(){return void 0===z&&(z=!K&&!W&&void 0!==e&&(e.process&&"server"===e.process.env.VUE_ENV)),z},oe=K&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function le(e){return"function"==typeof e&&/native code/.test(e.toString())}var ce,fe="undefined"!=typeof Symbol&&le(Symbol)&&"undefined"!=typeof Reflect&&le(Reflect.ownKeys);ce="undefined"!=typeof Set&&le(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ue=O,_e=0,pe=function(){this.id=_e++,this.subs=[]};pe.prototype.addSub=function(e){this.subs.push(e)},pe.prototype.removeSub=function(e){y(this.subs,e)},pe.prototype.depend=function(){pe.target&&pe.target.addDep(this)},pe.prototype.notify=function(){var e=this.subs.slice();for(var t=0,n=e.length;t-1)if(i&&!S(a,"default"))s=!1;else if(""===s||s===T(e)){var l=Ye(String,a.type);(l<0||o0&&(pt((a=e(a,(n||"")+"_"+r))[0])&&pt(f)&&(u[c]=ye(f.text+a[0].text),a.shift()),u.push.apply(u,a)):l(a)?pt(f)?u[c]=ye(f.text+a):""!==a&&u.push(ye(a)):pt(a)&&pt(f)?u[c]=ye(f.text+a.text):(o(t._isVList)&&s(a.tag)&&i(a.key)&&s(n)&&(a.key="__vlist"+n+"_"+r+"__"),u.push(a)));return u}(e):void 0}function pt(e){return s(e)&&s(e.text)&&!1===e.isComment}function ht(e,t){if(e){for(var n=Object.create(null),r=fe?Reflect.ownKeys(e):Object.keys(e),a=0;a0,s=e?!!e.$stable:!i,o=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(s&&n&&n!==a&&o===n.$key&&!i&&!n.$hasNormal)return n;for(var l in r={},e)e[l]&&"$"!==l[0]&&(r[l]=bt(t,l,e[l]))}else r={};for(var c in t)c in r||(r[c]=gt(t,c));return e&&Object.isExtensible(e)&&(e._normalized=r),Y(r,"$stable",s),Y(r,"$key",o),Y(r,"$hasNormal",i),r}function bt(e,t,n){var a=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"===(void 0===e?"undefined":r(e))&&!Array.isArray(e)?[e]:_t(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:a,enumerable:!0,configurable:!0}),a}function gt(e,t){return function(){return e[t]}}function yt(e,t){var n,r,a,i,o;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,a=e.length;rdocument.createEvent("Event").timeStamp&&(un=function(){return _n.now()})}function pn(){var e,t;for(fn=un(),ln=!0,rn.sort((function(e,t){return e.id-t.id})),cn=0;cncn&&rn[n].id>e.id;)n--;rn.splice(n+1,0,e)}else rn.push(e);on||(on=!0,at(pn))}}(this)},dn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||c(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Xe(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},dn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},dn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},dn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||y(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var vn={enumerable:!0,configurable:!0,get:O,set:O};function mn(e,t,n){vn.get=function(){return this[t][n]},vn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,vn)}function bn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},a=e.$options._propKeys=[];e.$parent&&Ae(!1);var i=function(i){a.push(i);var s=Ve(i,t,n,e);Be(r,i,s),i in e||mn(e,"_props",i)};for(var s in t)i(s);Ae(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?O:B(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;u(t=e._data="function"==typeof t?function(e,t){de();try{return e.call(t,t)}catch(e){return Xe(e,t,"data()"),{}}finally{ve()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,a=(e.$options.methods,n.length);for(;a--;){var i=n[a];0,r&&S(r,i)||q(i)||mn(e,"_data",i)}Te(t,!0)}(e):Te(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=se();for(var a in t){var i=t[a],s="function"==typeof i?i:i.get;0,r||(n[a]=new dn(e,s||O,O,gn)),a in e||yn(e,a,i)}}(e,t.computed),t.watch&&t.watch!==re&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var a=0;a-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!_(e)&&e.test(t)}function En(e,t){var n=e.cache,r=e.keys,a=e._vnode;for(var i in n){var s=n[i];if(s){var o=Tn(s.componentOptions);o&&!t(o)&&Cn(n,i,r,a)}}}function Cn(e,t,n,r){var a=e[t];!a||r&&a.tag===r.tag||a.componentInstance.$destroy(),e[t]=null,y(n,t)}!function(e){e.prototype._init=function(e){var t=this;t._uid=kn++,t._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var a=r.componentOptions;n.propsData=a.propsData,n._parentListeners=a.listeners,n._renderChildren=a.children,n._componentTag=a.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(t,e):t.$options=De(Mn(t.constructor),e||{},t),t._renderProxy=t,t._self=t,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(t),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Gt(e,t)}(t),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,r=n&&n.context;e.$slots=dt(t._renderChildren,r),e.$scopedSlots=a,e._c=function(t,n,r,a){return Ft(e,t,n,r,a,!1)},e.$createElement=function(t,n,r,a){return Ft(e,t,n,r,a,!0)};var i=n&&n.data;Be(e,"$attrs",i&&i.attrs||a,null,!0),Be(e,"$listeners",t._parentListeners||a,null,!0)}(t),nn(t,"beforeCreate"),function(e){var t=ht(e.$options.inject,e);t&&(Ae(!1),Object.keys(t).forEach((function(n){Be(e,n,t[n])})),Ae(!0))}(t),bn(t),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(t),nn(t,"created"),t.$options.el&&t.$mount(t.$options.el)}}(An),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Ee,e.prototype.$delete=Ce,e.prototype.$watch=function(e,t,n){if(u(t))return xn(this,e,t,n);(n=n||{}).user=!0;var r=new dn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Xe(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(An),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var a=0,i=e.length;a1?E(n):n;for(var r=E(arguments,1),a='event handler for "'+e+'"',i=0,s=n.length;iparseInt(this.max)&&Cn(s,o[0],o,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return V}};Object.defineProperty(e,"config",t),e.util={warn:ue,extend:C,mergeOptions:De,defineReactive:Be},e.set=Ee,e.delete=Ce,e.nextTick=at,e.observable=function(e){return Te(e),e},e.options=Object.create(null),D.forEach((function(t){e.options[t+"s"]=Object.create(null)})),e.options._base=e,C(e.options.components,On),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=E(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),Rn(e),function(e){D.forEach((function(t){e[t]=function(e,n){return n?("component"===t&&u(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}}))}(e)}(An),Object.defineProperty(An.prototype,"$isServer",{get:se}),Object.defineProperty(An.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(An,"FunctionalRenderContext",{value:It}),An.version="2.6.10";var Ln=m("style,class"),In=m("input,textarea,option,select,progress"),Nn=function(e,t,n){return"value"===n&&In(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Hn=m("contenteditable,draggable,spellcheck"),$n=m("events,caret,typing,plaintext-only"),Dn=m("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),jn="http://www.w3.org/1999/xlink",Vn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Fn=function(e){return Vn(e)?e.slice(6,e.length):""},qn=function(e){return null==e||!1===e};function Yn(e){for(var t=e.data,n=e,r=e;s(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(t=Xn(r.data,t));for(;s(n=n.parent);)n&&n.data&&(t=Xn(t,n.data));return function(e,t){if(s(e)||s(t))return zn(e,Un(t));return""}(t.staticClass,t.class)}function Xn(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:s(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Un(e){return Array.isArray(e)?function(e){for(var t,n="",r=0,a=e.length;r-1?br(e,t,n):Dn(t)?qn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Hn(t)?e.setAttribute(t,function(e,t){return qn(t)||"false"===t?"false":"contenteditable"===e&&$n(t)?t:"true"}(t,n)):Vn(t)?qn(n)?e.removeAttributeNS(jn,Fn(t)):e.setAttributeNS(jn,t,n):br(e,t,n)}function br(e,t,n){if(qn(n))e.removeAttribute(t);else{if(Q&&!J&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){e.addEventListener("input",(function t(n){n.stopImmediatePropagation(),e.removeEventListener("input",t)})),e.__ieph=!0}e.setAttribute(t,n)}}var gr={create:vr,update:vr};function yr(e,t){var n=t.elm,r=t.data,a=e.data;if(!(i(r.staticClass)&&i(r.class)&&(i(a)||i(a.staticClass)&&i(a.class)))){var o=Yn(t),l=n._transitionClasses;s(l)&&(o=zn(o,Un(l))),o!==n._prevClass&&(n.setAttribute("class",o),n._prevClass=o)}}var wr,Sr,xr,kr,Mr,Ar,Rr={create:yr,update:yr},Tr=/[\w).+\-_$\]]/;function Br(e){var t,n,r,a,i,s=!1,o=!1,l=!1,c=!1,f=0,u=0,_=0,p=0;for(r=0;r=0&&" "===(d=e.charAt(h));h--);d&&Tr.test(d)||(c=!0)}}else void 0===a?(p=r+1,a=e.slice(0,r).trim()):v();function v(){(i||(i=[])).push(e.slice(p,r).trim()),p=r+1}if(void 0===a?a=e.slice(0,r).trim():0!==p&&v(),i)for(r=0;r-1?{exp:e.slice(0,kr),key:'"'+e.slice(kr+1)+'"'}:{exp:e,key:null};Sr=e,kr=Mr=Ar=0;for(;!zr();)Ur(xr=Xr())?Wr(xr):91===xr&&Kr(xr);return{exp:e.slice(0,Mr),key:e.slice(Mr+1,Ar)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Xr(){return Sr.charCodeAt(++kr)}function zr(){return kr>=wr}function Ur(e){return 34===e||39===e}function Kr(e){var t=1;for(Mr=kr;!zr();)if(Ur(e=Xr()))Wr(e);else if(91===e&&t++,93===e&&t--,0===t){Ar=kr;break}}function Wr(e){for(var t=e;!zr()&&(e=Xr())!==t;);}var Zr;function Gr(e,t,n){var r=Zr;return function a(){var i=t.apply(null,arguments);null!==i&&ea(e,a,n,r)}}var Qr=Ze&&!(ne&&Number(ne[1])<=53);function Jr(e,t,n,r){if(Qr){var a=fn,i=t;t=i._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=a||e.timeStamp<=0||e.target.ownerDocument!==document)return i.apply(this,arguments)}}Zr.addEventListener(e,t,ae?{capture:n,passive:r}:n)}function ea(e,t,n,r){(r||Zr).removeEventListener(e,t._wrapper||t,n)}function ta(e,t){if(!i(e.data.on)||!i(t.data.on)){var n=t.data.on||{},r=e.data.on||{};Zr=t.elm,function(e){if(s(e.__r)){var t=Q?"change":"input";e[t]=[].concat(e.__r,e[t]||[]),delete e.__r}s(e.__c)&&(e.change=[].concat(e.__c,e.change||[]),delete e.__c)}(n),ct(n,r,Jr,ea,Gr,t.context),Zr=void 0}}var na,ra={create:ta,update:ta};function aa(e,t){if(!i(e.data.domProps)||!i(t.data.domProps)){var n,r,a=t.elm,o=e.data.domProps||{},l=t.data.domProps||{};for(n in s(l.__ob__)&&(l=t.data.domProps=C({},l)),o)n in l||(a[n]="");for(n in l){if(r=l[n],"textContent"===n||"innerHTML"===n){if(t.children&&(t.children.length=0),r===o[n])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===n&&"PROGRESS"!==a.tagName){a._value=r;var c=i(r)?"":String(r);ia(a,c)&&(a.value=c)}else if("innerHTML"===n&&Zn(a.tagName)&&i(a.innerHTML)){(na=na||document.createElement("div")).innerHTML=""+r+"";for(var f=na.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;f.firstChild;)a.appendChild(f.firstChild)}else if(r!==o[n])try{a[n]=r}catch(e){}}}}function ia(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var n=e.value,r=e._vModifiers;if(s(r)){if(r.number)return v(n)!==v(t);if(r.trim)return n.trim()!==t.trim()}return n!==t}(e,t))}var sa={create:aa,update:aa},oa=x((function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach((function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}})),t}));function la(e){var t=ca(e.style);return e.staticStyle?C(e.staticStyle,t):t}function ca(e){return Array.isArray(e)?P(e):"string"==typeof e?oa(e):e}var fa,ua=/^--/,_a=/\s*!important$/,pa=function(e,t,n){if(ua.test(t))e.style.setProperty(t,n);else if(_a.test(n))e.style.setProperty(T(t),n.replace(_a,""),"important");else{var r=da(t);if(Array.isArray(n))for(var a=0,i=n.length;a-1?t.split(ba).forEach((function(t){return e.classList.add(t)})):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function ya(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(ba).forEach((function(t){return e.classList.remove(t)})):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function wa(e){if(e){if("object"===(void 0===e?"undefined":r(e))){var t={};return!1!==e.css&&C(t,Sa(e.name||"v")),C(t,e),t}return"string"==typeof e?Sa(e):void 0}}var Sa=x((function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}})),xa=K&&!J,ka="transition",Ma="transitionend",Aa="animation",Ra="animationend";xa&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ka="WebkitTransition",Ma="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Aa="WebkitAnimation",Ra="webkitAnimationEnd"));var Ta=K?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ba(e){Ta((function(){Ta(e)}))}function Ea(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),ga(e,t))}function Ca(e,t){e._transitionClasses&&y(e._transitionClasses,t),ya(e,t)}function Pa(e,t,n){var r=La(e,t),a=r.type,i=r.timeout,s=r.propCount;if(!a)return n();var o="transition"===a?Ma:Ra,l=0,c=function(){e.removeEventListener(o,f),n()},f=function(t){t.target===e&&++l>=s&&c()};setTimeout((function(){l0&&(n="transition",f=s,u=i.length):"animation"===t?c>0&&(n="animation",f=c,u=l.length):u=(n=(f=Math.max(s,c))>0?s>c?"transition":"animation":null)?"transition"===n?i.length:l.length:0,{type:n,timeout:f,propCount:u,hasTransform:"transition"===n&&Oa.test(r[ka+"Property"])}}function Ia(e,t){for(;e.length1}function Va(e,t){!0!==t.data.show&&Ha(t)}var Fa=function(e){var t,n,r={},a=e.modules,c=e.nodeOps;for(t=0;th?g(e,i(n[m+1])?null:n[m+1].elm,n,p,m,r):p>m&&w(0,t,_,h)}(_,v,m,n,f):s(m)?(s(e.text)&&c.setTextContent(_,""),g(_,null,m,0,m.length-1,n)):s(v)?w(0,v,0,v.length-1):s(e.text)&&c.setTextContent(_,""):e.text!==t.text&&c.setTextContent(_,t.text),s(h)&&s(p=h.hook)&&s(p=p.postpatch)&&p(e,t)}}}function M(e,t,n){if(o(n)&&s(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r-1,s.selected!==i&&(s.selected=i);else if(N(Ua(s),r))return void(e.selectedIndex!==o&&(e.selectedIndex=o));a||(e.selectedIndex=-1)}}function za(e,t){return t.every((function(t){return!N(t,e)}))}function Ua(e){return"_value"in e?e._value:e.value}function Ka(e){e.target.composing=!0}function Wa(e){e.target.composing&&(e.target.composing=!1,Za(e.target,"input"))}function Za(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Ga(e){return!e.componentInstance||e.data&&e.data.transition?e:Ga(e.componentInstance._vnode)}var Qa={model:qa,show:{bind:function(e,t,n){var r=t.value,a=(n=Ga(n)).data&&n.data.transition,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&a?(n.data.show=!0,Ha(n,(function(){e.style.display=i}))):e.style.display=r?i:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Ga(n)).data&&n.data.transition?(n.data.show=!0,r?Ha(n,(function(){e.style.display=e.__vOriginalDisplay})):$a(n,(function(){e.style.display="none"}))):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,a){a||(e.style.display=e.__vOriginalDisplay)}}},Ja={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ei(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?ei(Ut(t.children)):e}function ti(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var a=n._parentListeners;for(var i in a)t[M(i)]=a[i];return t}function ni(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var ri=function(e){return e.tag||zt(e)},ai=function(e){return"show"===e.name},ii={name:"transition",props:Ja,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(ri)).length){0;var r=this.mode;0;var a=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return a;var i=ei(a);if(!i)return a;if(this._leaving)return ni(e,a);var s="__transition-"+this._uid+"-";i.key=null==i.key?i.isComment?s+"comment":s+i.tag:l(i.key)?0===String(i.key).indexOf(s)?i.key:s+i.key:i.key;var o=(i.data||(i.data={})).transition=ti(this),c=this._vnode,f=ei(c);if(i.data.directives&&i.data.directives.some(ai)&&(i.data.show=!0),f&&f.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(i,f)&&!zt(f)&&(!f.componentInstance||!f.componentInstance._vnode.isComment)){var u=f.data.transition=C({},o);if("out-in"===r)return this._leaving=!0,ft(u,"afterLeave",(function(){t._leaving=!1,t.$forceUpdate()})),ni(e,a);if("in-out"===r){if(zt(i))return c;var _,p=function(){_()};ft(o,"afterEnter",p),ft(o,"enterCancelled",p),ft(u,"delayLeave",(function(e){_=e}))}}return a}}},si=C({tag:String,moveClass:String},Ja);function oi(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function li(e){e.data.newPos=e.elm.getBoundingClientRect()}function ci(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,a=t.top-n.top;if(r||a){e.data.moved=!0;var i=e.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+a+"px)",i.transitionDuration="0s"}}delete si.mode;var fi={Transition:ii,TransitionGroup:{props:si,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var a=Jt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,a(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,a=this.$slots.default||[],i=this.children=[],s=ti(this),o=0;o-1?Jn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Jn[e]=/HTMLUnknownElement/.test(t.toString())},C(An.options.directives,Qa),C(An.options.components,fi),An.prototype.__patch__=K?Fa:O,An.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=ge),nn(e,"beforeMount"),r=function(){e._update(e._render(),n)},new dn(e,r,O,{before:function(){e._isMounted&&!e._isDestroyed&&nn(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,nn(e,"mounted")),e}(this,e=e&&K?tr(e):void 0,t)},K&&setTimeout((function(){V.devtools&&oe&&oe.emit("init",An)}),0);var ui=/\{\{((?:.|\r?\n)+?)\}\}/g,_i=/[-.*+?^${}()|[\]\/\\]/g,pi=x((function(e){var t=e[0].replace(_i,"\\$&"),n=e[1].replace(_i,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")}));var hi={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=jr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Dr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var di,vi={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=jr(e,"style");n&&(e.staticStyle=JSON.stringify(oa(n)));var r=Dr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},mi=function(e){return(di=di||document.createElement("div")).innerHTML=e,di.textContent},bi=m("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),gi=m("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),yi=m("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),wi=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Si=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,xi="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+F.source+"]*",ki="((?:"+xi+"\\:)?"+xi+")",Mi=new RegExp("^<"+ki),Ai=/^\s*(\/?)>/,Ri=new RegExp("^<\\/"+ki+"[^>]*>"),Ti=/^]+>/i,Bi=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Li=/&(?:lt|gt|quot|amp|#39);/g,Ii=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ni=m("pre,textarea",!0),Hi=function(e,t){return e&&Ni(e)&&"\n"===t[0]};function $i(e,t){var n=t?Ii:Li;return e.replace(n,(function(e){return Oi[e]}))}var Di,ji,Vi,Fi,qi,Yi,Xi,zi,Ui=/^@|^v-on:/,Ki=/^v-|^@|^:/,Wi=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Zi=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Gi=/^\(|\)$/g,Qi=/^\[.*\]$/,Ji=/:(.*)$/,es=/^:|^\.|^v-bind:/,ts=/\.[^.\]]+(?=[^\]]*$)/g,ns=/^v-slot(:|$)|^#/,rs=/[\r\n]/,as=/\s+/g,is=x(mi);function ss(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:ps(t),rawAttrsMap:{},parent:n,children:[]}}function os(e,t){Di=t.warn||Cr,Yi=t.isPreTag||L,Xi=t.mustUseProp||L,zi=t.getTagNamespace||L;var n=t.isReservedTag||L;(function(e){return!!e.component||!n(e.tag)}),Vi=Pr(t.modules,"transformNode"),Fi=Pr(t.modules,"preTransformNode"),qi=Pr(t.modules,"postTransformNode"),ji=t.delimiters;var r,a,i=[],s=!1!==t.preserveWhitespace,o=t.whitespace,l=!1,c=!1;function f(e){if(u(e),l||e.processed||(e=ls(e,t)),i.length||e===r||r.if&&(e.elseif||e.else)&&fs(r,{exp:e.elseif,block:e}),a&&!e.forbidden)if(e.elseif||e.else)s=e,(o=function(e){for(var t=e.length;t--;){if(1===e[t].type)return e[t];e.pop()}}(a.children))&&o.if&&fs(o,{exp:s.elseif,block:s});else{if(e.slotScope){var n=e.slotTarget||'"default"';(a.scopedSlots||(a.scopedSlots={}))[n]=e}a.children.push(e),e.parent=a}var s,o;e.children=e.children.filter((function(e){return!e.slotScope})),u(e),e.pre&&(l=!1),Yi(e.tag)&&(c=!1);for(var f=0;f]*>)","i")),_=e.replace(u,(function(e,n,r){return c=r.length,Ci(f)||"noscript"===f||(n=n.replace(//g,"$1").replace(//g,"$1")),Hi(f,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""}));l+=e.length-_.length,e=_,A(f,l-c,l)}else{var p=e.indexOf("<");if(0===p){if(Bi.test(e)){var h=e.indexOf("--\x3e");if(h>=0){t.shouldKeepComment&&t.comment(e.substring(4,h),l,l+h+3),x(h+3);continue}}if(Ei.test(e)){var d=e.indexOf("]>");if(d>=0){x(d+2);continue}}var v=e.match(Ti);if(v){x(v[0].length);continue}var m=e.match(Ri);if(m){var b=l;x(m[0].length),A(m[1],b,l);continue}var g=k();if(g){M(g),Hi(g.tagName,e)&&x(1);continue}}var y=void 0,w=void 0,S=void 0;if(p>=0){for(w=e.slice(p);!(Ri.test(w)||Mi.test(w)||Bi.test(w)||Ei.test(w)||(S=w.indexOf("<",1))<0);)p+=S,w=e.slice(p);y=e.substring(0,p)}p<0&&(y=e),y&&x(y.length),t.chars&&y&&t.chars(y,l-y.length,l)}if(e===n){t.chars&&t.chars(e);break}}function x(t){l+=t,e=e.substring(t)}function k(){var t=e.match(Mi);if(t){var n,r,a={tagName:t[1],attrs:[],start:l};for(x(t[0].length);!(n=e.match(Ai))&&(r=e.match(Si)||e.match(wi));)r.start=l,x(r[0].length),r.end=l,a.attrs.push(r);if(n)return a.unarySlash=n[1],x(n[0].length),a.end=l,a}}function M(e){var n=e.tagName,l=e.unarySlash;i&&("p"===r&&yi(n)&&A(r),o(n)&&r===n&&A(n));for(var c=s(n)||!!l,f=e.attrs.length,u=new Array(f),_=0;_=0&&a[s].lowerCasedTag!==o;s--);else s=0;if(s>=0){for(var c=a.length-1;c>=s;c--)t.end&&t.end(a[c].tag,n,i);a.length=s,r=s&&a[s-1].tag}else"br"===o?t.start&&t.start(e,[],!0,n,i):"p"===o&&(t.start&&t.start(e,[],!1,n,i),t.end&&t.end(e,n,i))}A()}(e,{warn:Di,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,n,s,o,u){var _=a&&a.ns||zi(e);Q&&"svg"===_&&(n=function(e){for(var t=[],n=0;nl&&(o.push(i=e.slice(l,a)),s.push(JSON.stringify(i)));var c=Br(r[1].trim());s.push("_s("+c+")"),o.push({"@binding":c}),l=a+r[0].length}return l-1"+("true"===i?":("+t+")":":_q("+t+","+i+")")),$r(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+i+"):("+s+");if(Array.isArray($$a)){var $$v="+(r?"_n("+a+")":a)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Yr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Yr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Yr(t,"$$c")+"}",null,!0)}(e,r,a);else if("input"===i&&"radio"===s)!function(e,t,n){var r=n&&n.number,a=Dr(e,"value")||"null";Or(e,"checked","_q("+t+","+(a=r?"_n("+a+")":a)+")"),$r(e,"change",Yr(t,a),null,!0)}(e,r,a);else if("input"===i||"textarea"===i)!function(e,t,n){var r=e.attrsMap.type;0;var a=n||{},i=a.lazy,s=a.number,o=a.trim,l=!i&&"range"!==r,c=i?"change":"range"===r?"__r":"input",f="$event.target.value";o&&(f="$event.target.value.trim()");s&&(f="_n("+f+")");var u=Yr(t,f);l&&(u="if($event.target.composing)return;"+u);Or(e,"value","("+t+")"),$r(e,c,u,null,!0),(o||s)&&$r(e,"blur","$forceUpdate()")}(e,r,a);else{if(!V.isReservedTag(i))return qr(e,r,a),!1}return!0},text:function(e,t){t.value&&Or(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Or(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:bi,mustUseProp:Nn,canBeLeftOpenTag:gi,isReservedTag:Gn,getTagNamespace:Qn,staticKeys:function(e){return e.reduce((function(e,t){return e.concat(t.staticKeys||[])}),[]).join(",")}(ms)},ws=x((function(e){return m("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))}));function Ss(e,t){e&&(bs=ws(t.staticKeys||""),gs=t.isReservedTag||L,function e(t){if(t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||b(e.tag)||!gs(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(bs)))}(t),1===t.type){if(!gs(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function\s*(?:[\w$]+)?\s*\(/,ks=/\([^)]*?\);*$/,Ms=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,As={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Rs={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Ts=function(e){return"if("+e+")return null;"},Bs={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Ts("$event.target !== $event.currentTarget"),ctrl:Ts("!$event.ctrlKey"),shift:Ts("!$event.shiftKey"),alt:Ts("!$event.altKey"),meta:Ts("!$event.metaKey"),left:Ts("'button' in $event && $event.button !== 0"),middle:Ts("'button' in $event && $event.button !== 1"),right:Ts("'button' in $event && $event.button !== 2")};function Es(e,t){var n=t?"nativeOn:":"on:",r="",a="";for(var i in e){var s=Cs(e[i]);e[i]&&e[i].dynamic?a+=i+","+s+",":r+='"'+i+'":'+s+","}return r="{"+r.slice(0,-1)+"}",a?n+"_d("+r+",["+a.slice(0,-1)+"])":n+r}function Cs(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map((function(e){return Cs(e)})).join(",")+"]";var t=Ms.test(e.value),n=xs.test(e.value),r=Ms.test(e.value.replace(ks,""));if(e.modifiers){var a="",i="",s=[];for(var o in e.modifiers)if(Bs[o])i+=Bs[o],As[o]&&s.push(o);else if("exact"===o){var l=e.modifiers;i+=Ts(["ctrl","shift","alt","meta"].filter((function(e){return!l[e]})).map((function(e){return"$event."+e+"Key"})).join("||"))}else s.push(o);return s.length&&(a+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(Ps).join("&&")+")return null;"}(s)),i&&(a+=i),"function($event){"+a+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ps(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=As[e],r=Rs[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Os={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:O},Ls=function(e){this.options=e,this.warn=e.warn||Cr,this.transforms=Pr(e.modules,"transformCode"),this.dataGenFns=Pr(e.modules,"genData"),this.directives=C(C({},Os),e.directives);var t=e.isReservedTag||L;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Is(e,t){var n=new Ls(t);return{render:"with(this){return "+(e?Ns(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ns(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Hs(e,t);if(e.once&&!e.onceProcessed)return $s(e,t);if(e.for&&!e.forProcessed)return js(e,t);if(e.if&&!e.ifProcessed)return Ds(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Ys(e,t),a="_t("+n+(r?","+r:""),i=e.attrs||e.dynamicAttrs?Us((e.attrs||[]).concat(e.dynamicAttrs||[]).map((function(e){return{name:M(e.name),value:e.value,dynamic:e.dynamic}}))):null,s=e.attrsMap["v-bind"];!i&&!s||r||(a+=",null");i&&(a+=","+i);s&&(a+=(i?"":",null")+","+s);return a+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Ys(t,n,!0);return"_c("+e+","+Vs(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Vs(e,t));var a=e.inlineTemplate?null:Ys(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(a?","+a:"")+")"}for(var i=0;i>>0}(s):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var i=function(e,t){var n=e.children[0];0;if(n&&1===n.type){var r=Is(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map((function(e){return"function(){"+e+"}"})).join(",")+"]}"}}(e,t);i&&(n+=i+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Us(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Fs(e){return 1===e.type&&("slot"===e.tag||e.children.some(Fs))}function qs(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Ds(e,t,qs,"null");if(e.for&&!e.forProcessed)return js(e,t,qs);var r="_empty_"===e.slotScope?"":String(e.slotScope),a="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(Ys(e,t)||"undefined")+":undefined":Ys(e,t)||"undefined":Ns(e,t))+"}",i=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+a+i+"}"}function Ys(e,t,n,r,a){var i=e.children;if(i.length){var s=i[0];if(1===i.length&&s.for&&"template"!==s.tag&&"slot"!==s.tag){var o=n?t.maybeComponent(s)?",1":",0":"";return""+(r||Ns)(s,t)+o}var l=n?function(e,t){for(var n=0,r=0;r':'
',Qs.innerHTML.indexOf(" ")>0}var no=!!K&&to(!1),ro=!!K&&to(!0),ao=x((function(e){var t=tr(e);return t&&t.innerHTML})),io=An.prototype.$mount;An.prototype.$mount=function(e,t){if((e=e&&tr(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=ao(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){0;var a=eo(r,{outputSourceRange:!1,shouldDecodeNewlines:no,shouldDecodeNewlinesForHref:ro,delimiters:n.delimiters,comments:n.comments},this),i=a.render,s=a.staticRenderFns;n.render=i,n.staticRenderFns=s}}return io.call(this,e,t)},An.compile=eo,t.default=An}).call(this,n(0),n(10).setImmediate)},function(e,t,n){"use strict";(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,a=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(a.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(a.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(11),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||void 0,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||void 0}).call(this,n(0))},function(e,t,n){"use strict";(function(e,t){!function(e,n){if(!e.setImmediate){var r,a,i,s,o,l=1,c={},f=!1,u=e.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(e);_=_&&_.setTimeout?_:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){h(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){h(e.data)},r=function(e){i.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(a=u.documentElement,r=function(e){var t=u.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,a.removeChild(t),t=null},a.appendChild(t)}):r=function(e){setTimeout(h,0,e)}:(s="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&h(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),r=function(t){e.postMessage(s+t,"*")}),_.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n1)for(var n=1;nf+1&&c("SampleData似乎传入了未重置chunk "+i+">"+f,3);for(var u=0,_=i;_1?u=Math.floor(u/p):(p=1,n=t),u+=o.length;var h=new Int16Array(u),d=0;for(_=0;_0){var k=2*(h.length-x);o=new Int16Array(h.buffer.slice(k)),h=new Int16Array(h.buffer.slice(0,k))}return{index:i,offset:s,frameNext:o,sampleRate:n,data:h}},n.PowerLevel=function(e,t){var n=e/t||0;return n<1251?Math.round(n/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(n/1e4)/Math.log(10)))))},n.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))},n.CLog=function(t,n){var a=new Date,i=("0"+a.getMinutes()).substr(-2)+":"+("0"+a.getSeconds()).substr(-2)+"."+("00"+a.getMilliseconds()).substr(-3),s=this&&this.envIn&&this.envCheck&&this.id,o=["["+i+" "+r+(s?":"+s:"")+"]"+t],l=arguments,c=e.console||{},u=2,_=c.log;for("number"==typeof n?_=1==n?c.error:3==n?c.warn:_:u=1;u1?o:""):_.apply(c,o)};var c=function(){n.CLog.apply(this,arguments)},f=!0;try{f=!console.log.apply}catch(e){}var u=0;function _(e){this.id=++u,b();var n={type:"mp3",bitRate:16,sampleRate:16e3,onProcess:t};for(var r in e)n[r]=e[r];this.set=n,this._S=9,this.Sync={O:9,C:9}}n.Sync={O:9,C:9},n.prototype=_.prototype={CLog:c,_streamStore:function(){return this.set.sourceStream?this:n},open:function(r,a){var s=this,o=s.set,c=s._streamStore();r=r||t;var f=function(e,t){t=!!t,s.CLog("录音open失败:"+e+",isUserNotAllow:"+t,1),a&&a(e,t)},u=function(){s.CLog("open ok id:"+s.id),r(),s._SO=0},_=c.Sync,p=++_.O,h=_.C;s._O=s._O_=p,s._SO=s._S;var d=s.envCheck({envName:"H5",canProcess:!0});if(d)f("不能录音:"+d);else if(o.sourceStream){if(!n.GetContext())return void f("不支持此浏览器从流中获取录音");l(c),s.Stream=o.sourceStream,s.Stream._call={};try{i(c)}catch(e){return void f("从流中打开录音失败:"+e.message)}u()}else{var v=function(t,n){try{e.top.a}catch(e){return void f('无权录音(跨域,请尝试给iframe添加麦克风访问策略,如allow="camera;microphone")')}/Permission|Allow/i.test(t)?f("用户拒绝了录音权限",!0):!1===e.isSecureContext?f("浏览器禁止不安全页面录音,可开启https解决"):/Found/i.test(t)?f(n+",无可用麦克风"):f(n)};if(n.IsOpen())u();else if(n.Support()){var m=function(e){setTimeout((function(){e._call={};var t=n.Stream;t&&(l(),e._call=t._call),n.Stream=e,function(){if(h!=_.C||!s._O){var e="open被取消";return p==_.O?s.close():e="open被中断",f(e),!0}}()||(n.IsOpen()?(t&&s.CLog("发现同时多次调用open",1),i(c,1),u()):f("录音功能无效:无音频流"))}),100)},b=function(e){var t=e.name||e.message||e.code+":"+e;s.CLog("请求录音权限错误",1,e),v(t,"无法录音:"+t)},g=o.audioTrackSet||{};g.sampleRate=n.Ctx.sampleRate;var y={audio:g};try{var w=n.Scope.getUserMedia(y,m,b)}catch(e){s.CLog("getUserMedia",3,e),y={audio:!0},w=n.Scope.getUserMedia(y,m,b)}s.CLog("getUserMedia("+JSON.stringify(y)+"),一般默认会降噪和回声消除,移动端可能会降低系统播放音量,请参阅文档中audioTrackSet配置"),w&&w.then&&w.then(m).catch(b)}else v("","此浏览器不支持录音")}},close:function(e){e=e||t;var n=this._streamStore();this._stop();var r=n.Sync;if(this._O=0,this._O_!=r.O)return this.CLog("close被忽略(因为同时open了多个rec,只有最后一个会真正close)",3),void e();r.C++,l(n),this.CLog("close"),e()},mock:function(e,t){return this._stop(),this.isMock=1,this.mockEnvInfo=null,this.buffers=[e],this.recSize=e.length,this.srcSampleRate=t,this},envCheck:function(t){var r,a=this.set,i="CPU_BE";if(r||n[i]||!e.Int8Array||new Int8Array(new Int32Array([1]).buffer)[0]||(b(i),r="不支持CPU_BE架构"),!r){var s=a.type;this[s+"_envCheck"]?r=this[s+"_envCheck"](t,a):a.takeoffEncodeChunk&&(r=s+"类型"+(this[s]?"":"(未加载编码器)")+"不支持设置takeoffEncodeChunk")}return r||""},envStart:function(e,t){var n=this.set;this.isMock=e?1:0,this.mockEnvInfo=e,this.buffers=[],this.recSize=0,this.envInLast=0,this.envInFirst=0,this.envInFix=0,this.envInFixTs=[];var r=n.sampleRate;if(r>t?n.sampleRate=t:r=0,this.srcSampleRate=t,this.CLog("srcSampleRate: "+t+" set.sampleRate: "+n.sampleRate+(r?" 忽略"+r:""),r?3:0),this.engineCtx=0,this[n.type+"_start"]){var a=this.engineCtx=this[n.type+"_start"](n);a&&(a.pcmDatas=[],a.pcmSize=0)}},envResume:function(){this.envInFixTs=[]},envIn:function(e,t){var r=this,a=r.set,i=r.engineCtx,s=r.srcSampleRate,o=e.length,l=n.PowerLevel(t,o),c=r.buffers,f=c.length;c.push(e);var u=c,_=f,p=Date.now(),h=Math.round(o/s*1e3);r.envInLast=p,1==r.buffers.length&&(r.envInFirst=p-h);var d=r.envInFixTs;d.splice(0,0,{t:p,d:h});for(var v=p,m=0,b=0;b3e3){d.length=b;break}v=g.t,m+=g.d}var y=d[1],w=p-v;if(w-m>w/3&&(y&&w>1e3||d.length>=6)){var S=p-y.t-h;if(S>h/5){var x=!a.disableEnvInFix;if(r.CLog("["+p+"]"+(x?"":"未")+"补偿"+S+"ms",3),r.envInFix+=S,x){var k=new Int16Array(S*s/1e3);o+=k.length,c.push(k)}}}var M=r.recSize,A=o,R=M+A;if(r.recSize=R,i){var T=n.SampleData(c,s,a.sampleRate,i.chunkInfo);i.chunkInfo=T,R=(M=i.pcmSize)+(A=T.data.length),i.pcmSize=R,c=i.pcmDatas,f=c.length,c.push(T.data),s=T.sampleRate}var B=Math.round(R/s*1e3),E=c.length,C=u.length,P=function(){for(var e=O?0:-A,t=null==c[0],n=f;n10&&r.envInFirst-p>1e3&&r.CLog("rec.set.onProcess低性能,耗时"+L+"ms",3),!0===O){var I=0;for(b=f;b"+b.length+" 花:"+(Date.now()-a)+"ms"),setTimeout((function(){a=Date.now(),i[s.type](b,(function(e){u(e,v)}),(function(e){f(e)}))}))}else f("未加载"+s.type+"编码器");else f("音频buffers被释放");else f("未采集到录音")}},e[r]&&(c("重复引入"+r,3),e[r].Destroy()),e[r]=n;var p=function(e,t){t.pos||(t.pos=[0],t.tracks={},t.bytes=[]);var n=t.tracks,r=[t.pos[0]],a=function(){t.pos[0]=r[0]},i=t.bytes.length,s=new Uint8Array(i+e.length);if(s.set(t.bytes),s.set(e,i),t.bytes=s,!t._ht){if(v(s,r),m(s,r),!h(v(s,r),[24,83,128,103]))return;for(v(s,r);r[0]1){var N=[];for(M=0;M=e.length)){var a=("0000000"+e[r].toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(a);if(i){var s=i[1].length,o=[];if(!(r+s>e.length)){for(var l=0;le.length)return;for(var s=0;s
';var c=this.canvas=o.querySelector("canvas"),f=this.ctx=c.getContext("2d");c.width=i,c.height=s,this.linear1=this.genLinear(f,i,e.linear1),this.linear2=this.genLinear(f,i,e.linear2),this.linearBg=this.genLinear(f,s,e.linearBg,!0),r&&(r.innerHTML="",r.appendChild(o)),this._phase=0}).prototype=r.prototype={genLinear:function(e,t,n,r){for(var a=e.createLinearGradient(0,0,r?0:t,r?t:0),i=0;i1300&&(clearInterval(e.timer),e.timer=0)}},draw:function(e){var t=this.set,n=this.ctx,r=t.scale,a=t.width*r,i=t.height*r,s=t.speed/t.fps,o=this._phase-=s,l=o+s*t.phase,c=e/100,f=this.genPath(2,c,o),u=this.genPath(1.8,c,l);n.clearRect(0,0,a,i),n.beginPath();for(var _=0,p=0;p=0;_--,p-=r)n.lineTo(p,u[_]);n.closePath(),n.fillStyle=this.linearBg,n.fill(),this.drawPath(u,this.linear2),this.drawPath(f,this.linear1)},drawPath:function(e,t){var n=this.set,r=this.ctx,a=n.scale,i=n.width*a;r.beginPath();for(var s=0,o=0;o\n \n\n \n\n '});window.vue_vue=r.default,window.vue_root=s,window.vue_main=s.$refs.mainView,console.log("Vue",r.default),console.log("Recorder",vue_main.Rec)},function(e,t,n){"use strict";n.r(t);var r=n(17),a=n(3);for(var i in a)"default"!==i&&function(e){n.d(t,e,(function(){return a[e]}))}(i);n(23);var s=n(1),o=Object(s.a)(a.default,r.a,r.b,!1,null,null,null);o.options.__file="component/recorder.vue",t.default=o.exports},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){var e;Recorder.prototype.enc_mp3={stable:!0,testmsg:"采样率范围48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000"},Recorder.prototype.mp3=function(e,t,n){var r=this.set,s=e.length,o=this.mp3_start(r);if(o)return this.mp3_encode(o,e),void this.mp3_complete(o,t,n,1);var l=new Recorder.lamejs.Mp3Encoder(1,r.sampleRate,r.bitRate),c=[],f=0,u=0;!function n(){if(f0&&(u+=o.buffer.byteLength,c.push(o.buffer)),f+=57600,setTimeout(n)}else{var o;(o=l.flush()).length>0&&(u+=o.buffer.byteLength,c.push(o.buffer));var _=a.fn(c,u,s,r.sampleRate);i(_,r),t(new Blob(c,{type:"audio/mp3"}))}}()},Recorder.BindDestroy("mp3Worker",(function(){Recorder.CLog("mp3Worker Destroy"),e&&e.terminate(),e=null})),Recorder.prototype.mp3_envCheck=function(e,t){var r="";return t.takeoffEncodeChunk&&(e.canProcess?n()||(r="当前浏览器版本太低,无法实时处理"):r=e.envName+"环境不支持实时处理"),r},Recorder.prototype.mp3_start=function(e){return n(e)};var t={id:0},n=function(n){var r=e;try{if(!r){var i=");wk_lame();var wk_ctxs={};self.onmessage="+function(e){var t=e.data,n=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(!n)return;switch(t.action){case"stop":n.encObj=null,delete wk_ctxs[t.id];break;case"encode":n.pcmSize+=t.pcm.length,(r=n.encObj.encodeBuffer(t.pcm)).length>0&&(n.takeoff?self.postMessage({action:"takeoff",id:t.id,chunk:r}):(n.mp3Size+=r.buffer.byteLength,n.encArr.push(r.buffer)));break;case"complete":var r;(r=n.encObj.flush()).length>0&&(n.takeoff?self.postMessage({action:"takeoff",id:t.id,chunk:r}):(n.mp3Size+=r.buffer.byteLength,n.encArr.push(r.buffer)));var a=wk_mp3TrimFix.fn(n.encArr,n.mp3Size,n.pcmSize,n.sampleRate);self.postMessage({action:t.action,id:t.id,blob:new Blob(n.encArr,{type:"audio/mp3"}),meta:a})}};i+=";var wk_mp3TrimFix={rm:"+a.rm+",fn:"+a.fn+"}";var s=Recorder.lamejs.toString(),o=(window.URL||webkitURL).createObjectURL(new Blob(["var wk_lame=(",s,i],{type:"text/javascript"}));r=new Worker(o),setTimeout((function(){(window.URL||webkitURL).revokeObjectURL(o)}),1e4),r.onmessage=function(e){var n=e.data,r=t[n.id];r&&("takeoff"==n.action?r.set.takeoffEncodeChunk(new Uint8Array(n.chunk.buffer)):(r.call&&r.call(n),r.call=null))}}var l={worker:r,set:n,takeoffQueue:[]};return n?(l.id=++t.id,t[l.id]=l,r.postMessage({action:"init",id:l.id,sampleRate:n.sampleRate,bitRate:n.bitRate,takeoff:!!n.takeoffEncodeChunk,x:new Int16Array(5)})):r.postMessage({x:new Int16Array(5)}),e=r,l}catch(e){return r&&r.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 t[e.id];var n=-1;for(var r in t)n++;n&&Recorder.CLog("mp3 worker剩"+n+"个在串行等待",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(e,t,n,r){var a=this;e&&e.worker?(e.call=function(n){i(n.meta,e.set),t(n.blob),r&&a.mp3_stop(e)},e.worker.postMessage({action:"complete",id:e.id})):n("mp3编码器未打开")},Recorder.mp3ReadMeta=function(e,t){var n="object"==("undefined"==typeof window?"undefined":r(window))?window.parseInt:self.parseInt,a=new Uint8Array(e[0]||[]);if(a.length<4)return null;var i=function(e,t){return("0000000"+((t||a)[e]||0).toString(2)).substr(-8)},s=i(0)+i(1),o=i(2)+i(3);if(!/^1{11}/.test(s))return null;var l={"00":2.5,10:2,11:1}[s.substr(11,2)],c={"01":3}[s.substr(13,2)],f={1:[44100,48e3,32e3],2:[22050,24e3,16e3],2.5:[11025,12e3,8e3]}[l];f&&(f=f[n(o.substr(4,2),2)]);var u=[[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==l?1:0][n(o.substr(0,4),2)];if(!(l&&c&&u&&f))return null;for(var _=Math.round(8*t/u),p=1==c?384:2==c||1==l?1152:576,h=p/f*1e3,d=Math.floor(p*u/8/f*1e3),v=0,m=0,b=0;b=d+3){var y=new Uint8Array(g);v="1"==i(g.byteLength-(m-(d+3)+1),y).charAt(6);break}}return v&&d++,{version:l,layer:c,sampleRate:f,bitRate:u,duration:_,size:t,hasPadding:v,frameSize:d,frameDurationFloat:h}};var a={rm:Recorder.mp3ReadMeta,fn:function(e,t,n,r){var a=this.rm(e,t);if(!a)return{err:"mp3非预定格式"};var i=Math.round(n/r*1e3),s=Math.floor((a.duration-i)/a.frameDurationFloat);if(s>0){var o=s*a.frameSize-(a.hasPadding?1:0);t-=o;for(var l=0,c=[],f=0;f=u.byteLength?(o-=u.byteLength,c.push(u),e.splice(f,1),f--):(e[f]=u.slice(o),l=u,o=0)}if(!this.rm(e,t)){l&&(e[0]=l);for(f=0;f "+r.duration+"ms",r.remove>2&&(e.err=(e.err?e.err+", ":"")+"移除帧数过多")):n+=(e.duration||"-")+"ms",e.err?Recorder.CLog(n,1,e.err,e):Recorder.CLog(n,e)}}()},function(e,t,n){"use strict";!function(){function e(){var t=function(e){return Math.log(e)/Math.log(10)};function n(e){return new Int8Array(e)}function r(e){return new Int16Array(e)}function a(e){return new Int32Array(e)}function i(e){return new Float32Array(e)}function s(e){return new Float64Array(e)}function o(e){if(1==e.length)return i(e[0]);var t=e[0];e=e.slice(1);for(var n=[],r=0;r>=1;0!=e--;)a[i++]=s>n[r++]?0:1,a[i++]=s>n[r++]?0:1}function i(t,n,r,a,i,s){var o=(t>>=1)%2;for(t>>=1;0!=t--;){var l,c,f,u,_,p,h,d;l=r[a++]*n,c=r[a++]*n,_=0|l,f=r[a++]*n,p=0|c,u=r[a++]*n,h=0|f,l+=e.adj43[_],d=0|u,c+=e.adj43[p],i[s++]=0|l,f+=e.adj43[h],i[s++]=0|c,u+=e.adj43[d],i[s++]=0|f,i[s++]=0|u}0!=o&&(_=0|(l=r[a++]*n),p=0|(c=r[a++]*n),l+=e.adj43[_],c+=e.adj43[p],i[s++]=0|l,i[s++]=0|c)}var s=[1,2,5,7,7,10,10,13,13,13,13,13,13,13,13];function o(e,t,n,r){var a=function(e,t,n){var r=0,a=0;do{var i=e[t++],s=e[t++];r>=16)>i&&(o=i,r++),a.bits+=o,r}(e,t,n,s[a-1],r);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,n,r,a){var i=0,s=0,o=0,l=A.ht[r].xlen,c=A.ht[r].hlen,f=A.ht[r+1].hlen,u=A.ht[r+2].hlen;do{var _=e[t+0]*l+e[t+1];t+=2,i+=c[_],s+=f[_],o+=u[_]}while(ts&&(i=s,p++),i>o&&(i=o,p=r+2),a.bits+=i,p}(e,t,n,s[a-1],r);default:if(a>I.IXMAX_VAL)return r.bits=I.LARGE_BITS,-1;var i,o;for(a-=15,i=24;i<32&&!(A.ht[i].linmax>=a);i++);for(o=i-8;o<24&&!(A.ht[o].linmax>=a);o++);return function(e,t,n,r,a,i){var s,o=65536*A.ht[r].xlen+A.ht[a].xlen,l=0;do{var c=e[t++],f=e[t++];0!=c&&(c>14&&(c=15,l+=o),c*=16),0!=f&&(f>14&&(f=15,l+=o),c+=f),l+=A.largetbl[c]}while(t>=16)>s&&(l=s,r=a),i.bits+=l,r}(e,t,n,o,i,r)}}function l(e,n,r,a,i,s,l,c){for(var f=n.big_values,u=2;u=f)break;var p=i[u-2]+n.count1bits;if(r.part2_3_length<=p)break;var h=new t(p),d=o(a,_,f,h);p=h.bits,r.part2_3_length<=p||(r.assign(n),r.part2_3_length=p,r.region0_count=s[u-2],r.region1_count=u-2-s[u-2],r.table_select[0]=l[u-2],r.table_select[1]=c[u-2],r.table_select[2]=d)}}this.noquant_count_bits=function(e,n,r){var a=n.l3_enc,i=Math.min(576,n.max_nonzero_coeff+2>>1<<1);for(null!=r&&(r.sfb_count1=0);i>1&&0==(a[i-1]|a[i-2]);i-=2);n.count1=i;for(var s=0,l=0;i>3;i-=4){var c;if((2147483647&(a[i-1]|a[i-2]|a[i-3]|a[i-4]))>1)break;c=2*(2*(2*a[i-4]+a[i-3])+a[i-2])+a[i-1],s+=A.t32l[c],l+=A.t33l[c]}var f=s;if(n.count1table_select=0,s>l&&(f=l,n.count1table_select=1),n.count1bits=f,n.big_values=i,0==i)return f;if(n.block_type==F.SHORT_TYPE)(s=3*e.scalefac_band.s[3])>n.big_values&&(s=n.big_values),l=n.big_values;else if(n.block_type==F.NORM_TYPE){if(s=n.region0_count=e.bv_scf[i-2],l=n.region1_count=e.bv_scf[i-1],l=e.scalefac_band.l[s+l+2],s=e.scalefac_band.l[s+1],l(l=i)&&(s=l);if(s=Math.min(s,i),l=Math.min(l,i),0l)return I.LARGE_BITS;if(function(t,n,a,s,o){var l,c,f,_=0,p=0,h=0,d=0,v=n,m=0,b=v,g=0,y=t,w=0;for(f=null!=o&&s.global_gain==o.global_gain,c=s.block_type==F.SHORT_TYPE?38:21,l=0;l<=c;l++){var S=-1;if((f||s.block_type==F.NORM_TYPE)&&(S=s.global_gain-(s.scalefac[l]+(0!=s.preflag?e.pretab[l]:0)<s.max_nonzero_coeff)x=s.max_nonzero_coeff-_+1,u.fill(n,s.max_nonzero_coeff,576,0),(k=x)<0&&(k=0),l=c+1;if(0==p&&0==h&&(b=v,g=m,y=t,w=d),null!=o&&o.sfb_count1>0&&l>=o.sfb_count1&&o.step[l]>0&&S>=o.step[l]?(0!=p&&(i(p,a,y,w,b,g),p=0,b=v,g=m,y=t,w=d),h+=k):(0!=h&&(r(h,a,y,w,b,g),h=0,b=v,g=m,y=t,w=d),p+=k),k<=0){0!=h&&(r(h,a,y,w,b,g),h=0),0!=p&&(i(p,a,y,w,b,g),p=0);break}}l<=c&&(m+=s.width[l],d+=s.width[l],_+=s.width[l])}0!=p&&(i(p,a,y,w,b,g),p=0),0!=h&&(r(h,a,y,w,b,g),h=0)}(n,o,e.IPOW20(a.global_gain),a,s),0!=(2&t.substep_shaping))for(var c=0,f=a.global_gain+a.scalefac_scale,_=.634521682242439/e.IPOW20(f),p=0;p=_?o[h]:0}return this.noquant_count_bits(t,a,s)},this.best_huffman_divide=function(e,n){var r=new H,i=n.l3_enc,s=a(23),c=a(23),f=a(23),u=a(23);if(n.block_type!=F.SHORT_TYPE||1!=e.mode_gr){r.assign(n),n.block_type==F.NORM_TYPE&&(!function(e,n,r,a,i,s,l){for(var c=n.big_values,f=0;f<=22;f++)a[f]=I.LARGE_BITS;for(f=0;f<16;f++){var u=e.scalefac_band.l[f+1];if(u>=c)break;var _=0,p=new t(_),h=o(r,0,u,p);_=p.bits;for(var d=0;d<8;d++){var v=e.scalefac_band.l[f+d+2];if(v>=c)break;var m=_,b=o(r,u,v,p=new t(m));m=p.bits,a[f+d]>m&&(a[f+d]=m,i[f+d]=f,s[f+d]=h,l[f+d]=b)}}}(e,n,i,s,c,f,u),l(e,r,n,i,s,c,f,u));var _=r.big_values;if(!(0==_||(i[_-2]|i[_-1])>1||(_=n.count1+2)>576)){r.assign(n),r.count1=_;for(var p=0,h=0;_>r.big_values;_-=4){var d=2*(2*(2*i[_-4]+i[_-3])+i[_-2])+i[_-1];p+=A.t32l[d],h+=A.t33l[d]}if(r.big_values=_,r.count1table_select=0,p>h&&(p=h,r.count1table_select=1),r.count1bits=p,r.block_type==F.NORM_TYPE)l(e,r,n,i,s,c,f,u);else{if(r.part2_3_length=p,(p=e.scalefac_band.l[8])>_&&(p=_),p>0){var v=new t(r.part2_3_length);r.table_select[0]=o(i,0,p,v),r.part2_3_length=v.bits}if(_>p){v=new t(r.part2_3_length);r.table_select[1]=o(i,p,_,v),r.part2_3_length=v.bits}n.part2_3_length>r.part2_3_length&&n.assign(r)}}}};var c=[1,1,1,1,8,2,2,2,4,4,4,8,8,8,16,16],f=[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],h=[0,1,2,3,0,1,2,3,1,2,3,1,2,3,2,3];g.slen1_tab=p,g.slen2_tab=h,this.best_scalefac_store=function(t,n,r,a){var i,s,o,l,u=a.tt[n][r],_=0;for(o=0,i=0;i0&&(v|=u.scalefac[i]);if(0==(1&v)&&0!=v){for(i=0;i0&&(u.scalefac[i]>>=1);u.scalefac_scale=_=1}}if(0==u.preflag&&u.block_type!=F.SHORT_TYPE&&2==t.mode_gr){for(i=11;i0&&(u.scalefac[i]-=e.pretab[i]);u.preflag=_=1}}for(s=0;s<4;s++)a.scfsi[r][s]=0;for(2==t.mode_gr&&1==n&&a.tt[0][r].block_type!=F.SHORT_TYPE&&a.tt[1][r].block_type!=F.SHORT_TYPE&&(!function(e,t){for(var n,r=t.tt[1][e],a=t.tt[0][e],i=0;i=0);n++);if(n==A.scfsi_band[i+1]){for(n=A.scfsi_band[i];n_&&(r.part2_length=_,r.scalefac_compress=i)}}(r,a),_=0),i=0;ia[n]&&(t.part2_length=a[n],t.scalefac_compress=n);return t.part2_length==I.LARGE_BITS};var b=[[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(t,n){var r,i,s,o,l,c,f,u,p=a(4),h=n.scalefac;for(r=0!=n.preflag?2:0,f=0;f<4;f++)p[f]=0;if(n.block_type==F.SHORT_TYPE){i=1;var d=e.nr_of_sfb_block[r][i];for(u=0,s=0;s<4;s++)for(o=d[s]/3,f=0;fp[s]&&(p[s]=h[3*u+l])}else{i=0;d=e.nr_of_sfb_block[r][i];for(u=0,s=0;s<4;s++)for(o=d[s],f=0;fp[s]&&(p[s]=h[u])}for(c=!1,s=0;s<4;s++)p[s]>b[r][s]&&(c=!0);if(!c){var v,m,g,w;for(n.sfb_partition_table=e.nr_of_sfb_block[r][i],s=0;s<4;s++)n.slen[s]=y[p[s]];switch(v=n.slen[0],m=n.slen[1],g=n.slen[2],w=n.slen[3],r){case 0:n.scalefac_compress=(5*v+m<<4)+(g<<2)+w;break;case 1:n.scalefac_compress=400+(5*v+m<<2)+g;break;case 2:n.scalefac_compress=500+3*v+m;break;default:_.err.printf("intensity stereo not implemented yet\n")}}if(!c)for(n.part2_length=0,s=0;s<4;s++)n.part2_length+=n.slen[s]*n.sfb_partition_table[s];return c};var y=[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 r,a=0;e.scalefac_band.l[++a]t;)r--;for(r<0&&(r=n[a][0]),e.bv_scf[t-2]=r,r=n[a][1];e.scalefac_band.l[r+e.bv_scf[t-2]+2]>t;)r--;r<0&&(r=n[a][1]),e.bv_scf[t-1]=r}}}function y(){}function w(){function e(e,t,n,r,a,i,s,o,l,c,f,u,_,p,h){this.vbr_q=e,this.quant_comp=t,this.quant_comp_s=n,this.expY=r,this.st_lrm=a,this.st_s=i,this.masking_adj=s,this.masking_adj_short=o,this.ath_lower=l,this.ath_curve=c,this.ath_sensitivity=f,this.interch=u,this.safejoint=_,this.sfb21mod=p,this.msfix=h}function t(e,t,n,r,a,i,s,o,l,c,f,u,_,p){this.quant_comp=t,this.quant_comp_s=n,this.safejoint=r,this.nsmsfix=a,this.st_lrm=i,this.st_s=s,this.nsbass=o,this.scale=l,this.masking_adj=c,this.ath_lower=f,this.ath_curve=u,this.interch=_,this.sfscale=p}var n;this.setModules=function(e){n=e};var r=[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)],a=[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 i(e,t,n){var i=e.VBR==v.vbr_rh?r:a,s=e.VBR_q_frac,o=i[t],l=i[t+1],c=o;o.st_lrm=o.st_lrm+s*(l.st_lrm-o.st_lrm),o.st_s=o.st_s+s*(l.st_s-o.st_s),o.masking_adj=o.masking_adj+s*(l.masking_adj-o.masking_adj),o.masking_adj_short=o.masking_adj_short+s*(l.masking_adj_short-o.masking_adj_short),o.ath_lower=o.ath_lower+s*(l.ath_lower-o.ath_lower),o.ath_curve=o.ath_curve+s*(l.ath_curve-o.ath_curve),o.ath_sensitivity=o.ath_sensitivity+s*(l.ath_sensitivity-o.ath_sensitivity),o.interch=o.interch+s*(l.interch-o.interch),o.msfix=o.msfix+s*(l.msfix-o.msfix),function(e,t){var n=0;0>t&&(n=-1,t=0);90||(e.quant_comp=c.quant_comp),0!=n?e.quant_comp_short=c.quant_comp_s:Math.abs(e.quant_comp_short- -1)>0||(e.quant_comp_short=c.quant_comp_s),0!=c.expY&&(e.experimentalY=0!=c.expY),0!=n?e.internal_flags.nsPsy.attackthre=c.st_lrm:Math.abs(e.internal_flags.nsPsy.attackthre- -1)>0||(e.internal_flags.nsPsy.attackthre=c.st_lrm),0!=n?e.internal_flags.nsPsy.attackthre_s=c.st_s:Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)>0||(e.internal_flags.nsPsy.attackthre_s=c.st_s),0!=n?e.maskingadjust=c.masking_adj:Math.abs(e.maskingadjust-0)>0||(e.maskingadjust=c.masking_adj),0!=n?e.maskingadjust_short=c.masking_adj_short:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=c.masking_adj_short),0!=n?e.ATHlower=-c.ath_lower/10:Math.abs(10*-e.ATHlower-0)>0||(e.ATHlower=-c.ath_lower/10),0!=n?e.ATHcurve=c.ath_curve:Math.abs(e.ATHcurve- -1)>0||(e.ATHcurve=c.ath_curve),0!=n?e.athaa_sensitivity=c.ath_sensitivity:Math.abs(e.athaa_sensitivity- -1)>0||(e.athaa_sensitivity=c.ath_sensitivity),c.interch>0&&(0!=n?e.interChRatio=c.interch:Math.abs(e.interChRatio- -1)>0||(e.interChRatio=c.interch)),c.safejoint>0&&(e.exp_nspsytune=e.exp_nspsytune|c.safejoint),c.sfb21mod>0&&(e.exp_nspsytune=e.exp_nspsytune|c.sfb21mod<<20),0!=n?e.msfix=c.msfix:Math.abs(e.msfix- -1)>0||(e.msfix=c.msfix),0==n&&(e.VBR_q=t,e.VBR_q_frac=s)}var s=[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 o(e,t,r){var a=t,i=n.nearestBitrateFullIndex(t);if(e.VBR=v.vbr_abr,e.VBR_mean_bitrate_kbps=a,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,e.VBR_mean_bitrate_kbps>320&&(e.disable_reservoir=!0),s[i].safejoint>0&&(e.exp_nspsytune=2|e.exp_nspsytune),s[i].sfscale>0&&(e.internal_flags.noise_shaping=2),Math.abs(s[i].nsbass)>0){var o=int(4*s[i].nsbass);o<0&&(o+=64),e.exp_nspsytune=e.exp_nspsytune|o<<2}return 0!=r?e.quant_comp=s[i].quant_comp:Math.abs(e.quant_comp- -1)>0||(e.quant_comp=s[i].quant_comp),0!=r?e.quant_comp_short=s[i].quant_comp_s:Math.abs(e.quant_comp_short- -1)>0||(e.quant_comp_short=s[i].quant_comp_s),0!=r?e.msfix=s[i].nsmsfix:Math.abs(e.msfix- -1)>0||(e.msfix=s[i].nsmsfix),0!=r?e.internal_flags.nsPsy.attackthre=s[i].st_lrm:Math.abs(e.internal_flags.nsPsy.attackthre- -1)>0||(e.internal_flags.nsPsy.attackthre=s[i].st_lrm),0!=r?e.internal_flags.nsPsy.attackthre_s=s[i].st_s:Math.abs(e.internal_flags.nsPsy.attackthre_s- -1)>0||(e.internal_flags.nsPsy.attackthre_s=s[i].st_s),0!=r?e.scale=s[i].scale:Math.abs(e.scale- -1)>0||(e.scale=s[i].scale),0!=r?e.maskingadjust=s[i].masking_adj:Math.abs(e.maskingadjust-0)>0||(e.maskingadjust=s[i].masking_adj),s[i].masking_adj>0?0!=r?e.maskingadjust_short=.9*s[i].masking_adj:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=.9*s[i].masking_adj):0!=r?e.maskingadjust_short=1.1*s[i].masking_adj:Math.abs(e.maskingadjust_short-0)>0||(e.maskingadjust_short=1.1*s[i].masking_adj),0!=r?e.ATHlower=-s[i].ath_lower/10:Math.abs(10*-e.ATHlower-0)>0||(e.ATHlower=-s[i].ath_lower/10),0!=r?e.ATHcurve=s[i].ath_curve:Math.abs(e.ATHcurve- -1)>0||(e.ATHcurve=s[i].ath_curve),0!=r?e.interChRatio=s[i].interch:Math.abs(e.interChRatio- -1)>0||(e.interChRatio=s[i].interch),t}this.apply_preset=function(e,t,n){switch(t){case Z.R3MIX:t=Z.V3,e.VBR=v.vbr_mtrh;break;case Z.MEDIUM:t=Z.V4,e.VBR=v.vbr_rh;break;case Z.MEDIUM_FAST:t=Z.V4,e.VBR=v.vbr_mtrh;break;case Z.STANDARD:t=Z.V2,e.VBR=v.vbr_rh;break;case Z.STANDARD_FAST:t=Z.V2,e.VBR=v.vbr_mtrh;break;case Z.EXTREME:t=Z.V0,e.VBR=v.vbr_rh;break;case Z.EXTREME_FAST:t=Z.V0,e.VBR=v.vbr_mtrh;break;case Z.INSANE:return t=320,e.preset=t,o(e,t,n),e.VBR=v.vbr_off,t}switch(e.preset=t,t){case Z.V9:return i(e,9,n),t;case Z.V8:return i(e,8,n),t;case Z.V7:return i(e,7,n),t;case Z.V6:return i(e,6,n),t;case Z.V5:return i(e,5,n),t;case Z.V4:return i(e,4,n),t;case Z.V3:return i(e,3,n),t;case Z.V2:return i(e,2,n),t;case Z.V1:return i(e,1,n),t;case Z.V0:return i(e,0,n),t}return 8<=t&&t<=320?o(e,t,n):(e.preset=0,t)}}function S(){var e;this.setModules=function(t){e=t},this.ResvFrameBegin=function(t,n){var r,a=t.internal_flags,i=a.l3_side,s=e.getframebits(t);n.bits=(s-8*a.sideinfo_len)/a.mode_gr;var o=2048*a.mode_gr-8;t.brate>320?r=8*int(1e3*t.brate/(t.out_samplerate/1152)/8+.5):(r=11520,t.strict_ISO&&(r=8*int(32e4/(t.out_samplerate/1152)/8+.5))),a.ResvMax=r-s,a.ResvMax>o&&(a.ResvMax=o),(a.ResvMax<0||t.disable_reservoir)&&(a.ResvMax=0);var l=n.bits*a.mode_gr+Math.min(a.ResvSize,a.ResvMax);return l>r&&(l=r),i.resvDrain_pre=0,null!=a.pinfo&&(a.pinfo.mean_bits=n.bits/2,a.pinfo.resvsize=a.ResvSize),l},this.ResvMaxBits=function(e,t,n,r){var a,i=e.internal_flags,s=i.ResvSize,o=i.ResvMax;0!=r&&(s+=t),0!=(1&i.substep_shaping)&&(o*=.9),n.bits=t,10*s>9*o?(a=s-9*o/10,n.bits+=a,i.substep_shaping|=128):(a=0,i.substep_shaping&=127,e.disable_reservoir||0!=(1&i.substep_shaping)||(n.bits-=.1*t));var l=s<6*i.ResvMax/10?s:6*i.ResvMax/10;return(l-=a)<0&&(l=0),l},this.ResvAdjust=function(e,t){e.ResvSize-=t.part2_3_length+t.part2_length},this.ResvFrameEnd=function(e,t){var n,r=e.l3_side;e.ResvSize+=t*e.mode_gr;var a=0;r.resvDrain_post=0,r.resvDrain_pre=0,0!=(n=e.ResvSize%8)&&(a+=n),(n=e.ResvSize-a-e.ResvMax)>0&&(a+=n);var i=Math.min(8*r.main_data_begin,a)/8;r.resvDrain_pre+=8*i,a-=8*i,e.ResvSize-=8*i,r.main_data_begin-=i,r.resvDrain_post+=a,e.ResvSize-=a}}function x(){this.setModules=function(e,t,n){e,t,n};var e=[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];function t(t,n){return n=n>>8^e[255&(n^t)]}this.updateMusicCRC=function(e,n,r,a){for(var i=0;i0;){var r;0==h&&(h=8,p++,e.header[e.w_ptr].write_timing==f&&d(e),c[p]=0),n-=r=Math.min(n,h),h-=r,c[p]|=t>>n<0;){var r;0==h&&(h=8,p++,c[p]=0),n-=r=Math.min(n,h),h-=r,c[p]|=t>>n<=8&&(v(r,76,8),t-=8),t>=8&&(v(r,65,8),t-=8),t>=8&&(v(r,77,8),t-=8),t>=8&&(v(r,69,8),t-=8),t>=32){var a=s.getLameShortVersion();if(t>=32)for(n=0;n=8;++n)t-=8,v(r,a.charCodeAt(n),8)}for(;t>=1;t-=1)v(r,r.ancillary_flag,1),r.ancillary_flag^=e.disable_reservoir?0:1}function w(e,t,n){for(var r=e.header[e.h_ptr].ptr;n>0;){var a=Math.min(n,8-(7&r));n-=a,e.header[e.h_ptr].buf[r>>3]|=t>>n<<8-(7&r)-a,r+=a}e.header[e.h_ptr].ptr=r}function S(e,t){e<<=8;for(var n=0;n<8;n++)0!=(65536&((t<<=1)^(e<<=1)))&&(t^=32773);return t}function x(e,t){var n,r=A.ht[t.count1table_select+32],a=0,i=t.big_values,s=t.big_values;for(n=(t.count1-t.big_values)/4;n>0;--n){var o=0,l=0;0!=t.l3_enc[i+0]&&(l+=8,t.xr[s+0]<0&&o++),0!=t.l3_enc[i+1]&&(l+=4,o*=2,t.xr[s+1]<0&&o++),0!=t.l3_enc[i+2]&&(l+=2,o*=2,t.xr[s+2]<0&&o++),0!=t.l3_enc[i+3]&&(l++,o*=2,t.xr[s+3]<0&&o++),i+=4,s+=4,v(e,o+r.table[l],r.hlen[l]),a+=r.hlen[l]}return a}function k(e,t,n,r,a){var i=A.ht[t],s=0;if(0==t)return s;for(var o=n;o15){if(p>14)_|=p-15<<1,c=f,p=15;if(h>14)_<<=f,_|=h-15,c+=f,h=15;u=16}0!=h&&(_<<=1,a.xr[o+1]<0&&_++,l--),p=p*u+h,c-=l,l+=i.hlen[p],v(e,i.table[p],l),v(e,_,c),s+=l+c}return s}function M(e,t){var n=3*e.scalefac_band.s[3];n>t.big_values&&(n=t.big_values);var r=k(e,t.table_select[0],0,n,t);return r+=k(e,t.table_select[1],n,t.big_values,t)}function R(e,t){var n,r,a,i;n=t.big_values;var s=t.region0_count+1;return a=e.scalefac_band.l[s],s+=t.region1_count+1,a>n&&(a=n),(i=e.scalefac_band.l[s])>n&&(i=n),r=k(e,t.table_select[0],0,a,t),r+=k(e,t.table_select[1],a,i,t),r+=k(e,t.table_select[2],i,n,t)}function T(){this.total=0}function B(t,n){var r,a,i,s,o,l=t.internal_flags;return o=l.w_ptr,-1==(s=l.h_ptr-1)&&(s=U.MAX_HEADER_BUF-1),r=l.header[s].write_timing-f,n.total=r,r>=0&&(a=1+s-o,s>8),t[5]=byte(255&n)},this.flush_bitstream=function(e){var n,a,i=e.internal_flags,s=i.h_ptr-1;if(-1==s&&(s=U.MAX_HEADER_BUF-1),n=i.l3_side,!((a=B(e,new T))<0)){if(b(e,a),i.ResvSize=0,n.main_data_begin=0,i.findReplayGain){var o=r.GetTitleGain(i.rgdata);i.RadioGain=0|Math.floor(10*o+.5)}i.findPeakSample&&(i.noclipGainChange=0|Math.ceil(20*t(i.PeakSample/32767)*10),i.noclipGainChange>0&&(EQ(e.scale,1)||EQ(e.scale,0))?i.noclipScale=Math.floor(32767/i.PeakSample*100)/100:i.noclipScale=-1)}},this.add_dummy_byte=function(e,t,n){for(var r,a=e.internal_flags;n-- >0;)for(m(0,t,8),r=0;r ResvSize"),8*t.main_data_begin!=n.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,n.ResvSize,t.resvDrain_post,t.resvDrain_pre,8*n.sideinfo_len,a-t.resvDrain_post-8*n.sideinfo_len,a,a%8,r),_.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"),n.ResvSize=8*t.main_data_begin),f>1e9){var i;for(i=0;is)return-1;if(_.arraycopy(c,0,t,n,u),p=-1,h=0,0!=f){var d=a(1);if(d[0]=e.nMusicCRC,l.updateMusicCRC(d,t,n,u),e.nMusicCRC=d[0],u>0&&(e.VBR_seek_table.nBytesWritten+=u),e.decode_on_the_fly)for(var v,m=o([2,1152]),b=u,g=-1;0!=g;)if(g=i.hip_decode1_unclipped(e.hip,t,n,b,m[0],m[1]),b=0,-1==g&&(g=0),g>0){if(e.findPeakSample){for(v=0;ve.PeakSample?e.PeakSample=m[0][v]:-m[0][v]>e.PeakSample&&(e.PeakSample=-m[0][v]);if(e.channels_out>1)for(v=0;ve.PeakSample?e.PeakSample=m[1][v]:-m[1][v]>e.PeakSample&&(e.PeakSample=-m[1][v])}if(e.findReplayGain&&r.AnalyzeSamples(e.rgdata,m[0],0,m[1],0,g,e.channels_out)==y.GAIN_ANALYSIS_ERROR)return-6}}return u},this.init_bit_stream_w=function(e){c=n(Z.LAME_MAXMP3BUFFER),e.h_ptr=e.w_ptr=0,e.header[e.h_ptr].write_timing=0,p=-1,h=0,f=0}}function M(e,t,n,r){this.xlen=e,this.linmax=t,this.table=n,this.hlen=r}m.STEREO=new m(0),m.JOINT_STEREO=new m(1),m.DUAL_CHANNEL=new m(2),m.MONO=new m(3),m.NOT_SET=new m(4),y.STEPS_per_dB=100,y.MAX_dB=120,y.GAIN_NOT_ENOUGH_SAMPLES=-24601,y.GAIN_ANALYSIS_ERROR=0,y.GAIN_ANALYSIS_OK=1,y.INIT_GAIN_ANALYSIS_ERROR=0,y.INIT_GAIN_ANALYSIS_OK=1,y.YULE_ORDER=10,y.MAX_ORDER=y.YULE_ORDER,y.MAX_SAMP_FREQ=48e3,y.RMS_WINDOW_TIME_NUMERATOR=1,y.RMS_WINDOW_TIME_DENOMINATOR=20,y.MAX_SAMPLES_PER_WINDOW=y.MAX_SAMP_FREQ*y.RMS_WINDOW_TIME_NUMERATOR/y.RMS_WINDOW_TIME_DENOMINATOR+1,x.NUMTOCENTRIES=100,x.MAXFRAMESIZE=2880,k.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)},k.NEQ=function(e,t){return!k.EQ(e,t)};var A={};function R(e){this.bits=e}function T(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}function B(){this.setModules=function(e,t){e,t}}function E(){this.useAdjust=0,this.aaSensitivityP=0,this.adjust=0,this.adjustLimit=0,this.decay=0,this.floor=0,this.l=i(F.SBMAX_l),this.s=i(F.SBMAX_s),this.psfb21=i(F.PSFB21),this.psfb12=i(F.PSFB12),this.cb_l=i(F.CBANDS),this.cb_s=i(F.CBANDS),this.eql_w=i(F.BLKSIZE/2)}function C(){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=m.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}function P(e){var t=e;this.quantize=t,this.iteration_loop=function(e,t,n,r){var s,o=e.internal_flags,l=i($.SFBMAX),c=i(576),f=a(2),u=0,_=o.l3_side,p=new R(u);this.quantize.rv.ResvFrameBegin(e,p),u=p.bits;for(var h=0;h>2&63)>=32&&(r-=64),c=Math.pow(10,r/4/10),(r=n.exp_nspsytune>>8&63)>=32&&(r-=64),p=Math.pow(10,r/4/10),(r=n.exp_nspsytune>>14&63)>=32&&(r-=64),v=Math.pow(10,r/4/10),(r=n.exp_nspsytune>>20&63)>=32&&(r-=64),b=v*Math.pow(10,r/4/10),r=0;rU.MAX_BITS_PER_GRANULE&&(d=U.MAX_BITS_PER_GRANULE),l=0,c=0;c3*i/4&&(_[c]=3*i/4),_[c]<0&&(_[c]=0),_[c]+r[c]>U.MAX_BITS_PER_CHANNEL&&(_[c]=Math.max(0,U.MAX_BITS_PER_CHANNEL-r[c])),l+=_[c];if(l>h)for(c=0;cU.MAX_BITS_PER_GRANULE){for(c=0;c.5&&(a=.5);var i=0|.5*a*(e[0]+e[1]);i>U.MAX_BITS_PER_CHANNEL-e[0]&&(i=U.MAX_BITS_PER_CHANNEL-e[0]),i<0&&(i=0),e[1]>=125&&(e[1]-i>125?(e[0]r&&(e[0]=r*e[0]/i,e[1]=r*e[1]/i)},this.athAdjust=function(e,t,n){var r=90.30873362,a=p.FAST_LOG10_X(t,10),i=e*e,s=0;return a-=n,i>1e-20&&(s=1+p.FAST_LOG10_X(i,10/r)),s<0&&(s=0),a*=s,a+=n+r-94.82444863,Math.pow(10,.1*a)},this.calc_xmin=function(e,t,n,r){var a,i=0,s=e.internal_flags,o=0,l=0,c=s.ATH,f=n.xr,u=e.VBR==v.vbr_mtrh?1:0,_=s.masking_lower;for(e.VBR!=v.vbr_mtrh&&e.VBR!=v.vbr_mt||(_=1),a=0;a>1,A=0;do{A+=T=f[o]*f[o],S+=T0);if(A>y&&l++,a==F.SBPSY_l)S<(M=y*s.nsPsy.longfact[a])&&(S=M);if(0!=u&&(y=S),!e.ATHonly)if((x=t.en.l[a])>0)M=A*t.thm.l[a]*_/x,0!=u&&(M*=s.nsPsy.longfact[a]),y>1;w=g/m,S=2220446049250313e-31;do{var T,B;A+=T=f[o]*f[o],S+=T0);if(A>g&&l++,d==F.SBPSY_s)S<(M=g*s.nsPsy.shortfact[d])&&(S=M);if(y=0!=u?S:g,!e.ATHonly&&!e.ATHshort)if((x=t.en.s[d][b])>0)M=A*t.thm.s[d][b]*_/x,0!=u&&(M*=s.nsPsy.shortfact[d]),yr[i-3+1]&&(r[i-3+1]+=(r[i-3]-r[i-3+1])*s.decay),r[i-3+1]>r[i-3+2]&&(r[i-3+2]+=(r[i-3+1]-r[i-3+2])*s.decay))}return l},this.calc_noise_core=function(e,t,n,r){var a=0,s=t.s,o=e.l3_enc;if(s>e.count1)for(;0!=n--;){c=e.xr[s],s++,a+=c*c,c=e.xr[s],s++,a+=c*c}else if(s>e.big_values){var l=i(2);for(l[0]=0,l[1]=r;0!=n--;){c=Math.abs(e.xr[s])-l[o[s]],s++,a+=c*c,c=Math.abs(e.xr[s])-l[o[s]],s++,a+=c*c}}else for(;0!=n--;){var c;c=Math.abs(e.xr[s])-_[o[s]]*r,s++,a+=c*c,c=Math.abs(e.xr[s])-_[o[s]]*r,s++,a+=c*c}return t.s=s,a},this.calc_noise=function(e,t,n,r,a){var i,s,o=0,l=0,u=0,_=0,h=0,d=-20,v=0,m=e.scalefac,g=0;for(r.over_SSD=0,i=0;i>1,v+e.width[i]>e.max_nonzero_coeff)s=(x=e.max_nonzero_coeff-v+1)>0?x>>1:0;var M=new b(v);S=this.calc_noise_core(e,M,s,k),v=M.s,null!=a&&(a.step[i]=w,a.noise[i]=S),S=n[o++]=S/t[l++],S=p.FAST_LOG10(Math.max(S,1e-20)),null!=a&&(a.noise_log[i]=S)}if(null!=a&&(a.global_gain=e.global_gain),h+=S,S>0)y=Math.max(0|10*S+.5,1),r.over_SSD+=y*y,u++,_+=S;d=Math.max(d,S)}return r.over_count=u,r.tot_noise=h,r.over_noise=_,r.max_noise=d,u},this.set_pinfo=function(e,t,n,r,a){var s,o,l,f,u,_=e.internal_flags,p=0==t.scalefac_scale?.5:1,h=t.scalefac,d=i($.SFBMAX),v=i($.SFBMAX),m=new T;calc_xmin(e,n,t,d),calc_noise(t,d,v,m,null);var b=0;for(o=t.sfb_lmax,t.block_type!=F.SHORT_TYPE&&0==t.mixed_block_flag&&(o=22),s=0;s0&&!e.ATHonly?f/=n.en.l[s]:f=0,_.pinfo.thr[r][a][s]=u*Math.max(f*n.thm.l[s],_.ATH.l[s]),_.pinfo.LAMEsfb[r][a][s]=0,0!=t.preflag&&s>=11&&(_.pinfo.LAMEsfb[r][a][s]=-p*c[s]),s0?f/=n.en.s[s][S]:f=0,(e.ATHonly||e.ATHshort)&&(f=0),_.pinfo.thr_s[r][a][3*s+S]=u*Math.max(f*n.thm.s[s][S],_.ATH.s[s]),_.pinfo.LAMEsfb_s[r][a][3*s+S]=-2*t.subblock_gain[S],s0?(i=n.over_SSD<=t.over_SSD,n.over_SSD==t.over_SSD&&(i=n.bits.2||n.max_noise<=0&&t.max_noise<0&&t.max_noise>n.max_noise-.2&&n.tot_noise0&&t.max_noise>n.max_noise-.2&&n.tot_noise0&&t.max_noise>-.05&&t.max_noise>n.max_noise-.1&&n.tot_noise+n.over_noise0&&t.max_noise>-.1&&t.max_noise>n.max_noise-.15&&n.tot_noise+n.over_noise+n.over_noise1?o=Math.pow(o,.5):o*=.95;break;case 0:default:o>1?o=1:o*=.95}var f=0;for(l=0;lt.xrpow_max&&(t.xrpow_max=r[f+u]);if(2==s.noise_shaping_amp)return}}}(e,t,a,i,s);var c=o(t);return!c&&(!(c=2==l.mode_gr?r.scale_bitcount(t):r.scale_bitcount_lsf(l,t))||(l.noise_shaping>1&&(u.fill(l.pseudohalf,0),0==t.scalefac_scale?(!function(e,t){for(var r=0,a=0;ae.xrpow_max&&(e.xrpow_max=t[r+o])}e.scalefac[a]=s>>1}e.preflag=0,e.scalefac_scale=1}(t,i),c=!1):t.block_type==F.SHORT_TYPE&&l.subblock_gain>0&&(c=function(e,t,r){var a,i=t.scalefac;for(a=0;a=16)return!0;for(var s=0;s<3;s++){var o=0,l=0;for(a=t.sfb_lmax+s;a=7)return!0;t.subblock_gain[s]++;var c=e.scalefac_band.l[t.sfb_lmax];for(a=t.sfb_lmax+s;a>t.scalefac_scale)>=0)i[a]=u,c+=3*f;else{i[a]=0;var _=210+(u<t.xrpow_max&&(t.xrpow_max=r[c+p]);c+=f*(3-s-1)}}var h=n.IPOW20(202);c+=t.width[a]*(s+1);for(p=-t.width[a];p<0;p++)r[c+p]*=h,r[c+p]>t.xrpow_max&&(t.xrpow_max=r[c+p])}}return!1}(l,t,i)||o(t))),c||(c=2==l.mode_gr?r.scale_bitcount(t):r.scale_bitcount_lsf(l,t)),!c))}this.setModules=function(i,s,o,l){e=i,t=s,this.rv=s,n=o,this.qupvt=o,r=l,a.setModules(n,r)},this.ms_convert=function(e,t){for(var n=0;n<576;++n){var r=e.tt[t][0].xr[n],a=e.tt[t][1].xr[n];e.tt[t][0].xr[n]=(r+a)*(.5*p.SQRT2),e.tt[t][1].xr[n]=(r-a)*(.5*p.SQRT2)}},this.init_xrpow=function(e,t,n){var r=0,a=0|t.max_nonzero_coeff;if(t.xrpow_max=0,u.fill(n,a,576,0),(r=function(e,t,n,r){r=0;for(var a=0;a<=n;++a){var i=Math.abs(e.xr[a]);r+=i,t[a]=Math.sqrt(i*Math.sqrt(i)),t[a]>e.xrpow_max&&(e.xrpow_max=t[a])}return r}(t,n,a,r))>1e-20){var i=0;0!=(2&e.substep_shaping)&&(i=1);for(var s=0;s=0&&!i;s--){var o=e.scalefac_band.psfb21[s],l=e.scalefac_band.psfb21[s+1],c=n.athAdjust(r.adjust,r.psfb21[s],r.floor);e.nsPsy.longfact[21]>1e-12&&(c*=e.nsPsy.longfact[21]);for(var f=l-1;f>=o;f--){if(!(Math.abs(a[f])=0&&!i;s--){l=(o=3*e.scalefac_band.s[12]+(e.scalefac_band.s[13]-e.scalefac_band.s[12])*u+(e.scalefac_band.psfb12[s]-e.scalefac_band.psfb12[0]))+(e.scalefac_band.psfb12[s+1]-e.scalefac_band.psfb12[s]);var _=n.athAdjust(r.adjust,r.psfb12[s],r.floor);e.nsPsy.shortfact[12]>1e-12&&(_*=e.nsPsy.shortfact[12]);for(f=l-1;f>=o;f--){if(!(Math.abs(a[f])<_)){i=!0;break}a[f]=0}}}(e,t)},s.BINSEARCH_NONE=new s(0),s.BINSEARCH_UP=new s(1),s.BINSEARCH_DOWN=new s(2),this.trancate_smallspectrums=function(e,t,a,s){var o=i($.SFBMAX);if((0!=(4&e.substep_shaping)||t.block_type!=F.SHORT_TYPE)&&0==(128&e.substep_shaping)){n.calc_noise(t,a,o,new T,null);for(var l=0;l<576;l++){var c=0;0!=t.l3_enc[l]&&(c=Math.abs(t.xr[l])),s[l]=c}l=0;var f=8;t.block_type==F.SHORT_TYPE&&(f=6);do{var _,p,h,d,v=t.width[f];if(l+=v,!(o[f]>=1||(u.sort(s,l-v,v),k.EQ(s[l-1],0)))){_=(1-o[f])*a[f],p=0,d=0;do{var m;for(h=1;d+h0)}}while(++fn?(u==s.BINSEARCH_DOWN&&(c=!0),c&&(l/=2),u=s.BINSEARCH_UP,_=l):(u==s.BINSEARCH_UP&&(c=!0),c&&(l/=2),u=s.BINSEARCH_DOWN,_=-l),t.global_gain+=_,t.global_gain<0&&(t.global_gain=0,c=!0),t.global_gain>255&&(t.global_gain=255,c=!0)}for(;o>n&&t.global_gain<255;)t.global_gain++,o=r.count_bits(e,i,t,null);e.CurrentStep[a]=f-t.global_gain>=4?4:2,e.OldValue[a]=t.global_gain,t.part2_3_length=o}(p,t,u,f,o),0==p.noise_shaping)return 100;n.calc_noise(t,a,m,b,g),b.bits=t.part2_3_length,h.assign(t);var k=0;for(_.arraycopy(o,0,d,0,576);!w;){do{var M,A=new T,R=255;if(M=0!=(2&p.substep_shaping)?20:3,p.sfb21_extra){if(m[h.sfbmax]>1)break;if(h.block_type==F.SHORT_TYPE&&(m[h.sfbmax+1]>1||m[h.sfbmax+2]>1))break}if(!c(e,h,m,o,S))break;0!=h.scalefac_scale&&(R=254);var B=u-h.part2_length;if(B<=0)break;for(;(h.part2_3_length=r.count_bits(p,o,h,g))>B&&h.global_gain<=R;)h.global_gain++;if(h.global_gain>R)break;if(0==b.over_count){for(;(h.part2_3_length=r.count_bits(p,o,h,g))>y&&h.global_gain<=R;)h.global_gain++;if(h.global_gain>R)break}if(n.calc_noise(h,a,m,A,g),A.bits=h.part2_3_length,0!=(l(t.block_type!=F.SHORT_TYPE?e.quant_comp:e.quant_comp_short,b,A,h,m)?1:0))y=t.part2_3_length,b=A,t.assign(h),k=0,_.arraycopy(o,0,d,0,576);else if(0==p.full_outer_loop){if(++k>M&&0==b.over_count)break;if(3==p.noise_shaping_amp&&S&&k>30)break;if(3==p.noise_shaping_amp&&S&&h.global_gain-x>15)break}}while(h.global_gain+h.scalefac_scale<255);3==p.noise_shaping_amp?S?w=!0:(h.assign(t),_.arraycopy(d,0,o,0,576),k=0,x=h.global_gain,S=!0):w=!0}return e.VBR==v.vbr_rh||e.VBR==v.vbr_mtrh?_.arraycopy(d,0,o,0,576):0!=(1&p.substep_shaping)&&trancate_smallspectrums(p,t,a,o),b.over_count},this.iteration_finish_one=function(e,n,a){var i=e.l3_side,s=i.tt[n][a];r.best_scalefac_store(e,n,a,i),1==e.use_best_huffman&&r.best_huffman_divide(e,s),t.ResvAdjust(e,s)},this.VBR_encode_granule=function(e,t,n,r,a,s,o){var l,c=e.internal_flags,f=new H,p=i(576),h=o,d=o+1,v=(o+s)/2,m=0,b=c.sfb21_extra;u.fill(f.l3_enc,0);do{c.sfb21_extra=!(v>h-42)&&b,outer_loop(e,t,n,r,a,v)<=0?(m=1,d=t.part2_3_length,f.assign(t),_.arraycopy(r,0,p,0,576),l=(o=d-32)-s,v=(o+s)/2):(l=o-(s=v+32),v=(o+s)/2,0!=m&&(m=2,t.assign(f),_.arraycopy(p,0,r,0,576)))}while(l>12);c.sfb21_extra=b,2==m&&_.arraycopy(f.l3_enc,0,t.l3_enc,0,576)},this.get_framebits=function(n,r){var a=n.internal_flags;a.bitrate_index=a.VBR_min_bitrate;var i=e.getframebits(n);a.bitrate_index=1,i=e.getframebits(n);for(var s=1;s<=a.VBR_max_bitrate;s++){a.bitrate_index=s;var o=new R(i);r[s]=t.ResvFrameBegin(n,o),i=o.bits}},this.VBR_old_prepare=function(e,r,a,i,s,o,l,c,f){var u,_=e.internal_flags,p=0,h=1,d=0;_.bitrate_index=_.VBR_max_bitrate;var v=t.ResvFrameBegin(e,new R(0))/_.mode_gr;get_framebits(e,o);for(var m=0;m<_.mode_gr;m++){var b=n.on_pe(e,r,c[m],v,m,0);_.mode_ext==F.MPG_MD_MS_LR&&(ms_convert(_.l3_side,m),n.reduce_side(c[m],a[m],v,b));for(var g=0;g<_.channels_out;++g){var y=_.l3_side.tt[m][g];y.block_type!=F.SHORT_TYPE?(p=1.28/(1+Math.exp(3.5-r[m][g]/300))-.05,u=_.PSY.mask_adjust-p):(p=2.56/(1+Math.exp(3.5-r[m][g]/300))-.14,u=_.PSY.mask_adjust_short-p),_.masking_lower=Math.pow(10,.1*u),init_outer_loop(_,y),f[m][g]=n.calc_xmin(e,i[m][g],y,s[m][g]),0!=f[m][g]&&(h=0),l[m][g]=126,d+=c[m][g]}}for(m=0;m<_.mode_gr;m++)for(g=0;g<_.channels_out;g++)d>o[_.VBR_max_bitrate]&&(c[m][g]*=o[_.VBR_max_bitrate],c[m][g]/=d),l[m][g]>c[m][g]&&(l[m][g]=c[m][g]);return h},this.bitpressure_strategy=function(e,t,n,r){for(var a=0;al&&(o[h][d]*=l,o[h][d]/=_);return f},this.calc_target_bits=function(r,a,i,s,o,l){var c,f,u,_,p=r.internal_flags,h=p.l3_side,d=0;p.bitrate_index=p.VBR_max_bitrate;var v=new R(d);for(l[0]=t.ResvFrameBegin(r,v),d=v.bits,p.bitrate_index=1,d=e.getframebits(r)-8*p.sideinfo_len,o[0]=d/(p.mode_gr*p.channels_out),d=r.VBR_mean_bitrate_kbps*r.framesize*1e3,0!=(1&p.substep_shaping)&&(d*=1.09),d/=r.out_samplerate,d-=8*p.sideinfo_len,d/=p.mode_gr*p.channels_out,(c=.93+.07*(11-r.compression_ratio)/5.5)<.9&&(c=.9),c>1&&(c=1),f=0;f700){var b=int((a[f][u]-700)/1.4),g=h.tt[f][u];s[f][u]=int(c*d),g.block_type==F.SHORT_TYPE&&b3*d/2?b=3*d/2:b<0&&(b=0),s[f][u]+=b}s[f][u]>U.MAX_BITS_PER_CHANNEL&&(s[f][u]=U.MAX_BITS_PER_CHANNEL),m+=s[f][u]}if(m>U.MAX_BITS_PER_GRANULE)for(u=0;uU.MAX_BITS_PER_CHANNEL&&(s[f][u]=U.MAX_BITS_PER_CHANNEL),_+=s[f][u];if(_>l[0])for(f=0;f=0;--z){var ee,te;ee=V[q+z]*a[20+z]+V[q+-1-z]*s[28+z],te=V[q+z]*s[28+z]-V[q+-1-z]*a[20+z],V[q+-1-z]=ee,V[q+z]=te}}}if(I=p,N=286,1==e.mode_gr)for(var ne=0;ne<18;ne++)_.arraycopy(e.sb_sample[H][1][ne],0,e.sb_sample[H][0][ne],0,32)}}}function V(){this.thm=new X,this.en=new X}function F(){var e=F.FFTOFFSET,t=F.MPG_MD_MS_LR,n=null;this.psy=null;var r=null,s=null,l=null;this.setModules=function(e,t,a,i){n=e,this.psy=t,r=t,s=i,l=a};var c=new j;this.lame_encode_mp3_frame=function(u,p,h,d,b,g){var y,w=f([2,2]);w[0][0]=new V,w[0][1]=new V,w[1][0]=new V,w[1][1]=new V;var S,x=f([2,2]);x[0][0]=new V,x[0][1]=new V,x[1][0]=new V,x[1][1]=new V;var k,M,A,R=[null,null],T=u.internal_flags,B=o([2,4]),E=[.5,.5],C=[[0,0],[0,0]],P=[[0,0],[0,0]];if(R[0]=p,R[1]=h,0==T.lame_encode_frame_init&&function(e,t){var n,r,a=e.internal_flags;if(0==a.lame_encode_frame_init){var s,o,l=i(2014),f=i(2014);for(a.lame_encode_frame_init=1,s=0,o=0;s<286+576*(1+a.mode_gr);++s)s<576*a.mode_gr?(l[s]=0,2==a.channels_out&&(f[s]=0)):(l[s]=t[0][o],2==a.channels_out&&(f[s]=t[1][o]),++o);for(r=0;r0&&(E[A]=B[A][3]/E[A])),M=0;M.03125)e.ATH.adjust>=1?e.ATH.adjust=1:e.ATH.adjust=r?(e.ATH.adjust*=.075*r+.925,e.ATH.adjust=r?e.ATH.adjust=r:e.ATH.adjust>1,d=(h=a<<1)+(_=a),a=h<<1,s=(i=t)+v;do{x=e[i+0]-e[i+_],S=e[i+0]+e[i+_],R=e[i+h]-e[i+d],M=e[i+h]+e[i+d],e[i+h]=S-M,e[i+0]=S+M,e[i+d]=x-R,e[i+_]=x+R,x=e[s+0]-e[s+_],S=e[s+0]+e[s+_],R=p.SQRT2*e[s+d],M=p.SQRT2*e[s+h],e[s+h]=S-M,e[s+0]=S+M,e[s+d]=x-R,e[s+_]=x+R,s+=a,i+=a}while(i=0);r(n[l],c,F.BLKSIZE_s/2)}},this.fft_long=function(t,n,i,s,o){var l=F.BLKSIZE/8-1,c=F.BLKSIZE/2;do{var f,u,_,p,h,d=255&a[l];u=(f=e[d]*s[i][o+d])-(h=e[d+512]*s[i][o+d+512]),f+=h,p=(_=e[d+256]*s[i][o+d+256])-(h=e[d+768]*s[i][o+d+768]),_+=h,n[(c-=4)+0]=f+_,n[c+2]=f-_,n[c+1]=u+p,n[c+3]=u-p,u=(f=e[d+1]*s[i][o+d+1])-(h=e[d+513]*s[i][o+d+513]),f+=h,p=(_=e[d+257]*s[i][o+d+257])-(h=e[d+769]*s[i][o+d+769]),_+=h,n[c+F.BLKSIZE/2+0]=f+_,n[c+F.BLKSIZE/2+2]=f-_,n[c+F.BLKSIZE/2+1]=u+p,n[c+F.BLKSIZE/2+3]=u-p}while(--l>=0);r(n,c,F.BLKSIZE/2)},this.init_fft=function(n){for(var r=0;r=0;--d){var v=i[s+0][d],m=i[s+1][d];i[s+0][d]=(v+m)*p.SQRT2*.5,i[s+1][d]=(v-m)*p.SQRT2*.5}for(var b=2;b>=0;--b)for(d=F.BLKSIZE_s-1;d>=0;--d){v=o[l+0][b][d],m=o[l+1][b][d];o[l+0][b][d]=(v+m)*p.SQRT2*.5,o[l+1][b][d]=(v-m)*p.SQRT2*.5}}n[0]=i[s+0][0],n[0]*=n[0];for(d=F.BLKSIZE/2-1;d>=0;--d){var g=i[s+0][F.BLKSIZE/2-d],y=i[s+0][F.BLKSIZE/2+d];n[F.BLKSIZE/2-d]=.5*(g*g+y*y)}for(b=2;b>=0;--b){a[b][0]=o[l+0][b][0],a[b][0]*=a[b][0];for(d=F.BLKSIZE_s/2-1;d>=0;--d){g=o[l+0][b][F.BLKSIZE_s/2-d],y=o[l+0][b][F.BLKSIZE_s/2+d];a[b][F.BLKSIZE_s/2-d]=.5*(g*g+y*y)}}var w=0;for(d=11;de){if(!(t=t*c)return e+t;s=e/t}if(e+=t,r+3<=6){if(s>=l)return e;var o=0|p.FAST_LOG10_X(s,16);return e*g[o]}var u,_;o=0|p.FAST_LOG10_X(s,16);return t=0!=i?a.ATH.cb_s[n]*a.ATH.adjust:a.ATH.cb_l[n]*a.ATH.adjust,et?(u=1,o<=13&&(u=y[o]),_=p.FAST_LOG10_X(e/t,10/15),e*((b[o]-u)*_+u)):o>13?e:e*y[o]:e*b[o]}var S=[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 x(e,t,n){var r;if(e<0&&(e=0),t<0&&(t=0),e<=0)return t;if(t<=0)return e;if(r=t>e?t/e:e/t,-2<=n&&n<=2){if(r>=l)return e+t;var a=0|p.FAST_LOG10_X(r,16);return(e+t)*S[a]}return r=f){++i;break}var _=e.PSY.bo_s_weight[i],p=1-_;o=_*t[s],l=_*n[s],e.en[r].s[i][a]+=o,e.thm[r].s[i][a]+=l,o=p*t[s],l=p*n[s]}for(;i=c){++a;break}var u=e.PSY.bo_l_weight[a],_=1-u;s=u*t[i],o=u*n[i],e.en[r].l[a]+=s,e.thm[r].l[a]+=o,s=_*t[i],o=_*n[i]}for(;a=1?e:n<=0?t:t>0?Math.pow(e/t,n)*t:0}var T=[11.8,13.6,17.2,32,46.5,51.3,57.5,67.1,71.5,84.6,97.6,130];function B(e,n){for(var r=309.07,a=0;a0){var o=s*n,l=e.en.s[a][i];l>o&&(r+=l>1e10*o?T[a]*(10*t):T[a]*p.FAST_LOG10(l/o))}}return r}var E=[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 C(e,n){for(var r=281.0575,a=0;a0){var s=i*n,o=e.en.l[a];o>s&&(r+=o>1e10*s?E[a]*(10*t):E[a]*p.FAST_LOG10(o/s))}}return r}function P(e,t,n,r,a){var i,s;for(i=s=0;i0?((o=t[i])a&&(l=a),r[i]=l):r[i]=0;for(i=1;i0)(o=t[i-1])a&&(l=a),r[i]=l;else r[i]=0}(s=n[i-1]+n[i])>0?((o=t[i-1])a&&(l=a),r[i]=l):r[i]=0}var L=[-1730326e-23,-.01703172,-1349528e-23,.0418072,-673278e-22,-.0876324,-30835e-21,.1863476,-1104424e-22,-.627638];function I(t,n,r,a,i,s,o,l){var c=t.internal_flags;if(a<2)e.fft_long(c,o[l],a,n,r);else if(2==a)for(var f=F.BLKSIZE-1;f>=0;--f){var u=o[l+0][f],_=o[l+1][f];o[l+0][f]=(u+_)*p.SQRT2*.5,o[l+1][f]=(u-_)*p.SQRT2*.5}s[0]=o[l+0][0],s[0]*=s[0];for(f=F.BLKSIZE/2-1;f>=0;--f){var h=o[l+0][F.BLKSIZE/2-f],d=o[l+0][F.BLKSIZE/2+f];s[F.BLKSIZE/2-f]=.5*(h*h+d*d)}var v=0;for(f=11;f=0;--f){var u=o[l+0][i][f],_=o[l+1][i][f];o[l+0][i][f]=(u+_)*p.SQRT2*.5,o[l+1][i][f]=(u-_)*p.SQRT2*.5}s[i][0]=o[l+0][i][0],s[i][0]*=s[i][0];for(f=F.BLKSIZE_s/2-1;f>=0;--f){var h=o[l+0][i][F.BLKSIZE_s/2-f],d=o[l+0][i][F.BLKSIZE_s/2+f];s[i][F.BLKSIZE_s/2-f]=.5*(h*h+d*d)}}function H(e,t,n,a){var i=e.internal_flags;2==e.athaa_loudapprox&&n<2&&(i.loudness_sq[t][n]=i.loudness_sq_save[n],i.loudness_sq_save[n]=r(a,i))}this.L3psycho_anal_ns=function(e,t,n,r,l,c,f,p,d,b){var g,y,S,x,T,E,I,N,H,$,D=e.internal_flags,j=o([2,F.BLKSIZE]),V=o([2,3,F.BLKSIZE_s]),q=i(F.CBANDS+1),Y=i(F.CBANDS+1),X=i(F.CBANDS+2),z=a(2),U=a(2),K=o([2,576]),W=a(F.CBANDS+2),Z=a(F.CBANDS+2);for(u.fill(Z,0),g=D.channels_out,e.mode==m.JOINT_STEREO&&(g=4),H=e.VBR==v.vbr_off?0==D.ResvMax?0:D.ResvSize/D.ResvMax*.5:e.VBR==v.vbr_rh||e.VBR==v.vbr_mtrh||e.VBR==v.vbr_mt?.6:1,y=0;y2&&(c[r][y].en.assign(D.en[y+2]),c[r][y].thm.assign(D.thm[y+2]))}for(y=0;yne[x+3-2]?ve/=ne[x+3-2]:ve=ne[x+3-2]>10*ve?ne[x+3-2]/(10*ve):0,ae[x+3]=ve}if(e.analysis){var me=ae[0];for(x=1;x<12;x++)mete&&(le[x/3]=x%3+1);for(x=1;x<4;x++){(re[x-1]>re[x]?re[x-1]/re[x]:re[x]/re[x-1])<1.7&&(le[x]=0,1==x&&(le[0]=0))}for(0!=le[0]&&0!=D.nsPsy.lastAttacks[y]&&(le[0]=0),3!=D.nsPsy.lastAttacks[y]&&le[0]+le[1]+le[2]+le[3]==0||(ie=0,0!=le[1]&&0!=le[0]&&(le[1]=0),0!=le[2]&&0!=le[1]&&(le[2]=0),0!=le[3]&&0!=le[2]&&(le[3]=0)),y<2?U[y]=ie:0==ie&&(U[0]=U[1]=0),d[y]=D.tot_ener[y],s(e,ce,fe,j,1&y,V,1&y,r,y,t,n),P(D,ce,q,se,oe),O(D,se,oe,W),N=0;N<3;N++){var be,ge;for(A(e,fe,Y,X,y,N),k(D,Y,X,y,N),I=0;I=2||1==le[N+1]){var ye=0!=N?N-1:2;ve=R(D.thm[y].s[I][ye],ge,.6*H);ge=Math.min(ge,ve)}if(1==le[N]){ye=0!=N?N-1:2,ve=R(D.thm[y].s[I][ye],ge,.3*H);ge=Math.min(ge,ve)}else if(0!=N&&3==le[N-1]||0==N&&3==D.nsPsy.lastAttacks[y]){ye=2!=N?N+1:0,ve=R(D.thm[y].s[I][ye],ge,.3*H);ge=Math.min(ge,ve)}be=ne[3*N+3]+ne[3*N+4]+ne[3*N+5],6*ne[3*N+5]0&&function(e,t){var n=e.internal_flags;if(n.channels_out>1){for(var r=0;r1.58*e.thm[1].l[t]||e.thm[1].l[t]>1.58*e.thm[0].l[t])){var n=e.mld_l[t]*e.en[3].l[t],r=Math.max(e.thm[2].l[t],Math.min(e.thm[3].l[t],n));n=e.mld_l[t]*e.en[2].l[t];var a=Math.max(e.thm[3].l[t],Math.min(e.thm[2].l[t],n));e.thm[2].l[t]=r,e.thm[3].l[t]=a}for(t=0;t1.58*e.thm[1].s[t][i]||e.thm[1].s[t][i]>1.58*e.thm[0].s[t][i])){n=e.mld_s[t]*e.en[3].s[t][i],r=Math.max(e.thm[2].s[t][i],Math.min(e.thm[3].s[t][i],n));n=e.mld_s[t]*e.en[2].s[t][i];a=Math.max(e.thm[3].s[t][i],Math.min(e.thm[2].s[t][i],n));e.thm[2].s[t][i]=r,e.thm[3].s[t][i]=a}}(D),$=e.msfix,Math.abs($)>0&&function(e,t,n){var r=t,a=Math.pow(10,n);t*=2,r*=2;for(var i=0;i1?(ke=p,Re=-2,Me=F.NORM_TYPE,b[0]!=F.SHORT_TYPE&&b[1]!=F.SHORT_TYPE||(Me=F.SHORT_TYPE),Ae=c[r][y-2]):(ke=f,Re=0,Me=b[y],Ae=l[r][y]),Me==F.SHORT_TYPE?ke[Re+y]=B(Ae,D.masking_lower):ke[Re+y]=C(Ae,D.masking_lower),e.analysis&&(D.pinfo.pe[r][y]=ke[Re+y])}return 0};var $=[-1730326e-23,-.01703172,-1349528e-23,.0418072,-673278e-22,-.0876324,-30835e-21,.1863476,-1104424e-22,-.627638];function D(e,t,n){if(0==n)for(var r=0;r0?((o=t[i])a&&(l=a),r[i]=l):r[i]=0,i=1;i0)(o=t[i-1])a&&(l=a),r[i]=l;else r[i]=0}(s=n[i-1]+n[i])>0?((o=t[i-1])a&&(l=a),r[i]=l):r[i]=0}(f,u,p,h),l=c=0;cw&&(r[c]=w),f.masking_lower>1&&(r[c]*=f.masking_lower),r[c]>n[c]&&(r[c]=n[c]),f.masking_lower<1&&(r[c]*=f.masking_lower)}for(;c0?Math.min(h,y):Math.min(h,.3*n[o])}else{var w=16*e.nb_2[s][o],S=2*e.nb_1[s][o];w<=0&&(w=h),S<=0&&(S=h),y=e.blocktype_old[1&s]==F.NORM_TYPE?Math.min(S,w):S,r[o]=Math.min(h,y)}e.nb_2[s][o]=e.nb_1[s][o],e.nb_1[s][o]=h,p=l[o],p*=e.minval_l[o],p*=d,r[o]>p&&(r[o]=p),e.masking_lower>1&&(r[o]*=e.masking_lower),r[o]>n[o]&&(r[o]=n[o]),e.masking_lower<1&&(r[o]*=e.masking_lower)}for(;o0?Math.pow(10,a):1,u=0;u0){var y,w,S=r[u]*f;if(y=Math.min(Math.max(h,S),Math.max(d,S)),(w=(v=Math.max(l,S))+(m=Math.max(o,S)))>0&&y*c_&&(l=_),o>p&&(o=p),t[2][u]=l,t[3][u]=o}}function X(e,t){var n;return(n=e>=0?27*-e:e*t)<=-72?0:Math.exp(.2302585093*n)}function z(e){var t,n,r=0;for(r=0;X(r,e)>1e-20;r-=1);for(a=r,i=0;Math.abs(i-a)>1e-12;)X(r=(i+a)/2,e)>0?i=r:a=r;t=a;var a,i;r=0;for(r=0;X(r,e)>1e-20;r+=1);for(a=0,i=r;Math.abs(i-a)>1e-12;)X(r=(i+a)/2,e)>0?a=r:i=r;n=i;var s,o=0,l=1e3;for(s=0;s<=l;++s){o+=X(r=t+s*(n-t)/l,e)}return 1001/(o*(n-t))}function U(e){return e<0&&(e=0),e*=.001,13*Math.atan(.76*e)+3.5*Math.atan(e*e/56.25)}function W(e,t,n,r,s,o,l,c,f,u,_,p){var h,d=i(F.CBANDS+1),v=c/(p>15?1152:384),m=a(F.HBLKSIZE);c/=f;var b=0,g=0;for(h=0;hf/2){b=f/2,++h;break}}d[h]=c*b;for(var w=0;wf/2&&(x=f/2),n[w]=(m[S]+m[x])/2,t[w]=m[x];var R=v*M;l[w]=(R-d[t[w]])/(d[t[w]+1]-d[t[w]]),l[w]<0?l[w]=0:l[w]>1&&(l[w]=1),A=U(c*u[w]*_),A=Math.min(A,15.5)/15.5,o[w]=Math.pow(10,1.25*(1-Math.cos(Math.PI*A))-2.5)}b=0;for(var T=0;T=0?3:1.5)>=.5&&f<=2.5?8*((p=f-.5)*p-2*p):0,((_=15.811389+7.5*(f+=.474)-17.5*Math.sqrt(1+f*f))<=-60?0:(f=Math.exp(.2302585093*(u+_)),f/=.6609193))*r[l]);h[v][l]=m*a[v]}else for(l=0;l0);l++);for(e[v][0]=l,l=t-1;l>0&&!(h[v][l]>0);l--);e[v][1]=l,d+=e[v][1]-e[v][0]+1}var y=i(d),w=0;for(v=0;v2&&(s[r][v].en.assign(p.en[v+2]),s[r][v].thm.assign(p.thm[v+2]))}for(v=0;v0;++g,--S){var E=_[0][g],C=_[1][g];_[0][g]=E+C,_[1][g]=E-C}for(g=0;g<3;g++)k[g]=p.nsPsy.last_en_subshort[v][g+6],x[g]=k[g]/p.nsPsy.last_en_subshort[v][g+4],M[0]+=k[g];for(g=0;g<9;g++){for(var P=R+64,O=1;Rk[g+3-2]?O/=k[g+3-2]:O=k[g+3-2]>10*O?k[g+3-2]/(10*O):0,x[g+3]=O}for(g=0;g<3;++g){var L=k[3*g+3]+k[3*g+4]+k[3*g+5],I=1;6*k[3*g+5]T&&(f[v][g/3]=g%3+1);for(g=1;g<4;g++){var H=M[g-1],D=M[g];Math.max(H,D)<4e4&&H<1.7*D&&D<1.7*H&&(1==g&&f[v][0]<=f[v][g]&&(f[v][0]=0),f[v][g]=0)}f[v][0]<=p.nsPsy.lastAttacks[v]&&(f[v][0]=0),3!=p.nsPsy.lastAttacks[v]&&f[v][0]+f[v][1]+f[v][2]+f[v][3]==0||(B=0,0!=f[v][1]&&0!=f[v][0]&&(f[v][1]=0),0!=f[v][2]&&0!=f[v][1]&&(f[v][2]=0),0!=f[v][3]&&0!=f[v][2]&&(f[v][3]=0)),v<2?u[v]=B:0==B&&(u[0]=u[1]=0),l[v]=p.tot_ener[v]}}(e,t,n,r,s,l,u,S,x,A),function(e,t){var n=e.internal_flags;e.short_blocks!=h.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var r=0;r=2||1==x[E][P+1]){var U=0!=P?P-1:2,K=R(p.thm[E].s[L][U],z,.36);z=Math.min(z,K)}else if(1==x[E][P]){U=0!=P?P-1:2,K=R(p.thm[E].s[L][U],z,.18);z=Math.min(z,K)}else if(0!=P&&3==x[E][P-1]||0==P&&3==p.nsPsy.lastAttacks[E]){U=2!=P?P+1:0,K=R(p.thm[E].s[L][U],z,.18);z=Math.min(z,K)}z*=S[E][P],X[P]=z}for(P=0;P<3;P++)p.thm[E].s[L][P]=X[P]}}for(E=0;E1?(W=f,Z=-2,G=F.NORM_TYPE,_[0]!=F.SHORT_TYPE&&_[1]!=F.SHORT_TYPE||(G=F.SHORT_TYPE),Q=l[r][E-2]):(W=c,Z=0,G=_[E],Q=s[r][E]),G==F.SHORT_TYPE?W[Z+E]=B(Q,p.masking_lower):W[Z+E]=C(Q,p.masking_lower),e.analysis&&(p.pinfo.pe[r][E]=W[Z+E])}return 0},this.psymodel_init=function(n){var r,a=n.internal_flags,s=!0,o=13,u=0,_=0,p=-8.25,h=-4.5,m=i(F.CBANDS),b=i(F.CBANDS),g=i(F.CBANDS),y=n.out_samplerate;switch(n.experimentalZ){default:case 0:s=!0;break;case 1:s=n.VBR!=v.vbr_mtrh&&n.VBR!=v.vbr_mt;break;case 2:s=!1;break;case 3:o=8,u=-1.75,_=-.0125,p=-8.25,h=-2.25}for(a.ms_ener_ratio_old=.25,a.blocktype_old[0]=a.blocktype_old[1]=F.NORM_TYPE,r=0;r<4;++r){for(var w=0;w=o&&(x=_*(m[r]-o)/(24-o)+u*(24-m[r])/(24-o)),g[r]=Math.pow(10,x/10),a.numlines_l[r]>0?a.rnumlines_l[r]=1/a.numlines_l[r]:a.rnumlines_l[r]=0}a.s3_ll=Z(a.s3ind,a.npart_l,m,b,g,s);var k;w=0;for(r=0;r(T*=a.numlines_l[r])&&(R=T)}a.ATH.cb_l[r]=R,(R=20*m[r]/10-20)>6&&(R=100),R<-15&&(R=-15),R-=8,a.minval_l[r]=Math.pow(10,R/10)*a.numlines_l[r]}for(a.npart_s=W(a.numlines_s,a.bo_s,a.bm_s,m,b,a.mld_s,a.PSY.bo_s_weight,y,F.BLKSIZE_s,a.scalefac_band.s,F.BLKSIZE_s/384,F.SBMAX_s),w=0,r=0;r=o&&(x=h*(m[r]-o)/(24-o)+p*(24-m[r])/(24-o)),g[r]=Math.pow(10,x/10),R=d.MAX_VALUE;for(M=0;M(T*=a.numlines_s[r])&&(R=T)}a.ATH.cb_s[r]=R,R=7*m[r]/12-7,m[r]>12&&(R*=1+3.1*Math.log(1+R)),m[r]<12&&(R*=1+2.3*Math.log(1-R)),R<-15&&(R=-15),R-=8,a.minval_s[r]=Math.pow(10,R/10)*a.numlines_s[r]}a.s3_ss=Z(a.s3ind_s,a.npart_s,m,b,g,s),l=Math.pow(10,9/16),c=Math.pow(10,1.5),f=Math.pow(10,1.5),e.init_fft(a),a.decay=Math.exp(-1*t/(.01*y/192)),k=3.5,0!=(2&n.exp_nspsytune)&&(k=1),Math.abs(n.msfix)>0&&(k=n.msfix),n.msfix=k;for(var B=0;Ba.npart_l-1&&(a.s3ind[B][1]=a.npart_l-1);var E=576*a.mode_gr/y;if(a.ATH.decay=Math.pow(10,-1.2*E),a.ATH.adjust=.01,a.ATH.adjustLimit=1,-1!=n.ATHtype){var C=n.out_samplerate/F.BLKSIZE,P=0;for(A=0,r=0;r=0;)a.ATH.eql_w[r]*=P}for(B=w=0;B1?0:e<=0?1:Math.cos(Math.PI/2*e)}function S(e,t){switch(e){case 44100:return t.version=1,0;case 48e3:return t.version=1,1;case 32e3:return t.version=1,2;case 22050:return t.version=0,0;case 24e3:return t.version=0,1;case 16e3:return t.version=0,2;case 11025:return t.version=0,0;case 12e3:return t.version=0,1;case 8e3:return t.version=0,2;default:return t.version=0,-1}}function x(e,t,n){n<16e3&&(t=2);for(var r=A.bitrate_table[t][1],a=2;a<=14;a++)A.bitrate_table[t][a]>0&&Math.abs(A.bitrate_table[t][a]-e)0&&A.bitrate_table[t][r]==e)return r;return-1}function R(t,n){var r=[new g(8,2e3),new g(16,3700),new g(24,3900),new g(32,5500),new g(40,7e3),new g(48,7500),new g(56,1e4),new g(64,11e3),new g(80,13500),new g(96,15100),new g(112,15600),new g(128,17e3),new g(160,17500),new g(192,18600),new g(224,19400),new g(256,19700),new g(320,20500)],a=e.nearestBitrateFullIndex(n);t.lowerlimit=r[a].lowpass}function T(e){var t=F.BLKSIZE+e.framesize-F.FFTOFFSET;return t=Math.max(t,512+e.framesize-32)}function B(t,n,r,a,i,s){var o=e.enc.lame_encode_mp3_frame(t,n,r,a,i,s);return t.frameNum++,o}function L(){this.n_in=0,this.n_out=0}function I(){this.num_used=0}function N(e,t,n){var r=Math.PI*t;(e/=n)<0&&(e=0),e>1&&(e=1);var a=e-.5,i=.42-.5*Math.cos(2*e*Math.PI)+.08*Math.cos(4*e*Math.PI);return Math.abs(a)<1e-9?r/Math.PI:i*Math.sin(n*r*a)/(Math.PI*n*a)}function H(e,t,n,r,a,s,o,l,c){var f,u,_=e.internal_flags,p=0,h=e.out_samplerate/function e(t,n){return 0!=n?e(n,t%n):t}(e.out_samplerate,e.in_samplerate);h>U.BPC&&(h=U.BPC);var d=Math.abs(_.resample_ratio-Math.floor(.5+_.resample_ratio))<1e-4?1:0,v=1/_.resample_ratio;v>1&&(v=1);var m=31;0==m%2&&--m;var b=(m+=d)+1;if(0==_.fill_buffer_resample_init){for(_.inbuf_old[0]=i(b),_.inbuf_old[1]=i(b),f=0;f<=2*h;++f)_.blackfilt[f]=i(b);for(_.itime[0]=0,_.itime[1]=0,p=0;p<=2*h;p++){var g=0,y=(p-h)/(2*h);for(f=0;f<=m;f++)g+=_.blackfilt[p][f]=N(f-y,v,m);for(f=0;f<=m;f++)_.blackfilt[p][f]/=g}_.fill_buffer_resample_init=1}var w=_.inbuf_old[c];for(u=0;u=o)break;y=S-_.itime[c]-(p+m%2*.5);x=0|Math.floor(2*y*h+h+.5);var k=0;for(f=0;f<=m;++f){var M=f+p-m/2;k+=(M<0?w[b+M]:a[s+M])*_.blackfilt[x][f]}t[n+u]=k}if(l.num_used=Math.min(o,m+p-m/2),_.itime[c]+=l.num_used-u*_.resample_ratio,l.num_used>=b)for(f=0;f1.0001)for(var o=0;oe-r?n:a},this.lame_init_params=function(e){var i,c,g,T=e.internal_flags;if(T.Class_ID=0,null==T.ATH&&(T.ATH=new E),null==T.PSY&&(T.PSY=new d),null==T.rgdata&&(T.rgdata=new O),T.channels_in=e.num_channels,1==T.channels_in&&(e.mode=m.MONO),T.channels_out=e.mode==m.MONO?1:2,T.mode_ext=F.MPG_MD_MS_LR,e.mode==m.MONO&&(e.force_ms=!1),e.VBR==v.vbr_off&&128!=e.VBR_mean_bitrate_kbps&&0==e.brate&&(e.brate=e.VBR_mean_bitrate_kbps),e.VBR==v.vbr_off||e.VBR==v.vbr_mtrh||e.VBR==v.vbr_mt||(e.free_format=!1),e.VBR==v.vbr_off&&0==e.brate&&k.EQ(e.compression_ratio,0)&&(e.compression_ratio=11.025),e.VBR==v.vbr_off&&e.compression_ratio>0&&(0==e.out_samplerate&&(e.out_samplerate=map2MP3Frequency(int(.97*e.in_samplerate))),e.brate=0|16*e.out_samplerate*T.channels_out/(1e3*e.compression_ratio),T.samplerate_index=S(e.out_samplerate,e),e.free_format||(e.brate=x(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 B=16e3;switch(e.VBR){case v.vbr_off:R(C=new b,e.brate),B=C.lowerlimit;break;case v.vbr_abr:var C;R(C=new b,e.VBR_mean_bitrate_kbps),B=C.lowerlimit;break;case v.vbr_rh:var L=[19500,19e3,18600,18e3,17500,16e3,15600,14900,12500,1e4,3950];if(0<=e.VBR_q&&e.VBR_q<=9){var I=L[e.VBR_q],N=L[e.VBR_q+1],H=e.VBR_q_frac;B=linear_int(I,N,H)}else B=19500;break;default:L=[19500,19e3,18500,18e3,17500,16500,15500,14500,12500,9500,3950];if(0<=e.VBR_q&&e.VBR_q<=9){I=L[e.VBR_q],N=L[e.VBR_q+1],H=e.VBR_q_frac;B=linear_int(I,N,H)}else B=19500}e.mode!=m.MONO||e.VBR!=v.vbr_off&&e.VBR!=v.vbr_abr||(B*=1.5),e.lowpassfreq=0|B}if(0==e.out_samplerate&&(2*e.lowpassfreq>e.in_samplerate&&(e.lowpassfreq=e.in_samplerate/2),e.out_samplerate=(i=0|e.lowpassfreq,c=e.in_samplerate,g=44100,c>=48e3?g=48e3:c>=44100?g=44100:c>=32e3?g=32e3:c>=24e3?g=24e3:c>=22050?g=22050:c>=16e3?g=16e3:c>=12e3?g=12e3:c>=11025?g=11025:c>=8e3&&(g=8e3),-1==i?g:(i<=15960&&(g=44100),i<=15250&&(g=32e3),i<=11220&&(g=24e3),i<=9970&&(g=22050),i<=7230&&(g=16e3),i<=5420&&(g=12e3),i<=4510&&(g=11025),i<=3970&&(g=8e3),c44100?48e3:c>32e3?44100:c>24e3?32e3:c>22050?24e3:c>16e3?22050:c>12e3?16e3:c>11025?12e3:c>8e3?11025:8e3:g))),e.lowpassfreq=Math.min(20500,e.lowpassfreq),e.lowpassfreq=Math.min(e.out_samplerate/2,e.lowpassfreq),e.VBR==v.vbr_off&&(e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.brate)),e.VBR==v.vbr_abr&&(e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.VBR_mean_bitrate_kbps)),e.bWriteVbrTag||(e.findReplayGain=!1,e.decode_on_the_fly=!1,T.findPeakSample=!1),T.findReplayGain=e.findReplayGain,T.decode_on_the_fly=e.decode_on_the_fly,T.decode_on_the_fly&&(T.findPeakSample=!0),T.findReplayGain&&t.InitGainAnalysis(T.rgdata,e.out_samplerate)==y.INIT_GAIN_ANALYSIS_ERROR)return e.internal_flags=null,-6;switch(T.decode_on_the_fly&&!e.decode_only&&(null!=T.hip&&u.hip_decode_exit(T.hip),T.hip=u.hip_decode_init()),T.mode_gr=e.out_samplerate<=24e3?1:2,e.framesize=576*T.mode_gr,e.encoder_delay=F.ENCDELAY,T.resample_ratio=e.in_samplerate/e.out_samplerate,e.VBR){case v.vbr_mt:case v.vbr_rh:case v.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 v.vbr_abr:e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.VBR_mean_bitrate_kbps);break;default:e.compression_ratio=16*e.out_samplerate*T.channels_out/(1e3*e.brate)}if(e.mode==m.NOT_SET&&(e.mode=m.JOINT_STEREO),e.highpassfreq>0?(T.highpass1=2*e.highpassfreq,e.highpasswidth>=0?T.highpass2=2*(e.highpassfreq+e.highpasswidth):T.highpass2=2*e.highpassfreq,T.highpass1/=e.out_samplerate,T.highpass2/=e.out_samplerate):(T.highpass1=0,T.highpass2=0),e.lowpassfreq>0?(T.lowpass2=2*e.lowpassfreq,e.lowpasswidth>=0?(T.lowpass1=2*(e.lowpassfreq-e.lowpasswidth),T.lowpass1<0&&(T.lowpass1=0)):T.lowpass1=2*e.lowpassfreq,T.lowpass1/=e.out_samplerate,T.lowpass2/=e.out_samplerate):(T.lowpass1=0,T.lowpass2=0),function(e){var t=e.internal_flags,n=32,r=-1;if(t.lowpass1>0){for(var a=999,i=0;i<=31;i++){(c=i/31)>=t.lowpass2&&(n=Math.min(n,i)),t.lowpass10&&t.highpass2<.75/31*.9&&(t.highpass1=0,t.highpass2=0,_.err.println("Warning: highpass filter disabled. highpass frequency too small\n")),t.highpass2>0){var s=-1;for(i=0;i<=31;i++){(c=i/31)<=t.highpass1&&(r=Math.max(r,i)),t.highpass1t.highpass1?w((t.highpass2-c)/(t.highpass2-t.highpass1+1e-20)):1,l=t.lowpass2>t.lowpass1?w((c-t.lowpass1)/(t.lowpass2-t.lowpass1+1e-20)):1,t.amp_filter[i]=o*l}}(e),T.samplerate_index=S(e.out_samplerate,e),T.samplerate_index<0)return e.internal_flags=null,-1;if(e.VBR==v.vbr_off){if(e.free_format)T.bitrate_index=0;else if(e.brate=x(e.brate,e.version,e.out_samplerate),T.bitrate_index=M(e.brate,e.version,e.out_samplerate),T.bitrate_index<=0)return e.internal_flags=null,-1}else T.bitrate_index=1;e.analysis&&(e.bWriteVbrTag=!1),null!=T.pinfo&&(e.bWriteVbrTag=!1),n.init_bit_stream_w(T);for(var $,D=T.samplerate_index+3*e.version+6*(e.out_samplerate<16e3?1:0),j=0;j5&&(e.quality=5),T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?T.sfb21_extra=!1:T.sfb21_extra=e.out_samplerate>44e3,T.iteration_loop=new VBRNewIterationLoop(s);break;case v.vbr_rh:r.apply_preset(e,500-10*e.VBR_q,0),T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,e.experimentalY?T.sfb21_extra=!1:T.sfb21_extra=e.out_samplerate>44e3,e.quality>6&&(e.quality=6),e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),T.iteration_loop=new VBROldIterationLoop(s);break;default:var Y;T.sfb21_extra=!1,e.quality<0&&(e.quality=LAME_DEFAULT_QUALITY),(Y=e.VBR)==v.vbr_off&&(e.VBR_mean_bitrate_kbps=e.brate),r.apply_preset(e,e.VBR_mean_bitrate_kbps,0),e.VBR=Y,T.PSY.mask_adjust=e.maskingadjust,T.PSY.mask_adjust_short=e.maskingadjust_short,Y==v.vbr_off?T.iteration_loop=new P(s):T.iteration_loop=new ABRIterationLoop(s)}if(e.VBR!=v.vbr_off){if(T.VBR_min_bitrate=1,T.VBR_max_bitrate=14,e.out_samplerate<16e3&&(T.VBR_max_bitrate=8),0!=e.VBR_min_bitrate_kbps&&(e.VBR_min_bitrate_kbps=x(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),T.VBR_min_bitrate=M(e.VBR_min_bitrate_kbps,e.version,e.out_samplerate),T.VBR_min_bitrate<0))return-1;if(0!=e.VBR_max_bitrate_kbps&&(e.VBR_max_bitrate_kbps=x(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),T.VBR_max_bitrate=M(e.VBR_max_bitrate_kbps,e.version,e.out_samplerate),T.VBR_max_bitrate<0))return-1;e.VBR_min_bitrate_kbps=A.bitrate_table[e.version][T.VBR_min_bitrate],e.VBR_max_bitrate_kbps=A.bitrate_table[e.version][T.VBR_max_bitrate],e.VBR_mean_bitrate_kbps=Math.min(A.bitrate_table[e.version][T.VBR_max_bitrate],e.VBR_mean_bitrate_kbps),e.VBR_mean_bitrate_kbps=Math.max(A.bitrate_table[e.version][T.VBR_min_bitrate],e.VBR_mean_bitrate_kbps)}return e.tune&&(T.PSY.mask_adjust+=e.tune_value_a,T.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,-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,-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,-1==t.subblock_gain&&(t.subblock_gain=1),t.use_best_huffman=1,t.full_outer_loop=0}}(e),e.athaa_type<0?T.ATH.useAdjust=3:T.ATH.useAdjust=e.athaa_type,T.ATH.aaSensitivityP=Math.pow(10,e.athaa_sensitivity/-10),null==e.short_blocks&&(e.short_blocks=h.short_block_allowed),e.short_blocks!=h.short_block_allowed||e.mode!=m.JOINT_STEREO&&e.mode!=m.STEREO||(e.short_blocks=h.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=W.NSATTACKTHRE),e.internal_flags.nsPsy.attackthre_s<0&&(e.internal_flags.nsPsy.attackthre_s=W.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),T.slot_lag=T.frac_SpF=0,e.VBR==v.vbr_off&&(T.slot_lag=T.frac_SpF=72e3*(e.version+1)*e.brate%e.out_samplerate|0),a.iteration_init(e),p.psymodel_init(e),0},this.lame_encode_flush=function(e,t,r,a){var i,s,o,l,u=e.internal_flags,_=c([2,1152]),p=0,h=u.mf_samples_to_encode-F.POSTDELAY,d=T(e);if(u.mf_samples_to_encode<1)return 0;for(i=0,e.in_samplerate!=e.out_samplerate&&(h+=16*e.out_samplerate/e.in_samplerate),(o=e.framesize-h%e.framesize)<576&&(o+=e.framesize),e.encoder_padding=o,l=(h+o)/e.framesize;l>0&&p>=0;){var v=d-u.mf_size,m=e.frameNum;v*=e.in_samplerate,(v/=e.out_samplerate)>1152&&(v=1152),v<1&&(v=1),s=a-i,0==a&&(s=0),r+=p=this.lame_encode_buffer(e,_[0],_[1],v,t,r,s),i+=p,l-=m!=e.frameNum?1:0}if(u.mf_samples_to_encode=0,p<0)return p;if(s=a-i,0==a&&(s=0),n.flush_bitstream(e),(p=n.copy_buffer(u,t,r,s,1))<0)return p;if(r+=p,s=a-(i+=p),0==a&&(s=0),e.write_id3tag_automatic){if(f.id3tag_write_v1(e),(p=n.copy_buffer(u,t,r,s,0))<0)return p;i+=p}return i},this.lame_encode_buffer=function(e,r,a,s,o,l,c){var f=e.internal_flags,u=[null,null];if(4294479419!=f.Class_ID)return-3;if(0==s)return 0;!function(e,t){(null==e.in_buffer_0||e.in_buffer_nsamples1&&(u[1][_]=a[_]);return function(e,r,a,i,s,o,l){var c,f,u,_,p,h=e.internal_flags,d=0,v=[null,null],m=[null,null];if(4294479419!=h.Class_ID)return-3;if(0==i)return 0;if((p=n.copy_buffer(h,s,o,l,0))<0)return p;if(o+=p,d+=p,m[0]=r,m[1]=a,k.NEQ(e.scale,0)&&k.NEQ(e.scale,1))for(f=0;f0;){var g,w,S=[null,null];S[0]=m[0],S[1]=m[1];var x=new L;if($(e,v,S,b,i,x),g=x.n_in,w=x.n_out,h.findReplayGain&&!h.decode_on_the_fly&&t.AnalyzeSamples(h.rgdata,v[0],h.mf_size,v[1],h.mf_size,w,h.channels_out)==y.GAIN_ANALYSIS_ERROR)return-6;if(i-=g,b+=g,h.channels_out,h.mf_size+=w,h.mf_samples_to_encode<1&&(h.mf_samples_to_encode=F.ENCDELAY+F.POSTDELAY),h.mf_samples_to_encode+=w,h.mf_size>=_){var M=l-d;if(0==l&&(M=0),(c=B(e,v[0],v[1],s,o,M))<0)return c;for(o+=c,d+=c,h.mf_size-=e.framesize,h.mf_samples_to_encode-=e.framesize,u=0;uR&&(R=t.length,B=n(T=0|1.25*R+7200));var i=a.lame_encode_buffer(A,t,r,t.length,B,0,T);return new Int8Array(B.subarray(0,i))},this.flush=function(){var e=a.lame_encode_flush(A,B,0,T);return new Int8Array(B.subarray(0,e))}}}e(),Recorder.lamejs=e}()},function(e,t,n){"use strict";var r=n(5);n.n(r).a},function(e,t,n){(e.exports=n(15)(!1)).push([e.i,"\nbody{\r\n word-wrap: break-word;\r\n background:#f5f5f5 center top no-repeat;\r\n background-size: auto 680px;\n}\npre{\r\n white-space:pre-wrap;\n}\na{\r\n text-decoration: none;\r\n color:#06c;\n}\na:hover{\r\n color:#f00;\n}\n.main{\r\n max-width:700px;\r\n margin:0 auto;\r\n padding-bottom:80px\n}\n.mainBox{\r\n margin-top:12px;\r\n padding: 12px;\r\n border-radius: 6px;\r\n background: #fff;\r\n --border: 1px solid #0b1;\r\n box-shadow: 2px 2px 3px #aaa;\n}\n.btns button{\r\n display: inline-block;\r\n cursor: pointer;\r\n border: none;\r\n border-radius: 3px;\r\n background: #0b1;\r\n color:#fff;\r\n padding: 0 15px;\r\n margin:3px 20px 3px 0;\r\n line-height: 36px;\r\n height: 36px;\r\n overflow: hidden;\r\n vertical-align: middle;\n}\n.btns button:active{\r\n background: #0a1;\n}\n.pd{\r\n\tpadding:0 0 6px 0;\n}\n.lb{\r\n\tdisplay:inline-block;\r\n\tvertical-align: middle;\r\n\tbackground:#00940e;\r\n\tcolor:#fff;\r\n\tfont-size:14px;\r\n\tpadding:2px 8px;\r\n\tborder-radius: 99px;\n}\r\n",""])}]); \ No newline at end of file diff --git a/assets/demo-vue/dist/recordapp.js b/assets/demo-vue/dist/recordapp.js index af2eb60..67e983f 100644 --- a/assets/demo-vue/dist/recordapp.js +++ b/assets/demo-vue/dist/recordapp.js @@ -3,4 +3,4 @@ * Vue.js v2.6.10 * (c) 2014-2019 Evan You * Released under the MIT License. - */function i(e){return null==e}function a(e){return null!=e}function s(e){return!0===e}function c(e){return"string"==typeof e||"number"==typeof e||"symbol"===(void 0===e?"undefined":r(e))||"boolean"==typeof e}function l(e){return null!==e&&"object"===(void 0===e?"undefined":r(e))}var u=Object.prototype.toString;function f(e){return"[object Object]"===u.call(e)}function p(e){return"[object RegExp]"===u.call(e)}function d(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function v(e){return a(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function h(e){return null==e?"":Array.isArray(e)||f(e)&&e.toString===u?JSON.stringify(e,null,2):String(e)}function m(e){var t=parseFloat(e);return isNaN(t)?e:t}function g(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(n,1)}}var w=Object.prototype.hasOwnProperty;function x(e,t){return w.call(e,t)}function S(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var C=/-(\w)/g,A=S((function(e){return e.replace(C,(function(e,t){return t?t.toUpperCase():""}))})),k=S((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),R=/\B([A-Z])/g,$=S((function(e){return e.replace(R,"-$1").toLowerCase()}));var O=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function T(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function I(e,t){for(var n in t)e[n]=t[n];return e}function M(e){for(var t={},n=0;n0,ee=Z&&Z.indexOf("edge/")>0,te=(Z&&Z.indexOf("android"),Z&&/iphone|ipad|ipod|ios/.test(Z)||"ios"===X),ne=(Z&&/chrome\/\d+/.test(Z),Z&&/phantomjs/.test(Z),Z&&Z.match(/firefox\/(\d+)/)),re={}.watch,oe=!1;if(K)try{var ie={};Object.defineProperty(ie,"passive",{get:function(){oe=!0}}),window.addEventListener("test-passive",null,ie)}catch(e){}var ae=function(){return void 0===V&&(V=!K&&!G&&void 0!==e&&(e.process&&"server"===e.process.env.VUE_ENV)),V},se=K&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ce(e){return"function"==typeof e&&/native code/.test(e.toString())}var le,ue="undefined"!=typeof Symbol&&ce(Symbol)&&"undefined"!=typeof Reflect&&ce(Reflect.ownKeys);le="undefined"!=typeof Set&&ce(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var fe=L,pe=0,de=function(){this.id=pe++,this.subs=[]};de.prototype.addSub=function(e){this.subs.push(e)},de.prototype.removeSub=function(e){b(this.subs,e)},de.prototype.depend=function(){de.target&&de.target.addDep(this)},de.prototype.notify=function(){var e=this.subs.slice();for(var t=0,n=e.length;t-1)if(i&&!x(o,"default"))a=!1;else if(""===a||a===$(e)){var c=We(String,o.type);(c<0||s0&&(dt((o=e(o,(n||"")+"_"+r))[0])&&dt(u)&&(f[l]=be(u.text+o[0].text),o.shift()),f.push.apply(f,o)):c(o)?dt(u)?f[l]=be(u.text+o):""!==o&&f.push(be(o)):dt(o)&&dt(u)?f[l]=be(u.text+o.text):(s(t._isVList)&&a(o.tag)&&i(o.key)&&a(n)&&(o.key="__vlist"+n+"_"+r+"__"),f.push(o)));return f}(e):void 0}function dt(e){return a(e)&&a(e.text)&&!1===e.isComment}function vt(e,t){if(e){for(var n=Object.create(null),r=ue?Reflect.ownKeys(e):Object.keys(e),o=0;o0,a=e?!!e.$stable:!i,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&n&&n!==o&&s===n.$key&&!i&&!n.$hasNormal)return n;for(var c in r={},e)e[c]&&"$"!==c[0]&&(r[c]=yt(t,c,e[c]))}else r={};for(var l in t)l in r||(r[l]=_t(t,l));return e&&Object.isExtensible(e)&&(e._normalized=r),W(r,"$stable",a),W(r,"$key",s),W(r,"$hasNormal",i),r}function yt(e,t,n){var o=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"===(void 0===e?"undefined":r(e))&&!Array.isArray(e)?[e]:pt(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:o,enumerable:!0,configurable:!0}),o}function _t(e,t){return function(){return e[t]}}function bt(e,t){var n,r,o,i,s;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,o=e.length;rdocument.createEvent("Event").timeStamp&&(fn=function(){return pn.now()})}function dn(){var e,t;for(un=fn(),cn=!0,rn.sort((function(e,t){return e.id-t.id})),ln=0;lnln&&rn[n].id>e.id;)n--;rn.splice(n+1,0,e)}else rn.push(e);sn||(sn=!0,ot(dn))}}(this)},hn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||l(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){He(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},hn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},hn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},hn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||b(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var mn={enumerable:!0,configurable:!0,get:L,set:L};function gn(e,t,n){mn.get=function(){return this[t][n]},mn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,mn)}function yn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[];e.$parent&&ke(!1);var i=function(i){o.push(i);var a=Ue(i,t,n,e);Oe(r,i,a),i in e||gn(e,"_props",i)};for(var a in t)i(a);ke(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?L:O(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;f(t=e._data="function"==typeof t?function(e,t){he();try{return e.call(t,t)}catch(e){return He(e,t,"data()"),{}}finally{me()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,o=(e.$options.methods,n.length);for(;o--;){var i=n[o];0,r&&x(r,i)||J(i)||gn(e,"_data",i)}$e(t,!0)}(e):$e(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ae();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;0,r||(n[o]=new hn(e,a||L,L,_n)),o in e||bn(e,o,i)}}(e,t.computed),t.watch&&t.watch!==re&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!p(e)&&e.test(t)}function Tn(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=$n(a.componentOptions);s&&!t(s)&&In(n,i,r,o)}}}function In(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,b(n,t)}!function(e){e.prototype._init=function(e){var t=this;t._uid=Cn++,t._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(t,e):t.$options=Fe(An(t.constructor),e||{},t),t._renderProxy=t,t._self=t,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(t),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Zt(e,t)}(t),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,r=n&&n.context;e.$slots=ht(t._renderChildren,r),e.$scopedSlots=o,e._c=function(t,n,r,o){return zt(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return zt(e,t,n,r,o,!0)};var i=n&&n.data;Oe(e,"$attrs",i&&i.attrs||o,null,!0),Oe(e,"$listeners",t._parentListeners||o,null,!0)}(t),nn(t,"beforeCreate"),function(e){var t=vt(e.$options.inject,e);t&&(ke(!1),Object.keys(t).forEach((function(n){Oe(e,n,t[n])})),ke(!0))}(t),yn(t),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(t),nn(t,"created"),t.$options.el&&t.$mount(t.$options.el)}}(kn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Te,e.prototype.$delete=Ie,e.prototype.$watch=function(e,t,n){if(f(t))return Sn(this,e,t,n);(n=n||{}).user=!0;var r=new hn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){He(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(kn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var o=0,i=e.length;o1?T(n):n;for(var r=T(arguments,1),o='event handler for "'+e+'"',i=0,a=n.length;iparseInt(this.max)&&In(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return U}};Object.defineProperty(e,"config",t),e.util={warn:fe,extend:I,mergeOptions:Fe,defineReactive:Oe},e.set=Te,e.delete=Ie,e.nextTick=ot,e.observable=function(e){return $e(e),e},e.options=Object.create(null),F.forEach((function(t){e.options[t+"s"]=Object.create(null)})),e.options._base=e,I(e.options.components,Ln),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=T(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=Fe(this.options,e),this}}(e),Rn(e),function(e){F.forEach((function(t){e[t]=function(e,n){return n?("component"===t&&f(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}}))}(e)}(kn),Object.defineProperty(kn.prototype,"$isServer",{get:ae}),Object.defineProperty(kn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(kn,"FunctionalRenderContext",{value:Pt}),kn.version="2.6.10";var Dn=g("style,class"),Pn=g("input,textarea,option,select,progress"),jn=function(e,t,n){return"value"===n&&Pn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},En=g("contenteditable,draggable,spellcheck"),Nn=g("events,caret,typing,plaintext-only"),Fn=g("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Bn="http://www.w3.org/1999/xlink",Un=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},zn=function(e){return Un(e)?e.slice(6,e.length):""},Jn=function(e){return null==e||!1===e};function Wn(e){for(var t=e.data,n=e,r=e;a(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(t=Hn(r.data,t));for(;a(n=n.parent);)n&&n.data&&(t=Hn(t,n.data));return function(e,t){if(a(e)||a(t))return Vn(e,qn(t));return""}(t.staticClass,t.class)}function Hn(e,t){return{staticClass:Vn(e.staticClass,t.staticClass),class:a(e.class)?[e.class,t.class]:t.class}}function Vn(e,t){return e?t?e+" "+t:e:t||""}function qn(e){return Array.isArray(e)?function(e){for(var t,n="",r=0,o=e.length;r-1?yr(e,t,n):Fn(t)?Jn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):En(t)?e.setAttribute(t,function(e,t){return Jn(t)||"false"===t?"false":"contenteditable"===e&&Nn(t)?t:"true"}(t,n)):Un(t)?Jn(n)?e.removeAttributeNS(Bn,zn(t)):e.setAttributeNS(Bn,t,n):yr(e,t,n)}function yr(e,t,n){if(Jn(n))e.removeAttribute(t);else{if(Y&&!Q&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){e.addEventListener("input",(function t(n){n.stopImmediatePropagation(),e.removeEventListener("input",t)})),e.__ieph=!0}e.setAttribute(t,n)}}var _r={create:mr,update:mr};function br(e,t){var n=t.elm,r=t.data,o=e.data;if(!(i(r.staticClass)&&i(r.class)&&(i(o)||i(o.staticClass)&&i(o.class)))){var s=Wn(t),c=n._transitionClasses;a(c)&&(s=Vn(s,qn(c))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var wr,xr,Sr,Cr,Ar,kr,Rr={create:br,update:br},$r=/[\w).+\-_$\]]/;function Or(e){var t,n,r,o,i,a=!1,s=!1,c=!1,l=!1,u=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&$r.test(h)||(l=!0)}}else void 0===o?(d=r+1,o=e.slice(0,r).trim()):m();function m(){(i||(i=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===o?o=e.slice(0,r).trim():0!==d&&m(),i)for(r=0;r-1?{exp:e.slice(0,Cr),key:'"'+e.slice(Cr+1)+'"'}:{exp:e,key:null};xr=e,Cr=Ar=kr=0;for(;!Vr();)qr(Sr=Hr())?Gr(Sr):91===Sr&&Kr(Sr);return{exp:e.slice(0,Ar),key:e.slice(Ar+1,kr)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Hr(){return xr.charCodeAt(++Cr)}function Vr(){return Cr>=wr}function qr(e){return 34===e||39===e}function Kr(e){var t=1;for(Ar=Cr;!Vr();)if(qr(e=Hr()))Gr(e);else if(91===e&&t++,93===e&&t--,0===t){kr=Cr;break}}function Gr(e){for(var t=e;!Vr()&&(e=Hr())!==t;);}var Xr;function Zr(e,t,n){var r=Xr;return function o(){var i=t.apply(null,arguments);null!==i&&eo(e,o,n,r)}}var Yr=Xe&&!(ne&&Number(ne[1])<=53);function Qr(e,t,n,r){if(Yr){var o=un,i=t;t=i._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=o||e.timeStamp<=0||e.target.ownerDocument!==document)return i.apply(this,arguments)}}Xr.addEventListener(e,t,oe?{capture:n,passive:r}:n)}function eo(e,t,n,r){(r||Xr).removeEventListener(e,t._wrapper||t,n)}function to(e,t){if(!i(e.data.on)||!i(t.data.on)){var n=t.data.on||{},r=e.data.on||{};Xr=t.elm,function(e){if(a(e.__r)){var t=Y?"change":"input";e[t]=[].concat(e.__r,e[t]||[]),delete e.__r}a(e.__c)&&(e.change=[].concat(e.__c,e.change||[]),delete e.__c)}(n),lt(n,r,Qr,eo,Zr,t.context),Xr=void 0}}var no,ro={create:to,update:to};function oo(e,t){if(!i(e.data.domProps)||!i(t.data.domProps)){var n,r,o=t.elm,s=e.data.domProps||{},c=t.data.domProps||{};for(n in a(c.__ob__)&&(c=t.data.domProps=I({},c)),s)n in c||(o[n]="");for(n in c){if(r=c[n],"textContent"===n||"innerHTML"===n){if(t.children&&(t.children.length=0),r===s[n])continue;1===o.childNodes.length&&o.removeChild(o.childNodes[0])}if("value"===n&&"PROGRESS"!==o.tagName){o._value=r;var l=i(r)?"":String(r);io(o,l)&&(o.value=l)}else if("innerHTML"===n&&Xn(o.tagName)&&i(o.innerHTML)){(no=no||document.createElement("div")).innerHTML=""+r+"";for(var u=no.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;u.firstChild;)o.appendChild(u.firstChild)}else if(r!==s[n])try{o[n]=r}catch(e){}}}}function io(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var n=e.value,r=e._vModifiers;if(a(r)){if(r.number)return m(n)!==m(t);if(r.trim)return n.trim()!==t.trim()}return n!==t}(e,t))}var ao={create:oo,update:oo},so=S((function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach((function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}})),t}));function co(e){var t=lo(e.style);return e.staticStyle?I(e.staticStyle,t):t}function lo(e){return Array.isArray(e)?M(e):"string"==typeof e?so(e):e}var uo,fo=/^--/,po=/\s*!important$/,vo=function(e,t,n){if(fo.test(t))e.style.setProperty(t,n);else if(po.test(n))e.style.setProperty($(t),n.replace(po,""),"important");else{var r=mo(t);if(Array.isArray(n))for(var o=0,i=n.length;o-1?t.split(_o).forEach((function(t){return e.classList.add(t)})):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function wo(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(_o).forEach((function(t){return e.classList.remove(t)})):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function xo(e){if(e){if("object"===(void 0===e?"undefined":r(e))){var t={};return!1!==e.css&&I(t,So(e.name||"v")),I(t,e),t}return"string"==typeof e?So(e):void 0}}var So=S((function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}})),Co=K&&!Q,Ao="transition",ko="transitionend",Ro="animation",$o="animationend";Co&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ao="WebkitTransition",ko="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Ro="WebkitAnimation",$o="webkitAnimationEnd"));var Oo=K?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function To(e){Oo((function(){Oo(e)}))}function Io(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),bo(e,t))}function Mo(e,t){e._transitionClasses&&b(e._transitionClasses,t),wo(e,t)}function Lo(e,t,n){var r=Po(e,t),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s="transition"===o?ko:$o,c=0,l=function(){e.removeEventListener(s,u),n()},u=function(t){t.target===e&&++c>=a&&l()};setTimeout((function(){c0&&(n="transition",u=a,f=i.length):"animation"===t?l>0&&(n="animation",u=l,f=c.length):f=(n=(u=Math.max(a,l))>0?a>l?"transition":"animation":null)?"transition"===n?i.length:c.length:0,{type:n,timeout:u,propCount:f,hasTransform:"transition"===n&&Do.test(r[Ao+"Property"])}}function jo(e,t){for(;e.length1}function zo(e,t){!0!==t.data.show&&No(t)}var Jo=function(e){var t,n,r={},o=e.modules,l=e.nodeOps;for(t=0;tv?_(e,i(n[g+1])?null:n[g+1].elm,n,d,g,r):d>g&&w(0,t,p,v)}(p,m,g,n,u):a(g)?(a(e.text)&&l.setTextContent(p,""),_(p,null,g,0,g.length-1,n)):a(m)?w(0,m,0,m.length-1):a(e.text)&&l.setTextContent(p,""):e.text!==t.text&&l.setTextContent(p,t.text),a(v)&&a(d=v.hook)&&a(d=d.postpatch)&&d(e,t)}}}function A(e,t,n){if(s(n)&&a(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r-1,a.selected!==i&&(a.selected=i);else if(j(Ko(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));o||(e.selectedIndex=-1)}}function qo(e,t){return t.every((function(t){return!j(t,e)}))}function Ko(e){return"_value"in e?e._value:e.value}function Go(e){e.target.composing=!0}function Xo(e){e.target.composing&&(e.target.composing=!1,Zo(e.target,"input"))}function Zo(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Yo(e){return!e.componentInstance||e.data&&e.data.transition?e:Yo(e.componentInstance._vnode)}var Qo={model:Wo,show:{bind:function(e,t,n){var r=t.value,o=(n=Yo(n)).data&&n.data.transition,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&o?(n.data.show=!0,No(n,(function(){e.style.display=i}))):e.style.display=r?i:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Yo(n)).data&&n.data.transition?(n.data.show=!0,r?No(n,(function(){e.style.display=e.__vOriginalDisplay})):Fo(n,(function(){e.style.display="none"}))):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,o){o||(e.style.display=e.__vOriginalDisplay)}}},ei={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ti(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?ti(qt(t.children)):e}function ni(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var o=n._parentListeners;for(var i in o)t[A(i)]=o[i];return t}function ri(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var oi=function(e){return e.tag||Vt(e)},ii=function(e){return"show"===e.name},ai={name:"transition",props:ei,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(oi)).length){0;var r=this.mode;0;var o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var i=ti(o);if(!i)return o;if(this._leaving)return ri(e,o);var a="__transition-"+this._uid+"-";i.key=null==i.key?i.isComment?a+"comment":a+i.tag:c(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var s=(i.data||(i.data={})).transition=ni(this),l=this._vnode,u=ti(l);if(i.data.directives&&i.data.directives.some(ii)&&(i.data.show=!0),u&&u.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(i,u)&&!Vt(u)&&(!u.componentInstance||!u.componentInstance._vnode.isComment)){var f=u.data.transition=I({},s);if("out-in"===r)return this._leaving=!0,ut(f,"afterLeave",(function(){t._leaving=!1,t.$forceUpdate()})),ri(e,o);if("in-out"===r){if(Vt(i))return l;var p,d=function(){p()};ut(s,"afterEnter",d),ut(s,"enterCancelled",d),ut(f,"delayLeave",(function(e){p=e}))}}return o}}},si=I({tag:String,moveClass:String},ei);function ci(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function li(e){e.data.newPos=e.elm.getBoundingClientRect()}function ui(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,o=t.top-n.top;if(r||o){e.data.moved=!0;var i=e.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}delete si.mode;var fi={Transition:ai,TransitionGroup:{props:si,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var o=Qt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,o(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=ni(this),s=0;s-1?Qn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Qn[e]=/HTMLUnknownElement/.test(t.toString())},I(kn.options.directives,Qo),I(kn.options.components,fi),kn.prototype.__patch__=K?Jo:L,kn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=_e),nn(e,"beforeMount"),r=function(){e._update(e._render(),n)},new hn(e,r,L,{before:function(){e._isMounted&&!e._isDestroyed&&nn(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,nn(e,"mounted")),e}(this,e=e&&K?tr(e):void 0,t)},K&&setTimeout((function(){U.devtools&&se&&se.emit("init",kn)}),0);var pi=/\{\{((?:.|\r?\n)+?)\}\}/g,di=/[-.*+?^${}()|[\]\/\\]/g,vi=S((function(e){var t=e[0].replace(di,"\\$&"),n=e[1].replace(di,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")}));var hi={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Br(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Fr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var mi,gi={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Br(e,"style");n&&(e.staticStyle=JSON.stringify(so(n)));var r=Fr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},yi=function(e){return(mi=mi||document.createElement("div")).innerHTML=e,mi.textContent},_i=g("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),bi=g("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),wi=g("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),xi=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Si=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Ci="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+z.source+"]*",Ai="((?:"+Ci+"\\:)?"+Ci+")",ki=new RegExp("^<"+Ai),Ri=/^\s*(\/?)>/,$i=new RegExp("^<\\/"+Ai+"[^>]*>"),Oi=/^]+>/i,Ti=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Pi=/&(?:lt|gt|quot|amp|#39);/g,ji=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ei=g("pre,textarea",!0),Ni=function(e,t){return e&&Ei(e)&&"\n"===t[0]};function Fi(e,t){var n=t?ji:Pi;return e.replace(n,(function(e){return Di[e]}))}var Bi,Ui,zi,Ji,Wi,Hi,Vi,qi,Ki=/^@|^v-on:/,Gi=/^v-|^@|^:/,Xi=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Zi=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Yi=/^\(|\)$/g,Qi=/^\[.*\]$/,ea=/:(.*)$/,ta=/^:|^\.|^v-bind:/,na=/\.[^.\]]+(?=[^\]]*$)/g,ra=/^v-slot(:|$)|^#/,oa=/[\r\n]/,ia=/\s+/g,aa=S(yi);function sa(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:va(t),rawAttrsMap:{},parent:n,children:[]}}function ca(e,t){Bi=t.warn||Ir,Hi=t.isPreTag||D,Vi=t.mustUseProp||D,qi=t.getTagNamespace||D;var n=t.isReservedTag||D;(function(e){return!!e.component||!n(e.tag)}),zi=Mr(t.modules,"transformNode"),Ji=Mr(t.modules,"preTransformNode"),Wi=Mr(t.modules,"postTransformNode"),Ui=t.delimiters;var r,o,i=[],a=!1!==t.preserveWhitespace,s=t.whitespace,c=!1,l=!1;function u(e){if(f(e),c||e.processed||(e=la(e,t)),i.length||e===r||r.if&&(e.elseif||e.else)&&fa(r,{exp:e.elseif,block:e}),o&&!e.forbidden)if(e.elseif||e.else)a=e,(s=function(e){for(var t=e.length;t--;){if(1===e[t].type)return e[t];e.pop()}}(o.children))&&s.if&&fa(s,{exp:a.elseif,block:a});else{if(e.slotScope){var n=e.slotTarget||'"default"';(o.scopedSlots||(o.scopedSlots={}))[n]=e}o.children.push(e),e.parent=o}var a,s;e.children=e.children.filter((function(e){return!e.slotScope})),f(e),e.pre&&(c=!1),Hi(e.tag)&&(l=!1);for(var u=0;u]*>)","i")),p=e.replace(f,(function(e,n,r){return l=r.length,Mi(u)||"noscript"===u||(n=n.replace(//g,"$1").replace(//g,"$1")),Ni(u,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""}));c+=e.length-p.length,e=p,k(u,c-l,c)}else{var d=e.indexOf("<");if(0===d){if(Ti.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),S(v+3);continue}}if(Ii.test(e)){var h=e.indexOf("]>");if(h>=0){S(h+2);continue}}var m=e.match(Oi);if(m){S(m[0].length);continue}var g=e.match($i);if(g){var y=c;S(g[0].length),k(g[1],y,c);continue}var _=C();if(_){A(_),Ni(_.tagName,e)&&S(1);continue}}var b=void 0,w=void 0,x=void 0;if(d>=0){for(w=e.slice(d);!($i.test(w)||ki.test(w)||Ti.test(w)||Ii.test(w)||(x=w.indexOf("<",1))<0);)d+=x,w=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&S(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function S(t){c+=t,e=e.substring(t)}function C(){var t=e.match(ki);if(t){var n,r,o={tagName:t[1],attrs:[],start:c};for(S(t[0].length);!(n=e.match(Ri))&&(r=e.match(Si)||e.match(xi));)r.start=c,S(r[0].length),r.end=c,o.attrs.push(r);if(n)return o.unarySlash=n[1],S(n[0].length),o.end=c,o}}function A(e){var n=e.tagName,c=e.unarySlash;i&&("p"===r&&wi(n)&&k(r),s(n)&&r===n&&k(n));for(var l=a(n)||!!c,u=e.attrs.length,f=new Array(u),p=0;p=0&&o[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var l=o.length-1;l>=a;l--)t.end&&t.end(o[l].tag,n,i);o.length=a,r=a&&o[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,i):"p"===s&&(t.start&&t.start(e,[],!1,n,i),t.end&&t.end(e,n,i))}k()}(e,{warn:Bi,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,n,a,s,f){var p=o&&o.ns||qi(e);Y&&"svg"===p&&(n=function(e){for(var t=[],n=0;nc&&(s.push(i=e.slice(c,o)),a.push(JSON.stringify(i)));var l=Or(r[1].trim());a.push("_s("+l+")"),s.push({"@binding":l}),c=o+r[0].length}return c-1"+("true"===i?":("+t+")":":_q("+t+","+i+")")),Nr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+i+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+o+")":o)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Wr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Wr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Wr(t,"$$c")+"}",null,!0)}(e,r,o);else if("input"===i&&"radio"===a)!function(e,t,n){var r=n&&n.number,o=Fr(e,"value")||"null";Lr(e,"checked","_q("+t+","+(o=r?"_n("+o+")":o)+")"),Nr(e,"change",Wr(t,o),null,!0)}(e,r,o);else if("input"===i||"textarea"===i)!function(e,t,n){var r=e.attrsMap.type;0;var o=n||{},i=o.lazy,a=o.number,s=o.trim,c=!i&&"range"!==r,l=i?"change":"range"===r?"__r":"input",u="$event.target.value";s&&(u="$event.target.value.trim()");a&&(u="_n("+u+")");var f=Wr(t,u);c&&(f="if($event.target.composing)return;"+f);Lr(e,"value","("+t+")"),Nr(e,l,f,null,!0),(s||a)&&Nr(e,"blur","$forceUpdate()")}(e,r,o);else{if(!U.isReservedTag(i))return Jr(e,r,o),!1}return!0},text:function(e,t){t.value&&Lr(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Lr(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:_i,mustUseProp:jn,canBeLeftOpenTag:bi,isReservedTag:Zn,getTagNamespace:Yn,staticKeys:function(e){return e.reduce((function(e,t){return e.concat(t.staticKeys||[])}),[]).join(",")}(ya)},xa=S((function(e){return g("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))}));function Sa(e,t){e&&(_a=xa(t.staticKeys||""),ba=t.isReservedTag||D,function e(t){if(t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||y(e.tag)||!ba(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(_a)))}(t),1===t.type){if(!ba(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function\s*(?:[\w$]+)?\s*\(/,Aa=/\([^)]*?\);*$/,ka=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ra={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},$a={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Oa=function(e){return"if("+e+")return null;"},Ta={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Oa("$event.target !== $event.currentTarget"),ctrl:Oa("!$event.ctrlKey"),shift:Oa("!$event.shiftKey"),alt:Oa("!$event.altKey"),meta:Oa("!$event.metaKey"),left:Oa("'button' in $event && $event.button !== 0"),middle:Oa("'button' in $event && $event.button !== 1"),right:Oa("'button' in $event && $event.button !== 2")};function Ia(e,t){var n=t?"nativeOn:":"on:",r="",o="";for(var i in e){var a=Ma(e[i]);e[i]&&e[i].dynamic?o+=i+","+a+",":r+='"'+i+'":'+a+","}return r="{"+r.slice(0,-1)+"}",o?n+"_d("+r+",["+o.slice(0,-1)+"])":n+r}function Ma(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map((function(e){return Ma(e)})).join(",")+"]";var t=ka.test(e.value),n=Ca.test(e.value),r=ka.test(e.value.replace(Aa,""));if(e.modifiers){var o="",i="",a=[];for(var s in e.modifiers)if(Ta[s])i+=Ta[s],Ra[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;i+=Oa(["ctrl","shift","alt","meta"].filter((function(e){return!c[e]})).map((function(e){return"$event."+e+"Key"})).join("||"))}else a.push(s);return a.length&&(o+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(La).join("&&")+")return null;"}(a)),i&&(o+=i),"function($event){"+o+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function La(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Ra[e],r=$a[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Da={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:L},Pa=function(e){this.options=e,this.warn=e.warn||Ir,this.transforms=Mr(e.modules,"transformCode"),this.dataGenFns=Mr(e.modules,"genData"),this.directives=I(I({},Da),e.directives);var t=e.isReservedTag||D;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function ja(e,t){var n=new Pa(t);return{render:"with(this){return "+(e?Ea(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ea(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Na(e,t);if(e.once&&!e.onceProcessed)return Fa(e,t);if(e.for&&!e.forProcessed)return Ua(e,t);if(e.if&&!e.ifProcessed)return Ba(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Ha(e,t),o="_t("+n+(r?","+r:""),i=e.attrs||e.dynamicAttrs?Ka((e.attrs||[]).concat(e.dynamicAttrs||[]).map((function(e){return{name:A(e.name),value:e.value,dynamic:e.dynamic}}))):null,a=e.attrsMap["v-bind"];!i&&!a||r||(o+=",null");i&&(o+=","+i);a&&(o+=(i?"":",null")+","+a);return o+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Ha(t,n,!0);return"_c("+e+","+za(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=za(e,t));var o=e.inlineTemplate?null:Ha(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(o?","+o:"")+")"}for(var i=0;i>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var i=function(e,t){var n=e.children[0];0;if(n&&1===n.type){var r=ja(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map((function(e){return"function(){"+e+"}"})).join(",")+"]}"}}(e,t);i&&(n+=i+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Ka(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ja(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ja))}function Wa(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Ba(e,t,Wa,"null");if(e.for&&!e.forProcessed)return Ua(e,t,Wa);var r="_empty_"===e.slotScope?"":String(e.slotScope),o="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(Ha(e,t)||"undefined")+":undefined":Ha(e,t)||"undefined":Ea(e,t))+"}",i=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+o+i+"}"}function Ha(e,t,n,r,o){var i=e.children;if(i.length){var a=i[0];if(1===i.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ea)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r':'
',Qa.innerHTML.indexOf(" ")>0}var rs=!!K&&ns(!1),os=!!K&&ns(!0),is=S((function(e){var t=tr(e);return t&&t.innerHTML})),as=kn.prototype.$mount;kn.prototype.$mount=function(e,t){if((e=e&&tr(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=is(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){0;var o=ts(r,{outputSourceRange:!1,shouldDecodeNewlines:rs,shouldDecodeNewlinesForHref:os,delimiters:n.delimiters,comments:n.comments},this),i=o.render,a=o.staticRenderFns;n.render=i,n.staticRenderFns=a}}return as.call(this,e,t)},kn.compile=ts,t.default=kn}).call(this,n(0),n(10).setImmediate)},function(e,t,n){"use strict";(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(11),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||void 0,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||void 0}).call(this,n(0))},function(e,t,n){"use strict";(function(e,t){!function(e,n){if(!e.setImmediate){var r,o,i,a,s,c=1,l={},u=!1,f=e.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(e);p=p&&p.setTimeout?p:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){v(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){v(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){v(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(v,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&v(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),p.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n1)for(var n=1;n1?l=Math.floor(l/f):(f=1,n=t),l+=s.length;var p=new Int16Array(l),d=0;for(u=0;u0){var S=2*(p.length-x);s=new Int16Array(p.buffer.slice(S)),p=new Int16Array(p.buffer.slice(0,S))}return{index:i,offset:a,frameNext:s,sampleRate:n,data:p}},n.PowerLevel=function(e,t){var n=e/t||0;return n<1251?Math.round(n/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(n/1e4)/Math.log(10)))))};var s=function(t,n){var r=new Date,o=("0"+r.getMinutes()).substr(-2)+":"+("0"+r.getSeconds()).substr(-2)+"."+("00"+r.getMilliseconds()).substr(-3),i=this&&this.envIn&&this.envCheck&&this.id,a=["["+o+" Recorder"+(i?":"+i:"")+"]"+t],s=arguments,l=e.console||{},u=2,f=l.log;for("number"==typeof n?f=1==n?l.error:3==n?l.warn:f:u=1;u1?a:""):f.apply(l,a)},c=!0;try{c=!console.log.apply}catch(e){}n.CLog=s;var l=0;function u(e){this.id=++l,n.Traffic&&n.Traffic();var r={type:"mp3",bitRate:16,sampleRate:16e3,onProcess:t};for(var o in e)r[o]=e[o];this.set=r,this._S=9,this.Sync={O:9,C:9}}n.Sync={O:9,C:9},n.prototype=u.prototype={CLog:s,_streamStore:function(){return this.set.sourceStream?this:n},open:function(r,i){var s=this,c=s._streamStore();r=r||t;var l=function(e,t){t=!!t,s.CLog("录音open失败:"+e+",isUserNotAllow:"+t,1),i&&i(e,t)},u=function(){s.CLog("open ok id:"+s.id),r(),s._SO=0},f=c.Sync,p=++f.O,d=f.C;s._O=s._O_=p,s._SO=s._S;var v=function(){if(d!=f.C||!s._O){var e="open被取消";return p==f.O?s.close():e="open被中断",l(e),!0}},h=s.envCheck({envName:"H5",canProcess:!0});if(h)l("不能录音:"+h);else if(s.set.sourceStream){if(!n.Support())return void l("不支持此浏览器从流中获取录音");a(c),s.Stream=s.set.sourceStream,s.Stream._call={};try{o(c)}catch(e){return void l("从流中打开录音失败:"+e.message)}u()}else{var m=function(t,n){try{e.top.a}catch(e){return void l('无权录音(跨域,请尝试给iframe添加麦克风访问策略,如allow="camera;microphone")')}/Permission|Allow/i.test(t)?l("用户拒绝了录音权限",!0):!1===e.isSecureContext?l("无权录音(需https)"):/Found/i.test(t)?l(n+",无可用麦克风"):l(n)};if(n.IsOpen())u();else if(n.Support()){var g=function(e){n.Stream=e,e._call={},v()||setTimeout((function(){v()||(n.IsOpen()?(o(),u()):l("录音功能无效:无音频流"))}),100)},y=function(e){var t=e.name||e.message||e.code+":"+e;s.CLog("请求录音权限错误",1,e),m(t,"无法录音:"+t)},_=n.Scope.getUserMedia({audio:s.set.audioTrackSet||!0},g,y);_&&_.then&&_.then(g)[r&&"catch"](y)}else m("","此浏览器不支持录音")}},close:function(e){e=e||t;var n=this._streamStore();this._stop();var r=n.Sync;if(this._O=0,this._O_!=r.O)return this.CLog("close被忽略(因为同时open了多个rec,只有最后一个会真正close)",3),void e();r.C++,a(n),this.CLog("close"),e()},mock:function(e,t){return this._stop(),this.isMock=1,this.mockEnvInfo=null,this.buffers=[e],this.recSize=e.length,this.srcSampleRate=t,this},envCheck:function(e){var t,n=this.set;return t||(this[n.type+"_envCheck"]?t=this[n.type+"_envCheck"](e,n):n.takeoffEncodeChunk&&(t=n.type+"类型不支持设置takeoffEncodeChunk")),t||""},envStart:function(e,t){var n=this.set;if(this.isMock=e?1:0,this.mockEnvInfo=e,this.buffers=[],this.recSize=0,this.envInLast=0,this.envInFirst=0,this.envInFix=0,this.envInFixTs=[],n.sampleRate=Math.min(t,n.sampleRate),this.srcSampleRate=t,this.engineCtx=0,this[n.type+"_start"]){var r=this.engineCtx=this[n.type+"_start"](n);r&&(r.pcmDatas=[],r.pcmSize=0)}},envResume:function(){this.envInFixTs=[]},envIn:function(e,t){var r=this,o=r.set,i=r.engineCtx,a=r.srcSampleRate,s=e.length,c=n.PowerLevel(t,s),l=r.buffers,u=l.length;l.push(e);var f=l,p=u,d=Date.now(),v=Math.round(s/a*1e3);r.envInLast=d,1==r.buffers.length&&(r.envInFirst=d-v);var h=r.envInFixTs;h.splice(0,0,{t:d,d:v});for(var m=d,g=0,y=0;y3e3){h.length=y;break}m=_.t,g+=_.d}var b=h[1],w=d-m;if(w-g>w/3&&(b&&w>1e3||h.length>=6)){var x=d-b.t-v;if(x>v/5){var S=!o.disableEnvInFix;if(r.CLog("["+d+"]"+(S?"":"未")+"补偿"+x+"ms",3),r.envInFix+=x,S){var C=new Int16Array(x*a/1e3);s+=C.length,l.push(C)}}}var A=r.recSize,k=s,R=A+k;if(r.recSize=R,i){var $=n.SampleData(l,a,o.sampleRate,i.chunkInfo);i.chunkInfo=$,R=(A=i.pcmSize)+(k=$.data.length),i.pcmSize=R,l=i.pcmDatas,u=l.length,l.push($.data),a=$.sampleRate}var O=Math.round(R/a*1e3),T=l.length,I=f.length,M=function(){for(var e=L?0:-k,t=null==l[0],n=u;n"+m.length+" 花:"+(Date.now()-o)+"ms"),setTimeout((function(){o=Date.now(),i[a.type](m,(function(e){l(e,v)}),(function(e){c(e)}))}))}else c("未加载"+a.type+"编码器");else c("音频buffers被释放");else c("未采集到录音")}},e.Recorder&&e.Recorder.Destroy(),e.Recorder=n,n.LM="2022-03-05 11:53:19",n.TrafficImgUrl="//ia.51.la/go1?id=20469973&pvFlag=1",n.Traffic=function(){var e=n.TrafficImgUrl;if(e){var t=n.Traffic,r=location.href.replace(/#.*/,"");0==e.indexOf("//")&&(e=/^https:/i.test(r)?"https:"+e:"http:"+e),t[r]||(t[r]=1,(new Image).src=e,s("Traffic Analysis Image: Recorder.TrafficImgUrl="+n.TrafficImgUrl))}}}(window),void 0===(r=function(){return Recorder}.call(t,n,t,e))||(e.exports=r),"object"==o(e)&&e.exports&&(e.exports=Recorder)}).call(this,n(2)(e))},function(e,t,n){"use strict";var r,o;r=function(e){return new o(e)},(o=function(e){var t={scale:2,speed:8,lineWidth:3,linear1:[0,"rgba(150,96,238,1)",.2,"rgba(170,79,249,1)",1,"rgba(53,199,253,1)"],linear2:[0,"rgba(209,130,255,0.6)",1,"rgba(53,199,255,0.6)"],linearBg:[0,"rgba(255,255,255,0.2)",1,"rgba(54,197,252,0.2)"]};for(var n in e)t[n]=e[n];this.set=e=t;var r=e.elem;r&&("string"==typeof r?r=document.querySelector(r):r.length&&(r=r[0])),r&&(e.width=r.offsetWidth,e.height=r.offsetHeight);var o=e.scale,i=e.width*o,a=e.height*o,s=this.elem=document.createElement("div"),c=["","transform-origin:0 0;","transform:scale("+1/o+");"];s.innerHTML='
';var l=this.canvas=s.querySelector("canvas"),u=this.ctx=l.getContext("2d");l.width=i,l.height=a,this.linear1=this.genLinear(u,i,e.linear1),this.linear2=this.genLinear(u,i,e.linear2),this.linearBg=this.genLinear(u,a,e.linearBg,!0),r&&(r.innerHTML="",r.appendChild(s)),this._phase=0}).prototype=r.prototype={genLinear:function(e,t,n,r){for(var o=e.createLinearGradient(0,0,r?0:t,r?t:0),i=0;i=0;d--,v-=i)o.lineTo(v,p[d]);o.closePath(),o.fillStyle=this.linearBg,o.fill(),this.drawPath(p,this.linear2),this.drawPath(f,this.linear1)},drawPath:function(e,t){var n=this.set,r=this.ctx,o=n.scale,i=n.width*o;r.beginPath();for(var a=0,s=0;s\n \n\n \n\n '}),s=a.$refs.mainView;s.reclog('RecordApp[即将废弃] 除Recorder支持的外,支持Hybrid App,低版本IOS上支持微信网页和小程序web-view'+unescape("%uD83C%uDF89")+""),s.reclog('Recorder H5使用简单,功能丰富,支持PC、Android、IOS 14.3+'+unescape("%uD83D%uDCAA")+""),s.reclog('绿油油的一大片,真有食欲'+unescape("%uD83D%uDE02")+' 当前浏览器支持录音':'red">不支持录音')+"");var c=function(e,t){s.reclog(''+e+": "+t+"")};c("本页面修改时间(有可能修改了忘改)","2020-11-25 21:43:09"),c("Recorder库修改时间(有可能修改了忘改)",s.Rec.LM),c("RecordApp库修改时间(有可能修改了忘改)",s.App.LM),c("UA",navigator.userAgent),c("URL",location.href.replace(/#.*/g,"")),c("Vue",r.default.version),s.reclog("点击打开录音,然后再点击开始录音",2),window.vue_root=a,window.vue_main=s,console.log("Vue",r.default),console.log("Recorder",s.Rec),console.log("RecordApp",s.App)},function(e,t,n){"use strict";n.r(t);var r=n(18),o=n(6);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);n(32);var a=n(1),s=Object(a.a)(o.default,r.a,r.b,!1,null,null,null);s.options.__file="component/recordapp.vue",t.default=s.exports},function(e,t,n){"use strict";window.PageSet_RecordAppBaseFolder="https://cdn.jsdelivr.net/gh/xiangyuecn/Recorder@latest/dist/",window.RecordAppBaseFolder=window.PageSet_RecordAppBaseFolder||"https://xiangyuecn.gitee.io/recorder/src/",window.OnRecordAppInstalled=window.Native_RecordApp_Config=function(){window.Native_RecordApp_Config=null,window.IOS_Weixin_RecordApp_Config&&IOS_Weixin_RecordApp_Config();var e=RecordApp,t=e.CLog,n=e.Platforms.Native.Config;t("native-config init");var r,o="RecordAppJsBridge",i=window.AppJsBridgeRequest=function(e,n,r){var s=window.top,c=0;try{c=s.AppJsBridgeRequest}catch(e){t("检测到跨域iframe,AppJsBridgeRequest将由Native通过执行postMessage转发来兼容数据的返回",3)}if(c&&c!=i)return c(e,n,r);n||(n={});var l="";r&&(l=a.length+"",a.push(r));var u={status:"",message:"",callback:l,value:null},f=JSON.stringify({action:e,args:n,callback:l}),p="";return window[o]?p=window[o].request(f):((window.webkit||{}).messageHandlers||{})[o+"IsSet"]?p=prompt(f):u.message="非app,不能调用接口",p=p&&JSON.parse(p)||u},a=[""];i.Call=function(e){a[e.callback]&&(a[e.callback](e),a[e.callback]=null)},i.Record=function(e,t){NativeRecordReceivePCM(e,t)};try{window.top.AppJsBridgeRequest=i}catch(e){var s=function(){t("检测到跨域iframe,AppJsBridgeRequest无法注入到顶层,已监听postMessage,Native通过执行postMessage转发来兼容数据返回",3),window.parent!=window.top&&t("RecordApp Native Config示例不支持跨域iframe超过1层,因为没有处理中间的iframe的window的postMessage转发",1)};setTimeout(s,8e3),s(),addEventListener("message",(function(e){var n=e.data;if(n&&"AppJsBridgeRequest"==n.type){var r=n.action;n=n.data,"Call"==r?i.Call(n):"Record"==r?i.Record(n.pcmDataBase64,n.sampleRate):t("AppJsBridgeRequest未知postMessage:"+r,3)}}))}n.IsApp=function(e){window[o]||((window.webkit||{}).messageHandlers||{})[o+"IsSet"]?e(!0):e(!1)},n.JsBridgeRequestPermission=function(e,t){i("recordPermission",{},(function(n){"success"==n.status?1==n.value?e():3==n.value?t("用户拒绝了录音权限",!0):t("不支持录音"):t(n.message)}))},n.JsBridgeStart=function(e,t,n){i("recordStart",{param:e},(function(e){"success"==e.status?(t(),r=setInterval((function(){i("recordAlive")}),5e3)):n(e.message)}))},n.JsBridgeStop=function(e,t){clearInterval(r),i("recordStop",{},(function(n){"success"==n.status?e():t(n.message)}))}},window.RecordApp&&OnRecordAppInstalled(),console.error("【注意】本网站正在使用RecordApp的native-config.js测试用的配置例子,这个配置如果要使用到你的网站,需要自己重写或修改后才能使用"),/^file:|:\/\/[^\/]*(jiebian.life|git\w+.io)(\/|$)/.test(location.href)||localStorage.DisableAppSampleAlert||window.AppSampleAlert||(window.AppSampleAlert=1,alert("【注意】当前网站正在使用RecordApp测试用的配置例子*.config.js,需要自己重写或修改后才能使用"))},function(e,t,n){"use strict";window.PageSet_RecordAppBaseFolder="https://cdn.jsdelivr.net/gh/xiangyuecn/Recorder@latest/dist/",function(){window.RecordAppBaseFolder=window.PageSet_RecordAppBaseFolder||"https://xiangyuecn.gitee.io/recorder/src/";var e=window.PageSet_RecordAppWxApi||"https://jiebian.life/api/weixin/git_record";window.OnRecordAppInstalled=window.IOS_Weixin_RecordApp_Config=function(){window.IOS_Weixin_RecordApp_Config=null,window.Native_RecordApp_Config&&Native_RecordApp_Config();var t=RecordApp,n=t.CLog,r=t.Platforms.Weixin.Config;n("ios-weixin-config init");var o=window.top;if(/iphone/i.test(navigator.userAgent)){var i="Bad_WeixinIOSH5HistoryInitLocation";o[i]=o[i]||window[i]||location.href,setTimeout((function(){n("IOS内微信不认 history.pushState 产生的新地址,如果签名地址不是页面加载时的地址,可能会导致签名失败,当前签名使用的地址为:"+o[i],3)}),5e3)}r.Enable=function(e){e(!0)},r.WxReady=function(n){o.WxReady||o.eval("var InitJsSDK="+s.toString()+";InitJsSDK")(t,e,a),o.WxReady(n)},r.DownWxMedia=function(t,r,o){var i=function(e){n(e,1),o(e)};n("下载微信素材...",t),a(e,{action:"wxdown",mediaID:t.mediaId,transform_mediaIds:t.transform_mediaIds,transform_type:t.transform_type,transform_bitRate:t.transform_bitRate,transform_sampleRate:t.transform_sampleRate},(function(e,t){var o=e.mime,a=e.data;o&&a&&(a.length||1)%4==0?(n("成功下载微信音频素材"+o+" ≈"+a.length/4*3+"b"),r(e)):(n("下载错误",1,t),i("微信音频素材下载接口返回非预定义json数据"))}),(function(e){i("微信音频素材下载失败:"+e)}))};var a=function(e,t,n,r){var o=new XMLHttpRequest;o.timeout=2e4,o.open("POST",e),o.onreadystatechange=function(){if(4==o.readyState)if(200==o.status){try{var e=JSON.parse(o.responseText)}catch(e){}if(0!==e.c||!e.v)return void r(e.m||"接口返回非预定义json数据");n(e.v,e)}else r("请求失败["+o.status+"]")};var i=[];for(var a in t)i.push(a+"="+encodeURIComponent(t[a]));o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(i.join("&"))},s=function(e,t,n){var r=e.CLog,o=function(e){s?e(null,s):d((function(){e(wx)}),(function(t){e(wx,"请求微信接口失败: "+t)}))};window.WxReady=function(e){i?o(e):a.push(e)};var i=!1,a=[],s="",c=function(){i=!0;var e=a;a=[];for(var t=0;t1?i:""):f.apply(s,i)},l=!0;try{l=!console.log.apply}catch(e){}var u={LM:"2022-03-03 18:58:07",Current:0,CLog:c,IsWx:t,BaseFolder:n,UseLazyLoad:!0,AlwaysUseWeixinJS:!1,AlwaysAppUseJS:!1,Platforms:{Native:i,Weixin:a,Default:s},Js:function(t,n,r,o){var i=(o=o||e).document;!function e(o){if(o>=t.length)n();else{var a=t[o],s=a.url;if(!1!==a.check()){var c=i.createElement("script");c.setAttribute("type","text/javascript"),c.setAttribute("src",s),c.onload=function(){e(o+1)},c.onerror=function(e){r("请求失败:"+(e.message||"-")+","+s)},i.body.appendChild(c)}else e(o+1)}}(0)},Install:function(e,t){var n=u.__reqs||(u.__reqs=[]);n.push({s:e,f:t}),e=function(){r("s",arguments)},t=function(e,t){r("f",arguments)};var r=function(e,t){for(var r=0;r1)){var i=function(e,t,n){for(var r,o=e.Config.paths,i=[],a=0;a>16,l[f]=a,u+=Math.abs(a);i.envIn(l,u)}else t("未开始录音,但收到Native PCM数据",3)};try{window.top.NativeRecordReceivePCM=o}catch(e){var i=function(){t("检测到跨域iframe,NativeRecordReceivePCM无法注入到顶层,已监听postMessage转发兼容传输数据,请自行实现将top层接收到数据转发到本iframe(不限层),不然无法接收到录音数据",3)};setTimeout(i,8e3),i(),addEventListener("message",(function(e){var t=e.data;t&&"NativeRecordReceivePCM"==t.type&&(t=t.data,o(t.pcmDataBase64,t.sampleRate))}))}n.RequestPermission=function(e,t){r.JsBridgeRequestPermission(e,t)},n.Start=function(t,n,i){o.param=t;var a=Recorder(t);a.set.disableEnvInFix=!0,o.rec=a,e.__Rec=a,r.JsBridgeStart(t,n,i)},n.Stop=function(n,i){var a=function(t){i("录音失败[Native]:"+t),o.rec=null,e.__Rec=null};r.JsBridgeStop((function(){var r=o.rec;if(o.rec=null,r){t("rec encode start: pcm:"+r.recSize+" src:"+r.srcSampleRate+" set:"+JSON.stringify(o.param));var i=function(){for(var e in r.set)o.param[e]=r.set[e]};if(!n)return i(),void a("仅清理资源");r.stop((function(o,a){t("rec encode end"),i(),e._SRec=r,n(o,a),e.__Rec=null}),(function(e){i(),a(e)}))}else a("未开始录音")}),a)}}()},function(e,t,n){"use strict";!function(){var e=RecordApp,t=e.CLog,n=e.Platforms.Weixin,r=n.Config;n.IsInit=!0;var o,i={};n.RequestPermission=function(e,n){if(5!=o)if(u.push({t:e,f:n}),1!=o){o=1;var a=function(e,t){o=e?0:5;var n=u;u=[];for(var r=0;r2?i.chunkErr=o:(r++,t("尝试重启..."+r),d((function(){e(r)}),1))}}}):t("已停止wx录音,拒绝接续",3)}(0)}}})}else o("请先调用RequestPermission")},n.Stop=function(o,a){var u=i.wx;s=0;var f=!!l;l=null,t("开始停止录音");var d=function(e){a("录音失败[wx]:"+(e.errMsg||e))},v=i.start;if(v){var h=Date.now()-i.startTime;if(!f&&h>59100)return t("wx录音即将满1分钟,等待它录满,不然stop不可控...",3),void(l=function(){n.Stop(o,a)});i.start=null;var m={list:[]};v.DownWxMediaData=m;var g=function(){var n=m.list,r=n[0];if(r.duration){for(var i=atob(r.data),a=i.length,s=new Uint8Array(a);a--;)s[a]=i.charCodeAt(a);var c=new Blob([s.buffer],{type:r.mime});return e._SRec=null,t("微信素材服务器端已转码,不支持RecordApp.GetStopUsedRec方法",3),void o(c,r.duration)}var l=[],u=0,f=0,p=0;Recorder.AMR?function r(){if(p||(p=Date.now()),f>=n.length)return m.decodeTime=Date.now()-p,void function(){u||(u=Date.now());var n=[],r=v.sampleRate/8e3;r<=1?r=1:t("微信arm素材采样率为8000hz(语音音质勉强能听),已自动提升成设置的采样率"+v.sampleRate+"hz,但音质不可能会变好",3);for(var i=0,a=0,s=0;s=e.length)return m.uploadTime=Date.now()-l,t("开始下载微信素材..."),void function e(n){if(a||(a=Date.now()),i>=y.length)s();else{var o=y[i];r.DownWxMedia({mediaId:o,transform_mediaIds:y.join(","),transform_type:v.type,transform_bitRate:v.bitRate,transform_sampleRate:v.sampleRate},(function(t){m.list.push(t),t.duration?s():/amr/i.test(t.mime)?(i++,e()):d("微信服务器返回了未知音频类型:"+t.mime)}),(function(r){(n=n||0)>2?d("下载微信音频失败:"+r):(n++,t("DownWxMedia失败,重试..."+n,1,r),e(n))}))}}();var f=e[c];t("wx上传本地录音["+c+"] wx.playVoice({localId:'"+f+"'})"),u.uploadVoice({localId:f,isShowProgressTips:0,fail:function(e){(o=o||0)>2?d("微信uploadVoice失败["+c+"]:"+e.errMsg):(o++,t("uploadVoice失败,重试..."+o,1,e),n(o))},success:function(e){var r=e.serverId;t("上传OK serverId:"+r),y.push(r),c++,n()}})}()}else d("未获得任何录音")}else d("仅清理资源")},b=i.chunks;if(i.chunkErr)return t(i.chunkErr,1,b),void d("录制失败,已录制"+b.length+"分钟,但后面出错:"+i.chunkErr);if(f)_();else{if(b.length&&Date.now()-b[b.length-1].time<900)return t("丢弃结尾未停止太短录音",3),p(),void _();c=function(e,n){c=null;var r=Date.now();e.localId?b.push({res:e,duration:r-i.startTime,time:r,from:n}):t("已忽略"+n+"数据",3,e),i.chunks=null,_()},u.stopRecord({fail:function(e){c=null,b.length&&h<3e3?(t("停止录音出错,但后续录音太短,已忽略此错误:"+e.errMsg,3),_()):d(e)},success:function(e){c&&c(e,"stop")}})}}else d("未开始录音")}}()},function(e,t,n){"use strict";var r=n(8);n.n(r).a},function(e,t,n){(e.exports=n(15)(!1)).push([e.i,"\nbody{\r\n word-wrap: break-word;\r\n background:#f5f5f5 center top no-repeat;\r\n background-size: auto 680px;\n}\npre{\r\n white-space:pre-wrap;\n}\na{\r\n text-decoration: none;\r\n color:#06c;\n}\na:hover{\r\n color:#f00;\n}\n.main{\r\n max-width:700px;\r\n margin:0 auto;\r\n padding-bottom:80px\n}\n.mainBox{\r\n margin-top:12px;\r\n padding: 12px;\r\n border-radius: 6px;\r\n background: #fff;\r\n --border: 1px solid #0b1;\r\n box-shadow: 2px 2px 3px #aaa;\n}\n.mainBtn{\r\n display: inline-block;\r\n cursor: pointer;\r\n border: none;\r\n border-radius: 3px;\r\n background: #0b1;\r\n color:#fff;\r\n padding: 0 15px;\r\n margin-right:20px;\r\n line-height: 36px;\r\n height: 36px;\r\n overflow: hidden;\r\n vertical-align: middle;\n}\n.mainBtn:active{\r\n background: #0a1;\n}\n.ctrlBtn{\r\n margin-top:10px;\n}\n.pd{\r\n\tpadding:0 0 6px 0;\n}\n.lb{\r\n\tdisplay:inline-block;\r\n\tvertical-align: middle;\r\n\tbackground:#00940e;\r\n\tcolor:#fff;\r\n\tfont-size:14px;\r\n\tpadding:2px 8px;\r\n\tborder-radius: 99px;\n}\r\n",""])}]); \ No newline at end of file + */function i(e){return null==e}function a(e){return null!=e}function s(e){return!0===e}function c(e){return"string"==typeof e||"number"==typeof e||"symbol"===(void 0===e?"undefined":r(e))||"boolean"==typeof e}function l(e){return null!==e&&"object"===(void 0===e?"undefined":r(e))}var u=Object.prototype.toString;function f(e){return"[object Object]"===u.call(e)}function p(e){return"[object RegExp]"===u.call(e)}function d(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function v(e){return a(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function h(e){return null==e?"":Array.isArray(e)||f(e)&&e.toString===u?JSON.stringify(e,null,2):String(e)}function m(e){var t=parseFloat(e);return isNaN(t)?e:t}function g(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(n,1)}}var w=Object.prototype.hasOwnProperty;function x(e,t){return w.call(e,t)}function S(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var C=/-(\w)/g,k=S((function(e){return e.replace(C,(function(e,t){return t?t.toUpperCase():""}))})),A=S((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),R=/\B([A-Z])/g,$=S((function(e){return e.replace(R,"-$1").toLowerCase()}));var T=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function O(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function M(e,t){for(var n in t)e[n]=t[n];return e}function I(e){for(var t={},n=0;n0,ee=Z&&Z.indexOf("edge/")>0,te=(Z&&Z.indexOf("android"),Z&&/iphone|ipad|ipod|ios/.test(Z)||"ios"===X),ne=(Z&&/chrome\/\d+/.test(Z),Z&&/phantomjs/.test(Z),Z&&Z.match(/firefox\/(\d+)/)),re={}.watch,oe=!1;if(K)try{var ie={};Object.defineProperty(ie,"passive",{get:function(){oe=!0}}),window.addEventListener("test-passive",null,ie)}catch(e){}var ae=function(){return void 0===V&&(V=!K&&!G&&void 0!==e&&(e.process&&"server"===e.process.env.VUE_ENV)),V},se=K&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ce(e){return"function"==typeof e&&/native code/.test(e.toString())}var le,ue="undefined"!=typeof Symbol&&ce(Symbol)&&"undefined"!=typeof Reflect&&ce(Reflect.ownKeys);le="undefined"!=typeof Set&&ce(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var fe=L,pe=0,de=function(){this.id=pe++,this.subs=[]};de.prototype.addSub=function(e){this.subs.push(e)},de.prototype.removeSub=function(e){b(this.subs,e)},de.prototype.depend=function(){de.target&&de.target.addDep(this)},de.prototype.notify=function(){var e=this.subs.slice();for(var t=0,n=e.length;t-1)if(i&&!x(o,"default"))a=!1;else if(""===a||a===$(e)){var c=Je(String,o.type);(c<0||s0&&(dt((o=e(o,(n||"")+"_"+r))[0])&&dt(u)&&(f[l]=be(u.text+o[0].text),o.shift()),f.push.apply(f,o)):c(o)?dt(u)?f[l]=be(u.text+o):""!==o&&f.push(be(o)):dt(o)&&dt(u)?f[l]=be(u.text+o.text):(s(t._isVList)&&a(o.tag)&&i(o.key)&&a(n)&&(o.key="__vlist"+n+"_"+r+"__"),f.push(o)));return f}(e):void 0}function dt(e){return a(e)&&a(e.text)&&!1===e.isComment}function vt(e,t){if(e){for(var n=Object.create(null),r=ue?Reflect.ownKeys(e):Object.keys(e),o=0;o0,a=e?!!e.$stable:!i,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&n&&n!==o&&s===n.$key&&!i&&!n.$hasNormal)return n;for(var c in r={},e)e[c]&&"$"!==c[0]&&(r[c]=yt(t,c,e[c]))}else r={};for(var l in t)l in r||(r[l]=_t(t,l));return e&&Object.isExtensible(e)&&(e._normalized=r),J(r,"$stable",a),J(r,"$key",s),J(r,"$hasNormal",i),r}function yt(e,t,n){var o=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"===(void 0===e?"undefined":r(e))&&!Array.isArray(e)?[e]:pt(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:o,enumerable:!0,configurable:!0}),o}function _t(e,t){return function(){return e[t]}}function bt(e,t){var n,r,o,i,s;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,o=e.length;rdocument.createEvent("Event").timeStamp&&(fn=function(){return pn.now()})}function dn(){var e,t;for(un=fn(),cn=!0,rn.sort((function(e,t){return e.id-t.id})),ln=0;lnln&&rn[n].id>e.id;)n--;rn.splice(n+1,0,e)}else rn.push(e);sn||(sn=!0,ot(dn))}}(this)},hn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||l(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){He(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},hn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},hn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},hn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||b(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var mn={enumerable:!0,configurable:!0,get:L,set:L};function gn(e,t,n){mn.get=function(){return this[t][n]},mn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,mn)}function yn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[];e.$parent&&Ae(!1);var i=function(i){o.push(i);var a=Ue(i,t,n,e);Te(r,i,a),i in e||gn(e,"_props",i)};for(var a in t)i(a);Ae(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?L:T(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;f(t=e._data="function"==typeof t?function(e,t){he();try{return e.call(t,t)}catch(e){return He(e,t,"data()"),{}}finally{me()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,o=(e.$options.methods,n.length);for(;o--;){var i=n[o];0,r&&x(r,i)||z(i)||gn(e,"_data",i)}$e(t,!0)}(e):$e(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ae();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;0,r||(n[o]=new hn(e,a||L,L,_n)),o in e||bn(e,o,i)}}(e,t.computed),t.watch&&t.watch!==re&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!p(e)&&e.test(t)}function On(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=$n(a.componentOptions);s&&!t(s)&&Mn(n,i,r,o)}}}function Mn(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,b(n,t)}!function(e){e.prototype._init=function(e){var t=this;t._uid=Cn++,t._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(t,e):t.$options=Fe(kn(t.constructor),e||{},t),t._renderProxy=t,t._self=t,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(t),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Zt(e,t)}(t),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,r=n&&n.context;e.$slots=ht(t._renderChildren,r),e.$scopedSlots=o,e._c=function(t,n,r,o){return Wt(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return Wt(e,t,n,r,o,!0)};var i=n&&n.data;Te(e,"$attrs",i&&i.attrs||o,null,!0),Te(e,"$listeners",t._parentListeners||o,null,!0)}(t),nn(t,"beforeCreate"),function(e){var t=vt(e.$options.inject,e);t&&(Ae(!1),Object.keys(t).forEach((function(n){Te(e,n,t[n])})),Ae(!0))}(t),yn(t),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(t),nn(t,"created"),t.$options.el&&t.$mount(t.$options.el)}}(An),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Oe,e.prototype.$delete=Me,e.prototype.$watch=function(e,t,n){if(f(t))return Sn(this,e,t,n);(n=n||{}).user=!0;var r=new hn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){He(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(An),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var o=0,i=e.length;o1?O(n):n;for(var r=O(arguments,1),o='event handler for "'+e+'"',i=0,a=n.length;iparseInt(this.max)&&Mn(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return U}};Object.defineProperty(e,"config",t),e.util={warn:fe,extend:M,mergeOptions:Fe,defineReactive:Te},e.set=Oe,e.delete=Me,e.nextTick=ot,e.observable=function(e){return $e(e),e},e.options=Object.create(null),F.forEach((function(t){e.options[t+"s"]=Object.create(null)})),e.options._base=e,M(e.options.components,Ln),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=O(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=Fe(this.options,e),this}}(e),Rn(e),function(e){F.forEach((function(t){e[t]=function(e,n){return n?("component"===t&&f(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}}))}(e)}(An),Object.defineProperty(An.prototype,"$isServer",{get:ae}),Object.defineProperty(An.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(An,"FunctionalRenderContext",{value:Pt}),An.version="2.6.10";var Dn=g("style,class"),Pn=g("input,textarea,option,select,progress"),jn=function(e,t,n){return"value"===n&&Pn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},En=g("contenteditable,draggable,spellcheck"),Nn=g("events,caret,typing,plaintext-only"),Fn=g("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Bn="http://www.w3.org/1999/xlink",Un=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Wn=function(e){return Un(e)?e.slice(6,e.length):""},zn=function(e){return null==e||!1===e};function Jn(e){for(var t=e.data,n=e,r=e;a(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(t=Hn(r.data,t));for(;a(n=n.parent);)n&&n.data&&(t=Hn(t,n.data));return function(e,t){if(a(e)||a(t))return Vn(e,qn(t));return""}(t.staticClass,t.class)}function Hn(e,t){return{staticClass:Vn(e.staticClass,t.staticClass),class:a(e.class)?[e.class,t.class]:t.class}}function Vn(e,t){return e?t?e+" "+t:e:t||""}function qn(e){return Array.isArray(e)?function(e){for(var t,n="",r=0,o=e.length;r-1?yr(e,t,n):Fn(t)?zn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):En(t)?e.setAttribute(t,function(e,t){return zn(t)||"false"===t?"false":"contenteditable"===e&&Nn(t)?t:"true"}(t,n)):Un(t)?zn(n)?e.removeAttributeNS(Bn,Wn(t)):e.setAttributeNS(Bn,t,n):yr(e,t,n)}function yr(e,t,n){if(zn(n))e.removeAttribute(t);else{if(Y&&!Q&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){e.addEventListener("input",(function t(n){n.stopImmediatePropagation(),e.removeEventListener("input",t)})),e.__ieph=!0}e.setAttribute(t,n)}}var _r={create:mr,update:mr};function br(e,t){var n=t.elm,r=t.data,o=e.data;if(!(i(r.staticClass)&&i(r.class)&&(i(o)||i(o.staticClass)&&i(o.class)))){var s=Jn(t),c=n._transitionClasses;a(c)&&(s=Vn(s,qn(c))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var wr,xr,Sr,Cr,kr,Ar,Rr={create:br,update:br},$r=/[\w).+\-_$\]]/;function Tr(e){var t,n,r,o,i,a=!1,s=!1,c=!1,l=!1,u=0,f=0,p=0,d=0;for(r=0;r=0&&" "===(h=e.charAt(v));v--);h&&$r.test(h)||(l=!0)}}else void 0===o?(d=r+1,o=e.slice(0,r).trim()):m();function m(){(i||(i=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===o?o=e.slice(0,r).trim():0!==d&&m(),i)for(r=0;r-1?{exp:e.slice(0,Cr),key:'"'+e.slice(Cr+1)+'"'}:{exp:e,key:null};xr=e,Cr=kr=Ar=0;for(;!Vr();)qr(Sr=Hr())?Gr(Sr):91===Sr&&Kr(Sr);return{exp:e.slice(0,kr),key:e.slice(kr+1,Ar)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Hr(){return xr.charCodeAt(++Cr)}function Vr(){return Cr>=wr}function qr(e){return 34===e||39===e}function Kr(e){var t=1;for(kr=Cr;!Vr();)if(qr(e=Hr()))Gr(e);else if(91===e&&t++,93===e&&t--,0===t){Ar=Cr;break}}function Gr(e){for(var t=e;!Vr()&&(e=Hr())!==t;);}var Xr;function Zr(e,t,n){var r=Xr;return function o(){var i=t.apply(null,arguments);null!==i&&eo(e,o,n,r)}}var Yr=Xe&&!(ne&&Number(ne[1])<=53);function Qr(e,t,n,r){if(Yr){var o=un,i=t;t=i._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=o||e.timeStamp<=0||e.target.ownerDocument!==document)return i.apply(this,arguments)}}Xr.addEventListener(e,t,oe?{capture:n,passive:r}:n)}function eo(e,t,n,r){(r||Xr).removeEventListener(e,t._wrapper||t,n)}function to(e,t){if(!i(e.data.on)||!i(t.data.on)){var n=t.data.on||{},r=e.data.on||{};Xr=t.elm,function(e){if(a(e.__r)){var t=Y?"change":"input";e[t]=[].concat(e.__r,e[t]||[]),delete e.__r}a(e.__c)&&(e.change=[].concat(e.__c,e.change||[]),delete e.__c)}(n),lt(n,r,Qr,eo,Zr,t.context),Xr=void 0}}var no,ro={create:to,update:to};function oo(e,t){if(!i(e.data.domProps)||!i(t.data.domProps)){var n,r,o=t.elm,s=e.data.domProps||{},c=t.data.domProps||{};for(n in a(c.__ob__)&&(c=t.data.domProps=M({},c)),s)n in c||(o[n]="");for(n in c){if(r=c[n],"textContent"===n||"innerHTML"===n){if(t.children&&(t.children.length=0),r===s[n])continue;1===o.childNodes.length&&o.removeChild(o.childNodes[0])}if("value"===n&&"PROGRESS"!==o.tagName){o._value=r;var l=i(r)?"":String(r);io(o,l)&&(o.value=l)}else if("innerHTML"===n&&Xn(o.tagName)&&i(o.innerHTML)){(no=no||document.createElement("div")).innerHTML=""+r+"";for(var u=no.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;u.firstChild;)o.appendChild(u.firstChild)}else if(r!==s[n])try{o[n]=r}catch(e){}}}}function io(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var n=e.value,r=e._vModifiers;if(a(r)){if(r.number)return m(n)!==m(t);if(r.trim)return n.trim()!==t.trim()}return n!==t}(e,t))}var ao={create:oo,update:oo},so=S((function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach((function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}})),t}));function co(e){var t=lo(e.style);return e.staticStyle?M(e.staticStyle,t):t}function lo(e){return Array.isArray(e)?I(e):"string"==typeof e?so(e):e}var uo,fo=/^--/,po=/\s*!important$/,vo=function(e,t,n){if(fo.test(t))e.style.setProperty(t,n);else if(po.test(n))e.style.setProperty($(t),n.replace(po,""),"important");else{var r=mo(t);if(Array.isArray(n))for(var o=0,i=n.length;o-1?t.split(_o).forEach((function(t){return e.classList.add(t)})):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function wo(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(_o).forEach((function(t){return e.classList.remove(t)})):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function xo(e){if(e){if("object"===(void 0===e?"undefined":r(e))){var t={};return!1!==e.css&&M(t,So(e.name||"v")),M(t,e),t}return"string"==typeof e?So(e):void 0}}var So=S((function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}})),Co=K&&!Q,ko="transition",Ao="transitionend",Ro="animation",$o="animationend";Co&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ko="WebkitTransition",Ao="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Ro="WebkitAnimation",$o="webkitAnimationEnd"));var To=K?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Oo(e){To((function(){To(e)}))}function Mo(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),bo(e,t))}function Io(e,t){e._transitionClasses&&b(e._transitionClasses,t),wo(e,t)}function Lo(e,t,n){var r=Po(e,t),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s="transition"===o?Ao:$o,c=0,l=function(){e.removeEventListener(s,u),n()},u=function(t){t.target===e&&++c>=a&&l()};setTimeout((function(){c0&&(n="transition",u=a,f=i.length):"animation"===t?l>0&&(n="animation",u=l,f=c.length):f=(n=(u=Math.max(a,l))>0?a>l?"transition":"animation":null)?"transition"===n?i.length:c.length:0,{type:n,timeout:u,propCount:f,hasTransform:"transition"===n&&Do.test(r[ko+"Property"])}}function jo(e,t){for(;e.length1}function Wo(e,t){!0!==t.data.show&&No(t)}var zo=function(e){var t,n,r={},o=e.modules,l=e.nodeOps;for(t=0;tv?_(e,i(n[g+1])?null:n[g+1].elm,n,d,g,r):d>g&&w(0,t,p,v)}(p,m,g,n,u):a(g)?(a(e.text)&&l.setTextContent(p,""),_(p,null,g,0,g.length-1,n)):a(m)?w(0,m,0,m.length-1):a(e.text)&&l.setTextContent(p,""):e.text!==t.text&&l.setTextContent(p,t.text),a(v)&&a(d=v.hook)&&a(d=d.postpatch)&&d(e,t)}}}function k(e,t,n){if(s(n)&&a(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r-1,a.selected!==i&&(a.selected=i);else if(j(Ko(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));o||(e.selectedIndex=-1)}}function qo(e,t){return t.every((function(t){return!j(t,e)}))}function Ko(e){return"_value"in e?e._value:e.value}function Go(e){e.target.composing=!0}function Xo(e){e.target.composing&&(e.target.composing=!1,Zo(e.target,"input"))}function Zo(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Yo(e){return!e.componentInstance||e.data&&e.data.transition?e:Yo(e.componentInstance._vnode)}var Qo={model:Jo,show:{bind:function(e,t,n){var r=t.value,o=(n=Yo(n)).data&&n.data.transition,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&o?(n.data.show=!0,No(n,(function(){e.style.display=i}))):e.style.display=r?i:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Yo(n)).data&&n.data.transition?(n.data.show=!0,r?No(n,(function(){e.style.display=e.__vOriginalDisplay})):Fo(n,(function(){e.style.display="none"}))):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,o){o||(e.style.display=e.__vOriginalDisplay)}}},ei={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ti(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?ti(qt(t.children)):e}function ni(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var o=n._parentListeners;for(var i in o)t[k(i)]=o[i];return t}function ri(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var oi=function(e){return e.tag||Vt(e)},ii=function(e){return"show"===e.name},ai={name:"transition",props:ei,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(oi)).length){0;var r=this.mode;0;var o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var i=ti(o);if(!i)return o;if(this._leaving)return ri(e,o);var a="__transition-"+this._uid+"-";i.key=null==i.key?i.isComment?a+"comment":a+i.tag:c(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var s=(i.data||(i.data={})).transition=ni(this),l=this._vnode,u=ti(l);if(i.data.directives&&i.data.directives.some(ii)&&(i.data.show=!0),u&&u.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(i,u)&&!Vt(u)&&(!u.componentInstance||!u.componentInstance._vnode.isComment)){var f=u.data.transition=M({},s);if("out-in"===r)return this._leaving=!0,ut(f,"afterLeave",(function(){t._leaving=!1,t.$forceUpdate()})),ri(e,o);if("in-out"===r){if(Vt(i))return l;var p,d=function(){p()};ut(s,"afterEnter",d),ut(s,"enterCancelled",d),ut(f,"delayLeave",(function(e){p=e}))}}return o}}},si=M({tag:String,moveClass:String},ei);function ci(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function li(e){e.data.newPos=e.elm.getBoundingClientRect()}function ui(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,o=t.top-n.top;if(r||o){e.data.moved=!0;var i=e.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}delete si.mode;var fi={Transition:ai,TransitionGroup:{props:si,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var o=Qt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,o(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=ni(this),s=0;s-1?Qn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Qn[e]=/HTMLUnknownElement/.test(t.toString())},M(An.options.directives,Qo),M(An.options.components,fi),An.prototype.__patch__=K?zo:L,An.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=_e),nn(e,"beforeMount"),r=function(){e._update(e._render(),n)},new hn(e,r,L,{before:function(){e._isMounted&&!e._isDestroyed&&nn(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,nn(e,"mounted")),e}(this,e=e&&K?tr(e):void 0,t)},K&&setTimeout((function(){U.devtools&&se&&se.emit("init",An)}),0);var pi=/\{\{((?:.|\r?\n)+?)\}\}/g,di=/[-.*+?^${}()|[\]\/\\]/g,vi=S((function(e){var t=e[0].replace(di,"\\$&"),n=e[1].replace(di,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")}));var hi={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Br(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Fr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var mi,gi={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Br(e,"style");n&&(e.staticStyle=JSON.stringify(so(n)));var r=Fr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},yi=function(e){return(mi=mi||document.createElement("div")).innerHTML=e,mi.textContent},_i=g("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),bi=g("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),wi=g("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),xi=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Si=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Ci="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+W.source+"]*",ki="((?:"+Ci+"\\:)?"+Ci+")",Ai=new RegExp("^<"+ki),Ri=/^\s*(\/?)>/,$i=new RegExp("^<\\/"+ki+"[^>]*>"),Ti=/^]+>/i,Oi=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Pi=/&(?:lt|gt|quot|amp|#39);/g,ji=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ei=g("pre,textarea",!0),Ni=function(e,t){return e&&Ei(e)&&"\n"===t[0]};function Fi(e,t){var n=t?ji:Pi;return e.replace(n,(function(e){return Di[e]}))}var Bi,Ui,Wi,zi,Ji,Hi,Vi,qi,Ki=/^@|^v-on:/,Gi=/^v-|^@|^:/,Xi=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Zi=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Yi=/^\(|\)$/g,Qi=/^\[.*\]$/,ea=/:(.*)$/,ta=/^:|^\.|^v-bind:/,na=/\.[^.\]]+(?=[^\]]*$)/g,ra=/^v-slot(:|$)|^#/,oa=/[\r\n]/,ia=/\s+/g,aa=S(yi);function sa(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:va(t),rawAttrsMap:{},parent:n,children:[]}}function ca(e,t){Bi=t.warn||Mr,Hi=t.isPreTag||D,Vi=t.mustUseProp||D,qi=t.getTagNamespace||D;var n=t.isReservedTag||D;(function(e){return!!e.component||!n(e.tag)}),Wi=Ir(t.modules,"transformNode"),zi=Ir(t.modules,"preTransformNode"),Ji=Ir(t.modules,"postTransformNode"),Ui=t.delimiters;var r,o,i=[],a=!1!==t.preserveWhitespace,s=t.whitespace,c=!1,l=!1;function u(e){if(f(e),c||e.processed||(e=la(e,t)),i.length||e===r||r.if&&(e.elseif||e.else)&&fa(r,{exp:e.elseif,block:e}),o&&!e.forbidden)if(e.elseif||e.else)a=e,(s=function(e){for(var t=e.length;t--;){if(1===e[t].type)return e[t];e.pop()}}(o.children))&&s.if&&fa(s,{exp:a.elseif,block:a});else{if(e.slotScope){var n=e.slotTarget||'"default"';(o.scopedSlots||(o.scopedSlots={}))[n]=e}o.children.push(e),e.parent=o}var a,s;e.children=e.children.filter((function(e){return!e.slotScope})),f(e),e.pre&&(c=!1),Hi(e.tag)&&(l=!1);for(var u=0;u]*>)","i")),p=e.replace(f,(function(e,n,r){return l=r.length,Ii(u)||"noscript"===u||(n=n.replace(//g,"$1").replace(//g,"$1")),Ni(u,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""}));c+=e.length-p.length,e=p,A(u,c-l,c)}else{var d=e.indexOf("<");if(0===d){if(Oi.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),S(v+3);continue}}if(Mi.test(e)){var h=e.indexOf("]>");if(h>=0){S(h+2);continue}}var m=e.match(Ti);if(m){S(m[0].length);continue}var g=e.match($i);if(g){var y=c;S(g[0].length),A(g[1],y,c);continue}var _=C();if(_){k(_),Ni(_.tagName,e)&&S(1);continue}}var b=void 0,w=void 0,x=void 0;if(d>=0){for(w=e.slice(d);!($i.test(w)||Ai.test(w)||Oi.test(w)||Mi.test(w)||(x=w.indexOf("<",1))<0);)d+=x,w=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&S(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function S(t){c+=t,e=e.substring(t)}function C(){var t=e.match(Ai);if(t){var n,r,o={tagName:t[1],attrs:[],start:c};for(S(t[0].length);!(n=e.match(Ri))&&(r=e.match(Si)||e.match(xi));)r.start=c,S(r[0].length),r.end=c,o.attrs.push(r);if(n)return o.unarySlash=n[1],S(n[0].length),o.end=c,o}}function k(e){var n=e.tagName,c=e.unarySlash;i&&("p"===r&&wi(n)&&A(r),s(n)&&r===n&&A(n));for(var l=a(n)||!!c,u=e.attrs.length,f=new Array(u),p=0;p=0&&o[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var l=o.length-1;l>=a;l--)t.end&&t.end(o[l].tag,n,i);o.length=a,r=a&&o[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,i):"p"===s&&(t.start&&t.start(e,[],!1,n,i),t.end&&t.end(e,n,i))}A()}(e,{warn:Bi,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,n,a,s,f){var p=o&&o.ns||qi(e);Y&&"svg"===p&&(n=function(e){for(var t=[],n=0;nc&&(s.push(i=e.slice(c,o)),a.push(JSON.stringify(i)));var l=Tr(r[1].trim());a.push("_s("+l+")"),s.push({"@binding":l}),c=o+r[0].length}return c-1"+("true"===i?":("+t+")":":_q("+t+","+i+")")),Nr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+i+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+o+")":o)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Jr(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Jr(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Jr(t,"$$c")+"}",null,!0)}(e,r,o);else if("input"===i&&"radio"===a)!function(e,t,n){var r=n&&n.number,o=Fr(e,"value")||"null";Lr(e,"checked","_q("+t+","+(o=r?"_n("+o+")":o)+")"),Nr(e,"change",Jr(t,o),null,!0)}(e,r,o);else if("input"===i||"textarea"===i)!function(e,t,n){var r=e.attrsMap.type;0;var o=n||{},i=o.lazy,a=o.number,s=o.trim,c=!i&&"range"!==r,l=i?"change":"range"===r?"__r":"input",u="$event.target.value";s&&(u="$event.target.value.trim()");a&&(u="_n("+u+")");var f=Jr(t,u);c&&(f="if($event.target.composing)return;"+f);Lr(e,"value","("+t+")"),Nr(e,l,f,null,!0),(s||a)&&Nr(e,"blur","$forceUpdate()")}(e,r,o);else{if(!U.isReservedTag(i))return zr(e,r,o),!1}return!0},text:function(e,t){t.value&&Lr(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Lr(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:_i,mustUseProp:jn,canBeLeftOpenTag:bi,isReservedTag:Zn,getTagNamespace:Yn,staticKeys:function(e){return e.reduce((function(e,t){return e.concat(t.staticKeys||[])}),[]).join(",")}(ya)},xa=S((function(e){return g("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))}));function Sa(e,t){e&&(_a=xa(t.staticKeys||""),ba=t.isReservedTag||D,function e(t){if(t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||y(e.tag)||!ba(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(_a)))}(t),1===t.type){if(!ba(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n|^function\s*(?:[\w$]+)?\s*\(/,ka=/\([^)]*?\);*$/,Aa=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ra={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},$a={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Ta=function(e){return"if("+e+")return null;"},Oa={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Ta("$event.target !== $event.currentTarget"),ctrl:Ta("!$event.ctrlKey"),shift:Ta("!$event.shiftKey"),alt:Ta("!$event.altKey"),meta:Ta("!$event.metaKey"),left:Ta("'button' in $event && $event.button !== 0"),middle:Ta("'button' in $event && $event.button !== 1"),right:Ta("'button' in $event && $event.button !== 2")};function Ma(e,t){var n=t?"nativeOn:":"on:",r="",o="";for(var i in e){var a=Ia(e[i]);e[i]&&e[i].dynamic?o+=i+","+a+",":r+='"'+i+'":'+a+","}return r="{"+r.slice(0,-1)+"}",o?n+"_d("+r+",["+o.slice(0,-1)+"])":n+r}function Ia(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map((function(e){return Ia(e)})).join(",")+"]";var t=Aa.test(e.value),n=Ca.test(e.value),r=Aa.test(e.value.replace(ka,""));if(e.modifiers){var o="",i="",a=[];for(var s in e.modifiers)if(Oa[s])i+=Oa[s],Ra[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;i+=Ta(["ctrl","shift","alt","meta"].filter((function(e){return!c[e]})).map((function(e){return"$event."+e+"Key"})).join("||"))}else a.push(s);return a.length&&(o+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(La).join("&&")+")return null;"}(a)),i&&(o+=i),"function($event){"+o+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function La(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Ra[e],r=$a[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Da={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:L},Pa=function(e){this.options=e,this.warn=e.warn||Mr,this.transforms=Ir(e.modules,"transformCode"),this.dataGenFns=Ir(e.modules,"genData"),this.directives=M(M({},Da),e.directives);var t=e.isReservedTag||D;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function ja(e,t){var n=new Pa(t);return{render:"with(this){return "+(e?Ea(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ea(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Na(e,t);if(e.once&&!e.onceProcessed)return Fa(e,t);if(e.for&&!e.forProcessed)return Ua(e,t);if(e.if&&!e.ifProcessed)return Ba(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Ha(e,t),o="_t("+n+(r?","+r:""),i=e.attrs||e.dynamicAttrs?Ka((e.attrs||[]).concat(e.dynamicAttrs||[]).map((function(e){return{name:k(e.name),value:e.value,dynamic:e.dynamic}}))):null,a=e.attrsMap["v-bind"];!i&&!a||r||(o+=",null");i&&(o+=","+i);a&&(o+=(i?"":",null")+","+a);return o+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Ha(t,n,!0);return"_c("+e+","+Wa(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Wa(e,t));var o=e.inlineTemplate?null:Ha(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(o?","+o:"")+")"}for(var i=0;i>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var i=function(e,t){var n=e.children[0];0;if(n&&1===n.type){var r=ja(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map((function(e){return"function(){"+e+"}"})).join(",")+"]}"}}(e,t);i&&(n+=i+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Ka(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function za(e){return 1===e.type&&("slot"===e.tag||e.children.some(za))}function Ja(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Ba(e,t,Ja,"null");if(e.for&&!e.forProcessed)return Ua(e,t,Ja);var r="_empty_"===e.slotScope?"":String(e.slotScope),o="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(Ha(e,t)||"undefined")+":undefined":Ha(e,t)||"undefined":Ea(e,t))+"}",i=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+o+i+"}"}function Ha(e,t,n,r,o){var i=e.children;if(i.length){var a=i[0];if(1===i.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ea)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r':'
',Qa.innerHTML.indexOf(" ")>0}var rs=!!K&&ns(!1),os=!!K&&ns(!0),is=S((function(e){var t=tr(e);return t&&t.innerHTML})),as=An.prototype.$mount;An.prototype.$mount=function(e,t){if((e=e&&tr(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=is(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){0;var o=ts(r,{outputSourceRange:!1,shouldDecodeNewlines:rs,shouldDecodeNewlinesForHref:os,delimiters:n.delimiters,comments:n.comments},this),i=o.render,a=o.staticRenderFns;n.render=i,n.staticRenderFns=a}}return as.call(this,e,t)},An.compile=ts,t.default=An}).call(this,n(0),n(10).setImmediate)},function(e,t,n){"use strict";(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(11),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||void 0,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||void 0}).call(this,n(0))},function(e,t,n){"use strict";(function(e,t){!function(e,n){if(!e.setImmediate){var r,o,i,a,s,c=1,l={},u=!1,f=e.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(e);p=p&&p.setTimeout?p:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){v(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){v(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){v(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(v,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&v(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),p.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n1)for(var n=1;nu+1&&l("SampleData似乎传入了未重置chunk "+i+">"+u,3);for(var f=0,p=i;p1?f=Math.floor(f/d):(d=1,n=t),f+=s.length;var v=new Int16Array(f),h=0;for(p=0;p0){var C=2*(v.length-S);s=new Int16Array(v.buffer.slice(C)),v=new Int16Array(v.buffer.slice(0,C))}return{index:i,offset:a,frameNext:s,sampleRate:n,data:v}},n.PowerLevel=function(e,t){var n=e/t||0;return n<1251?Math.round(n/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(n/1e4)/Math.log(10)))))},n.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))},n.CLog=function(t,n){var o=new Date,i=("0"+o.getMinutes()).substr(-2)+":"+("0"+o.getSeconds()).substr(-2)+"."+("00"+o.getMilliseconds()).substr(-3),a=this&&this.envIn&&this.envCheck&&this.id,s=["["+i+" "+r+(a?":"+a:"")+"]"+t],c=arguments,l=e.console||{},f=2,p=l.log;for("number"==typeof n?p=1==n?l.error:3==n?l.warn:p:f=1;f1?s:""):p.apply(l,s)};var l=function(){n.CLog.apply(this,arguments)},u=!0;try{u=!console.log.apply}catch(e){}var f=0;function p(e){this.id=++f,y();var n={type:"mp3",bitRate:16,sampleRate:16e3,onProcess:t};for(var r in e)n[r]=e[r];this.set=n,this._S=9,this.Sync={O:9,C:9}}n.Sync={O:9,C:9},n.prototype=p.prototype={CLog:l,_streamStore:function(){return this.set.sourceStream?this:n},open:function(r,o){var a=this,s=a.set,l=a._streamStore();r=r||t;var u=function(e,t){t=!!t,a.CLog("录音open失败:"+e+",isUserNotAllow:"+t,1),o&&o(e,t)},f=function(){a.CLog("open ok id:"+a.id),r(),a._SO=0},p=l.Sync,d=++p.O,v=p.C;a._O=a._O_=d,a._SO=a._S;var h=a.envCheck({envName:"H5",canProcess:!0});if(h)u("不能录音:"+h);else if(s.sourceStream){if(!n.GetContext())return void u("不支持此浏览器从流中获取录音");c(l),a.Stream=s.sourceStream,a.Stream._call={};try{i(l)}catch(e){return void u("从流中打开录音失败:"+e.message)}f()}else{var m=function(t,n){try{e.top.a}catch(e){return void u('无权录音(跨域,请尝试给iframe添加麦克风访问策略,如allow="camera;microphone")')}/Permission|Allow/i.test(t)?u("用户拒绝了录音权限",!0):!1===e.isSecureContext?u("浏览器禁止不安全页面录音,可开启https解决"):/Found/i.test(t)?u(n+",无可用麦克风"):u(n)};if(n.IsOpen())f();else if(n.Support()){var g=function(e){setTimeout((function(){e._call={};var t=n.Stream;t&&(c(),e._call=t._call),n.Stream=e,function(){if(v!=p.C||!a._O){var e="open被取消";return d==p.O?a.close():e="open被中断",u(e),!0}}()||(n.IsOpen()?(t&&a.CLog("发现同时多次调用open",1),i(l,1),f()):u("录音功能无效:无音频流"))}),100)},y=function(e){var t=e.name||e.message||e.code+":"+e;a.CLog("请求录音权限错误",1,e),m(t,"无法录音:"+t)},_=s.audioTrackSet||{};_.sampleRate=n.Ctx.sampleRate;var b={audio:_};try{var w=n.Scope.getUserMedia(b,g,y)}catch(e){a.CLog("getUserMedia",3,e),b={audio:!0},w=n.Scope.getUserMedia(b,g,y)}a.CLog("getUserMedia("+JSON.stringify(b)+"),一般默认会降噪和回声消除,移动端可能会降低系统播放音量,请参阅文档中audioTrackSet配置"),w&&w.then&&w.then(g).catch(y)}else m("","此浏览器不支持录音")}},close:function(e){e=e||t;var n=this._streamStore();this._stop();var r=n.Sync;if(this._O=0,this._O_!=r.O)return this.CLog("close被忽略(因为同时open了多个rec,只有最后一个会真正close)",3),void e();r.C++,c(n),this.CLog("close"),e()},mock:function(e,t){return this._stop(),this.isMock=1,this.mockEnvInfo=null,this.buffers=[e],this.recSize=e.length,this.srcSampleRate=t,this},envCheck:function(t){var r,o=this.set,i="CPU_BE";if(r||n[i]||!e.Int8Array||new Int8Array(new Int32Array([1]).buffer)[0]||(y(i),r="不支持CPU_BE架构"),!r){var a=o.type;this[a+"_envCheck"]?r=this[a+"_envCheck"](t,o):o.takeoffEncodeChunk&&(r=a+"类型"+(this[a]?"":"(未加载编码器)")+"不支持设置takeoffEncodeChunk")}return r||""},envStart:function(e,t){var n=this.set;this.isMock=e?1:0,this.mockEnvInfo=e,this.buffers=[],this.recSize=0,this.envInLast=0,this.envInFirst=0,this.envInFix=0,this.envInFixTs=[];var r=n.sampleRate;if(r>t?n.sampleRate=t:r=0,this.srcSampleRate=t,this.CLog("srcSampleRate: "+t+" set.sampleRate: "+n.sampleRate+(r?" 忽略"+r:""),r?3:0),this.engineCtx=0,this[n.type+"_start"]){var o=this.engineCtx=this[n.type+"_start"](n);o&&(o.pcmDatas=[],o.pcmSize=0)}},envResume:function(){this.envInFixTs=[]},envIn:function(e,t){var r=this,o=r.set,i=r.engineCtx,a=r.srcSampleRate,s=e.length,c=n.PowerLevel(t,s),l=r.buffers,u=l.length;l.push(e);var f=l,p=u,d=Date.now(),v=Math.round(s/a*1e3);r.envInLast=d,1==r.buffers.length&&(r.envInFirst=d-v);var h=r.envInFixTs;h.splice(0,0,{t:d,d:v});for(var m=d,g=0,y=0;y3e3){h.length=y;break}m=_.t,g+=_.d}var b=h[1],w=d-m;if(w-g>w/3&&(b&&w>1e3||h.length>=6)){var x=d-b.t-v;if(x>v/5){var S=!o.disableEnvInFix;if(r.CLog("["+d+"]"+(S?"":"未")+"补偿"+x+"ms",3),r.envInFix+=x,S){var C=new Int16Array(x*a/1e3);s+=C.length,l.push(C)}}}var k=r.recSize,A=s,R=k+A;if(r.recSize=R,i){var $=n.SampleData(l,a,o.sampleRate,i.chunkInfo);i.chunkInfo=$,R=(k=i.pcmSize)+(A=$.data.length),i.pcmSize=R,l=i.pcmDatas,u=l.length,l.push($.data),a=$.sampleRate}var T=Math.round(R/a*1e3),O=l.length,M=f.length,I=function(){for(var e=L?0:-A,t=null==l[0],n=u;n10&&r.envInFirst-d>1e3&&r.CLog("rec.set.onProcess低性能,耗时"+D+"ms",3),!0===L){var P=0;for(y=u;y"+y.length+" 花:"+(Date.now()-o)+"ms"),setTimeout((function(){o=Date.now(),i[a.type](y,(function(e){f(e,m)}),(function(e){u(e)}))}))}else u("未加载"+a.type+"编码器");else u("音频buffers被释放");else u("未采集到录音")}},e[r]&&(l("重复引入"+r,3),e[r].Destroy()),e[r]=n;var d=function(e,t){t.pos||(t.pos=[0],t.tracks={},t.bytes=[]);var n=t.tracks,r=[t.pos[0]],o=function(){t.pos[0]=r[0]},i=t.bytes.length,a=new Uint8Array(i+e.length);if(a.set(t.bytes),a.set(e,i),t.bytes=a,!t._ht){if(m(a,r),g(a,r),!v(m(a,r),[24,83,128,103]))return;for(m(a,r);r[0]1){var j=[];for(k=0;k<$.length;)j.push($[k]),k+=T.channels;$=new Float32Array(j)}return $}}},v=function(e,t){if(!e||e.length!=t.length)return!1;if(1==e.length)return e[0]==t[0];for(var n=0;n=e.length)){var o=("0000000"+e[r].toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(o);if(i){var a=i[1].length,s=[];if(!(r+a>e.length)){for(var c=0;ce.length)return;for(var a=0;a
';var l=this.canvas=s.querySelector("canvas"),u=this.ctx=l.getContext("2d");l.width=i,l.height=a,this.linear1=this.genLinear(u,i,e.linear1),this.linear2=this.genLinear(u,i,e.linear2),this.linearBg=this.genLinear(u,a,e.linearBg,!0),r&&(r.innerHTML="",r.appendChild(s)),this._phase=0}).prototype=r.prototype={genLinear:function(e,t,n,r){for(var o=e.createLinearGradient(0,0,r?0:t,r?t:0),i=0;i1300&&(clearInterval(e.timer),e.timer=0)}},draw:function(e){var t=this.set,n=this.ctx,r=t.scale,o=t.width*r,i=t.height*r,a=t.speed/t.fps,s=this._phase-=a,c=s+a*t.phase,l=e/100,u=this.genPath(2,l,s),f=this.genPath(1.8,l,c);n.clearRect(0,0,o,i),n.beginPath();for(var p=0,d=0;d=0;p--,d-=r)n.lineTo(d,f[p]);n.closePath(),n.fillStyle=this.linearBg,n.fill(),this.drawPath(f,this.linear2),this.drawPath(u,this.linear1)},drawPath:function(e,t){var n=this.set,r=this.ctx,o=n.scale,i=n.width*o;r.beginPath();for(var a=0,s=0;s\n \n\n \n\n '}),s=a.$refs.mainView;s.reclog('RecordApp[即将废弃] 除Recorder支持的外,支持Hybrid App,低版本IOS上支持微信网页和小程序web-view'+unescape("%uD83C%uDF89")+""),s.reclog('Recorder H5使用简单,功能丰富,支持PC、Android、IOS 14.3+'+unescape("%uD83D%uDCAA")+""),s.reclog('绿油油的一大片,真有食欲'+unescape("%uD83D%uDE02")+' 当前浏览器支持录音':'red">不支持录音')+"");var c=function(e,t){s.reclog(''+e+": "+t+"")};c("本页面修改时间(有可能修改了忘改)","2020-11-25 21:43:09"),c("Recorder库修改时间(有可能修改了忘改)",s.Rec.LM),c("RecordApp库修改时间(有可能修改了忘改)",s.App.LM),c("UA",navigator.userAgent),c("URL",location.href.replace(/#.*/g,"")),c("Vue",r.default.version),s.reclog("点击打开录音,然后再点击开始录音",2),window.vue_root=a,window.vue_main=s,console.log("Vue",r.default),console.log("Recorder",s.Rec),console.log("RecordApp",s.App)},function(e,t,n){"use strict";n.r(t);var r=n(18),o=n(6);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);n(32);var a=n(1),s=Object(a.a)(o.default,r.a,r.b,!1,null,null,null);s.options.__file="component/recordapp.vue",t.default=s.exports},function(e,t,n){"use strict";window.PageSet_RecordAppBaseFolder="https://cdn.jsdelivr.net/gh/xiangyuecn/Recorder@latest/dist/",window.RecordAppBaseFolder=window.PageSet_RecordAppBaseFolder||"https://xiangyuecn.gitee.io/recorder/src/",window.OnRecordAppInstalled=window.Native_RecordApp_Config=function(){window.Native_RecordApp_Config=null,window.IOS_Weixin_RecordApp_Config&&IOS_Weixin_RecordApp_Config();var e=RecordApp,t=e.CLog,n=e.Platforms.Native.Config;t("native-config init");var r,o="RecordAppJsBridge",i=window.AppJsBridgeRequest=function(e,n,r){var s=window.top,c=0;try{c=s.AppJsBridgeRequest}catch(e){t("检测到跨域iframe,AppJsBridgeRequest将由Native通过执行postMessage转发来兼容数据的返回",3)}if(c&&c!=i)return c(e,n,r);n||(n={});var l="";r&&(l=a.length+"",a.push(r));var u={status:"",message:"",callback:l,value:null},f=JSON.stringify({action:e,args:n,callback:l}),p="";return window[o]?p=window[o].request(f):((window.webkit||{}).messageHandlers||{})[o+"IsSet"]?p=prompt(f):u.message="非app,不能调用接口",p=p&&JSON.parse(p)||u},a=[""];i.Call=function(e){a[e.callback]&&(a[e.callback](e),a[e.callback]=null)},i.Record=function(e,t){NativeRecordReceivePCM(e,t)};try{window.top.AppJsBridgeRequest=i}catch(e){var s=function(){t("检测到跨域iframe,AppJsBridgeRequest无法注入到顶层,已监听postMessage,Native通过执行postMessage转发来兼容数据返回",3),window.parent!=window.top&&t("RecordApp Native Config示例不支持跨域iframe超过1层,因为没有处理中间的iframe的window的postMessage转发",1)};setTimeout(s,8e3),s(),addEventListener("message",(function(e){var n=e.data;if(n&&"AppJsBridgeRequest"==n.type){var r=n.action;n=n.data,"Call"==r?i.Call(n):"Record"==r?i.Record(n.pcmDataBase64,n.sampleRate):t("AppJsBridgeRequest未知postMessage:"+r,3)}}))}n.IsApp=function(e){window[o]||((window.webkit||{}).messageHandlers||{})[o+"IsSet"]?e(!0):e(!1)},n.JsBridgeRequestPermission=function(e,t){i("recordPermission",{},(function(n){"success"==n.status?1==n.value?e():3==n.value?t("用户拒绝了录音权限",!0):t("不支持录音"):t(n.message)}))},n.JsBridgeStart=function(e,t,n){i("recordStart",{param:e},(function(e){"success"==e.status?(t(),r=setInterval((function(){i("recordAlive")}),5e3)):n(e.message)}))},n.JsBridgeStop=function(e,t){clearInterval(r),i("recordStop",{},(function(n){"success"==n.status?e():t(n.message)}))}},window.RecordApp&&OnRecordAppInstalled(),console.error("【注意】本网站正在使用RecordApp的native-config.js测试用的配置例子,这个配置如果要使用到你的网站,需要自己重写或修改后才能使用"),/^file:|:\/\/[^\/]*(jiebian.life|git\w+.io)(\/|$)/.test(location.href)||localStorage.DisableAppSampleAlert||window.AppSampleAlert||(window.AppSampleAlert=1,alert("【注意】当前网站正在使用RecordApp测试用的配置例子*.config.js,需要自己重写或修改后才能使用"))},function(e,t,n){"use strict";window.PageSet_RecordAppBaseFolder="https://cdn.jsdelivr.net/gh/xiangyuecn/Recorder@latest/dist/",function(){window.RecordAppBaseFolder=window.PageSet_RecordAppBaseFolder||"https://xiangyuecn.gitee.io/recorder/src/";var e=window.PageSet_RecordAppWxApi||"https://jiebian.life/api/weixin/git_record";window.OnRecordAppInstalled=window.IOS_Weixin_RecordApp_Config=function(){window.IOS_Weixin_RecordApp_Config=null,window.Native_RecordApp_Config&&Native_RecordApp_Config();var t=RecordApp,n=t.CLog,r=t.Platforms.Weixin.Config;n("ios-weixin-config init");var o=window.top;if(/iphone/i.test(navigator.userAgent)){var i="Bad_WeixinIOSH5HistoryInitLocation";o[i]=o[i]||window[i]||location.href,setTimeout((function(){n("IOS内微信不认 history.pushState 产生的新地址,如果签名地址不是页面加载时的地址,可能会导致签名失败,当前签名使用的地址为:"+o[i],3)}),5e3)}r.Enable=function(e){e(!0)},r.WxReady=function(n){o.WxReady||o.eval("var InitJsSDK="+s.toString()+";InitJsSDK")(t,e,a),o.WxReady(n)},r.DownWxMedia=function(t,r,o){var i=function(e){n(e,1),o(e)};n("下载微信素材...",t),a(e,{action:"wxdown",mediaID:t.mediaId,transform_mediaIds:t.transform_mediaIds,transform_type:t.transform_type,transform_bitRate:t.transform_bitRate,transform_sampleRate:t.transform_sampleRate},(function(e,t){var o=e.mime,a=e.data;o&&a&&(a.length||1)%4==0?(n("成功下载微信音频素材"+o+" ≈"+a.length/4*3+"b"),r(e)):(n("下载错误",1,t),i("微信音频素材下载接口返回非预定义json数据"))}),(function(e){i("微信音频素材下载失败:"+e)}))};var a=function(e,t,n,r){var o=new XMLHttpRequest;o.timeout=2e4,o.open("POST",e),o.onreadystatechange=function(){if(4==o.readyState)if(200==o.status){try{var e=JSON.parse(o.responseText)}catch(e){}if(0!==e.c||!e.v)return void r(e.m||"接口返回非预定义json数据");n(e.v,e)}else r("请求失败["+o.status+"]")};var i=[];for(var a in t)i.push(a+"="+encodeURIComponent(t[a]));o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(i.join("&"))},s=function(e,t,n){var r=e.CLog,o=function(e){s?e(null,s):d((function(){e(wx)}),(function(t){e(wx,"请求微信接口失败: "+t)}))};window.WxReady=function(e){i?o(e):a.push(e)};var i=!1,a=[],s="",c=function(){i=!0;var e=a;a=[];for(var t=0;t1?i:""):f.apply(s,i)},l=!0;try{l=!console.log.apply}catch(e){}var u={LM:"2022-03-03 18:58:07",Current:0,CLog:c,IsWx:t,BaseFolder:n,UseLazyLoad:!0,AlwaysUseWeixinJS:!1,AlwaysAppUseJS:!1,Platforms:{Native:i,Weixin:a,Default:s},Js:function(t,n,r,o){var i=(o=o||e).document;!function e(o){if(o>=t.length)n();else{var a=t[o],s=a.url;if(!1!==a.check()){var c=i.createElement("script");c.setAttribute("type","text/javascript"),c.setAttribute("src",s),c.onload=function(){e(o+1)},c.onerror=function(e){r("请求失败:"+(e.message||"-")+","+s)},i.body.appendChild(c)}else e(o+1)}}(0)},Install:function(e,t){var n=u.__reqs||(u.__reqs=[]);n.push({s:e,f:t}),e=function(){r("s",arguments)},t=function(e,t){r("f",arguments)};var r=function(e,t){for(var r=0;r1)){var i=function(e,t,n){for(var r,o=e.Config.paths,i=[],a=0;a>16,l[f]=a,u+=Math.abs(a);i.envIn(l,u)}else t("未开始录音,但收到Native PCM数据",3)};try{window.top.NativeRecordReceivePCM=o}catch(e){var i=function(){t("检测到跨域iframe,NativeRecordReceivePCM无法注入到顶层,已监听postMessage转发兼容传输数据,请自行实现将top层接收到数据转发到本iframe(不限层),不然无法接收到录音数据",3)};setTimeout(i,8e3),i(),addEventListener("message",(function(e){var t=e.data;t&&"NativeRecordReceivePCM"==t.type&&(t=t.data,o(t.pcmDataBase64,t.sampleRate))}))}n.RequestPermission=function(e,t){r.JsBridgeRequestPermission(e,t)},n.Start=function(t,n,i){o.param=t;var a=Recorder(t);a.set.disableEnvInFix=!0,o.rec=a,e.__Rec=a,r.JsBridgeStart(t,n,i)},n.Stop=function(n,i){var a=function(t){i("录音失败[Native]:"+t),o.rec=null,e.__Rec=null};r.JsBridgeStop((function(){var r=o.rec;if(o.rec=null,r){t("rec encode start: pcm:"+r.recSize+" src:"+r.srcSampleRate+" set:"+JSON.stringify(o.param));var i=function(){for(var e in r.set)o.param[e]=r.set[e]};if(!n)return i(),void a("仅清理资源");r.stop((function(o,a){t("rec encode end"),i(),e._SRec=r,n(o,a),e.__Rec=null}),(function(e){i(),a(e)}))}else a("未开始录音")}),a)}}()},function(e,t,n){"use strict";!function(){var e=RecordApp,t=e.CLog,n=e.Platforms.Weixin,r=n.Config;n.IsInit=!0;var o,i={};n.RequestPermission=function(e,n){if(5!=o)if(u.push({t:e,f:n}),1!=o){o=1;var a=function(e,t){o=e?0:5;var n=u;u=[];for(var r=0;r2?i.chunkErr=o:(r++,t("尝试重启..."+r),d((function(){e(r)}),1))}}}):t("已停止wx录音,拒绝接续",3)}(0)}}})}else o("请先调用RequestPermission")},n.Stop=function(o,a){var u=i.wx;s=0;var f=!!l;l=null,t("开始停止录音");var d=function(e){a("录音失败[wx]:"+(e.errMsg||e))},v=i.start;if(v){var h=Date.now()-i.startTime;if(!f&&h>59100)return t("wx录音即将满1分钟,等待它录满,不然stop不可控...",3),void(l=function(){n.Stop(o,a)});i.start=null;var m={list:[]};v.DownWxMediaData=m;var g=function(){var n=m.list,r=n[0];if(r.duration){for(var i=atob(r.data),a=i.length,s=new Uint8Array(a);a--;)s[a]=i.charCodeAt(a);var c=new Blob([s.buffer],{type:r.mime});return e._SRec=null,t("微信素材服务器端已转码,不支持RecordApp.GetStopUsedRec方法",3),void o(c,r.duration)}var l=[],u=0,f=0,p=0;Recorder.AMR?function r(){if(p||(p=Date.now()),f>=n.length)return m.decodeTime=Date.now()-p,void function(){u||(u=Date.now());var n=[],r=v.sampleRate/8e3;r<=1?r=1:t("微信arm素材采样率为8000hz(语音音质勉强能听),已自动提升成设置的采样率"+v.sampleRate+"hz,但音质不可能会变好",3);for(var i=0,a=0,s=0;s=e.length)return m.uploadTime=Date.now()-l,t("开始下载微信素材..."),void function e(n){if(a||(a=Date.now()),i>=y.length)s();else{var o=y[i];r.DownWxMedia({mediaId:o,transform_mediaIds:y.join(","),transform_type:v.type,transform_bitRate:v.bitRate,transform_sampleRate:v.sampleRate},(function(t){m.list.push(t),t.duration?s():/amr/i.test(t.mime)?(i++,e()):d("微信服务器返回了未知音频类型:"+t.mime)}),(function(r){(n=n||0)>2?d("下载微信音频失败:"+r):(n++,t("DownWxMedia失败,重试..."+n,1,r),e(n))}))}}();var f=e[c];t("wx上传本地录音["+c+"] wx.playVoice({localId:'"+f+"'})"),u.uploadVoice({localId:f,isShowProgressTips:0,fail:function(e){(o=o||0)>2?d("微信uploadVoice失败["+c+"]:"+e.errMsg):(o++,t("uploadVoice失败,重试..."+o,1,e),n(o))},success:function(e){var r=e.serverId;t("上传OK serverId:"+r),y.push(r),c++,n()}})}()}else d("未获得任何录音")}else d("仅清理资源")},b=i.chunks;if(i.chunkErr)return t(i.chunkErr,1,b),void d("录制失败,已录制"+b.length+"分钟,但后面出错:"+i.chunkErr);if(f)_();else{if(b.length&&Date.now()-b[b.length-1].time<900)return t("丢弃结尾未停止太短录音",3),p(),void _();c=function(e,n){c=null;var r=Date.now();e.localId?b.push({res:e,duration:r-i.startTime,time:r,from:n}):t("已忽略"+n+"数据",3,e),i.chunks=null,_()},u.stopRecord({fail:function(e){c=null,b.length&&h<3e3?(t("停止录音出错,但后续录音太短,已忽略此错误:"+e.errMsg,3),_()):d(e)},success:function(e){c&&c(e,"stop")}})}}else d("未开始录音")}}()},function(e,t,n){"use strict";var r=n(8);n.n(r).a},function(e,t,n){(e.exports=n(15)(!1)).push([e.i,"\nbody{\r\n word-wrap: break-word;\r\n background:#f5f5f5 center top no-repeat;\r\n background-size: auto 680px;\n}\npre{\r\n white-space:pre-wrap;\n}\na{\r\n text-decoration: none;\r\n color:#06c;\n}\na:hover{\r\n color:#f00;\n}\n.main{\r\n max-width:700px;\r\n margin:0 auto;\r\n padding-bottom:80px\n}\n.mainBox{\r\n margin-top:12px;\r\n padding: 12px;\r\n border-radius: 6px;\r\n background: #fff;\r\n --border: 1px solid #0b1;\r\n box-shadow: 2px 2px 3px #aaa;\n}\n.mainBtn{\r\n display: inline-block;\r\n cursor: pointer;\r\n border: none;\r\n border-radius: 3px;\r\n background: #0b1;\r\n color:#fff;\r\n padding: 0 15px;\r\n margin-right:20px;\r\n line-height: 36px;\r\n height: 36px;\r\n overflow: hidden;\r\n vertical-align: middle;\n}\n.mainBtn:active{\r\n background: #0a1;\n}\n.ctrlBtn{\r\n margin-top:10px;\n}\n.pd{\r\n\tpadding:0 0 6px 0;\n}\n.lb{\r\n\tdisplay:inline-block;\r\n\tvertical-align: middle;\r\n\tbackground:#00940e;\r\n\tcolor:#fff;\r\n\tfont-size:14px;\r\n\tpadding:2px 8px;\r\n\tborder-radius: 99px;\n}\r\n",""])}]); \ No newline at end of file diff --git a/assets/npm-home/hash-history.txt b/assets/npm-home/hash-history.txt index f454927..78af205 100644 --- a/assets/npm-home/hash-history.txt +++ b/assets/npm-home/hash-history.txt @@ -1,4 +1,8 @@ [ + { + "sha1": "4fa1d9dd106f8d959a505168088d935f98fc620d", + "time": "2023/6/10 22:27:40" + }, { "sha1": "ef550552c34f40aebd27d186d8608540be998a02", "time": "2023/2/1 23:06:25" @@ -14,9 +18,5 @@ { "sha1": "40d86b5656875a4f856d652bc3d4839464d8fe2d", "time": "2022-6-28 09:44:33" - }, - { - "sha1": "88b22aab0ee72cd0a07d594cb0e035067f28cb69", - "time": "2022-5-7 23:49:36" } ] \ No newline at end of file diff --git a/assets/ztext_collab-project_videojs-record.html b/assets/ztext_collab-project_videojs-record.html index 3819fe6..776fee5 100644 --- a/assets/ztext_collab-project_videojs-record.html +++ b/assets/ztext_collab-project_videojs-record.html @@ -11,47 +11,54 @@ +
-
国外的玩意,除了好看就是容易误操作,上面如果是空白,代表:加载很慢↑↑↑↑ (也有可能是他们更新了页面,但这个测试html还未及时同步更新)
-
显示出录音界面后,点击大麦克风按钮打开录音,再点击左下角圆点按钮开始录音,再点按钮结束录音,录完后点左下角的播放箭头播放
+
加载中... 上面如果是空白,代表:加载很慢↑↑↑↑ (也有可能是他们更新了页面,但这个测试html还未及时同步更新)
+
- 这个录出来的音频格式完全不可控,可能是webm、wav;但可以注入代码强制修改,录音时日志里面显示的“Using recorderType: xxx”决定了录音类型,替换GetRecorderType函数即可: + 这个录出来的音频格式完全不可控,可能是webm、wav;但可以注入代码强制修改,录音时日志里面显示的“Initialized recorderType: xxx”决定了录音类型,替换GetRecorderType函数即可:
wav:
webm:
未知:
- +var playerOpen=function(){ + player.record().getDevice(); +}; +var playerClose=function(){ + player.record().stopDevice(); + reclog("已关闭录音"); +}; +var playerStart=function(){ + player.record().start(); +}; +var playerStop=function(){ + player.record().stop(); +}; +
-【测试方法】:使用上面的录音功能进行测试看看能否正常录音。 +
+ 【测试方法】:使用上面的录音功能进行测试看看能否正常录音,播放听听录音内容是否正常。可以多关闭打开几次录音进行测试,在不同设备上进行测试(iOS重灾区)。 +
如果ScriptProcessor模式下的录音有问题,请点击“改为MediaStreamRecorder录制webm,底层使用MediaRecorder”按钮,重新录音测试。
+


【附带测试】: @@ -92,6 +115,15 @@ Audio对录音的影响测试(issues#34);IOS Safari如果未开始过录音并且播放了音乐,然后后续录音将会有问题;再现方法(test apple developer forums):刷新页面后首先先播放音乐,然后开始测试录音,会发现波形显示掉帧或者保持直线。另测试浏览器对音频的支持情况。
+ +
+ + + + diff --git a/dist/recorder-core.js b/dist/recorder-core.js index bf58f1d..016b3ae 100644 --- a/dist/recorder-core.js +++ b/dist/recorder-core.js @@ -3,4 +3,4 @@ https://github.com/xiangyuecn/Recorder src: recorder-core.js */ -!function(I){"use strict";var d=function(){},U=function(e){return new t(e)};U.LM="2023-02-01 18:05";var L="Recorder",C="getUserMedia",P="srcSampleRate",W="sampleRate",A="catch";U.IsOpen=function(){var e=U.Stream;if(e){var t=e.getTracks&&e.getTracks()||e.audioTracks||[],n=t[0];if(n){var r=n.readyState;return"live"==r||r==n.LIVE}}return!1},U.BufferSize=4096,U.Destroy=function(){for(var e in z(L+" Destroy"),_(),n)n[e]()};var n={};U.BindDestroy=function(e,t){n[e]=t},U.Support=function(){var e=navigator.mediaDevices||{};return e[C]||(e=navigator)[C]||(e[C]=e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia),!!e[C]&&(U.Scope=e,!!U.GetContext())},U.GetContext=function(){var e=I.AudioContext;return e||(e=I.webkitAudioContext),e?(U.Ctx&&"closed"!=U.Ctx.state||(U.Ctx=new e,U.BindDestroy("Ctx",function(){var e=U.Ctx;e&&e.close&&(e.close(),U.Ctx=0)})),U.Ctx):null};var T="ConnectEnableWebM";U[T]=!0;var D="ConnectEnableWorklet";U[D]=!1;var S=function(e,c){var f,i,u,l=e.BufferSize||U.BufferSize,v=U.Ctx,p=e.Stream,s=function(e){var t=p._m=v.createMediaStreamSource(p),n=v.destination,r="createMediaStreamDestination";v[r]&&(n=v[r]()),t.connect(e),e.connect(n)},h="",g=p._call,m=function(e){for(var t in g){for(var n=e.length,r=new Int16Array(n),a=0,o=0;o"+f,3);for(var u=0,l=o;l"+d.length+" 花:"+(Date.now()-r)+"ms"),setTimeout(function(){r=Date.now(),a[o.type](d,function(e){u(e,g)},function(e){f(e)})})}else f("未加载"+o.type+"编码器");else f("音频buffers被释放");else f("未采集到录音")}},I[L]&&(z("重复引入"+L,3),I[L].Destroy()),I[L]=U;var R=function(e,t){t.pos||(t.pos=[0],t.tracks={},t.bytes=[]);var n=t.tracks,r=[t.pos[0]],a=function(){t.pos[0]=r[0]},o=t.bytes.length,i=new Uint8Array(o+e.length);if(i.set(t.bytes),i.set(e,o),t.bytes=i,!t._ht){if(N(i,r),G(i,r),!E(N(i,r),[24,83,128,103]))return;for(N(i,r);r[0]=e.length)){var a=e[r],o=("0000000"+a.toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(o);if(i){var s=i[1].length,c=[];if(!(r+s>e.length)){for(var f=0;fe.length)return;for(var i=0;i"+f,3);for(var u=0,l=o;l"+d.length+" 花:"+(Date.now()-n)+"ms"),setTimeout(function(){n=Date.now(),a[o.type](d,function(e){u(e,g)},function(e){f(e)})})}else f("未加载"+o.type+"编码器");else f("音频buffers被释放");else f("未采集到录音")}},I[w]&&(z("重复引入"+w,3),I[w].Destroy()),I[w]=P;var F=function(e,t){t.pos||(t.pos=[0],t.tracks={},t.bytes=[]);var r=t.tracks,n=[t.pos[0]],a=function(){t.pos[0]=n[0]},o=t.bytes.length,i=new Uint8Array(o+e.length);if(i.set(t.bytes),i.set(e,o),t.bytes=i,!t._ht){if(B(i,n),N(i,n),!R(B(i,n),[24,83,128,103]))return;for(B(i,n);n[0]=e.length)){var a=e[n],o=("0000000"+a.toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(o);if(i){var s=i[1].length,c=[];if(!(n+s>e.length)){for(var f=0;fe.length)return;for(var i=0;i //兼容环境 -var PageLM="2023-02-01 21:37"; +var PageLM="2023-06-10 21:23"; function RandomKey(){ return "randomkey"+(RandomKey.idx++); @@ -336,18 +336,20 @@
noiseSuppression : - 降噪配置开关(默认禁用) + 降噪(ANS)配置开关
echoCancellation : - 回声消除配置开关(默认禁用) + 回声消除(AEC)配置开关
autoGainControl : @@ -356,11 +358,11 @@ - 自动增益配置开关 + 自动增益(AGC)配置开关
- 以上参数设置后需重新打开录音;均为set中的audioTrackSet高级配置,会直接传递给浏览器的getUserMedia方法,不同浏览器的支持程度不同,并不一定会生效; - 移动端打开降噪、回声消除可能会表现的很怪异(包括系统播放声音变小),所以默认禁用,使用原声录制(高音甜、中音准、低音沉,总之一句话就是通透),如需降噪、回声消除请测试好后再开启 + 以上参数设置后需重新打开录音;均为set中的audioTrackSet高级配置,会直接传递给浏览器的getUserMedia方法,不同浏览器的支持程度不同,并不一定会生效,这些参数浏览器一般默认为打开; + 移动端打开降噪、回声消除可能会表现的很怪异(包括系统播放音量变小),但iOS上如果关闭又可能导致录音没有声音,如需更改配置请Android和iOS分别配置,并测试好
@@ -437,15 +439,6 @@
issues#51如果没有进行补偿,录音时设备偶尔出现很卡的情况下(CPU被其他程序大量占用),浏览器采集到的音频是断断续续的,导致10秒的录音可能就只返回了5秒的数据量,这个时候最终编码得到的音频时长明显变短,播放时的效果就像快放一样。未禁用时会在卡顿时自动补偿静默音频,消除了快放效果,但由于丢失的音频已被静默数据代替,听起来就是数据本身的断断续续的效果。在设备不卡时录音没有此问题。
-
- 临时调试选项 : -
-
以上参数设置后需重新打开录音;这些参数仅供调试用,未来会被删除。
-
-
Destroy : @@ -557,7 +550,7 @@ 问题自检 : 录音时注意观察灰色区域是否有绿色音量跳动,没有绿色跳动说明Recorder没有获取到声音数据。如果测试发现mp3没有声音,可以试一下wav格式,如果wav格式有声音,说明内置lamejs mp3编码器有问题。如果都没有,下载下来播放看看有没有。下载下来也没有声音可以反馈一下。 -
+
如果浏览器不能正常录音,并且不确定是不是这个库的问题,可以到 assets/ztext_collab-project_videojs-record.html 试一下。
@@ -614,18 +607,12 @@ reclog("已启用AudioWorklet"+(enableWebM?"(同时启用了MediaRecorder,AudioWorklet只会在MediaRecorder未生效时采用)":"")+","+workletTips,"#f60"); } - var debugSet_D220626=$(".debugSet_D220626")[0].checked; - Recorder._D220626=debugSet_D220626; - if(debugSet_D220626){ - reclog("已启用临时调试选项:Recorder._D220626=true","#f60"); - }; - var audioTrackSet=null; var trackSet_device=$(".trackSet_device").val(); var trackSet_noise=$(".trackSet_noise").val(); var trackSet_aec=$(".trackSet_aec").val(); var trackSet_gain=$(".trackSet_gain").val(); - if(trackSet_device || trackSet_noise==1 || trackSet_aec==1 || trackSet_gain){ + if(trackSet_device || trackSet_noise || trackSet_aec || trackSet_gain){ audioTrackSet={}; if(trackSet_device){ var device=DeviceList[+trackSet_device]; @@ -764,20 +751,22 @@ var DeviceList=[]; var trackSetQueryDeviceList=function(click){ var end=function(list,err){ - DeviceList=list; - if(click){ - console.log("DeviceList: ", JSON.parse(JSON.stringify(DeviceList))); - } - + DeviceList=list; var list2=[]; var opts=['']; for(var i=0;i'+name+''); } } - $(".trackSet_device").html(opts.join(" ")) + $(".trackSet_device").html(opts.join(" ")); + + if(click){ + console.log("DeviceList: ", JSON.parse(JSON.stringify(list))); + reclog("已重新拉取到"+list2.length+"个设备,可切换要使用的麦克风",2); + } }; if(navigator.mediaDevices && navigator.mediaDevices.enumerateDevices){ navigator.mediaDevices.enumerateDevices().then(end)["catch"](function(e){ diff --git a/recorder.mp3.min.js b/recorder.mp3.min.js index 2149663..faffe85 100644 --- a/recorder.mp3.min.js +++ b/recorder.mp3.min.js @@ -3,4 +3,4 @@ https://github.com/xiangyuecn/Recorder src: recorder-core.js,engine/mp3.js,engine/mp3-engine.js */ -!function(y){"use strict";var v=function(){},V=function(e){return new t(e)};V.LM="2023-02-01 18:05";var T="Recorder",d="getUserMedia",O="srcSampleRate",N="sampleRate",x="catch";V.IsOpen=function(){var e=V.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},V.BufferSize=4096,V.Destroy=function(){for(var e in H(T+" Destroy"),S(),a)a[e]()};var a={};V.BindDestroy=function(e,t){a[e]=t},V.Support=function(){var e=navigator.mediaDevices||{};return e[d]||(e=navigator)[d]||(e[d]=e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia),!!e[d]&&(V.Scope=e,!!V.GetContext())},V.GetContext=function(){var e=y.AudioContext;return e||(e=y.webkitAudioContext),e?(V.Ctx&&"closed"!=V.Ctx.state||(V.Ctx=new e,V.BindDestroy("Ctx",function(){var e=V.Ctx;e&&e.close&&(e.close(),V.Ctx=0)})),V.Ctx):null};var E="ConnectEnableWebM";V[E]=!0;var P="ConnectEnableWorklet";V[P]=!1;var g=function(e,_){var l,i,f,c=e.BufferSize||V.BufferSize,h=V.Ctx,u=e.Stream,o=function(e){var t=u._m=h.createMediaStreamSource(u),a=h.destination,s="createMediaStreamDestination";h[s]&&(a=h[s]()),t.connect(e),e.connect(a)},m="",p=u._call,b=function(e){for(var t in p){for(var a=e.length,s=new Int16Array(a),n=0,r=0;r"+l,3);for(var f=0,c=r;c"+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("未采集到录音")}},y[T]&&(H("重复引入"+T,3),y[T].Destroy()),y[T]=V;var C=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(X(i,s),q(i,s),!D(X(i,s),[24,83,128,103]))return;for(X(i,s);s[0]=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;le.length)return;for(var i=0;i=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 "+s.duration+"ms",2>=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>=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=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>=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>1<<1);for(null!=a&&(a.sfb_count1=0);1t.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],ir)return x.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.max_nonzero_coeff&&(g=s.max_nonzero_coeff-_+1,ye.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&&0=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=_?n[f]:0}return this.noquant_count_bits(e,a,s)},this.best_huffman_divide=function(e,t){var a=new T,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[_]=x.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,fa.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;nf&&(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;as[t]&&(e.part2_length=s[t],e.scalefac_compress=t);return e.part2_length==x.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;_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;_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;)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>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<>a<>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;0t.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>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=Z.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 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),1e9e.PeakSample?e.PeakSample=_[0][o]:-_[0][o]>e.PeakSample&&(e.PeakSample=-_[0][o]);if(1e.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 y(){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 x(){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 T=2.220446049250313e-16,f=x.IXMAX_VAL+2,c=x.Q_MAX,h=x.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>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;t3*s/4&&(f[o]=3*s/4),f[o]<0&&(f[o]=0),f[o]+a[o]>Z.MAX_BITS_PER_CHANNEL&&(f[o]=Math.max(0,Z.MAX_BITS_PER_CHANNEL-a[o])),i+=f[o];if(hZ.MAX_BITS_PER_CHANNEL-e[0]&&(r=Z.MAX_BITS_PER_CHANNEL-e[0]),r<0&&(r=0),125<=e[1]&&(125>1,A=0;do{A+=k=f[o]*f[o],M+=k>1;S=d/b,M=T;do{var k,y;A+=k=f[o]*f[o],M+=ks[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>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,0a.max_noise-.2&&a.tot_noisea.max_noise-.2&&a.tot_noisea.max_noise-.1&&a.tot_noise+a.over_noisea.max_noise-.15&&a.tot_noise+a.over_noise+a.over_noiset.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))||(1e.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>t.scalefac_scale))n[s]=f,_+=3*l;else{n[s]=0;var c=210+(f<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,ye.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;iS&&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&&30r[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;nZ.MAX_BITS_PER_CHANNEL&&(s[o][_]=Z.MAX_BITS_PER_CHANNEL),m+=s[o][_]}if(Z.MAX_BITS_PER_GRANULEZ.MAX_BITS_PER_CHANNEL&&(s[o][_]=Z.MAX_BITS_PER_CHANNEL),l+=s[o][_];if(l>r[0])for(o=0;o=s?(e.ATH.adjust*=.075*s+.925,e.ATH.adjust=s?e.ATH.adjust=s:e.ATH.adjust>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)V[u+3-2]?Q/=V[u+3-2]:Q=V[u+3-2]>10*Q?V[u+3-2]/(10*Q):0,N[u+3]=Q}if(e.analysis){var W=N[0];for(u=1;u<12;u++)WC&&(q[u/3]=u%3+1);for(u=1;u<4;u++){(O[u-1]>O[u]?O[u-1]/O[u]:O[u]/O[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?y[c]=D:0==D&&(y[0]=y[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,x),v=0;v<3;v++){var J,$;for(ve(e,j,A,B,c,v),pe(S,A,B,c,v),b=0;b1.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;t1.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,0g&&(s[_]=g),1a[_]&&(s[_]=a[_]),l.masking_lower<1&&(s[_]*=l.masking_lower)}for(;_f&&(s[r]=f),1a[r]&&(s[r]=a[r]),e.masking_lower<1&&(s[r]*=e.masking_lower)}for(;rM[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],L=1;6*M[3*b+5]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!=Te.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var s=0;s=n&&(p=i*(l[t]-n)/(24-n)+r*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),0=n&&(p=_*(l[t]-n)/(24-n)+o*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),g=K.MAX_VALUE;for(v=0;va.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=v)for(l=0;le.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=t.lowpass2&&(a=Math.min(a,r)),t.lowpass1t.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==xe.vbr_off){if(e.free_format)n.bitrate_index=0;else if(e.brate=L(e.brate,e.version,e.out_samplerate),n.bitrate_index=I(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=f){var M=i-u;if(0==i&&(M=0),(o=V(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;li&&(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 ad&&(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}(); \ No newline at end of file +!function(k){"use strict";var v=function(){},V=function(e){return new t(e)};V.LM="2023-06-10 21:09";var y="Recorder",d="getUserMedia",O="srcSampleRate",N="sampleRate",T="catch";V.IsOpen=function(){var e=V.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},V.BufferSize=4096,V.Destroy=function(){for(var e in I(y+" Destroy"),S(),a)a[e]()};var a={};V.BindDestroy=function(e,t){a[e]=t},V.Support=function(){var e=navigator.mediaDevices||{};return e[d]||(e=navigator)[d]||(e[d]=e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia),!!e[d]&&(V.Scope=e,!!V.GetContext())},V.GetContext=function(){var e=k.AudioContext;return e||(e=k.webkitAudioContext),e?(V.Ctx&&"closed"!=V.Ctx.state||(V.Ctx=new e,V.BindDestroy("Ctx",function(){var e=V.Ctx;e&&e.close&&(e.close(),V.Ctx=0)})),V.Ctx):null};var x="ConnectEnableWebM";V[x]=!0;var E="ConnectEnableWorklet";V[E]=!1;var g=function(e,o){var l,a,f,c=e.BufferSize||V.BufferSize,h=V.Ctx,u=e.Stream,i=function(e){var t=u._m=h.createMediaStreamSource(u);t.connect(e),e.connect(h.destination)},m="",p=u._call,b=function(e){for(var t in p){for(var a=e.length,s=new Int16Array(a),n=0,r=0;r"+l,3);for(var f=0,c=r;c"+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[y]&&(I("重复引入"+y,3),k[y].Destroy()),k[y]=V;var H=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(Y(i,s),X(i,s),!C(Y(i,s),[24,83,128,103]))return;for(Y(i,s);s[0]=e.length)){var n=e[s],r=("0000000"+n.toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(r);if(i){var _=i[1].length,o=[];if(!(s+_>e.length)){for(var l=0;l<_;l++)o[l]=e[s],s++;return a&&(o[0]=parseInt(i[2]||"0",2)),t[0]=s,o}}}},X=function(e,t){var a=Y(e,t,1);if(a){var s=D(a),n=t[0],r=[];if(s<2147483647){if(n+s>e.length)return;for(var i=0;i=c.byteLength?(_-=c.byteLength,l.push(c),e.splice(f,1),f--):(e[f]=c.slice(_),o=c,_=0)}if(!this.rm(e,t)){o&&(e[0]=o);for(f=0;f "+s.duration+"ms",2>=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;_=a[s++]*t,o=a[s++]*t,c=0|_,l=a[s++]*t,h=0|o,f=a[s++]*t,u=0|l,_+=M.adj43[c],m=0|f,o+=M.adj43[h],n[r++]=0|_,l+=M.adj43[u],n[r++]=0|o,f+=M.adj43[m],n[r++]=0|l,n[r++]=0|f}0!=i&&(c=0|(_=a[s++]*t),h=0|(o=a[s++]*t),_+=M.adj43[c],o+=M.adj43[h],n[r++]=0|_,n[r++]=0|o)}var _=[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>=16)&&(_=r,s++),n.bits+=_,s}(e,t,a,_[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,_=0,o=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]*o+e[t+1];t+=2,r+=l[h],i+=f[h],_+=c[h]}while(t=n);r++);for(i=r-8;i<24&&!(F.ht[i].linmax>=n);i++);return function(e,t,a,s,n,r){var i,_=65536*F.ht[s].xlen+F.ht[n].xlen,o=0;do{var l=e[t++],f=e[t++];0!=l&&(14>=16)&&(o=i,s=n),r.bits+=o,s}(e,t,a,i,r,s)}}function u(e,t,a,s,n,r,i,_){for(var o=t.big_values,l=2;l>1<<1);for(null!=a&&(a.sfb_count1=0);1t.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],ir)return x.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(_=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((_||s.block_type==Pe.NORM_TYPE)&&(d=s.global_gain-(s.scalefac[r]+(0!=s.preflag?M.pretab[r]:0)<s.max_nonzero_coeff&&(g=s.max_nonzero_coeff-o+1,ye.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&&0=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],o+=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,_=a.global_gain+a.scalefac_scale,o=.634521682242439/M.IPOW20(_),l=0;l=o?n[f]:0}return this.noquant_count_bits(e,a,s)},this.best_huffman_divide=function(e,t){var a=new T,s=t.l3_enc,n=Ae(23),r=Ae(23),i=Ae(23),_=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 _=t.big_values,o=0;o<=22;o++)s[o]=x.LARGE_BITS;for(o=0;o<16;o++){var l=e.scalefac_band.l[o+1];if(_<=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[o+u+2];if(_<=m)break;var p=f,b=d(a,l,m,c=new v(p));p=c.bits,s[o+u]>p&&(s[o+u]=p,r[(n[o+u]=o)+u]=h,i[o+u]=b)}}}(e,t,s,n,r,i,_),u(e,a,t,s,n,r,i,_));var o=a.big_values;if(!(0==o||1<(s[o-2]|s[o-1])||576<(o=t.count1+2))){a.assign(t),a.count1=o;for(var l=0,f=0;o>a.big_values;o-=4){var c=2*(2*(2*s[o-4]+s[o-3])+s[o-2])+s[o-1];l+=F.t32l[c],f+=F.t33l[c]}if(a.big_values=o,a.count1table_select=0,fa.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>=1);o.scalefac_scale=l=1}}if(0==o.preflag&&o.block_type!=Pe.SHORT_TYPE&&2==e.mode_gr){for(n=11;nf&&(s.part2_length=f,s.scalefac_compress=r)}}(a,s),l=0),n=0;ns[t]&&(e.part2_length=s[t],e.scalefac_compress=t);return e.part2_length==x.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,o=0;o<4;o++)f[o]=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,o=0;of[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],o=0;of[n]&&(f[n]=c[l])}for(_=!1,n=0;n<4;n++)f[n]>g[a][n]&&(_=!0);if(!_){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(!_)for(n=t.part2_length=0;n<4;n++)t.part2_length+=t.slen[n]*t.sfb_partition_table[n];return _};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;)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 _=[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>8^_[255&(i^r)]);var r,i}}function q(){var o=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<>a<>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;0t.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>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=Z.MAX_HEADER_BUF-1),t=s.l3_side,!((a=R(e,new w))<0)){if(_(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 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),1e9e.PeakSample?e.PeakSample=o[0][_]:-o[0][_]>e.PeakSample&&(e.PeakSample=-o[0][_]);if(1e.PeakSample?e.PeakSample=o[1][_]:-o[1][_]>e.PeakSample&&(e.PeakSample=-o[1][_])}if(e.findReplayGain&&c.AnalyzeSamples(e.rgdata,o[0],0,o[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 y(){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 x(){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 T=2.220446049250313e-16,f=x.IXMAX_VAL+2,c=x.Q_MAX,h=x.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,_=0;_>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),_=i*Math.pow(10,t/4/10),t=0;t3*s/4&&(f[_]=3*s/4),f[_]<0&&(f[_]=0),f[_]+a[_]>Z.MAX_BITS_PER_CHANNEL&&(f[_]=Math.max(0,Z.MAX_BITS_PER_CHANNEL-a[_])),i+=f[_];if(hZ.MAX_BITS_PER_CHANNEL-e[0]&&(r=Z.MAX_BITS_PER_CHANNEL-e[0]),r<0&&(r=0),125<=e[1]&&(125>1,A=0;do{A+=k=f[_]*f[_],M+=k>1;S=d/b,M=T;do{var k,y;A+=k=f[_]*f[_],M+=ks[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 o},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--;){o=e.xr[r],r++,n+=o*o,o=e.xr[r],r++,n+=o*o}else if(r>e.big_values){var _=Be(2);for(_[0]=0,_[1]=s;0!=a--;){o=Math.abs(e.xr[r])-_[i[r]],r++,n+=o*o,o=Math.abs(e.xr[r])-_[i[r]],r++,n+=o*o}}else for(;0!=a--;){var o;o=Math.abs(e.xr[r])-p[i[r]]*s,r++,n+=o*o,o=Math.abs(e.xr[r])-p[i[r]]*s,r++,n+=o*o}return t.s=r,n},this.calc_noise=function(e,t,a,s,n){var r,i,_=0,o=0,l=0,f=0,c=0,h=-20,u=0,m=e.scalefac,p=0;for(r=s.over_SSD=0;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[_++]=d/t[o++],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,0a.max_noise-.2&&a.tot_noisea.max_noise-.2&&a.tot_noisea.max_noise-.1&&a.tot_noise+a.over_noisea.max_noise-.15&&a.tot_noise+a.over_noise+a.over_noiset.xrpow_max&&(t.xrpow_max=s[f+c]);if(2==i.noise_shaping_amp)return}}}(e,t,a,s,n);var i=_(t);return!i&&(!(i=2==r.mode_gr?w.scale_bitcount(t):w.scale_bitcount_lsf(r,t))||(1e.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>t.scalefac_scale))n[s]=f,o+=3*l;else{n[s]=0;var c=210+(f<t.xrpow_max&&(t.xrpow_max=a[o+h]);o+=l*(3-r-1)}}var u=M.IPOW20(202);for(o+=t.width[s]*(r+1),h=-t.width[s];h<0;h++)a[o+h]*=u,a[o+h]>t.xrpow_max&&(t.xrpow_max=a[o+h])}}return!1}(r,t,s)||_(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,ye.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;iS&&_.global_gain<=g;)_.global_gain++;if(_.global_gain>g)break;if(0==f.over_count){for(;(_.part2_3_length=w.count_bits(i,s,_,c))>h&&_.global_gain<=g;)_.global_gain++;if(_.global_gain>g)break}if(M.calc_noise(_,a,l,d,c),d.bits=_.part2_3_length,0!=(A(t.block_type!=Pe.SHORT_TYPE?e.quant_comp:e.quant_comp_short,f,d,_,l)?1:0))h=t.part2_3_length,f=d,t.assign(_),b=0,$.arraycopy(s,0,o,0,576);else if(0==i.full_outer_loop){if(++b>v&&0==f.over_count)break;if(3==i.noise_shaping_amp&&m&&30r[f.VBR_max_bitrate]&&(_[p][v]*=r[f.VBR_max_bitrate],_[p][v]/=u),i[p][v]>_[p][v]&&(i[p][v]=_[p][v]);return h},this.bitpressure_strategy=function(e,t,a,s){for(var n=0;nZ.MAX_BITS_PER_CHANNEL&&(s[_][o]=Z.MAX_BITS_PER_CHANNEL),m+=s[_][o]}if(Z.MAX_BITS_PER_GRANULEZ.MAX_BITS_PER_CHANNEL&&(s[_][o]=Z.MAX_BITS_PER_CHANNEL),l+=s[_][o];if(l>r[0])for(_=0;_=s?(e.ATH.adjust*=.075*s+.925,e.ATH.adjust=s?e.ATH.adjust=s:e.ATH.adjust>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)<_;);for(l=y[i+0],o=y[i+1],f=1;fV[u+3-2]?Q/=V[u+3-2]:Q=V[u+3-2]>10*Q?V[u+3-2]/(10*Q):0,N[u+3]=Q}if(e.analysis){var W=N[0];for(u=1;u<12;u++)WC&&(q[u/3]=u%3+1);for(u=1;u<4;u++){(O[u-1]>O[u]?O[u-1]/O[u]:O[u]/O[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?y[c]=D:0==D&&(y[0]=y[1]=0),o[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,x),v=0;v<3;v++){var J,$;for(ve(e,j,A,B,c,v),pe(S,A,B,c,v),b=0;b1.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;t1.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,0g&&(s[o]=g),1a[o]&&(s[o]=a[o]),l.masking_lower<1&&(s[o]*=l.masking_lower)}for(;of&&(s[r]=f),1a[r]&&(s[r]=a[r]),e.masking_lower<1&&(s[r]*=e.masking_lower)}for(;rM[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],L=1;6*M[3*b+5]B&&(o[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&&o[m][0]<=o[m][b]&&(o[m][0]=0),o[m][b]=0)}o[m][0]<=c.nsPsy.lastAttacks[m]&&(o[m][0]=0),3!=c.nsPsy.lastAttacks[m]&&o[m][0]+o[m][1]+o[m][2]+o[m][3]==0||((k=0)!=o[m][1]&&0!=o[m][0]&&(o[m][1]=0),0!=o[m][2]&&0!=o[m][1]&&(o[m][2]=0),0!=o[m][3]&&0!=o[m][2]&&(o[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,o,w,R,A),function(e,t){var a=e.internal_flags;e.short_blocks!=Te.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var s=0;s=n&&(p=i*(l[t]-n)/(24-n)+r*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),0=n&&(p=o*(l[t]-n)/(24-n)+_*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),g=K.MAX_VALUE;for(v=0;va.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=v)for(l=0;le.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=t.lowpass2&&(a=Math.min(a,r)),t.lowpass1t.highpass1?E((t.highpass2-l)/(t.highpass2-t.highpass1+1e-20)):1,o=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==xe.vbr_off){if(e.free_format)n.bitrate_index=0;else if(e.brate=L(e.brate,e.version,e.out_samplerate),n.bitrate_index=I(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=f){var M=i-u;if(0==i&&(M=0),(_=V(e,m[0],m[1],n,r,M))<0)return _;for(r+=_,u+=_,h.mf_size-=e.framesize,h.mf_samples_to_encode-=e.framesize,l=0;li&&(s.ResvMax=i),(s.ResvMax<0||e.disable_reservoir)&&(s.ResvMax=0);var _=t.bits*s.mode_gr+Math.min(s.ResvSize,s.ResvMax);return a<_&&(_=a),n.resvDrain_pre=0,null!=s.pinfo&&(s.pinfo.mean_bits=t.bits/2,s.pinfo.resvsize=s.ResvSize),_},this.ResvMaxBits=function(e,t,a,s){var n,r=e.internal_flags,i=r.ResvSize,_=r.ResvMax;0!=s&&(i+=t),0!=(1&r.substep_shaping)&&(_*=.9),a.bits=t,9*_<10*i?(n=i-9*_/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 o=i<6*r.ResvMax/10?i:6*r.ResvMax/10;return(o-=n)<0&&(o=0),o},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),_.setModules(n),l.setModules(i,u,o,m),o.setModules(m,u,n.enc.psy),u.setModules(i),m.setModules(o),f.setModules(n,i,c),a.setModules(p,b),p.setModules(c,h,_);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}(); \ No newline at end of file diff --git a/recorder.wav.min.js b/recorder.wav.min.js index 8e94bda..de3fc2b 100644 --- a/recorder.wav.min.js +++ b/recorder.wav.min.js @@ -3,4 +3,4 @@ https://github.com/xiangyuecn/Recorder src: recorder-core.js,engine/wav.js */ -!function(I){"use strict";var d=function(){},U=function(e){return new t(e)};U.LM="2023-02-01 18:05";var A="Recorder",C="getUserMedia",P="srcSampleRate",W="sampleRate",L="catch";U.IsOpen=function(){var e=U.Stream;if(e){var t=e.getTracks&&e.getTracks()||e.audioTracks||[],n=t[0];if(n){var r=n.readyState;return"live"==r||r==n.LIVE}}return!1},U.BufferSize=4096,U.Destroy=function(){for(var e in O(A+" Destroy"),S(),n)n[e]()};var n={};U.BindDestroy=function(e,t){n[e]=t},U.Support=function(){var e=navigator.mediaDevices||{};return e[C]||(e=navigator)[C]||(e[C]=e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia),!!e[C]&&(U.Scope=e,!!U.GetContext())},U.GetContext=function(){var e=I.AudioContext;return e||(e=I.webkitAudioContext),e?(U.Ctx&&"closed"!=U.Ctx.state||(U.Ctx=new e,U.BindDestroy("Ctx",function(){var e=U.Ctx;e&&e.close&&(e.close(),U.Ctx=0)})),U.Ctx):null};var T="ConnectEnableWebM";U[T]=!0;var D="ConnectEnableWorklet";U[D]=!1;var y=function(e,c){var f,i,u,l=e.BufferSize||U.BufferSize,v=U.Ctx,p=e.Stream,s=function(e){var t=p._m=v.createMediaStreamSource(p),n=v.destination,r="createMediaStreamDestination";v[r]&&(n=v[r]()),t.connect(e),e.connect(n)},h="",g=p._call,m=function(e){for(var t in g){for(var n=e.length,r=new Int16Array(n),a=0,o=0;o"+f,3);for(var u=0,l=o;l"+d.length+" 花:"+(Date.now()-r)+"ms"),setTimeout(function(){r=Date.now(),a[o.type](d,function(e){u(e,g)},function(e){f(e)})})}else f("未加载"+o.type+"编码器");else f("音频buffers被释放");else f("未采集到录音")}},I[A]&&(O("重复引入"+A,3),I[A].Destroy()),I[A]=U;var z=function(e,t){t.pos||(t.pos=[0],t.tracks={},t.bytes=[]);var n=t.tracks,r=[t.pos[0]],a=function(){t.pos[0]=r[0]},o=t.bytes.length,i=new Uint8Array(o+e.length);if(i.set(t.bytes),i.set(e,o),t.bytes=i,!t._ht){if(N(i,r),G(i,r),!E(N(i,r),[24,83,128,103]))return;for(N(i,r);r[0]=e.length)){var a=e[r],o=("0000000"+a.toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(o);if(i){var s=i[1].length,c=[];if(!(r+s>e.length)){for(var f=0;fe.length)return;for(var i=0;i>8);f.setInt8(u,g,!0)}else for(h=0;h"+c,3);for(var u=0,l=o;l"+m.length+" 花:"+(Date.now()-r)+"ms"),setTimeout(function(){r=Date.now(),a[o.type](m,function(e){u(e,g)},function(e){c(e)})})}else c("未加载"+o.type+"编码器");else c("音频buffers被释放");else c("未采集到录音")}},x[I]&&(F("重复引入"+I,3),x[I].Destroy()),x[I]=U;var O=function(e,t){t.pos||(t.pos=[0],t.tracks={},t.bytes=[]);var n=t.tracks,r=[t.pos[0]],a=function(){t.pos[0]=r[0]},o=t.bytes.length,i=new Uint8Array(o+e.length);if(i.set(t.bytes),i.set(e,o),t.bytes=i,!t._ht){if(B(i,r),N(i,r),!z(B(i,r),[24,83,128,103]))return;for(B(i,r);r[0]=e.length)){var a=e[r],o=("0000000"+a.toString(2)).substr(-8),i=/^(0*1)(\d*)$/.exec(o);if(i){var s=i[1].length,f=[];if(!(r+s>e.length)){for(var c=0;ce.length)return;for(var i=0;i>8);c.setInt8(u,g,!0)}else for(h=0;h