mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-02 17:48:34 +01:00
2 lines
19 KiB
JavaScript
2 lines
19 KiB
JavaScript
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var f,a=[],c=!1,l=-1;function p(){c&&f&&(c=!1,f.length?a=f.concat(a):l=-1,a.length&&h())}function h(){if(!c){var e=s(p);c=!0;for(var t=a.length;t;){for(f=a,a=[];++l<t;)f&&f[l].run();l=-1,t=a.length}f=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];a.push(new d(e,t)),1!==a.length||c||s(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}t.resolve=function(){for(var t="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var u=o>=0?arguments[o]:e.cwd();if("string"!=typeof u)throw new TypeError("Arguments to path.resolve must be strings");u&&(t=u+"/"+t,i="/"===u.charAt(0))}return(i?"/":"")+(t=n(r(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var o=t.isAbsolute(e),u="/"===i(e,-1);return(e=n(r(e.split("/"),(function(e){return!!e})),!o).join("/"))||o||(e="."),e&&u&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),u=Math.min(i.length,o.length),s=u,f=0;f<u;f++)if(i[f]!==o[f]){s=f;break}var a=[];for(f=s;f<i.length;f++)a.push("..");return(a=a.concat(o.slice(s))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,i=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=function(e){"string"!=typeof e&&(e+="");var t,n=0,r=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){n=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":e.slice(n,r)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,o=0,u=e.length-1;u>=0;--u){var s=e.charCodeAt(u);if(47!==s)-1===r&&(i=!1,r=u+1),46===s?-1===t?t=u:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=u+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)};var i="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(0))},function(e,t,n){(function(t,r){var i=void 0!==i?i:{};"undefined"!=typeof self&&self,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){(function(t){var n,r,o=new Promise((function(e){r=e}));t.onmessage=function(e){o.then((function(){switch(e.data.command){case"decode":n&&n.decode(e.data.pages);break;case"done":n&&(n.sendLastBuffer(),t.close());break;case"init":n=new u(e.data,i)}}))};var u=function(e,t){if(!t)throw new Error("Module with exports required to initialize a decoder instance");this.mainReady=o,this.config=Object.assign({bufferLength:4096,decoderSampleRate:48e3,outputBufferSampleRate:48e3,resampleQuality:3},e),this._opus_decoder_create=t._opus_decoder_create,this._opus_decoder_destroy=t._opus_decoder_destroy,this._speex_resampler_process_interleaved_float=t._speex_resampler_process_interleaved_float,this._speex_resampler_init=t._speex_resampler_init,this._speex_resampler_destroy=t._speex_resampler_destroy,this._opus_decode_float=t._opus_decode_float,this._free=t._free,this._malloc=t._malloc,this.HEAPU8=t.HEAPU8,this.HEAP16=t.HEAP16,this.HEAP32=t.HEAP32,this.HEAPF32=t.HEAPF32,this.outputBuffers=[]};u.prototype.decode=function(e){var t=new DataView(e.buffer),n=this.getPageBoundaries(t),r=n.length-1;n.map((function(n,i){var o=t.getUint8(n+5,!0),u=t.getUint32(n+18,!0);if(2&o&&(this.numberOfChannels=t.getUint8(n+37,!0),this.init()),u>1){for(var s=t.getUint8(n+26,!0),f=n+27+s,a=0;a<s;a++){var c=t.getUint8(n+27+a,!0);if(this.decoderBuffer.set(e.subarray(f,f+=c),this.decoderBufferIndex),this.decoderBufferIndex+=c,c<255){var l=this._opus_decode_float(this.decoder,this.decoderBufferPointer,this.decoderBufferIndex,this.decoderOutputPointer,this.decoderOutputMaxLength,0),p=Math.ceil(l*this.config.outputBufferSampleRate/this.config.decoderSampleRate);this.HEAP32[this.decoderOutputLengthPointer>>2]=l,this.HEAP32[this.resampleOutputLengthPointer>>2]=p,this._speex_resampler_process_interleaved_float(this.resampler,this.decoderOutputPointer,this.decoderOutputLengthPointer,this.resampleOutputBufferPointer,this.resampleOutputLengthPointer),this.sendToOutputBuffers(this.HEAPF32.subarray(this.resampleOutputBufferPointer>>2,(this.resampleOutputBufferPointer>>2)+p*this.numberOfChannels)),this.decoderBufferIndex=0}}(4&o||i==r)&&this.sendLastBuffer()}}),this)},u.prototype.getPageBoundaries=function(e){for(var t=[],n=0;n<e.byteLength-32;n++)1399285583==e.getUint32(n,!0)&&t.push(n);return t},u.prototype.init=function(){this.resetOutputBuffers(),this.initCodec(),this.initResampler()},u.prototype.initCodec=function(){this.decoder&&(this._opus_decoder_destroy(this.decoder),this._free(this.decoderBufferPointer),this._free(this.decoderOutputLengthPointer),this._free(this.decoderOutputPointer));var e=this._malloc(4);this.decoder=this._opus_decoder_create(this.config.decoderSampleRate,this.numberOfChannels,e),this._free(e),this.decoderBufferMaxLength=4e3,this.decoderBufferPointer=this._malloc(this.decoderBufferMaxLength),this.decoderBuffer=this.HEAPU8.subarray(this.decoderBufferPointer,this.decoderBufferPointer+this.decoderBufferMaxLength),this.decoderBufferIndex=0,this.decoderOutputLengthPointer=this._malloc(4),this.decoderOutputMaxLength=this.config.decoderSampleRate*this.numberOfChannels*120/1e3,this.decoderOutputPointer=this._malloc(4*this.decoderOutputMaxLength)},u.prototype.initResampler=function(){this.resampler&&(this._speex_resampler_destroy(this.resampler),this._free(this.resampleOutputLengthPointer),this._free(this.resampleOutputBufferPointer));var e=this._malloc(4);this.resampler=this._speex_resampler_init(this.numberOfChannels,this.config.decoderSampleRate,this.config.outputBufferSampleRate,this.config.resampleQuality,e),this._free(e),this.resampleOutputLengthPointer=this._malloc(4),this.resampleOutputMaxLength=Math.ceil(this.decoderOutputMaxLength*this.config.outputBufferSampleRate/this.config.decoderSampleRate),this.resampleOutputBufferPointer=this._malloc(4*this.resampleOutputMaxLength)},u.prototype.resetOutputBuffers=function(){this.outputBuffers=[],this.outputBufferArrayBuffers=[],this.outputBufferIndex=0;for(var e=0;e<this.numberOfChannels;e++)this.outputBuffers.push(new Float32Array(this.config.bufferLength)),this.outputBufferArrayBuffers.push(this.outputBuffers[e].buffer)},u.prototype.sendLastBuffer=function(){this.sendToOutputBuffers(new Float32Array((this.config.bufferLength-this.outputBufferIndex)*this.numberOfChannels)),t.postMessage(null)},u.prototype.sendToOutputBuffers=function(e){for(var n=0,r=e.length/this.numberOfChannels;n<r;){var i=Math.min(r-n,this.config.bufferLength-this.outputBufferIndex);if(1===this.numberOfChannels)this.outputBuffers[0].set(e.subarray(n,n+i),this.outputBufferIndex);else for(var o=0;o<i;o++)this.outputBuffers.forEach((function(t,r){t[this.outputBufferIndex+o]=e[(n+o)*this.numberOfChannels+r]}),this);n+=i,this.outputBufferIndex+=i,this.outputBufferIndex==this.config.bufferLength&&(t.postMessage(this.outputBuffers,this.outputBufferArrayBuffers),this.resetOutputBuffers())}},i||(i={}),i.mainReady=o,i.OggOpusDecoder=u,i.onRuntimeInitialized=r,e.exports=i}).call(this,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n}]);var o,u={};for(o in i)i.hasOwnProperty(o)&&(u[o]=i[o]);var s=[],f=!1,a=!1,c=!1,l=!1;f="object"==typeof window,a="function"==typeof importScripts,c="object"==typeof t&&"object"==typeof t.versions&&"string"==typeof t.versions.node,l=!f&&!c&&!a;var p,h,d,m,y="";function g(e){return i.locateFile?i.locateFile(e,y):y+e}c?(y=a?n(1).dirname(y)+"/":r+"/",p=function(e,t){return d||(d=n(3)),m||(m=n(1)),e=m.normalize(e),d.readFileSync(e,t?null:"utf8")},h=function(e){var t=p(e,!0);return t.buffer||(t=new Uint8Array(t)),O(t.buffer),t},t.argv.length>1&&t.argv[1].replace(/\\/g,"/"),s=t.argv.slice(2),e.exports=i,t.on("uncaughtException",(function(e){if(!(e instanceof ve))throw e})),t.on("unhandledRejection",Z),function(e){t.exit(e)},i.inspect=function(){return"[Emscripten Module object]"}):l?("undefined"!=typeof read&&(p=function(e){return read(e)}),h=function(e){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(O("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?s=scriptArgs:void 0!==arguments&&(s=arguments),"function"==typeof quit&&function(e){quit(e)},"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(f||a)&&(a?y=self.location.href:document.currentScript&&(y=document.currentScript.src),y=0!==y.indexOf("blob:")?y.substr(0,y.lastIndexOf("/")+1):"",p=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},a&&(h=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)});var _,b,v=i.print||console.log.bind(console),w=i.printErr||console.warn.bind(console);for(o in u)u.hasOwnProperty(o)&&(i[o]=u[o]);u=null,i.arguments&&(s=i.arguments),i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(_=i.wasmBinary),i.noExitRuntime&&i.noExitRuntime,"object"!=typeof WebAssembly&&w("no native wasm support detected");var x=new WebAssembly.Table({initial:9,maximum:9,element:"anyfunc"}),A=!1;function O(e,t){e||Z("Assertion failed: "+t)}var P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function B(e,t,n){for(var r=t+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.subarray&&P)return P.decode(e.subarray(t,i));for(var o="";t<i;){var u=e[t++];if(128&u){var s=63&e[t++];if(192!=(224&u)){var f=63&e[t++];if((u=224==(240&u)?(15&u)<<12|s<<6|f:(7&u)<<18|s<<12|f<<6|63&e[t++])<65536)o+=String.fromCharCode(u);else{var a=u-65536;o+=String.fromCharCode(55296|a>>10,56320|1023&a)}}else o+=String.fromCharCode((31&u)<<6|s)}else o+=String.fromCharCode(u)}return o}function R(e,t){return e?B(S,e,t):""}var E,S,T,L=65536;function M(e){E=e,i.HEAP8=new Int8Array(e),i.HEAP16=new Int16Array(e),i.HEAP32=T=new Int32Array(e),i.HEAPU8=S=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAPU32=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=new Float64Array(e)}var I=5283024,j=39984,C=i.INITIAL_MEMORY||16777216;function H(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?i.dynCall_v(n):i.dynCall_vi(n,t.arg):n(void 0===t.arg?null:t.arg)}else t(i)}}(b=i.wasmMemory?i.wasmMemory:new WebAssembly.Memory({initial:C/L,maximum:C/L}))&&(E=b.buffer),C=E.byteLength,M(E),T[j>>2]=I;var U=[],W=[],k=[],F=[];function q(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)X(i.preRun.shift());H(U)}function D(){!0,H(W)}function z(){H(k)}function G(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)N(i.postRun.shift());H(F)}function X(e){U.unshift(e)}function N(e){F.unshift(e)}var Q=0,V=null,Y=null;function J(e){Q++,i.monitorRunDependencies&&i.monitorRunDependencies(Q)}function K(e){if(Q--,i.monitorRunDependencies&&i.monitorRunDependencies(Q),0==Q&&(null!==V&&(clearInterval(V),V=null),Y)){var t=Y;Y=null,t()}}function Z(e){throw i.onAbort&&i.onAbort(e),v(e+=""),w(e),A=!0,1,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(e)}function $(e,t){return String.prototype.startsWith?e.startsWith(t):0===e.indexOf(t)}i.preloadedImages={},i.preloadedAudios={};var ee="data:application/octet-stream;base64,";function te(e){return $(e,ee)}var ne="file://";function re(e){return $(e,ne)}var ie="decoderWorker.min.wasm";function oe(){try{if(_)return new Uint8Array(_);if(h)return h(ie);throw"both async and sync fetching of the wasm failed"}catch(e){Z(e)}}function ue(){return _||!f&&!a||"function"!=typeof fetch||re(ie)?new Promise((function(e,t){e(oe())})):fetch(ie,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+ie+"'";return e.arrayBuffer()})).catch((function(){return oe()}))}function se(){var e={a:ye};function t(e,t){var n=e.exports;i.asm=n,K()}function n(e){t(e.instance)}function r(t){return ue().then((function(t){return WebAssembly.instantiate(t,e)})).then(t,(function(e){w("failed to asynchronously prepare wasm: "+e),Z(e)}))}if(J(),i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(e){return w("Module.instantiateWasm callback failed with error: "+e),!1}return function(){if(_||"function"!=typeof WebAssembly.instantiateStreaming||te(ie)||re(ie)||"function"!=typeof fetch)return r(n);fetch(ie,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(n,(function(e){w("wasm streaming compile failed: "+e),w("falling back to ArrayBuffer instantiation"),r(n)}))}))}(),{}}function fe(){Z()}function ae(e,t,n){S.copyWithin(e,t,t+n)}function ce(e){Z("OOM")}function le(e){ce()}te(ie)||(ie=g(ie)),W.push({func:function(){be()}});var pe={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var n=pe.buffers[e];0===t||10===t?((1===e?v:w)(B(n,0)),n.length=0):n.push(t)},varargs:void 0,get:function(){return pe.varargs+=4,T[pe.varargs-4>>2]},getStr:function(e){return R(e)},get64:function(e,t){return e}};function he(e){return 0}function de(e,t,n,r,i){}function me(e,t,n,r){for(var i=0,o=0;o<n;o++){for(var u=T[t+8*o>>2],s=T[t+(8*o+4)>>2],f=0;f<s;f++)pe.printChar(e,S[u+f]);i+=s}return T[r>>2]=i,0}var ye={c:fe,e:ae,f:le,d:he,b:de,a:me,memory:b,table:x},ge=se();i.asm=ge;var _e,be=i.___wasm_call_ctors=function(){return(be=i.___wasm_call_ctors=i.asm.g).apply(null,arguments)};i._opus_decoder_create=function(){return(i._opus_decoder_create=i.asm.h).apply(null,arguments)},i._opus_decode_float=function(){return(i._opus_decode_float=i.asm.i).apply(null,arguments)},i._opus_decoder_destroy=function(){return(i._opus_decoder_destroy=i.asm.j).apply(null,arguments)},i._speex_resampler_init=function(){return(i._speex_resampler_init=i.asm.k).apply(null,arguments)},i._speex_resampler_destroy=function(){return(i._speex_resampler_destroy=i.asm.l).apply(null,arguments)},i._speex_resampler_process_interleaved_float=function(){return(i._speex_resampler_process_interleaved_float=i.asm.m).apply(null,arguments)},i._malloc=function(){return(i._malloc=i.asm.n).apply(null,arguments)},i._free=function(){return(i._free=i.asm.o).apply(null,arguments)};function ve(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function we(e){function t(){_e||(_e=!0,i.calledRun=!0,A||(D(),z(),i.onRuntimeInitialized&&i.onRuntimeInitialized(),G()))}e=e||s,Q>0||(q(),Q>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),t()}),1)):t()))}if(i.asm=ge,Y=function e(){_e||we(),_e||(Y=e)},i.run=we,i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();we()}).call(this,n(0),"/")},function(e,t){}]);
|
|
//# sourceMappingURL=64f200b5f81026a4c348.worker.js.map
|