mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-15 02:37:17 +01:00
1 line
1.7 KiB
JavaScript
1 line
1.7 KiB
JavaScript
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){importScripts("webp_wasm.js"),Module.onRuntimeInitialized=async()=>{self.postMessage({type:"initialized"})},self.onmessage=e=>{const{id:t,blob:r}=e.data,n=new FileReader;n.addEventListener("loadend",()=>{const e=n.result,r=e.byteLength,o=Module._malloc(r);Module.HEAPU8.set(new Uint8Array(e),o);const u=Module.cwrap("getInfo","number",["number","number"])(o,r);if(!!!Module.getValue(u,"i32"))return Module._free(u),Module._free(o),void self.postMessage({type:"result",id:t,width:0,height:0,result:null});const l=Module.getValue(u+4,"i32"),i=Module.getValue(u+8,"i32");Module._free(u);const d=Module.cwrap("decode","number",["number","number"])(o,r),a=new Uint8Array(Module.HEAPU8.buffer,d,l*i*4),s=new Uint8ClampedArray(a);Module._free(d),Module._free(o),self.postMessage({type:"result",id:t,width:l,height:i,result:s})}),n.readAsArrayBuffer(r)}}]); |