918 lines
37 KiB
JavaScript
918 lines
37 KiB
JavaScript
// Compiles a dart2wasm-generated main module from `source` which can then
|
|
// instantiatable via the `instantiate` method.
|
|
//
|
|
// `source` needs to be a `Response` object (or promise thereof) e.g. created
|
|
// via the `fetch()` JS API.
|
|
export async function compileStreaming(source) {
|
|
const builtins = {builtins: ['js-string']};
|
|
return new CompiledApp(
|
|
await WebAssembly.compileStreaming(source, builtins), builtins);
|
|
}
|
|
|
|
// Compiles a dart2wasm-generated wasm modules from `bytes` which is then
|
|
// instantiatable via the `instantiate` method.
|
|
export async function compile(bytes) {
|
|
const builtins = {builtins: ['js-string']};
|
|
return new CompiledApp(await WebAssembly.compile(bytes, builtins), builtins);
|
|
}
|
|
|
|
// DEPRECATED: Please use `compile` or `compileStreaming` to get a compiled app,
|
|
// use `instantiate` method to get an instantiated app and then call
|
|
// `invokeMain` to invoke the main function.
|
|
export async function instantiate(modulePromise, importObjectPromise) {
|
|
var moduleOrCompiledApp = await modulePromise;
|
|
if (!(moduleOrCompiledApp instanceof CompiledApp)) {
|
|
moduleOrCompiledApp = new CompiledApp(moduleOrCompiledApp);
|
|
}
|
|
const instantiatedApp = await moduleOrCompiledApp.instantiate(await importObjectPromise);
|
|
return instantiatedApp.instantiatedModule;
|
|
}
|
|
|
|
// DEPRECATED: Please use `compile` or `compileStreaming` to get a compiled app,
|
|
// use `instantiate` method to get an instantiated app and then call
|
|
// `invokeMain` to invoke the main function.
|
|
export const invoke = (moduleInstance, ...args) => {
|
|
moduleInstance.exports.$invokeMain(args);
|
|
}
|
|
|
|
class CompiledApp {
|
|
constructor(module, builtins) {
|
|
this.module = module;
|
|
this.builtins = builtins;
|
|
}
|
|
|
|
// The second argument is an options object containing:
|
|
// `loadDeferredWasm` is a JS function that takes a module name matching a
|
|
// wasm file produced by the dart2wasm compiler and returns the bytes to
|
|
// load the module. These bytes can be in either a format supported by
|
|
// `WebAssembly.compile` or `WebAssembly.compileStreaming`.
|
|
// `loadDynamicModule` is a JS function that takes two string names matching,
|
|
// in order, a wasm file produced by the dart2wasm compiler during dynamic
|
|
// module compilation and a corresponding js file produced by the same
|
|
// compilation. It should return a JS Array containing 2 elements. The first
|
|
// should be the bytes for the wasm module in a format supported by
|
|
// `WebAssembly.compile` or `WebAssembly.compileStreaming`. The second
|
|
// should be the result of using the JS 'import' API on the js file path.
|
|
async instantiate(additionalImports, {loadDeferredWasm, loadDynamicModule} = {}) {
|
|
let dartInstance;
|
|
|
|
// Prints to the console
|
|
function printToConsole(value) {
|
|
if (typeof dartPrint == "function") {
|
|
dartPrint(value);
|
|
return;
|
|
}
|
|
if (typeof console == "object" && typeof console.log != "undefined") {
|
|
console.log(value);
|
|
return;
|
|
}
|
|
if (typeof print == "function") {
|
|
print(value);
|
|
return;
|
|
}
|
|
|
|
throw "Unable to print message: " + value;
|
|
}
|
|
|
|
// A special symbol attached to functions that wrap Dart functions.
|
|
const jsWrappedDartFunctionSymbol = Symbol("JSWrappedDartFunction");
|
|
|
|
function finalizeWrapper(dartFunction, wrapped) {
|
|
wrapped.dartFunction = dartFunction;
|
|
wrapped[jsWrappedDartFunctionSymbol] = true;
|
|
return wrapped;
|
|
}
|
|
|
|
// Imports
|
|
const dart2wasm = {
|
|
_4: (o, c) => o instanceof c,
|
|
_5: o => Object.keys(o),
|
|
_8: (o, a) => o + a,
|
|
_36: x0 => new Array(x0),
|
|
_38: x0 => x0.length,
|
|
_40: (x0,x1) => x0[x1],
|
|
_41: (x0,x1,x2) => { x0[x1] = x2 },
|
|
_43: x0 => new Promise(x0),
|
|
_45: (x0,x1,x2) => new DataView(x0,x1,x2),
|
|
_47: x0 => new Int8Array(x0),
|
|
_48: (x0,x1,x2) => new Uint8Array(x0,x1,x2),
|
|
_49: x0 => new Uint8Array(x0),
|
|
_51: x0 => new Uint8ClampedArray(x0),
|
|
_53: x0 => new Int16Array(x0),
|
|
_55: x0 => new Uint16Array(x0),
|
|
_57: x0 => new Int32Array(x0),
|
|
_59: x0 => new Uint32Array(x0),
|
|
_61: x0 => new Float32Array(x0),
|
|
_63: x0 => new Float64Array(x0),
|
|
_65: (x0,x1,x2) => x0.call(x1,x2),
|
|
_70: (decoder, codeUnits) => decoder.decode(codeUnits),
|
|
_71: () => new TextDecoder("utf-8", {fatal: true}),
|
|
_72: () => new TextDecoder("utf-8", {fatal: false}),
|
|
_73: (s) => +s,
|
|
_74: x0 => new Uint8Array(x0),
|
|
_75: (x0,x1,x2) => x0.set(x1,x2),
|
|
_76: (x0,x1) => x0.transferFromImageBitmap(x1),
|
|
_77: x0 => x0.arrayBuffer(),
|
|
_78: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._78(f,arguments.length,x0) }),
|
|
_79: x0 => new window.FinalizationRegistry(x0),
|
|
_80: (x0,x1,x2,x3) => x0.register(x1,x2,x3),
|
|
_81: (x0,x1) => x0.unregister(x1),
|
|
_82: (x0,x1,x2) => x0.slice(x1,x2),
|
|
_83: (x0,x1) => x0.decode(x1),
|
|
_84: (x0,x1) => x0.segment(x1),
|
|
_85: () => new TextDecoder(),
|
|
_87: x0 => x0.buffer,
|
|
_88: x0 => x0.wasmMemory,
|
|
_89: () => globalThis.window._flutter_skwasmInstance,
|
|
_90: x0 => x0.rasterStartMilliseconds,
|
|
_91: x0 => x0.rasterEndMilliseconds,
|
|
_92: x0 => x0.imageBitmaps,
|
|
_196: x0 => x0.stopPropagation(),
|
|
_197: x0 => x0.preventDefault(),
|
|
_199: x0 => x0.remove(),
|
|
_200: (x0,x1) => x0.append(x1),
|
|
_201: (x0,x1,x2,x3) => x0.addEventListener(x1,x2,x3),
|
|
_246: x0 => x0.unlock(),
|
|
_247: x0 => x0.getReader(),
|
|
_248: (x0,x1,x2) => x0.addEventListener(x1,x2),
|
|
_249: (x0,x1,x2) => x0.removeEventListener(x1,x2),
|
|
_250: (x0,x1) => x0.item(x1),
|
|
_251: x0 => x0.next(),
|
|
_252: x0 => x0.now(),
|
|
_253: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._253(f,arguments.length,x0) }),
|
|
_254: (x0,x1) => x0.addListener(x1),
|
|
_255: (x0,x1) => x0.removeListener(x1),
|
|
_256: (x0,x1) => x0.matchMedia(x1),
|
|
_257: (x0,x1) => x0.revokeObjectURL(x1),
|
|
_258: x0 => x0.close(),
|
|
_259: (x0,x1,x2,x3,x4) => ({type: x0,data: x1,premultiplyAlpha: x2,colorSpaceConversion: x3,preferAnimation: x4}),
|
|
_260: x0 => new window.ImageDecoder(x0),
|
|
_261: x0 => ({frameIndex: x0}),
|
|
_262: (x0,x1) => x0.decode(x1),
|
|
_263: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._263(f,arguments.length,x0) }),
|
|
_264: (x0,x1) => x0.getModifierState(x1),
|
|
_265: (x0,x1) => x0.removeProperty(x1),
|
|
_266: (x0,x1) => x0.prepend(x1),
|
|
_267: x0 => new Intl.Locale(x0),
|
|
_268: x0 => x0.disconnect(),
|
|
_269: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._269(f,arguments.length,x0) }),
|
|
_270: (x0,x1) => x0.getAttribute(x1),
|
|
_271: (x0,x1) => x0.contains(x1),
|
|
_272: (x0,x1) => x0.querySelector(x1),
|
|
_273: x0 => x0.blur(),
|
|
_274: x0 => x0.hasFocus(),
|
|
_275: (x0,x1,x2) => x0.insertBefore(x1,x2),
|
|
_276: (x0,x1) => x0.hasAttribute(x1),
|
|
_277: (x0,x1) => x0.getModifierState(x1),
|
|
_278: (x0,x1) => x0.createTextNode(x1),
|
|
_279: (x0,x1) => x0.appendChild(x1),
|
|
_280: (x0,x1) => x0.removeAttribute(x1),
|
|
_281: x0 => x0.getBoundingClientRect(),
|
|
_282: (x0,x1) => x0.observe(x1),
|
|
_283: x0 => x0.disconnect(),
|
|
_284: (x0,x1) => x0.closest(x1),
|
|
_707: () => globalThis.window.flutterConfiguration,
|
|
_709: x0 => x0.assetBase,
|
|
_714: x0 => x0.canvasKitMaximumSurfaces,
|
|
_715: x0 => x0.debugShowSemanticsNodes,
|
|
_716: x0 => x0.hostElement,
|
|
_717: x0 => x0.multiViewEnabled,
|
|
_718: x0 => x0.nonce,
|
|
_720: x0 => x0.fontFallbackBaseUrl,
|
|
_730: x0 => x0.console,
|
|
_731: x0 => x0.devicePixelRatio,
|
|
_732: x0 => x0.document,
|
|
_733: x0 => x0.history,
|
|
_734: x0 => x0.innerHeight,
|
|
_735: x0 => x0.innerWidth,
|
|
_736: x0 => x0.location,
|
|
_737: x0 => x0.navigator,
|
|
_738: x0 => x0.visualViewport,
|
|
_739: x0 => x0.performance,
|
|
_741: x0 => x0.URL,
|
|
_743: (x0,x1) => x0.getComputedStyle(x1),
|
|
_744: x0 => x0.screen,
|
|
_745: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._745(f,arguments.length,x0) }),
|
|
_746: (x0,x1) => x0.requestAnimationFrame(x1),
|
|
_751: (x0,x1) => x0.warn(x1),
|
|
_753: (x0,x1) => x0.debug(x1),
|
|
_754: x0 => globalThis.parseFloat(x0),
|
|
_755: () => globalThis.window,
|
|
_756: () => globalThis.Intl,
|
|
_757: () => globalThis.Symbol,
|
|
_758: (x0,x1,x2,x3,x4) => globalThis.createImageBitmap(x0,x1,x2,x3,x4),
|
|
_760: x0 => x0.clipboard,
|
|
_761: x0 => x0.maxTouchPoints,
|
|
_762: x0 => x0.vendor,
|
|
_763: x0 => x0.language,
|
|
_764: x0 => x0.platform,
|
|
_765: x0 => x0.userAgent,
|
|
_766: (x0,x1) => x0.vibrate(x1),
|
|
_767: x0 => x0.languages,
|
|
_768: x0 => x0.documentElement,
|
|
_769: (x0,x1) => x0.querySelector(x1),
|
|
_772: (x0,x1) => x0.createElement(x1),
|
|
_775: (x0,x1) => x0.createEvent(x1),
|
|
_776: x0 => x0.activeElement,
|
|
_779: x0 => x0.head,
|
|
_780: x0 => x0.body,
|
|
_782: (x0,x1) => { x0.title = x1 },
|
|
_785: x0 => x0.visibilityState,
|
|
_786: () => globalThis.document,
|
|
_787: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._787(f,arguments.length,x0) }),
|
|
_788: (x0,x1) => x0.dispatchEvent(x1),
|
|
_796: x0 => x0.target,
|
|
_798: x0 => x0.timeStamp,
|
|
_799: x0 => x0.type,
|
|
_801: (x0,x1,x2,x3) => x0.initEvent(x1,x2,x3),
|
|
_807: x0 => x0.baseURI,
|
|
_808: x0 => x0.firstChild,
|
|
_812: x0 => x0.parentElement,
|
|
_814: (x0,x1) => { x0.textContent = x1 },
|
|
_815: x0 => x0.parentNode,
|
|
_816: x0 => x0.nextSibling,
|
|
_817: (x0,x1) => x0.removeChild(x1),
|
|
_818: x0 => x0.isConnected,
|
|
_826: x0 => x0.clientHeight,
|
|
_827: x0 => x0.clientWidth,
|
|
_828: x0 => x0.offsetHeight,
|
|
_829: x0 => x0.offsetWidth,
|
|
_830: x0 => x0.id,
|
|
_831: (x0,x1) => { x0.id = x1 },
|
|
_834: (x0,x1) => { x0.spellcheck = x1 },
|
|
_835: x0 => x0.tagName,
|
|
_836: x0 => x0.style,
|
|
_838: (x0,x1) => x0.querySelectorAll(x1),
|
|
_839: (x0,x1,x2) => x0.setAttribute(x1,x2),
|
|
_840: (x0,x1) => { x0.tabIndex = x1 },
|
|
_841: x0 => x0.tabIndex,
|
|
_842: (x0,x1) => x0.focus(x1),
|
|
_843: x0 => x0.scrollTop,
|
|
_844: (x0,x1) => { x0.scrollTop = x1 },
|
|
_845: x0 => x0.scrollLeft,
|
|
_846: (x0,x1) => { x0.scrollLeft = x1 },
|
|
_847: x0 => x0.classList,
|
|
_849: (x0,x1) => { x0.className = x1 },
|
|
_851: (x0,x1) => x0.getElementsByClassName(x1),
|
|
_852: x0 => x0.click(),
|
|
_853: (x0,x1) => x0.attachShadow(x1),
|
|
_856: x0 => x0.computedStyleMap(),
|
|
_857: (x0,x1) => x0.get(x1),
|
|
_863: (x0,x1) => x0.getPropertyValue(x1),
|
|
_864: (x0,x1,x2,x3) => x0.setProperty(x1,x2,x3),
|
|
_865: x0 => x0.offsetLeft,
|
|
_866: x0 => x0.offsetTop,
|
|
_867: x0 => x0.offsetParent,
|
|
_869: (x0,x1) => { x0.name = x1 },
|
|
_870: x0 => x0.content,
|
|
_871: (x0,x1) => { x0.content = x1 },
|
|
_875: (x0,x1) => { x0.src = x1 },
|
|
_876: x0 => x0.naturalWidth,
|
|
_877: x0 => x0.naturalHeight,
|
|
_881: (x0,x1) => { x0.crossOrigin = x1 },
|
|
_883: (x0,x1) => { x0.decoding = x1 },
|
|
_884: x0 => x0.decode(),
|
|
_889: (x0,x1) => { x0.nonce = x1 },
|
|
_894: (x0,x1) => { x0.width = x1 },
|
|
_896: (x0,x1) => { x0.height = x1 },
|
|
_899: (x0,x1) => x0.getContext(x1),
|
|
_960: x0 => x0.width,
|
|
_961: x0 => x0.height,
|
|
_963: (x0,x1) => x0.fetch(x1),
|
|
_964: x0 => x0.status,
|
|
_966: x0 => x0.body,
|
|
_967: x0 => x0.arrayBuffer(),
|
|
_970: x0 => x0.read(),
|
|
_971: x0 => x0.value,
|
|
_972: x0 => x0.done,
|
|
_979: x0 => x0.name,
|
|
_980: x0 => x0.x,
|
|
_981: x0 => x0.y,
|
|
_984: x0 => x0.top,
|
|
_985: x0 => x0.right,
|
|
_986: x0 => x0.bottom,
|
|
_987: x0 => x0.left,
|
|
_997: x0 => x0.height,
|
|
_998: x0 => x0.width,
|
|
_999: x0 => x0.scale,
|
|
_1000: (x0,x1) => { x0.value = x1 },
|
|
_1003: (x0,x1) => { x0.placeholder = x1 },
|
|
_1005: (x0,x1) => { x0.name = x1 },
|
|
_1006: x0 => x0.selectionDirection,
|
|
_1007: x0 => x0.selectionStart,
|
|
_1008: x0 => x0.selectionEnd,
|
|
_1011: x0 => x0.value,
|
|
_1013: (x0,x1,x2) => x0.setSelectionRange(x1,x2),
|
|
_1014: x0 => x0.readText(),
|
|
_1015: (x0,x1) => x0.writeText(x1),
|
|
_1017: x0 => x0.altKey,
|
|
_1018: x0 => x0.code,
|
|
_1019: x0 => x0.ctrlKey,
|
|
_1020: x0 => x0.key,
|
|
_1021: x0 => x0.keyCode,
|
|
_1022: x0 => x0.location,
|
|
_1023: x0 => x0.metaKey,
|
|
_1024: x0 => x0.repeat,
|
|
_1025: x0 => x0.shiftKey,
|
|
_1026: x0 => x0.isComposing,
|
|
_1028: x0 => x0.state,
|
|
_1029: (x0,x1) => x0.go(x1),
|
|
_1031: (x0,x1,x2,x3) => x0.pushState(x1,x2,x3),
|
|
_1032: (x0,x1,x2,x3) => x0.replaceState(x1,x2,x3),
|
|
_1033: x0 => x0.pathname,
|
|
_1034: x0 => x0.search,
|
|
_1035: x0 => x0.hash,
|
|
_1039: x0 => x0.state,
|
|
_1042: (x0,x1) => x0.createObjectURL(x1),
|
|
_1044: x0 => new Blob(x0),
|
|
_1046: x0 => new MutationObserver(x0),
|
|
_1047: (x0,x1,x2) => x0.observe(x1,x2),
|
|
_1048: f => finalizeWrapper(f, function(x0,x1) { return dartInstance.exports._1048(f,arguments.length,x0,x1) }),
|
|
_1051: x0 => x0.attributeName,
|
|
_1052: x0 => x0.type,
|
|
_1053: x0 => x0.matches,
|
|
_1054: x0 => x0.matches,
|
|
_1058: x0 => x0.relatedTarget,
|
|
_1060: x0 => x0.clientX,
|
|
_1061: x0 => x0.clientY,
|
|
_1062: x0 => x0.offsetX,
|
|
_1063: x0 => x0.offsetY,
|
|
_1066: x0 => x0.button,
|
|
_1067: x0 => x0.buttons,
|
|
_1068: x0 => x0.ctrlKey,
|
|
_1072: x0 => x0.pointerId,
|
|
_1073: x0 => x0.pointerType,
|
|
_1074: x0 => x0.pressure,
|
|
_1075: x0 => x0.tiltX,
|
|
_1076: x0 => x0.tiltY,
|
|
_1077: x0 => x0.getCoalescedEvents(),
|
|
_1080: x0 => x0.deltaX,
|
|
_1081: x0 => x0.deltaY,
|
|
_1082: x0 => x0.wheelDeltaX,
|
|
_1083: x0 => x0.wheelDeltaY,
|
|
_1084: x0 => x0.deltaMode,
|
|
_1091: x0 => x0.changedTouches,
|
|
_1094: x0 => x0.clientX,
|
|
_1095: x0 => x0.clientY,
|
|
_1098: x0 => x0.data,
|
|
_1101: (x0,x1) => { x0.disabled = x1 },
|
|
_1103: (x0,x1) => { x0.type = x1 },
|
|
_1104: (x0,x1) => { x0.max = x1 },
|
|
_1105: (x0,x1) => { x0.min = x1 },
|
|
_1106: x0 => x0.value,
|
|
_1107: (x0,x1) => { x0.value = x1 },
|
|
_1108: x0 => x0.disabled,
|
|
_1109: (x0,x1) => { x0.disabled = x1 },
|
|
_1111: (x0,x1) => { x0.placeholder = x1 },
|
|
_1112: (x0,x1) => { x0.name = x1 },
|
|
_1115: (x0,x1) => { x0.autocomplete = x1 },
|
|
_1116: x0 => x0.selectionDirection,
|
|
_1117: x0 => x0.selectionStart,
|
|
_1119: x0 => x0.selectionEnd,
|
|
_1122: (x0,x1,x2) => x0.setSelectionRange(x1,x2),
|
|
_1123: (x0,x1) => x0.add(x1),
|
|
_1126: (x0,x1) => { x0.noValidate = x1 },
|
|
_1127: (x0,x1) => { x0.method = x1 },
|
|
_1128: (x0,x1) => { x0.action = x1 },
|
|
_1129: (x0,x1) => new OffscreenCanvas(x0,x1),
|
|
_1135: (x0,x1) => x0.getContext(x1),
|
|
_1137: x0 => x0.convertToBlob(),
|
|
_1154: x0 => x0.orientation,
|
|
_1155: x0 => x0.width,
|
|
_1156: x0 => x0.height,
|
|
_1157: (x0,x1) => x0.lock(x1),
|
|
_1176: x0 => new ResizeObserver(x0),
|
|
_1179: f => finalizeWrapper(f, function(x0,x1) { return dartInstance.exports._1179(f,arguments.length,x0,x1) }),
|
|
_1187: x0 => x0.length,
|
|
_1188: x0 => x0.iterator,
|
|
_1189: x0 => x0.Segmenter,
|
|
_1190: x0 => x0.v8BreakIterator,
|
|
_1191: (x0,x1) => new Intl.Segmenter(x0,x1),
|
|
_1194: x0 => x0.language,
|
|
_1195: x0 => x0.script,
|
|
_1196: x0 => x0.region,
|
|
_1214: x0 => x0.done,
|
|
_1215: x0 => x0.value,
|
|
_1216: x0 => x0.index,
|
|
_1220: (x0,x1) => new Intl.v8BreakIterator(x0,x1),
|
|
_1221: (x0,x1) => x0.adoptText(x1),
|
|
_1222: x0 => x0.first(),
|
|
_1223: x0 => x0.next(),
|
|
_1224: x0 => x0.current(),
|
|
_1238: x0 => x0.hostElement,
|
|
_1239: x0 => x0.viewConstraints,
|
|
_1242: x0 => x0.maxHeight,
|
|
_1243: x0 => x0.maxWidth,
|
|
_1244: x0 => x0.minHeight,
|
|
_1245: x0 => x0.minWidth,
|
|
_1246: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1246(f,arguments.length,x0) }),
|
|
_1247: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1247(f,arguments.length,x0) }),
|
|
_1248: (x0,x1) => ({addView: x0,removeView: x1}),
|
|
_1251: x0 => x0.loader,
|
|
_1252: () => globalThis._flutter,
|
|
_1253: (x0,x1) => x0.didCreateEngineInitializer(x1),
|
|
_1254: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1254(f,arguments.length,x0) }),
|
|
_1255: f => finalizeWrapper(f, function() { return dartInstance.exports._1255(f,arguments.length) }),
|
|
_1256: (x0,x1) => ({initializeEngine: x0,autoStart: x1}),
|
|
_1259: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1259(f,arguments.length,x0) }),
|
|
_1260: x0 => ({runApp: x0}),
|
|
_1262: f => finalizeWrapper(f, function(x0,x1) { return dartInstance.exports._1262(f,arguments.length,x0,x1) }),
|
|
_1263: x0 => x0.length,
|
|
_1264: () => globalThis.window.ImageDecoder,
|
|
_1265: x0 => x0.tracks,
|
|
_1267: x0 => x0.completed,
|
|
_1269: x0 => x0.image,
|
|
_1275: x0 => x0.displayWidth,
|
|
_1276: x0 => x0.displayHeight,
|
|
_1277: x0 => x0.duration,
|
|
_1280: x0 => x0.ready,
|
|
_1281: x0 => x0.selectedTrack,
|
|
_1282: x0 => x0.repetitionCount,
|
|
_1283: x0 => x0.frameCount,
|
|
_1335: (x0,x1) => x0.createElement(x1),
|
|
_1336: (x0,x1) => x0.querySelector(x1),
|
|
_1337: (x0,x1) => x0.appendChild(x1),
|
|
_1338: x0 => ({type: x0}),
|
|
_1339: (x0,x1) => new Blob(x0,x1),
|
|
_1340: x0 => globalThis.URL.createObjectURL(x0),
|
|
_1342: (x0,x1,x2,x3) => x0.sendCommand(x1,x2,x3),
|
|
_1343: () => globalThis.PdfiumWasmCommunicator,
|
|
_1345: x0 => { globalThis.pdfiumWasmWorkerUrl = x0 },
|
|
_1346: (x0,x1) => x0.writeText(x1),
|
|
_1347: x0 => x0.preventDefault(),
|
|
_1348: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1348(f,arguments.length,x0) }),
|
|
_1349: (x0,x1,x2) => x0.addEventListener(x1,x2),
|
|
_1350: x0 => x0.createRange(),
|
|
_1351: (x0,x1) => x0.selectNode(x1),
|
|
_1352: x0 => x0.getSelection(),
|
|
_1353: x0 => x0.removeAllRanges(),
|
|
_1354: (x0,x1) => x0.addRange(x1),
|
|
_1355: (x0,x1) => x0.createElement(x1),
|
|
_1356: (x0,x1) => x0.append(x1),
|
|
_1357: (x0,x1,x2) => x0.insertRule(x1,x2),
|
|
_1358: (x0,x1) => x0.add(x1),
|
|
_1359: x0 => x0.preventDefault(),
|
|
_1360: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1360(f,arguments.length,x0) }),
|
|
_1361: (x0,x1,x2) => x0.addEventListener(x1,x2),
|
|
_1362: (x0,x1,x2,x3) => x0.addEventListener(x1,x2,x3),
|
|
_1363: (x0,x1,x2,x3) => x0.removeEventListener(x1,x2,x3),
|
|
_1370: (x0,x1,x2,x3) => x0.open(x1,x2,x3),
|
|
_1380: x0 => x0.click(),
|
|
_1381: x0 => x0.remove(),
|
|
_1384: x0 => x0.createReader(),
|
|
_1385: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1385(f,arguments.length,x0) }),
|
|
_1386: (x0,x1) => x0.readEntries(x1),
|
|
_1387: () => new Blob(),
|
|
_1388: (x0,x1,x2,x3) => x0.slice(x1,x2,x3),
|
|
_1389: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1389(f,arguments.length,x0) }),
|
|
_1390: (x0,x1) => x0.file(x1),
|
|
_1391: x0 => x0.webkitGetAsEntry(),
|
|
_1392: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1392(f,arguments.length,x0) }),
|
|
_1393: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1393(f,arguments.length,x0) }),
|
|
_1394: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1394(f,arguments.length,x0) }),
|
|
_1395: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1395(f,arguments.length,x0) }),
|
|
_1397: (x0,x1) => x0.append(x1),
|
|
_1405: (x0,x1) => x0.getItem(x1),
|
|
_1407: (x0,x1,x2) => x0.setItem(x1,x2),
|
|
_1408: (x0,x1) => x0.item(x1),
|
|
_1409: () => new FileReader(),
|
|
_1411: (x0,x1) => x0.readAsArrayBuffer(x1),
|
|
_1412: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1412(f,arguments.length,x0) }),
|
|
_1413: (x0,x1,x2) => x0.removeEventListener(x1,x2),
|
|
_1414: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1414(f,arguments.length,x0) }),
|
|
_1415: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1415(f,arguments.length,x0) }),
|
|
_1416: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1416(f,arguments.length,x0) }),
|
|
_1417: (x0,x1) => x0.removeChild(x1),
|
|
_1424: Date.now,
|
|
_1426: s => new Date(s * 1000).getTimezoneOffset() * 60,
|
|
_1427: s => {
|
|
if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s*$/.test(s)) {
|
|
return NaN;
|
|
}
|
|
return parseFloat(s);
|
|
},
|
|
_1428: () => {
|
|
let stackString = new Error().stack.toString();
|
|
let frames = stackString.split('\n');
|
|
let drop = 2;
|
|
if (frames[0] === 'Error') {
|
|
drop += 1;
|
|
}
|
|
return frames.slice(drop).join('\n');
|
|
},
|
|
_1429: () => typeof dartUseDateNowForTicks !== "undefined",
|
|
_1430: () => 1000 * performance.now(),
|
|
_1431: () => Date.now(),
|
|
_1433: () => {
|
|
return typeof process != "undefined" &&
|
|
Object.prototype.toString.call(process) == "[object process]" &&
|
|
process.platform == "win32"
|
|
},
|
|
_1434: () => new WeakMap(),
|
|
_1435: (map, o) => map.get(o),
|
|
_1436: (map, o, v) => map.set(o, v),
|
|
_1437: x0 => new WeakRef(x0),
|
|
_1438: x0 => x0.deref(),
|
|
_1445: () => globalThis.WeakRef,
|
|
_1449: s => JSON.stringify(s),
|
|
_1450: s => printToConsole(s),
|
|
_1451: (o, p, r) => o.replaceAll(p, () => r),
|
|
_1453: Function.prototype.call.bind(String.prototype.toLowerCase),
|
|
_1454: s => s.toUpperCase(),
|
|
_1455: s => s.trim(),
|
|
_1456: s => s.trimLeft(),
|
|
_1457: s => s.trimRight(),
|
|
_1458: (string, times) => string.repeat(times),
|
|
_1459: Function.prototype.call.bind(String.prototype.indexOf),
|
|
_1460: (s, p, i) => s.lastIndexOf(p, i),
|
|
_1461: (string, token) => string.split(token),
|
|
_1462: Object.is,
|
|
_1463: o => o instanceof Array,
|
|
_1464: (a, i) => a.push(i),
|
|
_1467: (a, l) => a.length = l,
|
|
_1468: a => a.pop(),
|
|
_1469: (a, i) => a.splice(i, 1),
|
|
_1470: (a, s) => a.join(s),
|
|
_1471: (a, s, e) => a.slice(s, e),
|
|
_1474: a => a.length,
|
|
_1475: (a, l) => a.length = l,
|
|
_1476: (a, i) => a[i],
|
|
_1477: (a, i, v) => a[i] = v,
|
|
_1479: o => {
|
|
if (o instanceof ArrayBuffer) return 0;
|
|
if (globalThis.SharedArrayBuffer !== undefined &&
|
|
o instanceof SharedArrayBuffer) {
|
|
return 1;
|
|
}
|
|
return 2;
|
|
},
|
|
_1480: (o, offsetInBytes, lengthInBytes) => {
|
|
var dst = new ArrayBuffer(lengthInBytes);
|
|
new Uint8Array(dst).set(new Uint8Array(o, offsetInBytes, lengthInBytes));
|
|
return new DataView(dst);
|
|
},
|
|
_1482: o => o instanceof Uint8Array,
|
|
_1483: (o, start, length) => new Uint8Array(o.buffer, o.byteOffset + start, length),
|
|
_1484: o => o instanceof Int8Array,
|
|
_1485: (o, start, length) => new Int8Array(o.buffer, o.byteOffset + start, length),
|
|
_1486: o => o instanceof Uint8ClampedArray,
|
|
_1487: (o, start, length) => new Uint8ClampedArray(o.buffer, o.byteOffset + start, length),
|
|
_1488: o => o instanceof Uint16Array,
|
|
_1489: (o, start, length) => new Uint16Array(o.buffer, o.byteOffset + start, length),
|
|
_1490: o => o instanceof Int16Array,
|
|
_1491: (o, start, length) => new Int16Array(o.buffer, o.byteOffset + start, length),
|
|
_1492: o => o instanceof Uint32Array,
|
|
_1493: (o, start, length) => new Uint32Array(o.buffer, o.byteOffset + start, length),
|
|
_1494: o => o instanceof Int32Array,
|
|
_1495: (o, start, length) => new Int32Array(o.buffer, o.byteOffset + start, length),
|
|
_1497: (o, start, length) => new BigInt64Array(o.buffer, o.byteOffset + start, length),
|
|
_1498: o => o instanceof Float32Array,
|
|
_1499: (o, start, length) => new Float32Array(o.buffer, o.byteOffset + start, length),
|
|
_1500: o => o instanceof Float64Array,
|
|
_1501: (o, start, length) => new Float64Array(o.buffer, o.byteOffset + start, length),
|
|
_1502: (t, s) => t.set(s),
|
|
_1503: l => new DataView(new ArrayBuffer(l)),
|
|
_1504: (o) => new DataView(o.buffer, o.byteOffset, o.byteLength),
|
|
_1505: o => o.byteLength,
|
|
_1506: o => o.buffer,
|
|
_1507: o => o.byteOffset,
|
|
_1508: Function.prototype.call.bind(Object.getOwnPropertyDescriptor(DataView.prototype, 'byteLength').get),
|
|
_1509: (b, o) => new DataView(b, o),
|
|
_1510: (b, o, l) => new DataView(b, o, l),
|
|
_1511: Function.prototype.call.bind(DataView.prototype.getUint8),
|
|
_1512: Function.prototype.call.bind(DataView.prototype.setUint8),
|
|
_1513: Function.prototype.call.bind(DataView.prototype.getInt8),
|
|
_1514: Function.prototype.call.bind(DataView.prototype.setInt8),
|
|
_1515: Function.prototype.call.bind(DataView.prototype.getUint16),
|
|
_1516: Function.prototype.call.bind(DataView.prototype.setUint16),
|
|
_1517: Function.prototype.call.bind(DataView.prototype.getInt16),
|
|
_1518: Function.prototype.call.bind(DataView.prototype.setInt16),
|
|
_1519: Function.prototype.call.bind(DataView.prototype.getUint32),
|
|
_1520: Function.prototype.call.bind(DataView.prototype.setUint32),
|
|
_1521: Function.prototype.call.bind(DataView.prototype.getInt32),
|
|
_1522: Function.prototype.call.bind(DataView.prototype.setInt32),
|
|
_1525: Function.prototype.call.bind(DataView.prototype.getBigInt64),
|
|
_1526: Function.prototype.call.bind(DataView.prototype.setBigInt64),
|
|
_1527: Function.prototype.call.bind(DataView.prototype.getFloat32),
|
|
_1528: Function.prototype.call.bind(DataView.prototype.setFloat32),
|
|
_1529: Function.prototype.call.bind(DataView.prototype.getFloat64),
|
|
_1530: Function.prototype.call.bind(DataView.prototype.setFloat64),
|
|
_1543: (ms, c) =>
|
|
setTimeout(() => dartInstance.exports.$invokeCallback(c),ms),
|
|
_1544: (handle) => clearTimeout(handle),
|
|
_1545: (ms, c) =>
|
|
setInterval(() => dartInstance.exports.$invokeCallback(c), ms),
|
|
_1546: (handle) => clearInterval(handle),
|
|
_1547: (c) =>
|
|
queueMicrotask(() => dartInstance.exports.$invokeCallback(c)),
|
|
_1548: () => Date.now(),
|
|
_1549: (s, m) => {
|
|
try {
|
|
return new RegExp(s, m);
|
|
} catch (e) {
|
|
return String(e);
|
|
}
|
|
},
|
|
_1550: (x0,x1) => x0.exec(x1),
|
|
_1551: (x0,x1) => x0.test(x1),
|
|
_1552: x0 => x0.pop(),
|
|
_1554: o => o === undefined,
|
|
_1556: o => typeof o === 'function' && o[jsWrappedDartFunctionSymbol] === true,
|
|
_1558: o => {
|
|
const proto = Object.getPrototypeOf(o);
|
|
return proto === Object.prototype || proto === null;
|
|
},
|
|
_1559: o => o instanceof RegExp,
|
|
_1560: (l, r) => l === r,
|
|
_1561: o => o,
|
|
_1562: o => o,
|
|
_1563: o => o,
|
|
_1564: b => !!b,
|
|
_1565: o => o.length,
|
|
_1567: (o, i) => o[i],
|
|
_1568: f => f.dartFunction,
|
|
_1569: () => ({}),
|
|
_1570: () => [],
|
|
_1572: () => globalThis,
|
|
_1573: (constructor, args) => {
|
|
const factoryFunction = constructor.bind.apply(
|
|
constructor, [null, ...args]);
|
|
return new factoryFunction();
|
|
},
|
|
_1574: (o, p) => p in o,
|
|
_1575: (o, p) => o[p],
|
|
_1576: (o, p, v) => o[p] = v,
|
|
_1577: (o, m, a) => o[m].apply(o, a),
|
|
_1579: o => String(o),
|
|
_1580: (p, s, f) => p.then(s, (e) => f(e, e === undefined)),
|
|
_1581: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1581(f,arguments.length,x0) }),
|
|
_1582: f => finalizeWrapper(f, function(x0,x1) { return dartInstance.exports._1582(f,arguments.length,x0,x1) }),
|
|
_1583: o => {
|
|
if (o === undefined) return 1;
|
|
var type = typeof o;
|
|
if (type === 'boolean') return 2;
|
|
if (type === 'number') return 3;
|
|
if (type === 'string') return 4;
|
|
if (o instanceof Array) return 5;
|
|
if (ArrayBuffer.isView(o)) {
|
|
if (o instanceof Int8Array) return 6;
|
|
if (o instanceof Uint8Array) return 7;
|
|
if (o instanceof Uint8ClampedArray) return 8;
|
|
if (o instanceof Int16Array) return 9;
|
|
if (o instanceof Uint16Array) return 10;
|
|
if (o instanceof Int32Array) return 11;
|
|
if (o instanceof Uint32Array) return 12;
|
|
if (o instanceof Float32Array) return 13;
|
|
if (o instanceof Float64Array) return 14;
|
|
if (o instanceof DataView) return 15;
|
|
}
|
|
if (o instanceof ArrayBuffer) return 16;
|
|
// Feature check for `SharedArrayBuffer` before doing a type-check.
|
|
if (globalThis.SharedArrayBuffer !== undefined &&
|
|
o instanceof SharedArrayBuffer) {
|
|
return 17;
|
|
}
|
|
if (o instanceof Promise) return 18;
|
|
return 19;
|
|
},
|
|
_1584: o => [o],
|
|
_1585: (o0, o1) => [o0, o1],
|
|
_1586: (o0, o1, o2) => [o0, o1, o2],
|
|
_1587: (o0, o1, o2, o3) => [o0, o1, o2, o3],
|
|
_1588: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const getValue = dartInstance.exports.$wasmI8ArrayGet;
|
|
for (let i = 0; i < length; i++) {
|
|
jsArray[jsArrayOffset + i] = getValue(wasmArray, wasmArrayOffset + i);
|
|
}
|
|
},
|
|
_1589: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const setValue = dartInstance.exports.$wasmI8ArraySet;
|
|
for (let i = 0; i < length; i++) {
|
|
setValue(wasmArray, wasmArrayOffset + i, jsArray[jsArrayOffset + i]);
|
|
}
|
|
},
|
|
_1590: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const getValue = dartInstance.exports.$wasmI16ArrayGet;
|
|
for (let i = 0; i < length; i++) {
|
|
jsArray[jsArrayOffset + i] = getValue(wasmArray, wasmArrayOffset + i);
|
|
}
|
|
},
|
|
_1591: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const setValue = dartInstance.exports.$wasmI16ArraySet;
|
|
for (let i = 0; i < length; i++) {
|
|
setValue(wasmArray, wasmArrayOffset + i, jsArray[jsArrayOffset + i]);
|
|
}
|
|
},
|
|
_1592: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const getValue = dartInstance.exports.$wasmI32ArrayGet;
|
|
for (let i = 0; i < length; i++) {
|
|
jsArray[jsArrayOffset + i] = getValue(wasmArray, wasmArrayOffset + i);
|
|
}
|
|
},
|
|
_1593: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const setValue = dartInstance.exports.$wasmI32ArraySet;
|
|
for (let i = 0; i < length; i++) {
|
|
setValue(wasmArray, wasmArrayOffset + i, jsArray[jsArrayOffset + i]);
|
|
}
|
|
},
|
|
_1594: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const getValue = dartInstance.exports.$wasmF32ArrayGet;
|
|
for (let i = 0; i < length; i++) {
|
|
jsArray[jsArrayOffset + i] = getValue(wasmArray, wasmArrayOffset + i);
|
|
}
|
|
},
|
|
_1595: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const setValue = dartInstance.exports.$wasmF32ArraySet;
|
|
for (let i = 0; i < length; i++) {
|
|
setValue(wasmArray, wasmArrayOffset + i, jsArray[jsArrayOffset + i]);
|
|
}
|
|
},
|
|
_1596: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const getValue = dartInstance.exports.$wasmF64ArrayGet;
|
|
for (let i = 0; i < length; i++) {
|
|
jsArray[jsArrayOffset + i] = getValue(wasmArray, wasmArrayOffset + i);
|
|
}
|
|
},
|
|
_1597: (jsArray, jsArrayOffset, wasmArray, wasmArrayOffset, length) => {
|
|
const setValue = dartInstance.exports.$wasmF64ArraySet;
|
|
for (let i = 0; i < length; i++) {
|
|
setValue(wasmArray, wasmArrayOffset + i, jsArray[jsArrayOffset + i]);
|
|
}
|
|
},
|
|
_1598: x0 => new ArrayBuffer(x0),
|
|
_1599: s => {
|
|
if (/[[\]{}()*+?.\\^$|]/.test(s)) {
|
|
s = s.replace(/[[\]{}()*+?.\\^$|]/g, '\\$&');
|
|
}
|
|
return s;
|
|
},
|
|
_1601: x0 => x0.index,
|
|
_1602: x0 => x0.groups,
|
|
_1603: x0 => x0.flags,
|
|
_1604: x0 => x0.multiline,
|
|
_1605: x0 => x0.ignoreCase,
|
|
_1606: x0 => x0.unicode,
|
|
_1607: x0 => x0.dotAll,
|
|
_1608: (x0,x1) => { x0.lastIndex = x1 },
|
|
_1609: (o, p) => p in o,
|
|
_1610: (o, p) => o[p],
|
|
_1613: () => new XMLHttpRequest(),
|
|
_1614: (x0,x1,x2,x3) => x0.open(x1,x2,x3),
|
|
_1618: x0 => x0.send(),
|
|
_1620: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1620(f,arguments.length,x0) }),
|
|
_1621: f => finalizeWrapper(f, function(x0) { return dartInstance.exports._1621(f,arguments.length,x0) }),
|
|
_1637: (x0,x1) => x0.key(x1),
|
|
_1638: x0 => x0.random(),
|
|
_1639: (x0,x1) => x0.getRandomValues(x1),
|
|
_1640: () => globalThis.crypto,
|
|
_1641: () => globalThis.Math,
|
|
_1651: Function.prototype.call.bind(Number.prototype.toString),
|
|
_1652: Function.prototype.call.bind(BigInt.prototype.toString),
|
|
_1653: Function.prototype.call.bind(Number.prototype.toString),
|
|
_1654: (d, digits) => d.toFixed(digits),
|
|
_1668: () => globalThis.document,
|
|
_1669: () => globalThis.window,
|
|
_1674: (x0,x1) => { x0.height = x1 },
|
|
_1676: (x0,x1) => { x0.width = x1 },
|
|
_1679: x0 => x0.head,
|
|
_1680: x0 => x0.classList,
|
|
_1684: (x0,x1) => { x0.innerText = x1 },
|
|
_1685: x0 => x0.style,
|
|
_1687: x0 => x0.sheet,
|
|
_1698: x0 => x0.offsetX,
|
|
_1699: x0 => x0.offsetY,
|
|
_1700: x0 => x0.button,
|
|
_1759: (x0,x1) => { x0.responseType = x1 },
|
|
_1760: x0 => x0.response,
|
|
_1820: (x0,x1) => { x0.draggable = x1 },
|
|
_1836: x0 => x0.style,
|
|
_2089: x0 => x0.content,
|
|
_2195: (x0,x1) => { x0.download = x1 },
|
|
_2220: (x0,x1) => { x0.href = x1 },
|
|
_2765: (x0,x1) => { x0.accept = x1 },
|
|
_2779: x0 => x0.files,
|
|
_2805: (x0,x1) => { x0.multiple = x1 },
|
|
_2823: (x0,x1) => { x0.type = x1 },
|
|
_3073: (x0,x1) => { x0.src = x1 },
|
|
_3075: (x0,x1) => { x0.type = x1 },
|
|
_3079: (x0,x1) => { x0.async = x1 },
|
|
_3093: (x0,x1) => { x0.charset = x1 },
|
|
_3524: x0 => x0.items,
|
|
_3527: (x0,x1) => x0[x1],
|
|
_3531: x0 => x0.length,
|
|
_3537: x0 => x0.dataTransfer,
|
|
_3541: () => globalThis.window,
|
|
_3584: x0 => x0.location,
|
|
_3603: x0 => x0.navigator,
|
|
_3674: (x0,x1) => { x0.ondragenter = x1 },
|
|
_3676: (x0,x1) => { x0.ondragleave = x1 },
|
|
_3678: (x0,x1) => { x0.ondragover = x1 },
|
|
_3682: (x0,x1) => { x0.ondrop = x1 },
|
|
_3867: x0 => x0.localStorage,
|
|
_3875: x0 => x0.href,
|
|
_3969: x0 => x0.clipboard,
|
|
_3990: x0 => x0.userAgent,
|
|
_3991: x0 => x0.vendor,
|
|
_4198: x0 => x0.length,
|
|
_6102: x0 => x0.type,
|
|
_6204: x0 => x0.firstChild,
|
|
_6215: () => globalThis.document,
|
|
_6297: x0 => x0.body,
|
|
_6629: (x0,x1) => { x0.id = x1 },
|
|
_6656: x0 => x0.children,
|
|
_6962: x0 => x0.clientX,
|
|
_6963: x0 => x0.clientY,
|
|
_8157: x0 => x0.size,
|
|
_8158: x0 => x0.type,
|
|
_8164: x0 => x0.name,
|
|
_8165: x0 => x0.lastModified,
|
|
_8170: x0 => x0.length,
|
|
_8175: x0 => x0.result,
|
|
_11083: (x0,x1) => { x0.display = x1 },
|
|
_12990: x0 => x0.isDirectory,
|
|
_12991: x0 => x0.name,
|
|
_12992: x0 => x0.fullPath,
|
|
|
|
};
|
|
|
|
const baseImports = {
|
|
dart2wasm: dart2wasm,
|
|
Math: Math,
|
|
Date: Date,
|
|
Object: Object,
|
|
Array: Array,
|
|
Reflect: Reflect,
|
|
S: new Proxy({}, { get(_, prop) { return prop; } }),
|
|
|
|
};
|
|
|
|
const jsStringPolyfill = {
|
|
"charCodeAt": (s, i) => s.charCodeAt(i),
|
|
"compare": (s1, s2) => {
|
|
if (s1 < s2) return -1;
|
|
if (s1 > s2) return 1;
|
|
return 0;
|
|
},
|
|
"concat": (s1, s2) => s1 + s2,
|
|
"equals": (s1, s2) => s1 === s2,
|
|
"fromCharCode": (i) => String.fromCharCode(i),
|
|
"length": (s) => s.length,
|
|
"substring": (s, a, b) => s.substring(a, b),
|
|
"fromCharCodeArray": (a, start, end) => {
|
|
if (end <= start) return '';
|
|
|
|
const read = dartInstance.exports.$wasmI16ArrayGet;
|
|
let result = '';
|
|
let index = start;
|
|
const chunkLength = Math.min(end - index, 500);
|
|
let array = new Array(chunkLength);
|
|
while (index < end) {
|
|
const newChunkLength = Math.min(end - index, 500);
|
|
for (let i = 0; i < newChunkLength; i++) {
|
|
array[i] = read(a, index++);
|
|
}
|
|
if (newChunkLength < chunkLength) {
|
|
array = array.slice(0, newChunkLength);
|
|
}
|
|
result += String.fromCharCode(...array);
|
|
}
|
|
return result;
|
|
},
|
|
"intoCharCodeArray": (s, a, start) => {
|
|
if (s === '') return 0;
|
|
|
|
const write = dartInstance.exports.$wasmI16ArraySet;
|
|
for (var i = 0; i < s.length; ++i) {
|
|
write(a, start++, s.charCodeAt(i));
|
|
}
|
|
return s.length;
|
|
},
|
|
"test": (s) => typeof s == "string",
|
|
};
|
|
|
|
|
|
|
|
|
|
dartInstance = await WebAssembly.instantiate(this.module, {
|
|
...baseImports,
|
|
...additionalImports,
|
|
|
|
"wasm:js-string": jsStringPolyfill,
|
|
});
|
|
|
|
return new InstantiatedApp(this, dartInstance);
|
|
}
|
|
}
|
|
|
|
class InstantiatedApp {
|
|
constructor(compiledApp, instantiatedModule) {
|
|
this.compiledApp = compiledApp;
|
|
this.instantiatedModule = instantiatedModule;
|
|
}
|
|
|
|
// Call the main function with the given arguments.
|
|
invokeMain(...args) {
|
|
this.instantiatedModule.exports.$invokeMain(args);
|
|
}
|
|
}
|