import*as WasmDis from'../third_party/wasmparser/WasmDis.js';import*as WasmParser from'../third_party/wasmparser/WasmParser.js';self.onmessage=async function(event){const method=(event.data.method);const params=(event.data.params);if(!method||method!=='disassemble'){return;}
const response=await fetch(`data:application/wasm;base64,${params.content}`);const buffer=await response.arrayBuffer();const data=new Uint8Array(buffer);const parser=new WasmParser.BinaryReader();parser.setData(data,0,data.length);const dis=new WasmDis.WasmDisassembler();dis.addOffsets=true;dis.maxLines=1000000;dis.disassembleChunk(parser);const result=dis.getResult();this.postMessage({source:result.lines.join('\n'),offsets:result.offsets});};self.WasmParserWorker=self.WasmParserWorker||{};WasmParserWorker=WasmParserWorker||{};