52 lines
1.1 MiB
JavaScript
52 lines
1.1 MiB
JavaScript
|
/// <reference types="./sqlite.d.ts" />
|
||
|
|
||
|
/* This file is automatically generated. Do not edit directly. */
|
||
|
import env from "./vfs.js";
|
||
|
|
||
|
const wasm =
|
||
|
"AGFzbQEAAAABjQREYAN/f38AYAF/AX9gAX8AYAJ/fwF/YAN/f38Bf2ACf38AYAR/f39/AX9gBH9/f34Bf2ACf34Bf2AFf39/f38Bf2AAAGAFf39/f34AYAZ/f39/f38Bf2AEf39/fwBgBX9/f39/AGAEf35/fwBgAAF/YAABfGAEf398fwF/YAJ/fABgAX8BfGABfABgA39/fAF/YAJ/fwF8YAF+AX9gAX4BfmABfwF+YAN/f34Bf2AFf39+f38Bf2ABfAF+YAR/f35/AGACf34AYAV/f35/fwBgB39/f39/f38Bf2ACf38BfmAGf39/fn9/AX9gB39/f39+f38Bf2ADf35/AX9gC39/f39/f39/f39/AX9gBH9+f38Bf2AHf39/f39/fwBgC39/f39/f39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38Bf2AGf39/f39/AGAKf39/f39/f39/fwBgCH9/f39/f39/AX9gCX9/f39/f39/fwBgDX9/f39/f39/f39/f38AYAN/fn4Bf2AFf39/fn8AYAR/f39+AGAGf39/f39+AX5gBX9+f39/AX9gCH9+fn9/f39/AX9gAn9+AX5gBH9/fn8Bf2ADf39+AGAHf35/f39/fwF/YAN/fn4AYAF+AGACfn8Bf2ABfAF8YAV/fn5+fgBgBH5+fn4Bf2ACfn4Bf2ACfn4BfGAEf35+fwAC1wEOA2Vudgtqc190aW1lem9uZQAQA2Vudgdqc19vcGVuAAQDZW52CWpzX2RlbGV0ZQACA2Vudglqc19leGlzdHMAAQNlbnYJanNfYWNjZXNzAAEDZW52B2pzX3RpbWUAEQNlbnYIanNfY2xvc2UAAgNlbnYHanNfcmVhZAASA2Vudghqc193cml0ZQASA2Vudgtqc190cnVuY2F0ZQATA2Vudgdqc19zeW5jAAIDZW52B2pzX3NpemUAFANlbnYHan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bytesStr.length);
|
||
|
for (let i = 0, c = bytesStr.length; i < c; i++) {
|
||
|
bytes[i] = bytesStr.charCodeAt(i);
|
||
|
}
|
||
|
return bytes;
|
||
|
}
|
||
|
|
||
|
const moduleOrInstance = {
|
||
|
module: null,
|
||
|
instances: [],
|
||
|
};
|
||
|
|
||
|
export async function compile() {
|
||
|
moduleOrInstance.module = await WebAssembly.compile(decode(wasm));
|
||
|
}
|
||
|
|
||
|
export async function instantiateBrowser() {
|
||
|
const placeholder = { exports: null };
|
||
|
const instance = await WebAssembly.instantiate(
|
||
|
moduleOrInstance.module,
|
||
|
env(placeholder),
|
||
|
);
|
||
|
placeholder.exports = instance.exports;
|
||
|
instance.exports.seed_rng(Date.now());
|
||
|
moduleOrInstance.instances.push(instance);
|
||
|
}
|
||
|
|
||
|
export function instantiate() {
|
||
|
if (moduleOrInstance.instances.length) {
|
||
|
return moduleOrInstance.instances.pop();
|
||
|
} else {
|
||
|
const placeholder = { exports: null };
|
||
|
const instance = new WebAssembly.Instance(
|
||
|
moduleOrInstance.module,
|
||
|
env(placeholder),
|
||
|
);
|
||
|
placeholder.exports = instance.exports;
|
||
|
instance.exports.seed_rng(Date.now());
|
||
|
return instance;
|
||
|
}
|
||
|
}
|