isomorfeus-asset-manager 0.14.26 → 0.15.0
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/esbuild.wasm +0 -0
- data/node_modules/esbuild-wasm/esm/browser.js +5 -5
- data/node_modules/esbuild-wasm/esm/browser.min.js +3 -3
- data/node_modules/esbuild-wasm/lib/browser.js +5 -5
- data/node_modules/esbuild-wasm/lib/browser.min.js +3 -3
- data/node_modules/esbuild-wasm/lib/main.js +7 -7
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38b2068375a8e86664b7421e506e7e0d2a5da55192fe0790da111127c4f13403
|
4
|
+
data.tar.gz: 127c9861ebd48810db3192243d738fc5f6fb205ab96899305ed9f72e101bfa67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2d4a04d90804b0f321c2dcf229650796140012ad55fa875d547e74ce7b8fb65d6ba5965fe9bf90c7863f4d6d51f74bb0b95bafe5edd3b27f619aa68c74c5a60
|
7
|
+
data.tar.gz: 76506bf2309b362de9928430290b0f3687d1f0586faae01fb08394e75e2180a87c29f492611513ff614ed77cb64cd5c709363ae480e7985fe011c76630d57efc
|
@@ -4,9 +4,9 @@
|
|
4
4
|
"requires": true,
|
5
5
|
"packages": {
|
6
6
|
"node_modules/esbuild-wasm": {
|
7
|
-
"version": "0.
|
8
|
-
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.
|
9
|
-
"integrity": "sha512-
|
7
|
+
"version": "0.15.0",
|
8
|
+
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.15.0.tgz",
|
9
|
+
"integrity": "sha512-zkCXQzJgVYxS6sCFFQl22lIJQ1V/dkPrv+qOKSgQMdTrZR4qUQh0siDhJLDeM3T6SZgBgQ89qDCkc7weEVvnoA==",
|
10
10
|
"bin": {
|
11
11
|
"esbuild": "bin/esbuild"
|
12
12
|
},
|
Binary file
|
@@ -756,8 +756,8 @@ function createChannel(streamIn) {
|
|
756
756
|
if (isFirstPacket) {
|
757
757
|
isFirstPacket = false;
|
758
758
|
let binaryVersion = String.fromCharCode(...bytes);
|
759
|
-
if (binaryVersion !== "0.
|
760
|
-
throw new Error(`Cannot start service: Host version "${"0.
|
759
|
+
if (binaryVersion !== "0.15.0") {
|
760
|
+
throw new Error(`Cannot start service: Host version "${"0.15.0"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
761
761
|
}
|
762
762
|
return;
|
763
763
|
}
|
@@ -1714,7 +1714,7 @@ function convertOutputFiles({ path, contents }) {
|
|
1714
1714
|
}
|
1715
1715
|
|
1716
1716
|
// lib/npm/browser.ts
|
1717
|
-
var version = "0.
|
1717
|
+
var version = "0.15.0";
|
1718
1718
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1719
1719
|
var serve = () => {
|
1720
1720
|
throw new Error(`The "serve" API only works in node`);
|
@@ -1770,7 +1770,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
1770
1770
|
}
|
1771
1771
|
let worker;
|
1772
1772
|
if (useWorker) {
|
1773
|
-
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 () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8) + 1\n ));\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.53"}`];\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" });
|
1773
|
+
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 () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8) + 1\n ));\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.15.0"}`];\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" });
|
1774
1774
|
worker = new Worker(URL.createObjectURL(blob));
|
1775
1775
|
} else {
|
1776
1776
|
let onmessage = ((postMessage) => {
|
@@ -2352,7 +2352,7 @@ var startRunningService = async (wasmURL, wasmModule, useWorker) => {
|
|
2352
2352
|
callback(null, count);
|
2353
2353
|
};
|
2354
2354
|
let go = new globalThis.Go();
|
2355
|
-
go.argv = ["", `--service=${"0.
|
2355
|
+
go.argv = ["", `--service=${"0.15.0"}`];
|
2356
2356
|
if (wasm instanceof WebAssembly.Module) {
|
2357
2357
|
WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));
|
2358
2358
|
} else {
|
@@ -1,15 +1,15 @@
|
|
1
|
-
var Ie=Object.defineProperty,nt=Object.defineProperties;var lt=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,st=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,De=(e,t)=>{for(var r in t||(t={}))it.call(t,r)&&qe(e,r,t[r]);if(We)for(var r of We(t))st.call(t,r)&&qe(e,r,t[r]);return e},Be=(e,t)=>nt(e,lt(t));var ot=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})};var Pe={};ot(Pe,{analyzeMetafile:()=>xt,analyzeMetafileSync:()=>$t,build:()=>wt,buildSync:()=>St,default:()=>Ct,formatMessages:()=>Ot,formatMessagesSync:()=>kt,initialize:()=>Mt,serve:()=>vt,transform:()=>Rt,transformSync:()=>Et,version:()=>bt});function Ne(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(ne(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(ne(s)),t(o[s])}},r=new Se;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Fe(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 ye(r.read());case 4:return r.read();case 5:{let c=r.read32(),l=[];for(let b=0;b<c;b++)l.push(t());return l}case 6:{let c=r.read32(),l={};for(let b=0;b<c;b++)l[ye(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new Se(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 Se=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);Fe(this.buf,t,r)}write(t){let r=this._write(4+t.length);Fe(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 Ue(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}},ne,ye;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ne=r=>e.encode(r),ye=r=>t.decode(r)}else if(typeof Buffer!="undefined")ne=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},ye=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 Ue(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Fe(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",ut=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",g=e=>typeof e=="string"?null:"a string",Me=e=>e instanceof RegExp?null:"a RegExp object",Re=e=>typeof e=="number"&&e===(e|0)?null:"an integer",je=e=>typeof e=="function"?null:"a function",V=e=>Array.isArray(e)?null:"an array",se=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ft=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",ct=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",dt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",pt=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Qe=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 He(e){let t=Object.create(null),r=n(e,t,"wasmURL",g),o=n(e,t,"wasmModule",ft),d=n(e,t,"worker",q);return Y(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:d}}function Ge(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 Ae(e,t,r,o,d){let s=n(t,r,"color",q),c=n(t,r,"logLevel",g),l=n(t,r,"logLimit",Re);s!==void 0?e.push(`--color=${s}`):o&&e.push("--color=true"),e.push(`--log-level=${c||d}`),e.push(`--log-limit=${l||0}`)}function Xe(e,t,r){let o=n(t,r,"legalComments",g),d=n(t,r,"sourceRoot",g),s=n(t,r,"sourcesContent",q),c=n(t,r,"target",pt),l=n(t,r,"format",g),b=n(t,r,"globalName",g),O=n(t,r,"mangleProps",Me),N=n(t,r,"reserveProps",Me),A=n(t,r,"mangleQuoted",q),k=n(t,r,"minify",q),z=n(t,r,"minifySyntax",q),le=n(t,r,"minifyWhitespace",q),oe=n(t,r,"minifyIdentifiers",q),ie=n(t,r,"drop",V),te=n(t,r,"charset",g),ae=n(t,r,"treeShaking",q),ue=n(t,r,"ignoreAnnotations",q),ce=n(t,r,"jsx",g),ge=n(t,r,"jsxFactory",g),de=n(t,r,"jsxFragment",g),be=n(t,r,"jsxImportSource",g),xe=n(t,r,"jsxDev",q),me=n(t,r,"define",se),p=n(t,r,"logOverride",se),u=n(t,r,"supported",se),a=n(t,r,"pure",V),f=n(t,r,"keepNames",q),C=n(t,r,"platform",g);if(o&&e.push(`--legal-comments=${o}`),d!==void 0&&e.push(`--source-root=${d}`),s!==void 0&&e.push(`--sources-content=${s}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ke).join(",")}`):e.push(`--target=${Ke(c)}`)),l&&e.push(`--format=${l}`),b&&e.push(`--global-name=${b}`),C&&e.push(`--platform=${C}`),k&&e.push("--minify"),z&&e.push("--minify-syntax"),le&&e.push("--minify-whitespace"),oe&&e.push("--minify-identifiers"),te&&e.push(`--charset=${te}`),ae!==void 0&&e.push(`--tree-shaking=${ae}`),ue&&e.push("--ignore-annotations"),ie)for(let w of ie)e.push(`--drop:${w}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),A!==void 0&&e.push(`--mangle-quoted=${A}`),ce&&e.push(`--jsx=${ce}`),ge&&e.push(`--jsx-factory=${ge}`),de&&e.push(`--jsx-fragment=${de}`),be&&e.push(`--jsx-import-source=${be}`),xe&&e.push("--jsx-dev"),me)for(let w in me){if(w.indexOf("=")>=0)throw new Error(`Invalid define: ${w}`);e.push(`--define:${w}=${me[w]}`)}if(p)for(let w in p){if(w.indexOf("=")>=0)throw new Error(`Invalid log override: ${w}`);e.push(`--log-override:${w}=${p[w]}`)}if(u)for(let w in u){if(w.indexOf("=")>=0)throw new Error(`Invalid supported: ${w}`);e.push(`--supported:${w}=${u[w]}`)}if(a)for(let w of a)e.push(`--pure:${w}`);f&&e.push("--keep-names")}function gt(e,t,r,o,d){var h;let s=[],c=[],l=Object.create(null),b=null,O=null,N=null;Ae(s,t,l,r,o),Xe(s,t,l);let A=n(t,l,"sourcemap",Ye),k=n(t,l,"bundle",q),z=n(t,l,"watch",ut),le=n(t,l,"splitting",q),oe=n(t,l,"preserveSymlinks",q),ie=n(t,l,"metafile",q),te=n(t,l,"outfile",g),ae=n(t,l,"outdir",g),ue=n(t,l,"outbase",g),ce=n(t,l,"tsconfig",g),ge=n(t,l,"resolveExtensions",V),de=n(t,l,"nodePaths",V),be=n(t,l,"mainFields",V),xe=n(t,l,"conditions",V),me=n(t,l,"external",V),p=n(t,l,"loader",se),u=n(t,l,"outExtension",se),a=n(t,l,"publicPath",g),f=n(t,l,"entryNames",g),C=n(t,l,"chunkNames",g),w=n(t,l,"assetNames",g),$=n(t,l,"inject",V),x=n(t,l,"banner",se),P=n(t,l,"footer",se),E=n(t,l,"entryPoints",ct),R=n(t,l,"absWorkingDir",g),M=n(t,l,"stdin",se),D=(h=n(t,l,"write",q))!=null?h:d,B=n(t,l,"allowOverwrite",q),W=n(t,l,"incremental",q)===!0,ee=n(t,l,"mangleCache",se);if(l.plugins=!0,Y(t,l,`in ${e}() call`),A&&s.push(`--sourcemap${A===!0?"":`=${A}`}`),k&&s.push("--bundle"),B&&s.push("--allow-overwrite"),z)if(s.push("--watch"),typeof z=="boolean")N={};else{let i=Object.create(null),y=n(z,i,"onRebuild",je);Y(z,i,`on "watch" in ${e}() call`),N={onRebuild:y}}if(le&&s.push("--splitting"),oe&&s.push("--preserve-symlinks"),ie&&s.push("--metafile"),te&&s.push(`--outfile=${te}`),ae&&s.push(`--outdir=${ae}`),ue&&s.push(`--outbase=${ue}`),ce&&s.push(`--tsconfig=${ce}`),ge){let i=[];for(let y of ge){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${y}`);i.push(y)}s.push(`--resolve-extensions=${i.join(",")}`)}if(a&&s.push(`--public-path=${a}`),f&&s.push(`--entry-names=${f}`),C&&s.push(`--chunk-names=${C}`),w&&s.push(`--asset-names=${w}`),be){let i=[];for(let y of be){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid main field: ${y}`);i.push(y)}s.push(`--main-fields=${i.join(",")}`)}if(xe){let i=[];for(let y of xe){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid condition: ${y}`);i.push(y)}s.push(`--conditions=${i.join(",")}`)}if(me)for(let i of me)s.push(`--external:${i}`);if(x)for(let i in x){if(i.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${i}`);s.push(`--banner:${i}=${x[i]}`)}if(P)for(let i in P){if(i.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${i}`);s.push(`--footer:${i}=${P[i]}`)}if($)for(let i of $)s.push(`--inject:${i}`);if(p)for(let i in p){if(i.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${i}`);s.push(`--loader:${i}=${p[i]}`)}if(u)for(let i in u){if(i.indexOf("=")>=0)throw new Error(`Invalid out extension: ${i}`);s.push(`--out-extension:${i}=${u[i]}`)}if(E)if(Array.isArray(E))for(let i of E)c.push(["",i+""]);else for(let[i,y]of Object.entries(E))c.push([i+"",y+""]);if(M){let i=Object.create(null),y=n(M,i,"contents",Qe),j=n(M,i,"resolveDir",g),L=n(M,i,"sourcefile",g),v=n(M,i,"loader",g);Y(M,i,'in "stdin" object'),L&&s.push(`--sourcefile=${L}`),v&&s.push(`--loader=${v}`),j&&(O=j+""),typeof y=="string"?b=ne(y):y instanceof Uint8Array&&(b=y)}let S=[];if(de)for(let i of de)i+="",S.push(i);return{entries:c,flags:s,write:D,stdinContents:b,stdinResolveDir:O,absWorkingDir:R,incremental:W,nodePaths:S,watch:N,mangleCache:Ge(ee)}}function mt(e,t,r,o){let d=[],s=Object.create(null);Ae(d,t,s,r,o),Xe(d,t,s);let c=n(t,s,"sourcemap",Ye),l=n(t,s,"tsconfigRaw",dt),b=n(t,s,"sourcefile",g),O=n(t,s,"loader",g),N=n(t,s,"banner",g),A=n(t,s,"footer",g),k=n(t,s,"mangleCache",se);return Y(t,s,`in ${e}() call`),c&&d.push(`--sourcemap=${c===!0?"external":c}`),l&&d.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),b&&d.push(`--sourcefile=${b}`),O&&d.push(`--loader=${O}`),N&&d.push(`--banner=${N}`),A&&d.push(`--footer=${A}`),{flags:d,mangleCache:Ge(k)}}function Ze(e){let t=new Map,r=new Map,o=new Map,d=new Map,s=null,c=0,l=0,b=new Uint8Array(16*1024),O=0,N=p=>{let u=O+p.length;if(u>b.length){let f=new Uint8Array(u*2);f.set(b),b=f}b.set(p,O),O+=p.length;let a=0;for(;a+4<=O;){let f=Ue(b,a);if(a+4+f>O)break;a+=4,ie(b.subarray(a,a+f)),a+=f}a>0&&(b.copyWithin(0,a,O),O-=a)},A=p=>{s={reason:p?": "+(p.message||p):""};let u="The service was stopped"+s.reason;for(let a of t.values())a(u,null);t.clear();for(let a of d.values())a.onWait(u);d.clear();for(let a of o.values())try{a(new Error(u),null)}catch(f){console.error(f)}o.clear()},k=(p,u,a)=>{if(s)return a("The service is no longer running"+s.reason,null);let f=c++;t.set(f,(C,w)=>{try{a(C,w)}finally{p&&p.unref()}}),p&&p.ref(),e.writeToStdin(Ne({id:f,isRequest:!0,value:u}))},z=(p,u)=>{if(s)throw new Error("The service is no longer running"+s.reason);e.writeToStdin(Ne({id:p,isRequest:!1,value:u}))},le=async(p,u)=>{try{switch(u.command){case"ping":{z(p,{});break}case"on-start":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"on-resolve":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"on-load":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"serve-request":{let a=d.get(u.key);a&&a.onRequest&&a.onRequest(u.args),z(p,{});break}case"serve-wait":{let a=d.get(u.key);a&&a.onWait(u.error),z(p,{});break}case"watch-rebuild":{let a=o.get(u.key);try{a&&a(null,u.args)}catch(f){console.error(f)}z(p,{});break}default:throw new Error("Invalid command: "+u.command)}}catch(a){z(p,{errors:[we(a,e,null,void 0,"")]})}},oe=!0,ie=p=>{if(oe){oe=!1;let a=String.fromCharCode(...p);if(a!=="0.14.53")throw new Error(`Cannot start service: Host version "0.14.53" does not match binary version ${JSON.stringify(a)}`);return}let u=ze(p);if(u.isRequest)le(u.id,u.value);else{let a=t.get(u.id);t.delete(u.id),u.value.error?a(u.value.error,{}):a(null,u.value)}},te=async(p,u,a,f,C)=>{let w=[],$=[],x={},P={},E=0,R=0,M=[],D=!1;u=[...u];for(let S of u){let h={};if(typeof S!="object")throw new Error(`Plugin at index ${R} must be an object`);let i=n(S,h,"name",g);if(typeof i!="string"||i==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let y=n(S,h,"setup",je);if(typeof y!="function")throw new Error("Plugin is missing a setup function");Y(S,h,`on plugin ${JSON.stringify(i)}`);let j={name:i,onResolve:[],onLoad:[]};R++;let v=y({initialOptions:p,resolve:(m,F={})=>{if(!D)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof m!="string")throw new Error("The path to resolve must be a string");let T=Object.create(null),Q=n(F,T,"pluginName",g),I=n(F,T,"importer",g),_=n(F,T,"namespace",g),X=n(F,T,"resolveDir",g),H=n(F,T,"kind",g),U=n(F,T,"pluginData",$e);return Y(F,T,"in resolve() call"),new Promise((J,G)=>{let K={command:"resolve",path:m,key:a,pluginName:i};Q!=null&&(K.pluginName=Q),I!=null&&(K.importer=I),_!=null&&(K.namespace=_),X!=null&&(K.resolveDir=X),H!=null&&(K.kind=H),U!=null&&(K.pluginData=f.store(U)),k(C,K,(fe,Z)=>{fe!==null?G(new Error(fe)):J({errors:pe(Z.errors,f),warnings:pe(Z.warnings,f),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:f.load(Z.pluginData)})})})},onStart(m){let F='This error came from the "onStart" callback registered here:',T=Ee(new Error(F),e,"onStart");w.push({name:i,callback:m,note:T})},onEnd(m){let F='This error came from the "onEnd" callback registered here:',T=Ee(new Error(F),e,"onEnd");$.push({name:i,callback:m,note:T})},onResolve(m,F){let T='This error came from the "onResolve" callback registered here:',Q=Ee(new Error(T),e,"onResolve"),I={},_=n(m,I,"filter",Me),X=n(m,I,"namespace",g);if(Y(m,I,`in onResolve() call for plugin ${JSON.stringify(i)}`),_==null)throw new Error("onResolve() call is missing a filter");let H=E++;x[H]={name:i,callback:F,note:Q},j.onResolve.push({id:H,filter:_.source,namespace:X||""})},onLoad(m,F){let T='This error came from the "onLoad" callback registered here:',Q=Ee(new Error(T),e,"onLoad"),I={},_=n(m,I,"filter",Me),X=n(m,I,"namespace",g);if(Y(m,I,`in onLoad() call for plugin ${JSON.stringify(i)}`),_==null)throw new Error("onLoad() call is missing a filter");let H=E++;P[H]={name:i,callback:F,note:Q},j.onLoad.push({id:H,filter:_.source,namespace:X||""})},esbuild:e.esbuild});v&&await v,M.push(j)}catch(y){return{ok:!1,error:y,pluginName:i}}}let B=async S=>{switch(S.command){case"on-start":{let h={errors:[],warnings:[]};return await Promise.all(w.map(async({name:i,callback:y,note:j})=>{try{let L=await y();if(L!=null){if(typeof L!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(i)} to return an object`);let v={},m=n(L,v,"errors",V),F=n(L,v,"warnings",V);Y(L,v,`from onStart() callback in plugin ${JSON.stringify(i)}`),m!=null&&h.errors.push(...he(m,"errors",f,i)),F!=null&&h.warnings.push(...he(F,"warnings",f,i))}}catch(L){h.errors.push(we(L,e,f,j&&j(),i))}})),h}case"on-resolve":{let h={},i="",y,j;for(let L of S.ids)try{({name:i,callback:y,note:j}=x[L]);let v=await y({path:S.path,importer:S.importer,namespace:S.namespace,resolveDir:S.resolveDir,kind:S.kind,pluginData:f.load(S.pluginData)});if(v!=null){if(typeof v!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(v,m,"pluginName",g),T=n(v,m,"path",g),Q=n(v,m,"namespace",g),I=n(v,m,"suffix",g),_=n(v,m,"external",q),X=n(v,m,"sideEffects",q),H=n(v,m,"pluginData",$e),U=n(v,m,"errors",V),J=n(v,m,"warnings",V),G=n(v,m,"watchFiles",V),K=n(v,m,"watchDirs",V);Y(v,m,`from onResolve() callback in plugin ${JSON.stringify(i)}`),h.id=L,F!=null&&(h.pluginName=F),T!=null&&(h.path=T),Q!=null&&(h.namespace=Q),I!=null&&(h.suffix=I),_!=null&&(h.external=_),X!=null&&(h.sideEffects=X),H!=null&&(h.pluginData=f.store(H)),U!=null&&(h.errors=he(U,"errors",f,i)),J!=null&&(h.warnings=he(J,"warnings",f,i)),G!=null&&(h.watchFiles=ke(G,"watchFiles")),K!=null&&(h.watchDirs=ke(K,"watchDirs"));break}}catch(v){return{id:L,errors:[we(v,e,f,j&&j(),i)]}}return h}case"on-load":{let h={},i="",y,j;for(let L of S.ids)try{({name:i,callback:y,note:j}=P[L]);let v=await y({path:S.path,namespace:S.namespace,suffix:S.suffix,pluginData:f.load(S.pluginData)});if(v!=null){if(typeof v!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(v,m,"pluginName",g),T=n(v,m,"contents",Qe),Q=n(v,m,"resolveDir",g),I=n(v,m,"pluginData",$e),_=n(v,m,"loader",g),X=n(v,m,"errors",V),H=n(v,m,"warnings",V),U=n(v,m,"watchFiles",V),J=n(v,m,"watchDirs",V);Y(v,m,`from onLoad() callback in plugin ${JSON.stringify(i)}`),h.id=L,F!=null&&(h.pluginName=F),T instanceof Uint8Array?h.contents=T:T!=null&&(h.contents=ne(T)),Q!=null&&(h.resolveDir=Q),I!=null&&(h.pluginData=f.store(I)),_!=null&&(h.loader=_),X!=null&&(h.errors=he(X,"errors",f,i)),H!=null&&(h.warnings=he(H,"warnings",f,i)),U!=null&&(h.watchFiles=ke(U,"watchFiles")),J!=null&&(h.watchDirs=ke(J,"watchDirs"));break}}catch(v){return{id:L,errors:[we(v,e,f,j&&j(),i)]}}return h}default:throw new Error("Invalid command: "+S.command)}},W=(S,h,i)=>i();$.length>0&&(W=(S,h,i)=>{(async()=>{for(let{name:y,callback:j,note:L}of $)try{await j(S)}catch(v){S.errors.push(await new Promise(m=>h(v,y,L&&L(),m)))}})().then(i)}),D=!0;let ee=0;return{ok:!0,requestPlugins:M,runOnEndCallbacks:W,pluginRefs:{ref(){++ee===1&&r.set(a,B)},unref(){--ee===0&&r.delete(a)}}}},ae=(p,u,a,f)=>{let C={},w=n(u,C,"port",Re),$=n(u,C,"host",g),x=n(u,C,"servedir",g),P=n(u,C,"onRequest",je),E,R=new Promise((M,D)=>{E=B=>{d.delete(f),B!==null?D(new Error(B)):M()}});return a.serve={},Y(u,C,"in serve() call"),w!==void 0&&(a.serve.port=w),$!==void 0&&(a.serve.host=$),x!==void 0&&(a.serve.servedir=x),d.set(f,{onRequest:P,onWait:E}),{wait:R,stop(){k(p,{command:"serve-stop",key:f},()=>{})}}},ue="warning",ce="silent",ge=p=>{let u=l++,a=Ve(),f,{refs:C,options:w,isTTY:$,callback:x}=p;if(typeof w=="object"){let R=w.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');f=R}}let P=(R,M,D,B)=>{let W=[];try{Ae(W,w,{},$,ue)}catch(S){}let ee=we(R,e,a,D,M);k(C,{command:"error",flags:W,error:ee},()=>{ee.detail=a.load(ee.detail),B(ee)})},E=(R,M)=>{P(R,M,void 0,D=>{x(ve("Build failed",[D],[]),null)})};if(f&&f.length>0){if(e.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");te(w,f,u,a,C).then(R=>{if(!R.ok)E(R.error,R.pluginName);else try{de(Be(De({},p),{key:u,details:a,logPluginError:P,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(M){E(M,"")}},R=>E(R,""))}else try{de(Be(De({},p),{key:u,details:a,logPluginError:P,requestPlugins:null,runOnEndCallbacks:(R,M,D)=>D(),pluginRefs:null}))}catch(R){E(R,"")}},de=({callName:p,refs:u,serveOptions:a,options:f,isTTY:C,defaultWD:w,callback:$,key:x,details:P,logPluginError:E,requestPlugins:R,runOnEndCallbacks:M,pluginRefs:D})=>{let B={ref(){D&&D.ref(),u&&u.ref()},unref(){D&&D.unref(),u&&u.unref()}},W=!e.isWriteUnavailable,{entries:ee,flags:S,write:h,stdinContents:i,stdinResolveDir:y,absWorkingDir:j,incremental:L,nodePaths:v,watch:m,mangleCache:F}=gt(p,f,C,ue,W),T={command:"build",key:x,entries:ee,flags:S,write:h,stdinContents:i,stdinResolveDir:y,absWorkingDir:j||w,incremental:L,nodePaths:v};R&&(T.plugins=R),F&&(T.mangleCache=F);let Q=a&&ae(B,a,T,x),I,_,X=(U,J)=>{U.outputFiles&&(J.outputFiles=U.outputFiles.map(yt)),U.metafile&&(J.metafile=JSON.parse(U.metafile)),U.mangleCache&&(J.mangleCache=U.mangleCache),U.writeToStdout!==void 0&&console.log(ye(U.writeToStdout).replace(/\n$/,""))},H=(U,J)=>{let G={errors:pe(U.errors,P),warnings:pe(U.warnings,P)};X(U,G),M(G,E,()=>{if(G.errors.length>0)return J(ve("Build failed",G.errors,G.warnings),null);if(U.rebuild){if(!I){let K=!1;I=()=>new Promise((fe,Z)=>{if(K||s)throw new Error("Cannot rebuild");k(B,{command:"rebuild",key:x},(re,tt)=>{if(re)return J(ve("Build failed",[{id:"",pluginName:"",text:re,location:null,notes:[],detail:void 0}],[]),null);H(tt,(Te,rt)=>{Te?Z(Te):fe(rt)})})}),B.ref(),I.dispose=()=>{K||(K=!0,k(B,{command:"rebuild-dispose",key:x},()=>{}),B.unref())}}G.rebuild=I}if(U.watch){if(!_){let K=!1;B.ref(),_=()=>{K||(K=!0,o.delete(x),k(B,{command:"watch-stop",key:x},()=>{}),B.unref())},m&&o.set(x,(fe,Z)=>{if(fe){m.onRebuild&&m.onRebuild(fe,null);return}let re={errors:pe(Z.errors,P),warnings:pe(Z.warnings,P)};X(Z,re),M(re,E,()=>{if(re.errors.length>0){m.onRebuild&&m.onRebuild(ve("Build failed",re.errors,re.warnings),null);return}Z.rebuildID!==void 0&&(re.rebuild=I),re.stop=_,m.onRebuild&&m.onRebuild(null,re)})})}G.stop=_}J(null,G)})};if(h&&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(m&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');k(B,T,(U,J)=>{if(U)return $(new Error(U),null);if(Q){let G=J,K=!1;B.ref();let fe={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,fe)}return H(J,$)})};return{readFromStdout:N,afterClose:A,service:{buildOrServe:ge,transform:({callName:p,refs:u,input:a,options:f,isTTY:C,fs:w,callback:$})=>{let x=Ve(),P=E=>{try{if(typeof a!="string"&&!(a instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:R,mangleCache:M}=mt(p,f,C,ce),D={command:"transform",flags:R,inputFS:E!==null,input:E!==null?ne(E):typeof a=="string"?ne(a):a};M&&(D.mangleCache=M),k(u,D,(B,W)=>{if(B)return $(new Error(B),null);let ee=pe(W.errors,x),S=pe(W.warnings,x),h=1,i=()=>{if(--h===0){let y={warnings:S,code:W.code,map:W.map};W.mangleCache&&(y.mangleCache=W==null?void 0:W.mangleCache),$(null,y)}};if(ee.length>0)return $(ve("Transform failed",ee,S),null);W.codeFS&&(h++,w.readFile(W.code,(y,j)=>{y!==null?$(y,null):(W.code=j,i())})),W.mapFS&&(h++,w.readFile(W.map,(y,j)=>{y!==null?$(y,null):(W.map=j,i())})),i()})}catch(R){let M=[];try{Ae(M,f,{},C,ce)}catch(B){}let D=we(R,e,x,void 0,"");k(u,{command:"error",flags:M,error:D},()=>{D.detail=x.load(D.detail),$(ve("Transform failed",[D],[]),null)})}};if((typeof a=="string"||a instanceof Uint8Array)&&a.length>1024*1024){let E=P;P=()=>w.writeFile(a,E)}P(null)},formatMessages:({callName:p,refs:u,messages:a,options:f,callback:C})=>{let w=he(a,"messages",null,"");if(!f)throw new Error(`Missing second argument in ${p}() call`);let $={},x=n(f,$,"kind",g),P=n(f,$,"color",q),E=n(f,$,"terminalWidth",Re);if(Y(f,$,`in ${p}() call`),x===void 0)throw new Error(`Missing "kind" in ${p}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${p}() call`);let R={command:"format-msgs",messages:w,isWarning:x==="warning"};P!==void 0&&(R.color=P),E!==void 0&&(R.terminalWidth=E),k(u,R,(M,D)=>{if(M)return C(new Error(M),null);C(null,D.messages)})},analyzeMetafile:({callName:p,refs:u,metafile:a,options:f,callback:C})=>{f===void 0&&(f={});let w={},$=n(f,w,"color",q),x=n(f,w,"verbose",q);Y(f,w,`in ${p}() call`);let P={command:"analyze-metafile",metafile:a};$!==void 0&&(P.color=$),x!==void 0&&(P.verbose=x),k(u,P,(E,R)=>{if(E)return C(new Error(E),null);C(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(`
|
1
|
+
var Ie=Object.defineProperty,nt=Object.defineProperties;var lt=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,st=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,De=(e,t)=>{for(var r in t||(t={}))it.call(t,r)&&qe(e,r,t[r]);if(We)for(var r of We(t))st.call(t,r)&&qe(e,r,t[r]);return e},Be=(e,t)=>nt(e,lt(t));var ot=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})};var Pe={};ot(Pe,{analyzeMetafile:()=>xt,analyzeMetafileSync:()=>$t,build:()=>wt,buildSync:()=>St,default:()=>Ct,formatMessages:()=>Ot,formatMessagesSync:()=>kt,initialize:()=>Mt,serve:()=>vt,transform:()=>Rt,transformSync:()=>Et,version:()=>bt});function Ne(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(ne(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(ne(s)),t(o[s])}},r=new Se;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Fe(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 ye(r.read());case 4:return r.read();case 5:{let c=r.read32(),l=[];for(let b=0;b<c;b++)l.push(t());return l}case 6:{let c=r.read32(),l={};for(let b=0;b<c;b++)l[ye(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new Se(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 Se=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);Fe(this.buf,t,r)}write(t){let r=this._write(4+t.length);Fe(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 Ue(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}},ne,ye;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ne=r=>e.encode(r),ye=r=>t.decode(r)}else if(typeof Buffer!="undefined")ne=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},ye=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 Ue(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Fe(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",ut=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",g=e=>typeof e=="string"?null:"a string",Me=e=>e instanceof RegExp?null:"a RegExp object",Re=e=>typeof e=="number"&&e===(e|0)?null:"an integer",je=e=>typeof e=="function"?null:"a function",V=e=>Array.isArray(e)?null:"an array",se=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ft=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",ct=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",dt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",pt=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Qe=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 He(e){let t=Object.create(null),r=n(e,t,"wasmURL",g),o=n(e,t,"wasmModule",ft),d=n(e,t,"worker",q);return Y(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:d}}function Ge(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 Ae(e,t,r,o,d){let s=n(t,r,"color",q),c=n(t,r,"logLevel",g),l=n(t,r,"logLimit",Re);s!==void 0?e.push(`--color=${s}`):o&&e.push("--color=true"),e.push(`--log-level=${c||d}`),e.push(`--log-limit=${l||0}`)}function Xe(e,t,r){let o=n(t,r,"legalComments",g),d=n(t,r,"sourceRoot",g),s=n(t,r,"sourcesContent",q),c=n(t,r,"target",pt),l=n(t,r,"format",g),b=n(t,r,"globalName",g),O=n(t,r,"mangleProps",Me),N=n(t,r,"reserveProps",Me),A=n(t,r,"mangleQuoted",q),k=n(t,r,"minify",q),z=n(t,r,"minifySyntax",q),le=n(t,r,"minifyWhitespace",q),oe=n(t,r,"minifyIdentifiers",q),ie=n(t,r,"drop",V),te=n(t,r,"charset",g),ae=n(t,r,"treeShaking",q),ue=n(t,r,"ignoreAnnotations",q),ce=n(t,r,"jsx",g),ge=n(t,r,"jsxFactory",g),de=n(t,r,"jsxFragment",g),be=n(t,r,"jsxImportSource",g),xe=n(t,r,"jsxDev",q),me=n(t,r,"define",se),p=n(t,r,"logOverride",se),u=n(t,r,"supported",se),a=n(t,r,"pure",V),f=n(t,r,"keepNames",q),C=n(t,r,"platform",g);if(o&&e.push(`--legal-comments=${o}`),d!==void 0&&e.push(`--source-root=${d}`),s!==void 0&&e.push(`--sources-content=${s}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ke).join(",")}`):e.push(`--target=${Ke(c)}`)),l&&e.push(`--format=${l}`),b&&e.push(`--global-name=${b}`),C&&e.push(`--platform=${C}`),k&&e.push("--minify"),z&&e.push("--minify-syntax"),le&&e.push("--minify-whitespace"),oe&&e.push("--minify-identifiers"),te&&e.push(`--charset=${te}`),ae!==void 0&&e.push(`--tree-shaking=${ae}`),ue&&e.push("--ignore-annotations"),ie)for(let w of ie)e.push(`--drop:${w}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),A!==void 0&&e.push(`--mangle-quoted=${A}`),ce&&e.push(`--jsx=${ce}`),ge&&e.push(`--jsx-factory=${ge}`),de&&e.push(`--jsx-fragment=${de}`),be&&e.push(`--jsx-import-source=${be}`),xe&&e.push("--jsx-dev"),me)for(let w in me){if(w.indexOf("=")>=0)throw new Error(`Invalid define: ${w}`);e.push(`--define:${w}=${me[w]}`)}if(p)for(let w in p){if(w.indexOf("=")>=0)throw new Error(`Invalid log override: ${w}`);e.push(`--log-override:${w}=${p[w]}`)}if(u)for(let w in u){if(w.indexOf("=")>=0)throw new Error(`Invalid supported: ${w}`);e.push(`--supported:${w}=${u[w]}`)}if(a)for(let w of a)e.push(`--pure:${w}`);f&&e.push("--keep-names")}function gt(e,t,r,o,d){var h;let s=[],c=[],l=Object.create(null),b=null,O=null,N=null;Ae(s,t,l,r,o),Xe(s,t,l);let A=n(t,l,"sourcemap",Ye),k=n(t,l,"bundle",q),z=n(t,l,"watch",ut),le=n(t,l,"splitting",q),oe=n(t,l,"preserveSymlinks",q),ie=n(t,l,"metafile",q),te=n(t,l,"outfile",g),ae=n(t,l,"outdir",g),ue=n(t,l,"outbase",g),ce=n(t,l,"tsconfig",g),ge=n(t,l,"resolveExtensions",V),de=n(t,l,"nodePaths",V),be=n(t,l,"mainFields",V),xe=n(t,l,"conditions",V),me=n(t,l,"external",V),p=n(t,l,"loader",se),u=n(t,l,"outExtension",se),a=n(t,l,"publicPath",g),f=n(t,l,"entryNames",g),C=n(t,l,"chunkNames",g),w=n(t,l,"assetNames",g),$=n(t,l,"inject",V),x=n(t,l,"banner",se),P=n(t,l,"footer",se),E=n(t,l,"entryPoints",ct),R=n(t,l,"absWorkingDir",g),M=n(t,l,"stdin",se),D=(h=n(t,l,"write",q))!=null?h:d,B=n(t,l,"allowOverwrite",q),W=n(t,l,"incremental",q)===!0,ee=n(t,l,"mangleCache",se);if(l.plugins=!0,Y(t,l,`in ${e}() call`),A&&s.push(`--sourcemap${A===!0?"":`=${A}`}`),k&&s.push("--bundle"),B&&s.push("--allow-overwrite"),z)if(s.push("--watch"),typeof z=="boolean")N={};else{let i=Object.create(null),y=n(z,i,"onRebuild",je);Y(z,i,`on "watch" in ${e}() call`),N={onRebuild:y}}if(le&&s.push("--splitting"),oe&&s.push("--preserve-symlinks"),ie&&s.push("--metafile"),te&&s.push(`--outfile=${te}`),ae&&s.push(`--outdir=${ae}`),ue&&s.push(`--outbase=${ue}`),ce&&s.push(`--tsconfig=${ce}`),ge){let i=[];for(let y of ge){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${y}`);i.push(y)}s.push(`--resolve-extensions=${i.join(",")}`)}if(a&&s.push(`--public-path=${a}`),f&&s.push(`--entry-names=${f}`),C&&s.push(`--chunk-names=${C}`),w&&s.push(`--asset-names=${w}`),be){let i=[];for(let y of be){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid main field: ${y}`);i.push(y)}s.push(`--main-fields=${i.join(",")}`)}if(xe){let i=[];for(let y of xe){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid condition: ${y}`);i.push(y)}s.push(`--conditions=${i.join(",")}`)}if(me)for(let i of me)s.push(`--external:${i}`);if(x)for(let i in x){if(i.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${i}`);s.push(`--banner:${i}=${x[i]}`)}if(P)for(let i in P){if(i.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${i}`);s.push(`--footer:${i}=${P[i]}`)}if($)for(let i of $)s.push(`--inject:${i}`);if(p)for(let i in p){if(i.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${i}`);s.push(`--loader:${i}=${p[i]}`)}if(u)for(let i in u){if(i.indexOf("=")>=0)throw new Error(`Invalid out extension: ${i}`);s.push(`--out-extension:${i}=${u[i]}`)}if(E)if(Array.isArray(E))for(let i of E)c.push(["",i+""]);else for(let[i,y]of Object.entries(E))c.push([i+"",y+""]);if(M){let i=Object.create(null),y=n(M,i,"contents",Qe),j=n(M,i,"resolveDir",g),L=n(M,i,"sourcefile",g),v=n(M,i,"loader",g);Y(M,i,'in "stdin" object'),L&&s.push(`--sourcefile=${L}`),v&&s.push(`--loader=${v}`),j&&(O=j+""),typeof y=="string"?b=ne(y):y instanceof Uint8Array&&(b=y)}let S=[];if(de)for(let i of de)i+="",S.push(i);return{entries:c,flags:s,write:D,stdinContents:b,stdinResolveDir:O,absWorkingDir:R,incremental:W,nodePaths:S,watch:N,mangleCache:Ge(ee)}}function mt(e,t,r,o){let d=[],s=Object.create(null);Ae(d,t,s,r,o),Xe(d,t,s);let c=n(t,s,"sourcemap",Ye),l=n(t,s,"tsconfigRaw",dt),b=n(t,s,"sourcefile",g),O=n(t,s,"loader",g),N=n(t,s,"banner",g),A=n(t,s,"footer",g),k=n(t,s,"mangleCache",se);return Y(t,s,`in ${e}() call`),c&&d.push(`--sourcemap=${c===!0?"external":c}`),l&&d.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),b&&d.push(`--sourcefile=${b}`),O&&d.push(`--loader=${O}`),N&&d.push(`--banner=${N}`),A&&d.push(`--footer=${A}`),{flags:d,mangleCache:Ge(k)}}function Ze(e){let t=new Map,r=new Map,o=new Map,d=new Map,s=null,c=0,l=0,b=new Uint8Array(16*1024),O=0,N=p=>{let u=O+p.length;if(u>b.length){let f=new Uint8Array(u*2);f.set(b),b=f}b.set(p,O),O+=p.length;let a=0;for(;a+4<=O;){let f=Ue(b,a);if(a+4+f>O)break;a+=4,ie(b.subarray(a,a+f)),a+=f}a>0&&(b.copyWithin(0,a,O),O-=a)},A=p=>{s={reason:p?": "+(p.message||p):""};let u="The service was stopped"+s.reason;for(let a of t.values())a(u,null);t.clear();for(let a of d.values())a.onWait(u);d.clear();for(let a of o.values())try{a(new Error(u),null)}catch(f){console.error(f)}o.clear()},k=(p,u,a)=>{if(s)return a("The service is no longer running"+s.reason,null);let f=c++;t.set(f,(C,w)=>{try{a(C,w)}finally{p&&p.unref()}}),p&&p.ref(),e.writeToStdin(Ne({id:f,isRequest:!0,value:u}))},z=(p,u)=>{if(s)throw new Error("The service is no longer running"+s.reason);e.writeToStdin(Ne({id:p,isRequest:!1,value:u}))},le=async(p,u)=>{try{switch(u.command){case"ping":{z(p,{});break}case"on-start":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"on-resolve":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"on-load":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"serve-request":{let a=d.get(u.key);a&&a.onRequest&&a.onRequest(u.args),z(p,{});break}case"serve-wait":{let a=d.get(u.key);a&&a.onWait(u.error),z(p,{});break}case"watch-rebuild":{let a=o.get(u.key);try{a&&a(null,u.args)}catch(f){console.error(f)}z(p,{});break}default:throw new Error("Invalid command: "+u.command)}}catch(a){z(p,{errors:[we(a,e,null,void 0,"")]})}},oe=!0,ie=p=>{if(oe){oe=!1;let a=String.fromCharCode(...p);if(a!=="0.15.0")throw new Error(`Cannot start service: Host version "0.15.0" does not match binary version ${JSON.stringify(a)}`);return}let u=ze(p);if(u.isRequest)le(u.id,u.value);else{let a=t.get(u.id);t.delete(u.id),u.value.error?a(u.value.error,{}):a(null,u.value)}},te=async(p,u,a,f,C)=>{let w=[],$=[],x={},P={},E=0,R=0,M=[],D=!1;u=[...u];for(let S of u){let h={};if(typeof S!="object")throw new Error(`Plugin at index ${R} must be an object`);let i=n(S,h,"name",g);if(typeof i!="string"||i==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let y=n(S,h,"setup",je);if(typeof y!="function")throw new Error("Plugin is missing a setup function");Y(S,h,`on plugin ${JSON.stringify(i)}`);let j={name:i,onResolve:[],onLoad:[]};R++;let v=y({initialOptions:p,resolve:(m,F={})=>{if(!D)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof m!="string")throw new Error("The path to resolve must be a string");let T=Object.create(null),Q=n(F,T,"pluginName",g),I=n(F,T,"importer",g),_=n(F,T,"namespace",g),X=n(F,T,"resolveDir",g),H=n(F,T,"kind",g),U=n(F,T,"pluginData",$e);return Y(F,T,"in resolve() call"),new Promise((J,G)=>{let K={command:"resolve",path:m,key:a,pluginName:i};Q!=null&&(K.pluginName=Q),I!=null&&(K.importer=I),_!=null&&(K.namespace=_),X!=null&&(K.resolveDir=X),H!=null&&(K.kind=H),U!=null&&(K.pluginData=f.store(U)),k(C,K,(fe,Z)=>{fe!==null?G(new Error(fe)):J({errors:pe(Z.errors,f),warnings:pe(Z.warnings,f),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:f.load(Z.pluginData)})})})},onStart(m){let F='This error came from the "onStart" callback registered here:',T=Ee(new Error(F),e,"onStart");w.push({name:i,callback:m,note:T})},onEnd(m){let F='This error came from the "onEnd" callback registered here:',T=Ee(new Error(F),e,"onEnd");$.push({name:i,callback:m,note:T})},onResolve(m,F){let T='This error came from the "onResolve" callback registered here:',Q=Ee(new Error(T),e,"onResolve"),I={},_=n(m,I,"filter",Me),X=n(m,I,"namespace",g);if(Y(m,I,`in onResolve() call for plugin ${JSON.stringify(i)}`),_==null)throw new Error("onResolve() call is missing a filter");let H=E++;x[H]={name:i,callback:F,note:Q},j.onResolve.push({id:H,filter:_.source,namespace:X||""})},onLoad(m,F){let T='This error came from the "onLoad" callback registered here:',Q=Ee(new Error(T),e,"onLoad"),I={},_=n(m,I,"filter",Me),X=n(m,I,"namespace",g);if(Y(m,I,`in onLoad() call for plugin ${JSON.stringify(i)}`),_==null)throw new Error("onLoad() call is missing a filter");let H=E++;P[H]={name:i,callback:F,note:Q},j.onLoad.push({id:H,filter:_.source,namespace:X||""})},esbuild:e.esbuild});v&&await v,M.push(j)}catch(y){return{ok:!1,error:y,pluginName:i}}}let B=async S=>{switch(S.command){case"on-start":{let h={errors:[],warnings:[]};return await Promise.all(w.map(async({name:i,callback:y,note:j})=>{try{let L=await y();if(L!=null){if(typeof L!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(i)} to return an object`);let v={},m=n(L,v,"errors",V),F=n(L,v,"warnings",V);Y(L,v,`from onStart() callback in plugin ${JSON.stringify(i)}`),m!=null&&h.errors.push(...he(m,"errors",f,i)),F!=null&&h.warnings.push(...he(F,"warnings",f,i))}}catch(L){h.errors.push(we(L,e,f,j&&j(),i))}})),h}case"on-resolve":{let h={},i="",y,j;for(let L of S.ids)try{({name:i,callback:y,note:j}=x[L]);let v=await y({path:S.path,importer:S.importer,namespace:S.namespace,resolveDir:S.resolveDir,kind:S.kind,pluginData:f.load(S.pluginData)});if(v!=null){if(typeof v!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(v,m,"pluginName",g),T=n(v,m,"path",g),Q=n(v,m,"namespace",g),I=n(v,m,"suffix",g),_=n(v,m,"external",q),X=n(v,m,"sideEffects",q),H=n(v,m,"pluginData",$e),U=n(v,m,"errors",V),J=n(v,m,"warnings",V),G=n(v,m,"watchFiles",V),K=n(v,m,"watchDirs",V);Y(v,m,`from onResolve() callback in plugin ${JSON.stringify(i)}`),h.id=L,F!=null&&(h.pluginName=F),T!=null&&(h.path=T),Q!=null&&(h.namespace=Q),I!=null&&(h.suffix=I),_!=null&&(h.external=_),X!=null&&(h.sideEffects=X),H!=null&&(h.pluginData=f.store(H)),U!=null&&(h.errors=he(U,"errors",f,i)),J!=null&&(h.warnings=he(J,"warnings",f,i)),G!=null&&(h.watchFiles=ke(G,"watchFiles")),K!=null&&(h.watchDirs=ke(K,"watchDirs"));break}}catch(v){return{id:L,errors:[we(v,e,f,j&&j(),i)]}}return h}case"on-load":{let h={},i="",y,j;for(let L of S.ids)try{({name:i,callback:y,note:j}=P[L]);let v=await y({path:S.path,namespace:S.namespace,suffix:S.suffix,pluginData:f.load(S.pluginData)});if(v!=null){if(typeof v!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(v,m,"pluginName",g),T=n(v,m,"contents",Qe),Q=n(v,m,"resolveDir",g),I=n(v,m,"pluginData",$e),_=n(v,m,"loader",g),X=n(v,m,"errors",V),H=n(v,m,"warnings",V),U=n(v,m,"watchFiles",V),J=n(v,m,"watchDirs",V);Y(v,m,`from onLoad() callback in plugin ${JSON.stringify(i)}`),h.id=L,F!=null&&(h.pluginName=F),T instanceof Uint8Array?h.contents=T:T!=null&&(h.contents=ne(T)),Q!=null&&(h.resolveDir=Q),I!=null&&(h.pluginData=f.store(I)),_!=null&&(h.loader=_),X!=null&&(h.errors=he(X,"errors",f,i)),H!=null&&(h.warnings=he(H,"warnings",f,i)),U!=null&&(h.watchFiles=ke(U,"watchFiles")),J!=null&&(h.watchDirs=ke(J,"watchDirs"));break}}catch(v){return{id:L,errors:[we(v,e,f,j&&j(),i)]}}return h}default:throw new Error("Invalid command: "+S.command)}},W=(S,h,i)=>i();$.length>0&&(W=(S,h,i)=>{(async()=>{for(let{name:y,callback:j,note:L}of $)try{await j(S)}catch(v){S.errors.push(await new Promise(m=>h(v,y,L&&L(),m)))}})().then(i)}),D=!0;let ee=0;return{ok:!0,requestPlugins:M,runOnEndCallbacks:W,pluginRefs:{ref(){++ee===1&&r.set(a,B)},unref(){--ee===0&&r.delete(a)}}}},ae=(p,u,a,f)=>{let C={},w=n(u,C,"port",Re),$=n(u,C,"host",g),x=n(u,C,"servedir",g),P=n(u,C,"onRequest",je),E,R=new Promise((M,D)=>{E=B=>{d.delete(f),B!==null?D(new Error(B)):M()}});return a.serve={},Y(u,C,"in serve() call"),w!==void 0&&(a.serve.port=w),$!==void 0&&(a.serve.host=$),x!==void 0&&(a.serve.servedir=x),d.set(f,{onRequest:P,onWait:E}),{wait:R,stop(){k(p,{command:"serve-stop",key:f},()=>{})}}},ue="warning",ce="silent",ge=p=>{let u=l++,a=Ve(),f,{refs:C,options:w,isTTY:$,callback:x}=p;if(typeof w=="object"){let R=w.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');f=R}}let P=(R,M,D,B)=>{let W=[];try{Ae(W,w,{},$,ue)}catch(S){}let ee=we(R,e,a,D,M);k(C,{command:"error",flags:W,error:ee},()=>{ee.detail=a.load(ee.detail),B(ee)})},E=(R,M)=>{P(R,M,void 0,D=>{x(ve("Build failed",[D],[]),null)})};if(f&&f.length>0){if(e.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");te(w,f,u,a,C).then(R=>{if(!R.ok)E(R.error,R.pluginName);else try{de(Be(De({},p),{key:u,details:a,logPluginError:P,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(M){E(M,"")}},R=>E(R,""))}else try{de(Be(De({},p),{key:u,details:a,logPluginError:P,requestPlugins:null,runOnEndCallbacks:(R,M,D)=>D(),pluginRefs:null}))}catch(R){E(R,"")}},de=({callName:p,refs:u,serveOptions:a,options:f,isTTY:C,defaultWD:w,callback:$,key:x,details:P,logPluginError:E,requestPlugins:R,runOnEndCallbacks:M,pluginRefs:D})=>{let B={ref(){D&&D.ref(),u&&u.ref()},unref(){D&&D.unref(),u&&u.unref()}},W=!e.isWriteUnavailable,{entries:ee,flags:S,write:h,stdinContents:i,stdinResolveDir:y,absWorkingDir:j,incremental:L,nodePaths:v,watch:m,mangleCache:F}=gt(p,f,C,ue,W),T={command:"build",key:x,entries:ee,flags:S,write:h,stdinContents:i,stdinResolveDir:y,absWorkingDir:j||w,incremental:L,nodePaths:v};R&&(T.plugins=R),F&&(T.mangleCache=F);let Q=a&&ae(B,a,T,x),I,_,X=(U,J)=>{U.outputFiles&&(J.outputFiles=U.outputFiles.map(yt)),U.metafile&&(J.metafile=JSON.parse(U.metafile)),U.mangleCache&&(J.mangleCache=U.mangleCache),U.writeToStdout!==void 0&&console.log(ye(U.writeToStdout).replace(/\n$/,""))},H=(U,J)=>{let G={errors:pe(U.errors,P),warnings:pe(U.warnings,P)};X(U,G),M(G,E,()=>{if(G.errors.length>0)return J(ve("Build failed",G.errors,G.warnings),null);if(U.rebuild){if(!I){let K=!1;I=()=>new Promise((fe,Z)=>{if(K||s)throw new Error("Cannot rebuild");k(B,{command:"rebuild",key:x},(re,tt)=>{if(re)return J(ve("Build failed",[{id:"",pluginName:"",text:re,location:null,notes:[],detail:void 0}],[]),null);H(tt,(Te,rt)=>{Te?Z(Te):fe(rt)})})}),B.ref(),I.dispose=()=>{K||(K=!0,k(B,{command:"rebuild-dispose",key:x},()=>{}),B.unref())}}G.rebuild=I}if(U.watch){if(!_){let K=!1;B.ref(),_=()=>{K||(K=!0,o.delete(x),k(B,{command:"watch-stop",key:x},()=>{}),B.unref())},m&&o.set(x,(fe,Z)=>{if(fe){m.onRebuild&&m.onRebuild(fe,null);return}let re={errors:pe(Z.errors,P),warnings:pe(Z.warnings,P)};X(Z,re),M(re,E,()=>{if(re.errors.length>0){m.onRebuild&&m.onRebuild(ve("Build failed",re.errors,re.warnings),null);return}Z.rebuildID!==void 0&&(re.rebuild=I),re.stop=_,m.onRebuild&&m.onRebuild(null,re)})})}G.stop=_}J(null,G)})};if(h&&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(m&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');k(B,T,(U,J)=>{if(U)return $(new Error(U),null);if(Q){let G=J,K=!1;B.ref();let fe={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,fe)}return H(J,$)})};return{readFromStdout:N,afterClose:A,service:{buildOrServe:ge,transform:({callName:p,refs:u,input:a,options:f,isTTY:C,fs:w,callback:$})=>{let x=Ve(),P=E=>{try{if(typeof a!="string"&&!(a instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:R,mangleCache:M}=mt(p,f,C,ce),D={command:"transform",flags:R,inputFS:E!==null,input:E!==null?ne(E):typeof a=="string"?ne(a):a};M&&(D.mangleCache=M),k(u,D,(B,W)=>{if(B)return $(new Error(B),null);let ee=pe(W.errors,x),S=pe(W.warnings,x),h=1,i=()=>{if(--h===0){let y={warnings:S,code:W.code,map:W.map};W.mangleCache&&(y.mangleCache=W==null?void 0:W.mangleCache),$(null,y)}};if(ee.length>0)return $(ve("Transform failed",ee,S),null);W.codeFS&&(h++,w.readFile(W.code,(y,j)=>{y!==null?$(y,null):(W.code=j,i())})),W.mapFS&&(h++,w.readFile(W.map,(y,j)=>{y!==null?$(y,null):(W.map=j,i())})),i()})}catch(R){let M=[];try{Ae(M,f,{},C,ce)}catch(B){}let D=we(R,e,x,void 0,"");k(u,{command:"error",flags:M,error:D},()=>{D.detail=x.load(D.detail),$(ve("Transform failed",[D],[]),null)})}};if((typeof a=="string"||a instanceof Uint8Array)&&a.length>1024*1024){let E=P;P=()=>w.writeFile(a,E)}P(null)},formatMessages:({callName:p,refs:u,messages:a,options:f,callback:C})=>{let w=he(a,"messages",null,"");if(!f)throw new Error(`Missing second argument in ${p}() call`);let $={},x=n(f,$,"kind",g),P=n(f,$,"color",q),E=n(f,$,"terminalWidth",Re);if(Y(f,$,`in ${p}() call`),x===void 0)throw new Error(`Missing "kind" in ${p}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${p}() call`);let R={command:"format-msgs",messages:w,isWarning:x==="warning"};P!==void 0&&(R.color=P),E!==void 0&&(R.terminalWidth=E),k(u,R,(M,D)=>{if(M)return C(new Error(M),null);C(null,D.messages)})},analyzeMetafile:({callName:p,refs:u,metafile:a,options:f,callback:C})=>{f===void 0&&(f={});let w={},$=n(f,w,"color",q),x=n(f,w,"verbose",q);Y(f,w,`in ${p}() call`);let P={command:"analyze-metafile",metafile:a};$!==void 0&&(P.color=$),x!==void 0&&(P.verbose=x),k(u,P,(E,R)=>{if(E)return C(new Error(E),null);C(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
2
|
`);s.splice(1,1);let c=et(t,s,r);if(c)return o={text:e.message,location:c},o}catch(s){}}}function we(e,t,r,o,d){let s="Internal error",c=null;try{s=(e&&e.message||e)+""}catch(l){}try{c=et(t,(e.stack+"").split(`
|
3
3
|
`),"")}catch(l){}return{id:"",pluginName:d,text:s,location:c,notes:o?[o]:[],detail:r?r.store(e):-1}}function et(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 c=/^(?:new |async )?\S+ \((.*)\)$/.exec(s);if(c){s=c[1];continue}if(c=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(s),c){s=c[1];continue}if(c=/^(\S+):(\d+):(\d+)$/.exec(s),c){let l;try{l=e.readFileSync(c[1],"utf8")}catch(A){break}let b=l.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",O=+c[3]-1,N=b.slice(O,O+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:ne(b.slice(0,O)).length,length:ne(b.slice(O,O+N)).length,lineText:b+`
|
4
4
|
`+t.slice(1).join(`
|
5
5
|
`),suggestion:""}}break}}return null}function ve(e,t,r){let o=5,d=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,o+1).map((c,l)=>{if(l===o)return`
|
6
6
|
...`;if(!c.location)return`
|
7
7
|
error: ${c.text}`;let{file:b,line:O,column:N}=c.location,A=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
|
8
|
-
${b}:${O}:${N}: ERROR: ${A}${c.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",g),d=n(e,r,"namespace",g),s=n(e,r,"line",Re),c=n(e,r,"column",Re),l=n(e,r,"length",Re),b=n(e,r,"lineText",g),O=n(e,r,"suggestion",g);return Y(e,r,t),{file:o||"",namespace:d||"",line:s||0,column:c||0,length:l||0,lineText:b||"",suggestion:O||""}}function he(e,t,r,o){let d=[],s=0;for(let c of e){let l={},b=n(c,l,"id",g),O=n(c,l,"pluginName",g),N=n(c,l,"text",g),A=n(c,l,"location",_e),k=n(c,l,"notes",V),z=n(c,l,"detail",$e),le=`in element ${s} of "${t}"`;Y(c,l,le);let oe=[];if(k)for(let ie of k){let te={},ae=n(ie,te,"text",g),ue=n(ie,te,"location",_e);Y(ie,te,le),oe.push({text:ae||"",location:Je(ue,le)})}d.push({id:b||"",pluginName:O||o,text:N||"",location:Je(A,le),notes:oe,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(){let o=this.contents;return(r===null||o!==t)&&(t=o,r=ye(o)),r}}}var bt="0.14.53",wt=e=>Ce().build(e),vt=()=>{throw new Error('The "serve" API only works in node')},Rt=(e,t)=>Ce().transform(e,t),Ot=(e,t)=>Ce().formatMessages(e,t),xt=(e,t)=>Ce().analyzeMetafile(e,t),St=()=>{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')},Oe,Le,Ce=()=>{if(Le)return Le;throw Oe?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=He(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(Oe)throw new Error('Cannot call "initialize" more than once');return Oe=At(t||"",r,o),Oe.catch(()=>{Oe=void 0}),Oe},At=async(e,t,r)=>{let o;if(t)o=t;else{let l=await fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);o=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.53"],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=>{
|
8
|
+
${b}:${O}:${N}: ERROR: ${A}${c.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",g),d=n(e,r,"namespace",g),s=n(e,r,"line",Re),c=n(e,r,"column",Re),l=n(e,r,"length",Re),b=n(e,r,"lineText",g),O=n(e,r,"suggestion",g);return Y(e,r,t),{file:o||"",namespace:d||"",line:s||0,column:c||0,length:l||0,lineText:b||"",suggestion:O||""}}function he(e,t,r,o){let d=[],s=0;for(let c of e){let l={},b=n(c,l,"id",g),O=n(c,l,"pluginName",g),N=n(c,l,"text",g),A=n(c,l,"location",_e),k=n(c,l,"notes",V),z=n(c,l,"detail",$e),le=`in element ${s} of "${t}"`;Y(c,l,le);let oe=[];if(k)for(let ie of k){let te={},ae=n(ie,te,"text",g),ue=n(ie,te,"location",_e);Y(ie,te,le),oe.push({text:ae||"",location:Je(ue,le)})}d.push({id:b||"",pluginName:O||o,text:N||"",location:Je(A,le),notes:oe,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(){let o=this.contents;return(r===null||o!==t)&&(t=o,r=ye(o)),r}}}var bt="0.15.0",wt=e=>Ce().build(e),vt=()=>{throw new Error('The "serve" API only works in node')},Rt=(e,t)=>Ce().transform(e,t),Ot=(e,t)=>Ce().formatMessages(e,t),xt=(e,t)=>Ce().analyzeMetafile(e,t),St=()=>{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')},Oe,Le,Ce=()=>{if(Le)return Le;throw Oe?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=He(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(Oe)throw new Error('Cannot call "initialize" more than once');return Oe=At(t||"",r,o),Oe.catch(()=>{Oe=void 0}),Oe},At=async(e,t,r)=>{let o;if(t)o=t;else{let l=await fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);o=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.15.0"],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=>{
|
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.
|
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.15.0"],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);})(b=>d.onmessage({data:b}));d={onmessage:null,postMessage:b=>setTimeout(()=>l({data:b})),terminate(){}}}d.postMessage(o),d.onmessage=({data:l})=>s(l);let{readFromStdout:s,service:c}=Ze({writeToStdin(l){d.postMessage(l)},isSync:!1,isWriteUnavailable:!0,esbuild:Pe});Le={build:l=>new Promise((b,O)=>c.buildOrServe({callName:"build",refs:null,serveOptions:null,options:l,isTTY:!1,defaultWD:"/",callback:(N,A)=>N?O(N):b(A)})),transform:(l,b)=>new Promise((O,N)=>c.transform({callName:"transform",refs:null,input:l,options:b||{},isTTY:!1,fs:{readFile(A,k){k(new Error("Internal error"),null)},writeFile(A,k){k(null)}},callback:(A,k)=>A?N(A):O(k)})),formatMessages:(l,b)=>new Promise((O,N)=>c.formatMessages({callName:"formatMessages",refs:null,messages:l,options:b,callback:(A,k)=>A?N(A):O(k)})),analyzeMetafile:(l,b)=>new Promise((O,N)=>c.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof l=="string"?l:JSON.stringify(l),options:b,callback:(A,k)=>A?N(A):O(k)}))}},Ct=Pe;export{xt as analyzeMetafile,$t as analyzeMetafileSync,wt as build,St as buildSync,Ct as default,Ot as formatMessages,kt as formatMessagesSync,Mt as initialize,vt as serve,Rt as transform,Et as transformSync,bt as version};
|
@@ -790,8 +790,8 @@ function createChannel(streamIn) {
|
|
790
790
|
if (isFirstPacket) {
|
791
791
|
isFirstPacket = false;
|
792
792
|
let binaryVersion = String.fromCharCode(...bytes);
|
793
|
-
if (binaryVersion !== "0.
|
794
|
-
throw new Error(`Cannot start service: Host version "${"0.
|
793
|
+
if (binaryVersion !== "0.15.0") {
|
794
|
+
throw new Error(`Cannot start service: Host version "${"0.15.0"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
795
795
|
}
|
796
796
|
return;
|
797
797
|
}
|
@@ -1748,7 +1748,7 @@ function convertOutputFiles({ path, contents }) {
|
|
1748
1748
|
}
|
1749
1749
|
|
1750
1750
|
// lib/npm/browser.ts
|
1751
|
-
var version = "0.
|
1751
|
+
var version = "0.15.0";
|
1752
1752
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1753
1753
|
var serve = () => {
|
1754
1754
|
throw new Error(`The "serve" API only works in node`);
|
@@ -1804,7 +1804,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
1804
1804
|
}
|
1805
1805
|
let worker;
|
1806
1806
|
if (useWorker) {
|
1807
|
-
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 var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\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 () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8) + 1\n ));\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 run(instance) {\n return __async(this, null, function* () {\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 yield this._exitPromise;\n });\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.53"}`];\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" });
|
1807
|
+
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 var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\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 () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8) + 1\n ));\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 run(instance) {\n return __async(this, null, function* () {\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 yield this._exitPromise;\n });\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.15.0"}`];\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" });
|
1808
1808
|
worker = new Worker(URL.createObjectURL(blob));
|
1809
1809
|
} else {
|
1810
1810
|
let onmessage = ((postMessage) => {
|
@@ -2408,7 +2408,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
|
|
2408
2408
|
callback(null, count);
|
2409
2409
|
};
|
2410
2410
|
let go = new globalThis.Go();
|
2411
|
-
go.argv = ["", `--service=${"0.
|
2411
|
+
go.argv = ["", `--service=${"0.15.0"}`];
|
2412
2412
|
if (wasm instanceof WebAssembly.Module) {
|
2413
2413
|
WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));
|
2414
2414
|
} else {
|
@@ -1,17 +1,17 @@
|
|
1
1
|
"use strict";(module=>{
|
2
|
-
var Ee=Object.defineProperty,it=Object.defineProperties,st=Object.getOwnPropertyDescriptor,ot=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fe=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&ze(e,r,t[r]);if(Ie)for(var r of Ie(t))ut.call(t,r)&&ze(e,r,t[r]);return e},Ne=(e,t)=>it(e,ot(t));var ft=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},ct=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of at(t))!Ke.call(e,u)&&u!==r&&Ee(e,u,{get:()=>t[u],enumerable:!(o=st(t,u))||o.enumerable});return e};var dt=e=>ct(Ee({},"__esModule",{value:!0}),e);var pe=(e,t,r)=>new Promise((o,u)=>{var i=g=>{try{l(r.next(g))}catch(R){u(R)}},c=g=>{try{l(r.throw(g))}catch(R){u(R)}},l=g=>g.done?o(g.value):Promise.resolve(g.value).then(i,c);l((r=r.apply(e,t)).next())});var De={};ft(De,{analyzeMetafile:()=>Mt,analyzeMetafileSync:()=>Tt,build:()=>St,buildSync:()=>At,default:()=>Ft,formatMessages:()=>$t,formatMessagesSync:()=>Pt,initialize:()=>Dt,serve:()=>Et,transform:()=>kt,transformSync:()=>Ct,version:()=>xt});module.exports=dt(De);function je(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(ne(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 u of o)t(u)}else{let u=Object.keys(o);r.write8(6),r.write32(u.length);for(let i of u)r.write(ne(i)),t(o[i])}},r=new ke;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Ue(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _e(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 c=r.read32(),l=[];for(let g=0;g<c;g++)l.push(t());return l}case 6:{let c=r.read32(),l={};for(let g=0;g<c;g++)l[he(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new ke(e),o=r.read32(),u=(o&1)===0;o>>>=1;let i=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:u,value:i}}var ke=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);Ue(this.buf,t,r)}write(t){let r=this._write(4+t.length);Ue(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 Le(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}},ne,he;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ne=r=>e.encode(r),he=r=>t.decode(r)}else if(typeof Buffer!="undefined")ne=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},he=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 Le(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Ue(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ve(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ae=()=>null,W=e=>typeof e=="boolean"?null:"a boolean",gt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",m=e=>typeof e=="string"?null:"a string",Ce=e=>e instanceof RegExp?null:"a RegExp object",Oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",We=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",se=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",mt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",yt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",He=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",ht=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",bt=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Ge=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,o){let u=e[r];if(t[r+""]=!0,u===void 0)return;let i=o(u);if(i!==null)throw new Error(`"${r}" must be ${i}`);return u}function J(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function Xe(e){let t=Object.create(null),r=n(e,t,"wasmURL",m),o=n(e,t,"wasmModule",mt),u=n(e,t,"worker",W);return J(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:u}}function Ze(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 Pe(e,t,r,o,u){let i=n(t,r,"color",W),c=n(t,r,"logLevel",m),l=n(t,r,"logLimit",Oe);i!==void 0?e.push(`--color=${i}`):o&&e.push("--color=true"),e.push(`--log-level=${c||u}`),e.push(`--log-limit=${l||0}`)}function et(e,t,r){let o=n(t,r,"legalComments",m),u=n(t,r,"sourceRoot",m),i=n(t,r,"sourcesContent",W),c=n(t,r,"target",bt),l=n(t,r,"format",m),g=n(t,r,"globalName",m),R=n(t,r,"mangleProps",Ce),N=n(t,r,"reserveProps",Ce),C=n(t,r,"mangleQuoted",W),$=n(t,r,"minify",W),I=n(t,r,"minifySyntax",W),le=n(t,r,"minifyWhitespace",W),oe=n(t,r,"minifyIdentifiers",W),ie=n(t,r,"drop",_),te=n(t,r,"charset",m),ae=n(t,r,"treeShaking",W),ue=n(t,r,"ignoreAnnotations",W),ce=n(t,r,"jsx",m),me=n(t,r,"jsxFactory",m),de=n(t,r,"jsxFragment",m),we=n(t,r,"jsxImportSource",m),Se=n(t,r,"jsxDev",W),ye=n(t,r,"define",se),p=n(t,r,"logOverride",se),f=n(t,r,"supported",se),a=n(t,r,"pure",_),d=n(t,r,"keepNames",W),P=n(t,r,"platform",m);if(o&&e.push(`--legal-comments=${o}`),u!==void 0&&e.push(`--source-root=${u}`),i!==void 0&&e.push(`--sources-content=${i}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),l&&e.push(`--format=${l}`),g&&e.push(`--global-name=${g}`),P&&e.push(`--platform=${P}`),$&&e.push("--minify"),I&&e.push("--minify-syntax"),le&&e.push("--minify-whitespace"),oe&&e.push("--minify-identifiers"),te&&e.push(`--charset=${te}`),ae!==void 0&&e.push(`--tree-shaking=${ae}`),ue&&e.push("--ignore-annotations"),ie)for(let v of ie)e.push(`--drop:${v}`);if(R&&e.push(`--mangle-props=${R.source}`),N&&e.push(`--reserve-props=${N.source}`),C!==void 0&&e.push(`--mangle-quoted=${C}`),ce&&e.push(`--jsx=${ce}`),me&&e.push(`--jsx-factory=${me}`),de&&e.push(`--jsx-fragment=${de}`),we&&e.push(`--jsx-import-source=${we}`),Se&&e.push("--jsx-dev"),ye)for(let v in ye){if(v.indexOf("=")>=0)throw new Error(`Invalid define: ${v}`);e.push(`--define:${v}=${ye[v]}`)}if(p)for(let v in p){if(v.indexOf("=")>=0)throw new Error(`Invalid log override: ${v}`);e.push(`--log-override:${v}=${p[v]}`)}if(f)for(let v in f){if(v.indexOf("=")>=0)throw new Error(`Invalid supported: ${v}`);e.push(`--supported:${v}=${f[v]}`)}if(a)for(let v of a)e.push(`--pure:${v}`);d&&e.push("--keep-names")}function wt(e,t,r,o,u){var w;let i=[],c=[],l=Object.create(null),g=null,R=null,N=null;Pe(i,t,l,r,o),et(i,t,l);let C=n(t,l,"sourcemap",He),$=n(t,l,"bundle",W),I=n(t,l,"watch",gt),le=n(t,l,"splitting",W),oe=n(t,l,"preserveSymlinks",W),ie=n(t,l,"metafile",W),te=n(t,l,"outfile",m),ae=n(t,l,"outdir",m),ue=n(t,l,"outbase",m),ce=n(t,l,"tsconfig",m),me=n(t,l,"resolveExtensions",_),de=n(t,l,"nodePaths",_),we=n(t,l,"mainFields",_),Se=n(t,l,"conditions",_),ye=n(t,l,"external",_),p=n(t,l,"loader",se),f=n(t,l,"outExtension",se),a=n(t,l,"publicPath",m),d=n(t,l,"entryNames",m),P=n(t,l,"chunkNames",m),v=n(t,l,"assetNames",m),M=n(t,l,"inject",_),x=n(t,l,"banner",se),T=n(t,l,"footer",se),E=n(t,l,"entryPoints",yt),O=n(t,l,"absWorkingDir",m),A=n(t,l,"stdin",se),D=(w=n(t,l,"write",W))!=null?w:u,B=n(t,l,"allowOverwrite",W),L=n(t,l,"incremental",W)===!0,ee=n(t,l,"mangleCache",se);if(l.plugins=!0,J(t,l,`in ${e}() call`),C&&i.push(`--sourcemap${C===!0?"":`=${C}`}`),$&&i.push("--bundle"),B&&i.push("--allow-overwrite"),I)if(i.push("--watch"),typeof I=="boolean")N={};else{let s=Object.create(null),h=n(I,s,"onRebuild",We);J(I,s,`on "watch" in ${e}() call`),N={onRebuild:h}}if(le&&i.push("--splitting"),oe&&i.push("--preserve-symlinks"),ie&&i.push("--metafile"),te&&i.push(`--outfile=${te}`),ae&&i.push(`--outdir=${ae}`),ue&&i.push(`--outbase=${ue}`),ce&&i.push(`--tsconfig=${ce}`),me){let s=[];for(let h of me){if(h+="",h.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${h}`);s.push(h)}i.push(`--resolve-extensions=${s.join(",")}`)}if(a&&i.push(`--public-path=${a}`),d&&i.push(`--entry-names=${d}`),P&&i.push(`--chunk-names=${P}`),v&&i.push(`--asset-names=${v}`),we){let s=[];for(let h of we){if(h+="",h.indexOf(",")>=0)throw new Error(`Invalid main field: ${h}`);s.push(h)}i.push(`--main-fields=${s.join(",")}`)}if(Se){let s=[];for(let h of Se){if(h+="",h.indexOf(",")>=0)throw new Error(`Invalid condition: ${h}`);s.push(h)}i.push(`--conditions=${s.join(",")}`)}if(ye)for(let s of ye)i.push(`--external:${s}`);if(x)for(let s in x){if(s.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${s}`);i.push(`--banner:${s}=${x[s]}`)}if(T)for(let s in T){if(s.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${s}`);i.push(`--footer:${s}=${T[s]}`)}if(M)for(let s of M)i.push(`--inject:${s}`);if(p)for(let s in p){if(s.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${s}`);i.push(`--loader:${s}=${p[s]}`)}if(f)for(let s in f){if(s.indexOf("=")>=0)throw new Error(`Invalid out extension: ${s}`);i.push(`--out-extension:${s}=${f[s]}`)}if(E)if(Array.isArray(E))for(let s of E)c.push(["",s+""]);else for(let[s,h]of Object.entries(E))c.push([s+"",h+""]);if(A){let s=Object.create(null),h=n(A,s,"contents",Ge),j=n(A,s,"resolveDir",m),Y=n(A,s,"sourcefile",m),b=n(A,s,"loader",m);J(A,s,'in "stdin" object'),Y&&i.push(`--sourcefile=${Y}`),b&&i.push(`--loader=${b}`),j&&(R=j+""),typeof h=="string"?g=ne(h):h instanceof Uint8Array&&(g=h)}let S=[];if(de)for(let s of de)s+="",S.push(s);return{entries:c,flags:i,write:D,stdinContents:g,stdinResolveDir:R,absWorkingDir:O,incremental:L,nodePaths:S,watch:N,mangleCache:Ze(ee)}}function vt(e,t,r,o){let u=[],i=Object.create(null);Pe(u,t,i,r,o),et(u,t,i);let c=n(t,i,"sourcemap",He),l=n(t,i,"tsconfigRaw",ht),g=n(t,i,"sourcefile",m),R=n(t,i,"loader",m),N=n(t,i,"banner",m),C=n(t,i,"footer",m),$=n(t,i,"mangleCache",se);return J(t,i,`in ${e}() call`),c&&u.push(`--sourcemap=${c===!0?"external":c}`),l&&u.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),g&&u.push(`--sourcefile=${g}`),R&&u.push(`--loader=${R}`),N&&u.push(`--banner=${N}`),C&&u.push(`--footer=${C}`),{flags:u,mangleCache:Ze($)}}function tt(e){let t=new Map,r=new Map,o=new Map,u=new Map,i=null,c=0,l=0,g=new Uint8Array(16*1024),R=0,N=p=>{let f=R+p.length;if(f>g.length){let d=new Uint8Array(f*2);d.set(g),g=d}g.set(p,R),R+=p.length;let a=0;for(;a+4<=R;){let d=Le(g,a);if(a+4+d>R)break;a+=4,ie(g.subarray(a,a+d)),a+=d}a>0&&(g.copyWithin(0,a,R),R-=a)},C=p=>{i={reason:p?": "+(p.message||p):""};let f="The service was stopped"+i.reason;for(let a of t.values())a(f,null);t.clear();for(let a of u.values())a.onWait(f);u.clear();for(let a of o.values())try{a(new Error(f),null)}catch(d){console.error(d)}o.clear()},$=(p,f,a)=>{if(i)return a("The service is no longer running"+i.reason,null);let d=c++;t.set(d,(P,v)=>{try{a(P,v)}finally{p&&p.unref()}}),p&&p.ref(),e.writeToStdin(je({id:d,isRequest:!0,value:f}))},I=(p,f)=>{if(i)throw new Error("The service is no longer running"+i.reason);e.writeToStdin(je({id:p,isRequest:!1,value:f}))},le=(p,f)=>pe(this,null,function*(){try{switch(f.command){case"ping":{I(p,{});break}case"on-start":{let a=r.get(f.key);a?I(p,yield a(f)):I(p,{});break}case"on-resolve":{let a=r.get(f.key);a?I(p,yield a(f)):I(p,{});break}case"on-load":{let a=r.get(f.key);a?I(p,yield a(f)):I(p,{});break}case"serve-request":{let a=u.get(f.key);a&&a.onRequest&&a.onRequest(f.args),I(p,{});break}case"serve-wait":{let a=u.get(f.key);a&&a.onWait(f.error),I(p,{});break}case"watch-rebuild":{let a=o.get(f.key);try{a&&a(null,f.args)}catch(d){console.error(d)}I(p,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(a){I(p,{errors:[ve(a,e,null,void 0,"")]})}}),oe=!0,ie=p=>{if(oe){oe=!1;let a=String.fromCharCode(...p);if(a!=="0.14.53")throw new Error(`Cannot start service: Host version "0.14.53" does not match binary version ${JSON.stringify(a)}`);return}let f=_e(p);if(f.isRequest)le(f.id,f.value);else{let a=t.get(f.id);t.delete(f.id),f.value.error?a(f.value.error,{}):a(null,f.value)}},te=(p,f,a,d,P)=>pe(this,null,function*(){let v=[],M=[],x={},T={},E=0,O=0,A=[],D=!1;f=[...f];for(let S of f){let w={};if(typeof S!="object")throw new Error(`Plugin at index ${O} must be an object`);let s=n(S,w,"name",m);if(typeof s!="string"||s==="")throw new Error(`Plugin at index ${O} is missing a name`);try{let h=n(S,w,"setup",We);if(typeof h!="function")throw new Error("Plugin is missing a setup function");J(S,w,`on plugin ${JSON.stringify(s)}`);let j={name:s,onResolve:[],onLoad:[]};O++;let b=h({initialOptions:p,resolve:(y,F={})=>{if(!D)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof y!="string")throw new Error("The path to resolve must be a string");let k=Object.create(null),Q=n(F,k,"pluginName",m),q=n(F,k,"importer",m),K=n(F,k,"namespace",m),X=n(F,k,"resolveDir",m),H=n(F,k,"kind",m),U=n(F,k,"pluginData",Ae);return J(F,k,"in resolve() call"),new Promise((V,G)=>{let z={command:"resolve",path:y,key:a,pluginName:s};Q!=null&&(z.pluginName=Q),q!=null&&(z.importer=q),K!=null&&(z.namespace=K),X!=null&&(z.resolveDir=X),H!=null&&(z.kind=H),U!=null&&(z.pluginData=d.store(U)),$(P,z,(fe,Z)=>{fe!==null?G(new Error(fe)):V({errors:ge(Z.errors,d),warnings:ge(Z.warnings,d),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:d.load(Z.pluginData)})})})},onStart(y){let F='This error came from the "onStart" callback registered here:',k=$e(new Error(F),e,"onStart");v.push({name:s,callback:y,note:k})},onEnd(y){let F='This error came from the "onEnd" callback registered here:',k=$e(new Error(F),e,"onEnd");M.push({name:s,callback:y,note:k})},onResolve(y,F){let k='This error came from the "onResolve" callback registered here:',Q=$e(new Error(k),e,"onResolve"),q={},K=n(y,q,"filter",Ce),X=n(y,q,"namespace",m);if(J(y,q,`in onResolve() call for plugin ${JSON.stringify(s)}`),K==null)throw new Error("onResolve() call is missing a filter");let H=E++;x[H]={name:s,callback:F,note:Q},j.onResolve.push({id:H,filter:K.source,namespace:X||""})},onLoad(y,F){let k='This error came from the "onLoad" callback registered here:',Q=$e(new Error(k),e,"onLoad"),q={},K=n(y,q,"filter",Ce),X=n(y,q,"namespace",m);if(J(y,q,`in onLoad() call for plugin ${JSON.stringify(s)}`),K==null)throw new Error("onLoad() call is missing a filter");let H=E++;T[H]={name:s,callback:F,note:Q},j.onLoad.push({id:H,filter:K.source,namespace:X||""})},esbuild:e.esbuild});b&&(yield b),A.push(j)}catch(h){return{ok:!1,error:h,pluginName:s}}}let B=S=>pe(this,null,function*(){switch(S.command){case"on-start":{let w={errors:[],warnings:[]};return yield Promise.all(v.map(Y=>pe(this,[Y],function*({name:s,callback:h,note:j}){try{let b=yield h();if(b!=null){if(typeof b!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(s)} to return an object`);let y={},F=n(b,y,"errors",_),k=n(b,y,"warnings",_);J(b,y,`from onStart() callback in plugin ${JSON.stringify(s)}`),F!=null&&w.errors.push(...be(F,"errors",d,s)),k!=null&&w.warnings.push(...be(k,"warnings",d,s))}}catch(b){w.errors.push(ve(b,e,d,j&&j(),s))}}))),w}case"on-resolve":{let w={},s="",h,j;for(let Y of S.ids)try{({name:s,callback:h,note:j}=x[Y]);let b=yield h({path:S.path,importer:S.importer,namespace:S.namespace,resolveDir:S.resolveDir,kind:S.kind,pluginData:d.load(S.pluginData)});if(b!=null){if(typeof b!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(s)} to return an object`);let y={},F=n(b,y,"pluginName",m),k=n(b,y,"path",m),Q=n(b,y,"namespace",m),q=n(b,y,"suffix",m),K=n(b,y,"external",W),X=n(b,y,"sideEffects",W),H=n(b,y,"pluginData",Ae),U=n(b,y,"errors",_),V=n(b,y,"warnings",_),G=n(b,y,"watchFiles",_),z=n(b,y,"watchDirs",_);J(b,y,`from onResolve() callback in plugin ${JSON.stringify(s)}`),w.id=Y,F!=null&&(w.pluginName=F),k!=null&&(w.path=k),Q!=null&&(w.namespace=Q),q!=null&&(w.suffix=q),K!=null&&(w.external=K),X!=null&&(w.sideEffects=X),H!=null&&(w.pluginData=d.store(H)),U!=null&&(w.errors=be(U,"errors",d,s)),V!=null&&(w.warnings=be(V,"warnings",d,s)),G!=null&&(w.watchFiles=Me(G,"watchFiles")),z!=null&&(w.watchDirs=Me(z,"watchDirs"));break}}catch(b){return{id:Y,errors:[ve(b,e,d,j&&j(),s)]}}return w}case"on-load":{let w={},s="",h,j;for(let Y of S.ids)try{({name:s,callback:h,note:j}=T[Y]);let b=yield h({path:S.path,namespace:S.namespace,suffix:S.suffix,pluginData:d.load(S.pluginData)});if(b!=null){if(typeof b!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(s)} to return an object`);let y={},F=n(b,y,"pluginName",m),k=n(b,y,"contents",Ge),Q=n(b,y,"resolveDir",m),q=n(b,y,"pluginData",Ae),K=n(b,y,"loader",m),X=n(b,y,"errors",_),H=n(b,y,"warnings",_),U=n(b,y,"watchFiles",_),V=n(b,y,"watchDirs",_);J(b,y,`from onLoad() callback in plugin ${JSON.stringify(s)}`),w.id=Y,F!=null&&(w.pluginName=F),k instanceof Uint8Array?w.contents=k:k!=null&&(w.contents=ne(k)),Q!=null&&(w.resolveDir=Q),q!=null&&(w.pluginData=d.store(q)),K!=null&&(w.loader=K),X!=null&&(w.errors=be(X,"errors",d,s)),H!=null&&(w.warnings=be(H,"warnings",d,s)),U!=null&&(w.watchFiles=Me(U,"watchFiles")),V!=null&&(w.watchDirs=Me(V,"watchDirs"));break}}catch(b){return{id:Y,errors:[ve(b,e,d,j&&j(),s)]}}return w}default:throw new Error("Invalid command: "+S.command)}}),L=(S,w,s)=>s();M.length>0&&(L=(S,w,s)=>{(()=>pe(this,null,function*(){for(let{name:h,callback:j,note:Y}of M)try{yield j(S)}catch(b){S.errors.push(yield new Promise(y=>w(b,h,Y&&Y(),y)))}}))().then(s)}),D=!0;let ee=0;return{ok:!0,requestPlugins:A,runOnEndCallbacks:L,pluginRefs:{ref(){++ee===1&&r.set(a,B)},unref(){--ee===0&&r.delete(a)}}}}),ae=(p,f,a,d)=>{let P={},v=n(f,P,"port",Oe),M=n(f,P,"host",m),x=n(f,P,"servedir",m),T=n(f,P,"onRequest",We),E,O=new Promise((A,D)=>{E=B=>{u.delete(d),B!==null?D(new Error(B)):A()}});return a.serve={},J(f,P,"in serve() call"),v!==void 0&&(a.serve.port=v),M!==void 0&&(a.serve.host=M),x!==void 0&&(a.serve.servedir=x),u.set(d,{onRequest:T,onWait:E}),{wait:O,stop(){$(p,{command:"serve-stop",key:d},()=>{})}}},ue="warning",ce="silent",me=p=>{let f=l++,a=Ye(),d,{refs:P,options:v,isTTY:M,callback:x}=p;if(typeof v=="object"){let O=v.plugins;if(O!==void 0){if(!Array.isArray(O))throw new Error('"plugins" must be an array');d=O}}let T=(O,A,D,B)=>{let L=[];try{Pe(L,v,{},M,ue)}catch(S){}let ee=ve(O,e,a,D,A);$(P,{command:"error",flags:L,error:ee},()=>{ee.detail=a.load(ee.detail),B(ee)})},E=(O,A)=>{T(O,A,void 0,D=>{x(Re("Build failed",[D],[]),null)})};if(d&&d.length>0){if(e.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");te(v,d,f,a,P).then(O=>{if(!O.ok)E(O.error,O.pluginName);else try{de(Ne(Fe({},p),{key:f,details:a,logPluginError:T,requestPlugins:O.requestPlugins,runOnEndCallbacks:O.runOnEndCallbacks,pluginRefs:O.pluginRefs}))}catch(A){E(A,"")}},O=>E(O,""))}else try{de(Ne(Fe({},p),{key:f,details:a,logPluginError:T,requestPlugins:null,runOnEndCallbacks:(O,A,D)=>D(),pluginRefs:null}))}catch(O){E(O,"")}},de=({callName:p,refs:f,serveOptions:a,options:d,isTTY:P,defaultWD:v,callback:M,key:x,details:T,logPluginError:E,requestPlugins:O,runOnEndCallbacks:A,pluginRefs:D})=>{let B={ref(){D&&D.ref(),f&&f.ref()},unref(){D&&D.unref(),f&&f.unref()}},L=!e.isWriteUnavailable,{entries:ee,flags:S,write:w,stdinContents:s,stdinResolveDir:h,absWorkingDir:j,incremental:Y,nodePaths:b,watch:y,mangleCache:F}=wt(p,d,P,ue,L),k={command:"build",key:x,entries:ee,flags:S,write:w,stdinContents:s,stdinResolveDir:h,absWorkingDir:j||v,incremental:Y,nodePaths:b};O&&(k.plugins=O),F&&(k.mangleCache=F);let Q=a&&ae(B,a,k,x),q,K,X=(U,V)=>{U.outputFiles&&(V.outputFiles=U.outputFiles.map(Rt)),U.metafile&&(V.metafile=JSON.parse(U.metafile)),U.mangleCache&&(V.mangleCache=U.mangleCache),U.writeToStdout!==void 0&&console.log(he(U.writeToStdout).replace(/\n$/,""))},H=(U,V)=>{let G={errors:ge(U.errors,T),warnings:ge(U.warnings,T)};X(U,G),A(G,E,()=>{if(G.errors.length>0)return V(Re("Build failed",G.errors,G.warnings),null);if(U.rebuild){if(!q){let z=!1;q=()=>new Promise((fe,Z)=>{if(z||i)throw new Error("Cannot rebuild");$(B,{command:"rebuild",key:x},(re,nt)=>{if(re)return V(Re("Build failed",[{id:"",pluginName:"",text:re,location:null,notes:[],detail:void 0}],[]),null);H(nt,(Be,lt)=>{Be?Z(Be):fe(lt)})})}),B.ref(),q.dispose=()=>{z||(z=!0,$(B,{command:"rebuild-dispose",key:x},()=>{}),B.unref())}}G.rebuild=q}if(U.watch){if(!K){let z=!1;B.ref(),K=()=>{z||(z=!0,o.delete(x),$(B,{command:"watch-stop",key:x},()=>{}),B.unref())},y&&o.set(x,(fe,Z)=>{if(fe){y.onRebuild&&y.onRebuild(fe,null);return}let re={errors:ge(Z.errors,T),warnings:ge(Z.warnings,T)};X(Z,re),A(re,E,()=>{if(re.errors.length>0){y.onRebuild&&y.onRebuild(Re("Build failed",re.errors,re.warnings),null);return}Z.rebuildID!==void 0&&(re.rebuild=q),re.stop=K,y.onRebuild&&y.onRebuild(null,re)})})}G.stop=K}V(null,G)})};if(w&&e.isWriteUnavailable)throw new Error('The "write" option is unavailable in this environment');if(Y&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(y&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');$(B,k,(U,V)=>{if(U)return M(new Error(U),null);if(Q){let G=V,z=!1;B.ref();let fe={port:G.port,host:G.host,wait:Q.wait,stop(){z||(z=!0,Q.stop(),B.unref())}};return B.ref(),Q.wait.then(B.unref,B.unref),M(null,fe)}return H(V,M)})};return{readFromStdout:N,afterClose:C,service:{buildOrServe:me,transform:({callName:p,refs:f,input:a,options:d,isTTY:P,fs:v,callback:M})=>{let x=Ye(),T=E=>{try{if(typeof a!="string"&&!(a instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:O,mangleCache:A}=vt(p,d,P,ce),D={command:"transform",flags:O,inputFS:E!==null,input:E!==null?ne(E):typeof a=="string"?ne(a):a};A&&(D.mangleCache=A),$(f,D,(B,L)=>{if(B)return M(new Error(B),null);let ee=ge(L.errors,x),S=ge(L.warnings,x),w=1,s=()=>{if(--w===0){let h={warnings:S,code:L.code,map:L.map};L.mangleCache&&(h.mangleCache=L==null?void 0:L.mangleCache),M(null,h)}};if(ee.length>0)return M(Re("Transform failed",ee,S),null);L.codeFS&&(w++,v.readFile(L.code,(h,j)=>{h!==null?M(h,null):(L.code=j,s())})),L.mapFS&&(w++,v.readFile(L.map,(h,j)=>{h!==null?M(h,null):(L.map=j,s())})),s()})}catch(O){let A=[];try{Pe(A,d,{},P,ce)}catch(B){}let D=ve(O,e,x,void 0,"");$(f,{command:"error",flags:A,error:D},()=>{D.detail=x.load(D.detail),M(Re("Transform failed",[D],[]),null)})}};if((typeof a=="string"||a instanceof Uint8Array)&&a.length>1024*1024){let E=T;T=()=>v.writeFile(a,E)}T(null)},formatMessages:({callName:p,refs:f,messages:a,options:d,callback:P})=>{let v=be(a,"messages",null,"");if(!d)throw new Error(`Missing second argument in ${p}() call`);let M={},x=n(d,M,"kind",m),T=n(d,M,"color",W),E=n(d,M,"terminalWidth",Oe);if(J(d,M,`in ${p}() call`),x===void 0)throw new Error(`Missing "kind" in ${p}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${p}() call`);let O={command:"format-msgs",messages:v,isWarning:x==="warning"};T!==void 0&&(O.color=T),E!==void 0&&(O.terminalWidth=E),$(f,O,(A,D)=>{if(A)return P(new Error(A),null);P(null,D.messages)})},analyzeMetafile:({callName:p,refs:f,metafile:a,options:d,callback:P})=>{d===void 0&&(d={});let v={},M=n(d,v,"color",W),x=n(d,v,"verbose",W);J(d,v,`in ${p}() call`);let T={command:"analyze-metafile",metafile:a};M!==void 0&&(T.color=M),x!==void 0&&(T.verbose=x),$(f,T,(E,O)=>{if(E)return P(new Error(E),null);P(null,O.result)})}}}}function Ye(){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 $e(e,t,r){let o,u=!1;return()=>{if(u)return o;u=!0;try{let i=(e.stack+"").split(`
|
2
|
+
var Ee=Object.defineProperty,it=Object.defineProperties,st=Object.getOwnPropertyDescriptor,ot=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fe=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&ze(e,r,t[r]);if(Ie)for(var r of Ie(t))ut.call(t,r)&&ze(e,r,t[r]);return e},Ne=(e,t)=>it(e,ot(t));var ft=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},ct=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of at(t))!Ke.call(e,u)&&u!==r&&Ee(e,u,{get:()=>t[u],enumerable:!(o=st(t,u))||o.enumerable});return e};var dt=e=>ct(Ee({},"__esModule",{value:!0}),e);var pe=(e,t,r)=>new Promise((o,u)=>{var i=g=>{try{l(r.next(g))}catch(R){u(R)}},c=g=>{try{l(r.throw(g))}catch(R){u(R)}},l=g=>g.done?o(g.value):Promise.resolve(g.value).then(i,c);l((r=r.apply(e,t)).next())});var De={};ft(De,{analyzeMetafile:()=>Mt,analyzeMetafileSync:()=>Tt,build:()=>St,buildSync:()=>At,default:()=>Ft,formatMessages:()=>$t,formatMessagesSync:()=>Pt,initialize:()=>Dt,serve:()=>Et,transform:()=>kt,transformSync:()=>Ct,version:()=>xt});module.exports=dt(De);function je(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(ne(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 u of o)t(u)}else{let u=Object.keys(o);r.write8(6),r.write32(u.length);for(let i of u)r.write(ne(i)),t(o[i])}},r=new ke;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Ue(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _e(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 c=r.read32(),l=[];for(let g=0;g<c;g++)l.push(t());return l}case 6:{let c=r.read32(),l={};for(let g=0;g<c;g++)l[he(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new ke(e),o=r.read32(),u=(o&1)===0;o>>>=1;let i=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:u,value:i}}var ke=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);Ue(this.buf,t,r)}write(t){let r=this._write(4+t.length);Ue(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 Le(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}},ne,he;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ne=r=>e.encode(r),he=r=>t.decode(r)}else if(typeof Buffer!="undefined")ne=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},he=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 Le(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Ue(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ve(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ae=()=>null,W=e=>typeof e=="boolean"?null:"a boolean",gt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",m=e=>typeof e=="string"?null:"a string",Ce=e=>e instanceof RegExp?null:"a RegExp object",Oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",We=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",se=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",mt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",yt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",He=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",ht=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",bt=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Ge=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,o){let u=e[r];if(t[r+""]=!0,u===void 0)return;let i=o(u);if(i!==null)throw new Error(`"${r}" must be ${i}`);return u}function J(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function Xe(e){let t=Object.create(null),r=n(e,t,"wasmURL",m),o=n(e,t,"wasmModule",mt),u=n(e,t,"worker",W);return J(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:u}}function Ze(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 Pe(e,t,r,o,u){let i=n(t,r,"color",W),c=n(t,r,"logLevel",m),l=n(t,r,"logLimit",Oe);i!==void 0?e.push(`--color=${i}`):o&&e.push("--color=true"),e.push(`--log-level=${c||u}`),e.push(`--log-limit=${l||0}`)}function et(e,t,r){let o=n(t,r,"legalComments",m),u=n(t,r,"sourceRoot",m),i=n(t,r,"sourcesContent",W),c=n(t,r,"target",bt),l=n(t,r,"format",m),g=n(t,r,"globalName",m),R=n(t,r,"mangleProps",Ce),N=n(t,r,"reserveProps",Ce),C=n(t,r,"mangleQuoted",W),$=n(t,r,"minify",W),I=n(t,r,"minifySyntax",W),le=n(t,r,"minifyWhitespace",W),oe=n(t,r,"minifyIdentifiers",W),ie=n(t,r,"drop",_),te=n(t,r,"charset",m),ae=n(t,r,"treeShaking",W),ue=n(t,r,"ignoreAnnotations",W),ce=n(t,r,"jsx",m),me=n(t,r,"jsxFactory",m),de=n(t,r,"jsxFragment",m),we=n(t,r,"jsxImportSource",m),Se=n(t,r,"jsxDev",W),ye=n(t,r,"define",se),p=n(t,r,"logOverride",se),f=n(t,r,"supported",se),a=n(t,r,"pure",_),d=n(t,r,"keepNames",W),P=n(t,r,"platform",m);if(o&&e.push(`--legal-comments=${o}`),u!==void 0&&e.push(`--source-root=${u}`),i!==void 0&&e.push(`--sources-content=${i}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),l&&e.push(`--format=${l}`),g&&e.push(`--global-name=${g}`),P&&e.push(`--platform=${P}`),$&&e.push("--minify"),I&&e.push("--minify-syntax"),le&&e.push("--minify-whitespace"),oe&&e.push("--minify-identifiers"),te&&e.push(`--charset=${te}`),ae!==void 0&&e.push(`--tree-shaking=${ae}`),ue&&e.push("--ignore-annotations"),ie)for(let v of ie)e.push(`--drop:${v}`);if(R&&e.push(`--mangle-props=${R.source}`),N&&e.push(`--reserve-props=${N.source}`),C!==void 0&&e.push(`--mangle-quoted=${C}`),ce&&e.push(`--jsx=${ce}`),me&&e.push(`--jsx-factory=${me}`),de&&e.push(`--jsx-fragment=${de}`),we&&e.push(`--jsx-import-source=${we}`),Se&&e.push("--jsx-dev"),ye)for(let v in ye){if(v.indexOf("=")>=0)throw new Error(`Invalid define: ${v}`);e.push(`--define:${v}=${ye[v]}`)}if(p)for(let v in p){if(v.indexOf("=")>=0)throw new Error(`Invalid log override: ${v}`);e.push(`--log-override:${v}=${p[v]}`)}if(f)for(let v in f){if(v.indexOf("=")>=0)throw new Error(`Invalid supported: ${v}`);e.push(`--supported:${v}=${f[v]}`)}if(a)for(let v of a)e.push(`--pure:${v}`);d&&e.push("--keep-names")}function wt(e,t,r,o,u){var w;let i=[],c=[],l=Object.create(null),g=null,R=null,N=null;Pe(i,t,l,r,o),et(i,t,l);let C=n(t,l,"sourcemap",He),$=n(t,l,"bundle",W),I=n(t,l,"watch",gt),le=n(t,l,"splitting",W),oe=n(t,l,"preserveSymlinks",W),ie=n(t,l,"metafile",W),te=n(t,l,"outfile",m),ae=n(t,l,"outdir",m),ue=n(t,l,"outbase",m),ce=n(t,l,"tsconfig",m),me=n(t,l,"resolveExtensions",_),de=n(t,l,"nodePaths",_),we=n(t,l,"mainFields",_),Se=n(t,l,"conditions",_),ye=n(t,l,"external",_),p=n(t,l,"loader",se),f=n(t,l,"outExtension",se),a=n(t,l,"publicPath",m),d=n(t,l,"entryNames",m),P=n(t,l,"chunkNames",m),v=n(t,l,"assetNames",m),M=n(t,l,"inject",_),x=n(t,l,"banner",se),T=n(t,l,"footer",se),E=n(t,l,"entryPoints",yt),O=n(t,l,"absWorkingDir",m),A=n(t,l,"stdin",se),D=(w=n(t,l,"write",W))!=null?w:u,B=n(t,l,"allowOverwrite",W),L=n(t,l,"incremental",W)===!0,ee=n(t,l,"mangleCache",se);if(l.plugins=!0,J(t,l,`in ${e}() call`),C&&i.push(`--sourcemap${C===!0?"":`=${C}`}`),$&&i.push("--bundle"),B&&i.push("--allow-overwrite"),I)if(i.push("--watch"),typeof I=="boolean")N={};else{let s=Object.create(null),h=n(I,s,"onRebuild",We);J(I,s,`on "watch" in ${e}() call`),N={onRebuild:h}}if(le&&i.push("--splitting"),oe&&i.push("--preserve-symlinks"),ie&&i.push("--metafile"),te&&i.push(`--outfile=${te}`),ae&&i.push(`--outdir=${ae}`),ue&&i.push(`--outbase=${ue}`),ce&&i.push(`--tsconfig=${ce}`),me){let s=[];for(let h of me){if(h+="",h.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${h}`);s.push(h)}i.push(`--resolve-extensions=${s.join(",")}`)}if(a&&i.push(`--public-path=${a}`),d&&i.push(`--entry-names=${d}`),P&&i.push(`--chunk-names=${P}`),v&&i.push(`--asset-names=${v}`),we){let s=[];for(let h of we){if(h+="",h.indexOf(",")>=0)throw new Error(`Invalid main field: ${h}`);s.push(h)}i.push(`--main-fields=${s.join(",")}`)}if(Se){let s=[];for(let h of Se){if(h+="",h.indexOf(",")>=0)throw new Error(`Invalid condition: ${h}`);s.push(h)}i.push(`--conditions=${s.join(",")}`)}if(ye)for(let s of ye)i.push(`--external:${s}`);if(x)for(let s in x){if(s.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${s}`);i.push(`--banner:${s}=${x[s]}`)}if(T)for(let s in T){if(s.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${s}`);i.push(`--footer:${s}=${T[s]}`)}if(M)for(let s of M)i.push(`--inject:${s}`);if(p)for(let s in p){if(s.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${s}`);i.push(`--loader:${s}=${p[s]}`)}if(f)for(let s in f){if(s.indexOf("=")>=0)throw new Error(`Invalid out extension: ${s}`);i.push(`--out-extension:${s}=${f[s]}`)}if(E)if(Array.isArray(E))for(let s of E)c.push(["",s+""]);else for(let[s,h]of Object.entries(E))c.push([s+"",h+""]);if(A){let s=Object.create(null),h=n(A,s,"contents",Ge),j=n(A,s,"resolveDir",m),Y=n(A,s,"sourcefile",m),b=n(A,s,"loader",m);J(A,s,'in "stdin" object'),Y&&i.push(`--sourcefile=${Y}`),b&&i.push(`--loader=${b}`),j&&(R=j+""),typeof h=="string"?g=ne(h):h instanceof Uint8Array&&(g=h)}let S=[];if(de)for(let s of de)s+="",S.push(s);return{entries:c,flags:i,write:D,stdinContents:g,stdinResolveDir:R,absWorkingDir:O,incremental:L,nodePaths:S,watch:N,mangleCache:Ze(ee)}}function vt(e,t,r,o){let u=[],i=Object.create(null);Pe(u,t,i,r,o),et(u,t,i);let c=n(t,i,"sourcemap",He),l=n(t,i,"tsconfigRaw",ht),g=n(t,i,"sourcefile",m),R=n(t,i,"loader",m),N=n(t,i,"banner",m),C=n(t,i,"footer",m),$=n(t,i,"mangleCache",se);return J(t,i,`in ${e}() call`),c&&u.push(`--sourcemap=${c===!0?"external":c}`),l&&u.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),g&&u.push(`--sourcefile=${g}`),R&&u.push(`--loader=${R}`),N&&u.push(`--banner=${N}`),C&&u.push(`--footer=${C}`),{flags:u,mangleCache:Ze($)}}function tt(e){let t=new Map,r=new Map,o=new Map,u=new Map,i=null,c=0,l=0,g=new Uint8Array(16*1024),R=0,N=p=>{let f=R+p.length;if(f>g.length){let d=new Uint8Array(f*2);d.set(g),g=d}g.set(p,R),R+=p.length;let a=0;for(;a+4<=R;){let d=Le(g,a);if(a+4+d>R)break;a+=4,ie(g.subarray(a,a+d)),a+=d}a>0&&(g.copyWithin(0,a,R),R-=a)},C=p=>{i={reason:p?": "+(p.message||p):""};let f="The service was stopped"+i.reason;for(let a of t.values())a(f,null);t.clear();for(let a of u.values())a.onWait(f);u.clear();for(let a of o.values())try{a(new Error(f),null)}catch(d){console.error(d)}o.clear()},$=(p,f,a)=>{if(i)return a("The service is no longer running"+i.reason,null);let d=c++;t.set(d,(P,v)=>{try{a(P,v)}finally{p&&p.unref()}}),p&&p.ref(),e.writeToStdin(je({id:d,isRequest:!0,value:f}))},I=(p,f)=>{if(i)throw new Error("The service is no longer running"+i.reason);e.writeToStdin(je({id:p,isRequest:!1,value:f}))},le=(p,f)=>pe(this,null,function*(){try{switch(f.command){case"ping":{I(p,{});break}case"on-start":{let a=r.get(f.key);a?I(p,yield a(f)):I(p,{});break}case"on-resolve":{let a=r.get(f.key);a?I(p,yield a(f)):I(p,{});break}case"on-load":{let a=r.get(f.key);a?I(p,yield a(f)):I(p,{});break}case"serve-request":{let a=u.get(f.key);a&&a.onRequest&&a.onRequest(f.args),I(p,{});break}case"serve-wait":{let a=u.get(f.key);a&&a.onWait(f.error),I(p,{});break}case"watch-rebuild":{let a=o.get(f.key);try{a&&a(null,f.args)}catch(d){console.error(d)}I(p,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(a){I(p,{errors:[ve(a,e,null,void 0,"")]})}}),oe=!0,ie=p=>{if(oe){oe=!1;let a=String.fromCharCode(...p);if(a!=="0.15.0")throw new Error(`Cannot start service: Host version "0.15.0" does not match binary version ${JSON.stringify(a)}`);return}let f=_e(p);if(f.isRequest)le(f.id,f.value);else{let a=t.get(f.id);t.delete(f.id),f.value.error?a(f.value.error,{}):a(null,f.value)}},te=(p,f,a,d,P)=>pe(this,null,function*(){let v=[],M=[],x={},T={},E=0,O=0,A=[],D=!1;f=[...f];for(let S of f){let w={};if(typeof S!="object")throw new Error(`Plugin at index ${O} must be an object`);let s=n(S,w,"name",m);if(typeof s!="string"||s==="")throw new Error(`Plugin at index ${O} is missing a name`);try{let h=n(S,w,"setup",We);if(typeof h!="function")throw new Error("Plugin is missing a setup function");J(S,w,`on plugin ${JSON.stringify(s)}`);let j={name:s,onResolve:[],onLoad:[]};O++;let b=h({initialOptions:p,resolve:(y,F={})=>{if(!D)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof y!="string")throw new Error("The path to resolve must be a string");let k=Object.create(null),Q=n(F,k,"pluginName",m),q=n(F,k,"importer",m),K=n(F,k,"namespace",m),X=n(F,k,"resolveDir",m),H=n(F,k,"kind",m),U=n(F,k,"pluginData",Ae);return J(F,k,"in resolve() call"),new Promise((V,G)=>{let z={command:"resolve",path:y,key:a,pluginName:s};Q!=null&&(z.pluginName=Q),q!=null&&(z.importer=q),K!=null&&(z.namespace=K),X!=null&&(z.resolveDir=X),H!=null&&(z.kind=H),U!=null&&(z.pluginData=d.store(U)),$(P,z,(fe,Z)=>{fe!==null?G(new Error(fe)):V({errors:ge(Z.errors,d),warnings:ge(Z.warnings,d),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:d.load(Z.pluginData)})})})},onStart(y){let F='This error came from the "onStart" callback registered here:',k=$e(new Error(F),e,"onStart");v.push({name:s,callback:y,note:k})},onEnd(y){let F='This error came from the "onEnd" callback registered here:',k=$e(new Error(F),e,"onEnd");M.push({name:s,callback:y,note:k})},onResolve(y,F){let k='This error came from the "onResolve" callback registered here:',Q=$e(new Error(k),e,"onResolve"),q={},K=n(y,q,"filter",Ce),X=n(y,q,"namespace",m);if(J(y,q,`in onResolve() call for plugin ${JSON.stringify(s)}`),K==null)throw new Error("onResolve() call is missing a filter");let H=E++;x[H]={name:s,callback:F,note:Q},j.onResolve.push({id:H,filter:K.source,namespace:X||""})},onLoad(y,F){let k='This error came from the "onLoad" callback registered here:',Q=$e(new Error(k),e,"onLoad"),q={},K=n(y,q,"filter",Ce),X=n(y,q,"namespace",m);if(J(y,q,`in onLoad() call for plugin ${JSON.stringify(s)}`),K==null)throw new Error("onLoad() call is missing a filter");let H=E++;T[H]={name:s,callback:F,note:Q},j.onLoad.push({id:H,filter:K.source,namespace:X||""})},esbuild:e.esbuild});b&&(yield b),A.push(j)}catch(h){return{ok:!1,error:h,pluginName:s}}}let B=S=>pe(this,null,function*(){switch(S.command){case"on-start":{let w={errors:[],warnings:[]};return yield Promise.all(v.map(Y=>pe(this,[Y],function*({name:s,callback:h,note:j}){try{let b=yield h();if(b!=null){if(typeof b!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(s)} to return an object`);let y={},F=n(b,y,"errors",_),k=n(b,y,"warnings",_);J(b,y,`from onStart() callback in plugin ${JSON.stringify(s)}`),F!=null&&w.errors.push(...be(F,"errors",d,s)),k!=null&&w.warnings.push(...be(k,"warnings",d,s))}}catch(b){w.errors.push(ve(b,e,d,j&&j(),s))}}))),w}case"on-resolve":{let w={},s="",h,j;for(let Y of S.ids)try{({name:s,callback:h,note:j}=x[Y]);let b=yield h({path:S.path,importer:S.importer,namespace:S.namespace,resolveDir:S.resolveDir,kind:S.kind,pluginData:d.load(S.pluginData)});if(b!=null){if(typeof b!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(s)} to return an object`);let y={},F=n(b,y,"pluginName",m),k=n(b,y,"path",m),Q=n(b,y,"namespace",m),q=n(b,y,"suffix",m),K=n(b,y,"external",W),X=n(b,y,"sideEffects",W),H=n(b,y,"pluginData",Ae),U=n(b,y,"errors",_),V=n(b,y,"warnings",_),G=n(b,y,"watchFiles",_),z=n(b,y,"watchDirs",_);J(b,y,`from onResolve() callback in plugin ${JSON.stringify(s)}`),w.id=Y,F!=null&&(w.pluginName=F),k!=null&&(w.path=k),Q!=null&&(w.namespace=Q),q!=null&&(w.suffix=q),K!=null&&(w.external=K),X!=null&&(w.sideEffects=X),H!=null&&(w.pluginData=d.store(H)),U!=null&&(w.errors=be(U,"errors",d,s)),V!=null&&(w.warnings=be(V,"warnings",d,s)),G!=null&&(w.watchFiles=Me(G,"watchFiles")),z!=null&&(w.watchDirs=Me(z,"watchDirs"));break}}catch(b){return{id:Y,errors:[ve(b,e,d,j&&j(),s)]}}return w}case"on-load":{let w={},s="",h,j;for(let Y of S.ids)try{({name:s,callback:h,note:j}=T[Y]);let b=yield h({path:S.path,namespace:S.namespace,suffix:S.suffix,pluginData:d.load(S.pluginData)});if(b!=null){if(typeof b!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(s)} to return an object`);let y={},F=n(b,y,"pluginName",m),k=n(b,y,"contents",Ge),Q=n(b,y,"resolveDir",m),q=n(b,y,"pluginData",Ae),K=n(b,y,"loader",m),X=n(b,y,"errors",_),H=n(b,y,"warnings",_),U=n(b,y,"watchFiles",_),V=n(b,y,"watchDirs",_);J(b,y,`from onLoad() callback in plugin ${JSON.stringify(s)}`),w.id=Y,F!=null&&(w.pluginName=F),k instanceof Uint8Array?w.contents=k:k!=null&&(w.contents=ne(k)),Q!=null&&(w.resolveDir=Q),q!=null&&(w.pluginData=d.store(q)),K!=null&&(w.loader=K),X!=null&&(w.errors=be(X,"errors",d,s)),H!=null&&(w.warnings=be(H,"warnings",d,s)),U!=null&&(w.watchFiles=Me(U,"watchFiles")),V!=null&&(w.watchDirs=Me(V,"watchDirs"));break}}catch(b){return{id:Y,errors:[ve(b,e,d,j&&j(),s)]}}return w}default:throw new Error("Invalid command: "+S.command)}}),L=(S,w,s)=>s();M.length>0&&(L=(S,w,s)=>{(()=>pe(this,null,function*(){for(let{name:h,callback:j,note:Y}of M)try{yield j(S)}catch(b){S.errors.push(yield new Promise(y=>w(b,h,Y&&Y(),y)))}}))().then(s)}),D=!0;let ee=0;return{ok:!0,requestPlugins:A,runOnEndCallbacks:L,pluginRefs:{ref(){++ee===1&&r.set(a,B)},unref(){--ee===0&&r.delete(a)}}}}),ae=(p,f,a,d)=>{let P={},v=n(f,P,"port",Oe),M=n(f,P,"host",m),x=n(f,P,"servedir",m),T=n(f,P,"onRequest",We),E,O=new Promise((A,D)=>{E=B=>{u.delete(d),B!==null?D(new Error(B)):A()}});return a.serve={},J(f,P,"in serve() call"),v!==void 0&&(a.serve.port=v),M!==void 0&&(a.serve.host=M),x!==void 0&&(a.serve.servedir=x),u.set(d,{onRequest:T,onWait:E}),{wait:O,stop(){$(p,{command:"serve-stop",key:d},()=>{})}}},ue="warning",ce="silent",me=p=>{let f=l++,a=Ye(),d,{refs:P,options:v,isTTY:M,callback:x}=p;if(typeof v=="object"){let O=v.plugins;if(O!==void 0){if(!Array.isArray(O))throw new Error('"plugins" must be an array');d=O}}let T=(O,A,D,B)=>{let L=[];try{Pe(L,v,{},M,ue)}catch(S){}let ee=ve(O,e,a,D,A);$(P,{command:"error",flags:L,error:ee},()=>{ee.detail=a.load(ee.detail),B(ee)})},E=(O,A)=>{T(O,A,void 0,D=>{x(Re("Build failed",[D],[]),null)})};if(d&&d.length>0){if(e.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");te(v,d,f,a,P).then(O=>{if(!O.ok)E(O.error,O.pluginName);else try{de(Ne(Fe({},p),{key:f,details:a,logPluginError:T,requestPlugins:O.requestPlugins,runOnEndCallbacks:O.runOnEndCallbacks,pluginRefs:O.pluginRefs}))}catch(A){E(A,"")}},O=>E(O,""))}else try{de(Ne(Fe({},p),{key:f,details:a,logPluginError:T,requestPlugins:null,runOnEndCallbacks:(O,A,D)=>D(),pluginRefs:null}))}catch(O){E(O,"")}},de=({callName:p,refs:f,serveOptions:a,options:d,isTTY:P,defaultWD:v,callback:M,key:x,details:T,logPluginError:E,requestPlugins:O,runOnEndCallbacks:A,pluginRefs:D})=>{let B={ref(){D&&D.ref(),f&&f.ref()},unref(){D&&D.unref(),f&&f.unref()}},L=!e.isWriteUnavailable,{entries:ee,flags:S,write:w,stdinContents:s,stdinResolveDir:h,absWorkingDir:j,incremental:Y,nodePaths:b,watch:y,mangleCache:F}=wt(p,d,P,ue,L),k={command:"build",key:x,entries:ee,flags:S,write:w,stdinContents:s,stdinResolveDir:h,absWorkingDir:j||v,incremental:Y,nodePaths:b};O&&(k.plugins=O),F&&(k.mangleCache=F);let Q=a&&ae(B,a,k,x),q,K,X=(U,V)=>{U.outputFiles&&(V.outputFiles=U.outputFiles.map(Rt)),U.metafile&&(V.metafile=JSON.parse(U.metafile)),U.mangleCache&&(V.mangleCache=U.mangleCache),U.writeToStdout!==void 0&&console.log(he(U.writeToStdout).replace(/\n$/,""))},H=(U,V)=>{let G={errors:ge(U.errors,T),warnings:ge(U.warnings,T)};X(U,G),A(G,E,()=>{if(G.errors.length>0)return V(Re("Build failed",G.errors,G.warnings),null);if(U.rebuild){if(!q){let z=!1;q=()=>new Promise((fe,Z)=>{if(z||i)throw new Error("Cannot rebuild");$(B,{command:"rebuild",key:x},(re,nt)=>{if(re)return V(Re("Build failed",[{id:"",pluginName:"",text:re,location:null,notes:[],detail:void 0}],[]),null);H(nt,(Be,lt)=>{Be?Z(Be):fe(lt)})})}),B.ref(),q.dispose=()=>{z||(z=!0,$(B,{command:"rebuild-dispose",key:x},()=>{}),B.unref())}}G.rebuild=q}if(U.watch){if(!K){let z=!1;B.ref(),K=()=>{z||(z=!0,o.delete(x),$(B,{command:"watch-stop",key:x},()=>{}),B.unref())},y&&o.set(x,(fe,Z)=>{if(fe){y.onRebuild&&y.onRebuild(fe,null);return}let re={errors:ge(Z.errors,T),warnings:ge(Z.warnings,T)};X(Z,re),A(re,E,()=>{if(re.errors.length>0){y.onRebuild&&y.onRebuild(Re("Build failed",re.errors,re.warnings),null);return}Z.rebuildID!==void 0&&(re.rebuild=q),re.stop=K,y.onRebuild&&y.onRebuild(null,re)})})}G.stop=K}V(null,G)})};if(w&&e.isWriteUnavailable)throw new Error('The "write" option is unavailable in this environment');if(Y&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(y&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');$(B,k,(U,V)=>{if(U)return M(new Error(U),null);if(Q){let G=V,z=!1;B.ref();let fe={port:G.port,host:G.host,wait:Q.wait,stop(){z||(z=!0,Q.stop(),B.unref())}};return B.ref(),Q.wait.then(B.unref,B.unref),M(null,fe)}return H(V,M)})};return{readFromStdout:N,afterClose:C,service:{buildOrServe:me,transform:({callName:p,refs:f,input:a,options:d,isTTY:P,fs:v,callback:M})=>{let x=Ye(),T=E=>{try{if(typeof a!="string"&&!(a instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:O,mangleCache:A}=vt(p,d,P,ce),D={command:"transform",flags:O,inputFS:E!==null,input:E!==null?ne(E):typeof a=="string"?ne(a):a};A&&(D.mangleCache=A),$(f,D,(B,L)=>{if(B)return M(new Error(B),null);let ee=ge(L.errors,x),S=ge(L.warnings,x),w=1,s=()=>{if(--w===0){let h={warnings:S,code:L.code,map:L.map};L.mangleCache&&(h.mangleCache=L==null?void 0:L.mangleCache),M(null,h)}};if(ee.length>0)return M(Re("Transform failed",ee,S),null);L.codeFS&&(w++,v.readFile(L.code,(h,j)=>{h!==null?M(h,null):(L.code=j,s())})),L.mapFS&&(w++,v.readFile(L.map,(h,j)=>{h!==null?M(h,null):(L.map=j,s())})),s()})}catch(O){let A=[];try{Pe(A,d,{},P,ce)}catch(B){}let D=ve(O,e,x,void 0,"");$(f,{command:"error",flags:A,error:D},()=>{D.detail=x.load(D.detail),M(Re("Transform failed",[D],[]),null)})}};if((typeof a=="string"||a instanceof Uint8Array)&&a.length>1024*1024){let E=T;T=()=>v.writeFile(a,E)}T(null)},formatMessages:({callName:p,refs:f,messages:a,options:d,callback:P})=>{let v=be(a,"messages",null,"");if(!d)throw new Error(`Missing second argument in ${p}() call`);let M={},x=n(d,M,"kind",m),T=n(d,M,"color",W),E=n(d,M,"terminalWidth",Oe);if(J(d,M,`in ${p}() call`),x===void 0)throw new Error(`Missing "kind" in ${p}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${p}() call`);let O={command:"format-msgs",messages:v,isWarning:x==="warning"};T!==void 0&&(O.color=T),E!==void 0&&(O.terminalWidth=E),$(f,O,(A,D)=>{if(A)return P(new Error(A),null);P(null,D.messages)})},analyzeMetafile:({callName:p,refs:f,metafile:a,options:d,callback:P})=>{d===void 0&&(d={});let v={},M=n(d,v,"color",W),x=n(d,v,"verbose",W);J(d,v,`in ${p}() call`);let T={command:"analyze-metafile",metafile:a};M!==void 0&&(T.color=M),x!==void 0&&(T.verbose=x),$(f,T,(E,O)=>{if(E)return P(new Error(E),null);P(null,O.result)})}}}}function Ye(){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 $e(e,t,r){let o,u=!1;return()=>{if(u)return o;u=!0;try{let i=(e.stack+"").split(`
|
3
3
|
`);i.splice(1,1);let c=rt(t,i,r);if(c)return o={text:e.message,location:c},o}catch(i){}}}function ve(e,t,r,o,u){let i="Internal error",c=null;try{i=(e&&e.message||e)+""}catch(l){}try{c=rt(t,(e.stack+"").split(`
|
4
4
|
`),"")}catch(l){}return{id:"",pluginName:u,text:i,location:c,notes:o?[o]:[],detail:r?r.store(e):-1}}function rt(e,t,r){let o=" at ";if(e.readFileSync&&!t[0].startsWith(o)&&t[1].startsWith(o))for(let u=1;u<t.length;u++){let i=t[u];if(!!i.startsWith(o))for(i=i.slice(o.length);;){let c=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(c){i=c[1];continue}if(c=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),c){i=c[1];continue}if(c=/^(\S+):(\d+):(\d+)$/.exec(i),c){let l;try{l=e.readFileSync(c[1],"utf8")}catch(C){break}let g=l.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",R=+c[3]-1,N=g.slice(R,R+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:ne(g.slice(0,R)).length,length:ne(g.slice(R,R+N)).length,lineText:g+`
|
5
5
|
`+t.slice(1).join(`
|
6
6
|
`),suggestion:""}}break}}return null}function Re(e,t,r){let o=5,u=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,o+1).map((c,l)=>{if(l===o)return`
|
7
7
|
...`;if(!c.location)return`
|
8
8
|
error: ${c.text}`;let{file:g,line:R,column:N}=c.location,C=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
|
9
|
-
${g}:${R}:${N}: ERROR: ${C}${c.text}`}).join(""),i=new Error(`${e}${u}`);return i.errors=t,i.warnings=r,i}function ge(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Qe(e,t){if(e==null)return null;let r={},o=n(e,r,"file",m),u=n(e,r,"namespace",m),i=n(e,r,"line",Oe),c=n(e,r,"column",Oe),l=n(e,r,"length",Oe),g=n(e,r,"lineText",m),R=n(e,r,"suggestion",m);return J(e,r,t),{file:o||"",namespace:u||"",line:i||0,column:c||0,length:l||0,lineText:g||"",suggestion:R||""}}function be(e,t,r,o){let u=[],i=0;for(let c of e){let l={},g=n(c,l,"id",m),R=n(c,l,"pluginName",m),N=n(c,l,"text",m),C=n(c,l,"location",Je),$=n(c,l,"notes",_),I=n(c,l,"detail",Ae),le=`in element ${i} of "${t}"`;J(c,l,le);let oe=[];if($)for(let ie of $){let te={},ae=n(ie,te,"text",m),ue=n(ie,te,"location",Je);J(ie,te,le),oe.push({text:ae||"",location:Qe(ue,le)})}u.push({id:g||"",pluginName:R||o,text:N||"",location:Qe(C,le),notes:oe,detail:r?r.store(I):-1}),i++}return u}function Me(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 Rt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){let o=this.contents;return(r===null||o!==t)&&(t=o,r=he(o)),r}}}var xt="0.14.53",St=e=>Te().build(e),Et=()=>{throw new Error('The "serve" API only works in node')},kt=(e,t)=>Te().transform(e,t),$t=(e,t)=>Te().formatMessages(e,t),Mt=(e,t)=>Te().analyzeMetafile(e,t),At=()=>{throw new Error('The "buildSync" API only works in node')},Ct=()=>{throw new Error('The "transformSync" API only works in node')},Pt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Tt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},xe,qe,Te=()=>{if(qe)return qe;throw xe?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')},Dt=e=>{e=Xe(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(xe)throw new Error('Cannot call "initialize" more than once');return xe=Bt(t||"",r,o),xe.catch(()=>{xe=void 0}),xe},Bt=(e,t,r)=>pe(void 0,null,function*(){let o;if(t)o=t;else{let l=yield fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);o=yield l.arrayBuffer()}let u;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.\nvar y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`\n`);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,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,l){l(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 g=new TextEncoder("utf-8"),f=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 h=(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 a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;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,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.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),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(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(l(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)),a=c(e+32),m=Reflect.apply(o,t,a);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=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(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=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,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=g.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,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.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(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.53"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});u=new Worker(URL.createObjectURL(l))}else{let l=(postMessage=>{
|
9
|
+
${g}:${R}:${N}: ERROR: ${C}${c.text}`}).join(""),i=new Error(`${e}${u}`);return i.errors=t,i.warnings=r,i}function ge(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Qe(e,t){if(e==null)return null;let r={},o=n(e,r,"file",m),u=n(e,r,"namespace",m),i=n(e,r,"line",Oe),c=n(e,r,"column",Oe),l=n(e,r,"length",Oe),g=n(e,r,"lineText",m),R=n(e,r,"suggestion",m);return J(e,r,t),{file:o||"",namespace:u||"",line:i||0,column:c||0,length:l||0,lineText:g||"",suggestion:R||""}}function be(e,t,r,o){let u=[],i=0;for(let c of e){let l={},g=n(c,l,"id",m),R=n(c,l,"pluginName",m),N=n(c,l,"text",m),C=n(c,l,"location",Je),$=n(c,l,"notes",_),I=n(c,l,"detail",Ae),le=`in element ${i} of "${t}"`;J(c,l,le);let oe=[];if($)for(let ie of $){let te={},ae=n(ie,te,"text",m),ue=n(ie,te,"location",Je);J(ie,te,le),oe.push({text:ae||"",location:Qe(ue,le)})}u.push({id:g||"",pluginName:R||o,text:N||"",location:Qe(C,le),notes:oe,detail:r?r.store(I):-1}),i++}return u}function Me(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 Rt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){let o=this.contents;return(r===null||o!==t)&&(t=o,r=he(o)),r}}}var xt="0.15.0",St=e=>Te().build(e),Et=()=>{throw new Error('The "serve" API only works in node')},kt=(e,t)=>Te().transform(e,t),$t=(e,t)=>Te().formatMessages(e,t),Mt=(e,t)=>Te().analyzeMetafile(e,t),At=()=>{throw new Error('The "buildSync" API only works in node')},Ct=()=>{throw new Error('The "transformSync" API only works in node')},Pt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Tt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},xe,qe,Te=()=>{if(qe)return qe;throw xe?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')},Dt=e=>{e=Xe(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(xe)throw new Error('Cannot call "initialize" more than once');return xe=Bt(t||"",r,o),xe.catch(()=>{xe=void 0}),xe},Bt=(e,t,r)=>pe(void 0,null,function*(){let o;if(t)o=t;else{let l=yield fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);o=yield l.arrayBuffer()}let u;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.\nvar y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`\n`);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,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,l){l(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 g=new TextEncoder("utf-8"),f=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 h=(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 a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;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,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.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),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(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(l(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)),a=c(e+32),m=Reflect.apply(o,t,a);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=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(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=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,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=g.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,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.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(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.15.0"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});u=new Worker(URL.createObjectURL(l))}else{let l=(postMessage=>{
|
10
10
|
// Copyright 2018 The Go Authors. All rights reserved.
|
11
11
|
// Use of this source code is governed by a BSD-style
|
12
12
|
// license that can be found in the LICENSE file.
|
13
13
|
var y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`
|
14
14
|
`);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,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,l){l(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 g=new TextEncoder("utf-8"),f=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 h=(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 a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;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,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.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),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(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(l(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)),a=c(e+32),m=Reflect.apply(o,t,a);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=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(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=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,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=g.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,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.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(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`
|
15
15
|
`);d.length>1&&console.log(d.slice(0,-1).join(`
|
16
|
-
`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.
|
16
|
+
`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.15.0"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(g=>u.onmessage({data:g}));u={onmessage:null,postMessage:g=>setTimeout(()=>l({data:g})),terminate(){}}}u.postMessage(o),u.onmessage=({data:l})=>i(l);let{readFromStdout:i,service:c}=tt({writeToStdin(l){u.postMessage(l)},isSync:!1,isWriteUnavailable:!0,esbuild:De});qe={build:l=>new Promise((g,R)=>c.buildOrServe({callName:"build",refs:null,serveOptions:null,options:l,isTTY:!1,defaultWD:"/",callback:(N,C)=>N?R(N):g(C)})),transform:(l,g)=>new Promise((R,N)=>c.transform({callName:"transform",refs:null,input:l,options:g||{},isTTY:!1,fs:{readFile(C,$){$(new Error("Internal error"),null)},writeFile(C,$){$(null)}},callback:(C,$)=>C?N(C):R($)})),formatMessages:(l,g)=>new Promise((R,N)=>c.formatMessages({callName:"formatMessages",refs:null,messages:l,options:g,callback:(C,$)=>C?N(C):R($)})),analyzeMetafile:(l,g)=>new Promise((R,N)=>c.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof l=="string"?l:JSON.stringify(l),options:g,callback:(C,$)=>C?N(C):R($)}))}}),Ft=De;
|
17
17
|
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|
@@ -758,8 +758,8 @@ function createChannel(streamIn) {
|
|
758
758
|
if (isFirstPacket) {
|
759
759
|
isFirstPacket = false;
|
760
760
|
let binaryVersion = String.fromCharCode(...bytes);
|
761
|
-
if (binaryVersion !== "0.
|
762
|
-
throw new Error(`Cannot start service: Host version "${"0.
|
761
|
+
if (binaryVersion !== "0.15.0") {
|
762
|
+
throw new Error(`Cannot start service: Host version "${"0.15.0"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
763
763
|
}
|
764
764
|
return;
|
765
765
|
}
|
@@ -1886,7 +1886,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
1886
1886
|
}
|
1887
1887
|
}
|
1888
1888
|
var _a;
|
1889
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.
|
1889
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.15.0";
|
1890
1890
|
var esbuildCommandAndArgs = () => {
|
1891
1891
|
if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
1892
1892
|
throw new Error(
|
@@ -1952,7 +1952,7 @@ var fsAsync = {
|
|
1952
1952
|
}
|
1953
1953
|
}
|
1954
1954
|
};
|
1955
|
-
var version = "0.
|
1955
|
+
var version = "0.15.0";
|
1956
1956
|
var build = (options) => ensureServiceIsRunning().build(options);
|
1957
1957
|
var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
|
1958
1958
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
@@ -2063,7 +2063,7 @@ var ensureServiceIsRunning = () => {
|
|
2063
2063
|
if (longLivedService)
|
2064
2064
|
return longLivedService;
|
2065
2065
|
let [command, args] = esbuildCommandAndArgs();
|
2066
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.
|
2066
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.15.0"}`, "--ping"), {
|
2067
2067
|
windowsHide: true,
|
2068
2068
|
stdio: ["pipe", "pipe", "inherit"],
|
2069
2069
|
cwd: defaultWD
|
@@ -2177,7 +2177,7 @@ var runServiceSync = (callback) => {
|
|
2177
2177
|
esbuild: node_exports
|
2178
2178
|
});
|
2179
2179
|
callback(service);
|
2180
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.
|
2180
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.15.0"}`), {
|
2181
2181
|
cwd: defaultWD,
|
2182
2182
|
windowsHide: true,
|
2183
2183
|
input: stdin,
|
@@ -2193,7 +2193,7 @@ var workerThreadService = null;
|
|
2193
2193
|
var startWorkerThreadService = (worker_threads2) => {
|
2194
2194
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
2195
2195
|
let worker = new worker_threads2.Worker(__filename, {
|
2196
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.
|
2196
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.15.0" },
|
2197
2197
|
transferList: [workerPort],
|
2198
2198
|
execArgv: []
|
2199
2199
|
});
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-asset-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brotli
|