/* 录音 https://github.com/xiangyuecn/Recorder src: recorder-core.js,engine/wav.js */ !function(e){var t="object"==typeof window&&!!window.document,r=t?window:Object;!function(e,w){"use strict";var y=function(){},u=function(e){return"number"==typeof e},F=function(e){return new f(e)},b=F.LM="2024-04-09 19:15",S="https://github.com/xiangyuecn/Recorder",k="Recorder",x="getUserMedia",U="srcSampleRate",G="sampleRate",i="bitRate",I="catch",t=e[k];if(t&&t.LM==b)return t.CLog(t.i18n.$T("K8zP::重复导入{1}",0,k),3);F.IsOpen=function(){var e=F.Stream;if(e){var t=e.getTracks&&e.getTracks()||e.audioTracks||[],r=t[0];if(r){var n=r.readyState;return"live"==n||n==r.LIVE}}return!1},F.BufferSize=4096,F.Destroy=function(){for(var e in N(k+" Destroy"),D(),r)r[e]()};var r={};F.BindDestroy=function(e,t){r[e]=t},F.Support=function(){if(!w)return!1;var e=navigator.mediaDevices||{};return e[x]||(e=navigator)[x]||(e[x]=e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia),!!e[x]&&(F.Scope=e,!!F.GetContext())},F.GetContext=function(e){if(!w)return null;var t=window.AudioContext;if(t||(t=window.webkitAudioContext),!t)return null;var r=F.Ctx;if(r&&"closed"!=r.state||(r=F.Ctx=new t,F.NewCtxs=F.NewCtxs||[],F.BindDestroy("Ctx",function(){var e=F.Ctx;e&&e.close&&(a(e),F.Ctx=0);var t=F.NewCtxs;F.NewCtxs=[];for(var r=0;r"+p),3);for(var h=0,g=i;g"+m.length,Date.now()-v)),setTimeout(function(){v=Date.now(),p[h.type](m,function(e,t){a(e,t,f)},function(e){d(e)})})}else d(V("xkKd::音频buffers被释放"))}else d(V("xGuI::未加载{1}编码器,请尝试到{2}的src/engine内找到{1}的编码器并加载",0,h.type,k));else d(V("Ltz3::未采集到录音"))}};var z=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(P(i,n),B(i,n),!E(P(i,n),[24,83,128,103]))return;for(P(i,n);n[0]32 bit",3)),x[G]!=t[G]||32!=x.bitDepth||x.channels<1||!/(\b|_)PCM\b/i.test(x.codec))return t.bytes=[],t.bad||N("WebM Track Unexpected",3,t),-(t.bad=1);for(var M=[],k=0;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;ia.length)&&(e="{?}",N("i18n["+n+"] no {"+t+"}: "+o,3)),r?"":e})):"en"==e?$.v_G(n,a,"zh"):$.v_G(n,a,"en")},$T:function(){return $.v_T.apply(null,arguments)},v_T:function(){for(var e,t=arguments,r="",n=[],a=0,o=k+".i18n.$T:",i=/^([\w\-]*):/,s=0;s>8);u[f++]=v}else(u=new Int16Array(u.buffer)).set(e,f/2);t(u.buffer,"audio/wav")},p.wav_header=function(e,t,r,n,a){var o=1==e?0:2,i=new ArrayBuffer(44+o),s=new DataView(i),c=0,f=function(e){for(var t=0;t