const sqlite3InitModuleState = globalThis.sqlite3InitModuleState
|| Object.assign(Object.create(null),{
debugModule: ()=>{}
});
delete globalThis.sqlite3InitModuleState;
sqlite3InitModuleState.debugModule('globalThis.location =',globalThis.location);
Module['locateFile'] = function(path, prefix) {
return new URL(path, import.meta.url).href;
'use strict';
let theFile;
const up = this.urlParams;
if(up.has(path)){
theFile = up.get(path);
}else if(this.sqlite3Dir){
theFile = this.sqlite3Dir + path;
}else if(this.scriptDir){
theFile = this.scriptDir + path;
}else{
theFile = prefix + path;
}
sqlite3InitModuleState.debugModule(
"locateFile(",arguments[0], ',', arguments[1],")",
'sqlite3InitModuleState.scriptDir =',this.scriptDir,
'up.entries() =',Array.from(up.entries()),
"result =", theFile
);
return theFile;
}.bind(sqlite3InitModuleState);
const xNameOfInstantiateWasm = false
? 'instantiateWasm'
: 'emscripten-bug-17951';
Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
imports.env.foo = function(){};
const uri = Module.locateFile(
callee.uri, (
('undefined'===typeof scriptDirectory)
? "" : scriptDirectory)
);
sqlite3InitModuleState.debugModule(
"instantiateWasm() uri =", uri
);
const wfetch = ()=>fetch(uri, {credentials: 'same-origin'});
const loadWasm = WebAssembly.instantiateStreaming
? async ()=>{
return WebAssembly.instantiateStreaming(wfetch(), imports)
.then((arg)=>onSuccess(arg.instance, arg.module));
}
: async ()=>{ return wfetch()
.then(response => response.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, imports))
.then((arg)=>onSuccess(arg.instance, arg.module));
};
loadWasm();
return {};
};
Module[xNameOfInstantiateWasm].uri = 'sqlite3.wasm';