gy-roslib
Version:
gy
1 lines • 1.15 kB
JavaScript
var initWasm=async(_0x528fc9={},_0x509a82)=>{let _0x2a61ec;if(_0x509a82['startsWith']('data:')){const _0x2565bf=_0x509a82['replace'](/^data:.*?base64,/,'');let _0x2cdf19;if(typeof Buffer==='function'&&typeof Buffer['from']==='function')_0x2cdf19=Buffer['from'](_0x2565bf,'base64');else{if(typeof atob==='function'){const _0x3b3e04=atob(_0x2565bf);_0x2cdf19=new Uint8Array(_0x3b3e04['length']);for(let _0x156271=0x0;_0x156271<_0x3b3e04['length'];_0x156271++){_0x2cdf19[_0x156271]=_0x3b3e04['charCodeAt'](_0x156271);}}else throw new Error('Failed\x20to\x20decode\x20base64-encoded\x20data\x20URL,\x20Buffer\x20and\x20atob\x20are\x20not\x20supported');}_0x2a61ec=await WebAssembly['instantiate'](_0x2cdf19,_0x528fc9);}else{const _0x2e49e8=await fetch(_0x509a82),_0x55e655=_0x2e49e8['headers']['get']('Content-Type')||'';if('instantiateStreaming'in WebAssembly&&_0x55e655['startsWith']('application/wasm'))_0x2a61ec=await WebAssembly['instantiateStreaming'](_0x2e49e8,_0x528fc9);else{const _0x3a976e=await _0x2e49e8['arrayBuffer']();_0x2a61ec=await WebAssembly['instantiate'](_0x3a976e,_0x528fc9);}}return _0x2a61ec['instance'];};export{initWasm as i};