isomorfeus-asset-manager 0.14.24 → 0.14.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isomorfeus/asset_manager/version.rb +1 -1
- data/node_modules/.package-lock.json +3 -3
- data/node_modules/esbuild-wasm/LICENSE.md +21 -0
- data/node_modules/esbuild-wasm/esbuild.wasm +0 -0
- data/node_modules/esbuild-wasm/esm/browser.d.ts +7 -3
- data/node_modules/esbuild-wasm/esm/browser.js +21 -11
- data/node_modules/esbuild-wasm/esm/browser.min.js +7 -7
- data/node_modules/esbuild-wasm/lib/browser.d.ts +7 -3
- data/node_modules/esbuild-wasm/lib/browser.js +22 -11
- data/node_modules/esbuild-wasm/lib/browser.min.js +8 -8
- data/node_modules/esbuild-wasm/lib/main.d.ts +7 -3
- data/node_modules/esbuild-wasm/lib/main.js +34 -36
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/package.json +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2550796d4ff2f2c815a485ed7ced24b825b0651d8838fb313271e41c9fdae488
|
4
|
+
data.tar.gz: 29442cda3c1a8b69d7063355e7e1b935faf73b127c1901b15b3195a635609e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64906b53a385b158273ea7fa0b3b8affdd925ed5846e58cd855e57deae61473f44616d5a76c5bb8dc624453dac50c2803037c91e480385bdbd4bbfdd0b0d8588
|
7
|
+
data.tar.gz: 6a98c69a12f6a5918c8ac37243b2b206cc5672a6481bc71b20afa1a32e4bae15fee86bf521feeabcf3afb593bec597768b709b0217eba5d6d4b4eb59464b04ca
|
@@ -4,9 +4,9 @@
|
|
4
4
|
"requires": true,
|
5
5
|
"packages": {
|
6
6
|
"node_modules/esbuild-wasm": {
|
7
|
-
"version": "0.14.
|
8
|
-
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.14.
|
9
|
-
"integrity": "sha512-
|
7
|
+
"version": "0.14.49",
|
8
|
+
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.14.49.tgz",
|
9
|
+
"integrity": "sha512-5ddzZv8M3WI1fWZ5rEfK5cSA9swlWJcceKgqjKLLERC7FnlNW50kF7hxhpkyC0Z/4w7Xeyt3yUJ9QWNMDXLk2Q==",
|
10
10
|
"bin": {
|
11
11
|
"esbuild": "bin/esbuild"
|
12
12
|
},
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Evan Wallace
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export type Platform = 'browser' | 'node' | 'neutral';
|
2
2
|
export type Format = 'iife' | 'cjs' | 'esm';
|
3
|
-
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'default';
|
3
|
+
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'copy' | 'default';
|
4
4
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
5
5
|
export type Charset = 'ascii' | 'utf8';
|
6
6
|
export type Drop = 'console' | 'debugger';
|
@@ -17,10 +17,12 @@ interface CommonOptions {
|
|
17
17
|
|
18
18
|
/** Documentation: https://esbuild.github.io/api/#format */
|
19
19
|
format?: Format;
|
20
|
-
/** Documentation: https://esbuild.github.io/api/#
|
20
|
+
/** Documentation: https://esbuild.github.io/api/#global-name */
|
21
21
|
globalName?: string;
|
22
22
|
/** Documentation: https://esbuild.github.io/api/#target */
|
23
23
|
target?: string | string[];
|
24
|
+
/** Documentation: https://esbuild.github.io/api/#supported */
|
25
|
+
supported?: Record<string, boolean>;
|
24
26
|
|
25
27
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
26
28
|
mangleProps?: RegExp;
|
@@ -94,7 +96,7 @@ export interface BuildOptions extends CommonOptions {
|
|
94
96
|
loader?: { [ext: string]: Loader };
|
95
97
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
96
98
|
resolveExtensions?: string[];
|
97
|
-
/** Documentation: https://esbuild.github.io/api/#
|
99
|
+
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
98
100
|
mainFields?: string[];
|
99
101
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
100
102
|
conditions?: string[];
|
@@ -148,6 +150,7 @@ export interface StdinOptions {
|
|
148
150
|
}
|
149
151
|
|
150
152
|
export interface Message {
|
153
|
+
id: string;
|
151
154
|
pluginName: string;
|
152
155
|
text: string;
|
153
156
|
location: Location | null;
|
@@ -402,6 +405,7 @@ export interface OnLoadResult {
|
|
402
405
|
}
|
403
406
|
|
404
407
|
export interface PartialMessage {
|
408
|
+
id?: string;
|
405
409
|
pluginName?: string;
|
406
410
|
text?: string;
|
407
411
|
location?: Partial<Location> | null;
|
@@ -304,6 +304,7 @@ function pushCommonFlags(flags, options, keys) {
|
|
304
304
|
let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
|
305
305
|
let define = getFlag(options, keys, "define", mustBeObject);
|
306
306
|
let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
|
307
|
+
let supported = getFlag(options, keys, "supported", mustBeObject);
|
307
308
|
let pure = getFlag(options, keys, "pure", mustBeArray);
|
308
309
|
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
309
310
|
if (legalComments)
|
@@ -365,6 +366,13 @@ function pushCommonFlags(flags, options, keys) {
|
|
365
366
|
flags.push(`--log-override:${key}=${logOverride[key]}`);
|
366
367
|
}
|
367
368
|
}
|
369
|
+
if (supported) {
|
370
|
+
for (let key in supported) {
|
371
|
+
if (key.indexOf("=") >= 0)
|
372
|
+
throw new Error(`Invalid supported: ${key}`);
|
373
|
+
flags.push(`--supported:${key}=${supported[key]}`);
|
374
|
+
}
|
375
|
+
}
|
368
376
|
if (pure)
|
369
377
|
for (let fn of pure)
|
370
378
|
flags.push(`--pure:${fn}`);
|
@@ -739,8 +747,8 @@ function createChannel(streamIn) {
|
|
739
747
|
if (isFirstPacket) {
|
740
748
|
isFirstPacket = false;
|
741
749
|
let binaryVersion = String.fromCharCode(...bytes);
|
742
|
-
if (binaryVersion !== "0.14.
|
743
|
-
throw new Error(`Cannot start service: Host version "${"0.14.
|
750
|
+
if (binaryVersion !== "0.14.49") {
|
751
|
+
throw new Error(`Cannot start service: Host version "${"0.14.49"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
744
752
|
}
|
745
753
|
return;
|
746
754
|
}
|
@@ -1189,7 +1197,7 @@ function createChannel(streamIn) {
|
|
1189
1197
|
callerRefs.unref();
|
1190
1198
|
}
|
1191
1199
|
};
|
1192
|
-
let writeDefault = !streamIn.
|
1200
|
+
let writeDefault = !streamIn.isWriteUnavailable;
|
1193
1201
|
let {
|
1194
1202
|
entries,
|
1195
1203
|
flags,
|
@@ -1249,7 +1257,7 @@ function createChannel(streamIn) {
|
|
1249
1257
|
throw new Error("Cannot rebuild");
|
1250
1258
|
sendRequest(refs, { command: "rebuild", key }, (error2, response2) => {
|
1251
1259
|
if (error2) {
|
1252
|
-
const message = { pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
|
1260
|
+
const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
|
1253
1261
|
return callback2(failureErrorWithLog("Build failed", [message], []), null);
|
1254
1262
|
}
|
1255
1263
|
buildResponseToResult(response2, (error3, result3) => {
|
@@ -1317,8 +1325,8 @@ function createChannel(streamIn) {
|
|
1317
1325
|
callback2(null, result);
|
1318
1326
|
});
|
1319
1327
|
};
|
1320
|
-
if (write && streamIn.
|
1321
|
-
throw new Error(`
|
1328
|
+
if (write && streamIn.isWriteUnavailable)
|
1329
|
+
throw new Error(`The "write" option is unavailable in this environment`);
|
1322
1330
|
if (incremental && streamIn.isSync)
|
1323
1331
|
throw new Error(`Cannot use "incremental" with a synchronous build`);
|
1324
1332
|
if (watch && streamIn.isSync)
|
@@ -1532,7 +1540,7 @@ function extractErrorMessageV8(e, streamIn, stash, note, pluginName) {
|
|
1532
1540
|
location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), "");
|
1533
1541
|
} catch (e2) {
|
1534
1542
|
}
|
1535
|
-
return { pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
1543
|
+
return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
|
1536
1544
|
}
|
1537
1545
|
function parseStackLinesV8(streamIn, lines, ident) {
|
1538
1546
|
let at = " at ";
|
@@ -1631,6 +1639,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
|
|
1631
1639
|
let index = 0;
|
1632
1640
|
for (const message of messages) {
|
1633
1641
|
let keys = {};
|
1642
|
+
let id = getFlag(message, keys, "id", mustBeString);
|
1634
1643
|
let pluginName = getFlag(message, keys, "pluginName", mustBeString);
|
1635
1644
|
let text = getFlag(message, keys, "text", mustBeString);
|
1636
1645
|
let location = getFlag(message, keys, "location", mustBeObjectOrNull);
|
@@ -1652,6 +1661,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
|
|
1652
1661
|
}
|
1653
1662
|
}
|
1654
1663
|
messagesClone.push({
|
1664
|
+
id: id || "",
|
1655
1665
|
pluginName: pluginName || fallbackPluginName,
|
1656
1666
|
text: text || "",
|
1657
1667
|
location: sanitizeLocation(location, where),
|
@@ -1685,7 +1695,7 @@ function convertOutputFiles({ path, contents }) {
|
|
1685
1695
|
}
|
1686
1696
|
|
1687
1697
|
// lib/npm/browser.ts
|
1688
|
-
var version = "0.14.
|
1698
|
+
var version = "0.14.49";
|
1689
1699
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1690
1700
|
var serve = () => {
|
1691
1701
|
throw new Error(`The "serve" API only works in node`);
|
@@ -1741,7 +1751,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
1741
1751
|
}
|
1742
1752
|
let worker;
|
1743
1753
|
if (useWorker) {
|
1744
|
-
let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substr(0, nl));\n outputBuf = outputBuf.substr(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n go: {\n "runtime.wasmExit": (sp) => {\n sp >>>= 0;\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n "runtime.wasmWrite": (sp) => {\n sp >>>= 0;\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n "runtime.resetMemoryDataView": (sp) => {\n sp >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n "runtime.walltime": (sp) => {\n sp >>>= 0;\n const msec = new Date().getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(() => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n }, getInt64(sp + 8) + 1));\n this.mem.setInt32(sp + 16, id, true);\n },\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n async run(instance) {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n await this._exitPromise;\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.14.42"}`];\n if (wasm instanceof WebAssembly.Module) {\n WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));\n } else {\n WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));\n }\n };\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
1754
|
+
let blob = new Blob([`onmessage=${'((postMessage) => {\n // Copyright 2018 The Go Authors. All rights reserved.\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substr(0, nl));\n outputBuf = outputBuf.substr(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n go: {\n "runtime.wasmExit": (sp) => {\n sp >>>= 0;\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n "runtime.wasmWrite": (sp) => {\n sp >>>= 0;\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n "runtime.resetMemoryDataView": (sp) => {\n sp >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n "runtime.walltime": (sp) => {\n sp >>>= 0;\n const msec = new Date().getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(() => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n }, getInt64(sp + 8) + 1));\n this.mem.setInt32(sp + 16, id, true);\n },\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n async run(instance) {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n await this._exitPromise;\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.14.49"}`];\n if (wasm instanceof WebAssembly.Module) {\n WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));\n } else {\n WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));\n }\n };\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
|
1745
1755
|
worker = new Worker(URL.createObjectURL(blob));
|
1746
1756
|
} else {
|
1747
1757
|
let onmessage = ((postMessage) => {
|
@@ -2320,7 +2330,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2320
2330
|
callback(null, count);
|
2321
2331
|
};
|
2322
2332
|
let go = new globalThis.Go();
|
2323
|
-
go.argv = ["", `--service=${"0.14.
|
2333
|
+
go.argv = ["", `--service=${"0.14.49"}`];
|
2324
2334
|
if (wasm instanceof WebAssembly.Module) {
|
2325
2335
|
WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));
|
2326
2336
|
} else {
|
@@ -2343,7 +2353,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2343
2353
|
worker.postMessage(bytes);
|
2344
2354
|
},
|
2345
2355
|
isSync: false,
|
2346
|
-
|
2356
|
+
isWriteUnavailable: true,
|
2347
2357
|
esbuild: browser_exports
|
2348
2358
|
});
|
2349
2359
|
longLivedService = {
|
@@ -1,15 +1,15 @@
|
|
1
|
-
var Ie=Object.defineProperty,rt=Object.defineProperties;var nt=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var lt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Te=(e,t)=>{for(var r in t||(t={}))lt.call(t,r)&&qe(e,r,t[r]);if(We)for(var r of We(t))it.call(t,r)&&qe(e,r,t[r]);return e},De=(e,t)=>rt(e,nt(t));var st=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})};var Ae={};st(Ae,{analyzeMetafile:()=>St,analyzeMetafileSync:()=>$t,build:()=>wt,buildSync:()=>xt,default:()=>Pt,formatMessages:()=>Ot,formatMessagesSync:()=>kt,initialize:()=>Mt,serve:()=>vt,transform:()=>Rt,transformSync:()=>Et,version:()=>bt});function Fe(e){let t=s=>{if(s===null)r.write8(0);else if(typeof s=="boolean")r.write8(1),r.write8(+s);else if(typeof s=="number")r.write8(2),r.write32(s|0);else if(typeof s=="string")r.write8(3),r.write(ce(s));else if(s instanceof Uint8Array)r.write8(4),r.write(s);else if(s instanceof Array){r.write8(5),r.write32(s.length);for(let d of s)t(d)}else{let d=Object.keys(s);r.write8(6),r.write32(d.length);for(let i of d)r.write(ce(i)),t(s[i])}},r=new xe;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Ne(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function ze(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return he(r.read());case 4:return r.read();case 5:{let f=r.read32(),l=[];for(let h=0;h<f;h++)l.push(t());return l}case 6:{let f=r.read32(),l={};for(let h=0;h<f;h++)l[he(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new xe(e),s=r.read32(),d=(s&1)===0;s>>>=1;let i=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:s,isRequest:d,value:i}}var xe=class{constructor(t=new Uint8Array(1024)){this.buf=t;this.len=0;this.ptr=0}_write(t){if(this.len+t>this.buf.length){let r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);Ne(this.buf,t,r)}write(t){let r=this._write(4+t.length);Ne(this.buf,t.length,r),this.buf.set(t,r+4)}_read(t){if(this.ptr+t>this.buf.length)throw new Error("Invalid packet");return this.ptr+=t,this.ptr-t}read8(){return this.buf[this._read(1)]}read32(){return je(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),s=this._read(r.length);return r.set(this.buf.subarray(s,s+t)),r}},ce,he;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ce=r=>e.encode(r),he=r=>t.decode(r)}else if(typeof Buffer!="undefined")ce=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},he=e=>{let{buffer:t,byteOffset:r,byteLength:s}=e;return Buffer.from(t,r,s).toString()};else throw new Error("No UTF-8 codec found");function je(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Ne(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ke(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var $e=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",at=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",m=e=>typeof e=="string"?null:"a string",Me=e=>e instanceof RegExp?null:"a RegExp object",Oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Le=e=>typeof e=="function"?null:"a function",V=e=>Array.isArray(e)?null:"an array",oe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ut=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",ft=e=>typeof e=="object"&&e!==null?null:"an array or an object",_e=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ye=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",ct=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",dt=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",pt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,s){let d=e[r];if(t[r+""]=!0,d===void 0)return;let i=s(d);if(i!==null)throw new Error(`"${r}" must be ${i}`);return d}function Y(e,t,r){for(let s in e)if(!(s in t))throw new Error(`Invalid option ${r}: "${s}"`)}function Qe(e){let t=Object.create(null),r=n(e,t,"wasmURL",m),s=n(e,t,"wasmModule",ut),d=n(e,t,"worker",I);return Y(e,t,"in initialize() call"),{wasmURL:r,wasmModule:s,worker:d}}function He(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let s=e[r];if(typeof s=="string"||s===!1)t[r]=s;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Ce(e,t,r,s,d){let i=n(t,r,"color",I),f=n(t,r,"logLevel",m),l=n(t,r,"logLimit",Oe);i!==void 0?e.push(`--color=${i}`):s&&e.push("--color=true"),e.push(`--log-level=${f||d}`),e.push(`--log-limit=${l||0}`)}function Ge(e,t,r){let s=n(t,r,"legalComments",m),d=n(t,r,"sourceRoot",m),i=n(t,r,"sourcesContent",I),f=n(t,r,"target",dt),l=n(t,r,"format",m),h=n(t,r,"globalName",m),O=n(t,r,"mangleProps",Me),N=n(t,r,"reserveProps",Me),k=n(t,r,"mangleQuoted",I),C=n(t,r,"minify",I),q=n(t,r,"minifySyntax",I),ae=n(t,r,"minifyWhitespace",I),re=n(t,r,"minifyIdentifiers",I),ne=n(t,r,"drop",V),le=n(t,r,"charset",m),ie=n(t,r,"treeShaking",I),pe=n(t,r,"ignoreAnnotations",I),ue=n(t,r,"jsx",m),ge=n(t,r,"jsxFactory",m),fe=n(t,r,"jsxFragment",m),me=n(t,r,"define",oe),ye=n(t,r,"logOverride",oe),we=n(t,r,"pure",V),g=n(t,r,"keepNames",I);if(s&&e.push(`--legal-comments=${s}`),d!==void 0&&e.push(`--source-root=${d}`),i!==void 0&&e.push(`--sources-content=${i}`),f&&(Array.isArray(f)?e.push(`--target=${Array.from(f).map(Ke).join(",")}`):e.push(`--target=${Ke(f)}`)),l&&e.push(`--format=${l}`),h&&e.push(`--global-name=${h}`),C&&e.push("--minify"),q&&e.push("--minify-syntax"),ae&&e.push("--minify-whitespace"),re&&e.push("--minify-identifiers"),le&&e.push(`--charset=${le}`),ie!==void 0&&e.push(`--tree-shaking=${ie}`),pe&&e.push("--ignore-annotations"),ne)for(let o of ne)e.push(`--drop:${o}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),k!==void 0&&e.push(`--mangle-quoted=${k}`),ue&&e.push(`--jsx=${ue}`),ge&&e.push(`--jsx-factory=${ge}`),fe&&e.push(`--jsx-fragment=${fe}`),me)for(let o in me){if(o.indexOf("=")>=0)throw new Error(`Invalid define: ${o}`);e.push(`--define:${o}=${me[o]}`)}if(ye)for(let o in ye){if(o.indexOf("=")>=0)throw new Error(`Invalid log override: ${o}`);e.push(`--log-override:${o}=${ye[o]}`)}if(we)for(let o of we)e.push(`--pure:${o}`);g&&e.push("--keep-names")}function gt(e,t,r,s,d){var b;let i=[],f=[],l=Object.create(null),h=null,O=null,N=null;Ce(i,t,l,r,s),Ge(i,t,l);let k=n(t,l,"sourcemap",Ye),C=n(t,l,"bundle",I),q=n(t,l,"watch",at),ae=n(t,l,"splitting",I),re=n(t,l,"preserveSymlinks",I),ne=n(t,l,"metafile",I),le=n(t,l,"outfile",m),ie=n(t,l,"outdir",m),pe=n(t,l,"outbase",m),ue=n(t,l,"platform",m),ge=n(t,l,"tsconfig",m),fe=n(t,l,"resolveExtensions",V),me=n(t,l,"nodePaths",V),ye=n(t,l,"mainFields",V),we=n(t,l,"conditions",V),g=n(t,l,"external",V),o=n(t,l,"loader",oe),a=n(t,l,"outExtension",oe),c=n(t,l,"publicPath",m),F=n(t,l,"entryNames",m),B=n(t,l,"chunkNames",m),$=n(t,l,"assetNames",m),x=n(t,l,"inject",V),P=n(t,l,"banner",oe),M=n(t,l,"footer",oe),R=n(t,l,"entryPoints",ft),L=n(t,l,"absWorkingDir",m),S=n(t,l,"stdin",oe),T=(b=n(t,l,"write",I))!=null?b:d,W=n(t,l,"allowOverwrite",I),ee=n(t,l,"incremental",I)===!0,E=n(t,l,"mangleCache",oe);if(l.plugins=!0,Y(t,l,`in ${e}() call`),k&&i.push(`--sourcemap${k===!0?"":`=${k}`}`),C&&i.push("--bundle"),W&&i.push("--allow-overwrite"),q)if(i.push("--watch"),typeof q=="boolean")N={};else{let u=Object.create(null),v=n(q,u,"onRebuild",Le);Y(q,u,`on "watch" in ${e}() call`),N={onRebuild:v}}if(ae&&i.push("--splitting"),re&&i.push("--preserve-symlinks"),ne&&i.push("--metafile"),le&&i.push(`--outfile=${le}`),ie&&i.push(`--outdir=${ie}`),pe&&i.push(`--outbase=${pe}`),ue&&i.push(`--platform=${ue}`),ge&&i.push(`--tsconfig=${ge}`),fe){let u=[];for(let v of fe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);u.push(v)}i.push(`--resolve-extensions=${u.join(",")}`)}if(c&&i.push(`--public-path=${c}`),F&&i.push(`--entry-names=${F}`),B&&i.push(`--chunk-names=${B}`),$&&i.push(`--asset-names=${$}`),ye){let u=[];for(let v of ye){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);u.push(v)}i.push(`--main-fields=${u.join(",")}`)}if(we){let u=[];for(let v of we){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);u.push(v)}i.push(`--conditions=${u.join(",")}`)}if(g)for(let u of g)i.push(`--external:${u}`);if(P)for(let u in P){if(u.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${u}`);i.push(`--banner:${u}=${P[u]}`)}if(M)for(let u in M){if(u.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${u}`);i.push(`--footer:${u}=${M[u]}`)}if(x)for(let u of x)i.push(`--inject:${u}`);if(o)for(let u in o){if(u.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${u}`);i.push(`--loader:${u}=${o[u]}`)}if(a)for(let u in a){if(u.indexOf("=")>=0)throw new Error(`Invalid out extension: ${u}`);i.push(`--out-extension:${u}=${a[u]}`)}if(R)if(Array.isArray(R))for(let u of R)f.push(["",u+""]);else for(let[u,v]of Object.entries(R))f.push([u+"",v+""]);if(S){let u=Object.create(null),v=n(S,u,"contents",m),U=n(S,u,"resolveDir",m),w=n(S,u,"sourcefile",m),p=n(S,u,"loader",m);Y(S,u,'in "stdin" object'),w&&i.push(`--sourcefile=${w}`),p&&i.push(`--loader=${p}`),U&&(O=U+""),h=v?v+"":""}let y=[];if(me)for(let u of me)u+="",y.push(u);return{entries:f,flags:i,write:T,stdinContents:h,stdinResolveDir:O,absWorkingDir:L,incremental:ee,nodePaths:y,watch:N,mangleCache:He(E)}}function mt(e,t,r,s){let d=[],i=Object.create(null);Ce(d,t,i,r,s),Ge(d,t,i);let f=n(t,i,"sourcemap",Ye),l=n(t,i,"tsconfigRaw",ct),h=n(t,i,"sourcefile",m),O=n(t,i,"loader",m),N=n(t,i,"banner",m),k=n(t,i,"footer",m),C=n(t,i,"mangleCache",oe);return Y(t,i,`in ${e}() call`),f&&d.push(`--sourcemap=${f===!0?"external":f}`),l&&d.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),h&&d.push(`--sourcefile=${h}`),O&&d.push(`--loader=${O}`),N&&d.push(`--banner=${N}`),k&&d.push(`--footer=${k}`),{flags:d,mangleCache:He(C)}}function Xe(e){let t=new Map,r=new Map,s=new Map,d=new Map,i=null,f=0,l=0,h=new Uint8Array(16*1024),O=0,N=g=>{let o=O+g.length;if(o>h.length){let c=new Uint8Array(o*2);c.set(h),h=c}h.set(g,O),O+=g.length;let a=0;for(;a+4<=O;){let c=je(h,a);if(a+4+c>O)break;a+=4,ne(h.subarray(a,a+c)),a+=c}a>0&&(h.copyWithin(0,a,O),O-=a)},k=g=>{i={reason:g?": "+(g.message||g):""};let o="The service was stopped"+i.reason;for(let a of t.values())a(o,null);t.clear();for(let a of d.values())a.onWait(o);d.clear();for(let a of s.values())try{a(new Error(o),null)}catch(c){console.error(c)}s.clear()},C=(g,o,a)=>{if(i)return a("The service is no longer running"+i.reason,null);let c=f++;t.set(c,(F,B)=>{try{a(F,B)}finally{g&&g.unref()}}),g&&g.ref(),e.writeToStdin(Fe({id:c,isRequest:!0,value:o}))},q=(g,o)=>{if(i)throw new Error("The service is no longer running"+i.reason);e.writeToStdin(Fe({id:g,isRequest:!1,value:o}))},ae=async(g,o)=>{try{switch(o.command){case"ping":{q(g,{});break}case"on-start":{let a=r.get(o.key);a?q(g,await a(o)):q(g,{});break}case"on-resolve":{let a=r.get(o.key);a?q(g,await a(o)):q(g,{});break}case"on-load":{let a=r.get(o.key);a?q(g,await a(o)):q(g,{});break}case"serve-request":{let a=d.get(o.key);a&&a.onRequest&&a.onRequest(o.args),q(g,{});break}case"serve-wait":{let a=d.get(o.key);a&&a.onWait(o.error),q(g,{});break}case"watch-rebuild":{let a=s.get(o.key);try{a&&a(null,o.args)}catch(c){console.error(c)}q(g,{});break}default:throw new Error("Invalid command: "+o.command)}}catch(a){q(g,{errors:[ve(a,e,null,void 0,"")]})}},re=!0,ne=g=>{if(re){re=!1;let a=String.fromCharCode(...g);if(a!=="0.14.42")throw new Error(`Cannot start service: Host version "0.14.42" does not match binary version ${JSON.stringify(a)}`);return}let o=ze(g);if(o.isRequest)ae(o.id,o.value);else{let a=t.get(o.id);t.delete(o.id),o.value.error?a(o.value.error,{}):a(null,o.value)}},le=async(g,o,a,c,F)=>{let B=[],$=[],x={},P={},M=0,R=0,L=[],S=!1;o=[...o];for(let E of o){let y={};if(typeof E!="object")throw new Error(`Plugin at index ${R} must be an object`);let b=n(E,y,"name",m);if(typeof b!="string"||b==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let u=n(E,y,"setup",Le);if(typeof u!="function")throw new Error("Plugin is missing a setup function");Y(E,y,`on plugin ${JSON.stringify(b)}`);let v={name:b,onResolve:[],onLoad:[]};R++;let w=u({initialOptions:g,resolve:(p,D={})=>{if(!S)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof p!="string")throw new Error("The path to resolve must be a string");let A=Object.create(null),Q=n(D,A,"pluginName",m),z=n(D,A,"importer",m),_=n(D,A,"namespace",m),X=n(D,A,"resolveDir",m),H=n(D,A,"kind",m),j=n(D,A,"pluginData",$e);return Y(D,A,"in resolve() call"),new Promise((J,G)=>{let K={command:"resolve",path:p,key:a,pluginName:b};Q!=null&&(K.pluginName=Q),z!=null&&(K.importer=z),_!=null&&(K.namespace=_),X!=null&&(K.resolveDir=X),H!=null&&(K.kind=H),j!=null&&(K.pluginData=c.store(j)),C(F,K,(se,Z)=>{se!==null?G(new Error(se)):J({errors:de(Z.errors,c),warnings:de(Z.warnings,c),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:c.load(Z.pluginData)})})})},onStart(p){let D='This error came from the "onStart" callback registered here:',A=Ee(new Error(D),e,"onStart");B.push({name:b,callback:p,note:A})},onEnd(p){let D='This error came from the "onEnd" callback registered here:',A=Ee(new Error(D),e,"onEnd");$.push({name:b,callback:p,note:A})},onResolve(p,D){let A='This error came from the "onResolve" callback registered here:',Q=Ee(new Error(A),e,"onResolve"),z={},_=n(p,z,"filter",Me),X=n(p,z,"namespace",m);if(Y(p,z,`in onResolve() call for plugin ${JSON.stringify(b)}`),_==null)throw new Error("onResolve() call is missing a filter");let H=M++;x[H]={name:b,callback:D,note:Q},v.onResolve.push({id:H,filter:_.source,namespace:X||""})},onLoad(p,D){let A='This error came from the "onLoad" callback registered here:',Q=Ee(new Error(A),e,"onLoad"),z={},_=n(p,z,"filter",Me),X=n(p,z,"namespace",m);if(Y(p,z,`in onLoad() call for plugin ${JSON.stringify(b)}`),_==null)throw new Error("onLoad() call is missing a filter");let H=M++;P[H]={name:b,callback:D,note:Q},v.onLoad.push({id:H,filter:_.source,namespace:X||""})},esbuild:e.esbuild});w&&await w,L.push(v)}catch(u){return{ok:!1,error:u,pluginName:b}}}let T=async E=>{switch(E.command){case"on-start":{let y={errors:[],warnings:[]};return await Promise.all(B.map(async({name:b,callback:u,note:v})=>{try{let U=await u();if(U!=null){if(typeof U!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(b)} to return an object`);let w={},p=n(U,w,"errors",V),D=n(U,w,"warnings",V);Y(U,w,`from onStart() callback in plugin ${JSON.stringify(b)}`),p!=null&&y.errors.push(...be(p,"errors",c,b)),D!=null&&y.warnings.push(...be(D,"warnings",c,b))}}catch(U){y.errors.push(ve(U,e,c,v&&v(),b))}})),y}case"on-resolve":{let y={},b="",u,v;for(let U of E.ids)try{({name:b,callback:u,note:v}=x[U]);let w=await u({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:c.load(E.pluginData)});if(w!=null){if(typeof w!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(b)} to return an object`);let p={},D=n(w,p,"pluginName",m),A=n(w,p,"path",m),Q=n(w,p,"namespace",m),z=n(w,p,"suffix",m),_=n(w,p,"external",I),X=n(w,p,"sideEffects",I),H=n(w,p,"pluginData",$e),j=n(w,p,"errors",V),J=n(w,p,"warnings",V),G=n(w,p,"watchFiles",V),K=n(w,p,"watchDirs",V);Y(w,p,`from onResolve() callback in plugin ${JSON.stringify(b)}`),y.id=U,D!=null&&(y.pluginName=D),A!=null&&(y.path=A),Q!=null&&(y.namespace=Q),z!=null&&(y.suffix=z),_!=null&&(y.external=_),X!=null&&(y.sideEffects=X),H!=null&&(y.pluginData=c.store(H)),j!=null&&(y.errors=be(j,"errors",c,b)),J!=null&&(y.warnings=be(J,"warnings",c,b)),G!=null&&(y.watchFiles=ke(G,"watchFiles")),K!=null&&(y.watchDirs=ke(K,"watchDirs"));break}}catch(w){return{id:U,errors:[ve(w,e,c,v&&v(),b)]}}return y}case"on-load":{let y={},b="",u,v;for(let U of E.ids)try{({name:b,callback:u,note:v}=P[U]);let w=await u({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:c.load(E.pluginData)});if(w!=null){if(typeof w!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(b)} to return an object`);let p={},D=n(w,p,"pluginName",m),A=n(w,p,"contents",pt),Q=n(w,p,"resolveDir",m),z=n(w,p,"pluginData",$e),_=n(w,p,"loader",m),X=n(w,p,"errors",V),H=n(w,p,"warnings",V),j=n(w,p,"watchFiles",V),J=n(w,p,"watchDirs",V);Y(w,p,`from onLoad() callback in plugin ${JSON.stringify(b)}`),y.id=U,D!=null&&(y.pluginName=D),A instanceof Uint8Array?y.contents=A:A!=null&&(y.contents=ce(A)),Q!=null&&(y.resolveDir=Q),z!=null&&(y.pluginData=c.store(z)),_!=null&&(y.loader=_),X!=null&&(y.errors=be(X,"errors",c,b)),H!=null&&(y.warnings=be(H,"warnings",c,b)),j!=null&&(y.watchFiles=ke(j,"watchFiles")),J!=null&&(y.watchDirs=ke(J,"watchDirs"));break}}catch(w){return{id:U,errors:[ve(w,e,c,v&&v(),b)]}}return y}default:throw new Error("Invalid command: "+E.command)}},W=(E,y,b)=>b();$.length>0&&(W=(E,y,b)=>{(async()=>{for(let{name:u,callback:v,note:U}of $)try{await v(E)}catch(w){E.errors.push(await new Promise(p=>y(w,u,U&&U(),p)))}})().then(b)}),S=!0;let ee=0;return{ok:!0,requestPlugins:L,runOnEndCallbacks:W,pluginRefs:{ref(){++ee===1&&r.set(a,T)},unref(){--ee===0&&r.delete(a)}}}},ie=(g,o,a,c)=>{let F={},B=n(o,F,"port",Oe),$=n(o,F,"host",m),x=n(o,F,"servedir",m),P=n(o,F,"onRequest",Le),M,R=new Promise((L,S)=>{M=T=>{d.delete(c),T!==null?S(new Error(T)):L()}});return a.serve={},Y(o,F,"in serve() call"),B!==void 0&&(a.serve.port=B),$!==void 0&&(a.serve.host=$),x!==void 0&&(a.serve.servedir=x),d.set(c,{onRequest:P,onWait:M}),{wait:R,stop(){C(g,{command:"serve-stop",key:c},()=>{})}}},pe="warning",ue="silent",ge=g=>{let o=l++,a=Ve(),c,{refs:F,options:B,isTTY:$,callback:x}=g;if(typeof B=="object"){let R=B.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');c=R}}let P=(R,L,S,T)=>{let W=[];try{Ce(W,B,{},$,pe)}catch(E){}let ee=ve(R,e,a,S,L);C(F,{command:"error",flags:W,error:ee},()=>{ee.detail=a.load(ee.detail),T(ee)})},M=(R,L)=>{P(R,L,void 0,S=>{x(Re("Build failed",[S],[]),null)})};if(c&&c.length>0){if(e.isSync)return M(new Error("Cannot use plugins in synchronous API calls"),"");le(B,c,o,a,F).then(R=>{if(!R.ok)M(R.error,R.pluginName);else try{fe(De(Te({},g),{key:o,details:a,logPluginError:P,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(L){M(L,"")}},R=>M(R,""))}else try{fe(De(Te({},g),{key:o,details:a,logPluginError:P,requestPlugins:null,runOnEndCallbacks:(R,L,S)=>S(),pluginRefs:null}))}catch(R){M(R,"")}},fe=({callName:g,refs:o,serveOptions:a,options:c,isTTY:F,defaultWD:B,callback:$,key:x,details:P,logPluginError:M,requestPlugins:R,runOnEndCallbacks:L,pluginRefs:S})=>{let T={ref(){S&&S.ref(),o&&o.ref()},unref(){S&&S.unref(),o&&o.unref()}},W=!e.isBrowser,{entries:ee,flags:E,write:y,stdinContents:b,stdinResolveDir:u,absWorkingDir:v,incremental:U,nodePaths:w,watch:p,mangleCache:D}=gt(g,c,F,pe,W),A={command:"build",key:x,entries:ee,flags:E,write:y,stdinContents:b,stdinResolveDir:u,absWorkingDir:v||B,incremental:U,nodePaths:w};R&&(A.plugins=R),D&&(A.mangleCache=D);let Q=a&&ie(T,a,A,x),z,_,X=(j,J)=>{j.outputFiles&&(J.outputFiles=j.outputFiles.map(yt)),j.metafile&&(J.metafile=JSON.parse(j.metafile)),j.mangleCache&&(J.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(he(j.writeToStdout).replace(/\n$/,""))},H=(j,J)=>{let G={errors:de(j.errors,P),warnings:de(j.warnings,P)};X(j,G),L(G,M,()=>{if(G.errors.length>0)return J(Re("Build failed",G.errors,G.warnings),null);if(j.rebuild){if(!z){let K=!1;z=()=>new Promise((se,Z)=>{if(K||i)throw new Error("Cannot rebuild");C(T,{command:"rebuild",key:x},(te,et)=>{if(te)return J(Re("Build failed",[{pluginName:"",text:te,location:null,notes:[],detail:void 0}],[]),null);H(et,(Be,tt)=>{Be?Z(Be):se(tt)})})}),T.ref(),z.dispose=()=>{K||(K=!0,C(T,{command:"rebuild-dispose",key:x},()=>{}),T.unref())}}G.rebuild=z}if(j.watch){if(!_){let K=!1;T.ref(),_=()=>{K||(K=!0,s.delete(x),C(T,{command:"watch-stop",key:x},()=>{}),T.unref())},p&&s.set(x,(se,Z)=>{if(se){p.onRebuild&&p.onRebuild(se,null);return}let te={errors:de(Z.errors,P),warnings:de(Z.warnings,P)};X(Z,te),L(te,M,()=>{if(te.errors.length>0){p.onRebuild&&p.onRebuild(Re("Build failed",te.errors,te.warnings),null);return}Z.rebuildID!==void 0&&(te.rebuild=z),te.stop=_,p.onRebuild&&p.onRebuild(null,te)})})}G.stop=_}J(null,G)})};if(y&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(U&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(p&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');C(T,A,(j,J)=>{if(j)return $(new Error(j),null);if(Q){let G=J,K=!1;T.ref();let se={port:G.port,host:G.host,wait:Q.wait,stop(){K||(K=!0,Q.stop(),T.unref())}};return T.ref(),Q.wait.then(T.unref,T.unref),$(null,se)}return H(J,$)})};return{readFromStdout:N,afterClose:k,service:{buildOrServe:ge,transform:({callName:g,refs:o,input:a,options:c,isTTY:F,fs:B,callback:$})=>{let x=Ve(),P=M=>{try{if(typeof a!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:L}=mt(g,c,F,ue),S={command:"transform",flags:R,inputFS:M!==null,input:M!==null?M:a};L&&(S.mangleCache=L),C(o,S,(T,W)=>{if(T)return $(new Error(T),null);let ee=de(W.errors,x),E=de(W.warnings,x),y=1,b=()=>{if(--y===0){let u={warnings:E,code:W.code,map:W.map};W.mangleCache&&(u.mangleCache=W==null?void 0:W.mangleCache),$(null,u)}};if(ee.length>0)return $(Re("Transform failed",ee,E),null);W.codeFS&&(y++,B.readFile(W.code,(u,v)=>{u!==null?$(u,null):(W.code=v,b())})),W.mapFS&&(y++,B.readFile(W.map,(u,v)=>{u!==null?$(u,null):(W.map=v,b())})),b()})}catch(R){let L=[];try{Ce(L,c,{},F,ue)}catch(T){}let S=ve(R,e,x,void 0,"");C(o,{command:"error",flags:L,error:S},()=>{S.detail=x.load(S.detail),$(Re("Transform failed",[S],[]),null)})}};if(typeof a=="string"&&a.length>1024*1024){let M=P;P=()=>B.writeFile(a,M)}P(null)},formatMessages:({callName:g,refs:o,messages:a,options:c,callback:F})=>{let B=be(a,"messages",null,"");if(!c)throw new Error(`Missing second argument in ${g}() call`);let $={},x=n(c,$,"kind",m),P=n(c,$,"color",I),M=n(c,$,"terminalWidth",Oe);if(Y(c,$,`in ${g}() call`),x===void 0)throw new Error(`Missing "kind" in ${g}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${g}() call`);let R={command:"format-msgs",messages:B,isWarning:x==="warning"};P!==void 0&&(R.color=P),M!==void 0&&(R.terminalWidth=M),C(o,R,(L,S)=>{if(L)return F(new Error(L),null);F(null,S.messages)})},analyzeMetafile:({callName:g,refs:o,metafile:a,options:c,callback:F})=>{c===void 0&&(c={});let B={},$=n(c,B,"color",I),x=n(c,B,"verbose",I);Y(c,B,`in ${g}() call`);let P={command:"analyze-metafile",metafile:a};$!==void 0&&(P.color=$),x!==void 0&&(P.verbose=x),C(o,P,(M,R)=>{if(M)return F(new Error(M),null);F(null,R.result)})}}}}function Ve(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let s=t++;return e.set(s,r),s}}}function Ee(e,t,r){let s,d=!1;return()=>{if(d)return s;d=!0;try{let i=(e.stack+"").split(`
|
2
|
-
`);
|
3
|
-
`),"")}catch(
|
1
|
+
var Ie=Object.defineProperty,rt=Object.defineProperties;var nt=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var lt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Be=(e,t)=>{for(var r in t||(t={}))lt.call(t,r)&&qe(e,r,t[r]);if(We)for(var r of We(t))it.call(t,r)&&qe(e,r,t[r]);return e},De=(e,t)=>rt(e,nt(t));var st=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})};var Ae={};st(Ae,{analyzeMetafile:()=>St,analyzeMetafileSync:()=>$t,build:()=>wt,buildSync:()=>xt,default:()=>Pt,formatMessages:()=>Ot,formatMessagesSync:()=>kt,initialize:()=>Mt,serve:()=>vt,transform:()=>Rt,transformSync:()=>Et,version:()=>bt});function Fe(e){let t=o=>{if(o===null)r.write8(0);else if(typeof o=="boolean")r.write8(1),r.write8(+o);else if(typeof o=="number")r.write8(2),r.write32(o|0);else if(typeof o=="string")r.write8(3),r.write(de(o));else if(o instanceof Uint8Array)r.write8(4),r.write(o);else if(o instanceof Array){r.write8(5),r.write32(o.length);for(let d of o)t(d)}else{let d=Object.keys(o);r.write8(6),r.write32(d.length);for(let s of d)r.write(de(s)),t(o[s])}},r=new xe;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Ne(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function ze(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return be(r.read());case 4:return r.read();case 5:{let f=r.read32(),i=[];for(let h=0;h<f;h++)i.push(t());return i}case 6:{let f=r.read32(),i={};for(let h=0;h<f;h++)i[be(r.read())]=t();return i}default:throw new Error("Invalid packet")}},r=new xe(e),o=r.read32(),d=(o&1)===0;o>>>=1;let s=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:d,value:s}}var xe=class{constructor(t=new Uint8Array(1024)){this.buf=t;this.len=0;this.ptr=0}_write(t){if(this.len+t>this.buf.length){let r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);Ne(this.buf,t,r)}write(t){let r=this._write(4+t.length);Ne(this.buf,t.length,r),this.buf.set(t,r+4)}_read(t){if(this.ptr+t>this.buf.length)throw new Error("Invalid packet");return this.ptr+=t,this.ptr-t}read8(){return this.buf[this._read(1)]}read32(){return je(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),o=this._read(r.length);return r.set(this.buf.subarray(o,o+t)),r}},de,be;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;de=r=>e.encode(r),be=r=>t.decode(r)}else if(typeof Buffer!="undefined")de=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},be=e=>{let{buffer:t,byteOffset:r,byteLength:o}=e;return Buffer.from(t,r,o).toString()};else throw new Error("No UTF-8 codec found");function je(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Ne(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ke(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var $e=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",at=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",m=e=>typeof e=="string"?null:"a string",Me=e=>e instanceof RegExp?null:"a RegExp object",Oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ue=e=>typeof e=="function"?null:"a function",V=e=>Array.isArray(e)?null:"an array",ie=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ut=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",ft=e=>typeof e=="object"&&e!==null?null:"an array or an object",_e=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ye=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",ct=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",dt=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",pt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,o){let d=e[r];if(t[r+""]=!0,d===void 0)return;let s=o(d);if(s!==null)throw new Error(`"${r}" must be ${s}`);return d}function Y(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function Qe(e){let t=Object.create(null),r=n(e,t,"wasmURL",m),o=n(e,t,"wasmModule",ut),d=n(e,t,"worker",q);return Y(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:d}}function He(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let o=e[r];if(typeof o=="string"||o===!1)t[r]=o;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Ce(e,t,r,o,d){let s=n(t,r,"color",q),f=n(t,r,"logLevel",m),i=n(t,r,"logLimit",Oe);s!==void 0?e.push(`--color=${s}`):o&&e.push("--color=true"),e.push(`--log-level=${f||d}`),e.push(`--log-limit=${i||0}`)}function Ge(e,t,r){let o=n(t,r,"legalComments",m),d=n(t,r,"sourceRoot",m),s=n(t,r,"sourcesContent",q),f=n(t,r,"target",dt),i=n(t,r,"format",m),h=n(t,r,"globalName",m),O=n(t,r,"mangleProps",Me),N=n(t,r,"reserveProps",Me),C=n(t,r,"mangleQuoted",q),k=n(t,r,"minify",q),z=n(t,r,"minifySyntax",q),ne=n(t,r,"minifyWhitespace",q),se=n(t,r,"minifyIdentifiers",q),le=n(t,r,"drop",V),te=n(t,r,"charset",m),oe=n(t,r,"treeShaking",q),ae=n(t,r,"ignoreAnnotations",q),fe=n(t,r,"jsx",m),ge=n(t,r,"jsxFactory",m),ce=n(t,r,"jsxFragment",m),me=n(t,r,"define",ie),ye=n(t,r,"logOverride",ie),he=n(t,r,"supported",ie),g=n(t,r,"pure",V),u=n(t,r,"keepNames",q);if(o&&e.push(`--legal-comments=${o}`),d!==void 0&&e.push(`--source-root=${d}`),s!==void 0&&e.push(`--sources-content=${s}`),f&&(Array.isArray(f)?e.push(`--target=${Array.from(f).map(Ke).join(",")}`):e.push(`--target=${Ke(f)}`)),i&&e.push(`--format=${i}`),h&&e.push(`--global-name=${h}`),k&&e.push("--minify"),z&&e.push("--minify-syntax"),ne&&e.push("--minify-whitespace"),se&&e.push("--minify-identifiers"),te&&e.push(`--charset=${te}`),oe!==void 0&&e.push(`--tree-shaking=${oe}`),ae&&e.push("--ignore-annotations"),le)for(let l of le)e.push(`--drop:${l}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),C!==void 0&&e.push(`--mangle-quoted=${C}`),fe&&e.push(`--jsx=${fe}`),ge&&e.push(`--jsx-factory=${ge}`),ce&&e.push(`--jsx-fragment=${ce}`),me)for(let l in me){if(l.indexOf("=")>=0)throw new Error(`Invalid define: ${l}`);e.push(`--define:${l}=${me[l]}`)}if(ye)for(let l in ye){if(l.indexOf("=")>=0)throw new Error(`Invalid log override: ${l}`);e.push(`--log-override:${l}=${ye[l]}`)}if(he)for(let l in he){if(l.indexOf("=")>=0)throw new Error(`Invalid supported: ${l}`);e.push(`--supported:${l}=${he[l]}`)}if(g)for(let l of g)e.push(`--pure:${l}`);u&&e.push("--keep-names")}function gt(e,t,r,o,d){var b;let s=[],f=[],i=Object.create(null),h=null,O=null,N=null;Ce(s,t,i,r,o),Ge(s,t,i);let C=n(t,i,"sourcemap",Ye),k=n(t,i,"bundle",q),z=n(t,i,"watch",at),ne=n(t,i,"splitting",q),se=n(t,i,"preserveSymlinks",q),le=n(t,i,"metafile",q),te=n(t,i,"outfile",m),oe=n(t,i,"outdir",m),ae=n(t,i,"outbase",m),fe=n(t,i,"platform",m),ge=n(t,i,"tsconfig",m),ce=n(t,i,"resolveExtensions",V),me=n(t,i,"nodePaths",V),ye=n(t,i,"mainFields",V),he=n(t,i,"conditions",V),g=n(t,i,"external",V),u=n(t,i,"loader",ie),l=n(t,i,"outExtension",ie),c=n(t,i,"publicPath",m),F=n(t,i,"entryNames",m),T=n(t,i,"chunkNames",m),$=n(t,i,"assetNames",m),x=n(t,i,"inject",V),P=n(t,i,"banner",ie),M=n(t,i,"footer",ie),R=n(t,i,"entryPoints",ft),U=n(t,i,"absWorkingDir",m),S=n(t,i,"stdin",ie),B=(b=n(t,i,"write",q))!=null?b:d,W=n(t,i,"allowOverwrite",q),ee=n(t,i,"incremental",q)===!0,E=n(t,i,"mangleCache",ie);if(i.plugins=!0,Y(t,i,`in ${e}() call`),C&&s.push(`--sourcemap${C===!0?"":`=${C}`}`),k&&s.push("--bundle"),W&&s.push("--allow-overwrite"),z)if(s.push("--watch"),typeof z=="boolean")N={};else{let a=Object.create(null),v=n(z,a,"onRebuild",Ue);Y(z,a,`on "watch" in ${e}() call`),N={onRebuild:v}}if(ne&&s.push("--splitting"),se&&s.push("--preserve-symlinks"),le&&s.push("--metafile"),te&&s.push(`--outfile=${te}`),oe&&s.push(`--outdir=${oe}`),ae&&s.push(`--outbase=${ae}`),fe&&s.push(`--platform=${fe}`),ge&&s.push(`--tsconfig=${ge}`),ce){let a=[];for(let v of ce){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);a.push(v)}s.push(`--resolve-extensions=${a.join(",")}`)}if(c&&s.push(`--public-path=${c}`),F&&s.push(`--entry-names=${F}`),T&&s.push(`--chunk-names=${T}`),$&&s.push(`--asset-names=${$}`),ye){let a=[];for(let v of ye){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);a.push(v)}s.push(`--main-fields=${a.join(",")}`)}if(he){let a=[];for(let v of he){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);a.push(v)}s.push(`--conditions=${a.join(",")}`)}if(g)for(let a of g)s.push(`--external:${a}`);if(P)for(let a in P){if(a.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${a}`);s.push(`--banner:${a}=${P[a]}`)}if(M)for(let a in M){if(a.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${a}`);s.push(`--footer:${a}=${M[a]}`)}if(x)for(let a of x)s.push(`--inject:${a}`);if(u)for(let a in u){if(a.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${a}`);s.push(`--loader:${a}=${u[a]}`)}if(l)for(let a in l){if(a.indexOf("=")>=0)throw new Error(`Invalid out extension: ${a}`);s.push(`--out-extension:${a}=${l[a]}`)}if(R)if(Array.isArray(R))for(let a of R)f.push(["",a+""]);else for(let[a,v]of Object.entries(R))f.push([a+"",v+""]);if(S){let a=Object.create(null),v=n(S,a,"contents",m),L=n(S,a,"resolveDir",m),w=n(S,a,"sourcefile",m),p=n(S,a,"loader",m);Y(S,a,'in "stdin" object'),w&&s.push(`--sourcefile=${w}`),p&&s.push(`--loader=${p}`),L&&(O=L+""),h=v?v+"":""}let y=[];if(me)for(let a of me)a+="",y.push(a);return{entries:f,flags:s,write:B,stdinContents:h,stdinResolveDir:O,absWorkingDir:U,incremental:ee,nodePaths:y,watch:N,mangleCache:He(E)}}function mt(e,t,r,o){let d=[],s=Object.create(null);Ce(d,t,s,r,o),Ge(d,t,s);let f=n(t,s,"sourcemap",Ye),i=n(t,s,"tsconfigRaw",ct),h=n(t,s,"sourcefile",m),O=n(t,s,"loader",m),N=n(t,s,"banner",m),C=n(t,s,"footer",m),k=n(t,s,"mangleCache",ie);return Y(t,s,`in ${e}() call`),f&&d.push(`--sourcemap=${f===!0?"external":f}`),i&&d.push(`--tsconfig-raw=${typeof i=="string"?i:JSON.stringify(i)}`),h&&d.push(`--sourcefile=${h}`),O&&d.push(`--loader=${O}`),N&&d.push(`--banner=${N}`),C&&d.push(`--footer=${C}`),{flags:d,mangleCache:He(k)}}function Xe(e){let t=new Map,r=new Map,o=new Map,d=new Map,s=null,f=0,i=0,h=new Uint8Array(16*1024),O=0,N=g=>{let u=O+g.length;if(u>h.length){let c=new Uint8Array(u*2);c.set(h),h=c}h.set(g,O),O+=g.length;let l=0;for(;l+4<=O;){let c=je(h,l);if(l+4+c>O)break;l+=4,le(h.subarray(l,l+c)),l+=c}l>0&&(h.copyWithin(0,l,O),O-=l)},C=g=>{s={reason:g?": "+(g.message||g):""};let u="The service was stopped"+s.reason;for(let l of t.values())l(u,null);t.clear();for(let l of d.values())l.onWait(u);d.clear();for(let l of o.values())try{l(new Error(u),null)}catch(c){console.error(c)}o.clear()},k=(g,u,l)=>{if(s)return l("The service is no longer running"+s.reason,null);let c=f++;t.set(c,(F,T)=>{try{l(F,T)}finally{g&&g.unref()}}),g&&g.ref(),e.writeToStdin(Fe({id:c,isRequest:!0,value:u}))},z=(g,u)=>{if(s)throw new Error("The service is no longer running"+s.reason);e.writeToStdin(Fe({id:g,isRequest:!1,value:u}))},ne=async(g,u)=>{try{switch(u.command){case"ping":{z(g,{});break}case"on-start":{let l=r.get(u.key);l?z(g,await l(u)):z(g,{});break}case"on-resolve":{let l=r.get(u.key);l?z(g,await l(u)):z(g,{});break}case"on-load":{let l=r.get(u.key);l?z(g,await l(u)):z(g,{});break}case"serve-request":{let l=d.get(u.key);l&&l.onRequest&&l.onRequest(u.args),z(g,{});break}case"serve-wait":{let l=d.get(u.key);l&&l.onWait(u.error),z(g,{});break}case"watch-rebuild":{let l=o.get(u.key);try{l&&l(null,u.args)}catch(c){console.error(c)}z(g,{});break}default:throw new Error("Invalid command: "+u.command)}}catch(l){z(g,{errors:[ve(l,e,null,void 0,"")]})}},se=!0,le=g=>{if(se){se=!1;let l=String.fromCharCode(...g);if(l!=="0.14.49")throw new Error(`Cannot start service: Host version "0.14.49" does not match binary version ${JSON.stringify(l)}`);return}let u=ze(g);if(u.isRequest)ne(u.id,u.value);else{let l=t.get(u.id);t.delete(u.id),u.value.error?l(u.value.error,{}):l(null,u.value)}},te=async(g,u,l,c,F)=>{let T=[],$=[],x={},P={},M=0,R=0,U=[],S=!1;u=[...u];for(let E of u){let y={};if(typeof E!="object")throw new Error(`Plugin at index ${R} must be an object`);let b=n(E,y,"name",m);if(typeof b!="string"||b==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let a=n(E,y,"setup",Ue);if(typeof a!="function")throw new Error("Plugin is missing a setup function");Y(E,y,`on plugin ${JSON.stringify(b)}`);let v={name:b,onResolve:[],onLoad:[]};R++;let w=a({initialOptions:g,resolve:(p,D={})=>{if(!S)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof p!="string")throw new Error("The path to resolve must be a string");let A=Object.create(null),Q=n(D,A,"pluginName",m),I=n(D,A,"importer",m),_=n(D,A,"namespace",m),X=n(D,A,"resolveDir",m),H=n(D,A,"kind",m),j=n(D,A,"pluginData",$e);return Y(D,A,"in resolve() call"),new Promise((J,G)=>{let K={command:"resolve",path:p,key:l,pluginName:b};Q!=null&&(K.pluginName=Q),I!=null&&(K.importer=I),_!=null&&(K.namespace=_),X!=null&&(K.resolveDir=X),H!=null&&(K.kind=H),j!=null&&(K.pluginData=c.store(j)),k(F,K,(ue,Z)=>{ue!==null?G(new Error(ue)):J({errors:pe(Z.errors,c),warnings:pe(Z.warnings,c),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:c.load(Z.pluginData)})})})},onStart(p){let D='This error came from the "onStart" callback registered here:',A=Ee(new Error(D),e,"onStart");T.push({name:b,callback:p,note:A})},onEnd(p){let D='This error came from the "onEnd" callback registered here:',A=Ee(new Error(D),e,"onEnd");$.push({name:b,callback:p,note:A})},onResolve(p,D){let A='This error came from the "onResolve" callback registered here:',Q=Ee(new Error(A),e,"onResolve"),I={},_=n(p,I,"filter",Me),X=n(p,I,"namespace",m);if(Y(p,I,`in onResolve() call for plugin ${JSON.stringify(b)}`),_==null)throw new Error("onResolve() call is missing a filter");let H=M++;x[H]={name:b,callback:D,note:Q},v.onResolve.push({id:H,filter:_.source,namespace:X||""})},onLoad(p,D){let A='This error came from the "onLoad" callback registered here:',Q=Ee(new Error(A),e,"onLoad"),I={},_=n(p,I,"filter",Me),X=n(p,I,"namespace",m);if(Y(p,I,`in onLoad() call for plugin ${JSON.stringify(b)}`),_==null)throw new Error("onLoad() call is missing a filter");let H=M++;P[H]={name:b,callback:D,note:Q},v.onLoad.push({id:H,filter:_.source,namespace:X||""})},esbuild:e.esbuild});w&&await w,U.push(v)}catch(a){return{ok:!1,error:a,pluginName:b}}}let B=async E=>{switch(E.command){case"on-start":{let y={errors:[],warnings:[]};return await Promise.all(T.map(async({name:b,callback:a,note:v})=>{try{let L=await a();if(L!=null){if(typeof L!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(b)} to return an object`);let w={},p=n(L,w,"errors",V),D=n(L,w,"warnings",V);Y(L,w,`from onStart() callback in plugin ${JSON.stringify(b)}`),p!=null&&y.errors.push(...we(p,"errors",c,b)),D!=null&&y.warnings.push(...we(D,"warnings",c,b))}}catch(L){y.errors.push(ve(L,e,c,v&&v(),b))}})),y}case"on-resolve":{let y={},b="",a,v;for(let L of E.ids)try{({name:b,callback:a,note:v}=x[L]);let w=await a({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:c.load(E.pluginData)});if(w!=null){if(typeof w!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(b)} to return an object`);let p={},D=n(w,p,"pluginName",m),A=n(w,p,"path",m),Q=n(w,p,"namespace",m),I=n(w,p,"suffix",m),_=n(w,p,"external",q),X=n(w,p,"sideEffects",q),H=n(w,p,"pluginData",$e),j=n(w,p,"errors",V),J=n(w,p,"warnings",V),G=n(w,p,"watchFiles",V),K=n(w,p,"watchDirs",V);Y(w,p,`from onResolve() callback in plugin ${JSON.stringify(b)}`),y.id=L,D!=null&&(y.pluginName=D),A!=null&&(y.path=A),Q!=null&&(y.namespace=Q),I!=null&&(y.suffix=I),_!=null&&(y.external=_),X!=null&&(y.sideEffects=X),H!=null&&(y.pluginData=c.store(H)),j!=null&&(y.errors=we(j,"errors",c,b)),J!=null&&(y.warnings=we(J,"warnings",c,b)),G!=null&&(y.watchFiles=ke(G,"watchFiles")),K!=null&&(y.watchDirs=ke(K,"watchDirs"));break}}catch(w){return{id:L,errors:[ve(w,e,c,v&&v(),b)]}}return y}case"on-load":{let y={},b="",a,v;for(let L of E.ids)try{({name:b,callback:a,note:v}=P[L]);let w=await a({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:c.load(E.pluginData)});if(w!=null){if(typeof w!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(b)} to return an object`);let p={},D=n(w,p,"pluginName",m),A=n(w,p,"contents",pt),Q=n(w,p,"resolveDir",m),I=n(w,p,"pluginData",$e),_=n(w,p,"loader",m),X=n(w,p,"errors",V),H=n(w,p,"warnings",V),j=n(w,p,"watchFiles",V),J=n(w,p,"watchDirs",V);Y(w,p,`from onLoad() callback in plugin ${JSON.stringify(b)}`),y.id=L,D!=null&&(y.pluginName=D),A instanceof Uint8Array?y.contents=A:A!=null&&(y.contents=de(A)),Q!=null&&(y.resolveDir=Q),I!=null&&(y.pluginData=c.store(I)),_!=null&&(y.loader=_),X!=null&&(y.errors=we(X,"errors",c,b)),H!=null&&(y.warnings=we(H,"warnings",c,b)),j!=null&&(y.watchFiles=ke(j,"watchFiles")),J!=null&&(y.watchDirs=ke(J,"watchDirs"));break}}catch(w){return{id:L,errors:[ve(w,e,c,v&&v(),b)]}}return y}default:throw new Error("Invalid command: "+E.command)}},W=(E,y,b)=>b();$.length>0&&(W=(E,y,b)=>{(async()=>{for(let{name:a,callback:v,note:L}of $)try{await v(E)}catch(w){E.errors.push(await new Promise(p=>y(w,a,L&&L(),p)))}})().then(b)}),S=!0;let ee=0;return{ok:!0,requestPlugins:U,runOnEndCallbacks:W,pluginRefs:{ref(){++ee===1&&r.set(l,B)},unref(){--ee===0&&r.delete(l)}}}},oe=(g,u,l,c)=>{let F={},T=n(u,F,"port",Oe),$=n(u,F,"host",m),x=n(u,F,"servedir",m),P=n(u,F,"onRequest",Ue),M,R=new Promise((U,S)=>{M=B=>{d.delete(c),B!==null?S(new Error(B)):U()}});return l.serve={},Y(u,F,"in serve() call"),T!==void 0&&(l.serve.port=T),$!==void 0&&(l.serve.host=$),x!==void 0&&(l.serve.servedir=x),d.set(c,{onRequest:P,onWait:M}),{wait:R,stop(){k(g,{command:"serve-stop",key:c},()=>{})}}},ae="warning",fe="silent",ge=g=>{let u=i++,l=Ve(),c,{refs:F,options:T,isTTY:$,callback:x}=g;if(typeof T=="object"){let R=T.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');c=R}}let P=(R,U,S,B)=>{let W=[];try{Ce(W,T,{},$,ae)}catch(E){}let ee=ve(R,e,l,S,U);k(F,{command:"error",flags:W,error:ee},()=>{ee.detail=l.load(ee.detail),B(ee)})},M=(R,U)=>{P(R,U,void 0,S=>{x(Re("Build failed",[S],[]),null)})};if(c&&c.length>0){if(e.isSync)return M(new Error("Cannot use plugins in synchronous API calls"),"");te(T,c,u,l,F).then(R=>{if(!R.ok)M(R.error,R.pluginName);else try{ce(De(Be({},g),{key:u,details:l,logPluginError:P,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(U){M(U,"")}},R=>M(R,""))}else try{ce(De(Be({},g),{key:u,details:l,logPluginError:P,requestPlugins:null,runOnEndCallbacks:(R,U,S)=>S(),pluginRefs:null}))}catch(R){M(R,"")}},ce=({callName:g,refs:u,serveOptions:l,options:c,isTTY:F,defaultWD:T,callback:$,key:x,details:P,logPluginError:M,requestPlugins:R,runOnEndCallbacks:U,pluginRefs:S})=>{let B={ref(){S&&S.ref(),u&&u.ref()},unref(){S&&S.unref(),u&&u.unref()}},W=!e.isWriteUnavailable,{entries:ee,flags:E,write:y,stdinContents:b,stdinResolveDir:a,absWorkingDir:v,incremental:L,nodePaths:w,watch:p,mangleCache:D}=gt(g,c,F,ae,W),A={command:"build",key:x,entries:ee,flags:E,write:y,stdinContents:b,stdinResolveDir:a,absWorkingDir:v||T,incremental:L,nodePaths:w};R&&(A.plugins=R),D&&(A.mangleCache=D);let Q=l&&oe(B,l,A,x),I,_,X=(j,J)=>{j.outputFiles&&(J.outputFiles=j.outputFiles.map(yt)),j.metafile&&(J.metafile=JSON.parse(j.metafile)),j.mangleCache&&(J.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(be(j.writeToStdout).replace(/\n$/,""))},H=(j,J)=>{let G={errors:pe(j.errors,P),warnings:pe(j.warnings,P)};X(j,G),U(G,M,()=>{if(G.errors.length>0)return J(Re("Build failed",G.errors,G.warnings),null);if(j.rebuild){if(!I){let K=!1;I=()=>new Promise((ue,Z)=>{if(K||s)throw new Error("Cannot rebuild");k(B,{command:"rebuild",key:x},(re,et)=>{if(re)return J(Re("Build failed",[{id:"",pluginName:"",text:re,location:null,notes:[],detail:void 0}],[]),null);H(et,(Te,tt)=>{Te?Z(Te):ue(tt)})})}),B.ref(),I.dispose=()=>{K||(K=!0,k(B,{command:"rebuild-dispose",key:x},()=>{}),B.unref())}}G.rebuild=I}if(j.watch){if(!_){let K=!1;B.ref(),_=()=>{K||(K=!0,o.delete(x),k(B,{command:"watch-stop",key:x},()=>{}),B.unref())},p&&o.set(x,(ue,Z)=>{if(ue){p.onRebuild&&p.onRebuild(ue,null);return}let re={errors:pe(Z.errors,P),warnings:pe(Z.warnings,P)};X(Z,re),U(re,M,()=>{if(re.errors.length>0){p.onRebuild&&p.onRebuild(Re("Build failed",re.errors,re.warnings),null);return}Z.rebuildID!==void 0&&(re.rebuild=I),re.stop=_,p.onRebuild&&p.onRebuild(null,re)})})}G.stop=_}J(null,G)})};if(y&&e.isWriteUnavailable)throw new Error('The "write" option is unavailable in this environment');if(L&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(p&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');k(B,A,(j,J)=>{if(j)return $(new Error(j),null);if(Q){let G=J,K=!1;B.ref();let ue={port:G.port,host:G.host,wait:Q.wait,stop(){K||(K=!0,Q.stop(),B.unref())}};return B.ref(),Q.wait.then(B.unref,B.unref),$(null,ue)}return H(J,$)})};return{readFromStdout:N,afterClose:C,service:{buildOrServe:ge,transform:({callName:g,refs:u,input:l,options:c,isTTY:F,fs:T,callback:$})=>{let x=Ve(),P=M=>{try{if(typeof l!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:U}=mt(g,c,F,fe),S={command:"transform",flags:R,inputFS:M!==null,input:M!==null?M:l};U&&(S.mangleCache=U),k(u,S,(B,W)=>{if(B)return $(new Error(B),null);let ee=pe(W.errors,x),E=pe(W.warnings,x),y=1,b=()=>{if(--y===0){let a={warnings:E,code:W.code,map:W.map};W.mangleCache&&(a.mangleCache=W==null?void 0:W.mangleCache),$(null,a)}};if(ee.length>0)return $(Re("Transform failed",ee,E),null);W.codeFS&&(y++,T.readFile(W.code,(a,v)=>{a!==null?$(a,null):(W.code=v,b())})),W.mapFS&&(y++,T.readFile(W.map,(a,v)=>{a!==null?$(a,null):(W.map=v,b())})),b()})}catch(R){let U=[];try{Ce(U,c,{},F,fe)}catch(B){}let S=ve(R,e,x,void 0,"");k(u,{command:"error",flags:U,error:S},()=>{S.detail=x.load(S.detail),$(Re("Transform failed",[S],[]),null)})}};if(typeof l=="string"&&l.length>1024*1024){let M=P;P=()=>T.writeFile(l,M)}P(null)},formatMessages:({callName:g,refs:u,messages:l,options:c,callback:F})=>{let T=we(l,"messages",null,"");if(!c)throw new Error(`Missing second argument in ${g}() call`);let $={},x=n(c,$,"kind",m),P=n(c,$,"color",q),M=n(c,$,"terminalWidth",Oe);if(Y(c,$,`in ${g}() call`),x===void 0)throw new Error(`Missing "kind" in ${g}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${g}() call`);let R={command:"format-msgs",messages:T,isWarning:x==="warning"};P!==void 0&&(R.color=P),M!==void 0&&(R.terminalWidth=M),k(u,R,(U,S)=>{if(U)return F(new Error(U),null);F(null,S.messages)})},analyzeMetafile:({callName:g,refs:u,metafile:l,options:c,callback:F})=>{c===void 0&&(c={});let T={},$=n(c,T,"color",q),x=n(c,T,"verbose",q);Y(c,T,`in ${g}() call`);let P={command:"analyze-metafile",metafile:l};$!==void 0&&(P.color=$),x!==void 0&&(P.verbose=x),k(u,P,(M,R)=>{if(M)return F(new Error(M),null);F(null,R.result)})}}}}function Ve(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let o=t++;return e.set(o,r),o}}}function Ee(e,t,r){let o,d=!1;return()=>{if(d)return o;d=!0;try{let s=(e.stack+"").split(`
|
2
|
+
`);s.splice(1,1);let f=Ze(t,s,r);if(f)return o={text:e.message,location:f},o}catch(s){}}}function ve(e,t,r,o,d){let s="Internal error",f=null;try{s=(e&&e.message||e)+""}catch(i){}try{f=Ze(t,(e.stack+"").split(`
|
3
|
+
`),"")}catch(i){}return{id:"",pluginName:d,text:s,location:f,notes:o?[o]:[],detail:r?r.store(e):-1}}function Ze(e,t,r){let o=" at ";if(e.readFileSync&&!t[0].startsWith(o)&&t[1].startsWith(o))for(let d=1;d<t.length;d++){let s=t[d];if(!!s.startsWith(o))for(s=s.slice(o.length);;){let f=/^(?:new |async )?\S+ \((.*)\)$/.exec(s);if(f){s=f[1];continue}if(f=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(s),f){s=f[1];continue}if(f=/^(\S+):(\d+):(\d+)$/.exec(s),f){let i;try{i=e.readFileSync(f[1],"utf8")}catch(C){break}let h=i.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",O=+f[3]-1,N=h.slice(O,O+r.length)===r?r.length:0;return{file:f[1],namespace:"file",line:+f[2],column:de(h.slice(0,O)).length,length:de(h.slice(O,O+N)).length,lineText:h+`
|
4
4
|
`+t.slice(1).join(`
|
5
|
-
`),suggestion:""}}break}}return null}function Re(e,t,r){let
|
5
|
+
`),suggestion:""}}break}}return null}function Re(e,t,r){let o=5,d=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,o+1).map((f,i)=>{if(i===o)return`
|
6
6
|
...`;if(!f.location)return`
|
7
|
-
error: ${f.text}`;let{file:h,line:O,column:N}=f.location,
|
8
|
-
${h}:${O}:${N}: ERROR: ${k}${f.text}`}).join(""),i=new Error(`${e}${d}`);return i.errors=t,i.warnings=r,i}function de(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Je(e,t){if(e==null)return null;let r={},s=n(e,r,"file",m),d=n(e,r,"namespace",m),i=n(e,r,"line",Oe),f=n(e,r,"column",Oe),l=n(e,r,"length",Oe),h=n(e,r,"lineText",m),O=n(e,r,"suggestion",m);return Y(e,r,t),{file:s||"",namespace:d||"",line:i||0,column:f||0,length:l||0,lineText:h||"",suggestion:O||""}}function be(e,t,r,s){let d=[],i=0;for(let f of e){let l={},h=n(f,l,"pluginName",m),O=n(f,l,"text",m),N=n(f,l,"location",_e),k=n(f,l,"notes",V),C=n(f,l,"detail",$e),q=`in element ${i} of "${t}"`;Y(f,l,q);let ae=[];if(k)for(let re of k){let ne={},le=n(re,ne,"text",m),ie=n(re,ne,"location",_e);Y(re,ne,q),ae.push({text:le||"",location:Je(ie,q)})}d.push({pluginName:h||s,text:O||"",location:Je(N,q),notes:ae,detail:r?r.store(C):-1}),i++}return d}function ke(e,t){let r=[];for(let s of e){if(typeof s!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(s)}return r}function yt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=he(t)),r}}}var bt="0.14.42",wt=e=>Pe().build(e),vt=()=>{throw new Error('The "serve" API only works in node')},Rt=(e,t)=>Pe().transform(e,t),Ot=(e,t)=>Pe().formatMessages(e,t),St=(e,t)=>Pe().analyzeMetafile(e,t),xt=()=>{throw new Error('The "buildSync" API only works in node')},Et=()=>{throw new Error('The "transformSync" API only works in node')},kt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},$t=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Se,Ue,Pe=()=>{if(Ue)return Ue;throw Se?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},Mt=e=>{e=Qe(e||{});let t=e.wasmURL,r=e.wasmModule,s=e.worker!==!1;if(!t&&!r)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(Se)throw new Error('Cannot call "initialize" more than once');return Se=Ct(t||"",r,s),Se.catch(()=>{Se=void 0}),Se},Ct=async(e,t,r)=>{let s;if(t)s=t;else{let l=await fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);s=await l.arrayBuffer()}let d;if(r){let l=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nlet onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});return(()=>{const r=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){c+=g.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substr(0,i)),c=c.substr(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,a){a(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),g=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(a(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);a(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(c){const n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),c=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.14.42"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,a.importObject).then(h=>a.run(h)):WebAssembly.instantiate(r,a.importObject).then(({instance:h})=>a.run(h))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});d=new Worker(URL.createObjectURL(l))}else{let l=(postMessage=>{
|
7
|
+
error: ${f.text}`;let{file:h,line:O,column:N}=f.location,C=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
|
8
|
+
${h}:${O}:${N}: ERROR: ${C}${f.text}`}).join(""),s=new Error(`${e}${d}`);return s.errors=t,s.warnings=r,s}function pe(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Je(e,t){if(e==null)return null;let r={},o=n(e,r,"file",m),d=n(e,r,"namespace",m),s=n(e,r,"line",Oe),f=n(e,r,"column",Oe),i=n(e,r,"length",Oe),h=n(e,r,"lineText",m),O=n(e,r,"suggestion",m);return Y(e,r,t),{file:o||"",namespace:d||"",line:s||0,column:f||0,length:i||0,lineText:h||"",suggestion:O||""}}function we(e,t,r,o){let d=[],s=0;for(let f of e){let i={},h=n(f,i,"id",m),O=n(f,i,"pluginName",m),N=n(f,i,"text",m),C=n(f,i,"location",_e),k=n(f,i,"notes",V),z=n(f,i,"detail",$e),ne=`in element ${s} of "${t}"`;Y(f,i,ne);let se=[];if(k)for(let le of k){let te={},oe=n(le,te,"text",m),ae=n(le,te,"location",_e);Y(le,te,ne),se.push({text:oe||"",location:Je(ae,ne)})}d.push({id:h||"",pluginName:O||o,text:N||"",location:Je(C,ne),notes:se,detail:r?r.store(z):-1}),s++}return d}function ke(e,t){let r=[];for(let o of e){if(typeof o!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(o)}return r}function yt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=be(t)),r}}}var bt="0.14.49",wt=e=>Pe().build(e),vt=()=>{throw new Error('The "serve" API only works in node')},Rt=(e,t)=>Pe().transform(e,t),Ot=(e,t)=>Pe().formatMessages(e,t),St=(e,t)=>Pe().analyzeMetafile(e,t),xt=()=>{throw new Error('The "buildSync" API only works in node')},Et=()=>{throw new Error('The "transformSync" API only works in node')},kt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},$t=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Se,Le,Pe=()=>{if(Le)return Le;throw Se?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},Mt=e=>{e=Qe(e||{});let t=e.wasmURL,r=e.wasmModule,o=e.worker!==!1;if(!t&&!r)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(Se)throw new Error('Cannot call "initialize" more than once');return Se=Ct(t||"",r,o),Se.catch(()=>{Se=void 0}),Se},Ct=async(e,t,r)=>{let o;if(t)o=t;else{let i=await fetch(e);if(!i.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);o=await i.arrayBuffer()}let d;if(r){let i=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nlet onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});return(()=>{const r=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){c+=g.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substr(0,i)),c=c.substr(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,a){a(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),g=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(a(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);a(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(c){const n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),c=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.14.49"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,a.importObject).then(h=>a.run(h)):WebAssembly.instantiate(r,a.importObject).then(({instance:h})=>a.run(h))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});d=new Worker(URL.createObjectURL(i))}else{let i=(postMessage=>{
|
9
9
|
// Copyright 2018 The Go Authors. All rights reserved.
|
10
10
|
// Use of this source code is governed by a BSD-style
|
11
11
|
// license that can be found in the LICENSE file.
|
12
12
|
let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});return(()=>{const r=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){c+=g.decode(s);const i=c.lastIndexOf(`
|
13
13
|
`);return i!=-1&&(console.log(c.substr(0,i)),c=c.substr(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,a){a(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),g=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(a(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);a(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=f.encode(e+"\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(c){const n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`
|
14
14
|
`);d.length>1&&console.log(d.slice(0,-1).join(`
|
15
|
-
`)),c=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.14.
|
15
|
+
`)),c=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.14.49"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,a.importObject).then(h=>a.run(h)):WebAssembly.instantiate(r,a.importObject).then(({instance:h})=>a.run(h))},r=>onmessage(r);})(h=>d.onmessage({data:h}));d={onmessage:null,postMessage:h=>setTimeout(()=>i({data:h})),terminate(){}}}d.postMessage(o),d.onmessage=({data:i})=>s(i);let{readFromStdout:s,service:f}=Xe({writeToStdin(i){d.postMessage(i)},isSync:!1,isWriteUnavailable:!0,esbuild:Ae});Le={build:i=>new Promise((h,O)=>f.buildOrServe({callName:"build",refs:null,serveOptions:null,options:i,isTTY:!1,defaultWD:"/",callback:(N,C)=>N?O(N):h(C)})),transform:(i,h)=>new Promise((O,N)=>f.transform({callName:"transform",refs:null,input:i,options:h||{},isTTY:!1,fs:{readFile(C,k){k(new Error("Internal error"),null)},writeFile(C,k){k(null)}},callback:(C,k)=>C?N(C):O(k)})),formatMessages:(i,h)=>new Promise((O,N)=>f.formatMessages({callName:"formatMessages",refs:null,messages:i,options:h,callback:(C,k)=>C?N(C):O(k)})),analyzeMetafile:(i,h)=>new Promise((O,N)=>f.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof i=="string"?i:JSON.stringify(i),options:h,callback:(C,k)=>C?N(C):O(k)}))}},Pt=Ae;export{St as analyzeMetafile,$t as analyzeMetafileSync,wt as build,xt as buildSync,Pt as default,Ot as formatMessages,kt as formatMessagesSync,Mt as initialize,vt as serve,Rt as transform,Et as transformSync,bt as version};
|