isomorfeus-asset-manager 0.14.25 → 0.14.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -336,11 +336,14 @@ function pushCommonFlags(flags, options, keys) {
336
336
  let jsx = getFlag(options, keys, "jsx", mustBeString);
337
337
  let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
338
338
  let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
339
+ let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString);
340
+ let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean);
339
341
  let define = getFlag(options, keys, "define", mustBeObject);
340
342
  let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
341
343
  let supported = getFlag(options, keys, "supported", mustBeObject);
342
344
  let pure = getFlag(options, keys, "pure", mustBeArray);
343
345
  let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
346
+ let platform = getFlag(options, keys, "platform", mustBeString);
344
347
  if (legalComments)
345
348
  flags.push(`--legal-comments=${legalComments}`);
346
349
  if (sourceRoot !== void 0)
@@ -357,6 +360,8 @@ function pushCommonFlags(flags, options, keys) {
357
360
  flags.push(`--format=${format}`);
358
361
  if (globalName)
359
362
  flags.push(`--global-name=${globalName}`);
363
+ if (platform)
364
+ flags.push(`--platform=${platform}`);
360
365
  if (minify)
361
366
  flags.push("--minify");
362
367
  if (minifySyntax)
@@ -386,6 +391,10 @@ function pushCommonFlags(flags, options, keys) {
386
391
  flags.push(`--jsx-factory=${jsxFactory}`);
387
392
  if (jsxFragment)
388
393
  flags.push(`--jsx-fragment=${jsxFragment}`);
394
+ if (jsxImportSource)
395
+ flags.push(`--jsx-import-source=${jsxImportSource}`);
396
+ if (jsxDev)
397
+ flags.push(`--jsx-dev`);
389
398
  if (define) {
390
399
  for (let key in define) {
391
400
  if (key.indexOf("=") >= 0)
@@ -432,7 +441,6 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
432
441
  let outfile = getFlag(options, keys, "outfile", mustBeString);
433
442
  let outdir = getFlag(options, keys, "outdir", mustBeString);
434
443
  let outbase = getFlag(options, keys, "outbase", mustBeString);
435
- let platform = getFlag(options, keys, "platform", mustBeString);
436
444
  let tsconfig = getFlag(options, keys, "tsconfig", mustBeString);
437
445
  let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArray);
438
446
  let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArray);
@@ -486,8 +494,6 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
486
494
  flags.push(`--outdir=${outdir}`);
487
495
  if (outbase)
488
496
  flags.push(`--outbase=${outbase}`);
489
- if (platform)
490
- flags.push(`--platform=${platform}`);
491
497
  if (tsconfig)
492
498
  flags.push(`--tsconfig=${tsconfig}`);
493
499
  if (resolveExtensions) {
@@ -575,7 +581,7 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
575
581
  }
576
582
  if (stdin) {
577
583
  let stdinKeys = /* @__PURE__ */ Object.create(null);
578
- let contents = getFlag(stdin, stdinKeys, "contents", mustBeString);
584
+ let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
579
585
  let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
580
586
  let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
581
587
  let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString);
@@ -586,7 +592,10 @@ function flagsForBuildOptions(callName, options, isTTY, logLevelDefault, writeDe
586
592
  flags.push(`--loader=${loader2}`);
587
593
  if (resolveDir)
588
594
  stdinResolveDir = resolveDir + "";
589
- stdinContents = contents ? contents + "" : "";
595
+ if (typeof contents === "string")
596
+ stdinContents = encodeUTF8(contents);
597
+ else if (contents instanceof Uint8Array)
598
+ stdinContents = contents;
590
599
  }
591
600
  let nodePaths = [];
592
601
  if (nodePathsInput) {
@@ -781,8 +790,8 @@ function createChannel(streamIn) {
781
790
  if (isFirstPacket) {
782
791
  isFirstPacket = false;
783
792
  let binaryVersion = String.fromCharCode(...bytes);
784
- if (binaryVersion !== "0.14.49") {
785
- throw new Error(`Cannot start service: Host version "${"0.14.49"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
793
+ if (binaryVersion !== "0.14.53") {
794
+ throw new Error(`Cannot start service: Host version "${"0.14.53"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
786
795
  }
787
796
  return;
788
797
  }
@@ -1169,24 +1178,27 @@ function createChannel(streamIn) {
1169
1178
  if (plugins && plugins.length > 0) {
1170
1179
  if (streamIn.isSync)
1171
1180
  return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
1172
- handlePlugins(options, plugins, key, details, refs).then((result) => {
1173
- if (!result.ok) {
1174
- handleError(result.error, result.pluginName);
1175
- } else {
1176
- try {
1177
- buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
1178
- key,
1179
- details,
1180
- logPluginError,
1181
- requestPlugins: result.requestPlugins,
1182
- runOnEndCallbacks: result.runOnEndCallbacks,
1183
- pluginRefs: result.pluginRefs
1184
- }));
1185
- } catch (e) {
1186
- handleError(e, "");
1181
+ handlePlugins(options, plugins, key, details, refs).then(
1182
+ (result) => {
1183
+ if (!result.ok) {
1184
+ handleError(result.error, result.pluginName);
1185
+ } else {
1186
+ try {
1187
+ buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
1188
+ key,
1189
+ details,
1190
+ logPluginError,
1191
+ requestPlugins: result.requestPlugins,
1192
+ runOnEndCallbacks: result.runOnEndCallbacks,
1193
+ pluginRefs: result.pluginRefs
1194
+ }));
1195
+ } catch (e) {
1196
+ handleError(e, "");
1197
+ }
1187
1198
  }
1188
- }
1189
- }, (e) => handleError(e, ""));
1199
+ },
1200
+ (e) => handleError(e, "")
1201
+ );
1190
1202
  } else {
1191
1203
  try {
1192
1204
  buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
@@ -1289,18 +1301,22 @@ function createChannel(streamIn) {
1289
1301
  rebuild = () => new Promise((resolve, reject) => {
1290
1302
  if (isDisposed || closeData)
1291
1303
  throw new Error("Cannot rebuild");
1292
- sendRequest(refs, { command: "rebuild", key }, (error2, response2) => {
1293
- if (error2) {
1294
- const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
1295
- return callback2(failureErrorWithLog("Build failed", [message], []), null);
1304
+ sendRequest(
1305
+ refs,
1306
+ { command: "rebuild", key },
1307
+ (error2, response2) => {
1308
+ if (error2) {
1309
+ const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
1310
+ return callback2(failureErrorWithLog("Build failed", [message], []), null);
1311
+ }
1312
+ buildResponseToResult(response2, (error3, result3) => {
1313
+ if (error3)
1314
+ reject(error3);
1315
+ else
1316
+ resolve(result3);
1317
+ });
1296
1318
  }
1297
- buildResponseToResult(response2, (error3, result3) => {
1298
- if (error3)
1299
- reject(error3);
1300
- else
1301
- resolve(result3);
1302
- });
1303
- });
1319
+ );
1304
1320
  });
1305
1321
  refs.ref();
1306
1322
  rebuild.dispose = () => {
@@ -1395,8 +1411,8 @@ function createChannel(streamIn) {
1395
1411
  const details = createObjectStash();
1396
1412
  let start = (inputPath) => {
1397
1413
  try {
1398
- if (typeof input !== "string")
1399
- throw new Error('The input to "transform" must be a string');
1414
+ if (typeof input !== "string" && !(input instanceof Uint8Array))
1415
+ throw new Error('The input to "transform" must be a string or a Uint8Array');
1400
1416
  let {
1401
1417
  flags,
1402
1418
  mangleCache
@@ -1405,7 +1421,7 @@ function createChannel(streamIn) {
1405
1421
  command: "transform",
1406
1422
  flags,
1407
1423
  inputFS: inputPath !== null,
1408
- input: inputPath !== null ? inputPath : input
1424
+ input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
1409
1425
  };
1410
1426
  if (mangleCache)
1411
1427
  request.mangleCache = mangleCache;
@@ -1462,7 +1478,7 @@ function createChannel(streamIn) {
1462
1478
  });
1463
1479
  }
1464
1480
  };
1465
- if (typeof input === "string" && input.length > 1024 * 1024) {
1481
+ if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
1466
1482
  let next = start;
1467
1483
  start = () => fs.writeFile(input, next);
1468
1484
  }
@@ -1721,15 +1737,18 @@ function convertOutputFiles({ path, contents }) {
1721
1737
  path,
1722
1738
  contents,
1723
1739
  get text() {
1724
- if (text === null)
1725
- text = decodeUTF8(contents);
1740
+ const binary = this.contents;
1741
+ if (text === null || binary !== contents) {
1742
+ contents = binary;
1743
+ text = decodeUTF8(binary);
1744
+ }
1726
1745
  return text;
1727
1746
  }
1728
1747
  };
1729
1748
  }
1730
1749
 
1731
1750
  // lib/npm/browser.ts
1732
- var version = "0.14.49";
1751
+ var version = "0.14.53";
1733
1752
  var build = (options) => ensureServiceIsRunning().build(options);
1734
1753
  var serve = () => {
1735
1754
  throw new Error(`The "serve" API only works in node`);
@@ -1785,7 +1804,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
1785
1804
  }
1786
1805
  let worker;
1787
1806
  if (useWorker) {
1788
- 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 this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n }, getInt64(sp + 8) + 1));\n this.mem.setInt32(sp + 16, id, true);\n },\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n 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.49"}`];\n if (wasm instanceof WebAssembly.Module) {\n WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));\n } else {\n WebAssembly.instantiate(wasm, go.importObject).then(({ instance }) => go.run(instance));\n }\n };\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
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" });
1789
1808
  worker = new Worker(URL.createObjectURL(blob));
1790
1809
  } else {
1791
1810
  let onmessage = ((postMessage) => {
@@ -2100,13 +2119,16 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2100
2119
  sp >>>= 0;
2101
2120
  const id = this._nextCallbackTimeoutID;
2102
2121
  this._nextCallbackTimeoutID++;
2103
- this._scheduledTimeouts.set(id, setTimeout(() => {
2104
- this._resume();
2105
- while (this._scheduledTimeouts.has(id)) {
2106
- console.warn("scheduleTimeoutEvent: missed timeout event");
2122
+ this._scheduledTimeouts.set(id, setTimeout(
2123
+ () => {
2107
2124
  this._resume();
2108
- }
2109
- }, getInt64(sp + 8) + 1));
2125
+ while (this._scheduledTimeouts.has(id)) {
2126
+ console.warn("scheduleTimeoutEvent: missed timeout event");
2127
+ this._resume();
2128
+ }
2129
+ },
2130
+ getInt64(sp + 8) + 1
2131
+ ));
2110
2132
  this.mem.setInt32(sp + 16, id, true);
2111
2133
  },
2112
2134
  "runtime.clearTimeoutEvent": (sp) => {
@@ -2386,7 +2408,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2386
2408
  callback(null, count);
2387
2409
  };
2388
2410
  let go = new globalThis.Go();
2389
- go.argv = ["", `--service=${"0.14.49"}`];
2411
+ go.argv = ["", `--service=${"0.14.53"}`];
2390
2412
  if (wasm instanceof WebAssembly.Module) {
2391
2413
  WebAssembly.instantiate(wasm, go.importObject).then((instance) => go.run(instance));
2392
2414
  } else {
@@ -1,17 +1,17 @@
1
1
  "use strict";(module=>{
2
- var Ee=Object.defineProperty,lt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,at=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,Ne=(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))at.call(t,r)&&ze(e,r,t[r]);return e},Fe=(e,t)=>lt(e,st(t));var ut=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},ft=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of ot(t))!Ke.call(e,u)&&u!==r&&Ee(e,u,{get:()=>t[u],enumerable:!(o=it(t,u))||o.enumerable});return e};var ct=e=>ft(Ee({},"__esModule",{value:!0}),e);var de=(e,t,r)=>new Promise((o,u)=>{var s=y=>{try{i(r.next(y))}catch(O){u(O)}},c=y=>{try{i(r.throw(y))}catch(O){u(O)}},i=y=>y.done?o(y.value):Promise.resolve(y.value).then(s,c);i((r=r.apply(e,t)).next())});var Be={};ut(Be,{analyzeMetafile:()=>Mt,analyzeMetafileSync:()=>Tt,build:()=>xt,buildSync:()=>Ct,default:()=>Nt,formatMessages:()=>$t,formatMessagesSync:()=>At,initialize:()=>Bt,serve:()=>Et,transform:()=>kt,transformSync:()=>Pt,version:()=>St});module.exports=ct(Be);function Ue(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(pe(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 s of u)r.write(pe(s)),t(o[s])}},r=new ke;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),je(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 we(r.read());case 4:return r.read();case 5:{let c=r.read32(),i=[];for(let y=0;y<c;y++)i.push(t());return i}case 6:{let c=r.read32(),i={};for(let y=0;y<c;y++)i[we(r.read())]=t();return i}default:throw new Error("Invalid packet")}},r=new ke(e),o=r.read32(),u=(o&1)===0;o>>>=1;let s=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:u,value:s}}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);je(this.buf,t,r)}write(t){let r=this._write(4+t.length);je(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}},pe,we;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;pe=r=>e.encode(r),we=r=>t.decode(r)}else if(typeof Buffer!="undefined")pe=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},we=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 je(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 Ce=()=>null,W=e=>typeof e=="boolean"?null:"a boolean",pt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",m=e=>typeof e=="string"?null:"a string",Pe=e=>e instanceof RegExp?null:"a RegExp object",Se=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",ie=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",gt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",mt=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",yt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ht=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",bt=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 s=o(u);if(s!==null)throw new Error(`"${r}" must be ${s}`);return u}function J(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function Ge(e){let t=Object.create(null),r=n(e,t,"wasmURL",m),o=n(e,t,"wasmModule",gt),u=n(e,t,"worker",W);return J(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:u}}function Xe(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,u){let s=n(t,r,"color",W),c=n(t,r,"logLevel",m),i=n(t,r,"logLimit",Se);s!==void 0?e.push(`--color=${s}`):o&&e.push("--color=true"),e.push(`--log-level=${c||u}`),e.push(`--log-limit=${i||0}`)}function Ze(e,t,r){let o=n(t,r,"legalComments",m),u=n(t,r,"sourceRoot",m),s=n(t,r,"sourcesContent",W),c=n(t,r,"target",ht),i=n(t,r,"format",m),y=n(t,r,"globalName",m),O=n(t,r,"mangleProps",Pe),N=n(t,r,"reserveProps",Pe),P=n(t,r,"mangleQuoted",W),$=n(t,r,"minify",W),I=n(t,r,"minifySyntax",W),ne=n(t,r,"minifyWhitespace",W),se=n(t,r,"minifyIdentifiers",W),le=n(t,r,"drop",_),te=n(t,r,"charset",m),oe=n(t,r,"treeShaking",W),ae=n(t,r,"ignoreAnnotations",W),fe=n(t,r,"jsx",m),me=n(t,r,"jsxFactory",m),ce=n(t,r,"jsxFragment",m),ye=n(t,r,"define",ie),he=n(t,r,"logOverride",ie),be=n(t,r,"supported",ie),g=n(t,r,"pure",_),f=n(t,r,"keepNames",W);if(o&&e.push(`--legal-comments=${o}`),u!==void 0&&e.push(`--source-root=${u}`),s!==void 0&&e.push(`--sources-content=${s}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),i&&e.push(`--format=${i}`),y&&e.push(`--global-name=${y}`),$&&e.push("--minify"),I&&e.push("--minify-syntax"),ne&&e.push("--minify-whitespace"),se&&e.push("--minify-identifiers"),te&&e.push(`--charset=${te}`),oe!==void 0&&e.push(`--tree-shaking=${oe}`),ae&&e.push("--ignore-annotations"),le)for(let l of le)e.push(`--drop:${l}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),P!==void 0&&e.push(`--mangle-quoted=${P}`),fe&&e.push(`--jsx=${fe}`),me&&e.push(`--jsx-factory=${me}`),ce&&e.push(`--jsx-fragment=${ce}`),ye)for(let l in ye){if(l.indexOf("=")>=0)throw new Error(`Invalid define: ${l}`);e.push(`--define:${l}=${ye[l]}`)}if(he)for(let l in he){if(l.indexOf("=")>=0)throw new Error(`Invalid log override: ${l}`);e.push(`--log-override:${l}=${he[l]}`)}if(be)for(let l in be){if(l.indexOf("=")>=0)throw new Error(`Invalid supported: ${l}`);e.push(`--supported:${l}=${be[l]}`)}if(g)for(let l of g)e.push(`--pure:${l}`);f&&e.push("--keep-names")}function wt(e,t,r,o,u){var w;let s=[],c=[],i=Object.create(null),y=null,O=null,N=null;Ae(s,t,i,r,o),Ze(s,t,i);let P=n(t,i,"sourcemap",He),$=n(t,i,"bundle",W),I=n(t,i,"watch",pt),ne=n(t,i,"splitting",W),se=n(t,i,"preserveSymlinks",W),le=n(t,i,"metafile",W),te=n(t,i,"outfile",m),oe=n(t,i,"outdir",m),ae=n(t,i,"outbase",m),fe=n(t,i,"platform",m),me=n(t,i,"tsconfig",m),ce=n(t,i,"resolveExtensions",_),ye=n(t,i,"nodePaths",_),he=n(t,i,"mainFields",_),be=n(t,i,"conditions",_),g=n(t,i,"external",_),f=n(t,i,"loader",ie),l=n(t,i,"outExtension",ie),d=n(t,i,"publicPath",m),F=n(t,i,"entryNames",m),T=n(t,i,"chunkNames",m),M=n(t,i,"assetNames",m),x=n(t,i,"inject",_),A=n(t,i,"banner",ie),C=n(t,i,"footer",ie),R=n(t,i,"entryPoints",mt),U=n(t,i,"absWorkingDir",m),S=n(t,i,"stdin",ie),B=(w=n(t,i,"write",W))!=null?w:u,L=n(t,i,"allowOverwrite",W),ee=n(t,i,"incremental",W)===!0,E=n(t,i,"mangleCache",ie);if(i.plugins=!0,J(t,i,`in ${e}() call`),P&&s.push(`--sourcemap${P===!0?"":`=${P}`}`),$&&s.push("--bundle"),L&&s.push("--allow-overwrite"),I)if(s.push("--watch"),typeof I=="boolean")N={};else{let a=Object.create(null),v=n(I,a,"onRebuild",We);J(I,a,`on "watch" in ${e}() call`),N={onRebuild:v}}if(ne&&s.push("--splitting"),se&&s.push("--preserve-symlinks"),le&&s.push("--metafile"),te&&s.push(`--outfile=${te}`),oe&&s.push(`--outdir=${oe}`),ae&&s.push(`--outbase=${ae}`),fe&&s.push(`--platform=${fe}`),me&&s.push(`--tsconfig=${me}`),ce){let a=[];for(let v of ce){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);a.push(v)}s.push(`--resolve-extensions=${a.join(",")}`)}if(d&&s.push(`--public-path=${d}`),F&&s.push(`--entry-names=${F}`),T&&s.push(`--chunk-names=${T}`),M&&s.push(`--asset-names=${M}`),he){let a=[];for(let v of he){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);a.push(v)}s.push(`--main-fields=${a.join(",")}`)}if(be){let a=[];for(let v of be){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);a.push(v)}s.push(`--conditions=${a.join(",")}`)}if(g)for(let a of g)s.push(`--external:${a}`);if(A)for(let a in A){if(a.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${a}`);s.push(`--banner:${a}=${A[a]}`)}if(C)for(let a in C){if(a.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${a}`);s.push(`--footer:${a}=${C[a]}`)}if(x)for(let a of x)s.push(`--inject:${a}`);if(f)for(let a in f){if(a.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${a}`);s.push(`--loader:${a}=${f[a]}`)}if(l)for(let a in l){if(a.indexOf("=")>=0)throw new Error(`Invalid out extension: ${a}`);s.push(`--out-extension:${a}=${l[a]}`)}if(R)if(Array.isArray(R))for(let a of R)c.push(["",a+""]);else for(let[a,v]of Object.entries(R))c.push([a+"",v+""]);if(S){let a=Object.create(null),v=n(S,a,"contents",m),Y=n(S,a,"resolveDir",m),h=n(S,a,"sourcefile",m),p=n(S,a,"loader",m);J(S,a,'in "stdin" object'),h&&s.push(`--sourcefile=${h}`),p&&s.push(`--loader=${p}`),Y&&(O=Y+""),y=v?v+"":""}let b=[];if(ye)for(let a of ye)a+="",b.push(a);return{entries:c,flags:s,write:B,stdinContents:y,stdinResolveDir:O,absWorkingDir:U,incremental:ee,nodePaths:b,watch:N,mangleCache:Xe(E)}}function vt(e,t,r,o){let u=[],s=Object.create(null);Ae(u,t,s,r,o),Ze(u,t,s);let c=n(t,s,"sourcemap",He),i=n(t,s,"tsconfigRaw",yt),y=n(t,s,"sourcefile",m),O=n(t,s,"loader",m),N=n(t,s,"banner",m),P=n(t,s,"footer",m),$=n(t,s,"mangleCache",ie);return J(t,s,`in ${e}() call`),c&&u.push(`--sourcemap=${c===!0?"external":c}`),i&&u.push(`--tsconfig-raw=${typeof i=="string"?i:JSON.stringify(i)}`),y&&u.push(`--sourcefile=${y}`),O&&u.push(`--loader=${O}`),N&&u.push(`--banner=${N}`),P&&u.push(`--footer=${P}`),{flags:u,mangleCache:Xe($)}}function et(e){let t=new Map,r=new Map,o=new Map,u=new Map,s=null,c=0,i=0,y=new Uint8Array(16*1024),O=0,N=g=>{let f=O+g.length;if(f>y.length){let d=new Uint8Array(f*2);d.set(y),y=d}y.set(g,O),O+=g.length;let l=0;for(;l+4<=O;){let d=Le(y,l);if(l+4+d>O)break;l+=4,le(y.subarray(l,l+d)),l+=d}l>0&&(y.copyWithin(0,l,O),O-=l)},P=g=>{s={reason:g?": "+(g.message||g):""};let f="The service was stopped"+s.reason;for(let l of t.values())l(f,null);t.clear();for(let l of u.values())l.onWait(f);u.clear();for(let l of o.values())try{l(new Error(f),null)}catch(d){console.error(d)}o.clear()},$=(g,f,l)=>{if(s)return l("The service is no longer running"+s.reason,null);let d=c++;t.set(d,(F,T)=>{try{l(F,T)}finally{g&&g.unref()}}),g&&g.ref(),e.writeToStdin(Ue({id:d,isRequest:!0,value:f}))},I=(g,f)=>{if(s)throw new Error("The service is no longer running"+s.reason);e.writeToStdin(Ue({id:g,isRequest:!1,value:f}))},ne=(g,f)=>de(this,null,function*(){try{switch(f.command){case"ping":{I(g,{});break}case"on-start":{let l=r.get(f.key);l?I(g,yield l(f)):I(g,{});break}case"on-resolve":{let l=r.get(f.key);l?I(g,yield l(f)):I(g,{});break}case"on-load":{let l=r.get(f.key);l?I(g,yield l(f)):I(g,{});break}case"serve-request":{let l=u.get(f.key);l&&l.onRequest&&l.onRequest(f.args),I(g,{});break}case"serve-wait":{let l=u.get(f.key);l&&l.onWait(f.error),I(g,{});break}case"watch-rebuild":{let l=o.get(f.key);try{l&&l(null,f.args)}catch(d){console.error(d)}I(g,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(l){I(g,{errors:[Re(l,e,null,void 0,"")]})}}),se=!0,le=g=>{if(se){se=!1;let l=String.fromCharCode(...g);if(l!=="0.14.49")throw new Error(`Cannot start service: Host version "0.14.49" does not match binary version ${JSON.stringify(l)}`);return}let f=_e(g);if(f.isRequest)ne(f.id,f.value);else{let l=t.get(f.id);t.delete(f.id),f.value.error?l(f.value.error,{}):l(null,f.value)}},te=(g,f,l,d,F)=>de(this,null,function*(){let T=[],M=[],x={},A={},C=0,R=0,U=[],S=!1;f=[...f];for(let E of f){let b={};if(typeof E!="object")throw new Error(`Plugin at index ${R} must be an object`);let w=n(E,b,"name",m);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let a=n(E,b,"setup",We);if(typeof a!="function")throw new Error("Plugin is missing a setup function");J(E,b,`on plugin ${JSON.stringify(w)}`);let v={name:w,onResolve:[],onLoad:[]};R++;let h=a({initialOptions:g,resolve:(p,D={})=>{if(!S)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof p!="string")throw new Error("The path to resolve must be a string");let k=Object.create(null),Q=n(D,k,"pluginName",m),q=n(D,k,"importer",m),K=n(D,k,"namespace",m),X=n(D,k,"resolveDir",m),H=n(D,k,"kind",m),j=n(D,k,"pluginData",Ce);return J(D,k,"in resolve() call"),new Promise((V,G)=>{let z={command:"resolve",path:p,key:l,pluginName:w};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),j!=null&&(z.pluginData=d.store(j)),$(F,z,(ue,Z)=>{ue!==null?G(new Error(ue)):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(p){let D='This error came from the "onStart" callback registered here:',k=$e(new Error(D),e,"onStart");T.push({name:w,callback:p,note:k})},onEnd(p){let D='This error came from the "onEnd" callback registered here:',k=$e(new Error(D),e,"onEnd");M.push({name:w,callback:p,note:k})},onResolve(p,D){let k='This error came from the "onResolve" callback registered here:',Q=$e(new Error(k),e,"onResolve"),q={},K=n(p,q,"filter",Pe),X=n(p,q,"namespace",m);if(J(p,q,`in onResolve() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onResolve() call is missing a filter");let H=C++;x[H]={name:w,callback:D,note:Q},v.onResolve.push({id:H,filter:K.source,namespace:X||""})},onLoad(p,D){let k='This error came from the "onLoad" callback registered here:',Q=$e(new Error(k),e,"onLoad"),q={},K=n(p,q,"filter",Pe),X=n(p,q,"namespace",m);if(J(p,q,`in onLoad() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onLoad() call is missing a filter");let H=C++;A[H]={name:w,callback:D,note:Q},v.onLoad.push({id:H,filter:K.source,namespace:X||""})},esbuild:e.esbuild});h&&(yield h),U.push(v)}catch(a){return{ok:!1,error:a,pluginName:w}}}let B=E=>de(this,null,function*(){switch(E.command){case"on-start":{let b={errors:[],warnings:[]};return yield Promise.all(T.map(Y=>de(this,[Y],function*({name:w,callback:a,note:v}){try{let h=yield a();if(h!=null){if(typeof h!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"errors",_),k=n(h,p,"warnings",_);J(h,p,`from onStart() callback in plugin ${JSON.stringify(w)}`),D!=null&&b.errors.push(...ve(D,"errors",d,w)),k!=null&&b.warnings.push(...ve(k,"warnings",d,w))}}catch(h){b.errors.push(Re(h,e,d,v&&v(),w))}}))),b}case"on-resolve":{let b={},w="",a,v;for(let Y of E.ids)try{({name:w,callback:a,note:v}=x[Y]);let h=yield a({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:d.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"pluginName",m),k=n(h,p,"path",m),Q=n(h,p,"namespace",m),q=n(h,p,"suffix",m),K=n(h,p,"external",W),X=n(h,p,"sideEffects",W),H=n(h,p,"pluginData",Ce),j=n(h,p,"errors",_),V=n(h,p,"warnings",_),G=n(h,p,"watchFiles",_),z=n(h,p,"watchDirs",_);J(h,p,`from onResolve() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k!=null&&(b.path=k),Q!=null&&(b.namespace=Q),q!=null&&(b.suffix=q),K!=null&&(b.external=K),X!=null&&(b.sideEffects=X),H!=null&&(b.pluginData=d.store(H)),j!=null&&(b.errors=ve(j,"errors",d,w)),V!=null&&(b.warnings=ve(V,"warnings",d,w)),G!=null&&(b.watchFiles=Me(G,"watchFiles")),z!=null&&(b.watchDirs=Me(z,"watchDirs"));break}}catch(h){return{id:Y,errors:[Re(h,e,d,v&&v(),w)]}}return b}case"on-load":{let b={},w="",a,v;for(let Y of E.ids)try{({name:w,callback:a,note:v}=A[Y]);let h=yield a({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:d.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let p={},D=n(h,p,"pluginName",m),k=n(h,p,"contents",bt),Q=n(h,p,"resolveDir",m),q=n(h,p,"pluginData",Ce),K=n(h,p,"loader",m),X=n(h,p,"errors",_),H=n(h,p,"warnings",_),j=n(h,p,"watchFiles",_),V=n(h,p,"watchDirs",_);J(h,p,`from onLoad() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k instanceof Uint8Array?b.contents=k:k!=null&&(b.contents=pe(k)),Q!=null&&(b.resolveDir=Q),q!=null&&(b.pluginData=d.store(q)),K!=null&&(b.loader=K),X!=null&&(b.errors=ve(X,"errors",d,w)),H!=null&&(b.warnings=ve(H,"warnings",d,w)),j!=null&&(b.watchFiles=Me(j,"watchFiles")),V!=null&&(b.watchDirs=Me(V,"watchDirs"));break}}catch(h){return{id:Y,errors:[Re(h,e,d,v&&v(),w)]}}return b}default:throw new Error("Invalid command: "+E.command)}}),L=(E,b,w)=>w();M.length>0&&(L=(E,b,w)=>{(()=>de(this,null,function*(){for(let{name:a,callback:v,note:Y}of M)try{yield v(E)}catch(h){E.errors.push(yield new Promise(p=>b(h,a,Y&&Y(),p)))}}))().then(w)}),S=!0;let ee=0;return{ok:!0,requestPlugins:U,runOnEndCallbacks:L,pluginRefs:{ref(){++ee===1&&r.set(l,B)},unref(){--ee===0&&r.delete(l)}}}}),oe=(g,f,l,d)=>{let F={},T=n(f,F,"port",Se),M=n(f,F,"host",m),x=n(f,F,"servedir",m),A=n(f,F,"onRequest",We),C,R=new Promise((U,S)=>{C=B=>{u.delete(d),B!==null?S(new Error(B)):U()}});return l.serve={},J(f,F,"in serve() call"),T!==void 0&&(l.serve.port=T),M!==void 0&&(l.serve.host=M),x!==void 0&&(l.serve.servedir=x),u.set(d,{onRequest:A,onWait:C}),{wait:R,stop(){$(g,{command:"serve-stop",key:d},()=>{})}}},ae="warning",fe="silent",me=g=>{let f=i++,l=Ye(),d,{refs:F,options:T,isTTY:M,callback:x}=g;if(typeof T=="object"){let R=T.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');d=R}}let A=(R,U,S,B)=>{let L=[];try{Ae(L,T,{},M,ae)}catch(E){}let ee=Re(R,e,l,S,U);$(F,{command:"error",flags:L,error:ee},()=>{ee.detail=l.load(ee.detail),B(ee)})},C=(R,U)=>{A(R,U,void 0,S=>{x(Oe("Build failed",[S],[]),null)})};if(d&&d.length>0){if(e.isSync)return C(new Error("Cannot use plugins in synchronous API calls"),"");te(T,d,f,l,F).then(R=>{if(!R.ok)C(R.error,R.pluginName);else try{ce(Fe(Ne({},g),{key:f,details:l,logPluginError:A,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(U){C(U,"")}},R=>C(R,""))}else try{ce(Fe(Ne({},g),{key:f,details:l,logPluginError:A,requestPlugins:null,runOnEndCallbacks:(R,U,S)=>S(),pluginRefs:null}))}catch(R){C(R,"")}},ce=({callName:g,refs:f,serveOptions:l,options:d,isTTY:F,defaultWD:T,callback:M,key:x,details:A,logPluginError:C,requestPlugins:R,runOnEndCallbacks:U,pluginRefs:S})=>{let B={ref(){S&&S.ref(),f&&f.ref()},unref(){S&&S.unref(),f&&f.unref()}},L=!e.isWriteUnavailable,{entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:a,absWorkingDir:v,incremental:Y,nodePaths:h,watch:p,mangleCache:D}=wt(g,d,F,ae,L),k={command:"build",key:x,entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:a,absWorkingDir:v||T,incremental:Y,nodePaths:h};R&&(k.plugins=R),D&&(k.mangleCache=D);let Q=l&&oe(B,l,k,x),q,K,X=(j,V)=>{j.outputFiles&&(V.outputFiles=j.outputFiles.map(Rt)),j.metafile&&(V.metafile=JSON.parse(j.metafile)),j.mangleCache&&(V.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(we(j.writeToStdout).replace(/\n$/,""))},H=(j,V)=>{let G={errors:ge(j.errors,A),warnings:ge(j.warnings,A)};X(j,G),U(G,C,()=>{if(G.errors.length>0)return V(Oe("Build failed",G.errors,G.warnings),null);if(j.rebuild){if(!q){let z=!1;q=()=>new Promise((ue,Z)=>{if(z||s)throw new Error("Cannot rebuild");$(B,{command:"rebuild",key:x},(re,rt)=>{if(re)return V(Oe("Build failed",[{id:"",pluginName:"",text:re,location:null,notes:[],detail:void 0}],[]),null);H(rt,(De,nt)=>{De?Z(De):ue(nt)})})}),B.ref(),q.dispose=()=>{z||(z=!0,$(B,{command:"rebuild-dispose",key:x},()=>{}),B.unref())}}G.rebuild=q}if(j.watch){if(!K){let z=!1;B.ref(),K=()=>{z||(z=!0,o.delete(x),$(B,{command:"watch-stop",key:x},()=>{}),B.unref())},p&&o.set(x,(ue,Z)=>{if(ue){p.onRebuild&&p.onRebuild(ue,null);return}let re={errors:ge(Z.errors,A),warnings:ge(Z.warnings,A)};X(Z,re),U(re,C,()=>{if(re.errors.length>0){p.onRebuild&&p.onRebuild(Oe("Build failed",re.errors,re.warnings),null);return}Z.rebuildID!==void 0&&(re.rebuild=q),re.stop=K,p.onRebuild&&p.onRebuild(null,re)})})}G.stop=K}V(null,G)})};if(b&&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(p&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');$(B,k,(j,V)=>{if(j)return M(new Error(j),null);if(Q){let G=V,z=!1;B.ref();let ue={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,ue)}return H(V,M)})};return{readFromStdout:N,afterClose:P,service:{buildOrServe:me,transform:({callName:g,refs:f,input:l,options:d,isTTY:F,fs:T,callback:M})=>{let x=Ye(),A=C=>{try{if(typeof l!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:U}=vt(g,d,F,fe),S={command:"transform",flags:R,inputFS:C!==null,input:C!==null?C:l};U&&(S.mangleCache=U),$(f,S,(B,L)=>{if(B)return M(new Error(B),null);let ee=ge(L.errors,x),E=ge(L.warnings,x),b=1,w=()=>{if(--b===0){let a={warnings:E,code:L.code,map:L.map};L.mangleCache&&(a.mangleCache=L==null?void 0:L.mangleCache),M(null,a)}};if(ee.length>0)return M(Oe("Transform failed",ee,E),null);L.codeFS&&(b++,T.readFile(L.code,(a,v)=>{a!==null?M(a,null):(L.code=v,w())})),L.mapFS&&(b++,T.readFile(L.map,(a,v)=>{a!==null?M(a,null):(L.map=v,w())})),w()})}catch(R){let U=[];try{Ae(U,d,{},F,fe)}catch(B){}let S=Re(R,e,x,void 0,"");$(f,{command:"error",flags:U,error:S},()=>{S.detail=x.load(S.detail),M(Oe("Transform failed",[S],[]),null)})}};if(typeof l=="string"&&l.length>1024*1024){let C=A;A=()=>T.writeFile(l,C)}A(null)},formatMessages:({callName:g,refs:f,messages:l,options:d,callback:F})=>{let T=ve(l,"messages",null,"");if(!d)throw new Error(`Missing second argument in ${g}() call`);let M={},x=n(d,M,"kind",m),A=n(d,M,"color",W),C=n(d,M,"terminalWidth",Se);if(J(d,M,`in ${g}() call`),x===void 0)throw new Error(`Missing "kind" in ${g}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${g}() call`);let R={command:"format-msgs",messages:T,isWarning:x==="warning"};A!==void 0&&(R.color=A),C!==void 0&&(R.terminalWidth=C),$(f,R,(U,S)=>{if(U)return F(new Error(U),null);F(null,S.messages)})},analyzeMetafile:({callName:g,refs:f,metafile:l,options:d,callback:F})=>{d===void 0&&(d={});let T={},M=n(d,T,"color",W),x=n(d,T,"verbose",W);J(d,T,`in ${g}() call`);let A={command:"analyze-metafile",metafile:l};M!==void 0&&(A.color=M),x!==void 0&&(A.verbose=x),$(f,A,(C,R)=>{if(C)return F(new Error(C),null);F(null,R.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 s=(e.stack+"").split(`
3
- `);s.splice(1,1);let c=tt(t,s,r);if(c)return o={text:e.message,location:c},o}catch(s){}}}function Re(e,t,r,o,u){let s="Internal error",c=null;try{s=(e&&e.message||e)+""}catch(i){}try{c=tt(t,(e.stack+"").split(`
4
- `),"")}catch(i){}return{id:"",pluginName:u,text:s,location:c,notes:o?[o]:[],detail:r?r.store(e):-1}}function tt(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 s=t[u];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 i;try{i=e.readFileSync(c[1],"utf8")}catch(P){break}let y=i.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",O=+c[3]-1,N=y.slice(O,O+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:pe(y.slice(0,O)).length,length:pe(y.slice(O,O+N)).length,lineText:y+`
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(`
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
+ `),"")}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
- `),suggestion:""}}break}}return null}function Oe(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,i)=>{if(i===o)return`
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
- error: ${c.text}`;let{file:y,line:O,column:N}=c.location,P=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
9
- ${y}:${O}:${N}: ERROR: ${P}${c.text}`}).join(""),s=new Error(`${e}${u}`);return s.errors=t,s.warnings=r,s}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),s=n(e,r,"line",Se),c=n(e,r,"column",Se),i=n(e,r,"length",Se),y=n(e,r,"lineText",m),O=n(e,r,"suggestion",m);return J(e,r,t),{file:o||"",namespace:u||"",line:s||0,column:c||0,length:i||0,lineText:y||"",suggestion:O||""}}function ve(e,t,r,o){let u=[],s=0;for(let c of e){let i={},y=n(c,i,"id",m),O=n(c,i,"pluginName",m),N=n(c,i,"text",m),P=n(c,i,"location",Je),$=n(c,i,"notes",_),I=n(c,i,"detail",Ce),ne=`in element ${s} of "${t}"`;J(c,i,ne);let se=[];if($)for(let le of $){let te={},oe=n(le,te,"text",m),ae=n(le,te,"location",Je);J(le,te,ne),se.push({text:oe||"",location:Qe(ae,ne)})}u.push({id:y||"",pluginName:O||o,text:N||"",location:Qe(P,ne),notes:se,detail:r?r.store(I):-1}),s++}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(){return r===null&&(r=we(t)),r}}}var St="0.14.49",xt=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),Ct=()=>{throw new Error('The "buildSync" API only works in node')},Pt=()=>{throw new Error('The "transformSync" API only works in node')},At=()=>{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')},Bt=e=>{e=Ge(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=Dt(t||"",r,o),xe.catch(()=>{xe=void 0}),xe},Dt=(e,t,r)=>de(void 0,null,function*(){let o;if(t)o=t;else{let i=yield fetch(e);if(!i.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);o=yield i.arrayBuffer()}let u;if(r){let i=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\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.49"],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(i))}else{let i=(postMessage=>{
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=>{
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.14.49"],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);})(y=>u.onmessage({data:y}));u={onmessage:null,postMessage:y=>setTimeout(()=>i({data:y})),terminate(){}}}u.postMessage(o),u.onmessage=({data:i})=>s(i);let{readFromStdout:s,service:c}=et({writeToStdin(i){u.postMessage(i)},isSync:!1,isWriteUnavailable:!0,esbuild:Be});qe={build:i=>new Promise((y,O)=>c.buildOrServe({callName:"build",refs:null,serveOptions:null,options:i,isTTY:!1,defaultWD:"/",callback:(N,P)=>N?O(N):y(P)})),transform:(i,y)=>new Promise((O,N)=>c.transform({callName:"transform",refs:null,input:i,options:y||{},isTTY:!1,fs:{readFile(P,$){$(new Error("Internal error"),null)},writeFile(P,$){$(null)}},callback:(P,$)=>P?N(P):O($)})),formatMessages:(i,y)=>new Promise((O,N)=>c.formatMessages({callName:"formatMessages",refs:null,messages:i,options:y,callback:(P,$)=>P?N(P):O($)})),analyzeMetafile:(i,y)=>new Promise((O,N)=>c.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof i=="string"?i:JSON.stringify(i),options:y,callback:(P,$)=>P?N(P):O($)}))}}),Nt=Be;
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.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);})(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}});