From 708ac6e1161a4efe7fb679136af60bb510c8daf9 Mon Sep 17 00:00:00 2001 From: coomdev Date: Sat, 6 Aug 2022 14:08:17 +0200 Subject: [PATCH] Offload extraction to WebWorker --- README.md | 2 +- build-chrome.js | 18 + build-ff.js | 38 +- build.js | 23 +- chrome/dist/background.js | 23 +- chrome/dist/main.js | 16473 ++++++------------------------ chrome/manifest.json | 2 +- dist/main.js | 16432 ++++++----------------------- firefox/dist/background.js | 23 +- firefox/dist/main.js | 16473 ++++++------------------------ firefox/manifest.json | 2 +- firefox_update.json | 2 +- main.d.ts | 2 +- main.meta.js | 2 +- main.user.js | 16434 ++++++----------------------- src/Components/Embedding.svelte | 4 +- src/Components/EyeButton.svelte | 2 +- src/bitstream.ts | 4 - src/jpg.ts | 6 +- src/main.ts | 534 +- src/platform.ts | 43 +- src/pngv3.ts | 31 +- src/pomf.ts | 15 +- src/processor.worker.ts | 215 +- src/stores.ts | 6 + src/thirdeye.ts | 11 +- src/utils.ts | 30 +- src/webm.ts | 2 +- src/websites/index.ts | 6 +- 29 files changed, 13262 insertions(+), 53596 deletions(-) diff --git a/README.md b/README.md index 13c3372..8ab87e2 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Please report any issue you have with those (only for mainstream browsers) Also, use this if you plan to use b4k's archive. - [Install 4chanX (recommended)](https://www.4chan-x.net/builds/4chan-X.user.js) -- Install the correct WebExtension for your Browser ([Firefox](https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.291.xpi) or Chrome-based (Down for "maintainance")) +- Install the correct WebExtension for your Browser ([Firefox](https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.292.xpi) or Chrome-based (Down for "maintainance")) For FF users, the extension is signed so you can just drag and drop it on your about:addons tab. diff --git a/build-chrome.js b/build-chrome.js index 1bac9c9..b6249a5 100644 --- a/build-chrome.js +++ b/build-chrome.js @@ -95,6 +95,24 @@ const manif3 = { esbuildSvelte({ compilerOptions: { css: true, accessors: true }, preprocess: sveltePreprocess(), + }), + inlineWorkerPlugin({ + minify: false, + bundle: true, + treeShaking: true, + target: "es2021", + loader: { + '.css': 'text', + '.png': 'binary' + }, + define: { + global: 'self', + execution_mode: '"worker"', + manifest: lmanif.version, + isBackground: 'false', + BUILD_VERSION: JSON.stringify([0, rev]) + }, + inject: ['./esbuild.inject.js'], }) ], loader: { diff --git a/build-ff.js b/build-ff.js index f15a5d7..5d07f49 100644 --- a/build-ff.js +++ b/build-ff.js @@ -2,6 +2,7 @@ import { spawnSync } from 'child_process'; import { writeFileSync, readFileSync, copyFileSync } from 'fs' +import inlineWorkerPlugin from 'esbuild-plugin-inline-worker'; import esbuild from "esbuild"; import esbuildSvelte from "esbuild-svelte"; @@ -83,14 +84,14 @@ const manif = { ], "web_accessible_resources": ["*.html", "*.js",], -// "background": { -// persistent: true, -// "scripts": [ -// "polyfill.min.js", -// "browser-polyfill.min.js", -// "dist/background.js" -// ] -// } + // "background": { + // persistent: true, + // "scripts": [ + // "polyfill.min.js", + // "browser-polyfill.min.js", + // "dist/background.js" + // ] + // } }; (async () => { @@ -114,8 +115,25 @@ const manif = { esbuildSvelte({ compilerOptions: { css: true, accessors: true }, preprocess: sveltePreprocess(), - }) - ], + }), + inlineWorkerPlugin({ + minify: false, + bundle: true, + treeShaking: true, + target: "es2021", + loader: { + '.css': 'text', + '.png': 'binary' + }, + define: { + global: 'self', + execution_mode: '"worker"', + manifest: manif.version, + isBackground: 'false', + BUILD_VERSION: JSON.stringify([0, rev]) + }, + inject: ['./esbuild.inject.js'], + })], loader: { '.css': 'text', '.png': 'binary' diff --git a/build.js b/build.js index c63f5a4..32884ad 100644 --- a/build.js +++ b/build.js @@ -2,6 +2,7 @@ import { spawnSync } from 'child_process'; import { writeFileSync, readFileSync } from 'fs' +import inlineWorkerPlugin from 'esbuild-plugin-inline-worker'; import esbuild from "esbuild"; import esbuildSvelte from "esbuild-svelte"; @@ -23,7 +24,7 @@ let rev = +res.stdout; define: { global: 'window', execution_mode: JSON.stringify(process.argv[2] || 'userscript'), - isBackground: JSON.stringify('false'), + isBackground: 'false', BUILD_VERSION: JSON.stringify([0, rev]) }, inject: ['./esbuild.inject.js'], @@ -31,8 +32,24 @@ let rev = +res.stdout; esbuildSvelte({ compilerOptions: { css: true, accessors: true }, preprocess: sveltePreprocess(), - }) - ], + }), + inlineWorkerPlugin({ + minify: false, + bundle: true, + treeShaking: true, + target: "es2021", + loader: { + '.css': 'text', + '.png': 'binary' + }, + define: { + global: 'self', + execution_mode: '"worker"', + isBackground: 'false', + BUILD_VERSION: JSON.stringify([0, rev]) + }, + inject: ['./esbuild.inject.js'], + })], loader: { '.css': 'text', '.png': 'binary' diff --git a/chrome/dist/background.js b/chrome/dist/background.js index 0b4e333..6e8f120 100644 --- a/chrome/dist/background.js +++ b/chrome/dist/background.js @@ -1876,9 +1876,12 @@ var lqueue = {}; var localLoad = (key, def) => "__pee__" + key in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key)) : def; var localSet = (key, value) => localStorage.setItem("__pee__" + key, JSON.stringify(value)); - var { port1, port2 } = new MessageChannel(); + var port1; console.log("chrome_api", true); if (false) { + const nmc = new MessageChannel(); + port1 = nmc.port1; + port2 = nmc.port2; const iframe = document.createElement("iframe"); iframe.style.display = "none"; iframe.name = location.origin; @@ -1886,7 +1889,6 @@ iframe.onload = _; }); iframe.src = `${chrome.runtime.getURL("")}options.html`; - const meself2 = new URL(chrome.runtime.getURL("")).origin; document.documentElement.appendChild(iframe); iframeloaded.then(() => { iframe.contentWindow?.postMessage("", "*", [port2]); @@ -1895,12 +1897,27 @@ lqueue[ev.data.id](ev.data); }; } + console.log("chrome_api"); + if (false) { + port1 = { + onmessage(ev) { + lqueue[ev.data.id](ev.data); + }, + postMessage(msg, tr) { + postMessage({ + type: "ipc", + tr, + msg + }, tr); + } + }; + } var gid = 0; var sendCmd = (cmd, tr) => { const prom = new Promise((_) => { const id = gid++; lqueue[id] = (e) => { - _(e.res); + _(e); delete lqueue[id]; }; port1.postMessage({ id, ...cmd }, tr || []); diff --git a/chrome/dist/main.js b/chrome/dist/main.js index f297726..dfe9b8b 100644 --- a/chrome/dist/main.js +++ b/chrome/dist/main.js @@ -73,7 +73,7 @@ var define_BUILD_VERSION_default; var init_define_BUILD_VERSION = __esm({ ""() { - define_BUILD_VERSION_default = [0, 291]; + define_BUILD_VERSION_default = [0, 292]; } }); @@ -271,13 +271,13 @@ var base64 = require_base64_js(); var ieee7542 = require_ieee754(); var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer18; + exports.Buffer = Buffer14; exports.SlowBuffer = SlowBuffer; exports.INSPECT_MAX_BYTES = 50; var K_MAX_LENGTH = 2147483647; exports.kMaxLength = K_MAX_LENGTH; - Buffer18.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer18.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { + Buffer14.TYPED_ARRAY_SUPPORT = typedArraySupport(); + if (!Buffer14.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); } function typedArraySupport() { @@ -293,18 +293,18 @@ return false; } } - Object.defineProperty(Buffer18.prototype, "parent", { + Object.defineProperty(Buffer14.prototype, "parent", { enumerable: true, get: function() { - if (!Buffer18.isBuffer(this)) + if (!Buffer14.isBuffer(this)) return void 0; return this.buffer; } }); - Object.defineProperty(Buffer18.prototype, "offset", { + Object.defineProperty(Buffer14.prototype, "offset", { enumerable: true, get: function() { - if (!Buffer18.isBuffer(this)) + if (!Buffer14.isBuffer(this)) return void 0; return this.byteOffset; } @@ -314,10 +314,10 @@ throw new RangeError('The value "' + length + '" is invalid for option "size"'); } const buf2 = new Uint8Array(length); - Object.setPrototypeOf(buf2, Buffer18.prototype); + Object.setPrototypeOf(buf2, Buffer14.prototype); return buf2; } - function Buffer18(arg, encodingOrOffset, length) { + function Buffer14(arg, encodingOrOffset, length) { if (typeof arg === "number") { if (typeof encodingOrOffset === "string") { throw new TypeError('The "string" argument must be of type string. Received type number'); @@ -326,7 +326,7 @@ } return from(arg, encodingOrOffset, length); } - Buffer18.poolSize = 8192; + Buffer14.poolSize = 8192; function from(value, encodingOrOffset, length) { if (typeof value === "string") { return fromString(value, encodingOrOffset); @@ -348,21 +348,21 @@ } const valueOf = value.valueOf && value.valueOf(); if (valueOf != null && valueOf !== value) { - return Buffer18.from(valueOf, encodingOrOffset, length); + return Buffer14.from(valueOf, encodingOrOffset, length); } const b = fromObject(value); if (b) return b; if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer18.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); + return Buffer14.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); } throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); } - Buffer18.from = function(value, encodingOrOffset, length) { + Buffer14.from = function(value, encodingOrOffset, length) { return from(value, encodingOrOffset, length); }; - Object.setPrototypeOf(Buffer18.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer18, Uint8Array); + Object.setPrototypeOf(Buffer14.prototype, Uint8Array.prototype); + Object.setPrototypeOf(Buffer14, Uint8Array); function assertSize(size) { if (typeof size !== "number") { throw new TypeError('"size" argument must be of type number'); @@ -380,24 +380,24 @@ } return createBuffer(size); } - Buffer18.alloc = function(size, fill, encoding) { + Buffer14.alloc = function(size, fill, encoding) { return alloc(size, fill, encoding); }; function allocUnsafe(size) { assertSize(size); return createBuffer(size < 0 ? 0 : checked(size) | 0); } - Buffer18.allocUnsafe = function(size) { + Buffer14.allocUnsafe = function(size) { return allocUnsafe(size); }; - Buffer18.allocUnsafeSlow = function(size) { + Buffer14.allocUnsafeSlow = function(size) { return allocUnsafe(size); }; function fromString(string, encoding) { if (typeof encoding !== "string" || encoding === "") { encoding = "utf8"; } - if (!Buffer18.isEncoding(encoding)) { + if (!Buffer14.isEncoding(encoding)) { throw new TypeError("Unknown encoding: " + encoding); } const length = byteLength(string, encoding) | 0; @@ -438,11 +438,11 @@ } else { buf2 = new Uint8Array(array, byteOffset, length); } - Object.setPrototypeOf(buf2, Buffer18.prototype); + Object.setPrototypeOf(buf2, Buffer14.prototype); return buf2; } function fromObject(obj) { - if (Buffer18.isBuffer(obj)) { + if (Buffer14.isBuffer(obj)) { const len = checked(obj.length) | 0; const buf2 = createBuffer(len); if (buf2.length === 0) { @@ -471,17 +471,17 @@ if (+length != length) { length = 0; } - return Buffer18.alloc(+length); + return Buffer14.alloc(+length); } - Buffer18.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer18.prototype; + Buffer14.isBuffer = function isBuffer(b) { + return b != null && b._isBuffer === true && b !== Buffer14.prototype; }; - Buffer18.compare = function compare(a, b) { + Buffer14.compare = function compare(a, b) { if (isInstance(a, Uint8Array)) - a = Buffer18.from(a, a.offset, a.byteLength); + a = Buffer14.from(a, a.offset, a.byteLength); if (isInstance(b, Uint8Array)) - b = Buffer18.from(b, b.offset, b.byteLength); - if (!Buffer18.isBuffer(a) || !Buffer18.isBuffer(b)) { + b = Buffer14.from(b, b.offset, b.byteLength); + if (!Buffer14.isBuffer(a) || !Buffer14.isBuffer(b)) { throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); } if (a === b) @@ -501,7 +501,7 @@ return 1; return 0; }; - Buffer18.isEncoding = function isEncoding(encoding) { + Buffer14.isEncoding = function isEncoding(encoding) { switch (String(encoding).toLowerCase()) { case "hex": case "utf8": @@ -519,12 +519,12 @@ return false; } }; - Buffer18.concat = function concat(list, length) { + Buffer14.concat = function concat(list, length) { if (!Array.isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers'); } if (list.length === 0) { - return Buffer18.alloc(0); + return Buffer14.alloc(0); } let i; if (length === void 0) { @@ -533,19 +533,19 @@ length += list[i].length; } } - const buffer = Buffer18.allocUnsafe(length); + const buffer = Buffer14.allocUnsafe(length); let pos = 0; for (i = 0; i < list.length; ++i) { let buf2 = list[i]; if (isInstance(buf2, Uint8Array)) { if (pos + buf2.length > buffer.length) { - if (!Buffer18.isBuffer(buf2)) - buf2 = Buffer18.from(buf2); + if (!Buffer14.isBuffer(buf2)) + buf2 = Buffer14.from(buf2); buf2.copy(buffer, pos); } else { Uint8Array.prototype.set.call(buffer, buf2, pos); } - } else if (!Buffer18.isBuffer(buf2)) { + } else if (!Buffer14.isBuffer(buf2)) { throw new TypeError('"list" argument must be an Array of Buffers'); } else { buf2.copy(buffer, pos); @@ -555,7 +555,7 @@ return buffer; }; function byteLength(string, encoding) { - if (Buffer18.isBuffer(string)) { + if (Buffer14.isBuffer(string)) { return string.length; } if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { @@ -596,7 +596,7 @@ } } } - Buffer18.byteLength = byteLength; + Buffer14.byteLength = byteLength; function slowToString(encoding, start, end) { let loweredCase = false; if (start === void 0 || start < 0) { @@ -645,13 +645,13 @@ } } } - Buffer18.prototype._isBuffer = true; + Buffer14.prototype._isBuffer = true; function swap(b, n, m) { const i = b[n]; b[n] = b[m]; b[m] = i; } - Buffer18.prototype.swap16 = function swap16() { + Buffer14.prototype.swap16 = function swap16() { const len = this.length; if (len % 2 !== 0) { throw new RangeError("Buffer size must be a multiple of 16-bits"); @@ -661,7 +661,7 @@ } return this; }; - Buffer18.prototype.swap32 = function swap32() { + Buffer14.prototype.swap32 = function swap32() { const len = this.length; if (len % 4 !== 0) { throw new RangeError("Buffer size must be a multiple of 32-bits"); @@ -672,7 +672,7 @@ } return this; }; - Buffer18.prototype.swap64 = function swap64() { + Buffer14.prototype.swap64 = function swap64() { const len = this.length; if (len % 8 !== 0) { throw new RangeError("Buffer size must be a multiple of 64-bits"); @@ -685,7 +685,7 @@ } return this; }; - Buffer18.prototype.toString = function toString2() { + Buffer14.prototype.toString = function toString2() { const length = this.length; if (length === 0) return ""; @@ -693,15 +693,15 @@ return utf8Slice(this, 0, length); return slowToString.apply(this, arguments); }; - Buffer18.prototype.toLocaleString = Buffer18.prototype.toString; - Buffer18.prototype.equals = function equals(b) { - if (!Buffer18.isBuffer(b)) + Buffer14.prototype.toLocaleString = Buffer14.prototype.toString; + Buffer14.prototype.equals = function equals(b) { + if (!Buffer14.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); if (this === b) return true; - return Buffer18.compare(this, b) === 0; + return Buffer14.compare(this, b) === 0; }; - Buffer18.prototype.inspect = function inspect() { + Buffer14.prototype.inspect = function inspect() { let str = ""; const max = exports.INSPECT_MAX_BYTES; str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); @@ -710,13 +710,13 @@ return ""; }; if (customInspectSymbol) { - Buffer18.prototype[customInspectSymbol] = Buffer18.prototype.inspect; + Buffer14.prototype[customInspectSymbol] = Buffer14.prototype.inspect; } - Buffer18.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { + Buffer14.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { if (isInstance(target, Uint8Array)) { - target = Buffer18.from(target, target.offset, target.byteLength); + target = Buffer14.from(target, target.offset, target.byteLength); } - if (!Buffer18.isBuffer(target)) { + if (!Buffer14.isBuffer(target)) { throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); } if (start === void 0) { @@ -796,9 +796,9 @@ return -1; } if (typeof val === "string") { - val = Buffer18.from(val, encoding); + val = Buffer14.from(val, encoding); } - if (Buffer18.isBuffer(val)) { + if (Buffer14.isBuffer(val)) { if (val.length === 0) { return -1; } @@ -871,13 +871,13 @@ } return -1; } - Buffer18.prototype.includes = function includes(val, byteOffset, encoding) { + Buffer14.prototype.includes = function includes(val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1; }; - Buffer18.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + Buffer14.prototype.indexOf = function indexOf(val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true); }; - Buffer18.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + Buffer14.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false); }; function hexWrite(buf2, string, offset, length) { @@ -916,7 +916,7 @@ function ucs2Write(buf2, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length); } - Buffer18.prototype.write = function write2(string, offset, length, encoding) { + Buffer14.prototype.write = function write2(string, offset, length, encoding) { if (offset === void 0) { encoding = "utf8"; length = this.length; @@ -973,7 +973,7 @@ } } }; - Buffer18.prototype.toJSON = function toJSON() { + Buffer14.prototype.toJSON = function toJSON() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) @@ -1095,7 +1095,7 @@ } return res; } - Buffer18.prototype.slice = function slice(start, end) { + Buffer14.prototype.slice = function slice(start, end) { const len = this.length; start = ~~start; end = end === void 0 ? len : ~~end; @@ -1116,7 +1116,7 @@ if (end < start) end = start; const newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer18.prototype); + Object.setPrototypeOf(newBuf, Buffer14.prototype); return newBuf; }; function checkOffset(offset, ext, length) { @@ -1125,7 +1125,7 @@ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length"); } - Buffer18.prototype.readUintLE = Buffer18.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { + Buffer14.prototype.readUintLE = Buffer14.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1138,7 +1138,7 @@ } return val; }; - Buffer18.prototype.readUintBE = Buffer18.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { + Buffer14.prototype.readUintBE = Buffer14.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) { @@ -1151,37 +1151,37 @@ } return val; }; - Buffer18.prototype.readUint8 = Buffer18.prototype.readUInt8 = function readUInt8(offset, noAssert) { + Buffer14.prototype.readUint8 = Buffer14.prototype.readUInt8 = function readUInt8(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 1, this.length); return this[offset]; }; - Buffer18.prototype.readUint16LE = Buffer18.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + Buffer14.prototype.readUint16LE = Buffer14.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] | this[offset + 1] << 8; }; - Buffer18.prototype.readUint16BE = Buffer18.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + Buffer14.prototype.readUint16BE = Buffer14.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] << 8 | this[offset + 1]; }; - Buffer18.prototype.readUint32LE = Buffer18.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + Buffer14.prototype.readUint32LE = Buffer14.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; }; - Buffer18.prototype.readUint32BE = Buffer18.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + Buffer14.prototype.readUint32BE = Buffer14.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); }; - Buffer18.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { + Buffer14.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1193,7 +1193,7 @@ const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24; return BigInt(lo) + (BigInt(hi) << BigInt(32)); }); - Buffer18.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { + Buffer14.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1205,7 +1205,7 @@ const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last; return (BigInt(hi) << BigInt(32)) + BigInt(lo); }); - Buffer18.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { + Buffer14.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1221,7 +1221,7 @@ val -= Math.pow(2, 8 * byteLength2); return val; }; - Buffer18.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { + Buffer14.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1237,7 +1237,7 @@ val -= Math.pow(2, 8 * byteLength2); return val; }; - Buffer18.prototype.readInt8 = function readInt8(offset, noAssert) { + Buffer14.prototype.readInt8 = function readInt8(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 1, this.length); @@ -1245,33 +1245,33 @@ return this[offset]; return (255 - this[offset] + 1) * -1; }; - Buffer18.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + Buffer14.prototype.readInt16LE = function readInt16LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); const val = this[offset] | this[offset + 1] << 8; return val & 32768 ? val | 4294901760 : val; }; - Buffer18.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + Buffer14.prototype.readInt16BE = function readInt16BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); const val = this[offset + 1] | this[offset] << 8; return val & 32768 ? val | 4294901760 : val; }; - Buffer18.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + Buffer14.prototype.readInt32LE = function readInt32LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; }; - Buffer18.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + Buffer14.prototype.readInt32BE = function readInt32BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; }; - Buffer18.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { + Buffer14.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1282,7 +1282,7 @@ const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24); return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); }); - Buffer18.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { + Buffer14.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1293,39 +1293,39 @@ const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset]; return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last); }); - Buffer18.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + Buffer14.prototype.readFloatLE = function readFloatLE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return ieee7542.read(this, offset, true, 23, 4); }; - Buffer18.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + Buffer14.prototype.readFloatBE = function readFloatBE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return ieee7542.read(this, offset, false, 23, 4); }; - Buffer18.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + Buffer14.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 8, this.length); return ieee7542.read(this, offset, true, 52, 8); }; - Buffer18.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + Buffer14.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 8, this.length); return ieee7542.read(this, offset, false, 52, 8); }; function checkInt(buf2, value, offset, ext, max, min) { - if (!Buffer18.isBuffer(buf2)) + if (!Buffer14.isBuffer(buf2)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); if (offset + ext > buf2.length) throw new RangeError("Index out of range"); } - Buffer18.prototype.writeUintLE = Buffer18.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeUintLE = Buffer14.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; @@ -1341,7 +1341,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeUintBE = Buffer18.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeUintBE = Buffer14.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; @@ -1357,7 +1357,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeUint8 = Buffer18.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + Buffer14.prototype.writeUint8 = Buffer14.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1365,7 +1365,7 @@ this[offset] = value & 255; return offset + 1; }; - Buffer18.prototype.writeUint16LE = Buffer18.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { + Buffer14.prototype.writeUint16LE = Buffer14.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1374,7 +1374,7 @@ this[offset + 1] = value >>> 8; return offset + 2; }; - Buffer18.prototype.writeUint16BE = Buffer18.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { + Buffer14.prototype.writeUint16BE = Buffer14.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1383,7 +1383,7 @@ this[offset + 1] = value & 255; return offset + 2; }; - Buffer18.prototype.writeUint32LE = Buffer18.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { + Buffer14.prototype.writeUint32LE = Buffer14.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1394,7 +1394,7 @@ this[offset] = value & 255; return offset + 4; }; - Buffer18.prototype.writeUint32BE = Buffer18.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { + Buffer14.prototype.writeUint32BE = Buffer14.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1445,13 +1445,13 @@ buf2[offset] = hi; return offset + 8; } - Buffer18.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { + Buffer14.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); }); - Buffer18.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { + Buffer14.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); }); - Buffer18.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) { @@ -1470,7 +1470,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) { @@ -1489,7 +1489,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + Buffer14.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1499,7 +1499,7 @@ this[offset] = value & 255; return offset + 1; }; - Buffer18.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + Buffer14.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1508,7 +1508,7 @@ this[offset + 1] = value >>> 8; return offset + 2; }; - Buffer18.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + Buffer14.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1517,7 +1517,7 @@ this[offset + 1] = value & 255; return offset + 2; }; - Buffer18.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + Buffer14.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1528,7 +1528,7 @@ this[offset + 3] = value >>> 24; return offset + 4; }; - Buffer18.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + Buffer14.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1541,10 +1541,10 @@ this[offset + 3] = value & 255; return offset + 4; }; - Buffer18.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { + Buffer14.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); }); - Buffer18.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { + Buffer14.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); }); function checkIEEE754(buf2, value, offset, ext, max, min) { @@ -1562,10 +1562,10 @@ ieee7542.write(buf2, value, offset, littleEndian, 23, 4); return offset + 4; } - Buffer18.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + Buffer14.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert); }; - Buffer18.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + Buffer14.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert); }; function writeDouble(buf2, value, offset, littleEndian, noAssert) { @@ -1577,14 +1577,14 @@ ieee7542.write(buf2, value, offset, littleEndian, 52, 8); return offset + 8; } - Buffer18.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { + Buffer14.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert); }; - Buffer18.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { + Buffer14.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert); }; - Buffer18.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer18.isBuffer(target)) + Buffer14.prototype.copy = function copy(target, targetStart, start, end) { + if (!Buffer14.isBuffer(target)) throw new TypeError("argument should be a Buffer"); if (!start) start = 0; @@ -1620,7 +1620,7 @@ } return len; }; - Buffer18.prototype.fill = function fill(val, start, end, encoding) { + Buffer14.prototype.fill = function fill(val, start, end, encoding) { if (typeof val === "string") { if (typeof start === "string") { encoding = start; @@ -1633,7 +1633,7 @@ if (encoding !== void 0 && typeof encoding !== "string") { throw new TypeError("encoding must be a string"); } - if (typeof encoding === "string" && !Buffer18.isEncoding(encoding)) { + if (typeof encoding === "string" && !Buffer14.isEncoding(encoding)) { throw new TypeError("Unknown encoding: " + encoding); } if (val.length === 1) { @@ -1663,7 +1663,7 @@ this[i] = val; } } else { - const bytes = Buffer18.isBuffer(val) ? val : Buffer18.from(val, encoding); + const bytes = Buffer14.isBuffer(val) ? val : Buffer14.from(val, encoding); const len = bytes.length; if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"'); @@ -1910,6 +1910,119 @@ } }); + // node_modules/crc-32/crc32.js + var require_crc32 = __commonJS({ + "node_modules/crc-32/crc32.js"(exports) { + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var CRC32; + (function(factory) { + if (typeof DO_NOT_EXPORT_CRC === "undefined") { + if (typeof exports === "object") { + factory(exports); + } else if (typeof define === "function" && define.amd) { + define(function() { + var module2 = {}; + factory(module2); + return module2; + }); + } else { + factory(CRC32 = {}); + } + } else { + factory(CRC32 = {}); + } + })(function(CRC322) { + CRC322.version = "1.2.0"; + function signed_crc_table() { + var c = 0, table = new Array(256); + for (var n = 0; n != 256; ++n) { + c = n; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + table[n] = c; + } + return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; + } + var T = signed_crc_table(); + function crc32_bstr(bstr, seed) { + var C = seed ^ -1, L = bstr.length - 1; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; + } + if (i === L) + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255]; + return C ^ -1; + } + function crc32_buf(buf2, seed) { + if (buf2.length > 1e4) + return crc32_buf_8(buf2, seed); + var C = seed ^ -1, L = buf2.length - 3; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + } + while (i < L + 3) + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + return C ^ -1; + } + function crc32_buf_8(buf2, seed) { + var C = seed ^ -1, L = buf2.length - 7; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + } + while (i < L + 7) + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + return C ^ -1; + } + function crc32_str(str, seed) { + var C = seed ^ -1; + for (var i = 0, L = str.length, c, d; i < L; ) { + c = str.charCodeAt(i++); + if (c < 128) { + C = C >>> 8 ^ T[(C ^ c) & 255]; + } else if (c < 2048) { + C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + } else if (c >= 55296 && c < 57344) { + c = (c & 1023) + 64; + d = str.charCodeAt(i++) & 1023; + C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255]; + } else { + C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + } + } + return C ^ -1; + } + CRC322.table = T; + CRC322.bstr = crc32_bstr; + CRC322.buf = crc32_buf; + CRC322.str = crc32_str; + }); + } + }); + // node_modules/events/events.js var require_events = __commonJS({ "node_modules/events/events.js"(exports, module) { @@ -2280,1472 +2393,501 @@ } }); - // node_modules/browser-process/dist/api_error.js - var require_api_error = __commonJS({ - "node_modules/browser-process/dist/api_error.js"(exports) { + // node_modules/readable-stream/lib/internal/streams/stream-browser.js + var require_stream_browser = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var Buffer18 = Buffer18; - (function(ErrorCode2) { - ErrorCode2[ErrorCode2["EPERM"] = 0] = "EPERM"; - ErrorCode2[ErrorCode2["ENOENT"] = 1] = "ENOENT"; - ErrorCode2[ErrorCode2["EIO"] = 2] = "EIO"; - ErrorCode2[ErrorCode2["EBADF"] = 3] = "EBADF"; - ErrorCode2[ErrorCode2["EACCES"] = 4] = "EACCES"; - ErrorCode2[ErrorCode2["EBUSY"] = 5] = "EBUSY"; - ErrorCode2[ErrorCode2["EEXIST"] = 6] = "EEXIST"; - ErrorCode2[ErrorCode2["ENOTDIR"] = 7] = "ENOTDIR"; - ErrorCode2[ErrorCode2["EISDIR"] = 8] = "EISDIR"; - ErrorCode2[ErrorCode2["EINVAL"] = 9] = "EINVAL"; - ErrorCode2[ErrorCode2["EFBIG"] = 10] = "EFBIG"; - ErrorCode2[ErrorCode2["ENOSPC"] = 11] = "ENOSPC"; - ErrorCode2[ErrorCode2["EROFS"] = 12] = "EROFS"; - ErrorCode2[ErrorCode2["ENOTEMPTY"] = 13] = "ENOTEMPTY"; - ErrorCode2[ErrorCode2["ENOTSUP"] = 14] = "ENOTSUP"; - })(exports.ErrorCode || (exports.ErrorCode = {})); - var ErrorCode = exports.ErrorCode; - var ErrorStrings = {}; - ErrorStrings[ErrorCode.EPERM] = "Operation not permitted."; - ErrorStrings[ErrorCode.ENOENT] = "No such file or directory."; - ErrorStrings[ErrorCode.EIO] = "Input/output error."; - ErrorStrings[ErrorCode.EBADF] = "Bad file descriptor."; - ErrorStrings[ErrorCode.EACCES] = "Permission denied."; - ErrorStrings[ErrorCode.EBUSY] = "Resource busy or locked."; - ErrorStrings[ErrorCode.EEXIST] = "File exists."; - ErrorStrings[ErrorCode.ENOTDIR] = "File is not a directory."; - ErrorStrings[ErrorCode.EISDIR] = "File is a directory."; - ErrorStrings[ErrorCode.EINVAL] = "Invalid argument."; - ErrorStrings[ErrorCode.EFBIG] = "File is too big."; - ErrorStrings[ErrorCode.ENOSPC] = "No space left on disk."; - ErrorStrings[ErrorCode.EROFS] = "Cannot modify a read-only file system."; - ErrorStrings[ErrorCode.ENOTEMPTY] = "Directory is not empty."; - ErrorStrings[ErrorCode.ENOTSUP] = "Operation is not supported."; - var ApiError = function() { - function ApiError2(type, message) { - this.type = type; - this.code = ErrorCode[type]; - if (message != null) { - this.message = message; - } else { - this.message = ErrorStrings[type]; - } - } - ApiError2.prototype.toString = function() { - return this.code + ": " + ErrorStrings[this.type] + " " + this.message; - }; - ApiError2.prototype.writeToBuffer = function(buffer, i) { - if (buffer === void 0) { - buffer = new Buffer18(this.bufferSize()); - } - if (i === void 0) { - i = 0; - } - buffer.writeUInt8(this.type, i); - var bytesWritten = buffer.write(this.message, i + 5); - buffer.writeUInt32LE(bytesWritten, i + 1); - return buffer; - }; - ApiError2.fromBuffer = function(buffer, i) { - if (i === void 0) { - i = 0; - } - return new ApiError2(buffer.readUInt8(i), buffer.toString("utf8", i + 5, i + 5 + buffer.readUInt32LE(i + 1))); - }; - ApiError2.prototype.bufferSize = function() { - return 5 + Buffer18.byteLength(this.message); - }; - ApiError2.FileError = function(code, p) { - return new ApiError2(code, p + ": " + ErrorStrings[code]); - }; - ApiError2.ENOENT = function(path) { - return this.FileError(ErrorCode.ENOENT, path); - }; - ApiError2.EEXIST = function(path) { - return this.FileError(ErrorCode.EEXIST, path); - }; - ApiError2.EISDIR = function(path) { - return this.FileError(ErrorCode.EISDIR, path); - }; - ApiError2.ENOTDIR = function(path) { - return this.FileError(ErrorCode.ENOTDIR, path); - }; - ApiError2.EPERM = function(path) { - return this.FileError(ErrorCode.EPERM, path); - }; - return ApiError2; - }(); - exports.ApiError = ApiError; + module.exports = require_events().EventEmitter; } }); - // node_modules/browser-process/dist/node_eventemitter.js - var require_node_eventemitter = __commonJS({ - "node_modules/browser-process/dist/node_eventemitter.js"(exports) { + // (disabled):node_modules/util/util.js + var require_util = __commonJS({ + "(disabled):node_modules/util/util.js"() { init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports.__extends || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - function __() { - this.constructor = d; - } - __.prototype = b.prototype; - d.prototype = new __(); - }; - var events = require_events(); - var api_error = require_api_error(); - var ApiError = api_error.ApiError; - var ErrorCode = api_error.ErrorCode; - var BufferedEvent = function() { - function BufferedEvent2(data, encoding, cb) { - this.data = data; - this.encoding = encoding; - this.cb = cb; - this.size = typeof data !== "string" ? data.length : Buffer2.byteLength(data, encoding != null ? encoding : void 0); - if (typeof this.data !== "string") { - this.data = typeof this.data.sliceCopy !== "undefined" ? this.data.sliceCopy() : Buffer2.concat([this.data]); - } - } - BufferedEvent2.prototype.getData = function(encoding) { - if (encoding == null) { - if (typeof this.data === "string") { - return new Buffer2(this.data, this.encoding != null ? this.encoding : void 0); - } else { - return this.data; - } - } else { - if (typeof this.data === "string") { - if (encoding === this.encoding) { - return this.data; - } else { - return new Buffer2(this.data, this.encoding != null ? this.encoding : void 0).toString(encoding); - } - } else { - return this.data.toString(encoding); - } - } - }; - return BufferedEvent2; - }(); - var AbstractDuplexStream = function(_super) { - __extends(AbstractDuplexStream2, _super); - function AbstractDuplexStream2(writable2, readable) { - _super.call(this); - this.writable = writable2; - this.readable = readable; - this.encoding = null; - this.flowing = false; - this.buffer = []; - this.endEvent = null; - this.ended = false; - this.drained = true; - } - AbstractDuplexStream2.prototype.addListener = function(event, listener) { - var rv = _super.prototype.addListener.call(this, event, listener), _this = this; - if (event === "data" && !this.flowing) { - this.resume(); - } else if (event === "readable" && this.buffer.length > 0) { - setTimeout(function() { - _this.emit("readable"); - }, 0); - } - return rv; - }; - AbstractDuplexStream2.prototype._processArgs = function(data, arg2, arg3) { - if (typeof arg2 === "string") { - return new BufferedEvent(data, arg2, arg3); - } else { - return new BufferedEvent(data, null, arg2); - } - }; - AbstractDuplexStream2.prototype._processEvents = function() { - var drained = this.buffer.length === 0; - if (this.drained !== drained) { - if (this.drained) { - this.emit("readable"); - } - } - if (this.flowing && this.buffer.length !== 0) { - this.emit("data", this.read()); - } - this.drained = this.buffer.length === 0; - }; - AbstractDuplexStream2.prototype.emitEvent = function(type, event) { - this.emit(type, event.getData(this.encoding)); - if (event.cb) { - event.cb(); - } - }; - AbstractDuplexStream2.prototype.write = function(data, arg2, arg3) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Cannot write to an ended stream."); - } - var event = this._processArgs(data, arg2, arg3); - this._push(event); - return this.flowing; - }; - AbstractDuplexStream2.prototype.end = function(data, arg2, arg3) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Stream is already closed."); - } - var event = this._processArgs(data, arg2, arg3); - this.ended = true; - this.endEvent = event; - this._processEvents(); - }; - AbstractDuplexStream2.prototype.read = function(size) { - var events2 = [], eventsCbs = [], lastCb, eventsSize = 0, event, buff, trueSize, i = 0, sizeUnspecified = typeof size !== "number"; - if (sizeUnspecified) - size = 4294967295; - for (i = 0; i < this.buffer.length && eventsSize < size; i++) { - event = this.buffer[i]; - events2.push(event.getData()); - if (event.cb) { - eventsCbs.push(event.cb); - } - eventsSize += event.size; - lastCb = event.cb; - } - if (!sizeUnspecified && eventsSize < size) { - return null; - } - this.buffer = this.buffer.slice(events2.length); - trueSize = eventsSize > size ? size : eventsSize; - buff = Buffer2.concat(events2); - if (eventsSize > size) { - if (lastCb) - eventsCbs.pop(); - this._push(new BufferedEvent(buff.slice(size), null, lastCb)); - } - if (eventsCbs.length > 0) { - setTimeout(function() { - var i2; - for (i2 = 0; i2 < eventsCbs.length; i2++) { - eventsCbs[i2](); - } - }, 0); - } - if (this.ended && this.buffer.length === 0 && this.endEvent !== null) { - var endEvent = this.endEvent, _this = this; - this.endEvent = null; - setTimeout(function() { - _this.emitEvent("end", endEvent); - }, 0); - } - if (events2.length === 0) { - this.emit("_read"); - return null; - } else if (this.encoding === null) { - return buff.slice(0, trueSize); - } else { - return buff.toString(this.encoding, 0, trueSize); - } - }; - AbstractDuplexStream2.prototype.setEncoding = function(encoding) { - this.encoding = encoding; - }; - AbstractDuplexStream2.prototype.pause = function() { - this.flowing = false; - }; - AbstractDuplexStream2.prototype.resume = function() { - this.flowing = true; - this._processEvents(); - }; - AbstractDuplexStream2.prototype.pipe = function(destination, options) { - throw new ApiError(ErrorCode.EPERM, "Unimplemented."); - }; - AbstractDuplexStream2.prototype.unpipe = function(destination) { - }; - AbstractDuplexStream2.prototype.unshift = function(chunk) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Stream has ended."); - } - this.buffer.unshift(new BufferedEvent(chunk, this.encoding)); - this._processEvents(); - }; - AbstractDuplexStream2.prototype._push = function(event) { - this.buffer.push(event); - this._processEvents(); - }; - AbstractDuplexStream2.prototype.wrap = function(stream) { - throw new ApiError(ErrorCode.EPERM, "Unimplemented."); - }; - return AbstractDuplexStream2; - }(events.EventEmitter); - exports.AbstractDuplexStream = AbstractDuplexStream; } }); - // node_modules/has-symbols/shams.js - var require_shams = __commonJS({ - "node_modules/has-symbols/shams.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/buffer_list.js + var require_buffer_list = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - module.exports = function hasSymbols() { - if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { - return false; - } - if (typeof Symbol.iterator === "symbol") { - return true; - } - var obj = {}; - var sym = Symbol("test"); - var symObj = Object(sym); - if (typeof sym === "string") { - return false; - } - if (Object.prototype.toString.call(sym) !== "[object Symbol]") { - return false; - } - if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { - return false; - } - var symVal = 42; - obj[sym] = symVal; - for (sym in obj) { - return false; - } - if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { - return false; + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) + symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); } - if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { - return false; + return keys; + } + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { + ownKeys(Object(source), true).forEach(function(key2) { + _defineProperty(target, key2, source[key2]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function(key2) { + Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); + }); + } } - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { - return false; + return target; + } + function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); + } else { + obj[key2] = value; } - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { - return false; + return obj; + } + function _classCallCheck(instance18, Constructor) { + if (!(instance18 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } - if (typeof Object.getOwnPropertyDescriptor === "function") { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { - return false; - } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); } - return true; - }; - } - }); - - // node_modules/has-tostringtag/shams.js - var require_shams2 = __commonJS({ - "node_modules/has-tostringtag/shams.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var hasSymbols = require_shams(); - module.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; - }; - } - }); - - // node_modules/has-symbols/index.js - var require_has_symbols = __commonJS({ - "node_modules/has-symbols/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var origSymbol = typeof Symbol !== "undefined" && Symbol; - var hasSymbolSham = require_shams(); - module.exports = function hasNativeSymbols() { - if (typeof origSymbol !== "function") { - return false; - } - if (typeof Symbol !== "function") { - return false; - } - if (typeof origSymbol("foo") !== "symbol") { - return false; - } - if (typeof Symbol("bar") !== "symbol") { - return false; + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) + _defineProperties(Constructor.prototype, protoProps); + if (staticProps) + _defineProperties(Constructor, staticProps); + return Constructor; + } + var _require = require_buffer(); + var Buffer14 = _require.Buffer; + var _require2 = require_util(); + var inspect = _require2.inspect; + var custom = inspect && inspect.custom || "inspect"; + function copyBuffer(src, target, offset) { + Buffer14.prototype.copy.call(src, target, offset); + } + module.exports = /* @__PURE__ */ function() { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; } - return hasSymbolSham(); - }; - } - }); - - // node_modules/function-bind/implementation.js - var require_implementation = __commonJS({ - "node_modules/function-bind/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; - var slice = Array.prototype.slice; - var toStr = Object.prototype.toString; - var funcType = "[object Function]"; - module.exports = function bind(that) { - var target = this; - if (typeof target !== "function" || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - var bound; - var binder = function() { - if (this instanceof bound) { - var result = target.apply(this, args.concat(slice.call(arguments))); - if (Object(result) === result) { - return result; + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) + this.tail.next = entry; + else + this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) + this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) + return; + var ret = this.head.data; + if (this.length === 1) + this.head = this.tail = null; + else + this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) + return ""; + var p = this.head; + var ret = "" + p.data; + while (p = p.next) { + ret += s + p.data; } - return this; - } else { - return target.apply(that, args.concat(slice.call(arguments))); + return ret; } - }; - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push("$" + i); - } - bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder); - if (target.prototype) { - var Empty = function Empty2() { - }; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; - } - }); - - // node_modules/function-bind/index.js - var require_function_bind = __commonJS({ - "node_modules/function-bind/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation(); - module.exports = Function.prototype.bind || implementation; - } - }); - - // node_modules/has/src/index.js - var require_src = __commonJS({ - "node_modules/has/src/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var bind = require_function_bind(); - module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); - } - }); - - // node_modules/get-intrinsic/index.js - var require_get_intrinsic = __commonJS({ - "node_modules/get-intrinsic/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var undefined2; - var $SyntaxError = SyntaxError; - var $Function = Function; - var $TypeError = TypeError; - var getEvalledConstructor = function(expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); - } catch (e) { - } - }; - var $gOPD = Object.getOwnPropertyDescriptor; - if ($gOPD) { - try { - $gOPD({}, ""); - } catch (e) { - $gOPD = null; - } - } - var throwTypeError = function() { - throw new $TypeError(); - }; - var ThrowTypeError = $gOPD ? function() { - try { - arguments.callee; - return throwTypeError; - } catch (calleeThrows) { - try { - return $gOPD(arguments, "callee").get; - } catch (gOPDthrows) { - return throwTypeError; + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) + return Buffer14.alloc(0); + var ret = Buffer14.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; } - } - }() : throwTypeError; - var hasSymbols = require_has_symbols()(); - var getProto = Object.getPrototypeOf || function(x) { - return x.__proto__; - }; - var needsEval = {}; - var TypedArray = typeof Uint8Array === "undefined" ? undefined2 : getProto(Uint8Array); - var INTRINSICS = { - "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError, - "%Array%": Array, - "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer, - "%ArrayIteratorPrototype%": hasSymbols ? getProto([][Symbol.iterator]()) : undefined2, - "%AsyncFromSyncIteratorPrototype%": undefined2, - "%AsyncFunction%": needsEval, - "%AsyncGenerator%": needsEval, - "%AsyncGeneratorFunction%": needsEval, - "%AsyncIteratorPrototype%": needsEval, - "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics, - "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt, - "%Boolean%": Boolean, - "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView, - "%Date%": Date, - "%decodeURI%": decodeURI, - "%decodeURIComponent%": decodeURIComponent, - "%encodeURI%": encodeURI, - "%encodeURIComponent%": encodeURIComponent, - "%Error%": Error, - "%eval%": eval, - "%EvalError%": EvalError, - "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array, - "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array, - "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry, - "%Function%": $Function, - "%GeneratorFunction%": needsEval, - "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array, - "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array, - "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array, - "%isFinite%": isFinite, - "%isNaN%": isNaN, - "%IteratorPrototype%": hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined2, - "%JSON%": typeof JSON === "object" ? JSON : undefined2, - "%Map%": typeof Map === "undefined" ? undefined2 : Map, - "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), - "%Math%": Math, - "%Number%": Number, - "%Object%": Object, - "%parseFloat%": parseFloat, - "%parseInt%": parseInt, - "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise, - "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy, - "%RangeError%": RangeError, - "%ReferenceError%": ReferenceError, - "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect, - "%RegExp%": RegExp, - "%Set%": typeof Set === "undefined" ? undefined2 : Set, - "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), - "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer, - "%String%": String, - "%StringIteratorPrototype%": hasSymbols ? getProto(""[Symbol.iterator]()) : undefined2, - "%Symbol%": hasSymbols ? Symbol : undefined2, - "%SyntaxError%": $SyntaxError, - "%ThrowTypeError%": ThrowTypeError, - "%TypedArray%": TypedArray, - "%TypeError%": $TypeError, - "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array, - "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray, - "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array, - "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array, - "%URIError%": URIError, - "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap, - "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef, - "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet - }; - var doEval = function doEval2(name) { - var value; - if (name === "%AsyncFunction%") { - value = getEvalledConstructor("async function () {}"); - } else if (name === "%GeneratorFunction%") { - value = getEvalledConstructor("function* () {}"); - } else if (name === "%AsyncGeneratorFunction%") { - value = getEvalledConstructor("async function* () {}"); - } else if (name === "%AsyncGenerator%") { - var fn = doEval2("%AsyncGeneratorFunction%"); - if (fn) { - value = fn.prototype; - } - } else if (name === "%AsyncIteratorPrototype%") { - var gen = doEval2("%AsyncGenerator%"); - if (gen) { - value = getProto(gen.prototype); - } - } - INTRINSICS[name] = value; - return value; - }; - var LEGACY_ALIASES = { - "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], - "%ArrayPrototype%": ["Array", "prototype"], - "%ArrayProto_entries%": ["Array", "prototype", "entries"], - "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], - "%ArrayProto_keys%": ["Array", "prototype", "keys"], - "%ArrayProto_values%": ["Array", "prototype", "values"], - "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], - "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], - "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], - "%BooleanPrototype%": ["Boolean", "prototype"], - "%DataViewPrototype%": ["DataView", "prototype"], - "%DatePrototype%": ["Date", "prototype"], - "%ErrorPrototype%": ["Error", "prototype"], - "%EvalErrorPrototype%": ["EvalError", "prototype"], - "%Float32ArrayPrototype%": ["Float32Array", "prototype"], - "%Float64ArrayPrototype%": ["Float64Array", "prototype"], - "%FunctionPrototype%": ["Function", "prototype"], - "%Generator%": ["GeneratorFunction", "prototype"], - "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], - "%Int8ArrayPrototype%": ["Int8Array", "prototype"], - "%Int16ArrayPrototype%": ["Int16Array", "prototype"], - "%Int32ArrayPrototype%": ["Int32Array", "prototype"], - "%JSONParse%": ["JSON", "parse"], - "%JSONStringify%": ["JSON", "stringify"], - "%MapPrototype%": ["Map", "prototype"], - "%NumberPrototype%": ["Number", "prototype"], - "%ObjectPrototype%": ["Object", "prototype"], - "%ObjProto_toString%": ["Object", "prototype", "toString"], - "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], - "%PromisePrototype%": ["Promise", "prototype"], - "%PromiseProto_then%": ["Promise", "prototype", "then"], - "%Promise_all%": ["Promise", "all"], - "%Promise_reject%": ["Promise", "reject"], - "%Promise_resolve%": ["Promise", "resolve"], - "%RangeErrorPrototype%": ["RangeError", "prototype"], - "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], - "%RegExpPrototype%": ["RegExp", "prototype"], - "%SetPrototype%": ["Set", "prototype"], - "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], - "%StringPrototype%": ["String", "prototype"], - "%SymbolPrototype%": ["Symbol", "prototype"], - "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], - "%TypedArrayPrototype%": ["TypedArray", "prototype"], - "%TypeErrorPrototype%": ["TypeError", "prototype"], - "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], - "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], - "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], - "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], - "%URIErrorPrototype%": ["URIError", "prototype"], - "%WeakMapPrototype%": ["WeakMap", "prototype"], - "%WeakSetPrototype%": ["WeakSet", "prototype"] - }; - var bind = require_function_bind(); - var hasOwn = require_src(); - var $concat = bind.call(Function.call, Array.prototype.concat); - var $spliceApply = bind.call(Function.apply, Array.prototype.splice); - var $replace = bind.call(Function.call, String.prototype.replace); - var $strSlice = bind.call(Function.call, String.prototype.slice); - var $exec = bind.call(Function.call, RegExp.prototype.exec); - var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; - var reEscapeChar = /\\(\\)?/g; - var stringToPath = function stringToPath2(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === "%" && last !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); - } else if (last === "%" && first !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); - } - var result = []; - $replace(string, rePropName, function(match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; - }); - return result; - }; - var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = "%" + alias[0] + "%"; - } - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + ret = this.shift(); + } else { + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; } - if (typeof value === "undefined" && !allowMissing) { - throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); + }, { + key: "first", + value: function first() { + return this.head.data; } - return { - alias, - name: intrinsicName, - value - }; - } - throw new $SyntaxError("intrinsic " + name + " does not exist!"); - }; - module.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== "string" || name.length === 0) { - throw new $TypeError("intrinsic name must be a non-empty string"); - } - if (arguments.length > 1 && typeof allowMissing !== "boolean") { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - if ($exec(/^%?[^%]*%?$/g, name) === null) { - throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); - } - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; - var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { - throw new $SyntaxError("property names with quotes must have matching quotes"); - } - if (part === "constructor" || !isOwn) { - skipFurtherCaching = true; - } - intrinsicBaseName += "." + part; - intrinsicRealName = "%" + intrinsicBaseName + "%"; - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) + ret += str; + else + ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) + this.head = p.next; + else + this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; } - return void 0; + ++c; } - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - if (isOwn && "get" in desc && !("originalValue" in desc.get)) { - value = desc.get; - } else { - value = value[part]; + this.length -= c; + return ret; + } + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer14.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf2 = p.data; + var nb = n > buf2.length ? buf2.length : n; + buf2.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf2.length) { + ++c; + if (p.next) + this.head = p.next; + else + this.head = this.tail = null; + } else { + this.head = p; + p.data = buf2.slice(nb); + } + break; } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; + ++c; } + this.length -= c; + return ret; } - } - return value; - }; + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + depth: 0, + customInspect: false + })); + } + }]); + return BufferList; + }(); } }); - // node_modules/call-bind/index.js - var require_call_bind = __commonJS({ - "node_modules/call-bind/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var bind = require_function_bind(); - var GetIntrinsic = require_get_intrinsic(); - var $apply = GetIntrinsic("%Function.prototype.apply%"); - var $call = GetIntrinsic("%Function.prototype.call%"); - var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var $max = GetIntrinsic("%Math.max%"); - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - } catch (e) { - $defineProperty = null; - } - } - module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, "length"); - if (desc.configurable) { - $defineProperty(func, "length", { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }); - } - } - return func; - }; - var applyBind = function applyBind2() { - return $reflectApply(bind, $apply, arguments); - }; - if ($defineProperty) { - $defineProperty(module.exports, "apply", { value: applyBind }); - } else { - module.exports.apply = applyBind; - } - } - }); - - // node_modules/call-bind/callBound.js - var require_callBound = __commonJS({ - "node_modules/call-bind/callBound.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var callBind = require_call_bind(); - var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf")); - module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { - return callBind(intrinsic); - } - return intrinsic; - }; - } - }); - - // node_modules/is-arguments/index.js - var require_is_arguments = __commonJS({ - "node_modules/is-arguments/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var hasToStringTag = require_shams2()(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) { - return false; - } - return $toString(value) === "[object Arguments]"; - }; - var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]"; - }; - var supportsStandardArguments = function() { - return isStandardArguments(arguments); - }(); - isStandardArguments.isLegacyArguments = isLegacyArguments; - module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - } - }); - - // node_modules/is-generator-function/index.js - var require_is_generator_function = __commonJS({ - "node_modules/is-generator-function/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/destroy.js + var require_destroy = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var toStr = Object.prototype.toString; - var fnToStr = Function.prototype.toString; - var isFnRegex = /^\s*(?:function)?\*/; - var hasToStringTag = require_shams2()(); - var getProto = Object.getPrototypeOf; - var getGeneratorFunc = function() { - if (!hasToStringTag) { - return false; - } - try { - return Function("return function*() {}")(); - } catch (e) { - } - }; - var GeneratorFunction; - module.exports = function isGeneratorFunction(fn) { - if (typeof fn !== "function") { - return false; + function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; } - if (isFnRegex.test(fnToStr.call(fn))) { - return true; + if (this._readableState) { + this._readableState.destroyed = true; } - if (!hasToStringTag) { - var str = toStr.call(fn); - return str === "[object GeneratorFunction]"; + if (this._writableState) { + this._writableState.destroyed = true; } - if (!getProto) { - return false; + this._destroy(err || null, function(err2) { + if (!cb && err2) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err2); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err2); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err2); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; + } + function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); + } + function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) + return; + if (self._readableState && !self._readableState.emitClose) + return; + self.emit("close"); + } + function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; } - if (typeof GeneratorFunction === "undefined") { - var generatorFunc = getGeneratorFunc(); - GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; } - return getProto(fn) === GeneratorFunction; + } + function emitErrorNT(self, err) { + self.emit("error", err); + } + function errorOrDestroy(stream, err) { + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) + stream.destroy(err); + else + stream.emit("error", err); + } + module.exports = { + destroy, + undestroy, + errorOrDestroy }; } }); - // node_modules/is-callable/index.js - var require_is_callable = __commonJS({ - "node_modules/is-callable/index.js"(exports, module) { + // node_modules/readable-stream/errors-browser.js + var require_errors_browser = __commonJS({ + "node_modules/readable-stream/errors-browser.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var fnToStr = Function.prototype.toString; - var reflectApply = typeof Reflect === "object" && Reflect !== null && Reflect.apply; - var badArrayLike; - var isCallableMarker; - if (typeof reflectApply === "function" && typeof Object.defineProperty === "function") { - try { - badArrayLike = Object.defineProperty({}, "length", { - get: function() { - throw isCallableMarker; - } - }); - isCallableMarker = {}; - reflectApply(function() { - throw 42; - }, null, badArrayLike); - } catch (_) { - if (_ !== isCallableMarker) { - reflectApply = null; - } - } - } else { - reflectApply = null; + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; } - var constructorRegex = /^\s*class\b/; - var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; + var codes = {}; + function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; } - }; - var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { - return false; + function getMessage(arg1, arg2, arg3) { + if (typeof message === "string") { + return message; + } else { + return message(arg1, arg2, arg3); } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var fnClass = "[object Function]"; - var genClass = "[object GeneratorFunction]"; - var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag; - var documentDotAll = typeof document === "object" && typeof document.all === "undefined" && document.all !== void 0 ? document.all : {}; - module.exports = reflectApply ? function isCallable(value) { - if (value === documentDotAll) { - return true; - } - if (!value) { - return false; - } - if (typeof value !== "function" && typeof value !== "object") { - return false; - } - if (typeof value === "function" && !value.prototype) { - return true; } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { - return false; + var NodeError = /* @__PURE__ */ function(_Base) { + _inheritsLoose(NodeError2, _Base); + function NodeError2(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + return NodeError2; + }(Base); + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; + } + function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function(i) { + return String(i); + }); + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); } + } else { + return "of ".concat(thing, " ").concat(String(expected)); } - return !isES6ClassFn(value); - } : function isCallable(value) { - if (value === documentDotAll) { - return true; + } + function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; + } + function endsWith(str, search, this_len) { + if (this_len === void 0 || this_len > str.length) { + this_len = str.length; } - if (!value) { - return false; + return str.substring(this_len - search.length, this_len) === search; + } + function includes(str, search, start) { + if (typeof start !== "number") { + start = 0; } - if (typeof value !== "function" && typeof value !== "object") { + if (start + search.length > str.length) { return false; + } else { + return str.indexOf(search, start) !== -1; } - if (typeof value === "function" && !value.prototype) { - return true; - } - if (hasToStringTag) { - return tryFunctionObject(value); + } + createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; + }, TypeError); + createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { + var determiner; + if (typeof expected === "string" && startsWith(expected, "not ")) { + determiner = "must not be"; + expected = expected.replace(/^not /, ""); + } else { + determiner = "must be"; } - if (isES6ClassFn(value)) { - return false; + var msg; + if (endsWith(name, " argument")) { + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + } else { + var type = includes(name, ".") ? "property" : "argument"; + msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); } - var strClass = toStr.call(value); - return strClass === fnClass || strClass === genClass; - }; + msg += ". Received type ".concat(typeof actual); + return msg; + }, TypeError); + createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); + createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { + return "The " + name + " method is not implemented"; + }); + createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); + createErrorType("ERR_STREAM_DESTROYED", function(name) { + return "Cannot call " + name + " after a stream was destroyed"; + }); + createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); + createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); + createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); + createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); + createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { + return "Unknown encoding: " + arg; + }, TypeError); + createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); + module.exports.codes = codes; } }); - // node_modules/for-each/index.js - var require_for_each = __commonJS({ - "node_modules/for-each/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/state.js + var require_state = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var isCallable = require_is_callable(); - var toStr = Object.prototype.toString; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var forEachArray = function forEachArray2(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } - }; - var forEachString = function forEachString2(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } - }; - var forEachObject = function forEachObject2(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } - }; - var forEach = function forEach2(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError("iterator must be a function"); - } - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; - } - if (toStr.call(list) === "[object Array]") { - forEachArray(list, iterator, receiver); - } else if (typeof list === "string") { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } - }; - module.exports = forEach; - } - }); - - // node_modules/available-typed-arrays/index.js - var require_available_typed_arrays = __commonJS({ - "node_modules/available-typed-arrays/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var possibleNames = [ - "BigInt64Array", - "BigUint64Array", - "Float32Array", - "Float64Array", - "Int16Array", - "Int32Array", - "Int8Array", - "Uint16Array", - "Uint32Array", - "Uint8Array", - "Uint8ClampedArray" - ]; - var g = typeof globalThis === "undefined" ? window : globalThis; - module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === "function") { - out[out.length] = possibleNames[i]; - } - } - return out; - }; - } - }); - - // node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js - var require_getOwnPropertyDescriptor = __commonJS({ - "node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - if ($gOPD) { - try { - $gOPD([], "length"); - } catch (e) { - $gOPD = null; - } - } - module.exports = $gOPD; - } - }); - - // node_modules/is-typed-array/index.js - var require_is_typed_array = __commonJS({ - "node_modules/is-typed-array/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? window : globalThis; - var typedArrays = availableTypedArrays(); - var $indexOf = callBound("Array.prototype.indexOf", true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; - }; - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var gOPD = require_getOwnPropertyDescriptor(); - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); - } - var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function(getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { - } - } - }); - return anyTrue; - }; - module.exports = function isTypedArray(value) { - if (!value || typeof value !== "object") { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { - return false; - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/which-typed-array/index.js - var require_which_typed_array = __commonJS({ - "node_modules/which-typed-array/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? window : globalThis; - var typedArrays = availableTypedArrays(); - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var gOPD = require_getOwnPropertyDescriptor(); - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - if (typeof g[typedArray] === "function") { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - } - }); + var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE; + function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; } - var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function(getter, typedArray) { - if (!foundName) { - try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; - } - } catch (e) { - } + function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : "highWaterMark"; + throw new ERR_INVALID_OPT_VALUE(name, hwm); } - }); - return foundName; - }; - var isTypedArray = require_is_typed_array(); - module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - return $slice($toString(value), 8, -1); - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/util/support/types.js - var require_types = __commonJS({ - "node_modules/util/support/types.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var isArgumentsObject = require_is_arguments(); - var isGeneratorFunction = require_is_generator_function(); - var whichTypedArray = require_which_typed_array(); - var isTypedArray = require_is_typed_array(); - function uncurryThis(f) { - return f.call.bind(f); - } - var BigIntSupported = typeof BigInt !== "undefined"; - var SymbolSupported = typeof Symbol !== "undefined"; - var ObjectToString = uncurryThis(Object.prototype.toString); - var numberValue = uncurryThis(Number.prototype.valueOf); - var stringValue = uncurryThis(String.prototype.valueOf); - var booleanValue = uncurryThis(Boolean.prototype.valueOf); - if (BigIntSupported) { - bigIntValue = uncurryThis(BigInt.prototype.valueOf); - } - var bigIntValue; - if (SymbolSupported) { - symbolValue = uncurryThis(Symbol.prototype.valueOf); - } - var symbolValue; - function checkBoxedPrimitive(value, prototypeValueOf) { - if (typeof value !== "object") { - return false; - } - try { - prototypeValueOf(value); - return true; - } catch (e) { - return false; - } - } - exports.isArgumentsObject = isArgumentsObject; - exports.isGeneratorFunction = isGeneratorFunction; - exports.isTypedArray = isTypedArray; - function isPromise(input) { - return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function"; - } - exports.isPromise = isPromise; - function isArrayBufferView(value) { - if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - return ArrayBuffer.isView(value); - } - return isTypedArray(value) || isDataView(value); - } - exports.isArrayBufferView = isArrayBufferView; - function isUint8Array(value) { - return whichTypedArray(value) === "Uint8Array"; - } - exports.isUint8Array = isUint8Array; - function isUint8ClampedArray(value) { - return whichTypedArray(value) === "Uint8ClampedArray"; - } - exports.isUint8ClampedArray = isUint8ClampedArray; - function isUint16Array(value) { - return whichTypedArray(value) === "Uint16Array"; - } - exports.isUint16Array = isUint16Array; - function isUint32Array(value) { - return whichTypedArray(value) === "Uint32Array"; - } - exports.isUint32Array = isUint32Array; - function isInt8Array(value) { - return whichTypedArray(value) === "Int8Array"; - } - exports.isInt8Array = isInt8Array; - function isInt16Array(value) { - return whichTypedArray(value) === "Int16Array"; - } - exports.isInt16Array = isInt16Array; - function isInt32Array(value) { - return whichTypedArray(value) === "Int32Array"; - } - exports.isInt32Array = isInt32Array; - function isFloat32Array(value) { - return whichTypedArray(value) === "Float32Array"; - } - exports.isFloat32Array = isFloat32Array; - function isFloat64Array(value) { - return whichTypedArray(value) === "Float64Array"; - } - exports.isFloat64Array = isFloat64Array; - function isBigInt64Array(value) { - return whichTypedArray(value) === "BigInt64Array"; - } - exports.isBigInt64Array = isBigInt64Array; - function isBigUint64Array(value) { - return whichTypedArray(value) === "BigUint64Array"; - } - exports.isBigUint64Array = isBigUint64Array; - function isMapToString(value) { - return ObjectToString(value) === "[object Map]"; - } - isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map()); - function isMap(value) { - if (typeof Map === "undefined") { - return false; - } - return isMapToString.working ? isMapToString(value) : value instanceof Map; - } - exports.isMap = isMap; - function isSetToString(value) { - return ObjectToString(value) === "[object Set]"; - } - isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set()); - function isSet(value) { - if (typeof Set === "undefined") { - return false; - } - return isSetToString.working ? isSetToString(value) : value instanceof Set; - } - exports.isSet = isSet; - function isWeakMapToString(value) { - return ObjectToString(value) === "[object WeakMap]"; - } - isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap()); - function isWeakMap(value) { - if (typeof WeakMap === "undefined") { - return false; - } - return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; - } - exports.isWeakMap = isWeakMap; - function isWeakSetToString(value) { - return ObjectToString(value) === "[object WeakSet]"; - } - isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet()); - function isWeakSet(value) { - return isWeakSetToString(value); - } - exports.isWeakSet = isWeakSet; - function isArrayBufferToString(value) { - return ObjectToString(value) === "[object ArrayBuffer]"; - } - isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer()); - function isArrayBuffer(value) { - if (typeof ArrayBuffer === "undefined") { - return false; - } - return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; - } - exports.isArrayBuffer = isArrayBuffer; - function isDataViewToString(value) { - return ObjectToString(value) === "[object DataView]"; - } - isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)); - function isDataView(value) { - if (typeof DataView === "undefined") { - return false; - } - return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; - } - exports.isDataView = isDataView; - var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0; - function isSharedArrayBufferToString(value) { - return ObjectToString(value) === "[object SharedArrayBuffer]"; - } - function isSharedArrayBuffer(value) { - if (typeof SharedArrayBufferCopy === "undefined") { - return false; - } - if (typeof isSharedArrayBufferToString.working === "undefined") { - isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); + return Math.floor(hwm); } - return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy; - } - exports.isSharedArrayBuffer = isSharedArrayBuffer; - function isAsyncFunction(value) { - return ObjectToString(value) === "[object AsyncFunction]"; - } - exports.isAsyncFunction = isAsyncFunction; - function isMapIterator(value) { - return ObjectToString(value) === "[object Map Iterator]"; - } - exports.isMapIterator = isMapIterator; - function isSetIterator(value) { - return ObjectToString(value) === "[object Set Iterator]"; - } - exports.isSetIterator = isSetIterator; - function isGeneratorObject(value) { - return ObjectToString(value) === "[object Generator]"; - } - exports.isGeneratorObject = isGeneratorObject; - function isWebAssemblyCompiledModule(value) { - return ObjectToString(value) === "[object WebAssembly.Module]"; - } - exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); - } - exports.isNumberObject = isNumberObject; - function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); - } - exports.isStringObject = isStringObject; - function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); - } - exports.isBooleanObject = isBooleanObject; - function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); - } - exports.isBigIntObject = isBigIntObject; - function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); - } - exports.isSymbolObject = isSymbolObject; - function isBoxedPrimitive(value) { - return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value); - } - exports.isBoxedPrimitive = isBoxedPrimitive; - function isAnyArrayBuffer(value) { - return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value)); + return state.objectMode ? 16 : 16 * 1024; } - exports.isAnyArrayBuffer = isAnyArrayBuffer; - ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) { - Object.defineProperty(exports, method, { - enumerable: false, - value: function() { - throw new Error(method + " is not supported in userland"); - } - }); - }); - } - }); - - // node_modules/util/support/isBufferBrowser.js - var require_isBufferBrowser = __commonJS({ - "node_modules/util/support/isBufferBrowser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function isBuffer(arg) { - return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function"; + module.exports = { + getHighWaterMark }; } }); @@ -3784,11390 +2926,2457 @@ } }); - // node_modules/util/util.js - var require_util = __commonJS({ - "node_modules/util/util.js"(exports) { + // node_modules/util-deprecate/browser.js + var require_browser = __commonJS({ + "node_modules/util-deprecate/browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for (var i = 0; i < keys.length; i++) { - descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - } - return descriptors; - }; - var formatRegExp = /%[sdj%]/g; - exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(" "); - } - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x2) { - if (x2 === "%%") - return "%"; - if (i >= len) - return x2; - switch (x2) { - case "%s": - return String(args[i++]); - case "%d": - return Number(args[i++]); - case "%j": - try { - return JSON.stringify(args[i++]); - } catch (_) { - return "[Circular]"; - } - default: - return x2; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += " " + x; - } else { - str += " " + inspect(x); - } - } - return str; - }; - exports.deprecate = function(fn, msg) { - if (typeof process !== "undefined" && process.noDeprecation === true) { + module.exports = deprecate; + function deprecate(fn, msg) { + if (config("noDeprecation")) { return fn; } - if (typeof process === "undefined") { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } var warned = false; function deprecated() { if (!warned) { - if (process.throwDeprecation) { + if (config("throwDeprecation")) { throw new Error(msg); - } else if (process.traceDeprecation) { + } else if (config("traceDeprecation")) { console.trace(msg); } else { - console.error(msg); + console.warn(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; - }; - var debugs = {}; - var debugEnvRegex = /^$/; - if (process.env.NODE_DEBUG) { - debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(); - debugEnvRegex = new RegExp("^" + debugEnv + "$", "i"); - } - var debugEnv; - exports.debuglog = function(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (debugEnvRegex.test(set)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error("%s %d: %s", set, pid, msg); - }; - } else { - debugs[set] = function() { - }; - } + } + function config(name) { + try { + if (!window.localStorage) + return false; + } catch (_) { + return false; } - return debugs[set]; - }; - function inspect(obj, opts) { - var ctx = { - seen: [], - stylize: stylizeNoColor + var val = window.localStorage[name]; + if (val == null) + return false; + return String(val).toLowerCase() === "true"; + } + } + }); + + // node_modules/readable-stream/lib/_stream_writable.js + var require_stream_writable = __commonJS({ + "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + module.exports = Writable; + function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function() { + onCorkedFinish(_this, state); }; - if (arguments.length >= 3) - ctx.depth = arguments[2]; - if (arguments.length >= 4) - ctx.colors = arguments[3]; - if (isBoolean(opts)) { - ctx.showHidden = opts; - } else if (opts) { - exports._extend(ctx, opts); - } - if (isUndefined(ctx.showHidden)) - ctx.showHidden = false; - if (isUndefined(ctx.depth)) - ctx.depth = 2; - if (isUndefined(ctx.colors)) - ctx.colors = false; - if (isUndefined(ctx.customInspect)) - ctx.customInspect = true; - if (ctx.colors) - ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); - } - exports.inspect = inspect; - inspect.colors = { - "bold": [1, 22], - "italic": [3, 23], - "underline": [4, 24], - "inverse": [7, 27], - "white": [37, 39], - "grey": [90, 39], - "black": [30, 39], - "blue": [34, 39], - "cyan": [36, 39], - "green": [32, 39], - "magenta": [35, 39], - "red": [31, 39], - "yellow": [33, 39] + } + var Duplex; + Writable.WritableState = WritableState; + var internalUtil = { + deprecate: require_browser() }; - inspect.styles = { - "special": "cyan", - "number": "yellow", - "boolean": "yellow", - "undefined": "grey", - "null": "bold", - "string": "green", - "date": "magenta", - "regexp": "red" + var Stream = require_stream_browser(); + var Buffer14 = require_buffer().Buffer; + var OurUint8Array = window.Uint8Array || function() { }; - function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - if (style) { - return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m"; - } else { - return str; - } + function _uint8ArrayToBuffer(chunk) { + return Buffer14.from(chunk); } - function stylizeNoColor(str, styleType) { - return str; + function _isUint8Array(obj) { + return Buffer14.isBuffer(obj) || obj instanceof OurUint8Array; } - function arrayToHash(array) { - var hash2 = {}; - array.forEach(function(val, idx) { - hash2[val] = true; - }); - return hash2; + var destroyImpl = require_destroy(); + var _require = require_state(); + var getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require_errors_browser().codes; + var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; + var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE; + var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES; + var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END; + var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; + var errorOrDestroy = destroyImpl.errorOrDestroy; + require_inherits_browser()(Writable, Stream); + function nop() { } - function formatValue(ctx, value, recurseTimes) { - if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; + function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + if (typeof isDuplex !== "boolean") + isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex); + this.finalCalled = false; + this.needDrain = false; + this.ending = false; + this.ended = false; + this.finished = false; + this.destroyed = false; + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.length = 0; + this.writing = false; + this.corked = 0; + this.sync = true; + this.bufferProcessing = false; + this.onwrite = function(er) { + onwrite(stream, er); + }; + this.writecb = null; + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + this.pendingcb = 0; + this.prefinished = false; + this.errorEmitted = false; + this.emitClose = options.emitClose !== false; + this.autoDestroy = !!options.autoDestroy; + this.bufferedRequestCount = 0; + this.corkedRequestsFree = new CorkedRequest(this); + } + WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; + }; + (function() { + try { + Object.defineProperty(WritableState.prototype, "buffer", { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") + }); + } catch (_) { + } + })(); + var realHasInstance; + if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) + return true; + if (this !== Writable) + return false; + return object && object._writableState instanceof WritableState; + } + }); + } else { + realHasInstance = function realHasInstance2(object) { + return object instanceof this; + }; + } + function Writable(options) { + Duplex = Duplex || require_stream_duplex(); + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) + return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + this.writable = true; + if (options) { + if (typeof options.write === "function") + this._write = options.write; + if (typeof options.writev === "function") + this._writev = options.writev; + if (typeof options.destroy === "function") + this._destroy = options.destroy; + if (typeof options.final === "function") + this._final = options.final; } - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; + Stream.call(this); + } + Writable.prototype.pipe = function() { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); + }; + function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + errorOrDestroy(stream, er); + process.nextTick(cb, er); + } + function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== "string" && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); } - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; } - if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) { - return formatError(value); + return true; + } + Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer14.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); } - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ": " + value.name : ""; - return ctx.stylize("[Function" + name + "]", "special"); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), "date"); - } - if (isError(value)) { - return formatError(value); - } + if (typeof encoding === "function") { + cb = encoding; + encoding = null; } - var base = "", array = false, braces = ["{", "}"]; - if (isArray(value)) { - array = true; - braces = ["[", "]"]; + if (isBuf) + encoding = "buffer"; + else if (!encoding) + encoding = state.defaultEncoding; + if (typeof cb !== "function") + cb = nop; + if (state.ending) + writeAfterEnd(this, cb); + else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } - if (isFunction(value)) { - var n = value.name ? ": " + value.name : ""; - base = " [Function" + n + "]"; + return ret; + }; + Writable.prototype.cork = function() { + this._writableState.corked++; + }; + Writable.prototype.uncork = function() { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) + clearBuffer(this, state); } - if (isRegExp(value)) { - base = " " + RegExp.prototype.toString.call(value); + }; + Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + if (typeof encoding === "string") + encoding = encoding.toLowerCase(); + if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) + throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; + }; + Object.defineProperty(Writable.prototype, "writableBuffer", { + enumerable: false, + get: function get2() { + return this._writableState && this._writableState.getBuffer(); } - if (isDate(value)) { - base = " " + Date.prototype.toUTCString.call(value); + }); + function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { + chunk = Buffer14.from(chunk, encoding); } - if (isError(value)) { - base = " " + formatError(value); + return chunk; + } + Object.defineProperty(Writable.prototype, "writableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._writableState.highWaterMark; } - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; + }); + function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = "buffer"; + chunk = newChunk; + } } - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + if (!ret) + state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk, + encoding, + isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; } else { - return ctx.stylize("[Object]", "special"); + state.bufferedRequest = state.lastBufferedRequest; } - } - ctx.seen.push(value); - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + state.bufferedRequestCount += 1; } else { - output = keys.map(function(key2) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key2, array); - }); + doWrite(stream, state, false, len, chunk, encoding, cb); } - ctx.seen.pop(); - return reduceToSingleString(output, base, braces); + return ret; + } + function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) + state.onwrite(new ERR_STREAM_DESTROYED("write")); + else if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); + state.sync = false; } - function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize("undefined", "undefined"); - if (isString(value)) { - var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; - return ctx.stylize(simple, "string"); + function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + process.nextTick(cb, er); + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + finishMaybe(stream, state); } - if (isNumber(value)) - return ctx.stylize("" + value, "number"); - if (isBoolean(value)) - return ctx.stylize("" + value, "boolean"); - if (isNull(value)) - return ctx.stylize("null", "null"); } - function formatError(value) { - return "[" + Error.prototype.toString.call(value) + "]"; + function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; } - function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); - } else { - output.push(""); - } - } - keys.forEach(function(key2) { - if (!key2.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key2, true)); + function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== "function") + throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) + onwriteError(stream, state, sync, er, cb); + else { + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); } - }); - return output; - } - function formatProperty(ctx, value, recurseTimes, visibleKeys, key2, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key2) || { value: value[key2] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize("[Getter/Setter]", "special"); + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); } else { - str = ctx.stylize("[Getter]", "special"); - } - } else { - if (desc.set) { - str = ctx.stylize("[Setter]", "special"); + afterWrite(stream, state, finished, cb); } } - if (!hasOwnProperty(visibleKeys, key2)) { - name = "[" + key2 + "]"; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf("\n") > -1) { - if (array) { - str = str.split("\n").map(function(line) { - return " " + line; - }).join("\n").substr(2); - } else { - str = "\n" + str.split("\n").map(function(line) { - return " " + line; - }).join("\n"); - } - } - } else { - str = ctx.stylize("[Circular]", "special"); - } + } + function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); + } + function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit("drain"); } - if (isUndefined(name)) { - if (array && key2.match(/^\d+$/)) { - return str; + } + function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) + allBuffers = false; + entry = entry.next; + count += 1; } - name = JSON.stringify("" + key2); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, "name"); + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, "", holder.finish); + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; } else { - name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, "string"); - } - } - return name + ": " + str; - } - function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf("\n") >= 0) - numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1; - }, 0); - if (length > 60) { - return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1]; - } - return braces[0] + base + " " + output.join(", ") + " " + braces[1]; - } - exports.types = require_types(); - function isArray(ar) { - return Array.isArray(ar); - } - exports.isArray = isArray; - function isBoolean(arg) { - return typeof arg === "boolean"; - } - exports.isBoolean = isBoolean; - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; - function isNumber(arg) { - return typeof arg === "number"; - } - exports.isNumber = isNumber; - function isString(arg) { - return typeof arg === "string"; - } - exports.isString = isString; - function isSymbol(arg) { - return typeof arg === "symbol"; - } - exports.isSymbol = isSymbol; - function isUndefined(arg) { - return arg === void 0; - } - exports.isUndefined = isUndefined; - function isRegExp(re) { - return isObject(re) && objectToString(re) === "[object RegExp]"; - } - exports.isRegExp = isRegExp; - exports.types.isRegExp = isRegExp; - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - exports.isObject = isObject; - function isDate(d) { - return isObject(d) && objectToString(d) === "[object Date]"; - } - exports.isDate = isDate; - exports.types.isDate = isDate; - function isError(e) { - return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error); - } - exports.isError = isError; - exports.types.isNativeError = isError; - function isFunction(arg) { - return typeof arg === "function"; - } - exports.isFunction = isFunction; - function isPrimitive(arg) { - return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined"; - } - exports.isPrimitive = isPrimitive; - exports.isBuffer = require_isBufferBrowser(); - function objectToString(o) { - return Object.prototype.toString.call(o); - } - function pad(n) { - return n < 10 ? "0" + n.toString(10) : n.toString(10); - } - var months = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ]; - function timestamp() { - var d = new Date(); - var time = [ - pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds()) - ].join(":"); - return [d.getDate(), months[d.getMonth()], time].join(" "); - } - exports.log = function() { - console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments)); + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + if (state.writing) { + break; + } + } + if (entry === null) + state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; + } + Writable.prototype._write = function(chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); }; - exports.inherits = require_inherits_browser(); - exports._extend = function(origin, add) { - if (!add || !isObject(add)) - return origin; - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; + Writable.prototype._writev = null; + Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === "function") { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === "function") { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== void 0) + this.write(chunk, encoding); + if (state.corked) { + state.corked = 1; + this.uncork(); + } + if (!state.ending) + endWritable(this, state, cb); + return this; }; - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0; - exports.promisify = function promisify(original) { - if (typeof original !== "function") - throw new TypeError('The "original" argument must be of type Function'); - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if (typeof fn !== "function") { - throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return fn; + Object.defineProperty(Writable.prototype, "writableLength", { + enumerable: false, + get: function get2() { + return this._writableState.length; } - function fn() { - var promiseResolve, promiseReject; - var promise2 = new Promise(function(resolve2, reject) { - promiseResolve = resolve2; - promiseReject = reject; - }); - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); + }); + function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; + } + function callFinal(stream, state) { + stream._final(function(err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); } - args.push(function(err, value) { - if (err) { - promiseReject(err); - } else { - promiseResolve(value); + state.prefinished = true; + stream.emit("prefinish"); + finishMaybe(stream, state); + }); + } + function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === "function" && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit("prefinish"); + } + } + } + function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit("finish"); + if (state.autoDestroy) { + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } } - }); - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); } - return promise2; } - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - if (kCustomPromisifiedSymbol) - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return Object.defineProperties(fn, getOwnPropertyDescriptors(original)); - }; - exports.promisify.custom = kCustomPromisifiedSymbol; - function callbackifyOnRejected(reason, cb) { - if (!reason) { - var newReason = new Error("Promise was rejected with a falsy value"); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); - } - function callbackify(original) { - if (typeof original !== "function") { - throw new TypeError('The "original" argument must be of type Function'); - } - function callbackified() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - var maybeCb = args.pop(); - if (typeof maybeCb !== "function") { - throw new TypeError("The last argument must be of type Function"); - } - var self = this; - var cb = function() { - return maybeCb.apply(self, arguments); - }; - original.apply(this, args).then(function(ret) { - process.nextTick(cb.bind(null, null, ret)); - }, function(rej) { - process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); - }); + return need; + } + function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once("finish", cb); + } + state.ended = true; + stream.writable = false; + } + function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; } - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)); - return callbackified; + state.corkedRequestsFree.next = corkReq; } - exports.callbackify = callbackify; + Object.defineProperty(Writable.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._writableState === void 0) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + if (!this._writableState) { + return; + } + this._writableState.destroyed = value; + } + }); + Writable.prototype.destroy = destroyImpl.destroy; + Writable.prototype._undestroy = destroyImpl.undestroy; + Writable.prototype._destroy = function(err, cb) { + cb(err); + }; } }); - // node_modules/assert-browserify/build/internal/errors.js - var require_errors = __commonJS({ - "node_modules/assert-browserify/build/internal/errors.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_duplex.js + var require_stream_duplex = __commonJS({ + "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + var objectKeys = Object.keys || function(obj) { + var keys2 = []; + for (var key2 in obj) { + keys2.push(key2); } - return _typeof2(obj); - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + return keys2; + }; + module.exports = Duplex; + var Readable = require_stream_readable(); + var Writable = require_stream_writable(); + require_inherits_browser()(Duplex, Readable); + { + keys = objectKeys(Writable.prototype); + for (v = 0; v < keys.length; v++) { + method = keys[v]; + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; } } - function _possibleConstructorReturn(self, call) { - if (call && (_typeof2(call) === "object" || typeof call === "function")) { - return call; + var keys; + var method; + var v; + function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) + this.readable = false; + if (options.writable === false) + this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once("end", onend); + } } - return _assertThisInitialized(self); } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._writableState.highWaterMark; } - return self; - } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); - } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + }); + Object.defineProperty(Duplex.prototype, "writableBuffer", { + enumerable: false, + get: function get2() { + return this._writableState && this._writableState.getBuffer(); + } + }); + Object.defineProperty(Duplex.prototype, "writableLength", { + enumerable: false, + get: function get2() { + return this._writableState.length; } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - if (superClass) - _setPrototypeOf(subClass, superClass); + }); + function onend() { + if (this._writableState.ended) + return; + process.nextTick(onEndNT, this); } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); + function onEndNT(self) { + self.end(); } - var codes = {}; - var assert; - var util; - function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - function getMessage(arg1, arg2, arg3) { - if (typeof message === "string") { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - var NodeError = /* @__PURE__ */ function(_Base) { - _inherits(NodeError2, _Base); - function NodeError2(arg1, arg2, arg3) { - var _this; - _classCallCheck(this, NodeError2); - _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError2).call(this, getMessage(arg1, arg2, arg3))); - _this.code = code; - return _this; + Object.defineProperty(Duplex.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._readableState === void 0 || this._writableState === void 0) { + return false; } - return NodeError2; - }(Base); - codes[code] = NodeError; - } - function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function(i) { - return String(i); - }); - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + if (this._readableState === void 0 || this._writableState === void 0) { + return; } - } else { - return "of ".concat(thing, " ").concat(String(expected)); + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } + }); + } + }); + + // node_modules/safe-buffer/index.js + var require_safe_buffer = __commonJS({ + "node_modules/safe-buffer/index.js"(exports, module) { + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var buffer = require_buffer(); + var Buffer14 = buffer.Buffer; + function copyProps(src, dst) { + for (var key2 in src) { + dst[key2] = src[key2]; } } - function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; + if (Buffer14.from && Buffer14.alloc && Buffer14.allocUnsafe && Buffer14.allocUnsafeSlow) { + module.exports = buffer; + } else { + copyProps(buffer, exports); + exports.Buffer = SafeBuffer; } - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; - } - return str.substring(this_len - search.length, this_len) === search; + function SafeBuffer(arg, encodingOrOffset, length) { + return Buffer14(arg, encodingOrOffset, length); } - function includes(str, search, start) { - if (typeof start !== "number") { - start = 0; - } - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; + SafeBuffer.prototype = Object.create(Buffer14.prototype); + copyProps(Buffer14, SafeBuffer); + SafeBuffer.from = function(arg, encodingOrOffset, length) { + if (typeof arg === "number") { + throw new TypeError("Argument must not be a number"); } - } - createErrorType("ERR_AMBIGUOUS_ARGUMENT", 'The "%s" argument is ambiguous. %s', TypeError); - createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { - if (assert === void 0) - assert = require_assert(); - assert(typeof name === "string", "'name' must be a string"); - var determiner; - if (typeof expected === "string" && startsWith(expected, "not ")) { - determiner = "must not be"; - expected = expected.replace(/^not /, ""); - } else { - determiner = "must be"; + return Buffer14(arg, encodingOrOffset, length); + }; + SafeBuffer.alloc = function(size, fill, encoding) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } - var msg; - if (endsWith(name, " argument")) { - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + var buf2 = Buffer14(size); + if (fill !== void 0) { + if (typeof encoding === "string") { + buf2.fill(fill, encoding); + } else { + buf2.fill(fill); + } } else { - var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + buf2.fill(0); } - msg += ". Received type ".concat(_typeof2(actual)); - return msg; - }, TypeError); - createErrorType("ERR_INVALID_ARG_VALUE", function(name, value) { - var reason = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "is invalid"; - if (util === void 0) - util = require_util(); - var inspected = util.inspect(value); - if (inspected.length > 128) { - inspected = "".concat(inspected.slice(0, 128), "..."); - } - return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected); - }, TypeError, RangeError); - createErrorType("ERR_INVALID_RETURN_VALUE", function(input, name, value) { - var type; - if (value && value.constructor && value.constructor.name) { - type = "instance of ".concat(value.constructor.name); - } else { - type = "type ".concat(_typeof2(value)); + return buf2; + }; + SafeBuffer.allocUnsafe = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } - return "Expected ".concat(input, ' to be returned from the "').concat(name, '"') + " function but got ".concat(type, "."); - }, TypeError); - createErrorType("ERR_MISSING_ARGS", function() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - if (assert === void 0) - assert = require_assert(); - assert(args.length > 0, "At least one arg needs to be specified"); - var msg = "The "; - var len = args.length; - args = args.map(function(a) { - return '"'.concat(a, '"'); - }); - switch (len) { - case 1: - msg += "".concat(args[0], " argument"); - break; - case 2: - msg += "".concat(args[0], " and ").concat(args[1], " arguments"); - break; - default: - msg += args.slice(0, len - 1).join(", "); - msg += ", and ".concat(args[len - 1], " arguments"); - break; + return Buffer14(size); + }; + SafeBuffer.allocUnsafeSlow = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } - return "".concat(msg, " must be specified"); - }, TypeError); - module.exports.codes = codes; + return buffer.SlowBuffer(size); + }; } }); - // node_modules/assert-browserify/build/internal/assert/assertion_error.js - var require_assertion_error = __commonJS({ - "node_modules/assert-browserify/build/internal/assert/assertion_error.js"(exports, module) { + // node_modules/string_decoder/lib/string_decoder.js + var require_string_decoder = __commonJS({ + "node_modules/string_decoder/lib/string_decoder.js"(exports) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === "function") { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); + var Buffer14 = require_safe_buffer().Buffer; + var isEncoding = Buffer14.isEncoding || function(encoding) { + encoding = "" + encoding; + switch (encoding && encoding.toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + case "raw": + return true; + default: + return false; + } + }; + function _normalizeEncoding(enc) { + if (!enc) + return "utf8"; + var retried; + while (true) { + switch (enc) { + case "utf8": + case "utf-8": + return "utf8"; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return "utf16le"; + case "latin1": + case "binary": + return "latin1"; + case "base64": + case "ascii": + case "hex": + return enc; + default: + if (retried) + return; + enc = ("" + enc).toLowerCase(); + retried = true; } - ownKeys.forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }); } - return target; } - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; + function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== "string" && (Buffer14.isEncoding === isEncoding || !isEncoding(enc))) + throw new Error("Unknown encoding: " + enc); + return nenc || enc; } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + exports.StringDecoder = StringDecoder; + function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case "utf16le": + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case "utf8": + this.fillLast = utf8FillLast; + nb = 4; + break; + case "base64": + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer14.allocUnsafe(nb); } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); + StringDecoder.prototype.write = function(buf2) { + if (buf2.length === 0) + return ""; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf2); + if (r === void 0) + return ""; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - function _possibleConstructorReturn(self, call) { - if (call && (_typeof2(call) === "object" || typeof call === "function")) { - return call; + if (i < buf2.length) + return r ? r + this.text(buf2, i) : this.text(buf2, i); + return r || ""; + }; + StringDecoder.prototype.end = utf8End; + StringDecoder.prototype.text = utf8Text; + StringDecoder.prototype.fillLast = function(buf2) { + if (this.lastNeed <= buf2.length) { + buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - return _assertThisInitialized(self); - } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; + buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length); + this.lastNeed -= buf2.length; + }; + function utf8CheckByte(byte) { + if (byte <= 127) + return 0; + else if (byte >> 5 === 6) + return 2; + else if (byte >> 4 === 14) + return 3; + else if (byte >> 3 === 30) + return 4; + return byte >> 6 === 2 ? -1 : -2; } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + function utf8CheckIncomplete(self, buf2, i) { + var j = buf2.length - 1; + if (j < i) + return 0; + var nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) + self.lastNeed = nb - 1; + return nb; } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - if (superClass) - _setPrototypeOf(subClass, superClass); - } - function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; - _wrapNativeSuper = function _wrapNativeSuper2(Class2) { - if (Class2 === null || !_isNativeFunction(Class2)) - return Class2; - if (typeof Class2 !== "function") { - throw new TypeError("Super expression must either be null or a function"); + if (--j < i || nb === -2) + return 0; + nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) + self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) + return 0; + nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) + nb = 0; + else + self.lastNeed = nb - 3; } - if (typeof _cache !== "undefined") { - if (_cache.has(Class2)) - return _cache.get(Class2); - _cache.set(Class2, Wrapper); + return nb; + } + return 0; + } + function utf8CheckExtraBytes(self, buf2, p) { + if ((buf2[0] & 192) !== 128) { + self.lastNeed = 0; + return "\uFFFD"; + } + if (self.lastNeed > 1 && buf2.length > 1) { + if ((buf2[1] & 192) !== 128) { + self.lastNeed = 1; + return "\uFFFD"; } - function Wrapper() { - return _construct(Class2, arguments, _getPrototypeOf(this).constructor); + if (self.lastNeed > 2 && buf2.length > 2) { + if ((buf2[2] & 192) !== 128) { + self.lastNeed = 2; + return "\uFFFD"; + } } - Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); - return _setPrototypeOf(Wrapper, Class2); - }; - return _wrapNativeSuper(Class); - } - function isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) - return false; - if (Reflect.construct.sham) - return false; - if (typeof Proxy === "function") - return true; - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function() { - })); - return true; - } catch (e) { - return false; } } - function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct2(Parent2, args2, Class2) { - var a = [null]; - a.push.apply(a, args2); - var Constructor = Function.bind.apply(Parent2, a); - var instance18 = new Constructor(); - if (Class2) - _setPrototypeOf(instance18, Class2.prototype); - return instance18; - }; + function utf8FillLast(buf2) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf2, p); + if (r !== void 0) + return r; + if (this.lastNeed <= buf2.length) { + buf2.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - return _construct.apply(null, arguments); - } - function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; + buf2.copy(this.lastChar, p, 0, buf2.length); + this.lastNeed -= buf2.length; } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); + function utf8Text(buf2, i) { + var total = utf8CheckIncomplete(this, buf2, i); + if (!this.lastNeed) + return buf2.toString("utf8", i); + this.lastTotal = total; + var end = buf2.length - (total - this.lastNeed); + buf2.copy(this.lastChar, 0, end); + return buf2.toString("utf8", i, end); } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); + function utf8End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) + return r + "\uFFFD"; + return r; } - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + function utf16Text(buf2, i) { + if ((buf2.length - i) % 2 === 0) { + var r = buf2.toString("utf16le", i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 55296 && c <= 56319) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf2[buf2.length - 2]; + this.lastChar[1] = buf2[buf2.length - 1]; + return r.slice(0, -1); + } + } + return r; } - return _typeof2(obj); + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf2[buf2.length - 1]; + return buf2.toString("utf16le", i, buf2.length - 1); } - var _require = require_util(); - var inspect = _require.inspect; - var _require2 = require_errors(); - var ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; + function utf16End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString("utf16le", 0, end); } - return str.substring(this_len - search.length, this_len) === search; + return r; } - function repeat(str, count) { - count = Math.floor(count); - if (str.length == 0 || count == 0) - return ""; - var maxCount = str.length * count; - count = Math.floor(Math.log(count) / Math.log(2)); - while (count) { - str += str; - count--; + function base64Text(buf2, i) { + var n = (buf2.length - i) % 3; + if (n === 0) + return buf2.toString("base64", i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf2[buf2.length - 1]; + } else { + this.lastChar[0] = buf2[buf2.length - 2]; + this.lastChar[1] = buf2[buf2.length - 1]; } - str += str.substring(0, maxCount - str.length); - return str; + return buf2.toString("base64", i, buf2.length - n); } - var blue = ""; - var green = ""; - var red = ""; - var white = ""; - var kReadableOperator = { - deepStrictEqual: "Expected values to be strictly deep-equal:", - strictEqual: "Expected values to be strictly equal:", - strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', - deepEqual: "Expected values to be loosely deep-equal:", - equal: "Expected values to be loosely equal:", - notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', - notStrictEqual: 'Expected "actual" to be strictly unequal to:', - notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', - notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', - notEqual: 'Expected "actual" to be loosely unequal to:', - notIdentical: "Values identical but not reference-equal:" - }; - var kMaxShortLength = 10; - function copyError(source) { - var keys = Object.keys(source); - var target = Object.create(Object.getPrototypeOf(source)); - keys.forEach(function(key2) { - target[key2] = source[key2]; - }); - Object.defineProperty(target, "message", { - value: source.message - }); - return target; + function base64End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) + return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); + return r; } - function inspectValue(val) { - return inspect(val, { - compact: false, - customInspect: false, - depth: 1e3, - maxArrayLength: Infinity, - showHidden: false, - breakLength: Infinity, - showProxy: false, - sorted: true, - getters: true - }); + function simpleWrite(buf2) { + return buf2.toString(this.encoding); } - function createErrDiff(actual, expected, operator) { - var other = ""; - var res = ""; - var lastPos = 0; - var end = ""; - var skipped = false; - var actualInspected = inspectValue(actual); - var actualLines = actualInspected.split("\n"); - var expectedLines = inspectValue(expected).split("\n"); - var i = 0; - var indicator = ""; - if (operator === "strictEqual" && _typeof2(actual) === "object" && _typeof2(expected) === "object" && actual !== null && expected !== null) { - operator = "strictEqualObject"; - } - if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) { - var inputLength = actualLines[0].length + expectedLines[0].length; - if (inputLength <= kMaxShortLength) { - if ((_typeof2(actual) !== "object" || actual === null) && (_typeof2(expected) !== "object" || expected === null) && (actual !== 0 || expected !== 0)) { - return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n"); - } - } else if (operator !== "strictEqualObject") { - var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80; - if (inputLength < maxLength) { - while (actualLines[0][i] === expectedLines[0][i]) { - i++; - } - if (i > 2) { - indicator = "\n ".concat(repeat(" ", i), "^"); - i = 0; - } - } - } - } - var a = actualLines[actualLines.length - 1]; - var b = expectedLines[expectedLines.length - 1]; - while (a === b) { - if (i++ < 2) { - end = "\n ".concat(a).concat(end); - } else { - other = a; - } - actualLines.pop(); - expectedLines.pop(); - if (actualLines.length === 0 || expectedLines.length === 0) - break; - a = actualLines[actualLines.length - 1]; - b = expectedLines[expectedLines.length - 1]; - } - var maxLines = Math.max(actualLines.length, expectedLines.length); - if (maxLines === 0) { - var _actualLines = actualInspected.split("\n"); - if (_actualLines.length > 30) { - _actualLines[26] = "".concat(blue, "...").concat(white); - while (_actualLines.length > 27) { - _actualLines.pop(); - } - } - return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join("\n"), "\n"); - } - if (i > 3) { - end = "\n".concat(blue, "...").concat(white).concat(end); - skipped = true; - } - if (other !== "") { - end = "\n ".concat(other).concat(end); - other = ""; - } - var printedLines = 0; - var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white); - var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped"); - for (i = 0; i < maxLines; i++) { - var cur = i - lastPos; - if (actualLines.length < i + 1) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(expectedLines[i - 2]); - printedLines++; - } - res += "\n ".concat(expectedLines[i - 1]); - printedLines++; - } - lastPos = i; - other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]); - printedLines++; - } else if (expectedLines.length < i + 1) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(actualLines[i - 2]); - printedLines++; - } - res += "\n ".concat(actualLines[i - 1]); - printedLines++; - } - lastPos = i; - res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]); - printedLines++; - } else { - var expectedLine = expectedLines[i]; - var actualLine = actualLines[i]; - var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ",") || actualLine.slice(0, -1) !== expectedLine); - if (divergingLines && endsWith(expectedLine, ",") && expectedLine.slice(0, -1) === actualLine) { - divergingLines = false; - actualLine += ","; - } - if (divergingLines) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(actualLines[i - 2]); - printedLines++; - } - res += "\n ".concat(actualLines[i - 1]); - printedLines++; - } - lastPos = i; - res += "\n".concat(green, "+").concat(white, " ").concat(actualLine); - other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine); - printedLines += 2; - } else { - res += other; - other = ""; - if (cur === 1 || i === 0) { - res += "\n ".concat(actualLine); - printedLines++; - } - } - } - if (printedLines > 20 && i < maxLines - 2) { - return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white); - } - } - return "".concat(msg).concat(skipped ? skippedMsg : "", "\n").concat(res).concat(other).concat(end).concat(indicator); + function simpleEnd(buf2) { + return buf2 && buf2.length ? this.write(buf2) : ""; } - var AssertionError = /* @__PURE__ */ function(_Error) { - _inherits(AssertionError2, _Error); - function AssertionError2(options) { - var _this; - _classCallCheck(this, AssertionError2); - if (_typeof2(options) !== "object" || options === null) { - throw new ERR_INVALID_ARG_TYPE("options", "Object", options); - } - var message = options.message, operator = options.operator, stackStartFn = options.stackStartFn; - var actual = options.actual, expected = options.expected; - var limit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - if (message != null) { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, String(message))); - } else { - if (process.stderr && process.stderr.isTTY) { - if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) { - blue = "\x1B[34m"; - green = "\x1B[32m"; - white = "\x1B[39m"; - red = "\x1B[31m"; - } else { - blue = ""; - green = ""; - white = ""; - red = ""; - } - } - if (_typeof2(actual) === "object" && actual !== null && _typeof2(expected) === "object" && expected !== null && "stack" in actual && actual instanceof Error && "stack" in expected && expected instanceof Error) { - actual = copyError(actual); - expected = copyError(expected); - } - if (operator === "deepStrictEqual" || operator === "strictEqual") { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, createErrDiff(actual, expected, operator))); - } else if (operator === "notDeepStrictEqual" || operator === "notStrictEqual") { - var base = kReadableOperator[operator]; - var res = inspectValue(actual).split("\n"); - if (operator === "notStrictEqual" && _typeof2(actual) === "object" && actual !== null) { - base = kReadableOperator.notStrictEqualObject; - } - if (res.length > 30) { - res[26] = "".concat(blue, "...").concat(white); - while (res.length > 27) { - res.pop(); - } - } - if (res.length === 1) { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(base, " ").concat(res[0]))); - } else { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(base, "\n\n").concat(res.join("\n"), "\n"))); - } - } else { - var _res = inspectValue(actual); - var other = ""; - var knownOperators = kReadableOperator[operator]; - if (operator === "notDeepEqual" || operator === "notEqual") { - _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res); - if (_res.length > 1024) { - _res = "".concat(_res.slice(0, 1021), "..."); - } - } else { - other = "".concat(inspectValue(expected)); - if (_res.length > 512) { - _res = "".concat(_res.slice(0, 509), "..."); - } - if (other.length > 512) { - other = "".concat(other.slice(0, 509), "..."); - } - if (operator === "deepEqual" || operator === "equal") { - _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n"); - } else { - other = " ".concat(operator, " ").concat(other); - } - } - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(_res).concat(other))); - } - } - Error.stackTraceLimit = limit; - _this.generatedMessage = !message; - Object.defineProperty(_assertThisInitialized(_this), "name", { - value: "AssertionError [ERR_ASSERTION]", - enumerable: false, - writable: true, - configurable: true - }); - _this.code = "ERR_ASSERTION"; - _this.actual = actual; - _this.expected = expected; - _this.operator = operator; - if (Error.captureStackTrace) { - Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn); - } - _this.stack; - _this.name = "AssertionError"; - return _possibleConstructorReturn(_this); - } - _createClass(AssertionError2, [{ - key: "toString", - value: function toString2() { - return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); - } - }, { - key: inspect.custom, - value: function value(recurseTimes, ctx) { - return inspect(this, _objectSpread({}, ctx, { - customInspect: false, - depth: 0 - })); - } - }]); - return AssertionError2; - }(_wrapNativeSuper(Error)); - module.exports = AssertionError; } }); - // node_modules/es6-object-assign/index.js - var require_es6_object_assign = __commonJS({ - "node_modules/es6-object-assign/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/end-of-stream.js + var require_end_of_stream = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function assign2(target, firstSource) { - if (target === void 0 || target === null) { - throw new TypeError("Cannot convert first argument to object"); - } - var to = Object(target); - for (var i = 1; i < arguments.length; i++) { - var nextSource = arguments[i]; - if (nextSource === void 0 || nextSource === null) { - continue; - } - var keysArray = Object.keys(Object(nextSource)); - for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { - var nextKey = keysArray[nextIndex]; - var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); - if (desc !== void 0 && desc.enumerable) { - to[nextKey] = nextSource[nextKey]; - } + var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE; + function once(callback) { + var called = false; + return function() { + if (called) + return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - } - return to; + callback.apply(this, args); + }; } - function polyfill() { - if (!Object.assign) { - Object.defineProperty(Object, "assign", { - enumerable: false, - configurable: true, - writable: true, - value: assign2 - }); - } + function noop3() { } - module.exports = { - assign: assign2, - polyfill - }; - } - }); - - // node_modules/object-keys/isArguments.js - var require_isArguments = __commonJS({ - "node_modules/object-keys/isArguments.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var toStr = Object.prototype.toString; - module.exports = function isArguments(value) { - var str = toStr.call(value); - var isArgs = str === "[object Arguments]"; - if (!isArgs) { - isArgs = str !== "[object Array]" && value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && toStr.call(value.callee) === "[object Function]"; - } - return isArgs; - }; - } - }); - - // node_modules/object-keys/implementation.js - var require_implementation2 = __commonJS({ - "node_modules/object-keys/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var keysShim; - if (!Object.keys) { - has = Object.prototype.hasOwnProperty; - toStr = Object.prototype.toString; - isArgs = require_isArguments(); - isEnumerable = Object.prototype.propertyIsEnumerable; - hasDontEnumBug = !isEnumerable.call({ toString: null }, "toString"); - hasProtoEnumBug = isEnumerable.call(function() { - }, "prototype"); - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ]; - equalsConstructorPrototype = function(o) { - var ctor = o.constructor; - return ctor && ctor.prototype === o; - }; - excludedKeys = { - $applicationCache: true, - $console: true, - $external: true, - $frame: true, - $frameElement: true, - $frames: true, - $innerHeight: true, - $innerWidth: true, - $onmozfullscreenchange: true, - $onmozfullscreenerror: true, - $outerHeight: true, - $outerWidth: true, - $pageXOffset: true, - $pageYOffset: true, - $parent: true, - $scrollLeft: true, - $scrollTop: true, - $scrollX: true, - $scrollY: true, - $self: true, - $webkitIndexedDB: true, - $webkitStorageInfo: true, - $window: true - }; - hasAutomationEqualityBug = function() { - if (typeof window === "undefined") { - return false; - } - for (var k in window) { - try { - if (!excludedKeys["$" + k] && has.call(window, k) && window[k] !== null && typeof window[k] === "object") { - try { - equalsConstructorPrototype(window[k]); - } catch (e) { - return true; - } - } - } catch (e) { - return true; - } - } - return false; - }(); - equalsConstructorPrototypeIfNotBuggy = function(o) { - if (typeof window === "undefined" || !hasAutomationEqualityBug) { - return equalsConstructorPrototype(o); - } - try { - return equalsConstructorPrototype(o); - } catch (e) { - return false; - } + function isRequest(stream) { + return stream.setHeader && typeof stream.abort === "function"; + } + function eos(stream, opts, callback) { + if (typeof opts === "function") + return eos(stream, null, opts); + if (!opts) + opts = {}; + callback = once(callback || noop3); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable2 = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish2() { + if (!stream.writable) + onfinish(); }; - keysShim = function keys(object) { - var isObject = object !== null && typeof object === "object"; - var isFunction = toStr.call(object) === "[object Function]"; - var isArguments = isArgs(object); - var isString = isObject && toStr.call(object) === "[object String]"; - var theKeys = []; - if (!isObject && !isFunction && !isArguments) { - throw new TypeError("Object.keys called on a non-object"); - } - var skipProto = hasProtoEnumBug && isFunction; - if (isString && object.length > 0 && !has.call(object, 0)) { - for (var i = 0; i < object.length; ++i) { - theKeys.push(String(i)); - } - } - if (isArguments && object.length > 0) { - for (var j = 0; j < object.length; ++j) { - theKeys.push(String(j)); - } - } else { - for (var name in object) { - if (!(skipProto && name === "prototype") && has.call(object, name)) { - theKeys.push(String(name)); - } - } - } - if (hasDontEnumBug) { - var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); - for (var k = 0; k < dontEnums.length; ++k) { - if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object, dontEnums[k])) { - theKeys.push(dontEnums[k]); - } - } - } - return theKeys; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish2() { + writable2 = false; + writableEnded = true; + if (!readable) + callback.call(stream); }; - } - var has; - var toStr; - var isArgs; - var isEnumerable; - var hasDontEnumBug; - var hasProtoEnumBug; - var dontEnums; - var equalsConstructorPrototype; - var excludedKeys; - var hasAutomationEqualityBug; - var equalsConstructorPrototypeIfNotBuggy; - module.exports = keysShim; - } - }); - - // node_modules/object-keys/index.js - var require_object_keys = __commonJS({ - "node_modules/object-keys/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var slice = Array.prototype.slice; - var isArgs = require_isArguments(); - var origKeys = Object.keys; - var keysShim = origKeys ? function keys(o) { - return origKeys(o); - } : require_implementation2(); - var originalKeys = Object.keys; - keysShim.shim = function shimObjectKeys() { - if (Object.keys) { - var keysWorksWithArguments = function() { - var args = Object.keys(arguments); - return args && args.length === arguments.length; - }(1, 2); - if (!keysWorksWithArguments) { - Object.keys = function keys(object) { - if (isArgs(object)) { - return originalKeys(slice.call(object)); - } - return originalKeys(object); - }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend2() { + readable = false; + readableEnded = true; + if (!writable2) + callback.call(stream); + }; + var onerror = function onerror2(err) { + callback.call(stream, err); + }; + var onclose = function onclose2() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) + err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } - } else { - Object.keys = keysShim; - } - return Object.keys || keysShim; - }; - module.exports = keysShim; - } - }); - - // node_modules/has-property-descriptors/index.js - var require_has_property_descriptors = __commonJS({ - "node_modules/has-property-descriptors/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var hasPropertyDescriptors = function hasPropertyDescriptors2() { - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - return true; - } catch (e) { - return false; + if (writable2 && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) + err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } + }; + var onrequest = function onrequest2() { + stream.req.on("finish", onfinish); + }; + if (isRequest(stream)) { + stream.on("complete", onfinish); + stream.on("abort", onclose); + if (stream.req) + onrequest(); + else + stream.on("request", onrequest); + } else if (writable2 && !stream._writableState) { + stream.on("end", onlegacyfinish); + stream.on("close", onlegacyfinish); } - return false; - }; - hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { - if (!hasPropertyDescriptors()) { - return null; - } - try { - return $defineProperty([], "length", { value: 1 }).length !== 1; - } catch (e) { - return true; - } - }; - module.exports = hasPropertyDescriptors; + stream.on("end", onend); + stream.on("finish", onfinish); + if (opts.error !== false) + stream.on("error", onerror); + stream.on("close", onclose); + return function() { + stream.removeListener("complete", onfinish); + stream.removeListener("abort", onclose); + stream.removeListener("request", onrequest); + if (stream.req) + stream.req.removeListener("finish", onfinish); + stream.removeListener("end", onlegacyfinish); + stream.removeListener("close", onlegacyfinish); + stream.removeListener("finish", onfinish); + stream.removeListener("end", onend); + stream.removeListener("error", onerror); + stream.removeListener("close", onclose); + }; + } + module.exports = eos; } }); - // node_modules/define-properties/index.js - var require_define_properties = __commonJS({ - "node_modules/define-properties/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/async_iterator.js + var require_async_iterator = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var keys = require_object_keys(); - var hasSymbols = typeof Symbol === "function" && typeof Symbol("foo") === "symbol"; - var toStr = Object.prototype.toString; - var concat = Array.prototype.concat; - var origDefineProperty = Object.defineProperty; - var isFunction = function(fn) { - return typeof fn === "function" && toStr.call(fn) === "[object Function]"; - }; - var hasPropertyDescriptors = require_has_property_descriptors()(); - var supportsDescriptors = origDefineProperty && hasPropertyDescriptors; - var defineProperty = function(object, name, value, predicate) { - if (name in object && (!isFunction(predicate) || !predicate())) { - return; - } - if (supportsDescriptors) { - origDefineProperty(object, name, { - configurable: true, - enumerable: false, - value, - writable: true - }); + var _Object$setPrototypeO; + function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { - object[name] = value; - } - }; - var defineProperties = function(object, map) { - var predicates = arguments.length > 2 ? arguments[2] : {}; - var props = keys(map); - if (hasSymbols) { - props = concat.call(props, Object.getOwnPropertySymbols(map)); - } - for (var i = 0; i < props.length; i += 1) { - defineProperty(object, props[i], map[props[i]], predicates[props[i]]); - } - }; - defineProperties.supportsDescriptors = !!supportsDescriptors; - module.exports = defineProperties; - } - }); - - // node_modules/object-is/implementation.js - var require_implementation3 = __commonJS({ - "node_modules/object-is/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var numberIsNaN = function(value) { - return value !== value; - }; - module.exports = function is(a, b) { - if (a === 0 && b === 0) { - return 1 / a === 1 / b; - } - if (a === b) { - return true; - } - if (numberIsNaN(a) && numberIsNaN(b)) { - return true; - } - return false; - }; - } - }); - - // node_modules/object-is/polyfill.js - var require_polyfill = __commonJS({ - "node_modules/object-is/polyfill.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation3(); - module.exports = function getPolyfill() { - return typeof Object.is === "function" ? Object.is : implementation; - }; - } - }); - - // node_modules/object-is/shim.js - var require_shim = __commonJS({ - "node_modules/object-is/shim.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var getPolyfill = require_polyfill(); - var define2 = require_define_properties(); - module.exports = function shimObjectIs() { - var polyfill = getPolyfill(); - define2(Object, { is: polyfill }, { - is: function testObjectIs() { - return Object.is !== polyfill; - } - }); - return polyfill; - }; - } - }); - - // node_modules/object-is/index.js - var require_object_is = __commonJS({ - "node_modules/object-is/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var define2 = require_define_properties(); - var callBind = require_call_bind(); - var implementation = require_implementation3(); - var getPolyfill = require_polyfill(); - var shim = require_shim(); - var polyfill = callBind(getPolyfill(), Object); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module.exports = polyfill; - } - }); - - // node_modules/is-nan/implementation.js - var require_implementation4 = __commonJS({ - "node_modules/is-nan/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function isNaN2(value) { - return value !== value; - }; - } - }); - - // node_modules/is-nan/polyfill.js - var require_polyfill2 = __commonJS({ - "node_modules/is-nan/polyfill.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation4(); - module.exports = function getPolyfill() { - if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN("a")) { - return Number.isNaN; + obj[key2] = value; } - return implementation; - }; - } - }); - - // node_modules/is-nan/shim.js - var require_shim2 = __commonJS({ - "node_modules/is-nan/shim.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var define2 = require_define_properties(); - var getPolyfill = require_polyfill2(); - module.exports = function shimNumberIsNaN() { - var polyfill = getPolyfill(); - define2(Number, { isNaN: polyfill }, { - isNaN: function testIsNaN() { - return Number.isNaN !== polyfill; - } - }); - return polyfill; - }; - } - }); - - // node_modules/is-nan/index.js - var require_is_nan = __commonJS({ - "node_modules/is-nan/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var callBind = require_call_bind(); - var define2 = require_define_properties(); - var implementation = require_implementation4(); - var getPolyfill = require_polyfill2(); - var shim = require_shim2(); - var polyfill = callBind(getPolyfill(), Number); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module.exports = polyfill; - } - }); - - // node_modules/assert-browserify/build/internal/util/comparisons.js - var require_comparisons = __commonJS({ - "node_modules/assert-browserify/build/internal/util/comparisons.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); + return obj; } - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + var finished = require_end_of_stream(); + var kLastResolve = Symbol("lastResolve"); + var kLastReject = Symbol("lastReject"); + var kError = Symbol("error"); + var kEnded = Symbol("ended"); + var kLastPromise = Symbol("lastPromise"); + var kHandlePromise = Symbol("handlePromise"); + var kStream = Symbol("stream"); + function createIterResult(value, done) { + return { + value, + done + }; } - function _iterableToArrayLimit(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = void 0; - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) - break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) - _i["return"](); - } finally { - if (_d) - throw _e; + function readAndResolve(iter) { + var resolve2 = iter[kLastResolve]; + if (resolve2 !== null) { + var data = iter[kStream].read(); + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve2(createIterResult(data, false)); } } - return _arr; } - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) - return arr; + function onReadable(iter) { + process.nextTick(readAndResolve, iter); } - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof2(obj); + function wrapForNext(lastPromise, iter) { + return function(resolve2, reject) { + lastPromise.then(function() { + if (iter[kEnded]) { + resolve2(createIterResult(void 0, true)); + return; + } + iter[kHandlePromise](resolve2, reject); + }, reject); + }; } - var regexFlagsSupported = /a/g.flags !== void 0; - var arrayFromSet = function arrayFromSet2(set) { - var array = []; - set.forEach(function(value) { - return array.push(value); - }); - return array; - }; - var arrayFromMap = function arrayFromMap2(map) { - var array = []; - map.forEach(function(value, key2) { - return array.push([key2, value]); - }); - return array; - }; - var objectIs = Object.is ? Object.is : require_object_is(); - var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function() { - return []; - }; - var numberIsNaN = Number.isNaN ? Number.isNaN : require_is_nan(); - function uncurryThis(f) { - return f.call.bind(f); - } - var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); - var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable); - var objectToString = uncurryThis(Object.prototype.toString); - var _require$types = require_util().types; - var isAnyArrayBuffer = _require$types.isAnyArrayBuffer; - var isArrayBufferView = _require$types.isArrayBufferView; - var isDate = _require$types.isDate; - var isMap = _require$types.isMap; - var isRegExp = _require$types.isRegExp; - var isSet = _require$types.isSet; - var isNativeError = _require$types.isNativeError; - var isBoxedPrimitive = _require$types.isBoxedPrimitive; - var isNumberObject = _require$types.isNumberObject; - var isStringObject = _require$types.isStringObject; - var isBooleanObject = _require$types.isBooleanObject; - var isBigIntObject = _require$types.isBigIntObject; - var isSymbolObject = _require$types.isSymbolObject; - var isFloat32Array = _require$types.isFloat32Array; - var isFloat64Array = _require$types.isFloat64Array; - function isNonIndex(key2) { - if (key2.length === 0 || key2.length > 10) - return true; - for (var i = 0; i < key2.length; i++) { - var code = key2.charCodeAt(i); - if (code < 48 || code > 57) - return true; - } - return key2.length === 10 && key2 >= Math.pow(2, 32); - } - function getOwnNonIndexProperties(value) { - return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value))); - } - function compare(a, b) { - if (a === b) { - return 0; - } - var x = a.length; - var y = b.length; - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; - } - var ONLY_ENUMERABLE = void 0; - var kStrict = true; - var kLoose = false; - var kNoIterator = 0; - var kIsArray = 1; - var kIsSet = 2; - var kIsMap = 3; - function areSimilarRegExps(a, b) { - return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b); - } - function areSimilarFloatArrays(a, b) { - if (a.byteLength !== b.byteLength) { - return false; - } - for (var offset = 0; offset < a.byteLength; offset++) { - if (a[offset] !== b[offset]) { - return false; - } - } - return true; - } - function areSimilarTypedArrays(a, b) { - if (a.byteLength !== b.byteLength) { - return false; - } - return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0; - } - function areEqualArrayBuffers(buf1, buf2) { - return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0; - } - function isEqualBoxedPrimitive(val1, val2) { - if (isNumberObject(val1)) { - return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2)); - } - if (isStringObject(val1)) { - return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2); - } - if (isBooleanObject(val1)) { - return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2); - } - if (isBigIntObject(val1)) { - return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2); - } - return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2); - } - function innerDeepEqual(val1, val2, strict, memos) { - if (val1 === val2) { - if (val1 !== 0) - return true; - return strict ? objectIs(val1, val2) : true; - } - if (strict) { - if (_typeof2(val1) !== "object") { - return typeof val1 === "number" && numberIsNaN(val1) && numberIsNaN(val2); + var AsyncIteratorPrototype = Object.getPrototypeOf(function() { + }); + var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); } - if (_typeof2(val2) !== "object" || val1 === null || val2 === null) { - return false; + if (this[kEnded]) { + return Promise.resolve(createIterResult(void 0, true)); } - if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) { - return false; + if (this[kStream].destroyed) { + return new Promise(function(resolve2, reject) { + process.nextTick(function() { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve2(createIterResult(void 0, true)); + } + }); + }); } - } else { - if (val1 === null || _typeof2(val1) !== "object") { - if (val2 === null || _typeof2(val2) !== "object") { - return val1 == val2; + var lastPromise = this[kLastPromise]; + var promise2; + if (lastPromise) { + promise2 = new Promise(wrapForNext(lastPromise, this)); + } else { + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); } - return false; - } - if (val2 === null || _typeof2(val2) !== "object") { - return false; - } - } - var val1Tag = objectToString(val1); - var val2Tag = objectToString(val2); - if (val1Tag !== val2Tag) { - return false; - } - if (Array.isArray(val1)) { - if (val1.length !== val2.length) { - return false; - } - var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); - var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); - if (keys1.length !== keys2.length) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsArray, keys1); - } - if (val1Tag === "[object Object]") { - if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) { - return false; + promise2 = new Promise(this[kHandlePromise]); } + this[kLastPromise] = promise2; + return promise2; } - if (isDate(val1)) { - if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) { - return false; - } - } else if (isRegExp(val1)) { - if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) { - return false; - } - } else if (isNativeError(val1) || val1 instanceof Error) { - if (val1.message !== val2.message || val1.name !== val2.name) { - return false; - } - } else if (isArrayBufferView(val1)) { - if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) { - if (!areSimilarFloatArrays(val1, val2)) { - return false; + }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { + return this; + }), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + return new Promise(function(resolve2, reject) { + _this2[kStream].destroy(null, function(err) { + if (err) { + reject(err); + return; } - } else if (!areSimilarTypedArrays(val1, val2)) { - return false; - } - var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); - var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); - if (_keys.length !== _keys2.length) { - return false; - } - return keyCheck(val1, val2, strict, memos, kNoIterator, _keys); - } else if (isSet(val1)) { - if (!isSet(val2) || val1.size !== val2.size) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsSet); - } else if (isMap(val1)) { - if (!isMap(val2) || val1.size !== val2.size) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsMap); - } else if (isAnyArrayBuffer(val1)) { - if (!areEqualArrayBuffers(val1, val2)) { - return false; - } - } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) { - return false; - } - return keyCheck(val1, val2, strict, memos, kNoIterator); - } - function getEnumerables(val, keys) { - return keys.filter(function(k) { - return propertyIsEnumerable(val, k); + resolve2(createIterResult(void 0, true)); + }); }); - } - function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { - if (arguments.length === 5) { - aKeys = Object.keys(val1); - var bKeys = Object.keys(val2); - if (aKeys.length !== bKeys.length) { - return false; - } - } - var i = 0; - for (; i < aKeys.length; i++) { - if (!hasOwnProperty(val2, aKeys[i])) { - return false; - } - } - if (strict && arguments.length === 5) { - var symbolKeysA = objectGetOwnPropertySymbols(val1); - if (symbolKeysA.length !== 0) { - var count = 0; - for (i = 0; i < symbolKeysA.length; i++) { - var key2 = symbolKeysA[i]; - if (propertyIsEnumerable(val1, key2)) { - if (!propertyIsEnumerable(val2, key2)) { - return false; - } - aKeys.push(key2); - count++; - } else if (propertyIsEnumerable(val2, key2)) { - return false; - } - } - var symbolKeysB = objectGetOwnPropertySymbols(val2); - if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) { - return false; - } - } else { - var _symbolKeysB = objectGetOwnPropertySymbols(val2); - if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) { - return false; + }), _Object$setPrototypeO), AsyncIteratorPrototype); + var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve2, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve2(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve2; + iterator[kLastReject] = reject; } - } - } - if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) { - return true; - } - if (memos === void 0) { - memos = { - val1: /* @__PURE__ */ new Map(), - val2: /* @__PURE__ */ new Map(), - position: 0 - }; - } else { - var val2MemoA = memos.val1.get(val1); - if (val2MemoA !== void 0) { - var val2MemoB = memos.val2.get(val2); - if (val2MemoB !== void 0) { - return val2MemoA === val2MemoB; + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function(err) { + if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { + var reject = iterator[kLastReject]; + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); } + iterator[kError] = err; + return; } - memos.position++; - } - memos.val1.set(val1, memos.position); - memos.val2.set(val2, memos.position); - var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType); - memos.val1.delete(val1); - memos.val2.delete(val2); - return areEq; - } - function setHasEqualElement(set, val1, strict, memo) { - var setValues = arrayFromSet(set); - for (var i = 0; i < setValues.length; i++) { - var val2 = setValues[i]; - if (innerDeepEqual(val1, val2, strict, memo)) { - set.delete(val2); - return true; + var resolve2 = iterator[kLastResolve]; + if (resolve2 !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve2(createIterResult(void 0, true)); } - } - return false; - } - function findLooseMatchingPrimitives(prim) { - switch (_typeof2(prim)) { - case "undefined": - return null; - case "object": - return void 0; - case "symbol": - return false; - case "string": - prim = +prim; - case "number": - if (numberIsNaN(prim)) { - return false; - } - } - return true; + iterator[kEnded] = true; + }); + stream.on("readable", onReadable.bind(null, iterator)); + return iterator; + }; + module.exports = createReadableStreamAsyncIterator; + } + }); + + // node_modules/readable-stream/lib/internal/streams/from-browser.js + var require_from_browser = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) { + init_define_BUILD_VERSION(); + init_esbuild_inject(); + module.exports = function() { + throw new Error("Readable.from is not available in the browser"); + }; + } + }); + + // node_modules/readable-stream/lib/_stream_readable.js + var require_stream_readable = __commonJS({ + "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + module.exports = Readable; + var Duplex; + Readable.ReadableState = ReadableState; + var EE = require_events().EventEmitter; + var EElistenerCount = function EElistenerCount2(emitter, type) { + return emitter.listeners(type).length; + }; + var Stream = require_stream_browser(); + var Buffer14 = require_buffer().Buffer; + var OurUint8Array = window.Uint8Array || function() { + }; + function _uint8ArrayToBuffer(chunk) { + return Buffer14.from(chunk); } - function setMightHaveLoosePrim(a, b, prim) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) - return altValue; - return b.has(altValue) && !a.has(altValue); + function _isUint8Array(obj) { + return Buffer14.isBuffer(obj) || obj instanceof OurUint8Array; } - function mapMightHaveLoosePrim(a, b, prim, item, memo) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) { - return altValue; - } - var curB = b.get(altValue); - if (curB === void 0 && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) { - return false; - } - return !a.has(altValue) && innerDeepEqual(item, curB, false, memo); + var debugUtil = require_util(); + var debug; + if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog("stream"); + } else { + debug = function debug2() { + }; } - function setEquiv(a, b, strict, memo) { - var set = null; - var aValues = arrayFromSet(a); - for (var i = 0; i < aValues.length; i++) { - var val = aValues[i]; - if (_typeof2(val) === "object" && val !== null) { - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(val); - } else if (!b.has(val)) { - if (strict) - return false; - if (!setMightHaveLoosePrim(a, b, val)) { - return false; - } - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(val); - } - } - if (set !== null) { - var bValues = arrayFromSet(b); - for (var _i = 0; _i < bValues.length; _i++) { - var _val = bValues[_i]; - if (_typeof2(_val) === "object" && _val !== null) { - if (!setHasEqualElement(set, _val, strict, memo)) - return false; - } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) { - return false; - } - } - return set.size === 0; + var BufferList = require_buffer_list(); + var destroyImpl = require_destroy(); + var _require = require_state(); + var getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require_errors_browser().codes; + var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; + var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + var StringDecoder; + var createReadableStreamAsyncIterator; + var from; + require_inherits_browser()(Readable, Stream); + var errorOrDestroy = destroyImpl.errorOrDestroy; + var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; + function prependListener(emitter, event, fn) { + if (typeof emitter.prependListener === "function") + return emitter.prependListener(event, fn); + if (!emitter._events || !emitter._events[event]) + emitter.on(event, fn); + else if (Array.isArray(emitter._events[event])) + emitter._events[event].unshift(fn); + else + emitter._events[event] = [fn, emitter._events[event]]; + } + function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + if (typeof isDuplex !== "boolean") + isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex); + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + this.sync = true; + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + this.emitClose = options.emitClose !== false; + this.autoDestroy = !!options.autoDestroy; + this.destroyed = false; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.awaitDrain = 0; + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require_string_decoder().StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; } - return true; } - function mapHasEqualEntry(set, map, key1, item1, strict, memo) { - var setValues = arrayFromSet(set); - for (var i = 0; i < setValues.length; i++) { - var key2 = setValues[i]; - if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) { - set.delete(key2); - return true; - } + function Readable(options) { + Duplex = Duplex || require_stream_duplex(); + if (!(this instanceof Readable)) + return new Readable(options); + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + this.readable = true; + if (options) { + if (typeof options.read === "function") + this._read = options.read; + if (typeof options.destroy === "function") + this._destroy = options.destroy; } - return false; + Stream.call(this); } - function mapEquiv(a, b, strict, memo) { - var set = null; - var aEntries = arrayFromMap(a); - for (var i = 0; i < aEntries.length; i++) { - var _aEntries$i = _slicedToArray(aEntries[i], 2), key2 = _aEntries$i[0], item1 = _aEntries$i[1]; - if (_typeof2(key2) === "object" && key2 !== null) { - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(key2); - } else { - var item2 = b.get(key2); - if (item2 === void 0 && !b.has(key2) || !innerDeepEqual(item1, item2, strict, memo)) { - if (strict) - return false; - if (!mapMightHaveLoosePrim(a, b, key2, item1, memo)) - return false; - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(key2); - } + Object.defineProperty(Readable.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._readableState === void 0) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + if (!this._readableState) { + return; } + this._readableState.destroyed = value; } - if (set !== null) { - var bEntries = arrayFromMap(b); - for (var _i2 = 0; _i2 < bEntries.length; _i2++) { - var _bEntries$_i = _slicedToArray(bEntries[_i2], 2), key2 = _bEntries$_i[0], item = _bEntries$_i[1]; - if (_typeof2(key2) === "object" && key2 !== null) { - if (!mapHasEqualEntry(set, a, key2, item, strict, memo)) - return false; - } else if (!strict && (!a.has(key2) || !innerDeepEqual(a.get(key2), item, false, memo)) && !mapHasEqualEntry(set, a, key2, item, false, memo)) { - return false; + }); + Readable.prototype.destroy = destroyImpl.destroy; + Readable.prototype._undestroy = destroyImpl.undestroy; + Readable.prototype._destroy = function(err, cb) { + cb(err); + }; + Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === "string") { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer14.from(chunk, encoding); + encoding = ""; } + skipChunkCheck = true; } - return set.size === 0; + } else { + skipChunkCheck = true; } - return true; - } - function objEquiv(a, b, strict, keys, memos, iterationType) { - var i = 0; - if (iterationType === kIsSet) { - if (!setEquiv(a, b, strict, memos)) { - return false; - } - } else if (iterationType === kIsMap) { - if (!mapEquiv(a, b, strict, memos)) { - return false; - } - } else if (iterationType === kIsArray) { - for (; i < a.length; i++) { - if (hasOwnProperty(a, i)) { - if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) { - return false; - } - } else if (hasOwnProperty(b, i)) { + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); + }; + Readable.prototype.unshift = function(chunk) { + return readableAddChunk(this, chunk, null, true, false); + }; + function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug("readableAddChunk", chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) + er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer14.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) + errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); + else + addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { return false; } else { - var keysA = Object.keys(a); - for (; i < keysA.length; i++) { - var key2 = keysA[i]; - if (!hasOwnProperty(b, key2) || !innerDeepEqual(a[key2], b[key2], strict, memos)) { - return false; - } - } - if (keysA.length !== Object.keys(b).length) { - return false; + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) + addChunk(stream, state, chunk, false); + else + maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); } - return true; } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); } } - for (i = 0; i < keys.length; i++) { - var _key = keys[i]; - if (!innerDeepEqual(a[_key], b[_key], strict, memos)) { - return false; - } - } - return true; - } - function isDeepEqual(val1, val2) { - return innerDeepEqual(val1, val2, kLoose); - } - function isDeepStrictEqual(val1, val2) { - return innerDeepEqual(val1, val2, kStrict); - } - module.exports = { - isDeepEqual, - isDeepStrictEqual - }; - } - }); - - // node_modules/assert-browserify/build/assert.js - var require_assert = __commonJS({ - "node_modules/assert-browserify/build/assert.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof2(obj); - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } + return !state.ended && (state.length < state.highWaterMark || state.length === 0); } - var _require = require_errors(); - var _require$codes = _require.codes; - var ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE; - var ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE; - var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; - var AssertionError = require_assertion_error(); - var _require2 = require_util(); - var inspect = _require2.inspect; - var _require$types = require_util().types; - var isPromise = _require$types.isPromise; - var isRegExp = _require$types.isRegExp; - var objectAssign = Object.assign ? Object.assign : require_es6_object_assign().assign; - var objectIs = Object.is ? Object.is : require_object_is(); - var isDeepEqual; - var isDeepStrictEqual; - function lazyLoadComparison() { - var comparison = require_comparisons(); - isDeepEqual = comparison.isDeepEqual; - isDeepStrictEqual = comparison.isDeepStrictEqual; - } - var warned = false; - var assert = module.exports = ok; - var NO_EXCEPTION_SENTINEL = {}; - function innerFail(obj) { - if (obj.message instanceof Error) - throw obj.message; - throw new AssertionError(obj); - } - function fail(actual, expected, message, operator, stackStartFn) { - var argsLen = arguments.length; - var internalMessage; - if (argsLen === 0) { - internalMessage = "Failed"; - } else if (argsLen === 1) { - message = actual; - actual = void 0; + function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit("data", chunk); } else { - if (warned === false) { - warned = true; - var warn2 = process.emitWarning ? process.emitWarning : console.warn.bind(console); - warn2("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.", "DeprecationWarning", "DEP0094"); - } - if (argsLen === 2) - operator = "!="; - } - if (message instanceof Error) - throw message; - var errArgs = { - actual, - expected, - operator: operator === void 0 ? "fail" : operator, - stackStartFn: stackStartFn || fail - }; - if (message !== void 0) { - errArgs.message = message; - } - var err = new AssertionError(errArgs); - if (internalMessage) { - err.message = internalMessage; - err.generatedMessage = true; - } - throw err; - } - assert.fail = fail; - assert.AssertionError = AssertionError; - function innerOk(fn, argLen, value, message) { - if (!value) { - var generatedMessage = false; - if (argLen === 0) { - generatedMessage = true; - message = "No value argument passed to `assert.ok()`"; - } else if (message instanceof Error) { - throw message; - } - var err = new AssertionError({ - actual: value, - expected: true, - message, - operator: "==", - stackStartFn: fn - }); - err.generatedMessage = generatedMessage; - throw err; + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + if (state.needReadable) + emitReadable(stream); } + maybeReadMore(stream, state); } - function ok() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); } - innerOk.apply(void 0, [ok, args.length].concat(args)); + return er; } - assert.ok = ok; - assert.equal = function equal(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (actual != expected) { - innerFail({ - actual, - expected, - message, - operator: "==", - stackStartFn: equal - }); - } - }; - assert.notEqual = function notEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (actual == expected) { - innerFail({ - actual, - expected, - message, - operator: "!=", - stackStartFn: notEqual - }); - } - }; - assert.deepEqual = function deepEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (!isDeepEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "deepEqual", - stackStartFn: deepEqual - }); - } - }; - assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (isDeepEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notDeepEqual", - stackStartFn: notDeepEqual - }); - } + Readable.prototype.isPaused = function() { + return this._readableState.flowing === false; }; - assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (!isDeepStrictEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "deepStrictEqual", - stackStartFn: deepStrictEqual - }); + Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require_string_decoder().StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + this._readableState.encoding = this._readableState.decoder.encoding; + var p = this._readableState.buffer.head; + var content = ""; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; } + this._readableState.buffer.clear(); + if (content !== "") + this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; }; - assert.notDeepStrictEqual = notDeepStrictEqual; - function notDeepStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (isDeepStrictEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notDeepStrictEqual", - stackStartFn: notDeepStrictEqual - }); - } - } - assert.strictEqual = function strictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (!objectIs(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "strictEqual", - stackStartFn: strictEqual - }); - } - }; - assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (objectIs(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notStrictEqual", - stackStartFn: notStrictEqual - }); - } - }; - var Comparison = function Comparison2(obj, keys, actual) { - var _this = this; - _classCallCheck(this, Comparison2); - keys.forEach(function(key2) { - if (key2 in obj) { - if (actual !== void 0 && typeof actual[key2] === "string" && isRegExp(obj[key2]) && obj[key2].test(actual[key2])) { - _this[key2] = actual[key2]; - } else { - _this[key2] = obj[key2]; - } - } - }); - }; - function compareExceptionKey(actual, expected, key2, message, keys, fn) { - if (!(key2 in actual) || !isDeepStrictEqual(actual[key2], expected[key2])) { - if (!message) { - var a = new Comparison(actual, keys); - var b = new Comparison(expected, keys, actual); - var err = new AssertionError({ - actual: a, - expected: b, - operator: "deepStrictEqual", - stackStartFn: fn - }); - err.actual = actual; - err.expected = expected; - err.operator = fn.name; - throw err; - } - innerFail({ - actual, - expected, - message, - operator: fn.name, - stackStartFn: fn - }); - } - } - function expectedException(actual, expected, msg, fn) { - if (typeof expected !== "function") { - if (isRegExp(expected)) - return expected.test(actual); - if (arguments.length === 2) { - throw new ERR_INVALID_ARG_TYPE("expected", ["Function", "RegExp"], expected); - } - if (_typeof2(actual) !== "object" || actual === null) { - var err = new AssertionError({ - actual, - expected, - message: msg, - operator: "deepStrictEqual", - stackStartFn: fn - }); - err.operator = fn.name; - throw err; - } - var keys = Object.keys(expected); - if (expected instanceof Error) { - keys.push("name", "message"); - } else if (keys.length === 0) { - throw new ERR_INVALID_ARG_VALUE("error", expected, "may not be an empty object"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - keys.forEach(function(key2) { - if (typeof actual[key2] === "string" && isRegExp(expected[key2]) && expected[key2].test(actual[key2])) { - return; - } - compareExceptionKey(actual, expected, key2, msg, keys, fn); - }); - return true; - } - if (expected.prototype !== void 0 && actual instanceof expected) { - return true; - } - if (Error.isPrototypeOf(expected)) { - return false; - } - return expected.call({}, actual) === true; - } - function getActual(fn) { - if (typeof fn !== "function") { - throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn); - } - try { - fn(); - } catch (e) { - return e; - } - return NO_EXCEPTION_SENTINEL; - } - function checkIsPromise(obj) { - return isPromise(obj) || obj !== null && _typeof2(obj) === "object" && typeof obj.then === "function" && typeof obj.catch === "function"; - } - function waitForActual(promiseFn) { - return Promise.resolve().then(function() { - var resultPromise; - if (typeof promiseFn === "function") { - resultPromise = promiseFn(); - if (!checkIsPromise(resultPromise)) { - throw new ERR_INVALID_RETURN_VALUE("instance of Promise", "promiseFn", resultPromise); - } - } else if (checkIsPromise(promiseFn)) { - resultPromise = promiseFn; - } else { - throw new ERR_INVALID_ARG_TYPE("promiseFn", ["Function", "Promise"], promiseFn); - } - return Promise.resolve().then(function() { - return resultPromise; - }).then(function() { - return NO_EXCEPTION_SENTINEL; - }).catch(function(e) { - return e; - }); - }); - } - function expectsError(stackStartFn, actual, error, message) { - if (typeof error === "string") { - if (arguments.length === 4) { - throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); - } - if (_typeof2(actual) === "object" && actual !== null) { - if (actual.message === error) { - throw new ERR_AMBIGUOUS_ARGUMENT("error/message", 'The error message "'.concat(actual.message, '" is identical to the message.')); - } - } else if (actual === error) { - throw new ERR_AMBIGUOUS_ARGUMENT("error/message", 'The error "'.concat(actual, '" is identical to the message.')); - } - message = error; - error = void 0; - } else if (error != null && _typeof2(error) !== "object" && typeof error !== "function") { - throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); - } - if (actual === NO_EXCEPTION_SENTINEL) { - var details = ""; - if (error && error.name) { - details += " (".concat(error.name, ")"); - } - details += message ? ": ".concat(message) : "."; - var fnType = stackStartFn.name === "rejects" ? "rejection" : "exception"; - innerFail({ - actual: void 0, - expected: error, - operator: stackStartFn.name, - message: "Missing expected ".concat(fnType).concat(details), - stackStartFn - }); - } - if (error && !expectedException(actual, error, message, stackStartFn)) { - throw actual; - } - } - function expectsNoError(stackStartFn, actual, error, message) { - if (actual === NO_EXCEPTION_SENTINEL) - return; - if (typeof error === "string") { - message = error; - error = void 0; - } - if (!error || expectedException(actual, error)) { - var details = message ? ": ".concat(message) : "."; - var fnType = stackStartFn.name === "doesNotReject" ? "rejection" : "exception"; - innerFail({ - actual, - expected: error, - operator: stackStartFn.name, - message: "Got unwanted ".concat(fnType).concat(details, "\n") + 'Actual message: "'.concat(actual && actual.message, '"'), - stackStartFn - }); - } - throw actual; - } - assert.throws = function throws(promiseFn) { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args)); - }; - assert.rejects = function rejects(promiseFn) { - for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { - args[_key3 - 1] = arguments[_key3]; - } - return waitForActual(promiseFn).then(function(result) { - return expectsError.apply(void 0, [rejects, result].concat(args)); - }); - }; - assert.doesNotThrow = function doesNotThrow(fn) { - for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { - args[_key4 - 1] = arguments[_key4]; - } - expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args)); - }; - assert.doesNotReject = function doesNotReject(fn) { - for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { - args[_key5 - 1] = arguments[_key5]; - } - return waitForActual(fn).then(function(result) { - return expectsNoError.apply(void 0, [doesNotReject, result].concat(args)); - }); - }; - assert.ifError = function ifError(err) { - if (err !== null && err !== void 0) { - var message = "ifError got unwanted exception: "; - if (_typeof2(err) === "object" && typeof err.message === "string") { - if (err.message.length === 0 && err.constructor) { - message += err.constructor.name; - } else { - message += err.message; - } - } else { - message += inspect(err); - } - var newErr = new AssertionError({ - actual: err, - expected: null, - operator: "ifError", - message, - stackStartFn: ifError - }); - var origStack = err.stack; - if (typeof origStack === "string") { - var tmp2 = origStack.split("\n"); - tmp2.shift(); - var tmp1 = newErr.stack.split("\n"); - for (var i = 0; i < tmp2.length; i++) { - var pos = tmp1.indexOf(tmp2[i]); - if (pos !== -1) { - tmp1 = tmp1.slice(0, pos); - break; - } - } - newErr.stack = "".concat(tmp1.join("\n"), "\n").concat(tmp2.join("\n")); - } - throw newErr; - } - }; - function strict() { - for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { - args[_key6] = arguments[_key6]; - } - innerOk.apply(void 0, [strict, args.length].concat(args)); - } - assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual - }); - assert.strict.strict = assert.strict; - } - }); - - // node_modules/browser-process/dist/node_process.js - var require_node_process = __commonJS({ - "node_modules/browser-process/dist/node_process.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var __extends = exports.__extends || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - function __() { - this.constructor = d; - } - __.prototype = b.prototype; - d.prototype = new __(); - }; - var eventemitter = require_node_eventemitter(); - var path = null; - var TTY = function(_super) { - __extends(TTY2, _super); - function TTY2() { - _super.call(this, true, true); - this.isRaw = false; - this.columns = 80; - this.rows = 120; - this.isTTY = true; - } - TTY2.prototype.setReadMode = function(mode) { - if (this.isRaw !== mode) { - this.isRaw = mode; - this.emit("modeChange"); - } - }; - TTY2.prototype.changeColumns = function(columns) { - if (columns !== this.columns) { - this.columns = columns; - this.emit("resize"); - } - }; - TTY2.prototype.changeRows = function(rows) { - if (rows !== this.rows) { - this.rows = rows; - this.emit("resize"); - } - }; - TTY2.isatty = function(fd) { - return fd instanceof TTY2; - }; - return TTY2; - }(eventemitter.AbstractDuplexStream); - exports.TTY = TTY; - var Process = function() { - function Process2() { - this.startTime = Date.now(); - this._cwd = "/"; - this.platform = "browser"; - this.argv = []; - this.stdout = new TTY(); - this.stderr = new TTY(); - this.stdin = new TTY(); - } - Process2.prototype.chdir = function(dir) { - if (path === null) { - path = require_assert(); - } - this._cwd = path.resolve(dir); - }; - Process2.prototype.cwd = function() { - return this._cwd; - }; - Process2.prototype.uptime = function() { - return (Date.now() - this.startTime) / 1e3 | 0; - }; - return Process2; - }(); - exports.Process = Process; - exports.process = new Process(); - module.exports = exports.process; - } - }); - - // node_modules/crc-32/crc32.js - var require_crc32 = __commonJS({ - "node_modules/crc-32/crc32.js"(exports) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var CRC32; - (function(factory) { - if (typeof DO_NOT_EXPORT_CRC === "undefined") { - if (typeof exports === "object") { - factory(exports); - } else if (typeof define === "function" && define.amd) { - define(function() { - var module2 = {}; - factory(module2); - return module2; - }); - } else { - factory(CRC32 = {}); - } - } else { - factory(CRC32 = {}); - } - })(function(CRC322) { - CRC322.version = "1.2.0"; - function signed_crc_table() { - var c = 0, table = new Array(256); - for (var n = 0; n != 256; ++n) { - c = n; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - table[n] = c; - } - return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; - } - var T = signed_crc_table(); - function crc32_bstr(bstr, seed) { - var C = seed ^ -1, L = bstr.length - 1; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; - } - if (i === L) - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255]; - return C ^ -1; - } - function crc32_buf(buf2, seed) { - if (buf2.length > 1e4) - return crc32_buf_8(buf2, seed); - var C = seed ^ -1, L = buf2.length - 3; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - } - while (i < L + 3) - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - return C ^ -1; - } - function crc32_buf_8(buf2, seed) { - var C = seed ^ -1, L = buf2.length - 7; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - } - while (i < L + 7) - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - return C ^ -1; - } - function crc32_str(str, seed) { - var C = seed ^ -1; - for (var i = 0, L = str.length, c, d; i < L; ) { - c = str.charCodeAt(i++); - if (c < 128) { - C = C >>> 8 ^ T[(C ^ c) & 255]; - } else if (c < 2048) { - C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; - } else if (c >= 55296 && c < 57344) { - c = (c & 1023) + 64; - d = str.charCodeAt(i++) & 1023; - C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255]; - } else { - C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; - } - } - return C ^ -1; - } - CRC322.table = T; - CRC322.bstr = crc32_bstr; - CRC322.buf = crc32_buf; - CRC322.str = crc32_str; - }); - } - }); - - // node_modules/readable-stream/lib/internal/streams/stream-browser.js - var require_stream_browser = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = require_events().EventEmitter; - } - }); - - // (disabled):node_modules/util/util.js - var require_util2 = __commonJS({ - "(disabled):node_modules/util/util.js"() { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - } - }); - - // node_modules/readable-stream/lib/internal/streams/buffer_list.js - var require_buffer_list = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) - symbols = symbols.filter(function(sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - return keys; - } - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - if (i % 2) { - ownKeys(Object(source), true).forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function(key2) { - Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); - }); - } - } - return target; - } - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - var _require = require_buffer(); - var Buffer18 = _require.Buffer; - var _require2 = require_util2(); - var inspect = _require2.inspect; - var custom = inspect && inspect.custom || "inspect"; - function copyBuffer(src, target, offset) { - Buffer18.prototype.copy.call(src, target, offset); - } - module.exports = /* @__PURE__ */ function() { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; - } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) - this.tail.next = entry; - else - this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) - this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - if (this.length === 0) - return; - var ret = this.head.data; - if (this.length === 1) - this.head = this.tail = null; - else - this.head = this.head.next; - --this.length; - return ret; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) - return ""; - var p = this.head; - var ret = "" + p.data; - while (p = p.next) { - ret += s + p.data; - } - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) - return Buffer18.alloc(0); - var ret = Buffer18.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - } - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; - if (n < this.head.data.length) { - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - ret = this.shift(); - } else { - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) - ret += str; - else - ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) - this.head = p.next; - else - this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer18.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf2 = p.data; - var nb = n > buf2.length ? buf2.length : n; - buf2.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf2.length) { - ++c; - if (p.next) - this.head = p.next; - else - this.head = this.tail = null; - } else { - this.head = p; - p.data = buf2.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread({}, options, { - depth: 0, - customInspect: false - })); - } - }]); - return BufferList; - }(); - } - }); - - // node_modules/readable-stream/lib/internal/streams/destroy.js - var require_destroy = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function destroy(err, cb) { - var _this = this; - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } - return this; - } - if (this._readableState) { - this._readableState.destroyed = true; - } - if (this._writableState) { - this._writableState.destroyed = true; - } - this._destroy(err || null, function(err2) { - if (!cb && err2) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err2); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err2); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err2); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - return this; - } - function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); - } - function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) - return; - if (self._readableState && !self._readableState.emitClose) - return; - self.emit("close"); - } - function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } - } - function emitErrorNT(self, err) { - self.emit("error", err); - } - function errorOrDestroy(stream, err) { - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) - stream.destroy(err); - else - stream.emit("error", err); - } - module.exports = { - destroy, - undestroy, - errorOrDestroy - }; - } - }); - - // node_modules/readable-stream/errors-browser.js - var require_errors_browser = __commonJS({ - "node_modules/readable-stream/errors-browser.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; - } - var codes = {}; - function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - function getMessage(arg1, arg2, arg3) { - if (typeof message === "string") { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - var NodeError = /* @__PURE__ */ function(_Base) { - _inheritsLoose(NodeError2, _Base); - function NodeError2(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; - } - return NodeError2; - }(Base); - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; - } - function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function(i) { - return String(i); - }); - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } - } - function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; - } - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; - } - return str.substring(this_len - search.length, this_len) === search; - } - function includes(str, search, start) { - if (typeof start !== "number") { - start = 0; - } - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } - } - createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; - }, TypeError); - createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { - var determiner; - if (typeof expected === "string" && startsWith(expected, "not ")) { - determiner = "must not be"; - expected = expected.replace(/^not /, ""); - } else { - determiner = "must be"; - } - var msg; - if (endsWith(name, " argument")) { - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } else { - var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } - msg += ". Received type ".concat(typeof actual); - return msg; - }, TypeError); - createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); - createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { - return "The " + name + " method is not implemented"; - }); - createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); - createErrorType("ERR_STREAM_DESTROYED", function(name) { - return "Cannot call " + name + " after a stream was destroyed"; - }); - createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); - createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); - createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); - createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); - createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { - return "Unknown encoding: " + arg; - }, TypeError); - createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); - module.exports.codes = codes; - } - }); - - // node_modules/readable-stream/lib/internal/streams/state.js - var require_state = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE; - function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; - } - function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : "highWaterMark"; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - return Math.floor(hwm); - } - return state.objectMode ? 16 : 16 * 1024; - } - module.exports = { - getHighWaterMark - }; - } - }); - - // node_modules/util-deprecate/browser.js - var require_browser = __commonJS({ - "node_modules/util-deprecate/browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = deprecate; - function deprecate(fn, msg) { - if (config("noDeprecation")) { - return fn; - } - var warned = false; - function deprecated() { - if (!warned) { - if (config("throwDeprecation")) { - throw new Error(msg); - } else if (config("traceDeprecation")) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - return deprecated; - } - function config(name) { - try { - if (!window.localStorage) - return false; - } catch (_) { - return false; - } - var val = window.localStorage[name]; - if (val == null) - return false; - return String(val).toLowerCase() === "true"; - } - } - }); - - // node_modules/readable-stream/lib/_stream_writable.js - var require_stream_writable = __commonJS({ - "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Writable; - function CorkedRequest(state) { - var _this = this; - this.next = null; - this.entry = null; - this.finish = function() { - onCorkedFinish(_this, state); - }; - } - var Duplex; - Writable.WritableState = WritableState; - var internalUtil = { - deprecate: require_browser() - }; - var Stream = require_stream_browser(); - var Buffer18 = require_buffer().Buffer; - var OurUint8Array = window.Uint8Array || function() { - }; - function _uint8ArrayToBuffer(chunk) { - return Buffer18.from(chunk); - } - function _isUint8Array(obj) { - return Buffer18.isBuffer(obj) || obj instanceof OurUint8Array; - } - var destroyImpl = require_destroy(); - var _require = require_state(); - var getHighWaterMark = _require.getHighWaterMark; - var _require$codes = require_errors_browser().codes; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; - var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE; - var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES; - var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END; - var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - var errorOrDestroy = destroyImpl.errorOrDestroy; - require_inherits_browser()(Writable, Stream); - function nop() { - } - function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require_stream_duplex(); - options = options || {}; - if (typeof isDuplex !== "boolean") - isDuplex = stream instanceof Duplex; - this.objectMode = !!options.objectMode; - if (isDuplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; - this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex); - this.finalCalled = false; - this.needDrain = false; - this.ending = false; - this.ended = false; - this.finished = false; - this.destroyed = false; - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - this.defaultEncoding = options.defaultEncoding || "utf8"; - this.length = 0; - this.writing = false; - this.corked = 0; - this.sync = true; - this.bufferProcessing = false; - this.onwrite = function(er) { - onwrite(stream, er); - }; - this.writecb = null; - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; - this.pendingcb = 0; - this.prefinished = false; - this.errorEmitted = false; - this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; - this.bufferedRequestCount = 0; - this.corkedRequestsFree = new CorkedRequest(this); - } - WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; - }; - (function() { - try { - Object.defineProperty(WritableState.prototype, "buffer", { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") - }); - } catch (_) { - } - })(); - var realHasInstance; - if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) - return true; - if (this !== Writable) - return false; - return object && object._writableState instanceof WritableState; - } - }); - } else { - realHasInstance = function realHasInstance2(object) { - return object instanceof this; - }; - } - function Writable(options) { - Duplex = Duplex || require_stream_duplex(); - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) - return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); - this.writable = true; - if (options) { - if (typeof options.write === "function") - this._write = options.write; - if (typeof options.writev === "function") - this._writev = options.writev; - if (typeof options.destroy === "function") - this._destroy = options.destroy; - if (typeof options.final === "function") - this._final = options.final; - } - Stream.call(this); - } - Writable.prototype.pipe = function() { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); - }; - function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); - errorOrDestroy(stream, er); - process.nextTick(cb, er); - } - function validChunk(stream, state, chunk, cb) { - var er; - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== "string" && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); - } - if (er) { - errorOrDestroy(stream, er); - process.nextTick(cb, er); - return false; - } - return true; - } - Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer18.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (typeof encoding === "function") { - cb = encoding; - encoding = null; - } - if (isBuf) - encoding = "buffer"; - else if (!encoding) - encoding = state.defaultEncoding; - if (typeof cb !== "function") - cb = nop; - if (state.ending) - writeAfterEnd(this, cb); - else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; - }; - Writable.prototype.cork = function() { - this._writableState.corked++; - }; - Writable.prototype.uncork = function() { - var state = this._writableState; - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) - clearBuffer(this, state); - } - }; - Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - if (typeof encoding === "string") - encoding = encoding.toLowerCase(); - if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) - throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; - }; - Object.defineProperty(Writable.prototype, "writableBuffer", { - enumerable: false, - get: function get2() { - return this._writableState && this._writableState.getBuffer(); - } - }); - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { - chunk = Buffer18.from(chunk, encoding); - } - return chunk; - } - Object.defineProperty(Writable.prototype, "writableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._writableState.highWaterMark; - } - }); - function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = "buffer"; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; - if (!ret) - state.needDrain = true; - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk, - encoding, - isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - return ret; - } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) - state.onwrite(new ERR_STREAM_DESTROYED("write")); - else if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; - } - function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) { - process.nextTick(cb, er); - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - finishMaybe(stream, state); - } - } - function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; - } - function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== "function") - throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) - onwriteError(stream, state, sync, er, cb); - else { - var finished = needFinish(state) || stream.destroyed; - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); - } - } - } - function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); - } - function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit("drain"); - } - } - function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - if (stream._writev && entry && entry.next) { - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) - allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, "", holder.finish); - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - if (state.writing) { - break; - } - } - if (entry === null) - state.lastBufferedRequest = null; - } - state.bufferedRequest = entry; - state.bufferProcessing = false; - } - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); - }; - Writable.prototype._writev = null; - Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - if (typeof chunk === "function") { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === "function") { - cb = encoding; - encoding = null; - } - if (chunk !== null && chunk !== void 0) - this.write(chunk, encoding); - if (state.corked) { - state.corked = 1; - this.uncork(); - } - if (!state.ending) - endWritable(this, state, cb); - return this; - }; - Object.defineProperty(Writable.prototype, "writableLength", { - enumerable: false, - get: function get2() { - return this._writableState.length; - } - }); - function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; - } - function callFinal(stream, state) { - stream._final(function(err) { - state.pendingcb--; - if (err) { - errorOrDestroy(stream, err); - } - state.prefinished = true; - stream.emit("prefinish"); - finishMaybe(stream, state); - }); - } - function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === "function" && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit("prefinish"); - } - } - } - function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit("finish"); - if (state.autoDestroy) { - var rState = stream._readableState; - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } - } - return need; - } - function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once("finish", cb); - } - state.ended = true; - stream.writable = false; - } - function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - state.corkedRequestsFree.next = corkReq; - } - Object.defineProperty(Writable.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._writableState === void 0) { - return false; - } - return this._writableState.destroyed; - }, - set: function set(value) { - if (!this._writableState) { - return; - } - this._writableState.destroyed = value; - } - }); - Writable.prototype.destroy = destroyImpl.destroy; - Writable.prototype._undestroy = destroyImpl.undestroy; - Writable.prototype._destroy = function(err, cb) { - cb(err); - }; - } - }); - - // node_modules/readable-stream/lib/_stream_duplex.js - var require_stream_duplex = __commonJS({ - "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var objectKeys = Object.keys || function(obj) { - var keys2 = []; - for (var key2 in obj) { - keys2.push(key2); - } - return keys2; - }; - module.exports = Duplex; - var Readable = require_stream_readable(); - var Writable = require_stream_writable(); - require_inherits_browser()(Duplex, Readable); - { - keys = objectKeys(Writable.prototype); - for (v = 0; v < keys.length; v++) { - method = keys[v]; - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; - } - } - var keys; - var method; - var v; - function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - if (options) { - if (options.readable === false) - this.readable = false; - if (options.writable === false) - this.writable = false; - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once("end", onend); - } - } - } - Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._writableState.highWaterMark; - } - }); - Object.defineProperty(Duplex.prototype, "writableBuffer", { - enumerable: false, - get: function get2() { - return this._writableState && this._writableState.getBuffer(); - } - }); - Object.defineProperty(Duplex.prototype, "writableLength", { - enumerable: false, - get: function get2() { - return this._writableState.length; - } - }); - function onend() { - if (this._writableState.ended) - return; - process.nextTick(onEndNT, this); - } - function onEndNT(self) { - self.end(); - } - Object.defineProperty(Duplex.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._readableState === void 0 || this._writableState === void 0) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - if (this._readableState === void 0 || this._writableState === void 0) { - return; - } - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } - }); - } - }); - - // node_modules/safe-buffer/index.js - var require_safe_buffer = __commonJS({ - "node_modules/safe-buffer/index.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var buffer = require_buffer(); - var Buffer18 = buffer.Buffer; - function copyProps(src, dst) { - for (var key2 in src) { - dst[key2] = src[key2]; - } - } - if (Buffer18.from && Buffer18.alloc && Buffer18.allocUnsafe && Buffer18.allocUnsafeSlow) { - module.exports = buffer; - } else { - copyProps(buffer, exports); - exports.Buffer = SafeBuffer; - } - function SafeBuffer(arg, encodingOrOffset, length) { - return Buffer18(arg, encodingOrOffset, length); - } - SafeBuffer.prototype = Object.create(Buffer18.prototype); - copyProps(Buffer18, SafeBuffer); - SafeBuffer.from = function(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - throw new TypeError("Argument must not be a number"); - } - return Buffer18(arg, encodingOrOffset, length); - }; - SafeBuffer.alloc = function(size, fill, encoding) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - var buf2 = Buffer18(size); - if (fill !== void 0) { - if (typeof encoding === "string") { - buf2.fill(fill, encoding); - } else { - buf2.fill(fill); - } - } else { - buf2.fill(0); - } - return buf2; - }; - SafeBuffer.allocUnsafe = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return Buffer18(size); - }; - SafeBuffer.allocUnsafeSlow = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return buffer.SlowBuffer(size); - }; - } - }); - - // node_modules/string_decoder/lib/string_decoder.js - var require_string_decoder = __commonJS({ - "node_modules/string_decoder/lib/string_decoder.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var Buffer18 = require_safe_buffer().Buffer; - var isEncoding = Buffer18.isEncoding || function(encoding) { - encoding = "" + encoding; - switch (encoding && encoding.toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - case "raw": - return true; - default: - return false; - } - }; - function _normalizeEncoding(enc) { - if (!enc) - return "utf8"; - var retried; - while (true) { - switch (enc) { - case "utf8": - case "utf-8": - return "utf8"; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return "utf16le"; - case "latin1": - case "binary": - return "latin1"; - case "base64": - case "ascii": - case "hex": - return enc; - default: - if (retried) - return; - enc = ("" + enc).toLowerCase(); - retried = true; - } - } - } - function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== "string" && (Buffer18.isEncoding === isEncoding || !isEncoding(enc))) - throw new Error("Unknown encoding: " + enc); - return nenc || enc; - } - exports.StringDecoder = StringDecoder; - function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case "utf16le": - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case "utf8": - this.fillLast = utf8FillLast; - nb = 4; - break; - case "base64": - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer18.allocUnsafe(nb); - } - StringDecoder.prototype.write = function(buf2) { - if (buf2.length === 0) - return ""; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf2); - if (r === void 0) - return ""; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf2.length) - return r ? r + this.text(buf2, i) : this.text(buf2, i); - return r || ""; - }; - StringDecoder.prototype.end = utf8End; - StringDecoder.prototype.text = utf8Text; - StringDecoder.prototype.fillLast = function(buf2) { - if (this.lastNeed <= buf2.length) { - buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length); - this.lastNeed -= buf2.length; - }; - function utf8CheckByte(byte) { - if (byte <= 127) - return 0; - else if (byte >> 5 === 6) - return 2; - else if (byte >> 4 === 14) - return 3; - else if (byte >> 3 === 30) - return 4; - return byte >> 6 === 2 ? -1 : -2; - } - function utf8CheckIncomplete(self, buf2, i) { - var j = buf2.length - 1; - if (j < i) - return 0; - var nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) - self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) - return 0; - nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) - self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) - return 0; - nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) - nb = 0; - else - self.lastNeed = nb - 3; - } - return nb; - } - return 0; - } - function utf8CheckExtraBytes(self, buf2, p) { - if ((buf2[0] & 192) !== 128) { - self.lastNeed = 0; - return "\uFFFD"; - } - if (self.lastNeed > 1 && buf2.length > 1) { - if ((buf2[1] & 192) !== 128) { - self.lastNeed = 1; - return "\uFFFD"; - } - if (self.lastNeed > 2 && buf2.length > 2) { - if ((buf2[2] & 192) !== 128) { - self.lastNeed = 2; - return "\uFFFD"; - } - } - } - } - function utf8FillLast(buf2) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf2, p); - if (r !== void 0) - return r; - if (this.lastNeed <= buf2.length) { - buf2.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf2.copy(this.lastChar, p, 0, buf2.length); - this.lastNeed -= buf2.length; - } - function utf8Text(buf2, i) { - var total = utf8CheckIncomplete(this, buf2, i); - if (!this.lastNeed) - return buf2.toString("utf8", i); - this.lastTotal = total; - var end = buf2.length - (total - this.lastNeed); - buf2.copy(this.lastChar, 0, end); - return buf2.toString("utf8", i, end); - } - function utf8End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) - return r + "\uFFFD"; - return r; - } - function utf16Text(buf2, i) { - if ((buf2.length - i) % 2 === 0) { - var r = buf2.toString("utf16le", i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 55296 && c <= 56319) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf2[buf2.length - 2]; - this.lastChar[1] = buf2[buf2.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf2[buf2.length - 1]; - return buf2.toString("utf16le", i, buf2.length - 1); - } - function utf16End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString("utf16le", 0, end); - } - return r; - } - function base64Text(buf2, i) { - var n = (buf2.length - i) % 3; - if (n === 0) - return buf2.toString("base64", i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf2[buf2.length - 1]; - } else { - this.lastChar[0] = buf2[buf2.length - 2]; - this.lastChar[1] = buf2[buf2.length - 1]; - } - return buf2.toString("base64", i, buf2.length - n); - } - function base64End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) - return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); - return r; - } - function simpleWrite(buf2) { - return buf2.toString(this.encoding); - } - function simpleEnd(buf2) { - return buf2 && buf2.length ? this.write(buf2) : ""; - } - } - }); - - // node_modules/readable-stream/lib/internal/streams/end-of-stream.js - var require_end_of_stream = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE; - function once(callback) { - var called = false; - return function() { - if (called) - return; - called = true; - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - callback.apply(this, args); - }; - } - function noop3() { - } - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === "function"; - } - function eos(stream, opts, callback) { - if (typeof opts === "function") - return eos(stream, null, opts); - if (!opts) - opts = {}; - callback = once(callback || noop3); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable2 = opts.writable || opts.writable !== false && stream.writable; - var onlegacyfinish = function onlegacyfinish2() { - if (!stream.writable) - onfinish(); - }; - var writableEnded = stream._writableState && stream._writableState.finished; - var onfinish = function onfinish2() { - writable2 = false; - writableEnded = true; - if (!readable) - callback.call(stream); - }; - var readableEnded = stream._readableState && stream._readableState.endEmitted; - var onend = function onend2() { - readable = false; - readableEnded = true; - if (!writable2) - callback.call(stream); - }; - var onerror = function onerror2(err) { - callback.call(stream, err); - }; - var onclose = function onclose2() { - var err; - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) - err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - if (writable2 && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) - err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - }; - var onrequest = function onrequest2() { - stream.req.on("finish", onfinish); - }; - if (isRequest(stream)) { - stream.on("complete", onfinish); - stream.on("abort", onclose); - if (stream.req) - onrequest(); - else - stream.on("request", onrequest); - } else if (writable2 && !stream._writableState) { - stream.on("end", onlegacyfinish); - stream.on("close", onlegacyfinish); - } - stream.on("end", onend); - stream.on("finish", onfinish); - if (opts.error !== false) - stream.on("error", onerror); - stream.on("close", onclose); - return function() { - stream.removeListener("complete", onfinish); - stream.removeListener("abort", onclose); - stream.removeListener("request", onrequest); - if (stream.req) - stream.req.removeListener("finish", onfinish); - stream.removeListener("end", onlegacyfinish); - stream.removeListener("close", onlegacyfinish); - stream.removeListener("finish", onfinish); - stream.removeListener("end", onend); - stream.removeListener("error", onerror); - stream.removeListener("close", onclose); - }; - } - module.exports = eos; - } - }); - - // node_modules/readable-stream/lib/internal/streams/async_iterator.js - var require_async_iterator = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var _Object$setPrototypeO; - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; - } - var finished = require_end_of_stream(); - var kLastResolve = Symbol("lastResolve"); - var kLastReject = Symbol("lastReject"); - var kError = Symbol("error"); - var kEnded = Symbol("ended"); - var kLastPromise = Symbol("lastPromise"); - var kHandlePromise = Symbol("handlePromise"); - var kStream = Symbol("stream"); - function createIterResult(value, done) { - return { - value, - done - }; - } - function readAndResolve(iter) { - var resolve2 = iter[kLastResolve]; - if (resolve2 !== null) { - var data = iter[kStream].read(); - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve2(createIterResult(data, false)); - } - } - } - function onReadable(iter) { - process.nextTick(readAndResolve, iter); - } - function wrapForNext(lastPromise, iter) { - return function(resolve2, reject) { - lastPromise.then(function() { - if (iter[kEnded]) { - resolve2(createIterResult(void 0, true)); - return; - } - iter[kHandlePromise](resolve2, reject); - }, reject); - }; - } - var AsyncIteratorPrototype = Object.getPrototypeOf(function() { - }); - var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - next: function next() { - var _this = this; - var error = this[kError]; - if (error !== null) { - return Promise.reject(error); - } - if (this[kEnded]) { - return Promise.resolve(createIterResult(void 0, true)); - } - if (this[kStream].destroyed) { - return new Promise(function(resolve2, reject) { - process.nextTick(function() { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve2(createIterResult(void 0, true)); - } - }); - }); - } - var lastPromise = this[kLastPromise]; - var promise2; - if (lastPromise) { - promise2 = new Promise(wrapForNext(lastPromise, this)); - } else { - var data = this[kStream].read(); - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - promise2 = new Promise(this[kHandlePromise]); - } - this[kLastPromise] = promise2; - return promise2; - } - }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { - return this; - }), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - return new Promise(function(resolve2, reject) { - _this2[kStream].destroy(null, function(err) { - if (err) { - reject(err); - return; - } - resolve2(createIterResult(void 0, true)); - }); - }); - }), _Object$setPrototypeO), AsyncIteratorPrototype); - var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { - var _Object$create; - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve2, reject) { - var data = iterator[kStream].read(); - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve2(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve2; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function(err) { - if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { - var reject = iterator[kLastReject]; - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - iterator[kError] = err; - return; - } - var resolve2 = iterator[kLastResolve]; - if (resolve2 !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve2(createIterResult(void 0, true)); - } - iterator[kEnded] = true; - }); - stream.on("readable", onReadable.bind(null, iterator)); - return iterator; - }; - module.exports = createReadableStreamAsyncIterator; - } - }); - - // node_modules/readable-stream/lib/internal/streams/from-browser.js - var require_from_browser = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function() { - throw new Error("Readable.from is not available in the browser"); - }; - } - }); - - // node_modules/readable-stream/lib/_stream_readable.js - var require_stream_readable = __commonJS({ - "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Readable; - var Duplex; - Readable.ReadableState = ReadableState; - var EE = require_events().EventEmitter; - var EElistenerCount = function EElistenerCount2(emitter, type) { - return emitter.listeners(type).length; - }; - var Stream = require_stream_browser(); - var Buffer18 = require_buffer().Buffer; - var OurUint8Array = window.Uint8Array || function() { - }; - function _uint8ArrayToBuffer(chunk) { - return Buffer18.from(chunk); - } - function _isUint8Array(obj) { - return Buffer18.isBuffer(obj) || obj instanceof OurUint8Array; - } - var debugUtil = require_util2(); - var debug; - if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog("stream"); - } else { - debug = function debug2() { - }; - } - var BufferList = require_buffer_list(); - var destroyImpl = require_destroy(); - var _require = require_state(); - var getHighWaterMark = _require.getHighWaterMark; - var _require$codes = require_errors_browser().codes; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; - var StringDecoder; - var createReadableStreamAsyncIterator; - var from; - require_inherits_browser()(Readable, Stream); - var errorOrDestroy = destroyImpl.errorOrDestroy; - var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; - function prependListener(emitter, event, fn) { - if (typeof emitter.prependListener === "function") - return emitter.prependListener(event, fn); - if (!emitter._events || !emitter._events[event]) - emitter.on(event, fn); - else if (Array.isArray(emitter._events[event])) - emitter._events[event].unshift(fn); - else - emitter._events[event] = [fn, emitter._events[event]]; - } - function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require_stream_duplex(); - options = options || {}; - if (typeof isDuplex !== "boolean") - isDuplex = stream instanceof Duplex; - this.objectMode = !!options.objectMode; - if (isDuplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex); - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - this.sync = true; - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; - this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; - this.destroyed = false; - this.defaultEncoding = options.defaultEncoding || "utf8"; - this.awaitDrain = 0; - this.readingMore = false; - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require_string_decoder().StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } - } - function Readable(options) { - Duplex = Duplex || require_stream_duplex(); - if (!(this instanceof Readable)) - return new Readable(options); - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); - this.readable = true; - if (options) { - if (typeof options.read === "function") - this._read = options.read; - if (typeof options.destroy === "function") - this._destroy = options.destroy; - } - Stream.call(this); - } - Object.defineProperty(Readable.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._readableState === void 0) { - return false; - } - return this._readableState.destroyed; - }, - set: function set(value) { - if (!this._readableState) { - return; - } - this._readableState.destroyed = value; - } - }); - Readable.prototype.destroy = destroyImpl.destroy; - Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function(err, cb) { - cb(err); - }; - Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - if (!state.objectMode) { - if (typeof chunk === "string") { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer18.from(chunk, encoding); - encoding = ""; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); - }; - Readable.prototype.unshift = function(chunk) { - return readableAddChunk(this, chunk, null, true, false); - }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug("readableAddChunk", chunk); - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) - er = chunkInvalid(state, chunk); - if (er) { - errorOrDestroy(stream, er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer18.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (addToFront) { - if (state.endEmitted) - errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); - else - addChunk(stream, state, chunk, true); - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) - addChunk(stream, state, chunk, false); - else - maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } - return !state.ended && (state.length < state.highWaterMark || state.length === 0); - } - function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit("data", chunk); - } else { - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - if (state.needReadable) - emitReadable(stream); - } - maybeReadMore(stream, state); - } - function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); - } - return er; - } - Readable.prototype.isPaused = function() { - return this._readableState.flowing === false; - }; - Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require_string_decoder().StringDecoder; - var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; - this._readableState.encoding = this._readableState.decoder.encoding; - var p = this._readableState.buffer.head; - var content = ""; - while (p !== null) { - content += decoder.write(p.data); - p = p.next; - } - this._readableState.buffer.clear(); - if (content !== "") - this._readableState.buffer.push(content); - this._readableState.length = content.length; - return this; - }; - var MAX_HWM = 1073741824; - function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; - } - function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) - return 0; - if (state.objectMode) - return 1; - if (n !== n) { - if (state.flowing && state.length) - return state.buffer.head.data.length; - else - return state.length; - } - if (n > state.highWaterMark) - state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) - return n; - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; - } - Readable.prototype.read = function(n) { - debug("read", n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) - state.emittedReadable = false; - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug("read: emitReadable", state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - n = howMuchToRead(n, state); - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - var doRead = state.needReadable; - debug("need readable", doRead); - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug("length less than watermark", doRead); - } - if (state.ended || state.reading) { - doRead = false; - debug("reading or ended", doRead); - } else if (doRead) { - debug("do read"); - state.reading = true; - state.sync = true; - if (state.length === 0) - state.needReadable = true; - this._read(state.highWaterMark); - state.sync = false; - if (!state.reading) - n = howMuchToRead(nOrig, state); - } - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - if (state.length === 0) { - if (!state.ended) - state.needReadable = true; - if (nOrig !== n && state.ended) - endReadable(this); - } - if (ret !== null) - this.emit("data", ret); - return ret; - }; - function onEofChunk(stream, state) { - debug("onEofChunk"); - if (state.ended) - return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - if (state.sync) { - emitReadable(stream); - } else { - state.needReadable = false; - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } - } - function emitReadable(stream) { - var state = stream._readableState; - debug("emitReadable", state.needReadable, state.emittedReadable); - state.needReadable = false; - if (!state.emittedReadable) { - debug("emitReadable", state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } - } - function emitReadable_(stream) { - var state = stream._readableState; - debug("emitReadable_", state.destroyed, state.length, state.ended); - if (!state.destroyed && (state.length || state.ended)) { - stream.emit("readable"); - state.emittedReadable = false; - } - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); - } - function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } - } - function maybeReadMore_(stream, state) { - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug("maybeReadMore read 0"); - stream.read(0); - if (len === state.length) - break; - } - state.readingMore = false; - } - Readable.prototype._read = function(n) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); - }; - Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once("end", endFn); - dest.on("unpipe", onunpipe); - function onunpipe(readable, unpipeInfo) { - debug("onunpipe"); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - function onend() { - debug("onend"); - dest.end(); - } - var ondrain = pipeOnDrain(src); - dest.on("drain", ondrain); - var cleanedUp = false; - function cleanup() { - debug("cleanup"); - dest.removeListener("close", onclose); - dest.removeListener("finish", onfinish); - dest.removeListener("drain", ondrain); - dest.removeListener("error", onerror); - dest.removeListener("unpipe", onunpipe); - src.removeListener("end", onend); - src.removeListener("end", unpipe); - src.removeListener("data", ondata); - cleanedUp = true; - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - src.on("data", ondata); - function ondata(chunk) { - debug("ondata"); - var ret = dest.write(chunk); - debug("dest.write", ret); - if (ret === false) { - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug("false write response, pause", state.awaitDrain); - state.awaitDrain++; - } - src.pause(); - } - } - function onerror(er) { - debug("onerror", er); - unpipe(); - dest.removeListener("error", onerror); - if (EElistenerCount(dest, "error") === 0) - errorOrDestroy(dest, er); - } - prependListener(dest, "error", onerror); - function onclose() { - dest.removeListener("finish", onfinish); - unpipe(); - } - dest.once("close", onclose); - function onfinish() { - debug("onfinish"); - dest.removeListener("close", onclose); - unpipe(); - } - dest.once("finish", onfinish); - function unpipe() { - debug("unpipe"); - src.unpipe(dest); - } - dest.emit("pipe", src); - if (!state.flowing) { - debug("pipe resume"); - src.resume(); - } - return dest; - }; - function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug("pipeOnDrain", state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { - state.flowing = true; - flow(src); - } - }; - } - Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; - if (state.pipesCount === 0) - return this; - if (state.pipesCount === 1) { - if (dest && dest !== state.pipes) - return this; - if (!dest) - dest = state.pipes; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit("unpipe", this, unpipeInfo); - return this; - } - if (!dest) { - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - for (var i = 0; i < len; i++) { - dests[i].emit("unpipe", this, { - hasUnpiped: false - }); - } - return this; - } - var index = indexOf(state.pipes, dest); - if (index === -1) - return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - dest.emit("unpipe", this, unpipeInfo); - return this; - }; - Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; - if (ev === "data") { - state.readableListening = this.listenerCount("readable") > 0; - if (state.flowing !== false) - this.resume(); - } else if (ev === "readable") { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug("on readable", state.length, state.reading); - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } - return res; - }; - Readable.prototype.addListener = Readable.prototype.on; - Readable.prototype.removeListener = function(ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - if (ev === "readable") { - process.nextTick(updateReadableListening, this); - } - return res; - }; - Readable.prototype.removeAllListeners = function(ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - if (ev === "readable" || ev === void 0) { - process.nextTick(updateReadableListening, this); - } - return res; - }; - function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount("readable") > 0; - if (state.resumeScheduled && !state.paused) { - state.flowing = true; - } else if (self.listenerCount("data") > 0) { - self.resume(); - } - } - function nReadingNextTick(self) { - debug("readable nexttick read 0"); - self.read(0); - } - Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug("resume"); - state.flowing = !state.readableListening; - resume(this, state); - } - state.paused = false; - return this; - }; - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } - } - function resume_(stream, state) { - debug("resume", state.reading); - if (!state.reading) { - stream.read(0); - } - state.resumeScheduled = false; - stream.emit("resume"); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); - } - Readable.prototype.pause = function() { - debug("call pause flowing=%j", this._readableState.flowing); - if (this._readableState.flowing !== false) { - debug("pause"); - this._readableState.flowing = false; - this.emit("pause"); - } - this._readableState.paused = true; - return this; - }; - function flow(stream) { - var state = stream._readableState; - debug("flow", state.flowing); - while (state.flowing && stream.read() !== null) { - ; - } - } - Readable.prototype.wrap = function(stream) { - var _this = this; - var state = this._readableState; - var paused = false; - stream.on("end", function() { - debug("wrapped end"); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - _this.push(chunk); - } - _this.push(null); - }); - stream.on("data", function(chunk) { - debug("wrapped data"); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (state.objectMode && (chunk === null || chunk === void 0)) - return; - else if (!state.objectMode && (!chunk || !chunk.length)) - return; - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - for (var i in stream) { - if (this[i] === void 0 && typeof stream[i] === "function") { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - this._read = function(n2) { - debug("wrapped _read", n2); - if (paused) { - paused = false; - stream.resume(); - } - }; - return this; - }; - if (typeof Symbol === "function") { - Readable.prototype[Symbol.asyncIterator] = function() { - if (createReadableStreamAsyncIterator === void 0) { - createReadableStreamAsyncIterator = require_async_iterator(); - } - return createReadableStreamAsyncIterator(this); - }; - } - Object.defineProperty(Readable.prototype, "readableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._readableState.highWaterMark; - } - }); - Object.defineProperty(Readable.prototype, "readableBuffer", { - enumerable: false, - get: function get2() { - return this._readableState && this._readableState.buffer; - } - }); - Object.defineProperty(Readable.prototype, "readableFlowing", { - enumerable: false, - get: function get2() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } - }); - Readable._fromList = fromList; - Object.defineProperty(Readable.prototype, "readableLength", { - enumerable: false, - get: function get2() { - return this._readableState.length; - } - }); - function fromList(n, state) { - if (state.length === 0) - return null; - var ret; - if (state.objectMode) - ret = state.buffer.shift(); - else if (!n || n >= state.length) { - if (state.decoder) - ret = state.buffer.join(""); - else if (state.buffer.length === 1) - ret = state.buffer.first(); - else - ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - ret = state.buffer.consume(n, state.decoder); - } - return ret; - } - function endReadable(stream) { - var state = stream._readableState; - debug("endReadable", state.endEmitted); - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } - } - function endReadableNT(state, stream) { - debug("endReadableNT", state.endEmitted, state.length); - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit("end"); - if (state.autoDestroy) { - var wState = stream._writableState; - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); - } - } - } - } - if (typeof Symbol === "function") { - Readable.from = function(iterable, opts) { - if (from === void 0) { - from = require_from_browser(); - } - return from(Readable, iterable, opts); - }; - } - function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) - return i; - } - return -1; - } - } - }); - - // node_modules/readable-stream/lib/_stream_transform.js - var require_stream_transform = __commonJS({ - "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Transform; - var _require$codes = require_errors_browser().codes; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; - var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING; - var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - var Duplex = require_stream_duplex(); - require_inherits_browser()(Transform, Duplex); - function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - if (cb === null) { - return this.emit("error", new ERR_MULTIPLE_CALLBACK()); - } - ts.writechunk = null; - ts.writecb = null; - if (data != null) - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } - } - function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - this._readableState.needReadable = true; - this._readableState.sync = false; - if (options) { - if (typeof options.transform === "function") - this._transform = options.transform; - if (typeof options.flush === "function") - this._flush = options.flush; - } - this.on("prefinish", prefinish); - } - function prefinish() { - var _this = this; - if (typeof this._flush === "function" && !this._readableState.destroyed) { - this._flush(function(er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } - } - Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); - }; - Transform.prototype._transform = function(chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); - }; - Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } - }; - Transform.prototype._read = function(n) { - var ts = this._transformState; - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - ts.needTransform = true; - } - }; - Transform.prototype._destroy = function(err, cb) { - Duplex.prototype._destroy.call(this, err, function(err2) { - cb(err2); - }); - }; - function done(stream, er, data) { - if (er) - return stream.emit("error", er); - if (data != null) - stream.push(data); - if (stream._writableState.length) - throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) - throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); - } - } - }); - - // node_modules/readable-stream/lib/_stream_passthrough.js - var require_stream_passthrough = __commonJS({ - "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = PassThrough; - var Transform = require_stream_transform(); - require_inherits_browser()(PassThrough, Transform); - function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - Transform.call(this, options); - } - PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); - }; - } - }); - - // node_modules/readable-stream/lib/internal/streams/pipeline.js - var require_pipeline = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var eos; - function once(callback) { - var called = false; - return function() { - if (called) - return; - called = true; - callback.apply(void 0, arguments); - }; - } - var _require$codes = require_errors_browser().codes; - var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; - var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - function noop3(err) { - if (err) - throw err; - } - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === "function"; - } - function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on("close", function() { - closed = true; - }); - if (eos === void 0) - eos = require_end_of_stream(); - eos(stream, { - readable: reading, - writable: writing - }, function(err) { - if (err) - return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function(err) { - if (closed) - return; - if (destroyed) - return; - destroyed = true; - if (isRequest(stream)) - return stream.abort(); - if (typeof stream.destroy === "function") - return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED("pipe")); - }; - } - function call(fn) { - fn(); - } - function pipe(from, to) { - return from.pipe(to); - } - function popCallback(streams) { - if (!streams.length) - return noop3; - if (typeof streams[streams.length - 1] !== "function") - return noop3; - return streams.pop(); - } - function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - var callback = popCallback(streams); - if (Array.isArray(streams[0])) - streams = streams[0]; - if (streams.length < 2) { - throw new ERR_MISSING_ARGS("streams"); - } - var error; - var destroys = streams.map(function(stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function(err) { - if (!error) - error = err; - if (err) - destroys.forEach(call); - if (reading) - return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); - } - module.exports = pipeline; - } - }); - - // node_modules/readable-stream/readable-browser.js - var require_readable_browser = __commonJS({ - "node_modules/readable-stream/readable-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - exports = module.exports = require_stream_readable(); - exports.Stream = exports; - exports.Readable = exports; - exports.Writable = require_stream_writable(); - exports.Duplex = require_stream_duplex(); - exports.Transform = require_stream_transform(); - exports.PassThrough = require_stream_passthrough(); - exports.finished = require_end_of_stream(); - exports.pipeline = require_pipeline(); - } - }); - - // node_modules/readable-web-to-node-stream/lib/index.js - var require_lib = __commonJS({ - "node_modules/readable-web-to-node-stream/lib/index.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ReadableWebToNodeStream = void 0; - var readable_stream_1 = require_readable_browser(); - var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable { - constructor(stream) { - super(); - this.bytesRead = 0; - this.released = false; - this.reader = stream.getReader(); - } - async _read() { - if (this.released) { - this.push(null); - return; - } - this.pendingRead = this.reader.read(); - const data = await this.pendingRead; - delete this.pendingRead; - if (data.done || this.released) { - this.push(null); - } else { - this.bytesRead += data.value.length; - this.push(data.value); - } - } - async waitForReadToComplete() { - if (this.pendingRead) { - await this.pendingRead; - } - } - async close() { - await this.syncAndRelease(); - } - async syncAndRelease() { - this.released = true; - await this.waitForReadToComplete(); - await this.reader.releaseLock(); - } - }; - exports.ReadableWebToNodeStream = ReadableWebToNodeStream2; - } - }); - - // node_modules/base-x/src/index.js - var require_src2 = __commonJS({ - "node_modules/base-x/src/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function base(ALPHABET) { - if (ALPHABET.length >= 255) { - throw new TypeError("Alphabet too long"); - } - var BASE_MAP = new Uint8Array(256); - for (var j = 0; j < BASE_MAP.length; j++) { - BASE_MAP[j] = 255; - } - for (var i = 0; i < ALPHABET.length; i++) { - var x = ALPHABET.charAt(i); - var xc = x.charCodeAt(0); - if (BASE_MAP[xc] !== 255) { - throw new TypeError(x + " is ambiguous"); - } - BASE_MAP[xc] = i; - } - var BASE = ALPHABET.length; - var LEADER = ALPHABET.charAt(0); - var FACTOR = Math.log(BASE) / Math.log(256); - var iFACTOR = Math.log(256) / Math.log(BASE); - function encode2(source) { - if (source instanceof Uint8Array) { - } else if (ArrayBuffer.isView(source)) { - source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); - } else if (Array.isArray(source)) { - source = Uint8Array.from(source); - } - if (!(source instanceof Uint8Array)) { - throw new TypeError("Expected Uint8Array"); - } - if (source.length === 0) { - return ""; - } - var zeroes = 0; - var length = 0; - var pbegin = 0; - var pend = source.length; - while (pbegin !== pend && source[pbegin] === 0) { - pbegin++; - zeroes++; - } - var size = (pend - pbegin) * iFACTOR + 1 >>> 0; - var b58 = new Uint8Array(size); - while (pbegin !== pend) { - var carry = source[pbegin]; - var i2 = 0; - for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) { - carry += 256 * b58[it1] >>> 0; - b58[it1] = carry % BASE >>> 0; - carry = carry / BASE >>> 0; - } - if (carry !== 0) { - throw new Error("Non-zero carry"); - } - length = i2; - pbegin++; - } - var it2 = size - length; - while (it2 !== size && b58[it2] === 0) { - it2++; - } - var str = LEADER.repeat(zeroes); - for (; it2 < size; ++it2) { - str += ALPHABET.charAt(b58[it2]); - } - return str; - } - function decodeUnsafe(source) { - if (typeof source !== "string") { - throw new TypeError("Expected String"); - } - if (source.length === 0) { - return new Uint8Array(); - } - var psz = 0; - var zeroes = 0; - var length = 0; - while (source[psz] === LEADER) { - zeroes++; - psz++; - } - var size = (source.length - psz) * FACTOR + 1 >>> 0; - var b256 = new Uint8Array(size); - while (source[psz]) { - var carry = BASE_MAP[source.charCodeAt(psz)]; - if (carry === 255) { - return; - } - var i2 = 0; - for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) { - carry += BASE * b256[it3] >>> 0; - b256[it3] = carry % 256 >>> 0; - carry = carry / 256 >>> 0; - } - if (carry !== 0) { - throw new Error("Non-zero carry"); - } - length = i2; - psz++; - } - var it4 = size - length; - while (it4 !== size && b256[it4] === 0) { - it4++; - } - var vch = new Uint8Array(zeroes + (size - it4)); - var j2 = zeroes; - while (it4 !== size) { - vch[j2++] = b256[it4++]; - } - return vch; - } - function decode3(string) { - var buffer = decodeUnsafe(string); - if (buffer) { - return buffer; - } - throw new Error("Non-base" + BASE + " character"); - } - return { - encode: encode2, - decodeUnsafe, - decode: decode3 - }; - } - module.exports = base; - } - }); - - // node_modules/bs58/index.js - var require_bs58 = __commonJS({ - "node_modules/bs58/index.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var basex = require_src2(); - var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; - module.exports = basex(ALPHABET); - } - }); - - // node_modules/int64-buffer/int64-buffer.js - var require_int64_buffer = __commonJS({ - "node_modules/int64-buffer/int64-buffer.js"(exports) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var Uint64BE; - var Int64BE; - var Uint64LE; - var Int64LE; - !function(exports2) { - var UNDEFINED = "undefined"; - var BUFFER = UNDEFINED !== typeof Buffer2 && Buffer2; - var UINT8ARRAY = UNDEFINED !== typeof Uint8Array && Uint8Array; - var ARRAYBUFFER = UNDEFINED !== typeof ArrayBuffer && ArrayBuffer; - var ZERO = [0, 0, 0, 0, 0, 0, 0, 0]; - var isArray = Array.isArray || _isArray; - var BIT32 = 4294967296; - var BIT24 = 16777216; - var storage; - Uint64BE = factory("Uint64BE", true, true); - Int64BE = factory("Int64BE", true, false); - Uint64LE = factory("Uint64LE", false, true); - Int64LE = factory("Int64LE", false, false); - function factory(name, bigendian, unsigned) { - var posH = bigendian ? 0 : 4; - var posL = bigendian ? 4 : 0; - var pos0 = bigendian ? 0 : 3; - var pos1 = bigendian ? 1 : 2; - var pos2 = bigendian ? 2 : 1; - var pos3 = bigendian ? 3 : 0; - var fromPositive = bigendian ? fromPositiveBE : fromPositiveLE; - var fromNegative = bigendian ? fromNegativeBE : fromNegativeLE; - var proto = Int64.prototype; - var isName = "is" + name; - var _isInt64 = "_" + isName; - proto.buffer = void 0; - proto.offset = 0; - proto[_isInt64] = true; - proto.toNumber = toNumber; - proto.toString = toString2; - proto.toJSON = toNumber; - proto.toArray = toArray; - if (BUFFER) - proto.toBuffer = toBuffer; - if (UINT8ARRAY) - proto.toArrayBuffer = toArrayBuffer; - Int64[isName] = isInt64; - exports2[name] = Int64; - return Int64; - function Int64(buffer, offset, value, raddix) { - if (!(this instanceof Int64)) - return new Int64(buffer, offset, value, raddix); - return init5(this, buffer, offset, value, raddix); - } - function isInt64(b) { - return !!(b && b[_isInt64]); - } - function init5(that, buffer, offset, value, raddix) { - if (UINT8ARRAY && ARRAYBUFFER) { - if (buffer instanceof ARRAYBUFFER) - buffer = new UINT8ARRAY(buffer); - if (value instanceof ARRAYBUFFER) - value = new UINT8ARRAY(value); - } - if (!buffer && !offset && !value && !storage) { - that.buffer = newArray(ZERO, 0); - return; - } - if (!isValidBuffer(buffer, offset)) { - var _storage = storage || Array; - raddix = offset; - value = buffer; - offset = 0; - buffer = new _storage(8); - } - that.buffer = buffer; - that.offset = offset |= 0; - if (UNDEFINED === typeof value) - return; - if (typeof value === "string") { - fromString(buffer, offset, value, raddix || 10); - } else if (isValidBuffer(value, raddix)) { - fromArray(buffer, offset, value, raddix); - } else if (typeof raddix === "number") { - writeInt32(buffer, offset + posH, value); - writeInt32(buffer, offset + posL, raddix); - } else if (value > 0) { - fromPositive(buffer, offset, value); - } else if (value < 0) { - fromNegative(buffer, offset, value); - } else { - fromArray(buffer, offset, ZERO, 0); - } - } - function fromString(buffer, offset, str, raddix) { - var pos = 0; - var len = str.length; - var high = 0; - var low = 0; - if (str[0] === "-") - pos++; - var sign = pos; - while (pos < len) { - var chr = parseInt(str[pos++], raddix); - if (!(chr >= 0)) - break; - low = low * raddix + chr; - high = high * raddix + Math.floor(low / BIT32); - low %= BIT32; - } - if (sign) { - high = ~high; - if (low) { - low = BIT32 - low; - } else { - high++; - } - } - writeInt32(buffer, offset + posH, high); - writeInt32(buffer, offset + posL, low); - } - function toNumber() { - var buffer = this.buffer; - var offset = this.offset; - var high = readInt32(buffer, offset + posH); - var low = readInt32(buffer, offset + posL); - if (!unsigned) - high |= 0; - return high ? high * BIT32 + low : low; - } - function toString2(radix) { - var buffer = this.buffer; - var offset = this.offset; - var high = readInt32(buffer, offset + posH); - var low = readInt32(buffer, offset + posL); - var str = ""; - var sign = !unsigned && high & 2147483648; - if (sign) { - high = ~high; - low = BIT32 - low; - } - radix = radix || 10; - while (1) { - var mod = high % radix * BIT32 + low; - high = Math.floor(high / radix); - low = Math.floor(mod / radix); - str = (mod % radix).toString(radix) + str; - if (!high && !low) - break; - } - if (sign) { - str = "-" + str; - } - return str; - } - function writeInt32(buffer, offset, value) { - buffer[offset + pos3] = value & 255; - value = value >> 8; - buffer[offset + pos2] = value & 255; - value = value >> 8; - buffer[offset + pos1] = value & 255; - value = value >> 8; - buffer[offset + pos0] = value & 255; - } - function readInt32(buffer, offset) { - return buffer[offset + pos0] * BIT24 + (buffer[offset + pos1] << 16) + (buffer[offset + pos2] << 8) + buffer[offset + pos3]; - } - } - function toArray(raw) { - var buffer = this.buffer; - var offset = this.offset; - storage = null; - if (raw !== false && offset === 0 && buffer.length === 8 && isArray(buffer)) - return buffer; - return newArray(buffer, offset); - } - function toBuffer(raw) { - var buffer = this.buffer; - var offset = this.offset; - storage = BUFFER; - if (raw !== false && offset === 0 && buffer.length === 8 && Buffer2.isBuffer(buffer)) - return buffer; - var dest = new BUFFER(8); - fromArray(dest, 0, buffer, offset); - return dest; - } - function toArrayBuffer(raw) { - var buffer = this.buffer; - var offset = this.offset; - var arrbuf = buffer.buffer; - storage = UINT8ARRAY; - if (raw !== false && offset === 0 && arrbuf instanceof ARRAYBUFFER && arrbuf.byteLength === 8) - return arrbuf; - var dest = new UINT8ARRAY(8); - fromArray(dest, 0, buffer, offset); - return dest.buffer; - } - function isValidBuffer(buffer, offset) { - var len = buffer && buffer.length; - offset |= 0; - return len && offset + 8 <= len && typeof buffer[offset] !== "string"; - } - function fromArray(destbuf, destoff, srcbuf, srcoff) { - destoff |= 0; - srcoff |= 0; - for (var i = 0; i < 8; i++) { - destbuf[destoff++] = srcbuf[srcoff++] & 255; - } - } - function newArray(buffer, offset) { - return Array.prototype.slice.call(buffer, offset, offset + 8); - } - function fromPositiveBE(buffer, offset, value) { - var pos = offset + 8; - while (pos > offset) { - buffer[--pos] = value & 255; - value /= 256; - } - } - function fromNegativeBE(buffer, offset, value) { - var pos = offset + 8; - value++; - while (pos > offset) { - buffer[--pos] = -value & 255 ^ 255; - value /= 256; - } - } - function fromPositiveLE(buffer, offset, value) { - var end = offset + 8; - while (offset < end) { - buffer[offset++] = value & 255; - value /= 256; - } - } - function fromNegativeLE(buffer, offset, value) { - var end = offset + 8; - value++; - while (offset < end) { - buffer[offset++] = -value & 255 ^ 255; - value /= 256; - } - } - function _isArray(val) { - return !!val && Object.prototype.toString.call(val) == "[object Array]"; - } - }(typeof exports === "object" && typeof exports.nodeName !== "string" ? exports : exports || {}); - } - }); - - // node_modules/matroska/lib/schema.js - var require_schema = __commonJS({ - "node_modules/matroska/lib/schema.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var byEbmlID = { - 128: { - name: "ChapterDisplay", - level: 4, - type: "m", - multiple: true, - webm: true, - description: "Contains all possible strings to use for the chapter display." - }, - 131: { - name: "TrackType", - level: 3, - type: "u", - mandatory: true, - description: "The `TrackType` defines the type of each frame found in the Track. The value **SHOULD** be stored on 1 octet." - }, - 133: { - name: "ChapString", - cppname: "ChapterString", - level: 5, - type: "8", - mandatory: true, - webm: true, - description: "Contains the string to use as the chapter atom." - }, - 134: { - name: "CodecID", - level: 3, - type: "s", - mandatory: true, - description: "An ID corresponding to the codec, see [@!MatroskaCodec] for more info." - }, - 136: { - name: "FlagDefault", - cppname: "TrackFlagDefault", - level: 3, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set if that track (audio, video or subs) **SHOULD** be eligible for automatic selection by the player; see (#default-track-selection) for more details." - }, - 137: { - name: "ChapterTrackUID", - cppname: "ChapterTrackNumber", - level: 5, - type: "u", - mandatory: true, - multiple: true, - range: "not 0", - description: "UID of the Track to apply this chapter to. In the absence of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absence of this Element indicates that the Chapter **SHOULD** be applied to any currently used Tracks." - }, - 142: { - name: "Slices", - level: 3, - type: "m", - maxver: 1, - description: "Contains slices description." - }, - 143: { - name: "ChapterTrack", - level: 4, - type: "m", - description: "List of tracks on which the chapter applies. If this Element is not present, all tracks apply" - }, - 145: { - name: "ChapterTimeStart", - level: 4, - type: "u", - mandatory: true, - webm: true, - description: "Timestamp of the start of Chapter, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 146: { - name: "ChapterTimeEnd", - level: 4, - type: "u", - webm: true, - description: "Timestamp of the end of Chapter timestamp excluded, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). The value **MUST** be greater than or equal to the `ChapterTimeStart` of the same `ChapterAtom`." - }, - 150: { - name: "CueRefTime", - level: 5, - type: "u", - mandatory: true, - minver: 2, - description: "Timestamp of the referenced Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 151: { - name: "CueRefCluster", - level: 5, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - description: "The Segment Position of the Cluster containing the referenced Block." - }, - 152: { - name: "ChapterFlagHidden", - level: 4, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if a chapter is hidden. Hidden chapters **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapterflaghidden) on Chapter flags)." - }, - 154: { - name: "FlagInterlaced", - cppname: "VideoFlagInterlaced", - level: 4, - type: "u", - mandatory: true, - minver: 2, - webm: true, - "default": "0", - description: "Specify whether the video frames in this track are interlaced or not." - }, - 155: { - name: "BlockDuration", - level: 3, - type: "u", - description: "The duration of the Block, expressed in Track Ticks; see (#timestamp-ticks). The BlockDuration Element can be useful at the end of a Track to define the duration of the last frame (as there is no subsequent Block available), or when there is a break in a track like for subtitle tracks." - }, - 156: { - name: "FlagLacing", - cppname: "TrackFlagLacing", - level: 3, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the track **MAY** contain blocks using lacing. When set to 0 all blocks **MUST** have their lacing flags set to No lacing; see (#block-lacing) on Block Lacing." - }, - 157: { - name: "FieldOrder", - cppname: "VideoFieldOrder", - level: 4, - type: "u", - mandatory: true, - minver: 4, - "default": "2", - description: "Specify the field ordering of video frames in this track." - }, - 159: { - name: "Channels", - cppname: "AudioChannels", - level: 4, - type: "u", - mandatory: true, - "default": "1", - range: "not 0", - description: "Numbers of channels in the track." - }, - 160: { - name: "BlockGroup", - level: 2, - type: "m", - multiple: true, - description: "Basic container of information containing a single Block and information specific to that Block." - }, - 161: { - name: "Block", - level: 3, - type: "b", - mandatory: true, - description: "Block containing the actual data to be rendered and a timestamp relative to the Cluster Timestamp; see (#block-structure) on Block Structure." - }, - 162: { - name: "BlockVirtual", - level: 3, - type: "b", - minver: 0, - maxver: 0, - description: "A Block with no data. It **MUST** be stored in the stream at the place the real Block would be in display order. " - }, - 163: { - name: "SimpleBlock", - level: 2, - type: "b", - multiple: true, - minver: 2, - webm: true, - divx: true, - description: "Similar to Block, see (#block-structure), but without all the extra information, mostly used to reduced overhead when no extra feature is needed; see (#simpleblock-structure) on SimpleBlock Structure." - }, - 164: { - name: "CodecState", - level: 3, - type: "b", - minver: 2, - description: "The new codec state to use. Data interpretation is private to the codec. This information **SHOULD** always be referenced by a seek entry." - }, - 165: { - name: "BlockAdditional", - level: 5, - type: "b", - mandatory: true, - webm: true, - description: "Interpreted by the codec as it wishes (using the BlockAddID)." - }, - 166: { - name: "BlockMore", - level: 4, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contain the BlockAdditional and some parameters." - }, - 167: { - name: "Position", - cppname: "ClusterPosition", - level: 2, - type: "u", - description: "The Segment Position of the Cluster in the Segment (0 in live streams). It might help to resynchronise offset on damaged streams." - }, - 170: { - name: "CodecDecodeAll", - level: 3, - type: "u", - mandatory: true, - maxver: 0, - "default": "1", - range: "0-1", - description: "Set to 1 if the codec can decode potentially damaged data." - }, - 171: { - name: "PrevSize", - cppname: "ClusterPrevSize", - level: 2, - type: "u", - description: "Size of the previous Cluster, in octets. Can be useful for backward playing." - }, - 174: { - name: "TrackEntry", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Describes a track with all Elements." - }, - 175: { - name: "EncryptedBlock", - level: 2, - type: "b", - multiple: true, - minver: 0, - maxver: 0, - description: "Similar to SimpleBlock, see (#simpleblock-structure), but the data inside the Block are Transformed (encrypt and/or signed)." - }, - 176: { - name: "PixelWidth", - cppname: "VideoPixelWidth", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "Width of the encoded video frames in pixels." - }, - 178: { - name: "CueDuration", - level: 4, - type: "u", - minver: 4, - webm: true, - description: "The duration of the block, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks). If missing, the track's DefaultDuration does not apply and no duration information is available in terms of the cues." - }, - 179: { - name: "CueTime", - level: 3, - type: "u", - mandatory: true, - description: "Absolute timestamp of the seek point, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 181: { - name: "SamplingFrequency", - cppname: "AudioSamplingFreq", - level: 4, - type: "f", - mandatory: true, - "default": "0x1.f4p+12", - range: "> 0x0p+0", - description: "Sampling frequency in Hz." - }, - 182: { - name: "ChapterAtom", - level: 3, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains the atom information to use as the chapter atom (apply to all tracks)." - }, - 183: { - name: "CueTrackPositions", - level: 3, - type: "m", - mandatory: true, - multiple: true, - description: "Contain positions for different tracks corresponding to the timestamp." - }, - 185: { - name: "FlagEnabled", - cppname: "TrackFlagEnabled", - level: 3, - type: "u", - mandatory: true, - minver: 2, - webm: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the track is usable. It is possible to turn a not usable track into a usable track using chapter codecs or control tracks." - }, - 186: { - name: "PixelHeight", - cppname: "VideoPixelHeight", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "Height of the encoded video frames in pixels." - }, - 187: { - name: "CuePoint", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Contains all information relative to a seek point in the Segment." - }, - 191: { - name: "CRC-32", - level: -1, - type: "b", - minver: 1, - webm: false, - description: "The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian", - crc: true - }, - 192: { - name: "TrickTrackUID", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The TrackUID of the Smooth FF/RW video in the paired EBML structure corresponding to this video track. See [@?DivXTrickTrack]." - }, - 193: { - name: "TrickTrackSegmentUID", - level: 3, - type: "b", - minver: 0, - maxver: 0, - divx: true, - description: "The SegmentUID of the Segment containing the track identified by TrickTrackUID. See [@?DivXTrickTrack]." - }, - 196: { - name: "TrickMasterTrackSegmentUID", - level: 3, - type: "b", - minver: 0, - maxver: 0, - divx: true, - description: "The SegmentUID of the Segment containing the track identified by MasterTrackUID. See [@?DivXTrickTrack]." - }, - 198: { - name: "TrickTrackFlag", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - "default": "0", - description: "Set to 1 if this video track is a Smooth FF/RW track. If set to 1, MasterTrackUID and MasterTrackSegUID should must be present and BlockGroups for this track must contain ReferenceFrame structures. Otherwise, TrickTrackUID and TrickTrackSegUID must be present if this track has a corresponding Smooth FF/RW track. See [@?DivXTrickTrack]." - }, - 199: { - name: "TrickMasterTrackUID", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The TrackUID of the video track in the paired EBML structure that corresponds to this Smooth FF/RW track. See [@?DivXTrickTrack]." - }, - 200: { - name: "ReferenceFrame", - level: 3, - type: "m", - minver: 0, - maxver: 0, - divx: true, - description: "Contains information about the last reference frame. See [@?DivXTrickTrack]." - }, - 201: { - name: "ReferenceOffset", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - divx: true, - description: "The relative offset, in bytes, from the previous BlockGroup element for this Smooth FF/RW video track to the containing BlockGroup element. See [@?DivXTrickTrack]." - }, - 202: { - name: "ReferenceTimestamp", - cppname: "ReferenceTimeCode", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp of the BlockGroup pointed to by ReferenceOffset, expressed in Track Ticks; see (#timestamp-ticks). See [@?DivXTrickTrack]." - }, - 203: { - name: "BlockAdditionID", - cppname: "SliceBlockAddID", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The ID of the BlockAdditional Element (0 is the main Block)." - }, - 204: { - name: "LaceNumber", - cppname: "SliceLaceNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - description: "The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). Being able to interpret this Element is not **REQUIRED** for playback." - }, - 205: { - name: "FrameNumber", - cppname: "SliceFrameNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame)." - }, - 206: { - name: "Delay", - cppname: "SliceDelay", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The delay to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)." - }, - 207: { - name: "SliceDuration", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The duration to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)." - }, - 215: { - name: "TrackNumber", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number)." - }, - 219: { - name: "CueReference", - level: 4, - type: "m", - multiple: true, - minver: 2, - description: "The Clusters containing the referenced Blocks." - }, - 224: { - name: "Video", - cppname: "TrackVideo", - level: 3, - type: "m", - description: "Video settings." - }, - 225: { - name: "Audio", - cppname: "TrackAudio", - level: 3, - type: "m", - description: "Audio settings." - }, - 226: { - name: "TrackOperation", - level: 3, - type: "m", - minver: 3, - description: "Operation that needs to be applied on tracks to create this virtual track. For more details look at (#track-operation)." - }, - 227: { - name: "TrackCombinePlanes", - level: 4, - type: "m", - minver: 3, - description: "Contains the list of all video plane tracks that need to be combined to create this 3D track" - }, - 228: { - name: "TrackPlane", - level: 5, - type: "m", - mandatory: true, - multiple: true, - minver: 3, - description: "Contains a video plane track that need to be combined to create this 3D track" - }, - 229: { - name: "TrackPlaneUID", - level: 6, - type: "u", - mandatory: true, - minver: 3, - range: "not 0", - description: "The trackUID number of the track representing the plane." - }, - 230: { - name: "TrackPlaneType", - level: 6, - type: "u", - mandatory: true, - minver: 3, - description: "The kind of plane this track corresponds to." - }, - 231: { - name: "Timestamp", - cppname: "ClusterTimecode", - level: 2, - type: "u", - mandatory: true, - description: "Absolute timestamp of the cluster, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)." - }, - 232: { - name: "TimeSlice", - level: 4, - type: "m", - multiple: true, - minver: 0, - maxver: 0, - description: "Contains extra time information about the data contained in the Block. Being able to interpret this Element is not **REQUIRED** for playback." - }, - 233: { - name: "TrackJoinBlocks", - level: 4, - type: "m", - minver: 3, - description: "Contains the list of all tracks whose Blocks need to be combined to create this virtual track" - }, - 234: { - name: "CueCodecState", - level: 4, - type: "u", - mandatory: true, - minver: 2, - "default": "0", - description: "The Segment Position of the Codec State corresponding to this Cue Element. 0 means that the data is taken from the initial Track Entry." - }, - 235: { - name: "CueRefCodecState", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The Segment Position of the Codec State corresponding to this referenced Element. 0 means that the data is taken from the initial Track Entry." - }, - 236: { - name: "Void", - level: -1, - type: "b", - minver: 1, - description: "Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use." - }, - 237: { - name: "TrackJoinUID", - level: 5, - type: "u", - mandatory: true, - multiple: true, - minver: 3, - range: "not 0", - description: "The trackUID number of a track whose blocks are used to create this virtual track." - }, - 238: { - name: "BlockAddID", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "1", - range: "not 0", - description: "An ID to identify the BlockAdditional level. If BlockAddIDType of the corresponding block is 0, this value is also the value of BlockAddIDType for the meaning of the content of BlockAdditional." - }, - 240: { - name: "CueRelativePosition", - level: 4, - type: "u", - minver: 4, - webm: true, - description: "The relative position inside the Cluster of the referenced SimpleBlock or BlockGroup with 0 being the first possible position for an Element inside that Cluster." - }, - 241: { - name: "CueClusterPosition", - level: 4, - type: "u", - mandatory: true, - description: "The Segment Position of the Cluster containing the associated Block." - }, - 247: { - name: "CueTrack", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "The track for which a position is given." - }, - 250: { - name: "ReferencePriority", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced." - }, - 251: { - name: "ReferenceBlock", - level: 3, - type: "i", - multiple: true, - description: "A timestamp value, relative to the timestamp of the Block in this BlockGroup, expressed in Track Ticks; see (#timestamp-ticks). This is used to reference other frames necessary to decode this frame. The relative value **SHOULD** correspond to a valid `Block` this `Block` depends on. Historically Matroska Writer didn't write the actual `Block(s)` this `Block` depends on, but *some* `Block` in the past. The value \"0\" **MAY** also be used to signify this `Block` cannot be decoded on its own, but without knownledge of which `Block` is necessary. In this case, other `ReferenceBlock` **MUST NOT** be found in the same `BlockGroup`. If the `BlockGroup` doesn't have any `ReferenceBlock` element, then the `Block` it contains can be decoded without using any other `Block` data." - }, - 253: { - name: "ReferenceVirtual", - level: 3, - type: "i", - minver: 0, - maxver: 0, - description: "The Segment Position of the data that would otherwise be in position of the virtual block." - }, - 16804: { - name: "BlockAddIDName", - level: 4, - type: "s", - minver: 4, - description: "A human-friendly name describing the type of BlockAdditional data, as defined by the associated Block Additional Mapping." - }, - 16868: { - name: "BlockAdditionMapping", - level: 3, - type: "m", - multiple: true, - minver: 4, - description: "Contains elements that extend the track format, by adding content either to each frame, with BlockAddID ((#blockaddid-element)), or to the track as a whole with BlockAddIDExtraData." - }, - 16871: { - name: "BlockAddIDType", - level: 4, - type: "u", - mandatory: true, - minver: 4, - "default": "0", - description: "Stores the registered identifier of the Block Additional Mapping to define how the BlockAdditional data should be handled." - }, - 16877: { - name: "BlockAddIDExtraData", - level: 4, - type: "b", - minver: 4, - description: "Extra binary data that the BlockAddIDType can use to interpret the BlockAdditional data. The interpretation of the binary data depends on the BlockAddIDType value and the corresponding Block Additional Mapping." - }, - 16880: { - name: "BlockAddIDValue", - level: 4, - type: "u", - minver: 4, - range: ">=2", - description: "If the track format extension needs content beside frames, the value refers to the BlockAddID ((#blockaddid-element)), value being described. To keep MaxBlockAdditionID as low as possible, small values **SHOULD** be used." - }, - 16980: { - name: "ContentCompAlgo", - level: 6, - type: "u", - mandatory: true, - "default": "0", - description: "The compression algorithm used." - }, - 16981: { - name: "ContentCompSettings", - level: 6, - type: "b", - description: "Settings that might be needed by the decompressor. For Header Stripping (`ContentCompAlgo`=3), the bytes that were removed from the beginning of each frames of the track." - }, - 17026: { - name: "DocType", - level: 1, - type: "s", - mandatory: true, - "default": "matroska", - minver: 1, - description: "A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files." - }, - 17029: { - name: "DocTypeReadVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The minimum DocType version an interpreter has to support to read this file." - }, - 17030: { - name: "EBMLVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The version of EBML parser used to create the file." - }, - 17031: { - name: "DocTypeVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The version of DocType interpreter used to create the file." - }, - 17138: { - name: "EBMLMaxIDLength", - level: 1, - type: "u", - mandatory: true, - "default": "4", - range: "4" - }, - 17139: { - name: "EBMLMaxSizeLength", - level: 1, - type: "u", - mandatory: true, - "default": "8", - range: "1-8" - }, - 17143: { - name: "EBMLReadVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The minimum EBML version a parser has to support to read this file." - }, - 17276: { - name: "ChapLanguage", - cppname: "ChapterLanguage", - level: 5, - type: "s", - mandatory: true, - multiple: true, - webm: true, - "default": "eng", - description: "A language corresponding to the string, in the bibliographic ISO-639-2 form [@!ISO639-2]. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element." - }, - 17277: { - name: "ChapLanguageIETF", - level: 5, - type: "s", - multiple: true, - minver: 4, - description: "Specifies a language corresponding to the ChapString in the format defined in [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If a ChapLanguageIETF Element is used, then any ChapLanguage and ChapCountry Elements used in the same ChapterDisplay **MUST** be ignored." - }, - 17278: { - name: "ChapCountry", - cppname: "ChapterCountry", - level: 5, - type: "s", - multiple: true, - webm: true, - description: "A country corresponding to the string, using the same 2 octets country-codes as in Internet domains [@!IANADomains] based on [@!ISO3166-1] alpha-2 codes. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element." - }, - 17476: { - name: "SegmentFamily", - level: 2, - type: "b", - multiple: true, - description: "A randomly generated unique ID that all Segments of a Linked Segment **MUST** share (128 bits)." - }, - 17505: { - name: "DateUTC", - level: 2, - type: "d", - description: "The date and time that the Segment was created by the muxing application or library." - }, - 17530: { - name: "TagLanguage", - cppname: "TagLangue", - level: 4, - type: "s", - mandatory: true, - webm: true, - "default": "und", - description: "Specifies the language of the tag specified, in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the TagLanguageIETF Element is used within the same SimpleTag Element." - }, - 17531: { - name: "TagLanguageIETF", - level: 4, - type: "s", - minver: 4, - description: "Specifies the language used in the TagString according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any TagLanguage Elements used in the same SimpleTag **MUST** be ignored." - }, - 17540: { - name: "TagDefault", - level: 4, - type: "u", - mandatory: true, - webm: true, - "default": "1", - range: "0-1", - description: "A boolean value to indicate if this is the default/original language to use for the given tag." - }, - 17541: { - name: "TagBinary", - level: 4, - type: "b", - webm: true, - description: "The values of the Tag, if it is binary. Note that this cannot be used in the same SimpleTag as TagString." - }, - 17543: { - name: "TagString", - level: 4, - type: "8", - webm: true, - description: "The value of the Tag." - }, - 17545: { - name: "Duration", - level: 2, - type: "f", - range: "> 0x0p+0", - description: "Duration of the Segment, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)." - }, - 17588: { - name: "TagDefaultBogus", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - "default": "1", - range: "0-1", - description: "A variant of the TagDefault element with a bogus Element ID; see (#tagdefault-element)." - }, - 17677: { - name: "ChapProcessPrivate", - cppname: "ChapterProcessPrivate", - level: 5, - type: "b", - description: 'Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent; see (#menu-features) on DVD menus.' - }, - 17816: { - name: "ChapterFlagEnabled", - level: 4, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie **SHOULD** skip all the content between the TimeStart and TimeEnd of this chapter; see (#chapter-flags) on Chapter flags." - }, - 17827: { - name: "TagName", - level: 4, - type: "8", - mandatory: true, - webm: true, - description: "The name of the Tag that is going to be stored." - }, - 17849: { - name: "EditionEntry", - level: 2, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains all information about a Segment edition." - }, - 17852: { - name: "EditionUID", - level: 3, - type: "u", - range: "not 0", - description: "A unique ID to identify the edition. It's useful for tagging an edition." - }, - 17853: { - name: "EditionFlagHidden", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if an edition is hidden. Hidden editions **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapter-flags) on Chapter flags)." - }, - 17883: { - name: "EditionFlagDefault", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if the edition **SHOULD** be used as the default one." - }, - 17885: { - name: "EditionFlagOrdered", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if the chapters can be defined multiple times and the order to play them is enforced; see (#editionflagordered)." - }, - 18012: { - name: "FileData", - level: 3, - type: "b", - mandatory: true, - description: "The data of the file." - }, - 18016: { - name: "FileMimeType", - cppname: "MimeType", - level: 3, - type: "s", - mandatory: true, - description: "MIME type of the file." - }, - 18017: { - name: "FileUsedStartTime", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp at which this optimized font attachment comes into context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]." - }, - 18018: { - name: "FileUsedEndTime", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp at which this optimized font attachment goes out of context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]." - }, - 18030: { - name: "FileName", - level: 3, - type: "8", - mandatory: true, - description: "Filename of the attached file." - }, - 18037: { - name: "FileReferral", - level: 3, - type: "b", - minver: 0, - maxver: 0, - description: "A binary value that a track/codec can refer to when the attachment is needed." - }, - 18046: { - name: "FileDescription", - level: 3, - type: "8", - description: "A human-friendly name for the attached file." - }, - 18094: { - name: "FileUID", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "Unique ID representing the file, as random as possible." - }, - 18401: { - name: "ContentEncAlgo", - level: 6, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: 'The encryption algorithm used. The value "0" means that the contents have not been encrypted.' - }, - 18402: { - name: "ContentEncKeyID", - level: 6, - type: "b", - webm: true, - description: "For public key algorithms this is the ID of the public key the the data was encrypted with." - }, - 18403: { - name: "ContentSignature", - level: 6, - type: "b", - maxver: 0, - description: "A cryptographic signature of the contents." - }, - 18404: { - name: "ContentSigKeyID", - level: 6, - type: "b", - maxver: 0, - description: "This is the ID of the private key the data was signed with." - }, - 18405: { - name: "ContentSigAlgo", - level: 6, - type: "u", - maxver: 0, - "default": "0", - description: "The algorithm used for the signature." - }, - 18406: { - name: "ContentSigHashAlgo", - level: 6, - type: "u", - maxver: 0, - "default": "0", - description: "The hash algorithm used for the signature." - }, - 18407: { - name: "ContentEncAESSettings", - level: 6, - type: "m", - minver: 4, - webm: true, - description: "Settings describing the encryption algorithm used. If `ContentEncAlgo` != 5 this **MUST** be ignored." - }, - 18408: { - name: "AESSettingsCipherMode", - level: 7, - type: "u", - mandatory: true, - minver: 4, - webm: true, - description: "The AES cipher mode used in the encryption." - }, - 19840: { - name: "MuxingApp", - level: 2, - type: "8", - mandatory: true, - description: 'Muxing application or library (example: "libmatroska-0.4.3").' - }, - 19899: { - name: "Seek", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Contains a single seek entry to an EBML Element." - }, - 20529: { - name: "ContentEncodingOrder", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: "Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder Elements in the TrackEntry that contains this ContentEncodingOrder element." - }, - 20530: { - name: "ContentEncodingScope", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "1", - description: "A bit field that describes which Elements have been modified in this way. Values (big-endian) can be OR'ed." - }, - 20531: { - name: "ContentEncodingType", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: "A value describing what kind of transformation is applied." - }, - 20532: { - name: "ContentCompression", - level: 5, - type: "m", - description: "Settings describing the compression used. This Element **MUST** be present if the value of ContentEncodingType is 0 and absent otherwise. Each block **MUST** be decompressable even if no previous block is available in order not to prevent seeking." - }, - 20533: { - name: "ContentEncryption", - level: 5, - type: "m", - webm: true, - description: "Settings describing the encryption used. This Element **MUST** be present if the value of `ContentEncodingType` is 1 (encryption) and **MUST** be ignored otherwise." - }, - 21343: { - name: "CueRefNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "1", - range: "not 0", - description: "Number of the referenced Block of Track X in the specified Cluster." - }, - 21358: { - name: "Name", - cppname: "TrackName", - level: 3, - type: "8", - description: "A human-readable track name." - }, - 21368: { - name: "CueBlockNumber", - level: 4, - type: "u", - range: "not 0", - description: "Number of the Block in the specified Cluster." - }, - 21375: { - name: "TrackOffset", - level: 3, - type: "i", - minver: 0, - maxver: 0, - "default": "0", - description: "A value to add to the Block's Timestamp, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). This can be used to adjust the playback offset of a track." - }, - 21419: { - name: "SeekID", - level: 3, - type: "b", - mandatory: true, - description: "The binary ID corresponding to the Element name." - }, - 21420: { - name: "SeekPosition", - level: 3, - type: "u", - mandatory: true, - description: "The Segment Position of the Element." - }, - 21432: { - name: "StereoMode", - cppname: "VideoStereoMode", - level: 4, - type: "u", - mandatory: true, - minver: 3, - webm: true, - "default": "0", - description: "Stereo-3D video mode. There are some more details in (#multi-planar-and-3d-videos)." - }, - 21433: { - name: "OldStereoMode", - level: 4, - type: "u", - maxver: 0, - description: "DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska." - }, - 21440: { - name: "AlphaMode", - cppname: "VideoAlphaMode", - level: 4, - type: "u", - mandatory: true, - minver: 3, - webm: true, - "default": "0", - description: 'Indicate whether the BlockAdditional Element with BlockAddID of "1" contains Alpha data, as defined by to the Codec Mapping for the `CodecID`. Undefined values **SHOULD NOT** be used as the behavior of known implementations is different (considered either as 0 or 1).' - }, - 21674: { - name: "PixelCropBottom", - cppname: "VideoPixelCropBottom", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove at the bottom of the image." - }, - 21680: { - name: "DisplayWidth", - cppname: "VideoDisplayWidth", - level: 4, - type: "u", - range: "not 0", - description: "Width of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)." - }, - 21682: { - name: "DisplayUnit", - cppname: "VideoDisplayUnit", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "How DisplayWidth & DisplayHeight are interpreted." - }, - 21683: { - name: "AspectRatioType", - cppname: "VideoAspectRatio", - level: 4, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "Specify the possible modifications to the aspect ratio." - }, - 21690: { - name: "DisplayHeight", - cppname: "VideoDisplayHeight", - level: 4, - type: "u", - range: "not 0", - description: "Height of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)." - }, - 21691: { - name: "PixelCropTop", - cppname: "VideoPixelCropTop", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove at the top of the image." - }, - 21708: { - name: "PixelCropLeft", - cppname: "VideoPixelCropLeft", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove on the left of the image." - }, - 21725: { - name: "PixelCropRight", - cppname: "VideoPixelCropRight", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove on the right of the image." - }, - 21930: { - name: "FlagForced", - cppname: "TrackFlagForced", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Applies only to subtitles. Set if that track **SHOULD** be eligible for automatic selection by the player if it matches the user's language preference, even if the user's preferences would normally not enable subtitles with the selected audio track; this can be used for tracks containing only translations of foreign-language audio or onscreen text. See (#default-track-selection) for more details." - }, - 21931: { - name: "FlagHearingImpaired", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is suitable for users with hearing impairments, set to 0 if it is unsuitable for users with hearing impairments." - }, - 21932: { - name: "FlagVisualImpaired", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is suitable for users with visual impairments, set to 0 if it is unsuitable for users with visual impairments." - }, - 21933: { - name: "FlagTextDescriptions", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track contains textual descriptions of video content, set to 0 if that track does not contain textual descriptions of video content." - }, - 21934: { - name: "FlagOriginal", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is in the content's original language, set to 0 if it is a translation." - }, - 21935: { - name: "FlagCommentary", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track contains commentary, set to 0 if it does not contain commentary." - }, - 21936: { - name: "Colour", - cppname: "VideoColour", - level: 4, - type: "m", - minver: 4, - webm: true, - description: "Settings describing the colour format." - }, - 21937: { - name: "MatrixCoefficients", - cppname: "VideoColourMatrix", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273." - }, - 21938: { - name: "BitsPerChannel", - cppname: "VideoBitsPerChannel", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Number of decoded bits per channel. A value of 0 indicates that the BitsPerChannel is unspecified." - }, - 21939: { - name: "ChromaSubsamplingHorz", - cppname: "VideoChromaSubsampHorz", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cr and Cb channels for every pixel not removed horizontally. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1." - }, - 21940: { - name: "ChromaSubsamplingVert", - cppname: "VideoChromaSubsampVert", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cr and Cb channels for every pixel not removed vertically. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingVert **SHOULD** be set to 1." - }, - 21941: { - name: "CbSubsamplingHorz", - cppname: "VideoCbSubsampHorz", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cb channel for every pixel not removed horizontally. This is additive with ChromaSubsamplingHorz. Example: For video with 4:2:1 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1 and CbSubsamplingHorz **SHOULD** be set to 1." - }, - 21942: { - name: "CbSubsamplingVert", - cppname: "VideoCbSubsampVert", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cb channel for every pixel not removed vertically. This is additive with ChromaSubsamplingVert." - }, - 21943: { - name: "ChromaSitingHorz", - cppname: "VideoChromaSitHorz", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "How chroma is subsampled horizontally." - }, - 21944: { - name: "ChromaSitingVert", - cppname: "VideoChromaSitVert", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "How chroma is subsampled vertically." - }, - 21945: { - name: "Range", - cppname: "VideoColourRange", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Clipping of the color ranges." - }, - 21946: { - name: "TransferCharacteristics", - cppname: "VideoColourTransferCharacter", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics are adopted from Table 3 of ISO/IEC 23091-4 or ITU-T H.273." - }, - 21947: { - name: "Primaries", - cppname: "VideoColourPrimaries", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273." - }, - 21948: { - name: "MaxCLL", - cppname: "VideoColourMaxCLL", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "Maximum brightness of a single pixel (Maximum Content Light Level) in candelas per square meter (cd/m^2^)." - }, - 21949: { - name: "MaxFALL", - cppname: "VideoColourMaxFALL", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "Maximum brightness of a single full frame (Maximum Frame-Average Light Level) in candelas per square meter (cd/m^2^)." - }, - 21968: { - name: "MasteringMetadata", - cppname: "VideoColourMasterMeta", - level: 5, - type: "m", - minver: 4, - webm: true, - description: "SMPTE 2086 mastering data." - }, - 21969: { - name: "PrimaryRChromaticityX", - cppname: "VideoRChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Red X chromaticity coordinate, as defined by CIE 1931." - }, - 21970: { - name: "PrimaryRChromaticityY", - cppname: "VideoRChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Red Y chromaticity coordinate, as defined by CIE 1931." - }, - 21971: { - name: "PrimaryGChromaticityX", - cppname: "VideoGChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Green X chromaticity coordinate, as defined by CIE 1931." - }, - 21972: { - name: "PrimaryGChromaticityY", - cppname: "VideoGChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Green Y chromaticity coordinate, as defined by CIE 1931." - }, - 21973: { - name: "PrimaryBChromaticityX", - cppname: "VideoBChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Blue X chromaticity coordinate, as defined by CIE 1931." - }, - 21974: { - name: "PrimaryBChromaticityY", - cppname: "VideoBChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Blue Y chromaticity coordinate, as defined by CIE 1931." - }, - 21975: { - name: "WhitePointChromaticityX", - cppname: "VideoWhitePointChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "White X chromaticity coordinate, as defined by CIE 1931." - }, - 21976: { - name: "WhitePointChromaticityY", - cppname: "VideoWhitePointChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "White Y chromaticity coordinate, as defined by CIE 1931." - }, - 21977: { - name: "LuminanceMax", - cppname: "VideoLuminanceMax", - level: 6, - type: "f", - minver: 4, - webm: true, - range: ">= 0x0p+0", - description: "Maximum luminance. Represented in candelas per square meter (cd/m^2^)." - }, - 21978: { - name: "LuminanceMin", - cppname: "VideoLuminanceMin", - level: 6, - type: "f", - minver: 4, - webm: true, - range: ">= 0x0p+0", - description: "Minimum luminance. Represented in candelas per square meter (cd/m^2^)." - }, - 21998: { - name: "MaxBlockAdditionID", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "The maximum value of BlockAddID ((#blockaddid-element)). A value 0 means there is no BlockAdditions ((#blockadditions-element)) for this track." - }, - 22100: { - name: "ChapterStringUID", - level: 4, - type: "8", - minver: 3, - webm: true, - description: "A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage [@!WebVTT]." - }, - 22186: { - name: "CodecDelay", - level: 3, - type: "u", - mandatory: true, - minver: 4, - webm: true, - description: "CodecDelay is The codec-built-in delay, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). It represents the amount of codec samples that will be discarded by the decoder during playback. This timestamp value **MUST** be subtracted from each frame timestamp in order to get the timestamp that will be actually played. The value **SHOULD** be small so the muxing of tracks with the same actual timestamp are in the same Cluster." - }, - 22203: { - name: "SeekPreRoll", - level: 3, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "After a discontinuity, SeekPreRoll is the duration of the data the decoder **MUST** decode before the decoded data is valid, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 22337: { - name: "WritingApp", - level: 2, - type: "8", - mandatory: true, - description: 'Writing application (example: "mkvmerge-0.3.3").' - }, - 22612: { - name: "SilentTracks", - cppname: "ClusterSilentTracks", - level: 2, - type: "m", - minver: 0, - maxver: 0, - description: "The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking or to decide what track to use." - }, - 22743: { - name: "SilentTrackNumber", - cppname: "ClusterSilentTrackNumber", - level: 3, - type: "u", - multiple: true, - minver: 0, - maxver: 0, - description: "One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster." - }, - 24999: { - name: "AttachedFile", - cppname: "Attached", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "An attached file." - }, - 25152: { - name: "ContentEncoding", - level: 4, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Settings for one content encoding like compression or encryption." - }, - 25188: { - name: "BitDepth", - cppname: "AudioBitDepth", - level: 4, - type: "u", - range: "not 0", - description: "Bits per sample, mostly used for PCM." - }, - 25506: { - name: "CodecPrivate", - level: 3, - type: "b", - description: "Private data only known to the codec." - }, - 25536: { - name: "Targets", - cppname: "TagTargets", - level: 3, - type: "m", - mandatory: true, - webm: true, - description: "Specifies which other elements the metadata represented by the Tag applies to. If empty or not present, then the Tag describes everything in the Segment." - }, - 25539: { - name: "ChapterPhysicalEquiv", - level: 4, - type: "u", - description: 'Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50); see (#physical-types) for a complete list of values.' - }, - 25540: { - name: "TagChapterUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the Chapter(s) the tags belong to." - }, - 25541: { - name: "TagTrackUID", - level: 4, - type: "u", - multiple: true, - webm: true, - "default": "0", - description: "A unique ID to identify the Track(s) the tags belong to." - }, - 25542: { - name: "TagAttachmentUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the Attachment(s) the tags belong to." - }, - 25545: { - name: "TagEditionUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the EditionEntry(s) the tags belong to." - }, - 25546: { - name: "TargetType", - cppname: "TagTargetType", - level: 4, - type: "s", - webm: true, - description: 'An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc ; see Section 6.4 of [@!MatroskaTags].' - }, - 25906: { - name: "SignedElement", - level: 3, - type: "b", - multiple: true, - webm: false, - description: "An element ID whose data will be used to compute the signature." - }, - 26148: { - name: "TrackTranslate", - level: 3, - type: "m", - multiple: true, - description: "The mapping between this `TrackEntry` and a track value in the given Chapter Codec." - }, - 26277: { - name: "TrackTranslateTrackID", - level: 4, - type: "b", - mandatory: true, - description: "The binary value used to represent this `TrackEntry` in the chapter codec data. The format depends on the `ChapProcessCodecID` used; see (#chapprocesscodecid-element)." - }, - 26303: { - name: "TrackTranslateCodec", - level: 4, - type: "u", - mandatory: true, - description: "This `TrackTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)." - }, - 26364: { - name: "TrackTranslateEditionUID", - level: 4, - type: "u", - multiple: true, - description: "Specify a chapter edition UID on which this `TrackTranslate` applies." - }, - 26568: { - name: "SimpleTag", - cppname: "TagSimple", - level: 3, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains general information about the target." - }, - 26826: { - name: "TargetTypeValue", - cppname: "TagTargetTypeValue", - level: 4, - type: "u", - mandatory: true, - webm: true, - "default": "50", - description: "A number to indicate the logical level of the target." - }, - 26897: { - name: "ChapProcessCommand", - cppname: "ChapterProcessCommand", - level: 5, - type: "m", - multiple: true, - description: "Contains all the commands associated to the Atom." - }, - 26914: { - name: "ChapProcessTime", - cppname: "ChapterProcessTime", - level: 6, - type: "u", - mandatory: true, - description: "Defines when the process command **SHOULD** be handled" - }, - 26916: { - name: "ChapterTranslate", - level: 2, - type: "m", - multiple: true, - description: "The mapping between this `Segment` and a segment value in the given Chapter Codec." - }, - 26931: { - name: "ChapProcessData", - cppname: "ChapterProcessData", - level: 6, - type: "b", - mandatory: true, - description: "Contains the command information. The data **SHOULD** be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands; see (#menu-features) on DVD menus." - }, - 26948: { - name: "ChapProcess", - cppname: "ChapterProcess", - level: 4, - type: "m", - multiple: true, - description: "Contains all the commands associated to the Atom." - }, - 26965: { - name: "ChapProcessCodecID", - cppname: "ChapterProcessCodecID", - level: 5, - type: "u", - mandatory: true, - "default": "0", - description: "Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used; see (#menu-features) on DVD menus. More codec IDs can be added later." - }, - 27045: { - name: "ChapterTranslateID", - level: 3, - type: "b", - mandatory: true, - description: "The binary value used to represent this Segment in the chapter codec data. The format depends on the ChapProcessCodecID used; see (#chapprocesscodecid-element)." - }, - 27071: { - name: "ChapterTranslateCodec", - level: 3, - type: "u", - mandatory: true, - description: "This `ChapterTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)." - }, - 27132: { - name: "ChapterTranslateEditionUID", - level: 3, - type: "u", - multiple: true, - description: "Specify a chapter edition UID on which this `ChapterTranslate` applies." - }, - 28032: { - name: "ContentEncodings", - level: 3, - type: "m", - webm: true, - description: "Settings for several content encoding mechanisms like compression or encryption." - }, - 28135: { - name: "MinCache", - cppname: "TrackMinCache", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "The minimum number of frames a player **SHOULD** be able to cache during playback. If set to 0, the reference pseudo-cache system is not used." - }, - 28152: { - name: "MaxCache", - cppname: "TrackMaxCache", - level: 3, - type: "u", - description: "The maximum cache size necessary to store referenced frames in and the current frame. 0 means no cache is needed." - }, - 28263: { - name: "ChapterSegmentUID", - level: 4, - type: "b", - range: ">0", - description: "The SegmentUID of another Segment to play during this chapter." - }, - 28348: { - name: "ChapterSegmentEditionUID", - level: 4, - type: "u", - range: "not 0", - description: "The EditionUID to play from the Segment linked in ChapterSegmentUID. If ChapterSegmentEditionUID is undeclared, then no Edition of the linked Segment is used; see (#medium-linking) on medium-linking Segments." - }, - 28587: { - name: "TrackOverlay", - level: 3, - type: "u", - multiple: true, - description: "Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap, see (#silenttracks-element) on SilentTracks, the overlay track **SHOULD** be used instead. The order of multiple TrackOverlay matters, the first one is the one that **SHOULD** be used. If not found it **SHOULD** be the second, etc." - }, - 29555: { - name: "Tag", - level: 2, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "A single metadata descriptor." - }, - 29572: { - name: "SegmentFilename", - level: 2, - type: "8", - description: "A filename corresponding to this Segment." - }, - 29604: { - name: "SegmentUID", - level: 2, - type: "b", - range: "not 0", - description: "A randomly generated unique ID to identify the Segment amongst many others (128 bits)." - }, - 29636: { - name: "ChapterUID", - level: 4, - type: "u", - mandatory: true, - webm: true, - range: "not 0", - description: "A unique ID to identify the Chapter." - }, - 29637: { - name: "TrackUID", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "A unique ID to identify the Track." - }, - 29766: { - name: "AttachmentLink", - cppname: "TrackAttachmentLink", - level: 3, - type: "u", - maxver: 3, - range: "not 0", - description: "The UID of an attachment that is used by this codec." - }, - 30113: { - name: "BlockAdditions", - level: 3, - type: "m", - webm: true, - description: "Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data." - }, - 30114: { - name: "DiscardPadding", - level: 3, - type: "i", - minver: 4, - webm: true, - description: "Duration of the silent data added to the Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and **SHOULD** be discarded during playback." - }, - 30320: { - name: "Projection", - cppname: "VideoProjection", - level: 4, - type: "m", - minver: 4, - webm: true, - description: "Describes the video projection details. Used to render spherical, VR videos or flipping videos horizontally/vertically." - }, - 30321: { - name: "ProjectionType", - cppname: "VideoProjectionType", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Describes the projection used for this video track." - }, - 30322: { - name: "ProjectionPrivate", - cppname: "VideoProjectionPrivate", - level: 5, - type: "b", - minver: 4, - webm: true, - description: "Private data that only applies to a specific projection. * If `ProjectionType` equals 0 (Rectangular), then this element must not be present. * If `ProjectionType` equals 1 (Equirectangular), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Equirectangular Projection Box ('equi'). * If `ProjectionType` equals 2 (Cubemap), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Cubemap Projection Box ('cbmp'). * If `ProjectionType` equals 3 (Mesh), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Mesh Projection Box ('mshp')." - }, - 30323: { - name: "ProjectionPoseYaw", - cppname: "VideoProjectionPoseYaw", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0xB4p+0, <= 0xB4p+0", - description: "Specifies a yaw rotation to the projection. Value represents a clockwise rotation, in degrees, around the up vector. This rotation must be applied before any `ProjectionPosePitch` or `ProjectionPoseRoll` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseYaw` to 180 or -180 degrees, with the `ProjectionPoseRoll` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally." - }, - 30324: { - name: "ProjectionPosePitch", - cppname: "VideoProjectionPosePitch", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0x5Ap+0, <= 0x5Ap+0", - description: "Specifies a pitch rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the right vector. This rotation must be applied after the `ProjectionPoseYaw` rotation and before the `ProjectionPoseRoll` rotation. The value of this element **MUST** be in the -90 to 90 degree range, both included." - }, - 30325: { - name: "ProjectionPoseRoll", - cppname: "VideoProjectionPoseRoll", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0xB4p+0, <= 0xB4p+0", - description: "Specifies a roll rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the forward vector. This rotation must be applied after the `ProjectionPoseYaw` and `ProjectionPosePitch` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseRoll` to 180 or -180 degrees, the `ProjectionPoseYaw` to 180 or -180 degrees with `ProjectionPosePitch` set to 0 degrees flips the image vertically. Setting `ProjectionPoseRoll` to 180 or -180 degrees, with the `ProjectionPoseYaw` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally and vertically." - }, - 30901: { - name: "OutputSamplingFrequency", - cppname: "AudioOutputSamplingFreq", - level: 4, - type: "f", - range: "> 0x0p+0", - description: "Real output sampling frequency in Hz (used for SBR techniques)." - }, - 31657: { - name: "Title", - level: 2, - type: "8", - webm: true, - description: "General name of the Segment." - }, - 32123: { - name: "ChannelPositions", - cppname: "AudioPosition", - level: 4, - type: "b", - minver: 0, - maxver: 0, - description: "Table of horizontal angles for each successive channel." - }, - 32347: { - name: "SignatureElements", - level: 1, - type: "m", - webm: false, - description: "Contains elements that will be used to compute the signature." - }, - 32379: { - name: "SignatureElementList", - level: 2, - type: "m", - multiple: true, - webm: false, - i: "Cluster|Block|BlockAdditional", - description: "A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption." - }, - 32394: { - name: "SignatureAlgo", - level: 1, - type: "u", - webm: false, - description: "Signature algorithm used (1=RSA, 2=elliptic)." - }, - 32410: { - name: "SignatureHash", - level: 1, - type: "u", - webm: false, - description: "Hash algorithm used (1=SHA1-160, 2=MD5)." - }, - 32421: { - name: "SignaturePublicKey", - level: 1, - type: "b", - webm: false, - description: "The public key to use with the algorithm (in the case of a PKI-based signature)." - }, - 32437: { - name: "Signature", - level: 1, - type: "b", - webm: false, - description: "The signature of the data (until a new." - }, - 2274716: { - name: "Language", - cppname: "TrackLanguage", - level: 3, - type: "s", - mandatory: true, - "default": "eng", - description: "Specifies the language of the track in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the LanguageIETF Element is used in the same TrackEntry." - }, - 2274717: { - name: "LanguageIETF", - level: 3, - type: "s", - minver: 4, - description: "Specifies the language of the track according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any Language Elements used in the same TrackEntry **MUST** be ignored." - }, - 2306383: { - name: "TrackTimestampScale", - cppname: "TrackTimecodeScale", - level: 3, - type: "f", - mandatory: true, - maxver: 3, - "default": "0x1p+0", - range: "> 0x0p+0", - description: "DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs)." - }, - 2313850: { - name: "DefaultDecodedFieldDuration", - cppname: "TrackDefaultDecodedFieldDuration", - level: 3, - type: "u", - minver: 4, - range: "not 0", - description: "The period between two successive fields at the output of the decoding process, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). see (#defaultdecodedfieldduration) for more information" - }, - 2327523: { - name: "FrameRate", - cppname: "VideoFrameRate", - level: 4, - type: "f", - minver: 0, - maxver: 0, - range: "> 0x0p+0", - description: "Number of frames per second. This value is Informational only. It is intended for constant frame rate streams, and **SHOULD NOT** be used for a variable frame rate TrackEntry." - }, - 2352003: { - name: "DefaultDuration", - cppname: "TrackDefaultDuration", - level: 3, - type: "u", - range: "not 0", - description: "Number of nanoseconds per frame, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (frame in the Matroska sense -- one Element put into a (Simple)Block)." - }, - 2459272: { - name: "CodecName", - level: 3, - type: "8", - description: "A human-readable string specifying the codec." - }, - 2536e3: { - name: "CodecDownloadURL", - level: 3, - type: "s", - multiple: true, - minver: 0, - maxver: 0, - description: "A URL to download about the codec used." - }, - 2807729: { - name: "TimestampScale", - cppname: "TimecodeScale", - level: 2, - type: "u", - mandatory: true, - "default": "1000000", - range: "not 0", - description: "Base unit for Segment Ticks and Track Ticks, in nanoseconds. A TimestampScale value of 1.000.000 means scaled timestamps in the Segment are expressed in milliseconds; see (#timestamps) on how to interpret timestamps." - }, - 2807730: { - name: "TimecodeScaleDenominator", - level: 2, - type: "u", - mandatory: true, - minver: 4, - "default": "1000000000", - description: "Timestamp scale numerator, see TimecodeScale." - }, - 3061028: { - name: "UncompressedFourCC", - cppname: "VideoColourSpace", - level: 4, - type: "b", - description: "Specify the uncompressed pixel format used for the Track's data as a FourCC. This value is similar in scope to the biCompression value of AVI's `BITMAPINFO` [@?AVIFormat]. See the YUV video formats [@?FourCC-YUV] and RGB video formats [@?FourCC-RGB] for common values." - }, - 3126563: { - name: "GammaValue", - cppname: "VideoGamma", - level: 4, - type: "f", - minver: 0, - maxver: 0, - range: "> 0x0p+0", - description: "Gamma Value." - }, - 3839639: { - name: "CodecSettings", - level: 3, - type: "8", - minver: 0, - maxver: 0, - description: "A string describing the encoding setting used." - }, - 3883072: { - name: "CodecInfoURL", - level: 3, - type: "s", - multiple: true, - minver: 0, - maxver: 0, - description: "A URL to find information about the codec used." - }, - 3965867: { - name: "PrevFilename", - level: 2, - type: "8", - description: "A filename corresponding to the file of the previous Linked Segment." - }, - 3979555: { - name: "PrevUID", - level: 2, - type: "b", - description: "A unique ID to identify the previous Segment of a Linked Segment (128 bits)." - }, - 4096955: { - name: "NextFilename", - level: 2, - type: "8", - description: "A filename corresponding to the file of the next Linked Segment." - }, - 4110627: { - name: "NextUID", - level: 2, - type: "b", - description: "A unique ID to identify the next Segment of a Linked Segment (128 bits)." - }, - 272869232: { - name: "Chapters", - level: 1, - type: "m", - webm: true, - description: "A system to define basic menus and partition data. For more detailed information, look at the Chapters explanation in (#chapters)." - }, - 290298740: { - name: "SeekHead", - level: 1, - type: "m", - multiple: true, - description: "Contains the Segment Position of other Top-Level Elements." - }, - 307544935: { - name: "Tags", - level: 1, - type: "m", - multiple: true, - webm: true, - description: "Element containing metadata describing Tracks, Editions, Chapters, Attachments, or the Segment as a whole. A list of valid tags can be found in [@!MatroskaTags]." - }, - 357149030: { - name: "Info", - level: 1, - type: "m", - mandatory: true, - description: "Contains general information about the Segment." - }, - 374648427: { - name: "Tracks", - level: 1, - type: "m", - description: "A Top-Level Element of information with many tracks described." - }, - 408125543: { - name: "Segment", - level: 0, - type: "m", - mandatory: true, - description: "The Root Element that contains all other Top-Level Elements (Elements defined only at Level 1). A Matroska file is composed of 1 Segment." - }, - 423732329: { - name: "Attachments", - level: 1, - type: "m", - description: "Contain attached files." - }, - 440786851: { - name: "EBML", - level: "0", - type: "m", - mandatory: true, - multiple: true, - minver: 1, - description: "Set the EBML characteristics of the data to follow. Each EBML document has to start with this." - }, - 458458727: { - name: "SignatureSlot", - level: -1, - type: "m", - multiple: true, - webm: false, - description: "Contain signature of some (coming) elements in the stream." - }, - 475249515: { - name: "Cues", - level: 1, - type: "m", - description: "A Top-Level Element to speed seeking access. All entries are local to the Segment." - }, - 524531317: { - name: "Cluster", - level: 1, - type: "m", - multiple: true, - description: "The Top-Level Element containing the (monolithic) Block structure." - } - }; - var byName = {}; - var schema = { - byEbmlID, - byName - }; - for (ebmlID in byEbmlID) { - desc = byEbmlID[ebmlID]; - byName[desc.name.replace("-", "_")] = parseInt(ebmlID, 10); - } - var desc; - var ebmlID; - module.exports = schema; - } - }); - - // node_modules/ts-ebml/lib/EBMLEncoder.js - var require_EBMLEncoder = __commonJS({ - "node_modules/ts-ebml/lib/EBMLEncoder.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var tools = require_tools2(); - var tools_1 = require_tools2(); - var schema = require_schema(); - var byEbmlID = schema.byEbmlID; - var EBMLEncoder = function() { - function EBMLEncoder2() { - this._schema = byEbmlID; - this._buffers = []; - this._stack = []; - } - EBMLEncoder2.prototype.encode = function(elms) { - var _this = this; - return tools.concat(elms.reduce(function(lst, elm) { - return lst.concat(_this.encodeChunk(elm)); - }, [])).buffer; - }; - EBMLEncoder2.prototype.encodeChunk = function(elm) { - if (elm.type === "m") { - if (!elm.isEnd) { - this.startTag(elm); - } else { - this.endTag(elm); - } - } else { - this.writeTag(elm); - } - return this.flush(); - }; - EBMLEncoder2.prototype.flush = function() { - var ret = this._buffers; - this._buffers = []; - return ret; - }; - EBMLEncoder2.prototype.getSchemaInfo = function(tagName) { - var tagNums = Object.keys(this._schema).map(Number); - for (var i = 0; i < tagNums.length; i++) { - var tagNum = tagNums[i]; - if (this._schema[tagNum].name === tagName) { - return new tools_1.Buffer(tagNum.toString(16), "hex"); - } - } - return null; - }; - EBMLEncoder2.prototype.writeTag = function(elm) { - var tagName = elm.name; - var tagId = this.getSchemaInfo(tagName); - var tagData = elm.data; - if (tagId == null) { - throw new Error("No schema entry found for " + tagName); - } - var data = tools.encodeTag(tagId, tagData); - if (this._stack.length > 0) { - var last = this._stack[this._stack.length - 1]; - last.children.push({ - tagId, - elm, - children: [], - data - }); - return; - } - this._buffers = this._buffers.concat(data); - return; - }; - EBMLEncoder2.prototype.startTag = function(elm) { - var tagName = elm.name; - var tagId = this.getSchemaInfo(tagName); - if (tagId == null) { - throw new Error("No schema entry found for " + tagName); - } - if (elm.unknownSize) { - var data = tools.encodeTag(tagId, new tools_1.Buffer(0), elm.unknownSize); - this._buffers = this._buffers.concat(data); - return; - } - var tag = { - tagId, - elm, - children: [], - data: null - }; - if (this._stack.length > 0) { - this._stack[this._stack.length - 1].children.push(tag); - } - this._stack.push(tag); - }; - EBMLEncoder2.prototype.endTag = function(elm) { - var tagName = elm.name; - var tag = this._stack.pop(); - if (tag == null) { - throw new Error("EBML structure is broken"); - } - if (tag.elm.name !== elm.name) { - throw new Error("EBML structure is broken"); - } - var childTagDataBuffers = tag.children.reduce(function(lst, child) { - if (child.data === null) { - throw new Error("EBML structure is broken"); - } - return lst.concat(child.data); - }, []); - var childTagDataBuffer = tools.concat(childTagDataBuffers); - if (tag.elm.type === "m") { - tag.data = tools.encodeTag(tag.tagId, childTagDataBuffer, tag.elm.unknownSize); - } else { - tag.data = tools.encodeTag(tag.tagId, childTagDataBuffer); - } - if (this._stack.length < 1) { - this._buffers = this._buffers.concat(tag.data); - } - }; - return EBMLEncoder2; - }(); - exports.default = EBMLEncoder; - } - }); - - // node_modules/ts-ebml/node_modules/buffer/index.js - var require_buffer2 = __commonJS({ - "node_modules/ts-ebml/node_modules/buffer/index.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var base64 = require_base64_js(); - var ieee7542 = require_ieee754(); - var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer18; - exports.SlowBuffer = SlowBuffer; - exports.INSPECT_MAX_BYTES = 50; - var K_MAX_LENGTH = 2147483647; - exports.kMaxLength = K_MAX_LENGTH; - Buffer18.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer18.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { - console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); - } - function typedArraySupport() { - try { - var arr = new Uint8Array(1); - var proto = { foo: function() { - return 42; - } }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; - } - } - Object.defineProperty(Buffer18.prototype, "parent", { - enumerable: true, - get: function() { - if (!Buffer18.isBuffer(this)) - return void 0; - return this.buffer; - } - }); - Object.defineProperty(Buffer18.prototype, "offset", { - enumerable: true, - get: function() { - if (!Buffer18.isBuffer(this)) - return void 0; - return this.byteOffset; - } - }); - function createBuffer(length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"'); - } - var buf2 = new Uint8Array(length); - Object.setPrototypeOf(buf2, Buffer18.prototype); - return buf2; - } - function Buffer18(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - if (typeof encodingOrOffset === "string") { - throw new TypeError('The "string" argument must be of type string. Received type number'); - } - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); - } - Buffer18.poolSize = 8192; - function from(value, encodingOrOffset, length) { - if (typeof value === "string") { - return fromString(value, encodingOrOffset); - } - if (ArrayBuffer.isView(value)) { - return fromArrayView(value); - } - if (value == null) { - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof value === "number") { - throw new TypeError('The "value" argument must not be of type number. Received type number'); - } - var valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) { - return Buffer18.from(valueOf, encodingOrOffset, length); - } - var b = fromObject(value); - if (b) - return b; - if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer18.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); - } - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - Buffer18.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); - }; - Object.setPrototypeOf(Buffer18.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer18, Uint8Array); - function assertSize(size) { - if (typeof size !== "number") { - throw new TypeError('"size" argument must be of type number'); - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"'); - } - } - function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) { - return createBuffer(size); - } - if (fill !== void 0) { - return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - } - return createBuffer(size); - } - Buffer18.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); - }; - function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); - } - Buffer18.allocUnsafe = function(size) { - return allocUnsafe(size); - }; - Buffer18.allocUnsafeSlow = function(size) { - return allocUnsafe(size); - }; - function fromString(string, encoding) { - if (typeof encoding !== "string" || encoding === "") { - encoding = "utf8"; - } - if (!Buffer18.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - var length = byteLength(string, encoding) | 0; - var buf2 = createBuffer(length); - var actual = buf2.write(string, encoding); - if (actual !== length) { - buf2 = buf2.slice(0, actual); - } - return buf2; - } - function fromArrayLike(array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0; - var buf2 = createBuffer(length); - for (var i = 0; i < length; i += 1) { - buf2[i] = array[i] & 255; - } - return buf2; - } - function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - var copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); - } - function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds'); - } - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds'); - } - var buf2; - if (byteOffset === void 0 && length === void 0) { - buf2 = new Uint8Array(array); - } else if (length === void 0) { - buf2 = new Uint8Array(array, byteOffset); - } else { - buf2 = new Uint8Array(array, byteOffset, length); - } - Object.setPrototypeOf(buf2, Buffer18.prototype); - return buf2; - } - function fromObject(obj) { - if (Buffer18.isBuffer(obj)) { - var len = checked(obj.length) | 0; - var buf2 = createBuffer(len); - if (buf2.length === 0) { - return buf2; - } - obj.copy(buf2, 0, 0, len); - return buf2; - } - if (obj.length !== void 0) { - if (typeof obj.length !== "number" || numberIsNaN(obj.length)) { - return createBuffer(0); - } - return fromArrayLike(obj); - } - if (obj.type === "Buffer" && Array.isArray(obj.data)) { - return fromArrayLike(obj.data); - } - } - function checked(length) { - if (length >= K_MAX_LENGTH) { - throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes"); - } - return length | 0; - } - function SlowBuffer(length) { - if (+length != length) { - length = 0; - } - return Buffer18.alloc(+length); - } - Buffer18.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer18.prototype; - }; - Buffer18.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) - a = Buffer18.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) - b = Buffer18.from(b, b.offset, b.byteLength); - if (!Buffer18.isBuffer(a) || !Buffer18.isBuffer(b)) { - throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - } - if (a === b) - return 0; - var x = a.length; - var y = b.length; - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) - return -1; - if (y < x) - return 1; - return 0; - }; - Buffer18.isEncoding = function isEncoding(encoding) { - switch (String(encoding).toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "latin1": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return true; - default: - return false; - } - }; - Buffer18.concat = function concat(list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } - if (list.length === 0) { - return Buffer18.alloc(0); - } - var i; - if (length === void 0) { - length = 0; - for (i = 0; i < list.length; ++i) { - length += list[i].length; - } - } - var buffer = Buffer18.allocUnsafe(length); - var pos = 0; - for (i = 0; i < list.length; ++i) { - var buf2 = list[i]; - if (isInstance(buf2, Uint8Array)) { - if (pos + buf2.length > buffer.length) { - Buffer18.from(buf2).copy(buffer, pos); - } else { - Uint8Array.prototype.set.call(buffer, buf2, pos); - } - } else if (!Buffer18.isBuffer(buf2)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } else { - buf2.copy(buffer, pos); - } - pos += buf2.length; - } - return buffer; - }; - function byteLength(string, encoding) { - if (Buffer18.isBuffer(string)) { - return string.length; - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength; - } - if (typeof string !== "string") { - throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - } - var len = string.length; - var mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) - return 0; - var loweredCase = false; - for (; ; ) { - switch (encoding) { - case "ascii": - case "latin1": - case "binary": - return len; - case "utf8": - case "utf-8": - return utf8ToBytes(string).length; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return len * 2; - case "hex": - return len >>> 1; - case "base64": - return base64ToBytes(string).length; - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length; - } - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - } - Buffer18.byteLength = byteLength; - function slowToString(encoding, start, end) { - var loweredCase = false; - if (start === void 0 || start < 0) { - start = 0; - } - if (start > this.length) { - return ""; - } - if (end === void 0 || end > this.length) { - end = this.length; - } - if (end <= 0) { - return ""; - } - end >>>= 0; - start >>>= 0; - if (end <= start) { - return ""; - } - if (!encoding) - encoding = "utf8"; - while (true) { - switch (encoding) { - case "hex": - return hexSlice(this, start, end); - case "utf8": - case "utf-8": - return utf8Slice(this, start, end); - case "ascii": - return asciiSlice(this, start, end); - case "latin1": - case "binary": - return latin1Slice(this, start, end); - case "base64": - return base64Slice(this, start, end); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return utf16leSlice(this, start, end); - default: - if (loweredCase) - throw new TypeError("Unknown encoding: " + encoding); - encoding = (encoding + "").toLowerCase(); - loweredCase = true; - } - } - } - Buffer18.prototype._isBuffer = true; - function swap(b, n, m) { - var i = b[n]; - b[n] = b[m]; - b[m] = i; - } - Buffer18.prototype.swap16 = function swap16() { - var len = this.length; - if (len % 2 !== 0) { - throw new RangeError("Buffer size must be a multiple of 16-bits"); - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1); - } - return this; - }; - Buffer18.prototype.swap32 = function swap32() { - var len = this.length; - if (len % 4 !== 0) { - throw new RangeError("Buffer size must be a multiple of 32-bits"); - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3); - swap(this, i + 1, i + 2); - } - return this; - }; - Buffer18.prototype.swap64 = function swap64() { - var len = this.length; - if (len % 8 !== 0) { - throw new RangeError("Buffer size must be a multiple of 64-bits"); - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); - } - return this; - }; - Buffer18.prototype.toString = function toString2() { - var length = this.length; - if (length === 0) - return ""; - if (arguments.length === 0) - return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); - }; - Buffer18.prototype.toLocaleString = Buffer18.prototype.toString; - Buffer18.prototype.equals = function equals(b) { - if (!Buffer18.isBuffer(b)) - throw new TypeError("Argument must be a Buffer"); - if (this === b) - return true; - return Buffer18.compare(this, b) === 0; - }; - Buffer18.prototype.inspect = function inspect() { - var str = ""; - var max = exports.INSPECT_MAX_BYTES; - str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); - if (this.length > max) - str += " ... "; - return ""; - }; - if (customInspectSymbol) { - Buffer18.prototype[customInspectSymbol] = Buffer18.prototype.inspect; - } - Buffer18.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer18.from(target, target.offset, target.byteLength); - } - if (!Buffer18.isBuffer(target)) { - throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - } - if (start === void 0) { - start = 0; - } - if (end === void 0) { - end = target ? target.length : 0; - } - if (thisStart === void 0) { - thisStart = 0; - } - if (thisEnd === void 0) { - thisEnd = this.length; - } - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError("out of range index"); - } - if (thisStart >= thisEnd && start >= end) { - return 0; - } - if (thisStart >= thisEnd) { - return -1; - } - if (start >= end) { - return 1; - } - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) - return 0; - var x = thisEnd - thisStart; - var y = end - start; - var len = Math.min(x, y); - var thisCopy = this.slice(thisStart, thisEnd); - var targetCopy = target.slice(start, end); - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; - } - } - if (x < y) - return -1; - if (y < x) - return 1; - return 0; - }; - function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - if (buffer.length === 0) - return -1; - if (typeof byteOffset === "string") { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 2147483647) { - byteOffset = 2147483647; - } else if (byteOffset < -2147483648) { - byteOffset = -2147483648; - } - byteOffset = +byteOffset; - if (numberIsNaN(byteOffset)) { - byteOffset = dir ? 0 : buffer.length - 1; - } - if (byteOffset < 0) - byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) - return -1; - else - byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) - byteOffset = 0; - else - return -1; - } - if (typeof val === "string") { - val = Buffer18.from(val, encoding); - } - if (Buffer18.isBuffer(val)) { - if (val.length === 0) { - return -1; - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === "number") { - val = val & 255; - if (typeof Uint8Array.prototype.indexOf === "function") { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); - } - throw new TypeError("val must be string, number or Buffer"); - } - function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - var indexSize = 1; - var arrLength = arr.length; - var valLength = val.length; - if (encoding !== void 0) { - encoding = String(encoding).toLowerCase(); - if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { - if (arr.length < 2 || val.length < 2) { - return -1; - } - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read2(buf2, i2) { - if (indexSize === 1) { - return buf2[i2]; - } else { - return buf2.readUInt16BE(i2 * indexSize); - } - } - var i; - if (dir) { - var foundIndex = -1; - for (i = byteOffset; i < arrLength; i++) { - if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) - foundIndex = i; - if (i - foundIndex + 1 === valLength) - return foundIndex * indexSize; - } else { - if (foundIndex !== -1) - i -= i - foundIndex; - foundIndex = -1; - } - } - } else { - if (byteOffset + valLength > arrLength) - byteOffset = arrLength - valLength; - for (i = byteOffset; i >= 0; i--) { - var found = true; - for (var j = 0; j < valLength; j++) { - if (read2(arr, i + j) !== read2(val, j)) { - found = false; - break; - } - } - if (found) - return i; - } - } - return -1; - } - Buffer18.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; - }; - Buffer18.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); - }; - Buffer18.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); - }; - function hexWrite(buf2, string, offset, length) { - offset = Number(offset) || 0; - var remaining = buf2.length - offset; - if (!length) { - length = remaining; - } else { - length = Number(length); - if (length > remaining) { - length = remaining; - } - } - var strLen = string.length; - if (length > strLen / 2) { - length = strLen / 2; - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) - return i; - buf2[offset + i] = parsed; - } - return i; - } - function utf8Write(buf2, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf2.length - offset), buf2, offset, length); - } - function asciiWrite(buf2, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf2, offset, length); - } - function base64Write(buf2, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf2, offset, length); - } - function ucs2Write(buf2, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length); - } - Buffer18.prototype.write = function write2(string, offset, length, encoding) { - if (offset === void 0) { - encoding = "utf8"; - length = this.length; - offset = 0; - } else if (length === void 0 && typeof offset === "string") { - encoding = offset; - length = this.length; - offset = 0; - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === void 0) - encoding = "utf8"; - } else { - encoding = length; - length = void 0; - } - } else { - throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); - } - var remaining = this.length - offset; - if (length === void 0 || length > remaining) - length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { - throw new RangeError("Attempt to write outside buffer bounds"); - } - if (!encoding) - encoding = "utf8"; - var loweredCase = false; - for (; ; ) { - switch (encoding) { - case "hex": - return hexWrite(this, string, offset, length); - case "utf8": - case "utf-8": - return utf8Write(this, string, offset, length); - case "ascii": - case "latin1": - case "binary": - return asciiWrite(this, string, offset, length); - case "base64": - return base64Write(this, string, offset, length); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) - throw new TypeError("Unknown encoding: " + encoding); - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - }; - Buffer18.prototype.toJSON = function toJSON() { - return { - type: "Buffer", - data: Array.prototype.slice.call(this._arr || this, 0) - }; - }; - function base64Slice(buf2, start, end) { - if (start === 0 && end === buf2.length) { - return base64.fromByteArray(buf2); - } else { - return base64.fromByteArray(buf2.slice(start, end)); - } - } - function utf8Slice(buf2, start, end) { - end = Math.min(buf2.length, end); - var res = []; - var i = start; - while (i < end) { - var firstByte = buf2[i]; - var codePoint = null; - var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint; - switch (bytesPerSequence) { - case 1: - if (firstByte < 128) { - codePoint = firstByte; - } - break; - case 2: - secondByte = buf2[i + 1]; - if ((secondByte & 192) === 128) { - tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; - if (tempCodePoint > 127) { - codePoint = tempCodePoint; - } - } - break; - case 3: - secondByte = buf2[i + 1]; - thirdByte = buf2[i + 2]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; - if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { - codePoint = tempCodePoint; - } - } - break; - case 4: - secondByte = buf2[i + 1]; - thirdByte = buf2[i + 2]; - fourthByte = buf2[i + 3]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; - if (tempCodePoint > 65535 && tempCodePoint < 1114112) { - codePoint = tempCodePoint; - } - } - } - } - if (codePoint === null) { - codePoint = 65533; - bytesPerSequence = 1; - } else if (codePoint > 65535) { - codePoint -= 65536; - res.push(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); - } - var MAX_ARGUMENTS_LENGTH = 4096; - function decodeCodePointsArray(codePoints) { - var len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints); - } - var res = ""; - var i = 0; - while (i < len) { - res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - } - return res; - } - function asciiSlice(buf2, start, end) { - var ret = ""; - end = Math.min(buf2.length, end); - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf2[i] & 127); - } - return ret; - } - function latin1Slice(buf2, start, end) { - var ret = ""; - end = Math.min(buf2.length, end); - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf2[i]); - } - return ret; - } - function hexSlice(buf2, start, end) { - var len = buf2.length; - if (!start || start < 0) - start = 0; - if (!end || end < 0 || end > len) - end = len; - var out = ""; - for (var i = start; i < end; ++i) { - out += hexSliceLookupTable[buf2[i]]; - } - return out; - } - function utf16leSlice(buf2, start, end) { - var bytes = buf2.slice(start, end); - var res = ""; - for (var i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); + var MAX_HWM = 1073741824; + function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; } - return res; + return n; } - Buffer18.prototype.slice = function slice(start, end) { - var len = this.length; - start = ~~start; - end = end === void 0 ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) - start = 0; - } else if (start > len) { - start = len; + function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) + return 0; + if (state.objectMode) + return 1; + if (n !== n) { + if (state.flowing && state.length) + return state.buffer.head.data.length; + else + return state.length; } - if (end < 0) { - end += len; - if (end < 0) - end = 0; - } else if (end > len) { - end = len; + if (n > state.highWaterMark) + state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) + return n; + if (!state.ended) { + state.needReadable = true; + return 0; } - if (end < start) - end = start; - var newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer18.prototype); - return newBuf; - }; - function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) - throw new RangeError("offset is not uint"); - if (offset + ext > length) - throw new RangeError("Trying to access beyond buffer length"); + return state.length; } - Buffer18.prototype.readUintLE = Buffer18.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - return val; - }; - Buffer18.prototype.readUintBE = Buffer18.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - checkOffset(offset, byteLength2, this.length); - } - var val = this[offset + --byteLength2]; - var mul = 1; - while (byteLength2 > 0 && (mul *= 256)) { - val += this[offset + --byteLength2] * mul; - } - return val; - }; - Buffer18.prototype.readUint8 = Buffer18.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 1, this.length); - return this[offset]; - }; - Buffer18.prototype.readUint16LE = Buffer18.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; - }; - Buffer18.prototype.readUint16BE = Buffer18.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; - }; - Buffer18.prototype.readUint32LE = Buffer18.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; - }; - Buffer18.prototype.readUint32BE = Buffer18.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); - }; - Buffer18.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - mul *= 128; - if (val >= mul) - val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer18.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var i = byteLength2; - var mul = 1; - var val = this[offset + --i]; - while (i > 0 && (mul *= 256)) { - val += this[offset + --i] * mul; + Readable.prototype.read = function(n) { + debug("read", n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) + state.emittedReadable = false; + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug("read: emitReadable", state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); + return null; } - mul *= 128; - if (val >= mul) - val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer18.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 1, this.length); - if (!(this[offset] & 128)) - return this[offset]; - return (255 - this[offset] + 1) * -1; - }; - Buffer18.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - var val = this[offset] | this[offset + 1] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer18.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - var val = this[offset + 1] | this[offset] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer18.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; - }; - Buffer18.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; - }; - Buffer18.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return ieee7542.read(this, offset, true, 23, 4); - }; - Buffer18.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return ieee7542.read(this, offset, false, 23, 4); - }; - Buffer18.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 8, this.length); - return ieee7542.read(this, offset, true, 52, 8); - }; - Buffer18.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 8, this.length); - return ieee7542.read(this, offset, false, 52, 8); - }; - function checkInt(buf2, value, offset, ext, max, min) { - if (!Buffer18.isBuffer(buf2)) - throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) - throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf2.length) - throw new RangeError("Index out of range"); - } - Buffer18.prototype.writeUintLE = Buffer18.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); + n = howMuchToRead(n, state); + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; } - var mul = 1; - var i = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - this[offset + i] = value / mul & 255; + var doRead = state.needReadable; + debug("need readable", doRead); + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug("length less than watermark", doRead); } - return offset + byteLength2; - }; - Buffer18.prototype.writeUintBE = Buffer18.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); + if (state.ended || state.reading) { + doRead = false; + debug("reading or ended", doRead); + } else if (doRead) { + debug("do read"); + state.reading = true; + state.sync = true; + if (state.length === 0) + state.needReadable = true; + this._read(state.highWaterMark); + state.sync = false; + if (!state.reading) + n = howMuchToRead(nOrig, state); } - var i = byteLength2 - 1; - var mul = 1; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - this[offset + i] = value / mul & 255; + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; } - return offset + byteLength2; - }; - Buffer18.prototype.writeUint8 = Buffer18.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 1, 255, 0); - this[offset] = value & 255; - return offset + 1; - }; - Buffer18.prototype.writeUint16LE = Buffer18.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer18.prototype.writeUint16BE = Buffer18.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer18.prototype.writeUint32LE = Buffer18.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 4294967295, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 255; - return offset + 4; - }; - Buffer18.prototype.writeUint32BE = Buffer18.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 4294967295, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; + if (state.length === 0) { + if (!state.ended) + state.needReadable = true; + if (nOrig !== n && state.ended) + endReadable(this); + } + if (ret !== null) + this.emit("data", ret); + return ret; }; - Buffer18.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); + function onEofChunk(stream, state) { + debug("onEofChunk"); + if (state.ended) + return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } } - var i = 0; - var mul = 1; - var sub = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1; + state.ended = true; + if (state.sync) { + emitReadable(stream); + } else { + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); } - this[offset + i] = (value / mul >> 0) - sub & 255; } - return offset + byteLength2; - }; - Buffer18.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); + } + function emitReadable(stream) { + var state = stream._readableState; + debug("emitReadable", state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug("emitReadable", state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); } - var i = byteLength2 - 1; - var mul = 1; - var sub = 0; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1; - } - this[offset + i] = (value / mul >> 0) - sub & 255; + } + function emitReadable_(stream) { + var state = stream._readableState; + debug("emitReadable_", state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit("readable"); + state.emittedReadable = false; } - return offset + byteLength2; - }; - Buffer18.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 1, 127, -128); - if (value < 0) - value = 255 + value + 1; - this[offset] = value & 255; - return offset + 1; - }; - Buffer18.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer18.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer18.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 2147483647, -2147483648); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; - }; - Buffer18.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 2147483647, -2147483648); - if (value < 0) - value = 4294967295 + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; - }; - function checkIEEE754(buf2, value, offset, ext, max, min) { - if (offset + ext > buf2.length) - throw new RangeError("Index out of range"); - if (offset < 0) - throw new RangeError("Index out of range"); + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); } - function writeFloat(buf2, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22); + function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); } - ieee7542.write(buf2, value, offset, littleEndian, 23, 4); - return offset + 4; } - Buffer18.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); - }; - Buffer18.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); - }; - function writeDouble(buf2, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292); + function maybeReadMore_(stream, state) { + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug("maybeReadMore read 0"); + stream.read(0); + if (len === state.length) + break; } - ieee7542.write(buf2, value, offset, littleEndian, 52, 8); - return offset + 8; + state.readingMore = false; } - Buffer18.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); - }; - Buffer18.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); + Readable.prototype._read = function(n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); }; - Buffer18.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer18.isBuffer(target)) - throw new TypeError("argument should be a Buffer"); - if (!start) - start = 0; - if (!end && end !== 0) - end = this.length; - if (targetStart >= target.length) - targetStart = target.length; - if (!targetStart) - targetStart = 0; - if (end > 0 && end < start) - end = start; - if (end === start) - return 0; - if (target.length === 0 || this.length === 0) - return 0; - if (targetStart < 0) { - throw new RangeError("targetStart out of bounds"); + Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) + process.nextTick(endFn); + else + src.once("end", endFn); + dest.on("unpipe", onunpipe); + function onunpipe(readable, unpipeInfo) { + debug("onunpipe"); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } } - if (start < 0 || start >= this.length) - throw new RangeError("Index out of range"); - if (end < 0) - throw new RangeError("sourceEnd out of bounds"); - if (end > this.length) - end = this.length; - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start; + function onend() { + debug("onend"); + dest.end(); } - var len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === "function") { - this.copyWithin(targetStart, start, end); - } else { - Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); + var ondrain = pipeOnDrain(src); + dest.on("drain", ondrain); + var cleanedUp = false; + function cleanup() { + debug("cleanup"); + dest.removeListener("close", onclose); + dest.removeListener("finish", onfinish); + dest.removeListener("drain", ondrain); + dest.removeListener("error", onerror); + dest.removeListener("unpipe", onunpipe); + src.removeListener("end", onend); + src.removeListener("end", unpipe); + src.removeListener("data", ondata); + cleanedUp = true; + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) + ondrain(); } - return len; - }; - Buffer18.prototype.fill = function fill(val, start, end, encoding) { - if (typeof val === "string") { - if (typeof start === "string") { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === "string") { - encoding = end; - end = this.length; - } - if (encoding !== void 0 && typeof encoding !== "string") { - throw new TypeError("encoding must be a string"); - } - if (typeof encoding === "string" && !Buffer18.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - if (val.length === 1) { - var code = val.charCodeAt(0); - if (encoding === "utf8" && code < 128 || encoding === "latin1") { - val = code; + src.on("data", ondata); + function ondata(chunk) { + debug("ondata"); + var ret = dest.write(chunk); + debug("dest.write", ret); + if (ret === false) { + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug("false write response, pause", state.awaitDrain); + state.awaitDrain++; } + src.pause(); } - } else if (typeof val === "number") { - val = val & 255; - } else if (typeof val === "boolean") { - val = Number(val); } - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError("Out of range index"); + function onerror(er) { + debug("onerror", er); + unpipe(); + dest.removeListener("error", onerror); + if (EElistenerCount(dest, "error") === 0) + errorOrDestroy(dest, er); } - if (end <= start) { - return this; + prependListener(dest, "error", onerror); + function onclose() { + dest.removeListener("finish", onfinish); + unpipe(); } - start = start >>> 0; - end = end === void 0 ? this.length : end >>> 0; - if (!val) - val = 0; - var i; - if (typeof val === "number") { - for (i = start; i < end; ++i) { - this[i] = val; - } - } else { - var bytes = Buffer18.isBuffer(val) ? val : Buffer18.from(val, encoding); - var len = bytes.length; - if (len === 0) { - throw new TypeError('The value "' + val + '" is invalid for argument "value"'); + dest.once("close", onclose); + function onfinish() { + debug("onfinish"); + dest.removeListener("close", onclose); + unpipe(); + } + dest.once("finish", onfinish); + function unpipe() { + debug("unpipe"); + src.unpipe(dest); + } + dest.emit("pipe", src); + if (!state.flowing) { + debug("pipe resume"); + src.resume(); + } + return dest; + }; + function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug("pipeOnDrain", state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { + state.flowing = true; + flow(src); } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len]; + }; + } + Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + if (state.pipesCount === 0) + return this; + if (state.pipesCount === 1) { + if (dest && dest !== state.pipes) + return this; + if (!dest) + dest = state.pipes; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) + dest.emit("unpipe", this, unpipeInfo); + return this; + } + if (!dest) { + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) { + dests[i].emit("unpipe", this, { + hasUnpiped: false + }); } + return this; } + var index = indexOf(state.pipes, dest); + if (index === -1) + return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + dest.emit("unpipe", this, unpipeInfo); return this; }; - var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; - function base64clean(str) { - str = str.split("=")[0]; - str = str.trim().replace(INVALID_BASE64_RE, ""); - if (str.length < 2) - return ""; - while (str.length % 4 !== 0) { - str = str + "="; - } - return str; - } - function utf8ToBytes(string, units) { - units = units || Infinity; - var codePoint; - var length = string.length; - var leadSurrogate = null; - var bytes = []; - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i); - if (codePoint > 55295 && codePoint < 57344) { - if (!leadSurrogate) { - if (codePoint > 56319) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - continue; - } else if (i + 1 === length) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - continue; - } - leadSurrogate = codePoint; - continue; - } - if (codePoint < 56320) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - leadSurrogate = codePoint; - continue; + Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === "data") { + state.readableListening = this.listenerCount("readable") > 0; + if (state.flowing !== false) + this.resume(); + } else if (ev === "readable") { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug("on readable", state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); } - codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; - } else if (leadSurrogate) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - } - leadSurrogate = null; - if (codePoint < 128) { - if ((units -= 1) < 0) - break; - bytes.push(codePoint); - } else if (codePoint < 2048) { - if ((units -= 2) < 0) - break; - bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128); - } else if (codePoint < 65536) { - if ((units -= 3) < 0) - break; - bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128); - } else if (codePoint < 1114112) { - if ((units -= 4) < 0) - break; - bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128); - } else { - throw new Error("Invalid code point"); } } - return bytes; - } - function asciiToBytes(str) { - var byteArray = []; - for (var i = 0; i < str.length; ++i) { - byteArray.push(str.charCodeAt(i) & 255); + return res; + }; + Readable.prototype.addListener = Readable.prototype.on; + Readable.prototype.removeListener = function(ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === "readable") { + process.nextTick(updateReadableListening, this); + } + return res; + }; + Readable.prototype.removeAllListeners = function(ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === "readable" || ev === void 0) { + process.nextTick(updateReadableListening, this); } - return byteArray; - } - function utf16leToBytes(str, units) { - var c, hi, lo; - var byteArray = []; - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) - break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); + return res; + }; + function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount("readable") > 0; + if (state.resumeScheduled && !state.paused) { + state.flowing = true; + } else if (self.listenerCount("data") > 0) { + self.resume(); } - return byteArray; } - function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); + function nReadingNextTick(self) { + debug("readable nexttick read 0"); + self.read(0); } - function blitBuffer(src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if (i + offset >= dst.length || i >= src.length) - break; - dst[i + offset] = src[i]; + Readable.prototype.resume = function() { + var state = this._readableState; + if (!state.flowing) { + debug("resume"); + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; + }; + function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); } - return i; } - function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; + function resume_(stream, state) { + debug("resume", state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit("resume"); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); } - function numberIsNaN(obj) { - return obj !== obj; + Readable.prototype.pause = function() { + debug("call pause flowing=%j", this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug("pause"); + this._readableState.flowing = false; + this.emit("pause"); + } + this._readableState.paused = true; + return this; + }; + function flow(stream) { + var state = stream._readableState; + debug("flow", state.flowing); + while (state.flowing && stream.read() !== null) { + ; + } } - var hexSliceLookupTable = function() { - var alphabet = "0123456789abcdef"; - var table = new Array(256); - for (var i = 0; i < 16; ++i) { - var i16 = i * 16; - for (var j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j]; + Readable.prototype.wrap = function(stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on("end", function() { + debug("wrapped end"); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + _this.push(chunk); } - } - return table; - }(); - } - }); - - // node_modules/ebml/lib/ebml/tools.js - var require_tools = __commonJS({ - "node_modules/ebml/lib/ebml/tools.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var tools = { - readVint: function(buffer, start) { - start = start || 0; - for (var length = 1; length <= 8; length++) { - if (buffer[start] >= Math.pow(2, 8 - length)) { - break; - } + _this.push(null); + }); + stream.on("data", function(chunk) { + debug("wrapped data"); + if (state.decoder) + chunk = state.decoder.write(chunk); + if (state.objectMode && (chunk === null || chunk === void 0)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) + return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); } - if (length > 8) { - throw new Error("Unrepresentable length: " + length + " " + buffer.toString("hex", start, start + length)); + }); + for (var i in stream) { + if (this[i] === void 0 && typeof stream[i] === "function") { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); } - if (start + length > buffer.length) { - return null; + } + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + this._read = function(n2) { + debug("wrapped _read", n2); + if (paused) { + paused = false; + stream.resume(); } - var value = buffer[start] & (1 << 8 - length) - 1; - for (var i = 1; i < length; i++) { - if (i === 7) { - if (value >= Math.pow(2, 53 - 8) && buffer[start + 7] > 0) { - return { - length, - value: -1 - }; - } - } - value *= Math.pow(2, 8); - value += buffer[start + i]; + }; + return this; + }; + if (typeof Symbol === "function") { + Readable.prototype[Symbol.asyncIterator] = function() { + if (createReadableStreamAsyncIterator === void 0) { + createReadableStreamAsyncIterator = require_async_iterator(); } - return { - length, - value - }; + return createReadableStreamAsyncIterator(this); + }; + } + Object.defineProperty(Readable.prototype, "readableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._readableState.highWaterMark; + } + }); + Object.defineProperty(Readable.prototype, "readableBuffer", { + enumerable: false, + get: function get2() { + return this._readableState && this._readableState.buffer; + } + }); + Object.defineProperty(Readable.prototype, "readableFlowing", { + enumerable: false, + get: function get2() { + return this._readableState.flowing; }, - writeVint: function(value) { - if (value < 0 || value > Math.pow(2, 53)) { - throw new Error("Unrepresentable value: " + value); + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; } - for (var length = 1; length <= 8; length++) { - if (value < Math.pow(2, 7 * length) - 1) { - break; + } + }); + Readable._fromList = fromList; + Object.defineProperty(Readable.prototype, "readableLength", { + enumerable: false, + get: function get2() { + return this._readableState.length; + } + }); + function fromList(n, state) { + if (state.length === 0) + return null; + var ret; + if (state.objectMode) + ret = state.buffer.shift(); + else if (!n || n >= state.length) { + if (state.decoder) + ret = state.buffer.join(""); + else if (state.buffer.length === 1) + ret = state.buffer.first(); + else + ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + ret = state.buffer.consume(n, state.decoder); + } + return ret; + } + function endReadable(stream) { + var state = stream._readableState; + debug("endReadable", state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } + } + function endReadableNT(state, stream) { + debug("endReadableNT", state.endEmitted, state.length); + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit("end"); + if (state.autoDestroy) { + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); } } - var buffer = new Buffer2(length); - for (var i = 1; i <= length; i++) { - var b = value & 255; - buffer[length - i] = b; - value -= b; - value /= Math.pow(2, 8); + } + } + if (typeof Symbol === "function") { + Readable.from = function(iterable, opts) { + if (from === void 0) { + from = require_from_browser(); } - buffer[0] = buffer[0] | 1 << 8 - length; - return buffer; + return from(Readable, iterable, opts); + }; + } + function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) + return i; } - }; - module.exports = tools; + return -1; + } } }); - // node_modules/ebml-block/lib/vint.js - var require_vint = __commonJS({ - "node_modules/ebml-block/lib/vint.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_transform.js + var require_stream_transform = __commonJS({ + "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - module.exports = function(buffer, start, signed) { - start = start || 0; - for (var length = 1; length <= 8; length++) { - if (buffer[start] >= Math.pow(2, 8 - length)) { - break; - } - } - if (length > 8) { - throw new Error("Unrepresentable length: " + length + " " + buffer.toString("hex", start, start + length)); - } - if (start + length > buffer.length) { - return null; - } - var i; - var value = buffer[start] & (1 << 8 - length) - 1; - for (i = 1; i < length; i++) { - if (i === 7) { - if (value >= Math.pow(2, 53 - 8) && buffer[start + 7] > 0) { - return { - length, - value: -1 - }; - } - } - value *= Math.pow(2, 8); - value += buffer[start + i]; + module.exports = Transform; + var _require$codes = require_errors_browser().codes; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; + var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING; + var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; + var Duplex = require_stream_duplex(); + require_inherits_browser()(Transform, Duplex); + function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit("error", new ERR_MULTIPLE_CALLBACK()); } - if (signed) { - value -= Math.pow(2, length * 7 - 1) - 1; + ts.writechunk = null; + ts.writecb = null; + if (data != null) + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); } - return { - length, - value + } + function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null }; + this._readableState.needReadable = true; + this._readableState.sync = false; + if (options) { + if (typeof options.transform === "function") + this._transform = options.transform; + if (typeof options.flush === "function") + this._flush = options.flush; + } + this.on("prefinish", prefinish); + } + function prefinish() { + var _this = this; + if (typeof this._flush === "function" && !this._readableState.destroyed) { + this._flush(function(er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } + } + Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); }; - } - }); - - // node_modules/ebml-block/lib/buffer-reader.js - var require_buffer_reader = __commonJS({ - "node_modules/ebml-block/lib/buffer-reader.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var vint = require_vint(); - function BufferReader(buffer) { - this.buffer = buffer; - this.offset = 0; - } - BufferReader.prototype.nextInt16BE = function() { - var value = this.buffer.readInt16BE(this.offset); - this.offset += 2; - return value; - }; - BufferReader.prototype.nextUInt8 = function() { - var value = this.buffer.readUInt8(this.offset); - this.offset += 1; - return value; + Transform.prototype._transform = function(chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); }; - BufferReader.prototype.nextUIntV = function() { - var v = vint(this.buffer, this.offset); - this.offset += v.length; - return v.value; + Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } }; - BufferReader.prototype.nextIntV = function() { - var v = vint(this.buffer, this.offset, true); - this.offset += v.length; - return v.value; + Transform.prototype._read = function(n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + ts.needTransform = true; + } }; - BufferReader.prototype.nextBuffer = function(length) { - var buffer = length ? this.buffer.slice(this.offset, this.offset + length) : this.buffer.slice(this.offset); - this.offset += length || this.length; - return buffer; + Transform.prototype._destroy = function(err, cb) { + Duplex.prototype._destroy.call(this, err, function(err2) { + cb(err2); + }); }; - Object.defineProperty(BufferReader.prototype, "length", { - get: function() { - return this.buffer.length - this.offset; - } - }); - module.exports = BufferReader; + function done(stream, er, data) { + if (er) + return stream.emit("error", er); + if (data != null) + stream.push(data); + if (stream._writableState.length) + throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) + throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); + } } }); - // node_modules/ebml-block/index.js - var require_ebml_block = __commonJS({ - "node_modules/ebml-block/index.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_passthrough.js + var require_stream_passthrough = __commonJS({ + "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var BufferReader = require_buffer_reader(); - var XIPH_LACING = 1; - var EBML_LACING = 3; - var FIXED_SIZE_LACING = 2; - module.exports = function(buffer) { - var block = {}; - var reader = new BufferReader(buffer); - block.trackNumber = reader.nextUIntV(); - block.timecode = reader.nextInt16BE(); - var flags = reader.nextUInt8(); - block.invisible = !!(flags & 8); - block.keyframe = !!(flags & 128); - block.discardable = !!(flags & 1); - var lacing = (flags & 6) >> 1; - block.frames = readLacedData(reader, lacing); - return block; - }; - function readLacedData(reader, lacing) { - if (!lacing) - return [reader.nextBuffer()]; - var i, frameSize; - var frames = []; - var framesNum = reader.nextUInt8() + 1; - if (lacing === FIXED_SIZE_LACING) { - if (reader.length % framesNum !== 0) - throw new Error("Fixed-Size Lacing Error"); - frameSize = reader.length / framesNum; - for (i = 0; i < framesNum; i++) { - frames.push(reader.nextBuffer(frameSize)); - } - return frames; - } - var frameSizes = []; - if (lacing === XIPH_LACING) { - for (i = 0; i < framesNum - 1; i++) { - var val; - frameSize = 0; - do { - val = reader.nextUInt8(); - frameSize += val; - } while (val === 255); - frameSizes.push(frameSize); - } - } else if (lacing === EBML_LACING) { - frameSize = reader.nextUIntV(); - frameSizes.push(frameSize); - for (i = 1; i < framesNum - 1; i++) { - frameSize += reader.nextIntV(); - frameSizes.push(frameSize); - } - } - for (i = 0; i < framesNum - 1; i++) { - frames.push(reader.nextBuffer(frameSizes[i])); - } - frames.push(reader.nextBuffer()); - return frames; + module.exports = PassThrough; + var Transform = require_stream_transform(); + require_inherits_browser()(PassThrough, Transform); + function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + Transform.call(this, options); } + PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); + }; } }); - // node_modules/ts-ebml/lib/tools.js - var require_tools2 = __commonJS({ - "node_modules/ts-ebml/lib/tools.js"(exports) { + // node_modules/readable-stream/lib/internal/streams/pipeline.js + var require_pipeline = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var int64_buffer_1 = require_int64_buffer(); - var EBMLEncoder_1 = require_EBMLEncoder(); - var _Buffer = require_buffer2(); - var _tools = require_tools(); - var _block = require_ebml_block(); - exports.Buffer = _Buffer.Buffer; - exports.readVint = _tools.readVint; - exports.writeVint = _tools.writeVint; - exports.ebmlBlock = _block; - function readBlock(buf2) { - return exports.ebmlBlock(new exports.Buffer(buf2)); - } - exports.readBlock = readBlock; - function encodeTag(tagId, tagData, unknownSize) { - if (unknownSize === void 0) { - unknownSize = false; - } - return concat([ - tagId, - unknownSize ? new exports.Buffer("01ffffffffffffff", "hex") : exports.writeVint(tagData.length), - tagData - ]); - } - exports.encodeTag = encodeTag; - function WebPFrameFilter(elms) { - return WebPBlockFilter(elms).reduce(function(lst, elm) { - var o = exports.ebmlBlock(elm.data); - return o.frames.reduce(function(lst2, frame) { - var webpBuf = VP8BitStreamToRiffWebPBuffer(frame); - var webp = new Blob([webpBuf], { type: "image/webp" }); - return lst2.concat(webp); - }, lst); - }, []); - } - exports.WebPFrameFilter = WebPFrameFilter; - function WebPBlockFilter(elms) { - return elms.reduce(function(lst, elm) { - if (elm.type !== "b") { - return lst; - } - if (elm.name !== "SimpleBlock") { - return lst; - } - var o = exports.ebmlBlock(elm.data); - var hasWebP = o.frames.some(function(frame) { - var startcode = frame.slice(3, 6).toString("hex"); - return startcode === "9d012a"; - }); - if (!hasWebP) { - return lst; - } - return lst.concat(elm); - }, []); - } - exports.WebPBlockFilter = WebPBlockFilter; - function VP8BitStreamToRiffWebPBuffer(frame) { - var VP8Chunk = createRIFFChunk("VP8 ", frame); - var WebPChunk = concat([ - new exports.Buffer("WEBP", "ascii"), - VP8Chunk - ]); - return createRIFFChunk("RIFF", WebPChunk); - } - exports.VP8BitStreamToRiffWebPBuffer = VP8BitStreamToRiffWebPBuffer; - function createRIFFChunk(FourCC, chunk) { - var chunkSize = new exports.Buffer(4); - chunkSize.writeUInt32LE(chunk.byteLength, 0); - return concat([ - new exports.Buffer(FourCC.substr(0, 4), "ascii"), - chunkSize, - chunk, - new exports.Buffer(chunk.byteLength % 2 === 0 ? 0 : 1) - ]); - } - exports.createRIFFChunk = createRIFFChunk; - function makeMetadataSeekable(originalMetadata, duration, cuesInfo) { - var header = extractElement("EBML", originalMetadata); - var headerSize = encodedSizeOfEbml(header); - var segmentContentStartPos = headerSize + 12; - var originalMetadataSize = originalMetadata[originalMetadata.length - 1].dataEnd - segmentContentStartPos; - var info = extractElement("Info", originalMetadata); - removeElement("Duration", info); - info.splice(1, 0, { name: "Duration", type: "f", data: createFloatBuffer(duration, 8) }); - var infoSize = encodedSizeOfEbml(info); - var tracks = extractElement("Tracks", originalMetadata); - var tracksSize = encodedSizeOfEbml(tracks); - var seekHeadSize = 47; - var seekHead = []; - var cuesSize = 5 + cuesInfo.length * 15; - var cues = []; - var lastSizeDifference = -1; - var maxIterations = 10; - var _loop_1 = function(i2) { - var infoStart = seekHeadSize; - var tracksStart = infoStart + infoSize; - var cuesStart = tracksStart + tracksSize; - var newMetadataSize = cuesStart + cuesSize; - var sizeDifference = newMetadataSize - originalMetadataSize; - seekHead = []; - seekHead.push({ name: "SeekHead", type: "m", isEnd: false }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([21, 73, 169, 102]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(infoStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([22, 84, 174, 107]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(tracksStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([28, 83, 187, 107]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(cuesStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "SeekHead", type: "m", isEnd: true }); - seekHeadSize = encodedSizeOfEbml(seekHead); - cues = []; - cues.push({ name: "Cues", type: "m", isEnd: false }); - cuesInfo.forEach(function(_a) { - var CueTrack = _a.CueTrack, CueClusterPosition = _a.CueClusterPosition, CueTime = _a.CueTime; - cues.push({ name: "CuePoint", type: "m", isEnd: false }); - cues.push({ name: "CueTime", type: "u", data: createUIntBuffer(CueTime) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: false }); - cues.push({ name: "CueTrack", type: "u", data: createUIntBuffer(CueTrack) }); - CueClusterPosition -= segmentContentStartPos; - CueClusterPosition += sizeDifference; - cues.push({ name: "CueClusterPosition", type: "u", data: createUIntBuffer(CueClusterPosition) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: true }); - cues.push({ name: "CuePoint", type: "m", isEnd: true }); - }); - cues.push({ name: "Cues", type: "m", isEnd: true }); - cuesSize = encodedSizeOfEbml(cues); - if (lastSizeDifference !== sizeDifference) { - lastSizeDifference = sizeDifference; - if (i2 === maxIterations - 1) { - throw new Error("Failed to converge to a stable metadata size"); - } - } else { - return "break"; - } + var eos; + function once(callback) { + var called = false; + return function() { + if (called) + return; + called = true; + callback.apply(void 0, arguments); }; - for (var i = 0; i < maxIterations; i++) { - var state_1 = _loop_1(i); - if (state_1 === "break") - break; - } - var finalMetadata = [].concat.apply([], [ - header, - { name: "Segment", type: "m", isEnd: false, unknownSize: true }, - seekHead, - info, - tracks, - cues - ]); - var result = new EBMLEncoder_1.default().encode(finalMetadata); - return result; - } - exports.makeMetadataSeekable = makeMetadataSeekable; - function removeElement(idName, metadata) { - var result = []; - var start = -1; - for (var i = 0; i < metadata.length; i++) { - var element2 = metadata[i]; - if (element2.name === idName) { - if (element2.type === "m") { - if (!element2.isEnd) { - start = i; - } else { - if (start == -1) - throw new Error("Detected " + idName + " closing element before finding the start"); - metadata.splice(start, i - start + 1); - return; - } - } else { - metadata.splice(i, 1); - return; - } - } - } } - exports.removeElement = removeElement; - function extractElement(idName, metadata) { - var result = []; - var start = -1; - for (var i = 0; i < metadata.length; i++) { - var element2 = metadata[i]; - if (element2.name === idName) { - if (element2.type === "m") { - if (!element2.isEnd) { - start = i; - } else { - if (start == -1) - throw new Error("Detected " + idName + " closing element before finding the start"); - result = metadata.slice(start, i + 1); - break; - } - } else { - result.push(metadata[i]); - break; - } - } - } - return result; + var _require$codes = require_errors_browser().codes; + var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; + var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + function noop3(err) { + if (err) + throw err; } - exports.extractElement = extractElement; - function putRefinedMetaData(metadata, info) { - if (Array.isArray(info.cueInfos) && !Array.isArray(info.cues)) { - console.warn("putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues"); - info.cues = info.cueInfos; - } - var ebml2 = []; - var payload = []; - for (var i_1 = 0; i_1 < metadata.length; i_1++) { - var elm = metadata[i_1]; - if (elm.type === "m" && elm.name === "Segment") { - ebml2 = metadata.slice(0, i_1); - payload = metadata.slice(i_1); - if (elm.unknownSize) { - payload.shift(); - break; - } - throw new Error("this metadata is not streaming webm file"); - } - } - if (!(payload[payload.length - 1].dataEnd > 0)) { - throw new Error("metadata dataEnd has wrong number"); - } - var originalPayloadOffsetEnd = payload[payload.length - 1].dataEnd; - var ebmlSize = ebml2[ebml2.length - 1].dataEnd; - var refinedEBMLSize = new EBMLEncoder_1.default().encode(ebml2).byteLength; - var offsetDiff = refinedEBMLSize - ebmlSize; - var payloadSize = originalPayloadOffsetEnd - payload[0].tagStart; - var segmentSize = payload[0].tagStart - ebmlSize; - var segmentOffset = payload[0].tagStart; - var segmentTagBuf = new exports.Buffer([24, 83, 128, 103]); - var segmentSizeBuf = new exports.Buffer("01ffffffffffffff", "hex"); - var _segmentSize = segmentTagBuf.byteLength + segmentSizeBuf.byteLength; - var newPayloadSize = payloadSize; - var i; - for (i = 1; i < 20; i++) { - var newPayloadOffsetEnd = ebmlSize + _segmentSize + newPayloadSize; - var offsetEndDiff = newPayloadOffsetEnd - originalPayloadOffsetEnd; - var sizeDiff = offsetDiff + offsetEndDiff; - var refined = refineMetadata(payload, sizeDiff, info); - var newNewRefinedSize = new EBMLEncoder_1.default().encode(refined).byteLength; - if (newNewRefinedSize === newPayloadSize) { - return new EBMLEncoder_1.default().encode([].concat(ebml2, [{ type: "m", name: "Segment", isEnd: false, unknownSize: true }], refined)); - } - newPayloadSize = newNewRefinedSize; - } - throw new Error("unable to refine metadata, stable size could not be found in " + i + " iterations!"); - } - exports.putRefinedMetaData = putRefinedMetaData; - function encodedSizeOfEbml(refinedMetaData) { - var encorder = new EBMLEncoder_1.default(); - return refinedMetaData.reduce(function(lst, elm) { - return lst.concat(encorder.encode([elm])); - }, []).reduce(function(o, buf2) { - return o + buf2.byteLength; - }, 0); - } - function refineMetadata(mesetadata, sizeDiff, info) { - var duration = info.duration, clusterPtrs = info.clusterPtrs, cues = info.cues; - var _metadata = mesetadata.slice(0); - if (typeof duration === "number") { - var overwrited_1 = false; - _metadata.forEach(function(elm) { - if (elm.type === "f" && elm.name === "Duration") { - overwrited_1 = true; - elm.data = createFloatBuffer(duration, 8); - } - }); - if (!overwrited_1) { - insertTag(_metadata, "Info", [{ name: "Duration", type: "f", data: createFloatBuffer(duration, 8) }]); - } - } - if (Array.isArray(cues)) { - insertTag(_metadata, "Cues", create_cue(cues, sizeDiff)); - } - var seekhead_children = []; - if (Array.isArray(clusterPtrs)) { - console.warn("append cluster pointers to seekhead is deprecated. please use cues"); - seekhead_children = create_seek_from_clusters(clusterPtrs, sizeDiff); - } - insertTag(_metadata, "SeekHead", seekhead_children, true); - return _metadata; + function isRequest(stream) { + return stream.setHeader && typeof stream.abort === "function"; } - function create_seek_from_clusters(clusterPtrs, sizeDiff) { - var seeks = []; - clusterPtrs.forEach(function(start) { - seeks.push({ name: "Seek", type: "m", isEnd: false }); - seeks.push({ name: "SeekID", type: "b", data: new exports.Buffer([31, 67, 182, 117]) }); - seeks.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(start + sizeDiff) }); - seeks.push({ name: "Seek", type: "m", isEnd: true }); + function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on("close", function() { + closed = true; }); - return seeks; - } - function create_cue(cueInfos, sizeDiff) { - var cues = []; - cueInfos.forEach(function(_a) { - var CueTrack = _a.CueTrack, CueClusterPosition = _a.CueClusterPosition, CueTime = _a.CueTime; - cues.push({ name: "CuePoint", type: "m", isEnd: false }); - cues.push({ name: "CueTime", type: "u", data: createUIntBuffer(CueTime) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: false }); - cues.push({ name: "CueTrack", type: "u", data: createUIntBuffer(CueTrack) }); - cues.push({ name: "CueClusterPosition", type: "u", data: createUIntBuffer(CueClusterPosition + sizeDiff) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: true }); - cues.push({ name: "CuePoint", type: "m", isEnd: true }); + if (eos === void 0) + eos = require_end_of_stream(); + eos(stream, { + readable: reading, + writable: writing + }, function(err) { + if (err) + return callback(err); + closed = true; + callback(); }); - return cues; + var destroyed = false; + return function(err) { + if (closed) + return; + if (destroyed) + return; + destroyed = true; + if (isRequest(stream)) + return stream.abort(); + if (typeof stream.destroy === "function") + return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED("pipe")); + }; } - function insertTag(_metadata, tagName, children2, insertHead) { - if (insertHead === void 0) { - insertHead = false; - } - var idx = -1; - for (var i = 0; i < _metadata.length; i++) { - var elm = _metadata[i]; - if (elm.type === "m" && elm.name === tagName && elm.isEnd === false) { - idx = i; - break; - } - } - if (idx >= 0) { - Array.prototype.splice.apply(_metadata, [idx + 1, 0].concat(children2)); - } else if (insertHead) { - [].concat([{ name: tagName, type: "m", isEnd: false }], children2, [{ name: tagName, type: "m", isEnd: true }]).reverse().forEach(function(elm2) { - _metadata.unshift(elm2); - }); - } else { - _metadata.push({ name: tagName, type: "m", isEnd: false }); - children2.forEach(function(elm2) { - _metadata.push(elm2); - }); - _metadata.push({ name: tagName, type: "m", isEnd: true }); - } + function call(fn) { + fn(); } - function concat(list) { - var i = 0; - var length = 0; - for (; i < list.length; ++i) { - length += list[i].length; - } - var buffer = exports.Buffer.allocUnsafe(length); - var pos = 0; - for (i = 0; i < list.length; ++i) { - var buf2 = list[i]; - buf2.copy(buffer, pos); - pos += buf2.length; - } - return buffer; + function pipe(from, to) { + return from.pipe(to); } - exports.concat = concat; - function encodeValueToBuffer(elm) { - var data = new exports.Buffer(0); - if (elm.type === "m") { - return elm; - } - switch (elm.type) { - case "u": - data = createUIntBuffer(elm.value); - break; - case "i": - data = createIntBuffer(elm.value); - break; - case "f": - data = createFloatBuffer(elm.value); - break; - case "s": - data = new exports.Buffer(elm.value, "ascii"); - break; - case "8": - data = new exports.Buffer(elm.value, "utf8"); - break; - case "b": - data = elm.value; - break; - case "d": - data = new int64_buffer_1.Int64BE(elm.value.getTime().toString()).toBuffer(); - break; - } - return Object.assign({}, elm, { data }); - } - exports.encodeValueToBuffer = encodeValueToBuffer; - function createUIntBuffer(value) { - var bytes = 1; - for (; value >= Math.pow(2, 8 * bytes); bytes++) { - } - if (bytes >= 7) { - console.warn("7bit or more bigger uint not supported."); - return new int64_buffer_1.Uint64BE(value).toBuffer(); - } - var data = new exports.Buffer(bytes); - data.writeUIntBE(value, 0, bytes); - return data; - } - exports.createUIntBuffer = createUIntBuffer; - function createIntBuffer(value) { - var bytes = 1; - for (; value >= Math.pow(2, 8 * bytes); bytes++) { - } - if (bytes >= 7) { - console.warn("7bit or more bigger uint not supported."); - return new int64_buffer_1.Int64BE(value).toBuffer(); - } - var data = new exports.Buffer(bytes); - data.writeIntBE(value, 0, bytes); - return data; - } - exports.createIntBuffer = createIntBuffer; - function createFloatBuffer(value, bytes) { - if (bytes === void 0) { - bytes = 8; - } - if (bytes === 8) { - var data = new exports.Buffer(8); - data.writeDoubleBE(value, 0); - return data; - } else if (bytes === 4) { - var data = new exports.Buffer(4); - data.writeFloatBE(value, 0); - return data; - } else { - throw new Error("float type bits must 4bytes or 8bytes"); - } + function popCallback(streams) { + if (!streams.length) + return noop3; + if (typeof streams[streams.length - 1] !== "function") + return noop3; + return streams.pop(); } - exports.createFloatBuffer = createFloatBuffer; - function convertEBMLDateToJSDate(int64str) { - if (int64str instanceof Date) { - return int64str; + function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) + streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS("streams"); } - return new Date(new Date("2001-01-01T00:00:00.000Z").getTime() + Number(int64str) / 1e3 / 1e3); + var error; + var destroys = streams.map(function(stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function(err) { + if (!error) + error = err; + if (err) + destroys.forEach(call); + if (reading) + return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); } - exports.convertEBMLDateToJSDate = convertEBMLDateToJSDate; + module.exports = pipeline; } }); - // node_modules/ts-ebml/lib/EBMLDecoder.js - var require_EBMLDecoder = __commonJS({ - "node_modules/ts-ebml/lib/EBMLDecoder.js"(exports) { - "use strict"; + // node_modules/readable-stream/readable-browser.js + var require_readable_browser = __commonJS({ + "node_modules/readable-stream/readable-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var tools_1 = require_tools2(); - var int64_buffer_1 = require_int64_buffer(); - var tools = require_tools2(); - var schema = require_schema(); - var byEbmlID = schema.byEbmlID; - var State2; - (function(State3) { - State3[State3["STATE_TAG"] = 1] = "STATE_TAG"; - State3[State3["STATE_SIZE"] = 2] = "STATE_SIZE"; - State3[State3["STATE_CONTENT"] = 3] = "STATE_CONTENT"; - })(State2 || (State2 = {})); - var EBMLDecoder = function() { - function EBMLDecoder2() { - this._buffer = new tools_1.Buffer(0); - this._tag_stack = []; - this._state = State2.STATE_TAG; - this._cursor = 0; - this._total = 0; - this._schema = byEbmlID; - this._result = []; - } - EBMLDecoder2.prototype.decode = function(chunk) { - this.readChunk(chunk); - var diff = this._result; - this._result = []; - return diff; - }; - EBMLDecoder2.prototype.readChunk = function(chunk) { - this._buffer = tools.concat([this._buffer, new tools_1.Buffer(chunk)]); - while (this._cursor < this._buffer.length) { - if (this._state === State2.STATE_TAG && !this.readTag()) { - break; - } - if (this._state === State2.STATE_SIZE && !this.readSize()) { - break; - } - if (this._state === State2.STATE_CONTENT && !this.readContent()) { - break; - } - } - }; - EBMLDecoder2.prototype.getSchemaInfo = function(tagNum) { - return this._schema[tagNum] || { - name: "unknown", - level: -1, - type: "unknown", - description: "unknown" - }; - }; - EBMLDecoder2.prototype.readTag = function() { - if (this._cursor >= this._buffer.length) { - return false; - } - var tag = tools_1.readVint(this._buffer, this._cursor); - if (tag == null) { - return false; - } - var buf2 = this._buffer.slice(this._cursor, this._cursor + tag.length); - var tagNum = buf2.reduce(function(o, v, i, arr) { - return o + v * Math.pow(16, 2 * (arr.length - 1 - i)); - }, 0); - var schema2 = this.getSchemaInfo(tagNum); - var tagObj = { - EBML_ID: tagNum.toString(16), - schema: schema2, - type: schema2.type, - name: schema2.name, - level: schema2.level, - tagStart: this._total, - tagEnd: this._total + tag.length, - sizeStart: this._total + tag.length, - sizeEnd: null, - dataStart: null, - dataEnd: null, - dataSize: null, - data: null - }; - this._tag_stack.push(tagObj); - this._cursor += tag.length; - this._total += tag.length; - this._state = State2.STATE_SIZE; - return true; - }; - EBMLDecoder2.prototype.readSize = function() { - if (this._cursor >= this._buffer.length) { - return false; - } - var size = tools_1.readVint(this._buffer, this._cursor); - if (size == null) { - return false; - } - var tagObj = this._tag_stack[this._tag_stack.length - 1]; - tagObj.sizeEnd = tagObj.sizeStart + size.length; - tagObj.dataStart = tagObj.sizeEnd; - tagObj.dataSize = size.value; - if (size.value === -1) { - tagObj.dataEnd = -1; - if (tagObj.type === "m") { - tagObj.unknownSize = true; - } - } else { - tagObj.dataEnd = tagObj.sizeEnd + size.value; - } - this._cursor += size.length; - this._total += size.length; - this._state = State2.STATE_CONTENT; - return true; - }; - EBMLDecoder2.prototype.readContent = function() { - var tagObj = this._tag_stack[this._tag_stack.length - 1]; - if (tagObj.type === "m") { - tagObj.isEnd = false; - this._result.push(tagObj); - this._state = State2.STATE_TAG; - if (tagObj.dataSize === 0) { - var elm = Object.assign({}, tagObj, { isEnd: true }); - this._result.push(elm); - this._tag_stack.pop(); - } - return true; - } - if (this._buffer.length < this._cursor + tagObj.dataSize) { - return false; - } - var data = this._buffer.slice(this._cursor, this._cursor + tagObj.dataSize); - this._buffer = this._buffer.slice(this._cursor + tagObj.dataSize); - tagObj.data = data; - switch (tagObj.type) { - case "u": - tagObj.value = data.readUIntBE(0, data.length); - break; - case "i": - tagObj.value = data.readIntBE(0, data.length); - break; - case "f": - tagObj.value = tagObj.dataSize === 4 ? data.readFloatBE(0) : tagObj.dataSize === 8 ? data.readDoubleBE(0) : (console.warn("cannot read " + tagObj.dataSize + " octets float. failback to 0"), 0); - break; - case "s": - tagObj.value = data.toString("ascii"); - break; - case "8": - tagObj.value = data.toString("utf8"); - break; - case "b": - tagObj.value = data; - break; - case "d": - tagObj.value = tools_1.convertEBMLDateToJSDate(new int64_buffer_1.Int64BE(data).toNumber()); - break; - } - if (tagObj.value === null) { - throw new Error("unknown tag type:" + tagObj.type); - } - this._result.push(tagObj); - this._total += tagObj.dataSize; - this._state = State2.STATE_TAG; - this._cursor = 0; - this._tag_stack.pop(); - while (this._tag_stack.length > 0) { - var topEle = this._tag_stack[this._tag_stack.length - 1]; - if (topEle.dataEnd < 0) { - this._tag_stack.pop(); - return true; - } - if (this._total < topEle.dataEnd) { - break; - } - if (topEle.type !== "m") { - throw new Error("parent element is not master element"); - } - var elm = Object.assign({}, topEle, { isEnd: true }); - this._result.push(elm); - this._tag_stack.pop(); - } - return true; - }; - return EBMLDecoder2; - }(); - exports.default = EBMLDecoder; + exports = module.exports = require_stream_readable(); + exports.Stream = exports; + exports.Readable = exports; + exports.Writable = require_stream_writable(); + exports.Duplex = require_stream_duplex(); + exports.Transform = require_stream_transform(); + exports.PassThrough = require_stream_passthrough(); + exports.finished = require_end_of_stream(); + exports.pipeline = require_pipeline(); } }); - // node_modules/ts-ebml/node_modules/events/events.js - var require_events2 = __commonJS({ - "node_modules/ts-ebml/node_modules/events/events.js"(exports, module) { + // node_modules/readable-web-to-node-stream/lib/index.js + var require_lib = __commonJS({ + "node_modules/readable-web-to-node-stream/lib/index.js"(exports) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || void 0; - } - module.exports = EventEmitter; - EventEmitter.EventEmitter = EventEmitter; - EventEmitter.prototype._events = void 0; - EventEmitter.prototype._maxListeners = void 0; - EventEmitter.defaultMaxListeners = 10; - EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError("n must be a positive number"); - this._maxListeners = n; - return this; - }; - EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - if (!this._events) - this._events = {}; - if (type === "error") { - if (!this._events.error || isObject(this._events.error) && !this._events.error.length) { - er = arguments[1]; - if (er instanceof Error) { - throw er; - } else { - var err = new Error('Uncaught, unspecified "error" event. (' + er + ")"); - err.context = er; - throw err; - } - } - } - handler = this._events[type]; - if (isUndefined(handler)) - return false; - if (isFunction(handler)) { - switch (arguments.length) { - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); - } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - return true; - }; - EventEmitter.prototype.addListener = function(type, listener) { - var m; - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - if (!this._events) - this._events = {}; - if (this._events.newListener) - this.emit("newListener", type, isFunction(listener.listener) ? listener.listener : listener); - if (!this._events[type]) - this._events[type] = listener; - else if (isObject(this._events[type])) - this._events[type].push(listener); - else - this._events[type] = [this._events[type], listener]; - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[type].length); - if (typeof console.trace === "function") { - console.trace(); - } - } + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ReadableWebToNodeStream = void 0; + var readable_stream_1 = require_readable_browser(); + var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable { + constructor(stream) { + super(); + this.bytesRead = 0; + this.released = false; + this.reader = stream.getReader(); } - return this; - }; - EventEmitter.prototype.on = EventEmitter.prototype.addListener; - EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - var fired = false; - function g() { - this.removeListener(type, g); - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - g.listener = listener; - this.on(type, g); - return this; - }; - EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - if (!this._events || !this._events[type]) - return this; - list = this._events[type]; - length = list.length; - position = -1; - if (list === listener || isFunction(list.listener) && list.listener === listener) { - delete this._events[type]; - if (this._events.removeListener) - this.emit("removeListener", type, listener); - } else if (isObject(list)) { - for (i = length; i-- > 0; ) { - if (list[i] === listener || list[i].listener && list[i].listener === listener) { - position = i; - break; - } + async _read() { + if (this.released) { + this.push(null); + return; } - if (position < 0) - return this; - if (list.length === 1) { - list.length = 0; - delete this._events[type]; + this.pendingRead = this.reader.read(); + const data = await this.pendingRead; + delete this.pendingRead; + if (data.done || this.released) { + this.push(null); } else { - list.splice(position, 1); + this.bytesRead += data.value.length; + this.push(data.value); } - if (this._events.removeListener) - this.emit("removeListener", type, listener); - } - return this; - }; - EventEmitter.prototype.removeAllListeners = function(type) { - var key2, listeners; - if (!this._events) - return this; - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; } - if (arguments.length === 0) { - for (key2 in this._events) { - if (key2 === "removeListener") - continue; - this.removeAllListeners(key2); + async waitForReadToComplete() { + if (this.pendingRead) { + await this.pendingRead; } - this.removeAllListeners("removeListener"); - this._events = {}; - return this; } - listeners = this._events[type]; - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); + async close() { + await this.syncAndRelease(); } - delete this._events[type]; - return this; - }; - EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; - }; - EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; - if (isFunction(evlistener)) - return 1; - else if (evlistener) - return evlistener.length; + async syncAndRelease() { + this.released = true; + await this.waitForReadToComplete(); + await this.reader.releaseLock(); } - return 0; - }; - EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); }; - function isFunction(arg) { - return typeof arg === "function"; - } - function isNumber(arg) { - return typeof arg === "number"; - } - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - function isUndefined(arg) { - return arg === void 0; - } + exports.ReadableWebToNodeStream = ReadableWebToNodeStream2; } }); - // node_modules/ts-ebml/lib/EBMLReader.js - var require_EBMLReader = __commonJS({ - "node_modules/ts-ebml/lib/EBMLReader.js"(exports) { + // node_modules/base-x/src/index.js + var require_src = __commonJS({ + "node_modules/base-x/src/index.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports && exports.__extends || function() { - var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { - d.__proto__ = b; - } || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - }; - return function(d, b) { - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - Object.defineProperty(exports, "__esModule", { value: true }); - var events_1 = require_events2(); - var tools = require_tools2(); - var EBMLReader = function(_super) { - __extends(EBMLReader2, _super); - function EBMLReader2() { - var _this = _super.call(this) || this; - _this.logGroup = ""; - _this.hasLoggingStarted = false; - _this.metadataloaded = false; - _this.chunks = []; - _this.stack = []; - _this.segmentOffset = 0; - _this.last2SimpleBlockVideoTrackTimecode = [0, 0]; - _this.last2SimpleBlockAudioTrackTimecode = [0, 0]; - _this.lastClusterTimecode = 0; - _this.lastClusterPosition = 0; - _this.timecodeScale = 1e6; - _this.metadataSize = 0; - _this.metadatas = []; - _this.cues = []; - _this.firstVideoBlockRead = false; - _this.firstAudioBlockRead = false; - _this.currentTrack = { TrackNumber: -1, TrackType: -1, DefaultDuration: null, CodecDelay: null }; - _this.trackTypes = []; - _this.trackDefaultDuration = []; - _this.trackCodecDelay = []; - _this.trackInfo = { type: "nothing" }; - _this.ended = false; - _this.logging = false; - _this.use_duration_every_simpleblock = false; - _this.use_webp = false; - _this.use_segment_info = true; - _this.drop_default_duration = true; - return _this; - } - EBMLReader2.prototype.stop = function() { - this.ended = true; - this.emit_segment_info(); - while (this.stack.length) { - this.stack.pop(); - if (this.logging) { - console.groupEnd(); - } + function base(ALPHABET) { + if (ALPHABET.length >= 255) { + throw new TypeError("Alphabet too long"); + } + var BASE_MAP = new Uint8Array(256); + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255; + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i); + var xc = x.charCodeAt(0); + if (BASE_MAP[xc] !== 255) { + throw new TypeError(x + " is ambiguous"); } - if (this.logging && this.hasLoggingStarted && this.logGroup) { - console.groupEnd(); + BASE_MAP[xc] = i; + } + var BASE = ALPHABET.length; + var LEADER = ALPHABET.charAt(0); + var FACTOR = Math.log(BASE) / Math.log(256); + var iFACTOR = Math.log(256) / Math.log(BASE); + function encode2(source) { + if (source instanceof Uint8Array) { + } else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); + } else if (Array.isArray(source)) { + source = Uint8Array.from(source); } - }; - EBMLReader2.prototype.emit_segment_info = function() { - var data = this.chunks; - this.chunks = []; - if (!this.metadataloaded) { - this.metadataloaded = true; - this.metadatas = data; - var videoTrackNum = this.trackTypes.indexOf(1); - var audioTrackNum = this.trackTypes.indexOf(2); - this.trackInfo = videoTrackNum >= 0 && audioTrackNum >= 0 ? { type: "both", trackNumber: videoTrackNum } : videoTrackNum >= 0 ? { type: "video", trackNumber: videoTrackNum } : audioTrackNum >= 0 ? { type: "audio", trackNumber: audioTrackNum } : { type: "nothing" }; - if (!this.use_segment_info) { - return; - } - this.emit("metadata", { data, metadataSize: this.metadataSize }); - } else { - if (!this.use_segment_info) { - return; - } - var timecode = this.lastClusterTimecode; - var duration = this.duration; - var timecodeScale = this.timecodeScale; - this.emit("cluster", { timecode, data }); - this.emit("duration", { timecodeScale, duration }); + if (!(source instanceof Uint8Array)) { + throw new TypeError("Expected Uint8Array"); } - }; - EBMLReader2.prototype.read = function(elm) { - var _this = this; - var drop = false; - if (this.ended) { - return; + if (source.length === 0) { + return ""; } - if (elm.type === "m") { - if (elm.isEnd) { - this.stack.pop(); - } else { - var parent_1 = this.stack[this.stack.length - 1]; - if (parent_1 != null && parent_1.level >= elm.level) { - this.stack.pop(); - if (this.logging) { - console.groupEnd(); - } - parent_1.dataEnd = elm.dataEnd; - parent_1.dataSize = elm.dataEnd - parent_1.dataStart; - parent_1.unknownSize = false; - var o = Object.assign({}, parent_1, { name: parent_1.name, type: parent_1.type, isEnd: true }); - this.chunks.push(o); - } - this.stack.push(elm); - } + var zeroes = 0; + var length = 0; + var pbegin = 0; + var pend = source.length; + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++; + zeroes++; } - if (elm.type === "m" && elm.name == "Segment") { - if (this.segmentOffset != 0) { - console.warn("Multiple segments detected!"); - } - this.segmentOffset = elm.dataStart; - this.emit("segment_offset", this.segmentOffset); - } else if (elm.type === "b" && elm.name === "SimpleBlock") { - var _a = tools.ebmlBlock(elm.data), timecode = _a.timecode, trackNumber = _a.trackNumber, frames_1 = _a.frames; - if (this.trackTypes[trackNumber] === 1) { - if (!this.firstVideoBlockRead) { - this.firstVideoBlockRead = true; - if (this.trackInfo.type === "both" || this.trackInfo.type === "video") { - var CueTime = this.lastClusterTimecode + timecode; - this.cues.push({ CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - this.emit("cue_info", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime: this.lastClusterTimecode }); - this.emit("cue", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - } - } - this.last2SimpleBlockVideoTrackTimecode = [this.last2SimpleBlockVideoTrackTimecode[1], timecode]; - } else if (this.trackTypes[trackNumber] === 2) { - if (!this.firstAudioBlockRead) { - this.firstAudioBlockRead = true; - if (this.trackInfo.type === "audio") { - var CueTime = this.lastClusterTimecode + timecode; - this.cues.push({ CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - this.emit("cue_info", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime: this.lastClusterTimecode }); - this.emit("cue", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - } - } - this.last2SimpleBlockAudioTrackTimecode = [this.last2SimpleBlockAudioTrackTimecode[1], timecode]; - } - if (this.use_duration_every_simpleblock) { - this.emit("duration", { timecodeScale: this.timecodeScale, duration: this.duration }); - } - if (this.use_webp) { - frames_1.forEach(function(frame) { - var startcode = frame.slice(3, 6).toString("hex"); - if (startcode !== "9d012a") { - return; - } - ; - var webpBuf = tools.VP8BitStreamToRiffWebPBuffer(frame); - var webp = new Blob([webpBuf], { type: "image/webp" }); - var currentTime = _this.duration; - _this.emit("webp", { currentTime, webp }); - }); - } - } else if (elm.type === "m" && elm.name === "Cluster" && elm.isEnd === false) { - this.firstVideoBlockRead = false; - this.firstAudioBlockRead = false; - this.emit_segment_info(); - this.emit("cluster_ptr", elm.tagStart); - this.lastClusterPosition = elm.tagStart; - } else if (elm.type === "u" && elm.name === "Timecode") { - this.lastClusterTimecode = elm.value; - } else if (elm.type === "u" && elm.name === "TimecodeScale") { - this.timecodeScale = elm.value; - } else if (elm.type === "m" && elm.name === "TrackEntry") { - if (elm.isEnd) { - this.trackTypes[this.currentTrack.TrackNumber] = this.currentTrack.TrackType; - this.trackDefaultDuration[this.currentTrack.TrackNumber] = this.currentTrack.DefaultDuration; - this.trackCodecDelay[this.currentTrack.TrackNumber] = this.currentTrack.CodecDelay; - } else { - this.currentTrack = { TrackNumber: -1, TrackType: -1, DefaultDuration: null, CodecDelay: null }; + var size = (pend - pbegin) * iFACTOR + 1 >>> 0; + var b58 = new Uint8Array(size); + while (pbegin !== pend) { + var carry = source[pbegin]; + var i2 = 0; + for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) { + carry += 256 * b58[it1] >>> 0; + b58[it1] = carry % BASE >>> 0; + carry = carry / BASE >>> 0; } - } else if (elm.type === "u" && elm.name === "TrackType") { - this.currentTrack.TrackType = elm.value; - } else if (elm.type === "u" && elm.name === "TrackNumber") { - this.currentTrack.TrackNumber = elm.value; - } else if (elm.type === "u" && elm.name === "CodecDelay") { - this.currentTrack.CodecDelay = elm.value; - } else if (elm.type === "u" && elm.name === "DefaultDuration") { - if (this.drop_default_duration) { - console.warn("DefaultDuration detected!, remove it"); - drop = true; - } else { - this.currentTrack.DefaultDuration = elm.value; + if (carry !== 0) { + throw new Error("Non-zero carry"); } - } else if (elm.name === "unknown") { - console.warn(elm); + length = i2; + pbegin++; + } + var it2 = size - length; + while (it2 !== size && b58[it2] === 0) { + it2++; } - if (!this.metadataloaded && elm.dataEnd > 0) { - this.metadataSize = elm.dataEnd; + var str = LEADER.repeat(zeroes); + for (; it2 < size; ++it2) { + str += ALPHABET.charAt(b58[it2]); } - if (!drop) { - this.chunks.push(elm); + return str; + } + function decodeUnsafe(source) { + if (typeof source !== "string") { + throw new TypeError("Expected String"); } - if (this.logging) { - this.put(elm); + if (source.length === 0) { + return new Uint8Array(); } - }; - Object.defineProperty(EBMLReader2.prototype, "duration", { - get: function() { - if (this.trackInfo.type === "nothing") { - console.warn("no video, no audio track"); - return 0; + var psz = 0; + var zeroes = 0; + var length = 0; + while (source[psz] === LEADER) { + zeroes++; + psz++; + } + var size = (source.length - psz) * FACTOR + 1 >>> 0; + var b256 = new Uint8Array(size); + while (source[psz]) { + var carry = BASE_MAP[source.charCodeAt(psz)]; + if (carry === 255) { + return; } - var defaultDuration = 0; - var codecDelay = 0; - var lastTimecode = 0; - var _defaultDuration = this.trackDefaultDuration[this.trackInfo.trackNumber]; - if (typeof _defaultDuration === "number") { - defaultDuration = _defaultDuration; - } else { - if (this.trackInfo.type === "both") { - if (this.last2SimpleBlockAudioTrackTimecode[1] > this.last2SimpleBlockVideoTrackTimecode[1]) { - defaultDuration = (this.last2SimpleBlockAudioTrackTimecode[1] - this.last2SimpleBlockAudioTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackTypes.indexOf(2)]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockAudioTrackTimecode[1]; - } else { - defaultDuration = (this.last2SimpleBlockVideoTrackTimecode[1] - this.last2SimpleBlockVideoTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackTypes.indexOf(1)]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockVideoTrackTimecode[1]; - } - } else if (this.trackInfo.type === "video") { - defaultDuration = (this.last2SimpleBlockVideoTrackTimecode[1] - this.last2SimpleBlockVideoTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackInfo.trackNumber]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockVideoTrackTimecode[1]; - } else if (this.trackInfo.type === "audio") { - defaultDuration = (this.last2SimpleBlockAudioTrackTimecode[1] - this.last2SimpleBlockAudioTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackInfo.trackNumber]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockAudioTrackTimecode[1]; - } + var i2 = 0; + for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) { + carry += BASE * b256[it3] >>> 0; + b256[it3] = carry % 256 >>> 0; + carry = carry / 256 >>> 0; } - var duration_nanosec = (this.lastClusterTimecode + lastTimecode) * this.timecodeScale + defaultDuration - codecDelay; - var duration = duration_nanosec / this.timecodeScale; - return Math.floor(duration); - }, - enumerable: true, - configurable: true - }); - EBMLReader2.prototype.addListener = function(event, listener) { - return _super.prototype.addListener.call(this, event, listener); - }; - EBMLReader2.prototype.put = function(elm) { - if (!this.hasLoggingStarted) { - this.hasLoggingStarted = true; - if (this.logging && this.logGroup) { - console.groupCollapsed(this.logGroup); + if (carry !== 0) { + throw new Error("Non-zero carry"); } + length = i2; + psz++; } - if (elm.type === "m") { - if (elm.isEnd) { - console.groupEnd(); - } else { - console.group(elm.name + ":" + elm.tagStart); - } - } else if (elm.type === "b") { - console.log(elm.name, elm.type); - } else { - console.log(elm.name, elm.tagStart, elm.type, elm.value); + var it4 = size - length; + while (it4 !== size && b256[it4] === 0) { + it4++; + } + var vch = new Uint8Array(zeroes + (size - it4)); + var j2 = zeroes; + while (it4 !== size) { + vch[j2++] = b256[it4++]; + } + return vch; + } + function decode3(string) { + var buffer = decodeUnsafe(string); + if (buffer) { + return buffer; } + throw new Error("Non-base" + BASE + " character"); + } + return { + encode: encode2, + decodeUnsafe, + decode: decode3 }; - return EBMLReader2; - }(events_1.EventEmitter); - exports.default = EBMLReader; - } - }); - - // node_modules/ts-ebml/package.json - var require_package = __commonJS({ - "node_modules/ts-ebml/package.json"(exports, module) { - module.exports = { - name: "ts-ebml", - version: "2.0.2", - description: "ebml decoder and encoder", - scripts: { - setup: "npm install -g http-server;", - init: "npm run update; npm run mkdir; npm run build", - update: "npm run reset; npm update", - reset: "rm -rf node_modules", - mkdir: "mkdir lib dist 2>/dev/null", - clean: "rm -rf lib/* dist/* test/*.js; mkdir -p dist", - build: "npm run clean && tsc -p .; npm run browserify", - start: "http-server . -s & tsc -w -p .& watchify lib/example_seekable.js -o test/example_seekable.js", - stop: "killall -- node */tsc -w -p", - browserify: "browserify lib/index.js --standalone EBML -o dist/EBML.js", - watchify: "watchify lib/index.js --standalone EBML -o dist/EBMl.js -v", - test: "tsc; espower lib/test.js > lib/test.tmp; mv -f lib/test.tmp lib/test.js; browserify lib/test.js -o test/test.js", - example: "tsc; browserify lib/example_seekable.js -o test/example_seekable.js", - examples: "tsc; for file in `find lib -name 'example_*.js' -type f -printf '%f\\n'`; do browserify lib/$file -o test/$file; done", - examples_bsd: "tsc; for file in `find lib -name 'example_*.js' -type f -print`; do browserify lib/$(basename $file) -o test/$(basename $file); done", - check: "tsc -w --noEmit -p ./", - lint: "tslint -c ./tslint.json --project ./tsconfig.json --type-check", - doc: "typedoc --mode modules --out doc --disableOutputCheck" - }, - repository: { - type: "git", - url: "git+https://github.com/legokichi/ts-ebml.git" - }, - keywords: [ - "ebml", - "webm", - "mkv", - "matrosika", - "webp" - ], - author: "legokichi duckscallion", - license: "MIT", - bugs: { - url: "https://github.com/legokichi/ts-ebml/issues" - }, - homepage: "https://github.com/legokichi/ts-ebml#readme", - dependencies: { - buffer: "^5.0.7", - commander: "^2.11.0", - ebml: "^2.2.1", - "ebml-block": "^1.1.0", - events: "^1.1.1", - "int64-buffer": "^0.1.9", - matroska: "^2.2.3" - }, - devDependencies: { - "@types/commander": "^2.9.1", - "@types/qunit": "^2.0.31", - browserify: "^13.1.0", - empower: "^1.2.3", - "espower-cli": "^1.1.0", - "power-assert": "^1.4.4", - "power-assert-formatter": "^1.4.1", - "qunit-tap": "^1.5.1", - qunitjs: "^2.4.0", - tslint: "^3.15.1", - typedoc: "^0.5.3", - typescript: "^2.4.2", - watchify: "^3.7.0" - }, - bin: "./lib/cli.js", - main: "./lib/index.js", - typings: "./lib/index.d.ts" - }; + } + module.exports = base; } }); - // node_modules/ts-ebml/lib/index.js - var require_lib2 = __commonJS({ - "node_modules/ts-ebml/lib/index.js"(exports) { - "use strict"; + // node_modules/bs58/index.js + var require_bs58 = __commonJS({ + "node_modules/bs58/index.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var EBMLDecoder_1 = require_EBMLDecoder(); - exports.Decoder = EBMLDecoder_1.default; - var EBMLEncoder_1 = require_EBMLEncoder(); - exports.Encoder = EBMLEncoder_1.default; - var EBMLReader_1 = require_EBMLReader(); - exports.Reader = EBMLReader_1.default; - var tools = require_tools2(); - exports.tools = tools; - var version = require_package().version; - exports.version = version; + var basex = require_src(); + var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + module.exports = basex(ALPHABET); } }); @@ -17032,10 +7241,10 @@ if (frames.length != 1) throw new Error("only single frame JPEGs supported"); for (var i = 0; i < frames.length; i++) { - var cp = frames[i].components; - for (var j in cp) { - cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx]; - delete cp[j].quantizationIdx; + var cp2 = frames[i].components; + for (var j in cp2) { + cp2[j].quantizationTable = quantizationTables[cp2[j].quantizationIdx]; + delete cp2[j].quantizationIdx; } } this.width = frame.samplesPerLine; @@ -17311,8 +7520,7 @@ // src/main.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_process = __toESM(require_node_process(), 1); - var import_buffer11 = __toESM(require_buffer(), 1); + var import_buffer9 = __toESM(require_buffer(), 1); // src/stores.ts init_define_BUILD_VERSION(); @@ -18188,6 +8396,9 @@ // src/stores.ts var localLoad = async (key2, def) => { + if (false) { + return def; + } const isinls = "__pee__" + key2 in localStorage; let ret; if (isinls) { @@ -18212,6 +8423,9 @@ return ret; }; var localSet = (key2, value) => { + if (false) { + return; + } if (true) chrome.storage.local.set({ [key2]: JSON.stringify(value) }); else @@ -18431,15 +8645,6 @@ this.writer.releaseLock(); } }; - var BufferWriteStream = () => { - let b = import_buffer.Buffer.from([]); - const ret = new WritableStream({ - write(chunk) { - b = import_buffer.Buffer.concat([b, chunk]); - } - }); - return [ret, () => b]; - }; // src/utils.ts init_define_BUILD_VERSION(); @@ -18530,9 +8735,13 @@ var lqueue = {}; var localLoad2 = (key2, def) => "__pee__" + key2 in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key2)) : def; var localSet2 = (key2, value) => localStorage.setItem("__pee__" + key2, JSON.stringify(value)); - var { port1, port2 } = new MessageChannel(); + var port1; + var port2; console.log("chrome_api", false); if (true) { + const nmc = new MessageChannel(); + port1 = nmc.port1; + port2 = nmc.port2; const iframe = document.createElement("iframe"); iframe.style.display = "none"; iframe.name = location.origin; @@ -18540,7 +8749,6 @@ iframe.onload = _; }); iframe.src = `${chrome.runtime.getURL("")}options.html`; - const meself = new URL(chrome.runtime.getURL("")).origin; document.documentElement.appendChild(iframe); iframeloaded.then(() => { iframe.contentWindow?.postMessage("", "*", [port2]); @@ -18549,12 +8757,27 @@ lqueue[ev.data.id](ev.data); }; } + console.log("chrome_api"); + if (false) { + port1 = { + onmessage(ev) { + lqueue[ev.data.id](ev.data); + }, + postMessage(msg, tr) { + postMessage({ + type: "ipc", + tr, + msg + }, tr); + } + }; + } var gid = 0; var sendCmd = (cmd, tr) => { const prom = new Promise((_) => { const id = gid++; lqueue[id] = (e) => { - _(e.res); + _(e); delete lqueue[id]; }; port1.postMessage({ id, ...cmd }, tr || []); @@ -18823,36 +9046,6 @@ return corsFetch(url.toString(), opt, lisn); return GM_fetch(url, opt, lisn); } - async function* streamRemote(url, chunkSize = 72 * 1024, fetchRestOnNonCanceled = true) { - let size = Number.POSITIVE_INFINITY; - let ptr = 0; - let fetchSize = chunkSize; - while (ptr != size) { - let obj; - const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } }); - if (false) { - obj = headerStringToObject(fres.responseHeaders); - } else { - obj = fres.headers; - } - if (!("content-length" in obj)) { - console.warn("no content lenght???", url); - break; - } - if ("content-range" in obj) { - size = +obj["content-range"].split("/")[1]; - } - const len = +obj["content-length"]; - ptr += len; - if (fetchRestOnNonCanceled) - fetchSize = size; - const val = Buffer2.from(await fres.arrayBuffer()); - const e = yield val; - if (e) { - break; - } - } - } // src/filehosts.ts function parseForm(data) { @@ -19011,12 +9204,12 @@ static inRange(a, min, max) { return min <= a && a <= max; } - static codePointToString(cp) { - if (cp <= 65535) { - return String.fromCharCode(cp); + static codePointToString(cp2) { + if (cp2 <= 65535) { + return String.fromCharCode(cp2); } else { - cp -= 65536; - return String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320); + cp2 -= 65536; + return String.fromCharCode((cp2 >> 10) + 55296, (cp2 & 1023) + 56320); } } static singleByteDecoder(bite) { @@ -20863,11 +11056,7 @@ }, filename: fn, thumbnail: csettings.hotlink ? prev || full : import_buffer2.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings.hotlink ? full || prev : async (lsn) => { - if (!cachedFile) - cachedFile = await (await ifetch(full || prev, void 0, lsn)).arrayBuffer(); - return import_buffer2.Buffer.from(cachedFile); - } + data: csettings.hotlink ? full || prev : { url: full || prev } }]; ret.push([end, true]); } @@ -20920,17 +11109,17 @@ if (hasThumbnail) { thumbsize = header.readInt32LE(ptr); ptr += 4; - if (header.byteLength < ptr + thumbsize) + if (header.byteLength >= ptr + thumbsize) thumb = header.slice(ptr, ptr + thumbsize); else thumb = import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer()); ptr += thumbsize; } - const unzip = async (lsn) => import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } }, lsn)).arrayBuffer()); + const unzip = { url: pee, headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } }; let data; data = unzip; if (size < 3072) { - thumb = data = await unzip(); + thumb = data = import_buffer2.Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer()); } return { filename: fn, @@ -20973,7 +11162,7 @@ if (typeof ef.data == "string") { const req = await ifetch(ef.data); buff = import_buffer2.Buffer.from(await req.arrayBuffer()); - } else if (!import_buffer2.Buffer.isBuffer(ef.data)) + } else if (!(ef.data instanceof Uint8Array)) buff = await ef.data(); else buff = ef.data; @@ -21017,197 +11206,34 @@ } addEventListener(ev, cb) { this.targets[ev] = this.targets[ev] || []; - this.targets[ev].push(cb); - } - dispatchEvent(ev) { - const evs = this.targets[ev.type]; - if (evs) - for (const cb of evs) - cb(ev); - return true; - } - removeEventListener(ev, cb) { - const evs = this.targets[ev]; - if (!evs) - return; - for (let i = 0; i < evs.length; ++i) { - if (evs[i] == cb) { - evs.splice(i, 1); - return; - } - } - } - }; - - // src/pngv3.ts - var bs58 = __toESM(require_bs58(), 1); - - // src/bitstream.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/reader.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/string-encoding-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/writer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/array-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/array-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/resolve-length.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/structure-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/utils.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/boolean-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/boolean-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/buffer-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/buffer-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/element.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/buffered-writable.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/constructor.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/discriminant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/writable.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/incomplete-read-result.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/element.js - var _parent; - var _readFields; - var _isBeingRead; - var _fieldBeingComputed; - var _fieldBeingComputedIntrospectable; - var SERIALIZE_WRITERS = Symbol("Writers used by Bitstream#serialize() for this element type."); - _parent = /* @__PURE__ */ new WeakMap(), _readFields = /* @__PURE__ */ new WeakMap(), _isBeingRead = /* @__PURE__ */ new WeakMap(), _fieldBeingComputed = /* @__PURE__ */ new WeakMap(), _fieldBeingComputedIntrospectable = /* @__PURE__ */ new WeakMap(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field-definition.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/null-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/number-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/string-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/length-determinant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/number-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/value-determinant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant-definition.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/reserved.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); + this.targets[ev].push(cb); + } + dispatchEvent(ev) { + const evs = this.targets[ev.type]; + if (evs) + for (const cb of evs) + cb(ev); + return true; + } + removeEventListener(ev, cb) { + const evs = this.targets[ev]; + if (!evs) + return; + for (let i = 0; i < evs.length; ++i) { + if (evs[i] == cb) { + evs.splice(i, 1); + return; + } + } + } + }; - // node_modules/@astronautlabs/bitstream/dist.esm/elements/reserved-low.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); + // src/pngv3.ts + var bs58 = __toESM(require_bs58(), 1); - // node_modules/@astronautlabs/bitstream/dist.esm/elements/marker.js + // src/bitstream.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - - // src/bitstream.ts var revbyte = (n, len = 8) => { let acc = 0; let n2 = n; @@ -21219,7 +11245,7 @@ } return acc; }; - var BitstreamReader2 = class { + var BitstreamReader = class { constructor() { this.buffers = []; this.bufferedLength = 0; @@ -21258,7 +11284,7 @@ this.bufferedLength += buffer.length * 8; } }; - var BitstreamWriter2 = class { + var BitstreamWriter = class { constructor(stream, bufferSize = 1) { this.stream = stream; this.pendingBits = 0; @@ -21282,8 +11308,6 @@ this.buffer.fill(0); } setBit(b) { - if (b) - debugger; let byte = this.buffer[0]; byte |= b << (this._offset & 7); this.buffer[0] = byte; @@ -21578,7 +11602,7 @@ let backoffset = tinf_read_bits(d, dist_bits[dist], dist_base[dist]); const offs2 = d.dest.length - backoffset; let match; - const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader2 && d.to_hide.available == 0; + const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader && d.to_hide.available == 0; if (!skip && (match = Buffer2.from(d.dest.slice(offs2, offs2 + length))).length == length) { let begin = d.dest.length - 32768; if (begin < 0) @@ -21604,7 +11628,7 @@ matches.reverse(); const v = Math.floor(Math.log2(matches.length)); capacity += v; - if (d.to_hide instanceof BitstreamReader2) { + if (d.to_hide instanceof BitstreamReader) { if (d.to_hide.available) { const s = d.to_hide.readSync(Math.min(d.to_hide.available, v)); backoffset = matches[s]; @@ -21645,8 +11669,8 @@ return TINF_OK; } function tinf_uncompress(source, decompressed, to_hide, hidden, opt = 0) { - const decomp = decompressed ? new BitstreamWriter2({ write: decompressed }) : null; - const hid = hidden && new BitstreamWriter2({ write: hidden }, 4); + const decomp = decompressed ? new BitstreamWriter({ write: decompressed }) : null; + const hid = hidden && new BitstreamWriter({ write: hidden }, 4); const d = new Data(source, decomp, to_hide, hid); let res; let bfinal, btype; @@ -21729,10 +11753,10 @@ "z": "z.zz.fo" }; var extractFromRawDeflate = (b) => { - const src = new BitstreamReader2(); + const src = new BitstreamReader(); src.addBuffer(b); const chnks = []; - const hidden = new BitstreamWriter2({ + const hidden = new BitstreamWriter({ write(chunk) { for (const i of chunk) { if (i) @@ -21750,7 +11774,7 @@ } return false; }; - var extract = async (png) => { + var extract = async (png, doextract = true) => { const reader = BufferReadStream(png).getReader(); const sneed = new PNGDecoder(reader, false); const ret = []; @@ -21766,22 +11790,28 @@ case "tEXt": buff = chunk; if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) { + if (!doextract) + return true; const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM4.length); xor(passed, password); const k = await decodeCoom3Payload(passed); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM5.length); const decoded = import_buffer3.Buffer.from(passed.toString(), "base64").toString().split(" ").map((e) => { return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (w = [CUM6, CUM7].find((e) => buff.slice(4, 4 + e.length).equals(e))) { const passed = buff.slice(4 + w.length); @@ -21798,8 +11828,10 @@ throw "Uhh"; return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); + if (!doextract) + return true; const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } catch (e) { } } @@ -21826,10 +11858,13 @@ throw "Uhh"; return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); - return decodeCoom3Payload(import_buffer3.Buffer.from(dec)); + if (doextract) + return decodeCoom3Payload(import_buffer3.Buffer.from(dec)); + return true; } } catch (e) { - console.error(e); + if (e != "Uhh") + console.error(e); } finally { reader.releaseLock(); } @@ -21840,7 +11875,7 @@ data.copy(ret, 4); return ret; }; - var BufferWriteStream2 = () => { + var BufferWriteStream = () => { let b = import_buffer3.Buffer.from([]); const ret = new WritableStream({ write(chunk) { @@ -21851,8 +11886,8 @@ return [ret, () => b]; }; var embedInRawDeflate = (b, h) => { - const src = new BitstreamReader2(); - const hid = new BitstreamReader2(); + const src = new BitstreamReader(); + const hid = new BitstreamReader(); hid.addBuffer(h); src.addBuffer(b); const chnks = []; @@ -21863,14 +11898,14 @@ if (!csettings2) throw new Error("Settings uninit"); if (csettings2.pmeth < 5) { - let magic4 = false; - const [writestream2, extract8] = BufferWriteStream2(); + let magic = false; + const [writestream2, extract6] = BufferWriteStream(); const encoder = new PNGEncoder(writestream2); const decoder = new PNGDecoder(container.stream().getReader()); for await (const [name, chunk, crc, offset] of decoder.chunks()) { - if (magic4 && name != "IDAT") + if (magic && name != "IDAT") break; - if (!magic4 && name == "IDAT") { + if (!magic && name == "IDAT") { const passed = import_buffer3.Buffer.from(injb); switch (csettings2.pmeth) { case 0: @@ -21890,7 +11925,7 @@ await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM7, import_buffer3.Buffer.from(bs58.encode(passed))])), 0, 0]); break; } - magic4 = true; + magic = true; } await encoder.insertchunk([name, chunk, crc, offset]); } @@ -21900,7 +11935,7 @@ 0, 0 ]); - return extract8(); + return extract6(); } let pdec = new PNGDecoder(container.stream().getReader()); const concat = []; @@ -21911,7 +11946,7 @@ const head = comp.slice(0, 2); const chksum = comp.slice(-4); const idatblk = embedInRawDeflate(comp.slice(2, -4), injb); - const [writestream, extract7] = BufferWriteStream2(); + const [writestream, extract5] = BufferWriteStream(); const penc = new PNGEncoder(writestream); pdec = new PNGDecoder(container.stream().getReader()); let ins = false; @@ -21927,7 +11962,7 @@ } await penc.dtor(); console.log("Finished writing"); - return extract7(); + return extract5(); }; var inject = async (container, links) => { links = links.map((link) => { @@ -21943,7 +11978,7 @@ return inject_data(container, injb); }; var has_embed = async (png) => { - const r = await extract(png); + const r = await extract(png, false); return !!r; }; var pngv3_default = { @@ -21953,287 +11988,10 @@ match: (fn) => !!fn.match(/\.png$/) }; - // src/webm.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var import_buffer4 = __toESM(require_buffer(), 1); - var ebml = __toESM(require_lib2(), 1); - var password2 = import_buffer4.Buffer.from("NOA"); - var xor2 = (a, p) => { - let n = 0; - for (let i = 0; i < a.byteLength; ++i) { - a[i] ^= p[n]; - n++; - n %= p.byteLength; - } - }; - var findEnclosingTag = (ch, name) => { - const first = ch.findIndex((e) => e.type == "m" && e.name == name); - if (first < 0) - return; - const second = ch.slice(first).findIndex((e) => e.type == "m" && e.name == name); - if (second < 0) - return; - return [ - first, - first + second - ]; - }; - var embed = (webm, data) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const enc = new ebml.Encoder(); - let embed2 = chunks.findIndex((e) => e.name == "Tracks" && e.type == "m" && e.isEnd); - const findOrInsert = (n) => { - let tags = findEnclosingTag(chunks, n); - const stack = []; - if (!tags) { - stack.push({ - type: "m", - isEnd: false, - name: n, - data: import_buffer4.Buffer.from("") - }); - stack.push({ - type: "m", - isEnd: true, - name: n, - data: import_buffer4.Buffer.from("") - }); - chunks.splice(embed2 + 1, 0, ...stack); - tags = findEnclosingTag(chunks, n); - } - embed2 = tags[1]; - }; - findOrInsert("Tags"); - findOrInsert("Tag"); - findOrInsert("Targets"); - embed2++; - chunks.splice(embed2 + 1, 0, ...[ - { - type: "m", - isEnd: false, - name: "SimpleTag", - data: import_buffer4.Buffer.from("") - }, - { - type: "8", - isEnd: false, - name: "TagName", - data: import_buffer4.Buffer.from("VOOM") - }, - { - type: "8", - isEnd: false, - name: "TagBinary", - data - }, - { - type: "m", - isEnd: true, - name: "SimpleTag", - data: import_buffer4.Buffer.from("") - } - ]); - return import_buffer4.Buffer.from(enc.encode(chunks.filter((e) => e.name != "unknown"))); - }; - var extract2 = (webm) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM")); - const cl = chunks.find((e) => e.name == "Cluster"); - if (cl && embed2 == -1) - return; - if (embed2 == -1) - return; - const echk = chunks[embed2]; - const chk = chunks[embed2 + 1]; - if (chk.type == "b" && chk.name == "TagBinary") { - if (echk.type == "8" && echk.value == "VOOM") { - xor2(chk.data, password2); - } - return decodeCoom3Payload(chk.data); - } - }; - var inject2 = async (container, links) => { - const buff = import_buffer4.Buffer.from(links.join(" ")); - xor2(buff, password2); - return embed(import_buffer4.Buffer.from(await container.arrayBuffer()), buff); - }; - var has_embed2 = (webm) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM")); - const cl = chunks.find((e) => e.name == "Cluster"); - if (cl && embed2 == -1) - return false; - if (embed2 == -1) - return; - return true; - }; - var webm_default = { - extract: extract2, - has_embed: has_embed2, - inject: inject2, - match: (fn) => !!fn.match(/\.webm$/) - }; - - // src/gif.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var import_buffer5 = __toESM(require_buffer(), 1); - var netscape = import_buffer5.Buffer.from("!\xFF\vNETSCAPE2.0", "ascii"); - var magic = import_buffer5.Buffer.from("!\xFF\vDOOMTECH1.1", "ascii"); - var magic2 = import_buffer5.Buffer.from("!\xFF\vVOOMTECH1.1", "ascii"); - var magic3 = import_buffer5.Buffer.from("!\xFF\vANIMEXTS1.0", "ascii"); - var read_section = (gif, pos) => { - const begin = pos; - pos += 3 + gif[pos + 2]; - let buf2 = import_buffer5.Buffer.alloc(0); - while (pos < gif.byteLength) { - const v = gif[pos++]; - buf2 = import_buffer5.Buffer.concat([buf2, gif.slice(pos, pos + v)]); - if (v == 0) - break; - pos += v; - } - const appname = gif.slice(begin + 3, begin + 11).toString("ascii"); - return { - appname, - data: buf2, - end: pos - }; - }; - var password3 = import_buffer5.Buffer.from("NOA"); - var xor3 = (a, p) => { - let n = 0; - for (let i = 0; i < a.byteLength; ++i) { - a[i] ^= p[n]; - n++; - n %= p.byteLength; - } - }; - var extractBuff = (gif) => { - const field = gif.readUInt8(10); - const gcte = !!(field & 1 << 7); - let end = 13; - if (gcte) { - end += 3 * (1 << (field & 7) + 1); - } - while (gif[end] == "!".charCodeAt(0)) { - let sec = read_section(gif, end); - if (sec.appname == "DOOMTECH") { - const ret = import_buffer5.Buffer.alloc(sec.data.readInt32LE(0)); - let ptr = 0; - do { - sec = read_section(gif, sec.end); - sec.data.copy(ret, ptr); - ptr += sec.data.byteLength; - end = sec.end; - } while (sec.appname == "DOOMTECH" && gif[end] == "!".charCodeAt(0)); - return decodeCoom3Payload(ret); - } - const cond = () => sec.appname == "VOOMTECH" || sec.appname == "ANIMEXTS"; - if (cond()) { - const ret = import_buffer5.Buffer.alloc(sec.data.readInt32LE(0)); - let ptr = 0; - do { - sec = read_section(gif, sec.end); - sec.data.copy(ret, ptr); - ptr += sec.data.byteLength; - end = sec.end; - } while (cond() && gif[end] == "!".charCodeAt(0)); - xor3(ret, password3); - return decodeCoom3Payload(ret); - } - end = sec.end; - } - throw new Error("Shouldn't happen"); - }; - var extract3 = extractBuff; - var write_data = async (writer, inj) => { - await writer.write(magic3); - const byte = import_buffer5.Buffer.from([0]); - let size = inj.byteLength; - let ws; - let offset = 0; - while (size != 0) { - ws = size >= 255 ? 255 : size; - byte.writeUInt8(ws, 0); - await writer.write(byte); - await writer.write(inj.slice(offset, offset + ws)); - size -= ws; - offset += ws; - } - byte.writeUInt8(0, 0); - await writer.write(byte); - }; - var write_embedding = async (writer, inj) => { - const b = import_buffer5.Buffer.alloc(4); - b.writeInt32LE(inj.byteLength, 0); - await write_data(writer, b); - let size = inj.byteLength; - let offset = 0; - while (size != 0) { - const ws = size >= 3 << 13 ? 3 << 13 : size; - await write_data(writer, inj.slice(offset, offset + ws)); - offset += ws; - size -= ws; - } - }; - var inject3 = async (container, links) => { - const [writestream, extract7] = BufferWriteStream(); - const writer = writestream.getWriter(); - const inj = import_buffer5.Buffer.from(links.join(" ")); - xor3(inj, password3); - const contbuff = import_buffer5.Buffer.from(await container.arrayBuffer()); - const field = contbuff.readUInt8(10); - const gcte = !!(field & 1 << 7); - let endo = 13; - if (gcte) - endo += 3 * (1 << (field & 7) + 1); - if (netscape.compare(contbuff, endo, endo + netscape.byteLength) == 0) - endo += 19; - await writer.write(contbuff.slice(0, endo)); - await write_embedding(writer, import_buffer5.Buffer.from(inj)); - await writer.write(contbuff.slice(endo)); - return extract7(); - }; - var has_embed3 = (gif) => { - const field = gif.readUInt8(10); - const gcte = !!(field & 1 << 7); - let end = 13; - if (gcte) { - end += 3 * (1 << (field & 7) + 1); - } - while (end < gif.byteLength && gif.readUInt8(end) == "!".charCodeAt(0)) { - if ([magic, magic2, magic3].every((m) => m.compare(gif, end, end + m.byteLength) != 0)) { - end += 3 + gif.readUInt8(end + 2); - while (true) { - const v = gif.readUInt8(end++); - if (!v) - break; - end += v; - } - } else { - return true; - } - } - if (end >= gif.byteLength) - return; - return false; - }; - var gif_default = { - extract: extract3, - has_embed: has_embed3, - inject: inject3, - match: (fn) => !!fn.match(/\.gif$/) - }; - // src/jpg.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer6 = __toESM(require_buffer(), 1); + var import_buffer4 = __toESM(require_buffer(), 1); // src/f5stego.ts init_define_BUILD_VERSION(); @@ -23874,23 +13632,23 @@ }; // src/jpg.ts - var key = import_buffer6.Buffer.from("CUNNYCUNNYCUNNY"); + var key = import_buffer4.Buffer.from("CUNNYCUNNYCUNNY"); var f5inst = new f5stego(key); - var inject4 = async (b, links) => { + var inject2 = async (b, links) => { if (b.size / 20 < links.join(" ").length) throw "Image too small to embed."; const arr = new Uint8Array(new Uint8Array(await b.arrayBuffer())); const buff = f5inst.embed(arr, new TextEncoder().encode(links.join(" ")), 1); - return import_buffer6.Buffer.from(buff); + return import_buffer4.Buffer.from(buff); }; - var has_embed4 = (b) => { + var has_embed2 = (b) => { try { const res = f5inst.extract(b); if (!res) return false; if (res.length > 1024) return false; - const str = import_buffer6.Buffer.from(res).toString(); + const str = import_buffer4.Buffer.from(res).toString(); if (!str.match(/^[a-zA-Z0-9:/.\-_ ]+$/)) return false; return str; @@ -23898,20 +13656,20 @@ return false; } }; - var extract4 = (b, ex) => { - return decodeCoom3Payload(import_buffer6.Buffer.from(ex)); + var extract2 = (b, ex) => { + return decodeCoom3Payload(import_buffer4.Buffer.from(ex)); }; var jpg_default = { match: (fn) => !!fn.match(/\.jpe?g$/), - has_embed: has_embed4, - extract: extract4, - inject: inject4 + has_embed: has_embed2, + extract: extract2, + inject: inject2 }; // src/thirdeye.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer7 = __toESM(require_buffer(), 1); + var import_buffer5 = __toESM(require_buffer(), 1); var import_jpeg_js = __toESM(require_jpeg_js(), 1); // src/phash.ts @@ -24027,7 +13785,7 @@ return []; } }; - var extract5 = async (b, fn) => { + var extract3 = async (b, fn) => { if (!csettings3) throw new Error("Settings uninit"); let result; @@ -24051,12 +13809,8 @@ url: result[0].page }, filename: fn.substring(0, 33) + result[0].ext, - thumbnail: csettings3.hotlink ? prev || full : import_buffer7.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings3.hotlink ? full || prev : async (lsn) => { - if (!cachedFile) - cachedFile = await (await ifetch(full || prev, void 0, lsn)).arrayBuffer(); - return import_buffer7.Buffer.from(cachedFile); - } + thumbnail: csettings3.hotlink ? prev || full : import_buffer5.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), + data: csettings3.hotlink ? full || prev : { url: full || prev } }]; }; var phash = (b) => { @@ -24072,8 +13826,8 @@ } return acc; }; - var has_embed5 = async (b, fn, prevlink) => { - if (import_buffer7.Buffer.from(fn, "hex").equals(b)) + var has_embed3 = async (b, fn, prevlink) => { + if (import_buffer5.Buffer.from(fn, "hex").equals(b)) return false; let result = void 0; for (const e of Object.values(boorus)) { @@ -24090,7 +13844,7 @@ const getHash = async (l) => { const ogreq = await ifetch(l); const origPreview = await ogreq.arrayBuffer(); - return phash(import_buffer7.Buffer.from(origPreview)); + return phash(import_buffer5.Buffer.from(origPreview)); }; const [orighash, tehash] = await Promise.all([ getHash(prevlink), @@ -24104,15 +13858,15 @@ }; var thirdeye_default = { skip: true, - extract: extract5, - has_embed: has_embed5, + extract: extract3, + has_embed: has_embed3, match: (fn) => !!fn.match(/^[0-9a-f]{32}\.....?/) }; // src/pomf.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer8 = __toESM(require_buffer(), 1); + var import_buffer6 = __toESM(require_buffer(), 1); var sources = [ { host: "Catbox", prefix: "files.catbox.moe/" }, { host: "Litter", prefix: "litter.catbox.moe/" }, @@ -24145,7 +13899,7 @@ } return { ext, source }; }; - var extract6 = async (b, fn) => { + var extract4 = async (b, fn) => { if (!csettings4) throw new Error("Settings uninit"); const { ext, source } = getExt(fn); @@ -24162,16 +13916,11 @@ } return [{ filename: ext, - data: csettings4.hotlink ? rsource : async (lsn) => { - try { - return import_buffer8.Buffer.from(await (await ifetch(rsource, void 0, lsn)).arrayBuffer()); - } catch (e) { - } - }, - thumbnail: import_buffer8.Buffer.from(hasembed_default) + data: csettings4.hotlink ? rsource : { url: rsource }, + thumbnail: import_buffer6.Buffer.from(hasembed_default) }]; }; - var has_embed6 = async (b, fn) => { + var has_embed4 = async (b, fn) => { const { ext, source } = getExt(fn); if (!ext) return false; @@ -24188,8 +13937,8 @@ }; var pomf_default = { skip: true, - extract: extract6, - has_embed: has_embed6, + extract: extract4, + has_embed: has_embed4, match: (fn) => !!getExt(fn) }; @@ -24909,7 +14658,7 @@ // src/Components/Embedding.svelte init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer9 = __toESM(require_buffer(), 1); + var import_buffer7 = __toESM(require_buffer(), 1); function add_css6(target) { append_styles(target, "svelte-olzxr6", ".plaace.svelte-olzxr6.svelte-olzxr6{cursor:pointer;max-width:100vw;max-height:100vh}.unzipping.svelte-olzxr6>img.svelte-olzxr6{filter:brightness(0.5) blur(10px)}.progress.svelte-olzxr6.svelte-olzxr6{color:black;-webkit-text-stroke:0.7px white;font-weight:bold;left:50%;top:50%;font-size:larger;display:inline-block;position:absolute;z-index:10}.hoverer.svelte-olzxr6.svelte-olzxr6{display:none;position:fixed;pointer-events:none}.visible.svelte-olzxr6.svelte-olzxr6{display:block;z-index:9}.contract.svelte-olzxr6 img.svelte-olzxr6,.contract.svelte-olzxr6 video.svelte-olzxr6{max-width:125px !important;max-height:125px !important;width:auto;height:auto}.plaace.svelte-olzxr6:not(.contract) video.svelte-olzxr6,.plaace.svelte-olzxr6:not(.contract) img.svelte-olzxr6,.hoverer.svelte-olzxr6>video.svelte-olzxr6,.hoverer.svelte-olzxr6>img.svelte-olzxr6{max-width:100vw;max-height:100vh}"); } @@ -25447,7 +15196,7 @@ const thumb = file.thumbnail || file.data; let type; if (typeof thumb != "string") { - let buff = import_buffer9.Buffer.isBuffer(thumb) ? thumb : await thumb(); + let buff = thumb instanceof Uint8Array ? thumb : await thumb(); type = await fileTypeFromBuffer(buff); if (!type && file.filename.endsWith(".txt") && file.filename.startsWith("message")) { type = { ext: "txt", mime: "text/plain" }; @@ -25511,7 +15260,7 @@ lisn.addEventListener("progress", (e) => { $$invalidate(18, progress = e.detail); }); - let full = import_buffer9.Buffer.isBuffer(file.data) ? file.data : await file.data(lisn); + let full = file.data instanceof Uint8Array ? file.data : await file.data(lisn); type = await fileTypeFromBuffer(full); if (!type && file.filename.endsWith(".txt") && file.filename.startsWith("message")) { type = { ext: "txt", mime: "text/plain" }; @@ -29981,7 +19730,7 @@ // src/Components/EyeButton.svelte init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer10 = __toESM(require_buffer(), 1); + var import_buffer8 = __toESM(require_buffer(), 1); function add_css12(target) { append_styles(target, "svelte-64lw6s", ".clickable.svelte-64lw6s{cursor:pointer;margin-left:5px}.clickable.svelte-64lw6s:hover{text-shadow:0 0 4px palevioletred}"); } @@ -30329,7 +20078,7 @@ a.style.display = "none"; let url; if (typeof file.data != "string") { - const thumb = import_buffer10.Buffer.isBuffer(file.data) ? file.data : await file.data(); + const thumb = file.data instanceof Uint8Array ? file.data : await file.data(); const type = await fileTypeFromBuffer(thumb); url = URL.createObjectURL(new Blob([thumb], { type: type?.mime })); } else @@ -30583,11 +20332,7 @@ catalogControlHost: () => document.getElementById("index-options"), getImageLink: async function* (post) { if (location.host == "arch.b4k.co") { - const pid = post.id.match(/\d+/)[0]; - const board = location.pathname.match(/\/(..?.?)\//)[1]; - const res = await ifetch(`https://archive.wakarimasen.moe/_/api/chan/post/?board=${board}&num=${pid}`); - const data = await res.json(); - yield data.media.media_link; + return; } yield post.querySelector("a[rel]")?.getAttribute("href") || ""; }, @@ -31816,12 +21561,33 @@ }; var ViewCount_default = ViewCount; + // src/processor.worker.ts + init_define_BUILD_VERSION(); + init_esbuild_inject(); + + // inline-worker:__inline-worker + init_define_BUILD_VERSION(); + init_esbuild_inject(); + function inlineWorker(scriptText) { + let blob = new Blob([scriptText], { type: "text/javascript" }); + let url = URL.createObjectURL(blob); + let worker = new Worker(url); + URL.revokeObjectURL(url); + return worker; + } + + // src/processor.worker.ts + function Worker2() { + return inlineWorker('var __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n};\nvar __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key2 of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key2) && key2 !== except)\n __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));\nvar __decorateClass = (decorators, target, key2, kind) => {\n var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;\n for (var i = decorators.length - 1, decorator; i >= 0; i--)\n if (decorator = decorators[i])\n result = (kind ? decorator(target, key2, result) : decorator(result)) || result;\n if (kind && result)\n __defProp(target, key2, result);\n return result;\n};\nvar __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError("Cannot " + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, "read from private field");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError("Cannot add the same private member more than once");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, "write to private field");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, "access private method");\n return method;\n};\nvar __toBinary = /* @__PURE__ */ (() => {\n var table = new Uint8Array(128);\n for (var i = 0; i < 64; i++)\n table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;\n return (base64) => {\n var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0);\n for (var i2 = 0, j = 0; i2 < n; ) {\n var c0 = table[base64.charCodeAt(i2++)], c1 = table[base64.charCodeAt(i2++)];\n var c2 = table[base64.charCodeAt(i2++)], c3 = table[base64.charCodeAt(i2++)];\n bytes[j++] = c0 << 2 | c1 >> 4;\n bytes[j++] = c1 << 4 | c2 >> 2;\n bytes[j++] = c2 << 6 | c3;\n }\n return bytes;\n };\n})();\n\n// \nvar init_define_BUILD_VERSION = __esm({\n ""() {\n }\n});\n\n// node_modules/base64-js/index.js\nvar require_base64_js = __commonJS({\n "node_modules/base64-js/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports.byteLength = byteLength;\n exports.toByteArray = toByteArray;\n exports.fromByteArray = fromByteArray;\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;\n var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n for (i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n var i;\n var len;\n revLookup["-".charCodeAt(0)] = 62;\n revLookup["_".charCodeAt(0)] = 63;\n function getLens(b64) {\n var len2 = b64.length;\n if (len2 % 4 > 0) {\n throw new Error("Invalid string. Length must be a multiple of 4");\n }\n var validLen = b64.indexOf("=");\n if (validLen === -1)\n validLen = len2;\n var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n }\n function byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function _byteLength(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i2;\n for (i2 = 0; i2 < len2; i2 += 4) {\n tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];\n arr[curByte++] = tmp >> 16 & 255;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 2) {\n tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n }\n function tripletToBase64(num) {\n return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\n }\n function encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i2 = start; i2 < end; i2 += 3) {\n tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);\n output.push(tripletToBase64(tmp));\n }\n return output.join("");\n }\n function fromByteArray(uint8) {\n var tmp;\n var len2 = uint8.length;\n var extraBytes = len2 % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {\n parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));\n }\n if (extraBytes === 1) {\n tmp = uint8[len2 - 1];\n parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");\n } else if (extraBytes === 2) {\n tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];\n parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");\n }\n return parts.join("");\n }\n }\n});\n\n// node_modules/ieee754/index.js\nvar require_ieee754 = __commonJS({\n "node_modules/ieee754/index.js"(exports) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports.read = function(buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? nBytes - 1 : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n i += d;\n e = s & (1 << -nBits) - 1;\n s >>= -nBits;\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {\n }\n m = e & (1 << -nBits) - 1;\n e >>= -nBits;\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {\n }\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : (s ? -1 : 1) * Infinity;\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n };\n exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;\n var i = isLE ? 0 : nBytes - 1;\n var d = isLE ? 1 : -1;\n var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n value = Math.abs(value);\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {\n }\n buffer[offset + i - d] |= s * 128;\n };\n }\n});\n\n// node_modules/buffer/index.js\nvar require_buffer = __commonJS({\n "node_modules/buffer/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var base64 = require_base64_js();\n var ieee7542 = require_ieee754();\n var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;\n exports.Buffer = Buffer13;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n var K_MAX_LENGTH = 2147483647;\n exports.kMaxLength = K_MAX_LENGTH;\n Buffer13.TYPED_ARRAY_SUPPORT = typedArraySupport();\n if (!Buffer13.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {\n console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");\n }\n function typedArraySupport() {\n try {\n const arr = new Uint8Array(1);\n const proto = { foo: function() {\n return 42;\n } };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42;\n } catch (e) {\n return false;\n }\n }\n Object.defineProperty(Buffer13.prototype, "parent", {\n enumerable: true,\n get: function() {\n if (!Buffer13.isBuffer(this))\n return void 0;\n return this.buffer;\n }\n });\n Object.defineProperty(Buffer13.prototype, "offset", {\n enumerable: true,\n get: function() {\n if (!Buffer13.isBuffer(this))\n return void 0;\n return this.byteOffset;\n }\n });\n function createBuffer(length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError(\'The value "\' + length + \'" is invalid for option "size"\');\n }\n const buf2 = new Uint8Array(length);\n Object.setPrototypeOf(buf2, Buffer13.prototype);\n return buf2;\n }\n function Buffer13(arg, encodingOrOffset, length) {\n if (typeof arg === "number") {\n if (typeof encodingOrOffset === "string") {\n throw new TypeError(\'The "string" argument must be of type string. Received type number\');\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }\n Buffer13.poolSize = 8192;\n function from(value, encodingOrOffset, length) {\n if (typeof value === "string") {\n return fromString(value, encodingOrOffset);\n }\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value);\n }\n if (value == null) {\n throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);\n }\n if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof value === "number") {\n throw new TypeError(\'The "value" argument must not be of type number. Received type number\');\n }\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer13.from(valueOf, encodingOrOffset, length);\n }\n const b = fromObject(value);\n if (b)\n return b;\n if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {\n return Buffer13.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);\n }\n throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);\n }\n Buffer13.from = function(value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length);\n };\n Object.setPrototypeOf(Buffer13.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer13, Uint8Array);\n function assertSize(size) {\n if (typeof size !== "number") {\n throw new TypeError(\'"size" argument must be of type number\');\n } else if (size < 0) {\n throw new RangeError(\'The value "\' + size + \'" is invalid for option "size"\');\n }\n }\n function alloc(size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size);\n }\n if (fill !== void 0) {\n return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);\n }\n return createBuffer(size);\n }\n Buffer13.alloc = function(size, fill, encoding) {\n return alloc(size, fill, encoding);\n };\n function allocUnsafe(size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0);\n }\n Buffer13.allocUnsafe = function(size) {\n return allocUnsafe(size);\n };\n Buffer13.allocUnsafeSlow = function(size) {\n return allocUnsafe(size);\n };\n function fromString(string, encoding) {\n if (typeof encoding !== "string" || encoding === "") {\n encoding = "utf8";\n }\n if (!Buffer13.isEncoding(encoding)) {\n throw new TypeError("Unknown encoding: " + encoding);\n }\n const length = byteLength(string, encoding) | 0;\n let buf2 = createBuffer(length);\n const actual = buf2.write(string, encoding);\n if (actual !== length) {\n buf2 = buf2.slice(0, actual);\n }\n return buf2;\n }\n function fromArrayLike(array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0;\n const buf2 = createBuffer(length);\n for (let i = 0; i < length; i += 1) {\n buf2[i] = array[i] & 255;\n }\n return buf2;\n }\n function fromArrayView(arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);\n }\n return fromArrayLike(arrayView);\n }\n function fromArrayBuffer(array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError(\'"offset" is outside of buffer bounds\');\n }\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError(\'"length" is outside of buffer bounds\');\n }\n let buf2;\n if (byteOffset === void 0 && length === void 0) {\n buf2 = new Uint8Array(array);\n } else if (length === void 0) {\n buf2 = new Uint8Array(array, byteOffset);\n } else {\n buf2 = new Uint8Array(array, byteOffset, length);\n }\n Object.setPrototypeOf(buf2, Buffer13.prototype);\n return buf2;\n }\n function fromObject(obj) {\n if (Buffer13.isBuffer(obj)) {\n const len = checked(obj.length) | 0;\n const buf2 = createBuffer(len);\n if (buf2.length === 0) {\n return buf2;\n }\n obj.copy(buf2, 0, 0, len);\n return buf2;\n }\n if (obj.length !== void 0) {\n if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {\n return createBuffer(0);\n }\n return fromArrayLike(obj);\n }\n if (obj.type === "Buffer" && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n }\n function checked(length) {\n if (length >= K_MAX_LENGTH) {\n throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");\n }\n return length | 0;\n }\n function SlowBuffer(length) {\n if (+length != length) {\n length = 0;\n }\n return Buffer13.alloc(+length);\n }\n Buffer13.isBuffer = function isBuffer(b) {\n return b != null && b._isBuffer === true && b !== Buffer13.prototype;\n };\n Buffer13.compare = function compare(a, b) {\n if (isInstance(a, Uint8Array))\n a = Buffer13.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array))\n b = Buffer13.from(b, b.offset, b.byteLength);\n if (!Buffer13.isBuffer(a) || !Buffer13.isBuffer(b)) {\n throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');\n }\n if (a === b)\n return 0;\n let x = a.length;\n let y = b.length;\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n if (x < y)\n return -1;\n if (y < x)\n return 1;\n return 0;\n };\n Buffer13.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case "hex":\n case "utf8":\n case "utf-8":\n case "ascii":\n case "latin1":\n case "binary":\n case "base64":\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return true;\n default:\n return false;\n }\n };\n Buffer13.concat = function concat(list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\');\n }\n if (list.length === 0) {\n return Buffer13.alloc(0);\n }\n let i;\n if (length === void 0) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n const buffer = Buffer13.allocUnsafe(length);\n let pos = 0;\n for (i = 0; i < list.length; ++i) {\n let buf2 = list[i];\n if (isInstance(buf2, Uint8Array)) {\n if (pos + buf2.length > buffer.length) {\n if (!Buffer13.isBuffer(buf2))\n buf2 = Buffer13.from(buf2);\n buf2.copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(buffer, buf2, pos);\n }\n } else if (!Buffer13.isBuffer(buf2)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\');\n } else {\n buf2.copy(buffer, pos);\n }\n pos += buf2.length;\n }\n return buffer;\n };\n function byteLength(string, encoding) {\n if (Buffer13.isBuffer(string)) {\n return string.length;\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength;\n }\n if (typeof string !== "string") {\n throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \' + typeof string);\n }\n const len = string.length;\n const mustMatch = arguments.length > 2 && arguments[2] === true;\n if (!mustMatch && len === 0)\n return 0;\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case "ascii":\n case "latin1":\n case "binary":\n return len;\n case "utf8":\n case "utf-8":\n return utf8ToBytes(string).length;\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return len * 2;\n case "hex":\n return len >>> 1;\n case "base64":\n return base64ToBytes(string).length;\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length;\n }\n encoding = ("" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer13.byteLength = byteLength;\n function slowToString(encoding, start, end) {\n let loweredCase = false;\n if (start === void 0 || start < 0) {\n start = 0;\n }\n if (start > this.length) {\n return "";\n }\n if (end === void 0 || end > this.length) {\n end = this.length;\n }\n if (end <= 0) {\n return "";\n }\n end >>>= 0;\n start >>>= 0;\n if (end <= start) {\n return "";\n }\n if (!encoding)\n encoding = "utf8";\n while (true) {\n switch (encoding) {\n case "hex":\n return hexSlice(this, start, end);\n case "utf8":\n case "utf-8":\n return utf8Slice(this, start, end);\n case "ascii":\n return asciiSlice(this, start, end);\n case "latin1":\n case "binary":\n return latin1Slice(this, start, end);\n case "base64":\n return base64Slice(this, start, end);\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return utf16leSlice(this, start, end);\n default:\n if (loweredCase)\n throw new TypeError("Unknown encoding: " + encoding);\n encoding = (encoding + "").toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer13.prototype._isBuffer = true;\n function swap(b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n Buffer13.prototype.swap16 = function swap16() {\n const len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 16-bits");\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this;\n };\n Buffer13.prototype.swap32 = function swap32() {\n const len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 32-bits");\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n };\n Buffer13.prototype.swap64 = function swap64() {\n const len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 64-bits");\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n };\n Buffer13.prototype.toString = function toString() {\n const length = this.length;\n if (length === 0)\n return "";\n if (arguments.length === 0)\n return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n };\n Buffer13.prototype.toLocaleString = Buffer13.prototype.toString;\n Buffer13.prototype.equals = function equals(b) {\n if (!Buffer13.isBuffer(b))\n throw new TypeError("Argument must be a Buffer");\n if (this === b)\n return true;\n return Buffer13.compare(this, b) === 0;\n };\n Buffer13.prototype.inspect = function inspect() {\n let str = "";\n const max = exports.INSPECT_MAX_BYTES;\n str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();\n if (this.length > max)\n str += " ... ";\n return "";\n };\n if (customInspectSymbol) {\n Buffer13.prototype[customInspectSymbol] = Buffer13.prototype.inspect;\n }\n Buffer13.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer13.from(target, target.offset, target.byteLength);\n }\n if (!Buffer13.isBuffer(target)) {\n throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \' + typeof target);\n }\n if (start === void 0) {\n start = 0;\n }\n if (end === void 0) {\n end = target ? target.length : 0;\n }\n if (thisStart === void 0) {\n thisStart = 0;\n }\n if (thisEnd === void 0) {\n thisEnd = this.length;\n }\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError("out of range index");\n }\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n if (thisStart >= thisEnd) {\n return -1;\n }\n if (start >= end) {\n return 1;\n }\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target)\n return 0;\n let x = thisEnd - thisStart;\n let y = end - start;\n const len = Math.min(x, y);\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n if (x < y)\n return -1;\n if (y < x)\n return 1;\n return 0;\n };\n function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n if (buffer.length === 0)\n return -1;\n if (typeof byteOffset === "string") {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 2147483647) {\n byteOffset = 2147483647;\n } else if (byteOffset < -2147483648) {\n byteOffset = -2147483648;\n }\n byteOffset = +byteOffset;\n if (numberIsNaN(byteOffset)) {\n byteOffset = dir ? 0 : buffer.length - 1;\n }\n if (byteOffset < 0)\n byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir)\n return -1;\n else\n byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir)\n byteOffset = 0;\n else\n return -1;\n }\n if (typeof val === "string") {\n val = Buffer13.from(val, encoding);\n }\n if (Buffer13.isBuffer(val)) {\n if (val.length === 0) {\n return -1;\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === "number") {\n val = val & 255;\n if (typeof Uint8Array.prototype.indexOf === "function") {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);\n }\n throw new TypeError("val must be string, number or Buffer");\n }\n function arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n let indexSize = 1;\n let arrLength = arr.length;\n let valLength = val.length;\n if (encoding !== void 0) {\n encoding = String(encoding).toLowerCase();\n if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n function read2(buf2, i2) {\n if (indexSize === 1) {\n return buf2[i2];\n } else {\n return buf2.readUInt16BE(i2 * indexSize);\n }\n }\n let i;\n if (dir) {\n let foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1)\n foundIndex = i;\n if (i - foundIndex + 1 === valLength)\n return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1)\n i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength)\n byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read2(arr, i + j) !== read2(val, j)) {\n found = false;\n break;\n }\n }\n if (found)\n return i;\n }\n }\n return -1;\n }\n Buffer13.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n };\n Buffer13.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n };\n Buffer13.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n };\n function hexWrite(buf2, string, offset, length) {\n offset = Number(offset) || 0;\n const remaining = buf2.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n const strLen = string.length;\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n let i;\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed))\n return i;\n buf2[offset + i] = parsed;\n }\n return i;\n }\n function utf8Write(buf2, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf2.length - offset), buf2, offset, length);\n }\n function asciiWrite(buf2, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf2, offset, length);\n }\n function base64Write(buf2, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf2, offset, length);\n }\n function ucs2Write(buf2, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length);\n }\n Buffer13.prototype.write = function write2(string, offset, length, encoding) {\n if (offset === void 0) {\n encoding = "utf8";\n length = this.length;\n offset = 0;\n } else if (length === void 0 && typeof offset === "string") {\n encoding = offset;\n length = this.length;\n offset = 0;\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === void 0)\n encoding = "utf8";\n } else {\n encoding = length;\n length = void 0;\n }\n } else {\n throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");\n }\n const remaining = this.length - offset;\n if (length === void 0 || length > remaining)\n length = remaining;\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError("Attempt to write outside buffer bounds");\n }\n if (!encoding)\n encoding = "utf8";\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case "hex":\n return hexWrite(this, string, offset, length);\n case "utf8":\n case "utf-8":\n return utf8Write(this, string, offset, length);\n case "ascii":\n case "latin1":\n case "binary":\n return asciiWrite(this, string, offset, length);\n case "base64":\n return base64Write(this, string, offset, length);\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return ucs2Write(this, string, offset, length);\n default:\n if (loweredCase)\n throw new TypeError("Unknown encoding: " + encoding);\n encoding = ("" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n Buffer13.prototype.toJSON = function toJSON() {\n return {\n type: "Buffer",\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n };\n function base64Slice(buf2, start, end) {\n if (start === 0 && end === buf2.length) {\n return base64.fromByteArray(buf2);\n } else {\n return base64.fromByteArray(buf2.slice(start, end));\n }\n }\n function utf8Slice(buf2, start, end) {\n end = Math.min(buf2.length, end);\n const res = [];\n let i = start;\n while (i < end) {\n const firstByte = buf2[i];\n let codePoint = null;\n let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint;\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 128) {\n codePoint = firstByte;\n }\n break;\n case 2:\n secondByte = buf2[i + 1];\n if ((secondByte & 192) === 128) {\n tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;\n if (tempCodePoint > 127) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 3:\n secondByte = buf2[i + 1];\n thirdByte = buf2[i + 2];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;\n if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 4:\n secondByte = buf2[i + 1];\n thirdByte = buf2[i + 2];\n fourthByte = buf2[i + 3];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;\n if (tempCodePoint > 65535 && tempCodePoint < 1114112) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n if (codePoint === null) {\n codePoint = 65533;\n bytesPerSequence = 1;\n } else if (codePoint > 65535) {\n codePoint -= 65536;\n res.push(codePoint >>> 10 & 1023 | 55296);\n codePoint = 56320 | codePoint & 1023;\n }\n res.push(codePoint);\n i += bytesPerSequence;\n }\n return decodeCodePointsArray(res);\n }\n var MAX_ARGUMENTS_LENGTH = 4096;\n function decodeCodePointsArray(codePoints) {\n const len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints);\n }\n let res = "";\n let i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));\n }\n return res;\n }\n function asciiSlice(buf2, start, end) {\n let ret = "";\n end = Math.min(buf2.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf2[i] & 127);\n }\n return ret;\n }\n function latin1Slice(buf2, start, end) {\n let ret = "";\n end = Math.min(buf2.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf2[i]);\n }\n return ret;\n }\n function hexSlice(buf2, start, end) {\n const len = buf2.length;\n if (!start || start < 0)\n start = 0;\n if (!end || end < 0 || end > len)\n end = len;\n let out = "";\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf2[i]];\n }\n return out;\n }\n function utf16leSlice(buf2, start, end) {\n const bytes = buf2.slice(start, end);\n let res = "";\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n return res;\n }\n Buffer13.prototype.slice = function slice(start, end) {\n const len = this.length;\n start = ~~start;\n end = end === void 0 ? len : ~~end;\n if (start < 0) {\n start += len;\n if (start < 0)\n start = 0;\n } else if (start > len) {\n start = len;\n }\n if (end < 0) {\n end += len;\n if (end < 0)\n end = 0;\n } else if (end > len) {\n end = len;\n }\n if (end < start)\n end = start;\n const newBuf = this.subarray(start, end);\n Object.setPrototypeOf(newBuf, Buffer13.prototype);\n return newBuf;\n };\n function checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0)\n throw new RangeError("offset is not uint");\n if (offset + ext > length)\n throw new RangeError("Trying to access beyond buffer length");\n }\n Buffer13.prototype.readUintLE = Buffer13.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n return val;\n };\n Buffer13.prototype.readUintBE = Buffer13.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength2, this.length);\n }\n let val = this[offset + --byteLength2];\n let mul = 1;\n while (byteLength2 > 0 && (mul *= 256)) {\n val += this[offset + --byteLength2] * mul;\n }\n return val;\n };\n Buffer13.prototype.readUint8 = Buffer13.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 1, this.length);\n return this[offset];\n };\n Buffer13.prototype.readUint16LE = Buffer13.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n };\n Buffer13.prototype.readUint16BE = Buffer13.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n };\n Buffer13.prototype.readUint32LE = Buffer13.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;\n };\n Buffer13.prototype.readUint32BE = Buffer13.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n };\n Buffer13.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;\n const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;\n return BigInt(lo) + (BigInt(hi) << BigInt(32));\n });\n Buffer13.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;\n return (BigInt(hi) << BigInt(32)) + BigInt(lo);\n });\n Buffer13.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n mul *= 128;\n if (val >= mul)\n val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer13.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let i = byteLength2;\n let mul = 1;\n let val = this[offset + --i];\n while (i > 0 && (mul *= 256)) {\n val += this[offset + --i] * mul;\n }\n mul *= 128;\n if (val >= mul)\n val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer13.prototype.readInt8 = function readInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 1, this.length);\n if (!(this[offset] & 128))\n return this[offset];\n return (255 - this[offset] + 1) * -1;\n };\n Buffer13.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n const val = this[offset] | this[offset + 1] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer13.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n const val = this[offset + 1] | this[offset] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer13.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\n };\n Buffer13.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n };\n Buffer13.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);\n return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);\n });\n Buffer13.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);\n });\n Buffer13.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return ieee7542.read(this, offset, true, 23, 4);\n };\n Buffer13.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return ieee7542.read(this, offset, false, 23, 4);\n };\n Buffer13.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 8, this.length);\n return ieee7542.read(this, offset, true, 52, 8);\n };\n Buffer13.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 8, this.length);\n return ieee7542.read(this, offset, false, 52, 8);\n };\n function checkInt(buf2, value, offset, ext, max, min) {\n if (!Buffer13.isBuffer(buf2))\n throw new TypeError(\'"buffer" argument must be a Buffer instance\');\n if (value > max || value < min)\n throw new RangeError(\'"value" argument is out of bounds\');\n if (offset + ext > buf2.length)\n throw new RangeError("Index out of range");\n }\n Buffer13.prototype.writeUintLE = Buffer13.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let mul = 1;\n let i = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeUintBE = Buffer13.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeUint8 = Buffer13.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 1, 255, 0);\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer13.prototype.writeUint16LE = Buffer13.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer13.prototype.writeUint16BE = Buffer13.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer13.prototype.writeUint32LE = Buffer13.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset + 3] = value >>> 24;\n this[offset + 2] = value >>> 16;\n this[offset + 1] = value >>> 8;\n this[offset] = value & 255;\n return offset + 4;\n };\n Buffer13.prototype.writeUint32BE = Buffer13.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n function wrtBigUInt64LE(buf2, value, offset, min, max) {\n checkIntBI(value, min, max, buf2, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n return offset;\n }\n function wrtBigUInt64BE(buf2, value, offset, min, max) {\n checkIntBI(value, min, max, buf2, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf2[offset + 7] = lo;\n lo = lo >> 8;\n buf2[offset + 6] = lo;\n lo = lo >> 8;\n buf2[offset + 5] = lo;\n lo = lo >> 8;\n buf2[offset + 4] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf2[offset + 3] = hi;\n hi = hi >> 8;\n buf2[offset + 2] = hi;\n hi = hi >> 8;\n buf2[offset + 1] = hi;\n hi = hi >> 8;\n buf2[offset] = hi;\n return offset + 8;\n }\n Buffer13.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));\n });\n Buffer13.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));\n });\n Buffer13.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = 0;\n let mul = 1;\n let sub = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n let sub = 0;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 1, 127, -128);\n if (value < 0)\n value = 255 + value + 1;\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer13.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer13.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer13.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 2147483647, -2147483648);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n this[offset + 2] = value >>> 16;\n this[offset + 3] = value >>> 24;\n return offset + 4;\n };\n Buffer13.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 2147483647, -2147483648);\n if (value < 0)\n value = 4294967295 + value + 1;\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n Buffer13.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));\n });\n Buffer13.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));\n });\n function checkIEEE754(buf2, value, offset, ext, max, min) {\n if (offset + ext > buf2.length)\n throw new RangeError("Index out of range");\n if (offset < 0)\n throw new RangeError("Index out of range");\n }\n function writeFloat(buf2, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22);\n }\n ieee7542.write(buf2, value, offset, littleEndian, 23, 4);\n return offset + 4;\n }\n Buffer13.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert);\n };\n Buffer13.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert);\n };\n function writeDouble(buf2, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292);\n }\n ieee7542.write(buf2, value, offset, littleEndian, 52, 8);\n return offset + 8;\n }\n Buffer13.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert);\n };\n Buffer13.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert);\n };\n Buffer13.prototype.copy = function copy(target, targetStart, start, end) {\n if (!Buffer13.isBuffer(target))\n throw new TypeError("argument should be a Buffer");\n if (!start)\n start = 0;\n if (!end && end !== 0)\n end = this.length;\n if (targetStart >= target.length)\n targetStart = target.length;\n if (!targetStart)\n targetStart = 0;\n if (end > 0 && end < start)\n end = start;\n if (end === start)\n return 0;\n if (target.length === 0 || this.length === 0)\n return 0;\n if (targetStart < 0) {\n throw new RangeError("targetStart out of bounds");\n }\n if (start < 0 || start >= this.length)\n throw new RangeError("Index out of range");\n if (end < 0)\n throw new RangeError("sourceEnd out of bounds");\n if (end > this.length)\n end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n const len = end - start;\n if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);\n }\n return len;\n };\n Buffer13.prototype.fill = function fill(val, start, end, encoding) {\n if (typeof val === "string") {\n if (typeof start === "string") {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === "string") {\n encoding = end;\n end = this.length;\n }\n if (encoding !== void 0 && typeof encoding !== "string") {\n throw new TypeError("encoding must be a string");\n }\n if (typeof encoding === "string" && !Buffer13.isEncoding(encoding)) {\n throw new TypeError("Unknown encoding: " + encoding);\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0);\n if (encoding === "utf8" && code < 128 || encoding === "latin1") {\n val = code;\n }\n }\n } else if (typeof val === "number") {\n val = val & 255;\n } else if (typeof val === "boolean") {\n val = Number(val);\n }\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError("Out of range index");\n }\n if (end <= start) {\n return this;\n }\n start = start >>> 0;\n end = end === void 0 ? this.length : end >>> 0;\n if (!val)\n val = 0;\n let i;\n if (typeof val === "number") {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n const bytes = Buffer13.isBuffer(val) ? val : Buffer13.from(val, encoding);\n const len = bytes.length;\n if (len === 0) {\n throw new TypeError(\'The value "\' + val + \'" is invalid for argument "value"\');\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n return this;\n };\n var errors = {};\n function E(sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor() {\n super();\n Object.defineProperty(this, "message", {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n });\n this.name = `${this.name} [${sym}]`;\n this.stack;\n delete this.name;\n }\n get code() {\n return sym;\n }\n set code(value) {\n Object.defineProperty(this, "code", {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n toString() {\n return `${this.name} [${sym}]: ${this.message}`;\n }\n };\n }\n E("ERR_BUFFER_OUT_OF_BOUNDS", function(name) {\n if (name) {\n return `${name} is outside of buffer bounds`;\n }\n return "Attempt to access memory outside buffer bounds";\n }, RangeError);\n E("ERR_INVALID_ARG_TYPE", function(name, actual) {\n return `The "${name}" argument must be of type number. Received type ${typeof actual}`;\n }, TypeError);\n E("ERR_OUT_OF_RANGE", function(str, range, input) {\n let msg = `The value of "${str}" is out of range.`;\n let received = input;\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input));\n } else if (typeof input === "bigint") {\n received = String(input);\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received);\n }\n received += "n";\n }\n msg += ` It must be ${range}. Received ${received}`;\n return msg;\n }, RangeError);\n function addNumericalSeparator(val) {\n let res = "";\n let i = val.length;\n const start = val[0] === "-" ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`;\n }\n return `${val.slice(0, i)}${res}`;\n }\n function checkBounds(buf2, offset, byteLength2) {\n validateNumber(offset, "offset");\n if (buf2[offset] === void 0 || buf2[offset + byteLength2] === void 0) {\n boundsError(offset, buf2.length - (byteLength2 + 1));\n }\n }\n function checkIntBI(value, min, max, buf2, offset, byteLength2) {\n if (value > max || value < min) {\n const n = typeof min === "bigint" ? "n" : "";\n let range;\n if (byteLength2 > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;\n } else {\n range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`;\n }\n throw new errors.ERR_OUT_OF_RANGE("value", range, value);\n }\n checkBounds(buf2, offset, byteLength2);\n }\n function validateNumber(value, name) {\n if (typeof value !== "number") {\n throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);\n }\n }\n function boundsError(value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type);\n throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);\n }\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();\n }\n throw new errors.ERR_OUT_OF_RANGE(type || "offset", `>= ${type ? 1 : 0} and <= ${length}`, value);\n }\n var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n function base64clean(str) {\n str = str.split("=")[0];\n str = str.trim().replace(INVALID_BASE64_RE, "");\n if (str.length < 2)\n return "";\n while (str.length % 4 !== 0) {\n str = str + "=";\n }\n return str;\n }\n function utf8ToBytes(string, units) {\n units = units || Infinity;\n let codePoint;\n const length = string.length;\n let leadSurrogate = null;\n const bytes = [];\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n if (codePoint > 55295 && codePoint < 57344) {\n if (!leadSurrogate) {\n if (codePoint > 56319) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n continue;\n } else if (i + 1 === length) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n continue;\n }\n leadSurrogate = codePoint;\n continue;\n }\n if (codePoint < 56320) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n leadSurrogate = codePoint;\n continue;\n }\n codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;\n } else if (leadSurrogate) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n }\n leadSurrogate = null;\n if (codePoint < 128) {\n if ((units -= 1) < 0)\n break;\n bytes.push(codePoint);\n } else if (codePoint < 2048) {\n if ((units -= 2) < 0)\n break;\n bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);\n } else if (codePoint < 65536) {\n if ((units -= 3) < 0)\n break;\n bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else if (codePoint < 1114112) {\n if ((units -= 4) < 0)\n break;\n bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else {\n throw new Error("Invalid code point");\n }\n }\n return bytes;\n }\n function asciiToBytes(str) {\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n byteArray.push(str.charCodeAt(i) & 255);\n }\n return byteArray;\n }\n function utf16leToBytes(str, units) {\n let c, hi, lo;\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0)\n break;\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n return byteArray;\n }\n function base64ToBytes(str) {\n return base64.toByteArray(base64clean(str));\n }\n function blitBuffer(src, dst, offset, length) {\n let i;\n for (i = 0; i < length; ++i) {\n if (i + offset >= dst.length || i >= src.length)\n break;\n dst[i + offset] = src[i];\n }\n return i;\n }\n function isInstance(obj, type) {\n return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;\n }\n function numberIsNaN(obj) {\n return obj !== obj;\n }\n var hexSliceLookupTable = function() {\n const alphabet = "0123456789abcdef";\n const table = new Array(256);\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16;\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table;\n }();\n function defineBigIntMethod(fn) {\n return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;\n }\n function BufferBigIntNotDefined() {\n throw new Error("BigInt not supported");\n }\n }\n});\n\n// esbuild.inject.js\nvar Buffer2;\nvar init_esbuild_inject = __esm({\n "esbuild.inject.js"() {\n "use strict";\n Buffer2 = require_buffer().Buffer;\n }\n});\n\n// node_modules/crc-32/crc32.js\nvar require_crc32 = __commonJS({\n "node_modules/crc-32/crc32.js"(exports) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var CRC32;\n (function(factory) {\n if (typeof DO_NOT_EXPORT_CRC === "undefined") {\n if (typeof exports === "object") {\n factory(exports);\n } else if (typeof define === "function" && define.amd) {\n define(function() {\n var module2 = {};\n factory(module2);\n return module2;\n });\n } else {\n factory(CRC32 = {});\n }\n } else {\n factory(CRC32 = {});\n }\n })(function(CRC322) {\n CRC322.version = "1.2.0";\n function signed_crc_table() {\n var c = 0, table = new Array(256);\n for (var n = 0; n != 256; ++n) {\n c = n;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n table[n] = c;\n }\n return typeof Int32Array !== "undefined" ? new Int32Array(table) : table;\n }\n var T = signed_crc_table();\n function crc32_bstr(bstr, seed) {\n var C = seed ^ -1, L = bstr.length - 1;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];\n }\n if (i === L)\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255];\n return C ^ -1;\n }\n function crc32_buf(buf2, seed) {\n if (buf2.length > 1e4)\n return crc32_buf_8(buf2, seed);\n var C = seed ^ -1, L = buf2.length - 3;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n }\n while (i < L + 3)\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n return C ^ -1;\n }\n function crc32_buf_8(buf2, seed) {\n var C = seed ^ -1, L = buf2.length - 7;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n }\n while (i < L + 7)\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n return C ^ -1;\n }\n function crc32_str(str, seed) {\n var C = seed ^ -1;\n for (var i = 0, L = str.length, c, d; i < L; ) {\n c = str.charCodeAt(i++);\n if (c < 128) {\n C = C >>> 8 ^ T[(C ^ c) & 255];\n } else if (c < 2048) {\n C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];\n } else if (c >= 55296 && c < 57344) {\n c = (c & 1023) + 64;\n d = str.charCodeAt(i++) & 1023;\n C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255];\n } else {\n C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];\n }\n }\n return C ^ -1;\n }\n CRC322.table = T;\n CRC322.bstr = crc32_bstr;\n CRC322.buf = crc32_buf;\n CRC322.str = crc32_str;\n });\n }\n});\n\n// node_modules/events/events.js\nvar require_events = __commonJS({\n "node_modules/events/events.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var R = typeof Reflect === "object" ? Reflect : null;\n var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n };\n var ReflectOwnKeys;\n if (R && typeof R.ownKeys === "function") {\n ReflectOwnKeys = R.ownKeys;\n } else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));\n };\n } else {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target);\n };\n }\n function ProcessEmitWarning(warning) {\n if (console && console.warn)\n console.warn(warning);\n }\n var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {\n return value !== value;\n };\n function EventEmitter() {\n EventEmitter.init.call(this);\n }\n module.exports = EventEmitter;\n module.exports.once = once;\n EventEmitter.EventEmitter = EventEmitter;\n EventEmitter.prototype._events = void 0;\n EventEmitter.prototype._eventsCount = 0;\n EventEmitter.prototype._maxListeners = void 0;\n var defaultMaxListeners = 10;\n function checkListener(listener) {\n if (typeof listener !== "function") {\n throw new TypeError(\'The "listener" argument must be of type Function. Received type \' + typeof listener);\n }\n }\n Object.defineProperty(EventEmitter, "defaultMaxListeners", {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError(\'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received \' + arg + ".");\n }\n defaultMaxListeners = arg;\n }\n });\n EventEmitter.init = function() {\n if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n }\n this._maxListeners = this._maxListeners || void 0;\n };\n EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {\n throw new RangeError(\'The value of "n" is out of range. It must be a non-negative number. Received \' + n + ".");\n }\n this._maxListeners = n;\n return this;\n };\n function _getMaxListeners(that) {\n if (that._maxListeners === void 0)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n }\n EventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n };\n EventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++)\n args.push(arguments[i]);\n var doError = type === "error";\n var events = this._events;\n if (events !== void 0)\n doError = doError && events.error === void 0;\n else if (!doError)\n return false;\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n throw er;\n }\n var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));\n err.context = er;\n throw err;\n }\n var handler = events[type];\n if (handler === void 0)\n return false;\n if (typeof handler === "function") {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n return true;\n };\n function _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n checkListener(listener);\n events = target._events;\n if (events === void 0) {\n events = target._events = /* @__PURE__ */ Object.create(null);\n target._eventsCount = 0;\n } else {\n if (events.newListener !== void 0) {\n target.emit("newListener", type, listener.listener ? listener.listener : listener);\n events = target._events;\n }\n existing = events[type];\n }\n if (existing === void 0) {\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === "function") {\n existing = events[type] = prepend ? [listener, existing] : [existing, listener];\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");\n w.name = "MaxListenersExceededWarning";\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n return target;\n }\n EventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n };\n EventEmitter.prototype.on = EventEmitter.prototype.addListener;\n EventEmitter.prototype.prependListener = function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n function onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n }\n function _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: void 0, target, type, listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n }\n EventEmitter.prototype.once = function once2(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.removeListener = function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n checkListener(listener);\n events = this._events;\n if (events === void 0)\n return this;\n list = events[type];\n if (list === void 0)\n return this;\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit("removeListener", type, list.listener || listener);\n }\n } else if (typeof list !== "function") {\n position = -1;\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n if (position < 0)\n return this;\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n if (list.length === 1)\n events[type] = list[0];\n if (events.removeListener !== void 0)\n this.emit("removeListener", type, originalListener || listener);\n }\n return this;\n };\n EventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {\n var listeners, events, i;\n events = this._events;\n if (events === void 0)\n return this;\n if (events.removeListener === void 0) {\n if (arguments.length === 0) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== void 0) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key2;\n for (i = 0; i < keys.length; ++i) {\n key2 = keys[i];\n if (key2 === "removeListener")\n continue;\n this.removeAllListeners(key2);\n }\n this.removeAllListeners("removeListener");\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n listeners = events[type];\n if (typeof listeners === "function") {\n this.removeListener(type, listeners);\n } else if (listeners !== void 0) {\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n return this;\n };\n function _listeners(target, type, unwrap) {\n var events = target._events;\n if (events === void 0)\n return [];\n var evlistener = events[type];\n if (evlistener === void 0)\n return [];\n if (typeof evlistener === "function")\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n }\n EventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n };\n EventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n };\n EventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === "function") {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n };\n EventEmitter.prototype.listenerCount = listenerCount;\n function listenerCount(type) {\n var events = this._events;\n if (events !== void 0) {\n var evlistener = events[type];\n if (typeof evlistener === "function") {\n return 1;\n } else if (evlistener !== void 0) {\n return evlistener.length;\n }\n }\n return 0;\n }\n EventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n };\n function arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n }\n function spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n }\n function unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n }\n function once(emitter, name) {\n return new Promise(function(resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n function resolver() {\n if (typeof emitter.removeListener === "function") {\n emitter.removeListener("error", errorListener);\n }\n resolve([].slice.call(arguments));\n }\n ;\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== "error") {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n }\n function addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === "function") {\n eventTargetAgnosticAddListener(emitter, "error", handler, flags);\n }\n }\n function eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === "function") {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === "function") {\n emitter.addEventListener(name, function wrapListener(arg) {\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError(\'The "emitter" argument must be of type EventEmitter. Received type \' + typeof emitter);\n }\n }\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/stream-browser.js\nvar require_stream_browser = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = require_events().EventEmitter;\n }\n});\n\n// (disabled):node_modules/util/util.js\nvar require_util = __commonJS({\n "(disabled):node_modules/util/util.js"() {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/buffer_list.js\nvar require_buffer_list = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly)\n symbols = symbols.filter(function(sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n return keys;\n }\n function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function(key2) {\n _defineProperty(target, key2, source[key2]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function(key2) {\n Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));\n });\n }\n }\n return target;\n }\n function _defineProperty(obj, key2, value) {\n if (key2 in obj) {\n Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key2] = value;\n }\n return obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor)\n descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps)\n _defineProperties(Constructor.prototype, protoProps);\n if (staticProps)\n _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n var _require = require_buffer();\n var Buffer13 = _require.Buffer;\n var _require2 = require_util();\n var inspect = _require2.inspect;\n var custom = inspect && inspect.custom || "inspect";\n function copyBuffer(src, target, offset) {\n Buffer13.prototype.copy.call(src, target, offset);\n }\n module.exports = /* @__PURE__ */ function() {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: "push",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0)\n this.tail.next = entry;\n else\n this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: "unshift",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0)\n this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: "shift",\n value: function shift() {\n if (this.length === 0)\n return;\n var ret = this.head.data;\n if (this.length === 1)\n this.head = this.tail = null;\n else\n this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: "clear",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: "join",\n value: function join(s) {\n if (this.length === 0)\n return "";\n var p = this.head;\n var ret = "" + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }\n return ret;\n }\n }, {\n key: "concat",\n value: function concat(n) {\n if (this.length === 0)\n return Buffer13.alloc(0);\n var ret = Buffer13.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n }, {\n key: "consume",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n ret = this.shift();\n } else {\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: "first",\n value: function first() {\n return this.head.data;\n }\n }, {\n key: "_getString",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length)\n ret += str;\n else\n ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n }, {\n key: "_getBuffer",\n value: function _getBuffer(n) {\n var ret = Buffer13.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf2 = p.data;\n var nb = n > buf2.length ? buf2.length : n;\n buf2.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf2.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf2.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread({}, options, {\n depth: 0,\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n }();\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/destroy.js\nvar require_destroy = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function(err2) {\n if (!cb && err2) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n }\n function emitErrorAndCloseNT(self2, err) {\n emitErrorNT(self2, err);\n emitCloseNT(self2);\n }\n function emitCloseNT(self2) {\n if (self2._writableState && !self2._writableState.emitClose)\n return;\n if (self2._readableState && !self2._readableState.emitClose)\n return;\n self2.emit("close");\n }\n function undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n }\n function emitErrorNT(self2, err) {\n self2.emit("error", err);\n }\n function errorOrDestroy(stream, err) {\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy)\n stream.destroy(err);\n else\n stream.emit("error", err);\n }\n module.exports = {\n destroy,\n undestroy,\n errorOrDestroy\n };\n }\n});\n\n// node_modules/readable-stream/errors-browser.js\nvar require_errors_browser = __commonJS({\n "node_modules/readable-stream/errors-browser.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n }\n var codes = {};\n function createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === "string") {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n var NodeError = /* @__PURE__ */ function(_Base) {\n _inheritsLoose(NodeError2, _Base);\n function NodeError2(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n return NodeError2;\n }(Base);\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function(i) {\n return String(i);\n });\n if (len > 2) {\n return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1];\n } else if (len === 2) {\n return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);\n } else {\n return "of ".concat(thing, " ").concat(expected[0]);\n }\n } else {\n return "of ".concat(thing, " ").concat(String(expected));\n }\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n if (this_len === void 0 || this_len > str.length) {\n this_len = str.length;\n }\n return str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n if (typeof start !== "number") {\n start = 0;\n }\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n }\n createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {\n return \'The value "\' + value + \'" is invalid for option "\' + name + \'"\';\n }, TypeError);\n createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {\n var determiner;\n if (typeof expected === "string" && startsWith(expected, "not ")) {\n determiner = "must not be";\n expected = expected.replace(/^not /, "");\n } else {\n determiner = "must be";\n }\n var msg;\n if (endsWith(name, " argument")) {\n msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));\n } else {\n var type = includes(name, ".") ? "property" : "argument";\n msg = \'The "\'.concat(name, \'" \').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));\n }\n msg += ". Received type ".concat(typeof actual);\n return msg;\n }, TypeError);\n createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");\n createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {\n return "The " + name + " method is not implemented";\n });\n createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");\n createErrorType("ERR_STREAM_DESTROYED", function(name) {\n return "Cannot call " + name + " after a stream was destroyed";\n });\n createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");\n createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");\n createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");\n createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);\n createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {\n return "Unknown encoding: " + arg;\n }, TypeError);\n createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");\n module.exports.codes = codes;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/state.js\nvar require_state = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE;\n function highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n }\n function getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : "highWaterMark";\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n return state.objectMode ? 16 : 16 * 1024;\n }\n module.exports = {\n getHighWaterMark\n };\n }\n});\n\n// node_modules/inherits/inherits_browser.js\nvar require_inherits_browser = __commonJS({\n "node_modules/inherits/inherits_browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n if (typeof Object.create === "function") {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n };\n } else {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n };\n }\n }\n});\n\n// node_modules/util-deprecate/browser.js\nvar require_browser = __commonJS({\n "node_modules/util-deprecate/browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = deprecate;\n function deprecate(fn, msg) {\n if (config("noDeprecation")) {\n return fn;\n }\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config("throwDeprecation")) {\n throw new Error(msg);\n } else if (config("traceDeprecation")) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n return deprecated;\n }\n function config(name) {\n try {\n if (!self.localStorage)\n return false;\n } catch (_) {\n return false;\n }\n var val = self.localStorage[name];\n if (val == null)\n return false;\n return String(val).toLowerCase() === "true";\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_writable.js\nvar require_stream_writable = __commonJS({\n "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Writable;\n function CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function() {\n onCorkedFinish(_this, state);\n };\n }\n var Duplex;\n Writable.WritableState = WritableState;\n var internalUtil = {\n deprecate: require_browser()\n };\n var Stream = require_stream_browser();\n var Buffer13 = require_buffer().Buffer;\n var OurUint8Array = self.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer13.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer13.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;\n var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;\n var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n require_inherits_browser()(Writable, Stream);\n function nop() {\n }\n function WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== "boolean")\n isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);\n this.finalCalled = false;\n this.needDrain = false;\n this.ending = false;\n this.ended = false;\n this.finished = false;\n this.destroyed = false;\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n this.defaultEncoding = options.defaultEncoding || "utf8";\n this.length = 0;\n this.writing = false;\n this.corked = 0;\n this.sync = true;\n this.bufferProcessing = false;\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n this.writecb = null;\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n this.pendingcb = 0;\n this.prefinished = false;\n this.errorEmitted = false;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.bufferedRequestCount = 0;\n this.corkedRequestsFree = new CorkedRequest(this);\n }\n WritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n };\n (function() {\n try {\n Object.defineProperty(WritableState.prototype, "buffer", {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")\n });\n } catch (_) {\n }\n })();\n var realHasInstance;\n if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object))\n return true;\n if (this !== Writable)\n return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n } else {\n realHasInstance = function realHasInstance2(object) {\n return object instanceof this;\n };\n }\n function Writable(options) {\n Duplex = Duplex || require_stream_duplex();\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this))\n return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n this.writable = true;\n if (options) {\n if (typeof options.write === "function")\n this._write = options.write;\n if (typeof options.writev === "function")\n this._writev = options.writev;\n if (typeof options.destroy === "function")\n this._destroy = options.destroy;\n if (typeof options.final === "function")\n this._final = options.final;\n }\n Stream.call(this);\n }\n Writable.prototype.pipe = function() {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n };\n function writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n }\n function validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== "string" && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n }\n Writable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer13.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === "function") {\n cb = encoding;\n encoding = null;\n }\n if (isBuf)\n encoding = "buffer";\n else if (!encoding)\n encoding = state.defaultEncoding;\n if (typeof cb !== "function")\n cb = nop;\n if (state.ending)\n writeAfterEnd(this, cb);\n else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n };\n Writable.prototype.cork = function() {\n this._writableState.corked++;\n };\n Writable.prototype.uncork = function() {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)\n clearBuffer(this, state);\n }\n };\n Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n if (typeof encoding === "string")\n encoding = encoding.toLowerCase();\n if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n };\n Object.defineProperty(Writable.prototype, "writableBuffer", {\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n function decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {\n chunk = Buffer13.from(chunk, encoding);\n }\n return chunk;\n }\n Object.defineProperty(Writable.prototype, "writableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = "buffer";\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n if (!ret)\n state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk,\n encoding,\n isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n }\n function doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed)\n state.onwrite(new ERR_STREAM_DESTROYED("write"));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n }\n function onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n process.nextTick(cb, er);\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n finishMaybe(stream, state);\n }\n }\n function onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n }\n function onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== "function")\n throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n }\n function afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n }\n function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit("drain");\n }\n }\n function clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf)\n allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, "", holder.finish);\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n if (state.writing) {\n break;\n }\n }\n if (entry === null)\n state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n }\n Writable.prototype._write = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));\n };\n Writable.prototype._writev = null;\n Writable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === "function") {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === "function") {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== void 0)\n this.write(chunk, encoding);\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n if (!state.ending)\n endWritable(this, state, cb);\n return this;\n };\n Object.defineProperty(Writable.prototype, "writableLength", {\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n }\n function callFinal(stream, state) {\n stream._final(function(err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit("prefinish");\n finishMaybe(stream, state);\n });\n }\n function prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === "function" && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit("prefinish");\n }\n }\n }\n function finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit("finish");\n if (state.autoDestroy) {\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n }\n function endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once("finish", cb);\n }\n state.ended = true;\n stream.writable = false;\n }\n function onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n state.corkedRequestsFree.next = corkReq;\n }\n Object.defineProperty(Writable.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._writableState === void 0) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n if (!this._writableState) {\n return;\n }\n this._writableState.destroyed = value;\n }\n });\n Writable.prototype.destroy = destroyImpl.destroy;\n Writable.prototype._undestroy = destroyImpl.undestroy;\n Writable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n }\n});\n\n// node_modules/readable-stream/lib/_stream_duplex.js\nvar require_stream_duplex = __commonJS({\n "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var objectKeys = Object.keys || function(obj) {\n var keys2 = [];\n for (var key2 in obj) {\n keys2.push(key2);\n }\n return keys2;\n };\n module.exports = Duplex;\n var Readable = require_stream_readable();\n var Writable = require_stream_writable();\n require_inherits_browser()(Duplex, Readable);\n {\n keys = objectKeys(Writable.prototype);\n for (v = 0; v < keys.length; v++) {\n method = keys[v];\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n }\n }\n var keys;\n var method;\n var v;\n function Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false)\n this.readable = false;\n if (options.writable === false)\n this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once("end", onend);\n }\n }\n }\n Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n Object.defineProperty(Duplex.prototype, "writableBuffer", {\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n Object.defineProperty(Duplex.prototype, "writableLength", {\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function onend() {\n if (this._writableState.ended)\n return;\n process.nextTick(onEndNT, this);\n }\n function onEndNT(self2) {\n self2.end();\n }\n Object.defineProperty(Duplex.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return;\n }\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n });\n }\n});\n\n// node_modules/safe-buffer/index.js\nvar require_safe_buffer = __commonJS({\n "node_modules/safe-buffer/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var buffer = require_buffer();\n var Buffer13 = buffer.Buffer;\n function copyProps(src, dst) {\n for (var key2 in src) {\n dst[key2] = src[key2];\n }\n }\n if (Buffer13.from && Buffer13.alloc && Buffer13.allocUnsafe && Buffer13.allocUnsafeSlow) {\n module.exports = buffer;\n } else {\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n }\n function SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer13(arg, encodingOrOffset, length);\n }\n SafeBuffer.prototype = Object.create(Buffer13.prototype);\n copyProps(Buffer13, SafeBuffer);\n SafeBuffer.from = function(arg, encodingOrOffset, length) {\n if (typeof arg === "number") {\n throw new TypeError("Argument must not be a number");\n }\n return Buffer13(arg, encodingOrOffset, length);\n };\n SafeBuffer.alloc = function(size, fill, encoding) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n var buf2 = Buffer13(size);\n if (fill !== void 0) {\n if (typeof encoding === "string") {\n buf2.fill(fill, encoding);\n } else {\n buf2.fill(fill);\n }\n } else {\n buf2.fill(0);\n }\n return buf2;\n };\n SafeBuffer.allocUnsafe = function(size) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n return Buffer13(size);\n };\n SafeBuffer.allocUnsafeSlow = function(size) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n return buffer.SlowBuffer(size);\n };\n }\n});\n\n// node_modules/string_decoder/lib/string_decoder.js\nvar require_string_decoder = __commonJS({\n "node_modules/string_decoder/lib/string_decoder.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var Buffer13 = require_safe_buffer().Buffer;\n var isEncoding = Buffer13.isEncoding || function(encoding) {\n encoding = "" + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case "hex":\n case "utf8":\n case "utf-8":\n case "ascii":\n case "binary":\n case "base64":\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n case "raw":\n return true;\n default:\n return false;\n }\n };\n function _normalizeEncoding(enc) {\n if (!enc)\n return "utf8";\n var retried;\n while (true) {\n switch (enc) {\n case "utf8":\n case "utf-8":\n return "utf8";\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return "utf16le";\n case "latin1":\n case "binary":\n return "latin1";\n case "base64":\n case "ascii":\n case "hex":\n return enc;\n default:\n if (retried)\n return;\n enc = ("" + enc).toLowerCase();\n retried = true;\n }\n }\n }\n function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== "string" && (Buffer13.isEncoding === isEncoding || !isEncoding(enc)))\n throw new Error("Unknown encoding: " + enc);\n return nenc || enc;\n }\n exports.StringDecoder = StringDecoder;\n function StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case "utf16le":\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case "utf8":\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case "base64":\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer13.allocUnsafe(nb);\n }\n StringDecoder.prototype.write = function(buf2) {\n if (buf2.length === 0)\n return "";\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf2);\n if (r === void 0)\n return "";\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf2.length)\n return r ? r + this.text(buf2, i) : this.text(buf2, i);\n return r || "";\n };\n StringDecoder.prototype.end = utf8End;\n StringDecoder.prototype.text = utf8Text;\n StringDecoder.prototype.fillLast = function(buf2) {\n if (this.lastNeed <= buf2.length) {\n buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length);\n this.lastNeed -= buf2.length;\n };\n function utf8CheckByte(byte) {\n if (byte <= 127)\n return 0;\n else if (byte >> 5 === 6)\n return 2;\n else if (byte >> 4 === 14)\n return 3;\n else if (byte >> 3 === 30)\n return 4;\n return byte >> 6 === 2 ? -1 : -2;\n }\n function utf8CheckIncomplete(self2, buf2, i) {\n var j = buf2.length - 1;\n if (j < i)\n return 0;\n var nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0)\n self2.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2)\n return 0;\n nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0)\n self2.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2)\n return 0;\n nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2)\n nb = 0;\n else\n self2.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n }\n function utf8CheckExtraBytes(self2, buf2, p) {\n if ((buf2[0] & 192) !== 128) {\n self2.lastNeed = 0;\n return "\\uFFFD";\n }\n if (self2.lastNeed > 1 && buf2.length > 1) {\n if ((buf2[1] & 192) !== 128) {\n self2.lastNeed = 1;\n return "\\uFFFD";\n }\n if (self2.lastNeed > 2 && buf2.length > 2) {\n if ((buf2[2] & 192) !== 128) {\n self2.lastNeed = 2;\n return "\\uFFFD";\n }\n }\n }\n }\n function utf8FillLast(buf2) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf2, p);\n if (r !== void 0)\n return r;\n if (this.lastNeed <= buf2.length) {\n buf2.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf2.copy(this.lastChar, p, 0, buf2.length);\n this.lastNeed -= buf2.length;\n }\n function utf8Text(buf2, i) {\n var total = utf8CheckIncomplete(this, buf2, i);\n if (!this.lastNeed)\n return buf2.toString("utf8", i);\n this.lastTotal = total;\n var end = buf2.length - (total - this.lastNeed);\n buf2.copy(this.lastChar, 0, end);\n return buf2.toString("utf8", i, end);\n }\n function utf8End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed)\n return r + "\\uFFFD";\n return r;\n }\n function utf16Text(buf2, i) {\n if ((buf2.length - i) % 2 === 0) {\n var r = buf2.toString("utf16le", i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 55296 && c <= 56319) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf2[buf2.length - 2];\n this.lastChar[1] = buf2[buf2.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf2[buf2.length - 1];\n return buf2.toString("utf16le", i, buf2.length - 1);\n }\n function utf16End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString("utf16le", 0, end);\n }\n return r;\n }\n function base64Text(buf2, i) {\n var n = (buf2.length - i) % 3;\n if (n === 0)\n return buf2.toString("base64", i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf2[buf2.length - 1];\n } else {\n this.lastChar[0] = buf2[buf2.length - 2];\n this.lastChar[1] = buf2[buf2.length - 1];\n }\n return buf2.toString("base64", i, buf2.length - n);\n }\n function base64End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed)\n return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);\n return r;\n }\n function simpleWrite(buf2) {\n return buf2.toString(this.encoding);\n }\n function simpleEnd(buf2) {\n return buf2 && buf2.length ? this.write(buf2) : "";\n }\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/end-of-stream.js\nvar require_end_of_stream = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE;\n function once(callback) {\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n }\n function noop2() {\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === "function";\n }\n function eos(stream, opts, callback) {\n if (typeof opts === "function")\n return eos(stream, null, opts);\n if (!opts)\n opts = {};\n callback = once(callback || noop2);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable2 = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish2() {\n if (!stream.writable)\n onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish2() {\n writable2 = false;\n writableEnded = true;\n if (!readable)\n callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend2() {\n readable = false;\n readableEnded = true;\n if (!writable2)\n callback.call(stream);\n };\n var onerror = function onerror2(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose2() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended)\n err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable2 && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended)\n err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest2() {\n stream.req.on("finish", onfinish);\n };\n if (isRequest(stream)) {\n stream.on("complete", onfinish);\n stream.on("abort", onclose);\n if (stream.req)\n onrequest();\n else\n stream.on("request", onrequest);\n } else if (writable2 && !stream._writableState) {\n stream.on("end", onlegacyfinish);\n stream.on("close", onlegacyfinish);\n }\n stream.on("end", onend);\n stream.on("finish", onfinish);\n if (opts.error !== false)\n stream.on("error", onerror);\n stream.on("close", onclose);\n return function() {\n stream.removeListener("complete", onfinish);\n stream.removeListener("abort", onclose);\n stream.removeListener("request", onrequest);\n if (stream.req)\n stream.req.removeListener("finish", onfinish);\n stream.removeListener("end", onlegacyfinish);\n stream.removeListener("close", onlegacyfinish);\n stream.removeListener("finish", onfinish);\n stream.removeListener("end", onend);\n stream.removeListener("error", onerror);\n stream.removeListener("close", onclose);\n };\n }\n module.exports = eos;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/async_iterator.js\nvar require_async_iterator = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var _Object$setPrototypeO;\n function _defineProperty(obj, key2, value) {\n if (key2 in obj) {\n Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key2] = value;\n }\n return obj;\n }\n var finished = require_end_of_stream();\n var kLastResolve = Symbol("lastResolve");\n var kLastReject = Symbol("lastReject");\n var kError = Symbol("error");\n var kEnded = Symbol("ended");\n var kLastPromise = Symbol("lastPromise");\n var kHandlePromise = Symbol("handlePromise");\n var kStream = Symbol("stream");\n function createIterResult(value, done) {\n return {\n value,\n done\n };\n }\n function readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n }\n function onReadable(iter) {\n process.nextTick(readAndResolve, iter);\n }\n function wrapForNext(lastPromise, iter) {\n return function(resolve, reject) {\n lastPromise.then(function() {\n if (iter[kEnded]) {\n resolve(createIterResult(void 0, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n }\n var AsyncIteratorPrototype = Object.getPrototypeOf(function() {\n });\n var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(void 0, true));\n }\n if (this[kStream].destroyed) {\n return new Promise(function(resolve, reject) {\n process.nextTick(function() {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(void 0, true));\n }\n });\n });\n }\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {\n return this;\n }), _defineProperty(_Object$setPrototypeO, "return", function _return() {\n var _this2 = this;\n return new Promise(function(resolve, reject) {\n _this2[kStream].destroy(null, function(err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(void 0, true));\n });\n });\n }), _Object$setPrototypeO), AsyncIteratorPrototype);\n var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function(err) {\n if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {\n var reject = iterator[kLastReject];\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(void 0, true));\n }\n iterator[kEnded] = true;\n });\n stream.on("readable", onReadable.bind(null, iterator));\n return iterator;\n };\n module.exports = createReadableStreamAsyncIterator;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/from-browser.js\nvar require_from_browser = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = function() {\n throw new Error("Readable.from is not available in the browser");\n };\n }\n});\n\n// node_modules/readable-stream/lib/_stream_readable.js\nvar require_stream_readable = __commonJS({\n "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Readable;\n var Duplex;\n Readable.ReadableState = ReadableState;\n var EE = require_events().EventEmitter;\n var EElistenerCount = function EElistenerCount2(emitter, type) {\n return emitter.listeners(type).length;\n };\n var Stream = require_stream_browser();\n var Buffer13 = require_buffer().Buffer;\n var OurUint8Array = self.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer13.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer13.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var debugUtil = require_util();\n var debug;\n if (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog("stream");\n } else {\n debug = function debug2() {\n };\n }\n var BufferList = require_buffer_list();\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n var StringDecoder;\n var createReadableStreamAsyncIterator;\n var from;\n require_inherits_browser()(Readable, Stream);\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];\n function prependListener(emitter, event, fn) {\n if (typeof emitter.prependListener === "function")\n return emitter.prependListener(event, fn);\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (Array.isArray(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n }\n function ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== "boolean")\n isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n this.sync = true;\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.destroyed = false;\n this.defaultEncoding = options.defaultEncoding || "utf8";\n this.awaitDrain = 0;\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require_string_decoder().StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n }\n function Readable(options) {\n Duplex = Duplex || require_stream_duplex();\n if (!(this instanceof Readable))\n return new Readable(options);\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n this.readable = true;\n if (options) {\n if (typeof options.read === "function")\n this._read = options.read;\n if (typeof options.destroy === "function")\n this._destroy = options.destroy;\n }\n Stream.call(this);\n }\n Object.defineProperty(Readable.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n if (!this._readableState) {\n return;\n }\n this._readableState.destroyed = value;\n }\n });\n Readable.prototype.destroy = destroyImpl.destroy;\n Readable.prototype._undestroy = destroyImpl.undestroy;\n Readable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n Readable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === "string") {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer13.from(chunk, encoding);\n encoding = "";\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n };\n Readable.prototype.unshift = function(chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n };\n function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug("readableAddChunk", chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck)\n er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer13.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted)\n errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());\n else\n addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0)\n addChunk(stream, state, chunk, false);\n else\n maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n }\n function addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit("data", chunk);\n } else {\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n if (state.needReadable)\n emitReadable(stream);\n }\n maybeReadMore(stream, state);\n }\n function chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);\n }\n return er;\n }\n Readable.prototype.isPaused = function() {\n return this._readableState.flowing === false;\n };\n Readable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require_string_decoder().StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n this._readableState.encoding = this._readableState.decoder.encoding;\n var p = this._readableState.buffer.head;\n var content = "";\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== "")\n this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n };\n var MAX_HWM = 1073741824;\n function computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n }\n function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended)\n return 0;\n if (state.objectMode)\n return 1;\n if (n !== n) {\n if (state.flowing && state.length)\n return state.buffer.head.data.length;\n else\n return state.length;\n }\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length)\n return n;\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n }\n Readable.prototype.read = function(n) {\n debug("read", n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0)\n state.emittedReadable = false;\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug("read: emitReadable", state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n var doRead = state.needReadable;\n debug("need readable", doRead);\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug("length less than watermark", doRead);\n }\n if (state.ended || state.reading) {\n doRead = false;\n debug("reading or ended", doRead);\n } else if (doRead) {\n debug("do read");\n state.reading = true;\n state.sync = true;\n if (state.length === 0)\n state.needReadable = true;\n this._read(state.highWaterMark);\n state.sync = false;\n if (!state.reading)\n n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n if (!state.ended)\n state.needReadable = true;\n if (nOrig !== n && state.ended)\n endReadable(this);\n }\n if (ret !== null)\n this.emit("data", ret);\n return ret;\n };\n function onEofChunk(stream, state) {\n debug("onEofChunk");\n if (state.ended)\n return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n emitReadable(stream);\n } else {\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n }\n function emitReadable(stream) {\n var state = stream._readableState;\n debug("emitReadable", state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug("emitReadable", state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n }\n function emitReadable_(stream) {\n var state = stream._readableState;\n debug("emitReadable_", state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit("readable");\n state.emittedReadable = false;\n }\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n }\n function maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n }\n function maybeReadMore_(stream, state) {\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug("maybeReadMore read 0");\n stream.read(0);\n if (len === state.length)\n break;\n }\n state.readingMore = false;\n }\n Readable.prototype._read = function(n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));\n };\n Readable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once("end", endFn);\n dest.on("unpipe", onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug("onunpipe");\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug("onend");\n dest.end();\n }\n var ondrain = pipeOnDrain(src);\n dest.on("drain", ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug("cleanup");\n dest.removeListener("close", onclose);\n dest.removeListener("finish", onfinish);\n dest.removeListener("drain", ondrain);\n dest.removeListener("error", onerror);\n dest.removeListener("unpipe", onunpipe);\n src.removeListener("end", onend);\n src.removeListener("end", unpipe);\n src.removeListener("data", ondata);\n cleanedUp = true;\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n src.on("data", ondata);\n function ondata(chunk) {\n debug("ondata");\n var ret = dest.write(chunk);\n debug("dest.write", ret);\n if (ret === false) {\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug("false write response, pause", state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n function onerror(er) {\n debug("onerror", er);\n unpipe();\n dest.removeListener("error", onerror);\n if (EElistenerCount(dest, "error") === 0)\n errorOrDestroy(dest, er);\n }\n prependListener(dest, "error", onerror);\n function onclose() {\n dest.removeListener("finish", onfinish);\n unpipe();\n }\n dest.once("close", onclose);\n function onfinish() {\n debug("onfinish");\n dest.removeListener("close", onclose);\n unpipe();\n }\n dest.once("finish", onfinish);\n function unpipe() {\n debug("unpipe");\n src.unpipe(dest);\n }\n dest.emit("pipe", src);\n if (!state.flowing) {\n debug("pipe resume");\n src.resume();\n }\n return dest;\n };\n function pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug("pipeOnDrain", state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {\n state.flowing = true;\n flow(src);\n }\n };\n }\n Readable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n if (state.pipesCount === 0)\n return this;\n if (state.pipesCount === 1) {\n if (dest && dest !== state.pipes)\n return this;\n if (!dest)\n dest = state.pipes;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit("unpipe", this, unpipeInfo);\n return this;\n }\n if (!dest) {\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) {\n dests[i].emit("unpipe", this, {\n hasUnpiped: false\n });\n }\n return this;\n }\n var index = indexOf(state.pipes, dest);\n if (index === -1)\n return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n dest.emit("unpipe", this, unpipeInfo);\n return this;\n };\n Readable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === "data") {\n state.readableListening = this.listenerCount("readable") > 0;\n if (state.flowing !== false)\n this.resume();\n } else if (ev === "readable") {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug("on readable", state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n };\n Readable.prototype.addListener = Readable.prototype.on;\n Readable.prototype.removeListener = function(ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === "readable") {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n Readable.prototype.removeAllListeners = function(ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === "readable" || ev === void 0) {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n function updateReadableListening(self2) {\n var state = self2._readableState;\n state.readableListening = self2.listenerCount("readable") > 0;\n if (state.resumeScheduled && !state.paused) {\n state.flowing = true;\n } else if (self2.listenerCount("data") > 0) {\n self2.resume();\n }\n }\n function nReadingNextTick(self2) {\n debug("readable nexttick read 0");\n self2.read(0);\n }\n Readable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug("resume");\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n };\n function resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n }\n function resume_(stream, state) {\n debug("resume", state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit("resume");\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n }\n Readable.prototype.pause = function() {\n debug("call pause flowing=%j", this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug("pause");\n this._readableState.flowing = false;\n this.emit("pause");\n }\n this._readableState.paused = true;\n return this;\n };\n function flow(stream) {\n var state = stream._readableState;\n debug("flow", state.flowing);\n while (state.flowing && stream.read() !== null) {\n ;\n }\n }\n Readable.prototype.wrap = function(stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on("end", function() {\n debug("wrapped end");\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on("data", function(chunk) {\n debug("wrapped data");\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n if (state.objectMode && (chunk === null || chunk === void 0))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n for (var i in stream) {\n if (this[i] === void 0 && typeof stream[i] === "function") {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n this._read = function(n2) {\n debug("wrapped _read", n2);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n };\n if (typeof Symbol === "function") {\n Readable.prototype[Symbol.asyncIterator] = function() {\n if (createReadableStreamAsyncIterator === void 0) {\n createReadableStreamAsyncIterator = require_async_iterator();\n }\n return createReadableStreamAsyncIterator(this);\n };\n }\n Object.defineProperty(Readable.prototype, "readableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n });\n Object.defineProperty(Readable.prototype, "readableBuffer", {\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n });\n Object.defineProperty(Readable.prototype, "readableFlowing", {\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n });\n Readable._fromList = fromList;\n Object.defineProperty(Readable.prototype, "readableLength", {\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n });\n function fromList(n, state) {\n if (state.length === 0)\n return null;\n var ret;\n if (state.objectMode)\n ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n if (state.decoder)\n ret = state.buffer.join("");\n else if (state.buffer.length === 1)\n ret = state.buffer.first();\n else\n ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n }\n function endReadable(stream) {\n var state = stream._readableState;\n debug("endReadable", state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n }\n function endReadableNT(state, stream) {\n debug("endReadableNT", state.endEmitted, state.length);\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit("end");\n if (state.autoDestroy) {\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n }\n if (typeof Symbol === "function") {\n Readable.from = function(iterable, opts) {\n if (from === void 0) {\n from = require_from_browser();\n }\n return from(Readable, iterable, opts);\n };\n }\n function indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x)\n return i;\n }\n return -1;\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_transform.js\nvar require_stream_transform = __commonJS({\n "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Transform;\n var _require$codes = require_errors_browser().codes;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;\n var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n var Duplex = require_stream_duplex();\n require_inherits_browser()(Transform, Duplex);\n function afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit("error", new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n }\n function Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n this._readableState.needReadable = true;\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === "function")\n this._transform = options.transform;\n if (typeof options.flush === "function")\n this._flush = options.flush;\n }\n this.on("prefinish", prefinish);\n }\n function prefinish() {\n var _this = this;\n if (typeof this._flush === "function" && !this._readableState.destroyed) {\n this._flush(function(er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n }\n Transform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n };\n Transform.prototype._transform = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));\n };\n Transform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n };\n Transform.prototype._read = function(n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n ts.needTransform = true;\n }\n };\n Transform.prototype._destroy = function(err, cb) {\n Duplex.prototype._destroy.call(this, err, function(err2) {\n cb(err2);\n });\n };\n function done(stream, er, data) {\n if (er)\n return stream.emit("error", er);\n if (data != null)\n stream.push(data);\n if (stream._writableState.length)\n throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming)\n throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_passthrough.js\nvar require_stream_passthrough = __commonJS({\n "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = PassThrough;\n var Transform = require_stream_transform();\n require_inherits_browser()(PassThrough, Transform);\n function PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n Transform.call(this, options);\n }\n PassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n };\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/pipeline.js\nvar require_pipeline = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var eos;\n function once(callback) {\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n callback.apply(void 0, arguments);\n };\n }\n var _require$codes = require_errors_browser().codes;\n var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n function noop2(err) {\n if (err)\n throw err;\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === "function";\n }\n function destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on("close", function() {\n closed = true;\n });\n if (eos === void 0)\n eos = require_end_of_stream();\n eos(stream, {\n readable: reading,\n writable: writing\n }, function(err) {\n if (err)\n return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function(err) {\n if (closed)\n return;\n if (destroyed)\n return;\n destroyed = true;\n if (isRequest(stream))\n return stream.abort();\n if (typeof stream.destroy === "function")\n return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED("pipe"));\n };\n }\n function call(fn) {\n fn();\n }\n function pipe(from, to) {\n return from.pipe(to);\n }\n function popCallback(streams) {\n if (!streams.length)\n return noop2;\n if (typeof streams[streams.length - 1] !== "function")\n return noop2;\n return streams.pop();\n }\n function pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0]))\n streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS("streams");\n }\n var error;\n var destroys = streams.map(function(stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function(err) {\n if (!error)\n error = err;\n if (err)\n destroys.forEach(call);\n if (reading)\n return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n }\n module.exports = pipeline;\n }\n});\n\n// node_modules/readable-stream/readable-browser.js\nvar require_readable_browser = __commonJS({\n "node_modules/readable-stream/readable-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports = module.exports = require_stream_readable();\n exports.Stream = exports;\n exports.Readable = exports;\n exports.Writable = require_stream_writable();\n exports.Duplex = require_stream_duplex();\n exports.Transform = require_stream_transform();\n exports.PassThrough = require_stream_passthrough();\n exports.finished = require_end_of_stream();\n exports.pipeline = require_pipeline();\n }\n});\n\n// node_modules/readable-web-to-node-stream/lib/index.js\nvar require_lib = __commonJS({\n "node_modules/readable-web-to-node-stream/lib/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.ReadableWebToNodeStream = void 0;\n var readable_stream_1 = require_readable_browser();\n var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable {\n constructor(stream) {\n super();\n this.bytesRead = 0;\n this.released = false;\n this.reader = stream.getReader();\n }\n async _read() {\n if (this.released) {\n this.push(null);\n return;\n }\n this.pendingRead = this.reader.read();\n const data = await this.pendingRead;\n delete this.pendingRead;\n if (data.done || this.released) {\n this.push(null);\n } else {\n this.bytesRead += data.value.length;\n this.push(data.value);\n }\n }\n async waitForReadToComplete() {\n if (this.pendingRead) {\n await this.pendingRead;\n }\n }\n async close() {\n await this.syncAndRelease();\n }\n async syncAndRelease() {\n this.released = true;\n await this.waitForReadToComplete();\n await this.reader.releaseLock();\n }\n };\n exports.ReadableWebToNodeStream = ReadableWebToNodeStream2;\n }\n});\n\n// node_modules/base-x/src/index.js\nvar require_src = __commonJS({\n "node_modules/base-x/src/index.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function base(ALPHABET) {\n if (ALPHABET.length >= 255) {\n throw new TypeError("Alphabet too long");\n }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) {\n throw new TypeError(x + " is ambiguous");\n }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256);\n var iFACTOR = Math.log(256) / Math.log(BASE);\n function encode2(source) {\n if (source instanceof Uint8Array) {\n } else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) {\n throw new TypeError("Expected Uint8Array");\n }\n if (source.length === 0) {\n return "";\n }\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n var size = (pend - pbegin) * iFACTOR + 1 >>> 0;\n var b58 = new Uint8Array(size);\n while (pbegin !== pend) {\n var carry = source[pbegin];\n var i2 = 0;\n for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {\n carry += 256 * b58[it1] >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = carry / BASE >>> 0;\n }\n if (carry !== 0) {\n throw new Error("Non-zero carry");\n }\n length = i2;\n pbegin++;\n }\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n return str;\n }\n function decodeUnsafe(source) {\n if (typeof source !== "string") {\n throw new TypeError("Expected String");\n }\n if (source.length === 0) {\n return new Uint8Array();\n }\n var psz = 0;\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n var size = (source.length - psz) * FACTOR + 1 >>> 0;\n var b256 = new Uint8Array(size);\n while (source[psz]) {\n var carry = BASE_MAP[source.charCodeAt(psz)];\n if (carry === 255) {\n return;\n }\n var i2 = 0;\n for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {\n carry += BASE * b256[it3] >>> 0;\n b256[it3] = carry % 256 >>> 0;\n carry = carry / 256 >>> 0;\n }\n if (carry !== 0) {\n throw new Error("Non-zero carry");\n }\n length = i2;\n psz++;\n }\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j2 = zeroes;\n while (it4 !== size) {\n vch[j2++] = b256[it4++];\n }\n return vch;\n }\n function decode3(string) {\n var buffer = decodeUnsafe(string);\n if (buffer) {\n return buffer;\n }\n throw new Error("Non-base" + BASE + " character");\n }\n return {\n encode: encode2,\n decodeUnsafe,\n decode: decode3\n };\n }\n module.exports = base;\n }\n});\n\n// node_modules/bs58/index.js\nvar require_bs58 = __commonJS({\n "node_modules/bs58/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var basex = require_src();\n var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";\n module.exports = basex(ALPHABET);\n }\n});\n\n// node_modules/jpeg-js/lib/encoder.js\nvar require_encoder = __commonJS({\n "node_modules/jpeg-js/lib/encoder.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var btoa = btoa || function(buf2) {\n return Buffer2.from(buf2).toString("base64");\n };\n function JPEGEncoder(quality) {\n var self2 = this;\n var fround = Math.round;\n var ffloor = Math.floor;\n var YTable = new Array(64);\n var UVTable = new Array(64);\n var fdtbl_Y = new Array(64);\n var fdtbl_UV = new Array(64);\n var YDC_HT2;\n var UVDC_HT2;\n var YAC_HT2;\n var UVAC_HT2;\n var bitcode2 = new Array(65535);\n var category2 = new Array(65535);\n var outputfDCTQuant = new Array(64);\n var DU = new Array(64);\n var byteout = [];\n var bytenew = 0;\n var bytepos = 7;\n var YDU = new Array(64);\n var UDU = new Array(64);\n var VDU = new Array(64);\n var clt = new Array(256);\n var RGB_YUV_TABLE = new Array(2048);\n var currentQuality;\n var ZigZag = [\n 0,\n 1,\n 5,\n 6,\n 14,\n 15,\n 27,\n 28,\n 2,\n 4,\n 7,\n 13,\n 16,\n 26,\n 29,\n 42,\n 3,\n 8,\n 12,\n 17,\n 25,\n 30,\n 41,\n 43,\n 9,\n 11,\n 18,\n 24,\n 31,\n 40,\n 44,\n 53,\n 10,\n 19,\n 23,\n 32,\n 39,\n 45,\n 52,\n 54,\n 20,\n 22,\n 33,\n 38,\n 46,\n 51,\n 55,\n 60,\n 21,\n 34,\n 37,\n 47,\n 50,\n 56,\n 59,\n 61,\n 35,\n 36,\n 48,\n 49,\n 57,\n 58,\n 62,\n 63\n ];\n var std_dc_luminance_nrcodes2 = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];\n var std_dc_luminance_values2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n var std_ac_luminance_nrcodes2 = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125];\n var std_ac_luminance_values2 = [\n 1,\n 2,\n 3,\n 0,\n 4,\n 17,\n 5,\n 18,\n 33,\n 49,\n 65,\n 6,\n 19,\n 81,\n 97,\n 7,\n 34,\n 113,\n 20,\n 50,\n 129,\n 145,\n 161,\n 8,\n 35,\n 66,\n 177,\n 193,\n 21,\n 82,\n 209,\n 240,\n 36,\n 51,\n 98,\n 114,\n 130,\n 9,\n 10,\n 22,\n 23,\n 24,\n 25,\n 26,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n ];\n var std_dc_chrominance_nrcodes2 = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];\n var std_dc_chrominance_values2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n var std_ac_chrominance_nrcodes2 = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119];\n var std_ac_chrominance_values2 = [\n 0,\n 1,\n 2,\n 3,\n 17,\n 4,\n 5,\n 33,\n 49,\n 6,\n 18,\n 65,\n 81,\n 7,\n 97,\n 113,\n 19,\n 34,\n 50,\n 129,\n 8,\n 20,\n 66,\n 145,\n 161,\n 177,\n 193,\n 9,\n 35,\n 51,\n 82,\n 240,\n 21,\n 98,\n 114,\n 209,\n 10,\n 22,\n 36,\n 52,\n 225,\n 37,\n 241,\n 23,\n 24,\n 25,\n 26,\n 38,\n 39,\n 40,\n 41,\n 42,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n ];\n function initQuantTables(sf) {\n var YQT = [\n 16,\n 11,\n 10,\n 16,\n 24,\n 40,\n 51,\n 61,\n 12,\n 12,\n 14,\n 19,\n 26,\n 58,\n 60,\n 55,\n 14,\n 13,\n 16,\n 24,\n 40,\n 57,\n 69,\n 56,\n 14,\n 17,\n 22,\n 29,\n 51,\n 87,\n 80,\n 62,\n 18,\n 22,\n 37,\n 56,\n 68,\n 109,\n 103,\n 77,\n 24,\n 35,\n 55,\n 64,\n 81,\n 104,\n 113,\n 92,\n 49,\n 64,\n 78,\n 87,\n 103,\n 121,\n 120,\n 101,\n 72,\n 92,\n 95,\n 98,\n 112,\n 100,\n 103,\n 99\n ];\n for (var i = 0; i < 64; i++) {\n var t = ffloor((YQT[i] * sf + 50) / 100);\n if (t < 1) {\n t = 1;\n } else if (t > 255) {\n t = 255;\n }\n YTable[ZigZag[i]] = t;\n }\n var UVQT = [\n 17,\n 18,\n 24,\n 47,\n 99,\n 99,\n 99,\n 99,\n 18,\n 21,\n 26,\n 66,\n 99,\n 99,\n 99,\n 99,\n 24,\n 26,\n 56,\n 99,\n 99,\n 99,\n 99,\n 99,\n 47,\n 66,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99\n ];\n for (var j = 0; j < 64; j++) {\n var u = ffloor((UVQT[j] * sf + 50) / 100);\n if (u < 1) {\n u = 1;\n } else if (u > 255) {\n u = 255;\n }\n UVTable[ZigZag[j]] = u;\n }\n var aasf = [\n 1,\n 1.387039845,\n 1.306562965,\n 1.175875602,\n 1,\n 0.785694958,\n 0.5411961,\n 0.275899379\n ];\n var k = 0;\n for (var row = 0; row < 8; row++) {\n for (var col = 0; col < 8; col++) {\n fdtbl_Y[k] = 1 / (YTable[ZigZag[k]] * aasf[row] * aasf[col] * 8);\n fdtbl_UV[k] = 1 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8);\n k++;\n }\n }\n }\n function computeHuffmanTbl(nrcodes, std_table) {\n var codevalue = 0;\n var pos_in_table = 0;\n var HT = new Array();\n for (var k = 1; k <= 16; k++) {\n for (var j = 1; j <= nrcodes[k]; j++) {\n HT[std_table[pos_in_table]] = [];\n HT[std_table[pos_in_table]][0] = codevalue;\n HT[std_table[pos_in_table]][1] = k;\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n }\n function initHuffmanTbl() {\n YDC_HT2 = computeHuffmanTbl(std_dc_luminance_nrcodes2, std_dc_luminance_values2);\n UVDC_HT2 = computeHuffmanTbl(std_dc_chrominance_nrcodes2, std_dc_chrominance_values2);\n YAC_HT2 = computeHuffmanTbl(std_ac_luminance_nrcodes2, std_ac_luminance_values2);\n UVAC_HT2 = computeHuffmanTbl(std_ac_chrominance_nrcodes2, std_ac_chrominance_values2);\n }\n function initCategoryNumber() {\n var nrlower = 1;\n var nrupper = 2;\n for (var cat = 1; cat <= 15; cat++) {\n for (var nr = nrlower; nr < nrupper; nr++) {\n category2[32767 + nr] = cat;\n bitcode2[32767 + nr] = [];\n bitcode2[32767 + nr][1] = cat;\n bitcode2[32767 + nr][0] = nr;\n }\n for (var nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) {\n category2[32767 + nrneg] = cat;\n bitcode2[32767 + nrneg] = [];\n bitcode2[32767 + nrneg][1] = cat;\n bitcode2[32767 + nrneg][0] = nrupper - 1 + nrneg;\n }\n nrlower <<= 1;\n nrupper <<= 1;\n }\n }\n function initRGBYUVTable() {\n for (var i = 0; i < 256; i++) {\n RGB_YUV_TABLE[i] = 19595 * i;\n RGB_YUV_TABLE[i + 256 >> 0] = 38470 * i;\n RGB_YUV_TABLE[i + 512 >> 0] = 7471 * i + 32768;\n RGB_YUV_TABLE[i + 768 >> 0] = -11059 * i;\n RGB_YUV_TABLE[i + 1024 >> 0] = -21709 * i;\n RGB_YUV_TABLE[i + 1280 >> 0] = 32768 * i + 8421375;\n RGB_YUV_TABLE[i + 1536 >> 0] = -27439 * i;\n RGB_YUV_TABLE[i + 1792 >> 0] = -5329 * i;\n }\n }\n function writeBits(bs) {\n var value = bs[0];\n var posval = bs[1] - 1;\n while (posval >= 0) {\n if (value & 1 << posval) {\n bytenew |= 1 << bytepos;\n }\n posval--;\n bytepos--;\n if (bytepos < 0) {\n if (bytenew == 255) {\n writeByte(255);\n writeByte(0);\n } else {\n writeByte(bytenew);\n }\n bytepos = 7;\n bytenew = 0;\n }\n }\n }\n function writeByte(value) {\n byteout.push(value);\n }\n function writeWord(value) {\n writeByte(value >> 8 & 255);\n writeByte(value & 255);\n }\n function fDCTQuant(data, fdtbl) {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n var dataOff = 0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i = 0; i < I8; ++i) {\n d0 = data[dataOff];\n d1 = data[dataOff + 1];\n d2 = data[dataOff + 2];\n d3 = data[dataOff + 3];\n d4 = data[dataOff + 4];\n d5 = data[dataOff + 5];\n d6 = data[dataOff + 6];\n d7 = data[dataOff + 7];\n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n var tmp10 = tmp0 + tmp3;\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n data[dataOff] = tmp10 + tmp11;\n data[dataOff + 4] = tmp10 - tmp11;\n var z1 = (tmp12 + tmp13) * 0.707106781;\n data[dataOff + 2] = tmp13 + z1;\n data[dataOff + 6] = tmp13 - z1;\n tmp10 = tmp4 + tmp5;\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n var z5 = (tmp10 - tmp12) * 0.382683433;\n var z2 = 0.5411961 * tmp10 + z5;\n var z4 = 1.306562965 * tmp12 + z5;\n var z3 = tmp11 * 0.707106781;\n var z11 = tmp7 + z3;\n var z13 = tmp7 - z3;\n data[dataOff + 5] = z13 + z2;\n data[dataOff + 3] = z13 - z2;\n data[dataOff + 1] = z11 + z4;\n data[dataOff + 7] = z11 - z4;\n dataOff += 8;\n }\n dataOff = 0;\n for (i = 0; i < I8; ++i) {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n var tmp10p2 = tmp0p2 + tmp3p2;\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n data[dataOff] = tmp10p2 + tmp11p2;\n data[dataOff + 32] = tmp10p2 - tmp11p2;\n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781;\n data[dataOff + 16] = tmp13p2 + z1p2;\n data[dataOff + 48] = tmp13p2 - z1p2;\n tmp10p2 = tmp4p2 + tmp5p2;\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433;\n var z2p2 = 0.5411961 * tmp10p2 + z5p2;\n var z4p2 = 1.306562965 * tmp12p2 + z5p2;\n var z3p2 = tmp11p2 * 0.707106781;\n var z11p2 = tmp7p2 + z3p2;\n var z13p2 = tmp7p2 - z3p2;\n data[dataOff + 40] = z13p2 + z2p2;\n data[dataOff + 24] = z13p2 - z2p2;\n data[dataOff + 8] = z11p2 + z4p2;\n data[dataOff + 56] = z11p2 - z4p2;\n dataOff++;\n }\n var fDCTQuant2;\n for (i = 0; i < I64; ++i) {\n fDCTQuant2 = data[i] * fdtbl[i];\n outputfDCTQuant[i] = fDCTQuant2 > 0 ? fDCTQuant2 + 0.5 | 0 : fDCTQuant2 - 0.5 | 0;\n }\n return outputfDCTQuant;\n }\n function writeAPP0() {\n writeWord(65504);\n writeWord(16);\n writeByte(74);\n writeByte(70);\n writeByte(73);\n writeByte(70);\n writeByte(0);\n writeByte(1);\n writeByte(1);\n writeByte(0);\n writeWord(1);\n writeWord(1);\n writeByte(0);\n writeByte(0);\n }\n function writeAPP1(exifBuffer) {\n if (!exifBuffer)\n return;\n writeWord(65505);\n if (exifBuffer[0] === 69 && exifBuffer[1] === 120 && exifBuffer[2] === 105 && exifBuffer[3] === 102) {\n writeWord(exifBuffer.length + 2);\n } else {\n writeWord(exifBuffer.length + 5 + 2);\n writeByte(69);\n writeByte(120);\n writeByte(105);\n writeByte(102);\n writeByte(0);\n }\n for (var i = 0; i < exifBuffer.length; i++) {\n writeByte(exifBuffer[i]);\n }\n }\n function writeSOF0(width, height) {\n writeWord(65472);\n writeWord(17);\n writeByte(8);\n writeWord(height);\n writeWord(width);\n writeByte(3);\n writeByte(1);\n writeByte(17);\n writeByte(0);\n writeByte(2);\n writeByte(17);\n writeByte(1);\n writeByte(3);\n writeByte(17);\n writeByte(1);\n }\n function writeDQT() {\n writeWord(65499);\n writeWord(132);\n writeByte(0);\n for (var i = 0; i < 64; i++) {\n writeByte(YTable[i]);\n }\n writeByte(1);\n for (var j = 0; j < 64; j++) {\n writeByte(UVTable[j]);\n }\n }\n function writeDHT() {\n writeWord(65476);\n writeWord(418);\n writeByte(0);\n for (var i = 0; i < 16; i++) {\n writeByte(std_dc_luminance_nrcodes2[i + 1]);\n }\n for (var j = 0; j <= 11; j++) {\n writeByte(std_dc_luminance_values2[j]);\n }\n writeByte(16);\n for (var k = 0; k < 16; k++) {\n writeByte(std_ac_luminance_nrcodes2[k + 1]);\n }\n for (var l = 0; l <= 161; l++) {\n writeByte(std_ac_luminance_values2[l]);\n }\n writeByte(1);\n for (var m = 0; m < 16; m++) {\n writeByte(std_dc_chrominance_nrcodes2[m + 1]);\n }\n for (var n = 0; n <= 11; n++) {\n writeByte(std_dc_chrominance_values2[n]);\n }\n writeByte(17);\n for (var o = 0; o < 16; o++) {\n writeByte(std_ac_chrominance_nrcodes2[o + 1]);\n }\n for (var p = 0; p <= 161; p++) {\n writeByte(std_ac_chrominance_values2[p]);\n }\n }\n function writeCOM(comments) {\n if (typeof comments === "undefined" || comments.constructor !== Array)\n return;\n comments.forEach((e) => {\n if (typeof e !== "string")\n return;\n writeWord(65534);\n var l = e.length;\n writeWord(l + 2);\n var i;\n for (i = 0; i < l; i++)\n writeByte(e.charCodeAt(i));\n });\n }\n function writeSOS() {\n writeWord(65498);\n writeWord(12);\n writeByte(3);\n writeByte(1);\n writeByte(0);\n writeByte(2);\n writeByte(17);\n writeByte(3);\n writeByte(17);\n writeByte(0);\n writeByte(63);\n writeByte(0);\n }\n function processDU(CDU, fdtbl, DC, HTDC, HTAC) {\n var EOB = HTAC[0];\n var M16zeroes = HTAC[240];\n var pos;\n var I16 = 16;\n var I63 = 63;\n var I64 = 64;\n var DU_DCT = fDCTQuant(CDU, fdtbl);\n for (var j = 0; j < I64; ++j) {\n DU[ZigZag[j]] = DU_DCT[j];\n }\n var Diff = DU[0] - DC;\n DC = DU[0];\n if (Diff == 0) {\n writeBits(HTDC[0]);\n } else {\n pos = 32767 + Diff;\n writeBits(HTDC[category2[pos]]);\n writeBits(bitcode2[pos]);\n }\n var end0pos = 63;\n for (; end0pos > 0 && DU[end0pos] == 0; end0pos--) {\n }\n ;\n if (end0pos == 0) {\n writeBits(EOB);\n return DC;\n }\n var i = 1;\n var lng;\n while (i <= end0pos) {\n var startpos = i;\n for (; DU[i] == 0 && i <= end0pos; ++i) {\n }\n var nrzeroes = i - startpos;\n if (nrzeroes >= I16) {\n lng = nrzeroes >> 4;\n for (var nrmarker = 1; nrmarker <= lng; ++nrmarker)\n writeBits(M16zeroes);\n nrzeroes = nrzeroes & 15;\n }\n pos = 32767 + DU[i];\n writeBits(HTAC[(nrzeroes << 4) + category2[pos]]);\n writeBits(bitcode2[pos]);\n i++;\n }\n if (end0pos != I63) {\n writeBits(EOB);\n }\n return DC;\n }\n function initCharLookupTable() {\n var sfcc = String.fromCharCode;\n for (var i = 0; i < 256; i++) {\n clt[i] = sfcc(i);\n }\n }\n this.encode = function(image, quality2) {\n var time_start = new Date().getTime();\n if (quality2)\n setQuality(quality2);\n byteout = new Array();\n bytenew = 0;\n bytepos = 7;\n writeWord(65496);\n writeAPP0();\n writeCOM(image.comments);\n writeAPP1(image.exifBuffer);\n writeDQT();\n writeSOF0(image.width, image.height);\n writeDHT();\n writeSOS();\n var DCY = 0;\n var DCU = 0;\n var DCV = 0;\n bytenew = 0;\n bytepos = 7;\n this.encode.displayName = "_encode_";\n var imageData = image.data;\n var width = image.width;\n var height = image.height;\n var quadWidth = width * 4;\n var tripleWidth = width * 3;\n var x, y = 0;\n var r, g, b;\n var start, p, col, row, pos;\n while (y < height) {\n x = 0;\n while (x < quadWidth) {\n start = quadWidth * y + x;\n p = start;\n col = -1;\n row = 0;\n for (pos = 0; pos < 64; pos++) {\n row = pos >> 3;\n col = (pos & 7) * 4;\n p = start + row * quadWidth + col;\n if (y + row >= height) {\n p -= quadWidth * (y + 1 + row - height);\n }\n if (x + col >= quadWidth) {\n p -= x + col - quadWidth + 4;\n }\n r = imageData[p++];\n g = imageData[p++];\n b = imageData[p++];\n YDU[pos] = (RGB_YUV_TABLE[r] + RGB_YUV_TABLE[g + 256 >> 0] + RGB_YUV_TABLE[b + 512 >> 0] >> 16) - 128;\n UDU[pos] = (RGB_YUV_TABLE[r + 768 >> 0] + RGB_YUV_TABLE[g + 1024 >> 0] + RGB_YUV_TABLE[b + 1280 >> 0] >> 16) - 128;\n VDU[pos] = (RGB_YUV_TABLE[r + 1280 >> 0] + RGB_YUV_TABLE[g + 1536 >> 0] + RGB_YUV_TABLE[b + 1792 >> 0] >> 16) - 128;\n }\n DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT2, YAC_HT2);\n DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT2, UVAC_HT2);\n DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT2, UVAC_HT2);\n x += 32;\n }\n y += 8;\n }\n if (bytepos >= 0) {\n var fillbits = [];\n fillbits[1] = bytepos + 1;\n fillbits[0] = (1 << bytepos + 1) - 1;\n writeBits(fillbits);\n }\n writeWord(65497);\n if (typeof module === "undefined")\n return new Uint8Array(byteout);\n return Buffer2.from(byteout);\n var jpegDataUri = "data:image/jpeg;base64," + btoa(byteout.join(""));\n byteout = [];\n var duration = new Date().getTime() - time_start;\n return jpegDataUri;\n };\n function setQuality(quality2) {\n if (quality2 <= 0) {\n quality2 = 1;\n }\n if (quality2 > 100) {\n quality2 = 100;\n }\n if (currentQuality == quality2)\n return;\n var sf = 0;\n if (quality2 < 50) {\n sf = Math.floor(5e3 / quality2);\n } else {\n sf = Math.floor(200 - quality2 * 2);\n }\n initQuantTables(sf);\n currentQuality = quality2;\n }\n function init2() {\n var time_start = new Date().getTime();\n if (!quality)\n quality = 50;\n initCharLookupTable();\n initHuffmanTbl();\n initCategoryNumber();\n initRGBYUVTable();\n setQuality(quality);\n var duration = new Date().getTime() - time_start;\n }\n init2();\n }\n if (typeof module !== "undefined") {\n module.exports = encode2;\n } else if (typeof window !== "undefined") {\n window["jpeg-js"] = window["jpeg-js"] || {};\n window["jpeg-js"].encode = encode2;\n }\n function encode2(imgData, qu) {\n if (typeof qu === "undefined")\n qu = 50;\n var encoder = new JPEGEncoder(qu);\n var data = encoder.encode(imgData, qu);\n return {\n data,\n width: imgData.width,\n height: imgData.height\n };\n }\n }\n});\n\n// node_modules/jpeg-js/lib/decoder.js\nvar require_decoder = __commonJS({\n "node_modules/jpeg-js/lib/decoder.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var JpegImage = function jpegImage() {\n "use strict";\n var dctZigZag = new Int32Array([\n 0,\n 1,\n 8,\n 16,\n 9,\n 2,\n 3,\n 10,\n 17,\n 24,\n 32,\n 25,\n 18,\n 11,\n 4,\n 5,\n 12,\n 19,\n 26,\n 33,\n 40,\n 48,\n 41,\n 34,\n 27,\n 20,\n 13,\n 6,\n 7,\n 14,\n 21,\n 28,\n 35,\n 42,\n 49,\n 56,\n 57,\n 50,\n 43,\n 36,\n 29,\n 22,\n 15,\n 23,\n 30,\n 37,\n 44,\n 51,\n 58,\n 59,\n 52,\n 45,\n 38,\n 31,\n 39,\n 46,\n 53,\n 60,\n 61,\n 54,\n 47,\n 55,\n 62,\n 63\n ]);\n var dctCos1 = 4017;\n var dctSin1 = 799;\n var dctCos3 = 3406;\n var dctSin3 = 2276;\n var dctCos6 = 1567;\n var dctSin6 = 3784;\n var dctSqrt2 = 5793;\n var dctSqrt1d2 = 2896;\n function constructor() {\n }\n function buildHuffmanTable2(codeLengths, values) {\n var k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({ children: [], index: 0 });\n var p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error("Could not recreate Huffman Table");\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n }\n function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, opts) {\n var precision = frame.precision;\n var samplesPerLine = frame.samplesPerLine;\n var scanLines = frame.scanLines;\n var mcusPerLine = frame.mcusPerLine;\n var progressive = frame.progressive;\n var maxH = frame.maxH, maxV = frame.maxV;\n var startOffset = offset, bitsData = 0, bitsCount = 0;\n function readBit() {\n if (bitsCount > 0) {\n bitsCount--;\n return bitsData >> bitsCount & 1;\n }\n bitsData = data[offset++];\n if (bitsData == 255) {\n var nextByte = data[offset++];\n if (nextByte) {\n throw new Error("unexpected marker: " + (bitsData << 8 | nextByte).toString(16));\n }\n }\n bitsCount = 7;\n return bitsData >>> 7;\n }\n function decodeHuffman(tree) {\n var node = tree, bit;\n while ((bit = readBit()) !== null) {\n node = node[bit];\n if (typeof node === "number")\n return node;\n if (typeof node !== "object")\n throw new Error("invalid huffman sequence");\n }\n return null;\n }\n function receive(length) {\n var n2 = 0;\n while (length > 0) {\n var bit = readBit();\n if (bit === null)\n return;\n n2 = n2 << 1 | bit;\n length--;\n }\n return n2;\n }\n function receiveAndExtend(length) {\n var n2 = receive(length);\n if (n2 >= 1 << length - 1)\n return n2;\n return n2 + (-1 << length) + 1;\n }\n function decodeBaseline(component2, zz) {\n var t = decodeHuffman(component2.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t);\n zz[0] = component2.pred += diff;\n var k2 = 1;\n while (k2 < 64) {\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15)\n break;\n k2 += 16;\n continue;\n }\n k2 += r;\n var z = dctZigZag[k2];\n zz[z] = receiveAndExtend(s);\n k2++;\n }\n }\n function decodeDCFirst(component2, zz) {\n var t = decodeHuffman(component2.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;\n zz[0] = component2.pred += diff;\n }\n function decodeDCSuccessive(component2, zz) {\n zz[0] |= readBit() << successive;\n }\n var eobrun = 0;\n function decodeACFirst(component2, zz) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k2 = spectralStart, e = spectralEnd;\n while (k2 <= e) {\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r) - 1;\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n var z = dctZigZag[k2];\n zz[z] = receiveAndExtend(s) * (1 << successive);\n k2++;\n }\n }\n var successiveACState = 0, successiveACNextValue;\n function decodeACSuccessive(component2, zz) {\n var k2 = spectralStart, e = spectralEnd, r = 0;\n while (k2 <= e) {\n var z = dctZigZag[k2];\n var direction = zz[z] < 0 ? -1 : 1;\n switch (successiveACState) {\n case 0:\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r);\n successiveACState = 4;\n } else {\n r = 16;\n successiveACState = 1;\n }\n } else {\n if (s !== 1)\n throw new Error("invalid ACn encoding");\n successiveACNextValue = receiveAndExtend(s);\n successiveACState = r ? 2 : 3;\n }\n continue;\n case 1:\n case 2:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n r--;\n if (r === 0)\n successiveACState = successiveACState == 2 ? 3 : 0;\n }\n break;\n case 3:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n zz[z] = successiveACNextValue << successive;\n successiveACState = 0;\n }\n break;\n case 4:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n break;\n }\n k2++;\n }\n if (successiveACState === 4) {\n eobrun--;\n if (eobrun === 0)\n successiveACState = 0;\n }\n }\n function decodeMcu(component2, decode4, mcu2, row, col) {\n var mcuRow = mcu2 / mcusPerLine | 0;\n var mcuCol = mcu2 % mcusPerLine;\n var blockRow = mcuRow * component2.v + row;\n var blockCol = mcuCol * component2.h + col;\n if (component2.blocks[blockRow] === void 0 && opts.tolerantDecoding)\n return;\n decode4(component2, component2.blocks[blockRow][blockCol]);\n }\n function decodeBlock(component2, decode4, mcu2) {\n var blockRow = mcu2 / component2.blocksPerLine | 0;\n var blockCol = mcu2 % component2.blocksPerLine;\n if (component2.blocks[blockRow] === void 0 && opts.tolerantDecoding)\n return;\n decode4(component2, component2.blocks[blockRow][blockCol]);\n }\n var componentsLength = components.length;\n var component, i, j, k, n;\n var decodeFn;\n if (progressive) {\n if (spectralStart === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n var mcu = 0, marker;\n var mcuExpected;\n if (componentsLength == 1) {\n mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;\n } else {\n mcuExpected = mcusPerLine * frame.mcusPerColumn;\n }\n if (!resetInterval)\n resetInterval = mcuExpected;\n var h, v;\n while (mcu < mcuExpected) {\n for (i = 0; i < componentsLength; i++)\n components[i].pred = 0;\n eobrun = 0;\n if (componentsLength == 1) {\n component = components[0];\n for (n = 0; n < resetInterval; n++) {\n decodeBlock(component, decodeFn, mcu);\n mcu++;\n }\n } else {\n for (n = 0; n < resetInterval; n++) {\n for (i = 0; i < componentsLength; i++) {\n component = components[i];\n h = component.h;\n v = component.v;\n for (j = 0; j < v; j++) {\n for (k = 0; k < h; k++) {\n decodeMcu(component, decodeFn, mcu, j, k);\n }\n }\n }\n mcu++;\n if (mcu === mcuExpected)\n break;\n }\n }\n if (mcu === mcuExpected) {\n do {\n if (data[offset] === 255) {\n if (data[offset + 1] !== 0) {\n break;\n }\n }\n offset += 1;\n } while (offset < data.length - 2);\n }\n bitsCount = 0;\n marker = data[offset] << 8 | data[offset + 1];\n if (marker < 65280) {\n throw new Error("marker was not found");\n }\n if (marker >= 65488 && marker <= 65495) {\n offset += 2;\n } else\n break;\n }\n return offset - startOffset;\n }\n function buildComponentData(frame, component) {\n var lines = [];\n var blocksPerLine = component.blocksPerLine;\n var blocksPerColumn = component.blocksPerColumn;\n var samplesPerLine = blocksPerLine << 3;\n var R = new Int32Array(64), r = new Uint8Array(64);\n function quantizeAndInverse(zz, dataOut, dataIn) {\n var qt = component.quantizationTable;\n var v0, v1, v2, v3, v4, v5, v6, v7, t;\n var p = dataIn;\n var i2;\n for (i2 = 0; i2 < 64; i2++)\n p[i2] = zz[i2] * qt[i2];\n for (i2 = 0; i2 < 8; ++i2) {\n var row = 8 * i2;\n if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 && p[4 + row] == 0 && p[5 + row] == 0 && p[6 + row] == 0 && p[7 + row] == 0) {\n t = dctSqrt2 * p[0 + row] + 512 >> 10;\n p[0 + row] = t;\n p[1 + row] = t;\n p[2 + row] = t;\n p[3 + row] = t;\n p[4 + row] = t;\n p[5 + row] = t;\n p[6 + row] = t;\n p[7 + row] = t;\n continue;\n }\n v0 = dctSqrt2 * p[0 + row] + 128 >> 8;\n v1 = dctSqrt2 * p[4 + row] + 128 >> 8;\n v2 = p[2 + row];\n v3 = p[6 + row];\n v4 = dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128 >> 8;\n v7 = dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128 >> 8;\n v5 = p[3 + row] << 4;\n v6 = p[5 + row] << 4;\n t = v0 - v1 + 1 >> 1;\n v0 = v0 + v1 + 1 >> 1;\n v1 = t;\n t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;\n v3 = t;\n t = v4 - v6 + 1 >> 1;\n v4 = v4 + v6 + 1 >> 1;\n v6 = t;\n t = v7 + v5 + 1 >> 1;\n v5 = v7 - v5 + 1 >> 1;\n v7 = t;\n t = v0 - v3 + 1 >> 1;\n v0 = v0 + v3 + 1 >> 1;\n v3 = t;\n t = v1 - v2 + 1 >> 1;\n v1 = v1 + v2 + 1 >> 1;\n v2 = t;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[0 + row] = v0 + v7;\n p[7 + row] = v0 - v7;\n p[1 + row] = v1 + v6;\n p[6 + row] = v1 - v6;\n p[2 + row] = v2 + v5;\n p[5 + row] = v2 - v5;\n p[3 + row] = v3 + v4;\n p[4 + row] = v3 - v4;\n }\n for (i2 = 0; i2 < 8; ++i2) {\n var col = i2;\n if (p[1 * 8 + col] == 0 && p[2 * 8 + col] == 0 && p[3 * 8 + col] == 0 && p[4 * 8 + col] == 0 && p[5 * 8 + col] == 0 && p[6 * 8 + col] == 0 && p[7 * 8 + col] == 0) {\n t = dctSqrt2 * dataIn[i2 + 0] + 8192 >> 14;\n p[0 * 8 + col] = t;\n p[1 * 8 + col] = t;\n p[2 * 8 + col] = t;\n p[3 * 8 + col] = t;\n p[4 * 8 + col] = t;\n p[5 * 8 + col] = t;\n p[6 * 8 + col] = t;\n p[7 * 8 + col] = t;\n continue;\n }\n v0 = dctSqrt2 * p[0 * 8 + col] + 2048 >> 12;\n v1 = dctSqrt2 * p[4 * 8 + col] + 2048 >> 12;\n v2 = p[2 * 8 + col];\n v3 = p[6 * 8 + col];\n v4 = dctSqrt1d2 * (p[1 * 8 + col] - p[7 * 8 + col]) + 2048 >> 12;\n v7 = dctSqrt1d2 * (p[1 * 8 + col] + p[7 * 8 + col]) + 2048 >> 12;\n v5 = p[3 * 8 + col];\n v6 = p[5 * 8 + col];\n t = v0 - v1 + 1 >> 1;\n v0 = v0 + v1 + 1 >> 1;\n v1 = t;\n t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;\n v3 = t;\n t = v4 - v6 + 1 >> 1;\n v4 = v4 + v6 + 1 >> 1;\n v6 = t;\n t = v7 + v5 + 1 >> 1;\n v5 = v7 - v5 + 1 >> 1;\n v7 = t;\n t = v0 - v3 + 1 >> 1;\n v0 = v0 + v3 + 1 >> 1;\n v3 = t;\n t = v1 - v2 + 1 >> 1;\n v1 = v1 + v2 + 1 >> 1;\n v2 = t;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[0 * 8 + col] = v0 + v7;\n p[7 * 8 + col] = v0 - v7;\n p[1 * 8 + col] = v1 + v6;\n p[6 * 8 + col] = v1 - v6;\n p[2 * 8 + col] = v2 + v5;\n p[5 * 8 + col] = v2 - v5;\n p[3 * 8 + col] = v3 + v4;\n p[4 * 8 + col] = v3 - v4;\n }\n for (i2 = 0; i2 < 64; ++i2) {\n var sample2 = 128 + (p[i2] + 8 >> 4);\n dataOut[i2] = sample2 < 0 ? 0 : sample2 > 255 ? 255 : sample2;\n }\n }\n requestMemoryAllocation(samplesPerLine * blocksPerColumn * 8);\n var i, j;\n for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {\n var scanLine = blockRow << 3;\n for (i = 0; i < 8; i++)\n lines.push(new Uint8Array(samplesPerLine));\n for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {\n quantizeAndInverse(component.blocks[blockRow][blockCol], r, R);\n var offset = 0, sample = blockCol << 3;\n for (j = 0; j < 8; j++) {\n var line = lines[scanLine + j];\n for (i = 0; i < 8; i++)\n line[sample + i] = r[offset++];\n }\n }\n }\n return lines;\n }\n function clampTo8bit(a) {\n return a < 0 ? 0 : a > 255 ? 255 : a;\n }\n constructor.prototype = {\n load: function load(path) {\n var xhr = new XMLHttpRequest();\n xhr.open("GET", path, true);\n xhr.responseType = "arraybuffer";\n xhr.onload = function() {\n var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);\n this.parse(data);\n if (this.onload)\n this.onload();\n }.bind(this);\n xhr.send(null);\n },\n parse: function parse(data) {\n var maxResolutionInPixels = this.opts.maxResolutionInMP * 1e3 * 1e3;\n var offset = 0, length = data.length;\n function readUint16() {\n var value = data[offset] << 8 | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length2 = readUint16();\n var array = data.subarray(offset, offset + length2 - 2);\n offset += array.length;\n return array;\n }\n function prepareComponents(frame2) {\n var maxH2 = 1, maxV2 = 1;\n var component2, componentId2;\n for (componentId2 in frame2.components) {\n if (frame2.components.hasOwnProperty(componentId2)) {\n component2 = frame2.components[componentId2];\n if (maxH2 < component2.h)\n maxH2 = component2.h;\n if (maxV2 < component2.v)\n maxV2 = component2.v;\n }\n }\n var mcusPerLine = Math.ceil(frame2.samplesPerLine / 8 / maxH2);\n var mcusPerColumn = Math.ceil(frame2.scanLines / 8 / maxV2);\n for (componentId2 in frame2.components) {\n if (frame2.components.hasOwnProperty(componentId2)) {\n component2 = frame2.components[componentId2];\n var blocksPerLine = Math.ceil(Math.ceil(frame2.samplesPerLine / 8) * component2.h / maxH2);\n var blocksPerColumn = Math.ceil(Math.ceil(frame2.scanLines / 8) * component2.v / maxV2);\n var blocksPerLineForMcu = mcusPerLine * component2.h;\n var blocksPerColumnForMcu = mcusPerColumn * component2.v;\n var blocksToAllocate = blocksPerColumnForMcu * blocksPerLineForMcu;\n var blocks = [];\n requestMemoryAllocation(blocksToAllocate * 256);\n for (var i2 = 0; i2 < blocksPerColumnForMcu; i2++) {\n var row = [];\n for (var j2 = 0; j2 < blocksPerLineForMcu; j2++)\n row.push(new Int32Array(64));\n blocks.push(row);\n }\n component2.blocksPerLine = blocksPerLine;\n component2.blocksPerColumn = blocksPerColumn;\n component2.blocks = blocks;\n }\n }\n frame2.maxH = maxH2;\n frame2.maxV = maxV2;\n frame2.mcusPerLine = mcusPerLine;\n frame2.mcusPerColumn = mcusPerColumn;\n }\n var jfif = null;\n var adobe = null;\n var pixels = null;\n var frame, resetInterval;\n var quantizationTables = [], frames = [];\n var huffmanTablesAC = [], huffmanTablesDC = [];\n var fileMarker = readUint16();\n var malformedDataOffset = -1;\n this.comments = [];\n if (fileMarker != 65496) {\n throw new Error("SOI not found");\n }\n fileMarker = readUint16();\n while (fileMarker != 65497) {\n var i, j, l;\n switch (fileMarker) {\n case 65280:\n break;\n case 65504:\n case 65505:\n case 65506:\n case 65507:\n case 65508:\n case 65509:\n case 65510:\n case 65511:\n case 65512:\n case 65513:\n case 65514:\n case 65515:\n case 65516:\n case 65517:\n case 65518:\n case 65519:\n case 65534:\n var appData = readDataBlock();\n if (fileMarker === 65534) {\n var comment = String.fromCharCode.apply(null, appData);\n this.comments.push(comment);\n }\n if (fileMarker === 65504) {\n if (appData[0] === 74 && appData[1] === 70 && appData[2] === 73 && appData[3] === 70 && appData[4] === 0) {\n jfif = {\n version: { major: appData[5], minor: appData[6] },\n densityUnits: appData[7],\n xDensity: appData[8] << 8 | appData[9],\n yDensity: appData[10] << 8 | appData[11],\n thumbWidth: appData[12],\n thumbHeight: appData[13],\n thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])\n };\n }\n }\n if (fileMarker === 65505) {\n if (appData[0] === 69 && appData[1] === 120 && appData[2] === 105 && appData[3] === 102 && appData[4] === 0) {\n this.exifBuffer = appData.subarray(5, appData.length);\n }\n }\n if (fileMarker === 65518) {\n if (appData[0] === 65 && appData[1] === 100 && appData[2] === 111 && appData[3] === 98 && appData[4] === 101 && appData[5] === 0) {\n adobe = {\n version: appData[6],\n flags0: appData[7] << 8 | appData[8],\n flags1: appData[9] << 8 | appData[10],\n transformCode: appData[11]\n };\n }\n }\n break;\n case 65499:\n var quantizationTablesLength = readUint16();\n var quantizationTablesEnd = quantizationTablesLength + offset - 2;\n while (offset < quantizationTablesEnd) {\n var quantizationTableSpec = data[offset++];\n requestMemoryAllocation(64 * 4);\n var tableData = new Int32Array(64);\n if (quantizationTableSpec >> 4 === 0) {\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = data[offset++];\n }\n } else if (quantizationTableSpec >> 4 === 1) {\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = readUint16();\n }\n } else\n throw new Error("DQT: invalid table spec");\n quantizationTables[quantizationTableSpec & 15] = tableData;\n }\n break;\n case 65472:\n case 65473:\n case 65474:\n readUint16();\n frame = {};\n frame.extended = fileMarker === 65473;\n frame.progressive = fileMarker === 65474;\n frame.precision = data[offset++];\n frame.scanLines = readUint16();\n frame.samplesPerLine = readUint16();\n frame.components = {};\n frame.componentsOrder = [];\n var pixelsInFrame = frame.scanLines * frame.samplesPerLine;\n if (pixelsInFrame > maxResolutionInPixels) {\n var exceededAmount = Math.ceil((pixelsInFrame - maxResolutionInPixels) / 1e6);\n throw new Error(`maxResolutionInMP limit exceeded by ${exceededAmount}MP`);\n }\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n var qId = data[offset + 2];\n if (h <= 0 || v <= 0) {\n throw new Error("Invalid sampling factor, expected values above 0");\n }\n frame.componentsOrder.push(componentId);\n frame.components[componentId] = {\n h,\n v,\n quantizationIdx: qId\n };\n offset += 3;\n }\n prepareComponents(frame);\n frames.push(frame);\n break;\n case 65476:\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength; ) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++) {\n codeLengthSum += codeLengths[j] = data[offset];\n }\n requestMemoryAllocation(16 + codeLengthSum);\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable2(codeLengths, huffmanValues);\n }\n break;\n case 65501:\n readUint16();\n resetInterval = readUint16();\n break;\n case 65500:\n readUint16();\n readUint16();\n break;\n case 65498:\n var scanLength = readUint16();\n var selectorsCount = data[offset++];\n var components = [], component;\n for (i = 0; i < selectorsCount; i++) {\n component = frame.components[data[offset++]];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, this.opts);\n offset += processed;\n break;\n case 65535:\n if (data[offset] !== 255) {\n offset--;\n }\n break;\n default:\n if (data[offset - 3] == 255 && data[offset - 2] >= 192 && data[offset - 2] <= 254) {\n offset -= 3;\n break;\n } else if (fileMarker === 224 || fileMarker == 225) {\n if (malformedDataOffset !== -1) {\n throw new Error(`first unknown JPEG marker at offset ${malformedDataOffset.toString(16)}, second unknown JPEG marker ${fileMarker.toString(16)} at offset ${(offset - 1).toString(16)}`);\n }\n malformedDataOffset = offset - 1;\n const nextOffset = readUint16();\n if (data[offset + nextOffset - 2] === 255) {\n offset += nextOffset - 2;\n break;\n }\n }\n throw new Error("unknown JPEG marker " + fileMarker.toString(16));\n }\n fileMarker = readUint16();\n }\n if (frames.length != 1)\n throw new Error("only single frame JPEGs supported");\n for (var i = 0; i < frames.length; i++) {\n var cp = frames[i].components;\n for (var j in cp) {\n cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx];\n delete cp[j].quantizationIdx;\n }\n }\n this.width = frame.samplesPerLine;\n this.height = frame.scanLines;\n this.jfif = jfif;\n this.adobe = adobe;\n this.components = [];\n for (var i = 0; i < frame.componentsOrder.length; i++) {\n var component = frame.components[frame.componentsOrder[i]];\n this.components.push({\n lines: buildComponentData(frame, component),\n scaleX: component.h / frame.maxH,\n scaleY: component.v / frame.maxV\n });\n }\n },\n getData: function getData(width, height) {\n var scaleX = this.width / width, scaleY = this.height / height;\n var component1, component2, component3, component4;\n var component1Line, component2Line, component3Line, component4Line;\n var x, y;\n var offset = 0;\n var Y, Cb, Cr, K, C, M, Ye, R, G, B;\n var colorTransform;\n var dataLength = width * height * this.components.length;\n requestMemoryAllocation(dataLength);\n var data = new Uint8Array(dataLength);\n switch (this.components.length) {\n case 1:\n component1 = this.components[0];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n data[offset++] = Y;\n }\n }\n break;\n case 2:\n component1 = this.components[0];\n component2 = this.components[1];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n data[offset++] = Y;\n Y = component2Line[0 | x * component2.scaleX * scaleX];\n data[offset++] = Y;\n }\n }\n break;\n case 3:\n colorTransform = true;\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== "undefined")\n colorTransform = !!this.opts.colorTransform;\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n component3Line = component3.lines[0 | y * component3.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n R = component1Line[0 | x * component1.scaleX * scaleX];\n G = component2Line[0 | x * component2.scaleX * scaleX];\n B = component3Line[0 | x * component3.scaleX * scaleX];\n } else {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n Cb = component2Line[0 | x * component2.scaleX * scaleX];\n Cr = component3Line[0 | x * component3.scaleX * scaleX];\n R = clampTo8bit(Y + 1.402 * (Cr - 128));\n G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n B = clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = R;\n data[offset++] = G;\n data[offset++] = B;\n }\n }\n break;\n case 4:\n if (!this.adobe)\n throw new Error("Unsupported color mode (4 components)");\n colorTransform = false;\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== "undefined")\n colorTransform = !!this.opts.colorTransform;\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n component4 = this.components[3];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n component3Line = component3.lines[0 | y * component3.scaleY * scaleY];\n component4Line = component4.lines[0 | y * component4.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n C = component1Line[0 | x * component1.scaleX * scaleX];\n M = component2Line[0 | x * component2.scaleX * scaleX];\n Ye = component3Line[0 | x * component3.scaleX * scaleX];\n K = component4Line[0 | x * component4.scaleX * scaleX];\n } else {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n Cb = component2Line[0 | x * component2.scaleX * scaleX];\n Cr = component3Line[0 | x * component3.scaleX * scaleX];\n K = component4Line[0 | x * component4.scaleX * scaleX];\n C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128));\n M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = 255 - C;\n data[offset++] = 255 - M;\n data[offset++] = 255 - Ye;\n data[offset++] = 255 - K;\n }\n }\n break;\n default:\n throw new Error("Unsupported color mode");\n }\n return data;\n },\n copyToImageData: function copyToImageData(imageData, formatAsRGBA) {\n var width = imageData.width, height = imageData.height;\n var imageDataArray = imageData.data;\n var data = this.getData(width, height);\n var i = 0, j = 0, x, y;\n var Y, K, C, M, R, G, B;\n switch (this.components.length) {\n case 1:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n Y = data[i++];\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 3:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n R = data[i++];\n G = data[i++];\n B = data[i++];\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 4:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n C = data[i++];\n M = data[i++];\n Y = data[i++];\n K = data[i++];\n R = 255 - clampTo8bit(C * (1 - K / 255) + K);\n G = 255 - clampTo8bit(M * (1 - K / 255) + K);\n B = 255 - clampTo8bit(Y * (1 - K / 255) + K);\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n default:\n throw new Error("Unsupported color mode");\n }\n }\n };\n var totalBytesAllocated = 0;\n var maxMemoryUsageBytes = 0;\n function requestMemoryAllocation(increaseAmount = 0) {\n var totalMemoryImpactBytes = totalBytesAllocated + increaseAmount;\n if (totalMemoryImpactBytes > maxMemoryUsageBytes) {\n var exceededAmount = Math.ceil((totalMemoryImpactBytes - maxMemoryUsageBytes) / 1024 / 1024);\n throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB`);\n }\n totalBytesAllocated = totalMemoryImpactBytes;\n }\n constructor.resetMaxMemoryUsage = function(maxMemoryUsageBytes_) {\n totalBytesAllocated = 0;\n maxMemoryUsageBytes = maxMemoryUsageBytes_;\n };\n constructor.getBytesAllocated = function() {\n return totalBytesAllocated;\n };\n constructor.requestMemoryAllocation = requestMemoryAllocation;\n return constructor;\n }();\n if (typeof module !== "undefined") {\n module.exports = decode3;\n } else if (typeof window !== "undefined") {\n window["jpeg-js"] = window["jpeg-js"] || {};\n window["jpeg-js"].decode = decode3;\n }\n function decode3(jpegData, userOpts = {}) {\n var defaultOpts = {\n colorTransform: void 0,\n useTArray: false,\n formatAsRGBA: true,\n tolerantDecoding: true,\n maxResolutionInMP: 100,\n maxMemoryUsageInMB: 512\n };\n var opts = { ...defaultOpts, ...userOpts };\n var arr = new Uint8Array(jpegData);\n var decoder = new JpegImage();\n decoder.opts = opts;\n JpegImage.resetMaxMemoryUsage(opts.maxMemoryUsageInMB * 1024 * 1024);\n decoder.parse(arr);\n var channels = opts.formatAsRGBA ? 4 : 3;\n var bytesNeeded = decoder.width * decoder.height * channels;\n try {\n JpegImage.requestMemoryAllocation(bytesNeeded);\n var image = {\n width: decoder.width,\n height: decoder.height,\n exifBuffer: decoder.exifBuffer,\n data: opts.useTArray ? new Uint8Array(bytesNeeded) : Buffer2.alloc(bytesNeeded)\n };\n if (decoder.comments.length > 0) {\n image["comments"] = decoder.comments;\n }\n } catch (err) {\n if (err instanceof RangeError) {\n throw new Error("Could not allocate enough memory for the image. Required: " + bytesNeeded);\n }\n if (err instanceof ReferenceError) {\n if (err.message === "Buffer is not defined") {\n throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");\n }\n }\n throw err;\n }\n decoder.copyToImageData(image, opts.formatAsRGBA);\n return image;\n }\n }\n});\n\n// node_modules/jpeg-js/index.js\nvar require_jpeg_js = __commonJS({\n "node_modules/jpeg-js/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var encode2 = require_encoder();\n var decode3 = require_decoder();\n module.exports = {\n encode: encode2,\n decode: decode3\n };\n }\n});\n\n// src/processor.worker.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// src/platform.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// src/requests.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar xmlhttprequest;\nif (false)\n xmlhttprequest = typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : typeof GM != "undefined" ? GM.xmlHttpRequest : window["GM_xmlhttpRequest"];\nvar GM_fetch = (...[url, opt, lisn]) => {\n function blobTo(to, blob) {\n if (to == "arrayBuffer" && blob.arrayBuffer) {\n const ret = blob.arrayBuffer();\n if (ret)\n return ret;\n }\n return new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = function(event) {\n if (!event)\n return;\n if (to == "base64")\n resolve(event.target.result);\n else\n resolve(event.target.result);\n };\n if (to == "arrayBuffer")\n fileReader.readAsArrayBuffer(blob);\n else if (to == "base64")\n fileReader.readAsDataURL(blob);\n else if (to == "text")\n fileReader.readAsText(blob, "utf-8");\n else\n reject(new Error("unknown to"));\n });\n }\n return new Promise((resolve, reject) => {\n const gmopt = {\n url: url.toString(),\n data: opt?.body,\n responseType: "blob",\n headers: opt?.headers,\n method: opt?.method || "GET",\n ...lisn ? {\n onprogress: (prog) => {\n if (prog.loaded != prog.total && prog.total != 0)\n lisn.dispatchEvent(new CustomEvent("progress", { detail: [prog.loaded, prog.total] }));\n }\n } : {},\n onload: (resp) => {\n if (resp.status / 100 >= 4) {\n reject(new Error("Server Error: " + resp.status));\n return;\n }\n const blob = resp.response;\n const ref = resp;\n ref.blob = () => Promise.resolve(blob);\n ref.arrayBuffer = () => blobTo("arrayBuffer", blob);\n ref.text = () => blobTo("text", blob);\n ref.json = async () => JSON.parse(await blobTo("text", blob));\n resolve(resp);\n },\n ontimeout: () => reject(new Error("fetch timeout")),\n onerror: (...args) => {\n reject(new Error("fetch error"));\n },\n onabort: () => reject(new Error("fetch abort"))\n };\n xmlhttprequest(gmopt);\n });\n};\n\n// src/platform.ts\nvar lqueue = {};\nvar localLoad = (key2, def) => "__pee__" + key2 in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key2)) : def;\nvar localSet = (key2, value) => localStorage.setItem("__pee__" + key2, JSON.stringify(value));\nvar port1;\nconsole.log("worker", false);\nif (false) {\n const nmc = new MessageChannel();\n port1 = nmc.port1;\n port2 = nmc.port2;\n const iframe = document.createElement("iframe");\n iframe.style.display = "none";\n iframe.name = location.origin;\n const iframeloaded = new Promise((_) => {\n iframe.onload = _;\n });\n iframe.src = `${chrome.runtime.getURL("")}options.html`;\n document.documentElement.appendChild(iframe);\n iframeloaded.then(() => {\n iframe.contentWindow?.postMessage("", "*", [port2]);\n });\n port1.onmessage = (ev) => {\n lqueue[ev.data.id](ev.data);\n };\n}\nconsole.log("worker");\nif (true) {\n port1 = {\n onmessage(ev) {\n lqueue[ev.data.id](ev.data);\n },\n postMessage(msg, tr) {\n postMessage({\n type: "ipc",\n tr,\n msg\n }, tr);\n }\n };\n}\nvar gid = 0;\nvar sendCmd = (cmd, tr) => {\n const prom = new Promise((_) => {\n const id = gid++;\n lqueue[id] = (e) => {\n _(e);\n delete lqueue[id];\n };\n port1.postMessage({ id, ...cmd }, tr || []);\n });\n return prom;\n};\nvar bridge = (name, f) => {\n if (false)\n return f;\n return (...args) => {\n return sendCmd({ name, args });\n };\n};\nvar Bridged = (ctor) => {\n const keys = Object.getOwnPropertyNames(ctor).filter((k) => typeof ctor[k] == "function");\n for (const k of keys)\n ctor[k] = bridge(k, ctor[k]);\n};\nif (false) {\n popupport = chrome.runtime.connect({ name: "popup" });\n popupport.onMessage.addListener((msg) => {\n if (msg.id in pendingcmds) {\n pendingcmds[msg.id](msg);\n delete pendingcmds[msg.id];\n }\n });\n}\nvar Platform = class {\n static async openInTab(src, opts) {\n if (false) {\n return GM.openInTab(src, opts);\n }\n const obj = false ? chrome : browser;\n let i;\n if (opts.insert)\n i = (await obj.tabs.getCurrent()).index + 1;\n return obj.tabs.create({ active: opts.active, url: src, index: i });\n }\n static getValue(name, def) {\n return localLoad(name, def);\n }\n static setValue(name, val) {\n localSet(name, val);\n }\n};\nPlatform.cmdid = 0;\nPlatform = __decorateClass([\n Bridged\n], Platform);\nvar corsFetch = async (input, init2, lsn) => {\n const id = gid++;\n let transfer = [];\n if (init2?.body) {\n if (false) {\n [init2.body, transfer] = await braveserialize(init2.body);\n }\n }\n const prom = new Promise((_, rej) => {\n let gcontroller;\n let buffer = [];\n let finished = false;\n const rs = new ReadableStream({\n start(controller) {\n gcontroller = controller;\n buffer.forEach((b) => gcontroller?.enqueue(b));\n buffer = [];\n if (finished) {\n gcontroller.close();\n }\n }\n });\n let s;\n s = 0;\n const cmdbuff = [];\n lqueue[id] = async (e) => {\n if (e.progress) {\n if (lsn)\n lsn.dispatchEvent(new CustomEvent("progress", { detail: e.progress }));\n }\n if (e.pushData) {\n if (e.s > s) {\n let idx = 0;\n while (idx < cmdbuff.length) {\n if (cmdbuff[idx].s > e.s)\n break;\n idx++;\n }\n cmdbuff.splice(idx, 0, e);\n return;\n }\n const processCmd = (e2) => {\n if (e2.pushData.data) {\n const data = new Uint8Array(e2.pushData.data);\n if (gcontroller)\n gcontroller.enqueue(data);\n else\n buffer.push(data);\n } else {\n if (gcontroller)\n gcontroller?.close();\n else\n finished = true;\n }\n };\n await processCmd(e);\n s++;\n while (cmdbuff[0]?.s == s) {\n await processCmd(cmdbuff.shift());\n s++;\n }\n }\n if (e.setRes) {\n const arrayBuffer = async () => {\n const r = rs.getReader();\n await sendCmd({ name: "fullyRead", fid: id });\n const abs = [];\n let res;\n do {\n res = await r.read();\n if (res.done)\n break;\n abs.push(res.value);\n } while (!res.done);\n const sum = abs.reduce((a, b) => a + b.byteLength, 0);\n const ret = new Uint8Array(sum);\n abs.reduce((ptr, arr) => {\n ret.set(arr, ptr);\n return ptr + arr.byteLength;\n }, 0);\n r.releaseLock();\n return ret;\n };\n const blob = async () => new Blob([await arrayBuffer()]);\n const text = async () => new TextDecoder().decode(await arrayBuffer());\n const json = async () => JSON.parse(await text());\n if (e.ok)\n _({\n body: rs,\n ok: e.ok,\n headers: e.headers,\n redirected: e.redirected,\n type: e.type,\n url: e.url,\n status: e.status,\n bodyUsed: e.bodyUsed,\n statusText: e.statusText,\n clone() {\n return this;\n },\n arrayBuffer,\n blob,\n text,\n json,\n async formData() {\n return new FormData();\n }\n });\n else {\n rej(new Error(`${e.url} - ${e.status}`));\n }\n }\n };\n port1.postMessage({\n id,\n name: "corsFetch",\n args: [input, init2]\n }, transfer);\n });\n return prom;\n};\nasync function getHeaders(s) {\n if (false)\n return headerStringToObject(await GM_head(s));\n const res = await ifetch(s, {\n method: "HEAD"\n });\n return res.headers;\n}\nasync function ifetch(...[url, opt, lisn]) {\n if (true)\n return corsFetch(url.toString(), opt, lisn);\n return GM_fetch(url, opt, lisn);\n}\nasync function* streamRemote(url, chunkSize = 72 * 1024, fetchRestOnNonCanceled = true) {\n let size = Number.POSITIVE_INFINITY;\n let ptr = 0;\n let fetchSize = chunkSize;\n while (ptr != size) {\n let obj;\n const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } });\n if (false) {\n obj = headerStringToObject(fres.responseHeaders);\n } else {\n obj = fres.headers;\n }\n if (!("content-length" in obj)) {\n console.warn("no content lenght???", url);\n break;\n }\n if ("content-range" in obj) {\n size = +obj["content-range"].split("/")[1];\n }\n const len = +obj["content-length"];\n ptr += len;\n if (fetchRestOnNonCanceled)\n fetchSize = size;\n const val = Buffer2.from(await fres.arrayBuffer());\n const e = yield val;\n if (e) {\n break;\n }\n }\n}\n\n// src/pngv3.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer3 = __toESM(require_buffer(), 1);\n\n// src/png.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_crc_32 = __toESM(require_crc32(), 1);\nvar import_buffer = __toESM(require_buffer(), 1);\nvar PNGDecoder = class {\n constructor(reader, strict = true) {\n this.reader = reader;\n this.strict = strict;\n this.req = 8;\n this.ptr = 8;\n this.stopped = false;\n this.repr = import_buffer.Buffer.from([]);\n }\n async catchup() {\n while (this.repr.byteLength < this.req) {\n const chunk = await this.reader.read();\n if (chunk.done) {\n if (this.strict)\n throw new Error(`Unexpected EOF, got ${this.repr.byteLength}, required ${this.req}, ${chunk.value}`);\n this.stopped = true;\n return;\n }\n this.repr = import_buffer.Buffer.concat([this.repr, chunk.value]);\n }\n }\n async *chunks() {\n while (true) {\n this.req += 8;\n await this.catchup();\n if (this.stopped)\n break;\n const length = this.repr.readUInt32BE(this.ptr);\n const name = this.repr.slice(this.ptr + 4, this.ptr + 8).toString();\n this.ptr += 4;\n this.req += length + 4;\n await this.catchup();\n yield [\n name,\n this.repr.slice(this.ptr, this.ptr + length + 4),\n this.ptr + length > this.repr.length ? -1 : this.repr.readUInt32BE(this.ptr + length + 4),\n this.ptr\n ];\n if (this.stopped)\n break;\n this.ptr += length + 8;\n if (name == "IEND")\n break;\n }\n }\n async dtor() {\n }\n};\nvar PNGEncoder = class {\n constructor(bytes) {\n this.writer = bytes.getWriter();\n this.writer.write(import_buffer.Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]));\n }\n async insertchunk(chunk) {\n let b = import_buffer.Buffer.alloc(4);\n const buff = chunk[1];\n b.writeInt32BE(buff.length - 4, 0);\n await this.writer.write(b);\n await this.writer.write(buff);\n b = import_buffer.Buffer.alloc(4);\n b.writeInt32BE((0, import_crc_32.buf)(buff), 0);\n await this.writer.write(b);\n }\n async dtor() {\n this.writer.releaseLock();\n }\n};\n\n// src/utils.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer2 = __toESM(require_buffer(), 1);\n\n// src/assets/hasembed.png\nvar hasembed_default = __toBinary("iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAMFBMVEX+/v3c3c2moZhda1ODfnfKvK49RDgCAgIbHxpsGhv6BQT9hIOV0Hh4pWO03Z//5coEk9oIAAAHdUlEQVR42qWZDXurIAyFhcDJsS31///bKzEWHX6sd2fPVqYbLycJwXXDTiGKSMrDkQKGc8WwjhCHa0WoSY5u5guIYIUk5BuGEc4oUYZTaVztUq4ZWZtSfzulCyPrCAjXEGgT+9vncQhoRtI1I1BnIdEouYecG5FmZPhNRsLn9T4l3fIjwq8gcXlFv9xwXpPriDLcKHjGYeX1RW0J2uBWUid3FsPPm+flz7Qd3FtJbqhzkuSiYHIzcq8Ybb7KiCRju5PlqirdNdLwewlT2u/IcNUrEvyVwzfKAbvEhHS1RrBF6ysK1ZRvGW0DxhbekGOSlGKzfxgIbpyE8XqJEI9W8GZN6ioi2VU9osSWk8jx8byCMC1zw5JHEiIwOY4YHmM8PDx0sZ/Gx6w9JeQcq3JoRZUUFeFLD+G1qBSh6vB4jBchjzI8NpSQE6BNgAiiodQINg4hvF9NxeYY02mFShw+lAogCUCAFhAiW3wpS/wNsGPQphjloP2FmINtkIdJoCSkvH5OIYZUxAURXk0CcsmJaQRi2IVdLGe1dJ7z7ZEkDNApDEFY27drYwRqC1shdR4dIalKBBhbwg3RCB3Edj39KNmnQ1QtZeoQJ4lIijF4kKzQZkaLUq+3zQ0iz+kwwkYFygrZUaahyr7m52TbHYa4gQxFwBT7u0XICtGO0fZFhAfqzskyHV69KkUbxeeefOQ2XjeyXEjx2JQDCgbdUAbTh5fdxr2RSBpFDillUNMmXB9bibxFFGOEIv6z9tqlxSH6CVirNL1nENGrtlCPKJWuNEijNFHlykHxfYCU1vyqXRRFo1CVJAzSU0bVKxsgpKyzoBRrLrTpy7ZWyroZDylm/lxic9ugYhapmvnSAmbfBId0FD2OlZQWB5JiSzWJFBGSHsMNRWGQnkJ2DDdP+SQDJPzk8/wV240esGY67SG6JgTHmVCQCo9JEiNQZZq82sUpdiaUspoOg/YU8n1sJE3zfLBoCGk2INT5aiTFKFoxhl9ro9QS7ijUGA4hzFNVpMKObskZBBTzxSykRUp1xkFjSIB6cRhkRxk1DXsI1zxMroRqw5iJBKRSUjVTaCbEn3SMUzhoJ/jp1hzI6z3vamBalaEEYUOSFWdmzOE6yeAcooNQ47A4efsRJCyhXmKamiIISh0FKhd8qGZIxMRGGQI6iN99z2sf3BGY67BodoDPqOpJEmX0OFo5LIPho9A7yX6jyijUWHugp6RppsBtESs6qiqMkhqlgzSbwb6E4t0CmH4okqu5sE2XWQbDOUTWe2kZVQjKLMr0UwEy9YrKClOcQ8rbjdhSLExWSYVp6oWpV6DWFAnzOcQO1DkJ5Dx428FdP4T5aNU2q6gydlbIMwjs1A7WDV5vY8xieQmnE2U1bRYhmtzKMUTs8eNlkLL0CQRhKcAZg+qU0LBmBXIMYakbJBhEizE0TplSKOdGXOmHFeIAQlmiFd4VQpUCUnReICCMJ5B0AAnKXRVvI1VsR1SEQQBy2YMgKutQoqvihly/SR3EMuAnu0NYjQEWXup0oqir8rSz0kNgrXAHsXr27QHV6UyfxG8vQvM2XG6jhxjZ22KyhnRdXnlfDjJxB+Hr1UP8JKUvN0/nygKJnT+2Humh6iCiSraOFacvlZRxWGWMc4gH4Xvl7TuyjbFWl2DNCUUw/a+IBnFGgxRygRAk/x8iG8jrFBInIfN/QwLCCUQsTss4b3dHTpK+BGo8hlBLg4QpKnZbQb6DSAcxoUKgxSETkv+8K32f+R4iNV5CMUhN3o9Gy/AFBAqEDuInlRDGu26090oKQo6cKDwp4BEkfQUpRYC+ulTFkrKHpP+F1NgjO6T1xE+8yKMTNn8JMQq2ENEqWbYjscuhiV9Vl3fCAg47I1WweBmkSayTfbcbSZ8Xw86IaYnXz1Mq5/BlW1G+XMPOiAkFykJMf1M6hOhW0PhHCCjrzMPWiItI1L9Cco27SVripblItjPyH6NFfmb+QLBrHVn1z9Fqjw5DlxF6zf6NEeup0RK/jGUHyRHyXXAQfrZgvhoErJSCLSRSVZF/v2wwHRtxiD8FcwuBplQx4Xd1hH5BXI2UskAUxVKygcyfjFDG35VR6tuWwpyQhJRBjSIbSJ6gFTKlOr6PlIR+j0AAKyeRkWoQFWqTTBEzJNUSS3eR4kHqApmGNEqFxOH5GBcIdCPa2Z5gfyyH60jhKKBkPXRH1iyE+ob5AqFuZcs3K8R1Og6NUsdh1nOmCOeBQTr5O0tMWeOUbk+RnvEYqsYRglOI0mudFUd+QwmV8Xi6FT2HtHd/kjn6gpJJ+fxr4TFyfObnGURl37Tl18c607zy1crD/mnVIL2XJlX+MlRknqduVkynECoRg/1mAvmr5xSxsnLIdA/xomaVklKZt91FvaxunTQRIqgQyHIQMN8hPBeTG7mFeG+uascmTjBBqMpHczANpucdhHht9LkYekLCksN1wqbHDYQsHcTE/V91GcaOWXvK4xYiW0bplgCA9OKQmRq1UZ7ZY3UDIXZGuAOQ68AApqROabqHlDMjNKlKzGG31a8o/wBpRk19RswBZgAAAABJRU5ErkJggg==");\n\n// src/stores.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/svelte/store/index.mjs\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/svelte/internal/index.mjs\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nfunction noop() {\n}\nfunction run(fn) {\n return fn();\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === "function";\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nvar resolved_promise = Promise.resolve();\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nvar SvelteElement;\nif (typeof HTMLElement === "function") {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: "open" });\n }\n connectedCallback() {\n const { on_mount } = this.$$;\n this.$$.on_disconnect = on_mount.map(run).filter(is_function);\n for (const key2 in this.$$.slotted) {\n this.appendChild(this.$$.slotted[key2]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n disconnectedCallback() {\n run_all(this.$$.on_disconnect);\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n\n// node_modules/svelte/store/index.mjs\nvar subscriber_queue = [];\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = /* @__PURE__ */ new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) {\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe2(run2, invalidate = noop) {\n const subscriber = [run2, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set) || noop;\n }\n run2(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe: subscribe2 };\n}\n\n// src/stores.ts\nvar localLoad2 = async (key2, def) => {\n if (true) {\n return def;\n }\n const isinls = "__pee__" + key2 in localStorage;\n let ret;\n if (isinls) {\n let it = localStorage.getItem("__pee__" + key2);\n if (it === "undefined")\n it = null;\n ret = { ...def, ...JSON.parse(it || "{}") };\n } else\n ret = def;\n if (true) {\n if (isinls) {\n delete localStorage["__pee__" + key2];\n await chrome.storage.local.set({\n [key2]: JSON.stringify(ret)\n });\n } else {\n const d = await chrome.storage.local.get([key2]);\n if (typeof d[key2] == "string")\n return { ...def, ...await JSON.parse("" + d[key2] || "{}") };\n }\n }\n return ret;\n};\nvar localSet2 = (key2, value) => {\n if (true) {\n return;\n }\n if (true)\n chrome.storage.local.set({ [key2]: JSON.stringify(value) });\n else\n localStorage.setItem("__pee__" + key2, JSON.stringify(value));\n};\nvar initial_settings = localLoad2("settingsv2", {\n loop: true,\n dh: false,\n pmeth: 5,\n xpv: false,\n xpi: false,\n hyd: false,\n notcata: false,\n ak: "",\n auto_embed: 0,\n auto_tags: "",\n te: false,\n eye: false,\n ca: false,\n pre: false,\n prev: false,\n sh: false,\n ep: false,\n tm: false,\n dvc: false,\n expte: false,\n mdist: -1,\n phash: false,\n hotlink: false,\n jpeg: false,\n vercheck: false,\n cache: void 0,\n fhost: 0,\n maxe: 5,\n conc: 8,\n ho: false,\n blacklist: [],\n rsources: []\n});\nvar settings = writable();\ninitial_settings.then((v) => {\n settings.set(v);\n});\nvar appState = writable({\n isCatalog: false,\n is4chanX: false,\n akValid: false,\n herror: "",\n client: null,\n foundPosts: []\n});\nsettings.subscribe((newVal) => {\n localSet2("settingsv2", newVal);\n});\n\n// src/filehosts.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nfunction parseForm(data) {\n const form = new FormData();\n Object.entries(data).filter(([key2, value]) => value !== null).map(([key2, value]) => form.append(key2, value));\n return form;\n}\nvar lolisafe = (domain, serving = domain) => ({\n domain,\n serving,\n async uploadFile(f) {\n const resp = await ifetch(`https://${domain}/api/upload`, {\n headers: {\n accept: "application/json"\n },\n "body": parseForm({\n reqtype: "fileupload",\n "files[]": new File([f], "f.pee")\n }),\n "method": "POST"\n });\n const res = await resp.json();\n return res.files.map((e) => e.url)[0];\n }\n});\nvar catbox = (domain, serving) => ({\n domain,\n serving,\n async uploadFile(inj) {\n const resp = await ifetch(`https://${domain}/user/api.php`, {\n method: "POST",\n body: parseForm({\n reqtype: "fileupload",\n fileToUpload: inj\n })\n });\n return resp.text();\n }\n});\nvar filehosts = [\n catbox("catbox.moe", "files.catbox.moe"),\n catbox("pomf.moe", "a.pomf.cat"),\n lolisafe("take-me-to.space"),\n lolisafe("zz.ht", "z.zz.fo")\n];\n\n// node_modules/file-type/browser.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_node_buffer4 = __toESM(require_buffer(), 1);\nvar import_readable_web_to_node_stream = __toESM(require_lib(), 1);\n\n// node_modules/file-type/core.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_node_buffer3 = __toESM(require_buffer(), 1);\n\n// node_modules/token-types/lib/index.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar ieee754 = __toESM(require_ieee754(), 1);\nvar import_node_buffer = __toESM(require_buffer(), 1);\nvar AnsiStringType = class {\n constructor(len) {\n this.len = len;\n }\n static decode(buffer, offset, until) {\n let str = "";\n for (let i = offset; i < until; ++i) {\n str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i]));\n }\n return str;\n }\n static inRange(a, min, max) {\n return min <= a && a <= max;\n }\n static codePointToString(cp) {\n if (cp <= 65535) {\n return String.fromCharCode(cp);\n } else {\n cp -= 65536;\n return String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320);\n }\n }\n static singleByteDecoder(bite) {\n if (AnsiStringType.inRange(bite, 0, 127)) {\n return bite;\n }\n const codePoint = AnsiStringType.windows1252[bite - 128];\n if (codePoint === null) {\n throw Error("invaliding encoding");\n }\n return codePoint;\n }\n get(buffer, offset = 0) {\n return AnsiStringType.decode(buffer, offset, offset + this.len);\n }\n};\nAnsiStringType.windows1252 = [\n 8364,\n 129,\n 8218,\n 402,\n 8222,\n 8230,\n 8224,\n 8225,\n 710,\n 8240,\n 352,\n 8249,\n 338,\n 141,\n 381,\n 143,\n 144,\n 8216,\n 8217,\n 8220,\n 8221,\n 8226,\n 8211,\n 8212,\n 732,\n 8482,\n 353,\n 8250,\n 339,\n 157,\n 382,\n 376,\n 160,\n 161,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 171,\n 172,\n 173,\n 174,\n 175,\n 176,\n 177,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 187,\n 188,\n 189,\n 190,\n 191,\n 192,\n 193,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 203,\n 204,\n 205,\n 206,\n 207,\n 208,\n 209,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 219,\n 220,\n 221,\n 222,\n 223,\n 224,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 235,\n 236,\n 237,\n 238,\n 239,\n 240,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250,\n 251,\n 252,\n 253,\n 254,\n 255\n];\n\n// node_modules/strtok3/lib/core.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/strtok3/lib/ReadStreamTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/strtok3/lib/AbstractTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/index.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/EndOfFileStream.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/StreamReader.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/Deferred.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/StreamReader.js\nvar maxStreamReadSize = 1 * 1024 * 1024;\n\n// node_modules/strtok3/lib/AbstractTokenizer.js\nvar import_node_buffer2 = __toESM(require_buffer(), 1);\n\n// node_modules/strtok3/lib/BufferTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/file-type/util.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/file-type/supported.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar extensions = [\n "jpg",\n "png",\n "apng",\n "gif",\n "webp",\n "flif",\n "xcf",\n "cr2",\n "cr3",\n "orf",\n "arw",\n "dng",\n "nef",\n "rw2",\n "raf",\n "tif",\n "bmp",\n "icns",\n "jxr",\n "psd",\n "indd",\n "zip",\n "tar",\n "rar",\n "gz",\n "bz2",\n "7z",\n "dmg",\n "mp4",\n "mid",\n "mkv",\n "webm",\n "mov",\n "avi",\n "mpg",\n "mp2",\n "mp3",\n "m4a",\n "oga",\n "ogg",\n "ogv",\n "opus",\n "flac",\n "wav",\n "spx",\n "amr",\n "pdf",\n "epub",\n "elf",\n "exe",\n "swf",\n "rtf",\n "wasm",\n "woff",\n "woff2",\n "eot",\n "ttf",\n "otf",\n "ico",\n "flv",\n "ps",\n "xz",\n "sqlite",\n "nes",\n "crx",\n "xpi",\n "cab",\n "deb",\n "ar",\n "rpm",\n "Z",\n "lz",\n "cfb",\n "mxf",\n "mts",\n "blend",\n "bpg",\n "docx",\n "pptx",\n "xlsx",\n "3gp",\n "3g2",\n "jp2",\n "jpm",\n "jpx",\n "mj2",\n "aif",\n "qcp",\n "odt",\n "ods",\n "odp",\n "xml",\n "mobi",\n "heic",\n "cur",\n "ktx",\n "ape",\n "wv",\n "dcm",\n "ics",\n "glb",\n "pcap",\n "dsf",\n "lnk",\n "alias",\n "voc",\n "ac3",\n "m4v",\n "m4p",\n "m4b",\n "f4v",\n "f4p",\n "f4b",\n "f4a",\n "mie",\n "asf",\n "ogm",\n "ogx",\n "mpc",\n "arrow",\n "shp",\n "aac",\n "mp1",\n "it",\n "s3m",\n "xm",\n "ai",\n "skp",\n "avif",\n "eps",\n "lzh",\n "pgp",\n "asar",\n "stl",\n "chm",\n "3mf",\n "zst",\n "jxl",\n "vcf"\n];\nvar mimeTypes = [\n "image/jpeg",\n "image/png",\n "image/gif",\n "image/webp",\n "image/flif",\n "image/x-xcf",\n "image/x-canon-cr2",\n "image/x-canon-cr3",\n "image/tiff",\n "image/bmp",\n "image/vnd.ms-photo",\n "image/vnd.adobe.photoshop",\n "application/x-indesign",\n "application/epub+zip",\n "application/x-xpinstall",\n "application/vnd.oasis.opendocument.text",\n "application/vnd.oasis.opendocument.spreadsheet",\n "application/vnd.oasis.opendocument.presentation",\n "application/vnd.openxmlformats-officedocument.wordprocessingml.document",\n "application/vnd.openxmlformats-officedocument.presentationml.presentation",\n "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",\n "application/zip",\n "application/x-tar",\n "application/x-rar-compressed",\n "application/gzip",\n "application/x-bzip2",\n "application/x-7z-compressed",\n "application/x-apple-diskimage",\n "application/x-apache-arrow",\n "video/mp4",\n "audio/midi",\n "video/x-matroska",\n "video/webm",\n "video/quicktime",\n "video/vnd.avi",\n "audio/vnd.wave",\n "audio/qcelp",\n "audio/x-ms-asf",\n "video/x-ms-asf",\n "application/vnd.ms-asf",\n "video/mpeg",\n "video/3gpp",\n "audio/mpeg",\n "audio/mp4",\n "audio/opus",\n "video/ogg",\n "audio/ogg",\n "application/ogg",\n "audio/x-flac",\n "audio/ape",\n "audio/wavpack",\n "audio/amr",\n "application/pdf",\n "application/x-elf",\n "application/x-msdownload",\n "application/x-shockwave-flash",\n "application/rtf",\n "application/wasm",\n "font/woff",\n "font/woff2",\n "application/vnd.ms-fontobject",\n "font/ttf",\n "font/otf",\n "image/x-icon",\n "video/x-flv",\n "application/postscript",\n "application/eps",\n "application/x-xz",\n "application/x-sqlite3",\n "application/x-nintendo-nes-rom",\n "application/x-google-chrome-extension",\n "application/vnd.ms-cab-compressed",\n "application/x-deb",\n "application/x-unix-archive",\n "application/x-rpm",\n "application/x-compress",\n "application/x-lzip",\n "application/x-cfb",\n "application/x-mie",\n "application/mxf",\n "video/mp2t",\n "application/x-blender",\n "image/bpg",\n "image/jp2",\n "image/jpx",\n "image/jpm",\n "image/mj2",\n "audio/aiff",\n "application/xml",\n "application/x-mobipocket-ebook",\n "image/heif",\n "image/heif-sequence",\n "image/heic",\n "image/heic-sequence",\n "image/icns",\n "image/ktx",\n "application/dicom",\n "audio/x-musepack",\n "text/calendar",\n "text/vcard",\n "model/gltf-binary",\n "application/vnd.tcpdump.pcap",\n "audio/x-dsf",\n "application/x.ms.shortcut",\n "application/x.apple.alias",\n "audio/x-voc",\n "audio/vnd.dolby.dd-raw",\n "audio/x-m4a",\n "image/apng",\n "image/x-olympus-orf",\n "image/x-sony-arw",\n "image/x-adobe-dng",\n "image/x-nikon-nef",\n "image/x-panasonic-rw2",\n "image/x-fujifilm-raf",\n "video/x-m4v",\n "video/3gpp2",\n "application/x-esri-shape",\n "audio/aac",\n "audio/x-it",\n "audio/x-s3m",\n "audio/x-xm",\n "video/MP1S",\n "video/MP2P",\n "application/vnd.sketchup.skp",\n "image/avif",\n "application/x-lzh-compressed",\n "application/pgp-encrypted",\n "application/x-asar",\n "model/stl",\n "application/vnd.ms-htmlhelp",\n "model/3mf",\n "image/jxl",\n "application/zstd"\n];\n\n// node_modules/file-type/core.js\nvar supportedExtensions = new Set(extensions);\nvar supportedMimeTypes = new Set(mimeTypes);\n\n// src/utils.ts\nvar csettings;\nsettings.subscribe((b) => {\n csettings = b;\n});\nvar threadDataCache = writable();\nvar cthreadDataCache;\nthreadDataCache.subscribe((newval) => {\n cthreadDataCache = newval;\n});\nvar decodeCoom3Payload = async (buff) => {\n if (!csettings)\n throw new Error("Settings uninit");\n const allowed_domains = filehosts.map((e) => e.serving.replaceAll(".", "\\\\."));\n const pees = buff.toString().split(" ").slice(0, csettings.maxe).filter((e) => allowed_domains.some((v) => e.match(`https://(.*\\\\.)?${v}/`)));\n return (await Promise.all(pees.map(async (pee) => {\n try {\n const m = pee.match(/(?https?):\\/\\/(?.*?)(?\\/.*)/);\n if (!m)\n return;\n const { domain, file } = m.groups;\n const headers = await getHeaders(pee);\n const res = await ifetch(pee, {\n headers: { range: "bytes=0-32767", "user-agent": "" },\n mode: "cors",\n referrerPolicy: "no-referrer"\n });\n const size = +headers["content-length"] || 0;\n const header = import_buffer2.Buffer.from(await res.arrayBuffer());\n let hptr = 0;\n if (header.slice(0, 4).toString() == "PEE\\0")\n hptr += 4;\n else\n return;\n const flags = header[hptr];\n const hasFn = !!(flags & 1);\n const hasTags = !!(flags & 2);\n const hasThumbnail = !!(flags & 4);\n let [ptr, ptr2] = [hptr + 1, hptr + 1];\n let fn = "embedded";\n let tags = [];\n let thumb = import_buffer2.Buffer.from(hasembed_default);\n if (hasFn) {\n while (header[ptr2] != 0)\n ptr2++;\n fn = header.slice(ptr, ptr2).toString();\n ptr = ++ptr2;\n }\n if (hasTags) {\n while (header[ptr2] != 0)\n ptr2++;\n tags = header.slice(ptr, ptr2).toString().split(/\\s+/);\n }\n let thumbsize = 0;\n if (hasThumbnail) {\n thumbsize = header.readInt32LE(ptr);\n ptr += 4;\n if (header.byteLength >= ptr + thumbsize)\n thumb = header.slice(ptr, ptr + thumbsize);\n else\n thumb = import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer());\n ptr += thumbsize;\n }\n const unzip = { url: pee, headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } };\n let data;\n data = unzip;\n if (size < 3072) {\n thumb = data = import_buffer2.Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer());\n }\n return {\n filename: fn,\n data,\n thumbnail: thumb\n };\n } catch (e) {\n console.warn(e);\n }\n }))).filter((e) => e).map((e) => e);\n};\n\n// src/pngv3.ts\nvar bs58 = __toESM(require_bs58(), 1);\n\n// src/bitstream.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar revbyte = (n, len = 8) => {\n let acc = 0;\n let n2 = n;\n let len2 = len;\n while (len2) {\n acc = acc * 2 + (n2 & 1);\n n2 >>= 1;\n len2--;\n }\n return acc;\n};\nvar BitstreamReader = class {\n constructor() {\n this.buffers = [];\n this.bufferedLength = 0;\n this._offsetIntoBuffer = 0;\n this._bufferIndex = 0;\n this._offset = 0;\n this.skippedLength = 0;\n }\n get bufferIndex() {\n return this._bufferIndex;\n }\n get offset() {\n return this._offset;\n }\n get available() {\n return this.bufferedLength - this.skippedLength;\n }\n getBit(offset) {\n const byte = this.buffers[0][offset >> 3];\n return +!!(byte & 1 << (offset & 7));\n }\n readSync(length) {\n let value = 0;\n if (this._offset >> 3 > this.buffers[0].byteLength) {\n throw "Out of data";\n }\n for (let i = length - 1; i >= 0; --i) {\n value = value * 2 + this.getBit(this._offset + i);\n }\n this._offset += length;\n this.bufferedLength -= length;\n return value;\n }\n addBuffer(buffer) {\n this.buffers.push(buffer);\n this.bufferedLength += buffer.length * 8;\n }\n};\nvar BitstreamWriter = class {\n constructor(stream, bufferSize = 1) {\n this.stream = stream;\n this.pendingBits = 0;\n this.bufferoffset = 0;\n this._offset = 0;\n bufferSize = 1;\n this.buffer = new Uint8Array(bufferSize);\n }\n get offset() {\n return this._offset;\n }\n get byteOffset() {\n return this.pendingBits;\n }\n end() {\n this.flush();\n }\n flush() {\n this.stream.write(new Uint8Array(this.buffer));\n this.bufferoffset = 0;\n this.buffer.fill(0);\n }\n setBit(b) {\n let byte = this.buffer[0];\n byte |= b << (this._offset & 7);\n this.buffer[0] = byte;\n this._offset += 1;\n if (++this.bufferoffset == this.buffer.length * 8) {\n this.flush();\n }\n }\n write(length, value) {\n while (length--) {\n this.setBit(value & 1);\n value >>= 1;\n }\n }\n};\n\n// src/dh-deflate.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar TINF_OK = 0;\nvar Tree = class {\n constructor() {\n this.table = new Uint16Array(16);\n this.trans = new Uint16Array(288);\n }\n};\nvar getPathTo = (tree, value) => {\n if (tree[0] === value)\n return "0";\n if (tree[1] === value)\n return "1";\n let p;\n if (typeof tree[0] != "number")\n p = getPathTo(tree[0], value);\n let b = "0";\n if (!p) {\n if (tree[1] && typeof tree[1] != "number")\n p = getPathTo(tree[1], value);\n b = "1";\n }\n if (p)\n return b + p;\n};\nfunction buildHuffmanTable(codeLengths, values) {\n let k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({ children: [], index: 0 });\n let p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error("Could not recreate Huffman Table");\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n}\nvar Data = class {\n constructor(source, dests, to_hide, hidden) {\n this.source = source;\n this.dests = dests;\n this.to_hide = to_hide;\n this.hidden = hidden;\n this.pathMap = /* @__PURE__ */ new Map();\n this.dest = [];\n this.ltree = new Tree();\n this.dtree = new Tree();\n }\n computeReverse() {\n this.rltree = buildHuffmanTable(this.ltree.table, this.ltree.trans)[0];\n this.rdtree = buildHuffmanTable(this.dtree.table, this.dtree.trans)[0];\n this.adists = new Set(this.rdtree.flat(16));\n }\n};\nvar sltree = new Tree();\nvar sdtree = new Tree();\nvar rltree;\nvar rdtree;\nvar sadist;\nvar length_bits = new Uint8Array(30);\nvar length_base = new Uint16Array(30);\nvar dist_bits = new Uint8Array(30);\nvar dist_base = new Uint16Array(30);\nvar clcidx = new Uint8Array([\n 16,\n 17,\n 18,\n 0,\n 8,\n 7,\n 9,\n 6,\n 10,\n 5,\n 11,\n 4,\n 12,\n 3,\n 13,\n 2,\n 14,\n 1,\n 15\n]);\nvar code_tree = new Tree();\nvar lengths = new Uint8Array(288 + 32);\nfunction tinf_build_bits_base(bits, base, delta, first) {\n let i, sum;\n for (i = 0; i < delta; ++i)\n bits[i] = 0;\n for (i = 0; i < 30 - delta; ++i)\n bits[i + delta] = i / delta | 0;\n for (sum = first, i = 0; i < 30; ++i) {\n base[i] = sum;\n sum += 1 << bits[i];\n }\n}\nfunction tinf_build_fixed_trees(lt, dt) {\n let i;\n for (i = 0; i < 7; ++i)\n lt.table[i] = 0;\n lt.table[7] = 24;\n lt.table[8] = 152;\n lt.table[9] = 112;\n for (i = 0; i < 24; ++i)\n lt.trans[i] = 256 + i;\n for (i = 0; i < 144; ++i)\n lt.trans[24 + i] = i;\n for (i = 0; i < 8; ++i)\n lt.trans[24 + 144 + i] = 280 + i;\n for (i = 0; i < 112; ++i)\n lt.trans[24 + 144 + 8 + i] = 144 + i;\n for (i = 0; i < 5; ++i)\n dt.table[i] = 0;\n dt.table[5] = 32;\n for (i = 0; i < 32; ++i)\n dt.trans[i] = i;\n}\nvar offs = new Uint16Array(16);\nfunction tinf_build_tree(t, lengths2, off, num) {\n let i, sum;\n for (i = 0; i < 16; ++i)\n t.table[i] = 0;\n for (i = 0; i < num; ++i)\n t.table[lengths2[off + i]]++;\n t.table[0] = 0;\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum;\n sum += t.table[i];\n }\n for (i = 0; i < num; ++i) {\n if (lengths2[off + i])\n t.trans[offs[lengths2[off + i]]++] = i;\n }\n}\nfunction tinf_getbit(d) {\n const v = d.source.readSync(1);\n return v;\n}\nvar loff = 0;\nvar loffs = [];\nfunction tinf_read_bits(d, num, base) {\n if (!num)\n return base;\n const v = d.source.readSync(num) + base;\n loff = v;\n loffs.push(v);\n if (loffs.length > 4) {\n loffs.shift();\n }\n return v;\n}\nfunction tinf_decode_symbol(d, t, copy = true, ext = {}) {\n let sum = 0, cur = 0, len = 0;\n let s = 0;\n do {\n const b = d.source.readSync(1);\n copy && d.hidden?.write(1, b);\n s = s << 1 | b;\n cur = 2 * cur + b;\n ++len;\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n ext.length = len;\n ext.sym = s;\n return t.trans[sum + cur];\n}\nfunction tinf_decode_trees(d, lt, dt, copy = true) {\n let i, num, length;\n const hlit = tinf_read_bits(d, 5, 257);\n copy && d.hidden?.write(5, hlit - 257);\n const hdist = tinf_read_bits(d, 5, 1);\n copy && d.hidden?.write(5, hdist - 1);\n const hclen = tinf_read_bits(d, 4, 4);\n copy && d.hidden?.write(4, hclen - 4);\n for (i = 0; i < 19; ++i)\n lengths[i] = 0;\n for (i = 0; i < hclen; ++i) {\n const clen = tinf_read_bits(d, 3, 0);\n copy && d.hidden?.write(3, clen);\n lengths[clcidx[i]] = clen;\n }\n tinf_build_tree(code_tree, lengths, 0, 19);\n for (num = 0; num < hlit + hdist; ) {\n const sym = tinf_decode_symbol(d, code_tree, copy);\n let prev;\n switch (sym) {\n case 16:\n prev = lengths[num - 1];\n length = tinf_read_bits(d, 2, 3);\n copy && d.hidden?.write(2, length - 3);\n for (; length; --length) {\n lengths[num++] = prev;\n }\n break;\n case 17:\n length = tinf_read_bits(d, 3, 3);\n copy && d.hidden?.write(3, length - 3);\n for (; length; --length) {\n lengths[num++] = 0;\n }\n break;\n case 18:\n length = tinf_read_bits(d, 7, 11);\n copy && d.hidden?.write(7, length - 11);\n for (; length; --length) {\n lengths[num++] = 0;\n }\n break;\n default:\n lengths[num++] = sym;\n break;\n }\n }\n tinf_build_tree(lt, lengths, 0, hlit);\n tinf_build_tree(dt, lengths, hlit, hdist);\n}\nvar get_symbol = (value, bits_table, base_table) => {\n let i = 0;\n for (i = 0; i < base_table.length; ++i) {\n if (base_table[i] > value) {\n i--;\n return [i, bits_table[i], value - base_table[i]];\n }\n }\n i--;\n return [i, bits_table[i], value - base_table[i]];\n};\nvar encode_symbol = (sym, tree, pathMap) => {\n const code = getPathTo(tree, sym);\n const v = {\n length: code?.length,\n val: parseInt(code, 2)\n };\n return v;\n};\nvar capacity = 0;\nfunction tinf_inflate_block_data(d, lt, dt) {\n while (1) {\n let sym = tinf_decode_symbol(d, lt);\n if (sym === 256) {\n return TINF_OK;\n }\n if (sym < 256) {\n d.dest.push(sym);\n } else {\n sym -= 257;\n const length = tinf_read_bits(d, length_bits[sym], length_base[sym]);\n if (length_bits[sym])\n d.hidden?.write(length_bits[sym], length - length_base[sym]);\n const ext = { length: 0, sym: 0 };\n const dist = tinf_decode_symbol(d, dt, false, ext);\n let backoffset = tinf_read_bits(d, dist_bits[dist], dist_base[dist]);\n const offs2 = d.dest.length - backoffset;\n let match;\n const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader && d.to_hide.available == 0;\n if (!skip && (match = Buffer2.from(d.dest.slice(offs2, offs2 + length))).length == length) {\n let begin = d.dest.length - 32768;\n if (begin < 0)\n begin = 0;\n let matches = [];\n let o = 0;\n const slic = Buffer2.from(d.dest.slice(begin + o, d.dest.length));\n while (begin + o < d.dest.length) {\n const r = slic.slice(o, d.dest.length).indexOf(match);\n if (r >= 0) {\n matches.push(r + begin + o);\n o += r;\n } else {\n break;\n }\n o++;\n }\n if (matches.length > 1) {\n matches = matches.map((e) => -(e - d.dest.length)).filter((e) => {\n const [dsym2] = get_symbol(e, dist_bits, dist_base);\n return d.adists.has(dsym2);\n });\n matches.reverse();\n const v = Math.floor(Math.log2(matches.length));\n capacity += v;\n if (d.to_hide instanceof BitstreamReader) {\n if (d.to_hide.available) {\n const s = d.to_hide.readSync(Math.min(d.to_hide.available, v));\n backoffset = matches[s];\n }\n } else {\n const idx = matches.indexOf(backoffset);\n d.to_hide.write(v, idx);\n }\n }\n }\n const [dsym, dlen, doff] = get_symbol(backoffset, dist_bits, dist_base);\n const encdist = encode_symbol(dsym, d.rdtree, d.pathMap);\n d.hidden?.write(encdist.length, revbyte(encdist.val, encdist.length));\n d.hidden?.write(dlen, doff);\n for (let i = offs2; i < offs2 + length; ++i) {\n d.dest.push(d.dest[i]);\n }\n }\n }\n}\nfunction tinf_inflate_uncompressed_block(d) {\n if (d.source.offset & 7)\n d.source.readSync(8 - d.source.offset & 7);\n if (d.hidden && d.hidden.offset & 7)\n d.hidden?.write(8 - d.hidden.offset & 7, 0);\n const length = d.source.readSync(16);\n d.hidden?.write(16, length);\n const invlength = d.source.readSync(16);\n d.hidden?.write(16, invlength);\n if (length !== (~invlength & 65535)) {\n return -4;\n }\n for (let i = length; i; --i) {\n const v = d.source.readSync(8);\n d.dest.push(v);\n d.hidden?.write(8, v);\n }\n return TINF_OK;\n}\nfunction tinf_uncompress(source, decompressed, to_hide, hidden, opt = 0) {\n const decomp = decompressed ? new BitstreamWriter({ write: decompressed }) : null;\n const hid = hidden && new BitstreamWriter({ write: hidden }, 4);\n const d = new Data(source, decomp, to_hide, hid);\n let res;\n let bfinal, btype;\n do {\n bfinal = tinf_getbit(d);\n d.hidden?.write(1, bfinal);\n btype = tinf_read_bits(d, 2, 0);\n d.hidden?.write(2, btype);\n switch (btype) {\n case 0:\n res = tinf_inflate_uncompressed_block(d);\n break;\n case 1:\n d.rdtree = rdtree;\n d.rltree = rltree;\n d.adists = sadist;\n res = tinf_inflate_block_data(d, sltree, sdtree);\n break;\n case 2:\n tinf_decode_trees(d, d.ltree, d.dtree);\n d.computeReverse();\n res = tinf_inflate_block_data(d, d.ltree, d.dtree);\n break;\n default:\n res = -2;\n }\n if (res !== TINF_OK)\n throw new Error("Data error " + res);\n } while (!bfinal);\n decomp?.end();\n hid?.end();\n}\ntinf_build_fixed_trees(sltree, sdtree);\ntinf_build_bits_base(length_bits, length_base, 4, 3);\ntinf_build_bits_base(dist_bits, dist_base, 2, 1);\nrltree = buildHuffmanTable(sltree.table, sltree.trans)[0];\nrdtree = buildHuffmanTable(sdtree.table, sdtree.trans)[0];\nsadist = new Set(rdtree.flat(16));\nlength_bits[28] = 0;\nlength_base[28] = 258;\n\n// src/pngv3.ts\nvar csettings2;\nsettings.subscribe((b) => {\n csettings2 = b;\n});\nvar CUM3 = import_buffer3.Buffer.from("doo\\0m");\nvar CUM4 = import_buffer3.Buffer.from("voo\\0m");\nvar CUM5 = import_buffer3.Buffer.from("boo\\0");\nvar CUM6 = import_buffer3.Buffer.from("Creation Time\\0");\nvar CUM7 = import_buffer3.Buffer.from("Software\\0");\nvar BufferReadStream = (b) => {\n const ret = new ReadableStream({\n pull(cont) {\n cont.enqueue(b);\n cont.close();\n }\n });\n return ret;\n};\nvar password = import_buffer3.Buffer.from("NOA");\nvar xor = (a, p) => {\n let n = 0;\n for (let i = 0; i < a.byteLength; ++i) {\n a[i] ^= p[n];\n n++;\n n %= p.byteLength;\n }\n};\nvar prefs = {\n "files.catbox.moe": "c",\n "a.pomf.cat": "p",\n "take-me-to.space": "t",\n "z.zz.fo": "z"\n};\nvar rprefs = {\n "c": "files.catbox.moe",\n "p": "a.pomf.cat",\n "t": "take-me-to.space",\n "z": "z.zz.fo"\n};\nvar extractFromRawDeflate = (b) => {\n const src = new BitstreamReader();\n src.addBuffer(b);\n const chnks = [];\n const hidden = new BitstreamWriter({\n write(chunk) {\n for (const i of chunk) {\n if (i)\n chnks.push(i);\n else\n throw "Finish";\n }\n }\n });\n try {\n tinf_uncompress(src, void 0, hidden, void 0);\n } catch (e) {\n if (e == "Finish")\n return import_buffer3.Buffer.from(chnks);\n }\n return false;\n};\nvar extract = async (png, doextract = true) => {\n const reader = BufferReadStream(png).getReader();\n const sneed = new PNGDecoder(reader, false);\n const ret = [];\n let w;\n if (!csettings2)\n throw new Error("Settings uninit");\n try {\n let complete = false;\n const idats = [];\n for await (const [name, chunk, crc, offset] of sneed.chunks()) {\n let buff;\n switch (name) {\n case "tEXt":\n buff = chunk;\n if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) {\n if (!doextract)\n return true;\n const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length));\n ret.push(...k.filter((e) => e));\n }\n if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) {\n if (!doextract)\n return true;\n const passed = buff.slice(4 + CUM4.length);\n xor(passed, password);\n const k = await decodeCoom3Payload(passed);\n ret.push(...k.filter((e) => e));\n }\n if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) {\n if (!doextract)\n return true;\n const passed = buff.slice(4 + CUM5.length);\n const decoded = import_buffer3.Buffer.from(passed.toString(), "base64").toString().split(" ").map((e) => {\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded));\n ret.push(...k.filter((e) => e));\n }\n if (w = [CUM6, CUM7].find((e) => buff.slice(4, 4 + e.length).equals(e))) {\n const passed = buff.slice(4 + w.length);\n if (!passed.toString().match(/^[0-9a-zA-Z+/=]+$/g))\n continue;\n const decoders = [\n (b) => import_buffer3.Buffer.from(b.toString(), "base64").toString(),\n (b) => import_buffer3.Buffer.from(bs58.decode(passed.toString())).toString()\n ];\n for (const d of decoders) {\n try {\n const decoded = d(passed).split(" ").map((e) => {\n if (!(e[0] in rprefs))\n throw "Uhh";\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n if (!doextract)\n return true;\n const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded));\n ret.push(...k.filter((e) => e));\n } catch (e) {\n }\n }\n }\n break;\n case "IDAT":\n if (ret.length)\n return ret;\n buff = chunk;\n idats.push(buff.slice(4));\n break;\n case "IEND":\n complete = true;\n default:\n break;\n }\n }\n if (idats.length) {\n let decoded;\n if ((decoded = extractFromRawDeflate(import_buffer3.Buffer.concat(idats).slice(2))) === false)\n return false;\n const dec = decoded.toString().split(" ").map((e) => {\n if (!(e[0] in rprefs))\n throw "Uhh";\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n if (doextract)\n return decodeCoom3Payload(import_buffer3.Buffer.from(dec));\n return true;\n }\n } catch (e) {\n if (e != "Uhh")\n console.error(e);\n } finally {\n reader.releaseLock();\n }\n};\nvar buildChunk = (tag, data) => {\n const ret = import_buffer3.Buffer.alloc(data.byteLength + 4);\n ret.write(tag.slice(0, 4), 0);\n data.copy(ret, 4);\n return ret;\n};\nvar BufferWriteStream = () => {\n let b = import_buffer3.Buffer.from([]);\n const ret = new WritableStream({\n write(chunk) {\n b = import_buffer3.Buffer.concat([b, chunk]);\n console.log("finished appending");\n }\n });\n return [ret, () => b];\n};\nvar embedInRawDeflate = (b, h) => {\n const src = new BitstreamReader();\n const hid = new BitstreamReader();\n hid.addBuffer(h);\n src.addBuffer(b);\n const chnks = [];\n tinf_uncompress(src, void 0, hid, (c) => chnks.push(c));\n return import_buffer3.Buffer.concat(chnks);\n};\nvar inject_data = async (container, injb) => {\n if (!csettings2)\n throw new Error("Settings uninit");\n if (csettings2.pmeth < 5) {\n let magic = false;\n const [writestream2, extract6] = BufferWriteStream();\n const encoder = new PNGEncoder(writestream2);\n const decoder = new PNGDecoder(container.stream().getReader());\n for await (const [name, chunk, crc, offset] of decoder.chunks()) {\n if (magic && name != "IDAT")\n break;\n if (!magic && name == "IDAT") {\n const passed = import_buffer3.Buffer.from(injb);\n switch (csettings2.pmeth) {\n case 0:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM3, passed])), 0, 0]);\n break;\n case 1:\n xor(passed, password);\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM4, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 2:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM5, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 3:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM6, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 4:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM7, import_buffer3.Buffer.from(bs58.encode(passed))])), 0, 0]);\n break;\n }\n magic = true;\n }\n await encoder.insertchunk([name, chunk, crc, offset]);\n }\n await encoder.insertchunk([\n "IEND",\n buildChunk("IEND", import_buffer3.Buffer.from([])),\n 0,\n 0\n ]);\n return extract6();\n }\n let pdec = new PNGDecoder(container.stream().getReader());\n const concat = [];\n for await (const chk of pdec.chunks())\n if (chk[0] == "IDAT")\n concat.push(chk[1].slice(4));\n const comp = import_buffer3.Buffer.concat(concat);\n const head = comp.slice(0, 2);\n const chksum = comp.slice(-4);\n const idatblk = embedInRawDeflate(comp.slice(2, -4), injb);\n const [writestream, extract5] = BufferWriteStream();\n const penc = new PNGEncoder(writestream);\n pdec = new PNGDecoder(container.stream().getReader());\n let ins = false;\n for await (const chk of pdec.chunks()) {\n if (chk[0] != "IDAT") {\n await penc.insertchunk(chk);\n } else {\n if (!ins) {\n await penc.insertchunk(["IDAT", import_buffer3.Buffer.concat([import_buffer3.Buffer.from("IDAT"), head, idatblk, chksum]), 0, 0]);\n ins = true;\n }\n }\n }\n await penc.dtor();\n console.log("Finished writing");\n return extract5();\n};\nvar inject = async (container, links) => {\n links = links.map((link) => {\n for (const h of filehosts) {\n if (link.includes(h.serving)) {\n const end = link.split("/").slice(-1)[0];\n return `${prefs[h.serving]}${end}`;\n }\n }\n return "";\n });\n const injb = import_buffer3.Buffer.from(links.join(" "));\n return inject_data(container, injb);\n};\nvar has_embed = async (png) => {\n const r = await extract(png, false);\n return !!r;\n};\nvar pngv3_default = {\n extract,\n has_embed,\n inject,\n match: (fn) => !!fn.match(/\\.png$/)\n};\n\n// src/jpg.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer4 = __toESM(require_buffer(), 1);\n\n// src/f5stego.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar bitcode = new Array(65535);\nvar category = new Array(65535);\nvar std_dc_luminance_nrcodes = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];\nvar std_dc_luminance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nvar std_ac_luminance_nrcodes = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125];\nvar std_ac_luminance_values = [\n 1,\n 2,\n 3,\n 0,\n 4,\n 17,\n 5,\n 18,\n 33,\n 49,\n 65,\n 6,\n 19,\n 81,\n 97,\n 7,\n 34,\n 113,\n 20,\n 50,\n 129,\n 145,\n 161,\n 8,\n 35,\n 66,\n 177,\n 193,\n 21,\n 82,\n 209,\n 240,\n 36,\n 51,\n 98,\n 114,\n 130,\n 9,\n 10,\n 22,\n 23,\n 24,\n 25,\n 26,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n];\nvar std_dc_chrominance_nrcodes = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];\nvar std_dc_chrominance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nvar std_ac_chrominance_nrcodes = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119];\nvar std_ac_chrominance_values = [\n 0,\n 1,\n 2,\n 3,\n 17,\n 4,\n 5,\n 33,\n 49,\n 6,\n 18,\n 65,\n 81,\n 7,\n 97,\n 113,\n 19,\n 34,\n 50,\n 129,\n 8,\n 20,\n 66,\n 145,\n 161,\n 177,\n 193,\n 9,\n 35,\n 51,\n 82,\n 240,\n 21,\n 98,\n 114,\n 209,\n 10,\n 22,\n 36,\n 52,\n 225,\n 37,\n 241,\n 23,\n 24,\n 25,\n 26,\n 38,\n 39,\n 40,\n 41,\n 42,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n];\nfunction _initCategoryNumber() {\n var nrlower = 1;\n var nrupper = 2;\n for (var cat = 1; cat <= 15; cat++) {\n for (var nr = nrlower; nr < nrupper; nr++) {\n category[32767 + nr] = cat;\n bitcode[32767 + nr] = [];\n bitcode[32767 + nr][1] = cat;\n bitcode[32767 + nr][0] = nr;\n }\n for (var nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) {\n category[32767 + nrneg] = cat;\n bitcode[32767 + nrneg] = [];\n bitcode[32767 + nrneg][1] = cat;\n bitcode[32767 + nrneg][0] = nrupper - 1 + nrneg;\n }\n nrlower <<= 1;\n nrupper <<= 1;\n }\n}\n_initCategoryNumber();\nfunction _computeHuffmanTbl(nrcodes, std_table) {\n var codevalue = 0;\n var pos_in_table = 0;\n var HT = [];\n for (var k = 1; k <= 16; k++) {\n for (var j = 1; j <= nrcodes[k]; j++) {\n HT[std_table[pos_in_table]] = [];\n HT[std_table[pos_in_table]][0] = codevalue;\n HT[std_table[pos_in_table]][1] = k;\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n}\nvar YDC_HT = _computeHuffmanTbl(std_dc_luminance_nrcodes, std_dc_luminance_values);\nvar UVDC_HT = _computeHuffmanTbl(std_dc_chrominance_nrcodes, std_dc_chrominance_values);\nvar YAC_HT = _computeHuffmanTbl(std_ac_luminance_nrcodes, std_ac_luminance_values);\nvar UVAC_HT = _computeHuffmanTbl(std_ac_chrominance_nrcodes, std_ac_chrominance_values);\nvar _randPool, __raw, _jfif, _APPn, _qts, _frame, _tail, _shuffleInit, shuffleInit_fn, _stegShuffle, stegShuffle_fn, __analyze, _analyze_fn, __f5write, _f5write_fn;\nvar f5stego = class {\n constructor(key2, maxPixels = 4096 * 4096) {\n this.maxPixels = maxPixels;\n __privateAdd(this, _shuffleInit);\n __privateAdd(this, _stegShuffle);\n __privateAdd(this, __analyze);\n __privateAdd(this, __f5write);\n __privateAdd(this, _randPool, void 0);\n __privateAdd(this, __raw, void 0);\n __privateAdd(this, _jfif, void 0);\n __privateAdd(this, _APPn, void 0);\n __privateAdd(this, _qts, void 0);\n __privateAdd(this, _frame, null);\n __privateAdd(this, _tail, null);\n __privateMethod(this, _shuffleInit, shuffleInit_fn).call(this, key2);\n }\n embed(image, data, k) {\n this.parse(image);\n this.f5put(data, k);\n return this.pack();\n }\n extract(image) {\n this.parse(image, true);\n return this.f5get();\n }\n analyze() {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var i, comp = __privateGet(this, _frame).components[0];\n if (comp.componentId != 1) {\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n return __privateMethod(this, __analyze, _analyze_fn).call(this, comp.blocks);\n }\n f5put(data, k) {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var t, i, comp = __privateGet(this, _frame).components[0];\n if (data.length > 8388607)\n throw "Data too big. Max 8388607 bytes allowed.";\n if (data.length < 32768) {\n t = new Uint8Array(2 + data.length);\n t[0] = data.length & 255;\n t[1] = data.length >>> 8;\n t.set(data, 2);\n } else {\n t = new Uint8Array(3 + data.length);\n t[0] = data.length & 255;\n t[1] = (data.length >>> 8 & 127) + 128;\n t[2] = data.length >>> 15;\n t.set(data, 3);\n }\n if (comp.componentId != 1) {\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (k) {\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n return __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n let ret;\n let prop = __privateMethod(this, __analyze, _analyze_fn).call(this, comp.blocks);\n k = 0;\n for (i = prop.capacity.length - 1; i >= 0; i--) {\n if (prop.capacity[i] >= t.length) {\n k = i;\n break;\n }\n }\n if (k === 0)\n throw "capacity exceeded";\n try {\n ret = __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n } catch (e) {\n k--;\n if (k === 0)\n throw "capacity exceeded";\n ret = __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n }\n ret["stats"] = prop;\n return ret;\n }\n f5get() {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var comp = __privateGet(this, _frame).components[0];\n if (comp.componentId != 1) {\n for (var i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n var coeff = new Int16Array(comp.blocks.length);\n coeff.set(comp.blocks);\n var pos = -1, extrBit = 0, cCount = coeff.length - 1;\n var n, k = 0;\n var out = new Uint8Array(coeff.length / 8 | 0), extrByte = 0, outPos = 0, bitsAvail = 0, code = 0, hash = 0;\n while (bitsAvail < 4) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n k |= extrBit << bitsAvail;\n bitsAvail++;\n }\n k = (k & 15) + 1;\n n = (1 << k) - 1;\n bitsAvail = 0;\n if (k == 1) {\n while (pos < cCount) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n extrByte |= extrBit << bitsAvail;\n bitsAvail++;\n if (bitsAvail == 8) {\n out[outPos++] = extrByte;\n extrByte = 0;\n bitsAvail = 0;\n }\n }\n } else {\n while (pos < cCount) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n hash ^= extrBit * ++code;\n if (code == n) {\n extrByte |= hash << bitsAvail;\n bitsAvail += k;\n code = 0;\n hash = 0;\n while (bitsAvail >= 8) {\n out[outPos++] = extrByte & 255;\n bitsAvail -= 8;\n extrByte = extrByte >> 8;\n }\n }\n }\n }\n while (bitsAvail > 0) {\n out[outPos++] = extrByte & 255;\n bitsAvail -= 8;\n extrByte = extrByte >> 8;\n }\n var s = 2, l = out[0];\n if (out[1] & 128) {\n s++;\n l += ((out[1] & 127) << 8) + (out[2] << 15);\n } else {\n l += out[1] << 8;\n }\n return out.subarray(s, s + l);\n }\n parse(data, tolerant = false) {\n var offset = 0;\n function _buildHuffmanTable(nrcodes, values) {\n var codevalue = 0, pos_in_table = 0, HT = new Uint16Array(65536);\n for (var k = 0; k < 16; k++) {\n for (var j2 = 0; j2 < nrcodes[k]; j2++) {\n for (var i2 = codevalue << 15 - k, cntTo = codevalue + 1 << 15 - k; i2 < cntTo; i2++) {\n HT[i2] = values[pos_in_table] + (k + 1 << 8);\n }\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n }\n function decodeScan(data2, offset2, frame, components2, resetInterval2, spectralStart2, spectralEnd2, successivePrev, successive) {\n var startOffset = offset2, bitsData = 0, bitsCount = 0, eobrun = 0, p1 = 1 << successive, m1 = -1 << successive;\n function decodeBaseline(component2, pos) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n var t = component2.huffmanTableDC[bitsData >>> bitsCount - 16 & 65535];\n if (!t)\n throw "invalid huffman sequence";\n bitsCount -= t >>> 8;\n t &= 255;\n var diff = 0;\n if (t !== 0) {\n while (bitsCount < t) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n diff = bitsData >>> bitsCount - t & (1 << t) - 1;\n bitsCount -= t;\n if (diff < 1 << t - 1)\n diff += (-1 << t) + 1;\n }\n component2.blocksDC[pos >> 6] = component2.pred += diff;\n var k2 = 1, s, r;\n while (k2 < 64) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s === 0) {\n if (r < 15) {\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n while (bitsCount < s) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n component2.blocks[pos + k2] = bitsData >>> bitsCount - s & (1 << s) - 1;\n bitsCount -= s;\n if (component2.blocks[pos + k2] < 1 << s - 1)\n component2.blocks[pos + k2] += (-1 << s) + 1;\n k2++;\n }\n }\n function decodeDCFirst(component2, pos) {\n var diff = 0;\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n var t = component2.huffmanTableDC[bitsData >>> bitsCount - 16 & 65535];\n if (!t)\n throw "invalid huffman sequence";\n bitsCount -= t >>> 8;\n t &= 255;\n if (t !== 0) {\n while (bitsCount < t) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n diff = bitsData >>> bitsCount - t & (1 << t) - 1;\n bitsCount -= t;\n if (diff < 1 << t - 1)\n diff += (-1 << t) + 1;\n }\n component2.blocksDC[pos >> 6] = component2.pred += diff << successive;\n }\n function decodeDCSuccessive(component2, pos) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocksDC[pos >> 6] |= (bitsData >>> --bitsCount & 1) << successive;\n }\n if (!frame)\n throw "Frame not parsed yet";\n function decodeACFirst(component2, pos) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k2 = spectralStart2, s, r;\n while (k2 <= spectralEnd2) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s === 0) {\n if (r != 15) {\n eobrun = (1 << r) - 1;\n if (r) {\n while (bitsCount < r) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n eobrun += bitsData >>> bitsCount - r & (1 << r) - 1;\n bitsCount -= r;\n }\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n while (bitsCount < s) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n component2.blocks[pos + k2] = bitsData >>> bitsCount - s & (1 << s) - 1;\n bitsCount -= s;\n if (component2.blocks[pos + k2] < 1 << s - 1)\n component2.blocks[pos + k2] += (-1 << s) + 1;\n component2.blocks[pos + k2] *= p1;\n k2++;\n }\n }\n function decodeACSuccessive(component2, pos) {\n var k2 = spectralStart2, r, s;\n if (frame == null)\n throw "Frame not defined";\n if (!eobrun) {\n while (k2 <= spectralEnd2) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s) {\n if (s != 1)\n throw "bad jpeg";\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n s = bitsData >>> --bitsCount & 1 ? p1 : m1;\n } else {\n if (r != 15) {\n eobrun = 1 << r;\n if (r) {\n while (bitsCount < r) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n eobrun += bitsData >>> bitsCount - r & (1 << r) - 1;\n bitsCount -= r;\n }\n break;\n }\n }\n while (k2 <= spectralEnd2) {\n if (component2.blocks[pos + k2]) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocks[pos + k2] += (bitsData >>> --bitsCount & 1) * (component2.blocks[pos + k2] >= 0 ? p1 : m1);\n } else {\n if (--r < 0)\n break;\n }\n k2++;\n }\n if (s)\n component2.blocks[pos + k2] = s;\n k2++;\n }\n }\n if (eobrun) {\n while (k2 <= spectralEnd2) {\n if (component2.blocks[pos + k2]) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocks[pos + k2] += (bitsData >>> --bitsCount & 1) * (component2.blocks[pos + k2] >= 0 ? p1 : m1);\n }\n k2++;\n }\n eobrun--;\n }\n }\n var decodeFn;\n if (frame.progressive) {\n if (spectralStart2 === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n var marker, mcuExpected, i2, j2, k, n, mcusPerLine2, mcusPerRow, x, y;\n if (components2.length == 1) {\n mcusPerLine2 = components2[0].blocksPerLine;\n mcusPerRow = components2[0].blocksPerColumn;\n mcuExpected = mcusPerRow * mcusPerLine2;\n if (!resetInterval2)\n resetInterval2 = mcuExpected;\n n = resetInterval2;\n components2[0].pred = 0;\n eobrun = 0;\n for (y = 0; y < mcusPerRow; y++) {\n for (x = 0; x < mcusPerLine2; x++) {\n if (!n) {\n n = resetInterval2;\n components2[0].pred = 0;\n eobrun = 0;\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n bitsCount = 0;\n marker = data2[offset2] << 8 | data2[offset2 + 1];\n if (marker >= 65488 && marker <= 65495) {\n offset2 += 2;\n } else {\n if (marker <= 65280) {\n throw "bad jpeg";\n }\n break;\n }\n }\n n--;\n for (i2 = 0; i2 < components2.length; i2++) {\n decodeFn(components2[i2], (y * components2[i2].blocksPerLineForMcu + x) * 64);\n }\n }\n }\n } else {\n mcusPerLine2 = frame.mcusPerLine;\n mcusPerRow = frame.mcusPerColumn;\n mcuExpected = mcusPerRow * mcusPerLine2;\n if (!resetInterval2)\n resetInterval2 = mcuExpected;\n n = resetInterval2;\n for (i2 = 0; i2 < components2.length; i2++)\n components2[i2].pred = 0;\n eobrun = 0;\n for (y = 0; y < mcusPerRow; y++) {\n for (x = 0; x < mcusPerLine2; x++) {\n if (!n) {\n n = resetInterval2;\n for (i2 = 0; i2 < components2.length; i2++)\n components2[i2].pred = 0;\n eobrun = 0;\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n bitsCount = 0;\n marker = data2[offset2] << 8 | data2[offset2 + 1];\n if (marker >= 65488 && marker <= 65495) {\n offset2 += 2;\n } else {\n if (marker <= 65280) {\n throw "bad jpeg";\n }\n break;\n }\n }\n n--;\n for (i2 = 0; i2 < components2.length; i2++) {\n for (j2 = 0; j2 < components2[i2].v; j2++) {\n for (k = 0; k < components2[i2].h; k++) {\n decodeFn(components2[i2], ((y * components2[i2].v + j2) * components2[i2].blocksPerLineForMcu + x * components2[i2].h + k) * 64);\n }\n }\n }\n }\n }\n }\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n return offset2 - startOffset;\n }\n function readUint16() {\n var value = data[offset] << 8 | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length = readUint16();\n var array = data.subarray(offset, offset + length - 2);\n offset += array.length;\n return array;\n }\n __privateSet(this, __raw, data);\n __privateSet(this, _jfif, null);\n __privateSet(this, _APPn, []);\n __privateSet(this, _qts, []);\n __privateSet(this, _frame, null);\n __privateSet(this, _tail, null);\n var markerHi, markerLo, i, j, resetInterval, component;\n let huffmanTablesAC = [];\n let huffmanTablesDC = [];\n while (1) {\n if (offset >= data.length) {\n if (tolerant)\n break;\n throw "unexpected EOF";\n }\n markerHi = data[offset++];\n markerLo = data[offset++];\n if (markerHi == 255) {\n if (markerLo == 224) {\n __privateSet(this, _jfif, readDataBlock());\n }\n if (markerLo > 224 && markerLo < 240 || markerLo == 254) {\n __privateGet(this, _APPn).push({\n "app": markerLo,\n "data": readDataBlock()\n });\n }\n if (markerLo == 219) {\n __privateGet(this, _qts).push(readDataBlock());\n }\n if (markerLo >= 192 && markerLo <= 194) {\n if (__privateGet(this, _frame))\n throw "Only single frame JPEGs supported";\n readUint16();\n __privateSet(this, _frame, {\n "extended": markerLo === 193,\n "progressive": markerLo === 194,\n "precision": data[offset++],\n "scanLines": readUint16(),\n "samplesPerLine": readUint16(),\n "components": [],\n "componentIds": {},\n "maxH": 1,\n "maxV": 1\n });\n if (__privateGet(this, _frame).scanLines * __privateGet(this, _frame).samplesPerLine > this.maxPixels)\n throw "Image is too big.";\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n if (maxH < h)\n maxH = h;\n if (maxV < v)\n maxV = v;\n var qId = data[offset + 2];\n var l = __privateGet(this, _frame).components.push({\n componentId,\n h,\n v,\n quantizationTable: qId\n });\n __privateGet(this, _frame).componentIds[componentId] = l - 1;\n offset += 3;\n }\n __privateGet(this, _frame).maxH = maxH;\n __privateGet(this, _frame).maxV = maxV;\n var mcusPerLine = Math.ceil(__privateGet(this, _frame).samplesPerLine / 8 / maxH);\n var mcusPerColumn = Math.ceil(__privateGet(this, _frame).scanLines / 8 / maxV);\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n component = __privateGet(this, _frame).components[i];\n var blocksPerLine = Math.ceil(Math.ceil(__privateGet(this, _frame).samplesPerLine / 8) * component.h / maxH);\n var blocksPerColumn = Math.ceil(Math.ceil(__privateGet(this, _frame).scanLines / 8) * component.v / maxV);\n var blocksPerLineForMcu = mcusPerLine * component.h;\n var blocksPerColumnForMcu = mcusPerColumn * component.v;\n __privateGet(this, _frame).components[i] = {\n ...component,\n blocks: new Int16Array(blocksPerColumnForMcu * blocksPerLineForMcu * 64),\n blocksDC: new Int16Array(blocksPerColumnForMcu * blocksPerLineForMcu),\n blocksPerLine,\n blocksPerColumn,\n blocksPerLineForMcu,\n blocksPerColumnForMcu\n };\n }\n __privateGet(this, _frame).mcusPerLine = mcusPerLine;\n __privateGet(this, _frame).mcusPerColumn = mcusPerColumn;\n }\n if (markerLo == 196) {\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength; ) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++)\n codeLengthSum += codeLengths[j] = data[offset];\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n const v2 = _buildHuffmanTable(codeLengths, huffmanValues);\n if (huffmanTableSpec >> 4 === 0)\n huffmanTablesDC[huffmanTableSpec & 15] = v2;\n else\n huffmanTablesAC[huffmanTableSpec & 15] = v2;\n }\n }\n if (markerLo == 221) {\n resetInterval = readUint16();\n }\n if (markerLo == 218) {\n if (__privateGet(this, _frame) == null)\n throw "SOS before SOF";\n readUint16();\n var selectorsCount = data[offset++];\n var components = [];\n for (i = 0; i < selectorsCount; i++) {\n var componentIndex = __privateGet(this, _frame).componentIds[data[offset++]];\n component = __privateGet(this, _frame).components[componentIndex];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset, __privateGet(this, _frame), components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);\n offset += processed;\n }\n if (markerLo == 217) {\n break;\n }\n } else {\n if (data[offset - 3] == 255 && data[offset - 2] >= 192 && data[offset - 2] <= 254) {\n offset -= 3;\n }\n while (data[offset] != 255 && offset < data.length) {\n offset++;\n }\n if (data[offset] != 255) {\n throw "bad jpeg ";\n }\n }\n }\n if (!__privateGet(this, _frame))\n throw "bad jpeg";\n if (offset < data.length)\n __privateSet(this, _tail, data.subarray(offset));\n return this;\n }\n pack() {\n let byteout;\n let bytenew;\n let bytepos;\n let poslast;\n let outpos;\n let byte;\n function writeByte(value) {\n var t;\n byteout[outpos++] = value;\n if (outpos > poslast) {\n t = new Uint8Array(byteout.length * 2);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n }\n function writeWord(value) {\n writeByte(value >> 8 & 255);\n writeByte(value & 255);\n }\n function writeBlock(block) {\n var t;\n if (outpos + block.length > poslast) {\n t = new Uint8Array(byteout.length * 2 + block.length);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n byteout.set(block, outpos);\n outpos += block.length;\n }\n function writeAPP0(self2) {\n writeWord(65504);\n if (!__privateGet(self2, _jfif)) {\n writeWord(16);\n writeByte(74);\n writeByte(70);\n writeByte(73);\n writeByte(70);\n writeByte(0);\n writeByte(1);\n writeByte(1);\n writeByte(0);\n writeWord(1);\n writeWord(1);\n writeByte(0);\n writeByte(0);\n } else {\n writeWord(__privateGet(self2, _jfif).length + 2);\n writeBlock(__privateGet(self2, _jfif));\n }\n }\n function writeDQT(self2) {\n for (var i2 = 0; i2 < __privateGet(self2, _qts).length; i2++) {\n writeWord(65499);\n writeWord(__privateGet(self2, _qts)[i2].length + 2);\n writeBlock(__privateGet(self2, _qts)[i2]);\n }\n }\n function writeAPPn(self2) {\n for (var i2 = 0; i2 < __privateGet(self2, _APPn).length; i2++) {\n writeWord(65280 | __privateGet(self2, _APPn)[i2].app);\n writeWord(__privateGet(self2, _APPn)[i2].data.length + 2);\n writeBlock(__privateGet(self2, _APPn)[i2].data);\n }\n }\n function writeSOF0(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65472);\n writeWord(8 + __privateGet(self2, _frame).components.length * 3);\n writeByte(__privateGet(self2, _frame).precision);\n writeWord(__privateGet(self2, _frame).scanLines);\n writeWord(__privateGet(self2, _frame).samplesPerLine);\n writeByte(__privateGet(self2, _frame).components.length);\n for (var i2 = 0; i2 < __privateGet(self2, _frame).components.length; i2++) {\n var c2 = __privateGet(self2, _frame).components[i2];\n writeByte(c2.componentId);\n writeByte(c2.h << 4 | c2.v);\n writeByte(c2.quantizationTable);\n }\n }\n function writeDHT(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65476);\n writeWord(31);\n writeByte(0);\n for (var i2 = 0; i2 < 16; i2++) {\n writeByte(std_dc_luminance_nrcodes[i2 + 1]);\n }\n for (var j = 0; j <= 11; j++) {\n writeByte(std_dc_luminance_values[j]);\n }\n writeWord(65476);\n writeWord(181);\n writeByte(16);\n for (var k = 0; k < 16; k++) {\n writeByte(std_ac_luminance_nrcodes[k + 1]);\n }\n for (var l = 0; l <= 161; l++) {\n writeByte(std_ac_luminance_values[l]);\n }\n if (__privateGet(self2, _frame).components.length != 1) {\n writeWord(65476);\n writeWord(31);\n writeByte(1);\n for (var m = 0; m < 16; m++) {\n writeByte(std_dc_chrominance_nrcodes[m + 1]);\n }\n for (var n = 0; n <= 11; n++) {\n writeByte(std_dc_chrominance_values[n]);\n }\n writeWord(65476);\n writeWord(181);\n writeByte(17);\n for (var o = 0; o < 16; o++) {\n writeByte(std_ac_chrominance_nrcodes[o + 1]);\n }\n for (var p = 0; p <= 161; p++) {\n writeByte(std_ac_chrominance_values[p]);\n }\n }\n }\n function writeSOS(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65498);\n writeWord(6 + __privateGet(self2, _frame).components.length * 2);\n writeByte(__privateGet(self2, _frame).components.length);\n for (var i2 = 0; i2 < __privateGet(self2, _frame).components.length; i2++) {\n var c2 = __privateGet(self2, _frame).components[i2];\n writeByte(c2.componentId);\n if (i2 === 0) {\n writeByte(0);\n } else {\n writeByte(17);\n }\n }\n writeByte(0);\n writeByte(63);\n writeByte(0);\n }\n function processDU(comp, POS, DC, HTDC, HTAC) {\n var pos, posval, t;\n if (bytepos === 0)\n bytenew = 0;\n if (!("blocks" in comp))\n throw "Blocks not parsed";\n var Diff = comp.blocksDC[POS >> 6] - DC;\n DC = comp.blocksDC[POS >> 6];\n if (Diff === 0) {\n posval = HTDC[0][1];\n bytenew <<= posval;\n bytenew += HTDC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n } else {\n pos = 32767 + Diff;\n posval = HTDC[category[pos]][1];\n bytenew <<= posval;\n bytenew += HTDC[category[pos]][0];\n bytepos += posval;\n posval = bitcode[pos][1];\n bytenew <<= posval;\n bytenew += bitcode[pos][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n var end0pos = 63;\n for (; end0pos > 0 && comp.blocks[POS + end0pos] === 0; end0pos--) {\n }\n if (end0pos === 0) {\n posval = HTAC[0][1];\n bytenew <<= posval;\n bytenew += HTAC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n return DC;\n }\n var i2 = 1;\n var lng;\n while (i2 <= end0pos) {\n var startpos = i2;\n for (; comp.blocks[POS + i2] === 0 && i2 <= end0pos; ++i2) {\n }\n var nrzeroes = i2 - startpos;\n if (nrzeroes >= 16) {\n lng = nrzeroes >> 4;\n for (var nrmarker = 1; nrmarker <= lng; ++nrmarker) {\n posval = HTAC[240][1];\n bytenew <<= posval;\n bytenew += HTAC[240][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n nrzeroes = nrzeroes & 15;\n }\n pos = 32767 + comp.blocks[POS + i2];\n posval = HTAC[(nrzeroes << 4) + category[pos]][1];\n bytenew <<= posval;\n bytenew += HTAC[(nrzeroes << 4) + category[pos]][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n posval = bitcode[pos][1];\n bytenew <<= posval;\n bytenew += bitcode[pos][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n i2++;\n }\n if (end0pos != 63) {\n posval = HTAC[0][1];\n bytenew <<= posval;\n bytenew += HTAC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n if (outpos > poslast) {\n t = new Uint8Array(byteout.length * 2);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n return DC;\n }\n byteout = new Uint8Array(65536);\n poslast = 65536 - 128;\n outpos = 0;\n bytenew = 0;\n bytepos = 0;\n writeWord(65496);\n writeAPP0(this);\n writeAPPn(this);\n writeDQT(this);\n writeSOF0(this);\n writeDHT(this);\n writeSOS(this);\n bytenew = 0;\n bytepos = 0;\n if (!__privateGet(this, _frame))\n throw "Frame not ready";\n var c, mcuRow, mcuCol, blockRow, blockCol, mcu, i, v, h;\n var DCdiff = [];\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n DCdiff.push(0);\n }\n for (mcu = 0; mcu < __privateGet(this, _frame).mcusPerLine * __privateGet(this, _frame).mcusPerColumn; mcu++) {\n mcuRow = mcu / __privateGet(this, _frame).mcusPerLine | 0;\n mcuCol = mcu % __privateGet(this, _frame).mcusPerLine;\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n c = __privateGet(this, _frame).components[i];\n for (v = 0; v < c.v; v++) {\n blockRow = mcuRow * c.v + v;\n for (h = 0; h < c.h; h++) {\n blockCol = mcuCol * c.h + h;\n if (i === 0) {\n DCdiff[i] = processDU(c, (blockRow * __privateGet(this, _frame).mcusPerLine * c.h + blockCol) * 64, DCdiff[i], YDC_HT, YAC_HT);\n } else {\n DCdiff[i] = processDU(c, (blockRow * __privateGet(this, _frame).mcusPerLine * c.h + blockCol) * 64, DCdiff[i], UVDC_HT, UVAC_HT);\n }\n }\n }\n }\n }\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n }\n if (bytepos > 0) {\n bytenew <<= 8 - bytepos;\n bytenew += (1 << 8 - bytepos) - 1;\n byteout[outpos++] = 255 & bytenew;\n }\n writeWord(65497);\n if (__privateGet(this, _tail))\n writeBlock(__privateGet(this, _tail));\n return byteout.slice(0, outpos);\n }\n};\n_randPool = new WeakMap();\n__raw = new WeakMap();\n_jfif = new WeakMap();\n_APPn = new WeakMap();\n_qts = new WeakMap();\n_frame = new WeakMap();\n_tail = new WeakMap();\n_shuffleInit = new WeakSet();\nshuffleInit_fn = function(key2) {\n __privateSet(this, _randPool, new ArrayBuffer(this.maxPixels * 4.125));\n if (!key2.length)\n throw "key needed";\n var i = 0, j = 0, t = 0, k = 0, S = new Uint8Array(256), rnd = new Uint8Array(__privateGet(this, _randPool));\n for (i = 0; i < 256; ++i)\n S[i] = i;\n for (i = 0; i < 256; ++i) {\n j = j + S[i] + key2[i % key2.length] & 255;\n t = S[i];\n S[i] = S[j];\n S[j] = t;\n }\n i = 0;\n j = 0;\n for (k = 0; k < this.maxPixels * 4.125; ++k) {\n i = i + 1 & 255;\n j = j + S[i] & 255;\n t = S[i];\n S[i] = S[j];\n S[j] = t;\n rnd[k] = S[t + S[i] & 255];\n }\n};\n_stegShuffle = new WeakSet();\nstegShuffle_fn = function(pm) {\n let t, l, k, random_index, rand32Array = new Uint32Array(__privateGet(this, _randPool));\n if (typeof pm == "number") {\n l = pm;\n pm = new Uint32Array(l);\n for (k = 1; k < l; k++) {\n random_index = rand32Array[k] % (k + 1);\n if (random_index != k)\n pm[k] = pm[random_index];\n pm[random_index] = k;\n }\n } else {\n l = pm.length;\n for (k = 1; k < l; k++) {\n random_index = rand32Array[k] % (k + 1);\n t = pm[k];\n pm[k] = pm[random_index];\n pm[random_index] = t;\n }\n }\n return { pm, gamma: new Uint8Array(__privateGet(this, _randPool), l * 4) };\n};\n__analyze = new WeakSet();\n_analyze_fn = function(coeff) {\n var _one = 0, _zero = 0, _large, _ratio, usable, i, k, embedded, matched, changed;\n for (i = 0; i < coeff.length; i++) {\n if (i % 64 === 0)\n continue;\n if (coeff[i] === 0)\n _zero++;\n if (coeff[i] == 1 || coeff[i] == -1)\n _one++;\n }\n _large = coeff.length - _zero - _one - coeff.length / 64;\n _ratio = _one / (_large + _one);\n var res = {\n "capacity": [0, (_large + 0.49 * _one >> 3) - 1],\n "coeff_total": coeff.length,\n "coeff_large": _large,\n "coeff_zero": _zero,\n "coeff_one": _one,\n "coeff_one_ratio": _one / (_large + _one)\n };\n for (i = 2; i < 17; i++) {\n k = (1 << i) - 1;\n usable = _large + _one;\n embedded = 0;\n while (usable > k) {\n matched = usable / k / (1 << i) / (1 << i) | 0;\n usable -= matched * k;\n changed = usable * (1 - _ratio) / k * 0.96 | 0;\n usable -= changed * k;\n embedded += changed + matched;\n k++;\n }\n res.capacity[i] = (i * embedded >> 3) - 1;\n }\n return res;\n};\n__f5write = new WeakSet();\n_f5write_fn = function(coeff, data, k) {\n var coeff_count = coeff.length;\n var _changed = 0, _embedded = 0, _examined = 0, _thrown = 0, shuffled_index = 0, i, n, ii;\n var next_bit_to_embed = 0, byte_to_embed = data.length, data_idx = 0, available_bits_to_embed = 0;\n n = (1 << k) - 1;\n byte_to_embed = k - 1;\n byte_to_embed ^= 0;\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed = 3;\n for (ii = 0; ii < coeff_count; ii++) {\n shuffled_index = ii;\n if (shuffled_index % 64 === 0 || coeff[shuffled_index] === 0)\n continue;\n var cc = coeff[shuffled_index];\n _examined++;\n if (cc > 0 && (cc & 1) != next_bit_to_embed) {\n coeff[shuffled_index]--;\n _changed++;\n } else if (cc < 0 && (cc & 1) == next_bit_to_embed) {\n coeff[shuffled_index]++;\n _changed++;\n }\n if (coeff[shuffled_index] !== 0) {\n _embedded++;\n if (available_bits_to_embed === 0) {\n if (k != 1 || data_idx >= data.length)\n break;\n byte_to_embed = data[data_idx++];\n byte_to_embed ^= 0;\n available_bits_to_embed = 8;\n }\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed--;\n } else {\n _thrown++;\n }\n }\n if (k == 1 && _embedded < data.length * 8)\n throw "capacity exceeded " + _embedded / 8 + " " + data.length;\n if (k != 1) {\n var is_last_byte = false, k_bits_to_embed = 0;\n while (!is_last_byte || available_bits_to_embed !== 0 && is_last_byte) {\n k_bits_to_embed = 0;\n for (i = 0; i < k; i++) {\n if (available_bits_to_embed === 0) {\n if (data_idx >= data.length) {\n is_last_byte = true;\n break;\n }\n byte_to_embed = data[data_idx++];\n byte_to_embed ^= 0;\n available_bits_to_embed = 8;\n }\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed--;\n k_bits_to_embed |= next_bit_to_embed << i;\n }\n var code_word = [];\n var ci = null;\n for (i = 0; i < n; i++) {\n while (true) {\n if (++ii >= coeff_count) {\n throw "capacity exceeded " + _embedded / 8;\n }\n ci = ii;\n if (ci % 64 !== 0 && coeff[ci] !== 0)\n break;\n }\n code_word.push(ci);\n }\n _examined += n;\n while (true) {\n var vhash = 0, extracted_bit;\n for (i = 0; i < code_word.length; i++) {\n if (coeff[code_word[i]] > 0) {\n extracted_bit = coeff[code_word[i]] & 1;\n } else {\n extracted_bit = 1 - (coeff[code_word[i]] & 1);\n }\n if (extracted_bit == 1)\n vhash ^= i + 1;\n }\n i = vhash ^ k_bits_to_embed;\n if (!i) {\n _embedded += k;\n break;\n }\n i--;\n coeff[code_word[i]] += coeff[code_word[i]] < 0 ? 1 : -1;\n _changed++;\n if (coeff[code_word[i]] === 0) {\n _thrown++;\n code_word.splice(i, 1);\n while (true) {\n if (++ii >= coeff_count) {\n throw "capacity exceeded " + _embedded / 8;\n }\n ci = ii;\n if (ci % 64 !== 0 && coeff[ci] !== 0)\n break;\n }\n _examined++;\n code_word.push(ci);\n } else {\n _embedded += k;\n break;\n }\n }\n }\n }\n return {\n "k": k,\n "embedded": _embedded / 8,\n "examined": _examined,\n "changed": _changed,\n "thrown": _thrown,\n "efficiency": (_embedded / _changed).toFixed(2)\n };\n};\n\n// src/jpg.ts\nvar key = import_buffer4.Buffer.from("CUNNYCUNNYCUNNY");\nvar f5inst = new f5stego(key);\nvar inject2 = async (b, links) => {\n if (b.size / 20 < links.join(" ").length)\n throw "Image too small to embed.";\n const arr = new Uint8Array(new Uint8Array(await b.arrayBuffer()));\n const buff = f5inst.embed(arr, new TextEncoder().encode(links.join(" ")), 1);\n return import_buffer4.Buffer.from(buff);\n};\nvar has_embed2 = (b) => {\n try {\n const res = f5inst.extract(b);\n if (!res)\n return false;\n if (res.length > 1024)\n return false;\n const str = import_buffer4.Buffer.from(res).toString();\n if (!str.match(/^[a-zA-Z0-9:/.\\-_ ]+$/))\n return false;\n return str;\n } catch {\n return false;\n }\n};\nvar extract2 = (b, ex) => {\n return decodeCoom3Payload(import_buffer4.Buffer.from(ex));\n};\nvar jpg_default = {\n match: (fn) => !!fn.match(/\\.jpe?g$/),\n has_embed: has_embed2,\n extract: extract2,\n inject: inject2\n};\n\n// src/thirdeye.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer5 = __toESM(require_buffer(), 1);\nvar import_jpeg_js = __toESM(require_jpeg_js(), 1);\n\n// src/phash.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar median = (data) => {\n const mdarr = data.slice(0);\n mdarr.sort((a, b) => a - b);\n if (mdarr.length % 2 === 0)\n return (mdarr[mdarr.length / 2 - 1] + mdarr[mdarr.length / 2]) / 2;\n return mdarr[Math.floor(mdarr.length / 2)];\n};\nvar translate_blocks_to_bits = function(blocks, pixels_per_block) {\n const half_block_value = pixels_per_block * 256 * 3 / 2;\n const bandsize = blocks.length / 4;\n for (let i = 0; i < 4; i++) {\n const m = median(blocks.slice(i * bandsize, (i + 1) * bandsize));\n for (let j = i * bandsize; j < (i + 1) * bandsize; j++) {\n const v = blocks[j];\n blocks[j] = Number(v > m || Math.abs(v - m) < 1 && m > half_block_value);\n }\n }\n};\nvar bits_to_hexhash = (bitsArray) => {\n const hex = [];\n for (let i = 0; i < bitsArray.length; i += 4) {\n const nibble = bitsArray.slice(i, i + 4);\n hex.push(parseInt(nibble.join(""), 2).toString(16));\n }\n return hex.join("");\n};\nvar bmvbhash_even = (data, bits) => {\n const blocksize_x = Math.floor(data.width / bits);\n const blocksize_y = Math.floor(data.height / bits);\n const result = [];\n for (let y = 0; y < bits; y++) {\n for (let x = 0; x < bits; x++) {\n let total = 0;\n for (let iy = 0; iy < blocksize_y; iy++) {\n for (let ix = 0; ix < blocksize_x; ix++) {\n const cx = x * blocksize_x + ix;\n const cy = y * blocksize_y + iy;\n const ii = (cy * data.width + cx) * 4;\n const alpha = data.data[ii + 3];\n if (alpha === 0) {\n total += 765;\n } else {\n total += data.data[ii] + data.data[ii + 1] + data.data[ii + 2];\n }\n }\n }\n result.push(total);\n }\n }\n translate_blocks_to_bits(result, blocksize_x * blocksize_y);\n return bits_to_hexhash(result);\n};\n\n// src/thirdeye.ts\nvar csettings3;\nsettings.subscribe((b) => {\n csettings3 = b;\n});\nvar gelquirk = (prefix) => (a) => {\n let base = a.post || a.data || a;\n if (!Array.isArray(base))\n return [];\n base = base.filter((e) => e.file_url);\n return base.map((e) => ({\n full_url: e.file_url,\n preview_url: e.preview_url || e.preview_url,\n source: e.source,\n ext: e.file_ext || e.file_url.substr(e.file_url.lastIndexOf(".") + 1),\n page: `${prefix}${e.id || e.parent_id}`,\n tags: (e.tag_string || (e.tags && (Array.isArray(e.tags) && (typeof e.tags[0] == "string" ? e.tags.join(" ") : e.tags.map((e2) => e2.name_en).join(" "))) || e.tags) || "").split(" ")\n })) || [];\n};\nvar experimentalApi = false;\nvar black = /* @__PURE__ */ new Set();\nvar phashEn = false;\nvar mindist = 5;\nsettings.subscribe((s) => {\n if (!s)\n return;\n experimentalApi = s.expte;\n boorus = s.rsources.map((e) => ({\n ...e,\n quirks: gelquirk(e.view)\n }));\n black = new Set(s.blacklist);\n mindist = s.mdist || 5;\n phashEn = s.phash;\n});\nvar boorus = [];\nvar unlockQueue = Promise.resolve();\nvar cache = {};\nvar findFileFrom = async (b, hex, abort) => {\n try {\n if (b.domain in cache && hex in cache[b.domain])\n return cache[b.domain][hex];\n const res = await ifetch(`https://${b.domain}${b.endpoint}${hex}`);\n const txt = await res.text();\n const pres = JSON.parse(txt);\n const tran = b.quirks(pres).filter((e) => !e.tags.some((e2) => black.has(e2)));\n if (!(b.domain in cache))\n cache[b.domain] = {};\n cache[b.domain][hex] = tran;\n return tran;\n } catch (e) {\n const error = e;\n if (!error.message.includes("Unexpected end of JSON input"))\n console.error(e);\n return [];\n }\n};\nvar extract3 = async (b, fn) => {\n if (!csettings3)\n throw new Error("Settings uninit");\n let result;\n let booru;\n for (const e of Object.values(boorus)) {\n if (e.disabled)\n continue;\n result = await findFileFrom(e, fn.substring(0, 32));\n if (result.length) {\n booru = e.name;\n break;\n }\n }\n let cachedFile;\n const prev = result[0].preview_url;\n const full = result[0].full_url;\n return [{\n source: result[0].source,\n page: {\n title: booru,\n url: result[0].page\n },\n filename: fn.substring(0, 33) + result[0].ext,\n thumbnail: csettings3.hotlink ? prev || full : import_buffer5.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()),\n data: csettings3.hotlink ? full || prev : { url: full || prev }\n }];\n};\nvar phash = (b) => {\n const res = (0, import_jpeg_js.decode)(b);\n return bmvbhash_even(res, 8);\n};\nvar hammingDist = (a, b) => {\n let res = BigInt("0x" + a) ^ BigInt("0x" + b);\n let acc = 0;\n while (res != 0n) {\n acc += Number(res & 1n);\n res >>= 1n;\n }\n return acc;\n};\nvar has_embed3 = async (b, fn, prevlink) => {\n if (import_buffer5.Buffer.from(fn, "hex").equals(b))\n return false;\n let result = void 0;\n for (const e of Object.values(boorus)) {\n if (e.disabled)\n continue;\n result = await findFileFrom(e, fn.substring(0, 32));\n result = result.filter((e2) => e2.full_url || e2.preview_url);\n if (result.length)\n break;\n }\n if (result && result.length != 0 && phashEn && prevlink) {\n if (!result[0].preview_url)\n return true;\n const getHash = async (l) => {\n const ogreq = await ifetch(l);\n const origPreview = await ogreq.arrayBuffer();\n return phash(import_buffer5.Buffer.from(origPreview));\n };\n const [orighash, tehash] = await Promise.all([\n getHash(prevlink),\n getHash(result[0].preview_url)\n ]);\n const d = hammingDist(orighash, tehash);\n console.log(d, prevlink);\n return d > mindist;\n }\n return result && result.length != 0;\n};\nvar thirdeye_default = {\n skip: true,\n extract: extract3,\n has_embed: has_embed3,\n match: (fn) => !!fn.match(/^[0-9a-f]{32}\\.....?/)\n};\n\n// src/pomf.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer6 = __toESM(require_buffer(), 1);\nvar sources = [\n { host: "Catbox", prefix: "files.catbox.moe/" },\n { host: "Litter", prefix: "litter.catbox.moe/" },\n { host: "Zzzz", prefix: "z.zz.fo/" }\n];\nvar csettings4;\nsettings.subscribe((b) => {\n csettings4 = b;\n});\nvar getExt = (fn) => {\n const isB64 = fn.match(/^((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=))?\\.(gif|jpe?g|png|webm)/);\n const isExt = fn.match(/\\[.*=(.*)\\]/);\n let ext;\n let source;\n try {\n if (isB64) {\n ext = atob(isB64[1]);\n } else if (isExt) {\n ext = decodeURIComponent(isExt[1]);\n if (ext.startsWith("https://"))\n ext = ext.slice("https://".length);\n for (const cs of sources)\n if (ext.startsWith(cs.prefix)) {\n source = cs.prefix;\n ext = ext.slice(cs.prefix.length);\n break;\n }\n }\n } catch {\n }\n return { ext, source };\n};\nvar extract4 = async (b, fn) => {\n if (!csettings4)\n throw new Error("Settings uninit");\n const { ext, source } = getExt(fn);\n let rsource;\n for (const cs of sources) {\n if (source && cs.prefix != source)\n continue;\n try {\n await getHeaders("https://" + cs.prefix + ext);\n rsource = "https://" + cs.prefix + ext;\n break;\n } catch {\n }\n }\n return [{\n filename: ext,\n data: csettings4.hotlink ? rsource : { url: rsource },\n thumbnail: import_buffer6.Buffer.from(hasembed_default)\n }];\n};\nvar has_embed4 = async (b, fn) => {\n const { ext, source } = getExt(fn);\n if (!ext)\n return false;\n for (const cs of sources) {\n if (source && cs.prefix != source)\n continue;\n try {\n const e = await getHeaders("https://" + cs.prefix + ext);\n return true;\n } catch {\n }\n }\n return false;\n};\nvar pomf_default = {\n skip: true,\n extract: extract4,\n has_embed: has_embed4,\n match: (fn) => !!getExt(fn)\n};\n\n// src/processor.worker.ts\nconsole.log("Worker started");\nvar pendinggens = {};\nvar proxyAsyncGen = (id) => {\n return {\n next(arg) {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n return(v) {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n throw() {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n};\nvar deserializeMessage = (m) => {\n if (typeof m == "object" && m.type == "AsyncGenerator") {\n return proxyAsyncGen(m.id);\n }\n if (typeof m == "object") {\n for (const p in m) {\n m[p] = deserializeMessage(m[p]);\n }\n }\n return m;\n};\nvar processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default];\nvar processImage = async (srcs, fn, hex, prevurl) => {\n const ret = await Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => {\n if (proc.skip) {\n const md5 = Buffer2.from(hex, "base64");\n if (await proc.has_embed(md5, fn, prevurl) === true) {\n return [await proc.extract(md5, fn), true];\n }\n return;\n }\n let succ = false;\n let cumul;\n do {\n try {\n const n = await srcs.next();\n if (n.done)\n return;\n const iter = streamRemote(n.value);\n if (!iter)\n return;\n cumul = Buffer2.alloc(0);\n let found;\n let chunk = { done: true };\n do {\n const { value, done } = await iter.next(typeof found === "boolean");\n if (done) {\n chunk = { done: true };\n } else {\n chunk = { done: false, value };\n cumul = Buffer2.concat([cumul, value]);\n const v = await proc.has_embed(cumul);\n if (typeof v == "string") {\n return [await proc.extract(cumul, v), false];\n }\n found = v;\n }\n } while (found !== false && !chunk.done);\n succ = true;\n await iter.next(true);\n if (found !== true) {\n return;\n }\n return [await proc.extract(cumul), false];\n } catch (err) {\n console.log(err);\n }\n } while (!succ);\n }));\n return ret.filter((e) => e).map((e) => e);\n};\n(async () => {\n onmessage = async (msg) => {\n const des = deserializeMessage(msg.data);\n switch (des.type) {\n case "ipc": {\n if (port1.onmessage)\n port1.onmessage(new MessageEvent("message", { data: des.res }));\n break;\n }\n case "cmd": {\n switch (des.fun) {\n case "processImage": {\n const res = await processImage(des.args[0], des.args[1], des.args[2], des.args[3]);\n const tr = [];\n for (const ef of res) {\n for (const e of ef[0]) {\n if (Buffer2.isBuffer(e.thumbnail) || e.thumbnail instanceof Uint8Array)\n tr.push(e.thumbnail.buffer);\n if (Buffer2.isBuffer(e.data) || e.data instanceof Uint8Array)\n tr.push(e.data.buffer);\n }\n }\n postMessage({\n type: "reply",\n id: des.id,\n res\n }, [...new Set(tr)]);\n }\n }\n break;\n }\n case "ag": {\n const cb = pendinggens[des.id].shift();\n if (cb) {\n cb(des.res);\n }\n break;\n }\n }\n };\n})();\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\n/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n'); + } + // src/main.ts + var ProcessWorker = Worker2; if (!supportedMainDomain(location.host) && !supportedAltDomain(location.host)) throw "PEE not supported here, skipping"; var qp; var csettings5; - var processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default, webm_default, gif_default]; + var processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default]; var cappState; settings.subscribe(async (b) => { if (!b) @@ -31843,68 +21609,13 @@ } } csettings5 = b; - processors = [ - ...!csettings5.te ? [thirdeye_default] : [], - pngv3_default, - pomf_default, - jpg_default, - webm_default, - gif_default - ]; }); appState.subscribe((v) => { cappState = v; }); - var processImage = async (srcs, fn, hex, prevurl) => { - const ret = await Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { - if (proc.skip) { - const md5 = import_buffer11.Buffer.from(hex, "base64"); - if (await proc.has_embed(md5, fn, prevurl) === true) { - return [await proc.extract(md5, fn), true]; - } - return; - } - let succ = false; - let cumul; - do { - try { - const n = await srcs.next(); - if (n.done) - return; - const iter = streamRemote(n.value); - if (!iter) - return; - cumul = import_buffer11.Buffer.alloc(0); - let found; - let chunk = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true }; - } else { - chunk = { done: false, value }; - cumul = import_buffer11.Buffer.concat([cumul, value]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return [await proc.extract(cumul, v), false]; - } - found = v; - } - } while (found !== false && !chunk.done); - succ = true; - await iter.next(true); - if (found !== true) { - return; - } - return [await proc.extract(cumul), false]; - } catch { - } - } while (!succ); - })); - return ret.filter((e) => e).map((e) => e); - }; var textToElement = (s) => document.createRange().createContextualFragment(s).children[0]; var pendingPosts = []; + var pendingNoPosts = []; var signalNewEmbeds = debounce(async () => { if (!csettings5) return; @@ -31913,16 +21624,20 @@ try { const boardname = location.pathname.match(/\/([^/]*)\//)[1]; const reshaped = Object.fromEntries([...new Set(pendingPosts.map((e) => e.op))].map((e) => [e, pendingPosts.filter((p) => p.op == e).map((e2) => e2.id)])); - console.log(reshaped); + const reshaped2 = Object.fromEntries([...new Set(pendingNoPosts.map((e) => e.op))].map((e) => [e, pendingPosts.filter((p) => p.op == e).map((e2) => e2.id)])); const res = await ifetch("https://shoujo.coom.tech/listing/" + boardname, { method: "POST", - body: JSON.stringify(reshaped), + body: JSON.stringify({ + emb: reshaped, + noemb: reshaped2 + }), headers: { "content-type": "application/json" } }); await res.json(); pendingPosts = []; + pendingNoPosts = []; } catch (e) { console.error(e); } @@ -31934,6 +21649,177 @@ return false; return typeof csettings5.cache == "boolean" ? csettings5.cache : location.hostname.includes("b4k"); }; + var cp; + var CommandProcessor = class { + constructor() { + this.processor = ProcessWorker(); + this.genid = 0; + this.pendinggens = {}; + this.cmdid = 0; + this.pendingprom = {}; + this.processor.onmessage = async (msg) => { + let gen; + let res; + switch (msg.data.type) { + case "ipc": + { + const id = msg.data.msg.id; + if (true) { + if (msg.data.msg.name == "corsFetch") { + sendCmd(msg.data.msg, msg.data.tr); + lqueue[id] = (res2) => { + this.processor.postMessage({ + type: "ipc", + id, + res: res2 + }); + }; + } else { + const repl = await sendCmd(msg.data.msg, msg.data.tr); + repl.id = id; + this.processor.postMessage({ + type: "ipc", + id, + res: repl + }); + } + } else { + if (msg.data.msg.name == "fullyRead") { + this.processor.postMessage({ + type: "ipc", + res: { + id, + ok: 1 + } + }); + } + if (msg.data.msg.name == "corsFetch") { + const { args } = msg.data.msg; + const res2 = await ifetch(args[0], args[1]); + const headersStr = res2.responseHeaders; + const headerObj = headerStringToObject2(headersStr); + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + ok: res2.ok || true, + setRes: true, + headers: headerObj, + responseHeaders: headersStr, + redirected: res2.redirected, + type: res2.type, + url: res2.url, + status: res2.status, + bodyUsed: res2.bodyUsed, + statusText: res2.statusText + } + }); + if (!args[1].method || ["GET", "POST"].includes(args[1].method)) { + const data = await res2.arrayBuffer(); + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + pushData: { + data + } + } + }, [data]); + } + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + pushData: {} + } + }, []); + } + } + } + break; + case "reply": + if (msg.data.id in this.pendingprom) { + this.pendingprom[msg.data.id](msg.data.res); + delete this.pendingprom[msg.data.id]; + } + break; + case "ag": + gen = this.pendinggens[msg.data.id]; + res = await gen.next(msg.data.args); + if (res.done) { + delete this.pendinggens[msg.data.id]; + } + this.processor.postMessage({ + type: "ag", + id: msg.data.id, + res + }); + break; + } + }; + } + serializeArg(m) { + if (m[Symbol.toStringTag] == "AsyncGenerator") { + const genid = this.genid++; + this.pendinggens[genid] = m; + return { + type: "AsyncGenerator", + id: genid + }; + } + return m; + } + sendCmd(cmd, ...args) { + const id = this.cmdid++; + this.processor.postMessage({ + type: "cmd", + id, + fun: cmd, + args: args.map((a) => this.serializeArg(a)) + }); + return new Promise((res) => { + this.pendingprom[id] = res; + }); + } + sendAg(id, res) { + this.processor.postMessage({ + type: "ag", + id, + res + }); + } + processImage(origlink, fn, md5, thumb) { + return this.sendCmd("processImage", origlink, fn, md5, thumb); + } + }; + var convertToLocalEmbed = (wef) => { + let ret; + ret = wef; + if (typeof wef.data == "object") { + if (!(wef.data instanceof Uint8Array)) { + const ref = wef.data; + if (!wef.thumbnail) + return wef; + ret = { + ...wef, + thumbnail: import_buffer9.Buffer.from(wef.thumbnail), + data: async (lsn) => { + return import_buffer9.Buffer.from(await (await ifetch(ref.url, { headers: ref.headers }, lsn)).arrayBuffer()); + } + }; + } + } + if (wef.data instanceof Uint8Array) { + ret.data = import_buffer9.Buffer.from(wef.data); + } + if (wef.thumbnail instanceof Uint8Array) { + ret.thumbnail = import_buffer9.Buffer.from(wef.thumbnail); + } + return ret; + }; var processPost = async (post) => { const origlink = qp.getImageLink(post); if (!origlink) @@ -31942,25 +21828,39 @@ if (!thumbLink) return; let res2 = void 0; + const op = +location.pathname.match(/\/thread\/(.*)/)[1]; const reportEmbed = () => { if (!csettings5) - return false; + return; if (csettings5.tm) { if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { if (!cappState.isCatalog) { - const op = +location.pathname.match(/\/thread\/(.*)/)[1]; pendingPosts.push({ id: +post.id.match(/([0-9]+)/)[1], op }); signalNewEmbeds(); } } } }; + const reportNoEmbed = () => { + if (!csettings5) + return; + if (csettings5.tm) { + if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { + if (!cappState.isCatalog) { + pendingNoPosts.push({ id: +post.id.match(/([0-9]+)/)[1], op }); + signalNewEmbeds(); + } + } + } + }; try { if (shouldUseCache()) { res2 = await getEmbedsFromCache(qp.getCurrentBoard(), +qp.getCurrentThread(), post.id); } if (!res2) { - res2 = await processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2 = []; + const tmp = await cp.processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2.push(...tmp); res2 = res2?.filter((e) => e); } } catch (e) { @@ -31968,10 +21868,10 @@ return; } if (!res2 || res2.length == 0) - return; + return reportNoEmbed(); reportEmbed(); post.querySelector(".post")?.classList.add("embedfound"); - processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [k, e[1]]))); + processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [convertToLocalEmbed(k), e[1]]))); }; var versionCheck = async () => { const txt = await (await ifetch("https://raw.githubusercontent.com/coomdev/pngextraembedder/main/main.meta.js")).text(); @@ -31981,111 +21881,8 @@ fireNotification("info", `Last PEE version is ${lmajor}.${lminor}, you're on ${major}.${minor}`); } }; - function copyTextToClipboard(text3) { - const copyFrom = document.createElement("textarea"); - copyFrom.textContent = text3; - document.body.appendChild(copyFrom); - copyFrom.select(); - document.execCommand("copy"); - copyFrom.blur(); - document.body.removeChild(copyFrom); - navigator.clipboard.writeText(text3); - } var scrapeBoard = async (self) => { - if (!csettings5) - return false; - if (csettings5.tm) { - fireNotification("success", "Scrapping board with telemetry on! Thank you for your service, selfless stranger ;_;7"); - } - self.disabled = true; - self.textContent = "Searching..."; - const boardname = location.pathname.match(/\/([^/]*)\//)[1]; - const res = await ifetch(`https://a.4cdn.org/${boardname}/threads.json`); - const pages = await res.json(); - fireNotification("info", "Fetching all threads..."); - const threads = (await Promise.all(pages.reduce((a, b) => [...a, ...b.threads], []).map((e) => e.no).map(async (id) => { - try { - const res2 = await ifetch(`https://a.4cdn.org/${boardname}/thread/${id}.json`); - return await res2.json(); - } catch { - return void 0; - } - }))).filter((e) => e).map((e) => e); - const filenames = threads.reduce((a, b) => [...a, ...b.posts.filter((p) => p.ext).map((p) => p)], []).filter((p) => p.ext != ".webm" && p.ext != ".gif").map((p) => [p.resto || p.no, `https://i.4cdn.org/${boardname}/${p.tim}${p.ext}`, p.md5, p.filename + p.ext, p.no]); - console.log(filenames); - fireNotification("info", "Analyzing images..."); - const n = 1; - const processFile = (src, fn, hex) => { - return Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { - if (proc.skip) { - const md5 = import_buffer11.Buffer.from(hex, "base64"); - return await proc.has_embed(md5, fn); - } - const iter = streamRemote(src); - if (!iter) - return false; - let cumul = import_buffer11.Buffer.alloc(0); - let found; - let chunk = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true }; - } else { - chunk = { done: false, value }; - cumul = import_buffer11.Buffer.concat([cumul, value]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return true; - } - found = v; - } - } while (found !== false && !chunk.done); - await iter.next(true); - return found === true; - })); - }; - const range = ~~(filenames.length / n) + 1; - const hasEmbed = []; - const total = filenames.length; - let processed = 0; - const int = setInterval(() => { - fireNotification("info", `Processed [${processed} / ${total}] files`); - }, 5e3); - await Promise.all([...new Array(n + 1)].map(async (e, i) => { - const postsslice = filenames.slice(i * range, (i + 1) * range); - for (const post of postsslice) { - try { - const res2 = await processFile(post[1], post[3], post[2]); - processed++; - if (res2.some((e2) => e2)) { - hasEmbed.push(post); - if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { - pendingPosts.push({ id: post[4], op: post[0] }); - signalNewEmbeds(); - } - } - } catch (e2) { - console.log(e2); - } - } - })); - clearInterval(int); - const counters = {}; - for (const k of hasEmbed) - counters[k[0]] = k[0] in counters ? counters[k[0]] + 1 : 1; - console.log(counters); - fireNotification("success", "Processing finished! Results pasted in the clipboard"); - const text3 = Object.entries(counters).sort((a, b) => b[1] - a[1]).map((e) => `>>${e[0]} (${e[1]})`).join("\n"); - console.log(text3); - copyTextToClipboard(text3); - self.textContent = "Copy Results"; - self.disabled = false; - self.onclick = () => { - copyTextToClipboard(text3); - }; }; - var __DOMParser = false ? _DOMParser : DOMParser; var gmo; var earlystartup = async () => { if (["arch.b4k.co", "desuarchive.org"].includes(location.host) && false) { @@ -32208,6 +22005,12 @@ Use the WebExtension version of PEE if you want to use b4k!`); mo2.observe(document.documentElement, { childList: true, subtree: true }); await bodyInit; } + try { + cp = new CommandProcessor(); + } catch { + alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list."); + return; + } if (!is4chanX && location.host.startsWith("boards.4chan")) { const notificationHost = document.createElement("span"); new NotificationsHandler_default({ @@ -32405,7 +22208,7 @@ Use the WebExtension version of PEE if you want to use b4k!`); const text3 = new TextEmbeddings_default({ target: textInsertCursor, props: { - files: ress.map((e) => e[0]).filter((e) => import_buffer11.Buffer.isBuffer(e.data) && e.filename.endsWith(".txt") && e.filename.startsWith("message")) + files: ress.map((e) => e[0]).filter((e) => (import_buffer9.Buffer.isBuffer(e.data) || e.data instanceof Uint8Array) && e.filename.endsWith(".txt") && e.filename.startsWith("message")) } }); const emb = new Embeddings_default({ @@ -32443,12 +22246,6 @@ Use the WebExtension version of PEE if you want to use b4k!`); post.setAttribute("data-processed", "true"); } })(); -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ /*! * The buffer module from node.js, for the browser. * diff --git a/chrome/manifest.json b/chrome/manifest.json index 31d62d0..39c78fc 100644 --- a/chrome/manifest.json +++ b/chrome/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "PngExtraEmbedder", "description": "Discover embedded files on 4chan and archives!", - "version": "0.291", + "version": "0.292", "icons": { "64": "1449696017588.png" }, diff --git a/dist/main.js b/dist/main.js index f8c0fde..e4d6407 100644 --- a/dist/main.js +++ b/dist/main.js @@ -73,7 +73,7 @@ var define_BUILD_VERSION_default; var init_define_BUILD_VERSION = __esm({ ""() { - define_BUILD_VERSION_default = [0, 291]; + define_BUILD_VERSION_default = [0, 292]; } }); @@ -271,13 +271,13 @@ var base64 = require_base64_js(); var ieee7542 = require_ieee754(); var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer18; + exports.Buffer = Buffer14; exports.SlowBuffer = SlowBuffer; exports.INSPECT_MAX_BYTES = 50; var K_MAX_LENGTH = 2147483647; exports.kMaxLength = K_MAX_LENGTH; - Buffer18.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer18.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { + Buffer14.TYPED_ARRAY_SUPPORT = typedArraySupport(); + if (!Buffer14.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); } function typedArraySupport() { @@ -293,18 +293,18 @@ return false; } } - Object.defineProperty(Buffer18.prototype, "parent", { + Object.defineProperty(Buffer14.prototype, "parent", { enumerable: true, get: function() { - if (!Buffer18.isBuffer(this)) + if (!Buffer14.isBuffer(this)) return void 0; return this.buffer; } }); - Object.defineProperty(Buffer18.prototype, "offset", { + Object.defineProperty(Buffer14.prototype, "offset", { enumerable: true, get: function() { - if (!Buffer18.isBuffer(this)) + if (!Buffer14.isBuffer(this)) return void 0; return this.byteOffset; } @@ -314,10 +314,10 @@ throw new RangeError('The value "' + length + '" is invalid for option "size"'); } const buf2 = new Uint8Array(length); - Object.setPrototypeOf(buf2, Buffer18.prototype); + Object.setPrototypeOf(buf2, Buffer14.prototype); return buf2; } - function Buffer18(arg, encodingOrOffset, length) { + function Buffer14(arg, encodingOrOffset, length) { if (typeof arg === "number") { if (typeof encodingOrOffset === "string") { throw new TypeError('The "string" argument must be of type string. Received type number'); @@ -326,7 +326,7 @@ } return from(arg, encodingOrOffset, length); } - Buffer18.poolSize = 8192; + Buffer14.poolSize = 8192; function from(value, encodingOrOffset, length) { if (typeof value === "string") { return fromString(value, encodingOrOffset); @@ -348,21 +348,21 @@ } const valueOf = value.valueOf && value.valueOf(); if (valueOf != null && valueOf !== value) { - return Buffer18.from(valueOf, encodingOrOffset, length); + return Buffer14.from(valueOf, encodingOrOffset, length); } const b = fromObject(value); if (b) return b; if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer18.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); + return Buffer14.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); } throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); } - Buffer18.from = function(value, encodingOrOffset, length) { + Buffer14.from = function(value, encodingOrOffset, length) { return from(value, encodingOrOffset, length); }; - Object.setPrototypeOf(Buffer18.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer18, Uint8Array); + Object.setPrototypeOf(Buffer14.prototype, Uint8Array.prototype); + Object.setPrototypeOf(Buffer14, Uint8Array); function assertSize(size) { if (typeof size !== "number") { throw new TypeError('"size" argument must be of type number'); @@ -380,24 +380,24 @@ } return createBuffer(size); } - Buffer18.alloc = function(size, fill, encoding) { + Buffer14.alloc = function(size, fill, encoding) { return alloc(size, fill, encoding); }; function allocUnsafe(size) { assertSize(size); return createBuffer(size < 0 ? 0 : checked(size) | 0); } - Buffer18.allocUnsafe = function(size) { + Buffer14.allocUnsafe = function(size) { return allocUnsafe(size); }; - Buffer18.allocUnsafeSlow = function(size) { + Buffer14.allocUnsafeSlow = function(size) { return allocUnsafe(size); }; function fromString(string, encoding) { if (typeof encoding !== "string" || encoding === "") { encoding = "utf8"; } - if (!Buffer18.isEncoding(encoding)) { + if (!Buffer14.isEncoding(encoding)) { throw new TypeError("Unknown encoding: " + encoding); } const length = byteLength(string, encoding) | 0; @@ -438,11 +438,11 @@ } else { buf2 = new Uint8Array(array, byteOffset, length); } - Object.setPrototypeOf(buf2, Buffer18.prototype); + Object.setPrototypeOf(buf2, Buffer14.prototype); return buf2; } function fromObject(obj) { - if (Buffer18.isBuffer(obj)) { + if (Buffer14.isBuffer(obj)) { const len = checked(obj.length) | 0; const buf2 = createBuffer(len); if (buf2.length === 0) { @@ -471,17 +471,17 @@ if (+length != length) { length = 0; } - return Buffer18.alloc(+length); + return Buffer14.alloc(+length); } - Buffer18.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer18.prototype; + Buffer14.isBuffer = function isBuffer(b) { + return b != null && b._isBuffer === true && b !== Buffer14.prototype; }; - Buffer18.compare = function compare(a, b) { + Buffer14.compare = function compare(a, b) { if (isInstance(a, Uint8Array)) - a = Buffer18.from(a, a.offset, a.byteLength); + a = Buffer14.from(a, a.offset, a.byteLength); if (isInstance(b, Uint8Array)) - b = Buffer18.from(b, b.offset, b.byteLength); - if (!Buffer18.isBuffer(a) || !Buffer18.isBuffer(b)) { + b = Buffer14.from(b, b.offset, b.byteLength); + if (!Buffer14.isBuffer(a) || !Buffer14.isBuffer(b)) { throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); } if (a === b) @@ -501,7 +501,7 @@ return 1; return 0; }; - Buffer18.isEncoding = function isEncoding(encoding) { + Buffer14.isEncoding = function isEncoding(encoding) { switch (String(encoding).toLowerCase()) { case "hex": case "utf8": @@ -519,12 +519,12 @@ return false; } }; - Buffer18.concat = function concat(list, length) { + Buffer14.concat = function concat(list, length) { if (!Array.isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers'); } if (list.length === 0) { - return Buffer18.alloc(0); + return Buffer14.alloc(0); } let i; if (length === void 0) { @@ -533,19 +533,19 @@ length += list[i].length; } } - const buffer = Buffer18.allocUnsafe(length); + const buffer = Buffer14.allocUnsafe(length); let pos = 0; for (i = 0; i < list.length; ++i) { let buf2 = list[i]; if (isInstance(buf2, Uint8Array)) { if (pos + buf2.length > buffer.length) { - if (!Buffer18.isBuffer(buf2)) - buf2 = Buffer18.from(buf2); + if (!Buffer14.isBuffer(buf2)) + buf2 = Buffer14.from(buf2); buf2.copy(buffer, pos); } else { Uint8Array.prototype.set.call(buffer, buf2, pos); } - } else if (!Buffer18.isBuffer(buf2)) { + } else if (!Buffer14.isBuffer(buf2)) { throw new TypeError('"list" argument must be an Array of Buffers'); } else { buf2.copy(buffer, pos); @@ -555,7 +555,7 @@ return buffer; }; function byteLength(string, encoding) { - if (Buffer18.isBuffer(string)) { + if (Buffer14.isBuffer(string)) { return string.length; } if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { @@ -596,7 +596,7 @@ } } } - Buffer18.byteLength = byteLength; + Buffer14.byteLength = byteLength; function slowToString(encoding, start, end) { let loweredCase = false; if (start === void 0 || start < 0) { @@ -645,13 +645,13 @@ } } } - Buffer18.prototype._isBuffer = true; + Buffer14.prototype._isBuffer = true; function swap(b, n, m) { const i = b[n]; b[n] = b[m]; b[m] = i; } - Buffer18.prototype.swap16 = function swap16() { + Buffer14.prototype.swap16 = function swap16() { const len = this.length; if (len % 2 !== 0) { throw new RangeError("Buffer size must be a multiple of 16-bits"); @@ -661,7 +661,7 @@ } return this; }; - Buffer18.prototype.swap32 = function swap32() { + Buffer14.prototype.swap32 = function swap32() { const len = this.length; if (len % 4 !== 0) { throw new RangeError("Buffer size must be a multiple of 32-bits"); @@ -672,7 +672,7 @@ } return this; }; - Buffer18.prototype.swap64 = function swap64() { + Buffer14.prototype.swap64 = function swap64() { const len = this.length; if (len % 8 !== 0) { throw new RangeError("Buffer size must be a multiple of 64-bits"); @@ -685,7 +685,7 @@ } return this; }; - Buffer18.prototype.toString = function toString2() { + Buffer14.prototype.toString = function toString2() { const length = this.length; if (length === 0) return ""; @@ -693,15 +693,15 @@ return utf8Slice(this, 0, length); return slowToString.apply(this, arguments); }; - Buffer18.prototype.toLocaleString = Buffer18.prototype.toString; - Buffer18.prototype.equals = function equals(b) { - if (!Buffer18.isBuffer(b)) + Buffer14.prototype.toLocaleString = Buffer14.prototype.toString; + Buffer14.prototype.equals = function equals(b) { + if (!Buffer14.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); if (this === b) return true; - return Buffer18.compare(this, b) === 0; + return Buffer14.compare(this, b) === 0; }; - Buffer18.prototype.inspect = function inspect() { + Buffer14.prototype.inspect = function inspect() { let str = ""; const max = exports.INSPECT_MAX_BYTES; str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); @@ -710,13 +710,13 @@ return ""; }; if (customInspectSymbol) { - Buffer18.prototype[customInspectSymbol] = Buffer18.prototype.inspect; + Buffer14.prototype[customInspectSymbol] = Buffer14.prototype.inspect; } - Buffer18.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { + Buffer14.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { if (isInstance(target, Uint8Array)) { - target = Buffer18.from(target, target.offset, target.byteLength); + target = Buffer14.from(target, target.offset, target.byteLength); } - if (!Buffer18.isBuffer(target)) { + if (!Buffer14.isBuffer(target)) { throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); } if (start === void 0) { @@ -796,9 +796,9 @@ return -1; } if (typeof val === "string") { - val = Buffer18.from(val, encoding); + val = Buffer14.from(val, encoding); } - if (Buffer18.isBuffer(val)) { + if (Buffer14.isBuffer(val)) { if (val.length === 0) { return -1; } @@ -871,13 +871,13 @@ } return -1; } - Buffer18.prototype.includes = function includes(val, byteOffset, encoding) { + Buffer14.prototype.includes = function includes(val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1; }; - Buffer18.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + Buffer14.prototype.indexOf = function indexOf(val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true); }; - Buffer18.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + Buffer14.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false); }; function hexWrite(buf2, string, offset, length) { @@ -916,7 +916,7 @@ function ucs2Write(buf2, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length); } - Buffer18.prototype.write = function write2(string, offset, length, encoding) { + Buffer14.prototype.write = function write2(string, offset, length, encoding) { if (offset === void 0) { encoding = "utf8"; length = this.length; @@ -973,7 +973,7 @@ } } }; - Buffer18.prototype.toJSON = function toJSON() { + Buffer14.prototype.toJSON = function toJSON() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) @@ -1095,7 +1095,7 @@ } return res; } - Buffer18.prototype.slice = function slice(start, end) { + Buffer14.prototype.slice = function slice(start, end) { const len = this.length; start = ~~start; end = end === void 0 ? len : ~~end; @@ -1116,7 +1116,7 @@ if (end < start) end = start; const newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer18.prototype); + Object.setPrototypeOf(newBuf, Buffer14.prototype); return newBuf; }; function checkOffset(offset, ext, length) { @@ -1125,7 +1125,7 @@ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length"); } - Buffer18.prototype.readUintLE = Buffer18.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { + Buffer14.prototype.readUintLE = Buffer14.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1138,7 +1138,7 @@ } return val; }; - Buffer18.prototype.readUintBE = Buffer18.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { + Buffer14.prototype.readUintBE = Buffer14.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) { @@ -1151,37 +1151,37 @@ } return val; }; - Buffer18.prototype.readUint8 = Buffer18.prototype.readUInt8 = function readUInt8(offset, noAssert) { + Buffer14.prototype.readUint8 = Buffer14.prototype.readUInt8 = function readUInt8(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 1, this.length); return this[offset]; }; - Buffer18.prototype.readUint16LE = Buffer18.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + Buffer14.prototype.readUint16LE = Buffer14.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] | this[offset + 1] << 8; }; - Buffer18.prototype.readUint16BE = Buffer18.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + Buffer14.prototype.readUint16BE = Buffer14.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] << 8 | this[offset + 1]; }; - Buffer18.prototype.readUint32LE = Buffer18.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + Buffer14.prototype.readUint32LE = Buffer14.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; }; - Buffer18.prototype.readUint32BE = Buffer18.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + Buffer14.prototype.readUint32BE = Buffer14.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); }; - Buffer18.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { + Buffer14.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1193,7 +1193,7 @@ const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24; return BigInt(lo) + (BigInt(hi) << BigInt(32)); }); - Buffer18.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { + Buffer14.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1205,7 +1205,7 @@ const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last; return (BigInt(hi) << BigInt(32)) + BigInt(lo); }); - Buffer18.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { + Buffer14.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1221,7 +1221,7 @@ val -= Math.pow(2, 8 * byteLength2); return val; }; - Buffer18.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { + Buffer14.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1237,7 +1237,7 @@ val -= Math.pow(2, 8 * byteLength2); return val; }; - Buffer18.prototype.readInt8 = function readInt8(offset, noAssert) { + Buffer14.prototype.readInt8 = function readInt8(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 1, this.length); @@ -1245,33 +1245,33 @@ return this[offset]; return (255 - this[offset] + 1) * -1; }; - Buffer18.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + Buffer14.prototype.readInt16LE = function readInt16LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); const val = this[offset] | this[offset + 1] << 8; return val & 32768 ? val | 4294901760 : val; }; - Buffer18.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + Buffer14.prototype.readInt16BE = function readInt16BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); const val = this[offset + 1] | this[offset] << 8; return val & 32768 ? val | 4294901760 : val; }; - Buffer18.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + Buffer14.prototype.readInt32LE = function readInt32LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; }; - Buffer18.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + Buffer14.prototype.readInt32BE = function readInt32BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; }; - Buffer18.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { + Buffer14.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1282,7 +1282,7 @@ const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24); return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); }); - Buffer18.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { + Buffer14.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1293,39 +1293,39 @@ const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset]; return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last); }); - Buffer18.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + Buffer14.prototype.readFloatLE = function readFloatLE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return ieee7542.read(this, offset, true, 23, 4); }; - Buffer18.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + Buffer14.prototype.readFloatBE = function readFloatBE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return ieee7542.read(this, offset, false, 23, 4); }; - Buffer18.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + Buffer14.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 8, this.length); return ieee7542.read(this, offset, true, 52, 8); }; - Buffer18.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + Buffer14.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 8, this.length); return ieee7542.read(this, offset, false, 52, 8); }; function checkInt(buf2, value, offset, ext, max, min) { - if (!Buffer18.isBuffer(buf2)) + if (!Buffer14.isBuffer(buf2)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); if (offset + ext > buf2.length) throw new RangeError("Index out of range"); } - Buffer18.prototype.writeUintLE = Buffer18.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeUintLE = Buffer14.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; @@ -1341,7 +1341,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeUintBE = Buffer18.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeUintBE = Buffer14.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; @@ -1357,7 +1357,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeUint8 = Buffer18.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + Buffer14.prototype.writeUint8 = Buffer14.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1365,7 +1365,7 @@ this[offset] = value & 255; return offset + 1; }; - Buffer18.prototype.writeUint16LE = Buffer18.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { + Buffer14.prototype.writeUint16LE = Buffer14.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1374,7 +1374,7 @@ this[offset + 1] = value >>> 8; return offset + 2; }; - Buffer18.prototype.writeUint16BE = Buffer18.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { + Buffer14.prototype.writeUint16BE = Buffer14.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1383,7 +1383,7 @@ this[offset + 1] = value & 255; return offset + 2; }; - Buffer18.prototype.writeUint32LE = Buffer18.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { + Buffer14.prototype.writeUint32LE = Buffer14.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1394,7 +1394,7 @@ this[offset] = value & 255; return offset + 4; }; - Buffer18.prototype.writeUint32BE = Buffer18.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { + Buffer14.prototype.writeUint32BE = Buffer14.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1445,13 +1445,13 @@ buf2[offset] = hi; return offset + 8; } - Buffer18.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { + Buffer14.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); }); - Buffer18.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { + Buffer14.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); }); - Buffer18.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) { @@ -1470,7 +1470,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) { @@ -1489,7 +1489,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + Buffer14.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1499,7 +1499,7 @@ this[offset] = value & 255; return offset + 1; }; - Buffer18.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + Buffer14.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1508,7 +1508,7 @@ this[offset + 1] = value >>> 8; return offset + 2; }; - Buffer18.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + Buffer14.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1517,7 +1517,7 @@ this[offset + 1] = value & 255; return offset + 2; }; - Buffer18.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + Buffer14.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1528,7 +1528,7 @@ this[offset + 3] = value >>> 24; return offset + 4; }; - Buffer18.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + Buffer14.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1541,10 +1541,10 @@ this[offset + 3] = value & 255; return offset + 4; }; - Buffer18.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { + Buffer14.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); }); - Buffer18.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { + Buffer14.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); }); function checkIEEE754(buf2, value, offset, ext, max, min) { @@ -1562,10 +1562,10 @@ ieee7542.write(buf2, value, offset, littleEndian, 23, 4); return offset + 4; } - Buffer18.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + Buffer14.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert); }; - Buffer18.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + Buffer14.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert); }; function writeDouble(buf2, value, offset, littleEndian, noAssert) { @@ -1577,14 +1577,14 @@ ieee7542.write(buf2, value, offset, littleEndian, 52, 8); return offset + 8; } - Buffer18.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { + Buffer14.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert); }; - Buffer18.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { + Buffer14.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert); }; - Buffer18.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer18.isBuffer(target)) + Buffer14.prototype.copy = function copy(target, targetStart, start, end) { + if (!Buffer14.isBuffer(target)) throw new TypeError("argument should be a Buffer"); if (!start) start = 0; @@ -1620,7 +1620,7 @@ } return len; }; - Buffer18.prototype.fill = function fill(val, start, end, encoding) { + Buffer14.prototype.fill = function fill(val, start, end, encoding) { if (typeof val === "string") { if (typeof start === "string") { encoding = start; @@ -1633,7 +1633,7 @@ if (encoding !== void 0 && typeof encoding !== "string") { throw new TypeError("encoding must be a string"); } - if (typeof encoding === "string" && !Buffer18.isEncoding(encoding)) { + if (typeof encoding === "string" && !Buffer14.isEncoding(encoding)) { throw new TypeError("Unknown encoding: " + encoding); } if (val.length === 1) { @@ -1663,7 +1663,7 @@ this[i] = val; } } else { - const bytes = Buffer18.isBuffer(val) ? val : Buffer18.from(val, encoding); + const bytes = Buffer14.isBuffer(val) ? val : Buffer14.from(val, encoding); const len = bytes.length; if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"'); @@ -1910,6 +1910,119 @@ } }); + // node_modules/crc-32/crc32.js + var require_crc32 = __commonJS({ + "node_modules/crc-32/crc32.js"(exports) { + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var CRC32; + (function(factory) { + if (typeof DO_NOT_EXPORT_CRC === "undefined") { + if (typeof exports === "object") { + factory(exports); + } else if (typeof define === "function" && define.amd) { + define(function() { + var module2 = {}; + factory(module2); + return module2; + }); + } else { + factory(CRC32 = {}); + } + } else { + factory(CRC32 = {}); + } + })(function(CRC322) { + CRC322.version = "1.2.0"; + function signed_crc_table() { + var c = 0, table = new Array(256); + for (var n = 0; n != 256; ++n) { + c = n; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + table[n] = c; + } + return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; + } + var T = signed_crc_table(); + function crc32_bstr(bstr, seed) { + var C = seed ^ -1, L = bstr.length - 1; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; + } + if (i === L) + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255]; + return C ^ -1; + } + function crc32_buf(buf2, seed) { + if (buf2.length > 1e4) + return crc32_buf_8(buf2, seed); + var C = seed ^ -1, L = buf2.length - 3; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + } + while (i < L + 3) + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + return C ^ -1; + } + function crc32_buf_8(buf2, seed) { + var C = seed ^ -1, L = buf2.length - 7; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + } + while (i < L + 7) + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + return C ^ -1; + } + function crc32_str(str, seed) { + var C = seed ^ -1; + for (var i = 0, L = str.length, c, d; i < L; ) { + c = str.charCodeAt(i++); + if (c < 128) { + C = C >>> 8 ^ T[(C ^ c) & 255]; + } else if (c < 2048) { + C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + } else if (c >= 55296 && c < 57344) { + c = (c & 1023) + 64; + d = str.charCodeAt(i++) & 1023; + C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255]; + } else { + C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + } + } + return C ^ -1; + } + CRC322.table = T; + CRC322.bstr = crc32_bstr; + CRC322.buf = crc32_buf; + CRC322.str = crc32_str; + }); + } + }); + // node_modules/events/events.js var require_events = __commonJS({ "node_modules/events/events.js"(exports, module) { @@ -2280,1472 +2393,501 @@ } }); - // node_modules/browser-process/dist/api_error.js - var require_api_error = __commonJS({ - "node_modules/browser-process/dist/api_error.js"(exports) { + // node_modules/readable-stream/lib/internal/streams/stream-browser.js + var require_stream_browser = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var Buffer18 = Buffer18; - (function(ErrorCode2) { - ErrorCode2[ErrorCode2["EPERM"] = 0] = "EPERM"; - ErrorCode2[ErrorCode2["ENOENT"] = 1] = "ENOENT"; - ErrorCode2[ErrorCode2["EIO"] = 2] = "EIO"; - ErrorCode2[ErrorCode2["EBADF"] = 3] = "EBADF"; - ErrorCode2[ErrorCode2["EACCES"] = 4] = "EACCES"; - ErrorCode2[ErrorCode2["EBUSY"] = 5] = "EBUSY"; - ErrorCode2[ErrorCode2["EEXIST"] = 6] = "EEXIST"; - ErrorCode2[ErrorCode2["ENOTDIR"] = 7] = "ENOTDIR"; - ErrorCode2[ErrorCode2["EISDIR"] = 8] = "EISDIR"; - ErrorCode2[ErrorCode2["EINVAL"] = 9] = "EINVAL"; - ErrorCode2[ErrorCode2["EFBIG"] = 10] = "EFBIG"; - ErrorCode2[ErrorCode2["ENOSPC"] = 11] = "ENOSPC"; - ErrorCode2[ErrorCode2["EROFS"] = 12] = "EROFS"; - ErrorCode2[ErrorCode2["ENOTEMPTY"] = 13] = "ENOTEMPTY"; - ErrorCode2[ErrorCode2["ENOTSUP"] = 14] = "ENOTSUP"; - })(exports.ErrorCode || (exports.ErrorCode = {})); - var ErrorCode = exports.ErrorCode; - var ErrorStrings = {}; - ErrorStrings[ErrorCode.EPERM] = "Operation not permitted."; - ErrorStrings[ErrorCode.ENOENT] = "No such file or directory."; - ErrorStrings[ErrorCode.EIO] = "Input/output error."; - ErrorStrings[ErrorCode.EBADF] = "Bad file descriptor."; - ErrorStrings[ErrorCode.EACCES] = "Permission denied."; - ErrorStrings[ErrorCode.EBUSY] = "Resource busy or locked."; - ErrorStrings[ErrorCode.EEXIST] = "File exists."; - ErrorStrings[ErrorCode.ENOTDIR] = "File is not a directory."; - ErrorStrings[ErrorCode.EISDIR] = "File is a directory."; - ErrorStrings[ErrorCode.EINVAL] = "Invalid argument."; - ErrorStrings[ErrorCode.EFBIG] = "File is too big."; - ErrorStrings[ErrorCode.ENOSPC] = "No space left on disk."; - ErrorStrings[ErrorCode.EROFS] = "Cannot modify a read-only file system."; - ErrorStrings[ErrorCode.ENOTEMPTY] = "Directory is not empty."; - ErrorStrings[ErrorCode.ENOTSUP] = "Operation is not supported."; - var ApiError = function() { - function ApiError2(type, message) { - this.type = type; - this.code = ErrorCode[type]; - if (message != null) { - this.message = message; - } else { - this.message = ErrorStrings[type]; - } - } - ApiError2.prototype.toString = function() { - return this.code + ": " + ErrorStrings[this.type] + " " + this.message; - }; - ApiError2.prototype.writeToBuffer = function(buffer, i) { - if (buffer === void 0) { - buffer = new Buffer18(this.bufferSize()); - } - if (i === void 0) { - i = 0; - } - buffer.writeUInt8(this.type, i); - var bytesWritten = buffer.write(this.message, i + 5); - buffer.writeUInt32LE(bytesWritten, i + 1); - return buffer; - }; - ApiError2.fromBuffer = function(buffer, i) { - if (i === void 0) { - i = 0; - } - return new ApiError2(buffer.readUInt8(i), buffer.toString("utf8", i + 5, i + 5 + buffer.readUInt32LE(i + 1))); - }; - ApiError2.prototype.bufferSize = function() { - return 5 + Buffer18.byteLength(this.message); - }; - ApiError2.FileError = function(code, p) { - return new ApiError2(code, p + ": " + ErrorStrings[code]); - }; - ApiError2.ENOENT = function(path) { - return this.FileError(ErrorCode.ENOENT, path); - }; - ApiError2.EEXIST = function(path) { - return this.FileError(ErrorCode.EEXIST, path); - }; - ApiError2.EISDIR = function(path) { - return this.FileError(ErrorCode.EISDIR, path); - }; - ApiError2.ENOTDIR = function(path) { - return this.FileError(ErrorCode.ENOTDIR, path); - }; - ApiError2.EPERM = function(path) { - return this.FileError(ErrorCode.EPERM, path); - }; - return ApiError2; - }(); - exports.ApiError = ApiError; + module.exports = require_events().EventEmitter; } }); - // node_modules/browser-process/dist/node_eventemitter.js - var require_node_eventemitter = __commonJS({ - "node_modules/browser-process/dist/node_eventemitter.js"(exports) { + // (disabled):node_modules/util/util.js + var require_util = __commonJS({ + "(disabled):node_modules/util/util.js"() { init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports.__extends || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - function __() { - this.constructor = d; - } - __.prototype = b.prototype; - d.prototype = new __(); - }; - var events = require_events(); - var api_error = require_api_error(); - var ApiError = api_error.ApiError; - var ErrorCode = api_error.ErrorCode; - var BufferedEvent = function() { - function BufferedEvent2(data, encoding, cb) { - this.data = data; - this.encoding = encoding; - this.cb = cb; - this.size = typeof data !== "string" ? data.length : Buffer2.byteLength(data, encoding != null ? encoding : void 0); - if (typeof this.data !== "string") { - this.data = typeof this.data.sliceCopy !== "undefined" ? this.data.sliceCopy() : Buffer2.concat([this.data]); - } - } - BufferedEvent2.prototype.getData = function(encoding) { - if (encoding == null) { - if (typeof this.data === "string") { - return new Buffer2(this.data, this.encoding != null ? this.encoding : void 0); - } else { - return this.data; - } - } else { - if (typeof this.data === "string") { - if (encoding === this.encoding) { - return this.data; - } else { - return new Buffer2(this.data, this.encoding != null ? this.encoding : void 0).toString(encoding); - } - } else { - return this.data.toString(encoding); - } - } - }; - return BufferedEvent2; - }(); - var AbstractDuplexStream = function(_super) { - __extends(AbstractDuplexStream2, _super); - function AbstractDuplexStream2(writable2, readable) { - _super.call(this); - this.writable = writable2; - this.readable = readable; - this.encoding = null; - this.flowing = false; - this.buffer = []; - this.endEvent = null; - this.ended = false; - this.drained = true; - } - AbstractDuplexStream2.prototype.addListener = function(event, listener) { - var rv = _super.prototype.addListener.call(this, event, listener), _this = this; - if (event === "data" && !this.flowing) { - this.resume(); - } else if (event === "readable" && this.buffer.length > 0) { - setTimeout(function() { - _this.emit("readable"); - }, 0); - } - return rv; - }; - AbstractDuplexStream2.prototype._processArgs = function(data, arg2, arg3) { - if (typeof arg2 === "string") { - return new BufferedEvent(data, arg2, arg3); - } else { - return new BufferedEvent(data, null, arg2); - } - }; - AbstractDuplexStream2.prototype._processEvents = function() { - var drained = this.buffer.length === 0; - if (this.drained !== drained) { - if (this.drained) { - this.emit("readable"); - } - } - if (this.flowing && this.buffer.length !== 0) { - this.emit("data", this.read()); - } - this.drained = this.buffer.length === 0; - }; - AbstractDuplexStream2.prototype.emitEvent = function(type, event) { - this.emit(type, event.getData(this.encoding)); - if (event.cb) { - event.cb(); - } - }; - AbstractDuplexStream2.prototype.write = function(data, arg2, arg3) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Cannot write to an ended stream."); - } - var event = this._processArgs(data, arg2, arg3); - this._push(event); - return this.flowing; - }; - AbstractDuplexStream2.prototype.end = function(data, arg2, arg3) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Stream is already closed."); - } - var event = this._processArgs(data, arg2, arg3); - this.ended = true; - this.endEvent = event; - this._processEvents(); - }; - AbstractDuplexStream2.prototype.read = function(size) { - var events2 = [], eventsCbs = [], lastCb, eventsSize = 0, event, buff, trueSize, i = 0, sizeUnspecified = typeof size !== "number"; - if (sizeUnspecified) - size = 4294967295; - for (i = 0; i < this.buffer.length && eventsSize < size; i++) { - event = this.buffer[i]; - events2.push(event.getData()); - if (event.cb) { - eventsCbs.push(event.cb); - } - eventsSize += event.size; - lastCb = event.cb; - } - if (!sizeUnspecified && eventsSize < size) { - return null; - } - this.buffer = this.buffer.slice(events2.length); - trueSize = eventsSize > size ? size : eventsSize; - buff = Buffer2.concat(events2); - if (eventsSize > size) { - if (lastCb) - eventsCbs.pop(); - this._push(new BufferedEvent(buff.slice(size), null, lastCb)); - } - if (eventsCbs.length > 0) { - setTimeout(function() { - var i2; - for (i2 = 0; i2 < eventsCbs.length; i2++) { - eventsCbs[i2](); - } - }, 0); - } - if (this.ended && this.buffer.length === 0 && this.endEvent !== null) { - var endEvent = this.endEvent, _this = this; - this.endEvent = null; - setTimeout(function() { - _this.emitEvent("end", endEvent); - }, 0); - } - if (events2.length === 0) { - this.emit("_read"); - return null; - } else if (this.encoding === null) { - return buff.slice(0, trueSize); - } else { - return buff.toString(this.encoding, 0, trueSize); - } - }; - AbstractDuplexStream2.prototype.setEncoding = function(encoding) { - this.encoding = encoding; - }; - AbstractDuplexStream2.prototype.pause = function() { - this.flowing = false; - }; - AbstractDuplexStream2.prototype.resume = function() { - this.flowing = true; - this._processEvents(); - }; - AbstractDuplexStream2.prototype.pipe = function(destination, options) { - throw new ApiError(ErrorCode.EPERM, "Unimplemented."); - }; - AbstractDuplexStream2.prototype.unpipe = function(destination) { - }; - AbstractDuplexStream2.prototype.unshift = function(chunk) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Stream has ended."); - } - this.buffer.unshift(new BufferedEvent(chunk, this.encoding)); - this._processEvents(); - }; - AbstractDuplexStream2.prototype._push = function(event) { - this.buffer.push(event); - this._processEvents(); - }; - AbstractDuplexStream2.prototype.wrap = function(stream) { - throw new ApiError(ErrorCode.EPERM, "Unimplemented."); - }; - return AbstractDuplexStream2; - }(events.EventEmitter); - exports.AbstractDuplexStream = AbstractDuplexStream; } }); - // node_modules/has-symbols/shams.js - var require_shams = __commonJS({ - "node_modules/has-symbols/shams.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/buffer_list.js + var require_buffer_list = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - module.exports = function hasSymbols() { - if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { - return false; - } - if (typeof Symbol.iterator === "symbol") { - return true; - } - var obj = {}; - var sym = Symbol("test"); - var symObj = Object(sym); - if (typeof sym === "string") { - return false; - } - if (Object.prototype.toString.call(sym) !== "[object Symbol]") { - return false; - } - if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { - return false; - } - var symVal = 42; - obj[sym] = symVal; - for (sym in obj) { - return false; - } - if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { - return false; + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) + symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); } - if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { - return false; + return keys; + } + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { + ownKeys(Object(source), true).forEach(function(key2) { + _defineProperty(target, key2, source[key2]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function(key2) { + Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); + }); + } } - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { - return false; + return target; + } + function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); + } else { + obj[key2] = value; } - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { - return false; + return obj; + } + function _classCallCheck(instance18, Constructor) { + if (!(instance18 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } - if (typeof Object.getOwnPropertyDescriptor === "function") { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { - return false; - } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); } - return true; - }; - } - }); - - // node_modules/has-tostringtag/shams.js - var require_shams2 = __commonJS({ - "node_modules/has-tostringtag/shams.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var hasSymbols = require_shams(); - module.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; - }; - } - }); - - // node_modules/has-symbols/index.js - var require_has_symbols = __commonJS({ - "node_modules/has-symbols/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var origSymbol = typeof Symbol !== "undefined" && Symbol; - var hasSymbolSham = require_shams(); - module.exports = function hasNativeSymbols() { - if (typeof origSymbol !== "function") { - return false; - } - if (typeof Symbol !== "function") { - return false; - } - if (typeof origSymbol("foo") !== "symbol") { - return false; - } - if (typeof Symbol("bar") !== "symbol") { - return false; + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) + _defineProperties(Constructor.prototype, protoProps); + if (staticProps) + _defineProperties(Constructor, staticProps); + return Constructor; + } + var _require = require_buffer(); + var Buffer14 = _require.Buffer; + var _require2 = require_util(); + var inspect = _require2.inspect; + var custom = inspect && inspect.custom || "inspect"; + function copyBuffer(src, target, offset) { + Buffer14.prototype.copy.call(src, target, offset); + } + module.exports = /* @__PURE__ */ function() { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; } - return hasSymbolSham(); - }; - } - }); - - // node_modules/function-bind/implementation.js - var require_implementation = __commonJS({ - "node_modules/function-bind/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; - var slice = Array.prototype.slice; - var toStr = Object.prototype.toString; - var funcType = "[object Function]"; - module.exports = function bind(that) { - var target = this; - if (typeof target !== "function" || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - var bound; - var binder = function() { - if (this instanceof bound) { - var result = target.apply(this, args.concat(slice.call(arguments))); - if (Object(result) === result) { - return result; + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) + this.tail.next = entry; + else + this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) + this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) + return; + var ret = this.head.data; + if (this.length === 1) + this.head = this.tail = null; + else + this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) + return ""; + var p = this.head; + var ret = "" + p.data; + while (p = p.next) { + ret += s + p.data; } - return this; - } else { - return target.apply(that, args.concat(slice.call(arguments))); + return ret; } - }; - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push("$" + i); - } - bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder); - if (target.prototype) { - var Empty = function Empty2() { - }; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; - } - }); - - // node_modules/function-bind/index.js - var require_function_bind = __commonJS({ - "node_modules/function-bind/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation(); - module.exports = Function.prototype.bind || implementation; - } - }); - - // node_modules/has/src/index.js - var require_src = __commonJS({ - "node_modules/has/src/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var bind = require_function_bind(); - module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); - } - }); - - // node_modules/get-intrinsic/index.js - var require_get_intrinsic = __commonJS({ - "node_modules/get-intrinsic/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var undefined2; - var $SyntaxError = SyntaxError; - var $Function = Function; - var $TypeError = TypeError; - var getEvalledConstructor = function(expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); - } catch (e) { - } - }; - var $gOPD = Object.getOwnPropertyDescriptor; - if ($gOPD) { - try { - $gOPD({}, ""); - } catch (e) { - $gOPD = null; - } - } - var throwTypeError = function() { - throw new $TypeError(); - }; - var ThrowTypeError = $gOPD ? function() { - try { - arguments.callee; - return throwTypeError; - } catch (calleeThrows) { - try { - return $gOPD(arguments, "callee").get; - } catch (gOPDthrows) { - return throwTypeError; + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) + return Buffer14.alloc(0); + var ret = Buffer14.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; } - } - }() : throwTypeError; - var hasSymbols = require_has_symbols()(); - var getProto = Object.getPrototypeOf || function(x) { - return x.__proto__; - }; - var needsEval = {}; - var TypedArray = typeof Uint8Array === "undefined" ? undefined2 : getProto(Uint8Array); - var INTRINSICS = { - "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError, - "%Array%": Array, - "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer, - "%ArrayIteratorPrototype%": hasSymbols ? getProto([][Symbol.iterator]()) : undefined2, - "%AsyncFromSyncIteratorPrototype%": undefined2, - "%AsyncFunction%": needsEval, - "%AsyncGenerator%": needsEval, - "%AsyncGeneratorFunction%": needsEval, - "%AsyncIteratorPrototype%": needsEval, - "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics, - "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt, - "%Boolean%": Boolean, - "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView, - "%Date%": Date, - "%decodeURI%": decodeURI, - "%decodeURIComponent%": decodeURIComponent, - "%encodeURI%": encodeURI, - "%encodeURIComponent%": encodeURIComponent, - "%Error%": Error, - "%eval%": eval, - "%EvalError%": EvalError, - "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array, - "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array, - "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry, - "%Function%": $Function, - "%GeneratorFunction%": needsEval, - "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array, - "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array, - "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array, - "%isFinite%": isFinite, - "%isNaN%": isNaN, - "%IteratorPrototype%": hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined2, - "%JSON%": typeof JSON === "object" ? JSON : undefined2, - "%Map%": typeof Map === "undefined" ? undefined2 : Map, - "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), - "%Math%": Math, - "%Number%": Number, - "%Object%": Object, - "%parseFloat%": parseFloat, - "%parseInt%": parseInt, - "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise, - "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy, - "%RangeError%": RangeError, - "%ReferenceError%": ReferenceError, - "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect, - "%RegExp%": RegExp, - "%Set%": typeof Set === "undefined" ? undefined2 : Set, - "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), - "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer, - "%String%": String, - "%StringIteratorPrototype%": hasSymbols ? getProto(""[Symbol.iterator]()) : undefined2, - "%Symbol%": hasSymbols ? Symbol : undefined2, - "%SyntaxError%": $SyntaxError, - "%ThrowTypeError%": ThrowTypeError, - "%TypedArray%": TypedArray, - "%TypeError%": $TypeError, - "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array, - "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray, - "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array, - "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array, - "%URIError%": URIError, - "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap, - "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef, - "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet - }; - var doEval = function doEval2(name) { - var value; - if (name === "%AsyncFunction%") { - value = getEvalledConstructor("async function () {}"); - } else if (name === "%GeneratorFunction%") { - value = getEvalledConstructor("function* () {}"); - } else if (name === "%AsyncGeneratorFunction%") { - value = getEvalledConstructor("async function* () {}"); - } else if (name === "%AsyncGenerator%") { - var fn = doEval2("%AsyncGeneratorFunction%"); - if (fn) { - value = fn.prototype; - } - } else if (name === "%AsyncIteratorPrototype%") { - var gen = doEval2("%AsyncGenerator%"); - if (gen) { - value = getProto(gen.prototype); - } - } - INTRINSICS[name] = value; - return value; - }; - var LEGACY_ALIASES = { - "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], - "%ArrayPrototype%": ["Array", "prototype"], - "%ArrayProto_entries%": ["Array", "prototype", "entries"], - "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], - "%ArrayProto_keys%": ["Array", "prototype", "keys"], - "%ArrayProto_values%": ["Array", "prototype", "values"], - "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], - "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], - "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], - "%BooleanPrototype%": ["Boolean", "prototype"], - "%DataViewPrototype%": ["DataView", "prototype"], - "%DatePrototype%": ["Date", "prototype"], - "%ErrorPrototype%": ["Error", "prototype"], - "%EvalErrorPrototype%": ["EvalError", "prototype"], - "%Float32ArrayPrototype%": ["Float32Array", "prototype"], - "%Float64ArrayPrototype%": ["Float64Array", "prototype"], - "%FunctionPrototype%": ["Function", "prototype"], - "%Generator%": ["GeneratorFunction", "prototype"], - "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], - "%Int8ArrayPrototype%": ["Int8Array", "prototype"], - "%Int16ArrayPrototype%": ["Int16Array", "prototype"], - "%Int32ArrayPrototype%": ["Int32Array", "prototype"], - "%JSONParse%": ["JSON", "parse"], - "%JSONStringify%": ["JSON", "stringify"], - "%MapPrototype%": ["Map", "prototype"], - "%NumberPrototype%": ["Number", "prototype"], - "%ObjectPrototype%": ["Object", "prototype"], - "%ObjProto_toString%": ["Object", "prototype", "toString"], - "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], - "%PromisePrototype%": ["Promise", "prototype"], - "%PromiseProto_then%": ["Promise", "prototype", "then"], - "%Promise_all%": ["Promise", "all"], - "%Promise_reject%": ["Promise", "reject"], - "%Promise_resolve%": ["Promise", "resolve"], - "%RangeErrorPrototype%": ["RangeError", "prototype"], - "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], - "%RegExpPrototype%": ["RegExp", "prototype"], - "%SetPrototype%": ["Set", "prototype"], - "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], - "%StringPrototype%": ["String", "prototype"], - "%SymbolPrototype%": ["Symbol", "prototype"], - "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], - "%TypedArrayPrototype%": ["TypedArray", "prototype"], - "%TypeErrorPrototype%": ["TypeError", "prototype"], - "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], - "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], - "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], - "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], - "%URIErrorPrototype%": ["URIError", "prototype"], - "%WeakMapPrototype%": ["WeakMap", "prototype"], - "%WeakSetPrototype%": ["WeakSet", "prototype"] - }; - var bind = require_function_bind(); - var hasOwn = require_src(); - var $concat = bind.call(Function.call, Array.prototype.concat); - var $spliceApply = bind.call(Function.apply, Array.prototype.splice); - var $replace = bind.call(Function.call, String.prototype.replace); - var $strSlice = bind.call(Function.call, String.prototype.slice); - var $exec = bind.call(Function.call, RegExp.prototype.exec); - var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; - var reEscapeChar = /\\(\\)?/g; - var stringToPath = function stringToPath2(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === "%" && last !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); - } else if (last === "%" && first !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); - } - var result = []; - $replace(string, rePropName, function(match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; - }); - return result; - }; - var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = "%" + alias[0] + "%"; - } - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + ret = this.shift(); + } else { + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; } - if (typeof value === "undefined" && !allowMissing) { - throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); + }, { + key: "first", + value: function first() { + return this.head.data; } - return { - alias, - name: intrinsicName, - value - }; - } - throw new $SyntaxError("intrinsic " + name + " does not exist!"); - }; - module.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== "string" || name.length === 0) { - throw new $TypeError("intrinsic name must be a non-empty string"); - } - if (arguments.length > 1 && typeof allowMissing !== "boolean") { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - if ($exec(/^%?[^%]*%?$/g, name) === null) { - throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); - } - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; - var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { - throw new $SyntaxError("property names with quotes must have matching quotes"); - } - if (part === "constructor" || !isOwn) { - skipFurtherCaching = true; - } - intrinsicBaseName += "." + part; - intrinsicRealName = "%" + intrinsicBaseName + "%"; - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) + ret += str; + else + ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) + this.head = p.next; + else + this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; } - return void 0; + ++c; } - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - if (isOwn && "get" in desc && !("originalValue" in desc.get)) { - value = desc.get; - } else { - value = value[part]; + this.length -= c; + return ret; + } + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer14.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf2 = p.data; + var nb = n > buf2.length ? buf2.length : n; + buf2.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf2.length) { + ++c; + if (p.next) + this.head = p.next; + else + this.head = this.tail = null; + } else { + this.head = p; + p.data = buf2.slice(nb); + } + break; } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; + ++c; } + this.length -= c; + return ret; } - } - return value; - }; + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + depth: 0, + customInspect: false + })); + } + }]); + return BufferList; + }(); } }); - // node_modules/call-bind/index.js - var require_call_bind = __commonJS({ - "node_modules/call-bind/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/destroy.js + var require_destroy = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var bind = require_function_bind(); - var GetIntrinsic = require_get_intrinsic(); - var $apply = GetIntrinsic("%Function.prototype.apply%"); - var $call = GetIntrinsic("%Function.prototype.call%"); - var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var $max = GetIntrinsic("%Math.max%"); - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - } catch (e) { - $defineProperty = null; - } - } - module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, "length"); - if (desc.configurable) { - $defineProperty(func, "length", { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }); + function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } } + return this; } - return func; - }; - var applyBind = function applyBind2() { - return $reflectApply(bind, $apply, arguments); - }; - if ($defineProperty) { - $defineProperty(module.exports, "apply", { value: applyBind }); - } else { - module.exports.apply = applyBind; - } - } - }); - - // node_modules/call-bind/callBound.js - var require_callBound = __commonJS({ - "node_modules/call-bind/callBound.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var callBind = require_call_bind(); - var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf")); - module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { - return callBind(intrinsic); - } - return intrinsic; - }; - } - }); - - // node_modules/is-arguments/index.js - var require_is_arguments = __commonJS({ - "node_modules/is-arguments/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var hasToStringTag = require_shams2()(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) { - return false; - } - return $toString(value) === "[object Arguments]"; - }; - var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]"; - }; - var supportsStandardArguments = function() { - return isStandardArguments(arguments); - }(); - isStandardArguments.isLegacyArguments = isLegacyArguments; - module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - } - }); - - // node_modules/is-generator-function/index.js - var require_is_generator_function = __commonJS({ - "node_modules/is-generator-function/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var toStr = Object.prototype.toString; - var fnToStr = Function.prototype.toString; - var isFnRegex = /^\s*(?:function)?\*/; - var hasToStringTag = require_shams2()(); - var getProto = Object.getPrototypeOf; - var getGeneratorFunc = function() { - if (!hasToStringTag) { - return false; - } - try { - return Function("return function*() {}")(); - } catch (e) { - } - }; - var GeneratorFunction; - module.exports = function isGeneratorFunction(fn) { - if (typeof fn !== "function") { - return false; - } - if (isFnRegex.test(fnToStr.call(fn))) { - return true; + if (this._readableState) { + this._readableState.destroyed = true; } - if (!hasToStringTag) { - var str = toStr.call(fn); - return str === "[object GeneratorFunction]"; + if (this._writableState) { + this._writableState.destroyed = true; } - if (!getProto) { - return false; + this._destroy(err || null, function(err2) { + if (!cb && err2) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err2); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err2); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err2); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; + } + function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); + } + function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) + return; + if (self._readableState && !self._readableState.emitClose) + return; + self.emit("close"); + } + function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; } - if (typeof GeneratorFunction === "undefined") { - var generatorFunc = getGeneratorFunc(); - GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; } - return getProto(fn) === GeneratorFunction; + } + function emitErrorNT(self, err) { + self.emit("error", err); + } + function errorOrDestroy(stream, err) { + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) + stream.destroy(err); + else + stream.emit("error", err); + } + module.exports = { + destroy, + undestroy, + errorOrDestroy }; } }); - // node_modules/is-callable/index.js - var require_is_callable = __commonJS({ - "node_modules/is-callable/index.js"(exports, module) { + // node_modules/readable-stream/errors-browser.js + var require_errors_browser = __commonJS({ + "node_modules/readable-stream/errors-browser.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var fnToStr = Function.prototype.toString; - var reflectApply = typeof Reflect === "object" && Reflect !== null && Reflect.apply; - var badArrayLike; - var isCallableMarker; - if (typeof reflectApply === "function" && typeof Object.defineProperty === "function") { - try { - badArrayLike = Object.defineProperty({}, "length", { - get: function() { - throw isCallableMarker; - } - }); - isCallableMarker = {}; - reflectApply(function() { - throw 42; - }, null, badArrayLike); - } catch (_) { - if (_ !== isCallableMarker) { - reflectApply = null; - } - } - } else { - reflectApply = null; + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; } - var constructorRegex = /^\s*class\b/; - var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; + var codes = {}; + function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; } - }; - var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { - return false; + function getMessage(arg1, arg2, arg3) { + if (typeof message === "string") { + return message; + } else { + return message(arg1, arg2, arg3); } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var fnClass = "[object Function]"; - var genClass = "[object GeneratorFunction]"; - var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag; - var documentDotAll = typeof document === "object" && typeof document.all === "undefined" && document.all !== void 0 ? document.all : {}; - module.exports = reflectApply ? function isCallable(value) { - if (value === documentDotAll) { - return true; - } - if (!value) { - return false; - } - if (typeof value !== "function" && typeof value !== "object") { - return false; } - if (typeof value === "function" && !value.prototype) { - return true; - } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { - return false; + var NodeError = /* @__PURE__ */ function(_Base) { + _inheritsLoose(NodeError2, _Base); + function NodeError2(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + return NodeError2; + }(Base); + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; + } + function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function(i) { + return String(i); + }); + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); } + } else { + return "of ".concat(thing, " ").concat(String(expected)); } - return !isES6ClassFn(value); - } : function isCallable(value) { - if (value === documentDotAll) { - return true; + } + function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; + } + function endsWith(str, search, this_len) { + if (this_len === void 0 || this_len > str.length) { + this_len = str.length; } - if (!value) { - return false; + return str.substring(this_len - search.length, this_len) === search; + } + function includes(str, search, start) { + if (typeof start !== "number") { + start = 0; } - if (typeof value !== "function" && typeof value !== "object") { + if (start + search.length > str.length) { return false; + } else { + return str.indexOf(search, start) !== -1; } - if (typeof value === "function" && !value.prototype) { - return true; - } - if (hasToStringTag) { - return tryFunctionObject(value); + } + createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; + }, TypeError); + createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { + var determiner; + if (typeof expected === "string" && startsWith(expected, "not ")) { + determiner = "must not be"; + expected = expected.replace(/^not /, ""); + } else { + determiner = "must be"; } - if (isES6ClassFn(value)) { - return false; + var msg; + if (endsWith(name, " argument")) { + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + } else { + var type = includes(name, ".") ? "property" : "argument"; + msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); } - var strClass = toStr.call(value); - return strClass === fnClass || strClass === genClass; - }; + msg += ". Received type ".concat(typeof actual); + return msg; + }, TypeError); + createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); + createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { + return "The " + name + " method is not implemented"; + }); + createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); + createErrorType("ERR_STREAM_DESTROYED", function(name) { + return "Cannot call " + name + " after a stream was destroyed"; + }); + createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); + createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); + createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); + createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); + createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { + return "Unknown encoding: " + arg; + }, TypeError); + createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); + module.exports.codes = codes; } }); - // node_modules/for-each/index.js - var require_for_each = __commonJS({ - "node_modules/for-each/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/state.js + var require_state = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var isCallable = require_is_callable(); - var toStr = Object.prototype.toString; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var forEachArray = function forEachArray2(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } - }; - var forEachString = function forEachString2(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } - }; - var forEachObject = function forEachObject2(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } - }; - var forEach = function forEach2(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError("iterator must be a function"); - } - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; - } - if (toStr.call(list) === "[object Array]") { - forEachArray(list, iterator, receiver); - } else if (typeof list === "string") { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } - }; - module.exports = forEach; - } - }); - - // node_modules/available-typed-arrays/index.js - var require_available_typed_arrays = __commonJS({ - "node_modules/available-typed-arrays/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var possibleNames = [ - "BigInt64Array", - "BigUint64Array", - "Float32Array", - "Float64Array", - "Int16Array", - "Int32Array", - "Int8Array", - "Uint16Array", - "Uint32Array", - "Uint8Array", - "Uint8ClampedArray" - ]; - var g = typeof globalThis === "undefined" ? window : globalThis; - module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === "function") { - out[out.length] = possibleNames[i]; - } - } - return out; - }; - } - }); - - // node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js - var require_getOwnPropertyDescriptor = __commonJS({ - "node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - if ($gOPD) { - try { - $gOPD([], "length"); - } catch (e) { - $gOPD = null; - } - } - module.exports = $gOPD; - } - }); - - // node_modules/is-typed-array/index.js - var require_is_typed_array = __commonJS({ - "node_modules/is-typed-array/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? window : globalThis; - var typedArrays = availableTypedArrays(); - var $indexOf = callBound("Array.prototype.indexOf", true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; - }; - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var gOPD = require_getOwnPropertyDescriptor(); - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); - } - var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function(getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { - } - } - }); - return anyTrue; - }; - module.exports = function isTypedArray(value) { - if (!value || typeof value !== "object") { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { - return false; - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/which-typed-array/index.js - var require_which_typed_array = __commonJS({ - "node_modules/which-typed-array/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? window : globalThis; - var typedArrays = availableTypedArrays(); - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var gOPD = require_getOwnPropertyDescriptor(); - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - if (typeof g[typedArray] === "function") { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - } - }); + var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE; + function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; } - var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function(getter, typedArray) { - if (!foundName) { - try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; - } - } catch (e) { - } + function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : "highWaterMark"; + throw new ERR_INVALID_OPT_VALUE(name, hwm); } - }); - return foundName; - }; - var isTypedArray = require_is_typed_array(); - module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - return $slice($toString(value), 8, -1); - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/util/support/types.js - var require_types = __commonJS({ - "node_modules/util/support/types.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var isArgumentsObject = require_is_arguments(); - var isGeneratorFunction = require_is_generator_function(); - var whichTypedArray = require_which_typed_array(); - var isTypedArray = require_is_typed_array(); - function uncurryThis(f) { - return f.call.bind(f); - } - var BigIntSupported = typeof BigInt !== "undefined"; - var SymbolSupported = typeof Symbol !== "undefined"; - var ObjectToString = uncurryThis(Object.prototype.toString); - var numberValue = uncurryThis(Number.prototype.valueOf); - var stringValue = uncurryThis(String.prototype.valueOf); - var booleanValue = uncurryThis(Boolean.prototype.valueOf); - if (BigIntSupported) { - bigIntValue = uncurryThis(BigInt.prototype.valueOf); - } - var bigIntValue; - if (SymbolSupported) { - symbolValue = uncurryThis(Symbol.prototype.valueOf); - } - var symbolValue; - function checkBoxedPrimitive(value, prototypeValueOf) { - if (typeof value !== "object") { - return false; - } - try { - prototypeValueOf(value); - return true; - } catch (e) { - return false; - } - } - exports.isArgumentsObject = isArgumentsObject; - exports.isGeneratorFunction = isGeneratorFunction; - exports.isTypedArray = isTypedArray; - function isPromise(input) { - return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function"; - } - exports.isPromise = isPromise; - function isArrayBufferView(value) { - if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - return ArrayBuffer.isView(value); - } - return isTypedArray(value) || isDataView(value); - } - exports.isArrayBufferView = isArrayBufferView; - function isUint8Array(value) { - return whichTypedArray(value) === "Uint8Array"; - } - exports.isUint8Array = isUint8Array; - function isUint8ClampedArray(value) { - return whichTypedArray(value) === "Uint8ClampedArray"; - } - exports.isUint8ClampedArray = isUint8ClampedArray; - function isUint16Array(value) { - return whichTypedArray(value) === "Uint16Array"; - } - exports.isUint16Array = isUint16Array; - function isUint32Array(value) { - return whichTypedArray(value) === "Uint32Array"; - } - exports.isUint32Array = isUint32Array; - function isInt8Array(value) { - return whichTypedArray(value) === "Int8Array"; - } - exports.isInt8Array = isInt8Array; - function isInt16Array(value) { - return whichTypedArray(value) === "Int16Array"; - } - exports.isInt16Array = isInt16Array; - function isInt32Array(value) { - return whichTypedArray(value) === "Int32Array"; - } - exports.isInt32Array = isInt32Array; - function isFloat32Array(value) { - return whichTypedArray(value) === "Float32Array"; - } - exports.isFloat32Array = isFloat32Array; - function isFloat64Array(value) { - return whichTypedArray(value) === "Float64Array"; - } - exports.isFloat64Array = isFloat64Array; - function isBigInt64Array(value) { - return whichTypedArray(value) === "BigInt64Array"; - } - exports.isBigInt64Array = isBigInt64Array; - function isBigUint64Array(value) { - return whichTypedArray(value) === "BigUint64Array"; - } - exports.isBigUint64Array = isBigUint64Array; - function isMapToString(value) { - return ObjectToString(value) === "[object Map]"; - } - isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map()); - function isMap(value) { - if (typeof Map === "undefined") { - return false; - } - return isMapToString.working ? isMapToString(value) : value instanceof Map; - } - exports.isMap = isMap; - function isSetToString(value) { - return ObjectToString(value) === "[object Set]"; - } - isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set()); - function isSet(value) { - if (typeof Set === "undefined") { - return false; - } - return isSetToString.working ? isSetToString(value) : value instanceof Set; - } - exports.isSet = isSet; - function isWeakMapToString(value) { - return ObjectToString(value) === "[object WeakMap]"; - } - isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap()); - function isWeakMap(value) { - if (typeof WeakMap === "undefined") { - return false; - } - return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; - } - exports.isWeakMap = isWeakMap; - function isWeakSetToString(value) { - return ObjectToString(value) === "[object WeakSet]"; - } - isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet()); - function isWeakSet(value) { - return isWeakSetToString(value); - } - exports.isWeakSet = isWeakSet; - function isArrayBufferToString(value) { - return ObjectToString(value) === "[object ArrayBuffer]"; - } - isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer()); - function isArrayBuffer(value) { - if (typeof ArrayBuffer === "undefined") { - return false; - } - return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; - } - exports.isArrayBuffer = isArrayBuffer; - function isDataViewToString(value) { - return ObjectToString(value) === "[object DataView]"; - } - isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)); - function isDataView(value) { - if (typeof DataView === "undefined") { - return false; - } - return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; - } - exports.isDataView = isDataView; - var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0; - function isSharedArrayBufferToString(value) { - return ObjectToString(value) === "[object SharedArrayBuffer]"; - } - function isSharedArrayBuffer(value) { - if (typeof SharedArrayBufferCopy === "undefined") { - return false; - } - if (typeof isSharedArrayBufferToString.working === "undefined") { - isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); + return Math.floor(hwm); } - return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy; - } - exports.isSharedArrayBuffer = isSharedArrayBuffer; - function isAsyncFunction(value) { - return ObjectToString(value) === "[object AsyncFunction]"; - } - exports.isAsyncFunction = isAsyncFunction; - function isMapIterator(value) { - return ObjectToString(value) === "[object Map Iterator]"; - } - exports.isMapIterator = isMapIterator; - function isSetIterator(value) { - return ObjectToString(value) === "[object Set Iterator]"; - } - exports.isSetIterator = isSetIterator; - function isGeneratorObject(value) { - return ObjectToString(value) === "[object Generator]"; - } - exports.isGeneratorObject = isGeneratorObject; - function isWebAssemblyCompiledModule(value) { - return ObjectToString(value) === "[object WebAssembly.Module]"; - } - exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); - } - exports.isNumberObject = isNumberObject; - function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); - } - exports.isStringObject = isStringObject; - function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); - } - exports.isBooleanObject = isBooleanObject; - function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); - } - exports.isBigIntObject = isBigIntObject; - function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); - } - exports.isSymbolObject = isSymbolObject; - function isBoxedPrimitive(value) { - return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value); - } - exports.isBoxedPrimitive = isBoxedPrimitive; - function isAnyArrayBuffer(value) { - return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value)); + return state.objectMode ? 16 : 16 * 1024; } - exports.isAnyArrayBuffer = isAnyArrayBuffer; - ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) { - Object.defineProperty(exports, method, { - enumerable: false, - value: function() { - throw new Error(method + " is not supported in userland"); - } - }); - }); - } - }); - - // node_modules/util/support/isBufferBrowser.js - var require_isBufferBrowser = __commonJS({ - "node_modules/util/support/isBufferBrowser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function isBuffer(arg) { - return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function"; + module.exports = { + getHighWaterMark }; } }); @@ -3784,11390 +2926,2457 @@ } }); - // node_modules/util/util.js - var require_util = __commonJS({ - "node_modules/util/util.js"(exports) { + // node_modules/util-deprecate/browser.js + var require_browser = __commonJS({ + "node_modules/util-deprecate/browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for (var i = 0; i < keys.length; i++) { - descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - } - return descriptors; - }; - var formatRegExp = /%[sdj%]/g; - exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(" "); - } - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x2) { - if (x2 === "%%") - return "%"; - if (i >= len) - return x2; - switch (x2) { - case "%s": - return String(args[i++]); - case "%d": - return Number(args[i++]); - case "%j": - try { - return JSON.stringify(args[i++]); - } catch (_) { - return "[Circular]"; - } - default: - return x2; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += " " + x; - } else { - str += " " + inspect(x); - } - } - return str; - }; - exports.deprecate = function(fn, msg) { - if (typeof process !== "undefined" && process.noDeprecation === true) { + module.exports = deprecate; + function deprecate(fn, msg) { + if (config("noDeprecation")) { return fn; } - if (typeof process === "undefined") { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } var warned = false; function deprecated() { if (!warned) { - if (process.throwDeprecation) { + if (config("throwDeprecation")) { throw new Error(msg); - } else if (process.traceDeprecation) { + } else if (config("traceDeprecation")) { console.trace(msg); } else { - console.error(msg); + console.warn(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; - }; - var debugs = {}; - var debugEnvRegex = /^$/; - if (process.env.NODE_DEBUG) { - debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(); - debugEnvRegex = new RegExp("^" + debugEnv + "$", "i"); - } - var debugEnv; - exports.debuglog = function(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (debugEnvRegex.test(set)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error("%s %d: %s", set, pid, msg); - }; - } else { - debugs[set] = function() { - }; - } + } + function config(name) { + try { + if (!window.localStorage) + return false; + } catch (_) { + return false; } - return debugs[set]; - }; - function inspect(obj, opts) { - var ctx = { - seen: [], - stylize: stylizeNoColor + var val = window.localStorage[name]; + if (val == null) + return false; + return String(val).toLowerCase() === "true"; + } + } + }); + + // node_modules/readable-stream/lib/_stream_writable.js + var require_stream_writable = __commonJS({ + "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + module.exports = Writable; + function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function() { + onCorkedFinish(_this, state); }; - if (arguments.length >= 3) - ctx.depth = arguments[2]; - if (arguments.length >= 4) - ctx.colors = arguments[3]; - if (isBoolean(opts)) { - ctx.showHidden = opts; - } else if (opts) { - exports._extend(ctx, opts); - } - if (isUndefined(ctx.showHidden)) - ctx.showHidden = false; - if (isUndefined(ctx.depth)) - ctx.depth = 2; - if (isUndefined(ctx.colors)) - ctx.colors = false; - if (isUndefined(ctx.customInspect)) - ctx.customInspect = true; - if (ctx.colors) - ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); - } - exports.inspect = inspect; - inspect.colors = { - "bold": [1, 22], - "italic": [3, 23], - "underline": [4, 24], - "inverse": [7, 27], - "white": [37, 39], - "grey": [90, 39], - "black": [30, 39], - "blue": [34, 39], - "cyan": [36, 39], - "green": [32, 39], - "magenta": [35, 39], - "red": [31, 39], - "yellow": [33, 39] + } + var Duplex; + Writable.WritableState = WritableState; + var internalUtil = { + deprecate: require_browser() }; - inspect.styles = { - "special": "cyan", - "number": "yellow", - "boolean": "yellow", - "undefined": "grey", - "null": "bold", - "string": "green", - "date": "magenta", - "regexp": "red" + var Stream = require_stream_browser(); + var Buffer14 = require_buffer().Buffer; + var OurUint8Array = window.Uint8Array || function() { }; - function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - if (style) { - return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m"; - } else { - return str; - } + function _uint8ArrayToBuffer(chunk) { + return Buffer14.from(chunk); } - function stylizeNoColor(str, styleType) { - return str; + function _isUint8Array(obj) { + return Buffer14.isBuffer(obj) || obj instanceof OurUint8Array; } - function arrayToHash(array) { - var hash2 = {}; - array.forEach(function(val, idx) { - hash2[val] = true; - }); - return hash2; + var destroyImpl = require_destroy(); + var _require = require_state(); + var getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require_errors_browser().codes; + var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; + var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE; + var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES; + var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END; + var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; + var errorOrDestroy = destroyImpl.errorOrDestroy; + require_inherits_browser()(Writable, Stream); + function nop() { } - function formatValue(ctx, value, recurseTimes) { - if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) { - return formatError(value); - } - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ": " + value.name : ""; - return ctx.stylize("[Function" + name + "]", "special"); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), "date"); - } - if (isError(value)) { - return formatError(value); - } - } - var base = "", array = false, braces = ["{", "}"]; - if (isArray(value)) { - array = true; - braces = ["[", "]"]; - } - if (isFunction(value)) { - var n = value.name ? ": " + value.name : ""; - base = " [Function" + n + "]"; - } - if (isRegExp(value)) { - base = " " + RegExp.prototype.toString.call(value); - } - if (isDate(value)) { - base = " " + Date.prototype.toUTCString.call(value); - } - if (isError(value)) { - base = " " + formatError(value); - } - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } else { - return ctx.stylize("[Object]", "special"); - } + function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + if (typeof isDuplex !== "boolean") + isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex); + this.finalCalled = false; + this.needDrain = false; + this.ending = false; + this.ended = false; + this.finished = false; + this.destroyed = false; + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.length = 0; + this.writing = false; + this.corked = 0; + this.sync = true; + this.bufferProcessing = false; + this.onwrite = function(er) { + onwrite(stream, er); + }; + this.writecb = null; + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + this.pendingcb = 0; + this.prefinished = false; + this.errorEmitted = false; + this.emitClose = options.emitClose !== false; + this.autoDestroy = !!options.autoDestroy; + this.bufferedRequestCount = 0; + this.corkedRequestsFree = new CorkedRequest(this); + } + WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; } - ctx.seen.push(value); - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key2) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key2, array); + return out; + }; + (function() { + try { + Object.defineProperty(WritableState.prototype, "buffer", { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") }); + } catch (_) { } - ctx.seen.pop(); - return reduceToSingleString(output, base, braces); + })(); + var realHasInstance; + if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) + return true; + if (this !== Writable) + return false; + return object && object._writableState instanceof WritableState; + } + }); + } else { + realHasInstance = function realHasInstance2(object) { + return object instanceof this; + }; } - function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize("undefined", "undefined"); - if (isString(value)) { - var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; - return ctx.stylize(simple, "string"); + function Writable(options) { + Duplex = Duplex || require_stream_duplex(); + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) + return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + this.writable = true; + if (options) { + if (typeof options.write === "function") + this._write = options.write; + if (typeof options.writev === "function") + this._writev = options.writev; + if (typeof options.destroy === "function") + this._destroy = options.destroy; + if (typeof options.final === "function") + this._final = options.final; } - if (isNumber(value)) - return ctx.stylize("" + value, "number"); - if (isBoolean(value)) - return ctx.stylize("" + value, "boolean"); - if (isNull(value)) - return ctx.stylize("null", "null"); + Stream.call(this); } - function formatError(value) { - return "[" + Error.prototype.toString.call(value) + "]"; + Writable.prototype.pipe = function() { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); + }; + function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + errorOrDestroy(stream, er); + process.nextTick(cb, er); } - function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); - } else { - output.push(""); - } + function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== "string" && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); } - keys.forEach(function(key2) { - if (!key2.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key2, true)); - } - }); - return output; - } - function formatProperty(ctx, value, recurseTimes, visibleKeys, key2, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key2) || { value: value[key2] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize("[Getter/Setter]", "special"); - } else { - str = ctx.stylize("[Getter]", "special"); - } - } else { - if (desc.set) { - str = ctx.stylize("[Setter]", "special"); - } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; + } + Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer14.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); } - if (!hasOwnProperty(visibleKeys, key2)) { - name = "[" + key2 + "]"; + if (typeof encoding === "function") { + cb = encoding; + encoding = null; } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf("\n") > -1) { - if (array) { - str = str.split("\n").map(function(line) { - return " " + line; - }).join("\n").substr(2); - } else { - str = "\n" + str.split("\n").map(function(line) { - return " " + line; - }).join("\n"); - } - } - } else { - str = ctx.stylize("[Circular]", "special"); - } + if (isBuf) + encoding = "buffer"; + else if (!encoding) + encoding = state.defaultEncoding; + if (typeof cb !== "function") + cb = nop; + if (state.ending) + writeAfterEnd(this, cb); + else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } - if (isUndefined(name)) { - if (array && key2.match(/^\d+$/)) { - return str; - } - name = JSON.stringify("" + key2); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, "name"); - } else { - name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, "string"); - } - } - return name + ": " + str; - } - function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf("\n") >= 0) - numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1; - }, 0); - if (length > 60) { - return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1]; - } - return braces[0] + base + " " + output.join(", ") + " " + braces[1]; - } - exports.types = require_types(); - function isArray(ar) { - return Array.isArray(ar); - } - exports.isArray = isArray; - function isBoolean(arg) { - return typeof arg === "boolean"; - } - exports.isBoolean = isBoolean; - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; - function isNumber(arg) { - return typeof arg === "number"; - } - exports.isNumber = isNumber; - function isString(arg) { - return typeof arg === "string"; - } - exports.isString = isString; - function isSymbol(arg) { - return typeof arg === "symbol"; - } - exports.isSymbol = isSymbol; - function isUndefined(arg) { - return arg === void 0; - } - exports.isUndefined = isUndefined; - function isRegExp(re) { - return isObject(re) && objectToString(re) === "[object RegExp]"; - } - exports.isRegExp = isRegExp; - exports.types.isRegExp = isRegExp; - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - exports.isObject = isObject; - function isDate(d) { - return isObject(d) && objectToString(d) === "[object Date]"; - } - exports.isDate = isDate; - exports.types.isDate = isDate; - function isError(e) { - return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error); - } - exports.isError = isError; - exports.types.isNativeError = isError; - function isFunction(arg) { - return typeof arg === "function"; - } - exports.isFunction = isFunction; - function isPrimitive(arg) { - return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined"; - } - exports.isPrimitive = isPrimitive; - exports.isBuffer = require_isBufferBrowser(); - function objectToString(o) { - return Object.prototype.toString.call(o); - } - function pad(n) { - return n < 10 ? "0" + n.toString(10) : n.toString(10); - } - var months = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ]; - function timestamp() { - var d = new Date(); - var time = [ - pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds()) - ].join(":"); - return [d.getDate(), months[d.getMonth()], time].join(" "); - } - exports.log = function() { - console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments)); + return ret; }; - exports.inherits = require_inherits_browser(); - exports._extend = function(origin, add) { - if (!add || !isObject(add)) - return origin; - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; + Writable.prototype.cork = function() { + this._writableState.corked++; }; - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0; - exports.promisify = function promisify(original) { - if (typeof original !== "function") - throw new TypeError('The "original" argument must be of type Function'); - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if (typeof fn !== "function") { - throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return fn; - } - function fn() { - var promiseResolve, promiseReject; - var promise2 = new Promise(function(resolve2, reject) { - promiseResolve = resolve2; - promiseReject = reject; - }); - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - args.push(function(err, value) { - if (err) { - promiseReject(err); - } else { - promiseResolve(value); - } - }); - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); - } - return promise2; + Writable.prototype.uncork = function() { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) + clearBuffer(this, state); } - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - if (kCustomPromisifiedSymbol) - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return Object.defineProperties(fn, getOwnPropertyDescriptors(original)); }; - exports.promisify.custom = kCustomPromisifiedSymbol; - function callbackifyOnRejected(reason, cb) { - if (!reason) { - var newReason = new Error("Promise was rejected with a falsy value"); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); - } - function callbackify(original) { - if (typeof original !== "function") { - throw new TypeError('The "original" argument must be of type Function'); - } - function callbackified() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - var maybeCb = args.pop(); - if (typeof maybeCb !== "function") { - throw new TypeError("The last argument must be of type Function"); - } - var self = this; - var cb = function() { - return maybeCb.apply(self, arguments); - }; - original.apply(this, args).then(function(ret) { - process.nextTick(cb.bind(null, null, ret)); - }, function(rej) { - process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); - }); - } - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)); - return callbackified; - } - exports.callbackify = callbackify; - } - }); - - // node_modules/assert-browserify/build/internal/errors.js - var require_errors = __commonJS({ - "node_modules/assert-browserify/build/internal/errors.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + if (typeof encoding === "string") + encoding = encoding.toLowerCase(); + if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) + throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; + }; + Object.defineProperty(Writable.prototype, "writableBuffer", { + enumerable: false, + get: function get2() { + return this._writableState && this._writableState.getBuffer(); } - return _typeof2(obj); - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + }); + function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { + chunk = Buffer14.from(chunk, encoding); } + return chunk; } - function _possibleConstructorReturn(self, call) { - if (call && (_typeof2(call) === "object" || typeof call === "function")) { - return call; + Object.defineProperty(Writable.prototype, "writableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._writableState.highWaterMark; } - return _assertThisInitialized(self); - } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }); + function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = "buffer"; + chunk = newChunk; + } } - return self; - } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); - } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + if (!ret) + state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk, + encoding, + isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - if (superClass) - _setPrototypeOf(subClass, superClass); - } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); + return ret; } - var codes = {}; - var assert; - var util; - function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - function getMessage(arg1, arg2, arg3) { - if (typeof message === "string") { - return message; - } else { - return message(arg1, arg2, arg3); - } + function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) + state.onwrite(new ERR_STREAM_DESTROYED("write")); + else if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); + state.sync = false; + } + function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + process.nextTick(cb, er); + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + finishMaybe(stream, state); } - var NodeError = /* @__PURE__ */ function(_Base) { - _inherits(NodeError2, _Base); - function NodeError2(arg1, arg2, arg3) { - var _this; - _classCallCheck(this, NodeError2); - _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError2).call(this, getMessage(arg1, arg2, arg3))); - _this.code = code; - return _this; - } - return NodeError2; - }(Base); - codes[code] = NodeError; } - function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function(i) { - return String(i); - }); - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; + } + function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== "function") + throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) + onwriteError(stream, state, sync, er, cb); + else { + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); } else { - return "of ".concat(thing, " ").concat(expected[0]); + afterWrite(stream, state, finished, cb); } - } else { - return "of ".concat(thing, " ").concat(String(expected)); } } - function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; + function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); } - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; + function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit("drain"); } - return str.substring(this_len - search.length, this_len) === search; } - function includes(str, search, start) { - if (typeof start !== "number") { - start = 0; - } - if (start + search.length > str.length) { - return false; + function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) + allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, "", holder.finish); + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; } else { - return str.indexOf(search, start) !== -1; + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + if (state.writing) { + break; + } + } + if (entry === null) + state.lastBufferedRequest = null; } + state.bufferedRequest = entry; + state.bufferProcessing = false; } - createErrorType("ERR_AMBIGUOUS_ARGUMENT", 'The "%s" argument is ambiguous. %s', TypeError); - createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { - if (assert === void 0) - assert = require_assert(); - assert(typeof name === "string", "'name' must be a string"); - var determiner; - if (typeof expected === "string" && startsWith(expected, "not ")) { - determiner = "must not be"; - expected = expected.replace(/^not /, ""); - } else { - determiner = "must be"; - } - var msg; - if (endsWith(name, " argument")) { - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } else { - var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + Writable.prototype._write = function(chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); + }; + Writable.prototype._writev = null; + Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === "function") { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === "function") { + cb = encoding; + encoding = null; } - msg += ". Received type ".concat(_typeof2(actual)); - return msg; - }, TypeError); - createErrorType("ERR_INVALID_ARG_VALUE", function(name, value) { - var reason = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "is invalid"; - if (util === void 0) - util = require_util(); - var inspected = util.inspect(value); - if (inspected.length > 128) { - inspected = "".concat(inspected.slice(0, 128), "..."); - } - return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected); - }, TypeError, RangeError); - createErrorType("ERR_INVALID_RETURN_VALUE", function(input, name, value) { - var type; - if (value && value.constructor && value.constructor.name) { - type = "instance of ".concat(value.constructor.name); - } else { - type = "type ".concat(_typeof2(value)); + if (chunk !== null && chunk !== void 0) + this.write(chunk, encoding); + if (state.corked) { + state.corked = 1; + this.uncork(); } - return "Expected ".concat(input, ' to be returned from the "').concat(name, '"') + " function but got ".concat(type, "."); - }, TypeError); - createErrorType("ERR_MISSING_ARGS", function() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - if (assert === void 0) - assert = require_assert(); - assert(args.length > 0, "At least one arg needs to be specified"); - var msg = "The "; - var len = args.length; - args = args.map(function(a) { - return '"'.concat(a, '"'); - }); - switch (len) { - case 1: - msg += "".concat(args[0], " argument"); - break; - case 2: - msg += "".concat(args[0], " and ").concat(args[1], " arguments"); - break; - default: - msg += args.slice(0, len - 1).join(", "); - msg += ", and ".concat(args[len - 1], " arguments"); - break; + if (!state.ending) + endWritable(this, state, cb); + return this; + }; + Object.defineProperty(Writable.prototype, "writableLength", { + enumerable: false, + get: function get2() { + return this._writableState.length; } - return "".concat(msg, " must be specified"); - }, TypeError); - module.exports.codes = codes; - } - }); - - // node_modules/assert-browserify/build/internal/assert/assertion_error.js - var require_assertion_error = __commonJS({ - "node_modules/assert-browserify/build/internal/assert/assertion_error.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === "function") { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); + }); + function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; + } + function callFinal(stream, state) { + stream._final(function(err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); } - ownKeys.forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }); - } - return target; + state.prefinished = true; + stream.emit("prefinish"); + finishMaybe(stream, state); + }); } - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; + function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === "function" && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit("prefinish"); + } } - return obj; } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit("finish"); + if (state.autoDestroy) { + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } } + return need; } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - function _possibleConstructorReturn(self, call) { - if (call && (_typeof2(call) === "object" || typeof call === "function")) { - return call; - } - return _assertThisInitialized(self); - } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once("finish", cb); } - return self; + state.ended = true; + stream.writable = false; } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - if (superClass) - _setPrototypeOf(subClass, superClass); + state.corkedRequestsFree.next = corkReq; } - function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; - _wrapNativeSuper = function _wrapNativeSuper2(Class2) { - if (Class2 === null || !_isNativeFunction(Class2)) - return Class2; - if (typeof Class2 !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class2)) - return _cache.get(Class2); - _cache.set(Class2, Wrapper); + Object.defineProperty(Writable.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._writableState === void 0) { + return false; } - function Wrapper() { - return _construct(Class2, arguments, _getPrototypeOf(this).constructor); + return this._writableState.destroyed; + }, + set: function set(value) { + if (!this._writableState) { + return; } - Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); - return _setPrototypeOf(Wrapper, Class2); - }; - return _wrapNativeSuper(Class); - } - function isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) - return false; - if (Reflect.construct.sham) - return false; - if (typeof Proxy === "function") - return true; - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function() { - })); - return true; - } catch (e) { - return false; + this._writableState.destroyed = value; } - } - function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct2(Parent2, args2, Class2) { - var a = [null]; - a.push.apply(a, args2); - var Constructor = Function.bind.apply(Parent2, a); - var instance18 = new Constructor(); - if (Class2) - _setPrototypeOf(instance18, Class2.prototype); - return instance18; - }; + }); + Writable.prototype.destroy = destroyImpl.destroy; + Writable.prototype._undestroy = destroyImpl.undestroy; + Writable.prototype._destroy = function(err, cb) { + cb(err); + }; + } + }); + + // node_modules/readable-stream/lib/_stream_duplex.js + var require_stream_duplex = __commonJS({ + "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var objectKeys = Object.keys || function(obj) { + var keys2 = []; + for (var key2 in obj) { + keys2.push(key2); } - return _construct.apply(null, arguments); - } - function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; - } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); - } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); - } - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + return keys2; + }; + module.exports = Duplex; + var Readable = require_stream_readable(); + var Writable = require_stream_writable(); + require_inherits_browser()(Duplex, Readable); + { + keys = objectKeys(Writable.prototype); + for (v = 0; v < keys.length; v++) { + method = keys[v]; + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; } - return _typeof2(obj); } - var _require = require_util(); - var inspect = _require.inspect; - var _require2 = require_errors(); - var ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; + var keys; + var method; + var v; + function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) + this.readable = false; + if (options.writable === false) + this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once("end", onend); + } } - return str.substring(this_len - search.length, this_len) === search; } - function repeat(str, count) { - count = Math.floor(count); - if (str.length == 0 || count == 0) - return ""; - var maxCount = str.length * count; - count = Math.floor(Math.log(count) / Math.log(2)); - while (count) { - str += str; - count--; + Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._writableState.highWaterMark; } - str += str.substring(0, maxCount - str.length); - return str; - } - var blue = ""; - var green = ""; - var red = ""; - var white = ""; - var kReadableOperator = { - deepStrictEqual: "Expected values to be strictly deep-equal:", - strictEqual: "Expected values to be strictly equal:", - strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', - deepEqual: "Expected values to be loosely deep-equal:", - equal: "Expected values to be loosely equal:", - notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', - notStrictEqual: 'Expected "actual" to be strictly unequal to:', - notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', - notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', - notEqual: 'Expected "actual" to be loosely unequal to:', - notIdentical: "Values identical but not reference-equal:" - }; - var kMaxShortLength = 10; - function copyError(source) { - var keys = Object.keys(source); - var target = Object.create(Object.getPrototypeOf(source)); - keys.forEach(function(key2) { - target[key2] = source[key2]; - }); - Object.defineProperty(target, "message", { - value: source.message - }); - return target; - } - function inspectValue(val) { - return inspect(val, { - compact: false, - customInspect: false, - depth: 1e3, - maxArrayLength: Infinity, - showHidden: false, - breakLength: Infinity, - showProxy: false, - sorted: true, - getters: true - }); - } - function createErrDiff(actual, expected, operator) { - var other = ""; - var res = ""; - var lastPos = 0; - var end = ""; - var skipped = false; - var actualInspected = inspectValue(actual); - var actualLines = actualInspected.split("\n"); - var expectedLines = inspectValue(expected).split("\n"); - var i = 0; - var indicator = ""; - if (operator === "strictEqual" && _typeof2(actual) === "object" && _typeof2(expected) === "object" && actual !== null && expected !== null) { - operator = "strictEqualObject"; - } - if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) { - var inputLength = actualLines[0].length + expectedLines[0].length; - if (inputLength <= kMaxShortLength) { - if ((_typeof2(actual) !== "object" || actual === null) && (_typeof2(expected) !== "object" || expected === null) && (actual !== 0 || expected !== 0)) { - return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n"); - } - } else if (operator !== "strictEqualObject") { - var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80; - if (inputLength < maxLength) { - while (actualLines[0][i] === expectedLines[0][i]) { - i++; - } - if (i > 2) { - indicator = "\n ".concat(repeat(" ", i), "^"); - i = 0; - } - } - } + }); + Object.defineProperty(Duplex.prototype, "writableBuffer", { + enumerable: false, + get: function get2() { + return this._writableState && this._writableState.getBuffer(); } - var a = actualLines[actualLines.length - 1]; - var b = expectedLines[expectedLines.length - 1]; - while (a === b) { - if (i++ < 2) { - end = "\n ".concat(a).concat(end); - } else { - other = a; - } - actualLines.pop(); - expectedLines.pop(); - if (actualLines.length === 0 || expectedLines.length === 0) - break; - a = actualLines[actualLines.length - 1]; - b = expectedLines[expectedLines.length - 1]; - } - var maxLines = Math.max(actualLines.length, expectedLines.length); - if (maxLines === 0) { - var _actualLines = actualInspected.split("\n"); - if (_actualLines.length > 30) { - _actualLines[26] = "".concat(blue, "...").concat(white); - while (_actualLines.length > 27) { - _actualLines.pop(); - } - } - return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join("\n"), "\n"); - } - if (i > 3) { - end = "\n".concat(blue, "...").concat(white).concat(end); - skipped = true; - } - if (other !== "") { - end = "\n ".concat(other).concat(end); - other = ""; - } - var printedLines = 0; - var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white); - var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped"); - for (i = 0; i < maxLines; i++) { - var cur = i - lastPos; - if (actualLines.length < i + 1) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(expectedLines[i - 2]); - printedLines++; - } - res += "\n ".concat(expectedLines[i - 1]); - printedLines++; - } - lastPos = i; - other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]); - printedLines++; - } else if (expectedLines.length < i + 1) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(actualLines[i - 2]); - printedLines++; - } - res += "\n ".concat(actualLines[i - 1]); - printedLines++; - } - lastPos = i; - res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]); - printedLines++; - } else { - var expectedLine = expectedLines[i]; - var actualLine = actualLines[i]; - var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ",") || actualLine.slice(0, -1) !== expectedLine); - if (divergingLines && endsWith(expectedLine, ",") && expectedLine.slice(0, -1) === actualLine) { - divergingLines = false; - actualLine += ","; - } - if (divergingLines) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(actualLines[i - 2]); - printedLines++; - } - res += "\n ".concat(actualLines[i - 1]); - printedLines++; - } - lastPos = i; - res += "\n".concat(green, "+").concat(white, " ").concat(actualLine); - other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine); - printedLines += 2; - } else { - res += other; - other = ""; - if (cur === 1 || i === 0) { - res += "\n ".concat(actualLine); - printedLines++; - } - } - } - if (printedLines > 20 && i < maxLines - 2) { - return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white); - } + }); + Object.defineProperty(Duplex.prototype, "writableLength", { + enumerable: false, + get: function get2() { + return this._writableState.length; } - return "".concat(msg).concat(skipped ? skippedMsg : "", "\n").concat(res).concat(other).concat(end).concat(indicator); + }); + function onend() { + if (this._writableState.ended) + return; + process.nextTick(onEndNT, this); } - var AssertionError = /* @__PURE__ */ function(_Error) { - _inherits(AssertionError2, _Error); - function AssertionError2(options) { - var _this; - _classCallCheck(this, AssertionError2); - if (_typeof2(options) !== "object" || options === null) { - throw new ERR_INVALID_ARG_TYPE("options", "Object", options); - } - var message = options.message, operator = options.operator, stackStartFn = options.stackStartFn; - var actual = options.actual, expected = options.expected; - var limit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - if (message != null) { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, String(message))); - } else { - if (process.stderr && process.stderr.isTTY) { - if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) { - blue = "\x1B[34m"; - green = "\x1B[32m"; - white = "\x1B[39m"; - red = "\x1B[31m"; - } else { - blue = ""; - green = ""; - white = ""; - red = ""; - } - } - if (_typeof2(actual) === "object" && actual !== null && _typeof2(expected) === "object" && expected !== null && "stack" in actual && actual instanceof Error && "stack" in expected && expected instanceof Error) { - actual = copyError(actual); - expected = copyError(expected); - } - if (operator === "deepStrictEqual" || operator === "strictEqual") { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, createErrDiff(actual, expected, operator))); - } else if (operator === "notDeepStrictEqual" || operator === "notStrictEqual") { - var base = kReadableOperator[operator]; - var res = inspectValue(actual).split("\n"); - if (operator === "notStrictEqual" && _typeof2(actual) === "object" && actual !== null) { - base = kReadableOperator.notStrictEqualObject; - } - if (res.length > 30) { - res[26] = "".concat(blue, "...").concat(white); - while (res.length > 27) { - res.pop(); - } - } - if (res.length === 1) { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(base, " ").concat(res[0]))); - } else { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(base, "\n\n").concat(res.join("\n"), "\n"))); - } - } else { - var _res = inspectValue(actual); - var other = ""; - var knownOperators = kReadableOperator[operator]; - if (operator === "notDeepEqual" || operator === "notEqual") { - _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res); - if (_res.length > 1024) { - _res = "".concat(_res.slice(0, 1021), "..."); - } - } else { - other = "".concat(inspectValue(expected)); - if (_res.length > 512) { - _res = "".concat(_res.slice(0, 509), "..."); - } - if (other.length > 512) { - other = "".concat(other.slice(0, 509), "..."); - } - if (operator === "deepEqual" || operator === "equal") { - _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n"); - } else { - other = " ".concat(operator, " ").concat(other); - } - } - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(_res).concat(other))); - } - } - Error.stackTraceLimit = limit; - _this.generatedMessage = !message; - Object.defineProperty(_assertThisInitialized(_this), "name", { - value: "AssertionError [ERR_ASSERTION]", - enumerable: false, - writable: true, - configurable: true - }); - _this.code = "ERR_ASSERTION"; - _this.actual = actual; - _this.expected = expected; - _this.operator = operator; - if (Error.captureStackTrace) { - Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn); - } - _this.stack; - _this.name = "AssertionError"; - return _possibleConstructorReturn(_this); - } - _createClass(AssertionError2, [{ - key: "toString", - value: function toString2() { - return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); + function onEndNT(self) { + self.end(); + } + Object.defineProperty(Duplex.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._readableState === void 0 || this._writableState === void 0) { + return false; } - }, { - key: inspect.custom, - value: function value(recurseTimes, ctx) { - return inspect(this, _objectSpread({}, ctx, { - customInspect: false, - depth: 0 - })); + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + if (this._readableState === void 0 || this._writableState === void 0) { + return; } - }]); - return AssertionError2; - }(_wrapNativeSuper(Error)); - module.exports = AssertionError; + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } + }); } }); - // node_modules/es6-object-assign/index.js - var require_es6_object_assign = __commonJS({ - "node_modules/es6-object-assign/index.js"(exports, module) { - "use strict"; + // node_modules/safe-buffer/index.js + var require_safe_buffer = __commonJS({ + "node_modules/safe-buffer/index.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - function assign2(target, firstSource) { - if (target === void 0 || target === null) { - throw new TypeError("Cannot convert first argument to object"); - } - var to = Object(target); - for (var i = 1; i < arguments.length; i++) { - var nextSource = arguments[i]; - if (nextSource === void 0 || nextSource === null) { - continue; - } - var keysArray = Object.keys(Object(nextSource)); - for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { - var nextKey = keysArray[nextIndex]; - var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); - if (desc !== void 0 && desc.enumerable) { - to[nextKey] = nextSource[nextKey]; - } - } + var buffer = require_buffer(); + var Buffer14 = buffer.Buffer; + function copyProps(src, dst) { + for (var key2 in src) { + dst[key2] = src[key2]; } - return to; } - function polyfill() { - if (!Object.assign) { - Object.defineProperty(Object, "assign", { - enumerable: false, - configurable: true, - writable: true, - value: assign2 - }); - } + if (Buffer14.from && Buffer14.alloc && Buffer14.allocUnsafe && Buffer14.allocUnsafeSlow) { + module.exports = buffer; + } else { + copyProps(buffer, exports); + exports.Buffer = SafeBuffer; } - module.exports = { - assign: assign2, - polyfill - }; - } - }); - - // node_modules/object-keys/isArguments.js - var require_isArguments = __commonJS({ - "node_modules/object-keys/isArguments.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var toStr = Object.prototype.toString; - module.exports = function isArguments(value) { - var str = toStr.call(value); - var isArgs = str === "[object Arguments]"; - if (!isArgs) { - isArgs = str !== "[object Array]" && value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && toStr.call(value.callee) === "[object Function]"; - } - return isArgs; + function SafeBuffer(arg, encodingOrOffset, length) { + return Buffer14(arg, encodingOrOffset, length); + } + SafeBuffer.prototype = Object.create(Buffer14.prototype); + copyProps(Buffer14, SafeBuffer); + SafeBuffer.from = function(arg, encodingOrOffset, length) { + if (typeof arg === "number") { + throw new TypeError("Argument must not be a number"); + } + return Buffer14(arg, encodingOrOffset, length); }; - } - }); - - // node_modules/object-keys/implementation.js - var require_implementation2 = __commonJS({ - "node_modules/object-keys/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var keysShim; - if (!Object.keys) { - has = Object.prototype.hasOwnProperty; - toStr = Object.prototype.toString; - isArgs = require_isArguments(); - isEnumerable = Object.prototype.propertyIsEnumerable; - hasDontEnumBug = !isEnumerable.call({ toString: null }, "toString"); - hasProtoEnumBug = isEnumerable.call(function() { - }, "prototype"); - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ]; - equalsConstructorPrototype = function(o) { - var ctor = o.constructor; - return ctor && ctor.prototype === o; - }; - excludedKeys = { - $applicationCache: true, - $console: true, - $external: true, - $frame: true, - $frameElement: true, - $frames: true, - $innerHeight: true, - $innerWidth: true, - $onmozfullscreenchange: true, - $onmozfullscreenerror: true, - $outerHeight: true, - $outerWidth: true, - $pageXOffset: true, - $pageYOffset: true, - $parent: true, - $scrollLeft: true, - $scrollTop: true, - $scrollX: true, - $scrollY: true, - $self: true, - $webkitIndexedDB: true, - $webkitStorageInfo: true, - $window: true - }; - hasAutomationEqualityBug = function() { - if (typeof window === "undefined") { - return false; - } - for (var k in window) { - try { - if (!excludedKeys["$" + k] && has.call(window, k) && window[k] !== null && typeof window[k] === "object") { - try { - equalsConstructorPrototype(window[k]); - } catch (e) { - return true; - } - } - } catch (e) { - return true; - } - } - return false; - }(); - equalsConstructorPrototypeIfNotBuggy = function(o) { - if (typeof window === "undefined" || !hasAutomationEqualityBug) { - return equalsConstructorPrototype(o); - } - try { - return equalsConstructorPrototype(o); - } catch (e) { - return false; - } - }; - keysShim = function keys(object) { - var isObject = object !== null && typeof object === "object"; - var isFunction = toStr.call(object) === "[object Function]"; - var isArguments = isArgs(object); - var isString = isObject && toStr.call(object) === "[object String]"; - var theKeys = []; - if (!isObject && !isFunction && !isArguments) { - throw new TypeError("Object.keys called on a non-object"); - } - var skipProto = hasProtoEnumBug && isFunction; - if (isString && object.length > 0 && !has.call(object, 0)) { - for (var i = 0; i < object.length; ++i) { - theKeys.push(String(i)); - } - } - if (isArguments && object.length > 0) { - for (var j = 0; j < object.length; ++j) { - theKeys.push(String(j)); - } + SafeBuffer.alloc = function(size, fill, encoding) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); + } + var buf2 = Buffer14(size); + if (fill !== void 0) { + if (typeof encoding === "string") { + buf2.fill(fill, encoding); } else { - for (var name in object) { - if (!(skipProto && name === "prototype") && has.call(object, name)) { - theKeys.push(String(name)); - } - } - } - if (hasDontEnumBug) { - var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); - for (var k = 0; k < dontEnums.length; ++k) { - if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object, dontEnums[k])) { - theKeys.push(dontEnums[k]); - } - } - } - return theKeys; - }; - } - var has; - var toStr; - var isArgs; - var isEnumerable; - var hasDontEnumBug; - var hasProtoEnumBug; - var dontEnums; - var equalsConstructorPrototype; - var excludedKeys; - var hasAutomationEqualityBug; - var equalsConstructorPrototypeIfNotBuggy; - module.exports = keysShim; - } - }); - - // node_modules/object-keys/index.js - var require_object_keys = __commonJS({ - "node_modules/object-keys/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var slice = Array.prototype.slice; - var isArgs = require_isArguments(); - var origKeys = Object.keys; - var keysShim = origKeys ? function keys(o) { - return origKeys(o); - } : require_implementation2(); - var originalKeys = Object.keys; - keysShim.shim = function shimObjectKeys() { - if (Object.keys) { - var keysWorksWithArguments = function() { - var args = Object.keys(arguments); - return args && args.length === arguments.length; - }(1, 2); - if (!keysWorksWithArguments) { - Object.keys = function keys(object) { - if (isArgs(object)) { - return originalKeys(slice.call(object)); - } - return originalKeys(object); - }; + buf2.fill(fill); } } else { - Object.keys = keysShim; - } - return Object.keys || keysShim; - }; - module.exports = keysShim; - } - }); - - // node_modules/has-property-descriptors/index.js - var require_has_property_descriptors = __commonJS({ - "node_modules/has-property-descriptors/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var hasPropertyDescriptors = function hasPropertyDescriptors2() { - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - return true; - } catch (e) { - return false; - } - } - return false; - }; - hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { - if (!hasPropertyDescriptors()) { - return null; - } - try { - return $defineProperty([], "length", { value: 1 }).length !== 1; - } catch (e) { - return true; + buf2.fill(0); } + return buf2; }; - module.exports = hasPropertyDescriptors; - } - }); - - // node_modules/define-properties/index.js - var require_define_properties = __commonJS({ - "node_modules/define-properties/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var keys = require_object_keys(); - var hasSymbols = typeof Symbol === "function" && typeof Symbol("foo") === "symbol"; - var toStr = Object.prototype.toString; - var concat = Array.prototype.concat; - var origDefineProperty = Object.defineProperty; - var isFunction = function(fn) { - return typeof fn === "function" && toStr.call(fn) === "[object Function]"; - }; - var hasPropertyDescriptors = require_has_property_descriptors()(); - var supportsDescriptors = origDefineProperty && hasPropertyDescriptors; - var defineProperty = function(object, name, value, predicate) { - if (name in object && (!isFunction(predicate) || !predicate())) { - return; - } - if (supportsDescriptors) { - origDefineProperty(object, name, { - configurable: true, - enumerable: false, - value, - writable: true - }); - } else { - object[name] = value; + SafeBuffer.allocUnsafe = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } + return Buffer14(size); }; - var defineProperties = function(object, map) { - var predicates = arguments.length > 2 ? arguments[2] : {}; - var props = keys(map); - if (hasSymbols) { - props = concat.call(props, Object.getOwnPropertySymbols(map)); - } - for (var i = 0; i < props.length; i += 1) { - defineProperty(object, props[i], map[props[i]], predicates[props[i]]); + SafeBuffer.allocUnsafeSlow = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } + return buffer.SlowBuffer(size); }; - defineProperties.supportsDescriptors = !!supportsDescriptors; - module.exports = defineProperties; } }); - // node_modules/object-is/implementation.js - var require_implementation3 = __commonJS({ - "node_modules/object-is/implementation.js"(exports, module) { + // node_modules/string_decoder/lib/string_decoder.js + var require_string_decoder = __commonJS({ + "node_modules/string_decoder/lib/string_decoder.js"(exports) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var numberIsNaN = function(value) { - return value !== value; - }; - module.exports = function is(a, b) { - if (a === 0 && b === 0) { - return 1 / a === 1 / b; - } - if (a === b) { - return true; - } - if (numberIsNaN(a) && numberIsNaN(b)) { - return true; + var Buffer14 = require_safe_buffer().Buffer; + var isEncoding = Buffer14.isEncoding || function(encoding) { + encoding = "" + encoding; + switch (encoding && encoding.toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + case "raw": + return true; + default: + return false; } - return false; - }; - } - }); - - // node_modules/object-is/polyfill.js - var require_polyfill = __commonJS({ - "node_modules/object-is/polyfill.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation3(); - module.exports = function getPolyfill() { - return typeof Object.is === "function" ? Object.is : implementation; }; - } - }); - - // node_modules/object-is/shim.js - var require_shim = __commonJS({ - "node_modules/object-is/shim.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var getPolyfill = require_polyfill(); - var define2 = require_define_properties(); - module.exports = function shimObjectIs() { - var polyfill = getPolyfill(); - define2(Object, { is: polyfill }, { - is: function testObjectIs() { - return Object.is !== polyfill; + function _normalizeEncoding(enc) { + if (!enc) + return "utf8"; + var retried; + while (true) { + switch (enc) { + case "utf8": + case "utf-8": + return "utf8"; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return "utf16le"; + case "latin1": + case "binary": + return "latin1"; + case "base64": + case "ascii": + case "hex": + return enc; + default: + if (retried) + return; + enc = ("" + enc).toLowerCase(); + retried = true; } - }); - return polyfill; - }; - } - }); - - // node_modules/object-is/index.js - var require_object_is = __commonJS({ - "node_modules/object-is/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var define2 = require_define_properties(); - var callBind = require_call_bind(); - var implementation = require_implementation3(); - var getPolyfill = require_polyfill(); - var shim = require_shim(); - var polyfill = callBind(getPolyfill(), Object); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module.exports = polyfill; - } - }); - - // node_modules/is-nan/implementation.js - var require_implementation4 = __commonJS({ - "node_modules/is-nan/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function isNaN2(value) { - return value !== value; - }; - } - }); - - // node_modules/is-nan/polyfill.js - var require_polyfill2 = __commonJS({ - "node_modules/is-nan/polyfill.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation4(); - module.exports = function getPolyfill() { - if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN("a")) { - return Number.isNaN; } - return implementation; - }; - } - }); - - // node_modules/is-nan/shim.js - var require_shim2 = __commonJS({ - "node_modules/is-nan/shim.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var define2 = require_define_properties(); - var getPolyfill = require_polyfill2(); - module.exports = function shimNumberIsNaN() { - var polyfill = getPolyfill(); - define2(Number, { isNaN: polyfill }, { - isNaN: function testIsNaN() { - return Number.isNaN !== polyfill; - } - }); - return polyfill; - }; - } - }); - - // node_modules/is-nan/index.js - var require_is_nan = __commonJS({ - "node_modules/is-nan/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var callBind = require_call_bind(); - var define2 = require_define_properties(); - var implementation = require_implementation4(); - var getPolyfill = require_polyfill2(); - var shim = require_shim2(); - var polyfill = callBind(getPolyfill(), Number); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module.exports = polyfill; - } - }); - - // node_modules/assert-browserify/build/internal/util/comparisons.js - var require_comparisons = __commonJS({ - "node_modules/assert-browserify/build/internal/util/comparisons.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== "string" && (Buffer14.isEncoding === isEncoding || !isEncoding(enc))) + throw new Error("Unknown encoding: " + enc); + return nenc || enc; } - function _iterableToArrayLimit(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = void 0; - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) - break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) - _i["return"](); - } finally { - if (_d) - throw _e; - } + exports.StringDecoder = StringDecoder; + function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case "utf16le": + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case "utf8": + this.fillLast = utf8FillLast; + nb = 4; + break; + case "base64": + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; } - return _arr; - } - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) - return arr; + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer14.allocUnsafe(nb); } - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; + StringDecoder.prototype.write = function(buf2) { + if (buf2.length === 0) + return ""; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf2); + if (r === void 0) + return ""; + i = this.lastNeed; + this.lastNeed = 0; } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + i = 0; } - return _typeof2(obj); - } - var regexFlagsSupported = /a/g.flags !== void 0; - var arrayFromSet = function arrayFromSet2(set) { - var array = []; - set.forEach(function(value) { - return array.push(value); - }); - return array; + if (i < buf2.length) + return r ? r + this.text(buf2, i) : this.text(buf2, i); + return r || ""; }; - var arrayFromMap = function arrayFromMap2(map) { - var array = []; - map.forEach(function(value, key2) { - return array.push([key2, value]); - }); - return array; - }; - var objectIs = Object.is ? Object.is : require_object_is(); - var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function() { - return []; - }; - var numberIsNaN = Number.isNaN ? Number.isNaN : require_is_nan(); - function uncurryThis(f) { - return f.call.bind(f); - } - var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); - var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable); - var objectToString = uncurryThis(Object.prototype.toString); - var _require$types = require_util().types; - var isAnyArrayBuffer = _require$types.isAnyArrayBuffer; - var isArrayBufferView = _require$types.isArrayBufferView; - var isDate = _require$types.isDate; - var isMap = _require$types.isMap; - var isRegExp = _require$types.isRegExp; - var isSet = _require$types.isSet; - var isNativeError = _require$types.isNativeError; - var isBoxedPrimitive = _require$types.isBoxedPrimitive; - var isNumberObject = _require$types.isNumberObject; - var isStringObject = _require$types.isStringObject; - var isBooleanObject = _require$types.isBooleanObject; - var isBigIntObject = _require$types.isBigIntObject; - var isSymbolObject = _require$types.isSymbolObject; - var isFloat32Array = _require$types.isFloat32Array; - var isFloat64Array = _require$types.isFloat64Array; - function isNonIndex(key2) { - if (key2.length === 0 || key2.length > 10) - return true; - for (var i = 0; i < key2.length; i++) { - var code = key2.charCodeAt(i); - if (code < 48 || code > 57) - return true; + StringDecoder.prototype.end = utf8End; + StringDecoder.prototype.text = utf8Text; + StringDecoder.prototype.fillLast = function(buf2) { + if (this.lastNeed <= buf2.length) { + buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - return key2.length === 10 && key2 >= Math.pow(2, 32); - } - function getOwnNonIndexProperties(value) { - return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value))); + buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length); + this.lastNeed -= buf2.length; + }; + function utf8CheckByte(byte) { + if (byte <= 127) + return 0; + else if (byte >> 5 === 6) + return 2; + else if (byte >> 4 === 14) + return 3; + else if (byte >> 3 === 30) + return 4; + return byte >> 6 === 2 ? -1 : -2; } - function compare(a, b) { - if (a === b) { + function utf8CheckIncomplete(self, buf2, i) { + var j = buf2.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) + self.lastNeed = nb - 1; + return nb; } - var x = a.length; - var y = b.length; - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) { - return -1; + if (--j < i || nb === -2) + return 0; + nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) + self.lastNeed = nb - 2; + return nb; } - if (y < x) { - return 1; + if (--j < i || nb === -2) + return 0; + nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) + nb = 0; + else + self.lastNeed = nb - 3; + } + return nb; } return 0; } - var ONLY_ENUMERABLE = void 0; - var kStrict = true; - var kLoose = false; - var kNoIterator = 0; - var kIsArray = 1; - var kIsSet = 2; - var kIsMap = 3; - function areSimilarRegExps(a, b) { - return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b); - } - function areSimilarFloatArrays(a, b) { - if (a.byteLength !== b.byteLength) { - return false; + function utf8CheckExtraBytes(self, buf2, p) { + if ((buf2[0] & 192) !== 128) { + self.lastNeed = 0; + return "\uFFFD"; } - for (var offset = 0; offset < a.byteLength; offset++) { - if (a[offset] !== b[offset]) { - return false; + if (self.lastNeed > 1 && buf2.length > 1) { + if ((buf2[1] & 192) !== 128) { + self.lastNeed = 1; + return "\uFFFD"; + } + if (self.lastNeed > 2 && buf2.length > 2) { + if ((buf2[2] & 192) !== 128) { + self.lastNeed = 2; + return "\uFFFD"; + } } } - return true; } - function areSimilarTypedArrays(a, b) { - if (a.byteLength !== b.byteLength) { - return false; + function utf8FillLast(buf2) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf2, p); + if (r !== void 0) + return r; + if (this.lastNeed <= buf2.length) { + buf2.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0; + buf2.copy(this.lastChar, p, 0, buf2.length); + this.lastNeed -= buf2.length; } - function areEqualArrayBuffers(buf1, buf2) { - return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0; + function utf8Text(buf2, i) { + var total = utf8CheckIncomplete(this, buf2, i); + if (!this.lastNeed) + return buf2.toString("utf8", i); + this.lastTotal = total; + var end = buf2.length - (total - this.lastNeed); + buf2.copy(this.lastChar, 0, end); + return buf2.toString("utf8", i, end); } - function isEqualBoxedPrimitive(val1, val2) { - if (isNumberObject(val1)) { - return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2)); - } - if (isStringObject(val1)) { - return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2); - } - if (isBooleanObject(val1)) { - return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2); - } - if (isBigIntObject(val1)) { - return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2); - } - return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2); + function utf8End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) + return r + "\uFFFD"; + return r; } - function innerDeepEqual(val1, val2, strict, memos) { - if (val1 === val2) { - if (val1 !== 0) - return true; - return strict ? objectIs(val1, val2) : true; - } - if (strict) { - if (_typeof2(val1) !== "object") { - return typeof val1 === "number" && numberIsNaN(val1) && numberIsNaN(val2); - } - if (_typeof2(val2) !== "object" || val1 === null || val2 === null) { - return false; - } - if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) { - return false; - } - } else { - if (val1 === null || _typeof2(val1) !== "object") { - if (val2 === null || _typeof2(val2) !== "object") { - return val1 == val2; - } - return false; - } - if (val2 === null || _typeof2(val2) !== "object") { - return false; - } - } - var val1Tag = objectToString(val1); - var val2Tag = objectToString(val2); - if (val1Tag !== val2Tag) { - return false; - } - if (Array.isArray(val1)) { - if (val1.length !== val2.length) { - return false; - } - var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); - var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); - if (keys1.length !== keys2.length) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsArray, keys1); - } - if (val1Tag === "[object Object]") { - if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) { - return false; - } - } - if (isDate(val1)) { - if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) { - return false; - } - } else if (isRegExp(val1)) { - if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) { - return false; - } - } else if (isNativeError(val1) || val1 instanceof Error) { - if (val1.message !== val2.message || val1.name !== val2.name) { - return false; - } - } else if (isArrayBufferView(val1)) { - if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) { - if (!areSimilarFloatArrays(val1, val2)) { - return false; + function utf16Text(buf2, i) { + if ((buf2.length - i) % 2 === 0) { + var r = buf2.toString("utf16le", i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 55296 && c <= 56319) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf2[buf2.length - 2]; + this.lastChar[1] = buf2[buf2.length - 1]; + return r.slice(0, -1); } - } else if (!areSimilarTypedArrays(val1, val2)) { - return false; - } - var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); - var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); - if (_keys.length !== _keys2.length) { - return false; - } - return keyCheck(val1, val2, strict, memos, kNoIterator, _keys); - } else if (isSet(val1)) { - if (!isSet(val2) || val1.size !== val2.size) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsSet); - } else if (isMap(val1)) { - if (!isMap(val2) || val1.size !== val2.size) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsMap); - } else if (isAnyArrayBuffer(val1)) { - if (!areEqualArrayBuffers(val1, val2)) { - return false; } - } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) { - return false; + return r; } - return keyCheck(val1, val2, strict, memos, kNoIterator); - } - function getEnumerables(val, keys) { - return keys.filter(function(k) { - return propertyIsEnumerable(val, k); - }); + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf2[buf2.length - 1]; + return buf2.toString("utf16le", i, buf2.length - 1); } - function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { - if (arguments.length === 5) { - aKeys = Object.keys(val1); - var bKeys = Object.keys(val2); - if (aKeys.length !== bKeys.length) { - return false; - } - } - var i = 0; - for (; i < aKeys.length; i++) { - if (!hasOwnProperty(val2, aKeys[i])) { - return false; - } - } - if (strict && arguments.length === 5) { - var symbolKeysA = objectGetOwnPropertySymbols(val1); - if (symbolKeysA.length !== 0) { - var count = 0; - for (i = 0; i < symbolKeysA.length; i++) { - var key2 = symbolKeysA[i]; - if (propertyIsEnumerable(val1, key2)) { - if (!propertyIsEnumerable(val2, key2)) { - return false; - } - aKeys.push(key2); - count++; - } else if (propertyIsEnumerable(val2, key2)) { - return false; - } - } - var symbolKeysB = objectGetOwnPropertySymbols(val2); - if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) { - return false; - } - } else { - var _symbolKeysB = objectGetOwnPropertySymbols(val2); - if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) { - return false; - } - } - } - if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) { - return true; + function utf16End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString("utf16le", 0, end); } - if (memos === void 0) { - memos = { - val1: /* @__PURE__ */ new Map(), - val2: /* @__PURE__ */ new Map(), - position: 0 - }; + return r; + } + function base64Text(buf2, i) { + var n = (buf2.length - i) % 3; + if (n === 0) + return buf2.toString("base64", i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf2[buf2.length - 1]; } else { - var val2MemoA = memos.val1.get(val1); - if (val2MemoA !== void 0) { - var val2MemoB = memos.val2.get(val2); - if (val2MemoB !== void 0) { - return val2MemoA === val2MemoB; - } - } - memos.position++; - } - memos.val1.set(val1, memos.position); - memos.val2.set(val2, memos.position); - var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType); - memos.val1.delete(val1); - memos.val2.delete(val2); - return areEq; - } - function setHasEqualElement(set, val1, strict, memo) { - var setValues = arrayFromSet(set); - for (var i = 0; i < setValues.length; i++) { - var val2 = setValues[i]; - if (innerDeepEqual(val1, val2, strict, memo)) { - set.delete(val2); - return true; - } + this.lastChar[0] = buf2[buf2.length - 2]; + this.lastChar[1] = buf2[buf2.length - 1]; } - return false; + return buf2.toString("base64", i, buf2.length - n); } - function findLooseMatchingPrimitives(prim) { - switch (_typeof2(prim)) { - case "undefined": - return null; - case "object": - return void 0; - case "symbol": - return false; - case "string": - prim = +prim; - case "number": - if (numberIsNaN(prim)) { - return false; - } - } - return true; + function base64End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) + return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); + return r; } - function setMightHaveLoosePrim(a, b, prim) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) - return altValue; - return b.has(altValue) && !a.has(altValue); + function simpleWrite(buf2) { + return buf2.toString(this.encoding); } - function mapMightHaveLoosePrim(a, b, prim, item, memo) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) { - return altValue; - } - var curB = b.get(altValue); - if (curB === void 0 && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) { - return false; - } - return !a.has(altValue) && innerDeepEqual(item, curB, false, memo); + function simpleEnd(buf2) { + return buf2 && buf2.length ? this.write(buf2) : ""; } - function setEquiv(a, b, strict, memo) { - var set = null; - var aValues = arrayFromSet(a); - for (var i = 0; i < aValues.length; i++) { - var val = aValues[i]; - if (_typeof2(val) === "object" && val !== null) { - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(val); - } else if (!b.has(val)) { - if (strict) - return false; - if (!setMightHaveLoosePrim(a, b, val)) { - return false; - } - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(val); - } - } - if (set !== null) { - var bValues = arrayFromSet(b); - for (var _i = 0; _i < bValues.length; _i++) { - var _val = bValues[_i]; - if (_typeof2(_val) === "object" && _val !== null) { - if (!setHasEqualElement(set, _val, strict, memo)) - return false; - } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) { - return false; - } + } + }); + + // node_modules/readable-stream/lib/internal/streams/end-of-stream.js + var require_end_of_stream = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE; + function once(callback) { + var called = false; + return function() { + if (called) + return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - return set.size === 0; - } - return true; + callback.apply(this, args); + }; } - function mapHasEqualEntry(set, map, key1, item1, strict, memo) { - var setValues = arrayFromSet(set); - for (var i = 0; i < setValues.length; i++) { - var key2 = setValues[i]; - if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) { - set.delete(key2); - return true; - } - } - return false; + function noop3() { } - function mapEquiv(a, b, strict, memo) { - var set = null; - var aEntries = arrayFromMap(a); - for (var i = 0; i < aEntries.length; i++) { - var _aEntries$i = _slicedToArray(aEntries[i], 2), key2 = _aEntries$i[0], item1 = _aEntries$i[1]; - if (_typeof2(key2) === "object" && key2 !== null) { - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(key2); - } else { - var item2 = b.get(key2); - if (item2 === void 0 && !b.has(key2) || !innerDeepEqual(item1, item2, strict, memo)) { - if (strict) - return false; - if (!mapMightHaveLoosePrim(a, b, key2, item1, memo)) - return false; - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(key2); - } - } - } - if (set !== null) { - var bEntries = arrayFromMap(b); - for (var _i2 = 0; _i2 < bEntries.length; _i2++) { - var _bEntries$_i = _slicedToArray(bEntries[_i2], 2), key2 = _bEntries$_i[0], item = _bEntries$_i[1]; - if (_typeof2(key2) === "object" && key2 !== null) { - if (!mapHasEqualEntry(set, a, key2, item, strict, memo)) - return false; - } else if (!strict && (!a.has(key2) || !innerDeepEqual(a.get(key2), item, false, memo)) && !mapHasEqualEntry(set, a, key2, item, false, memo)) { - return false; - } - } - return set.size === 0; - } - return true; + function isRequest(stream) { + return stream.setHeader && typeof stream.abort === "function"; } - function objEquiv(a, b, strict, keys, memos, iterationType) { - var i = 0; - if (iterationType === kIsSet) { - if (!setEquiv(a, b, strict, memos)) { - return false; - } - } else if (iterationType === kIsMap) { - if (!mapEquiv(a, b, strict, memos)) { - return false; - } - } else if (iterationType === kIsArray) { - for (; i < a.length; i++) { - if (hasOwnProperty(a, i)) { - if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) { - return false; - } - } else if (hasOwnProperty(b, i)) { - return false; - } else { - var keysA = Object.keys(a); - for (; i < keysA.length; i++) { - var key2 = keysA[i]; - if (!hasOwnProperty(b, key2) || !innerDeepEqual(a[key2], b[key2], strict, memos)) { - return false; - } - } - if (keysA.length !== Object.keys(b).length) { - return false; - } - return true; - } + function eos(stream, opts, callback) { + if (typeof opts === "function") + return eos(stream, null, opts); + if (!opts) + opts = {}; + callback = once(callback || noop3); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable2 = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish2() { + if (!stream.writable) + onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish2() { + writable2 = false; + writableEnded = true; + if (!readable) + callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend2() { + readable = false; + readableEnded = true; + if (!writable2) + callback.call(stream); + }; + var onerror = function onerror2(err) { + callback.call(stream, err); + }; + var onclose = function onclose2() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) + err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } - } - for (i = 0; i < keys.length; i++) { - var _key = keys[i]; - if (!innerDeepEqual(a[_key], b[_key], strict, memos)) { - return false; + if (writable2 && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) + err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } + }; + var onrequest = function onrequest2() { + stream.req.on("finish", onfinish); + }; + if (isRequest(stream)) { + stream.on("complete", onfinish); + stream.on("abort", onclose); + if (stream.req) + onrequest(); + else + stream.on("request", onrequest); + } else if (writable2 && !stream._writableState) { + stream.on("end", onlegacyfinish); + stream.on("close", onlegacyfinish); } - return true; - } - function isDeepEqual(val1, val2) { - return innerDeepEqual(val1, val2, kLoose); - } - function isDeepStrictEqual(val1, val2) { - return innerDeepEqual(val1, val2, kStrict); + stream.on("end", onend); + stream.on("finish", onfinish); + if (opts.error !== false) + stream.on("error", onerror); + stream.on("close", onclose); + return function() { + stream.removeListener("complete", onfinish); + stream.removeListener("abort", onclose); + stream.removeListener("request", onrequest); + if (stream.req) + stream.req.removeListener("finish", onfinish); + stream.removeListener("end", onlegacyfinish); + stream.removeListener("close", onlegacyfinish); + stream.removeListener("finish", onfinish); + stream.removeListener("end", onend); + stream.removeListener("error", onerror); + stream.removeListener("close", onclose); + }; } - module.exports = { - isDeepEqual, - isDeepStrictEqual - }; + module.exports = eos; } }); - // node_modules/assert-browserify/build/assert.js - var require_assert = __commonJS({ - "node_modules/assert-browserify/build/assert.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/async_iterator.js + var require_async_iterator = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; + var _Object$setPrototypeO; + function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof2(obj); - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + obj[key2] = value; } + return obj; } - var _require = require_errors(); - var _require$codes = _require.codes; - var ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE; - var ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE; - var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; - var AssertionError = require_assertion_error(); - var _require2 = require_util(); - var inspect = _require2.inspect; - var _require$types = require_util().types; - var isPromise = _require$types.isPromise; - var isRegExp = _require$types.isRegExp; - var objectAssign = Object.assign ? Object.assign : require_es6_object_assign().assign; - var objectIs = Object.is ? Object.is : require_object_is(); - var isDeepEqual; - var isDeepStrictEqual; - function lazyLoadComparison() { - var comparison = require_comparisons(); - isDeepEqual = comparison.isDeepEqual; - isDeepStrictEqual = comparison.isDeepStrictEqual; - } - var warned = false; - var assert = module.exports = ok; - var NO_EXCEPTION_SENTINEL = {}; - function innerFail(obj) { - if (obj.message instanceof Error) - throw obj.message; - throw new AssertionError(obj); - } - function fail(actual, expected, message, operator, stackStartFn) { - var argsLen = arguments.length; - var internalMessage; - if (argsLen === 0) { - internalMessage = "Failed"; - } else if (argsLen === 1) { - message = actual; - actual = void 0; - } else { - if (warned === false) { - warned = true; - var warn2 = process.emitWarning ? process.emitWarning : console.warn.bind(console); - warn2("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.", "DeprecationWarning", "DEP0094"); - } - if (argsLen === 2) - operator = "!="; - } - if (message instanceof Error) - throw message; - var errArgs = { - actual, - expected, - operator: operator === void 0 ? "fail" : operator, - stackStartFn: stackStartFn || fail + var finished = require_end_of_stream(); + var kLastResolve = Symbol("lastResolve"); + var kLastReject = Symbol("lastReject"); + var kError = Symbol("error"); + var kEnded = Symbol("ended"); + var kLastPromise = Symbol("lastPromise"); + var kHandlePromise = Symbol("handlePromise"); + var kStream = Symbol("stream"); + function createIterResult(value, done) { + return { + value, + done }; - if (message !== void 0) { - errArgs.message = message; - } - var err = new AssertionError(errArgs); - if (internalMessage) { - err.message = internalMessage; - err.generatedMessage = true; - } - throw err; - } - assert.fail = fail; - assert.AssertionError = AssertionError; - function innerOk(fn, argLen, value, message) { - if (!value) { - var generatedMessage = false; - if (argLen === 0) { - generatedMessage = true; - message = "No value argument passed to `assert.ok()`"; - } else if (message instanceof Error) { - throw message; - } - var err = new AssertionError({ - actual: value, - expected: true, - message, - operator: "==", - stackStartFn: fn - }); - err.generatedMessage = generatedMessage; - throw err; - } } - function ok() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + function readAndResolve(iter) { + var resolve2 = iter[kLastResolve]; + if (resolve2 !== null) { + var data = iter[kStream].read(); + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve2(createIterResult(data, false)); + } } - innerOk.apply(void 0, [ok, args.length].concat(args)); } - assert.ok = ok; - assert.equal = function equal(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (actual != expected) { - innerFail({ - actual, - expected, - message, - operator: "==", - stackStartFn: equal - }); - } - }; - assert.notEqual = function notEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (actual == expected) { - innerFail({ - actual, - expected, - message, - operator: "!=", - stackStartFn: notEqual - }); - } - }; - assert.deepEqual = function deepEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (!isDeepEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "deepEqual", - stackStartFn: deepEqual - }); - } - }; - assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (isDeepEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notDeepEqual", - stackStartFn: notDeepEqual - }); - } - }; - assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (!isDeepStrictEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "deepStrictEqual", - stackStartFn: deepStrictEqual - }); - } - }; - assert.notDeepStrictEqual = notDeepStrictEqual; - function notDeepStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (isDeepStrictEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notDeepStrictEqual", - stackStartFn: notDeepStrictEqual - }); - } + function onReadable(iter) { + process.nextTick(readAndResolve, iter); } - assert.strictEqual = function strictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (!objectIs(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "strictEqual", - stackStartFn: strictEqual - }); - } - }; - assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (objectIs(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notStrictEqual", - stackStartFn: notStrictEqual - }); - } - }; - var Comparison = function Comparison2(obj, keys, actual) { - var _this = this; - _classCallCheck(this, Comparison2); - keys.forEach(function(key2) { - if (key2 in obj) { - if (actual !== void 0 && typeof actual[key2] === "string" && isRegExp(obj[key2]) && obj[key2].test(actual[key2])) { - _this[key2] = actual[key2]; - } else { - _this[key2] = obj[key2]; + function wrapForNext(lastPromise, iter) { + return function(resolve2, reject) { + lastPromise.then(function() { + if (iter[kEnded]) { + resolve2(createIterResult(void 0, true)); + return; } + iter[kHandlePromise](resolve2, reject); + }, reject); + }; + } + var AsyncIteratorPrototype = Object.getPrototypeOf(function() { + }); + var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); } - }); - }; - function compareExceptionKey(actual, expected, key2, message, keys, fn) { - if (!(key2 in actual) || !isDeepStrictEqual(actual[key2], expected[key2])) { - if (!message) { - var a = new Comparison(actual, keys); - var b = new Comparison(expected, keys, actual); - var err = new AssertionError({ - actual: a, - expected: b, - operator: "deepStrictEqual", - stackStartFn: fn + if (this[kEnded]) { + return Promise.resolve(createIterResult(void 0, true)); + } + if (this[kStream].destroyed) { + return new Promise(function(resolve2, reject) { + process.nextTick(function() { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve2(createIterResult(void 0, true)); + } + }); }); - err.actual = actual; - err.expected = expected; - err.operator = fn.name; - throw err; - } - innerFail({ - actual, - expected, - message, - operator: fn.name, - stackStartFn: fn - }); + } + var lastPromise = this[kLastPromise]; + var promise2; + if (lastPromise) { + promise2 = new Promise(wrapForNext(lastPromise, this)); + } else { + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise2 = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise2; + return promise2; } - } - function expectedException(actual, expected, msg, fn) { - if (typeof expected !== "function") { - if (isRegExp(expected)) - return expected.test(actual); - if (arguments.length === 2) { - throw new ERR_INVALID_ARG_TYPE("expected", ["Function", "RegExp"], expected); - } - if (_typeof2(actual) !== "object" || actual === null) { - var err = new AssertionError({ - actual, - expected, - message: msg, - operator: "deepStrictEqual", - stackStartFn: fn - }); - err.operator = fn.name; - throw err; - } - var keys = Object.keys(expected); - if (expected instanceof Error) { - keys.push("name", "message"); - } else if (keys.length === 0) { - throw new ERR_INVALID_ARG_VALUE("error", expected, "may not be an empty object"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - keys.forEach(function(key2) { - if (typeof actual[key2] === "string" && isRegExp(expected[key2]) && expected[key2].test(actual[key2])) { + }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { + return this; + }), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + return new Promise(function(resolve2, reject) { + _this2[kStream].destroy(null, function(err) { + if (err) { + reject(err); return; } - compareExceptionKey(actual, expected, key2, msg, keys, fn); + resolve2(createIterResult(void 0, true)); }); - return true; - } - if (expected.prototype !== void 0 && actual instanceof expected) { - return true; - } - if (Error.isPrototypeOf(expected)) { - return false; - } - return expected.call({}, actual) === true; - } - function getActual(fn) { - if (typeof fn !== "function") { - throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn); - } - try { - fn(); - } catch (e) { - return e; - } - return NO_EXCEPTION_SENTINEL; - } - function checkIsPromise(obj) { - return isPromise(obj) || obj !== null && _typeof2(obj) === "object" && typeof obj.then === "function" && typeof obj.catch === "function"; - } - function waitForActual(promiseFn) { - return Promise.resolve().then(function() { - var resultPromise; - if (typeof promiseFn === "function") { - resultPromise = promiseFn(); - if (!checkIsPromise(resultPromise)) { - throw new ERR_INVALID_RETURN_VALUE("instance of Promise", "promiseFn", resultPromise); - } - } else if (checkIsPromise(promiseFn)) { - resultPromise = promiseFn; - } else { - throw new ERR_INVALID_ARG_TYPE("promiseFn", ["Function", "Promise"], promiseFn); - } - return Promise.resolve().then(function() { - return resultPromise; - }).then(function() { - return NO_EXCEPTION_SENTINEL; - }).catch(function(e) { - return e; - }); - }); - } - function expectsError(stackStartFn, actual, error, message) { - if (typeof error === "string") { - if (arguments.length === 4) { - throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); - } - if (_typeof2(actual) === "object" && actual !== null) { - if (actual.message === error) { - throw new ERR_AMBIGUOUS_ARGUMENT("error/message", 'The error message "'.concat(actual.message, '" is identical to the message.')); - } - } else if (actual === error) { - throw new ERR_AMBIGUOUS_ARGUMENT("error/message", 'The error "'.concat(actual, '" is identical to the message.')); - } - message = error; - error = void 0; - } else if (error != null && _typeof2(error) !== "object" && typeof error !== "function") { - throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); - } - if (actual === NO_EXCEPTION_SENTINEL) { - var details = ""; - if (error && error.name) { - details += " (".concat(error.name, ")"); - } - details += message ? ": ".concat(message) : "."; - var fnType = stackStartFn.name === "rejects" ? "rejection" : "exception"; - innerFail({ - actual: void 0, - expected: error, - operator: stackStartFn.name, - message: "Missing expected ".concat(fnType).concat(details), - stackStartFn - }); - } - if (error && !expectedException(actual, error, message, stackStartFn)) { - throw actual; - } - } - function expectsNoError(stackStartFn, actual, error, message) { - if (actual === NO_EXCEPTION_SENTINEL) - return; - if (typeof error === "string") { - message = error; - error = void 0; - } - if (!error || expectedException(actual, error)) { - var details = message ? ": ".concat(message) : "."; - var fnType = stackStartFn.name === "doesNotReject" ? "rejection" : "exception"; - innerFail({ - actual, - expected: error, - operator: stackStartFn.name, - message: "Got unwanted ".concat(fnType).concat(details, "\n") + 'Actual message: "'.concat(actual && actual.message, '"'), - stackStartFn - }); - } - throw actual; - } - assert.throws = function throws(promiseFn) { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args)); - }; - assert.rejects = function rejects(promiseFn) { - for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { - args[_key3 - 1] = arguments[_key3]; - } - return waitForActual(promiseFn).then(function(result) { - return expectsError.apply(void 0, [rejects, result].concat(args)); - }); - }; - assert.doesNotThrow = function doesNotThrow(fn) { - for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { - args[_key4 - 1] = arguments[_key4]; - } - expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args)); - }; - assert.doesNotReject = function doesNotReject(fn) { - for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { - args[_key5 - 1] = arguments[_key5]; - } - return waitForActual(fn).then(function(result) { - return expectsNoError.apply(void 0, [doesNotReject, result].concat(args)); }); - }; - assert.ifError = function ifError(err) { - if (err !== null && err !== void 0) { - var message = "ifError got unwanted exception: "; - if (_typeof2(err) === "object" && typeof err.message === "string") { - if (err.message.length === 0 && err.constructor) { - message += err.constructor.name; + }), _Object$setPrototypeO), AsyncIteratorPrototype); + var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve2, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve2(createIterResult(data, false)); } else { - message += err.message; + iterator[kLastResolve] = resolve2; + iterator[kLastReject] = reject; } - } else { - message += inspect(err); - } - var newErr = new AssertionError({ - actual: err, - expected: null, - operator: "ifError", - message, - stackStartFn: ifError - }); - var origStack = err.stack; - if (typeof origStack === "string") { - var tmp2 = origStack.split("\n"); - tmp2.shift(); - var tmp1 = newErr.stack.split("\n"); - for (var i = 0; i < tmp2.length; i++) { - var pos = tmp1.indexOf(tmp2[i]); - if (pos !== -1) { - tmp1 = tmp1.slice(0, pos); - break; - } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function(err) { + if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { + var reject = iterator[kLastReject]; + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); } - newErr.stack = "".concat(tmp1.join("\n"), "\n").concat(tmp2.join("\n")); + iterator[kError] = err; + return; } - throw newErr; - } + var resolve2 = iterator[kLastResolve]; + if (resolve2 !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve2(createIterResult(void 0, true)); + } + iterator[kEnded] = true; + }); + stream.on("readable", onReadable.bind(null, iterator)); + return iterator; }; - function strict() { - for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { - args[_key6] = arguments[_key6]; - } - innerOk.apply(void 0, [strict, args.length].concat(args)); - } - assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual - }); - assert.strict.strict = assert.strict; + module.exports = createReadableStreamAsyncIterator; } }); - // node_modules/browser-process/dist/node_process.js - var require_node_process = __commonJS({ - "node_modules/browser-process/dist/node_process.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/from-browser.js + var require_from_browser = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports.__extends || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - function __() { - this.constructor = d; - } - __.prototype = b.prototype; - d.prototype = new __(); + module.exports = function() { + throw new Error("Readable.from is not available in the browser"); }; - var eventemitter = require_node_eventemitter(); - var path = null; - var TTY = function(_super) { - __extends(TTY2, _super); - function TTY2() { - _super.call(this, true, true); - this.isRaw = false; - this.columns = 80; - this.rows = 120; - this.isTTY = true; - } - TTY2.prototype.setReadMode = function(mode) { - if (this.isRaw !== mode) { - this.isRaw = mode; - this.emit("modeChange"); - } - }; - TTY2.prototype.changeColumns = function(columns) { - if (columns !== this.columns) { - this.columns = columns; - this.emit("resize"); - } - }; - TTY2.prototype.changeRows = function(rows) { - if (rows !== this.rows) { - this.rows = rows; - this.emit("resize"); - } - }; - TTY2.isatty = function(fd) { - return fd instanceof TTY2; - }; - return TTY2; - }(eventemitter.AbstractDuplexStream); - exports.TTY = TTY; - var Process = function() { - function Process2() { - this.startTime = Date.now(); - this._cwd = "/"; - this.platform = "browser"; - this.argv = []; - this.stdout = new TTY(); - this.stderr = new TTY(); - this.stdin = new TTY(); - } - Process2.prototype.chdir = function(dir) { - if (path === null) { - path = require_assert(); - } - this._cwd = path.resolve(dir); - }; - Process2.prototype.cwd = function() { - return this._cwd; - }; - Process2.prototype.uptime = function() { - return (Date.now() - this.startTime) / 1e3 | 0; - }; - return Process2; - }(); - exports.Process = Process; - exports.process = new Process(); - module.exports = exports.process; } }); - // node_modules/crc-32/crc32.js - var require_crc32 = __commonJS({ - "node_modules/crc-32/crc32.js"(exports) { + // node_modules/readable-stream/lib/_stream_readable.js + var require_stream_readable = __commonJS({ + "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var CRC32; - (function(factory) { - if (typeof DO_NOT_EXPORT_CRC === "undefined") { - if (typeof exports === "object") { - factory(exports); - } else if (typeof define === "function" && define.amd) { - define(function() { - var module2 = {}; - factory(module2); - return module2; - }); - } else { - factory(CRC32 = {}); - } - } else { - factory(CRC32 = {}); - } - })(function(CRC322) { - CRC322.version = "1.2.0"; - function signed_crc_table() { - var c = 0, table = new Array(256); - for (var n = 0; n != 256; ++n) { - c = n; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - table[n] = c; - } - return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; + module.exports = Readable; + var Duplex; + Readable.ReadableState = ReadableState; + var EE = require_events().EventEmitter; + var EElistenerCount = function EElistenerCount2(emitter, type) { + return emitter.listeners(type).length; + }; + var Stream = require_stream_browser(); + var Buffer14 = require_buffer().Buffer; + var OurUint8Array = window.Uint8Array || function() { + }; + function _uint8ArrayToBuffer(chunk) { + return Buffer14.from(chunk); + } + function _isUint8Array(obj) { + return Buffer14.isBuffer(obj) || obj instanceof OurUint8Array; + } + var debugUtil = require_util(); + var debug; + if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog("stream"); + } else { + debug = function debug2() { + }; + } + var BufferList = require_buffer_list(); + var destroyImpl = require_destroy(); + var _require = require_state(); + var getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require_errors_browser().codes; + var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; + var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + var StringDecoder; + var createReadableStreamAsyncIterator; + var from; + require_inherits_browser()(Readable, Stream); + var errorOrDestroy = destroyImpl.errorOrDestroy; + var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; + function prependListener(emitter, event, fn) { + if (typeof emitter.prependListener === "function") + return emitter.prependListener(event, fn); + if (!emitter._events || !emitter._events[event]) + emitter.on(event, fn); + else if (Array.isArray(emitter._events[event])) + emitter._events[event].unshift(fn); + else + emitter._events[event] = [fn, emitter._events[event]]; + } + function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + if (typeof isDuplex !== "boolean") + isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex); + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + this.sync = true; + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + this.emitClose = options.emitClose !== false; + this.autoDestroy = !!options.autoDestroy; + this.destroyed = false; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.awaitDrain = 0; + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require_string_decoder().StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; } - var T = signed_crc_table(); - function crc32_bstr(bstr, seed) { - var C = seed ^ -1, L = bstr.length - 1; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; - } - if (i === L) - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255]; - return C ^ -1; + } + function Readable(options) { + Duplex = Duplex || require_stream_duplex(); + if (!(this instanceof Readable)) + return new Readable(options); + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + this.readable = true; + if (options) { + if (typeof options.read === "function") + this._read = options.read; + if (typeof options.destroy === "function") + this._destroy = options.destroy; } - function crc32_buf(buf2, seed) { - if (buf2.length > 1e4) - return crc32_buf_8(buf2, seed); - var C = seed ^ -1, L = buf2.length - 3; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + Stream.call(this); + } + Object.defineProperty(Readable.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._readableState === void 0) { + return false; } - while (i < L + 3) - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - return C ^ -1; + return this._readableState.destroyed; + }, + set: function set(value) { + if (!this._readableState) { + return; + } + this._readableState.destroyed = value; } - function crc32_buf_8(buf2, seed) { - var C = seed ^ -1, L = buf2.length - 7; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + }); + Readable.prototype.destroy = destroyImpl.destroy; + Readable.prototype._undestroy = destroyImpl.undestroy; + Readable.prototype._destroy = function(err, cb) { + cb(err); + }; + Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === "string") { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer14.from(chunk, encoding); + encoding = ""; + } + skipChunkCheck = true; } - while (i < L + 7) - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - return C ^ -1; + } else { + skipChunkCheck = true; } - function crc32_str(str, seed) { - var C = seed ^ -1; - for (var i = 0, L = str.length, c, d; i < L; ) { - c = str.charCodeAt(i++); - if (c < 128) { - C = C >>> 8 ^ T[(C ^ c) & 255]; - } else if (c < 2048) { - C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; - } else if (c >= 55296 && c < 57344) { - c = (c & 1023) + 64; - d = str.charCodeAt(i++) & 1023; - C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255]; + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); + }; + Readable.prototype.unshift = function(chunk) { + return readableAddChunk(this, chunk, null, true, false); + }; + function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug("readableAddChunk", chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) + er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer14.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) + errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); + else + addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; } else { - C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) + addChunk(stream, state, chunk, false); + else + maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); } - return C ^ -1; } - CRC322.table = T; - CRC322.bstr = crc32_bstr; - CRC322.buf = crc32_buf; - CRC322.str = crc32_str; - }); - } - }); - - // node_modules/readable-stream/lib/internal/streams/stream-browser.js - var require_stream_browser = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = require_events().EventEmitter; - } - }); - - // (disabled):node_modules/util/util.js - var require_util2 = __commonJS({ - "(disabled):node_modules/util/util.js"() { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - } - }); - - // node_modules/readable-stream/lib/internal/streams/buffer_list.js - var require_buffer_list = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) - symbols = symbols.filter(function(sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); + return !state.ended && (state.length < state.highWaterMark || state.length === 0); + } + function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit("data", chunk); + } else { + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + if (state.needReadable) + emitReadable(stream); } - return keys; + maybeReadMore(stream, state); } - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - if (i % 2) { - ownKeys(Object(source), true).forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function(key2) { - Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); - }); - } + function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); } - return target; + return er; } - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); + Readable.prototype.isPaused = function() { + return this._readableState.flowing === false; + }; + Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require_string_decoder().StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + this._readableState.encoding = this._readableState.decoder.encoding; + var p = this._readableState.buffer.head; + var content = ""; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== "") + this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; + }; + var MAX_HWM = 1073741824; + function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; } else { - obj[key2] = value; + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; } - return obj; + return n; } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) + return 0; + if (state.objectMode) + return 1; + if (n !== n) { + if (state.flowing && state.length) + return state.buffer.head.data.length; + else + return state.length; + } + if (n > state.highWaterMark) + state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) + return n; + if (!state.ended) { + state.needReadable = true; + return 0; } + return state.length; } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - var _require = require_buffer(); - var Buffer18 = _require.Buffer; - var _require2 = require_util2(); - var inspect = _require2.inspect; - var custom = inspect && inspect.custom || "inspect"; - function copyBuffer(src, target, offset) { - Buffer18.prototype.copy.call(src, target, offset); - } - module.exports = /* @__PURE__ */ function() { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; - } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) - this.tail.next = entry; - else - this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) - this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - if (this.length === 0) - return; - var ret = this.head.data; - if (this.length === 1) - this.head = this.tail = null; - else - this.head = this.head.next; - --this.length; - return ret; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) - return ""; - var p = this.head; - var ret = "" + p.data; - while (p = p.next) { - ret += s + p.data; - } - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) - return Buffer18.alloc(0); - var ret = Buffer18.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - } - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; - if (n < this.head.data.length) { - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - ret = this.shift(); - } else { - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) - ret += str; - else - ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) - this.head = p.next; - else - this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer18.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf2 = p.data; - var nb = n > buf2.length ? buf2.length : n; - buf2.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf2.length) { - ++c; - if (p.next) - this.head = p.next; - else - this.head = this.tail = null; - } else { - this.head = p; - p.data = buf2.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread({}, options, { - depth: 0, - customInspect: false - })); - } - }]); - return BufferList; - }(); - } - }); - - // node_modules/readable-stream/lib/internal/streams/destroy.js - var require_destroy = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function destroy(err, cb) { - var _this = this; - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } - return this; - } - if (this._readableState) { - this._readableState.destroyed = true; - } - if (this._writableState) { - this._writableState.destroyed = true; - } - this._destroy(err || null, function(err2) { - if (!cb && err2) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err2); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err2); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err2); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - return this; - } - function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); - } - function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) - return; - if (self._readableState && !self._readableState.emitClose) - return; - self.emit("close"); - } - function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } - } - function emitErrorNT(self, err) { - self.emit("error", err); - } - function errorOrDestroy(stream, err) { - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) - stream.destroy(err); - else - stream.emit("error", err); - } - module.exports = { - destroy, - undestroy, - errorOrDestroy - }; - } - }); - - // node_modules/readable-stream/errors-browser.js - var require_errors_browser = __commonJS({ - "node_modules/readable-stream/errors-browser.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; - } - var codes = {}; - function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - function getMessage(arg1, arg2, arg3) { - if (typeof message === "string") { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - var NodeError = /* @__PURE__ */ function(_Base) { - _inheritsLoose(NodeError2, _Base); - function NodeError2(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; - } - return NodeError2; - }(Base); - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; - } - function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function(i) { - return String(i); - }); - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } - } - function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; - } - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; - } - return str.substring(this_len - search.length, this_len) === search; - } - function includes(str, search, start) { - if (typeof start !== "number") { - start = 0; - } - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } - } - createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; - }, TypeError); - createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { - var determiner; - if (typeof expected === "string" && startsWith(expected, "not ")) { - determiner = "must not be"; - expected = expected.replace(/^not /, ""); - } else { - determiner = "must be"; - } - var msg; - if (endsWith(name, " argument")) { - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } else { - var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } - msg += ". Received type ".concat(typeof actual); - return msg; - }, TypeError); - createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); - createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { - return "The " + name + " method is not implemented"; - }); - createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); - createErrorType("ERR_STREAM_DESTROYED", function(name) { - return "Cannot call " + name + " after a stream was destroyed"; - }); - createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); - createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); - createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); - createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); - createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { - return "Unknown encoding: " + arg; - }, TypeError); - createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); - module.exports.codes = codes; - } - }); - - // node_modules/readable-stream/lib/internal/streams/state.js - var require_state = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE; - function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; - } - function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : "highWaterMark"; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - return Math.floor(hwm); - } - return state.objectMode ? 16 : 16 * 1024; - } - module.exports = { - getHighWaterMark - }; - } - }); - - // node_modules/util-deprecate/browser.js - var require_browser = __commonJS({ - "node_modules/util-deprecate/browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = deprecate; - function deprecate(fn, msg) { - if (config("noDeprecation")) { - return fn; - } - var warned = false; - function deprecated() { - if (!warned) { - if (config("throwDeprecation")) { - throw new Error(msg); - } else if (config("traceDeprecation")) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - return deprecated; - } - function config(name) { - try { - if (!window.localStorage) - return false; - } catch (_) { - return false; - } - var val = window.localStorage[name]; - if (val == null) - return false; - return String(val).toLowerCase() === "true"; - } - } - }); - - // node_modules/readable-stream/lib/_stream_writable.js - var require_stream_writable = __commonJS({ - "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Writable; - function CorkedRequest(state) { - var _this = this; - this.next = null; - this.entry = null; - this.finish = function() { - onCorkedFinish(_this, state); - }; - } - var Duplex; - Writable.WritableState = WritableState; - var internalUtil = { - deprecate: require_browser() - }; - var Stream = require_stream_browser(); - var Buffer18 = require_buffer().Buffer; - var OurUint8Array = window.Uint8Array || function() { - }; - function _uint8ArrayToBuffer(chunk) { - return Buffer18.from(chunk); - } - function _isUint8Array(obj) { - return Buffer18.isBuffer(obj) || obj instanceof OurUint8Array; - } - var destroyImpl = require_destroy(); - var _require = require_state(); - var getHighWaterMark = _require.getHighWaterMark; - var _require$codes = require_errors_browser().codes; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; - var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE; - var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES; - var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END; - var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - var errorOrDestroy = destroyImpl.errorOrDestroy; - require_inherits_browser()(Writable, Stream); - function nop() { - } - function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require_stream_duplex(); - options = options || {}; - if (typeof isDuplex !== "boolean") - isDuplex = stream instanceof Duplex; - this.objectMode = !!options.objectMode; - if (isDuplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; - this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex); - this.finalCalled = false; - this.needDrain = false; - this.ending = false; - this.ended = false; - this.finished = false; - this.destroyed = false; - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - this.defaultEncoding = options.defaultEncoding || "utf8"; - this.length = 0; - this.writing = false; - this.corked = 0; - this.sync = true; - this.bufferProcessing = false; - this.onwrite = function(er) { - onwrite(stream, er); - }; - this.writecb = null; - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; - this.pendingcb = 0; - this.prefinished = false; - this.errorEmitted = false; - this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; - this.bufferedRequestCount = 0; - this.corkedRequestsFree = new CorkedRequest(this); - } - WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; - }; - (function() { - try { - Object.defineProperty(WritableState.prototype, "buffer", { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") - }); - } catch (_) { - } - })(); - var realHasInstance; - if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) - return true; - if (this !== Writable) - return false; - return object && object._writableState instanceof WritableState; - } - }); - } else { - realHasInstance = function realHasInstance2(object) { - return object instanceof this; - }; - } - function Writable(options) { - Duplex = Duplex || require_stream_duplex(); - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) - return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); - this.writable = true; - if (options) { - if (typeof options.write === "function") - this._write = options.write; - if (typeof options.writev === "function") - this._writev = options.writev; - if (typeof options.destroy === "function") - this._destroy = options.destroy; - if (typeof options.final === "function") - this._final = options.final; - } - Stream.call(this); - } - Writable.prototype.pipe = function() { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); - }; - function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); - errorOrDestroy(stream, er); - process.nextTick(cb, er); - } - function validChunk(stream, state, chunk, cb) { - var er; - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== "string" && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); - } - if (er) { - errorOrDestroy(stream, er); - process.nextTick(cb, er); - return false; - } - return true; - } - Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer18.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (typeof encoding === "function") { - cb = encoding; - encoding = null; - } - if (isBuf) - encoding = "buffer"; - else if (!encoding) - encoding = state.defaultEncoding; - if (typeof cb !== "function") - cb = nop; - if (state.ending) - writeAfterEnd(this, cb); - else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; - }; - Writable.prototype.cork = function() { - this._writableState.corked++; - }; - Writable.prototype.uncork = function() { - var state = this._writableState; - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) - clearBuffer(this, state); - } - }; - Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - if (typeof encoding === "string") - encoding = encoding.toLowerCase(); - if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) - throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; - }; - Object.defineProperty(Writable.prototype, "writableBuffer", { - enumerable: false, - get: function get2() { - return this._writableState && this._writableState.getBuffer(); - } - }); - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { - chunk = Buffer18.from(chunk, encoding); - } - return chunk; - } - Object.defineProperty(Writable.prototype, "writableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._writableState.highWaterMark; - } - }); - function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = "buffer"; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; - if (!ret) - state.needDrain = true; - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk, - encoding, - isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - return ret; - } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) - state.onwrite(new ERR_STREAM_DESTROYED("write")); - else if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; - } - function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) { - process.nextTick(cb, er); - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - finishMaybe(stream, state); - } - } - function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; - } - function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== "function") - throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) - onwriteError(stream, state, sync, er, cb); - else { - var finished = needFinish(state) || stream.destroyed; - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); - } - } - } - function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); - } - function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit("drain"); - } - } - function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - if (stream._writev && entry && entry.next) { - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) - allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, "", holder.finish); - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - if (state.writing) { - break; - } - } - if (entry === null) - state.lastBufferedRequest = null; - } - state.bufferedRequest = entry; - state.bufferProcessing = false; - } - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); - }; - Writable.prototype._writev = null; - Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - if (typeof chunk === "function") { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === "function") { - cb = encoding; - encoding = null; - } - if (chunk !== null && chunk !== void 0) - this.write(chunk, encoding); - if (state.corked) { - state.corked = 1; - this.uncork(); - } - if (!state.ending) - endWritable(this, state, cb); - return this; - }; - Object.defineProperty(Writable.prototype, "writableLength", { - enumerable: false, - get: function get2() { - return this._writableState.length; - } - }); - function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; - } - function callFinal(stream, state) { - stream._final(function(err) { - state.pendingcb--; - if (err) { - errorOrDestroy(stream, err); - } - state.prefinished = true; - stream.emit("prefinish"); - finishMaybe(stream, state); - }); - } - function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === "function" && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit("prefinish"); - } - } - } - function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit("finish"); - if (state.autoDestroy) { - var rState = stream._readableState; - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } - } - return need; - } - function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once("finish", cb); - } - state.ended = true; - stream.writable = false; - } - function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - state.corkedRequestsFree.next = corkReq; - } - Object.defineProperty(Writable.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._writableState === void 0) { - return false; - } - return this._writableState.destroyed; - }, - set: function set(value) { - if (!this._writableState) { - return; - } - this._writableState.destroyed = value; - } - }); - Writable.prototype.destroy = destroyImpl.destroy; - Writable.prototype._undestroy = destroyImpl.undestroy; - Writable.prototype._destroy = function(err, cb) { - cb(err); - }; - } - }); - - // node_modules/readable-stream/lib/_stream_duplex.js - var require_stream_duplex = __commonJS({ - "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var objectKeys = Object.keys || function(obj) { - var keys2 = []; - for (var key2 in obj) { - keys2.push(key2); - } - return keys2; - }; - module.exports = Duplex; - var Readable = require_stream_readable(); - var Writable = require_stream_writable(); - require_inherits_browser()(Duplex, Readable); - { - keys = objectKeys(Writable.prototype); - for (v = 0; v < keys.length; v++) { - method = keys[v]; - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; - } - } - var keys; - var method; - var v; - function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - if (options) { - if (options.readable === false) - this.readable = false; - if (options.writable === false) - this.writable = false; - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once("end", onend); - } - } - } - Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._writableState.highWaterMark; - } - }); - Object.defineProperty(Duplex.prototype, "writableBuffer", { - enumerable: false, - get: function get2() { - return this._writableState && this._writableState.getBuffer(); - } - }); - Object.defineProperty(Duplex.prototype, "writableLength", { - enumerable: false, - get: function get2() { - return this._writableState.length; - } - }); - function onend() { - if (this._writableState.ended) - return; - process.nextTick(onEndNT, this); - } - function onEndNT(self) { - self.end(); - } - Object.defineProperty(Duplex.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._readableState === void 0 || this._writableState === void 0) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - if (this._readableState === void 0 || this._writableState === void 0) { - return; - } - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } - }); - } - }); - - // node_modules/safe-buffer/index.js - var require_safe_buffer = __commonJS({ - "node_modules/safe-buffer/index.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var buffer = require_buffer(); - var Buffer18 = buffer.Buffer; - function copyProps(src, dst) { - for (var key2 in src) { - dst[key2] = src[key2]; - } - } - if (Buffer18.from && Buffer18.alloc && Buffer18.allocUnsafe && Buffer18.allocUnsafeSlow) { - module.exports = buffer; - } else { - copyProps(buffer, exports); - exports.Buffer = SafeBuffer; - } - function SafeBuffer(arg, encodingOrOffset, length) { - return Buffer18(arg, encodingOrOffset, length); - } - SafeBuffer.prototype = Object.create(Buffer18.prototype); - copyProps(Buffer18, SafeBuffer); - SafeBuffer.from = function(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - throw new TypeError("Argument must not be a number"); - } - return Buffer18(arg, encodingOrOffset, length); - }; - SafeBuffer.alloc = function(size, fill, encoding) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - var buf2 = Buffer18(size); - if (fill !== void 0) { - if (typeof encoding === "string") { - buf2.fill(fill, encoding); - } else { - buf2.fill(fill); - } - } else { - buf2.fill(0); - } - return buf2; - }; - SafeBuffer.allocUnsafe = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return Buffer18(size); - }; - SafeBuffer.allocUnsafeSlow = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return buffer.SlowBuffer(size); - }; - } - }); - - // node_modules/string_decoder/lib/string_decoder.js - var require_string_decoder = __commonJS({ - "node_modules/string_decoder/lib/string_decoder.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var Buffer18 = require_safe_buffer().Buffer; - var isEncoding = Buffer18.isEncoding || function(encoding) { - encoding = "" + encoding; - switch (encoding && encoding.toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - case "raw": - return true; - default: - return false; - } - }; - function _normalizeEncoding(enc) { - if (!enc) - return "utf8"; - var retried; - while (true) { - switch (enc) { - case "utf8": - case "utf-8": - return "utf8"; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return "utf16le"; - case "latin1": - case "binary": - return "latin1"; - case "base64": - case "ascii": - case "hex": - return enc; - default: - if (retried) - return; - enc = ("" + enc).toLowerCase(); - retried = true; - } - } - } - function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== "string" && (Buffer18.isEncoding === isEncoding || !isEncoding(enc))) - throw new Error("Unknown encoding: " + enc); - return nenc || enc; - } - exports.StringDecoder = StringDecoder; - function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case "utf16le": - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case "utf8": - this.fillLast = utf8FillLast; - nb = 4; - break; - case "base64": - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer18.allocUnsafe(nb); - } - StringDecoder.prototype.write = function(buf2) { - if (buf2.length === 0) - return ""; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf2); - if (r === void 0) - return ""; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf2.length) - return r ? r + this.text(buf2, i) : this.text(buf2, i); - return r || ""; - }; - StringDecoder.prototype.end = utf8End; - StringDecoder.prototype.text = utf8Text; - StringDecoder.prototype.fillLast = function(buf2) { - if (this.lastNeed <= buf2.length) { - buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length); - this.lastNeed -= buf2.length; - }; - function utf8CheckByte(byte) { - if (byte <= 127) - return 0; - else if (byte >> 5 === 6) - return 2; - else if (byte >> 4 === 14) - return 3; - else if (byte >> 3 === 30) - return 4; - return byte >> 6 === 2 ? -1 : -2; - } - function utf8CheckIncomplete(self, buf2, i) { - var j = buf2.length - 1; - if (j < i) - return 0; - var nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) - self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) - return 0; - nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) - self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) - return 0; - nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) - nb = 0; - else - self.lastNeed = nb - 3; - } - return nb; - } - return 0; - } - function utf8CheckExtraBytes(self, buf2, p) { - if ((buf2[0] & 192) !== 128) { - self.lastNeed = 0; - return "\uFFFD"; - } - if (self.lastNeed > 1 && buf2.length > 1) { - if ((buf2[1] & 192) !== 128) { - self.lastNeed = 1; - return "\uFFFD"; - } - if (self.lastNeed > 2 && buf2.length > 2) { - if ((buf2[2] & 192) !== 128) { - self.lastNeed = 2; - return "\uFFFD"; - } - } - } - } - function utf8FillLast(buf2) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf2, p); - if (r !== void 0) - return r; - if (this.lastNeed <= buf2.length) { - buf2.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf2.copy(this.lastChar, p, 0, buf2.length); - this.lastNeed -= buf2.length; - } - function utf8Text(buf2, i) { - var total = utf8CheckIncomplete(this, buf2, i); - if (!this.lastNeed) - return buf2.toString("utf8", i); - this.lastTotal = total; - var end = buf2.length - (total - this.lastNeed); - buf2.copy(this.lastChar, 0, end); - return buf2.toString("utf8", i, end); - } - function utf8End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) - return r + "\uFFFD"; - return r; - } - function utf16Text(buf2, i) { - if ((buf2.length - i) % 2 === 0) { - var r = buf2.toString("utf16le", i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 55296 && c <= 56319) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf2[buf2.length - 2]; - this.lastChar[1] = buf2[buf2.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf2[buf2.length - 1]; - return buf2.toString("utf16le", i, buf2.length - 1); - } - function utf16End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString("utf16le", 0, end); - } - return r; - } - function base64Text(buf2, i) { - var n = (buf2.length - i) % 3; - if (n === 0) - return buf2.toString("base64", i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf2[buf2.length - 1]; - } else { - this.lastChar[0] = buf2[buf2.length - 2]; - this.lastChar[1] = buf2[buf2.length - 1]; - } - return buf2.toString("base64", i, buf2.length - n); - } - function base64End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) - return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); - return r; - } - function simpleWrite(buf2) { - return buf2.toString(this.encoding); - } - function simpleEnd(buf2) { - return buf2 && buf2.length ? this.write(buf2) : ""; - } - } - }); - - // node_modules/readable-stream/lib/internal/streams/end-of-stream.js - var require_end_of_stream = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE; - function once(callback) { - var called = false; - return function() { - if (called) - return; - called = true; - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - callback.apply(this, args); - }; - } - function noop3() { - } - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === "function"; - } - function eos(stream, opts, callback) { - if (typeof opts === "function") - return eos(stream, null, opts); - if (!opts) - opts = {}; - callback = once(callback || noop3); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable2 = opts.writable || opts.writable !== false && stream.writable; - var onlegacyfinish = function onlegacyfinish2() { - if (!stream.writable) - onfinish(); - }; - var writableEnded = stream._writableState && stream._writableState.finished; - var onfinish = function onfinish2() { - writable2 = false; - writableEnded = true; - if (!readable) - callback.call(stream); - }; - var readableEnded = stream._readableState && stream._readableState.endEmitted; - var onend = function onend2() { - readable = false; - readableEnded = true; - if (!writable2) - callback.call(stream); - }; - var onerror = function onerror2(err) { - callback.call(stream, err); - }; - var onclose = function onclose2() { - var err; - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) - err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - if (writable2 && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) - err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - }; - var onrequest = function onrequest2() { - stream.req.on("finish", onfinish); - }; - if (isRequest(stream)) { - stream.on("complete", onfinish); - stream.on("abort", onclose); - if (stream.req) - onrequest(); - else - stream.on("request", onrequest); - } else if (writable2 && !stream._writableState) { - stream.on("end", onlegacyfinish); - stream.on("close", onlegacyfinish); - } - stream.on("end", onend); - stream.on("finish", onfinish); - if (opts.error !== false) - stream.on("error", onerror); - stream.on("close", onclose); - return function() { - stream.removeListener("complete", onfinish); - stream.removeListener("abort", onclose); - stream.removeListener("request", onrequest); - if (stream.req) - stream.req.removeListener("finish", onfinish); - stream.removeListener("end", onlegacyfinish); - stream.removeListener("close", onlegacyfinish); - stream.removeListener("finish", onfinish); - stream.removeListener("end", onend); - stream.removeListener("error", onerror); - stream.removeListener("close", onclose); - }; - } - module.exports = eos; - } - }); - - // node_modules/readable-stream/lib/internal/streams/async_iterator.js - var require_async_iterator = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var _Object$setPrototypeO; - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; - } - var finished = require_end_of_stream(); - var kLastResolve = Symbol("lastResolve"); - var kLastReject = Symbol("lastReject"); - var kError = Symbol("error"); - var kEnded = Symbol("ended"); - var kLastPromise = Symbol("lastPromise"); - var kHandlePromise = Symbol("handlePromise"); - var kStream = Symbol("stream"); - function createIterResult(value, done) { - return { - value, - done - }; - } - function readAndResolve(iter) { - var resolve2 = iter[kLastResolve]; - if (resolve2 !== null) { - var data = iter[kStream].read(); - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve2(createIterResult(data, false)); - } - } - } - function onReadable(iter) { - process.nextTick(readAndResolve, iter); - } - function wrapForNext(lastPromise, iter) { - return function(resolve2, reject) { - lastPromise.then(function() { - if (iter[kEnded]) { - resolve2(createIterResult(void 0, true)); - return; - } - iter[kHandlePromise](resolve2, reject); - }, reject); - }; - } - var AsyncIteratorPrototype = Object.getPrototypeOf(function() { - }); - var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - next: function next() { - var _this = this; - var error = this[kError]; - if (error !== null) { - return Promise.reject(error); - } - if (this[kEnded]) { - return Promise.resolve(createIterResult(void 0, true)); - } - if (this[kStream].destroyed) { - return new Promise(function(resolve2, reject) { - process.nextTick(function() { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve2(createIterResult(void 0, true)); - } - }); - }); - } - var lastPromise = this[kLastPromise]; - var promise2; - if (lastPromise) { - promise2 = new Promise(wrapForNext(lastPromise, this)); - } else { - var data = this[kStream].read(); - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - promise2 = new Promise(this[kHandlePromise]); - } - this[kLastPromise] = promise2; - return promise2; - } - }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { - return this; - }), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - return new Promise(function(resolve2, reject) { - _this2[kStream].destroy(null, function(err) { - if (err) { - reject(err); - return; - } - resolve2(createIterResult(void 0, true)); - }); - }); - }), _Object$setPrototypeO), AsyncIteratorPrototype); - var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { - var _Object$create; - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve2, reject) { - var data = iterator[kStream].read(); - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve2(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve2; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function(err) { - if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { - var reject = iterator[kLastReject]; - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - iterator[kError] = err; - return; - } - var resolve2 = iterator[kLastResolve]; - if (resolve2 !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve2(createIterResult(void 0, true)); - } - iterator[kEnded] = true; - }); - stream.on("readable", onReadable.bind(null, iterator)); - return iterator; - }; - module.exports = createReadableStreamAsyncIterator; - } - }); - - // node_modules/readable-stream/lib/internal/streams/from-browser.js - var require_from_browser = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function() { - throw new Error("Readable.from is not available in the browser"); - }; - } - }); - - // node_modules/readable-stream/lib/_stream_readable.js - var require_stream_readable = __commonJS({ - "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Readable; - var Duplex; - Readable.ReadableState = ReadableState; - var EE = require_events().EventEmitter; - var EElistenerCount = function EElistenerCount2(emitter, type) { - return emitter.listeners(type).length; - }; - var Stream = require_stream_browser(); - var Buffer18 = require_buffer().Buffer; - var OurUint8Array = window.Uint8Array || function() { - }; - function _uint8ArrayToBuffer(chunk) { - return Buffer18.from(chunk); - } - function _isUint8Array(obj) { - return Buffer18.isBuffer(obj) || obj instanceof OurUint8Array; - } - var debugUtil = require_util2(); - var debug; - if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog("stream"); - } else { - debug = function debug2() { - }; - } - var BufferList = require_buffer_list(); - var destroyImpl = require_destroy(); - var _require = require_state(); - var getHighWaterMark = _require.getHighWaterMark; - var _require$codes = require_errors_browser().codes; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; - var StringDecoder; - var createReadableStreamAsyncIterator; - var from; - require_inherits_browser()(Readable, Stream); - var errorOrDestroy = destroyImpl.errorOrDestroy; - var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; - function prependListener(emitter, event, fn) { - if (typeof emitter.prependListener === "function") - return emitter.prependListener(event, fn); - if (!emitter._events || !emitter._events[event]) - emitter.on(event, fn); - else if (Array.isArray(emitter._events[event])) - emitter._events[event].unshift(fn); - else - emitter._events[event] = [fn, emitter._events[event]]; - } - function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require_stream_duplex(); - options = options || {}; - if (typeof isDuplex !== "boolean") - isDuplex = stream instanceof Duplex; - this.objectMode = !!options.objectMode; - if (isDuplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex); - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - this.sync = true; - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; - this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; - this.destroyed = false; - this.defaultEncoding = options.defaultEncoding || "utf8"; - this.awaitDrain = 0; - this.readingMore = false; - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require_string_decoder().StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } - } - function Readable(options) { - Duplex = Duplex || require_stream_duplex(); - if (!(this instanceof Readable)) - return new Readable(options); - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); - this.readable = true; - if (options) { - if (typeof options.read === "function") - this._read = options.read; - if (typeof options.destroy === "function") - this._destroy = options.destroy; - } - Stream.call(this); - } - Object.defineProperty(Readable.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._readableState === void 0) { - return false; - } - return this._readableState.destroyed; - }, - set: function set(value) { - if (!this._readableState) { - return; - } - this._readableState.destroyed = value; - } - }); - Readable.prototype.destroy = destroyImpl.destroy; - Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function(err, cb) { - cb(err); - }; - Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - if (!state.objectMode) { - if (typeof chunk === "string") { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer18.from(chunk, encoding); - encoding = ""; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); - }; - Readable.prototype.unshift = function(chunk) { - return readableAddChunk(this, chunk, null, true, false); - }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug("readableAddChunk", chunk); - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) - er = chunkInvalid(state, chunk); - if (er) { - errorOrDestroy(stream, er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer18.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (addToFront) { - if (state.endEmitted) - errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); - else - addChunk(stream, state, chunk, true); - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) - addChunk(stream, state, chunk, false); - else - maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } - return !state.ended && (state.length < state.highWaterMark || state.length === 0); - } - function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit("data", chunk); - } else { - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - if (state.needReadable) - emitReadable(stream); - } - maybeReadMore(stream, state); - } - function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); - } - return er; - } - Readable.prototype.isPaused = function() { - return this._readableState.flowing === false; - }; - Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require_string_decoder().StringDecoder; - var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; - this._readableState.encoding = this._readableState.decoder.encoding; - var p = this._readableState.buffer.head; - var content = ""; - while (p !== null) { - content += decoder.write(p.data); - p = p.next; - } - this._readableState.buffer.clear(); - if (content !== "") - this._readableState.buffer.push(content); - this._readableState.length = content.length; - return this; - }; - var MAX_HWM = 1073741824; - function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; - } - function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) - return 0; - if (state.objectMode) - return 1; - if (n !== n) { - if (state.flowing && state.length) - return state.buffer.head.data.length; - else - return state.length; - } - if (n > state.highWaterMark) - state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) - return n; - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; - } - Readable.prototype.read = function(n) { - debug("read", n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) - state.emittedReadable = false; - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug("read: emitReadable", state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - n = howMuchToRead(n, state); - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - var doRead = state.needReadable; - debug("need readable", doRead); - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug("length less than watermark", doRead); - } - if (state.ended || state.reading) { - doRead = false; - debug("reading or ended", doRead); - } else if (doRead) { - debug("do read"); - state.reading = true; - state.sync = true; - if (state.length === 0) - state.needReadable = true; - this._read(state.highWaterMark); - state.sync = false; - if (!state.reading) - n = howMuchToRead(nOrig, state); - } - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - if (state.length === 0) { - if (!state.ended) - state.needReadable = true; - if (nOrig !== n && state.ended) - endReadable(this); - } - if (ret !== null) - this.emit("data", ret); - return ret; - }; - function onEofChunk(stream, state) { - debug("onEofChunk"); - if (state.ended) - return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - if (state.sync) { - emitReadable(stream); - } else { - state.needReadable = false; - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } - } - function emitReadable(stream) { - var state = stream._readableState; - debug("emitReadable", state.needReadable, state.emittedReadable); - state.needReadable = false; - if (!state.emittedReadable) { - debug("emitReadable", state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } - } - function emitReadable_(stream) { - var state = stream._readableState; - debug("emitReadable_", state.destroyed, state.length, state.ended); - if (!state.destroyed && (state.length || state.ended)) { - stream.emit("readable"); - state.emittedReadable = false; - } - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); - } - function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } - } - function maybeReadMore_(stream, state) { - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug("maybeReadMore read 0"); - stream.read(0); - if (len === state.length) - break; - } - state.readingMore = false; - } - Readable.prototype._read = function(n) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); - }; - Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once("end", endFn); - dest.on("unpipe", onunpipe); - function onunpipe(readable, unpipeInfo) { - debug("onunpipe"); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - function onend() { - debug("onend"); - dest.end(); - } - var ondrain = pipeOnDrain(src); - dest.on("drain", ondrain); - var cleanedUp = false; - function cleanup() { - debug("cleanup"); - dest.removeListener("close", onclose); - dest.removeListener("finish", onfinish); - dest.removeListener("drain", ondrain); - dest.removeListener("error", onerror); - dest.removeListener("unpipe", onunpipe); - src.removeListener("end", onend); - src.removeListener("end", unpipe); - src.removeListener("data", ondata); - cleanedUp = true; - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - src.on("data", ondata); - function ondata(chunk) { - debug("ondata"); - var ret = dest.write(chunk); - debug("dest.write", ret); - if (ret === false) { - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug("false write response, pause", state.awaitDrain); - state.awaitDrain++; - } - src.pause(); - } - } - function onerror(er) { - debug("onerror", er); - unpipe(); - dest.removeListener("error", onerror); - if (EElistenerCount(dest, "error") === 0) - errorOrDestroy(dest, er); - } - prependListener(dest, "error", onerror); - function onclose() { - dest.removeListener("finish", onfinish); - unpipe(); - } - dest.once("close", onclose); - function onfinish() { - debug("onfinish"); - dest.removeListener("close", onclose); - unpipe(); - } - dest.once("finish", onfinish); - function unpipe() { - debug("unpipe"); - src.unpipe(dest); - } - dest.emit("pipe", src); - if (!state.flowing) { - debug("pipe resume"); - src.resume(); - } - return dest; - }; - function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug("pipeOnDrain", state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { - state.flowing = true; - flow(src); - } - }; - } - Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; - if (state.pipesCount === 0) - return this; - if (state.pipesCount === 1) { - if (dest && dest !== state.pipes) - return this; - if (!dest) - dest = state.pipes; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit("unpipe", this, unpipeInfo); - return this; - } - if (!dest) { - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - for (var i = 0; i < len; i++) { - dests[i].emit("unpipe", this, { - hasUnpiped: false - }); - } - return this; - } - var index = indexOf(state.pipes, dest); - if (index === -1) - return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - dest.emit("unpipe", this, unpipeInfo); - return this; - }; - Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; - if (ev === "data") { - state.readableListening = this.listenerCount("readable") > 0; - if (state.flowing !== false) - this.resume(); - } else if (ev === "readable") { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug("on readable", state.length, state.reading); - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } - return res; - }; - Readable.prototype.addListener = Readable.prototype.on; - Readable.prototype.removeListener = function(ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - if (ev === "readable") { - process.nextTick(updateReadableListening, this); - } - return res; - }; - Readable.prototype.removeAllListeners = function(ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - if (ev === "readable" || ev === void 0) { - process.nextTick(updateReadableListening, this); - } - return res; - }; - function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount("readable") > 0; - if (state.resumeScheduled && !state.paused) { - state.flowing = true; - } else if (self.listenerCount("data") > 0) { - self.resume(); - } - } - function nReadingNextTick(self) { - debug("readable nexttick read 0"); - self.read(0); - } - Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug("resume"); - state.flowing = !state.readableListening; - resume(this, state); - } - state.paused = false; - return this; - }; - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } - } - function resume_(stream, state) { - debug("resume", state.reading); - if (!state.reading) { - stream.read(0); - } - state.resumeScheduled = false; - stream.emit("resume"); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); - } - Readable.prototype.pause = function() { - debug("call pause flowing=%j", this._readableState.flowing); - if (this._readableState.flowing !== false) { - debug("pause"); - this._readableState.flowing = false; - this.emit("pause"); - } - this._readableState.paused = true; - return this; - }; - function flow(stream) { - var state = stream._readableState; - debug("flow", state.flowing); - while (state.flowing && stream.read() !== null) { - ; - } - } - Readable.prototype.wrap = function(stream) { - var _this = this; - var state = this._readableState; - var paused = false; - stream.on("end", function() { - debug("wrapped end"); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - _this.push(chunk); - } - _this.push(null); - }); - stream.on("data", function(chunk) { - debug("wrapped data"); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (state.objectMode && (chunk === null || chunk === void 0)) - return; - else if (!state.objectMode && (!chunk || !chunk.length)) - return; - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - for (var i in stream) { - if (this[i] === void 0 && typeof stream[i] === "function") { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - this._read = function(n2) { - debug("wrapped _read", n2); - if (paused) { - paused = false; - stream.resume(); - } - }; - return this; - }; - if (typeof Symbol === "function") { - Readable.prototype[Symbol.asyncIterator] = function() { - if (createReadableStreamAsyncIterator === void 0) { - createReadableStreamAsyncIterator = require_async_iterator(); - } - return createReadableStreamAsyncIterator(this); - }; - } - Object.defineProperty(Readable.prototype, "readableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._readableState.highWaterMark; - } - }); - Object.defineProperty(Readable.prototype, "readableBuffer", { - enumerable: false, - get: function get2() { - return this._readableState && this._readableState.buffer; - } - }); - Object.defineProperty(Readable.prototype, "readableFlowing", { - enumerable: false, - get: function get2() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } - }); - Readable._fromList = fromList; - Object.defineProperty(Readable.prototype, "readableLength", { - enumerable: false, - get: function get2() { - return this._readableState.length; - } - }); - function fromList(n, state) { - if (state.length === 0) - return null; - var ret; - if (state.objectMode) - ret = state.buffer.shift(); - else if (!n || n >= state.length) { - if (state.decoder) - ret = state.buffer.join(""); - else if (state.buffer.length === 1) - ret = state.buffer.first(); - else - ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - ret = state.buffer.consume(n, state.decoder); - } - return ret; - } - function endReadable(stream) { - var state = stream._readableState; - debug("endReadable", state.endEmitted); - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } - } - function endReadableNT(state, stream) { - debug("endReadableNT", state.endEmitted, state.length); - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit("end"); - if (state.autoDestroy) { - var wState = stream._writableState; - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); - } - } - } - } - if (typeof Symbol === "function") { - Readable.from = function(iterable, opts) { - if (from === void 0) { - from = require_from_browser(); - } - return from(Readable, iterable, opts); - }; - } - function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) - return i; - } - return -1; - } - } - }); - - // node_modules/readable-stream/lib/_stream_transform.js - var require_stream_transform = __commonJS({ - "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Transform; - var _require$codes = require_errors_browser().codes; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; - var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING; - var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - var Duplex = require_stream_duplex(); - require_inherits_browser()(Transform, Duplex); - function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - if (cb === null) { - return this.emit("error", new ERR_MULTIPLE_CALLBACK()); - } - ts.writechunk = null; - ts.writecb = null; - if (data != null) - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } - } - function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - this._readableState.needReadable = true; - this._readableState.sync = false; - if (options) { - if (typeof options.transform === "function") - this._transform = options.transform; - if (typeof options.flush === "function") - this._flush = options.flush; - } - this.on("prefinish", prefinish); - } - function prefinish() { - var _this = this; - if (typeof this._flush === "function" && !this._readableState.destroyed) { - this._flush(function(er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } - } - Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); - }; - Transform.prototype._transform = function(chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); - }; - Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } - }; - Transform.prototype._read = function(n) { - var ts = this._transformState; - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - ts.needTransform = true; - } - }; - Transform.prototype._destroy = function(err, cb) { - Duplex.prototype._destroy.call(this, err, function(err2) { - cb(err2); - }); - }; - function done(stream, er, data) { - if (er) - return stream.emit("error", er); - if (data != null) - stream.push(data); - if (stream._writableState.length) - throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) - throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); - } - } - }); - - // node_modules/readable-stream/lib/_stream_passthrough.js - var require_stream_passthrough = __commonJS({ - "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = PassThrough; - var Transform = require_stream_transform(); - require_inherits_browser()(PassThrough, Transform); - function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - Transform.call(this, options); - } - PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); - }; - } - }); - - // node_modules/readable-stream/lib/internal/streams/pipeline.js - var require_pipeline = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var eos; - function once(callback) { - var called = false; - return function() { - if (called) - return; - called = true; - callback.apply(void 0, arguments); - }; - } - var _require$codes = require_errors_browser().codes; - var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; - var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - function noop3(err) { - if (err) - throw err; - } - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === "function"; - } - function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on("close", function() { - closed = true; - }); - if (eos === void 0) - eos = require_end_of_stream(); - eos(stream, { - readable: reading, - writable: writing - }, function(err) { - if (err) - return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function(err) { - if (closed) - return; - if (destroyed) - return; - destroyed = true; - if (isRequest(stream)) - return stream.abort(); - if (typeof stream.destroy === "function") - return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED("pipe")); - }; - } - function call(fn) { - fn(); - } - function pipe(from, to) { - return from.pipe(to); - } - function popCallback(streams) { - if (!streams.length) - return noop3; - if (typeof streams[streams.length - 1] !== "function") - return noop3; - return streams.pop(); - } - function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - var callback = popCallback(streams); - if (Array.isArray(streams[0])) - streams = streams[0]; - if (streams.length < 2) { - throw new ERR_MISSING_ARGS("streams"); - } - var error; - var destroys = streams.map(function(stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function(err) { - if (!error) - error = err; - if (err) - destroys.forEach(call); - if (reading) - return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); - } - module.exports = pipeline; - } - }); - - // node_modules/readable-stream/readable-browser.js - var require_readable_browser = __commonJS({ - "node_modules/readable-stream/readable-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - exports = module.exports = require_stream_readable(); - exports.Stream = exports; - exports.Readable = exports; - exports.Writable = require_stream_writable(); - exports.Duplex = require_stream_duplex(); - exports.Transform = require_stream_transform(); - exports.PassThrough = require_stream_passthrough(); - exports.finished = require_end_of_stream(); - exports.pipeline = require_pipeline(); - } - }); - - // node_modules/readable-web-to-node-stream/lib/index.js - var require_lib = __commonJS({ - "node_modules/readable-web-to-node-stream/lib/index.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ReadableWebToNodeStream = void 0; - var readable_stream_1 = require_readable_browser(); - var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable { - constructor(stream) { - super(); - this.bytesRead = 0; - this.released = false; - this.reader = stream.getReader(); - } - async _read() { - if (this.released) { - this.push(null); - return; - } - this.pendingRead = this.reader.read(); - const data = await this.pendingRead; - delete this.pendingRead; - if (data.done || this.released) { - this.push(null); - } else { - this.bytesRead += data.value.length; - this.push(data.value); - } - } - async waitForReadToComplete() { - if (this.pendingRead) { - await this.pendingRead; - } - } - async close() { - await this.syncAndRelease(); - } - async syncAndRelease() { - this.released = true; - await this.waitForReadToComplete(); - await this.reader.releaseLock(); - } - }; - exports.ReadableWebToNodeStream = ReadableWebToNodeStream2; - } - }); - - // node_modules/base-x/src/index.js - var require_src2 = __commonJS({ - "node_modules/base-x/src/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function base(ALPHABET) { - if (ALPHABET.length >= 255) { - throw new TypeError("Alphabet too long"); - } - var BASE_MAP = new Uint8Array(256); - for (var j = 0; j < BASE_MAP.length; j++) { - BASE_MAP[j] = 255; - } - for (var i = 0; i < ALPHABET.length; i++) { - var x = ALPHABET.charAt(i); - var xc = x.charCodeAt(0); - if (BASE_MAP[xc] !== 255) { - throw new TypeError(x + " is ambiguous"); - } - BASE_MAP[xc] = i; - } - var BASE = ALPHABET.length; - var LEADER = ALPHABET.charAt(0); - var FACTOR = Math.log(BASE) / Math.log(256); - var iFACTOR = Math.log(256) / Math.log(BASE); - function encode2(source) { - if (source instanceof Uint8Array) { - } else if (ArrayBuffer.isView(source)) { - source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); - } else if (Array.isArray(source)) { - source = Uint8Array.from(source); - } - if (!(source instanceof Uint8Array)) { - throw new TypeError("Expected Uint8Array"); - } - if (source.length === 0) { - return ""; - } - var zeroes = 0; - var length = 0; - var pbegin = 0; - var pend = source.length; - while (pbegin !== pend && source[pbegin] === 0) { - pbegin++; - zeroes++; - } - var size = (pend - pbegin) * iFACTOR + 1 >>> 0; - var b58 = new Uint8Array(size); - while (pbegin !== pend) { - var carry = source[pbegin]; - var i2 = 0; - for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) { - carry += 256 * b58[it1] >>> 0; - b58[it1] = carry % BASE >>> 0; - carry = carry / BASE >>> 0; - } - if (carry !== 0) { - throw new Error("Non-zero carry"); - } - length = i2; - pbegin++; - } - var it2 = size - length; - while (it2 !== size && b58[it2] === 0) { - it2++; - } - var str = LEADER.repeat(zeroes); - for (; it2 < size; ++it2) { - str += ALPHABET.charAt(b58[it2]); - } - return str; - } - function decodeUnsafe(source) { - if (typeof source !== "string") { - throw new TypeError("Expected String"); - } - if (source.length === 0) { - return new Uint8Array(); - } - var psz = 0; - var zeroes = 0; - var length = 0; - while (source[psz] === LEADER) { - zeroes++; - psz++; - } - var size = (source.length - psz) * FACTOR + 1 >>> 0; - var b256 = new Uint8Array(size); - while (source[psz]) { - var carry = BASE_MAP[source.charCodeAt(psz)]; - if (carry === 255) { - return; - } - var i2 = 0; - for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) { - carry += BASE * b256[it3] >>> 0; - b256[it3] = carry % 256 >>> 0; - carry = carry / 256 >>> 0; - } - if (carry !== 0) { - throw new Error("Non-zero carry"); - } - length = i2; - psz++; - } - var it4 = size - length; - while (it4 !== size && b256[it4] === 0) { - it4++; - } - var vch = new Uint8Array(zeroes + (size - it4)); - var j2 = zeroes; - while (it4 !== size) { - vch[j2++] = b256[it4++]; - } - return vch; - } - function decode3(string) { - var buffer = decodeUnsafe(string); - if (buffer) { - return buffer; - } - throw new Error("Non-base" + BASE + " character"); - } - return { - encode: encode2, - decodeUnsafe, - decode: decode3 - }; - } - module.exports = base; - } - }); - - // node_modules/bs58/index.js - var require_bs58 = __commonJS({ - "node_modules/bs58/index.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var basex = require_src2(); - var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; - module.exports = basex(ALPHABET); - } - }); - - // node_modules/int64-buffer/int64-buffer.js - var require_int64_buffer = __commonJS({ - "node_modules/int64-buffer/int64-buffer.js"(exports) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var Uint64BE; - var Int64BE; - var Uint64LE; - var Int64LE; - !function(exports2) { - var UNDEFINED = "undefined"; - var BUFFER = UNDEFINED !== typeof Buffer2 && Buffer2; - var UINT8ARRAY = UNDEFINED !== typeof Uint8Array && Uint8Array; - var ARRAYBUFFER = UNDEFINED !== typeof ArrayBuffer && ArrayBuffer; - var ZERO = [0, 0, 0, 0, 0, 0, 0, 0]; - var isArray = Array.isArray || _isArray; - var BIT32 = 4294967296; - var BIT24 = 16777216; - var storage; - Uint64BE = factory("Uint64BE", true, true); - Int64BE = factory("Int64BE", true, false); - Uint64LE = factory("Uint64LE", false, true); - Int64LE = factory("Int64LE", false, false); - function factory(name, bigendian, unsigned) { - var posH = bigendian ? 0 : 4; - var posL = bigendian ? 4 : 0; - var pos0 = bigendian ? 0 : 3; - var pos1 = bigendian ? 1 : 2; - var pos2 = bigendian ? 2 : 1; - var pos3 = bigendian ? 3 : 0; - var fromPositive = bigendian ? fromPositiveBE : fromPositiveLE; - var fromNegative = bigendian ? fromNegativeBE : fromNegativeLE; - var proto = Int64.prototype; - var isName = "is" + name; - var _isInt64 = "_" + isName; - proto.buffer = void 0; - proto.offset = 0; - proto[_isInt64] = true; - proto.toNumber = toNumber; - proto.toString = toString2; - proto.toJSON = toNumber; - proto.toArray = toArray; - if (BUFFER) - proto.toBuffer = toBuffer; - if (UINT8ARRAY) - proto.toArrayBuffer = toArrayBuffer; - Int64[isName] = isInt64; - exports2[name] = Int64; - return Int64; - function Int64(buffer, offset, value, raddix) { - if (!(this instanceof Int64)) - return new Int64(buffer, offset, value, raddix); - return init5(this, buffer, offset, value, raddix); - } - function isInt64(b) { - return !!(b && b[_isInt64]); - } - function init5(that, buffer, offset, value, raddix) { - if (UINT8ARRAY && ARRAYBUFFER) { - if (buffer instanceof ARRAYBUFFER) - buffer = new UINT8ARRAY(buffer); - if (value instanceof ARRAYBUFFER) - value = new UINT8ARRAY(value); - } - if (!buffer && !offset && !value && !storage) { - that.buffer = newArray(ZERO, 0); - return; - } - if (!isValidBuffer(buffer, offset)) { - var _storage = storage || Array; - raddix = offset; - value = buffer; - offset = 0; - buffer = new _storage(8); - } - that.buffer = buffer; - that.offset = offset |= 0; - if (UNDEFINED === typeof value) - return; - if (typeof value === "string") { - fromString(buffer, offset, value, raddix || 10); - } else if (isValidBuffer(value, raddix)) { - fromArray(buffer, offset, value, raddix); - } else if (typeof raddix === "number") { - writeInt32(buffer, offset + posH, value); - writeInt32(buffer, offset + posL, raddix); - } else if (value > 0) { - fromPositive(buffer, offset, value); - } else if (value < 0) { - fromNegative(buffer, offset, value); - } else { - fromArray(buffer, offset, ZERO, 0); - } - } - function fromString(buffer, offset, str, raddix) { - var pos = 0; - var len = str.length; - var high = 0; - var low = 0; - if (str[0] === "-") - pos++; - var sign = pos; - while (pos < len) { - var chr = parseInt(str[pos++], raddix); - if (!(chr >= 0)) - break; - low = low * raddix + chr; - high = high * raddix + Math.floor(low / BIT32); - low %= BIT32; - } - if (sign) { - high = ~high; - if (low) { - low = BIT32 - low; - } else { - high++; - } - } - writeInt32(buffer, offset + posH, high); - writeInt32(buffer, offset + posL, low); - } - function toNumber() { - var buffer = this.buffer; - var offset = this.offset; - var high = readInt32(buffer, offset + posH); - var low = readInt32(buffer, offset + posL); - if (!unsigned) - high |= 0; - return high ? high * BIT32 + low : low; - } - function toString2(radix) { - var buffer = this.buffer; - var offset = this.offset; - var high = readInt32(buffer, offset + posH); - var low = readInt32(buffer, offset + posL); - var str = ""; - var sign = !unsigned && high & 2147483648; - if (sign) { - high = ~high; - low = BIT32 - low; - } - radix = radix || 10; - while (1) { - var mod = high % radix * BIT32 + low; - high = Math.floor(high / radix); - low = Math.floor(mod / radix); - str = (mod % radix).toString(radix) + str; - if (!high && !low) - break; - } - if (sign) { - str = "-" + str; - } - return str; - } - function writeInt32(buffer, offset, value) { - buffer[offset + pos3] = value & 255; - value = value >> 8; - buffer[offset + pos2] = value & 255; - value = value >> 8; - buffer[offset + pos1] = value & 255; - value = value >> 8; - buffer[offset + pos0] = value & 255; - } - function readInt32(buffer, offset) { - return buffer[offset + pos0] * BIT24 + (buffer[offset + pos1] << 16) + (buffer[offset + pos2] << 8) + buffer[offset + pos3]; - } - } - function toArray(raw) { - var buffer = this.buffer; - var offset = this.offset; - storage = null; - if (raw !== false && offset === 0 && buffer.length === 8 && isArray(buffer)) - return buffer; - return newArray(buffer, offset); - } - function toBuffer(raw) { - var buffer = this.buffer; - var offset = this.offset; - storage = BUFFER; - if (raw !== false && offset === 0 && buffer.length === 8 && Buffer2.isBuffer(buffer)) - return buffer; - var dest = new BUFFER(8); - fromArray(dest, 0, buffer, offset); - return dest; - } - function toArrayBuffer(raw) { - var buffer = this.buffer; - var offset = this.offset; - var arrbuf = buffer.buffer; - storage = UINT8ARRAY; - if (raw !== false && offset === 0 && arrbuf instanceof ARRAYBUFFER && arrbuf.byteLength === 8) - return arrbuf; - var dest = new UINT8ARRAY(8); - fromArray(dest, 0, buffer, offset); - return dest.buffer; - } - function isValidBuffer(buffer, offset) { - var len = buffer && buffer.length; - offset |= 0; - return len && offset + 8 <= len && typeof buffer[offset] !== "string"; - } - function fromArray(destbuf, destoff, srcbuf, srcoff) { - destoff |= 0; - srcoff |= 0; - for (var i = 0; i < 8; i++) { - destbuf[destoff++] = srcbuf[srcoff++] & 255; - } - } - function newArray(buffer, offset) { - return Array.prototype.slice.call(buffer, offset, offset + 8); - } - function fromPositiveBE(buffer, offset, value) { - var pos = offset + 8; - while (pos > offset) { - buffer[--pos] = value & 255; - value /= 256; - } - } - function fromNegativeBE(buffer, offset, value) { - var pos = offset + 8; - value++; - while (pos > offset) { - buffer[--pos] = -value & 255 ^ 255; - value /= 256; - } - } - function fromPositiveLE(buffer, offset, value) { - var end = offset + 8; - while (offset < end) { - buffer[offset++] = value & 255; - value /= 256; - } - } - function fromNegativeLE(buffer, offset, value) { - var end = offset + 8; - value++; - while (offset < end) { - buffer[offset++] = -value & 255 ^ 255; - value /= 256; - } - } - function _isArray(val) { - return !!val && Object.prototype.toString.call(val) == "[object Array]"; - } - }(typeof exports === "object" && typeof exports.nodeName !== "string" ? exports : exports || {}); - } - }); - - // node_modules/matroska/lib/schema.js - var require_schema = __commonJS({ - "node_modules/matroska/lib/schema.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var byEbmlID = { - 128: { - name: "ChapterDisplay", - level: 4, - type: "m", - multiple: true, - webm: true, - description: "Contains all possible strings to use for the chapter display." - }, - 131: { - name: "TrackType", - level: 3, - type: "u", - mandatory: true, - description: "The `TrackType` defines the type of each frame found in the Track. The value **SHOULD** be stored on 1 octet." - }, - 133: { - name: "ChapString", - cppname: "ChapterString", - level: 5, - type: "8", - mandatory: true, - webm: true, - description: "Contains the string to use as the chapter atom." - }, - 134: { - name: "CodecID", - level: 3, - type: "s", - mandatory: true, - description: "An ID corresponding to the codec, see [@!MatroskaCodec] for more info." - }, - 136: { - name: "FlagDefault", - cppname: "TrackFlagDefault", - level: 3, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set if that track (audio, video or subs) **SHOULD** be eligible for automatic selection by the player; see (#default-track-selection) for more details." - }, - 137: { - name: "ChapterTrackUID", - cppname: "ChapterTrackNumber", - level: 5, - type: "u", - mandatory: true, - multiple: true, - range: "not 0", - description: "UID of the Track to apply this chapter to. In the absence of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absence of this Element indicates that the Chapter **SHOULD** be applied to any currently used Tracks." - }, - 142: { - name: "Slices", - level: 3, - type: "m", - maxver: 1, - description: "Contains slices description." - }, - 143: { - name: "ChapterTrack", - level: 4, - type: "m", - description: "List of tracks on which the chapter applies. If this Element is not present, all tracks apply" - }, - 145: { - name: "ChapterTimeStart", - level: 4, - type: "u", - mandatory: true, - webm: true, - description: "Timestamp of the start of Chapter, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 146: { - name: "ChapterTimeEnd", - level: 4, - type: "u", - webm: true, - description: "Timestamp of the end of Chapter timestamp excluded, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). The value **MUST** be greater than or equal to the `ChapterTimeStart` of the same `ChapterAtom`." - }, - 150: { - name: "CueRefTime", - level: 5, - type: "u", - mandatory: true, - minver: 2, - description: "Timestamp of the referenced Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 151: { - name: "CueRefCluster", - level: 5, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - description: "The Segment Position of the Cluster containing the referenced Block." - }, - 152: { - name: "ChapterFlagHidden", - level: 4, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if a chapter is hidden. Hidden chapters **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapterflaghidden) on Chapter flags)." - }, - 154: { - name: "FlagInterlaced", - cppname: "VideoFlagInterlaced", - level: 4, - type: "u", - mandatory: true, - minver: 2, - webm: true, - "default": "0", - description: "Specify whether the video frames in this track are interlaced or not." - }, - 155: { - name: "BlockDuration", - level: 3, - type: "u", - description: "The duration of the Block, expressed in Track Ticks; see (#timestamp-ticks). The BlockDuration Element can be useful at the end of a Track to define the duration of the last frame (as there is no subsequent Block available), or when there is a break in a track like for subtitle tracks." - }, - 156: { - name: "FlagLacing", - cppname: "TrackFlagLacing", - level: 3, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the track **MAY** contain blocks using lacing. When set to 0 all blocks **MUST** have their lacing flags set to No lacing; see (#block-lacing) on Block Lacing." - }, - 157: { - name: "FieldOrder", - cppname: "VideoFieldOrder", - level: 4, - type: "u", - mandatory: true, - minver: 4, - "default": "2", - description: "Specify the field ordering of video frames in this track." - }, - 159: { - name: "Channels", - cppname: "AudioChannels", - level: 4, - type: "u", - mandatory: true, - "default": "1", - range: "not 0", - description: "Numbers of channels in the track." - }, - 160: { - name: "BlockGroup", - level: 2, - type: "m", - multiple: true, - description: "Basic container of information containing a single Block and information specific to that Block." - }, - 161: { - name: "Block", - level: 3, - type: "b", - mandatory: true, - description: "Block containing the actual data to be rendered and a timestamp relative to the Cluster Timestamp; see (#block-structure) on Block Structure." - }, - 162: { - name: "BlockVirtual", - level: 3, - type: "b", - minver: 0, - maxver: 0, - description: "A Block with no data. It **MUST** be stored in the stream at the place the real Block would be in display order. " - }, - 163: { - name: "SimpleBlock", - level: 2, - type: "b", - multiple: true, - minver: 2, - webm: true, - divx: true, - description: "Similar to Block, see (#block-structure), but without all the extra information, mostly used to reduced overhead when no extra feature is needed; see (#simpleblock-structure) on SimpleBlock Structure." - }, - 164: { - name: "CodecState", - level: 3, - type: "b", - minver: 2, - description: "The new codec state to use. Data interpretation is private to the codec. This information **SHOULD** always be referenced by a seek entry." - }, - 165: { - name: "BlockAdditional", - level: 5, - type: "b", - mandatory: true, - webm: true, - description: "Interpreted by the codec as it wishes (using the BlockAddID)." - }, - 166: { - name: "BlockMore", - level: 4, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contain the BlockAdditional and some parameters." - }, - 167: { - name: "Position", - cppname: "ClusterPosition", - level: 2, - type: "u", - description: "The Segment Position of the Cluster in the Segment (0 in live streams). It might help to resynchronise offset on damaged streams." - }, - 170: { - name: "CodecDecodeAll", - level: 3, - type: "u", - mandatory: true, - maxver: 0, - "default": "1", - range: "0-1", - description: "Set to 1 if the codec can decode potentially damaged data." - }, - 171: { - name: "PrevSize", - cppname: "ClusterPrevSize", - level: 2, - type: "u", - description: "Size of the previous Cluster, in octets. Can be useful for backward playing." - }, - 174: { - name: "TrackEntry", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Describes a track with all Elements." - }, - 175: { - name: "EncryptedBlock", - level: 2, - type: "b", - multiple: true, - minver: 0, - maxver: 0, - description: "Similar to SimpleBlock, see (#simpleblock-structure), but the data inside the Block are Transformed (encrypt and/or signed)." - }, - 176: { - name: "PixelWidth", - cppname: "VideoPixelWidth", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "Width of the encoded video frames in pixels." - }, - 178: { - name: "CueDuration", - level: 4, - type: "u", - minver: 4, - webm: true, - description: "The duration of the block, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks). If missing, the track's DefaultDuration does not apply and no duration information is available in terms of the cues." - }, - 179: { - name: "CueTime", - level: 3, - type: "u", - mandatory: true, - description: "Absolute timestamp of the seek point, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 181: { - name: "SamplingFrequency", - cppname: "AudioSamplingFreq", - level: 4, - type: "f", - mandatory: true, - "default": "0x1.f4p+12", - range: "> 0x0p+0", - description: "Sampling frequency in Hz." - }, - 182: { - name: "ChapterAtom", - level: 3, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains the atom information to use as the chapter atom (apply to all tracks)." - }, - 183: { - name: "CueTrackPositions", - level: 3, - type: "m", - mandatory: true, - multiple: true, - description: "Contain positions for different tracks corresponding to the timestamp." - }, - 185: { - name: "FlagEnabled", - cppname: "TrackFlagEnabled", - level: 3, - type: "u", - mandatory: true, - minver: 2, - webm: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the track is usable. It is possible to turn a not usable track into a usable track using chapter codecs or control tracks." - }, - 186: { - name: "PixelHeight", - cppname: "VideoPixelHeight", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "Height of the encoded video frames in pixels." - }, - 187: { - name: "CuePoint", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Contains all information relative to a seek point in the Segment." - }, - 191: { - name: "CRC-32", - level: -1, - type: "b", - minver: 1, - webm: false, - description: "The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian", - crc: true - }, - 192: { - name: "TrickTrackUID", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The TrackUID of the Smooth FF/RW video in the paired EBML structure corresponding to this video track. See [@?DivXTrickTrack]." - }, - 193: { - name: "TrickTrackSegmentUID", - level: 3, - type: "b", - minver: 0, - maxver: 0, - divx: true, - description: "The SegmentUID of the Segment containing the track identified by TrickTrackUID. See [@?DivXTrickTrack]." - }, - 196: { - name: "TrickMasterTrackSegmentUID", - level: 3, - type: "b", - minver: 0, - maxver: 0, - divx: true, - description: "The SegmentUID of the Segment containing the track identified by MasterTrackUID. See [@?DivXTrickTrack]." - }, - 198: { - name: "TrickTrackFlag", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - "default": "0", - description: "Set to 1 if this video track is a Smooth FF/RW track. If set to 1, MasterTrackUID and MasterTrackSegUID should must be present and BlockGroups for this track must contain ReferenceFrame structures. Otherwise, TrickTrackUID and TrickTrackSegUID must be present if this track has a corresponding Smooth FF/RW track. See [@?DivXTrickTrack]." - }, - 199: { - name: "TrickMasterTrackUID", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The TrackUID of the video track in the paired EBML structure that corresponds to this Smooth FF/RW track. See [@?DivXTrickTrack]." - }, - 200: { - name: "ReferenceFrame", - level: 3, - type: "m", - minver: 0, - maxver: 0, - divx: true, - description: "Contains information about the last reference frame. See [@?DivXTrickTrack]." - }, - 201: { - name: "ReferenceOffset", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - divx: true, - description: "The relative offset, in bytes, from the previous BlockGroup element for this Smooth FF/RW video track to the containing BlockGroup element. See [@?DivXTrickTrack]." - }, - 202: { - name: "ReferenceTimestamp", - cppname: "ReferenceTimeCode", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp of the BlockGroup pointed to by ReferenceOffset, expressed in Track Ticks; see (#timestamp-ticks). See [@?DivXTrickTrack]." - }, - 203: { - name: "BlockAdditionID", - cppname: "SliceBlockAddID", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The ID of the BlockAdditional Element (0 is the main Block)." - }, - 204: { - name: "LaceNumber", - cppname: "SliceLaceNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - description: "The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). Being able to interpret this Element is not **REQUIRED** for playback." - }, - 205: { - name: "FrameNumber", - cppname: "SliceFrameNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame)." - }, - 206: { - name: "Delay", - cppname: "SliceDelay", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The delay to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)." - }, - 207: { - name: "SliceDuration", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The duration to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)." - }, - 215: { - name: "TrackNumber", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number)." - }, - 219: { - name: "CueReference", - level: 4, - type: "m", - multiple: true, - minver: 2, - description: "The Clusters containing the referenced Blocks." - }, - 224: { - name: "Video", - cppname: "TrackVideo", - level: 3, - type: "m", - description: "Video settings." - }, - 225: { - name: "Audio", - cppname: "TrackAudio", - level: 3, - type: "m", - description: "Audio settings." - }, - 226: { - name: "TrackOperation", - level: 3, - type: "m", - minver: 3, - description: "Operation that needs to be applied on tracks to create this virtual track. For more details look at (#track-operation)." - }, - 227: { - name: "TrackCombinePlanes", - level: 4, - type: "m", - minver: 3, - description: "Contains the list of all video plane tracks that need to be combined to create this 3D track" - }, - 228: { - name: "TrackPlane", - level: 5, - type: "m", - mandatory: true, - multiple: true, - minver: 3, - description: "Contains a video plane track that need to be combined to create this 3D track" - }, - 229: { - name: "TrackPlaneUID", - level: 6, - type: "u", - mandatory: true, - minver: 3, - range: "not 0", - description: "The trackUID number of the track representing the plane." - }, - 230: { - name: "TrackPlaneType", - level: 6, - type: "u", - mandatory: true, - minver: 3, - description: "The kind of plane this track corresponds to." - }, - 231: { - name: "Timestamp", - cppname: "ClusterTimecode", - level: 2, - type: "u", - mandatory: true, - description: "Absolute timestamp of the cluster, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)." - }, - 232: { - name: "TimeSlice", - level: 4, - type: "m", - multiple: true, - minver: 0, - maxver: 0, - description: "Contains extra time information about the data contained in the Block. Being able to interpret this Element is not **REQUIRED** for playback." - }, - 233: { - name: "TrackJoinBlocks", - level: 4, - type: "m", - minver: 3, - description: "Contains the list of all tracks whose Blocks need to be combined to create this virtual track" - }, - 234: { - name: "CueCodecState", - level: 4, - type: "u", - mandatory: true, - minver: 2, - "default": "0", - description: "The Segment Position of the Codec State corresponding to this Cue Element. 0 means that the data is taken from the initial Track Entry." - }, - 235: { - name: "CueRefCodecState", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The Segment Position of the Codec State corresponding to this referenced Element. 0 means that the data is taken from the initial Track Entry." - }, - 236: { - name: "Void", - level: -1, - type: "b", - minver: 1, - description: "Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use." - }, - 237: { - name: "TrackJoinUID", - level: 5, - type: "u", - mandatory: true, - multiple: true, - minver: 3, - range: "not 0", - description: "The trackUID number of a track whose blocks are used to create this virtual track." - }, - 238: { - name: "BlockAddID", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "1", - range: "not 0", - description: "An ID to identify the BlockAdditional level. If BlockAddIDType of the corresponding block is 0, this value is also the value of BlockAddIDType for the meaning of the content of BlockAdditional." - }, - 240: { - name: "CueRelativePosition", - level: 4, - type: "u", - minver: 4, - webm: true, - description: "The relative position inside the Cluster of the referenced SimpleBlock or BlockGroup with 0 being the first possible position for an Element inside that Cluster." - }, - 241: { - name: "CueClusterPosition", - level: 4, - type: "u", - mandatory: true, - description: "The Segment Position of the Cluster containing the associated Block." - }, - 247: { - name: "CueTrack", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "The track for which a position is given." - }, - 250: { - name: "ReferencePriority", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced." - }, - 251: { - name: "ReferenceBlock", - level: 3, - type: "i", - multiple: true, - description: "A timestamp value, relative to the timestamp of the Block in this BlockGroup, expressed in Track Ticks; see (#timestamp-ticks). This is used to reference other frames necessary to decode this frame. The relative value **SHOULD** correspond to a valid `Block` this `Block` depends on. Historically Matroska Writer didn't write the actual `Block(s)` this `Block` depends on, but *some* `Block` in the past. The value \"0\" **MAY** also be used to signify this `Block` cannot be decoded on its own, but without knownledge of which `Block` is necessary. In this case, other `ReferenceBlock` **MUST NOT** be found in the same `BlockGroup`. If the `BlockGroup` doesn't have any `ReferenceBlock` element, then the `Block` it contains can be decoded without using any other `Block` data." - }, - 253: { - name: "ReferenceVirtual", - level: 3, - type: "i", - minver: 0, - maxver: 0, - description: "The Segment Position of the data that would otherwise be in position of the virtual block." - }, - 16804: { - name: "BlockAddIDName", - level: 4, - type: "s", - minver: 4, - description: "A human-friendly name describing the type of BlockAdditional data, as defined by the associated Block Additional Mapping." - }, - 16868: { - name: "BlockAdditionMapping", - level: 3, - type: "m", - multiple: true, - minver: 4, - description: "Contains elements that extend the track format, by adding content either to each frame, with BlockAddID ((#blockaddid-element)), or to the track as a whole with BlockAddIDExtraData." - }, - 16871: { - name: "BlockAddIDType", - level: 4, - type: "u", - mandatory: true, - minver: 4, - "default": "0", - description: "Stores the registered identifier of the Block Additional Mapping to define how the BlockAdditional data should be handled." - }, - 16877: { - name: "BlockAddIDExtraData", - level: 4, - type: "b", - minver: 4, - description: "Extra binary data that the BlockAddIDType can use to interpret the BlockAdditional data. The interpretation of the binary data depends on the BlockAddIDType value and the corresponding Block Additional Mapping." - }, - 16880: { - name: "BlockAddIDValue", - level: 4, - type: "u", - minver: 4, - range: ">=2", - description: "If the track format extension needs content beside frames, the value refers to the BlockAddID ((#blockaddid-element)), value being described. To keep MaxBlockAdditionID as low as possible, small values **SHOULD** be used." - }, - 16980: { - name: "ContentCompAlgo", - level: 6, - type: "u", - mandatory: true, - "default": "0", - description: "The compression algorithm used." - }, - 16981: { - name: "ContentCompSettings", - level: 6, - type: "b", - description: "Settings that might be needed by the decompressor. For Header Stripping (`ContentCompAlgo`=3), the bytes that were removed from the beginning of each frames of the track." - }, - 17026: { - name: "DocType", - level: 1, - type: "s", - mandatory: true, - "default": "matroska", - minver: 1, - description: "A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files." - }, - 17029: { - name: "DocTypeReadVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The minimum DocType version an interpreter has to support to read this file." - }, - 17030: { - name: "EBMLVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The version of EBML parser used to create the file." - }, - 17031: { - name: "DocTypeVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The version of DocType interpreter used to create the file." - }, - 17138: { - name: "EBMLMaxIDLength", - level: 1, - type: "u", - mandatory: true, - "default": "4", - range: "4" - }, - 17139: { - name: "EBMLMaxSizeLength", - level: 1, - type: "u", - mandatory: true, - "default": "8", - range: "1-8" - }, - 17143: { - name: "EBMLReadVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The minimum EBML version a parser has to support to read this file." - }, - 17276: { - name: "ChapLanguage", - cppname: "ChapterLanguage", - level: 5, - type: "s", - mandatory: true, - multiple: true, - webm: true, - "default": "eng", - description: "A language corresponding to the string, in the bibliographic ISO-639-2 form [@!ISO639-2]. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element." - }, - 17277: { - name: "ChapLanguageIETF", - level: 5, - type: "s", - multiple: true, - minver: 4, - description: "Specifies a language corresponding to the ChapString in the format defined in [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If a ChapLanguageIETF Element is used, then any ChapLanguage and ChapCountry Elements used in the same ChapterDisplay **MUST** be ignored." - }, - 17278: { - name: "ChapCountry", - cppname: "ChapterCountry", - level: 5, - type: "s", - multiple: true, - webm: true, - description: "A country corresponding to the string, using the same 2 octets country-codes as in Internet domains [@!IANADomains] based on [@!ISO3166-1] alpha-2 codes. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element." - }, - 17476: { - name: "SegmentFamily", - level: 2, - type: "b", - multiple: true, - description: "A randomly generated unique ID that all Segments of a Linked Segment **MUST** share (128 bits)." - }, - 17505: { - name: "DateUTC", - level: 2, - type: "d", - description: "The date and time that the Segment was created by the muxing application or library." - }, - 17530: { - name: "TagLanguage", - cppname: "TagLangue", - level: 4, - type: "s", - mandatory: true, - webm: true, - "default": "und", - description: "Specifies the language of the tag specified, in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the TagLanguageIETF Element is used within the same SimpleTag Element." - }, - 17531: { - name: "TagLanguageIETF", - level: 4, - type: "s", - minver: 4, - description: "Specifies the language used in the TagString according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any TagLanguage Elements used in the same SimpleTag **MUST** be ignored." - }, - 17540: { - name: "TagDefault", - level: 4, - type: "u", - mandatory: true, - webm: true, - "default": "1", - range: "0-1", - description: "A boolean value to indicate if this is the default/original language to use for the given tag." - }, - 17541: { - name: "TagBinary", - level: 4, - type: "b", - webm: true, - description: "The values of the Tag, if it is binary. Note that this cannot be used in the same SimpleTag as TagString." - }, - 17543: { - name: "TagString", - level: 4, - type: "8", - webm: true, - description: "The value of the Tag." - }, - 17545: { - name: "Duration", - level: 2, - type: "f", - range: "> 0x0p+0", - description: "Duration of the Segment, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)." - }, - 17588: { - name: "TagDefaultBogus", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - "default": "1", - range: "0-1", - description: "A variant of the TagDefault element with a bogus Element ID; see (#tagdefault-element)." - }, - 17677: { - name: "ChapProcessPrivate", - cppname: "ChapterProcessPrivate", - level: 5, - type: "b", - description: 'Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent; see (#menu-features) on DVD menus.' - }, - 17816: { - name: "ChapterFlagEnabled", - level: 4, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie **SHOULD** skip all the content between the TimeStart and TimeEnd of this chapter; see (#chapter-flags) on Chapter flags." - }, - 17827: { - name: "TagName", - level: 4, - type: "8", - mandatory: true, - webm: true, - description: "The name of the Tag that is going to be stored." - }, - 17849: { - name: "EditionEntry", - level: 2, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains all information about a Segment edition." - }, - 17852: { - name: "EditionUID", - level: 3, - type: "u", - range: "not 0", - description: "A unique ID to identify the edition. It's useful for tagging an edition." - }, - 17853: { - name: "EditionFlagHidden", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if an edition is hidden. Hidden editions **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapter-flags) on Chapter flags)." - }, - 17883: { - name: "EditionFlagDefault", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if the edition **SHOULD** be used as the default one." - }, - 17885: { - name: "EditionFlagOrdered", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if the chapters can be defined multiple times and the order to play them is enforced; see (#editionflagordered)." - }, - 18012: { - name: "FileData", - level: 3, - type: "b", - mandatory: true, - description: "The data of the file." - }, - 18016: { - name: "FileMimeType", - cppname: "MimeType", - level: 3, - type: "s", - mandatory: true, - description: "MIME type of the file." - }, - 18017: { - name: "FileUsedStartTime", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp at which this optimized font attachment comes into context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]." - }, - 18018: { - name: "FileUsedEndTime", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp at which this optimized font attachment goes out of context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]." - }, - 18030: { - name: "FileName", - level: 3, - type: "8", - mandatory: true, - description: "Filename of the attached file." - }, - 18037: { - name: "FileReferral", - level: 3, - type: "b", - minver: 0, - maxver: 0, - description: "A binary value that a track/codec can refer to when the attachment is needed." - }, - 18046: { - name: "FileDescription", - level: 3, - type: "8", - description: "A human-friendly name for the attached file." - }, - 18094: { - name: "FileUID", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "Unique ID representing the file, as random as possible." - }, - 18401: { - name: "ContentEncAlgo", - level: 6, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: 'The encryption algorithm used. The value "0" means that the contents have not been encrypted.' - }, - 18402: { - name: "ContentEncKeyID", - level: 6, - type: "b", - webm: true, - description: "For public key algorithms this is the ID of the public key the the data was encrypted with." - }, - 18403: { - name: "ContentSignature", - level: 6, - type: "b", - maxver: 0, - description: "A cryptographic signature of the contents." - }, - 18404: { - name: "ContentSigKeyID", - level: 6, - type: "b", - maxver: 0, - description: "This is the ID of the private key the data was signed with." - }, - 18405: { - name: "ContentSigAlgo", - level: 6, - type: "u", - maxver: 0, - "default": "0", - description: "The algorithm used for the signature." - }, - 18406: { - name: "ContentSigHashAlgo", - level: 6, - type: "u", - maxver: 0, - "default": "0", - description: "The hash algorithm used for the signature." - }, - 18407: { - name: "ContentEncAESSettings", - level: 6, - type: "m", - minver: 4, - webm: true, - description: "Settings describing the encryption algorithm used. If `ContentEncAlgo` != 5 this **MUST** be ignored." - }, - 18408: { - name: "AESSettingsCipherMode", - level: 7, - type: "u", - mandatory: true, - minver: 4, - webm: true, - description: "The AES cipher mode used in the encryption." - }, - 19840: { - name: "MuxingApp", - level: 2, - type: "8", - mandatory: true, - description: 'Muxing application or library (example: "libmatroska-0.4.3").' - }, - 19899: { - name: "Seek", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Contains a single seek entry to an EBML Element." - }, - 20529: { - name: "ContentEncodingOrder", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: "Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder Elements in the TrackEntry that contains this ContentEncodingOrder element." - }, - 20530: { - name: "ContentEncodingScope", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "1", - description: "A bit field that describes which Elements have been modified in this way. Values (big-endian) can be OR'ed." - }, - 20531: { - name: "ContentEncodingType", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: "A value describing what kind of transformation is applied." - }, - 20532: { - name: "ContentCompression", - level: 5, - type: "m", - description: "Settings describing the compression used. This Element **MUST** be present if the value of ContentEncodingType is 0 and absent otherwise. Each block **MUST** be decompressable even if no previous block is available in order not to prevent seeking." - }, - 20533: { - name: "ContentEncryption", - level: 5, - type: "m", - webm: true, - description: "Settings describing the encryption used. This Element **MUST** be present if the value of `ContentEncodingType` is 1 (encryption) and **MUST** be ignored otherwise." - }, - 21343: { - name: "CueRefNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "1", - range: "not 0", - description: "Number of the referenced Block of Track X in the specified Cluster." - }, - 21358: { - name: "Name", - cppname: "TrackName", - level: 3, - type: "8", - description: "A human-readable track name." - }, - 21368: { - name: "CueBlockNumber", - level: 4, - type: "u", - range: "not 0", - description: "Number of the Block in the specified Cluster." - }, - 21375: { - name: "TrackOffset", - level: 3, - type: "i", - minver: 0, - maxver: 0, - "default": "0", - description: "A value to add to the Block's Timestamp, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). This can be used to adjust the playback offset of a track." - }, - 21419: { - name: "SeekID", - level: 3, - type: "b", - mandatory: true, - description: "The binary ID corresponding to the Element name." - }, - 21420: { - name: "SeekPosition", - level: 3, - type: "u", - mandatory: true, - description: "The Segment Position of the Element." - }, - 21432: { - name: "StereoMode", - cppname: "VideoStereoMode", - level: 4, - type: "u", - mandatory: true, - minver: 3, - webm: true, - "default": "0", - description: "Stereo-3D video mode. There are some more details in (#multi-planar-and-3d-videos)." - }, - 21433: { - name: "OldStereoMode", - level: 4, - type: "u", - maxver: 0, - description: "DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska." - }, - 21440: { - name: "AlphaMode", - cppname: "VideoAlphaMode", - level: 4, - type: "u", - mandatory: true, - minver: 3, - webm: true, - "default": "0", - description: 'Indicate whether the BlockAdditional Element with BlockAddID of "1" contains Alpha data, as defined by to the Codec Mapping for the `CodecID`. Undefined values **SHOULD NOT** be used as the behavior of known implementations is different (considered either as 0 or 1).' - }, - 21674: { - name: "PixelCropBottom", - cppname: "VideoPixelCropBottom", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove at the bottom of the image." - }, - 21680: { - name: "DisplayWidth", - cppname: "VideoDisplayWidth", - level: 4, - type: "u", - range: "not 0", - description: "Width of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)." - }, - 21682: { - name: "DisplayUnit", - cppname: "VideoDisplayUnit", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "How DisplayWidth & DisplayHeight are interpreted." - }, - 21683: { - name: "AspectRatioType", - cppname: "VideoAspectRatio", - level: 4, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "Specify the possible modifications to the aspect ratio." - }, - 21690: { - name: "DisplayHeight", - cppname: "VideoDisplayHeight", - level: 4, - type: "u", - range: "not 0", - description: "Height of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)." - }, - 21691: { - name: "PixelCropTop", - cppname: "VideoPixelCropTop", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove at the top of the image." - }, - 21708: { - name: "PixelCropLeft", - cppname: "VideoPixelCropLeft", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove on the left of the image." - }, - 21725: { - name: "PixelCropRight", - cppname: "VideoPixelCropRight", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove on the right of the image." - }, - 21930: { - name: "FlagForced", - cppname: "TrackFlagForced", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Applies only to subtitles. Set if that track **SHOULD** be eligible for automatic selection by the player if it matches the user's language preference, even if the user's preferences would normally not enable subtitles with the selected audio track; this can be used for tracks containing only translations of foreign-language audio or onscreen text. See (#default-track-selection) for more details." - }, - 21931: { - name: "FlagHearingImpaired", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is suitable for users with hearing impairments, set to 0 if it is unsuitable for users with hearing impairments." - }, - 21932: { - name: "FlagVisualImpaired", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is suitable for users with visual impairments, set to 0 if it is unsuitable for users with visual impairments." - }, - 21933: { - name: "FlagTextDescriptions", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track contains textual descriptions of video content, set to 0 if that track does not contain textual descriptions of video content." - }, - 21934: { - name: "FlagOriginal", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is in the content's original language, set to 0 if it is a translation." - }, - 21935: { - name: "FlagCommentary", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track contains commentary, set to 0 if it does not contain commentary." - }, - 21936: { - name: "Colour", - cppname: "VideoColour", - level: 4, - type: "m", - minver: 4, - webm: true, - description: "Settings describing the colour format." - }, - 21937: { - name: "MatrixCoefficients", - cppname: "VideoColourMatrix", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273." - }, - 21938: { - name: "BitsPerChannel", - cppname: "VideoBitsPerChannel", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Number of decoded bits per channel. A value of 0 indicates that the BitsPerChannel is unspecified." - }, - 21939: { - name: "ChromaSubsamplingHorz", - cppname: "VideoChromaSubsampHorz", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cr and Cb channels for every pixel not removed horizontally. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1." - }, - 21940: { - name: "ChromaSubsamplingVert", - cppname: "VideoChromaSubsampVert", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cr and Cb channels for every pixel not removed vertically. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingVert **SHOULD** be set to 1." - }, - 21941: { - name: "CbSubsamplingHorz", - cppname: "VideoCbSubsampHorz", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cb channel for every pixel not removed horizontally. This is additive with ChromaSubsamplingHorz. Example: For video with 4:2:1 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1 and CbSubsamplingHorz **SHOULD** be set to 1." - }, - 21942: { - name: "CbSubsamplingVert", - cppname: "VideoCbSubsampVert", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cb channel for every pixel not removed vertically. This is additive with ChromaSubsamplingVert." - }, - 21943: { - name: "ChromaSitingHorz", - cppname: "VideoChromaSitHorz", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "How chroma is subsampled horizontally." - }, - 21944: { - name: "ChromaSitingVert", - cppname: "VideoChromaSitVert", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "How chroma is subsampled vertically." - }, - 21945: { - name: "Range", - cppname: "VideoColourRange", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Clipping of the color ranges." - }, - 21946: { - name: "TransferCharacteristics", - cppname: "VideoColourTransferCharacter", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics are adopted from Table 3 of ISO/IEC 23091-4 or ITU-T H.273." - }, - 21947: { - name: "Primaries", - cppname: "VideoColourPrimaries", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273." - }, - 21948: { - name: "MaxCLL", - cppname: "VideoColourMaxCLL", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "Maximum brightness of a single pixel (Maximum Content Light Level) in candelas per square meter (cd/m^2^)." - }, - 21949: { - name: "MaxFALL", - cppname: "VideoColourMaxFALL", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "Maximum brightness of a single full frame (Maximum Frame-Average Light Level) in candelas per square meter (cd/m^2^)." - }, - 21968: { - name: "MasteringMetadata", - cppname: "VideoColourMasterMeta", - level: 5, - type: "m", - minver: 4, - webm: true, - description: "SMPTE 2086 mastering data." - }, - 21969: { - name: "PrimaryRChromaticityX", - cppname: "VideoRChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Red X chromaticity coordinate, as defined by CIE 1931." - }, - 21970: { - name: "PrimaryRChromaticityY", - cppname: "VideoRChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Red Y chromaticity coordinate, as defined by CIE 1931." - }, - 21971: { - name: "PrimaryGChromaticityX", - cppname: "VideoGChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Green X chromaticity coordinate, as defined by CIE 1931." - }, - 21972: { - name: "PrimaryGChromaticityY", - cppname: "VideoGChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Green Y chromaticity coordinate, as defined by CIE 1931." - }, - 21973: { - name: "PrimaryBChromaticityX", - cppname: "VideoBChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Blue X chromaticity coordinate, as defined by CIE 1931." - }, - 21974: { - name: "PrimaryBChromaticityY", - cppname: "VideoBChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Blue Y chromaticity coordinate, as defined by CIE 1931." - }, - 21975: { - name: "WhitePointChromaticityX", - cppname: "VideoWhitePointChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "White X chromaticity coordinate, as defined by CIE 1931." - }, - 21976: { - name: "WhitePointChromaticityY", - cppname: "VideoWhitePointChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "White Y chromaticity coordinate, as defined by CIE 1931." - }, - 21977: { - name: "LuminanceMax", - cppname: "VideoLuminanceMax", - level: 6, - type: "f", - minver: 4, - webm: true, - range: ">= 0x0p+0", - description: "Maximum luminance. Represented in candelas per square meter (cd/m^2^)." - }, - 21978: { - name: "LuminanceMin", - cppname: "VideoLuminanceMin", - level: 6, - type: "f", - minver: 4, - webm: true, - range: ">= 0x0p+0", - description: "Minimum luminance. Represented in candelas per square meter (cd/m^2^)." - }, - 21998: { - name: "MaxBlockAdditionID", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "The maximum value of BlockAddID ((#blockaddid-element)). A value 0 means there is no BlockAdditions ((#blockadditions-element)) for this track." - }, - 22100: { - name: "ChapterStringUID", - level: 4, - type: "8", - minver: 3, - webm: true, - description: "A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage [@!WebVTT]." - }, - 22186: { - name: "CodecDelay", - level: 3, - type: "u", - mandatory: true, - minver: 4, - webm: true, - description: "CodecDelay is The codec-built-in delay, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). It represents the amount of codec samples that will be discarded by the decoder during playback. This timestamp value **MUST** be subtracted from each frame timestamp in order to get the timestamp that will be actually played. The value **SHOULD** be small so the muxing of tracks with the same actual timestamp are in the same Cluster." - }, - 22203: { - name: "SeekPreRoll", - level: 3, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "After a discontinuity, SeekPreRoll is the duration of the data the decoder **MUST** decode before the decoded data is valid, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 22337: { - name: "WritingApp", - level: 2, - type: "8", - mandatory: true, - description: 'Writing application (example: "mkvmerge-0.3.3").' - }, - 22612: { - name: "SilentTracks", - cppname: "ClusterSilentTracks", - level: 2, - type: "m", - minver: 0, - maxver: 0, - description: "The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking or to decide what track to use." - }, - 22743: { - name: "SilentTrackNumber", - cppname: "ClusterSilentTrackNumber", - level: 3, - type: "u", - multiple: true, - minver: 0, - maxver: 0, - description: "One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster." - }, - 24999: { - name: "AttachedFile", - cppname: "Attached", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "An attached file." - }, - 25152: { - name: "ContentEncoding", - level: 4, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Settings for one content encoding like compression or encryption." - }, - 25188: { - name: "BitDepth", - cppname: "AudioBitDepth", - level: 4, - type: "u", - range: "not 0", - description: "Bits per sample, mostly used for PCM." - }, - 25506: { - name: "CodecPrivate", - level: 3, - type: "b", - description: "Private data only known to the codec." - }, - 25536: { - name: "Targets", - cppname: "TagTargets", - level: 3, - type: "m", - mandatory: true, - webm: true, - description: "Specifies which other elements the metadata represented by the Tag applies to. If empty or not present, then the Tag describes everything in the Segment." - }, - 25539: { - name: "ChapterPhysicalEquiv", - level: 4, - type: "u", - description: 'Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50); see (#physical-types) for a complete list of values.' - }, - 25540: { - name: "TagChapterUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the Chapter(s) the tags belong to." - }, - 25541: { - name: "TagTrackUID", - level: 4, - type: "u", - multiple: true, - webm: true, - "default": "0", - description: "A unique ID to identify the Track(s) the tags belong to." - }, - 25542: { - name: "TagAttachmentUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the Attachment(s) the tags belong to." - }, - 25545: { - name: "TagEditionUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the EditionEntry(s) the tags belong to." - }, - 25546: { - name: "TargetType", - cppname: "TagTargetType", - level: 4, - type: "s", - webm: true, - description: 'An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc ; see Section 6.4 of [@!MatroskaTags].' - }, - 25906: { - name: "SignedElement", - level: 3, - type: "b", - multiple: true, - webm: false, - description: "An element ID whose data will be used to compute the signature." - }, - 26148: { - name: "TrackTranslate", - level: 3, - type: "m", - multiple: true, - description: "The mapping between this `TrackEntry` and a track value in the given Chapter Codec." - }, - 26277: { - name: "TrackTranslateTrackID", - level: 4, - type: "b", - mandatory: true, - description: "The binary value used to represent this `TrackEntry` in the chapter codec data. The format depends on the `ChapProcessCodecID` used; see (#chapprocesscodecid-element)." - }, - 26303: { - name: "TrackTranslateCodec", - level: 4, - type: "u", - mandatory: true, - description: "This `TrackTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)." - }, - 26364: { - name: "TrackTranslateEditionUID", - level: 4, - type: "u", - multiple: true, - description: "Specify a chapter edition UID on which this `TrackTranslate` applies." - }, - 26568: { - name: "SimpleTag", - cppname: "TagSimple", - level: 3, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains general information about the target." - }, - 26826: { - name: "TargetTypeValue", - cppname: "TagTargetTypeValue", - level: 4, - type: "u", - mandatory: true, - webm: true, - "default": "50", - description: "A number to indicate the logical level of the target." - }, - 26897: { - name: "ChapProcessCommand", - cppname: "ChapterProcessCommand", - level: 5, - type: "m", - multiple: true, - description: "Contains all the commands associated to the Atom." - }, - 26914: { - name: "ChapProcessTime", - cppname: "ChapterProcessTime", - level: 6, - type: "u", - mandatory: true, - description: "Defines when the process command **SHOULD** be handled" - }, - 26916: { - name: "ChapterTranslate", - level: 2, - type: "m", - multiple: true, - description: "The mapping between this `Segment` and a segment value in the given Chapter Codec." - }, - 26931: { - name: "ChapProcessData", - cppname: "ChapterProcessData", - level: 6, - type: "b", - mandatory: true, - description: "Contains the command information. The data **SHOULD** be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands; see (#menu-features) on DVD menus." - }, - 26948: { - name: "ChapProcess", - cppname: "ChapterProcess", - level: 4, - type: "m", - multiple: true, - description: "Contains all the commands associated to the Atom." - }, - 26965: { - name: "ChapProcessCodecID", - cppname: "ChapterProcessCodecID", - level: 5, - type: "u", - mandatory: true, - "default": "0", - description: "Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used; see (#menu-features) on DVD menus. More codec IDs can be added later." - }, - 27045: { - name: "ChapterTranslateID", - level: 3, - type: "b", - mandatory: true, - description: "The binary value used to represent this Segment in the chapter codec data. The format depends on the ChapProcessCodecID used; see (#chapprocesscodecid-element)." - }, - 27071: { - name: "ChapterTranslateCodec", - level: 3, - type: "u", - mandatory: true, - description: "This `ChapterTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)." - }, - 27132: { - name: "ChapterTranslateEditionUID", - level: 3, - type: "u", - multiple: true, - description: "Specify a chapter edition UID on which this `ChapterTranslate` applies." - }, - 28032: { - name: "ContentEncodings", - level: 3, - type: "m", - webm: true, - description: "Settings for several content encoding mechanisms like compression or encryption." - }, - 28135: { - name: "MinCache", - cppname: "TrackMinCache", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "The minimum number of frames a player **SHOULD** be able to cache during playback. If set to 0, the reference pseudo-cache system is not used." - }, - 28152: { - name: "MaxCache", - cppname: "TrackMaxCache", - level: 3, - type: "u", - description: "The maximum cache size necessary to store referenced frames in and the current frame. 0 means no cache is needed." - }, - 28263: { - name: "ChapterSegmentUID", - level: 4, - type: "b", - range: ">0", - description: "The SegmentUID of another Segment to play during this chapter." - }, - 28348: { - name: "ChapterSegmentEditionUID", - level: 4, - type: "u", - range: "not 0", - description: "The EditionUID to play from the Segment linked in ChapterSegmentUID. If ChapterSegmentEditionUID is undeclared, then no Edition of the linked Segment is used; see (#medium-linking) on medium-linking Segments." - }, - 28587: { - name: "TrackOverlay", - level: 3, - type: "u", - multiple: true, - description: "Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap, see (#silenttracks-element) on SilentTracks, the overlay track **SHOULD** be used instead. The order of multiple TrackOverlay matters, the first one is the one that **SHOULD** be used. If not found it **SHOULD** be the second, etc." - }, - 29555: { - name: "Tag", - level: 2, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "A single metadata descriptor." - }, - 29572: { - name: "SegmentFilename", - level: 2, - type: "8", - description: "A filename corresponding to this Segment." - }, - 29604: { - name: "SegmentUID", - level: 2, - type: "b", - range: "not 0", - description: "A randomly generated unique ID to identify the Segment amongst many others (128 bits)." - }, - 29636: { - name: "ChapterUID", - level: 4, - type: "u", - mandatory: true, - webm: true, - range: "not 0", - description: "A unique ID to identify the Chapter." - }, - 29637: { - name: "TrackUID", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "A unique ID to identify the Track." - }, - 29766: { - name: "AttachmentLink", - cppname: "TrackAttachmentLink", - level: 3, - type: "u", - maxver: 3, - range: "not 0", - description: "The UID of an attachment that is used by this codec." - }, - 30113: { - name: "BlockAdditions", - level: 3, - type: "m", - webm: true, - description: "Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data." - }, - 30114: { - name: "DiscardPadding", - level: 3, - type: "i", - minver: 4, - webm: true, - description: "Duration of the silent data added to the Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and **SHOULD** be discarded during playback." - }, - 30320: { - name: "Projection", - cppname: "VideoProjection", - level: 4, - type: "m", - minver: 4, - webm: true, - description: "Describes the video projection details. Used to render spherical, VR videos or flipping videos horizontally/vertically." - }, - 30321: { - name: "ProjectionType", - cppname: "VideoProjectionType", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Describes the projection used for this video track." - }, - 30322: { - name: "ProjectionPrivate", - cppname: "VideoProjectionPrivate", - level: 5, - type: "b", - minver: 4, - webm: true, - description: "Private data that only applies to a specific projection. * If `ProjectionType` equals 0 (Rectangular), then this element must not be present. * If `ProjectionType` equals 1 (Equirectangular), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Equirectangular Projection Box ('equi'). * If `ProjectionType` equals 2 (Cubemap), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Cubemap Projection Box ('cbmp'). * If `ProjectionType` equals 3 (Mesh), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Mesh Projection Box ('mshp')." - }, - 30323: { - name: "ProjectionPoseYaw", - cppname: "VideoProjectionPoseYaw", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0xB4p+0, <= 0xB4p+0", - description: "Specifies a yaw rotation to the projection. Value represents a clockwise rotation, in degrees, around the up vector. This rotation must be applied before any `ProjectionPosePitch` or `ProjectionPoseRoll` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseYaw` to 180 or -180 degrees, with the `ProjectionPoseRoll` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally." - }, - 30324: { - name: "ProjectionPosePitch", - cppname: "VideoProjectionPosePitch", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0x5Ap+0, <= 0x5Ap+0", - description: "Specifies a pitch rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the right vector. This rotation must be applied after the `ProjectionPoseYaw` rotation and before the `ProjectionPoseRoll` rotation. The value of this element **MUST** be in the -90 to 90 degree range, both included." - }, - 30325: { - name: "ProjectionPoseRoll", - cppname: "VideoProjectionPoseRoll", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0xB4p+0, <= 0xB4p+0", - description: "Specifies a roll rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the forward vector. This rotation must be applied after the `ProjectionPoseYaw` and `ProjectionPosePitch` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseRoll` to 180 or -180 degrees, the `ProjectionPoseYaw` to 180 or -180 degrees with `ProjectionPosePitch` set to 0 degrees flips the image vertically. Setting `ProjectionPoseRoll` to 180 or -180 degrees, with the `ProjectionPoseYaw` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally and vertically." - }, - 30901: { - name: "OutputSamplingFrequency", - cppname: "AudioOutputSamplingFreq", - level: 4, - type: "f", - range: "> 0x0p+0", - description: "Real output sampling frequency in Hz (used for SBR techniques)." - }, - 31657: { - name: "Title", - level: 2, - type: "8", - webm: true, - description: "General name of the Segment." - }, - 32123: { - name: "ChannelPositions", - cppname: "AudioPosition", - level: 4, - type: "b", - minver: 0, - maxver: 0, - description: "Table of horizontal angles for each successive channel." - }, - 32347: { - name: "SignatureElements", - level: 1, - type: "m", - webm: false, - description: "Contains elements that will be used to compute the signature." - }, - 32379: { - name: "SignatureElementList", - level: 2, - type: "m", - multiple: true, - webm: false, - i: "Cluster|Block|BlockAdditional", - description: "A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption." - }, - 32394: { - name: "SignatureAlgo", - level: 1, - type: "u", - webm: false, - description: "Signature algorithm used (1=RSA, 2=elliptic)." - }, - 32410: { - name: "SignatureHash", - level: 1, - type: "u", - webm: false, - description: "Hash algorithm used (1=SHA1-160, 2=MD5)." - }, - 32421: { - name: "SignaturePublicKey", - level: 1, - type: "b", - webm: false, - description: "The public key to use with the algorithm (in the case of a PKI-based signature)." - }, - 32437: { - name: "Signature", - level: 1, - type: "b", - webm: false, - description: "The signature of the data (until a new." - }, - 2274716: { - name: "Language", - cppname: "TrackLanguage", - level: 3, - type: "s", - mandatory: true, - "default": "eng", - description: "Specifies the language of the track in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the LanguageIETF Element is used in the same TrackEntry." - }, - 2274717: { - name: "LanguageIETF", - level: 3, - type: "s", - minver: 4, - description: "Specifies the language of the track according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any Language Elements used in the same TrackEntry **MUST** be ignored." - }, - 2306383: { - name: "TrackTimestampScale", - cppname: "TrackTimecodeScale", - level: 3, - type: "f", - mandatory: true, - maxver: 3, - "default": "0x1p+0", - range: "> 0x0p+0", - description: "DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs)." - }, - 2313850: { - name: "DefaultDecodedFieldDuration", - cppname: "TrackDefaultDecodedFieldDuration", - level: 3, - type: "u", - minver: 4, - range: "not 0", - description: "The period between two successive fields at the output of the decoding process, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). see (#defaultdecodedfieldduration) for more information" - }, - 2327523: { - name: "FrameRate", - cppname: "VideoFrameRate", - level: 4, - type: "f", - minver: 0, - maxver: 0, - range: "> 0x0p+0", - description: "Number of frames per second. This value is Informational only. It is intended for constant frame rate streams, and **SHOULD NOT** be used for a variable frame rate TrackEntry." - }, - 2352003: { - name: "DefaultDuration", - cppname: "TrackDefaultDuration", - level: 3, - type: "u", - range: "not 0", - description: "Number of nanoseconds per frame, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (frame in the Matroska sense -- one Element put into a (Simple)Block)." - }, - 2459272: { - name: "CodecName", - level: 3, - type: "8", - description: "A human-readable string specifying the codec." - }, - 2536e3: { - name: "CodecDownloadURL", - level: 3, - type: "s", - multiple: true, - minver: 0, - maxver: 0, - description: "A URL to download about the codec used." - }, - 2807729: { - name: "TimestampScale", - cppname: "TimecodeScale", - level: 2, - type: "u", - mandatory: true, - "default": "1000000", - range: "not 0", - description: "Base unit for Segment Ticks and Track Ticks, in nanoseconds. A TimestampScale value of 1.000.000 means scaled timestamps in the Segment are expressed in milliseconds; see (#timestamps) on how to interpret timestamps." - }, - 2807730: { - name: "TimecodeScaleDenominator", - level: 2, - type: "u", - mandatory: true, - minver: 4, - "default": "1000000000", - description: "Timestamp scale numerator, see TimecodeScale." - }, - 3061028: { - name: "UncompressedFourCC", - cppname: "VideoColourSpace", - level: 4, - type: "b", - description: "Specify the uncompressed pixel format used for the Track's data as a FourCC. This value is similar in scope to the biCompression value of AVI's `BITMAPINFO` [@?AVIFormat]. See the YUV video formats [@?FourCC-YUV] and RGB video formats [@?FourCC-RGB] for common values." - }, - 3126563: { - name: "GammaValue", - cppname: "VideoGamma", - level: 4, - type: "f", - minver: 0, - maxver: 0, - range: "> 0x0p+0", - description: "Gamma Value." - }, - 3839639: { - name: "CodecSettings", - level: 3, - type: "8", - minver: 0, - maxver: 0, - description: "A string describing the encoding setting used." - }, - 3883072: { - name: "CodecInfoURL", - level: 3, - type: "s", - multiple: true, - minver: 0, - maxver: 0, - description: "A URL to find information about the codec used." - }, - 3965867: { - name: "PrevFilename", - level: 2, - type: "8", - description: "A filename corresponding to the file of the previous Linked Segment." - }, - 3979555: { - name: "PrevUID", - level: 2, - type: "b", - description: "A unique ID to identify the previous Segment of a Linked Segment (128 bits)." - }, - 4096955: { - name: "NextFilename", - level: 2, - type: "8", - description: "A filename corresponding to the file of the next Linked Segment." - }, - 4110627: { - name: "NextUID", - level: 2, - type: "b", - description: "A unique ID to identify the next Segment of a Linked Segment (128 bits)." - }, - 272869232: { - name: "Chapters", - level: 1, - type: "m", - webm: true, - description: "A system to define basic menus and partition data. For more detailed information, look at the Chapters explanation in (#chapters)." - }, - 290298740: { - name: "SeekHead", - level: 1, - type: "m", - multiple: true, - description: "Contains the Segment Position of other Top-Level Elements." - }, - 307544935: { - name: "Tags", - level: 1, - type: "m", - multiple: true, - webm: true, - description: "Element containing metadata describing Tracks, Editions, Chapters, Attachments, or the Segment as a whole. A list of valid tags can be found in [@!MatroskaTags]." - }, - 357149030: { - name: "Info", - level: 1, - type: "m", - mandatory: true, - description: "Contains general information about the Segment." - }, - 374648427: { - name: "Tracks", - level: 1, - type: "m", - description: "A Top-Level Element of information with many tracks described." - }, - 408125543: { - name: "Segment", - level: 0, - type: "m", - mandatory: true, - description: "The Root Element that contains all other Top-Level Elements (Elements defined only at Level 1). A Matroska file is composed of 1 Segment." - }, - 423732329: { - name: "Attachments", - level: 1, - type: "m", - description: "Contain attached files." - }, - 440786851: { - name: "EBML", - level: "0", - type: "m", - mandatory: true, - multiple: true, - minver: 1, - description: "Set the EBML characteristics of the data to follow. Each EBML document has to start with this." - }, - 458458727: { - name: "SignatureSlot", - level: -1, - type: "m", - multiple: true, - webm: false, - description: "Contain signature of some (coming) elements in the stream." - }, - 475249515: { - name: "Cues", - level: 1, - type: "m", - description: "A Top-Level Element to speed seeking access. All entries are local to the Segment." - }, - 524531317: { - name: "Cluster", - level: 1, - type: "m", - multiple: true, - description: "The Top-Level Element containing the (monolithic) Block structure." - } - }; - var byName = {}; - var schema = { - byEbmlID, - byName - }; - for (ebmlID in byEbmlID) { - desc = byEbmlID[ebmlID]; - byName[desc.name.replace("-", "_")] = parseInt(ebmlID, 10); - } - var desc; - var ebmlID; - module.exports = schema; - } - }); - - // node_modules/ts-ebml/lib/EBMLEncoder.js - var require_EBMLEncoder = __commonJS({ - "node_modules/ts-ebml/lib/EBMLEncoder.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var tools = require_tools2(); - var tools_1 = require_tools2(); - var schema = require_schema(); - var byEbmlID = schema.byEbmlID; - var EBMLEncoder = function() { - function EBMLEncoder2() { - this._schema = byEbmlID; - this._buffers = []; - this._stack = []; - } - EBMLEncoder2.prototype.encode = function(elms) { - var _this = this; - return tools.concat(elms.reduce(function(lst, elm) { - return lst.concat(_this.encodeChunk(elm)); - }, [])).buffer; - }; - EBMLEncoder2.prototype.encodeChunk = function(elm) { - if (elm.type === "m") { - if (!elm.isEnd) { - this.startTag(elm); - } else { - this.endTag(elm); - } - } else { - this.writeTag(elm); - } - return this.flush(); - }; - EBMLEncoder2.prototype.flush = function() { - var ret = this._buffers; - this._buffers = []; - return ret; - }; - EBMLEncoder2.prototype.getSchemaInfo = function(tagName) { - var tagNums = Object.keys(this._schema).map(Number); - for (var i = 0; i < tagNums.length; i++) { - var tagNum = tagNums[i]; - if (this._schema[tagNum].name === tagName) { - return new tools_1.Buffer(tagNum.toString(16), "hex"); - } - } - return null; - }; - EBMLEncoder2.prototype.writeTag = function(elm) { - var tagName = elm.name; - var tagId = this.getSchemaInfo(tagName); - var tagData = elm.data; - if (tagId == null) { - throw new Error("No schema entry found for " + tagName); - } - var data = tools.encodeTag(tagId, tagData); - if (this._stack.length > 0) { - var last = this._stack[this._stack.length - 1]; - last.children.push({ - tagId, - elm, - children: [], - data - }); - return; - } - this._buffers = this._buffers.concat(data); - return; - }; - EBMLEncoder2.prototype.startTag = function(elm) { - var tagName = elm.name; - var tagId = this.getSchemaInfo(tagName); - if (tagId == null) { - throw new Error("No schema entry found for " + tagName); - } - if (elm.unknownSize) { - var data = tools.encodeTag(tagId, new tools_1.Buffer(0), elm.unknownSize); - this._buffers = this._buffers.concat(data); - return; - } - var tag = { - tagId, - elm, - children: [], - data: null - }; - if (this._stack.length > 0) { - this._stack[this._stack.length - 1].children.push(tag); - } - this._stack.push(tag); - }; - EBMLEncoder2.prototype.endTag = function(elm) { - var tagName = elm.name; - var tag = this._stack.pop(); - if (tag == null) { - throw new Error("EBML structure is broken"); - } - if (tag.elm.name !== elm.name) { - throw new Error("EBML structure is broken"); - } - var childTagDataBuffers = tag.children.reduce(function(lst, child) { - if (child.data === null) { - throw new Error("EBML structure is broken"); - } - return lst.concat(child.data); - }, []); - var childTagDataBuffer = tools.concat(childTagDataBuffers); - if (tag.elm.type === "m") { - tag.data = tools.encodeTag(tag.tagId, childTagDataBuffer, tag.elm.unknownSize); - } else { - tag.data = tools.encodeTag(tag.tagId, childTagDataBuffer); - } - if (this._stack.length < 1) { - this._buffers = this._buffers.concat(tag.data); - } - }; - return EBMLEncoder2; - }(); - exports.default = EBMLEncoder; - } - }); - - // node_modules/ts-ebml/node_modules/buffer/index.js - var require_buffer2 = __commonJS({ - "node_modules/ts-ebml/node_modules/buffer/index.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var base64 = require_base64_js(); - var ieee7542 = require_ieee754(); - var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer18; - exports.SlowBuffer = SlowBuffer; - exports.INSPECT_MAX_BYTES = 50; - var K_MAX_LENGTH = 2147483647; - exports.kMaxLength = K_MAX_LENGTH; - Buffer18.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer18.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { - console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); - } - function typedArraySupport() { - try { - var arr = new Uint8Array(1); - var proto = { foo: function() { - return 42; - } }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; - } - } - Object.defineProperty(Buffer18.prototype, "parent", { - enumerable: true, - get: function() { - if (!Buffer18.isBuffer(this)) - return void 0; - return this.buffer; - } - }); - Object.defineProperty(Buffer18.prototype, "offset", { - enumerable: true, - get: function() { - if (!Buffer18.isBuffer(this)) - return void 0; - return this.byteOffset; - } - }); - function createBuffer(length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"'); - } - var buf2 = new Uint8Array(length); - Object.setPrototypeOf(buf2, Buffer18.prototype); - return buf2; - } - function Buffer18(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - if (typeof encodingOrOffset === "string") { - throw new TypeError('The "string" argument must be of type string. Received type number'); - } - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); - } - Buffer18.poolSize = 8192; - function from(value, encodingOrOffset, length) { - if (typeof value === "string") { - return fromString(value, encodingOrOffset); - } - if (ArrayBuffer.isView(value)) { - return fromArrayView(value); - } - if (value == null) { - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof value === "number") { - throw new TypeError('The "value" argument must not be of type number. Received type number'); - } - var valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) { - return Buffer18.from(valueOf, encodingOrOffset, length); - } - var b = fromObject(value); - if (b) - return b; - if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer18.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); - } - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - Buffer18.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); - }; - Object.setPrototypeOf(Buffer18.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer18, Uint8Array); - function assertSize(size) { - if (typeof size !== "number") { - throw new TypeError('"size" argument must be of type number'); - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"'); - } - } - function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) { - return createBuffer(size); - } - if (fill !== void 0) { - return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - } - return createBuffer(size); - } - Buffer18.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); - }; - function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); - } - Buffer18.allocUnsafe = function(size) { - return allocUnsafe(size); - }; - Buffer18.allocUnsafeSlow = function(size) { - return allocUnsafe(size); - }; - function fromString(string, encoding) { - if (typeof encoding !== "string" || encoding === "") { - encoding = "utf8"; - } - if (!Buffer18.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - var length = byteLength(string, encoding) | 0; - var buf2 = createBuffer(length); - var actual = buf2.write(string, encoding); - if (actual !== length) { - buf2 = buf2.slice(0, actual); - } - return buf2; - } - function fromArrayLike(array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0; - var buf2 = createBuffer(length); - for (var i = 0; i < length; i += 1) { - buf2[i] = array[i] & 255; - } - return buf2; - } - function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - var copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); - } - function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds'); - } - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds'); - } - var buf2; - if (byteOffset === void 0 && length === void 0) { - buf2 = new Uint8Array(array); - } else if (length === void 0) { - buf2 = new Uint8Array(array, byteOffset); - } else { - buf2 = new Uint8Array(array, byteOffset, length); - } - Object.setPrototypeOf(buf2, Buffer18.prototype); - return buf2; - } - function fromObject(obj) { - if (Buffer18.isBuffer(obj)) { - var len = checked(obj.length) | 0; - var buf2 = createBuffer(len); - if (buf2.length === 0) { - return buf2; - } - obj.copy(buf2, 0, 0, len); - return buf2; - } - if (obj.length !== void 0) { - if (typeof obj.length !== "number" || numberIsNaN(obj.length)) { - return createBuffer(0); - } - return fromArrayLike(obj); - } - if (obj.type === "Buffer" && Array.isArray(obj.data)) { - return fromArrayLike(obj.data); - } - } - function checked(length) { - if (length >= K_MAX_LENGTH) { - throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes"); - } - return length | 0; - } - function SlowBuffer(length) { - if (+length != length) { - length = 0; - } - return Buffer18.alloc(+length); - } - Buffer18.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer18.prototype; - }; - Buffer18.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) - a = Buffer18.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) - b = Buffer18.from(b, b.offset, b.byteLength); - if (!Buffer18.isBuffer(a) || !Buffer18.isBuffer(b)) { - throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - } - if (a === b) - return 0; - var x = a.length; - var y = b.length; - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) - return -1; - if (y < x) - return 1; - return 0; - }; - Buffer18.isEncoding = function isEncoding(encoding) { - switch (String(encoding).toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "latin1": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return true; - default: - return false; - } - }; - Buffer18.concat = function concat(list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } - if (list.length === 0) { - return Buffer18.alloc(0); - } - var i; - if (length === void 0) { - length = 0; - for (i = 0; i < list.length; ++i) { - length += list[i].length; - } - } - var buffer = Buffer18.allocUnsafe(length); - var pos = 0; - for (i = 0; i < list.length; ++i) { - var buf2 = list[i]; - if (isInstance(buf2, Uint8Array)) { - if (pos + buf2.length > buffer.length) { - Buffer18.from(buf2).copy(buffer, pos); - } else { - Uint8Array.prototype.set.call(buffer, buf2, pos); - } - } else if (!Buffer18.isBuffer(buf2)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } else { - buf2.copy(buffer, pos); - } - pos += buf2.length; - } - return buffer; - }; - function byteLength(string, encoding) { - if (Buffer18.isBuffer(string)) { - return string.length; - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength; - } - if (typeof string !== "string") { - throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - } - var len = string.length; - var mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) - return 0; - var loweredCase = false; - for (; ; ) { - switch (encoding) { - case "ascii": - case "latin1": - case "binary": - return len; - case "utf8": - case "utf-8": - return utf8ToBytes(string).length; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return len * 2; - case "hex": - return len >>> 1; - case "base64": - return base64ToBytes(string).length; - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length; - } - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - } - Buffer18.byteLength = byteLength; - function slowToString(encoding, start, end) { - var loweredCase = false; - if (start === void 0 || start < 0) { - start = 0; - } - if (start > this.length) { - return ""; - } - if (end === void 0 || end > this.length) { - end = this.length; - } - if (end <= 0) { - return ""; - } - end >>>= 0; - start >>>= 0; - if (end <= start) { - return ""; - } - if (!encoding) - encoding = "utf8"; - while (true) { - switch (encoding) { - case "hex": - return hexSlice(this, start, end); - case "utf8": - case "utf-8": - return utf8Slice(this, start, end); - case "ascii": - return asciiSlice(this, start, end); - case "latin1": - case "binary": - return latin1Slice(this, start, end); - case "base64": - return base64Slice(this, start, end); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return utf16leSlice(this, start, end); - default: - if (loweredCase) - throw new TypeError("Unknown encoding: " + encoding); - encoding = (encoding + "").toLowerCase(); - loweredCase = true; - } - } - } - Buffer18.prototype._isBuffer = true; - function swap(b, n, m) { - var i = b[n]; - b[n] = b[m]; - b[m] = i; - } - Buffer18.prototype.swap16 = function swap16() { - var len = this.length; - if (len % 2 !== 0) { - throw new RangeError("Buffer size must be a multiple of 16-bits"); - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1); - } - return this; - }; - Buffer18.prototype.swap32 = function swap32() { - var len = this.length; - if (len % 4 !== 0) { - throw new RangeError("Buffer size must be a multiple of 32-bits"); - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3); - swap(this, i + 1, i + 2); - } - return this; - }; - Buffer18.prototype.swap64 = function swap64() { - var len = this.length; - if (len % 8 !== 0) { - throw new RangeError("Buffer size must be a multiple of 64-bits"); - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); - } - return this; - }; - Buffer18.prototype.toString = function toString2() { - var length = this.length; - if (length === 0) - return ""; - if (arguments.length === 0) - return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); - }; - Buffer18.prototype.toLocaleString = Buffer18.prototype.toString; - Buffer18.prototype.equals = function equals(b) { - if (!Buffer18.isBuffer(b)) - throw new TypeError("Argument must be a Buffer"); - if (this === b) - return true; - return Buffer18.compare(this, b) === 0; - }; - Buffer18.prototype.inspect = function inspect() { - var str = ""; - var max = exports.INSPECT_MAX_BYTES; - str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); - if (this.length > max) - str += " ... "; - return ""; - }; - if (customInspectSymbol) { - Buffer18.prototype[customInspectSymbol] = Buffer18.prototype.inspect; - } - Buffer18.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer18.from(target, target.offset, target.byteLength); - } - if (!Buffer18.isBuffer(target)) { - throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - } - if (start === void 0) { - start = 0; - } - if (end === void 0) { - end = target ? target.length : 0; - } - if (thisStart === void 0) { - thisStart = 0; - } - if (thisEnd === void 0) { - thisEnd = this.length; - } - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError("out of range index"); - } - if (thisStart >= thisEnd && start >= end) { - return 0; - } - if (thisStart >= thisEnd) { - return -1; - } - if (start >= end) { - return 1; - } - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) - return 0; - var x = thisEnd - thisStart; - var y = end - start; - var len = Math.min(x, y); - var thisCopy = this.slice(thisStart, thisEnd); - var targetCopy = target.slice(start, end); - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; - } - } - if (x < y) - return -1; - if (y < x) - return 1; - return 0; - }; - function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - if (buffer.length === 0) - return -1; - if (typeof byteOffset === "string") { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 2147483647) { - byteOffset = 2147483647; - } else if (byteOffset < -2147483648) { - byteOffset = -2147483648; - } - byteOffset = +byteOffset; - if (numberIsNaN(byteOffset)) { - byteOffset = dir ? 0 : buffer.length - 1; - } - if (byteOffset < 0) - byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) - return -1; - else - byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) - byteOffset = 0; - else - return -1; - } - if (typeof val === "string") { - val = Buffer18.from(val, encoding); - } - if (Buffer18.isBuffer(val)) { - if (val.length === 0) { - return -1; - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === "number") { - val = val & 255; - if (typeof Uint8Array.prototype.indexOf === "function") { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); - } - throw new TypeError("val must be string, number or Buffer"); - } - function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - var indexSize = 1; - var arrLength = arr.length; - var valLength = val.length; - if (encoding !== void 0) { - encoding = String(encoding).toLowerCase(); - if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { - if (arr.length < 2 || val.length < 2) { - return -1; - } - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read2(buf2, i2) { - if (indexSize === 1) { - return buf2[i2]; - } else { - return buf2.readUInt16BE(i2 * indexSize); - } - } - var i; - if (dir) { - var foundIndex = -1; - for (i = byteOffset; i < arrLength; i++) { - if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) - foundIndex = i; - if (i - foundIndex + 1 === valLength) - return foundIndex * indexSize; - } else { - if (foundIndex !== -1) - i -= i - foundIndex; - foundIndex = -1; - } - } - } else { - if (byteOffset + valLength > arrLength) - byteOffset = arrLength - valLength; - for (i = byteOffset; i >= 0; i--) { - var found = true; - for (var j = 0; j < valLength; j++) { - if (read2(arr, i + j) !== read2(val, j)) { - found = false; - break; - } - } - if (found) - return i; - } - } - return -1; - } - Buffer18.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; - }; - Buffer18.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); - }; - Buffer18.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); - }; - function hexWrite(buf2, string, offset, length) { - offset = Number(offset) || 0; - var remaining = buf2.length - offset; - if (!length) { - length = remaining; - } else { - length = Number(length); - if (length > remaining) { - length = remaining; - } - } - var strLen = string.length; - if (length > strLen / 2) { - length = strLen / 2; - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) - return i; - buf2[offset + i] = parsed; - } - return i; - } - function utf8Write(buf2, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf2.length - offset), buf2, offset, length); - } - function asciiWrite(buf2, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf2, offset, length); - } - function base64Write(buf2, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf2, offset, length); - } - function ucs2Write(buf2, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length); - } - Buffer18.prototype.write = function write2(string, offset, length, encoding) { - if (offset === void 0) { - encoding = "utf8"; - length = this.length; - offset = 0; - } else if (length === void 0 && typeof offset === "string") { - encoding = offset; - length = this.length; - offset = 0; - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === void 0) - encoding = "utf8"; - } else { - encoding = length; - length = void 0; - } - } else { - throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); - } - var remaining = this.length - offset; - if (length === void 0 || length > remaining) - length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { - throw new RangeError("Attempt to write outside buffer bounds"); - } - if (!encoding) - encoding = "utf8"; - var loweredCase = false; - for (; ; ) { - switch (encoding) { - case "hex": - return hexWrite(this, string, offset, length); - case "utf8": - case "utf-8": - return utf8Write(this, string, offset, length); - case "ascii": - case "latin1": - case "binary": - return asciiWrite(this, string, offset, length); - case "base64": - return base64Write(this, string, offset, length); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) - throw new TypeError("Unknown encoding: " + encoding); - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - }; - Buffer18.prototype.toJSON = function toJSON() { - return { - type: "Buffer", - data: Array.prototype.slice.call(this._arr || this, 0) - }; - }; - function base64Slice(buf2, start, end) { - if (start === 0 && end === buf2.length) { - return base64.fromByteArray(buf2); - } else { - return base64.fromByteArray(buf2.slice(start, end)); - } - } - function utf8Slice(buf2, start, end) { - end = Math.min(buf2.length, end); - var res = []; - var i = start; - while (i < end) { - var firstByte = buf2[i]; - var codePoint = null; - var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint; - switch (bytesPerSequence) { - case 1: - if (firstByte < 128) { - codePoint = firstByte; - } - break; - case 2: - secondByte = buf2[i + 1]; - if ((secondByte & 192) === 128) { - tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; - if (tempCodePoint > 127) { - codePoint = tempCodePoint; - } - } - break; - case 3: - secondByte = buf2[i + 1]; - thirdByte = buf2[i + 2]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; - if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { - codePoint = tempCodePoint; - } - } - break; - case 4: - secondByte = buf2[i + 1]; - thirdByte = buf2[i + 2]; - fourthByte = buf2[i + 3]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; - if (tempCodePoint > 65535 && tempCodePoint < 1114112) { - codePoint = tempCodePoint; - } - } - } - } - if (codePoint === null) { - codePoint = 65533; - bytesPerSequence = 1; - } else if (codePoint > 65535) { - codePoint -= 65536; - res.push(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); - } - var MAX_ARGUMENTS_LENGTH = 4096; - function decodeCodePointsArray(codePoints) { - var len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints); - } - var res = ""; - var i = 0; - while (i < len) { - res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - } - return res; - } - function asciiSlice(buf2, start, end) { - var ret = ""; - end = Math.min(buf2.length, end); - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf2[i] & 127); - } - return ret; - } - function latin1Slice(buf2, start, end) { - var ret = ""; - end = Math.min(buf2.length, end); - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf2[i]); - } - return ret; - } - function hexSlice(buf2, start, end) { - var len = buf2.length; - if (!start || start < 0) - start = 0; - if (!end || end < 0 || end > len) - end = len; - var out = ""; - for (var i = start; i < end; ++i) { - out += hexSliceLookupTable[buf2[i]]; - } - return out; - } - function utf16leSlice(buf2, start, end) { - var bytes = buf2.slice(start, end); - var res = ""; - for (var i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - } - return res; - } - Buffer18.prototype.slice = function slice(start, end) { - var len = this.length; - start = ~~start; - end = end === void 0 ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) - start = 0; - } else if (start > len) { - start = len; - } - if (end < 0) { - end += len; - if (end < 0) - end = 0; - } else if (end > len) { - end = len; - } - if (end < start) - end = start; - var newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer18.prototype); - return newBuf; - }; - function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) - throw new RangeError("offset is not uint"); - if (offset + ext > length) - throw new RangeError("Trying to access beyond buffer length"); - } - Buffer18.prototype.readUintLE = Buffer18.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - return val; - }; - Buffer18.prototype.readUintBE = Buffer18.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - checkOffset(offset, byteLength2, this.length); - } - var val = this[offset + --byteLength2]; - var mul = 1; - while (byteLength2 > 0 && (mul *= 256)) { - val += this[offset + --byteLength2] * mul; - } - return val; - }; - Buffer18.prototype.readUint8 = Buffer18.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 1, this.length); - return this[offset]; - }; - Buffer18.prototype.readUint16LE = Buffer18.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; - }; - Buffer18.prototype.readUint16BE = Buffer18.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; - }; - Buffer18.prototype.readUint32LE = Buffer18.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; - }; - Buffer18.prototype.readUint32BE = Buffer18.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); - }; - Buffer18.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; + Readable.prototype.read = function(n) { + debug("read", n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) + state.emittedReadable = false; + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug("read: emitReadable", state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); + return null; } - mul *= 128; - if (val >= mul) - val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer18.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var i = byteLength2; - var mul = 1; - var val = this[offset + --i]; - while (i > 0 && (mul *= 256)) { - val += this[offset + --i] * mul; + n = howMuchToRead(n, state); + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; } - mul *= 128; - if (val >= mul) - val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer18.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 1, this.length); - if (!(this[offset] & 128)) - return this[offset]; - return (255 - this[offset] + 1) * -1; - }; - Buffer18.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - var val = this[offset] | this[offset + 1] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer18.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - var val = this[offset + 1] | this[offset] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer18.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; - }; - Buffer18.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; - }; - Buffer18.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return ieee7542.read(this, offset, true, 23, 4); - }; - Buffer18.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return ieee7542.read(this, offset, false, 23, 4); - }; - Buffer18.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 8, this.length); - return ieee7542.read(this, offset, true, 52, 8); - }; - Buffer18.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 8, this.length); - return ieee7542.read(this, offset, false, 52, 8); - }; - function checkInt(buf2, value, offset, ext, max, min) { - if (!Buffer18.isBuffer(buf2)) - throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) - throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf2.length) - throw new RangeError("Index out of range"); - } - Buffer18.prototype.writeUintLE = Buffer18.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); + var doRead = state.needReadable; + debug("need readable", doRead); + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug("length less than watermark", doRead); } - var mul = 1; - var i = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - this[offset + i] = value / mul & 255; + if (state.ended || state.reading) { + doRead = false; + debug("reading or ended", doRead); + } else if (doRead) { + debug("do read"); + state.reading = true; + state.sync = true; + if (state.length === 0) + state.needReadable = true; + this._read(state.highWaterMark); + state.sync = false; + if (!state.reading) + n = howMuchToRead(nOrig, state); } - return offset + byteLength2; - }; - Buffer18.prototype.writeUintBE = Buffer18.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; } - var i = byteLength2 - 1; - var mul = 1; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - this[offset + i] = value / mul & 255; + if (state.length === 0) { + if (!state.ended) + state.needReadable = true; + if (nOrig !== n && state.ended) + endReadable(this); } - return offset + byteLength2; - }; - Buffer18.prototype.writeUint8 = Buffer18.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 1, 255, 0); - this[offset] = value & 255; - return offset + 1; - }; - Buffer18.prototype.writeUint16LE = Buffer18.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer18.prototype.writeUint16BE = Buffer18.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer18.prototype.writeUint32LE = Buffer18.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 4294967295, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 255; - return offset + 4; - }; - Buffer18.prototype.writeUint32BE = Buffer18.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 4294967295, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; + if (ret !== null) + this.emit("data", ret); + return ret; }; - Buffer18.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); + function onEofChunk(stream, state) { + debug("onEofChunk"); + if (state.ended) + return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } } - var i = 0; - var mul = 1; - var sub = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1; + state.ended = true; + if (state.sync) { + emitReadable(stream); + } else { + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); } - this[offset + i] = (value / mul >> 0) - sub & 255; } - return offset + byteLength2; - }; - Buffer18.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); + } + function emitReadable(stream) { + var state = stream._readableState; + debug("emitReadable", state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug("emitReadable", state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); } - var i = byteLength2 - 1; - var mul = 1; - var sub = 0; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1; - } - this[offset + i] = (value / mul >> 0) - sub & 255; + } + function emitReadable_(stream) { + var state = stream._readableState; + debug("emitReadable_", state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit("readable"); + state.emittedReadable = false; } - return offset + byteLength2; - }; - Buffer18.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 1, 127, -128); - if (value < 0) - value = 255 + value + 1; - this[offset] = value & 255; - return offset + 1; - }; - Buffer18.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer18.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer18.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 2147483647, -2147483648); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; - }; - Buffer18.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 2147483647, -2147483648); - if (value < 0) - value = 4294967295 + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; - }; - function checkIEEE754(buf2, value, offset, ext, max, min) { - if (offset + ext > buf2.length) - throw new RangeError("Index out of range"); - if (offset < 0) - throw new RangeError("Index out of range"); + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); } - function writeFloat(buf2, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22); + function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); } - ieee7542.write(buf2, value, offset, littleEndian, 23, 4); - return offset + 4; } - Buffer18.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); - }; - Buffer18.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); - }; - function writeDouble(buf2, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292); + function maybeReadMore_(stream, state) { + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug("maybeReadMore read 0"); + stream.read(0); + if (len === state.length) + break; } - ieee7542.write(buf2, value, offset, littleEndian, 52, 8); - return offset + 8; + state.readingMore = false; } - Buffer18.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); - }; - Buffer18.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); + Readable.prototype._read = function(n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); }; - Buffer18.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer18.isBuffer(target)) - throw new TypeError("argument should be a Buffer"); - if (!start) - start = 0; - if (!end && end !== 0) - end = this.length; - if (targetStart >= target.length) - targetStart = target.length; - if (!targetStart) - targetStart = 0; - if (end > 0 && end < start) - end = start; - if (end === start) - return 0; - if (target.length === 0 || this.length === 0) - return 0; - if (targetStart < 0) { - throw new RangeError("targetStart out of bounds"); + Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) + process.nextTick(endFn); + else + src.once("end", endFn); + dest.on("unpipe", onunpipe); + function onunpipe(readable, unpipeInfo) { + debug("onunpipe"); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } } - if (start < 0 || start >= this.length) - throw new RangeError("Index out of range"); - if (end < 0) - throw new RangeError("sourceEnd out of bounds"); - if (end > this.length) - end = this.length; - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start; + function onend() { + debug("onend"); + dest.end(); } - var len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === "function") { - this.copyWithin(targetStart, start, end); - } else { - Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); + var ondrain = pipeOnDrain(src); + dest.on("drain", ondrain); + var cleanedUp = false; + function cleanup() { + debug("cleanup"); + dest.removeListener("close", onclose); + dest.removeListener("finish", onfinish); + dest.removeListener("drain", ondrain); + dest.removeListener("error", onerror); + dest.removeListener("unpipe", onunpipe); + src.removeListener("end", onend); + src.removeListener("end", unpipe); + src.removeListener("data", ondata); + cleanedUp = true; + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) + ondrain(); } - return len; - }; - Buffer18.prototype.fill = function fill(val, start, end, encoding) { - if (typeof val === "string") { - if (typeof start === "string") { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === "string") { - encoding = end; - end = this.length; - } - if (encoding !== void 0 && typeof encoding !== "string") { - throw new TypeError("encoding must be a string"); - } - if (typeof encoding === "string" && !Buffer18.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - if (val.length === 1) { - var code = val.charCodeAt(0); - if (encoding === "utf8" && code < 128 || encoding === "latin1") { - val = code; + src.on("data", ondata); + function ondata(chunk) { + debug("ondata"); + var ret = dest.write(chunk); + debug("dest.write", ret); + if (ret === false) { + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug("false write response, pause", state.awaitDrain); + state.awaitDrain++; } + src.pause(); } - } else if (typeof val === "number") { - val = val & 255; - } else if (typeof val === "boolean") { - val = Number(val); } - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError("Out of range index"); + function onerror(er) { + debug("onerror", er); + unpipe(); + dest.removeListener("error", onerror); + if (EElistenerCount(dest, "error") === 0) + errorOrDestroy(dest, er); } - if (end <= start) { - return this; + prependListener(dest, "error", onerror); + function onclose() { + dest.removeListener("finish", onfinish); + unpipe(); } - start = start >>> 0; - end = end === void 0 ? this.length : end >>> 0; - if (!val) - val = 0; - var i; - if (typeof val === "number") { - for (i = start; i < end; ++i) { - this[i] = val; - } - } else { - var bytes = Buffer18.isBuffer(val) ? val : Buffer18.from(val, encoding); - var len = bytes.length; - if (len === 0) { - throw new TypeError('The value "' + val + '" is invalid for argument "value"'); + dest.once("close", onclose); + function onfinish() { + debug("onfinish"); + dest.removeListener("close", onclose); + unpipe(); + } + dest.once("finish", onfinish); + function unpipe() { + debug("unpipe"); + src.unpipe(dest); + } + dest.emit("pipe", src); + if (!state.flowing) { + debug("pipe resume"); + src.resume(); + } + return dest; + }; + function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug("pipeOnDrain", state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { + state.flowing = true; + flow(src); } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len]; + }; + } + Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + if (state.pipesCount === 0) + return this; + if (state.pipesCount === 1) { + if (dest && dest !== state.pipes) + return this; + if (!dest) + dest = state.pipes; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) + dest.emit("unpipe", this, unpipeInfo); + return this; + } + if (!dest) { + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) { + dests[i].emit("unpipe", this, { + hasUnpiped: false + }); } + return this; } + var index = indexOf(state.pipes, dest); + if (index === -1) + return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + dest.emit("unpipe", this, unpipeInfo); return this; }; - var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; - function base64clean(str) { - str = str.split("=")[0]; - str = str.trim().replace(INVALID_BASE64_RE, ""); - if (str.length < 2) - return ""; - while (str.length % 4 !== 0) { - str = str + "="; - } - return str; - } - function utf8ToBytes(string, units) { - units = units || Infinity; - var codePoint; - var length = string.length; - var leadSurrogate = null; - var bytes = []; - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i); - if (codePoint > 55295 && codePoint < 57344) { - if (!leadSurrogate) { - if (codePoint > 56319) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - continue; - } else if (i + 1 === length) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - continue; - } - leadSurrogate = codePoint; - continue; - } - if (codePoint < 56320) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - leadSurrogate = codePoint; - continue; + Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === "data") { + state.readableListening = this.listenerCount("readable") > 0; + if (state.flowing !== false) + this.resume(); + } else if (ev === "readable") { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug("on readable", state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); } - codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; - } else if (leadSurrogate) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - } - leadSurrogate = null; - if (codePoint < 128) { - if ((units -= 1) < 0) - break; - bytes.push(codePoint); - } else if (codePoint < 2048) { - if ((units -= 2) < 0) - break; - bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128); - } else if (codePoint < 65536) { - if ((units -= 3) < 0) - break; - bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128); - } else if (codePoint < 1114112) { - if ((units -= 4) < 0) - break; - bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128); - } else { - throw new Error("Invalid code point"); } } - return bytes; - } - function asciiToBytes(str) { - var byteArray = []; - for (var i = 0; i < str.length; ++i) { - byteArray.push(str.charCodeAt(i) & 255); + return res; + }; + Readable.prototype.addListener = Readable.prototype.on; + Readable.prototype.removeListener = function(ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === "readable") { + process.nextTick(updateReadableListening, this); } - return byteArray; - } - function utf16leToBytes(str, units) { - var c, hi, lo; - var byteArray = []; - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) - break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); + return res; + }; + Readable.prototype.removeAllListeners = function(ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === "readable" || ev === void 0) { + process.nextTick(updateReadableListening, this); + } + return res; + }; + function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount("readable") > 0; + if (state.resumeScheduled && !state.paused) { + state.flowing = true; + } else if (self.listenerCount("data") > 0) { + self.resume(); } - return byteArray; } - function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); + function nReadingNextTick(self) { + debug("readable nexttick read 0"); + self.read(0); } - function blitBuffer(src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if (i + offset >= dst.length || i >= src.length) - break; - dst[i + offset] = src[i]; + Readable.prototype.resume = function() { + var state = this._readableState; + if (!state.flowing) { + debug("resume"); + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; + }; + function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); } - return i; } - function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; + function resume_(stream, state) { + debug("resume", state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit("resume"); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); } - function numberIsNaN(obj) { - return obj !== obj; + Readable.prototype.pause = function() { + debug("call pause flowing=%j", this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug("pause"); + this._readableState.flowing = false; + this.emit("pause"); + } + this._readableState.paused = true; + return this; + }; + function flow(stream) { + var state = stream._readableState; + debug("flow", state.flowing); + while (state.flowing && stream.read() !== null) { + ; + } } - var hexSliceLookupTable = function() { - var alphabet = "0123456789abcdef"; - var table = new Array(256); - for (var i = 0; i < 16; ++i) { - var i16 = i * 16; - for (var j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j]; + Readable.prototype.wrap = function(stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on("end", function() { + debug("wrapped end"); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + _this.push(chunk); } - } - return table; - }(); - } - }); - - // node_modules/ebml/lib/ebml/tools.js - var require_tools = __commonJS({ - "node_modules/ebml/lib/ebml/tools.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var tools = { - readVint: function(buffer, start) { - start = start || 0; - for (var length = 1; length <= 8; length++) { - if (buffer[start] >= Math.pow(2, 8 - length)) { - break; - } + _this.push(null); + }); + stream.on("data", function(chunk) { + debug("wrapped data"); + if (state.decoder) + chunk = state.decoder.write(chunk); + if (state.objectMode && (chunk === null || chunk === void 0)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) + return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); } - if (length > 8) { - throw new Error("Unrepresentable length: " + length + " " + buffer.toString("hex", start, start + length)); + }); + for (var i in stream) { + if (this[i] === void 0 && typeof stream[i] === "function") { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); } - if (start + length > buffer.length) { - return null; + } + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + this._read = function(n2) { + debug("wrapped _read", n2); + if (paused) { + paused = false; + stream.resume(); } - var value = buffer[start] & (1 << 8 - length) - 1; - for (var i = 1; i < length; i++) { - if (i === 7) { - if (value >= Math.pow(2, 53 - 8) && buffer[start + 7] > 0) { - return { - length, - value: -1 - }; - } - } - value *= Math.pow(2, 8); - value += buffer[start + i]; + }; + return this; + }; + if (typeof Symbol === "function") { + Readable.prototype[Symbol.asyncIterator] = function() { + if (createReadableStreamAsyncIterator === void 0) { + createReadableStreamAsyncIterator = require_async_iterator(); } - return { - length, - value - }; + return createReadableStreamAsyncIterator(this); + }; + } + Object.defineProperty(Readable.prototype, "readableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._readableState.highWaterMark; + } + }); + Object.defineProperty(Readable.prototype, "readableBuffer", { + enumerable: false, + get: function get2() { + return this._readableState && this._readableState.buffer; + } + }); + Object.defineProperty(Readable.prototype, "readableFlowing", { + enumerable: false, + get: function get2() { + return this._readableState.flowing; }, - writeVint: function(value) { - if (value < 0 || value > Math.pow(2, 53)) { - throw new Error("Unrepresentable value: " + value); + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; } - for (var length = 1; length <= 8; length++) { - if (value < Math.pow(2, 7 * length) - 1) { - break; + } + }); + Readable._fromList = fromList; + Object.defineProperty(Readable.prototype, "readableLength", { + enumerable: false, + get: function get2() { + return this._readableState.length; + } + }); + function fromList(n, state) { + if (state.length === 0) + return null; + var ret; + if (state.objectMode) + ret = state.buffer.shift(); + else if (!n || n >= state.length) { + if (state.decoder) + ret = state.buffer.join(""); + else if (state.buffer.length === 1) + ret = state.buffer.first(); + else + ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + ret = state.buffer.consume(n, state.decoder); + } + return ret; + } + function endReadable(stream) { + var state = stream._readableState; + debug("endReadable", state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } + } + function endReadableNT(state, stream) { + debug("endReadableNT", state.endEmitted, state.length); + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit("end"); + if (state.autoDestroy) { + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); } } - var buffer = new Buffer2(length); - for (var i = 1; i <= length; i++) { - var b = value & 255; - buffer[length - i] = b; - value -= b; - value /= Math.pow(2, 8); + } + } + if (typeof Symbol === "function") { + Readable.from = function(iterable, opts) { + if (from === void 0) { + from = require_from_browser(); } - buffer[0] = buffer[0] | 1 << 8 - length; - return buffer; + return from(Readable, iterable, opts); + }; + } + function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) + return i; } - }; - module.exports = tools; + return -1; + } } }); - // node_modules/ebml-block/lib/vint.js - var require_vint = __commonJS({ - "node_modules/ebml-block/lib/vint.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_transform.js + var require_stream_transform = __commonJS({ + "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - module.exports = function(buffer, start, signed) { - start = start || 0; - for (var length = 1; length <= 8; length++) { - if (buffer[start] >= Math.pow(2, 8 - length)) { - break; - } - } - if (length > 8) { - throw new Error("Unrepresentable length: " + length + " " + buffer.toString("hex", start, start + length)); - } - if (start + length > buffer.length) { - return null; - } - var i; - var value = buffer[start] & (1 << 8 - length) - 1; - for (i = 1; i < length; i++) { - if (i === 7) { - if (value >= Math.pow(2, 53 - 8) && buffer[start + 7] > 0) { - return { - length, - value: -1 - }; - } - } - value *= Math.pow(2, 8); - value += buffer[start + i]; + module.exports = Transform; + var _require$codes = require_errors_browser().codes; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; + var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING; + var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; + var Duplex = require_stream_duplex(); + require_inherits_browser()(Transform, Duplex); + function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit("error", new ERR_MULTIPLE_CALLBACK()); } - if (signed) { - value -= Math.pow(2, length * 7 - 1) - 1; + ts.writechunk = null; + ts.writecb = null; + if (data != null) + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); } - return { - length, - value + } + function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null }; + this._readableState.needReadable = true; + this._readableState.sync = false; + if (options) { + if (typeof options.transform === "function") + this._transform = options.transform; + if (typeof options.flush === "function") + this._flush = options.flush; + } + this.on("prefinish", prefinish); + } + function prefinish() { + var _this = this; + if (typeof this._flush === "function" && !this._readableState.destroyed) { + this._flush(function(er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } + } + Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); }; - } - }); - - // node_modules/ebml-block/lib/buffer-reader.js - var require_buffer_reader = __commonJS({ - "node_modules/ebml-block/lib/buffer-reader.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var vint = require_vint(); - function BufferReader(buffer) { - this.buffer = buffer; - this.offset = 0; - } - BufferReader.prototype.nextInt16BE = function() { - var value = this.buffer.readInt16BE(this.offset); - this.offset += 2; - return value; - }; - BufferReader.prototype.nextUInt8 = function() { - var value = this.buffer.readUInt8(this.offset); - this.offset += 1; - return value; + Transform.prototype._transform = function(chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); }; - BufferReader.prototype.nextUIntV = function() { - var v = vint(this.buffer, this.offset); - this.offset += v.length; - return v.value; + Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } }; - BufferReader.prototype.nextIntV = function() { - var v = vint(this.buffer, this.offset, true); - this.offset += v.length; - return v.value; + Transform.prototype._read = function(n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + ts.needTransform = true; + } }; - BufferReader.prototype.nextBuffer = function(length) { - var buffer = length ? this.buffer.slice(this.offset, this.offset + length) : this.buffer.slice(this.offset); - this.offset += length || this.length; - return buffer; + Transform.prototype._destroy = function(err, cb) { + Duplex.prototype._destroy.call(this, err, function(err2) { + cb(err2); + }); }; - Object.defineProperty(BufferReader.prototype, "length", { - get: function() { - return this.buffer.length - this.offset; - } - }); - module.exports = BufferReader; + function done(stream, er, data) { + if (er) + return stream.emit("error", er); + if (data != null) + stream.push(data); + if (stream._writableState.length) + throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) + throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); + } } }); - // node_modules/ebml-block/index.js - var require_ebml_block = __commonJS({ - "node_modules/ebml-block/index.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_passthrough.js + var require_stream_passthrough = __commonJS({ + "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var BufferReader = require_buffer_reader(); - var XIPH_LACING = 1; - var EBML_LACING = 3; - var FIXED_SIZE_LACING = 2; - module.exports = function(buffer) { - var block = {}; - var reader = new BufferReader(buffer); - block.trackNumber = reader.nextUIntV(); - block.timecode = reader.nextInt16BE(); - var flags = reader.nextUInt8(); - block.invisible = !!(flags & 8); - block.keyframe = !!(flags & 128); - block.discardable = !!(flags & 1); - var lacing = (flags & 6) >> 1; - block.frames = readLacedData(reader, lacing); - return block; - }; - function readLacedData(reader, lacing) { - if (!lacing) - return [reader.nextBuffer()]; - var i, frameSize; - var frames = []; - var framesNum = reader.nextUInt8() + 1; - if (lacing === FIXED_SIZE_LACING) { - if (reader.length % framesNum !== 0) - throw new Error("Fixed-Size Lacing Error"); - frameSize = reader.length / framesNum; - for (i = 0; i < framesNum; i++) { - frames.push(reader.nextBuffer(frameSize)); - } - return frames; - } - var frameSizes = []; - if (lacing === XIPH_LACING) { - for (i = 0; i < framesNum - 1; i++) { - var val; - frameSize = 0; - do { - val = reader.nextUInt8(); - frameSize += val; - } while (val === 255); - frameSizes.push(frameSize); - } - } else if (lacing === EBML_LACING) { - frameSize = reader.nextUIntV(); - frameSizes.push(frameSize); - for (i = 1; i < framesNum - 1; i++) { - frameSize += reader.nextIntV(); - frameSizes.push(frameSize); - } - } - for (i = 0; i < framesNum - 1; i++) { - frames.push(reader.nextBuffer(frameSizes[i])); - } - frames.push(reader.nextBuffer()); - return frames; + module.exports = PassThrough; + var Transform = require_stream_transform(); + require_inherits_browser()(PassThrough, Transform); + function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + Transform.call(this, options); } + PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); + }; } }); - // node_modules/ts-ebml/lib/tools.js - var require_tools2 = __commonJS({ - "node_modules/ts-ebml/lib/tools.js"(exports) { + // node_modules/readable-stream/lib/internal/streams/pipeline.js + var require_pipeline = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var int64_buffer_1 = require_int64_buffer(); - var EBMLEncoder_1 = require_EBMLEncoder(); - var _Buffer = require_buffer2(); - var _tools = require_tools(); - var _block = require_ebml_block(); - exports.Buffer = _Buffer.Buffer; - exports.readVint = _tools.readVint; - exports.writeVint = _tools.writeVint; - exports.ebmlBlock = _block; - function readBlock(buf2) { - return exports.ebmlBlock(new exports.Buffer(buf2)); - } - exports.readBlock = readBlock; - function encodeTag(tagId, tagData, unknownSize) { - if (unknownSize === void 0) { - unknownSize = false; - } - return concat([ - tagId, - unknownSize ? new exports.Buffer("01ffffffffffffff", "hex") : exports.writeVint(tagData.length), - tagData - ]); - } - exports.encodeTag = encodeTag; - function WebPFrameFilter(elms) { - return WebPBlockFilter(elms).reduce(function(lst, elm) { - var o = exports.ebmlBlock(elm.data); - return o.frames.reduce(function(lst2, frame) { - var webpBuf = VP8BitStreamToRiffWebPBuffer(frame); - var webp = new Blob([webpBuf], { type: "image/webp" }); - return lst2.concat(webp); - }, lst); - }, []); - } - exports.WebPFrameFilter = WebPFrameFilter; - function WebPBlockFilter(elms) { - return elms.reduce(function(lst, elm) { - if (elm.type !== "b") { - return lst; - } - if (elm.name !== "SimpleBlock") { - return lst; - } - var o = exports.ebmlBlock(elm.data); - var hasWebP = o.frames.some(function(frame) { - var startcode = frame.slice(3, 6).toString("hex"); - return startcode === "9d012a"; - }); - if (!hasWebP) { - return lst; - } - return lst.concat(elm); - }, []); - } - exports.WebPBlockFilter = WebPBlockFilter; - function VP8BitStreamToRiffWebPBuffer(frame) { - var VP8Chunk = createRIFFChunk("VP8 ", frame); - var WebPChunk = concat([ - new exports.Buffer("WEBP", "ascii"), - VP8Chunk - ]); - return createRIFFChunk("RIFF", WebPChunk); - } - exports.VP8BitStreamToRiffWebPBuffer = VP8BitStreamToRiffWebPBuffer; - function createRIFFChunk(FourCC, chunk) { - var chunkSize = new exports.Buffer(4); - chunkSize.writeUInt32LE(chunk.byteLength, 0); - return concat([ - new exports.Buffer(FourCC.substr(0, 4), "ascii"), - chunkSize, - chunk, - new exports.Buffer(chunk.byteLength % 2 === 0 ? 0 : 1) - ]); - } - exports.createRIFFChunk = createRIFFChunk; - function makeMetadataSeekable(originalMetadata, duration, cuesInfo) { - var header = extractElement("EBML", originalMetadata); - var headerSize = encodedSizeOfEbml(header); - var segmentContentStartPos = headerSize + 12; - var originalMetadataSize = originalMetadata[originalMetadata.length - 1].dataEnd - segmentContentStartPos; - var info = extractElement("Info", originalMetadata); - removeElement("Duration", info); - info.splice(1, 0, { name: "Duration", type: "f", data: createFloatBuffer(duration, 8) }); - var infoSize = encodedSizeOfEbml(info); - var tracks = extractElement("Tracks", originalMetadata); - var tracksSize = encodedSizeOfEbml(tracks); - var seekHeadSize = 47; - var seekHead = []; - var cuesSize = 5 + cuesInfo.length * 15; - var cues = []; - var lastSizeDifference = -1; - var maxIterations = 10; - var _loop_1 = function(i2) { - var infoStart = seekHeadSize; - var tracksStart = infoStart + infoSize; - var cuesStart = tracksStart + tracksSize; - var newMetadataSize = cuesStart + cuesSize; - var sizeDifference = newMetadataSize - originalMetadataSize; - seekHead = []; - seekHead.push({ name: "SeekHead", type: "m", isEnd: false }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([21, 73, 169, 102]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(infoStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([22, 84, 174, 107]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(tracksStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([28, 83, 187, 107]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(cuesStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "SeekHead", type: "m", isEnd: true }); - seekHeadSize = encodedSizeOfEbml(seekHead); - cues = []; - cues.push({ name: "Cues", type: "m", isEnd: false }); - cuesInfo.forEach(function(_a) { - var CueTrack = _a.CueTrack, CueClusterPosition = _a.CueClusterPosition, CueTime = _a.CueTime; - cues.push({ name: "CuePoint", type: "m", isEnd: false }); - cues.push({ name: "CueTime", type: "u", data: createUIntBuffer(CueTime) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: false }); - cues.push({ name: "CueTrack", type: "u", data: createUIntBuffer(CueTrack) }); - CueClusterPosition -= segmentContentStartPos; - CueClusterPosition += sizeDifference; - cues.push({ name: "CueClusterPosition", type: "u", data: createUIntBuffer(CueClusterPosition) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: true }); - cues.push({ name: "CuePoint", type: "m", isEnd: true }); - }); - cues.push({ name: "Cues", type: "m", isEnd: true }); - cuesSize = encodedSizeOfEbml(cues); - if (lastSizeDifference !== sizeDifference) { - lastSizeDifference = sizeDifference; - if (i2 === maxIterations - 1) { - throw new Error("Failed to converge to a stable metadata size"); - } - } else { - return "break"; - } + var eos; + function once(callback) { + var called = false; + return function() { + if (called) + return; + called = true; + callback.apply(void 0, arguments); }; - for (var i = 0; i < maxIterations; i++) { - var state_1 = _loop_1(i); - if (state_1 === "break") - break; - } - var finalMetadata = [].concat.apply([], [ - header, - { name: "Segment", type: "m", isEnd: false, unknownSize: true }, - seekHead, - info, - tracks, - cues - ]); - var result = new EBMLEncoder_1.default().encode(finalMetadata); - return result; - } - exports.makeMetadataSeekable = makeMetadataSeekable; - function removeElement(idName, metadata) { - var result = []; - var start = -1; - for (var i = 0; i < metadata.length; i++) { - var element2 = metadata[i]; - if (element2.name === idName) { - if (element2.type === "m") { - if (!element2.isEnd) { - start = i; - } else { - if (start == -1) - throw new Error("Detected " + idName + " closing element before finding the start"); - metadata.splice(start, i - start + 1); - return; - } - } else { - metadata.splice(i, 1); - return; - } - } - } } - exports.removeElement = removeElement; - function extractElement(idName, metadata) { - var result = []; - var start = -1; - for (var i = 0; i < metadata.length; i++) { - var element2 = metadata[i]; - if (element2.name === idName) { - if (element2.type === "m") { - if (!element2.isEnd) { - start = i; - } else { - if (start == -1) - throw new Error("Detected " + idName + " closing element before finding the start"); - result = metadata.slice(start, i + 1); - break; - } - } else { - result.push(metadata[i]); - break; - } - } - } - return result; + var _require$codes = require_errors_browser().codes; + var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; + var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + function noop3(err) { + if (err) + throw err; } - exports.extractElement = extractElement; - function putRefinedMetaData(metadata, info) { - if (Array.isArray(info.cueInfos) && !Array.isArray(info.cues)) { - console.warn("putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues"); - info.cues = info.cueInfos; - } - var ebml2 = []; - var payload = []; - for (var i_1 = 0; i_1 < metadata.length; i_1++) { - var elm = metadata[i_1]; - if (elm.type === "m" && elm.name === "Segment") { - ebml2 = metadata.slice(0, i_1); - payload = metadata.slice(i_1); - if (elm.unknownSize) { - payload.shift(); - break; - } - throw new Error("this metadata is not streaming webm file"); - } - } - if (!(payload[payload.length - 1].dataEnd > 0)) { - throw new Error("metadata dataEnd has wrong number"); - } - var originalPayloadOffsetEnd = payload[payload.length - 1].dataEnd; - var ebmlSize = ebml2[ebml2.length - 1].dataEnd; - var refinedEBMLSize = new EBMLEncoder_1.default().encode(ebml2).byteLength; - var offsetDiff = refinedEBMLSize - ebmlSize; - var payloadSize = originalPayloadOffsetEnd - payload[0].tagStart; - var segmentSize = payload[0].tagStart - ebmlSize; - var segmentOffset = payload[0].tagStart; - var segmentTagBuf = new exports.Buffer([24, 83, 128, 103]); - var segmentSizeBuf = new exports.Buffer("01ffffffffffffff", "hex"); - var _segmentSize = segmentTagBuf.byteLength + segmentSizeBuf.byteLength; - var newPayloadSize = payloadSize; - var i; - for (i = 1; i < 20; i++) { - var newPayloadOffsetEnd = ebmlSize + _segmentSize + newPayloadSize; - var offsetEndDiff = newPayloadOffsetEnd - originalPayloadOffsetEnd; - var sizeDiff = offsetDiff + offsetEndDiff; - var refined = refineMetadata(payload, sizeDiff, info); - var newNewRefinedSize = new EBMLEncoder_1.default().encode(refined).byteLength; - if (newNewRefinedSize === newPayloadSize) { - return new EBMLEncoder_1.default().encode([].concat(ebml2, [{ type: "m", name: "Segment", isEnd: false, unknownSize: true }], refined)); - } - newPayloadSize = newNewRefinedSize; - } - throw new Error("unable to refine metadata, stable size could not be found in " + i + " iterations!"); - } - exports.putRefinedMetaData = putRefinedMetaData; - function encodedSizeOfEbml(refinedMetaData) { - var encorder = new EBMLEncoder_1.default(); - return refinedMetaData.reduce(function(lst, elm) { - return lst.concat(encorder.encode([elm])); - }, []).reduce(function(o, buf2) { - return o + buf2.byteLength; - }, 0); - } - function refineMetadata(mesetadata, sizeDiff, info) { - var duration = info.duration, clusterPtrs = info.clusterPtrs, cues = info.cues; - var _metadata = mesetadata.slice(0); - if (typeof duration === "number") { - var overwrited_1 = false; - _metadata.forEach(function(elm) { - if (elm.type === "f" && elm.name === "Duration") { - overwrited_1 = true; - elm.data = createFloatBuffer(duration, 8); - } - }); - if (!overwrited_1) { - insertTag(_metadata, "Info", [{ name: "Duration", type: "f", data: createFloatBuffer(duration, 8) }]); - } - } - if (Array.isArray(cues)) { - insertTag(_metadata, "Cues", create_cue(cues, sizeDiff)); - } - var seekhead_children = []; - if (Array.isArray(clusterPtrs)) { - console.warn("append cluster pointers to seekhead is deprecated. please use cues"); - seekhead_children = create_seek_from_clusters(clusterPtrs, sizeDiff); - } - insertTag(_metadata, "SeekHead", seekhead_children, true); - return _metadata; + function isRequest(stream) { + return stream.setHeader && typeof stream.abort === "function"; } - function create_seek_from_clusters(clusterPtrs, sizeDiff) { - var seeks = []; - clusterPtrs.forEach(function(start) { - seeks.push({ name: "Seek", type: "m", isEnd: false }); - seeks.push({ name: "SeekID", type: "b", data: new exports.Buffer([31, 67, 182, 117]) }); - seeks.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(start + sizeDiff) }); - seeks.push({ name: "Seek", type: "m", isEnd: true }); + function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on("close", function() { + closed = true; }); - return seeks; - } - function create_cue(cueInfos, sizeDiff) { - var cues = []; - cueInfos.forEach(function(_a) { - var CueTrack = _a.CueTrack, CueClusterPosition = _a.CueClusterPosition, CueTime = _a.CueTime; - cues.push({ name: "CuePoint", type: "m", isEnd: false }); - cues.push({ name: "CueTime", type: "u", data: createUIntBuffer(CueTime) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: false }); - cues.push({ name: "CueTrack", type: "u", data: createUIntBuffer(CueTrack) }); - cues.push({ name: "CueClusterPosition", type: "u", data: createUIntBuffer(CueClusterPosition + sizeDiff) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: true }); - cues.push({ name: "CuePoint", type: "m", isEnd: true }); + if (eos === void 0) + eos = require_end_of_stream(); + eos(stream, { + readable: reading, + writable: writing + }, function(err) { + if (err) + return callback(err); + closed = true; + callback(); }); - return cues; + var destroyed = false; + return function(err) { + if (closed) + return; + if (destroyed) + return; + destroyed = true; + if (isRequest(stream)) + return stream.abort(); + if (typeof stream.destroy === "function") + return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED("pipe")); + }; } - function insertTag(_metadata, tagName, children2, insertHead) { - if (insertHead === void 0) { - insertHead = false; - } - var idx = -1; - for (var i = 0; i < _metadata.length; i++) { - var elm = _metadata[i]; - if (elm.type === "m" && elm.name === tagName && elm.isEnd === false) { - idx = i; - break; - } - } - if (idx >= 0) { - Array.prototype.splice.apply(_metadata, [idx + 1, 0].concat(children2)); - } else if (insertHead) { - [].concat([{ name: tagName, type: "m", isEnd: false }], children2, [{ name: tagName, type: "m", isEnd: true }]).reverse().forEach(function(elm2) { - _metadata.unshift(elm2); - }); - } else { - _metadata.push({ name: tagName, type: "m", isEnd: false }); - children2.forEach(function(elm2) { - _metadata.push(elm2); - }); - _metadata.push({ name: tagName, type: "m", isEnd: true }); - } + function call(fn) { + fn(); } - function concat(list) { - var i = 0; - var length = 0; - for (; i < list.length; ++i) { - length += list[i].length; - } - var buffer = exports.Buffer.allocUnsafe(length); - var pos = 0; - for (i = 0; i < list.length; ++i) { - var buf2 = list[i]; - buf2.copy(buffer, pos); - pos += buf2.length; - } - return buffer; + function pipe(from, to) { + return from.pipe(to); } - exports.concat = concat; - function encodeValueToBuffer(elm) { - var data = new exports.Buffer(0); - if (elm.type === "m") { - return elm; - } - switch (elm.type) { - case "u": - data = createUIntBuffer(elm.value); - break; - case "i": - data = createIntBuffer(elm.value); - break; - case "f": - data = createFloatBuffer(elm.value); - break; - case "s": - data = new exports.Buffer(elm.value, "ascii"); - break; - case "8": - data = new exports.Buffer(elm.value, "utf8"); - break; - case "b": - data = elm.value; - break; - case "d": - data = new int64_buffer_1.Int64BE(elm.value.getTime().toString()).toBuffer(); - break; - } - return Object.assign({}, elm, { data }); - } - exports.encodeValueToBuffer = encodeValueToBuffer; - function createUIntBuffer(value) { - var bytes = 1; - for (; value >= Math.pow(2, 8 * bytes); bytes++) { - } - if (bytes >= 7) { - console.warn("7bit or more bigger uint not supported."); - return new int64_buffer_1.Uint64BE(value).toBuffer(); - } - var data = new exports.Buffer(bytes); - data.writeUIntBE(value, 0, bytes); - return data; - } - exports.createUIntBuffer = createUIntBuffer; - function createIntBuffer(value) { - var bytes = 1; - for (; value >= Math.pow(2, 8 * bytes); bytes++) { - } - if (bytes >= 7) { - console.warn("7bit or more bigger uint not supported."); - return new int64_buffer_1.Int64BE(value).toBuffer(); - } - var data = new exports.Buffer(bytes); - data.writeIntBE(value, 0, bytes); - return data; - } - exports.createIntBuffer = createIntBuffer; - function createFloatBuffer(value, bytes) { - if (bytes === void 0) { - bytes = 8; - } - if (bytes === 8) { - var data = new exports.Buffer(8); - data.writeDoubleBE(value, 0); - return data; - } else if (bytes === 4) { - var data = new exports.Buffer(4); - data.writeFloatBE(value, 0); - return data; - } else { - throw new Error("float type bits must 4bytes or 8bytes"); - } + function popCallback(streams) { + if (!streams.length) + return noop3; + if (typeof streams[streams.length - 1] !== "function") + return noop3; + return streams.pop(); } - exports.createFloatBuffer = createFloatBuffer; - function convertEBMLDateToJSDate(int64str) { - if (int64str instanceof Date) { - return int64str; + function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) + streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS("streams"); } - return new Date(new Date("2001-01-01T00:00:00.000Z").getTime() + Number(int64str) / 1e3 / 1e3); + var error; + var destroys = streams.map(function(stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function(err) { + if (!error) + error = err; + if (err) + destroys.forEach(call); + if (reading) + return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); } - exports.convertEBMLDateToJSDate = convertEBMLDateToJSDate; + module.exports = pipeline; } }); - // node_modules/ts-ebml/lib/EBMLDecoder.js - var require_EBMLDecoder = __commonJS({ - "node_modules/ts-ebml/lib/EBMLDecoder.js"(exports) { - "use strict"; + // node_modules/readable-stream/readable-browser.js + var require_readable_browser = __commonJS({ + "node_modules/readable-stream/readable-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var tools_1 = require_tools2(); - var int64_buffer_1 = require_int64_buffer(); - var tools = require_tools2(); - var schema = require_schema(); - var byEbmlID = schema.byEbmlID; - var State2; - (function(State3) { - State3[State3["STATE_TAG"] = 1] = "STATE_TAG"; - State3[State3["STATE_SIZE"] = 2] = "STATE_SIZE"; - State3[State3["STATE_CONTENT"] = 3] = "STATE_CONTENT"; - })(State2 || (State2 = {})); - var EBMLDecoder = function() { - function EBMLDecoder2() { - this._buffer = new tools_1.Buffer(0); - this._tag_stack = []; - this._state = State2.STATE_TAG; - this._cursor = 0; - this._total = 0; - this._schema = byEbmlID; - this._result = []; - } - EBMLDecoder2.prototype.decode = function(chunk) { - this.readChunk(chunk); - var diff = this._result; - this._result = []; - return diff; - }; - EBMLDecoder2.prototype.readChunk = function(chunk) { - this._buffer = tools.concat([this._buffer, new tools_1.Buffer(chunk)]); - while (this._cursor < this._buffer.length) { - if (this._state === State2.STATE_TAG && !this.readTag()) { - break; - } - if (this._state === State2.STATE_SIZE && !this.readSize()) { - break; - } - if (this._state === State2.STATE_CONTENT && !this.readContent()) { - break; - } - } - }; - EBMLDecoder2.prototype.getSchemaInfo = function(tagNum) { - return this._schema[tagNum] || { - name: "unknown", - level: -1, - type: "unknown", - description: "unknown" - }; - }; - EBMLDecoder2.prototype.readTag = function() { - if (this._cursor >= this._buffer.length) { - return false; - } - var tag = tools_1.readVint(this._buffer, this._cursor); - if (tag == null) { - return false; - } - var buf2 = this._buffer.slice(this._cursor, this._cursor + tag.length); - var tagNum = buf2.reduce(function(o, v, i, arr) { - return o + v * Math.pow(16, 2 * (arr.length - 1 - i)); - }, 0); - var schema2 = this.getSchemaInfo(tagNum); - var tagObj = { - EBML_ID: tagNum.toString(16), - schema: schema2, - type: schema2.type, - name: schema2.name, - level: schema2.level, - tagStart: this._total, - tagEnd: this._total + tag.length, - sizeStart: this._total + tag.length, - sizeEnd: null, - dataStart: null, - dataEnd: null, - dataSize: null, - data: null - }; - this._tag_stack.push(tagObj); - this._cursor += tag.length; - this._total += tag.length; - this._state = State2.STATE_SIZE; - return true; - }; - EBMLDecoder2.prototype.readSize = function() { - if (this._cursor >= this._buffer.length) { - return false; - } - var size = tools_1.readVint(this._buffer, this._cursor); - if (size == null) { - return false; - } - var tagObj = this._tag_stack[this._tag_stack.length - 1]; - tagObj.sizeEnd = tagObj.sizeStart + size.length; - tagObj.dataStart = tagObj.sizeEnd; - tagObj.dataSize = size.value; - if (size.value === -1) { - tagObj.dataEnd = -1; - if (tagObj.type === "m") { - tagObj.unknownSize = true; - } - } else { - tagObj.dataEnd = tagObj.sizeEnd + size.value; - } - this._cursor += size.length; - this._total += size.length; - this._state = State2.STATE_CONTENT; - return true; - }; - EBMLDecoder2.prototype.readContent = function() { - var tagObj = this._tag_stack[this._tag_stack.length - 1]; - if (tagObj.type === "m") { - tagObj.isEnd = false; - this._result.push(tagObj); - this._state = State2.STATE_TAG; - if (tagObj.dataSize === 0) { - var elm = Object.assign({}, tagObj, { isEnd: true }); - this._result.push(elm); - this._tag_stack.pop(); - } - return true; - } - if (this._buffer.length < this._cursor + tagObj.dataSize) { - return false; - } - var data = this._buffer.slice(this._cursor, this._cursor + tagObj.dataSize); - this._buffer = this._buffer.slice(this._cursor + tagObj.dataSize); - tagObj.data = data; - switch (tagObj.type) { - case "u": - tagObj.value = data.readUIntBE(0, data.length); - break; - case "i": - tagObj.value = data.readIntBE(0, data.length); - break; - case "f": - tagObj.value = tagObj.dataSize === 4 ? data.readFloatBE(0) : tagObj.dataSize === 8 ? data.readDoubleBE(0) : (console.warn("cannot read " + tagObj.dataSize + " octets float. failback to 0"), 0); - break; - case "s": - tagObj.value = data.toString("ascii"); - break; - case "8": - tagObj.value = data.toString("utf8"); - break; - case "b": - tagObj.value = data; - break; - case "d": - tagObj.value = tools_1.convertEBMLDateToJSDate(new int64_buffer_1.Int64BE(data).toNumber()); - break; - } - if (tagObj.value === null) { - throw new Error("unknown tag type:" + tagObj.type); - } - this._result.push(tagObj); - this._total += tagObj.dataSize; - this._state = State2.STATE_TAG; - this._cursor = 0; - this._tag_stack.pop(); - while (this._tag_stack.length > 0) { - var topEle = this._tag_stack[this._tag_stack.length - 1]; - if (topEle.dataEnd < 0) { - this._tag_stack.pop(); - return true; - } - if (this._total < topEle.dataEnd) { - break; - } - if (topEle.type !== "m") { - throw new Error("parent element is not master element"); - } - var elm = Object.assign({}, topEle, { isEnd: true }); - this._result.push(elm); - this._tag_stack.pop(); - } - return true; - }; - return EBMLDecoder2; - }(); - exports.default = EBMLDecoder; + exports = module.exports = require_stream_readable(); + exports.Stream = exports; + exports.Readable = exports; + exports.Writable = require_stream_writable(); + exports.Duplex = require_stream_duplex(); + exports.Transform = require_stream_transform(); + exports.PassThrough = require_stream_passthrough(); + exports.finished = require_end_of_stream(); + exports.pipeline = require_pipeline(); } }); - // node_modules/ts-ebml/node_modules/events/events.js - var require_events2 = __commonJS({ - "node_modules/ts-ebml/node_modules/events/events.js"(exports, module) { + // node_modules/readable-web-to-node-stream/lib/index.js + var require_lib = __commonJS({ + "node_modules/readable-web-to-node-stream/lib/index.js"(exports) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || void 0; - } - module.exports = EventEmitter; - EventEmitter.EventEmitter = EventEmitter; - EventEmitter.prototype._events = void 0; - EventEmitter.prototype._maxListeners = void 0; - EventEmitter.defaultMaxListeners = 10; - EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError("n must be a positive number"); - this._maxListeners = n; - return this; - }; - EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - if (!this._events) - this._events = {}; - if (type === "error") { - if (!this._events.error || isObject(this._events.error) && !this._events.error.length) { - er = arguments[1]; - if (er instanceof Error) { - throw er; - } else { - var err = new Error('Uncaught, unspecified "error" event. (' + er + ")"); - err.context = er; - throw err; - } - } - } - handler = this._events[type]; - if (isUndefined(handler)) - return false; - if (isFunction(handler)) { - switch (arguments.length) { - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); - } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - return true; - }; - EventEmitter.prototype.addListener = function(type, listener) { - var m; - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - if (!this._events) - this._events = {}; - if (this._events.newListener) - this.emit("newListener", type, isFunction(listener.listener) ? listener.listener : listener); - if (!this._events[type]) - this._events[type] = listener; - else if (isObject(this._events[type])) - this._events[type].push(listener); - else - this._events[type] = [this._events[type], listener]; - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[type].length); - if (typeof console.trace === "function") { - console.trace(); - } - } + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ReadableWebToNodeStream = void 0; + var readable_stream_1 = require_readable_browser(); + var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable { + constructor(stream) { + super(); + this.bytesRead = 0; + this.released = false; + this.reader = stream.getReader(); } - return this; - }; - EventEmitter.prototype.on = EventEmitter.prototype.addListener; - EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - var fired = false; - function g() { - this.removeListener(type, g); - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - g.listener = listener; - this.on(type, g); - return this; - }; - EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - if (!this._events || !this._events[type]) - return this; - list = this._events[type]; - length = list.length; - position = -1; - if (list === listener || isFunction(list.listener) && list.listener === listener) { - delete this._events[type]; - if (this._events.removeListener) - this.emit("removeListener", type, listener); - } else if (isObject(list)) { - for (i = length; i-- > 0; ) { - if (list[i] === listener || list[i].listener && list[i].listener === listener) { - position = i; - break; - } + async _read() { + if (this.released) { + this.push(null); + return; } - if (position < 0) - return this; - if (list.length === 1) { - list.length = 0; - delete this._events[type]; + this.pendingRead = this.reader.read(); + const data = await this.pendingRead; + delete this.pendingRead; + if (data.done || this.released) { + this.push(null); } else { - list.splice(position, 1); + this.bytesRead += data.value.length; + this.push(data.value); } - if (this._events.removeListener) - this.emit("removeListener", type, listener); - } - return this; - }; - EventEmitter.prototype.removeAllListeners = function(type) { - var key2, listeners; - if (!this._events) - return this; - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; } - if (arguments.length === 0) { - for (key2 in this._events) { - if (key2 === "removeListener") - continue; - this.removeAllListeners(key2); + async waitForReadToComplete() { + if (this.pendingRead) { + await this.pendingRead; } - this.removeAllListeners("removeListener"); - this._events = {}; - return this; } - listeners = this._events[type]; - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); + async close() { + await this.syncAndRelease(); } - delete this._events[type]; - return this; - }; - EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; - }; - EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; - if (isFunction(evlistener)) - return 1; - else if (evlistener) - return evlistener.length; + async syncAndRelease() { + this.released = true; + await this.waitForReadToComplete(); + await this.reader.releaseLock(); } - return 0; }; - EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); - }; - function isFunction(arg) { - return typeof arg === "function"; - } - function isNumber(arg) { - return typeof arg === "number"; - } - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - function isUndefined(arg) { - return arg === void 0; - } + exports.ReadableWebToNodeStream = ReadableWebToNodeStream2; } }); - // node_modules/ts-ebml/lib/EBMLReader.js - var require_EBMLReader = __commonJS({ - "node_modules/ts-ebml/lib/EBMLReader.js"(exports) { + // node_modules/base-x/src/index.js + var require_src = __commonJS({ + "node_modules/base-x/src/index.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports && exports.__extends || function() { - var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { - d.__proto__ = b; - } || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - }; - return function(d, b) { - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - Object.defineProperty(exports, "__esModule", { value: true }); - var events_1 = require_events2(); - var tools = require_tools2(); - var EBMLReader = function(_super) { - __extends(EBMLReader2, _super); - function EBMLReader2() { - var _this = _super.call(this) || this; - _this.logGroup = ""; - _this.hasLoggingStarted = false; - _this.metadataloaded = false; - _this.chunks = []; - _this.stack = []; - _this.segmentOffset = 0; - _this.last2SimpleBlockVideoTrackTimecode = [0, 0]; - _this.last2SimpleBlockAudioTrackTimecode = [0, 0]; - _this.lastClusterTimecode = 0; - _this.lastClusterPosition = 0; - _this.timecodeScale = 1e6; - _this.metadataSize = 0; - _this.metadatas = []; - _this.cues = []; - _this.firstVideoBlockRead = false; - _this.firstAudioBlockRead = false; - _this.currentTrack = { TrackNumber: -1, TrackType: -1, DefaultDuration: null, CodecDelay: null }; - _this.trackTypes = []; - _this.trackDefaultDuration = []; - _this.trackCodecDelay = []; - _this.trackInfo = { type: "nothing" }; - _this.ended = false; - _this.logging = false; - _this.use_duration_every_simpleblock = false; - _this.use_webp = false; - _this.use_segment_info = true; - _this.drop_default_duration = true; - return _this; - } - EBMLReader2.prototype.stop = function() { - this.ended = true; - this.emit_segment_info(); - while (this.stack.length) { - this.stack.pop(); - if (this.logging) { - console.groupEnd(); - } + function base(ALPHABET) { + if (ALPHABET.length >= 255) { + throw new TypeError("Alphabet too long"); + } + var BASE_MAP = new Uint8Array(256); + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255; + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i); + var xc = x.charCodeAt(0); + if (BASE_MAP[xc] !== 255) { + throw new TypeError(x + " is ambiguous"); } - if (this.logging && this.hasLoggingStarted && this.logGroup) { - console.groupEnd(); + BASE_MAP[xc] = i; + } + var BASE = ALPHABET.length; + var LEADER = ALPHABET.charAt(0); + var FACTOR = Math.log(BASE) / Math.log(256); + var iFACTOR = Math.log(256) / Math.log(BASE); + function encode2(source) { + if (source instanceof Uint8Array) { + } else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); + } else if (Array.isArray(source)) { + source = Uint8Array.from(source); } - }; - EBMLReader2.prototype.emit_segment_info = function() { - var data = this.chunks; - this.chunks = []; - if (!this.metadataloaded) { - this.metadataloaded = true; - this.metadatas = data; - var videoTrackNum = this.trackTypes.indexOf(1); - var audioTrackNum = this.trackTypes.indexOf(2); - this.trackInfo = videoTrackNum >= 0 && audioTrackNum >= 0 ? { type: "both", trackNumber: videoTrackNum } : videoTrackNum >= 0 ? { type: "video", trackNumber: videoTrackNum } : audioTrackNum >= 0 ? { type: "audio", trackNumber: audioTrackNum } : { type: "nothing" }; - if (!this.use_segment_info) { - return; - } - this.emit("metadata", { data, metadataSize: this.metadataSize }); - } else { - if (!this.use_segment_info) { - return; - } - var timecode = this.lastClusterTimecode; - var duration = this.duration; - var timecodeScale = this.timecodeScale; - this.emit("cluster", { timecode, data }); - this.emit("duration", { timecodeScale, duration }); + if (!(source instanceof Uint8Array)) { + throw new TypeError("Expected Uint8Array"); } - }; - EBMLReader2.prototype.read = function(elm) { - var _this = this; - var drop = false; - if (this.ended) { - return; + if (source.length === 0) { + return ""; } - if (elm.type === "m") { - if (elm.isEnd) { - this.stack.pop(); - } else { - var parent_1 = this.stack[this.stack.length - 1]; - if (parent_1 != null && parent_1.level >= elm.level) { - this.stack.pop(); - if (this.logging) { - console.groupEnd(); - } - parent_1.dataEnd = elm.dataEnd; - parent_1.dataSize = elm.dataEnd - parent_1.dataStart; - parent_1.unknownSize = false; - var o = Object.assign({}, parent_1, { name: parent_1.name, type: parent_1.type, isEnd: true }); - this.chunks.push(o); - } - this.stack.push(elm); - } + var zeroes = 0; + var length = 0; + var pbegin = 0; + var pend = source.length; + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++; + zeroes++; } - if (elm.type === "m" && elm.name == "Segment") { - if (this.segmentOffset != 0) { - console.warn("Multiple segments detected!"); - } - this.segmentOffset = elm.dataStart; - this.emit("segment_offset", this.segmentOffset); - } else if (elm.type === "b" && elm.name === "SimpleBlock") { - var _a = tools.ebmlBlock(elm.data), timecode = _a.timecode, trackNumber = _a.trackNumber, frames_1 = _a.frames; - if (this.trackTypes[trackNumber] === 1) { - if (!this.firstVideoBlockRead) { - this.firstVideoBlockRead = true; - if (this.trackInfo.type === "both" || this.trackInfo.type === "video") { - var CueTime = this.lastClusterTimecode + timecode; - this.cues.push({ CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - this.emit("cue_info", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime: this.lastClusterTimecode }); - this.emit("cue", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - } - } - this.last2SimpleBlockVideoTrackTimecode = [this.last2SimpleBlockVideoTrackTimecode[1], timecode]; - } else if (this.trackTypes[trackNumber] === 2) { - if (!this.firstAudioBlockRead) { - this.firstAudioBlockRead = true; - if (this.trackInfo.type === "audio") { - var CueTime = this.lastClusterTimecode + timecode; - this.cues.push({ CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - this.emit("cue_info", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime: this.lastClusterTimecode }); - this.emit("cue", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - } - } - this.last2SimpleBlockAudioTrackTimecode = [this.last2SimpleBlockAudioTrackTimecode[1], timecode]; - } - if (this.use_duration_every_simpleblock) { - this.emit("duration", { timecodeScale: this.timecodeScale, duration: this.duration }); - } - if (this.use_webp) { - frames_1.forEach(function(frame) { - var startcode = frame.slice(3, 6).toString("hex"); - if (startcode !== "9d012a") { - return; - } - ; - var webpBuf = tools.VP8BitStreamToRiffWebPBuffer(frame); - var webp = new Blob([webpBuf], { type: "image/webp" }); - var currentTime = _this.duration; - _this.emit("webp", { currentTime, webp }); - }); - } - } else if (elm.type === "m" && elm.name === "Cluster" && elm.isEnd === false) { - this.firstVideoBlockRead = false; - this.firstAudioBlockRead = false; - this.emit_segment_info(); - this.emit("cluster_ptr", elm.tagStart); - this.lastClusterPosition = elm.tagStart; - } else if (elm.type === "u" && elm.name === "Timecode") { - this.lastClusterTimecode = elm.value; - } else if (elm.type === "u" && elm.name === "TimecodeScale") { - this.timecodeScale = elm.value; - } else if (elm.type === "m" && elm.name === "TrackEntry") { - if (elm.isEnd) { - this.trackTypes[this.currentTrack.TrackNumber] = this.currentTrack.TrackType; - this.trackDefaultDuration[this.currentTrack.TrackNumber] = this.currentTrack.DefaultDuration; - this.trackCodecDelay[this.currentTrack.TrackNumber] = this.currentTrack.CodecDelay; - } else { - this.currentTrack = { TrackNumber: -1, TrackType: -1, DefaultDuration: null, CodecDelay: null }; + var size = (pend - pbegin) * iFACTOR + 1 >>> 0; + var b58 = new Uint8Array(size); + while (pbegin !== pend) { + var carry = source[pbegin]; + var i2 = 0; + for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) { + carry += 256 * b58[it1] >>> 0; + b58[it1] = carry % BASE >>> 0; + carry = carry / BASE >>> 0; } - } else if (elm.type === "u" && elm.name === "TrackType") { - this.currentTrack.TrackType = elm.value; - } else if (elm.type === "u" && elm.name === "TrackNumber") { - this.currentTrack.TrackNumber = elm.value; - } else if (elm.type === "u" && elm.name === "CodecDelay") { - this.currentTrack.CodecDelay = elm.value; - } else if (elm.type === "u" && elm.name === "DefaultDuration") { - if (this.drop_default_duration) { - console.warn("DefaultDuration detected!, remove it"); - drop = true; - } else { - this.currentTrack.DefaultDuration = elm.value; + if (carry !== 0) { + throw new Error("Non-zero carry"); } - } else if (elm.name === "unknown") { - console.warn(elm); + length = i2; + pbegin++; + } + var it2 = size - length; + while (it2 !== size && b58[it2] === 0) { + it2++; } - if (!this.metadataloaded && elm.dataEnd > 0) { - this.metadataSize = elm.dataEnd; + var str = LEADER.repeat(zeroes); + for (; it2 < size; ++it2) { + str += ALPHABET.charAt(b58[it2]); } - if (!drop) { - this.chunks.push(elm); + return str; + } + function decodeUnsafe(source) { + if (typeof source !== "string") { + throw new TypeError("Expected String"); } - if (this.logging) { - this.put(elm); + if (source.length === 0) { + return new Uint8Array(); } - }; - Object.defineProperty(EBMLReader2.prototype, "duration", { - get: function() { - if (this.trackInfo.type === "nothing") { - console.warn("no video, no audio track"); - return 0; + var psz = 0; + var zeroes = 0; + var length = 0; + while (source[psz] === LEADER) { + zeroes++; + psz++; + } + var size = (source.length - psz) * FACTOR + 1 >>> 0; + var b256 = new Uint8Array(size); + while (source[psz]) { + var carry = BASE_MAP[source.charCodeAt(psz)]; + if (carry === 255) { + return; } - var defaultDuration = 0; - var codecDelay = 0; - var lastTimecode = 0; - var _defaultDuration = this.trackDefaultDuration[this.trackInfo.trackNumber]; - if (typeof _defaultDuration === "number") { - defaultDuration = _defaultDuration; - } else { - if (this.trackInfo.type === "both") { - if (this.last2SimpleBlockAudioTrackTimecode[1] > this.last2SimpleBlockVideoTrackTimecode[1]) { - defaultDuration = (this.last2SimpleBlockAudioTrackTimecode[1] - this.last2SimpleBlockAudioTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackTypes.indexOf(2)]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockAudioTrackTimecode[1]; - } else { - defaultDuration = (this.last2SimpleBlockVideoTrackTimecode[1] - this.last2SimpleBlockVideoTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackTypes.indexOf(1)]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockVideoTrackTimecode[1]; - } - } else if (this.trackInfo.type === "video") { - defaultDuration = (this.last2SimpleBlockVideoTrackTimecode[1] - this.last2SimpleBlockVideoTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackInfo.trackNumber]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockVideoTrackTimecode[1]; - } else if (this.trackInfo.type === "audio") { - defaultDuration = (this.last2SimpleBlockAudioTrackTimecode[1] - this.last2SimpleBlockAudioTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackInfo.trackNumber]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockAudioTrackTimecode[1]; - } + var i2 = 0; + for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) { + carry += BASE * b256[it3] >>> 0; + b256[it3] = carry % 256 >>> 0; + carry = carry / 256 >>> 0; } - var duration_nanosec = (this.lastClusterTimecode + lastTimecode) * this.timecodeScale + defaultDuration - codecDelay; - var duration = duration_nanosec / this.timecodeScale; - return Math.floor(duration); - }, - enumerable: true, - configurable: true - }); - EBMLReader2.prototype.addListener = function(event, listener) { - return _super.prototype.addListener.call(this, event, listener); - }; - EBMLReader2.prototype.put = function(elm) { - if (!this.hasLoggingStarted) { - this.hasLoggingStarted = true; - if (this.logging && this.logGroup) { - console.groupCollapsed(this.logGroup); + if (carry !== 0) { + throw new Error("Non-zero carry"); } + length = i2; + psz++; } - if (elm.type === "m") { - if (elm.isEnd) { - console.groupEnd(); - } else { - console.group(elm.name + ":" + elm.tagStart); - } - } else if (elm.type === "b") { - console.log(elm.name, elm.type); - } else { - console.log(elm.name, elm.tagStart, elm.type, elm.value); + var it4 = size - length; + while (it4 !== size && b256[it4] === 0) { + it4++; + } + var vch = new Uint8Array(zeroes + (size - it4)); + var j2 = zeroes; + while (it4 !== size) { + vch[j2++] = b256[it4++]; + } + return vch; + } + function decode3(string) { + var buffer = decodeUnsafe(string); + if (buffer) { + return buffer; } + throw new Error("Non-base" + BASE + " character"); + } + return { + encode: encode2, + decodeUnsafe, + decode: decode3 }; - return EBMLReader2; - }(events_1.EventEmitter); - exports.default = EBMLReader; - } - }); - - // node_modules/ts-ebml/package.json - var require_package = __commonJS({ - "node_modules/ts-ebml/package.json"(exports, module) { - module.exports = { - name: "ts-ebml", - version: "2.0.2", - description: "ebml decoder and encoder", - scripts: { - setup: "npm install -g http-server;", - init: "npm run update; npm run mkdir; npm run build", - update: "npm run reset; npm update", - reset: "rm -rf node_modules", - mkdir: "mkdir lib dist 2>/dev/null", - clean: "rm -rf lib/* dist/* test/*.js; mkdir -p dist", - build: "npm run clean && tsc -p .; npm run browserify", - start: "http-server . -s & tsc -w -p .& watchify lib/example_seekable.js -o test/example_seekable.js", - stop: "killall -- node */tsc -w -p", - browserify: "browserify lib/index.js --standalone EBML -o dist/EBML.js", - watchify: "watchify lib/index.js --standalone EBML -o dist/EBMl.js -v", - test: "tsc; espower lib/test.js > lib/test.tmp; mv -f lib/test.tmp lib/test.js; browserify lib/test.js -o test/test.js", - example: "tsc; browserify lib/example_seekable.js -o test/example_seekable.js", - examples: "tsc; for file in `find lib -name 'example_*.js' -type f -printf '%f\\n'`; do browserify lib/$file -o test/$file; done", - examples_bsd: "tsc; for file in `find lib -name 'example_*.js' -type f -print`; do browserify lib/$(basename $file) -o test/$(basename $file); done", - check: "tsc -w --noEmit -p ./", - lint: "tslint -c ./tslint.json --project ./tsconfig.json --type-check", - doc: "typedoc --mode modules --out doc --disableOutputCheck" - }, - repository: { - type: "git", - url: "git+https://github.com/legokichi/ts-ebml.git" - }, - keywords: [ - "ebml", - "webm", - "mkv", - "matrosika", - "webp" - ], - author: "legokichi duckscallion", - license: "MIT", - bugs: { - url: "https://github.com/legokichi/ts-ebml/issues" - }, - homepage: "https://github.com/legokichi/ts-ebml#readme", - dependencies: { - buffer: "^5.0.7", - commander: "^2.11.0", - ebml: "^2.2.1", - "ebml-block": "^1.1.0", - events: "^1.1.1", - "int64-buffer": "^0.1.9", - matroska: "^2.2.3" - }, - devDependencies: { - "@types/commander": "^2.9.1", - "@types/qunit": "^2.0.31", - browserify: "^13.1.0", - empower: "^1.2.3", - "espower-cli": "^1.1.0", - "power-assert": "^1.4.4", - "power-assert-formatter": "^1.4.1", - "qunit-tap": "^1.5.1", - qunitjs: "^2.4.0", - tslint: "^3.15.1", - typedoc: "^0.5.3", - typescript: "^2.4.2", - watchify: "^3.7.0" - }, - bin: "./lib/cli.js", - main: "./lib/index.js", - typings: "./lib/index.d.ts" - }; + } + module.exports = base; } }); - // node_modules/ts-ebml/lib/index.js - var require_lib2 = __commonJS({ - "node_modules/ts-ebml/lib/index.js"(exports) { - "use strict"; + // node_modules/bs58/index.js + var require_bs58 = __commonJS({ + "node_modules/bs58/index.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var EBMLDecoder_1 = require_EBMLDecoder(); - exports.Decoder = EBMLDecoder_1.default; - var EBMLEncoder_1 = require_EBMLEncoder(); - exports.Encoder = EBMLEncoder_1.default; - var EBMLReader_1 = require_EBMLReader(); - exports.Reader = EBMLReader_1.default; - var tools = require_tools2(); - exports.tools = tools; - var version = require_package().version; - exports.version = version; + var basex = require_src(); + var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + module.exports = basex(ALPHABET); } }); @@ -17032,10 +7241,10 @@ if (frames.length != 1) throw new Error("only single frame JPEGs supported"); for (var i = 0; i < frames.length; i++) { - var cp = frames[i].components; - for (var j in cp) { - cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx]; - delete cp[j].quantizationIdx; + var cp2 = frames[i].components; + for (var j in cp2) { + cp2[j].quantizationTable = quantizationTables[cp2[j].quantizationIdx]; + delete cp2[j].quantizationIdx; } } this.width = frame.samplesPerLine; @@ -17311,8 +7520,7 @@ // src/main.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_process = __toESM(require_node_process(), 1); - var import_buffer11 = __toESM(require_buffer(), 1); + var import_buffer9 = __toESM(require_buffer(), 1); // src/stores.ts init_define_BUILD_VERSION(); @@ -18188,6 +8396,9 @@ // src/stores.ts var localLoad = async (key2, def) => { + if (false) { + return def; + } const isinls = "__pee__" + key2 in localStorage; let ret; if (isinls) { @@ -18212,6 +8423,9 @@ return ret; }; var localSet = (key2, value) => { + if (false) { + return; + } if (false) chrome.storage.local.set({ [key2]: JSON.stringify(value) }); else @@ -18431,15 +8645,6 @@ this.writer.releaseLock(); } }; - var BufferWriteStream = () => { - let b = import_buffer.Buffer.from([]); - const ret = new WritableStream({ - write(chunk) { - b = import_buffer.Buffer.concat([b, chunk]); - } - }); - return [ret, () => b]; - }; // src/utils.ts init_define_BUILD_VERSION(); @@ -18553,9 +8758,12 @@ var lqueue = {}; var localLoad2 = (key2, def) => "__pee__" + key2 in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key2)) : def; var localSet2 = (key2, value) => localStorage.setItem("__pee__" + key2, JSON.stringify(value)); - var { port1, port2 } = new MessageChannel(); - console.log("userscript", "false"); + var port1; + console.log("userscript", false); if (false) { + const nmc = new MessageChannel(); + port1 = nmc.port1; + port2 = nmc.port2; const iframe = document.createElement("iframe"); iframe.style.display = "none"; iframe.name = location.origin; @@ -18563,7 +8771,6 @@ iframe.onload = _; }); iframe.src = `${chrome.runtime.getURL("")}options.html`; - const meself = new URL(chrome.runtime.getURL("")).origin; document.documentElement.appendChild(iframe); iframeloaded.then(() => { iframe.contentWindow?.postMessage("", "*", [port2]); @@ -18572,12 +8779,27 @@ lqueue[ev.data.id](ev.data); }; } + console.log("userscript"); + if (false) { + port1 = { + onmessage(ev) { + lqueue[ev.data.id](ev.data); + }, + postMessage(msg, tr) { + postMessage({ + type: "ipc", + tr, + msg + }, tr); + } + }; + } var gid = 0; var sendCmd = (cmd, tr) => { const prom = new Promise((_) => { const id = gid++; lqueue[id] = (e) => { - _(e.res); + _(e); delete lqueue[id]; }; port1.postMessage({ id, ...cmd }, tr || []); @@ -18658,36 +8880,6 @@ return corsFetch(url.toString(), opt, lisn); return GM_fetch(url, opt, lisn); } - async function* streamRemote(url, chunkSize = 72 * 1024, fetchRestOnNonCanceled = true) { - let size = Number.POSITIVE_INFINITY; - let ptr = 0; - let fetchSize = chunkSize; - while (ptr != size) { - let obj; - const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } }); - if (true) { - obj = headerStringToObject(fres.responseHeaders); - } else { - obj = fres.headers; - } - if (!("content-length" in obj)) { - console.warn("no content lenght???", url); - break; - } - if ("content-range" in obj) { - size = +obj["content-range"].split("/")[1]; - } - const len = +obj["content-length"]; - ptr += len; - if (fetchRestOnNonCanceled) - fetchSize = size; - const val = Buffer2.from(await fres.arrayBuffer()); - const e = yield val; - if (e) { - break; - } - } - } // src/filehosts.ts function parseForm(data) { @@ -18846,12 +9038,12 @@ static inRange(a, min, max) { return min <= a && a <= max; } - static codePointToString(cp) { - if (cp <= 65535) { - return String.fromCharCode(cp); + static codePointToString(cp2) { + if (cp2 <= 65535) { + return String.fromCharCode(cp2); } else { - cp -= 65536; - return String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320); + cp2 -= 65536; + return String.fromCharCode((cp2 >> 10) + 55296, (cp2 & 1023) + 56320); } } static singleByteDecoder(bite) { @@ -20698,11 +10890,7 @@ }, filename: fn, thumbnail: csettings.hotlink ? prev || full : import_buffer2.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings.hotlink ? full || prev : async (lsn) => { - if (!cachedFile) - cachedFile = await (await ifetch(full || prev, void 0, lsn)).arrayBuffer(); - return import_buffer2.Buffer.from(cachedFile); - } + data: csettings.hotlink ? full || prev : { url: full || prev } }]; ret.push([end, true]); } @@ -20755,17 +10943,17 @@ if (hasThumbnail) { thumbsize = header.readInt32LE(ptr); ptr += 4; - if (header.byteLength < ptr + thumbsize) + if (header.byteLength >= ptr + thumbsize) thumb = header.slice(ptr, ptr + thumbsize); else thumb = import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer()); ptr += thumbsize; } - const unzip = async (lsn) => import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } }, lsn)).arrayBuffer()); + const unzip = { url: pee, headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } }; let data; data = unzip; if (size < 3072) { - thumb = data = await unzip(); + thumb = data = import_buffer2.Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer()); } return { filename: fn, @@ -20808,7 +10996,7 @@ if (typeof ef.data == "string") { const req = await ifetch(ef.data); buff = import_buffer2.Buffer.from(await req.arrayBuffer()); - } else if (!import_buffer2.Buffer.isBuffer(ef.data)) + } else if (!(ef.data instanceof Uint8Array)) buff = await ef.data(); else buff = ef.data; @@ -20852,197 +11040,34 @@ } addEventListener(ev, cb) { this.targets[ev] = this.targets[ev] || []; - this.targets[ev].push(cb); - } - dispatchEvent(ev) { - const evs = this.targets[ev.type]; - if (evs) - for (const cb of evs) - cb(ev); - return true; - } - removeEventListener(ev, cb) { - const evs = this.targets[ev]; - if (!evs) - return; - for (let i = 0; i < evs.length; ++i) { - if (evs[i] == cb) { - evs.splice(i, 1); - return; - } - } - } - }; - - // src/pngv3.ts - var bs58 = __toESM(require_bs58(), 1); - - // src/bitstream.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/reader.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/string-encoding-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/writer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/array-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/array-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/resolve-length.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/structure-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/utils.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/boolean-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/boolean-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/buffer-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/buffer-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/element.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/buffered-writable.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/constructor.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/discriminant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/writable.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/incomplete-read-result.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/element.js - var _parent; - var _readFields; - var _isBeingRead; - var _fieldBeingComputed; - var _fieldBeingComputedIntrospectable; - var SERIALIZE_WRITERS = Symbol("Writers used by Bitstream#serialize() for this element type."); - _parent = /* @__PURE__ */ new WeakMap(), _readFields = /* @__PURE__ */ new WeakMap(), _isBeingRead = /* @__PURE__ */ new WeakMap(), _fieldBeingComputed = /* @__PURE__ */ new WeakMap(), _fieldBeingComputedIntrospectable = /* @__PURE__ */ new WeakMap(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field-definition.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/null-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/number-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/string-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/length-determinant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/number-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/value-determinant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant-definition.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/reserved.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); + this.targets[ev].push(cb); + } + dispatchEvent(ev) { + const evs = this.targets[ev.type]; + if (evs) + for (const cb of evs) + cb(ev); + return true; + } + removeEventListener(ev, cb) { + const evs = this.targets[ev]; + if (!evs) + return; + for (let i = 0; i < evs.length; ++i) { + if (evs[i] == cb) { + evs.splice(i, 1); + return; + } + } + } + }; - // node_modules/@astronautlabs/bitstream/dist.esm/elements/reserved-low.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); + // src/pngv3.ts + var bs58 = __toESM(require_bs58(), 1); - // node_modules/@astronautlabs/bitstream/dist.esm/elements/marker.js + // src/bitstream.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - - // src/bitstream.ts var revbyte = (n, len = 8) => { let acc = 0; let n2 = n; @@ -21054,7 +11079,7 @@ } return acc; }; - var BitstreamReader2 = class { + var BitstreamReader = class { constructor() { this.buffers = []; this.bufferedLength = 0; @@ -21093,7 +11118,7 @@ this.bufferedLength += buffer.length * 8; } }; - var BitstreamWriter2 = class { + var BitstreamWriter = class { constructor(stream, bufferSize = 1) { this.stream = stream; this.pendingBits = 0; @@ -21117,8 +11142,6 @@ this.buffer.fill(0); } setBit(b) { - if (b) - debugger; let byte = this.buffer[0]; byte |= b << (this._offset & 7); this.buffer[0] = byte; @@ -21413,7 +11436,7 @@ let backoffset = tinf_read_bits(d, dist_bits[dist], dist_base[dist]); const offs2 = d.dest.length - backoffset; let match; - const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader2 && d.to_hide.available == 0; + const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader && d.to_hide.available == 0; if (!skip && (match = Buffer2.from(d.dest.slice(offs2, offs2 + length))).length == length) { let begin = d.dest.length - 32768; if (begin < 0) @@ -21439,7 +11462,7 @@ matches.reverse(); const v = Math.floor(Math.log2(matches.length)); capacity += v; - if (d.to_hide instanceof BitstreamReader2) { + if (d.to_hide instanceof BitstreamReader) { if (d.to_hide.available) { const s = d.to_hide.readSync(Math.min(d.to_hide.available, v)); backoffset = matches[s]; @@ -21480,8 +11503,8 @@ return TINF_OK; } function tinf_uncompress(source, decompressed, to_hide, hidden, opt = 0) { - const decomp = decompressed ? new BitstreamWriter2({ write: decompressed }) : null; - const hid = hidden && new BitstreamWriter2({ write: hidden }, 4); + const decomp = decompressed ? new BitstreamWriter({ write: decompressed }) : null; + const hid = hidden && new BitstreamWriter({ write: hidden }, 4); const d = new Data(source, decomp, to_hide, hid); let res; let bfinal, btype; @@ -21564,10 +11587,10 @@ "z": "z.zz.fo" }; var extractFromRawDeflate = (b) => { - const src = new BitstreamReader2(); + const src = new BitstreamReader(); src.addBuffer(b); const chnks = []; - const hidden = new BitstreamWriter2({ + const hidden = new BitstreamWriter({ write(chunk) { for (const i of chunk) { if (i) @@ -21585,7 +11608,7 @@ } return false; }; - var extract = async (png) => { + var extract = async (png, doextract = true) => { const reader = BufferReadStream(png).getReader(); const sneed = new PNGDecoder(reader, false); const ret = []; @@ -21601,22 +11624,28 @@ case "tEXt": buff = chunk; if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) { + if (!doextract) + return true; const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM4.length); xor(passed, password); const k = await decodeCoom3Payload(passed); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM5.length); const decoded = import_buffer3.Buffer.from(passed.toString(), "base64").toString().split(" ").map((e) => { return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (w = [CUM6, CUM7].find((e) => buff.slice(4, 4 + e.length).equals(e))) { const passed = buff.slice(4 + w.length); @@ -21633,8 +11662,10 @@ throw "Uhh"; return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); + if (!doextract) + return true; const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } catch (e) { } } @@ -21661,10 +11692,13 @@ throw "Uhh"; return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); - return decodeCoom3Payload(import_buffer3.Buffer.from(dec)); + if (doextract) + return decodeCoom3Payload(import_buffer3.Buffer.from(dec)); + return true; } } catch (e) { - console.error(e); + if (e != "Uhh") + console.error(e); } finally { reader.releaseLock(); } @@ -21675,7 +11709,7 @@ data.copy(ret, 4); return ret; }; - var BufferWriteStream2 = () => { + var BufferWriteStream = () => { let b = import_buffer3.Buffer.from([]); const ret = new WritableStream({ write(chunk) { @@ -21686,8 +11720,8 @@ return [ret, () => b]; }; var embedInRawDeflate = (b, h) => { - const src = new BitstreamReader2(); - const hid = new BitstreamReader2(); + const src = new BitstreamReader(); + const hid = new BitstreamReader(); hid.addBuffer(h); src.addBuffer(b); const chnks = []; @@ -21698,14 +11732,14 @@ if (!csettings2) throw new Error("Settings uninit"); if (csettings2.pmeth < 5) { - let magic4 = false; - const [writestream2, extract8] = BufferWriteStream2(); + let magic = false; + const [writestream2, extract6] = BufferWriteStream(); const encoder = new PNGEncoder(writestream2); const decoder = new PNGDecoder(container.stream().getReader()); for await (const [name, chunk, crc, offset] of decoder.chunks()) { - if (magic4 && name != "IDAT") + if (magic && name != "IDAT") break; - if (!magic4 && name == "IDAT") { + if (!magic && name == "IDAT") { const passed = import_buffer3.Buffer.from(injb); switch (csettings2.pmeth) { case 0: @@ -21725,7 +11759,7 @@ await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM7, import_buffer3.Buffer.from(bs58.encode(passed))])), 0, 0]); break; } - magic4 = true; + magic = true; } await encoder.insertchunk([name, chunk, crc, offset]); } @@ -21735,7 +11769,7 @@ 0, 0 ]); - return extract8(); + return extract6(); } let pdec = new PNGDecoder(container.stream().getReader()); const concat = []; @@ -21746,7 +11780,7 @@ const head = comp.slice(0, 2); const chksum = comp.slice(-4); const idatblk = embedInRawDeflate(comp.slice(2, -4), injb); - const [writestream, extract7] = BufferWriteStream2(); + const [writestream, extract5] = BufferWriteStream(); const penc = new PNGEncoder(writestream); pdec = new PNGDecoder(container.stream().getReader()); let ins = false; @@ -21762,7 +11796,7 @@ } await penc.dtor(); console.log("Finished writing"); - return extract7(); + return extract5(); }; var inject = async (container, links) => { links = links.map((link) => { @@ -21778,7 +11812,7 @@ return inject_data(container, injb); }; var has_embed = async (png) => { - const r = await extract(png); + const r = await extract(png, false); return !!r; }; var pngv3_default = { @@ -21788,287 +11822,10 @@ match: (fn) => !!fn.match(/\.png$/) }; - // src/webm.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var import_buffer4 = __toESM(require_buffer(), 1); - var ebml = __toESM(require_lib2(), 1); - var password2 = import_buffer4.Buffer.from("NOA"); - var xor2 = (a, p) => { - let n = 0; - for (let i = 0; i < a.byteLength; ++i) { - a[i] ^= p[n]; - n++; - n %= p.byteLength; - } - }; - var findEnclosingTag = (ch, name) => { - const first = ch.findIndex((e) => e.type == "m" && e.name == name); - if (first < 0) - return; - const second = ch.slice(first).findIndex((e) => e.type == "m" && e.name == name); - if (second < 0) - return; - return [ - first, - first + second - ]; - }; - var embed = (webm, data) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const enc = new ebml.Encoder(); - let embed2 = chunks.findIndex((e) => e.name == "Tracks" && e.type == "m" && e.isEnd); - const findOrInsert = (n) => { - let tags = findEnclosingTag(chunks, n); - const stack = []; - if (!tags) { - stack.push({ - type: "m", - isEnd: false, - name: n, - data: import_buffer4.Buffer.from("") - }); - stack.push({ - type: "m", - isEnd: true, - name: n, - data: import_buffer4.Buffer.from("") - }); - chunks.splice(embed2 + 1, 0, ...stack); - tags = findEnclosingTag(chunks, n); - } - embed2 = tags[1]; - }; - findOrInsert("Tags"); - findOrInsert("Tag"); - findOrInsert("Targets"); - embed2++; - chunks.splice(embed2 + 1, 0, ...[ - { - type: "m", - isEnd: false, - name: "SimpleTag", - data: import_buffer4.Buffer.from("") - }, - { - type: "8", - isEnd: false, - name: "TagName", - data: import_buffer4.Buffer.from("VOOM") - }, - { - type: "8", - isEnd: false, - name: "TagBinary", - data - }, - { - type: "m", - isEnd: true, - name: "SimpleTag", - data: import_buffer4.Buffer.from("") - } - ]); - return import_buffer4.Buffer.from(enc.encode(chunks.filter((e) => e.name != "unknown"))); - }; - var extract2 = (webm) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM")); - const cl = chunks.find((e) => e.name == "Cluster"); - if (cl && embed2 == -1) - return; - if (embed2 == -1) - return; - const echk = chunks[embed2]; - const chk = chunks[embed2 + 1]; - if (chk.type == "b" && chk.name == "TagBinary") { - if (echk.type == "8" && echk.value == "VOOM") { - xor2(chk.data, password2); - } - return decodeCoom3Payload(chk.data); - } - }; - var inject2 = async (container, links) => { - const buff = import_buffer4.Buffer.from(links.join(" ")); - xor2(buff, password2); - return embed(import_buffer4.Buffer.from(await container.arrayBuffer()), buff); - }; - var has_embed2 = (webm) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM")); - const cl = chunks.find((e) => e.name == "Cluster"); - if (cl && embed2 == -1) - return false; - if (embed2 == -1) - return; - return true; - }; - var webm_default = { - extract: extract2, - has_embed: has_embed2, - inject: inject2, - match: (fn) => !!fn.match(/\.webm$/) - }; - - // src/gif.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var import_buffer5 = __toESM(require_buffer(), 1); - var netscape = import_buffer5.Buffer.from("!\xFF\vNETSCAPE2.0", "ascii"); - var magic = import_buffer5.Buffer.from("!\xFF\vDOOMTECH1.1", "ascii"); - var magic2 = import_buffer5.Buffer.from("!\xFF\vVOOMTECH1.1", "ascii"); - var magic3 = import_buffer5.Buffer.from("!\xFF\vANIMEXTS1.0", "ascii"); - var read_section = (gif, pos) => { - const begin = pos; - pos += 3 + gif[pos + 2]; - let buf2 = import_buffer5.Buffer.alloc(0); - while (pos < gif.byteLength) { - const v = gif[pos++]; - buf2 = import_buffer5.Buffer.concat([buf2, gif.slice(pos, pos + v)]); - if (v == 0) - break; - pos += v; - } - const appname = gif.slice(begin + 3, begin + 11).toString("ascii"); - return { - appname, - data: buf2, - end: pos - }; - }; - var password3 = import_buffer5.Buffer.from("NOA"); - var xor3 = (a, p) => { - let n = 0; - for (let i = 0; i < a.byteLength; ++i) { - a[i] ^= p[n]; - n++; - n %= p.byteLength; - } - }; - var extractBuff = (gif) => { - const field = gif.readUInt8(10); - const gcte = !!(field & 1 << 7); - let end = 13; - if (gcte) { - end += 3 * (1 << (field & 7) + 1); - } - while (gif[end] == "!".charCodeAt(0)) { - let sec = read_section(gif, end); - if (sec.appname == "DOOMTECH") { - const ret = import_buffer5.Buffer.alloc(sec.data.readInt32LE(0)); - let ptr = 0; - do { - sec = read_section(gif, sec.end); - sec.data.copy(ret, ptr); - ptr += sec.data.byteLength; - end = sec.end; - } while (sec.appname == "DOOMTECH" && gif[end] == "!".charCodeAt(0)); - return decodeCoom3Payload(ret); - } - const cond = () => sec.appname == "VOOMTECH" || sec.appname == "ANIMEXTS"; - if (cond()) { - const ret = import_buffer5.Buffer.alloc(sec.data.readInt32LE(0)); - let ptr = 0; - do { - sec = read_section(gif, sec.end); - sec.data.copy(ret, ptr); - ptr += sec.data.byteLength; - end = sec.end; - } while (cond() && gif[end] == "!".charCodeAt(0)); - xor3(ret, password3); - return decodeCoom3Payload(ret); - } - end = sec.end; - } - throw new Error("Shouldn't happen"); - }; - var extract3 = extractBuff; - var write_data = async (writer, inj) => { - await writer.write(magic3); - const byte = import_buffer5.Buffer.from([0]); - let size = inj.byteLength; - let ws; - let offset = 0; - while (size != 0) { - ws = size >= 255 ? 255 : size; - byte.writeUInt8(ws, 0); - await writer.write(byte); - await writer.write(inj.slice(offset, offset + ws)); - size -= ws; - offset += ws; - } - byte.writeUInt8(0, 0); - await writer.write(byte); - }; - var write_embedding = async (writer, inj) => { - const b = import_buffer5.Buffer.alloc(4); - b.writeInt32LE(inj.byteLength, 0); - await write_data(writer, b); - let size = inj.byteLength; - let offset = 0; - while (size != 0) { - const ws = size >= 3 << 13 ? 3 << 13 : size; - await write_data(writer, inj.slice(offset, offset + ws)); - offset += ws; - size -= ws; - } - }; - var inject3 = async (container, links) => { - const [writestream, extract7] = BufferWriteStream(); - const writer = writestream.getWriter(); - const inj = import_buffer5.Buffer.from(links.join(" ")); - xor3(inj, password3); - const contbuff = import_buffer5.Buffer.from(await container.arrayBuffer()); - const field = contbuff.readUInt8(10); - const gcte = !!(field & 1 << 7); - let endo = 13; - if (gcte) - endo += 3 * (1 << (field & 7) + 1); - if (netscape.compare(contbuff, endo, endo + netscape.byteLength) == 0) - endo += 19; - await writer.write(contbuff.slice(0, endo)); - await write_embedding(writer, import_buffer5.Buffer.from(inj)); - await writer.write(contbuff.slice(endo)); - return extract7(); - }; - var has_embed3 = (gif) => { - const field = gif.readUInt8(10); - const gcte = !!(field & 1 << 7); - let end = 13; - if (gcte) { - end += 3 * (1 << (field & 7) + 1); - } - while (end < gif.byteLength && gif.readUInt8(end) == "!".charCodeAt(0)) { - if ([magic, magic2, magic3].every((m) => m.compare(gif, end, end + m.byteLength) != 0)) { - end += 3 + gif.readUInt8(end + 2); - while (true) { - const v = gif.readUInt8(end++); - if (!v) - break; - end += v; - } - } else { - return true; - } - } - if (end >= gif.byteLength) - return; - return false; - }; - var gif_default = { - extract: extract3, - has_embed: has_embed3, - inject: inject3, - match: (fn) => !!fn.match(/\.gif$/) - }; - // src/jpg.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer6 = __toESM(require_buffer(), 1); + var import_buffer4 = __toESM(require_buffer(), 1); // src/f5stego.ts init_define_BUILD_VERSION(); @@ -23709,23 +13466,23 @@ }; // src/jpg.ts - var key = import_buffer6.Buffer.from("CUNNYCUNNYCUNNY"); + var key = import_buffer4.Buffer.from("CUNNYCUNNYCUNNY"); var f5inst = new f5stego(key); - var inject4 = async (b, links) => { + var inject2 = async (b, links) => { if (b.size / 20 < links.join(" ").length) throw "Image too small to embed."; const arr = new Uint8Array(new Uint8Array(await b.arrayBuffer())); const buff = f5inst.embed(arr, new TextEncoder().encode(links.join(" ")), 1); - return import_buffer6.Buffer.from(buff); + return import_buffer4.Buffer.from(buff); }; - var has_embed4 = (b) => { + var has_embed2 = (b) => { try { const res = f5inst.extract(b); if (!res) return false; if (res.length > 1024) return false; - const str = import_buffer6.Buffer.from(res).toString(); + const str = import_buffer4.Buffer.from(res).toString(); if (!str.match(/^[a-zA-Z0-9:/.\-_ ]+$/)) return false; return str; @@ -23733,20 +13490,20 @@ return false; } }; - var extract4 = (b, ex) => { - return decodeCoom3Payload(import_buffer6.Buffer.from(ex)); + var extract2 = (b, ex) => { + return decodeCoom3Payload(import_buffer4.Buffer.from(ex)); }; var jpg_default = { match: (fn) => !!fn.match(/\.jpe?g$/), - has_embed: has_embed4, - extract: extract4, - inject: inject4 + has_embed: has_embed2, + extract: extract2, + inject: inject2 }; // src/thirdeye.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer7 = __toESM(require_buffer(), 1); + var import_buffer5 = __toESM(require_buffer(), 1); var import_jpeg_js = __toESM(require_jpeg_js(), 1); // src/phash.ts @@ -23862,7 +13619,7 @@ return []; } }; - var extract5 = async (b, fn) => { + var extract3 = async (b, fn) => { if (!csettings3) throw new Error("Settings uninit"); let result; @@ -23886,12 +13643,8 @@ url: result[0].page }, filename: fn.substring(0, 33) + result[0].ext, - thumbnail: csettings3.hotlink ? prev || full : import_buffer7.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings3.hotlink ? full || prev : async (lsn) => { - if (!cachedFile) - cachedFile = await (await ifetch(full || prev, void 0, lsn)).arrayBuffer(); - return import_buffer7.Buffer.from(cachedFile); - } + thumbnail: csettings3.hotlink ? prev || full : import_buffer5.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), + data: csettings3.hotlink ? full || prev : { url: full || prev } }]; }; var phash = (b) => { @@ -23907,8 +13660,8 @@ } return acc; }; - var has_embed5 = async (b, fn, prevlink) => { - if (import_buffer7.Buffer.from(fn, "hex").equals(b)) + var has_embed3 = async (b, fn, prevlink) => { + if (import_buffer5.Buffer.from(fn, "hex").equals(b)) return false; let result = void 0; for (const e of Object.values(boorus)) { @@ -23925,7 +13678,7 @@ const getHash = async (l) => { const ogreq = await ifetch(l); const origPreview = await ogreq.arrayBuffer(); - return phash(import_buffer7.Buffer.from(origPreview)); + return phash(import_buffer5.Buffer.from(origPreview)); }; const [orighash, tehash] = await Promise.all([ getHash(prevlink), @@ -23939,15 +13692,15 @@ }; var thirdeye_default = { skip: true, - extract: extract5, - has_embed: has_embed5, + extract: extract3, + has_embed: has_embed3, match: (fn) => !!fn.match(/^[0-9a-f]{32}\.....?/) }; // src/pomf.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer8 = __toESM(require_buffer(), 1); + var import_buffer6 = __toESM(require_buffer(), 1); var sources = [ { host: "Catbox", prefix: "files.catbox.moe/" }, { host: "Litter", prefix: "litter.catbox.moe/" }, @@ -23980,7 +13733,7 @@ } return { ext, source }; }; - var extract6 = async (b, fn) => { + var extract4 = async (b, fn) => { if (!csettings4) throw new Error("Settings uninit"); const { ext, source } = getExt(fn); @@ -23997,16 +13750,11 @@ } return [{ filename: ext, - data: csettings4.hotlink ? rsource : async (lsn) => { - try { - return import_buffer8.Buffer.from(await (await ifetch(rsource, void 0, lsn)).arrayBuffer()); - } catch (e) { - } - }, - thumbnail: import_buffer8.Buffer.from(hasembed_default) + data: csettings4.hotlink ? rsource : { url: rsource }, + thumbnail: import_buffer6.Buffer.from(hasembed_default) }]; }; - var has_embed6 = async (b, fn) => { + var has_embed4 = async (b, fn) => { const { ext, source } = getExt(fn); if (!ext) return false; @@ -24023,8 +13771,8 @@ }; var pomf_default = { skip: true, - extract: extract6, - has_embed: has_embed6, + extract: extract4, + has_embed: has_embed4, match: (fn) => !!getExt(fn) }; @@ -24744,7 +14492,7 @@ // src/Components/Embedding.svelte init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer9 = __toESM(require_buffer(), 1); + var import_buffer7 = __toESM(require_buffer(), 1); function add_css6(target) { append_styles(target, "svelte-olzxr6", ".plaace.svelte-olzxr6.svelte-olzxr6{cursor:pointer;max-width:100vw;max-height:100vh}.unzipping.svelte-olzxr6>img.svelte-olzxr6{filter:brightness(0.5) blur(10px)}.progress.svelte-olzxr6.svelte-olzxr6{color:black;-webkit-text-stroke:0.7px white;font-weight:bold;left:50%;top:50%;font-size:larger;display:inline-block;position:absolute;z-index:10}.hoverer.svelte-olzxr6.svelte-olzxr6{display:none;position:fixed;pointer-events:none}.visible.svelte-olzxr6.svelte-olzxr6{display:block;z-index:9}.contract.svelte-olzxr6 img.svelte-olzxr6,.contract.svelte-olzxr6 video.svelte-olzxr6{max-width:125px !important;max-height:125px !important;width:auto;height:auto}.plaace.svelte-olzxr6:not(.contract) video.svelte-olzxr6,.plaace.svelte-olzxr6:not(.contract) img.svelte-olzxr6,.hoverer.svelte-olzxr6>video.svelte-olzxr6,.hoverer.svelte-olzxr6>img.svelte-olzxr6{max-width:100vw;max-height:100vh}"); } @@ -25282,7 +15030,7 @@ const thumb = file.thumbnail || file.data; let type; if (typeof thumb != "string") { - let buff = import_buffer9.Buffer.isBuffer(thumb) ? thumb : await thumb(); + let buff = thumb instanceof Uint8Array ? thumb : await thumb(); type = await fileTypeFromBuffer(buff); if (!type && file.filename.endsWith(".txt") && file.filename.startsWith("message")) { type = { ext: "txt", mime: "text/plain" }; @@ -25346,7 +15094,7 @@ lisn.addEventListener("progress", (e) => { $$invalidate(18, progress = e.detail); }); - let full = import_buffer9.Buffer.isBuffer(file.data) ? file.data : await file.data(lisn); + let full = file.data instanceof Uint8Array ? file.data : await file.data(lisn); type = await fileTypeFromBuffer(full); if (!type && file.filename.endsWith(".txt") && file.filename.startsWith("message")) { type = { ext: "txt", mime: "text/plain" }; @@ -29816,7 +19564,7 @@ // src/Components/EyeButton.svelte init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer10 = __toESM(require_buffer(), 1); + var import_buffer8 = __toESM(require_buffer(), 1); function add_css12(target) { append_styles(target, "svelte-64lw6s", ".clickable.svelte-64lw6s{cursor:pointer;margin-left:5px}.clickable.svelte-64lw6s:hover{text-shadow:0 0 4px palevioletred}"); } @@ -30164,7 +19912,7 @@ a.style.display = "none"; let url; if (typeof file.data != "string") { - const thumb = import_buffer10.Buffer.isBuffer(file.data) ? file.data : await file.data(); + const thumb = file.data instanceof Uint8Array ? file.data : await file.data(); const type = await fileTypeFromBuffer(thumb); url = URL.createObjectURL(new Blob([thumb], { type: type?.mime })); } else @@ -30418,11 +20166,7 @@ catalogControlHost: () => document.getElementById("index-options"), getImageLink: async function* (post) { if (location.host == "arch.b4k.co") { - const pid = post.id.match(/\d+/)[0]; - const board = location.pathname.match(/\/(..?.?)\//)[1]; - const res = await ifetch(`https://archive.wakarimasen.moe/_/api/chan/post/?board=${board}&num=${pid}`); - const data = await res.json(); - yield data.media.media_link; + return; } yield post.querySelector("a[rel]")?.getAttribute("href") || ""; }, @@ -31651,12 +21395,33 @@ }; var ViewCount_default = ViewCount; + // src/processor.worker.ts + init_define_BUILD_VERSION(); + init_esbuild_inject(); + + // inline-worker:__inline-worker + init_define_BUILD_VERSION(); + init_esbuild_inject(); + function inlineWorker(scriptText) { + let blob = new Blob([scriptText], { type: "text/javascript" }); + let url = URL.createObjectURL(blob); + let worker = new Worker(url); + URL.revokeObjectURL(url); + return worker; + } + + // src/processor.worker.ts + function Worker2() { + return inlineWorker('var __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n};\nvar __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key2 of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key2) && key2 !== except)\n __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));\nvar __decorateClass = (decorators, target, key2, kind) => {\n var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;\n for (var i = decorators.length - 1, decorator; i >= 0; i--)\n if (decorator = decorators[i])\n result = (kind ? decorator(target, key2, result) : decorator(result)) || result;\n if (kind && result)\n __defProp(target, key2, result);\n return result;\n};\nvar __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError("Cannot " + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, "read from private field");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError("Cannot add the same private member more than once");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, "write to private field");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, "access private method");\n return method;\n};\nvar __toBinary = /* @__PURE__ */ (() => {\n var table = new Uint8Array(128);\n for (var i = 0; i < 64; i++)\n table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;\n return (base64) => {\n var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0);\n for (var i2 = 0, j = 0; i2 < n; ) {\n var c0 = table[base64.charCodeAt(i2++)], c1 = table[base64.charCodeAt(i2++)];\n var c2 = table[base64.charCodeAt(i2++)], c3 = table[base64.charCodeAt(i2++)];\n bytes[j++] = c0 << 2 | c1 >> 4;\n bytes[j++] = c1 << 4 | c2 >> 2;\n bytes[j++] = c2 << 6 | c3;\n }\n return bytes;\n };\n})();\n\n// \nvar init_define_BUILD_VERSION = __esm({\n ""() {\n }\n});\n\n// node_modules/base64-js/index.js\nvar require_base64_js = __commonJS({\n "node_modules/base64-js/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports.byteLength = byteLength;\n exports.toByteArray = toByteArray;\n exports.fromByteArray = fromByteArray;\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;\n var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n for (i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n var i;\n var len;\n revLookup["-".charCodeAt(0)] = 62;\n revLookup["_".charCodeAt(0)] = 63;\n function getLens(b64) {\n var len2 = b64.length;\n if (len2 % 4 > 0) {\n throw new Error("Invalid string. Length must be a multiple of 4");\n }\n var validLen = b64.indexOf("=");\n if (validLen === -1)\n validLen = len2;\n var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n }\n function byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function _byteLength(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i2;\n for (i2 = 0; i2 < len2; i2 += 4) {\n tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];\n arr[curByte++] = tmp >> 16 & 255;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 2) {\n tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n }\n function tripletToBase64(num) {\n return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\n }\n function encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i2 = start; i2 < end; i2 += 3) {\n tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);\n output.push(tripletToBase64(tmp));\n }\n return output.join("");\n }\n function fromByteArray(uint8) {\n var tmp;\n var len2 = uint8.length;\n var extraBytes = len2 % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {\n parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));\n }\n if (extraBytes === 1) {\n tmp = uint8[len2 - 1];\n parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");\n } else if (extraBytes === 2) {\n tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];\n parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");\n }\n return parts.join("");\n }\n }\n});\n\n// node_modules/ieee754/index.js\nvar require_ieee754 = __commonJS({\n "node_modules/ieee754/index.js"(exports) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports.read = function(buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? nBytes - 1 : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n i += d;\n e = s & (1 << -nBits) - 1;\n s >>= -nBits;\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {\n }\n m = e & (1 << -nBits) - 1;\n e >>= -nBits;\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {\n }\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : (s ? -1 : 1) * Infinity;\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n };\n exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;\n var i = isLE ? 0 : nBytes - 1;\n var d = isLE ? 1 : -1;\n var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n value = Math.abs(value);\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {\n }\n buffer[offset + i - d] |= s * 128;\n };\n }\n});\n\n// node_modules/buffer/index.js\nvar require_buffer = __commonJS({\n "node_modules/buffer/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var base64 = require_base64_js();\n var ieee7542 = require_ieee754();\n var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;\n exports.Buffer = Buffer13;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n var K_MAX_LENGTH = 2147483647;\n exports.kMaxLength = K_MAX_LENGTH;\n Buffer13.TYPED_ARRAY_SUPPORT = typedArraySupport();\n if (!Buffer13.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {\n console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");\n }\n function typedArraySupport() {\n try {\n const arr = new Uint8Array(1);\n const proto = { foo: function() {\n return 42;\n } };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42;\n } catch (e) {\n return false;\n }\n }\n Object.defineProperty(Buffer13.prototype, "parent", {\n enumerable: true,\n get: function() {\n if (!Buffer13.isBuffer(this))\n return void 0;\n return this.buffer;\n }\n });\n Object.defineProperty(Buffer13.prototype, "offset", {\n enumerable: true,\n get: function() {\n if (!Buffer13.isBuffer(this))\n return void 0;\n return this.byteOffset;\n }\n });\n function createBuffer(length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError(\'The value "\' + length + \'" is invalid for option "size"\');\n }\n const buf2 = new Uint8Array(length);\n Object.setPrototypeOf(buf2, Buffer13.prototype);\n return buf2;\n }\n function Buffer13(arg, encodingOrOffset, length) {\n if (typeof arg === "number") {\n if (typeof encodingOrOffset === "string") {\n throw new TypeError(\'The "string" argument must be of type string. Received type number\');\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }\n Buffer13.poolSize = 8192;\n function from(value, encodingOrOffset, length) {\n if (typeof value === "string") {\n return fromString(value, encodingOrOffset);\n }\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value);\n }\n if (value == null) {\n throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);\n }\n if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof value === "number") {\n throw new TypeError(\'The "value" argument must not be of type number. Received type number\');\n }\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer13.from(valueOf, encodingOrOffset, length);\n }\n const b = fromObject(value);\n if (b)\n return b;\n if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {\n return Buffer13.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);\n }\n throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);\n }\n Buffer13.from = function(value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length);\n };\n Object.setPrototypeOf(Buffer13.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer13, Uint8Array);\n function assertSize(size) {\n if (typeof size !== "number") {\n throw new TypeError(\'"size" argument must be of type number\');\n } else if (size < 0) {\n throw new RangeError(\'The value "\' + size + \'" is invalid for option "size"\');\n }\n }\n function alloc(size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size);\n }\n if (fill !== void 0) {\n return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);\n }\n return createBuffer(size);\n }\n Buffer13.alloc = function(size, fill, encoding) {\n return alloc(size, fill, encoding);\n };\n function allocUnsafe(size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0);\n }\n Buffer13.allocUnsafe = function(size) {\n return allocUnsafe(size);\n };\n Buffer13.allocUnsafeSlow = function(size) {\n return allocUnsafe(size);\n };\n function fromString(string, encoding) {\n if (typeof encoding !== "string" || encoding === "") {\n encoding = "utf8";\n }\n if (!Buffer13.isEncoding(encoding)) {\n throw new TypeError("Unknown encoding: " + encoding);\n }\n const length = byteLength(string, encoding) | 0;\n let buf2 = createBuffer(length);\n const actual = buf2.write(string, encoding);\n if (actual !== length) {\n buf2 = buf2.slice(0, actual);\n }\n return buf2;\n }\n function fromArrayLike(array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0;\n const buf2 = createBuffer(length);\n for (let i = 0; i < length; i += 1) {\n buf2[i] = array[i] & 255;\n }\n return buf2;\n }\n function fromArrayView(arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);\n }\n return fromArrayLike(arrayView);\n }\n function fromArrayBuffer(array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError(\'"offset" is outside of buffer bounds\');\n }\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError(\'"length" is outside of buffer bounds\');\n }\n let buf2;\n if (byteOffset === void 0 && length === void 0) {\n buf2 = new Uint8Array(array);\n } else if (length === void 0) {\n buf2 = new Uint8Array(array, byteOffset);\n } else {\n buf2 = new Uint8Array(array, byteOffset, length);\n }\n Object.setPrototypeOf(buf2, Buffer13.prototype);\n return buf2;\n }\n function fromObject(obj) {\n if (Buffer13.isBuffer(obj)) {\n const len = checked(obj.length) | 0;\n const buf2 = createBuffer(len);\n if (buf2.length === 0) {\n return buf2;\n }\n obj.copy(buf2, 0, 0, len);\n return buf2;\n }\n if (obj.length !== void 0) {\n if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {\n return createBuffer(0);\n }\n return fromArrayLike(obj);\n }\n if (obj.type === "Buffer" && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n }\n function checked(length) {\n if (length >= K_MAX_LENGTH) {\n throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");\n }\n return length | 0;\n }\n function SlowBuffer(length) {\n if (+length != length) {\n length = 0;\n }\n return Buffer13.alloc(+length);\n }\n Buffer13.isBuffer = function isBuffer(b) {\n return b != null && b._isBuffer === true && b !== Buffer13.prototype;\n };\n Buffer13.compare = function compare(a, b) {\n if (isInstance(a, Uint8Array))\n a = Buffer13.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array))\n b = Buffer13.from(b, b.offset, b.byteLength);\n if (!Buffer13.isBuffer(a) || !Buffer13.isBuffer(b)) {\n throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');\n }\n if (a === b)\n return 0;\n let x = a.length;\n let y = b.length;\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n if (x < y)\n return -1;\n if (y < x)\n return 1;\n return 0;\n };\n Buffer13.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case "hex":\n case "utf8":\n case "utf-8":\n case "ascii":\n case "latin1":\n case "binary":\n case "base64":\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return true;\n default:\n return false;\n }\n };\n Buffer13.concat = function concat(list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\');\n }\n if (list.length === 0) {\n return Buffer13.alloc(0);\n }\n let i;\n if (length === void 0) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n const buffer = Buffer13.allocUnsafe(length);\n let pos = 0;\n for (i = 0; i < list.length; ++i) {\n let buf2 = list[i];\n if (isInstance(buf2, Uint8Array)) {\n if (pos + buf2.length > buffer.length) {\n if (!Buffer13.isBuffer(buf2))\n buf2 = Buffer13.from(buf2);\n buf2.copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(buffer, buf2, pos);\n }\n } else if (!Buffer13.isBuffer(buf2)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\');\n } else {\n buf2.copy(buffer, pos);\n }\n pos += buf2.length;\n }\n return buffer;\n };\n function byteLength(string, encoding) {\n if (Buffer13.isBuffer(string)) {\n return string.length;\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength;\n }\n if (typeof string !== "string") {\n throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \' + typeof string);\n }\n const len = string.length;\n const mustMatch = arguments.length > 2 && arguments[2] === true;\n if (!mustMatch && len === 0)\n return 0;\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case "ascii":\n case "latin1":\n case "binary":\n return len;\n case "utf8":\n case "utf-8":\n return utf8ToBytes(string).length;\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return len * 2;\n case "hex":\n return len >>> 1;\n case "base64":\n return base64ToBytes(string).length;\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length;\n }\n encoding = ("" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer13.byteLength = byteLength;\n function slowToString(encoding, start, end) {\n let loweredCase = false;\n if (start === void 0 || start < 0) {\n start = 0;\n }\n if (start > this.length) {\n return "";\n }\n if (end === void 0 || end > this.length) {\n end = this.length;\n }\n if (end <= 0) {\n return "";\n }\n end >>>= 0;\n start >>>= 0;\n if (end <= start) {\n return "";\n }\n if (!encoding)\n encoding = "utf8";\n while (true) {\n switch (encoding) {\n case "hex":\n return hexSlice(this, start, end);\n case "utf8":\n case "utf-8":\n return utf8Slice(this, start, end);\n case "ascii":\n return asciiSlice(this, start, end);\n case "latin1":\n case "binary":\n return latin1Slice(this, start, end);\n case "base64":\n return base64Slice(this, start, end);\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return utf16leSlice(this, start, end);\n default:\n if (loweredCase)\n throw new TypeError("Unknown encoding: " + encoding);\n encoding = (encoding + "").toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer13.prototype._isBuffer = true;\n function swap(b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n Buffer13.prototype.swap16 = function swap16() {\n const len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 16-bits");\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this;\n };\n Buffer13.prototype.swap32 = function swap32() {\n const len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 32-bits");\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n };\n Buffer13.prototype.swap64 = function swap64() {\n const len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 64-bits");\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n };\n Buffer13.prototype.toString = function toString() {\n const length = this.length;\n if (length === 0)\n return "";\n if (arguments.length === 0)\n return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n };\n Buffer13.prototype.toLocaleString = Buffer13.prototype.toString;\n Buffer13.prototype.equals = function equals(b) {\n if (!Buffer13.isBuffer(b))\n throw new TypeError("Argument must be a Buffer");\n if (this === b)\n return true;\n return Buffer13.compare(this, b) === 0;\n };\n Buffer13.prototype.inspect = function inspect() {\n let str = "";\n const max = exports.INSPECT_MAX_BYTES;\n str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();\n if (this.length > max)\n str += " ... ";\n return "";\n };\n if (customInspectSymbol) {\n Buffer13.prototype[customInspectSymbol] = Buffer13.prototype.inspect;\n }\n Buffer13.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer13.from(target, target.offset, target.byteLength);\n }\n if (!Buffer13.isBuffer(target)) {\n throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \' + typeof target);\n }\n if (start === void 0) {\n start = 0;\n }\n if (end === void 0) {\n end = target ? target.length : 0;\n }\n if (thisStart === void 0) {\n thisStart = 0;\n }\n if (thisEnd === void 0) {\n thisEnd = this.length;\n }\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError("out of range index");\n }\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n if (thisStart >= thisEnd) {\n return -1;\n }\n if (start >= end) {\n return 1;\n }\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target)\n return 0;\n let x = thisEnd - thisStart;\n let y = end - start;\n const len = Math.min(x, y);\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n if (x < y)\n return -1;\n if (y < x)\n return 1;\n return 0;\n };\n function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n if (buffer.length === 0)\n return -1;\n if (typeof byteOffset === "string") {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 2147483647) {\n byteOffset = 2147483647;\n } else if (byteOffset < -2147483648) {\n byteOffset = -2147483648;\n }\n byteOffset = +byteOffset;\n if (numberIsNaN(byteOffset)) {\n byteOffset = dir ? 0 : buffer.length - 1;\n }\n if (byteOffset < 0)\n byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir)\n return -1;\n else\n byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir)\n byteOffset = 0;\n else\n return -1;\n }\n if (typeof val === "string") {\n val = Buffer13.from(val, encoding);\n }\n if (Buffer13.isBuffer(val)) {\n if (val.length === 0) {\n return -1;\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === "number") {\n val = val & 255;\n if (typeof Uint8Array.prototype.indexOf === "function") {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);\n }\n throw new TypeError("val must be string, number or Buffer");\n }\n function arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n let indexSize = 1;\n let arrLength = arr.length;\n let valLength = val.length;\n if (encoding !== void 0) {\n encoding = String(encoding).toLowerCase();\n if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n function read2(buf2, i2) {\n if (indexSize === 1) {\n return buf2[i2];\n } else {\n return buf2.readUInt16BE(i2 * indexSize);\n }\n }\n let i;\n if (dir) {\n let foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1)\n foundIndex = i;\n if (i - foundIndex + 1 === valLength)\n return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1)\n i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength)\n byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read2(arr, i + j) !== read2(val, j)) {\n found = false;\n break;\n }\n }\n if (found)\n return i;\n }\n }\n return -1;\n }\n Buffer13.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n };\n Buffer13.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n };\n Buffer13.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n };\n function hexWrite(buf2, string, offset, length) {\n offset = Number(offset) || 0;\n const remaining = buf2.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n const strLen = string.length;\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n let i;\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed))\n return i;\n buf2[offset + i] = parsed;\n }\n return i;\n }\n function utf8Write(buf2, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf2.length - offset), buf2, offset, length);\n }\n function asciiWrite(buf2, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf2, offset, length);\n }\n function base64Write(buf2, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf2, offset, length);\n }\n function ucs2Write(buf2, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length);\n }\n Buffer13.prototype.write = function write2(string, offset, length, encoding) {\n if (offset === void 0) {\n encoding = "utf8";\n length = this.length;\n offset = 0;\n } else if (length === void 0 && typeof offset === "string") {\n encoding = offset;\n length = this.length;\n offset = 0;\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === void 0)\n encoding = "utf8";\n } else {\n encoding = length;\n length = void 0;\n }\n } else {\n throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");\n }\n const remaining = this.length - offset;\n if (length === void 0 || length > remaining)\n length = remaining;\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError("Attempt to write outside buffer bounds");\n }\n if (!encoding)\n encoding = "utf8";\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case "hex":\n return hexWrite(this, string, offset, length);\n case "utf8":\n case "utf-8":\n return utf8Write(this, string, offset, length);\n case "ascii":\n case "latin1":\n case "binary":\n return asciiWrite(this, string, offset, length);\n case "base64":\n return base64Write(this, string, offset, length);\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return ucs2Write(this, string, offset, length);\n default:\n if (loweredCase)\n throw new TypeError("Unknown encoding: " + encoding);\n encoding = ("" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n Buffer13.prototype.toJSON = function toJSON() {\n return {\n type: "Buffer",\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n };\n function base64Slice(buf2, start, end) {\n if (start === 0 && end === buf2.length) {\n return base64.fromByteArray(buf2);\n } else {\n return base64.fromByteArray(buf2.slice(start, end));\n }\n }\n function utf8Slice(buf2, start, end) {\n end = Math.min(buf2.length, end);\n const res = [];\n let i = start;\n while (i < end) {\n const firstByte = buf2[i];\n let codePoint = null;\n let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint;\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 128) {\n codePoint = firstByte;\n }\n break;\n case 2:\n secondByte = buf2[i + 1];\n if ((secondByte & 192) === 128) {\n tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;\n if (tempCodePoint > 127) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 3:\n secondByte = buf2[i + 1];\n thirdByte = buf2[i + 2];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;\n if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 4:\n secondByte = buf2[i + 1];\n thirdByte = buf2[i + 2];\n fourthByte = buf2[i + 3];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;\n if (tempCodePoint > 65535 && tempCodePoint < 1114112) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n if (codePoint === null) {\n codePoint = 65533;\n bytesPerSequence = 1;\n } else if (codePoint > 65535) {\n codePoint -= 65536;\n res.push(codePoint >>> 10 & 1023 | 55296);\n codePoint = 56320 | codePoint & 1023;\n }\n res.push(codePoint);\n i += bytesPerSequence;\n }\n return decodeCodePointsArray(res);\n }\n var MAX_ARGUMENTS_LENGTH = 4096;\n function decodeCodePointsArray(codePoints) {\n const len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints);\n }\n let res = "";\n let i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));\n }\n return res;\n }\n function asciiSlice(buf2, start, end) {\n let ret = "";\n end = Math.min(buf2.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf2[i] & 127);\n }\n return ret;\n }\n function latin1Slice(buf2, start, end) {\n let ret = "";\n end = Math.min(buf2.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf2[i]);\n }\n return ret;\n }\n function hexSlice(buf2, start, end) {\n const len = buf2.length;\n if (!start || start < 0)\n start = 0;\n if (!end || end < 0 || end > len)\n end = len;\n let out = "";\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf2[i]];\n }\n return out;\n }\n function utf16leSlice(buf2, start, end) {\n const bytes = buf2.slice(start, end);\n let res = "";\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n return res;\n }\n Buffer13.prototype.slice = function slice(start, end) {\n const len = this.length;\n start = ~~start;\n end = end === void 0 ? len : ~~end;\n if (start < 0) {\n start += len;\n if (start < 0)\n start = 0;\n } else if (start > len) {\n start = len;\n }\n if (end < 0) {\n end += len;\n if (end < 0)\n end = 0;\n } else if (end > len) {\n end = len;\n }\n if (end < start)\n end = start;\n const newBuf = this.subarray(start, end);\n Object.setPrototypeOf(newBuf, Buffer13.prototype);\n return newBuf;\n };\n function checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0)\n throw new RangeError("offset is not uint");\n if (offset + ext > length)\n throw new RangeError("Trying to access beyond buffer length");\n }\n Buffer13.prototype.readUintLE = Buffer13.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n return val;\n };\n Buffer13.prototype.readUintBE = Buffer13.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength2, this.length);\n }\n let val = this[offset + --byteLength2];\n let mul = 1;\n while (byteLength2 > 0 && (mul *= 256)) {\n val += this[offset + --byteLength2] * mul;\n }\n return val;\n };\n Buffer13.prototype.readUint8 = Buffer13.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 1, this.length);\n return this[offset];\n };\n Buffer13.prototype.readUint16LE = Buffer13.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n };\n Buffer13.prototype.readUint16BE = Buffer13.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n };\n Buffer13.prototype.readUint32LE = Buffer13.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;\n };\n Buffer13.prototype.readUint32BE = Buffer13.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n };\n Buffer13.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;\n const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;\n return BigInt(lo) + (BigInt(hi) << BigInt(32));\n });\n Buffer13.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;\n return (BigInt(hi) << BigInt(32)) + BigInt(lo);\n });\n Buffer13.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n mul *= 128;\n if (val >= mul)\n val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer13.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let i = byteLength2;\n let mul = 1;\n let val = this[offset + --i];\n while (i > 0 && (mul *= 256)) {\n val += this[offset + --i] * mul;\n }\n mul *= 128;\n if (val >= mul)\n val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer13.prototype.readInt8 = function readInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 1, this.length);\n if (!(this[offset] & 128))\n return this[offset];\n return (255 - this[offset] + 1) * -1;\n };\n Buffer13.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n const val = this[offset] | this[offset + 1] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer13.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n const val = this[offset + 1] | this[offset] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer13.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\n };\n Buffer13.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n };\n Buffer13.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);\n return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);\n });\n Buffer13.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);\n });\n Buffer13.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return ieee7542.read(this, offset, true, 23, 4);\n };\n Buffer13.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return ieee7542.read(this, offset, false, 23, 4);\n };\n Buffer13.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 8, this.length);\n return ieee7542.read(this, offset, true, 52, 8);\n };\n Buffer13.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 8, this.length);\n return ieee7542.read(this, offset, false, 52, 8);\n };\n function checkInt(buf2, value, offset, ext, max, min) {\n if (!Buffer13.isBuffer(buf2))\n throw new TypeError(\'"buffer" argument must be a Buffer instance\');\n if (value > max || value < min)\n throw new RangeError(\'"value" argument is out of bounds\');\n if (offset + ext > buf2.length)\n throw new RangeError("Index out of range");\n }\n Buffer13.prototype.writeUintLE = Buffer13.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let mul = 1;\n let i = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeUintBE = Buffer13.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeUint8 = Buffer13.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 1, 255, 0);\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer13.prototype.writeUint16LE = Buffer13.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer13.prototype.writeUint16BE = Buffer13.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer13.prototype.writeUint32LE = Buffer13.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset + 3] = value >>> 24;\n this[offset + 2] = value >>> 16;\n this[offset + 1] = value >>> 8;\n this[offset] = value & 255;\n return offset + 4;\n };\n Buffer13.prototype.writeUint32BE = Buffer13.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n function wrtBigUInt64LE(buf2, value, offset, min, max) {\n checkIntBI(value, min, max, buf2, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n return offset;\n }\n function wrtBigUInt64BE(buf2, value, offset, min, max) {\n checkIntBI(value, min, max, buf2, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf2[offset + 7] = lo;\n lo = lo >> 8;\n buf2[offset + 6] = lo;\n lo = lo >> 8;\n buf2[offset + 5] = lo;\n lo = lo >> 8;\n buf2[offset + 4] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf2[offset + 3] = hi;\n hi = hi >> 8;\n buf2[offset + 2] = hi;\n hi = hi >> 8;\n buf2[offset + 1] = hi;\n hi = hi >> 8;\n buf2[offset] = hi;\n return offset + 8;\n }\n Buffer13.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));\n });\n Buffer13.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));\n });\n Buffer13.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = 0;\n let mul = 1;\n let sub = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n let sub = 0;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 1, 127, -128);\n if (value < 0)\n value = 255 + value + 1;\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer13.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer13.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer13.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 2147483647, -2147483648);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n this[offset + 2] = value >>> 16;\n this[offset + 3] = value >>> 24;\n return offset + 4;\n };\n Buffer13.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 2147483647, -2147483648);\n if (value < 0)\n value = 4294967295 + value + 1;\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n Buffer13.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));\n });\n Buffer13.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));\n });\n function checkIEEE754(buf2, value, offset, ext, max, min) {\n if (offset + ext > buf2.length)\n throw new RangeError("Index out of range");\n if (offset < 0)\n throw new RangeError("Index out of range");\n }\n function writeFloat(buf2, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22);\n }\n ieee7542.write(buf2, value, offset, littleEndian, 23, 4);\n return offset + 4;\n }\n Buffer13.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert);\n };\n Buffer13.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert);\n };\n function writeDouble(buf2, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292);\n }\n ieee7542.write(buf2, value, offset, littleEndian, 52, 8);\n return offset + 8;\n }\n Buffer13.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert);\n };\n Buffer13.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert);\n };\n Buffer13.prototype.copy = function copy(target, targetStart, start, end) {\n if (!Buffer13.isBuffer(target))\n throw new TypeError("argument should be a Buffer");\n if (!start)\n start = 0;\n if (!end && end !== 0)\n end = this.length;\n if (targetStart >= target.length)\n targetStart = target.length;\n if (!targetStart)\n targetStart = 0;\n if (end > 0 && end < start)\n end = start;\n if (end === start)\n return 0;\n if (target.length === 0 || this.length === 0)\n return 0;\n if (targetStart < 0) {\n throw new RangeError("targetStart out of bounds");\n }\n if (start < 0 || start >= this.length)\n throw new RangeError("Index out of range");\n if (end < 0)\n throw new RangeError("sourceEnd out of bounds");\n if (end > this.length)\n end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n const len = end - start;\n if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);\n }\n return len;\n };\n Buffer13.prototype.fill = function fill(val, start, end, encoding) {\n if (typeof val === "string") {\n if (typeof start === "string") {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === "string") {\n encoding = end;\n end = this.length;\n }\n if (encoding !== void 0 && typeof encoding !== "string") {\n throw new TypeError("encoding must be a string");\n }\n if (typeof encoding === "string" && !Buffer13.isEncoding(encoding)) {\n throw new TypeError("Unknown encoding: " + encoding);\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0);\n if (encoding === "utf8" && code < 128 || encoding === "latin1") {\n val = code;\n }\n }\n } else if (typeof val === "number") {\n val = val & 255;\n } else if (typeof val === "boolean") {\n val = Number(val);\n }\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError("Out of range index");\n }\n if (end <= start) {\n return this;\n }\n start = start >>> 0;\n end = end === void 0 ? this.length : end >>> 0;\n if (!val)\n val = 0;\n let i;\n if (typeof val === "number") {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n const bytes = Buffer13.isBuffer(val) ? val : Buffer13.from(val, encoding);\n const len = bytes.length;\n if (len === 0) {\n throw new TypeError(\'The value "\' + val + \'" is invalid for argument "value"\');\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n return this;\n };\n var errors = {};\n function E(sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor() {\n super();\n Object.defineProperty(this, "message", {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n });\n this.name = `${this.name} [${sym}]`;\n this.stack;\n delete this.name;\n }\n get code() {\n return sym;\n }\n set code(value) {\n Object.defineProperty(this, "code", {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n toString() {\n return `${this.name} [${sym}]: ${this.message}`;\n }\n };\n }\n E("ERR_BUFFER_OUT_OF_BOUNDS", function(name) {\n if (name) {\n return `${name} is outside of buffer bounds`;\n }\n return "Attempt to access memory outside buffer bounds";\n }, RangeError);\n E("ERR_INVALID_ARG_TYPE", function(name, actual) {\n return `The "${name}" argument must be of type number. Received type ${typeof actual}`;\n }, TypeError);\n E("ERR_OUT_OF_RANGE", function(str, range, input) {\n let msg = `The value of "${str}" is out of range.`;\n let received = input;\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input));\n } else if (typeof input === "bigint") {\n received = String(input);\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received);\n }\n received += "n";\n }\n msg += ` It must be ${range}. Received ${received}`;\n return msg;\n }, RangeError);\n function addNumericalSeparator(val) {\n let res = "";\n let i = val.length;\n const start = val[0] === "-" ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`;\n }\n return `${val.slice(0, i)}${res}`;\n }\n function checkBounds(buf2, offset, byteLength2) {\n validateNumber(offset, "offset");\n if (buf2[offset] === void 0 || buf2[offset + byteLength2] === void 0) {\n boundsError(offset, buf2.length - (byteLength2 + 1));\n }\n }\n function checkIntBI(value, min, max, buf2, offset, byteLength2) {\n if (value > max || value < min) {\n const n = typeof min === "bigint" ? "n" : "";\n let range;\n if (byteLength2 > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;\n } else {\n range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`;\n }\n throw new errors.ERR_OUT_OF_RANGE("value", range, value);\n }\n checkBounds(buf2, offset, byteLength2);\n }\n function validateNumber(value, name) {\n if (typeof value !== "number") {\n throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);\n }\n }\n function boundsError(value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type);\n throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);\n }\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();\n }\n throw new errors.ERR_OUT_OF_RANGE(type || "offset", `>= ${type ? 1 : 0} and <= ${length}`, value);\n }\n var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n function base64clean(str) {\n str = str.split("=")[0];\n str = str.trim().replace(INVALID_BASE64_RE, "");\n if (str.length < 2)\n return "";\n while (str.length % 4 !== 0) {\n str = str + "=";\n }\n return str;\n }\n function utf8ToBytes(string, units) {\n units = units || Infinity;\n let codePoint;\n const length = string.length;\n let leadSurrogate = null;\n const bytes = [];\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n if (codePoint > 55295 && codePoint < 57344) {\n if (!leadSurrogate) {\n if (codePoint > 56319) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n continue;\n } else if (i + 1 === length) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n continue;\n }\n leadSurrogate = codePoint;\n continue;\n }\n if (codePoint < 56320) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n leadSurrogate = codePoint;\n continue;\n }\n codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;\n } else if (leadSurrogate) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n }\n leadSurrogate = null;\n if (codePoint < 128) {\n if ((units -= 1) < 0)\n break;\n bytes.push(codePoint);\n } else if (codePoint < 2048) {\n if ((units -= 2) < 0)\n break;\n bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);\n } else if (codePoint < 65536) {\n if ((units -= 3) < 0)\n break;\n bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else if (codePoint < 1114112) {\n if ((units -= 4) < 0)\n break;\n bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else {\n throw new Error("Invalid code point");\n }\n }\n return bytes;\n }\n function asciiToBytes(str) {\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n byteArray.push(str.charCodeAt(i) & 255);\n }\n return byteArray;\n }\n function utf16leToBytes(str, units) {\n let c, hi, lo;\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0)\n break;\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n return byteArray;\n }\n function base64ToBytes(str) {\n return base64.toByteArray(base64clean(str));\n }\n function blitBuffer(src, dst, offset, length) {\n let i;\n for (i = 0; i < length; ++i) {\n if (i + offset >= dst.length || i >= src.length)\n break;\n dst[i + offset] = src[i];\n }\n return i;\n }\n function isInstance(obj, type) {\n return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;\n }\n function numberIsNaN(obj) {\n return obj !== obj;\n }\n var hexSliceLookupTable = function() {\n const alphabet = "0123456789abcdef";\n const table = new Array(256);\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16;\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table;\n }();\n function defineBigIntMethod(fn) {\n return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;\n }\n function BufferBigIntNotDefined() {\n throw new Error("BigInt not supported");\n }\n }\n});\n\n// esbuild.inject.js\nvar Buffer2;\nvar init_esbuild_inject = __esm({\n "esbuild.inject.js"() {\n "use strict";\n Buffer2 = require_buffer().Buffer;\n }\n});\n\n// node_modules/crc-32/crc32.js\nvar require_crc32 = __commonJS({\n "node_modules/crc-32/crc32.js"(exports) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var CRC32;\n (function(factory) {\n if (typeof DO_NOT_EXPORT_CRC === "undefined") {\n if (typeof exports === "object") {\n factory(exports);\n } else if (typeof define === "function" && define.amd) {\n define(function() {\n var module2 = {};\n factory(module2);\n return module2;\n });\n } else {\n factory(CRC32 = {});\n }\n } else {\n factory(CRC32 = {});\n }\n })(function(CRC322) {\n CRC322.version = "1.2.0";\n function signed_crc_table() {\n var c = 0, table = new Array(256);\n for (var n = 0; n != 256; ++n) {\n c = n;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n table[n] = c;\n }\n return typeof Int32Array !== "undefined" ? new Int32Array(table) : table;\n }\n var T = signed_crc_table();\n function crc32_bstr(bstr, seed) {\n var C = seed ^ -1, L = bstr.length - 1;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];\n }\n if (i === L)\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255];\n return C ^ -1;\n }\n function crc32_buf(buf2, seed) {\n if (buf2.length > 1e4)\n return crc32_buf_8(buf2, seed);\n var C = seed ^ -1, L = buf2.length - 3;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n }\n while (i < L + 3)\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n return C ^ -1;\n }\n function crc32_buf_8(buf2, seed) {\n var C = seed ^ -1, L = buf2.length - 7;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n }\n while (i < L + 7)\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n return C ^ -1;\n }\n function crc32_str(str, seed) {\n var C = seed ^ -1;\n for (var i = 0, L = str.length, c, d; i < L; ) {\n c = str.charCodeAt(i++);\n if (c < 128) {\n C = C >>> 8 ^ T[(C ^ c) & 255];\n } else if (c < 2048) {\n C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];\n } else if (c >= 55296 && c < 57344) {\n c = (c & 1023) + 64;\n d = str.charCodeAt(i++) & 1023;\n C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255];\n } else {\n C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];\n }\n }\n return C ^ -1;\n }\n CRC322.table = T;\n CRC322.bstr = crc32_bstr;\n CRC322.buf = crc32_buf;\n CRC322.str = crc32_str;\n });\n }\n});\n\n// node_modules/events/events.js\nvar require_events = __commonJS({\n "node_modules/events/events.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var R = typeof Reflect === "object" ? Reflect : null;\n var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n };\n var ReflectOwnKeys;\n if (R && typeof R.ownKeys === "function") {\n ReflectOwnKeys = R.ownKeys;\n } else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));\n };\n } else {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target);\n };\n }\n function ProcessEmitWarning(warning) {\n if (console && console.warn)\n console.warn(warning);\n }\n var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {\n return value !== value;\n };\n function EventEmitter() {\n EventEmitter.init.call(this);\n }\n module.exports = EventEmitter;\n module.exports.once = once;\n EventEmitter.EventEmitter = EventEmitter;\n EventEmitter.prototype._events = void 0;\n EventEmitter.prototype._eventsCount = 0;\n EventEmitter.prototype._maxListeners = void 0;\n var defaultMaxListeners = 10;\n function checkListener(listener) {\n if (typeof listener !== "function") {\n throw new TypeError(\'The "listener" argument must be of type Function. Received type \' + typeof listener);\n }\n }\n Object.defineProperty(EventEmitter, "defaultMaxListeners", {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError(\'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received \' + arg + ".");\n }\n defaultMaxListeners = arg;\n }\n });\n EventEmitter.init = function() {\n if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n }\n this._maxListeners = this._maxListeners || void 0;\n };\n EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {\n throw new RangeError(\'The value of "n" is out of range. It must be a non-negative number. Received \' + n + ".");\n }\n this._maxListeners = n;\n return this;\n };\n function _getMaxListeners(that) {\n if (that._maxListeners === void 0)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n }\n EventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n };\n EventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++)\n args.push(arguments[i]);\n var doError = type === "error";\n var events = this._events;\n if (events !== void 0)\n doError = doError && events.error === void 0;\n else if (!doError)\n return false;\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n throw er;\n }\n var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));\n err.context = er;\n throw err;\n }\n var handler = events[type];\n if (handler === void 0)\n return false;\n if (typeof handler === "function") {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n return true;\n };\n function _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n checkListener(listener);\n events = target._events;\n if (events === void 0) {\n events = target._events = /* @__PURE__ */ Object.create(null);\n target._eventsCount = 0;\n } else {\n if (events.newListener !== void 0) {\n target.emit("newListener", type, listener.listener ? listener.listener : listener);\n events = target._events;\n }\n existing = events[type];\n }\n if (existing === void 0) {\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === "function") {\n existing = events[type] = prepend ? [listener, existing] : [existing, listener];\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");\n w.name = "MaxListenersExceededWarning";\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n return target;\n }\n EventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n };\n EventEmitter.prototype.on = EventEmitter.prototype.addListener;\n EventEmitter.prototype.prependListener = function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n function onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n }\n function _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: void 0, target, type, listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n }\n EventEmitter.prototype.once = function once2(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.removeListener = function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n checkListener(listener);\n events = this._events;\n if (events === void 0)\n return this;\n list = events[type];\n if (list === void 0)\n return this;\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit("removeListener", type, list.listener || listener);\n }\n } else if (typeof list !== "function") {\n position = -1;\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n if (position < 0)\n return this;\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n if (list.length === 1)\n events[type] = list[0];\n if (events.removeListener !== void 0)\n this.emit("removeListener", type, originalListener || listener);\n }\n return this;\n };\n EventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {\n var listeners, events, i;\n events = this._events;\n if (events === void 0)\n return this;\n if (events.removeListener === void 0) {\n if (arguments.length === 0) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== void 0) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key2;\n for (i = 0; i < keys.length; ++i) {\n key2 = keys[i];\n if (key2 === "removeListener")\n continue;\n this.removeAllListeners(key2);\n }\n this.removeAllListeners("removeListener");\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n listeners = events[type];\n if (typeof listeners === "function") {\n this.removeListener(type, listeners);\n } else if (listeners !== void 0) {\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n return this;\n };\n function _listeners(target, type, unwrap) {\n var events = target._events;\n if (events === void 0)\n return [];\n var evlistener = events[type];\n if (evlistener === void 0)\n return [];\n if (typeof evlistener === "function")\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n }\n EventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n };\n EventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n };\n EventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === "function") {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n };\n EventEmitter.prototype.listenerCount = listenerCount;\n function listenerCount(type) {\n var events = this._events;\n if (events !== void 0) {\n var evlistener = events[type];\n if (typeof evlistener === "function") {\n return 1;\n } else if (evlistener !== void 0) {\n return evlistener.length;\n }\n }\n return 0;\n }\n EventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n };\n function arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n }\n function spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n }\n function unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n }\n function once(emitter, name) {\n return new Promise(function(resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n function resolver() {\n if (typeof emitter.removeListener === "function") {\n emitter.removeListener("error", errorListener);\n }\n resolve([].slice.call(arguments));\n }\n ;\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== "error") {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n }\n function addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === "function") {\n eventTargetAgnosticAddListener(emitter, "error", handler, flags);\n }\n }\n function eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === "function") {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === "function") {\n emitter.addEventListener(name, function wrapListener(arg) {\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError(\'The "emitter" argument must be of type EventEmitter. Received type \' + typeof emitter);\n }\n }\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/stream-browser.js\nvar require_stream_browser = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = require_events().EventEmitter;\n }\n});\n\n// (disabled):node_modules/util/util.js\nvar require_util = __commonJS({\n "(disabled):node_modules/util/util.js"() {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/buffer_list.js\nvar require_buffer_list = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly)\n symbols = symbols.filter(function(sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n return keys;\n }\n function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function(key2) {\n _defineProperty(target, key2, source[key2]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function(key2) {\n Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));\n });\n }\n }\n return target;\n }\n function _defineProperty(obj, key2, value) {\n if (key2 in obj) {\n Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key2] = value;\n }\n return obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor)\n descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps)\n _defineProperties(Constructor.prototype, protoProps);\n if (staticProps)\n _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n var _require = require_buffer();\n var Buffer13 = _require.Buffer;\n var _require2 = require_util();\n var inspect = _require2.inspect;\n var custom = inspect && inspect.custom || "inspect";\n function copyBuffer(src, target, offset) {\n Buffer13.prototype.copy.call(src, target, offset);\n }\n module.exports = /* @__PURE__ */ function() {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: "push",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0)\n this.tail.next = entry;\n else\n this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: "unshift",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0)\n this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: "shift",\n value: function shift() {\n if (this.length === 0)\n return;\n var ret = this.head.data;\n if (this.length === 1)\n this.head = this.tail = null;\n else\n this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: "clear",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: "join",\n value: function join(s) {\n if (this.length === 0)\n return "";\n var p = this.head;\n var ret = "" + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }\n return ret;\n }\n }, {\n key: "concat",\n value: function concat(n) {\n if (this.length === 0)\n return Buffer13.alloc(0);\n var ret = Buffer13.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n }, {\n key: "consume",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n ret = this.shift();\n } else {\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: "first",\n value: function first() {\n return this.head.data;\n }\n }, {\n key: "_getString",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length)\n ret += str;\n else\n ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n }, {\n key: "_getBuffer",\n value: function _getBuffer(n) {\n var ret = Buffer13.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf2 = p.data;\n var nb = n > buf2.length ? buf2.length : n;\n buf2.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf2.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf2.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread({}, options, {\n depth: 0,\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n }();\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/destroy.js\nvar require_destroy = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function(err2) {\n if (!cb && err2) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n }\n function emitErrorAndCloseNT(self2, err) {\n emitErrorNT(self2, err);\n emitCloseNT(self2);\n }\n function emitCloseNT(self2) {\n if (self2._writableState && !self2._writableState.emitClose)\n return;\n if (self2._readableState && !self2._readableState.emitClose)\n return;\n self2.emit("close");\n }\n function undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n }\n function emitErrorNT(self2, err) {\n self2.emit("error", err);\n }\n function errorOrDestroy(stream, err) {\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy)\n stream.destroy(err);\n else\n stream.emit("error", err);\n }\n module.exports = {\n destroy,\n undestroy,\n errorOrDestroy\n };\n }\n});\n\n// node_modules/readable-stream/errors-browser.js\nvar require_errors_browser = __commonJS({\n "node_modules/readable-stream/errors-browser.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n }\n var codes = {};\n function createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === "string") {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n var NodeError = /* @__PURE__ */ function(_Base) {\n _inheritsLoose(NodeError2, _Base);\n function NodeError2(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n return NodeError2;\n }(Base);\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function(i) {\n return String(i);\n });\n if (len > 2) {\n return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1];\n } else if (len === 2) {\n return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);\n } else {\n return "of ".concat(thing, " ").concat(expected[0]);\n }\n } else {\n return "of ".concat(thing, " ").concat(String(expected));\n }\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n if (this_len === void 0 || this_len > str.length) {\n this_len = str.length;\n }\n return str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n if (typeof start !== "number") {\n start = 0;\n }\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n }\n createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {\n return \'The value "\' + value + \'" is invalid for option "\' + name + \'"\';\n }, TypeError);\n createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {\n var determiner;\n if (typeof expected === "string" && startsWith(expected, "not ")) {\n determiner = "must not be";\n expected = expected.replace(/^not /, "");\n } else {\n determiner = "must be";\n }\n var msg;\n if (endsWith(name, " argument")) {\n msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));\n } else {\n var type = includes(name, ".") ? "property" : "argument";\n msg = \'The "\'.concat(name, \'" \').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));\n }\n msg += ". Received type ".concat(typeof actual);\n return msg;\n }, TypeError);\n createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");\n createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {\n return "The " + name + " method is not implemented";\n });\n createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");\n createErrorType("ERR_STREAM_DESTROYED", function(name) {\n return "Cannot call " + name + " after a stream was destroyed";\n });\n createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");\n createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");\n createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");\n createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);\n createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {\n return "Unknown encoding: " + arg;\n }, TypeError);\n createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");\n module.exports.codes = codes;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/state.js\nvar require_state = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE;\n function highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n }\n function getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : "highWaterMark";\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n return state.objectMode ? 16 : 16 * 1024;\n }\n module.exports = {\n getHighWaterMark\n };\n }\n});\n\n// node_modules/inherits/inherits_browser.js\nvar require_inherits_browser = __commonJS({\n "node_modules/inherits/inherits_browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n if (typeof Object.create === "function") {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n };\n } else {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n };\n }\n }\n});\n\n// node_modules/util-deprecate/browser.js\nvar require_browser = __commonJS({\n "node_modules/util-deprecate/browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = deprecate;\n function deprecate(fn, msg) {\n if (config("noDeprecation")) {\n return fn;\n }\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config("throwDeprecation")) {\n throw new Error(msg);\n } else if (config("traceDeprecation")) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n return deprecated;\n }\n function config(name) {\n try {\n if (!self.localStorage)\n return false;\n } catch (_) {\n return false;\n }\n var val = self.localStorage[name];\n if (val == null)\n return false;\n return String(val).toLowerCase() === "true";\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_writable.js\nvar require_stream_writable = __commonJS({\n "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Writable;\n function CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function() {\n onCorkedFinish(_this, state);\n };\n }\n var Duplex;\n Writable.WritableState = WritableState;\n var internalUtil = {\n deprecate: require_browser()\n };\n var Stream = require_stream_browser();\n var Buffer13 = require_buffer().Buffer;\n var OurUint8Array = self.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer13.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer13.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;\n var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;\n var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n require_inherits_browser()(Writable, Stream);\n function nop() {\n }\n function WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== "boolean")\n isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);\n this.finalCalled = false;\n this.needDrain = false;\n this.ending = false;\n this.ended = false;\n this.finished = false;\n this.destroyed = false;\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n this.defaultEncoding = options.defaultEncoding || "utf8";\n this.length = 0;\n this.writing = false;\n this.corked = 0;\n this.sync = true;\n this.bufferProcessing = false;\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n this.writecb = null;\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n this.pendingcb = 0;\n this.prefinished = false;\n this.errorEmitted = false;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.bufferedRequestCount = 0;\n this.corkedRequestsFree = new CorkedRequest(this);\n }\n WritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n };\n (function() {\n try {\n Object.defineProperty(WritableState.prototype, "buffer", {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")\n });\n } catch (_) {\n }\n })();\n var realHasInstance;\n if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object))\n return true;\n if (this !== Writable)\n return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n } else {\n realHasInstance = function realHasInstance2(object) {\n return object instanceof this;\n };\n }\n function Writable(options) {\n Duplex = Duplex || require_stream_duplex();\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this))\n return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n this.writable = true;\n if (options) {\n if (typeof options.write === "function")\n this._write = options.write;\n if (typeof options.writev === "function")\n this._writev = options.writev;\n if (typeof options.destroy === "function")\n this._destroy = options.destroy;\n if (typeof options.final === "function")\n this._final = options.final;\n }\n Stream.call(this);\n }\n Writable.prototype.pipe = function() {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n };\n function writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n }\n function validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== "string" && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n }\n Writable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer13.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === "function") {\n cb = encoding;\n encoding = null;\n }\n if (isBuf)\n encoding = "buffer";\n else if (!encoding)\n encoding = state.defaultEncoding;\n if (typeof cb !== "function")\n cb = nop;\n if (state.ending)\n writeAfterEnd(this, cb);\n else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n };\n Writable.prototype.cork = function() {\n this._writableState.corked++;\n };\n Writable.prototype.uncork = function() {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)\n clearBuffer(this, state);\n }\n };\n Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n if (typeof encoding === "string")\n encoding = encoding.toLowerCase();\n if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n };\n Object.defineProperty(Writable.prototype, "writableBuffer", {\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n function decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {\n chunk = Buffer13.from(chunk, encoding);\n }\n return chunk;\n }\n Object.defineProperty(Writable.prototype, "writableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = "buffer";\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n if (!ret)\n state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk,\n encoding,\n isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n }\n function doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed)\n state.onwrite(new ERR_STREAM_DESTROYED("write"));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n }\n function onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n process.nextTick(cb, er);\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n finishMaybe(stream, state);\n }\n }\n function onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n }\n function onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== "function")\n throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n }\n function afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n }\n function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit("drain");\n }\n }\n function clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf)\n allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, "", holder.finish);\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n if (state.writing) {\n break;\n }\n }\n if (entry === null)\n state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n }\n Writable.prototype._write = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));\n };\n Writable.prototype._writev = null;\n Writable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === "function") {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === "function") {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== void 0)\n this.write(chunk, encoding);\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n if (!state.ending)\n endWritable(this, state, cb);\n return this;\n };\n Object.defineProperty(Writable.prototype, "writableLength", {\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n }\n function callFinal(stream, state) {\n stream._final(function(err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit("prefinish");\n finishMaybe(stream, state);\n });\n }\n function prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === "function" && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit("prefinish");\n }\n }\n }\n function finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit("finish");\n if (state.autoDestroy) {\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n }\n function endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once("finish", cb);\n }\n state.ended = true;\n stream.writable = false;\n }\n function onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n state.corkedRequestsFree.next = corkReq;\n }\n Object.defineProperty(Writable.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._writableState === void 0) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n if (!this._writableState) {\n return;\n }\n this._writableState.destroyed = value;\n }\n });\n Writable.prototype.destroy = destroyImpl.destroy;\n Writable.prototype._undestroy = destroyImpl.undestroy;\n Writable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n }\n});\n\n// node_modules/readable-stream/lib/_stream_duplex.js\nvar require_stream_duplex = __commonJS({\n "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var objectKeys = Object.keys || function(obj) {\n var keys2 = [];\n for (var key2 in obj) {\n keys2.push(key2);\n }\n return keys2;\n };\n module.exports = Duplex;\n var Readable = require_stream_readable();\n var Writable = require_stream_writable();\n require_inherits_browser()(Duplex, Readable);\n {\n keys = objectKeys(Writable.prototype);\n for (v = 0; v < keys.length; v++) {\n method = keys[v];\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n }\n }\n var keys;\n var method;\n var v;\n function Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false)\n this.readable = false;\n if (options.writable === false)\n this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once("end", onend);\n }\n }\n }\n Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n Object.defineProperty(Duplex.prototype, "writableBuffer", {\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n Object.defineProperty(Duplex.prototype, "writableLength", {\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function onend() {\n if (this._writableState.ended)\n return;\n process.nextTick(onEndNT, this);\n }\n function onEndNT(self2) {\n self2.end();\n }\n Object.defineProperty(Duplex.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return;\n }\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n });\n }\n});\n\n// node_modules/safe-buffer/index.js\nvar require_safe_buffer = __commonJS({\n "node_modules/safe-buffer/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var buffer = require_buffer();\n var Buffer13 = buffer.Buffer;\n function copyProps(src, dst) {\n for (var key2 in src) {\n dst[key2] = src[key2];\n }\n }\n if (Buffer13.from && Buffer13.alloc && Buffer13.allocUnsafe && Buffer13.allocUnsafeSlow) {\n module.exports = buffer;\n } else {\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n }\n function SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer13(arg, encodingOrOffset, length);\n }\n SafeBuffer.prototype = Object.create(Buffer13.prototype);\n copyProps(Buffer13, SafeBuffer);\n SafeBuffer.from = function(arg, encodingOrOffset, length) {\n if (typeof arg === "number") {\n throw new TypeError("Argument must not be a number");\n }\n return Buffer13(arg, encodingOrOffset, length);\n };\n SafeBuffer.alloc = function(size, fill, encoding) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n var buf2 = Buffer13(size);\n if (fill !== void 0) {\n if (typeof encoding === "string") {\n buf2.fill(fill, encoding);\n } else {\n buf2.fill(fill);\n }\n } else {\n buf2.fill(0);\n }\n return buf2;\n };\n SafeBuffer.allocUnsafe = function(size) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n return Buffer13(size);\n };\n SafeBuffer.allocUnsafeSlow = function(size) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n return buffer.SlowBuffer(size);\n };\n }\n});\n\n// node_modules/string_decoder/lib/string_decoder.js\nvar require_string_decoder = __commonJS({\n "node_modules/string_decoder/lib/string_decoder.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var Buffer13 = require_safe_buffer().Buffer;\n var isEncoding = Buffer13.isEncoding || function(encoding) {\n encoding = "" + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case "hex":\n case "utf8":\n case "utf-8":\n case "ascii":\n case "binary":\n case "base64":\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n case "raw":\n return true;\n default:\n return false;\n }\n };\n function _normalizeEncoding(enc) {\n if (!enc)\n return "utf8";\n var retried;\n while (true) {\n switch (enc) {\n case "utf8":\n case "utf-8":\n return "utf8";\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return "utf16le";\n case "latin1":\n case "binary":\n return "latin1";\n case "base64":\n case "ascii":\n case "hex":\n return enc;\n default:\n if (retried)\n return;\n enc = ("" + enc).toLowerCase();\n retried = true;\n }\n }\n }\n function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== "string" && (Buffer13.isEncoding === isEncoding || !isEncoding(enc)))\n throw new Error("Unknown encoding: " + enc);\n return nenc || enc;\n }\n exports.StringDecoder = StringDecoder;\n function StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case "utf16le":\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case "utf8":\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case "base64":\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer13.allocUnsafe(nb);\n }\n StringDecoder.prototype.write = function(buf2) {\n if (buf2.length === 0)\n return "";\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf2);\n if (r === void 0)\n return "";\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf2.length)\n return r ? r + this.text(buf2, i) : this.text(buf2, i);\n return r || "";\n };\n StringDecoder.prototype.end = utf8End;\n StringDecoder.prototype.text = utf8Text;\n StringDecoder.prototype.fillLast = function(buf2) {\n if (this.lastNeed <= buf2.length) {\n buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length);\n this.lastNeed -= buf2.length;\n };\n function utf8CheckByte(byte) {\n if (byte <= 127)\n return 0;\n else if (byte >> 5 === 6)\n return 2;\n else if (byte >> 4 === 14)\n return 3;\n else if (byte >> 3 === 30)\n return 4;\n return byte >> 6 === 2 ? -1 : -2;\n }\n function utf8CheckIncomplete(self2, buf2, i) {\n var j = buf2.length - 1;\n if (j < i)\n return 0;\n var nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0)\n self2.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2)\n return 0;\n nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0)\n self2.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2)\n return 0;\n nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2)\n nb = 0;\n else\n self2.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n }\n function utf8CheckExtraBytes(self2, buf2, p) {\n if ((buf2[0] & 192) !== 128) {\n self2.lastNeed = 0;\n return "\\uFFFD";\n }\n if (self2.lastNeed > 1 && buf2.length > 1) {\n if ((buf2[1] & 192) !== 128) {\n self2.lastNeed = 1;\n return "\\uFFFD";\n }\n if (self2.lastNeed > 2 && buf2.length > 2) {\n if ((buf2[2] & 192) !== 128) {\n self2.lastNeed = 2;\n return "\\uFFFD";\n }\n }\n }\n }\n function utf8FillLast(buf2) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf2, p);\n if (r !== void 0)\n return r;\n if (this.lastNeed <= buf2.length) {\n buf2.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf2.copy(this.lastChar, p, 0, buf2.length);\n this.lastNeed -= buf2.length;\n }\n function utf8Text(buf2, i) {\n var total = utf8CheckIncomplete(this, buf2, i);\n if (!this.lastNeed)\n return buf2.toString("utf8", i);\n this.lastTotal = total;\n var end = buf2.length - (total - this.lastNeed);\n buf2.copy(this.lastChar, 0, end);\n return buf2.toString("utf8", i, end);\n }\n function utf8End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed)\n return r + "\\uFFFD";\n return r;\n }\n function utf16Text(buf2, i) {\n if ((buf2.length - i) % 2 === 0) {\n var r = buf2.toString("utf16le", i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 55296 && c <= 56319) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf2[buf2.length - 2];\n this.lastChar[1] = buf2[buf2.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf2[buf2.length - 1];\n return buf2.toString("utf16le", i, buf2.length - 1);\n }\n function utf16End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString("utf16le", 0, end);\n }\n return r;\n }\n function base64Text(buf2, i) {\n var n = (buf2.length - i) % 3;\n if (n === 0)\n return buf2.toString("base64", i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf2[buf2.length - 1];\n } else {\n this.lastChar[0] = buf2[buf2.length - 2];\n this.lastChar[1] = buf2[buf2.length - 1];\n }\n return buf2.toString("base64", i, buf2.length - n);\n }\n function base64End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed)\n return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);\n return r;\n }\n function simpleWrite(buf2) {\n return buf2.toString(this.encoding);\n }\n function simpleEnd(buf2) {\n return buf2 && buf2.length ? this.write(buf2) : "";\n }\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/end-of-stream.js\nvar require_end_of_stream = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE;\n function once(callback) {\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n }\n function noop2() {\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === "function";\n }\n function eos(stream, opts, callback) {\n if (typeof opts === "function")\n return eos(stream, null, opts);\n if (!opts)\n opts = {};\n callback = once(callback || noop2);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable2 = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish2() {\n if (!stream.writable)\n onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish2() {\n writable2 = false;\n writableEnded = true;\n if (!readable)\n callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend2() {\n readable = false;\n readableEnded = true;\n if (!writable2)\n callback.call(stream);\n };\n var onerror = function onerror2(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose2() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended)\n err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable2 && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended)\n err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest2() {\n stream.req.on("finish", onfinish);\n };\n if (isRequest(stream)) {\n stream.on("complete", onfinish);\n stream.on("abort", onclose);\n if (stream.req)\n onrequest();\n else\n stream.on("request", onrequest);\n } else if (writable2 && !stream._writableState) {\n stream.on("end", onlegacyfinish);\n stream.on("close", onlegacyfinish);\n }\n stream.on("end", onend);\n stream.on("finish", onfinish);\n if (opts.error !== false)\n stream.on("error", onerror);\n stream.on("close", onclose);\n return function() {\n stream.removeListener("complete", onfinish);\n stream.removeListener("abort", onclose);\n stream.removeListener("request", onrequest);\n if (stream.req)\n stream.req.removeListener("finish", onfinish);\n stream.removeListener("end", onlegacyfinish);\n stream.removeListener("close", onlegacyfinish);\n stream.removeListener("finish", onfinish);\n stream.removeListener("end", onend);\n stream.removeListener("error", onerror);\n stream.removeListener("close", onclose);\n };\n }\n module.exports = eos;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/async_iterator.js\nvar require_async_iterator = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var _Object$setPrototypeO;\n function _defineProperty(obj, key2, value) {\n if (key2 in obj) {\n Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key2] = value;\n }\n return obj;\n }\n var finished = require_end_of_stream();\n var kLastResolve = Symbol("lastResolve");\n var kLastReject = Symbol("lastReject");\n var kError = Symbol("error");\n var kEnded = Symbol("ended");\n var kLastPromise = Symbol("lastPromise");\n var kHandlePromise = Symbol("handlePromise");\n var kStream = Symbol("stream");\n function createIterResult(value, done) {\n return {\n value,\n done\n };\n }\n function readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n }\n function onReadable(iter) {\n process.nextTick(readAndResolve, iter);\n }\n function wrapForNext(lastPromise, iter) {\n return function(resolve, reject) {\n lastPromise.then(function() {\n if (iter[kEnded]) {\n resolve(createIterResult(void 0, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n }\n var AsyncIteratorPrototype = Object.getPrototypeOf(function() {\n });\n var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(void 0, true));\n }\n if (this[kStream].destroyed) {\n return new Promise(function(resolve, reject) {\n process.nextTick(function() {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(void 0, true));\n }\n });\n });\n }\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {\n return this;\n }), _defineProperty(_Object$setPrototypeO, "return", function _return() {\n var _this2 = this;\n return new Promise(function(resolve, reject) {\n _this2[kStream].destroy(null, function(err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(void 0, true));\n });\n });\n }), _Object$setPrototypeO), AsyncIteratorPrototype);\n var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function(err) {\n if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {\n var reject = iterator[kLastReject];\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(void 0, true));\n }\n iterator[kEnded] = true;\n });\n stream.on("readable", onReadable.bind(null, iterator));\n return iterator;\n };\n module.exports = createReadableStreamAsyncIterator;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/from-browser.js\nvar require_from_browser = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = function() {\n throw new Error("Readable.from is not available in the browser");\n };\n }\n});\n\n// node_modules/readable-stream/lib/_stream_readable.js\nvar require_stream_readable = __commonJS({\n "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Readable;\n var Duplex;\n Readable.ReadableState = ReadableState;\n var EE = require_events().EventEmitter;\n var EElistenerCount = function EElistenerCount2(emitter, type) {\n return emitter.listeners(type).length;\n };\n var Stream = require_stream_browser();\n var Buffer13 = require_buffer().Buffer;\n var OurUint8Array = self.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer13.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer13.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var debugUtil = require_util();\n var debug;\n if (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog("stream");\n } else {\n debug = function debug2() {\n };\n }\n var BufferList = require_buffer_list();\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n var StringDecoder;\n var createReadableStreamAsyncIterator;\n var from;\n require_inherits_browser()(Readable, Stream);\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];\n function prependListener(emitter, event, fn) {\n if (typeof emitter.prependListener === "function")\n return emitter.prependListener(event, fn);\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (Array.isArray(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n }\n function ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== "boolean")\n isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n this.sync = true;\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.destroyed = false;\n this.defaultEncoding = options.defaultEncoding || "utf8";\n this.awaitDrain = 0;\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require_string_decoder().StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n }\n function Readable(options) {\n Duplex = Duplex || require_stream_duplex();\n if (!(this instanceof Readable))\n return new Readable(options);\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n this.readable = true;\n if (options) {\n if (typeof options.read === "function")\n this._read = options.read;\n if (typeof options.destroy === "function")\n this._destroy = options.destroy;\n }\n Stream.call(this);\n }\n Object.defineProperty(Readable.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n if (!this._readableState) {\n return;\n }\n this._readableState.destroyed = value;\n }\n });\n Readable.prototype.destroy = destroyImpl.destroy;\n Readable.prototype._undestroy = destroyImpl.undestroy;\n Readable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n Readable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === "string") {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer13.from(chunk, encoding);\n encoding = "";\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n };\n Readable.prototype.unshift = function(chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n };\n function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug("readableAddChunk", chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck)\n er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer13.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted)\n errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());\n else\n addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0)\n addChunk(stream, state, chunk, false);\n else\n maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n }\n function addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit("data", chunk);\n } else {\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n if (state.needReadable)\n emitReadable(stream);\n }\n maybeReadMore(stream, state);\n }\n function chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);\n }\n return er;\n }\n Readable.prototype.isPaused = function() {\n return this._readableState.flowing === false;\n };\n Readable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require_string_decoder().StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n this._readableState.encoding = this._readableState.decoder.encoding;\n var p = this._readableState.buffer.head;\n var content = "";\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== "")\n this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n };\n var MAX_HWM = 1073741824;\n function computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n }\n function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended)\n return 0;\n if (state.objectMode)\n return 1;\n if (n !== n) {\n if (state.flowing && state.length)\n return state.buffer.head.data.length;\n else\n return state.length;\n }\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length)\n return n;\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n }\n Readable.prototype.read = function(n) {\n debug("read", n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0)\n state.emittedReadable = false;\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug("read: emitReadable", state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n var doRead = state.needReadable;\n debug("need readable", doRead);\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug("length less than watermark", doRead);\n }\n if (state.ended || state.reading) {\n doRead = false;\n debug("reading or ended", doRead);\n } else if (doRead) {\n debug("do read");\n state.reading = true;\n state.sync = true;\n if (state.length === 0)\n state.needReadable = true;\n this._read(state.highWaterMark);\n state.sync = false;\n if (!state.reading)\n n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n if (!state.ended)\n state.needReadable = true;\n if (nOrig !== n && state.ended)\n endReadable(this);\n }\n if (ret !== null)\n this.emit("data", ret);\n return ret;\n };\n function onEofChunk(stream, state) {\n debug("onEofChunk");\n if (state.ended)\n return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n emitReadable(stream);\n } else {\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n }\n function emitReadable(stream) {\n var state = stream._readableState;\n debug("emitReadable", state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug("emitReadable", state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n }\n function emitReadable_(stream) {\n var state = stream._readableState;\n debug("emitReadable_", state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit("readable");\n state.emittedReadable = false;\n }\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n }\n function maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n }\n function maybeReadMore_(stream, state) {\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug("maybeReadMore read 0");\n stream.read(0);\n if (len === state.length)\n break;\n }\n state.readingMore = false;\n }\n Readable.prototype._read = function(n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));\n };\n Readable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once("end", endFn);\n dest.on("unpipe", onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug("onunpipe");\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug("onend");\n dest.end();\n }\n var ondrain = pipeOnDrain(src);\n dest.on("drain", ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug("cleanup");\n dest.removeListener("close", onclose);\n dest.removeListener("finish", onfinish);\n dest.removeListener("drain", ondrain);\n dest.removeListener("error", onerror);\n dest.removeListener("unpipe", onunpipe);\n src.removeListener("end", onend);\n src.removeListener("end", unpipe);\n src.removeListener("data", ondata);\n cleanedUp = true;\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n src.on("data", ondata);\n function ondata(chunk) {\n debug("ondata");\n var ret = dest.write(chunk);\n debug("dest.write", ret);\n if (ret === false) {\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug("false write response, pause", state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n function onerror(er) {\n debug("onerror", er);\n unpipe();\n dest.removeListener("error", onerror);\n if (EElistenerCount(dest, "error") === 0)\n errorOrDestroy(dest, er);\n }\n prependListener(dest, "error", onerror);\n function onclose() {\n dest.removeListener("finish", onfinish);\n unpipe();\n }\n dest.once("close", onclose);\n function onfinish() {\n debug("onfinish");\n dest.removeListener("close", onclose);\n unpipe();\n }\n dest.once("finish", onfinish);\n function unpipe() {\n debug("unpipe");\n src.unpipe(dest);\n }\n dest.emit("pipe", src);\n if (!state.flowing) {\n debug("pipe resume");\n src.resume();\n }\n return dest;\n };\n function pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug("pipeOnDrain", state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {\n state.flowing = true;\n flow(src);\n }\n };\n }\n Readable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n if (state.pipesCount === 0)\n return this;\n if (state.pipesCount === 1) {\n if (dest && dest !== state.pipes)\n return this;\n if (!dest)\n dest = state.pipes;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit("unpipe", this, unpipeInfo);\n return this;\n }\n if (!dest) {\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) {\n dests[i].emit("unpipe", this, {\n hasUnpiped: false\n });\n }\n return this;\n }\n var index = indexOf(state.pipes, dest);\n if (index === -1)\n return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n dest.emit("unpipe", this, unpipeInfo);\n return this;\n };\n Readable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === "data") {\n state.readableListening = this.listenerCount("readable") > 0;\n if (state.flowing !== false)\n this.resume();\n } else if (ev === "readable") {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug("on readable", state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n };\n Readable.prototype.addListener = Readable.prototype.on;\n Readable.prototype.removeListener = function(ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === "readable") {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n Readable.prototype.removeAllListeners = function(ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === "readable" || ev === void 0) {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n function updateReadableListening(self2) {\n var state = self2._readableState;\n state.readableListening = self2.listenerCount("readable") > 0;\n if (state.resumeScheduled && !state.paused) {\n state.flowing = true;\n } else if (self2.listenerCount("data") > 0) {\n self2.resume();\n }\n }\n function nReadingNextTick(self2) {\n debug("readable nexttick read 0");\n self2.read(0);\n }\n Readable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug("resume");\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n };\n function resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n }\n function resume_(stream, state) {\n debug("resume", state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit("resume");\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n }\n Readable.prototype.pause = function() {\n debug("call pause flowing=%j", this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug("pause");\n this._readableState.flowing = false;\n this.emit("pause");\n }\n this._readableState.paused = true;\n return this;\n };\n function flow(stream) {\n var state = stream._readableState;\n debug("flow", state.flowing);\n while (state.flowing && stream.read() !== null) {\n ;\n }\n }\n Readable.prototype.wrap = function(stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on("end", function() {\n debug("wrapped end");\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on("data", function(chunk) {\n debug("wrapped data");\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n if (state.objectMode && (chunk === null || chunk === void 0))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n for (var i in stream) {\n if (this[i] === void 0 && typeof stream[i] === "function") {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n this._read = function(n2) {\n debug("wrapped _read", n2);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n };\n if (typeof Symbol === "function") {\n Readable.prototype[Symbol.asyncIterator] = function() {\n if (createReadableStreamAsyncIterator === void 0) {\n createReadableStreamAsyncIterator = require_async_iterator();\n }\n return createReadableStreamAsyncIterator(this);\n };\n }\n Object.defineProperty(Readable.prototype, "readableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n });\n Object.defineProperty(Readable.prototype, "readableBuffer", {\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n });\n Object.defineProperty(Readable.prototype, "readableFlowing", {\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n });\n Readable._fromList = fromList;\n Object.defineProperty(Readable.prototype, "readableLength", {\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n });\n function fromList(n, state) {\n if (state.length === 0)\n return null;\n var ret;\n if (state.objectMode)\n ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n if (state.decoder)\n ret = state.buffer.join("");\n else if (state.buffer.length === 1)\n ret = state.buffer.first();\n else\n ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n }\n function endReadable(stream) {\n var state = stream._readableState;\n debug("endReadable", state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n }\n function endReadableNT(state, stream) {\n debug("endReadableNT", state.endEmitted, state.length);\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit("end");\n if (state.autoDestroy) {\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n }\n if (typeof Symbol === "function") {\n Readable.from = function(iterable, opts) {\n if (from === void 0) {\n from = require_from_browser();\n }\n return from(Readable, iterable, opts);\n };\n }\n function indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x)\n return i;\n }\n return -1;\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_transform.js\nvar require_stream_transform = __commonJS({\n "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Transform;\n var _require$codes = require_errors_browser().codes;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;\n var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n var Duplex = require_stream_duplex();\n require_inherits_browser()(Transform, Duplex);\n function afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit("error", new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n }\n function Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n this._readableState.needReadable = true;\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === "function")\n this._transform = options.transform;\n if (typeof options.flush === "function")\n this._flush = options.flush;\n }\n this.on("prefinish", prefinish);\n }\n function prefinish() {\n var _this = this;\n if (typeof this._flush === "function" && !this._readableState.destroyed) {\n this._flush(function(er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n }\n Transform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n };\n Transform.prototype._transform = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));\n };\n Transform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n };\n Transform.prototype._read = function(n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n ts.needTransform = true;\n }\n };\n Transform.prototype._destroy = function(err, cb) {\n Duplex.prototype._destroy.call(this, err, function(err2) {\n cb(err2);\n });\n };\n function done(stream, er, data) {\n if (er)\n return stream.emit("error", er);\n if (data != null)\n stream.push(data);\n if (stream._writableState.length)\n throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming)\n throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_passthrough.js\nvar require_stream_passthrough = __commonJS({\n "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = PassThrough;\n var Transform = require_stream_transform();\n require_inherits_browser()(PassThrough, Transform);\n function PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n Transform.call(this, options);\n }\n PassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n };\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/pipeline.js\nvar require_pipeline = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var eos;\n function once(callback) {\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n callback.apply(void 0, arguments);\n };\n }\n var _require$codes = require_errors_browser().codes;\n var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n function noop2(err) {\n if (err)\n throw err;\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === "function";\n }\n function destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on("close", function() {\n closed = true;\n });\n if (eos === void 0)\n eos = require_end_of_stream();\n eos(stream, {\n readable: reading,\n writable: writing\n }, function(err) {\n if (err)\n return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function(err) {\n if (closed)\n return;\n if (destroyed)\n return;\n destroyed = true;\n if (isRequest(stream))\n return stream.abort();\n if (typeof stream.destroy === "function")\n return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED("pipe"));\n };\n }\n function call(fn) {\n fn();\n }\n function pipe(from, to) {\n return from.pipe(to);\n }\n function popCallback(streams) {\n if (!streams.length)\n return noop2;\n if (typeof streams[streams.length - 1] !== "function")\n return noop2;\n return streams.pop();\n }\n function pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0]))\n streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS("streams");\n }\n var error;\n var destroys = streams.map(function(stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function(err) {\n if (!error)\n error = err;\n if (err)\n destroys.forEach(call);\n if (reading)\n return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n }\n module.exports = pipeline;\n }\n});\n\n// node_modules/readable-stream/readable-browser.js\nvar require_readable_browser = __commonJS({\n "node_modules/readable-stream/readable-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports = module.exports = require_stream_readable();\n exports.Stream = exports;\n exports.Readable = exports;\n exports.Writable = require_stream_writable();\n exports.Duplex = require_stream_duplex();\n exports.Transform = require_stream_transform();\n exports.PassThrough = require_stream_passthrough();\n exports.finished = require_end_of_stream();\n exports.pipeline = require_pipeline();\n }\n});\n\n// node_modules/readable-web-to-node-stream/lib/index.js\nvar require_lib = __commonJS({\n "node_modules/readable-web-to-node-stream/lib/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.ReadableWebToNodeStream = void 0;\n var readable_stream_1 = require_readable_browser();\n var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable {\n constructor(stream) {\n super();\n this.bytesRead = 0;\n this.released = false;\n this.reader = stream.getReader();\n }\n async _read() {\n if (this.released) {\n this.push(null);\n return;\n }\n this.pendingRead = this.reader.read();\n const data = await this.pendingRead;\n delete this.pendingRead;\n if (data.done || this.released) {\n this.push(null);\n } else {\n this.bytesRead += data.value.length;\n this.push(data.value);\n }\n }\n async waitForReadToComplete() {\n if (this.pendingRead) {\n await this.pendingRead;\n }\n }\n async close() {\n await this.syncAndRelease();\n }\n async syncAndRelease() {\n this.released = true;\n await this.waitForReadToComplete();\n await this.reader.releaseLock();\n }\n };\n exports.ReadableWebToNodeStream = ReadableWebToNodeStream2;\n }\n});\n\n// node_modules/base-x/src/index.js\nvar require_src = __commonJS({\n "node_modules/base-x/src/index.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function base(ALPHABET) {\n if (ALPHABET.length >= 255) {\n throw new TypeError("Alphabet too long");\n }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) {\n throw new TypeError(x + " is ambiguous");\n }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256);\n var iFACTOR = Math.log(256) / Math.log(BASE);\n function encode2(source) {\n if (source instanceof Uint8Array) {\n } else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) {\n throw new TypeError("Expected Uint8Array");\n }\n if (source.length === 0) {\n return "";\n }\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n var size = (pend - pbegin) * iFACTOR + 1 >>> 0;\n var b58 = new Uint8Array(size);\n while (pbegin !== pend) {\n var carry = source[pbegin];\n var i2 = 0;\n for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {\n carry += 256 * b58[it1] >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = carry / BASE >>> 0;\n }\n if (carry !== 0) {\n throw new Error("Non-zero carry");\n }\n length = i2;\n pbegin++;\n }\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n return str;\n }\n function decodeUnsafe(source) {\n if (typeof source !== "string") {\n throw new TypeError("Expected String");\n }\n if (source.length === 0) {\n return new Uint8Array();\n }\n var psz = 0;\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n var size = (source.length - psz) * FACTOR + 1 >>> 0;\n var b256 = new Uint8Array(size);\n while (source[psz]) {\n var carry = BASE_MAP[source.charCodeAt(psz)];\n if (carry === 255) {\n return;\n }\n var i2 = 0;\n for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {\n carry += BASE * b256[it3] >>> 0;\n b256[it3] = carry % 256 >>> 0;\n carry = carry / 256 >>> 0;\n }\n if (carry !== 0) {\n throw new Error("Non-zero carry");\n }\n length = i2;\n psz++;\n }\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j2 = zeroes;\n while (it4 !== size) {\n vch[j2++] = b256[it4++];\n }\n return vch;\n }\n function decode3(string) {\n var buffer = decodeUnsafe(string);\n if (buffer) {\n return buffer;\n }\n throw new Error("Non-base" + BASE + " character");\n }\n return {\n encode: encode2,\n decodeUnsafe,\n decode: decode3\n };\n }\n module.exports = base;\n }\n});\n\n// node_modules/bs58/index.js\nvar require_bs58 = __commonJS({\n "node_modules/bs58/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var basex = require_src();\n var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";\n module.exports = basex(ALPHABET);\n }\n});\n\n// node_modules/jpeg-js/lib/encoder.js\nvar require_encoder = __commonJS({\n "node_modules/jpeg-js/lib/encoder.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var btoa = btoa || function(buf2) {\n return Buffer2.from(buf2).toString("base64");\n };\n function JPEGEncoder(quality) {\n var self2 = this;\n var fround = Math.round;\n var ffloor = Math.floor;\n var YTable = new Array(64);\n var UVTable = new Array(64);\n var fdtbl_Y = new Array(64);\n var fdtbl_UV = new Array(64);\n var YDC_HT2;\n var UVDC_HT2;\n var YAC_HT2;\n var UVAC_HT2;\n var bitcode2 = new Array(65535);\n var category2 = new Array(65535);\n var outputfDCTQuant = new Array(64);\n var DU = new Array(64);\n var byteout = [];\n var bytenew = 0;\n var bytepos = 7;\n var YDU = new Array(64);\n var UDU = new Array(64);\n var VDU = new Array(64);\n var clt = new Array(256);\n var RGB_YUV_TABLE = new Array(2048);\n var currentQuality;\n var ZigZag = [\n 0,\n 1,\n 5,\n 6,\n 14,\n 15,\n 27,\n 28,\n 2,\n 4,\n 7,\n 13,\n 16,\n 26,\n 29,\n 42,\n 3,\n 8,\n 12,\n 17,\n 25,\n 30,\n 41,\n 43,\n 9,\n 11,\n 18,\n 24,\n 31,\n 40,\n 44,\n 53,\n 10,\n 19,\n 23,\n 32,\n 39,\n 45,\n 52,\n 54,\n 20,\n 22,\n 33,\n 38,\n 46,\n 51,\n 55,\n 60,\n 21,\n 34,\n 37,\n 47,\n 50,\n 56,\n 59,\n 61,\n 35,\n 36,\n 48,\n 49,\n 57,\n 58,\n 62,\n 63\n ];\n var std_dc_luminance_nrcodes2 = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];\n var std_dc_luminance_values2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n var std_ac_luminance_nrcodes2 = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125];\n var std_ac_luminance_values2 = [\n 1,\n 2,\n 3,\n 0,\n 4,\n 17,\n 5,\n 18,\n 33,\n 49,\n 65,\n 6,\n 19,\n 81,\n 97,\n 7,\n 34,\n 113,\n 20,\n 50,\n 129,\n 145,\n 161,\n 8,\n 35,\n 66,\n 177,\n 193,\n 21,\n 82,\n 209,\n 240,\n 36,\n 51,\n 98,\n 114,\n 130,\n 9,\n 10,\n 22,\n 23,\n 24,\n 25,\n 26,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n ];\n var std_dc_chrominance_nrcodes2 = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];\n var std_dc_chrominance_values2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n var std_ac_chrominance_nrcodes2 = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119];\n var std_ac_chrominance_values2 = [\n 0,\n 1,\n 2,\n 3,\n 17,\n 4,\n 5,\n 33,\n 49,\n 6,\n 18,\n 65,\n 81,\n 7,\n 97,\n 113,\n 19,\n 34,\n 50,\n 129,\n 8,\n 20,\n 66,\n 145,\n 161,\n 177,\n 193,\n 9,\n 35,\n 51,\n 82,\n 240,\n 21,\n 98,\n 114,\n 209,\n 10,\n 22,\n 36,\n 52,\n 225,\n 37,\n 241,\n 23,\n 24,\n 25,\n 26,\n 38,\n 39,\n 40,\n 41,\n 42,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n ];\n function initQuantTables(sf) {\n var YQT = [\n 16,\n 11,\n 10,\n 16,\n 24,\n 40,\n 51,\n 61,\n 12,\n 12,\n 14,\n 19,\n 26,\n 58,\n 60,\n 55,\n 14,\n 13,\n 16,\n 24,\n 40,\n 57,\n 69,\n 56,\n 14,\n 17,\n 22,\n 29,\n 51,\n 87,\n 80,\n 62,\n 18,\n 22,\n 37,\n 56,\n 68,\n 109,\n 103,\n 77,\n 24,\n 35,\n 55,\n 64,\n 81,\n 104,\n 113,\n 92,\n 49,\n 64,\n 78,\n 87,\n 103,\n 121,\n 120,\n 101,\n 72,\n 92,\n 95,\n 98,\n 112,\n 100,\n 103,\n 99\n ];\n for (var i = 0; i < 64; i++) {\n var t = ffloor((YQT[i] * sf + 50) / 100);\n if (t < 1) {\n t = 1;\n } else if (t > 255) {\n t = 255;\n }\n YTable[ZigZag[i]] = t;\n }\n var UVQT = [\n 17,\n 18,\n 24,\n 47,\n 99,\n 99,\n 99,\n 99,\n 18,\n 21,\n 26,\n 66,\n 99,\n 99,\n 99,\n 99,\n 24,\n 26,\n 56,\n 99,\n 99,\n 99,\n 99,\n 99,\n 47,\n 66,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99\n ];\n for (var j = 0; j < 64; j++) {\n var u = ffloor((UVQT[j] * sf + 50) / 100);\n if (u < 1) {\n u = 1;\n } else if (u > 255) {\n u = 255;\n }\n UVTable[ZigZag[j]] = u;\n }\n var aasf = [\n 1,\n 1.387039845,\n 1.306562965,\n 1.175875602,\n 1,\n 0.785694958,\n 0.5411961,\n 0.275899379\n ];\n var k = 0;\n for (var row = 0; row < 8; row++) {\n for (var col = 0; col < 8; col++) {\n fdtbl_Y[k] = 1 / (YTable[ZigZag[k]] * aasf[row] * aasf[col] * 8);\n fdtbl_UV[k] = 1 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8);\n k++;\n }\n }\n }\n function computeHuffmanTbl(nrcodes, std_table) {\n var codevalue = 0;\n var pos_in_table = 0;\n var HT = new Array();\n for (var k = 1; k <= 16; k++) {\n for (var j = 1; j <= nrcodes[k]; j++) {\n HT[std_table[pos_in_table]] = [];\n HT[std_table[pos_in_table]][0] = codevalue;\n HT[std_table[pos_in_table]][1] = k;\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n }\n function initHuffmanTbl() {\n YDC_HT2 = computeHuffmanTbl(std_dc_luminance_nrcodes2, std_dc_luminance_values2);\n UVDC_HT2 = computeHuffmanTbl(std_dc_chrominance_nrcodes2, std_dc_chrominance_values2);\n YAC_HT2 = computeHuffmanTbl(std_ac_luminance_nrcodes2, std_ac_luminance_values2);\n UVAC_HT2 = computeHuffmanTbl(std_ac_chrominance_nrcodes2, std_ac_chrominance_values2);\n }\n function initCategoryNumber() {\n var nrlower = 1;\n var nrupper = 2;\n for (var cat = 1; cat <= 15; cat++) {\n for (var nr = nrlower; nr < nrupper; nr++) {\n category2[32767 + nr] = cat;\n bitcode2[32767 + nr] = [];\n bitcode2[32767 + nr][1] = cat;\n bitcode2[32767 + nr][0] = nr;\n }\n for (var nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) {\n category2[32767 + nrneg] = cat;\n bitcode2[32767 + nrneg] = [];\n bitcode2[32767 + nrneg][1] = cat;\n bitcode2[32767 + nrneg][0] = nrupper - 1 + nrneg;\n }\n nrlower <<= 1;\n nrupper <<= 1;\n }\n }\n function initRGBYUVTable() {\n for (var i = 0; i < 256; i++) {\n RGB_YUV_TABLE[i] = 19595 * i;\n RGB_YUV_TABLE[i + 256 >> 0] = 38470 * i;\n RGB_YUV_TABLE[i + 512 >> 0] = 7471 * i + 32768;\n RGB_YUV_TABLE[i + 768 >> 0] = -11059 * i;\n RGB_YUV_TABLE[i + 1024 >> 0] = -21709 * i;\n RGB_YUV_TABLE[i + 1280 >> 0] = 32768 * i + 8421375;\n RGB_YUV_TABLE[i + 1536 >> 0] = -27439 * i;\n RGB_YUV_TABLE[i + 1792 >> 0] = -5329 * i;\n }\n }\n function writeBits(bs) {\n var value = bs[0];\n var posval = bs[1] - 1;\n while (posval >= 0) {\n if (value & 1 << posval) {\n bytenew |= 1 << bytepos;\n }\n posval--;\n bytepos--;\n if (bytepos < 0) {\n if (bytenew == 255) {\n writeByte(255);\n writeByte(0);\n } else {\n writeByte(bytenew);\n }\n bytepos = 7;\n bytenew = 0;\n }\n }\n }\n function writeByte(value) {\n byteout.push(value);\n }\n function writeWord(value) {\n writeByte(value >> 8 & 255);\n writeByte(value & 255);\n }\n function fDCTQuant(data, fdtbl) {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n var dataOff = 0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i = 0; i < I8; ++i) {\n d0 = data[dataOff];\n d1 = data[dataOff + 1];\n d2 = data[dataOff + 2];\n d3 = data[dataOff + 3];\n d4 = data[dataOff + 4];\n d5 = data[dataOff + 5];\n d6 = data[dataOff + 6];\n d7 = data[dataOff + 7];\n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n var tmp10 = tmp0 + tmp3;\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n data[dataOff] = tmp10 + tmp11;\n data[dataOff + 4] = tmp10 - tmp11;\n var z1 = (tmp12 + tmp13) * 0.707106781;\n data[dataOff + 2] = tmp13 + z1;\n data[dataOff + 6] = tmp13 - z1;\n tmp10 = tmp4 + tmp5;\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n var z5 = (tmp10 - tmp12) * 0.382683433;\n var z2 = 0.5411961 * tmp10 + z5;\n var z4 = 1.306562965 * tmp12 + z5;\n var z3 = tmp11 * 0.707106781;\n var z11 = tmp7 + z3;\n var z13 = tmp7 - z3;\n data[dataOff + 5] = z13 + z2;\n data[dataOff + 3] = z13 - z2;\n data[dataOff + 1] = z11 + z4;\n data[dataOff + 7] = z11 - z4;\n dataOff += 8;\n }\n dataOff = 0;\n for (i = 0; i < I8; ++i) {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n var tmp10p2 = tmp0p2 + tmp3p2;\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n data[dataOff] = tmp10p2 + tmp11p2;\n data[dataOff + 32] = tmp10p2 - tmp11p2;\n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781;\n data[dataOff + 16] = tmp13p2 + z1p2;\n data[dataOff + 48] = tmp13p2 - z1p2;\n tmp10p2 = tmp4p2 + tmp5p2;\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433;\n var z2p2 = 0.5411961 * tmp10p2 + z5p2;\n var z4p2 = 1.306562965 * tmp12p2 + z5p2;\n var z3p2 = tmp11p2 * 0.707106781;\n var z11p2 = tmp7p2 + z3p2;\n var z13p2 = tmp7p2 - z3p2;\n data[dataOff + 40] = z13p2 + z2p2;\n data[dataOff + 24] = z13p2 - z2p2;\n data[dataOff + 8] = z11p2 + z4p2;\n data[dataOff + 56] = z11p2 - z4p2;\n dataOff++;\n }\n var fDCTQuant2;\n for (i = 0; i < I64; ++i) {\n fDCTQuant2 = data[i] * fdtbl[i];\n outputfDCTQuant[i] = fDCTQuant2 > 0 ? fDCTQuant2 + 0.5 | 0 : fDCTQuant2 - 0.5 | 0;\n }\n return outputfDCTQuant;\n }\n function writeAPP0() {\n writeWord(65504);\n writeWord(16);\n writeByte(74);\n writeByte(70);\n writeByte(73);\n writeByte(70);\n writeByte(0);\n writeByte(1);\n writeByte(1);\n writeByte(0);\n writeWord(1);\n writeWord(1);\n writeByte(0);\n writeByte(0);\n }\n function writeAPP1(exifBuffer) {\n if (!exifBuffer)\n return;\n writeWord(65505);\n if (exifBuffer[0] === 69 && exifBuffer[1] === 120 && exifBuffer[2] === 105 && exifBuffer[3] === 102) {\n writeWord(exifBuffer.length + 2);\n } else {\n writeWord(exifBuffer.length + 5 + 2);\n writeByte(69);\n writeByte(120);\n writeByte(105);\n writeByte(102);\n writeByte(0);\n }\n for (var i = 0; i < exifBuffer.length; i++) {\n writeByte(exifBuffer[i]);\n }\n }\n function writeSOF0(width, height) {\n writeWord(65472);\n writeWord(17);\n writeByte(8);\n writeWord(height);\n writeWord(width);\n writeByte(3);\n writeByte(1);\n writeByte(17);\n writeByte(0);\n writeByte(2);\n writeByte(17);\n writeByte(1);\n writeByte(3);\n writeByte(17);\n writeByte(1);\n }\n function writeDQT() {\n writeWord(65499);\n writeWord(132);\n writeByte(0);\n for (var i = 0; i < 64; i++) {\n writeByte(YTable[i]);\n }\n writeByte(1);\n for (var j = 0; j < 64; j++) {\n writeByte(UVTable[j]);\n }\n }\n function writeDHT() {\n writeWord(65476);\n writeWord(418);\n writeByte(0);\n for (var i = 0; i < 16; i++) {\n writeByte(std_dc_luminance_nrcodes2[i + 1]);\n }\n for (var j = 0; j <= 11; j++) {\n writeByte(std_dc_luminance_values2[j]);\n }\n writeByte(16);\n for (var k = 0; k < 16; k++) {\n writeByte(std_ac_luminance_nrcodes2[k + 1]);\n }\n for (var l = 0; l <= 161; l++) {\n writeByte(std_ac_luminance_values2[l]);\n }\n writeByte(1);\n for (var m = 0; m < 16; m++) {\n writeByte(std_dc_chrominance_nrcodes2[m + 1]);\n }\n for (var n = 0; n <= 11; n++) {\n writeByte(std_dc_chrominance_values2[n]);\n }\n writeByte(17);\n for (var o = 0; o < 16; o++) {\n writeByte(std_ac_chrominance_nrcodes2[o + 1]);\n }\n for (var p = 0; p <= 161; p++) {\n writeByte(std_ac_chrominance_values2[p]);\n }\n }\n function writeCOM(comments) {\n if (typeof comments === "undefined" || comments.constructor !== Array)\n return;\n comments.forEach((e) => {\n if (typeof e !== "string")\n return;\n writeWord(65534);\n var l = e.length;\n writeWord(l + 2);\n var i;\n for (i = 0; i < l; i++)\n writeByte(e.charCodeAt(i));\n });\n }\n function writeSOS() {\n writeWord(65498);\n writeWord(12);\n writeByte(3);\n writeByte(1);\n writeByte(0);\n writeByte(2);\n writeByte(17);\n writeByte(3);\n writeByte(17);\n writeByte(0);\n writeByte(63);\n writeByte(0);\n }\n function processDU(CDU, fdtbl, DC, HTDC, HTAC) {\n var EOB = HTAC[0];\n var M16zeroes = HTAC[240];\n var pos;\n var I16 = 16;\n var I63 = 63;\n var I64 = 64;\n var DU_DCT = fDCTQuant(CDU, fdtbl);\n for (var j = 0; j < I64; ++j) {\n DU[ZigZag[j]] = DU_DCT[j];\n }\n var Diff = DU[0] - DC;\n DC = DU[0];\n if (Diff == 0) {\n writeBits(HTDC[0]);\n } else {\n pos = 32767 + Diff;\n writeBits(HTDC[category2[pos]]);\n writeBits(bitcode2[pos]);\n }\n var end0pos = 63;\n for (; end0pos > 0 && DU[end0pos] == 0; end0pos--) {\n }\n ;\n if (end0pos == 0) {\n writeBits(EOB);\n return DC;\n }\n var i = 1;\n var lng;\n while (i <= end0pos) {\n var startpos = i;\n for (; DU[i] == 0 && i <= end0pos; ++i) {\n }\n var nrzeroes = i - startpos;\n if (nrzeroes >= I16) {\n lng = nrzeroes >> 4;\n for (var nrmarker = 1; nrmarker <= lng; ++nrmarker)\n writeBits(M16zeroes);\n nrzeroes = nrzeroes & 15;\n }\n pos = 32767 + DU[i];\n writeBits(HTAC[(nrzeroes << 4) + category2[pos]]);\n writeBits(bitcode2[pos]);\n i++;\n }\n if (end0pos != I63) {\n writeBits(EOB);\n }\n return DC;\n }\n function initCharLookupTable() {\n var sfcc = String.fromCharCode;\n for (var i = 0; i < 256; i++) {\n clt[i] = sfcc(i);\n }\n }\n this.encode = function(image, quality2) {\n var time_start = new Date().getTime();\n if (quality2)\n setQuality(quality2);\n byteout = new Array();\n bytenew = 0;\n bytepos = 7;\n writeWord(65496);\n writeAPP0();\n writeCOM(image.comments);\n writeAPP1(image.exifBuffer);\n writeDQT();\n writeSOF0(image.width, image.height);\n writeDHT();\n writeSOS();\n var DCY = 0;\n var DCU = 0;\n var DCV = 0;\n bytenew = 0;\n bytepos = 7;\n this.encode.displayName = "_encode_";\n var imageData = image.data;\n var width = image.width;\n var height = image.height;\n var quadWidth = width * 4;\n var tripleWidth = width * 3;\n var x, y = 0;\n var r, g, b;\n var start, p, col, row, pos;\n while (y < height) {\n x = 0;\n while (x < quadWidth) {\n start = quadWidth * y + x;\n p = start;\n col = -1;\n row = 0;\n for (pos = 0; pos < 64; pos++) {\n row = pos >> 3;\n col = (pos & 7) * 4;\n p = start + row * quadWidth + col;\n if (y + row >= height) {\n p -= quadWidth * (y + 1 + row - height);\n }\n if (x + col >= quadWidth) {\n p -= x + col - quadWidth + 4;\n }\n r = imageData[p++];\n g = imageData[p++];\n b = imageData[p++];\n YDU[pos] = (RGB_YUV_TABLE[r] + RGB_YUV_TABLE[g + 256 >> 0] + RGB_YUV_TABLE[b + 512 >> 0] >> 16) - 128;\n UDU[pos] = (RGB_YUV_TABLE[r + 768 >> 0] + RGB_YUV_TABLE[g + 1024 >> 0] + RGB_YUV_TABLE[b + 1280 >> 0] >> 16) - 128;\n VDU[pos] = (RGB_YUV_TABLE[r + 1280 >> 0] + RGB_YUV_TABLE[g + 1536 >> 0] + RGB_YUV_TABLE[b + 1792 >> 0] >> 16) - 128;\n }\n DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT2, YAC_HT2);\n DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT2, UVAC_HT2);\n DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT2, UVAC_HT2);\n x += 32;\n }\n y += 8;\n }\n if (bytepos >= 0) {\n var fillbits = [];\n fillbits[1] = bytepos + 1;\n fillbits[0] = (1 << bytepos + 1) - 1;\n writeBits(fillbits);\n }\n writeWord(65497);\n if (typeof module === "undefined")\n return new Uint8Array(byteout);\n return Buffer2.from(byteout);\n var jpegDataUri = "data:image/jpeg;base64," + btoa(byteout.join(""));\n byteout = [];\n var duration = new Date().getTime() - time_start;\n return jpegDataUri;\n };\n function setQuality(quality2) {\n if (quality2 <= 0) {\n quality2 = 1;\n }\n if (quality2 > 100) {\n quality2 = 100;\n }\n if (currentQuality == quality2)\n return;\n var sf = 0;\n if (quality2 < 50) {\n sf = Math.floor(5e3 / quality2);\n } else {\n sf = Math.floor(200 - quality2 * 2);\n }\n initQuantTables(sf);\n currentQuality = quality2;\n }\n function init2() {\n var time_start = new Date().getTime();\n if (!quality)\n quality = 50;\n initCharLookupTable();\n initHuffmanTbl();\n initCategoryNumber();\n initRGBYUVTable();\n setQuality(quality);\n var duration = new Date().getTime() - time_start;\n }\n init2();\n }\n if (typeof module !== "undefined") {\n module.exports = encode2;\n } else if (typeof window !== "undefined") {\n window["jpeg-js"] = window["jpeg-js"] || {};\n window["jpeg-js"].encode = encode2;\n }\n function encode2(imgData, qu) {\n if (typeof qu === "undefined")\n qu = 50;\n var encoder = new JPEGEncoder(qu);\n var data = encoder.encode(imgData, qu);\n return {\n data,\n width: imgData.width,\n height: imgData.height\n };\n }\n }\n});\n\n// node_modules/jpeg-js/lib/decoder.js\nvar require_decoder = __commonJS({\n "node_modules/jpeg-js/lib/decoder.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var JpegImage = function jpegImage() {\n "use strict";\n var dctZigZag = new Int32Array([\n 0,\n 1,\n 8,\n 16,\n 9,\n 2,\n 3,\n 10,\n 17,\n 24,\n 32,\n 25,\n 18,\n 11,\n 4,\n 5,\n 12,\n 19,\n 26,\n 33,\n 40,\n 48,\n 41,\n 34,\n 27,\n 20,\n 13,\n 6,\n 7,\n 14,\n 21,\n 28,\n 35,\n 42,\n 49,\n 56,\n 57,\n 50,\n 43,\n 36,\n 29,\n 22,\n 15,\n 23,\n 30,\n 37,\n 44,\n 51,\n 58,\n 59,\n 52,\n 45,\n 38,\n 31,\n 39,\n 46,\n 53,\n 60,\n 61,\n 54,\n 47,\n 55,\n 62,\n 63\n ]);\n var dctCos1 = 4017;\n var dctSin1 = 799;\n var dctCos3 = 3406;\n var dctSin3 = 2276;\n var dctCos6 = 1567;\n var dctSin6 = 3784;\n var dctSqrt2 = 5793;\n var dctSqrt1d2 = 2896;\n function constructor() {\n }\n function buildHuffmanTable2(codeLengths, values) {\n var k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({ children: [], index: 0 });\n var p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error("Could not recreate Huffman Table");\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n }\n function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, opts) {\n var precision = frame.precision;\n var samplesPerLine = frame.samplesPerLine;\n var scanLines = frame.scanLines;\n var mcusPerLine = frame.mcusPerLine;\n var progressive = frame.progressive;\n var maxH = frame.maxH, maxV = frame.maxV;\n var startOffset = offset, bitsData = 0, bitsCount = 0;\n function readBit() {\n if (bitsCount > 0) {\n bitsCount--;\n return bitsData >> bitsCount & 1;\n }\n bitsData = data[offset++];\n if (bitsData == 255) {\n var nextByte = data[offset++];\n if (nextByte) {\n throw new Error("unexpected marker: " + (bitsData << 8 | nextByte).toString(16));\n }\n }\n bitsCount = 7;\n return bitsData >>> 7;\n }\n function decodeHuffman(tree) {\n var node = tree, bit;\n while ((bit = readBit()) !== null) {\n node = node[bit];\n if (typeof node === "number")\n return node;\n if (typeof node !== "object")\n throw new Error("invalid huffman sequence");\n }\n return null;\n }\n function receive(length) {\n var n2 = 0;\n while (length > 0) {\n var bit = readBit();\n if (bit === null)\n return;\n n2 = n2 << 1 | bit;\n length--;\n }\n return n2;\n }\n function receiveAndExtend(length) {\n var n2 = receive(length);\n if (n2 >= 1 << length - 1)\n return n2;\n return n2 + (-1 << length) + 1;\n }\n function decodeBaseline(component2, zz) {\n var t = decodeHuffman(component2.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t);\n zz[0] = component2.pred += diff;\n var k2 = 1;\n while (k2 < 64) {\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15)\n break;\n k2 += 16;\n continue;\n }\n k2 += r;\n var z = dctZigZag[k2];\n zz[z] = receiveAndExtend(s);\n k2++;\n }\n }\n function decodeDCFirst(component2, zz) {\n var t = decodeHuffman(component2.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;\n zz[0] = component2.pred += diff;\n }\n function decodeDCSuccessive(component2, zz) {\n zz[0] |= readBit() << successive;\n }\n var eobrun = 0;\n function decodeACFirst(component2, zz) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k2 = spectralStart, e = spectralEnd;\n while (k2 <= e) {\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r) - 1;\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n var z = dctZigZag[k2];\n zz[z] = receiveAndExtend(s) * (1 << successive);\n k2++;\n }\n }\n var successiveACState = 0, successiveACNextValue;\n function decodeACSuccessive(component2, zz) {\n var k2 = spectralStart, e = spectralEnd, r = 0;\n while (k2 <= e) {\n var z = dctZigZag[k2];\n var direction = zz[z] < 0 ? -1 : 1;\n switch (successiveACState) {\n case 0:\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r);\n successiveACState = 4;\n } else {\n r = 16;\n successiveACState = 1;\n }\n } else {\n if (s !== 1)\n throw new Error("invalid ACn encoding");\n successiveACNextValue = receiveAndExtend(s);\n successiveACState = r ? 2 : 3;\n }\n continue;\n case 1:\n case 2:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n r--;\n if (r === 0)\n successiveACState = successiveACState == 2 ? 3 : 0;\n }\n break;\n case 3:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n zz[z] = successiveACNextValue << successive;\n successiveACState = 0;\n }\n break;\n case 4:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n break;\n }\n k2++;\n }\n if (successiveACState === 4) {\n eobrun--;\n if (eobrun === 0)\n successiveACState = 0;\n }\n }\n function decodeMcu(component2, decode4, mcu2, row, col) {\n var mcuRow = mcu2 / mcusPerLine | 0;\n var mcuCol = mcu2 % mcusPerLine;\n var blockRow = mcuRow * component2.v + row;\n var blockCol = mcuCol * component2.h + col;\n if (component2.blocks[blockRow] === void 0 && opts.tolerantDecoding)\n return;\n decode4(component2, component2.blocks[blockRow][blockCol]);\n }\n function decodeBlock(component2, decode4, mcu2) {\n var blockRow = mcu2 / component2.blocksPerLine | 0;\n var blockCol = mcu2 % component2.blocksPerLine;\n if (component2.blocks[blockRow] === void 0 && opts.tolerantDecoding)\n return;\n decode4(component2, component2.blocks[blockRow][blockCol]);\n }\n var componentsLength = components.length;\n var component, i, j, k, n;\n var decodeFn;\n if (progressive) {\n if (spectralStart === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n var mcu = 0, marker;\n var mcuExpected;\n if (componentsLength == 1) {\n mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;\n } else {\n mcuExpected = mcusPerLine * frame.mcusPerColumn;\n }\n if (!resetInterval)\n resetInterval = mcuExpected;\n var h, v;\n while (mcu < mcuExpected) {\n for (i = 0; i < componentsLength; i++)\n components[i].pred = 0;\n eobrun = 0;\n if (componentsLength == 1) {\n component = components[0];\n for (n = 0; n < resetInterval; n++) {\n decodeBlock(component, decodeFn, mcu);\n mcu++;\n }\n } else {\n for (n = 0; n < resetInterval; n++) {\n for (i = 0; i < componentsLength; i++) {\n component = components[i];\n h = component.h;\n v = component.v;\n for (j = 0; j < v; j++) {\n for (k = 0; k < h; k++) {\n decodeMcu(component, decodeFn, mcu, j, k);\n }\n }\n }\n mcu++;\n if (mcu === mcuExpected)\n break;\n }\n }\n if (mcu === mcuExpected) {\n do {\n if (data[offset] === 255) {\n if (data[offset + 1] !== 0) {\n break;\n }\n }\n offset += 1;\n } while (offset < data.length - 2);\n }\n bitsCount = 0;\n marker = data[offset] << 8 | data[offset + 1];\n if (marker < 65280) {\n throw new Error("marker was not found");\n }\n if (marker >= 65488 && marker <= 65495) {\n offset += 2;\n } else\n break;\n }\n return offset - startOffset;\n }\n function buildComponentData(frame, component) {\n var lines = [];\n var blocksPerLine = component.blocksPerLine;\n var blocksPerColumn = component.blocksPerColumn;\n var samplesPerLine = blocksPerLine << 3;\n var R = new Int32Array(64), r = new Uint8Array(64);\n function quantizeAndInverse(zz, dataOut, dataIn) {\n var qt = component.quantizationTable;\n var v0, v1, v2, v3, v4, v5, v6, v7, t;\n var p = dataIn;\n var i2;\n for (i2 = 0; i2 < 64; i2++)\n p[i2] = zz[i2] * qt[i2];\n for (i2 = 0; i2 < 8; ++i2) {\n var row = 8 * i2;\n if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 && p[4 + row] == 0 && p[5 + row] == 0 && p[6 + row] == 0 && p[7 + row] == 0) {\n t = dctSqrt2 * p[0 + row] + 512 >> 10;\n p[0 + row] = t;\n p[1 + row] = t;\n p[2 + row] = t;\n p[3 + row] = t;\n p[4 + row] = t;\n p[5 + row] = t;\n p[6 + row] = t;\n p[7 + row] = t;\n continue;\n }\n v0 = dctSqrt2 * p[0 + row] + 128 >> 8;\n v1 = dctSqrt2 * p[4 + row] + 128 >> 8;\n v2 = p[2 + row];\n v3 = p[6 + row];\n v4 = dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128 >> 8;\n v7 = dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128 >> 8;\n v5 = p[3 + row] << 4;\n v6 = p[5 + row] << 4;\n t = v0 - v1 + 1 >> 1;\n v0 = v0 + v1 + 1 >> 1;\n v1 = t;\n t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;\n v3 = t;\n t = v4 - v6 + 1 >> 1;\n v4 = v4 + v6 + 1 >> 1;\n v6 = t;\n t = v7 + v5 + 1 >> 1;\n v5 = v7 - v5 + 1 >> 1;\n v7 = t;\n t = v0 - v3 + 1 >> 1;\n v0 = v0 + v3 + 1 >> 1;\n v3 = t;\n t = v1 - v2 + 1 >> 1;\n v1 = v1 + v2 + 1 >> 1;\n v2 = t;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[0 + row] = v0 + v7;\n p[7 + row] = v0 - v7;\n p[1 + row] = v1 + v6;\n p[6 + row] = v1 - v6;\n p[2 + row] = v2 + v5;\n p[5 + row] = v2 - v5;\n p[3 + row] = v3 + v4;\n p[4 + row] = v3 - v4;\n }\n for (i2 = 0; i2 < 8; ++i2) {\n var col = i2;\n if (p[1 * 8 + col] == 0 && p[2 * 8 + col] == 0 && p[3 * 8 + col] == 0 && p[4 * 8 + col] == 0 && p[5 * 8 + col] == 0 && p[6 * 8 + col] == 0 && p[7 * 8 + col] == 0) {\n t = dctSqrt2 * dataIn[i2 + 0] + 8192 >> 14;\n p[0 * 8 + col] = t;\n p[1 * 8 + col] = t;\n p[2 * 8 + col] = t;\n p[3 * 8 + col] = t;\n p[4 * 8 + col] = t;\n p[5 * 8 + col] = t;\n p[6 * 8 + col] = t;\n p[7 * 8 + col] = t;\n continue;\n }\n v0 = dctSqrt2 * p[0 * 8 + col] + 2048 >> 12;\n v1 = dctSqrt2 * p[4 * 8 + col] + 2048 >> 12;\n v2 = p[2 * 8 + col];\n v3 = p[6 * 8 + col];\n v4 = dctSqrt1d2 * (p[1 * 8 + col] - p[7 * 8 + col]) + 2048 >> 12;\n v7 = dctSqrt1d2 * (p[1 * 8 + col] + p[7 * 8 + col]) + 2048 >> 12;\n v5 = p[3 * 8 + col];\n v6 = p[5 * 8 + col];\n t = v0 - v1 + 1 >> 1;\n v0 = v0 + v1 + 1 >> 1;\n v1 = t;\n t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;\n v3 = t;\n t = v4 - v6 + 1 >> 1;\n v4 = v4 + v6 + 1 >> 1;\n v6 = t;\n t = v7 + v5 + 1 >> 1;\n v5 = v7 - v5 + 1 >> 1;\n v7 = t;\n t = v0 - v3 + 1 >> 1;\n v0 = v0 + v3 + 1 >> 1;\n v3 = t;\n t = v1 - v2 + 1 >> 1;\n v1 = v1 + v2 + 1 >> 1;\n v2 = t;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[0 * 8 + col] = v0 + v7;\n p[7 * 8 + col] = v0 - v7;\n p[1 * 8 + col] = v1 + v6;\n p[6 * 8 + col] = v1 - v6;\n p[2 * 8 + col] = v2 + v5;\n p[5 * 8 + col] = v2 - v5;\n p[3 * 8 + col] = v3 + v4;\n p[4 * 8 + col] = v3 - v4;\n }\n for (i2 = 0; i2 < 64; ++i2) {\n var sample2 = 128 + (p[i2] + 8 >> 4);\n dataOut[i2] = sample2 < 0 ? 0 : sample2 > 255 ? 255 : sample2;\n }\n }\n requestMemoryAllocation(samplesPerLine * blocksPerColumn * 8);\n var i, j;\n for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {\n var scanLine = blockRow << 3;\n for (i = 0; i < 8; i++)\n lines.push(new Uint8Array(samplesPerLine));\n for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {\n quantizeAndInverse(component.blocks[blockRow][blockCol], r, R);\n var offset = 0, sample = blockCol << 3;\n for (j = 0; j < 8; j++) {\n var line = lines[scanLine + j];\n for (i = 0; i < 8; i++)\n line[sample + i] = r[offset++];\n }\n }\n }\n return lines;\n }\n function clampTo8bit(a) {\n return a < 0 ? 0 : a > 255 ? 255 : a;\n }\n constructor.prototype = {\n load: function load(path) {\n var xhr = new XMLHttpRequest();\n xhr.open("GET", path, true);\n xhr.responseType = "arraybuffer";\n xhr.onload = function() {\n var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);\n this.parse(data);\n if (this.onload)\n this.onload();\n }.bind(this);\n xhr.send(null);\n },\n parse: function parse(data) {\n var maxResolutionInPixels = this.opts.maxResolutionInMP * 1e3 * 1e3;\n var offset = 0, length = data.length;\n function readUint16() {\n var value = data[offset] << 8 | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length2 = readUint16();\n var array = data.subarray(offset, offset + length2 - 2);\n offset += array.length;\n return array;\n }\n function prepareComponents(frame2) {\n var maxH2 = 1, maxV2 = 1;\n var component2, componentId2;\n for (componentId2 in frame2.components) {\n if (frame2.components.hasOwnProperty(componentId2)) {\n component2 = frame2.components[componentId2];\n if (maxH2 < component2.h)\n maxH2 = component2.h;\n if (maxV2 < component2.v)\n maxV2 = component2.v;\n }\n }\n var mcusPerLine = Math.ceil(frame2.samplesPerLine / 8 / maxH2);\n var mcusPerColumn = Math.ceil(frame2.scanLines / 8 / maxV2);\n for (componentId2 in frame2.components) {\n if (frame2.components.hasOwnProperty(componentId2)) {\n component2 = frame2.components[componentId2];\n var blocksPerLine = Math.ceil(Math.ceil(frame2.samplesPerLine / 8) * component2.h / maxH2);\n var blocksPerColumn = Math.ceil(Math.ceil(frame2.scanLines / 8) * component2.v / maxV2);\n var blocksPerLineForMcu = mcusPerLine * component2.h;\n var blocksPerColumnForMcu = mcusPerColumn * component2.v;\n var blocksToAllocate = blocksPerColumnForMcu * blocksPerLineForMcu;\n var blocks = [];\n requestMemoryAllocation(blocksToAllocate * 256);\n for (var i2 = 0; i2 < blocksPerColumnForMcu; i2++) {\n var row = [];\n for (var j2 = 0; j2 < blocksPerLineForMcu; j2++)\n row.push(new Int32Array(64));\n blocks.push(row);\n }\n component2.blocksPerLine = blocksPerLine;\n component2.blocksPerColumn = blocksPerColumn;\n component2.blocks = blocks;\n }\n }\n frame2.maxH = maxH2;\n frame2.maxV = maxV2;\n frame2.mcusPerLine = mcusPerLine;\n frame2.mcusPerColumn = mcusPerColumn;\n }\n var jfif = null;\n var adobe = null;\n var pixels = null;\n var frame, resetInterval;\n var quantizationTables = [], frames = [];\n var huffmanTablesAC = [], huffmanTablesDC = [];\n var fileMarker = readUint16();\n var malformedDataOffset = -1;\n this.comments = [];\n if (fileMarker != 65496) {\n throw new Error("SOI not found");\n }\n fileMarker = readUint16();\n while (fileMarker != 65497) {\n var i, j, l;\n switch (fileMarker) {\n case 65280:\n break;\n case 65504:\n case 65505:\n case 65506:\n case 65507:\n case 65508:\n case 65509:\n case 65510:\n case 65511:\n case 65512:\n case 65513:\n case 65514:\n case 65515:\n case 65516:\n case 65517:\n case 65518:\n case 65519:\n case 65534:\n var appData = readDataBlock();\n if (fileMarker === 65534) {\n var comment = String.fromCharCode.apply(null, appData);\n this.comments.push(comment);\n }\n if (fileMarker === 65504) {\n if (appData[0] === 74 && appData[1] === 70 && appData[2] === 73 && appData[3] === 70 && appData[4] === 0) {\n jfif = {\n version: { major: appData[5], minor: appData[6] },\n densityUnits: appData[7],\n xDensity: appData[8] << 8 | appData[9],\n yDensity: appData[10] << 8 | appData[11],\n thumbWidth: appData[12],\n thumbHeight: appData[13],\n thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])\n };\n }\n }\n if (fileMarker === 65505) {\n if (appData[0] === 69 && appData[1] === 120 && appData[2] === 105 && appData[3] === 102 && appData[4] === 0) {\n this.exifBuffer = appData.subarray(5, appData.length);\n }\n }\n if (fileMarker === 65518) {\n if (appData[0] === 65 && appData[1] === 100 && appData[2] === 111 && appData[3] === 98 && appData[4] === 101 && appData[5] === 0) {\n adobe = {\n version: appData[6],\n flags0: appData[7] << 8 | appData[8],\n flags1: appData[9] << 8 | appData[10],\n transformCode: appData[11]\n };\n }\n }\n break;\n case 65499:\n var quantizationTablesLength = readUint16();\n var quantizationTablesEnd = quantizationTablesLength + offset - 2;\n while (offset < quantizationTablesEnd) {\n var quantizationTableSpec = data[offset++];\n requestMemoryAllocation(64 * 4);\n var tableData = new Int32Array(64);\n if (quantizationTableSpec >> 4 === 0) {\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = data[offset++];\n }\n } else if (quantizationTableSpec >> 4 === 1) {\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = readUint16();\n }\n } else\n throw new Error("DQT: invalid table spec");\n quantizationTables[quantizationTableSpec & 15] = tableData;\n }\n break;\n case 65472:\n case 65473:\n case 65474:\n readUint16();\n frame = {};\n frame.extended = fileMarker === 65473;\n frame.progressive = fileMarker === 65474;\n frame.precision = data[offset++];\n frame.scanLines = readUint16();\n frame.samplesPerLine = readUint16();\n frame.components = {};\n frame.componentsOrder = [];\n var pixelsInFrame = frame.scanLines * frame.samplesPerLine;\n if (pixelsInFrame > maxResolutionInPixels) {\n var exceededAmount = Math.ceil((pixelsInFrame - maxResolutionInPixels) / 1e6);\n throw new Error(`maxResolutionInMP limit exceeded by ${exceededAmount}MP`);\n }\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n var qId = data[offset + 2];\n if (h <= 0 || v <= 0) {\n throw new Error("Invalid sampling factor, expected values above 0");\n }\n frame.componentsOrder.push(componentId);\n frame.components[componentId] = {\n h,\n v,\n quantizationIdx: qId\n };\n offset += 3;\n }\n prepareComponents(frame);\n frames.push(frame);\n break;\n case 65476:\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength; ) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++) {\n codeLengthSum += codeLengths[j] = data[offset];\n }\n requestMemoryAllocation(16 + codeLengthSum);\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable2(codeLengths, huffmanValues);\n }\n break;\n case 65501:\n readUint16();\n resetInterval = readUint16();\n break;\n case 65500:\n readUint16();\n readUint16();\n break;\n case 65498:\n var scanLength = readUint16();\n var selectorsCount = data[offset++];\n var components = [], component;\n for (i = 0; i < selectorsCount; i++) {\n component = frame.components[data[offset++]];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, this.opts);\n offset += processed;\n break;\n case 65535:\n if (data[offset] !== 255) {\n offset--;\n }\n break;\n default:\n if (data[offset - 3] == 255 && data[offset - 2] >= 192 && data[offset - 2] <= 254) {\n offset -= 3;\n break;\n } else if (fileMarker === 224 || fileMarker == 225) {\n if (malformedDataOffset !== -1) {\n throw new Error(`first unknown JPEG marker at offset ${malformedDataOffset.toString(16)}, second unknown JPEG marker ${fileMarker.toString(16)} at offset ${(offset - 1).toString(16)}`);\n }\n malformedDataOffset = offset - 1;\n const nextOffset = readUint16();\n if (data[offset + nextOffset - 2] === 255) {\n offset += nextOffset - 2;\n break;\n }\n }\n throw new Error("unknown JPEG marker " + fileMarker.toString(16));\n }\n fileMarker = readUint16();\n }\n if (frames.length != 1)\n throw new Error("only single frame JPEGs supported");\n for (var i = 0; i < frames.length; i++) {\n var cp = frames[i].components;\n for (var j in cp) {\n cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx];\n delete cp[j].quantizationIdx;\n }\n }\n this.width = frame.samplesPerLine;\n this.height = frame.scanLines;\n this.jfif = jfif;\n this.adobe = adobe;\n this.components = [];\n for (var i = 0; i < frame.componentsOrder.length; i++) {\n var component = frame.components[frame.componentsOrder[i]];\n this.components.push({\n lines: buildComponentData(frame, component),\n scaleX: component.h / frame.maxH,\n scaleY: component.v / frame.maxV\n });\n }\n },\n getData: function getData(width, height) {\n var scaleX = this.width / width, scaleY = this.height / height;\n var component1, component2, component3, component4;\n var component1Line, component2Line, component3Line, component4Line;\n var x, y;\n var offset = 0;\n var Y, Cb, Cr, K, C, M, Ye, R, G, B;\n var colorTransform;\n var dataLength = width * height * this.components.length;\n requestMemoryAllocation(dataLength);\n var data = new Uint8Array(dataLength);\n switch (this.components.length) {\n case 1:\n component1 = this.components[0];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n data[offset++] = Y;\n }\n }\n break;\n case 2:\n component1 = this.components[0];\n component2 = this.components[1];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n data[offset++] = Y;\n Y = component2Line[0 | x * component2.scaleX * scaleX];\n data[offset++] = Y;\n }\n }\n break;\n case 3:\n colorTransform = true;\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== "undefined")\n colorTransform = !!this.opts.colorTransform;\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n component3Line = component3.lines[0 | y * component3.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n R = component1Line[0 | x * component1.scaleX * scaleX];\n G = component2Line[0 | x * component2.scaleX * scaleX];\n B = component3Line[0 | x * component3.scaleX * scaleX];\n } else {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n Cb = component2Line[0 | x * component2.scaleX * scaleX];\n Cr = component3Line[0 | x * component3.scaleX * scaleX];\n R = clampTo8bit(Y + 1.402 * (Cr - 128));\n G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n B = clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = R;\n data[offset++] = G;\n data[offset++] = B;\n }\n }\n break;\n case 4:\n if (!this.adobe)\n throw new Error("Unsupported color mode (4 components)");\n colorTransform = false;\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== "undefined")\n colorTransform = !!this.opts.colorTransform;\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n component4 = this.components[3];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n component3Line = component3.lines[0 | y * component3.scaleY * scaleY];\n component4Line = component4.lines[0 | y * component4.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n C = component1Line[0 | x * component1.scaleX * scaleX];\n M = component2Line[0 | x * component2.scaleX * scaleX];\n Ye = component3Line[0 | x * component3.scaleX * scaleX];\n K = component4Line[0 | x * component4.scaleX * scaleX];\n } else {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n Cb = component2Line[0 | x * component2.scaleX * scaleX];\n Cr = component3Line[0 | x * component3.scaleX * scaleX];\n K = component4Line[0 | x * component4.scaleX * scaleX];\n C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128));\n M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = 255 - C;\n data[offset++] = 255 - M;\n data[offset++] = 255 - Ye;\n data[offset++] = 255 - K;\n }\n }\n break;\n default:\n throw new Error("Unsupported color mode");\n }\n return data;\n },\n copyToImageData: function copyToImageData(imageData, formatAsRGBA) {\n var width = imageData.width, height = imageData.height;\n var imageDataArray = imageData.data;\n var data = this.getData(width, height);\n var i = 0, j = 0, x, y;\n var Y, K, C, M, R, G, B;\n switch (this.components.length) {\n case 1:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n Y = data[i++];\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 3:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n R = data[i++];\n G = data[i++];\n B = data[i++];\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 4:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n C = data[i++];\n M = data[i++];\n Y = data[i++];\n K = data[i++];\n R = 255 - clampTo8bit(C * (1 - K / 255) + K);\n G = 255 - clampTo8bit(M * (1 - K / 255) + K);\n B = 255 - clampTo8bit(Y * (1 - K / 255) + K);\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n default:\n throw new Error("Unsupported color mode");\n }\n }\n };\n var totalBytesAllocated = 0;\n var maxMemoryUsageBytes = 0;\n function requestMemoryAllocation(increaseAmount = 0) {\n var totalMemoryImpactBytes = totalBytesAllocated + increaseAmount;\n if (totalMemoryImpactBytes > maxMemoryUsageBytes) {\n var exceededAmount = Math.ceil((totalMemoryImpactBytes - maxMemoryUsageBytes) / 1024 / 1024);\n throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB`);\n }\n totalBytesAllocated = totalMemoryImpactBytes;\n }\n constructor.resetMaxMemoryUsage = function(maxMemoryUsageBytes_) {\n totalBytesAllocated = 0;\n maxMemoryUsageBytes = maxMemoryUsageBytes_;\n };\n constructor.getBytesAllocated = function() {\n return totalBytesAllocated;\n };\n constructor.requestMemoryAllocation = requestMemoryAllocation;\n return constructor;\n }();\n if (typeof module !== "undefined") {\n module.exports = decode3;\n } else if (typeof window !== "undefined") {\n window["jpeg-js"] = window["jpeg-js"] || {};\n window["jpeg-js"].decode = decode3;\n }\n function decode3(jpegData, userOpts = {}) {\n var defaultOpts = {\n colorTransform: void 0,\n useTArray: false,\n formatAsRGBA: true,\n tolerantDecoding: true,\n maxResolutionInMP: 100,\n maxMemoryUsageInMB: 512\n };\n var opts = { ...defaultOpts, ...userOpts };\n var arr = new Uint8Array(jpegData);\n var decoder = new JpegImage();\n decoder.opts = opts;\n JpegImage.resetMaxMemoryUsage(opts.maxMemoryUsageInMB * 1024 * 1024);\n decoder.parse(arr);\n var channels = opts.formatAsRGBA ? 4 : 3;\n var bytesNeeded = decoder.width * decoder.height * channels;\n try {\n JpegImage.requestMemoryAllocation(bytesNeeded);\n var image = {\n width: decoder.width,\n height: decoder.height,\n exifBuffer: decoder.exifBuffer,\n data: opts.useTArray ? new Uint8Array(bytesNeeded) : Buffer2.alloc(bytesNeeded)\n };\n if (decoder.comments.length > 0) {\n image["comments"] = decoder.comments;\n }\n } catch (err) {\n if (err instanceof RangeError) {\n throw new Error("Could not allocate enough memory for the image. Required: " + bytesNeeded);\n }\n if (err instanceof ReferenceError) {\n if (err.message === "Buffer is not defined") {\n throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");\n }\n }\n throw err;\n }\n decoder.copyToImageData(image, opts.formatAsRGBA);\n return image;\n }\n }\n});\n\n// node_modules/jpeg-js/index.js\nvar require_jpeg_js = __commonJS({\n "node_modules/jpeg-js/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var encode2 = require_encoder();\n var decode3 = require_decoder();\n module.exports = {\n encode: encode2,\n decode: decode3\n };\n }\n});\n\n// src/processor.worker.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// src/platform.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// src/requests.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar xmlhttprequest;\nif (false)\n xmlhttprequest = typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : typeof GM != "undefined" ? GM.xmlHttpRequest : window["GM_xmlhttpRequest"];\nvar GM_fetch = (...[url, opt, lisn]) => {\n function blobTo(to, blob) {\n if (to == "arrayBuffer" && blob.arrayBuffer) {\n const ret = blob.arrayBuffer();\n if (ret)\n return ret;\n }\n return new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = function(event) {\n if (!event)\n return;\n if (to == "base64")\n resolve(event.target.result);\n else\n resolve(event.target.result);\n };\n if (to == "arrayBuffer")\n fileReader.readAsArrayBuffer(blob);\n else if (to == "base64")\n fileReader.readAsDataURL(blob);\n else if (to == "text")\n fileReader.readAsText(blob, "utf-8");\n else\n reject(new Error("unknown to"));\n });\n }\n return new Promise((resolve, reject) => {\n const gmopt = {\n url: url.toString(),\n data: opt?.body,\n responseType: "blob",\n headers: opt?.headers,\n method: opt?.method || "GET",\n ...lisn ? {\n onprogress: (prog) => {\n if (prog.loaded != prog.total && prog.total != 0)\n lisn.dispatchEvent(new CustomEvent("progress", { detail: [prog.loaded, prog.total] }));\n }\n } : {},\n onload: (resp) => {\n if (resp.status / 100 >= 4) {\n reject(new Error("Server Error: " + resp.status));\n return;\n }\n const blob = resp.response;\n const ref = resp;\n ref.blob = () => Promise.resolve(blob);\n ref.arrayBuffer = () => blobTo("arrayBuffer", blob);\n ref.text = () => blobTo("text", blob);\n ref.json = async () => JSON.parse(await blobTo("text", blob));\n resolve(resp);\n },\n ontimeout: () => reject(new Error("fetch timeout")),\n onerror: (...args) => {\n reject(new Error("fetch error"));\n },\n onabort: () => reject(new Error("fetch abort"))\n };\n xmlhttprequest(gmopt);\n });\n};\n\n// src/platform.ts\nvar lqueue = {};\nvar localLoad = (key2, def) => "__pee__" + key2 in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key2)) : def;\nvar localSet = (key2, value) => localStorage.setItem("__pee__" + key2, JSON.stringify(value));\nvar port1;\nconsole.log("worker", false);\nif (false) {\n const nmc = new MessageChannel();\n port1 = nmc.port1;\n port2 = nmc.port2;\n const iframe = document.createElement("iframe");\n iframe.style.display = "none";\n iframe.name = location.origin;\n const iframeloaded = new Promise((_) => {\n iframe.onload = _;\n });\n iframe.src = `${chrome.runtime.getURL("")}options.html`;\n document.documentElement.appendChild(iframe);\n iframeloaded.then(() => {\n iframe.contentWindow?.postMessage("", "*", [port2]);\n });\n port1.onmessage = (ev) => {\n lqueue[ev.data.id](ev.data);\n };\n}\nconsole.log("worker");\nif (true) {\n port1 = {\n onmessage(ev) {\n lqueue[ev.data.id](ev.data);\n },\n postMessage(msg, tr) {\n postMessage({\n type: "ipc",\n tr,\n msg\n }, tr);\n }\n };\n}\nvar gid = 0;\nvar sendCmd = (cmd, tr) => {\n const prom = new Promise((_) => {\n const id = gid++;\n lqueue[id] = (e) => {\n _(e);\n delete lqueue[id];\n };\n port1.postMessage({ id, ...cmd }, tr || []);\n });\n return prom;\n};\nvar bridge = (name, f) => {\n if (false)\n return f;\n return (...args) => {\n return sendCmd({ name, args });\n };\n};\nvar Bridged = (ctor) => {\n const keys = Object.getOwnPropertyNames(ctor).filter((k) => typeof ctor[k] == "function");\n for (const k of keys)\n ctor[k] = bridge(k, ctor[k]);\n};\nif (false) {\n popupport = chrome.runtime.connect({ name: "popup" });\n popupport.onMessage.addListener((msg) => {\n if (msg.id in pendingcmds) {\n pendingcmds[msg.id](msg);\n delete pendingcmds[msg.id];\n }\n });\n}\nvar Platform = class {\n static async openInTab(src, opts) {\n if (false) {\n return GM.openInTab(src, opts);\n }\n const obj = false ? chrome : browser;\n let i;\n if (opts.insert)\n i = (await obj.tabs.getCurrent()).index + 1;\n return obj.tabs.create({ active: opts.active, url: src, index: i });\n }\n static getValue(name, def) {\n return localLoad(name, def);\n }\n static setValue(name, val) {\n localSet(name, val);\n }\n};\nPlatform.cmdid = 0;\nPlatform = __decorateClass([\n Bridged\n], Platform);\nvar corsFetch = async (input, init2, lsn) => {\n const id = gid++;\n let transfer = [];\n if (init2?.body) {\n if (false) {\n [init2.body, transfer] = await braveserialize(init2.body);\n }\n }\n const prom = new Promise((_, rej) => {\n let gcontroller;\n let buffer = [];\n let finished = false;\n const rs = new ReadableStream({\n start(controller) {\n gcontroller = controller;\n buffer.forEach((b) => gcontroller?.enqueue(b));\n buffer = [];\n if (finished) {\n gcontroller.close();\n }\n }\n });\n let s;\n s = 0;\n const cmdbuff = [];\n lqueue[id] = async (e) => {\n if (e.progress) {\n if (lsn)\n lsn.dispatchEvent(new CustomEvent("progress", { detail: e.progress }));\n }\n if (e.pushData) {\n if (e.s > s) {\n let idx = 0;\n while (idx < cmdbuff.length) {\n if (cmdbuff[idx].s > e.s)\n break;\n idx++;\n }\n cmdbuff.splice(idx, 0, e);\n return;\n }\n const processCmd = (e2) => {\n if (e2.pushData.data) {\n const data = new Uint8Array(e2.pushData.data);\n if (gcontroller)\n gcontroller.enqueue(data);\n else\n buffer.push(data);\n } else {\n if (gcontroller)\n gcontroller?.close();\n else\n finished = true;\n }\n };\n await processCmd(e);\n s++;\n while (cmdbuff[0]?.s == s) {\n await processCmd(cmdbuff.shift());\n s++;\n }\n }\n if (e.setRes) {\n const arrayBuffer = async () => {\n const r = rs.getReader();\n await sendCmd({ name: "fullyRead", fid: id });\n const abs = [];\n let res;\n do {\n res = await r.read();\n if (res.done)\n break;\n abs.push(res.value);\n } while (!res.done);\n const sum = abs.reduce((a, b) => a + b.byteLength, 0);\n const ret = new Uint8Array(sum);\n abs.reduce((ptr, arr) => {\n ret.set(arr, ptr);\n return ptr + arr.byteLength;\n }, 0);\n r.releaseLock();\n return ret;\n };\n const blob = async () => new Blob([await arrayBuffer()]);\n const text = async () => new TextDecoder().decode(await arrayBuffer());\n const json = async () => JSON.parse(await text());\n if (e.ok)\n _({\n body: rs,\n ok: e.ok,\n headers: e.headers,\n redirected: e.redirected,\n type: e.type,\n url: e.url,\n status: e.status,\n bodyUsed: e.bodyUsed,\n statusText: e.statusText,\n clone() {\n return this;\n },\n arrayBuffer,\n blob,\n text,\n json,\n async formData() {\n return new FormData();\n }\n });\n else {\n rej(new Error(`${e.url} - ${e.status}`));\n }\n }\n };\n port1.postMessage({\n id,\n name: "corsFetch",\n args: [input, init2]\n }, transfer);\n });\n return prom;\n};\nasync function getHeaders(s) {\n if (false)\n return headerStringToObject(await GM_head(s));\n const res = await ifetch(s, {\n method: "HEAD"\n });\n return res.headers;\n}\nasync function ifetch(...[url, opt, lisn]) {\n if (true)\n return corsFetch(url.toString(), opt, lisn);\n return GM_fetch(url, opt, lisn);\n}\nasync function* streamRemote(url, chunkSize = 72 * 1024, fetchRestOnNonCanceled = true) {\n let size = Number.POSITIVE_INFINITY;\n let ptr = 0;\n let fetchSize = chunkSize;\n while (ptr != size) {\n let obj;\n const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } });\n if (false) {\n obj = headerStringToObject(fres.responseHeaders);\n } else {\n obj = fres.headers;\n }\n if (!("content-length" in obj)) {\n console.warn("no content lenght???", url);\n break;\n }\n if ("content-range" in obj) {\n size = +obj["content-range"].split("/")[1];\n }\n const len = +obj["content-length"];\n ptr += len;\n if (fetchRestOnNonCanceled)\n fetchSize = size;\n const val = Buffer2.from(await fres.arrayBuffer());\n const e = yield val;\n if (e) {\n break;\n }\n }\n}\n\n// src/pngv3.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer3 = __toESM(require_buffer(), 1);\n\n// src/png.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_crc_32 = __toESM(require_crc32(), 1);\nvar import_buffer = __toESM(require_buffer(), 1);\nvar PNGDecoder = class {\n constructor(reader, strict = true) {\n this.reader = reader;\n this.strict = strict;\n this.req = 8;\n this.ptr = 8;\n this.stopped = false;\n this.repr = import_buffer.Buffer.from([]);\n }\n async catchup() {\n while (this.repr.byteLength < this.req) {\n const chunk = await this.reader.read();\n if (chunk.done) {\n if (this.strict)\n throw new Error(`Unexpected EOF, got ${this.repr.byteLength}, required ${this.req}, ${chunk.value}`);\n this.stopped = true;\n return;\n }\n this.repr = import_buffer.Buffer.concat([this.repr, chunk.value]);\n }\n }\n async *chunks() {\n while (true) {\n this.req += 8;\n await this.catchup();\n if (this.stopped)\n break;\n const length = this.repr.readUInt32BE(this.ptr);\n const name = this.repr.slice(this.ptr + 4, this.ptr + 8).toString();\n this.ptr += 4;\n this.req += length + 4;\n await this.catchup();\n yield [\n name,\n this.repr.slice(this.ptr, this.ptr + length + 4),\n this.ptr + length > this.repr.length ? -1 : this.repr.readUInt32BE(this.ptr + length + 4),\n this.ptr\n ];\n if (this.stopped)\n break;\n this.ptr += length + 8;\n if (name == "IEND")\n break;\n }\n }\n async dtor() {\n }\n};\nvar PNGEncoder = class {\n constructor(bytes) {\n this.writer = bytes.getWriter();\n this.writer.write(import_buffer.Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]));\n }\n async insertchunk(chunk) {\n let b = import_buffer.Buffer.alloc(4);\n const buff = chunk[1];\n b.writeInt32BE(buff.length - 4, 0);\n await this.writer.write(b);\n await this.writer.write(buff);\n b = import_buffer.Buffer.alloc(4);\n b.writeInt32BE((0, import_crc_32.buf)(buff), 0);\n await this.writer.write(b);\n }\n async dtor() {\n this.writer.releaseLock();\n }\n};\n\n// src/utils.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer2 = __toESM(require_buffer(), 1);\n\n// src/assets/hasembed.png\nvar hasembed_default = __toBinary("iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAMFBMVEX+/v3c3c2moZhda1ODfnfKvK49RDgCAgIbHxpsGhv6BQT9hIOV0Hh4pWO03Z//5coEk9oIAAAHdUlEQVR42qWZDXurIAyFhcDJsS31///bKzEWHX6sd2fPVqYbLycJwXXDTiGKSMrDkQKGc8WwjhCHa0WoSY5u5guIYIUk5BuGEc4oUYZTaVztUq4ZWZtSfzulCyPrCAjXEGgT+9vncQhoRtI1I1BnIdEouYecG5FmZPhNRsLn9T4l3fIjwq8gcXlFv9xwXpPriDLcKHjGYeX1RW0J2uBWUid3FsPPm+flz7Qd3FtJbqhzkuSiYHIzcq8Ybb7KiCRju5PlqirdNdLwewlT2u/IcNUrEvyVwzfKAbvEhHS1RrBF6ysK1ZRvGW0DxhbekGOSlGKzfxgIbpyE8XqJEI9W8GZN6ioi2VU9osSWk8jx8byCMC1zw5JHEiIwOY4YHmM8PDx0sZ/Gx6w9JeQcq3JoRZUUFeFLD+G1qBSh6vB4jBchjzI8NpSQE6BNgAiiodQINg4hvF9NxeYY02mFShw+lAogCUCAFhAiW3wpS/wNsGPQphjloP2FmINtkIdJoCSkvH5OIYZUxAURXk0CcsmJaQRi2IVdLGe1dJ7z7ZEkDNApDEFY27drYwRqC1shdR4dIalKBBhbwg3RCB3Edj39KNmnQ1QtZeoQJ4lIijF4kKzQZkaLUq+3zQ0iz+kwwkYFygrZUaahyr7m52TbHYa4gQxFwBT7u0XICtGO0fZFhAfqzskyHV69KkUbxeeefOQ2XjeyXEjx2JQDCgbdUAbTh5fdxr2RSBpFDillUNMmXB9bibxFFGOEIv6z9tqlxSH6CVirNL1nENGrtlCPKJWuNEijNFHlykHxfYCU1vyqXRRFo1CVJAzSU0bVKxsgpKyzoBRrLrTpy7ZWyroZDylm/lxic9ugYhapmvnSAmbfBId0FD2OlZQWB5JiSzWJFBGSHsMNRWGQnkJ2DDdP+SQDJPzk8/wV240esGY67SG6JgTHmVCQCo9JEiNQZZq82sUpdiaUspoOg/YU8n1sJE3zfLBoCGk2INT5aiTFKFoxhl9ro9QS7ijUGA4hzFNVpMKObskZBBTzxSykRUp1xkFjSIB6cRhkRxk1DXsI1zxMroRqw5iJBKRSUjVTaCbEn3SMUzhoJ/jp1hzI6z3vamBalaEEYUOSFWdmzOE6yeAcooNQ47A4efsRJCyhXmKamiIISh0FKhd8qGZIxMRGGQI6iN99z2sf3BGY67BodoDPqOpJEmX0OFo5LIPho9A7yX6jyijUWHugp6RppsBtESs6qiqMkhqlgzSbwb6E4t0CmH4okqu5sE2XWQbDOUTWe2kZVQjKLMr0UwEy9YrKClOcQ8rbjdhSLExWSYVp6oWpV6DWFAnzOcQO1DkJ5Dx428FdP4T5aNU2q6gydlbIMwjs1A7WDV5vY8xieQmnE2U1bRYhmtzKMUTs8eNlkLL0CQRhKcAZg+qU0LBmBXIMYakbJBhEizE0TplSKOdGXOmHFeIAQlmiFd4VQpUCUnReICCMJ5B0AAnKXRVvI1VsR1SEQQBy2YMgKutQoqvihly/SR3EMuAnu0NYjQEWXup0oqir8rSz0kNgrXAHsXr27QHV6UyfxG8vQvM2XG6jhxjZ22KyhnRdXnlfDjJxB+Hr1UP8JKUvN0/nygKJnT+2Humh6iCiSraOFacvlZRxWGWMc4gH4Xvl7TuyjbFWl2DNCUUw/a+IBnFGgxRygRAk/x8iG8jrFBInIfN/QwLCCUQsTss4b3dHTpK+BGo8hlBLg4QpKnZbQb6DSAcxoUKgxSETkv+8K32f+R4iNV5CMUhN3o9Gy/AFBAqEDuInlRDGu26090oKQo6cKDwp4BEkfQUpRYC+ulTFkrKHpP+F1NgjO6T1xE+8yKMTNn8JMQq2ENEqWbYjscuhiV9Vl3fCAg47I1WweBmkSayTfbcbSZ8Xw86IaYnXz1Mq5/BlW1G+XMPOiAkFykJMf1M6hOhW0PhHCCjrzMPWiItI1L9Cco27SVripblItjPyH6NFfmb+QLBrHVn1z9Fqjw5DlxF6zf6NEeup0RK/jGUHyRHyXXAQfrZgvhoErJSCLSRSVZF/v2wwHRtxiD8FcwuBplQx4Xd1hH5BXI2UskAUxVKygcyfjFDG35VR6tuWwpyQhJRBjSIbSJ6gFTKlOr6PlIR+j0AAKyeRkWoQFWqTTBEzJNUSS3eR4kHqApmGNEqFxOH5GBcIdCPa2Z5gfyyH60jhKKBkPXRH1iyE+ob5AqFuZcs3K8R1Og6NUsdh1nOmCOeBQTr5O0tMWeOUbk+RnvEYqsYRglOI0mudFUd+QwmV8Xi6FT2HtHd/kjn6gpJJ+fxr4TFyfObnGURl37Tl18c607zy1crD/mnVIL2XJlX+MlRknqduVkynECoRg/1mAvmr5xSxsnLIdA/xomaVklKZt91FvaxunTQRIqgQyHIQMN8hPBeTG7mFeG+uascmTjBBqMpHczANpucdhHht9LkYekLCksN1wqbHDYQsHcTE/V91GcaOWXvK4xYiW0bplgCA9OKQmRq1UZ7ZY3UDIXZGuAOQ68AApqROabqHlDMjNKlKzGG31a8o/wBpRk19RswBZgAAAABJRU5ErkJggg==");\n\n// src/stores.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/svelte/store/index.mjs\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/svelte/internal/index.mjs\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nfunction noop() {\n}\nfunction run(fn) {\n return fn();\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === "function";\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nvar resolved_promise = Promise.resolve();\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nvar SvelteElement;\nif (typeof HTMLElement === "function") {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: "open" });\n }\n connectedCallback() {\n const { on_mount } = this.$$;\n this.$$.on_disconnect = on_mount.map(run).filter(is_function);\n for (const key2 in this.$$.slotted) {\n this.appendChild(this.$$.slotted[key2]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n disconnectedCallback() {\n run_all(this.$$.on_disconnect);\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n\n// node_modules/svelte/store/index.mjs\nvar subscriber_queue = [];\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = /* @__PURE__ */ new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) {\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe2(run2, invalidate = noop) {\n const subscriber = [run2, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set) || noop;\n }\n run2(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe: subscribe2 };\n}\n\n// src/stores.ts\nvar localLoad2 = async (key2, def) => {\n if (true) {\n return def;\n }\n const isinls = "__pee__" + key2 in localStorage;\n let ret;\n if (isinls) {\n let it = localStorage.getItem("__pee__" + key2);\n if (it === "undefined")\n it = null;\n ret = { ...def, ...JSON.parse(it || "{}") };\n } else\n ret = def;\n if (true) {\n if (isinls) {\n delete localStorage["__pee__" + key2];\n await chrome.storage.local.set({\n [key2]: JSON.stringify(ret)\n });\n } else {\n const d = await chrome.storage.local.get([key2]);\n if (typeof d[key2] == "string")\n return { ...def, ...await JSON.parse("" + d[key2] || "{}") };\n }\n }\n return ret;\n};\nvar localSet2 = (key2, value) => {\n if (true) {\n return;\n }\n if (true)\n chrome.storage.local.set({ [key2]: JSON.stringify(value) });\n else\n localStorage.setItem("__pee__" + key2, JSON.stringify(value));\n};\nvar initial_settings = localLoad2("settingsv2", {\n loop: true,\n dh: false,\n pmeth: 5,\n xpv: false,\n xpi: false,\n hyd: false,\n notcata: false,\n ak: "",\n auto_embed: 0,\n auto_tags: "",\n te: false,\n eye: false,\n ca: false,\n pre: false,\n prev: false,\n sh: false,\n ep: false,\n tm: false,\n dvc: false,\n expte: false,\n mdist: -1,\n phash: false,\n hotlink: false,\n jpeg: false,\n vercheck: false,\n cache: void 0,\n fhost: 0,\n maxe: 5,\n conc: 8,\n ho: false,\n blacklist: [],\n rsources: []\n});\nvar settings = writable();\ninitial_settings.then((v) => {\n settings.set(v);\n});\nvar appState = writable({\n isCatalog: false,\n is4chanX: false,\n akValid: false,\n herror: "",\n client: null,\n foundPosts: []\n});\nsettings.subscribe((newVal) => {\n localSet2("settingsv2", newVal);\n});\n\n// src/filehosts.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nfunction parseForm(data) {\n const form = new FormData();\n Object.entries(data).filter(([key2, value]) => value !== null).map(([key2, value]) => form.append(key2, value));\n return form;\n}\nvar lolisafe = (domain, serving = domain) => ({\n domain,\n serving,\n async uploadFile(f) {\n const resp = await ifetch(`https://${domain}/api/upload`, {\n headers: {\n accept: "application/json"\n },\n "body": parseForm({\n reqtype: "fileupload",\n "files[]": new File([f], "f.pee")\n }),\n "method": "POST"\n });\n const res = await resp.json();\n return res.files.map((e) => e.url)[0];\n }\n});\nvar catbox = (domain, serving) => ({\n domain,\n serving,\n async uploadFile(inj) {\n const resp = await ifetch(`https://${domain}/user/api.php`, {\n method: "POST",\n body: parseForm({\n reqtype: "fileupload",\n fileToUpload: inj\n })\n });\n return resp.text();\n }\n});\nvar filehosts = [\n catbox("catbox.moe", "files.catbox.moe"),\n catbox("pomf.moe", "a.pomf.cat"),\n lolisafe("take-me-to.space"),\n lolisafe("zz.ht", "z.zz.fo")\n];\n\n// node_modules/file-type/browser.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_node_buffer4 = __toESM(require_buffer(), 1);\nvar import_readable_web_to_node_stream = __toESM(require_lib(), 1);\n\n// node_modules/file-type/core.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_node_buffer3 = __toESM(require_buffer(), 1);\n\n// node_modules/token-types/lib/index.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar ieee754 = __toESM(require_ieee754(), 1);\nvar import_node_buffer = __toESM(require_buffer(), 1);\nvar AnsiStringType = class {\n constructor(len) {\n this.len = len;\n }\n static decode(buffer, offset, until) {\n let str = "";\n for (let i = offset; i < until; ++i) {\n str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i]));\n }\n return str;\n }\n static inRange(a, min, max) {\n return min <= a && a <= max;\n }\n static codePointToString(cp) {\n if (cp <= 65535) {\n return String.fromCharCode(cp);\n } else {\n cp -= 65536;\n return String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320);\n }\n }\n static singleByteDecoder(bite) {\n if (AnsiStringType.inRange(bite, 0, 127)) {\n return bite;\n }\n const codePoint = AnsiStringType.windows1252[bite - 128];\n if (codePoint === null) {\n throw Error("invaliding encoding");\n }\n return codePoint;\n }\n get(buffer, offset = 0) {\n return AnsiStringType.decode(buffer, offset, offset + this.len);\n }\n};\nAnsiStringType.windows1252 = [\n 8364,\n 129,\n 8218,\n 402,\n 8222,\n 8230,\n 8224,\n 8225,\n 710,\n 8240,\n 352,\n 8249,\n 338,\n 141,\n 381,\n 143,\n 144,\n 8216,\n 8217,\n 8220,\n 8221,\n 8226,\n 8211,\n 8212,\n 732,\n 8482,\n 353,\n 8250,\n 339,\n 157,\n 382,\n 376,\n 160,\n 161,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 171,\n 172,\n 173,\n 174,\n 175,\n 176,\n 177,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 187,\n 188,\n 189,\n 190,\n 191,\n 192,\n 193,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 203,\n 204,\n 205,\n 206,\n 207,\n 208,\n 209,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 219,\n 220,\n 221,\n 222,\n 223,\n 224,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 235,\n 236,\n 237,\n 238,\n 239,\n 240,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250,\n 251,\n 252,\n 253,\n 254,\n 255\n];\n\n// node_modules/strtok3/lib/core.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/strtok3/lib/ReadStreamTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/strtok3/lib/AbstractTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/index.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/EndOfFileStream.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/StreamReader.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/Deferred.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/StreamReader.js\nvar maxStreamReadSize = 1 * 1024 * 1024;\n\n// node_modules/strtok3/lib/AbstractTokenizer.js\nvar import_node_buffer2 = __toESM(require_buffer(), 1);\n\n// node_modules/strtok3/lib/BufferTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/file-type/util.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/file-type/supported.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar extensions = [\n "jpg",\n "png",\n "apng",\n "gif",\n "webp",\n "flif",\n "xcf",\n "cr2",\n "cr3",\n "orf",\n "arw",\n "dng",\n "nef",\n "rw2",\n "raf",\n "tif",\n "bmp",\n "icns",\n "jxr",\n "psd",\n "indd",\n "zip",\n "tar",\n "rar",\n "gz",\n "bz2",\n "7z",\n "dmg",\n "mp4",\n "mid",\n "mkv",\n "webm",\n "mov",\n "avi",\n "mpg",\n "mp2",\n "mp3",\n "m4a",\n "oga",\n "ogg",\n "ogv",\n "opus",\n "flac",\n "wav",\n "spx",\n "amr",\n "pdf",\n "epub",\n "elf",\n "exe",\n "swf",\n "rtf",\n "wasm",\n "woff",\n "woff2",\n "eot",\n "ttf",\n "otf",\n "ico",\n "flv",\n "ps",\n "xz",\n "sqlite",\n "nes",\n "crx",\n "xpi",\n "cab",\n "deb",\n "ar",\n "rpm",\n "Z",\n "lz",\n "cfb",\n "mxf",\n "mts",\n "blend",\n "bpg",\n "docx",\n "pptx",\n "xlsx",\n "3gp",\n "3g2",\n "jp2",\n "jpm",\n "jpx",\n "mj2",\n "aif",\n "qcp",\n "odt",\n "ods",\n "odp",\n "xml",\n "mobi",\n "heic",\n "cur",\n "ktx",\n "ape",\n "wv",\n "dcm",\n "ics",\n "glb",\n "pcap",\n "dsf",\n "lnk",\n "alias",\n "voc",\n "ac3",\n "m4v",\n "m4p",\n "m4b",\n "f4v",\n "f4p",\n "f4b",\n "f4a",\n "mie",\n "asf",\n "ogm",\n "ogx",\n "mpc",\n "arrow",\n "shp",\n "aac",\n "mp1",\n "it",\n "s3m",\n "xm",\n "ai",\n "skp",\n "avif",\n "eps",\n "lzh",\n "pgp",\n "asar",\n "stl",\n "chm",\n "3mf",\n "zst",\n "jxl",\n "vcf"\n];\nvar mimeTypes = [\n "image/jpeg",\n "image/png",\n "image/gif",\n "image/webp",\n "image/flif",\n "image/x-xcf",\n "image/x-canon-cr2",\n "image/x-canon-cr3",\n "image/tiff",\n "image/bmp",\n "image/vnd.ms-photo",\n "image/vnd.adobe.photoshop",\n "application/x-indesign",\n "application/epub+zip",\n "application/x-xpinstall",\n "application/vnd.oasis.opendocument.text",\n "application/vnd.oasis.opendocument.spreadsheet",\n "application/vnd.oasis.opendocument.presentation",\n "application/vnd.openxmlformats-officedocument.wordprocessingml.document",\n "application/vnd.openxmlformats-officedocument.presentationml.presentation",\n "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",\n "application/zip",\n "application/x-tar",\n "application/x-rar-compressed",\n "application/gzip",\n "application/x-bzip2",\n "application/x-7z-compressed",\n "application/x-apple-diskimage",\n "application/x-apache-arrow",\n "video/mp4",\n "audio/midi",\n "video/x-matroska",\n "video/webm",\n "video/quicktime",\n "video/vnd.avi",\n "audio/vnd.wave",\n "audio/qcelp",\n "audio/x-ms-asf",\n "video/x-ms-asf",\n "application/vnd.ms-asf",\n "video/mpeg",\n "video/3gpp",\n "audio/mpeg",\n "audio/mp4",\n "audio/opus",\n "video/ogg",\n "audio/ogg",\n "application/ogg",\n "audio/x-flac",\n "audio/ape",\n "audio/wavpack",\n "audio/amr",\n "application/pdf",\n "application/x-elf",\n "application/x-msdownload",\n "application/x-shockwave-flash",\n "application/rtf",\n "application/wasm",\n "font/woff",\n "font/woff2",\n "application/vnd.ms-fontobject",\n "font/ttf",\n "font/otf",\n "image/x-icon",\n "video/x-flv",\n "application/postscript",\n "application/eps",\n "application/x-xz",\n "application/x-sqlite3",\n "application/x-nintendo-nes-rom",\n "application/x-google-chrome-extension",\n "application/vnd.ms-cab-compressed",\n "application/x-deb",\n "application/x-unix-archive",\n "application/x-rpm",\n "application/x-compress",\n "application/x-lzip",\n "application/x-cfb",\n "application/x-mie",\n "application/mxf",\n "video/mp2t",\n "application/x-blender",\n "image/bpg",\n "image/jp2",\n "image/jpx",\n "image/jpm",\n "image/mj2",\n "audio/aiff",\n "application/xml",\n "application/x-mobipocket-ebook",\n "image/heif",\n "image/heif-sequence",\n "image/heic",\n "image/heic-sequence",\n "image/icns",\n "image/ktx",\n "application/dicom",\n "audio/x-musepack",\n "text/calendar",\n "text/vcard",\n "model/gltf-binary",\n "application/vnd.tcpdump.pcap",\n "audio/x-dsf",\n "application/x.ms.shortcut",\n "application/x.apple.alias",\n "audio/x-voc",\n "audio/vnd.dolby.dd-raw",\n "audio/x-m4a",\n "image/apng",\n "image/x-olympus-orf",\n "image/x-sony-arw",\n "image/x-adobe-dng",\n "image/x-nikon-nef",\n "image/x-panasonic-rw2",\n "image/x-fujifilm-raf",\n "video/x-m4v",\n "video/3gpp2",\n "application/x-esri-shape",\n "audio/aac",\n "audio/x-it",\n "audio/x-s3m",\n "audio/x-xm",\n "video/MP1S",\n "video/MP2P",\n "application/vnd.sketchup.skp",\n "image/avif",\n "application/x-lzh-compressed",\n "application/pgp-encrypted",\n "application/x-asar",\n "model/stl",\n "application/vnd.ms-htmlhelp",\n "model/3mf",\n "image/jxl",\n "application/zstd"\n];\n\n// node_modules/file-type/core.js\nvar supportedExtensions = new Set(extensions);\nvar supportedMimeTypes = new Set(mimeTypes);\n\n// src/utils.ts\nvar csettings;\nsettings.subscribe((b) => {\n csettings = b;\n});\nvar threadDataCache = writable();\nvar cthreadDataCache;\nthreadDataCache.subscribe((newval) => {\n cthreadDataCache = newval;\n});\nvar decodeCoom3Payload = async (buff) => {\n if (!csettings)\n throw new Error("Settings uninit");\n const allowed_domains = filehosts.map((e) => e.serving.replaceAll(".", "\\\\."));\n const pees = buff.toString().split(" ").slice(0, csettings.maxe).filter((e) => allowed_domains.some((v) => e.match(`https://(.*\\\\.)?${v}/`)));\n return (await Promise.all(pees.map(async (pee) => {\n try {\n const m = pee.match(/(?https?):\\/\\/(?.*?)(?\\/.*)/);\n if (!m)\n return;\n const { domain, file } = m.groups;\n const headers = await getHeaders(pee);\n const res = await ifetch(pee, {\n headers: { range: "bytes=0-32767", "user-agent": "" },\n mode: "cors",\n referrerPolicy: "no-referrer"\n });\n const size = +headers["content-length"] || 0;\n const header = import_buffer2.Buffer.from(await res.arrayBuffer());\n let hptr = 0;\n if (header.slice(0, 4).toString() == "PEE\\0")\n hptr += 4;\n else\n return;\n const flags = header[hptr];\n const hasFn = !!(flags & 1);\n const hasTags = !!(flags & 2);\n const hasThumbnail = !!(flags & 4);\n let [ptr, ptr2] = [hptr + 1, hptr + 1];\n let fn = "embedded";\n let tags = [];\n let thumb = import_buffer2.Buffer.from(hasembed_default);\n if (hasFn) {\n while (header[ptr2] != 0)\n ptr2++;\n fn = header.slice(ptr, ptr2).toString();\n ptr = ++ptr2;\n }\n if (hasTags) {\n while (header[ptr2] != 0)\n ptr2++;\n tags = header.slice(ptr, ptr2).toString().split(/\\s+/);\n }\n let thumbsize = 0;\n if (hasThumbnail) {\n thumbsize = header.readInt32LE(ptr);\n ptr += 4;\n if (header.byteLength >= ptr + thumbsize)\n thumb = header.slice(ptr, ptr + thumbsize);\n else\n thumb = import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer());\n ptr += thumbsize;\n }\n const unzip = { url: pee, headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } };\n let data;\n data = unzip;\n if (size < 3072) {\n thumb = data = import_buffer2.Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer());\n }\n return {\n filename: fn,\n data,\n thumbnail: thumb\n };\n } catch (e) {\n console.warn(e);\n }\n }))).filter((e) => e).map((e) => e);\n};\n\n// src/pngv3.ts\nvar bs58 = __toESM(require_bs58(), 1);\n\n// src/bitstream.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar revbyte = (n, len = 8) => {\n let acc = 0;\n let n2 = n;\n let len2 = len;\n while (len2) {\n acc = acc * 2 + (n2 & 1);\n n2 >>= 1;\n len2--;\n }\n return acc;\n};\nvar BitstreamReader = class {\n constructor() {\n this.buffers = [];\n this.bufferedLength = 0;\n this._offsetIntoBuffer = 0;\n this._bufferIndex = 0;\n this._offset = 0;\n this.skippedLength = 0;\n }\n get bufferIndex() {\n return this._bufferIndex;\n }\n get offset() {\n return this._offset;\n }\n get available() {\n return this.bufferedLength - this.skippedLength;\n }\n getBit(offset) {\n const byte = this.buffers[0][offset >> 3];\n return +!!(byte & 1 << (offset & 7));\n }\n readSync(length) {\n let value = 0;\n if (this._offset >> 3 > this.buffers[0].byteLength) {\n throw "Out of data";\n }\n for (let i = length - 1; i >= 0; --i) {\n value = value * 2 + this.getBit(this._offset + i);\n }\n this._offset += length;\n this.bufferedLength -= length;\n return value;\n }\n addBuffer(buffer) {\n this.buffers.push(buffer);\n this.bufferedLength += buffer.length * 8;\n }\n};\nvar BitstreamWriter = class {\n constructor(stream, bufferSize = 1) {\n this.stream = stream;\n this.pendingBits = 0;\n this.bufferoffset = 0;\n this._offset = 0;\n bufferSize = 1;\n this.buffer = new Uint8Array(bufferSize);\n }\n get offset() {\n return this._offset;\n }\n get byteOffset() {\n return this.pendingBits;\n }\n end() {\n this.flush();\n }\n flush() {\n this.stream.write(new Uint8Array(this.buffer));\n this.bufferoffset = 0;\n this.buffer.fill(0);\n }\n setBit(b) {\n let byte = this.buffer[0];\n byte |= b << (this._offset & 7);\n this.buffer[0] = byte;\n this._offset += 1;\n if (++this.bufferoffset == this.buffer.length * 8) {\n this.flush();\n }\n }\n write(length, value) {\n while (length--) {\n this.setBit(value & 1);\n value >>= 1;\n }\n }\n};\n\n// src/dh-deflate.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar TINF_OK = 0;\nvar Tree = class {\n constructor() {\n this.table = new Uint16Array(16);\n this.trans = new Uint16Array(288);\n }\n};\nvar getPathTo = (tree, value) => {\n if (tree[0] === value)\n return "0";\n if (tree[1] === value)\n return "1";\n let p;\n if (typeof tree[0] != "number")\n p = getPathTo(tree[0], value);\n let b = "0";\n if (!p) {\n if (tree[1] && typeof tree[1] != "number")\n p = getPathTo(tree[1], value);\n b = "1";\n }\n if (p)\n return b + p;\n};\nfunction buildHuffmanTable(codeLengths, values) {\n let k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({ children: [], index: 0 });\n let p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error("Could not recreate Huffman Table");\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n}\nvar Data = class {\n constructor(source, dests, to_hide, hidden) {\n this.source = source;\n this.dests = dests;\n this.to_hide = to_hide;\n this.hidden = hidden;\n this.pathMap = /* @__PURE__ */ new Map();\n this.dest = [];\n this.ltree = new Tree();\n this.dtree = new Tree();\n }\n computeReverse() {\n this.rltree = buildHuffmanTable(this.ltree.table, this.ltree.trans)[0];\n this.rdtree = buildHuffmanTable(this.dtree.table, this.dtree.trans)[0];\n this.adists = new Set(this.rdtree.flat(16));\n }\n};\nvar sltree = new Tree();\nvar sdtree = new Tree();\nvar rltree;\nvar rdtree;\nvar sadist;\nvar length_bits = new Uint8Array(30);\nvar length_base = new Uint16Array(30);\nvar dist_bits = new Uint8Array(30);\nvar dist_base = new Uint16Array(30);\nvar clcidx = new Uint8Array([\n 16,\n 17,\n 18,\n 0,\n 8,\n 7,\n 9,\n 6,\n 10,\n 5,\n 11,\n 4,\n 12,\n 3,\n 13,\n 2,\n 14,\n 1,\n 15\n]);\nvar code_tree = new Tree();\nvar lengths = new Uint8Array(288 + 32);\nfunction tinf_build_bits_base(bits, base, delta, first) {\n let i, sum;\n for (i = 0; i < delta; ++i)\n bits[i] = 0;\n for (i = 0; i < 30 - delta; ++i)\n bits[i + delta] = i / delta | 0;\n for (sum = first, i = 0; i < 30; ++i) {\n base[i] = sum;\n sum += 1 << bits[i];\n }\n}\nfunction tinf_build_fixed_trees(lt, dt) {\n let i;\n for (i = 0; i < 7; ++i)\n lt.table[i] = 0;\n lt.table[7] = 24;\n lt.table[8] = 152;\n lt.table[9] = 112;\n for (i = 0; i < 24; ++i)\n lt.trans[i] = 256 + i;\n for (i = 0; i < 144; ++i)\n lt.trans[24 + i] = i;\n for (i = 0; i < 8; ++i)\n lt.trans[24 + 144 + i] = 280 + i;\n for (i = 0; i < 112; ++i)\n lt.trans[24 + 144 + 8 + i] = 144 + i;\n for (i = 0; i < 5; ++i)\n dt.table[i] = 0;\n dt.table[5] = 32;\n for (i = 0; i < 32; ++i)\n dt.trans[i] = i;\n}\nvar offs = new Uint16Array(16);\nfunction tinf_build_tree(t, lengths2, off, num) {\n let i, sum;\n for (i = 0; i < 16; ++i)\n t.table[i] = 0;\n for (i = 0; i < num; ++i)\n t.table[lengths2[off + i]]++;\n t.table[0] = 0;\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum;\n sum += t.table[i];\n }\n for (i = 0; i < num; ++i) {\n if (lengths2[off + i])\n t.trans[offs[lengths2[off + i]]++] = i;\n }\n}\nfunction tinf_getbit(d) {\n const v = d.source.readSync(1);\n return v;\n}\nvar loff = 0;\nvar loffs = [];\nfunction tinf_read_bits(d, num, base) {\n if (!num)\n return base;\n const v = d.source.readSync(num) + base;\n loff = v;\n loffs.push(v);\n if (loffs.length > 4) {\n loffs.shift();\n }\n return v;\n}\nfunction tinf_decode_symbol(d, t, copy = true, ext = {}) {\n let sum = 0, cur = 0, len = 0;\n let s = 0;\n do {\n const b = d.source.readSync(1);\n copy && d.hidden?.write(1, b);\n s = s << 1 | b;\n cur = 2 * cur + b;\n ++len;\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n ext.length = len;\n ext.sym = s;\n return t.trans[sum + cur];\n}\nfunction tinf_decode_trees(d, lt, dt, copy = true) {\n let i, num, length;\n const hlit = tinf_read_bits(d, 5, 257);\n copy && d.hidden?.write(5, hlit - 257);\n const hdist = tinf_read_bits(d, 5, 1);\n copy && d.hidden?.write(5, hdist - 1);\n const hclen = tinf_read_bits(d, 4, 4);\n copy && d.hidden?.write(4, hclen - 4);\n for (i = 0; i < 19; ++i)\n lengths[i] = 0;\n for (i = 0; i < hclen; ++i) {\n const clen = tinf_read_bits(d, 3, 0);\n copy && d.hidden?.write(3, clen);\n lengths[clcidx[i]] = clen;\n }\n tinf_build_tree(code_tree, lengths, 0, 19);\n for (num = 0; num < hlit + hdist; ) {\n const sym = tinf_decode_symbol(d, code_tree, copy);\n let prev;\n switch (sym) {\n case 16:\n prev = lengths[num - 1];\n length = tinf_read_bits(d, 2, 3);\n copy && d.hidden?.write(2, length - 3);\n for (; length; --length) {\n lengths[num++] = prev;\n }\n break;\n case 17:\n length = tinf_read_bits(d, 3, 3);\n copy && d.hidden?.write(3, length - 3);\n for (; length; --length) {\n lengths[num++] = 0;\n }\n break;\n case 18:\n length = tinf_read_bits(d, 7, 11);\n copy && d.hidden?.write(7, length - 11);\n for (; length; --length) {\n lengths[num++] = 0;\n }\n break;\n default:\n lengths[num++] = sym;\n break;\n }\n }\n tinf_build_tree(lt, lengths, 0, hlit);\n tinf_build_tree(dt, lengths, hlit, hdist);\n}\nvar get_symbol = (value, bits_table, base_table) => {\n let i = 0;\n for (i = 0; i < base_table.length; ++i) {\n if (base_table[i] > value) {\n i--;\n return [i, bits_table[i], value - base_table[i]];\n }\n }\n i--;\n return [i, bits_table[i], value - base_table[i]];\n};\nvar encode_symbol = (sym, tree, pathMap) => {\n const code = getPathTo(tree, sym);\n const v = {\n length: code?.length,\n val: parseInt(code, 2)\n };\n return v;\n};\nvar capacity = 0;\nfunction tinf_inflate_block_data(d, lt, dt) {\n while (1) {\n let sym = tinf_decode_symbol(d, lt);\n if (sym === 256) {\n return TINF_OK;\n }\n if (sym < 256) {\n d.dest.push(sym);\n } else {\n sym -= 257;\n const length = tinf_read_bits(d, length_bits[sym], length_base[sym]);\n if (length_bits[sym])\n d.hidden?.write(length_bits[sym], length - length_base[sym]);\n const ext = { length: 0, sym: 0 };\n const dist = tinf_decode_symbol(d, dt, false, ext);\n let backoffset = tinf_read_bits(d, dist_bits[dist], dist_base[dist]);\n const offs2 = d.dest.length - backoffset;\n let match;\n const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader && d.to_hide.available == 0;\n if (!skip && (match = Buffer2.from(d.dest.slice(offs2, offs2 + length))).length == length) {\n let begin = d.dest.length - 32768;\n if (begin < 0)\n begin = 0;\n let matches = [];\n let o = 0;\n const slic = Buffer2.from(d.dest.slice(begin + o, d.dest.length));\n while (begin + o < d.dest.length) {\n const r = slic.slice(o, d.dest.length).indexOf(match);\n if (r >= 0) {\n matches.push(r + begin + o);\n o += r;\n } else {\n break;\n }\n o++;\n }\n if (matches.length > 1) {\n matches = matches.map((e) => -(e - d.dest.length)).filter((e) => {\n const [dsym2] = get_symbol(e, dist_bits, dist_base);\n return d.adists.has(dsym2);\n });\n matches.reverse();\n const v = Math.floor(Math.log2(matches.length));\n capacity += v;\n if (d.to_hide instanceof BitstreamReader) {\n if (d.to_hide.available) {\n const s = d.to_hide.readSync(Math.min(d.to_hide.available, v));\n backoffset = matches[s];\n }\n } else {\n const idx = matches.indexOf(backoffset);\n d.to_hide.write(v, idx);\n }\n }\n }\n const [dsym, dlen, doff] = get_symbol(backoffset, dist_bits, dist_base);\n const encdist = encode_symbol(dsym, d.rdtree, d.pathMap);\n d.hidden?.write(encdist.length, revbyte(encdist.val, encdist.length));\n d.hidden?.write(dlen, doff);\n for (let i = offs2; i < offs2 + length; ++i) {\n d.dest.push(d.dest[i]);\n }\n }\n }\n}\nfunction tinf_inflate_uncompressed_block(d) {\n if (d.source.offset & 7)\n d.source.readSync(8 - d.source.offset & 7);\n if (d.hidden && d.hidden.offset & 7)\n d.hidden?.write(8 - d.hidden.offset & 7, 0);\n const length = d.source.readSync(16);\n d.hidden?.write(16, length);\n const invlength = d.source.readSync(16);\n d.hidden?.write(16, invlength);\n if (length !== (~invlength & 65535)) {\n return -4;\n }\n for (let i = length; i; --i) {\n const v = d.source.readSync(8);\n d.dest.push(v);\n d.hidden?.write(8, v);\n }\n return TINF_OK;\n}\nfunction tinf_uncompress(source, decompressed, to_hide, hidden, opt = 0) {\n const decomp = decompressed ? new BitstreamWriter({ write: decompressed }) : null;\n const hid = hidden && new BitstreamWriter({ write: hidden }, 4);\n const d = new Data(source, decomp, to_hide, hid);\n let res;\n let bfinal, btype;\n do {\n bfinal = tinf_getbit(d);\n d.hidden?.write(1, bfinal);\n btype = tinf_read_bits(d, 2, 0);\n d.hidden?.write(2, btype);\n switch (btype) {\n case 0:\n res = tinf_inflate_uncompressed_block(d);\n break;\n case 1:\n d.rdtree = rdtree;\n d.rltree = rltree;\n d.adists = sadist;\n res = tinf_inflate_block_data(d, sltree, sdtree);\n break;\n case 2:\n tinf_decode_trees(d, d.ltree, d.dtree);\n d.computeReverse();\n res = tinf_inflate_block_data(d, d.ltree, d.dtree);\n break;\n default:\n res = -2;\n }\n if (res !== TINF_OK)\n throw new Error("Data error " + res);\n } while (!bfinal);\n decomp?.end();\n hid?.end();\n}\ntinf_build_fixed_trees(sltree, sdtree);\ntinf_build_bits_base(length_bits, length_base, 4, 3);\ntinf_build_bits_base(dist_bits, dist_base, 2, 1);\nrltree = buildHuffmanTable(sltree.table, sltree.trans)[0];\nrdtree = buildHuffmanTable(sdtree.table, sdtree.trans)[0];\nsadist = new Set(rdtree.flat(16));\nlength_bits[28] = 0;\nlength_base[28] = 258;\n\n// src/pngv3.ts\nvar csettings2;\nsettings.subscribe((b) => {\n csettings2 = b;\n});\nvar CUM3 = import_buffer3.Buffer.from("doo\\0m");\nvar CUM4 = import_buffer3.Buffer.from("voo\\0m");\nvar CUM5 = import_buffer3.Buffer.from("boo\\0");\nvar CUM6 = import_buffer3.Buffer.from("Creation Time\\0");\nvar CUM7 = import_buffer3.Buffer.from("Software\\0");\nvar BufferReadStream = (b) => {\n const ret = new ReadableStream({\n pull(cont) {\n cont.enqueue(b);\n cont.close();\n }\n });\n return ret;\n};\nvar password = import_buffer3.Buffer.from("NOA");\nvar xor = (a, p) => {\n let n = 0;\n for (let i = 0; i < a.byteLength; ++i) {\n a[i] ^= p[n];\n n++;\n n %= p.byteLength;\n }\n};\nvar prefs = {\n "files.catbox.moe": "c",\n "a.pomf.cat": "p",\n "take-me-to.space": "t",\n "z.zz.fo": "z"\n};\nvar rprefs = {\n "c": "files.catbox.moe",\n "p": "a.pomf.cat",\n "t": "take-me-to.space",\n "z": "z.zz.fo"\n};\nvar extractFromRawDeflate = (b) => {\n const src = new BitstreamReader();\n src.addBuffer(b);\n const chnks = [];\n const hidden = new BitstreamWriter({\n write(chunk) {\n for (const i of chunk) {\n if (i)\n chnks.push(i);\n else\n throw "Finish";\n }\n }\n });\n try {\n tinf_uncompress(src, void 0, hidden, void 0);\n } catch (e) {\n if (e == "Finish")\n return import_buffer3.Buffer.from(chnks);\n }\n return false;\n};\nvar extract = async (png, doextract = true) => {\n const reader = BufferReadStream(png).getReader();\n const sneed = new PNGDecoder(reader, false);\n const ret = [];\n let w;\n if (!csettings2)\n throw new Error("Settings uninit");\n try {\n let complete = false;\n const idats = [];\n for await (const [name, chunk, crc, offset] of sneed.chunks()) {\n let buff;\n switch (name) {\n case "tEXt":\n buff = chunk;\n if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) {\n if (!doextract)\n return true;\n const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length));\n ret.push(...k.filter((e) => e));\n }\n if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) {\n if (!doextract)\n return true;\n const passed = buff.slice(4 + CUM4.length);\n xor(passed, password);\n const k = await decodeCoom3Payload(passed);\n ret.push(...k.filter((e) => e));\n }\n if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) {\n if (!doextract)\n return true;\n const passed = buff.slice(4 + CUM5.length);\n const decoded = import_buffer3.Buffer.from(passed.toString(), "base64").toString().split(" ").map((e) => {\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded));\n ret.push(...k.filter((e) => e));\n }\n if (w = [CUM6, CUM7].find((e) => buff.slice(4, 4 + e.length).equals(e))) {\n const passed = buff.slice(4 + w.length);\n if (!passed.toString().match(/^[0-9a-zA-Z+/=]+$/g))\n continue;\n const decoders = [\n (b) => import_buffer3.Buffer.from(b.toString(), "base64").toString(),\n (b) => import_buffer3.Buffer.from(bs58.decode(passed.toString())).toString()\n ];\n for (const d of decoders) {\n try {\n const decoded = d(passed).split(" ").map((e) => {\n if (!(e[0] in rprefs))\n throw "Uhh";\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n if (!doextract)\n return true;\n const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded));\n ret.push(...k.filter((e) => e));\n } catch (e) {\n }\n }\n }\n break;\n case "IDAT":\n if (ret.length)\n return ret;\n buff = chunk;\n idats.push(buff.slice(4));\n break;\n case "IEND":\n complete = true;\n default:\n break;\n }\n }\n if (idats.length) {\n let decoded;\n if ((decoded = extractFromRawDeflate(import_buffer3.Buffer.concat(idats).slice(2))) === false)\n return false;\n const dec = decoded.toString().split(" ").map((e) => {\n if (!(e[0] in rprefs))\n throw "Uhh";\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n if (doextract)\n return decodeCoom3Payload(import_buffer3.Buffer.from(dec));\n return true;\n }\n } catch (e) {\n if (e != "Uhh")\n console.error(e);\n } finally {\n reader.releaseLock();\n }\n};\nvar buildChunk = (tag, data) => {\n const ret = import_buffer3.Buffer.alloc(data.byteLength + 4);\n ret.write(tag.slice(0, 4), 0);\n data.copy(ret, 4);\n return ret;\n};\nvar BufferWriteStream = () => {\n let b = import_buffer3.Buffer.from([]);\n const ret = new WritableStream({\n write(chunk) {\n b = import_buffer3.Buffer.concat([b, chunk]);\n console.log("finished appending");\n }\n });\n return [ret, () => b];\n};\nvar embedInRawDeflate = (b, h) => {\n const src = new BitstreamReader();\n const hid = new BitstreamReader();\n hid.addBuffer(h);\n src.addBuffer(b);\n const chnks = [];\n tinf_uncompress(src, void 0, hid, (c) => chnks.push(c));\n return import_buffer3.Buffer.concat(chnks);\n};\nvar inject_data = async (container, injb) => {\n if (!csettings2)\n throw new Error("Settings uninit");\n if (csettings2.pmeth < 5) {\n let magic = false;\n const [writestream2, extract6] = BufferWriteStream();\n const encoder = new PNGEncoder(writestream2);\n const decoder = new PNGDecoder(container.stream().getReader());\n for await (const [name, chunk, crc, offset] of decoder.chunks()) {\n if (magic && name != "IDAT")\n break;\n if (!magic && name == "IDAT") {\n const passed = import_buffer3.Buffer.from(injb);\n switch (csettings2.pmeth) {\n case 0:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM3, passed])), 0, 0]);\n break;\n case 1:\n xor(passed, password);\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM4, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 2:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM5, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 3:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM6, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 4:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM7, import_buffer3.Buffer.from(bs58.encode(passed))])), 0, 0]);\n break;\n }\n magic = true;\n }\n await encoder.insertchunk([name, chunk, crc, offset]);\n }\n await encoder.insertchunk([\n "IEND",\n buildChunk("IEND", import_buffer3.Buffer.from([])),\n 0,\n 0\n ]);\n return extract6();\n }\n let pdec = new PNGDecoder(container.stream().getReader());\n const concat = [];\n for await (const chk of pdec.chunks())\n if (chk[0] == "IDAT")\n concat.push(chk[1].slice(4));\n const comp = import_buffer3.Buffer.concat(concat);\n const head = comp.slice(0, 2);\n const chksum = comp.slice(-4);\n const idatblk = embedInRawDeflate(comp.slice(2, -4), injb);\n const [writestream, extract5] = BufferWriteStream();\n const penc = new PNGEncoder(writestream);\n pdec = new PNGDecoder(container.stream().getReader());\n let ins = false;\n for await (const chk of pdec.chunks()) {\n if (chk[0] != "IDAT") {\n await penc.insertchunk(chk);\n } else {\n if (!ins) {\n await penc.insertchunk(["IDAT", import_buffer3.Buffer.concat([import_buffer3.Buffer.from("IDAT"), head, idatblk, chksum]), 0, 0]);\n ins = true;\n }\n }\n }\n await penc.dtor();\n console.log("Finished writing");\n return extract5();\n};\nvar inject = async (container, links) => {\n links = links.map((link) => {\n for (const h of filehosts) {\n if (link.includes(h.serving)) {\n const end = link.split("/").slice(-1)[0];\n return `${prefs[h.serving]}${end}`;\n }\n }\n return "";\n });\n const injb = import_buffer3.Buffer.from(links.join(" "));\n return inject_data(container, injb);\n};\nvar has_embed = async (png) => {\n const r = await extract(png, false);\n return !!r;\n};\nvar pngv3_default = {\n extract,\n has_embed,\n inject,\n match: (fn) => !!fn.match(/\\.png$/)\n};\n\n// src/jpg.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer4 = __toESM(require_buffer(), 1);\n\n// src/f5stego.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar bitcode = new Array(65535);\nvar category = new Array(65535);\nvar std_dc_luminance_nrcodes = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];\nvar std_dc_luminance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nvar std_ac_luminance_nrcodes = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125];\nvar std_ac_luminance_values = [\n 1,\n 2,\n 3,\n 0,\n 4,\n 17,\n 5,\n 18,\n 33,\n 49,\n 65,\n 6,\n 19,\n 81,\n 97,\n 7,\n 34,\n 113,\n 20,\n 50,\n 129,\n 145,\n 161,\n 8,\n 35,\n 66,\n 177,\n 193,\n 21,\n 82,\n 209,\n 240,\n 36,\n 51,\n 98,\n 114,\n 130,\n 9,\n 10,\n 22,\n 23,\n 24,\n 25,\n 26,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n];\nvar std_dc_chrominance_nrcodes = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];\nvar std_dc_chrominance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nvar std_ac_chrominance_nrcodes = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119];\nvar std_ac_chrominance_values = [\n 0,\n 1,\n 2,\n 3,\n 17,\n 4,\n 5,\n 33,\n 49,\n 6,\n 18,\n 65,\n 81,\n 7,\n 97,\n 113,\n 19,\n 34,\n 50,\n 129,\n 8,\n 20,\n 66,\n 145,\n 161,\n 177,\n 193,\n 9,\n 35,\n 51,\n 82,\n 240,\n 21,\n 98,\n 114,\n 209,\n 10,\n 22,\n 36,\n 52,\n 225,\n 37,\n 241,\n 23,\n 24,\n 25,\n 26,\n 38,\n 39,\n 40,\n 41,\n 42,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n];\nfunction _initCategoryNumber() {\n var nrlower = 1;\n var nrupper = 2;\n for (var cat = 1; cat <= 15; cat++) {\n for (var nr = nrlower; nr < nrupper; nr++) {\n category[32767 + nr] = cat;\n bitcode[32767 + nr] = [];\n bitcode[32767 + nr][1] = cat;\n bitcode[32767 + nr][0] = nr;\n }\n for (var nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) {\n category[32767 + nrneg] = cat;\n bitcode[32767 + nrneg] = [];\n bitcode[32767 + nrneg][1] = cat;\n bitcode[32767 + nrneg][0] = nrupper - 1 + nrneg;\n }\n nrlower <<= 1;\n nrupper <<= 1;\n }\n}\n_initCategoryNumber();\nfunction _computeHuffmanTbl(nrcodes, std_table) {\n var codevalue = 0;\n var pos_in_table = 0;\n var HT = [];\n for (var k = 1; k <= 16; k++) {\n for (var j = 1; j <= nrcodes[k]; j++) {\n HT[std_table[pos_in_table]] = [];\n HT[std_table[pos_in_table]][0] = codevalue;\n HT[std_table[pos_in_table]][1] = k;\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n}\nvar YDC_HT = _computeHuffmanTbl(std_dc_luminance_nrcodes, std_dc_luminance_values);\nvar UVDC_HT = _computeHuffmanTbl(std_dc_chrominance_nrcodes, std_dc_chrominance_values);\nvar YAC_HT = _computeHuffmanTbl(std_ac_luminance_nrcodes, std_ac_luminance_values);\nvar UVAC_HT = _computeHuffmanTbl(std_ac_chrominance_nrcodes, std_ac_chrominance_values);\nvar _randPool, __raw, _jfif, _APPn, _qts, _frame, _tail, _shuffleInit, shuffleInit_fn, _stegShuffle, stegShuffle_fn, __analyze, _analyze_fn, __f5write, _f5write_fn;\nvar f5stego = class {\n constructor(key2, maxPixels = 4096 * 4096) {\n this.maxPixels = maxPixels;\n __privateAdd(this, _shuffleInit);\n __privateAdd(this, _stegShuffle);\n __privateAdd(this, __analyze);\n __privateAdd(this, __f5write);\n __privateAdd(this, _randPool, void 0);\n __privateAdd(this, __raw, void 0);\n __privateAdd(this, _jfif, void 0);\n __privateAdd(this, _APPn, void 0);\n __privateAdd(this, _qts, void 0);\n __privateAdd(this, _frame, null);\n __privateAdd(this, _tail, null);\n __privateMethod(this, _shuffleInit, shuffleInit_fn).call(this, key2);\n }\n embed(image, data, k) {\n this.parse(image);\n this.f5put(data, k);\n return this.pack();\n }\n extract(image) {\n this.parse(image, true);\n return this.f5get();\n }\n analyze() {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var i, comp = __privateGet(this, _frame).components[0];\n if (comp.componentId != 1) {\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n return __privateMethod(this, __analyze, _analyze_fn).call(this, comp.blocks);\n }\n f5put(data, k) {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var t, i, comp = __privateGet(this, _frame).components[0];\n if (data.length > 8388607)\n throw "Data too big. Max 8388607 bytes allowed.";\n if (data.length < 32768) {\n t = new Uint8Array(2 + data.length);\n t[0] = data.length & 255;\n t[1] = data.length >>> 8;\n t.set(data, 2);\n } else {\n t = new Uint8Array(3 + data.length);\n t[0] = data.length & 255;\n t[1] = (data.length >>> 8 & 127) + 128;\n t[2] = data.length >>> 15;\n t.set(data, 3);\n }\n if (comp.componentId != 1) {\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (k) {\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n return __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n let ret;\n let prop = __privateMethod(this, __analyze, _analyze_fn).call(this, comp.blocks);\n k = 0;\n for (i = prop.capacity.length - 1; i >= 0; i--) {\n if (prop.capacity[i] >= t.length) {\n k = i;\n break;\n }\n }\n if (k === 0)\n throw "capacity exceeded";\n try {\n ret = __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n } catch (e) {\n k--;\n if (k === 0)\n throw "capacity exceeded";\n ret = __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n }\n ret["stats"] = prop;\n return ret;\n }\n f5get() {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var comp = __privateGet(this, _frame).components[0];\n if (comp.componentId != 1) {\n for (var i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n var coeff = new Int16Array(comp.blocks.length);\n coeff.set(comp.blocks);\n var pos = -1, extrBit = 0, cCount = coeff.length - 1;\n var n, k = 0;\n var out = new Uint8Array(coeff.length / 8 | 0), extrByte = 0, outPos = 0, bitsAvail = 0, code = 0, hash = 0;\n while (bitsAvail < 4) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n k |= extrBit << bitsAvail;\n bitsAvail++;\n }\n k = (k & 15) + 1;\n n = (1 << k) - 1;\n bitsAvail = 0;\n if (k == 1) {\n while (pos < cCount) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n extrByte |= extrBit << bitsAvail;\n bitsAvail++;\n if (bitsAvail == 8) {\n out[outPos++] = extrByte;\n extrByte = 0;\n bitsAvail = 0;\n }\n }\n } else {\n while (pos < cCount) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n hash ^= extrBit * ++code;\n if (code == n) {\n extrByte |= hash << bitsAvail;\n bitsAvail += k;\n code = 0;\n hash = 0;\n while (bitsAvail >= 8) {\n out[outPos++] = extrByte & 255;\n bitsAvail -= 8;\n extrByte = extrByte >> 8;\n }\n }\n }\n }\n while (bitsAvail > 0) {\n out[outPos++] = extrByte & 255;\n bitsAvail -= 8;\n extrByte = extrByte >> 8;\n }\n var s = 2, l = out[0];\n if (out[1] & 128) {\n s++;\n l += ((out[1] & 127) << 8) + (out[2] << 15);\n } else {\n l += out[1] << 8;\n }\n return out.subarray(s, s + l);\n }\n parse(data, tolerant = false) {\n var offset = 0;\n function _buildHuffmanTable(nrcodes, values) {\n var codevalue = 0, pos_in_table = 0, HT = new Uint16Array(65536);\n for (var k = 0; k < 16; k++) {\n for (var j2 = 0; j2 < nrcodes[k]; j2++) {\n for (var i2 = codevalue << 15 - k, cntTo = codevalue + 1 << 15 - k; i2 < cntTo; i2++) {\n HT[i2] = values[pos_in_table] + (k + 1 << 8);\n }\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n }\n function decodeScan(data2, offset2, frame, components2, resetInterval2, spectralStart2, spectralEnd2, successivePrev, successive) {\n var startOffset = offset2, bitsData = 0, bitsCount = 0, eobrun = 0, p1 = 1 << successive, m1 = -1 << successive;\n function decodeBaseline(component2, pos) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n var t = component2.huffmanTableDC[bitsData >>> bitsCount - 16 & 65535];\n if (!t)\n throw "invalid huffman sequence";\n bitsCount -= t >>> 8;\n t &= 255;\n var diff = 0;\n if (t !== 0) {\n while (bitsCount < t) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n diff = bitsData >>> bitsCount - t & (1 << t) - 1;\n bitsCount -= t;\n if (diff < 1 << t - 1)\n diff += (-1 << t) + 1;\n }\n component2.blocksDC[pos >> 6] = component2.pred += diff;\n var k2 = 1, s, r;\n while (k2 < 64) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s === 0) {\n if (r < 15) {\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n while (bitsCount < s) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n component2.blocks[pos + k2] = bitsData >>> bitsCount - s & (1 << s) - 1;\n bitsCount -= s;\n if (component2.blocks[pos + k2] < 1 << s - 1)\n component2.blocks[pos + k2] += (-1 << s) + 1;\n k2++;\n }\n }\n function decodeDCFirst(component2, pos) {\n var diff = 0;\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n var t = component2.huffmanTableDC[bitsData >>> bitsCount - 16 & 65535];\n if (!t)\n throw "invalid huffman sequence";\n bitsCount -= t >>> 8;\n t &= 255;\n if (t !== 0) {\n while (bitsCount < t) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n diff = bitsData >>> bitsCount - t & (1 << t) - 1;\n bitsCount -= t;\n if (diff < 1 << t - 1)\n diff += (-1 << t) + 1;\n }\n component2.blocksDC[pos >> 6] = component2.pred += diff << successive;\n }\n function decodeDCSuccessive(component2, pos) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocksDC[pos >> 6] |= (bitsData >>> --bitsCount & 1) << successive;\n }\n if (!frame)\n throw "Frame not parsed yet";\n function decodeACFirst(component2, pos) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k2 = spectralStart2, s, r;\n while (k2 <= spectralEnd2) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s === 0) {\n if (r != 15) {\n eobrun = (1 << r) - 1;\n if (r) {\n while (bitsCount < r) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n eobrun += bitsData >>> bitsCount - r & (1 << r) - 1;\n bitsCount -= r;\n }\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n while (bitsCount < s) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n component2.blocks[pos + k2] = bitsData >>> bitsCount - s & (1 << s) - 1;\n bitsCount -= s;\n if (component2.blocks[pos + k2] < 1 << s - 1)\n component2.blocks[pos + k2] += (-1 << s) + 1;\n component2.blocks[pos + k2] *= p1;\n k2++;\n }\n }\n function decodeACSuccessive(component2, pos) {\n var k2 = spectralStart2, r, s;\n if (frame == null)\n throw "Frame not defined";\n if (!eobrun) {\n while (k2 <= spectralEnd2) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s) {\n if (s != 1)\n throw "bad jpeg";\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n s = bitsData >>> --bitsCount & 1 ? p1 : m1;\n } else {\n if (r != 15) {\n eobrun = 1 << r;\n if (r) {\n while (bitsCount < r) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n eobrun += bitsData >>> bitsCount - r & (1 << r) - 1;\n bitsCount -= r;\n }\n break;\n }\n }\n while (k2 <= spectralEnd2) {\n if (component2.blocks[pos + k2]) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocks[pos + k2] += (bitsData >>> --bitsCount & 1) * (component2.blocks[pos + k2] >= 0 ? p1 : m1);\n } else {\n if (--r < 0)\n break;\n }\n k2++;\n }\n if (s)\n component2.blocks[pos + k2] = s;\n k2++;\n }\n }\n if (eobrun) {\n while (k2 <= spectralEnd2) {\n if (component2.blocks[pos + k2]) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocks[pos + k2] += (bitsData >>> --bitsCount & 1) * (component2.blocks[pos + k2] >= 0 ? p1 : m1);\n }\n k2++;\n }\n eobrun--;\n }\n }\n var decodeFn;\n if (frame.progressive) {\n if (spectralStart2 === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n var marker, mcuExpected, i2, j2, k, n, mcusPerLine2, mcusPerRow, x, y;\n if (components2.length == 1) {\n mcusPerLine2 = components2[0].blocksPerLine;\n mcusPerRow = components2[0].blocksPerColumn;\n mcuExpected = mcusPerRow * mcusPerLine2;\n if (!resetInterval2)\n resetInterval2 = mcuExpected;\n n = resetInterval2;\n components2[0].pred = 0;\n eobrun = 0;\n for (y = 0; y < mcusPerRow; y++) {\n for (x = 0; x < mcusPerLine2; x++) {\n if (!n) {\n n = resetInterval2;\n components2[0].pred = 0;\n eobrun = 0;\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n bitsCount = 0;\n marker = data2[offset2] << 8 | data2[offset2 + 1];\n if (marker >= 65488 && marker <= 65495) {\n offset2 += 2;\n } else {\n if (marker <= 65280) {\n throw "bad jpeg";\n }\n break;\n }\n }\n n--;\n for (i2 = 0; i2 < components2.length; i2++) {\n decodeFn(components2[i2], (y * components2[i2].blocksPerLineForMcu + x) * 64);\n }\n }\n }\n } else {\n mcusPerLine2 = frame.mcusPerLine;\n mcusPerRow = frame.mcusPerColumn;\n mcuExpected = mcusPerRow * mcusPerLine2;\n if (!resetInterval2)\n resetInterval2 = mcuExpected;\n n = resetInterval2;\n for (i2 = 0; i2 < components2.length; i2++)\n components2[i2].pred = 0;\n eobrun = 0;\n for (y = 0; y < mcusPerRow; y++) {\n for (x = 0; x < mcusPerLine2; x++) {\n if (!n) {\n n = resetInterval2;\n for (i2 = 0; i2 < components2.length; i2++)\n components2[i2].pred = 0;\n eobrun = 0;\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n bitsCount = 0;\n marker = data2[offset2] << 8 | data2[offset2 + 1];\n if (marker >= 65488 && marker <= 65495) {\n offset2 += 2;\n } else {\n if (marker <= 65280) {\n throw "bad jpeg";\n }\n break;\n }\n }\n n--;\n for (i2 = 0; i2 < components2.length; i2++) {\n for (j2 = 0; j2 < components2[i2].v; j2++) {\n for (k = 0; k < components2[i2].h; k++) {\n decodeFn(components2[i2], ((y * components2[i2].v + j2) * components2[i2].blocksPerLineForMcu + x * components2[i2].h + k) * 64);\n }\n }\n }\n }\n }\n }\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n return offset2 - startOffset;\n }\n function readUint16() {\n var value = data[offset] << 8 | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length = readUint16();\n var array = data.subarray(offset, offset + length - 2);\n offset += array.length;\n return array;\n }\n __privateSet(this, __raw, data);\n __privateSet(this, _jfif, null);\n __privateSet(this, _APPn, []);\n __privateSet(this, _qts, []);\n __privateSet(this, _frame, null);\n __privateSet(this, _tail, null);\n var markerHi, markerLo, i, j, resetInterval, component;\n let huffmanTablesAC = [];\n let huffmanTablesDC = [];\n while (1) {\n if (offset >= data.length) {\n if (tolerant)\n break;\n throw "unexpected EOF";\n }\n markerHi = data[offset++];\n markerLo = data[offset++];\n if (markerHi == 255) {\n if (markerLo == 224) {\n __privateSet(this, _jfif, readDataBlock());\n }\n if (markerLo > 224 && markerLo < 240 || markerLo == 254) {\n __privateGet(this, _APPn).push({\n "app": markerLo,\n "data": readDataBlock()\n });\n }\n if (markerLo == 219) {\n __privateGet(this, _qts).push(readDataBlock());\n }\n if (markerLo >= 192 && markerLo <= 194) {\n if (__privateGet(this, _frame))\n throw "Only single frame JPEGs supported";\n readUint16();\n __privateSet(this, _frame, {\n "extended": markerLo === 193,\n "progressive": markerLo === 194,\n "precision": data[offset++],\n "scanLines": readUint16(),\n "samplesPerLine": readUint16(),\n "components": [],\n "componentIds": {},\n "maxH": 1,\n "maxV": 1\n });\n if (__privateGet(this, _frame).scanLines * __privateGet(this, _frame).samplesPerLine > this.maxPixels)\n throw "Image is too big.";\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n if (maxH < h)\n maxH = h;\n if (maxV < v)\n maxV = v;\n var qId = data[offset + 2];\n var l = __privateGet(this, _frame).components.push({\n componentId,\n h,\n v,\n quantizationTable: qId\n });\n __privateGet(this, _frame).componentIds[componentId] = l - 1;\n offset += 3;\n }\n __privateGet(this, _frame).maxH = maxH;\n __privateGet(this, _frame).maxV = maxV;\n var mcusPerLine = Math.ceil(__privateGet(this, _frame).samplesPerLine / 8 / maxH);\n var mcusPerColumn = Math.ceil(__privateGet(this, _frame).scanLines / 8 / maxV);\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n component = __privateGet(this, _frame).components[i];\n var blocksPerLine = Math.ceil(Math.ceil(__privateGet(this, _frame).samplesPerLine / 8) * component.h / maxH);\n var blocksPerColumn = Math.ceil(Math.ceil(__privateGet(this, _frame).scanLines / 8) * component.v / maxV);\n var blocksPerLineForMcu = mcusPerLine * component.h;\n var blocksPerColumnForMcu = mcusPerColumn * component.v;\n __privateGet(this, _frame).components[i] = {\n ...component,\n blocks: new Int16Array(blocksPerColumnForMcu * blocksPerLineForMcu * 64),\n blocksDC: new Int16Array(blocksPerColumnForMcu * blocksPerLineForMcu),\n blocksPerLine,\n blocksPerColumn,\n blocksPerLineForMcu,\n blocksPerColumnForMcu\n };\n }\n __privateGet(this, _frame).mcusPerLine = mcusPerLine;\n __privateGet(this, _frame).mcusPerColumn = mcusPerColumn;\n }\n if (markerLo == 196) {\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength; ) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++)\n codeLengthSum += codeLengths[j] = data[offset];\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n const v2 = _buildHuffmanTable(codeLengths, huffmanValues);\n if (huffmanTableSpec >> 4 === 0)\n huffmanTablesDC[huffmanTableSpec & 15] = v2;\n else\n huffmanTablesAC[huffmanTableSpec & 15] = v2;\n }\n }\n if (markerLo == 221) {\n resetInterval = readUint16();\n }\n if (markerLo == 218) {\n if (__privateGet(this, _frame) == null)\n throw "SOS before SOF";\n readUint16();\n var selectorsCount = data[offset++];\n var components = [];\n for (i = 0; i < selectorsCount; i++) {\n var componentIndex = __privateGet(this, _frame).componentIds[data[offset++]];\n component = __privateGet(this, _frame).components[componentIndex];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset, __privateGet(this, _frame), components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);\n offset += processed;\n }\n if (markerLo == 217) {\n break;\n }\n } else {\n if (data[offset - 3] == 255 && data[offset - 2] >= 192 && data[offset - 2] <= 254) {\n offset -= 3;\n }\n while (data[offset] != 255 && offset < data.length) {\n offset++;\n }\n if (data[offset] != 255) {\n throw "bad jpeg ";\n }\n }\n }\n if (!__privateGet(this, _frame))\n throw "bad jpeg";\n if (offset < data.length)\n __privateSet(this, _tail, data.subarray(offset));\n return this;\n }\n pack() {\n let byteout;\n let bytenew;\n let bytepos;\n let poslast;\n let outpos;\n let byte;\n function writeByte(value) {\n var t;\n byteout[outpos++] = value;\n if (outpos > poslast) {\n t = new Uint8Array(byteout.length * 2);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n }\n function writeWord(value) {\n writeByte(value >> 8 & 255);\n writeByte(value & 255);\n }\n function writeBlock(block) {\n var t;\n if (outpos + block.length > poslast) {\n t = new Uint8Array(byteout.length * 2 + block.length);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n byteout.set(block, outpos);\n outpos += block.length;\n }\n function writeAPP0(self2) {\n writeWord(65504);\n if (!__privateGet(self2, _jfif)) {\n writeWord(16);\n writeByte(74);\n writeByte(70);\n writeByte(73);\n writeByte(70);\n writeByte(0);\n writeByte(1);\n writeByte(1);\n writeByte(0);\n writeWord(1);\n writeWord(1);\n writeByte(0);\n writeByte(0);\n } else {\n writeWord(__privateGet(self2, _jfif).length + 2);\n writeBlock(__privateGet(self2, _jfif));\n }\n }\n function writeDQT(self2) {\n for (var i2 = 0; i2 < __privateGet(self2, _qts).length; i2++) {\n writeWord(65499);\n writeWord(__privateGet(self2, _qts)[i2].length + 2);\n writeBlock(__privateGet(self2, _qts)[i2]);\n }\n }\n function writeAPPn(self2) {\n for (var i2 = 0; i2 < __privateGet(self2, _APPn).length; i2++) {\n writeWord(65280 | __privateGet(self2, _APPn)[i2].app);\n writeWord(__privateGet(self2, _APPn)[i2].data.length + 2);\n writeBlock(__privateGet(self2, _APPn)[i2].data);\n }\n }\n function writeSOF0(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65472);\n writeWord(8 + __privateGet(self2, _frame).components.length * 3);\n writeByte(__privateGet(self2, _frame).precision);\n writeWord(__privateGet(self2, _frame).scanLines);\n writeWord(__privateGet(self2, _frame).samplesPerLine);\n writeByte(__privateGet(self2, _frame).components.length);\n for (var i2 = 0; i2 < __privateGet(self2, _frame).components.length; i2++) {\n var c2 = __privateGet(self2, _frame).components[i2];\n writeByte(c2.componentId);\n writeByte(c2.h << 4 | c2.v);\n writeByte(c2.quantizationTable);\n }\n }\n function writeDHT(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65476);\n writeWord(31);\n writeByte(0);\n for (var i2 = 0; i2 < 16; i2++) {\n writeByte(std_dc_luminance_nrcodes[i2 + 1]);\n }\n for (var j = 0; j <= 11; j++) {\n writeByte(std_dc_luminance_values[j]);\n }\n writeWord(65476);\n writeWord(181);\n writeByte(16);\n for (var k = 0; k < 16; k++) {\n writeByte(std_ac_luminance_nrcodes[k + 1]);\n }\n for (var l = 0; l <= 161; l++) {\n writeByte(std_ac_luminance_values[l]);\n }\n if (__privateGet(self2, _frame).components.length != 1) {\n writeWord(65476);\n writeWord(31);\n writeByte(1);\n for (var m = 0; m < 16; m++) {\n writeByte(std_dc_chrominance_nrcodes[m + 1]);\n }\n for (var n = 0; n <= 11; n++) {\n writeByte(std_dc_chrominance_values[n]);\n }\n writeWord(65476);\n writeWord(181);\n writeByte(17);\n for (var o = 0; o < 16; o++) {\n writeByte(std_ac_chrominance_nrcodes[o + 1]);\n }\n for (var p = 0; p <= 161; p++) {\n writeByte(std_ac_chrominance_values[p]);\n }\n }\n }\n function writeSOS(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65498);\n writeWord(6 + __privateGet(self2, _frame).components.length * 2);\n writeByte(__privateGet(self2, _frame).components.length);\n for (var i2 = 0; i2 < __privateGet(self2, _frame).components.length; i2++) {\n var c2 = __privateGet(self2, _frame).components[i2];\n writeByte(c2.componentId);\n if (i2 === 0) {\n writeByte(0);\n } else {\n writeByte(17);\n }\n }\n writeByte(0);\n writeByte(63);\n writeByte(0);\n }\n function processDU(comp, POS, DC, HTDC, HTAC) {\n var pos, posval, t;\n if (bytepos === 0)\n bytenew = 0;\n if (!("blocks" in comp))\n throw "Blocks not parsed";\n var Diff = comp.blocksDC[POS >> 6] - DC;\n DC = comp.blocksDC[POS >> 6];\n if (Diff === 0) {\n posval = HTDC[0][1];\n bytenew <<= posval;\n bytenew += HTDC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n } else {\n pos = 32767 + Diff;\n posval = HTDC[category[pos]][1];\n bytenew <<= posval;\n bytenew += HTDC[category[pos]][0];\n bytepos += posval;\n posval = bitcode[pos][1];\n bytenew <<= posval;\n bytenew += bitcode[pos][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n var end0pos = 63;\n for (; end0pos > 0 && comp.blocks[POS + end0pos] === 0; end0pos--) {\n }\n if (end0pos === 0) {\n posval = HTAC[0][1];\n bytenew <<= posval;\n bytenew += HTAC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n return DC;\n }\n var i2 = 1;\n var lng;\n while (i2 <= end0pos) {\n var startpos = i2;\n for (; comp.blocks[POS + i2] === 0 && i2 <= end0pos; ++i2) {\n }\n var nrzeroes = i2 - startpos;\n if (nrzeroes >= 16) {\n lng = nrzeroes >> 4;\n for (var nrmarker = 1; nrmarker <= lng; ++nrmarker) {\n posval = HTAC[240][1];\n bytenew <<= posval;\n bytenew += HTAC[240][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n nrzeroes = nrzeroes & 15;\n }\n pos = 32767 + comp.blocks[POS + i2];\n posval = HTAC[(nrzeroes << 4) + category[pos]][1];\n bytenew <<= posval;\n bytenew += HTAC[(nrzeroes << 4) + category[pos]][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n posval = bitcode[pos][1];\n bytenew <<= posval;\n bytenew += bitcode[pos][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n i2++;\n }\n if (end0pos != 63) {\n posval = HTAC[0][1];\n bytenew <<= posval;\n bytenew += HTAC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n if (outpos > poslast) {\n t = new Uint8Array(byteout.length * 2);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n return DC;\n }\n byteout = new Uint8Array(65536);\n poslast = 65536 - 128;\n outpos = 0;\n bytenew = 0;\n bytepos = 0;\n writeWord(65496);\n writeAPP0(this);\n writeAPPn(this);\n writeDQT(this);\n writeSOF0(this);\n writeDHT(this);\n writeSOS(this);\n bytenew = 0;\n bytepos = 0;\n if (!__privateGet(this, _frame))\n throw "Frame not ready";\n var c, mcuRow, mcuCol, blockRow, blockCol, mcu, i, v, h;\n var DCdiff = [];\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n DCdiff.push(0);\n }\n for (mcu = 0; mcu < __privateGet(this, _frame).mcusPerLine * __privateGet(this, _frame).mcusPerColumn; mcu++) {\n mcuRow = mcu / __privateGet(this, _frame).mcusPerLine | 0;\n mcuCol = mcu % __privateGet(this, _frame).mcusPerLine;\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n c = __privateGet(this, _frame).components[i];\n for (v = 0; v < c.v; v++) {\n blockRow = mcuRow * c.v + v;\n for (h = 0; h < c.h; h++) {\n blockCol = mcuCol * c.h + h;\n if (i === 0) {\n DCdiff[i] = processDU(c, (blockRow * __privateGet(this, _frame).mcusPerLine * c.h + blockCol) * 64, DCdiff[i], YDC_HT, YAC_HT);\n } else {\n DCdiff[i] = processDU(c, (blockRow * __privateGet(this, _frame).mcusPerLine * c.h + blockCol) * 64, DCdiff[i], UVDC_HT, UVAC_HT);\n }\n }\n }\n }\n }\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n }\n if (bytepos > 0) {\n bytenew <<= 8 - bytepos;\n bytenew += (1 << 8 - bytepos) - 1;\n byteout[outpos++] = 255 & bytenew;\n }\n writeWord(65497);\n if (__privateGet(this, _tail))\n writeBlock(__privateGet(this, _tail));\n return byteout.slice(0, outpos);\n }\n};\n_randPool = new WeakMap();\n__raw = new WeakMap();\n_jfif = new WeakMap();\n_APPn = new WeakMap();\n_qts = new WeakMap();\n_frame = new WeakMap();\n_tail = new WeakMap();\n_shuffleInit = new WeakSet();\nshuffleInit_fn = function(key2) {\n __privateSet(this, _randPool, new ArrayBuffer(this.maxPixels * 4.125));\n if (!key2.length)\n throw "key needed";\n var i = 0, j = 0, t = 0, k = 0, S = new Uint8Array(256), rnd = new Uint8Array(__privateGet(this, _randPool));\n for (i = 0; i < 256; ++i)\n S[i] = i;\n for (i = 0; i < 256; ++i) {\n j = j + S[i] + key2[i % key2.length] & 255;\n t = S[i];\n S[i] = S[j];\n S[j] = t;\n }\n i = 0;\n j = 0;\n for (k = 0; k < this.maxPixels * 4.125; ++k) {\n i = i + 1 & 255;\n j = j + S[i] & 255;\n t = S[i];\n S[i] = S[j];\n S[j] = t;\n rnd[k] = S[t + S[i] & 255];\n }\n};\n_stegShuffle = new WeakSet();\nstegShuffle_fn = function(pm) {\n let t, l, k, random_index, rand32Array = new Uint32Array(__privateGet(this, _randPool));\n if (typeof pm == "number") {\n l = pm;\n pm = new Uint32Array(l);\n for (k = 1; k < l; k++) {\n random_index = rand32Array[k] % (k + 1);\n if (random_index != k)\n pm[k] = pm[random_index];\n pm[random_index] = k;\n }\n } else {\n l = pm.length;\n for (k = 1; k < l; k++) {\n random_index = rand32Array[k] % (k + 1);\n t = pm[k];\n pm[k] = pm[random_index];\n pm[random_index] = t;\n }\n }\n return { pm, gamma: new Uint8Array(__privateGet(this, _randPool), l * 4) };\n};\n__analyze = new WeakSet();\n_analyze_fn = function(coeff) {\n var _one = 0, _zero = 0, _large, _ratio, usable, i, k, embedded, matched, changed;\n for (i = 0; i < coeff.length; i++) {\n if (i % 64 === 0)\n continue;\n if (coeff[i] === 0)\n _zero++;\n if (coeff[i] == 1 || coeff[i] == -1)\n _one++;\n }\n _large = coeff.length - _zero - _one - coeff.length / 64;\n _ratio = _one / (_large + _one);\n var res = {\n "capacity": [0, (_large + 0.49 * _one >> 3) - 1],\n "coeff_total": coeff.length,\n "coeff_large": _large,\n "coeff_zero": _zero,\n "coeff_one": _one,\n "coeff_one_ratio": _one / (_large + _one)\n };\n for (i = 2; i < 17; i++) {\n k = (1 << i) - 1;\n usable = _large + _one;\n embedded = 0;\n while (usable > k) {\n matched = usable / k / (1 << i) / (1 << i) | 0;\n usable -= matched * k;\n changed = usable * (1 - _ratio) / k * 0.96 | 0;\n usable -= changed * k;\n embedded += changed + matched;\n k++;\n }\n res.capacity[i] = (i * embedded >> 3) - 1;\n }\n return res;\n};\n__f5write = new WeakSet();\n_f5write_fn = function(coeff, data, k) {\n var coeff_count = coeff.length;\n var _changed = 0, _embedded = 0, _examined = 0, _thrown = 0, shuffled_index = 0, i, n, ii;\n var next_bit_to_embed = 0, byte_to_embed = data.length, data_idx = 0, available_bits_to_embed = 0;\n n = (1 << k) - 1;\n byte_to_embed = k - 1;\n byte_to_embed ^= 0;\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed = 3;\n for (ii = 0; ii < coeff_count; ii++) {\n shuffled_index = ii;\n if (shuffled_index % 64 === 0 || coeff[shuffled_index] === 0)\n continue;\n var cc = coeff[shuffled_index];\n _examined++;\n if (cc > 0 && (cc & 1) != next_bit_to_embed) {\n coeff[shuffled_index]--;\n _changed++;\n } else if (cc < 0 && (cc & 1) == next_bit_to_embed) {\n coeff[shuffled_index]++;\n _changed++;\n }\n if (coeff[shuffled_index] !== 0) {\n _embedded++;\n if (available_bits_to_embed === 0) {\n if (k != 1 || data_idx >= data.length)\n break;\n byte_to_embed = data[data_idx++];\n byte_to_embed ^= 0;\n available_bits_to_embed = 8;\n }\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed--;\n } else {\n _thrown++;\n }\n }\n if (k == 1 && _embedded < data.length * 8)\n throw "capacity exceeded " + _embedded / 8 + " " + data.length;\n if (k != 1) {\n var is_last_byte = false, k_bits_to_embed = 0;\n while (!is_last_byte || available_bits_to_embed !== 0 && is_last_byte) {\n k_bits_to_embed = 0;\n for (i = 0; i < k; i++) {\n if (available_bits_to_embed === 0) {\n if (data_idx >= data.length) {\n is_last_byte = true;\n break;\n }\n byte_to_embed = data[data_idx++];\n byte_to_embed ^= 0;\n available_bits_to_embed = 8;\n }\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed--;\n k_bits_to_embed |= next_bit_to_embed << i;\n }\n var code_word = [];\n var ci = null;\n for (i = 0; i < n; i++) {\n while (true) {\n if (++ii >= coeff_count) {\n throw "capacity exceeded " + _embedded / 8;\n }\n ci = ii;\n if (ci % 64 !== 0 && coeff[ci] !== 0)\n break;\n }\n code_word.push(ci);\n }\n _examined += n;\n while (true) {\n var vhash = 0, extracted_bit;\n for (i = 0; i < code_word.length; i++) {\n if (coeff[code_word[i]] > 0) {\n extracted_bit = coeff[code_word[i]] & 1;\n } else {\n extracted_bit = 1 - (coeff[code_word[i]] & 1);\n }\n if (extracted_bit == 1)\n vhash ^= i + 1;\n }\n i = vhash ^ k_bits_to_embed;\n if (!i) {\n _embedded += k;\n break;\n }\n i--;\n coeff[code_word[i]] += coeff[code_word[i]] < 0 ? 1 : -1;\n _changed++;\n if (coeff[code_word[i]] === 0) {\n _thrown++;\n code_word.splice(i, 1);\n while (true) {\n if (++ii >= coeff_count) {\n throw "capacity exceeded " + _embedded / 8;\n }\n ci = ii;\n if (ci % 64 !== 0 && coeff[ci] !== 0)\n break;\n }\n _examined++;\n code_word.push(ci);\n } else {\n _embedded += k;\n break;\n }\n }\n }\n }\n return {\n "k": k,\n "embedded": _embedded / 8,\n "examined": _examined,\n "changed": _changed,\n "thrown": _thrown,\n "efficiency": (_embedded / _changed).toFixed(2)\n };\n};\n\n// src/jpg.ts\nvar key = import_buffer4.Buffer.from("CUNNYCUNNYCUNNY");\nvar f5inst = new f5stego(key);\nvar inject2 = async (b, links) => {\n if (b.size / 20 < links.join(" ").length)\n throw "Image too small to embed.";\n const arr = new Uint8Array(new Uint8Array(await b.arrayBuffer()));\n const buff = f5inst.embed(arr, new TextEncoder().encode(links.join(" ")), 1);\n return import_buffer4.Buffer.from(buff);\n};\nvar has_embed2 = (b) => {\n try {\n const res = f5inst.extract(b);\n if (!res)\n return false;\n if (res.length > 1024)\n return false;\n const str = import_buffer4.Buffer.from(res).toString();\n if (!str.match(/^[a-zA-Z0-9:/.\\-_ ]+$/))\n return false;\n return str;\n } catch {\n return false;\n }\n};\nvar extract2 = (b, ex) => {\n return decodeCoom3Payload(import_buffer4.Buffer.from(ex));\n};\nvar jpg_default = {\n match: (fn) => !!fn.match(/\\.jpe?g$/),\n has_embed: has_embed2,\n extract: extract2,\n inject: inject2\n};\n\n// src/thirdeye.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer5 = __toESM(require_buffer(), 1);\nvar import_jpeg_js = __toESM(require_jpeg_js(), 1);\n\n// src/phash.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar median = (data) => {\n const mdarr = data.slice(0);\n mdarr.sort((a, b) => a - b);\n if (mdarr.length % 2 === 0)\n return (mdarr[mdarr.length / 2 - 1] + mdarr[mdarr.length / 2]) / 2;\n return mdarr[Math.floor(mdarr.length / 2)];\n};\nvar translate_blocks_to_bits = function(blocks, pixels_per_block) {\n const half_block_value = pixels_per_block * 256 * 3 / 2;\n const bandsize = blocks.length / 4;\n for (let i = 0; i < 4; i++) {\n const m = median(blocks.slice(i * bandsize, (i + 1) * bandsize));\n for (let j = i * bandsize; j < (i + 1) * bandsize; j++) {\n const v = blocks[j];\n blocks[j] = Number(v > m || Math.abs(v - m) < 1 && m > half_block_value);\n }\n }\n};\nvar bits_to_hexhash = (bitsArray) => {\n const hex = [];\n for (let i = 0; i < bitsArray.length; i += 4) {\n const nibble = bitsArray.slice(i, i + 4);\n hex.push(parseInt(nibble.join(""), 2).toString(16));\n }\n return hex.join("");\n};\nvar bmvbhash_even = (data, bits) => {\n const blocksize_x = Math.floor(data.width / bits);\n const blocksize_y = Math.floor(data.height / bits);\n const result = [];\n for (let y = 0; y < bits; y++) {\n for (let x = 0; x < bits; x++) {\n let total = 0;\n for (let iy = 0; iy < blocksize_y; iy++) {\n for (let ix = 0; ix < blocksize_x; ix++) {\n const cx = x * blocksize_x + ix;\n const cy = y * blocksize_y + iy;\n const ii = (cy * data.width + cx) * 4;\n const alpha = data.data[ii + 3];\n if (alpha === 0) {\n total += 765;\n } else {\n total += data.data[ii] + data.data[ii + 1] + data.data[ii + 2];\n }\n }\n }\n result.push(total);\n }\n }\n translate_blocks_to_bits(result, blocksize_x * blocksize_y);\n return bits_to_hexhash(result);\n};\n\n// src/thirdeye.ts\nvar csettings3;\nsettings.subscribe((b) => {\n csettings3 = b;\n});\nvar gelquirk = (prefix) => (a) => {\n let base = a.post || a.data || a;\n if (!Array.isArray(base))\n return [];\n base = base.filter((e) => e.file_url);\n return base.map((e) => ({\n full_url: e.file_url,\n preview_url: e.preview_url || e.preview_url,\n source: e.source,\n ext: e.file_ext || e.file_url.substr(e.file_url.lastIndexOf(".") + 1),\n page: `${prefix}${e.id || e.parent_id}`,\n tags: (e.tag_string || (e.tags && (Array.isArray(e.tags) && (typeof e.tags[0] == "string" ? e.tags.join(" ") : e.tags.map((e2) => e2.name_en).join(" "))) || e.tags) || "").split(" ")\n })) || [];\n};\nvar experimentalApi = false;\nvar black = /* @__PURE__ */ new Set();\nvar phashEn = false;\nvar mindist = 5;\nsettings.subscribe((s) => {\n if (!s)\n return;\n experimentalApi = s.expte;\n boorus = s.rsources.map((e) => ({\n ...e,\n quirks: gelquirk(e.view)\n }));\n black = new Set(s.blacklist);\n mindist = s.mdist || 5;\n phashEn = s.phash;\n});\nvar boorus = [];\nvar unlockQueue = Promise.resolve();\nvar cache = {};\nvar findFileFrom = async (b, hex, abort) => {\n try {\n if (b.domain in cache && hex in cache[b.domain])\n return cache[b.domain][hex];\n const res = await ifetch(`https://${b.domain}${b.endpoint}${hex}`);\n const txt = await res.text();\n const pres = JSON.parse(txt);\n const tran = b.quirks(pres).filter((e) => !e.tags.some((e2) => black.has(e2)));\n if (!(b.domain in cache))\n cache[b.domain] = {};\n cache[b.domain][hex] = tran;\n return tran;\n } catch (e) {\n const error = e;\n if (!error.message.includes("Unexpected end of JSON input"))\n console.error(e);\n return [];\n }\n};\nvar extract3 = async (b, fn) => {\n if (!csettings3)\n throw new Error("Settings uninit");\n let result;\n let booru;\n for (const e of Object.values(boorus)) {\n if (e.disabled)\n continue;\n result = await findFileFrom(e, fn.substring(0, 32));\n if (result.length) {\n booru = e.name;\n break;\n }\n }\n let cachedFile;\n const prev = result[0].preview_url;\n const full = result[0].full_url;\n return [{\n source: result[0].source,\n page: {\n title: booru,\n url: result[0].page\n },\n filename: fn.substring(0, 33) + result[0].ext,\n thumbnail: csettings3.hotlink ? prev || full : import_buffer5.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()),\n data: csettings3.hotlink ? full || prev : { url: full || prev }\n }];\n};\nvar phash = (b) => {\n const res = (0, import_jpeg_js.decode)(b);\n return bmvbhash_even(res, 8);\n};\nvar hammingDist = (a, b) => {\n let res = BigInt("0x" + a) ^ BigInt("0x" + b);\n let acc = 0;\n while (res != 0n) {\n acc += Number(res & 1n);\n res >>= 1n;\n }\n return acc;\n};\nvar has_embed3 = async (b, fn, prevlink) => {\n if (import_buffer5.Buffer.from(fn, "hex").equals(b))\n return false;\n let result = void 0;\n for (const e of Object.values(boorus)) {\n if (e.disabled)\n continue;\n result = await findFileFrom(e, fn.substring(0, 32));\n result = result.filter((e2) => e2.full_url || e2.preview_url);\n if (result.length)\n break;\n }\n if (result && result.length != 0 && phashEn && prevlink) {\n if (!result[0].preview_url)\n return true;\n const getHash = async (l) => {\n const ogreq = await ifetch(l);\n const origPreview = await ogreq.arrayBuffer();\n return phash(import_buffer5.Buffer.from(origPreview));\n };\n const [orighash, tehash] = await Promise.all([\n getHash(prevlink),\n getHash(result[0].preview_url)\n ]);\n const d = hammingDist(orighash, tehash);\n console.log(d, prevlink);\n return d > mindist;\n }\n return result && result.length != 0;\n};\nvar thirdeye_default = {\n skip: true,\n extract: extract3,\n has_embed: has_embed3,\n match: (fn) => !!fn.match(/^[0-9a-f]{32}\\.....?/)\n};\n\n// src/pomf.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer6 = __toESM(require_buffer(), 1);\nvar sources = [\n { host: "Catbox", prefix: "files.catbox.moe/" },\n { host: "Litter", prefix: "litter.catbox.moe/" },\n { host: "Zzzz", prefix: "z.zz.fo/" }\n];\nvar csettings4;\nsettings.subscribe((b) => {\n csettings4 = b;\n});\nvar getExt = (fn) => {\n const isB64 = fn.match(/^((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=))?\\.(gif|jpe?g|png|webm)/);\n const isExt = fn.match(/\\[.*=(.*)\\]/);\n let ext;\n let source;\n try {\n if (isB64) {\n ext = atob(isB64[1]);\n } else if (isExt) {\n ext = decodeURIComponent(isExt[1]);\n if (ext.startsWith("https://"))\n ext = ext.slice("https://".length);\n for (const cs of sources)\n if (ext.startsWith(cs.prefix)) {\n source = cs.prefix;\n ext = ext.slice(cs.prefix.length);\n break;\n }\n }\n } catch {\n }\n return { ext, source };\n};\nvar extract4 = async (b, fn) => {\n if (!csettings4)\n throw new Error("Settings uninit");\n const { ext, source } = getExt(fn);\n let rsource;\n for (const cs of sources) {\n if (source && cs.prefix != source)\n continue;\n try {\n await getHeaders("https://" + cs.prefix + ext);\n rsource = "https://" + cs.prefix + ext;\n break;\n } catch {\n }\n }\n return [{\n filename: ext,\n data: csettings4.hotlink ? rsource : { url: rsource },\n thumbnail: import_buffer6.Buffer.from(hasembed_default)\n }];\n};\nvar has_embed4 = async (b, fn) => {\n const { ext, source } = getExt(fn);\n if (!ext)\n return false;\n for (const cs of sources) {\n if (source && cs.prefix != source)\n continue;\n try {\n const e = await getHeaders("https://" + cs.prefix + ext);\n return true;\n } catch {\n }\n }\n return false;\n};\nvar pomf_default = {\n skip: true,\n extract: extract4,\n has_embed: has_embed4,\n match: (fn) => !!getExt(fn)\n};\n\n// src/processor.worker.ts\nconsole.log("Worker started");\nvar pendinggens = {};\nvar proxyAsyncGen = (id) => {\n return {\n next(arg) {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n return(v) {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n throw() {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n};\nvar deserializeMessage = (m) => {\n if (typeof m == "object" && m.type == "AsyncGenerator") {\n return proxyAsyncGen(m.id);\n }\n if (typeof m == "object") {\n for (const p in m) {\n m[p] = deserializeMessage(m[p]);\n }\n }\n return m;\n};\nvar processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default];\nvar processImage = async (srcs, fn, hex, prevurl) => {\n const ret = await Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => {\n if (proc.skip) {\n const md5 = Buffer2.from(hex, "base64");\n if (await proc.has_embed(md5, fn, prevurl) === true) {\n return [await proc.extract(md5, fn), true];\n }\n return;\n }\n let succ = false;\n let cumul;\n do {\n try {\n const n = await srcs.next();\n if (n.done)\n return;\n const iter = streamRemote(n.value);\n if (!iter)\n return;\n cumul = Buffer2.alloc(0);\n let found;\n let chunk = { done: true };\n do {\n const { value, done } = await iter.next(typeof found === "boolean");\n if (done) {\n chunk = { done: true };\n } else {\n chunk = { done: false, value };\n cumul = Buffer2.concat([cumul, value]);\n const v = await proc.has_embed(cumul);\n if (typeof v == "string") {\n return [await proc.extract(cumul, v), false];\n }\n found = v;\n }\n } while (found !== false && !chunk.done);\n succ = true;\n await iter.next(true);\n if (found !== true) {\n return;\n }\n return [await proc.extract(cumul), false];\n } catch (err) {\n console.log(err);\n }\n } while (!succ);\n }));\n return ret.filter((e) => e).map((e) => e);\n};\n(async () => {\n onmessage = async (msg) => {\n const des = deserializeMessage(msg.data);\n switch (des.type) {\n case "ipc": {\n if (port1.onmessage)\n port1.onmessage(new MessageEvent("message", { data: des.res }));\n break;\n }\n case "cmd": {\n switch (des.fun) {\n case "processImage": {\n const res = await processImage(des.args[0], des.args[1], des.args[2], des.args[3]);\n const tr = [];\n for (const ef of res) {\n for (const e of ef[0]) {\n if (Buffer2.isBuffer(e.thumbnail) || e.thumbnail instanceof Uint8Array)\n tr.push(e.thumbnail.buffer);\n if (Buffer2.isBuffer(e.data) || e.data instanceof Uint8Array)\n tr.push(e.data.buffer);\n }\n }\n postMessage({\n type: "reply",\n id: des.id,\n res\n }, [...new Set(tr)]);\n }\n }\n break;\n }\n case "ag": {\n const cb = pendinggens[des.id].shift();\n if (cb) {\n cb(des.res);\n }\n break;\n }\n }\n };\n})();\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\n/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n'); + } + // src/main.ts + var ProcessWorker = Worker2; if (!supportedMainDomain(location.host) && !supportedAltDomain(location.host)) throw "PEE not supported here, skipping"; var qp; var csettings5; - var processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default, webm_default, gif_default]; + var processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default]; var cappState; settings.subscribe(async (b) => { if (!b) @@ -31678,68 +21443,13 @@ } } csettings5 = b; - processors = [ - ...!csettings5.te ? [thirdeye_default] : [], - pngv3_default, - pomf_default, - jpg_default, - webm_default, - gif_default - ]; }); appState.subscribe((v) => { cappState = v; }); - var processImage = async (srcs, fn, hex, prevurl) => { - const ret = await Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { - if (proc.skip) { - const md5 = import_buffer11.Buffer.from(hex, "base64"); - if (await proc.has_embed(md5, fn, prevurl) === true) { - return [await proc.extract(md5, fn), true]; - } - return; - } - let succ = false; - let cumul; - do { - try { - const n = await srcs.next(); - if (n.done) - return; - const iter = streamRemote(n.value); - if (!iter) - return; - cumul = import_buffer11.Buffer.alloc(0); - let found; - let chunk = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true }; - } else { - chunk = { done: false, value }; - cumul = import_buffer11.Buffer.concat([cumul, value]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return [await proc.extract(cumul, v), false]; - } - found = v; - } - } while (found !== false && !chunk.done); - succ = true; - await iter.next(true); - if (found !== true) { - return; - } - return [await proc.extract(cumul), false]; - } catch { - } - } while (!succ); - })); - return ret.filter((e) => e).map((e) => e); - }; var textToElement = (s) => document.createRange().createContextualFragment(s).children[0]; var pendingPosts = []; + var pendingNoPosts = []; var signalNewEmbeds = debounce(async () => { if (!csettings5) return; @@ -31748,16 +21458,20 @@ try { const boardname = location.pathname.match(/\/([^/]*)\//)[1]; const reshaped = Object.fromEntries([...new Set(pendingPosts.map((e) => e.op))].map((e) => [e, pendingPosts.filter((p) => p.op == e).map((e2) => e2.id)])); - console.log(reshaped); + const reshaped2 = Object.fromEntries([...new Set(pendingNoPosts.map((e) => e.op))].map((e) => [e, pendingPosts.filter((p) => p.op == e).map((e2) => e2.id)])); const res = await ifetch("https://shoujo.coom.tech/listing/" + boardname, { method: "POST", - body: JSON.stringify(reshaped), + body: JSON.stringify({ + emb: reshaped, + noemb: reshaped2 + }), headers: { "content-type": "application/json" } }); await res.json(); pendingPosts = []; + pendingNoPosts = []; } catch (e) { console.error(e); } @@ -31769,6 +21483,177 @@ return false; return typeof csettings5.cache == "boolean" ? csettings5.cache : location.hostname.includes("b4k"); }; + var cp; + var CommandProcessor = class { + constructor() { + this.processor = ProcessWorker(); + this.genid = 0; + this.pendinggens = {}; + this.cmdid = 0; + this.pendingprom = {}; + this.processor.onmessage = async (msg) => { + let gen; + let res; + switch (msg.data.type) { + case "ipc": + { + const id = msg.data.msg.id; + if (false) { + if (msg.data.msg.name == "corsFetch") { + sendCmd2(msg.data.msg, msg.data.tr); + lqueue2[id] = (res2) => { + this.processor.postMessage({ + type: "ipc", + id, + res: res2 + }); + }; + } else { + const repl = await sendCmd2(msg.data.msg, msg.data.tr); + repl.id = id; + this.processor.postMessage({ + type: "ipc", + id, + res: repl + }); + } + } else { + if (msg.data.msg.name == "fullyRead") { + this.processor.postMessage({ + type: "ipc", + res: { + id, + ok: 1 + } + }); + } + if (msg.data.msg.name == "corsFetch") { + const { args } = msg.data.msg; + const res2 = await ifetch(args[0], args[1]); + const headersStr = res2.responseHeaders; + const headerObj = headerStringToObject(headersStr); + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + ok: res2.ok || true, + setRes: true, + headers: headerObj, + responseHeaders: headersStr, + redirected: res2.redirected, + type: res2.type, + url: res2.url, + status: res2.status, + bodyUsed: res2.bodyUsed, + statusText: res2.statusText + } + }); + if (!args[1].method || ["GET", "POST"].includes(args[1].method)) { + const data = await res2.arrayBuffer(); + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + pushData: { + data + } + } + }, [data]); + } + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + pushData: {} + } + }, []); + } + } + } + break; + case "reply": + if (msg.data.id in this.pendingprom) { + this.pendingprom[msg.data.id](msg.data.res); + delete this.pendingprom[msg.data.id]; + } + break; + case "ag": + gen = this.pendinggens[msg.data.id]; + res = await gen.next(msg.data.args); + if (res.done) { + delete this.pendinggens[msg.data.id]; + } + this.processor.postMessage({ + type: "ag", + id: msg.data.id, + res + }); + break; + } + }; + } + serializeArg(m) { + if (m[Symbol.toStringTag] == "AsyncGenerator") { + const genid = this.genid++; + this.pendinggens[genid] = m; + return { + type: "AsyncGenerator", + id: genid + }; + } + return m; + } + sendCmd(cmd, ...args) { + const id = this.cmdid++; + this.processor.postMessage({ + type: "cmd", + id, + fun: cmd, + args: args.map((a) => this.serializeArg(a)) + }); + return new Promise((res) => { + this.pendingprom[id] = res; + }); + } + sendAg(id, res) { + this.processor.postMessage({ + type: "ag", + id, + res + }); + } + processImage(origlink, fn, md5, thumb) { + return this.sendCmd("processImage", origlink, fn, md5, thumb); + } + }; + var convertToLocalEmbed = (wef) => { + let ret; + ret = wef; + if (typeof wef.data == "object") { + if (!(wef.data instanceof Uint8Array)) { + const ref = wef.data; + if (!wef.thumbnail) + return wef; + ret = { + ...wef, + thumbnail: import_buffer9.Buffer.from(wef.thumbnail), + data: async (lsn) => { + return import_buffer9.Buffer.from(await (await ifetch(ref.url, { headers: ref.headers }, lsn)).arrayBuffer()); + } + }; + } + } + if (wef.data instanceof Uint8Array) { + ret.data = import_buffer9.Buffer.from(wef.data); + } + if (wef.thumbnail instanceof Uint8Array) { + ret.thumbnail = import_buffer9.Buffer.from(wef.thumbnail); + } + return ret; + }; var processPost = async (post) => { const origlink = qp.getImageLink(post); if (!origlink) @@ -31777,25 +21662,39 @@ if (!thumbLink) return; let res2 = void 0; + const op = +location.pathname.match(/\/thread\/(.*)/)[1]; const reportEmbed = () => { if (!csettings5) - return false; + return; if (csettings5.tm) { if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { if (!cappState.isCatalog) { - const op = +location.pathname.match(/\/thread\/(.*)/)[1]; pendingPosts.push({ id: +post.id.match(/([0-9]+)/)[1], op }); signalNewEmbeds(); } } } }; + const reportNoEmbed = () => { + if (!csettings5) + return; + if (csettings5.tm) { + if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { + if (!cappState.isCatalog) { + pendingNoPosts.push({ id: +post.id.match(/([0-9]+)/)[1], op }); + signalNewEmbeds(); + } + } + } + }; try { if (shouldUseCache()) { res2 = await getEmbedsFromCache(qp.getCurrentBoard(), +qp.getCurrentThread(), post.id); } if (!res2) { - res2 = await processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2 = []; + const tmp = await cp.processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2.push(...tmp); res2 = res2?.filter((e) => e); } } catch (e) { @@ -31803,10 +21702,10 @@ return; } if (!res2 || res2.length == 0) - return; + return reportNoEmbed(); reportEmbed(); post.querySelector(".post")?.classList.add("embedfound"); - processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [k, e[1]]))); + processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [convertToLocalEmbed(k), e[1]]))); }; var versionCheck = async () => { const txt = await (await ifetch("https://raw.githubusercontent.com/coomdev/pngextraembedder/main/main.meta.js")).text(); @@ -31816,111 +21715,8 @@ fireNotification("info", `Last PEE version is ${lmajor}.${lminor}, you're on ${major}.${minor}`); } }; - function copyTextToClipboard(text3) { - const copyFrom = document.createElement("textarea"); - copyFrom.textContent = text3; - document.body.appendChild(copyFrom); - copyFrom.select(); - document.execCommand("copy"); - copyFrom.blur(); - document.body.removeChild(copyFrom); - navigator.clipboard.writeText(text3); - } var scrapeBoard = async (self) => { - if (!csettings5) - return false; - if (csettings5.tm) { - fireNotification("success", "Scrapping board with telemetry on! Thank you for your service, selfless stranger ;_;7"); - } - self.disabled = true; - self.textContent = "Searching..."; - const boardname = location.pathname.match(/\/([^/]*)\//)[1]; - const res = await ifetch(`https://a.4cdn.org/${boardname}/threads.json`); - const pages = await res.json(); - fireNotification("info", "Fetching all threads..."); - const threads = (await Promise.all(pages.reduce((a, b) => [...a, ...b.threads], []).map((e) => e.no).map(async (id) => { - try { - const res2 = await ifetch(`https://a.4cdn.org/${boardname}/thread/${id}.json`); - return await res2.json(); - } catch { - return void 0; - } - }))).filter((e) => e).map((e) => e); - const filenames = threads.reduce((a, b) => [...a, ...b.posts.filter((p) => p.ext).map((p) => p)], []).filter((p) => p.ext != ".webm" && p.ext != ".gif").map((p) => [p.resto || p.no, `https://i.4cdn.org/${boardname}/${p.tim}${p.ext}`, p.md5, p.filename + p.ext, p.no]); - console.log(filenames); - fireNotification("info", "Analyzing images..."); - const n = 1; - const processFile = (src, fn, hex) => { - return Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { - if (proc.skip) { - const md5 = import_buffer11.Buffer.from(hex, "base64"); - return await proc.has_embed(md5, fn); - } - const iter = streamRemote(src); - if (!iter) - return false; - let cumul = import_buffer11.Buffer.alloc(0); - let found; - let chunk = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true }; - } else { - chunk = { done: false, value }; - cumul = import_buffer11.Buffer.concat([cumul, value]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return true; - } - found = v; - } - } while (found !== false && !chunk.done); - await iter.next(true); - return found === true; - })); - }; - const range = ~~(filenames.length / n) + 1; - const hasEmbed = []; - const total = filenames.length; - let processed = 0; - const int = setInterval(() => { - fireNotification("info", `Processed [${processed} / ${total}] files`); - }, 5e3); - await Promise.all([...new Array(n + 1)].map(async (e, i) => { - const postsslice = filenames.slice(i * range, (i + 1) * range); - for (const post of postsslice) { - try { - const res2 = await processFile(post[1], post[3], post[2]); - processed++; - if (res2.some((e2) => e2)) { - hasEmbed.push(post); - if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { - pendingPosts.push({ id: post[4], op: post[0] }); - signalNewEmbeds(); - } - } - } catch (e2) { - console.log(e2); - } - } - })); - clearInterval(int); - const counters = {}; - for (const k of hasEmbed) - counters[k[0]] = k[0] in counters ? counters[k[0]] + 1 : 1; - console.log(counters); - fireNotification("success", "Processing finished! Results pasted in the clipboard"); - const text3 = Object.entries(counters).sort((a, b) => b[1] - a[1]).map((e) => `>>${e[0]} (${e[1]})`).join("\n"); - console.log(text3); - copyTextToClipboard(text3); - self.textContent = "Copy Results"; - self.disabled = false; - self.onclick = () => { - copyTextToClipboard(text3); - }; }; - var __DOMParser = true ? _DOMParser : DOMParser; var gmo; var earlystartup = async () => { if (["arch.b4k.co", "desuarchive.org"].includes(location.host) && true) { @@ -32043,6 +21839,12 @@ Use the WebExtension version of PEE if you want to use b4k!`); mo2.observe(document.documentElement, { childList: true, subtree: true }); await bodyInit; } + try { + cp = new CommandProcessor(); + } catch { + alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list."); + return; + } if (!is4chanX && location.host.startsWith("boards.4chan")) { const notificationHost = document.createElement("span"); new NotificationsHandler_default({ @@ -32240,7 +22042,7 @@ Use the WebExtension version of PEE if you want to use b4k!`); const text3 = new TextEmbeddings_default({ target: textInsertCursor, props: { - files: ress.map((e) => e[0]).filter((e) => import_buffer11.Buffer.isBuffer(e.data) && e.filename.endsWith(".txt") && e.filename.startsWith("message")) + files: ress.map((e) => e[0]).filter((e) => (import_buffer9.Buffer.isBuffer(e.data) || e.data instanceof Uint8Array) && e.filename.endsWith(".txt") && e.filename.startsWith("message")) } }); const emb = new Embeddings_default({ @@ -32278,12 +22080,6 @@ Use the WebExtension version of PEE if you want to use b4k!`); post.setAttribute("data-processed", "true"); } })(); -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ /*! * The buffer module from node.js, for the browser. * diff --git a/firefox/dist/background.js b/firefox/dist/background.js index 08a4375..bf5075b 100644 --- a/firefox/dist/background.js +++ b/firefox/dist/background.js @@ -1876,9 +1876,12 @@ var lqueue = {}; var localLoad = (key, def) => "__pee__" + key in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key)) : def; var localSet = (key, value) => localStorage.setItem("__pee__" + key, JSON.stringify(value)); - var { port1, port2 } = new MessageChannel(); + var port1; console.log("ff_api", true); if (false) { + const nmc = new MessageChannel(); + port1 = nmc.port1; + port2 = nmc.port2; const iframe = document.createElement("iframe"); iframe.style.display = "none"; iframe.name = location.origin; @@ -1886,7 +1889,6 @@ iframe.onload = _; }); iframe.src = `${chrome.runtime.getURL("")}options.html`; - const meself2 = new URL(chrome.runtime.getURL("")).origin; document.documentElement.appendChild(iframe); iframeloaded.then(() => { iframe.contentWindow?.postMessage("", "*", [port2]); @@ -1895,12 +1897,27 @@ lqueue[ev.data.id](ev.data); }; } + console.log("ff_api"); + if (false) { + port1 = { + onmessage(ev) { + lqueue[ev.data.id](ev.data); + }, + postMessage(msg, tr) { + postMessage({ + type: "ipc", + tr, + msg + }, tr); + } + }; + } var gid = 0; var sendCmd = (cmd, tr) => { const prom = new Promise((_) => { const id = gid++; lqueue[id] = (e) => { - _(e.res); + _(e); delete lqueue[id]; }; port1.postMessage({ id, ...cmd }, tr || []); diff --git a/firefox/dist/main.js b/firefox/dist/main.js index 351a781..4db3e7b 100644 --- a/firefox/dist/main.js +++ b/firefox/dist/main.js @@ -73,7 +73,7 @@ var define_BUILD_VERSION_default; var init_define_BUILD_VERSION = __esm({ ""() { - define_BUILD_VERSION_default = [0, 291]; + define_BUILD_VERSION_default = [0, 292]; } }); @@ -271,13 +271,13 @@ var base64 = require_base64_js(); var ieee7542 = require_ieee754(); var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer18; + exports.Buffer = Buffer14; exports.SlowBuffer = SlowBuffer; exports.INSPECT_MAX_BYTES = 50; var K_MAX_LENGTH = 2147483647; exports.kMaxLength = K_MAX_LENGTH; - Buffer18.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer18.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { + Buffer14.TYPED_ARRAY_SUPPORT = typedArraySupport(); + if (!Buffer14.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); } function typedArraySupport() { @@ -293,18 +293,18 @@ return false; } } - Object.defineProperty(Buffer18.prototype, "parent", { + Object.defineProperty(Buffer14.prototype, "parent", { enumerable: true, get: function() { - if (!Buffer18.isBuffer(this)) + if (!Buffer14.isBuffer(this)) return void 0; return this.buffer; } }); - Object.defineProperty(Buffer18.prototype, "offset", { + Object.defineProperty(Buffer14.prototype, "offset", { enumerable: true, get: function() { - if (!Buffer18.isBuffer(this)) + if (!Buffer14.isBuffer(this)) return void 0; return this.byteOffset; } @@ -314,10 +314,10 @@ throw new RangeError('The value "' + length + '" is invalid for option "size"'); } const buf2 = new Uint8Array(length); - Object.setPrototypeOf(buf2, Buffer18.prototype); + Object.setPrototypeOf(buf2, Buffer14.prototype); return buf2; } - function Buffer18(arg, encodingOrOffset, length) { + function Buffer14(arg, encodingOrOffset, length) { if (typeof arg === "number") { if (typeof encodingOrOffset === "string") { throw new TypeError('The "string" argument must be of type string. Received type number'); @@ -326,7 +326,7 @@ } return from(arg, encodingOrOffset, length); } - Buffer18.poolSize = 8192; + Buffer14.poolSize = 8192; function from(value, encodingOrOffset, length) { if (typeof value === "string") { return fromString(value, encodingOrOffset); @@ -348,21 +348,21 @@ } const valueOf = value.valueOf && value.valueOf(); if (valueOf != null && valueOf !== value) { - return Buffer18.from(valueOf, encodingOrOffset, length); + return Buffer14.from(valueOf, encodingOrOffset, length); } const b = fromObject(value); if (b) return b; if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer18.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); + return Buffer14.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); } throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); } - Buffer18.from = function(value, encodingOrOffset, length) { + Buffer14.from = function(value, encodingOrOffset, length) { return from(value, encodingOrOffset, length); }; - Object.setPrototypeOf(Buffer18.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer18, Uint8Array); + Object.setPrototypeOf(Buffer14.prototype, Uint8Array.prototype); + Object.setPrototypeOf(Buffer14, Uint8Array); function assertSize(size) { if (typeof size !== "number") { throw new TypeError('"size" argument must be of type number'); @@ -380,24 +380,24 @@ } return createBuffer(size); } - Buffer18.alloc = function(size, fill, encoding) { + Buffer14.alloc = function(size, fill, encoding) { return alloc(size, fill, encoding); }; function allocUnsafe(size) { assertSize(size); return createBuffer(size < 0 ? 0 : checked(size) | 0); } - Buffer18.allocUnsafe = function(size) { + Buffer14.allocUnsafe = function(size) { return allocUnsafe(size); }; - Buffer18.allocUnsafeSlow = function(size) { + Buffer14.allocUnsafeSlow = function(size) { return allocUnsafe(size); }; function fromString(string, encoding) { if (typeof encoding !== "string" || encoding === "") { encoding = "utf8"; } - if (!Buffer18.isEncoding(encoding)) { + if (!Buffer14.isEncoding(encoding)) { throw new TypeError("Unknown encoding: " + encoding); } const length = byteLength(string, encoding) | 0; @@ -438,11 +438,11 @@ } else { buf2 = new Uint8Array(array, byteOffset, length); } - Object.setPrototypeOf(buf2, Buffer18.prototype); + Object.setPrototypeOf(buf2, Buffer14.prototype); return buf2; } function fromObject(obj) { - if (Buffer18.isBuffer(obj)) { + if (Buffer14.isBuffer(obj)) { const len = checked(obj.length) | 0; const buf2 = createBuffer(len); if (buf2.length === 0) { @@ -471,17 +471,17 @@ if (+length != length) { length = 0; } - return Buffer18.alloc(+length); + return Buffer14.alloc(+length); } - Buffer18.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer18.prototype; + Buffer14.isBuffer = function isBuffer(b) { + return b != null && b._isBuffer === true && b !== Buffer14.prototype; }; - Buffer18.compare = function compare(a, b) { + Buffer14.compare = function compare(a, b) { if (isInstance(a, Uint8Array)) - a = Buffer18.from(a, a.offset, a.byteLength); + a = Buffer14.from(a, a.offset, a.byteLength); if (isInstance(b, Uint8Array)) - b = Buffer18.from(b, b.offset, b.byteLength); - if (!Buffer18.isBuffer(a) || !Buffer18.isBuffer(b)) { + b = Buffer14.from(b, b.offset, b.byteLength); + if (!Buffer14.isBuffer(a) || !Buffer14.isBuffer(b)) { throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); } if (a === b) @@ -501,7 +501,7 @@ return 1; return 0; }; - Buffer18.isEncoding = function isEncoding(encoding) { + Buffer14.isEncoding = function isEncoding(encoding) { switch (String(encoding).toLowerCase()) { case "hex": case "utf8": @@ -519,12 +519,12 @@ return false; } }; - Buffer18.concat = function concat(list, length) { + Buffer14.concat = function concat(list, length) { if (!Array.isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers'); } if (list.length === 0) { - return Buffer18.alloc(0); + return Buffer14.alloc(0); } let i; if (length === void 0) { @@ -533,19 +533,19 @@ length += list[i].length; } } - const buffer = Buffer18.allocUnsafe(length); + const buffer = Buffer14.allocUnsafe(length); let pos = 0; for (i = 0; i < list.length; ++i) { let buf2 = list[i]; if (isInstance(buf2, Uint8Array)) { if (pos + buf2.length > buffer.length) { - if (!Buffer18.isBuffer(buf2)) - buf2 = Buffer18.from(buf2); + if (!Buffer14.isBuffer(buf2)) + buf2 = Buffer14.from(buf2); buf2.copy(buffer, pos); } else { Uint8Array.prototype.set.call(buffer, buf2, pos); } - } else if (!Buffer18.isBuffer(buf2)) { + } else if (!Buffer14.isBuffer(buf2)) { throw new TypeError('"list" argument must be an Array of Buffers'); } else { buf2.copy(buffer, pos); @@ -555,7 +555,7 @@ return buffer; }; function byteLength(string, encoding) { - if (Buffer18.isBuffer(string)) { + if (Buffer14.isBuffer(string)) { return string.length; } if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { @@ -596,7 +596,7 @@ } } } - Buffer18.byteLength = byteLength; + Buffer14.byteLength = byteLength; function slowToString(encoding, start, end) { let loweredCase = false; if (start === void 0 || start < 0) { @@ -645,13 +645,13 @@ } } } - Buffer18.prototype._isBuffer = true; + Buffer14.prototype._isBuffer = true; function swap(b, n, m) { const i = b[n]; b[n] = b[m]; b[m] = i; } - Buffer18.prototype.swap16 = function swap16() { + Buffer14.prototype.swap16 = function swap16() { const len = this.length; if (len % 2 !== 0) { throw new RangeError("Buffer size must be a multiple of 16-bits"); @@ -661,7 +661,7 @@ } return this; }; - Buffer18.prototype.swap32 = function swap32() { + Buffer14.prototype.swap32 = function swap32() { const len = this.length; if (len % 4 !== 0) { throw new RangeError("Buffer size must be a multiple of 32-bits"); @@ -672,7 +672,7 @@ } return this; }; - Buffer18.prototype.swap64 = function swap64() { + Buffer14.prototype.swap64 = function swap64() { const len = this.length; if (len % 8 !== 0) { throw new RangeError("Buffer size must be a multiple of 64-bits"); @@ -685,7 +685,7 @@ } return this; }; - Buffer18.prototype.toString = function toString2() { + Buffer14.prototype.toString = function toString2() { const length = this.length; if (length === 0) return ""; @@ -693,15 +693,15 @@ return utf8Slice(this, 0, length); return slowToString.apply(this, arguments); }; - Buffer18.prototype.toLocaleString = Buffer18.prototype.toString; - Buffer18.prototype.equals = function equals(b) { - if (!Buffer18.isBuffer(b)) + Buffer14.prototype.toLocaleString = Buffer14.prototype.toString; + Buffer14.prototype.equals = function equals(b) { + if (!Buffer14.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); if (this === b) return true; - return Buffer18.compare(this, b) === 0; + return Buffer14.compare(this, b) === 0; }; - Buffer18.prototype.inspect = function inspect() { + Buffer14.prototype.inspect = function inspect() { let str = ""; const max = exports.INSPECT_MAX_BYTES; str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); @@ -710,13 +710,13 @@ return ""; }; if (customInspectSymbol) { - Buffer18.prototype[customInspectSymbol] = Buffer18.prototype.inspect; + Buffer14.prototype[customInspectSymbol] = Buffer14.prototype.inspect; } - Buffer18.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { + Buffer14.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { if (isInstance(target, Uint8Array)) { - target = Buffer18.from(target, target.offset, target.byteLength); + target = Buffer14.from(target, target.offset, target.byteLength); } - if (!Buffer18.isBuffer(target)) { + if (!Buffer14.isBuffer(target)) { throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); } if (start === void 0) { @@ -796,9 +796,9 @@ return -1; } if (typeof val === "string") { - val = Buffer18.from(val, encoding); + val = Buffer14.from(val, encoding); } - if (Buffer18.isBuffer(val)) { + if (Buffer14.isBuffer(val)) { if (val.length === 0) { return -1; } @@ -871,13 +871,13 @@ } return -1; } - Buffer18.prototype.includes = function includes(val, byteOffset, encoding) { + Buffer14.prototype.includes = function includes(val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1; }; - Buffer18.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + Buffer14.prototype.indexOf = function indexOf(val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true); }; - Buffer18.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + Buffer14.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false); }; function hexWrite(buf2, string, offset, length) { @@ -916,7 +916,7 @@ function ucs2Write(buf2, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length); } - Buffer18.prototype.write = function write2(string, offset, length, encoding) { + Buffer14.prototype.write = function write2(string, offset, length, encoding) { if (offset === void 0) { encoding = "utf8"; length = this.length; @@ -973,7 +973,7 @@ } } }; - Buffer18.prototype.toJSON = function toJSON() { + Buffer14.prototype.toJSON = function toJSON() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) @@ -1095,7 +1095,7 @@ } return res; } - Buffer18.prototype.slice = function slice(start, end) { + Buffer14.prototype.slice = function slice(start, end) { const len = this.length; start = ~~start; end = end === void 0 ? len : ~~end; @@ -1116,7 +1116,7 @@ if (end < start) end = start; const newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer18.prototype); + Object.setPrototypeOf(newBuf, Buffer14.prototype); return newBuf; }; function checkOffset(offset, ext, length) { @@ -1125,7 +1125,7 @@ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length"); } - Buffer18.prototype.readUintLE = Buffer18.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { + Buffer14.prototype.readUintLE = Buffer14.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1138,7 +1138,7 @@ } return val; }; - Buffer18.prototype.readUintBE = Buffer18.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { + Buffer14.prototype.readUintBE = Buffer14.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) { @@ -1151,37 +1151,37 @@ } return val; }; - Buffer18.prototype.readUint8 = Buffer18.prototype.readUInt8 = function readUInt8(offset, noAssert) { + Buffer14.prototype.readUint8 = Buffer14.prototype.readUInt8 = function readUInt8(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 1, this.length); return this[offset]; }; - Buffer18.prototype.readUint16LE = Buffer18.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + Buffer14.prototype.readUint16LE = Buffer14.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] | this[offset + 1] << 8; }; - Buffer18.prototype.readUint16BE = Buffer18.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + Buffer14.prototype.readUint16BE = Buffer14.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] << 8 | this[offset + 1]; }; - Buffer18.prototype.readUint32LE = Buffer18.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + Buffer14.prototype.readUint32LE = Buffer14.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; }; - Buffer18.prototype.readUint32BE = Buffer18.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + Buffer14.prototype.readUint32BE = Buffer14.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); }; - Buffer18.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { + Buffer14.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1193,7 +1193,7 @@ const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24; return BigInt(lo) + (BigInt(hi) << BigInt(32)); }); - Buffer18.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { + Buffer14.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1205,7 +1205,7 @@ const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last; return (BigInt(hi) << BigInt(32)) + BigInt(lo); }); - Buffer18.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { + Buffer14.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1221,7 +1221,7 @@ val -= Math.pow(2, 8 * byteLength2); return val; }; - Buffer18.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { + Buffer14.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1237,7 +1237,7 @@ val -= Math.pow(2, 8 * byteLength2); return val; }; - Buffer18.prototype.readInt8 = function readInt8(offset, noAssert) { + Buffer14.prototype.readInt8 = function readInt8(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 1, this.length); @@ -1245,33 +1245,33 @@ return this[offset]; return (255 - this[offset] + 1) * -1; }; - Buffer18.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + Buffer14.prototype.readInt16LE = function readInt16LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); const val = this[offset] | this[offset + 1] << 8; return val & 32768 ? val | 4294901760 : val; }; - Buffer18.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + Buffer14.prototype.readInt16BE = function readInt16BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); const val = this[offset + 1] | this[offset] << 8; return val & 32768 ? val | 4294901760 : val; }; - Buffer18.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + Buffer14.prototype.readInt32LE = function readInt32LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; }; - Buffer18.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + Buffer14.prototype.readInt32BE = function readInt32BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; }; - Buffer18.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { + Buffer14.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1282,7 +1282,7 @@ const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24); return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); }); - Buffer18.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { + Buffer14.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1293,39 +1293,39 @@ const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset]; return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last); }); - Buffer18.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + Buffer14.prototype.readFloatLE = function readFloatLE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return ieee7542.read(this, offset, true, 23, 4); }; - Buffer18.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + Buffer14.prototype.readFloatBE = function readFloatBE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return ieee7542.read(this, offset, false, 23, 4); }; - Buffer18.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + Buffer14.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 8, this.length); return ieee7542.read(this, offset, true, 52, 8); }; - Buffer18.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + Buffer14.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 8, this.length); return ieee7542.read(this, offset, false, 52, 8); }; function checkInt(buf2, value, offset, ext, max, min) { - if (!Buffer18.isBuffer(buf2)) + if (!Buffer14.isBuffer(buf2)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); if (offset + ext > buf2.length) throw new RangeError("Index out of range"); } - Buffer18.prototype.writeUintLE = Buffer18.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeUintLE = Buffer14.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; @@ -1341,7 +1341,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeUintBE = Buffer18.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeUintBE = Buffer14.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; @@ -1357,7 +1357,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeUint8 = Buffer18.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + Buffer14.prototype.writeUint8 = Buffer14.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1365,7 +1365,7 @@ this[offset] = value & 255; return offset + 1; }; - Buffer18.prototype.writeUint16LE = Buffer18.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { + Buffer14.prototype.writeUint16LE = Buffer14.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1374,7 +1374,7 @@ this[offset + 1] = value >>> 8; return offset + 2; }; - Buffer18.prototype.writeUint16BE = Buffer18.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { + Buffer14.prototype.writeUint16BE = Buffer14.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1383,7 +1383,7 @@ this[offset + 1] = value & 255; return offset + 2; }; - Buffer18.prototype.writeUint32LE = Buffer18.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { + Buffer14.prototype.writeUint32LE = Buffer14.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1394,7 +1394,7 @@ this[offset] = value & 255; return offset + 4; }; - Buffer18.prototype.writeUint32BE = Buffer18.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { + Buffer14.prototype.writeUint32BE = Buffer14.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1445,13 +1445,13 @@ buf2[offset] = hi; return offset + 8; } - Buffer18.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { + Buffer14.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); }); - Buffer18.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { + Buffer14.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); }); - Buffer18.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) { @@ -1470,7 +1470,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) { @@ -1489,7 +1489,7 @@ } return offset + byteLength2; }; - Buffer18.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + Buffer14.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1499,7 +1499,7 @@ this[offset] = value & 255; return offset + 1; }; - Buffer18.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + Buffer14.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1508,7 +1508,7 @@ this[offset + 1] = value >>> 8; return offset + 2; }; - Buffer18.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + Buffer14.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1517,7 +1517,7 @@ this[offset + 1] = value & 255; return offset + 2; }; - Buffer18.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + Buffer14.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1528,7 +1528,7 @@ this[offset + 3] = value >>> 24; return offset + 4; }; - Buffer18.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + Buffer14.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1541,10 +1541,10 @@ this[offset + 3] = value & 255; return offset + 4; }; - Buffer18.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { + Buffer14.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); }); - Buffer18.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { + Buffer14.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); }); function checkIEEE754(buf2, value, offset, ext, max, min) { @@ -1562,10 +1562,10 @@ ieee7542.write(buf2, value, offset, littleEndian, 23, 4); return offset + 4; } - Buffer18.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + Buffer14.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert); }; - Buffer18.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + Buffer14.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert); }; function writeDouble(buf2, value, offset, littleEndian, noAssert) { @@ -1577,14 +1577,14 @@ ieee7542.write(buf2, value, offset, littleEndian, 52, 8); return offset + 8; } - Buffer18.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { + Buffer14.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert); }; - Buffer18.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { + Buffer14.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert); }; - Buffer18.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer18.isBuffer(target)) + Buffer14.prototype.copy = function copy(target, targetStart, start, end) { + if (!Buffer14.isBuffer(target)) throw new TypeError("argument should be a Buffer"); if (!start) start = 0; @@ -1620,7 +1620,7 @@ } return len; }; - Buffer18.prototype.fill = function fill(val, start, end, encoding) { + Buffer14.prototype.fill = function fill(val, start, end, encoding) { if (typeof val === "string") { if (typeof start === "string") { encoding = start; @@ -1633,7 +1633,7 @@ if (encoding !== void 0 && typeof encoding !== "string") { throw new TypeError("encoding must be a string"); } - if (typeof encoding === "string" && !Buffer18.isEncoding(encoding)) { + if (typeof encoding === "string" && !Buffer14.isEncoding(encoding)) { throw new TypeError("Unknown encoding: " + encoding); } if (val.length === 1) { @@ -1663,7 +1663,7 @@ this[i] = val; } } else { - const bytes = Buffer18.isBuffer(val) ? val : Buffer18.from(val, encoding); + const bytes = Buffer14.isBuffer(val) ? val : Buffer14.from(val, encoding); const len = bytes.length; if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"'); @@ -1910,6 +1910,119 @@ } }); + // node_modules/crc-32/crc32.js + var require_crc32 = __commonJS({ + "node_modules/crc-32/crc32.js"(exports) { + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var CRC32; + (function(factory) { + if (typeof DO_NOT_EXPORT_CRC === "undefined") { + if (typeof exports === "object") { + factory(exports); + } else if (typeof define === "function" && define.amd) { + define(function() { + var module2 = {}; + factory(module2); + return module2; + }); + } else { + factory(CRC32 = {}); + } + } else { + factory(CRC32 = {}); + } + })(function(CRC322) { + CRC322.version = "1.2.0"; + function signed_crc_table() { + var c = 0, table = new Array(256); + for (var n = 0; n != 256; ++n) { + c = n; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + table[n] = c; + } + return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; + } + var T = signed_crc_table(); + function crc32_bstr(bstr, seed) { + var C = seed ^ -1, L = bstr.length - 1; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; + } + if (i === L) + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255]; + return C ^ -1; + } + function crc32_buf(buf2, seed) { + if (buf2.length > 1e4) + return crc32_buf_8(buf2, seed); + var C = seed ^ -1, L = buf2.length - 3; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + } + while (i < L + 3) + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + return C ^ -1; + } + function crc32_buf_8(buf2, seed) { + var C = seed ^ -1, L = buf2.length - 7; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + } + while (i < L + 7) + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + return C ^ -1; + } + function crc32_str(str, seed) { + var C = seed ^ -1; + for (var i = 0, L = str.length, c, d; i < L; ) { + c = str.charCodeAt(i++); + if (c < 128) { + C = C >>> 8 ^ T[(C ^ c) & 255]; + } else if (c < 2048) { + C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + } else if (c >= 55296 && c < 57344) { + c = (c & 1023) + 64; + d = str.charCodeAt(i++) & 1023; + C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255]; + } else { + C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + } + } + return C ^ -1; + } + CRC322.table = T; + CRC322.bstr = crc32_bstr; + CRC322.buf = crc32_buf; + CRC322.str = crc32_str; + }); + } + }); + // node_modules/events/events.js var require_events = __commonJS({ "node_modules/events/events.js"(exports, module) { @@ -2280,1472 +2393,501 @@ } }); - // node_modules/browser-process/dist/api_error.js - var require_api_error = __commonJS({ - "node_modules/browser-process/dist/api_error.js"(exports) { + // node_modules/readable-stream/lib/internal/streams/stream-browser.js + var require_stream_browser = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var Buffer18 = Buffer18; - (function(ErrorCode2) { - ErrorCode2[ErrorCode2["EPERM"] = 0] = "EPERM"; - ErrorCode2[ErrorCode2["ENOENT"] = 1] = "ENOENT"; - ErrorCode2[ErrorCode2["EIO"] = 2] = "EIO"; - ErrorCode2[ErrorCode2["EBADF"] = 3] = "EBADF"; - ErrorCode2[ErrorCode2["EACCES"] = 4] = "EACCES"; - ErrorCode2[ErrorCode2["EBUSY"] = 5] = "EBUSY"; - ErrorCode2[ErrorCode2["EEXIST"] = 6] = "EEXIST"; - ErrorCode2[ErrorCode2["ENOTDIR"] = 7] = "ENOTDIR"; - ErrorCode2[ErrorCode2["EISDIR"] = 8] = "EISDIR"; - ErrorCode2[ErrorCode2["EINVAL"] = 9] = "EINVAL"; - ErrorCode2[ErrorCode2["EFBIG"] = 10] = "EFBIG"; - ErrorCode2[ErrorCode2["ENOSPC"] = 11] = "ENOSPC"; - ErrorCode2[ErrorCode2["EROFS"] = 12] = "EROFS"; - ErrorCode2[ErrorCode2["ENOTEMPTY"] = 13] = "ENOTEMPTY"; - ErrorCode2[ErrorCode2["ENOTSUP"] = 14] = "ENOTSUP"; - })(exports.ErrorCode || (exports.ErrorCode = {})); - var ErrorCode = exports.ErrorCode; - var ErrorStrings = {}; - ErrorStrings[ErrorCode.EPERM] = "Operation not permitted."; - ErrorStrings[ErrorCode.ENOENT] = "No such file or directory."; - ErrorStrings[ErrorCode.EIO] = "Input/output error."; - ErrorStrings[ErrorCode.EBADF] = "Bad file descriptor."; - ErrorStrings[ErrorCode.EACCES] = "Permission denied."; - ErrorStrings[ErrorCode.EBUSY] = "Resource busy or locked."; - ErrorStrings[ErrorCode.EEXIST] = "File exists."; - ErrorStrings[ErrorCode.ENOTDIR] = "File is not a directory."; - ErrorStrings[ErrorCode.EISDIR] = "File is a directory."; - ErrorStrings[ErrorCode.EINVAL] = "Invalid argument."; - ErrorStrings[ErrorCode.EFBIG] = "File is too big."; - ErrorStrings[ErrorCode.ENOSPC] = "No space left on disk."; - ErrorStrings[ErrorCode.EROFS] = "Cannot modify a read-only file system."; - ErrorStrings[ErrorCode.ENOTEMPTY] = "Directory is not empty."; - ErrorStrings[ErrorCode.ENOTSUP] = "Operation is not supported."; - var ApiError = function() { - function ApiError2(type, message) { - this.type = type; - this.code = ErrorCode[type]; - if (message != null) { - this.message = message; - } else { - this.message = ErrorStrings[type]; - } - } - ApiError2.prototype.toString = function() { - return this.code + ": " + ErrorStrings[this.type] + " " + this.message; - }; - ApiError2.prototype.writeToBuffer = function(buffer, i) { - if (buffer === void 0) { - buffer = new Buffer18(this.bufferSize()); - } - if (i === void 0) { - i = 0; - } - buffer.writeUInt8(this.type, i); - var bytesWritten = buffer.write(this.message, i + 5); - buffer.writeUInt32LE(bytesWritten, i + 1); - return buffer; - }; - ApiError2.fromBuffer = function(buffer, i) { - if (i === void 0) { - i = 0; - } - return new ApiError2(buffer.readUInt8(i), buffer.toString("utf8", i + 5, i + 5 + buffer.readUInt32LE(i + 1))); - }; - ApiError2.prototype.bufferSize = function() { - return 5 + Buffer18.byteLength(this.message); - }; - ApiError2.FileError = function(code, p) { - return new ApiError2(code, p + ": " + ErrorStrings[code]); - }; - ApiError2.ENOENT = function(path) { - return this.FileError(ErrorCode.ENOENT, path); - }; - ApiError2.EEXIST = function(path) { - return this.FileError(ErrorCode.EEXIST, path); - }; - ApiError2.EISDIR = function(path) { - return this.FileError(ErrorCode.EISDIR, path); - }; - ApiError2.ENOTDIR = function(path) { - return this.FileError(ErrorCode.ENOTDIR, path); - }; - ApiError2.EPERM = function(path) { - return this.FileError(ErrorCode.EPERM, path); - }; - return ApiError2; - }(); - exports.ApiError = ApiError; + module.exports = require_events().EventEmitter; } }); - // node_modules/browser-process/dist/node_eventemitter.js - var require_node_eventemitter = __commonJS({ - "node_modules/browser-process/dist/node_eventemitter.js"(exports) { + // (disabled):node_modules/util/util.js + var require_util = __commonJS({ + "(disabled):node_modules/util/util.js"() { init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports.__extends || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - function __() { - this.constructor = d; - } - __.prototype = b.prototype; - d.prototype = new __(); - }; - var events = require_events(); - var api_error = require_api_error(); - var ApiError = api_error.ApiError; - var ErrorCode = api_error.ErrorCode; - var BufferedEvent = function() { - function BufferedEvent2(data, encoding, cb) { - this.data = data; - this.encoding = encoding; - this.cb = cb; - this.size = typeof data !== "string" ? data.length : Buffer2.byteLength(data, encoding != null ? encoding : void 0); - if (typeof this.data !== "string") { - this.data = typeof this.data.sliceCopy !== "undefined" ? this.data.sliceCopy() : Buffer2.concat([this.data]); - } - } - BufferedEvent2.prototype.getData = function(encoding) { - if (encoding == null) { - if (typeof this.data === "string") { - return new Buffer2(this.data, this.encoding != null ? this.encoding : void 0); - } else { - return this.data; - } - } else { - if (typeof this.data === "string") { - if (encoding === this.encoding) { - return this.data; - } else { - return new Buffer2(this.data, this.encoding != null ? this.encoding : void 0).toString(encoding); - } - } else { - return this.data.toString(encoding); - } - } - }; - return BufferedEvent2; - }(); - var AbstractDuplexStream = function(_super) { - __extends(AbstractDuplexStream2, _super); - function AbstractDuplexStream2(writable2, readable) { - _super.call(this); - this.writable = writable2; - this.readable = readable; - this.encoding = null; - this.flowing = false; - this.buffer = []; - this.endEvent = null; - this.ended = false; - this.drained = true; - } - AbstractDuplexStream2.prototype.addListener = function(event, listener) { - var rv = _super.prototype.addListener.call(this, event, listener), _this = this; - if (event === "data" && !this.flowing) { - this.resume(); - } else if (event === "readable" && this.buffer.length > 0) { - setTimeout(function() { - _this.emit("readable"); - }, 0); - } - return rv; - }; - AbstractDuplexStream2.prototype._processArgs = function(data, arg2, arg3) { - if (typeof arg2 === "string") { - return new BufferedEvent(data, arg2, arg3); - } else { - return new BufferedEvent(data, null, arg2); - } - }; - AbstractDuplexStream2.prototype._processEvents = function() { - var drained = this.buffer.length === 0; - if (this.drained !== drained) { - if (this.drained) { - this.emit("readable"); - } - } - if (this.flowing && this.buffer.length !== 0) { - this.emit("data", this.read()); - } - this.drained = this.buffer.length === 0; - }; - AbstractDuplexStream2.prototype.emitEvent = function(type, event) { - this.emit(type, event.getData(this.encoding)); - if (event.cb) { - event.cb(); - } - }; - AbstractDuplexStream2.prototype.write = function(data, arg2, arg3) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Cannot write to an ended stream."); - } - var event = this._processArgs(data, arg2, arg3); - this._push(event); - return this.flowing; - }; - AbstractDuplexStream2.prototype.end = function(data, arg2, arg3) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Stream is already closed."); - } - var event = this._processArgs(data, arg2, arg3); - this.ended = true; - this.endEvent = event; - this._processEvents(); - }; - AbstractDuplexStream2.prototype.read = function(size) { - var events2 = [], eventsCbs = [], lastCb, eventsSize = 0, event, buff, trueSize, i = 0, sizeUnspecified = typeof size !== "number"; - if (sizeUnspecified) - size = 4294967295; - for (i = 0; i < this.buffer.length && eventsSize < size; i++) { - event = this.buffer[i]; - events2.push(event.getData()); - if (event.cb) { - eventsCbs.push(event.cb); - } - eventsSize += event.size; - lastCb = event.cb; - } - if (!sizeUnspecified && eventsSize < size) { - return null; - } - this.buffer = this.buffer.slice(events2.length); - trueSize = eventsSize > size ? size : eventsSize; - buff = Buffer2.concat(events2); - if (eventsSize > size) { - if (lastCb) - eventsCbs.pop(); - this._push(new BufferedEvent(buff.slice(size), null, lastCb)); - } - if (eventsCbs.length > 0) { - setTimeout(function() { - var i2; - for (i2 = 0; i2 < eventsCbs.length; i2++) { - eventsCbs[i2](); - } - }, 0); - } - if (this.ended && this.buffer.length === 0 && this.endEvent !== null) { - var endEvent = this.endEvent, _this = this; - this.endEvent = null; - setTimeout(function() { - _this.emitEvent("end", endEvent); - }, 0); - } - if (events2.length === 0) { - this.emit("_read"); - return null; - } else if (this.encoding === null) { - return buff.slice(0, trueSize); - } else { - return buff.toString(this.encoding, 0, trueSize); - } - }; - AbstractDuplexStream2.prototype.setEncoding = function(encoding) { - this.encoding = encoding; - }; - AbstractDuplexStream2.prototype.pause = function() { - this.flowing = false; - }; - AbstractDuplexStream2.prototype.resume = function() { - this.flowing = true; - this._processEvents(); - }; - AbstractDuplexStream2.prototype.pipe = function(destination, options) { - throw new ApiError(ErrorCode.EPERM, "Unimplemented."); - }; - AbstractDuplexStream2.prototype.unpipe = function(destination) { - }; - AbstractDuplexStream2.prototype.unshift = function(chunk) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Stream has ended."); - } - this.buffer.unshift(new BufferedEvent(chunk, this.encoding)); - this._processEvents(); - }; - AbstractDuplexStream2.prototype._push = function(event) { - this.buffer.push(event); - this._processEvents(); - }; - AbstractDuplexStream2.prototype.wrap = function(stream) { - throw new ApiError(ErrorCode.EPERM, "Unimplemented."); - }; - return AbstractDuplexStream2; - }(events.EventEmitter); - exports.AbstractDuplexStream = AbstractDuplexStream; } }); - // node_modules/has-symbols/shams.js - var require_shams = __commonJS({ - "node_modules/has-symbols/shams.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/buffer_list.js + var require_buffer_list = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - module.exports = function hasSymbols() { - if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { - return false; - } - if (typeof Symbol.iterator === "symbol") { - return true; - } - var obj = {}; - var sym = Symbol("test"); - var symObj = Object(sym); - if (typeof sym === "string") { - return false; - } - if (Object.prototype.toString.call(sym) !== "[object Symbol]") { - return false; - } - if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { - return false; - } - var symVal = 42; - obj[sym] = symVal; - for (sym in obj) { - return false; - } - if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { - return false; + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) + symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); } - if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { - return false; + return keys; + } + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { + ownKeys(Object(source), true).forEach(function(key2) { + _defineProperty(target, key2, source[key2]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function(key2) { + Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); + }); + } } - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { - return false; + return target; + } + function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); + } else { + obj[key2] = value; } - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { - return false; + return obj; + } + function _classCallCheck(instance18, Constructor) { + if (!(instance18 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } - if (typeof Object.getOwnPropertyDescriptor === "function") { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { - return false; - } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); } - return true; - }; - } - }); - - // node_modules/has-tostringtag/shams.js - var require_shams2 = __commonJS({ - "node_modules/has-tostringtag/shams.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var hasSymbols = require_shams(); - module.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; - }; - } - }); - - // node_modules/has-symbols/index.js - var require_has_symbols = __commonJS({ - "node_modules/has-symbols/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var origSymbol = typeof Symbol !== "undefined" && Symbol; - var hasSymbolSham = require_shams(); - module.exports = function hasNativeSymbols() { - if (typeof origSymbol !== "function") { - return false; - } - if (typeof Symbol !== "function") { - return false; - } - if (typeof origSymbol("foo") !== "symbol") { - return false; - } - if (typeof Symbol("bar") !== "symbol") { - return false; + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) + _defineProperties(Constructor.prototype, protoProps); + if (staticProps) + _defineProperties(Constructor, staticProps); + return Constructor; + } + var _require = require_buffer(); + var Buffer14 = _require.Buffer; + var _require2 = require_util(); + var inspect = _require2.inspect; + var custom = inspect && inspect.custom || "inspect"; + function copyBuffer(src, target, offset) { + Buffer14.prototype.copy.call(src, target, offset); + } + module.exports = /* @__PURE__ */ function() { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; } - return hasSymbolSham(); - }; - } - }); - - // node_modules/function-bind/implementation.js - var require_implementation = __commonJS({ - "node_modules/function-bind/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; - var slice = Array.prototype.slice; - var toStr = Object.prototype.toString; - var funcType = "[object Function]"; - module.exports = function bind(that) { - var target = this; - if (typeof target !== "function" || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - var bound; - var binder = function() { - if (this instanceof bound) { - var result = target.apply(this, args.concat(slice.call(arguments))); - if (Object(result) === result) { - return result; + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) + this.tail.next = entry; + else + this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) + this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) + return; + var ret = this.head.data; + if (this.length === 1) + this.head = this.tail = null; + else + this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) + return ""; + var p = this.head; + var ret = "" + p.data; + while (p = p.next) { + ret += s + p.data; } - return this; - } else { - return target.apply(that, args.concat(slice.call(arguments))); + return ret; } - }; - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push("$" + i); - } - bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder); - if (target.prototype) { - var Empty = function Empty2() { - }; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; - } - }); - - // node_modules/function-bind/index.js - var require_function_bind = __commonJS({ - "node_modules/function-bind/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation(); - module.exports = Function.prototype.bind || implementation; - } - }); - - // node_modules/has/src/index.js - var require_src = __commonJS({ - "node_modules/has/src/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var bind = require_function_bind(); - module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); - } - }); - - // node_modules/get-intrinsic/index.js - var require_get_intrinsic = __commonJS({ - "node_modules/get-intrinsic/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var undefined2; - var $SyntaxError = SyntaxError; - var $Function = Function; - var $TypeError = TypeError; - var getEvalledConstructor = function(expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); - } catch (e) { - } - }; - var $gOPD = Object.getOwnPropertyDescriptor; - if ($gOPD) { - try { - $gOPD({}, ""); - } catch (e) { - $gOPD = null; - } - } - var throwTypeError = function() { - throw new $TypeError(); - }; - var ThrowTypeError = $gOPD ? function() { - try { - arguments.callee; - return throwTypeError; - } catch (calleeThrows) { - try { - return $gOPD(arguments, "callee").get; - } catch (gOPDthrows) { - return throwTypeError; + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) + return Buffer14.alloc(0); + var ret = Buffer14.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; } - } - }() : throwTypeError; - var hasSymbols = require_has_symbols()(); - var getProto = Object.getPrototypeOf || function(x) { - return x.__proto__; - }; - var needsEval = {}; - var TypedArray = typeof Uint8Array === "undefined" ? undefined2 : getProto(Uint8Array); - var INTRINSICS = { - "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError, - "%Array%": Array, - "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer, - "%ArrayIteratorPrototype%": hasSymbols ? getProto([][Symbol.iterator]()) : undefined2, - "%AsyncFromSyncIteratorPrototype%": undefined2, - "%AsyncFunction%": needsEval, - "%AsyncGenerator%": needsEval, - "%AsyncGeneratorFunction%": needsEval, - "%AsyncIteratorPrototype%": needsEval, - "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics, - "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt, - "%Boolean%": Boolean, - "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView, - "%Date%": Date, - "%decodeURI%": decodeURI, - "%decodeURIComponent%": decodeURIComponent, - "%encodeURI%": encodeURI, - "%encodeURIComponent%": encodeURIComponent, - "%Error%": Error, - "%eval%": eval, - "%EvalError%": EvalError, - "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array, - "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array, - "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry, - "%Function%": $Function, - "%GeneratorFunction%": needsEval, - "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array, - "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array, - "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array, - "%isFinite%": isFinite, - "%isNaN%": isNaN, - "%IteratorPrototype%": hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined2, - "%JSON%": typeof JSON === "object" ? JSON : undefined2, - "%Map%": typeof Map === "undefined" ? undefined2 : Map, - "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), - "%Math%": Math, - "%Number%": Number, - "%Object%": Object, - "%parseFloat%": parseFloat, - "%parseInt%": parseInt, - "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise, - "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy, - "%RangeError%": RangeError, - "%ReferenceError%": ReferenceError, - "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect, - "%RegExp%": RegExp, - "%Set%": typeof Set === "undefined" ? undefined2 : Set, - "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), - "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer, - "%String%": String, - "%StringIteratorPrototype%": hasSymbols ? getProto(""[Symbol.iterator]()) : undefined2, - "%Symbol%": hasSymbols ? Symbol : undefined2, - "%SyntaxError%": $SyntaxError, - "%ThrowTypeError%": ThrowTypeError, - "%TypedArray%": TypedArray, - "%TypeError%": $TypeError, - "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array, - "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray, - "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array, - "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array, - "%URIError%": URIError, - "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap, - "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef, - "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet - }; - var doEval = function doEval2(name) { - var value; - if (name === "%AsyncFunction%") { - value = getEvalledConstructor("async function () {}"); - } else if (name === "%GeneratorFunction%") { - value = getEvalledConstructor("function* () {}"); - } else if (name === "%AsyncGeneratorFunction%") { - value = getEvalledConstructor("async function* () {}"); - } else if (name === "%AsyncGenerator%") { - var fn = doEval2("%AsyncGeneratorFunction%"); - if (fn) { - value = fn.prototype; - } - } else if (name === "%AsyncIteratorPrototype%") { - var gen = doEval2("%AsyncGenerator%"); - if (gen) { - value = getProto(gen.prototype); - } - } - INTRINSICS[name] = value; - return value; - }; - var LEGACY_ALIASES = { - "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], - "%ArrayPrototype%": ["Array", "prototype"], - "%ArrayProto_entries%": ["Array", "prototype", "entries"], - "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], - "%ArrayProto_keys%": ["Array", "prototype", "keys"], - "%ArrayProto_values%": ["Array", "prototype", "values"], - "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], - "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], - "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], - "%BooleanPrototype%": ["Boolean", "prototype"], - "%DataViewPrototype%": ["DataView", "prototype"], - "%DatePrototype%": ["Date", "prototype"], - "%ErrorPrototype%": ["Error", "prototype"], - "%EvalErrorPrototype%": ["EvalError", "prototype"], - "%Float32ArrayPrototype%": ["Float32Array", "prototype"], - "%Float64ArrayPrototype%": ["Float64Array", "prototype"], - "%FunctionPrototype%": ["Function", "prototype"], - "%Generator%": ["GeneratorFunction", "prototype"], - "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], - "%Int8ArrayPrototype%": ["Int8Array", "prototype"], - "%Int16ArrayPrototype%": ["Int16Array", "prototype"], - "%Int32ArrayPrototype%": ["Int32Array", "prototype"], - "%JSONParse%": ["JSON", "parse"], - "%JSONStringify%": ["JSON", "stringify"], - "%MapPrototype%": ["Map", "prototype"], - "%NumberPrototype%": ["Number", "prototype"], - "%ObjectPrototype%": ["Object", "prototype"], - "%ObjProto_toString%": ["Object", "prototype", "toString"], - "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], - "%PromisePrototype%": ["Promise", "prototype"], - "%PromiseProto_then%": ["Promise", "prototype", "then"], - "%Promise_all%": ["Promise", "all"], - "%Promise_reject%": ["Promise", "reject"], - "%Promise_resolve%": ["Promise", "resolve"], - "%RangeErrorPrototype%": ["RangeError", "prototype"], - "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], - "%RegExpPrototype%": ["RegExp", "prototype"], - "%SetPrototype%": ["Set", "prototype"], - "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], - "%StringPrototype%": ["String", "prototype"], - "%SymbolPrototype%": ["Symbol", "prototype"], - "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], - "%TypedArrayPrototype%": ["TypedArray", "prototype"], - "%TypeErrorPrototype%": ["TypeError", "prototype"], - "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], - "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], - "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], - "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], - "%URIErrorPrototype%": ["URIError", "prototype"], - "%WeakMapPrototype%": ["WeakMap", "prototype"], - "%WeakSetPrototype%": ["WeakSet", "prototype"] - }; - var bind = require_function_bind(); - var hasOwn = require_src(); - var $concat = bind.call(Function.call, Array.prototype.concat); - var $spliceApply = bind.call(Function.apply, Array.prototype.splice); - var $replace = bind.call(Function.call, String.prototype.replace); - var $strSlice = bind.call(Function.call, String.prototype.slice); - var $exec = bind.call(Function.call, RegExp.prototype.exec); - var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; - var reEscapeChar = /\\(\\)?/g; - var stringToPath = function stringToPath2(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === "%" && last !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); - } else if (last === "%" && first !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); - } - var result = []; - $replace(string, rePropName, function(match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; - }); - return result; - }; - var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = "%" + alias[0] + "%"; - } - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + ret = this.shift(); + } else { + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; } - if (typeof value === "undefined" && !allowMissing) { - throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); + }, { + key: "first", + value: function first() { + return this.head.data; } - return { - alias, - name: intrinsicName, - value - }; - } - throw new $SyntaxError("intrinsic " + name + " does not exist!"); - }; - module.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== "string" || name.length === 0) { - throw new $TypeError("intrinsic name must be a non-empty string"); - } - if (arguments.length > 1 && typeof allowMissing !== "boolean") { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - if ($exec(/^%?[^%]*%?$/g, name) === null) { - throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); - } - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; - var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { - throw new $SyntaxError("property names with quotes must have matching quotes"); - } - if (part === "constructor" || !isOwn) { - skipFurtherCaching = true; - } - intrinsicBaseName += "." + part; - intrinsicRealName = "%" + intrinsicBaseName + "%"; - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) + ret += str; + else + ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) + this.head = p.next; + else + this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; } - return void 0; + ++c; } - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - if (isOwn && "get" in desc && !("originalValue" in desc.get)) { - value = desc.get; - } else { - value = value[part]; + this.length -= c; + return ret; + } + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer14.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf2 = p.data; + var nb = n > buf2.length ? buf2.length : n; + buf2.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf2.length) { + ++c; + if (p.next) + this.head = p.next; + else + this.head = this.tail = null; + } else { + this.head = p; + p.data = buf2.slice(nb); + } + break; } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; + ++c; } + this.length -= c; + return ret; } - } - return value; - }; + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + depth: 0, + customInspect: false + })); + } + }]); + return BufferList; + }(); } }); - // node_modules/call-bind/index.js - var require_call_bind = __commonJS({ - "node_modules/call-bind/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var bind = require_function_bind(); - var GetIntrinsic = require_get_intrinsic(); - var $apply = GetIntrinsic("%Function.prototype.apply%"); - var $call = GetIntrinsic("%Function.prototype.call%"); - var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var $max = GetIntrinsic("%Math.max%"); - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - } catch (e) { - $defineProperty = null; - } - } - module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, "length"); - if (desc.configurable) { - $defineProperty(func, "length", { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }); - } - } - return func; - }; - var applyBind = function applyBind2() { - return $reflectApply(bind, $apply, arguments); - }; - if ($defineProperty) { - $defineProperty(module.exports, "apply", { value: applyBind }); - } else { - module.exports.apply = applyBind; - } - } - }); - - // node_modules/call-bind/callBound.js - var require_callBound = __commonJS({ - "node_modules/call-bind/callBound.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var callBind = require_call_bind(); - var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf")); - module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { - return callBind(intrinsic); - } - return intrinsic; - }; - } - }); - - // node_modules/is-arguments/index.js - var require_is_arguments = __commonJS({ - "node_modules/is-arguments/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var hasToStringTag = require_shams2()(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) { - return false; - } - return $toString(value) === "[object Arguments]"; - }; - var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]"; - }; - var supportsStandardArguments = function() { - return isStandardArguments(arguments); - }(); - isStandardArguments.isLegacyArguments = isLegacyArguments; - module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - } - }); - - // node_modules/is-generator-function/index.js - var require_is_generator_function = __commonJS({ - "node_modules/is-generator-function/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/destroy.js + var require_destroy = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var toStr = Object.prototype.toString; - var fnToStr = Function.prototype.toString; - var isFnRegex = /^\s*(?:function)?\*/; - var hasToStringTag = require_shams2()(); - var getProto = Object.getPrototypeOf; - var getGeneratorFunc = function() { - if (!hasToStringTag) { - return false; - } - try { - return Function("return function*() {}")(); - } catch (e) { - } - }; - var GeneratorFunction; - module.exports = function isGeneratorFunction(fn) { - if (typeof fn !== "function") { - return false; + function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; } - if (isFnRegex.test(fnToStr.call(fn))) { - return true; + if (this._readableState) { + this._readableState.destroyed = true; } - if (!hasToStringTag) { - var str = toStr.call(fn); - return str === "[object GeneratorFunction]"; + if (this._writableState) { + this._writableState.destroyed = true; } - if (!getProto) { - return false; + this._destroy(err || null, function(err2) { + if (!cb && err2) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err2); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err2); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err2); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; + } + function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); + } + function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) + return; + if (self._readableState && !self._readableState.emitClose) + return; + self.emit("close"); + } + function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; } - if (typeof GeneratorFunction === "undefined") { - var generatorFunc = getGeneratorFunc(); - GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; } - return getProto(fn) === GeneratorFunction; + } + function emitErrorNT(self, err) { + self.emit("error", err); + } + function errorOrDestroy(stream, err) { + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) + stream.destroy(err); + else + stream.emit("error", err); + } + module.exports = { + destroy, + undestroy, + errorOrDestroy }; } }); - // node_modules/is-callable/index.js - var require_is_callable = __commonJS({ - "node_modules/is-callable/index.js"(exports, module) { + // node_modules/readable-stream/errors-browser.js + var require_errors_browser = __commonJS({ + "node_modules/readable-stream/errors-browser.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var fnToStr = Function.prototype.toString; - var reflectApply = typeof Reflect === "object" && Reflect !== null && Reflect.apply; - var badArrayLike; - var isCallableMarker; - if (typeof reflectApply === "function" && typeof Object.defineProperty === "function") { - try { - badArrayLike = Object.defineProperty({}, "length", { - get: function() { - throw isCallableMarker; - } - }); - isCallableMarker = {}; - reflectApply(function() { - throw 42; - }, null, badArrayLike); - } catch (_) { - if (_ !== isCallableMarker) { - reflectApply = null; - } - } - } else { - reflectApply = null; + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; } - var constructorRegex = /^\s*class\b/; - var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; + var codes = {}; + function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; } - }; - var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { - return false; + function getMessage(arg1, arg2, arg3) { + if (typeof message === "string") { + return message; + } else { + return message(arg1, arg2, arg3); } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var fnClass = "[object Function]"; - var genClass = "[object GeneratorFunction]"; - var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag; - var documentDotAll = typeof document === "object" && typeof document.all === "undefined" && document.all !== void 0 ? document.all : {}; - module.exports = reflectApply ? function isCallable(value) { - if (value === documentDotAll) { - return true; - } - if (!value) { - return false; - } - if (typeof value !== "function" && typeof value !== "object") { - return false; - } - if (typeof value === "function" && !value.prototype) { - return true; } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { - return false; + var NodeError = /* @__PURE__ */ function(_Base) { + _inheritsLoose(NodeError2, _Base); + function NodeError2(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + return NodeError2; + }(Base); + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; + } + function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function(i) { + return String(i); + }); + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); } + } else { + return "of ".concat(thing, " ").concat(String(expected)); } - return !isES6ClassFn(value); - } : function isCallable(value) { - if (value === documentDotAll) { - return true; + } + function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; + } + function endsWith(str, search, this_len) { + if (this_len === void 0 || this_len > str.length) { + this_len = str.length; } - if (!value) { - return false; + return str.substring(this_len - search.length, this_len) === search; + } + function includes(str, search, start) { + if (typeof start !== "number") { + start = 0; } - if (typeof value !== "function" && typeof value !== "object") { + if (start + search.length > str.length) { return false; + } else { + return str.indexOf(search, start) !== -1; } - if (typeof value === "function" && !value.prototype) { - return true; - } - if (hasToStringTag) { - return tryFunctionObject(value); + } + createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; + }, TypeError); + createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { + var determiner; + if (typeof expected === "string" && startsWith(expected, "not ")) { + determiner = "must not be"; + expected = expected.replace(/^not /, ""); + } else { + determiner = "must be"; } - if (isES6ClassFn(value)) { - return false; + var msg; + if (endsWith(name, " argument")) { + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + } else { + var type = includes(name, ".") ? "property" : "argument"; + msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); } - var strClass = toStr.call(value); - return strClass === fnClass || strClass === genClass; - }; + msg += ". Received type ".concat(typeof actual); + return msg; + }, TypeError); + createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); + createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { + return "The " + name + " method is not implemented"; + }); + createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); + createErrorType("ERR_STREAM_DESTROYED", function(name) { + return "Cannot call " + name + " after a stream was destroyed"; + }); + createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); + createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); + createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); + createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); + createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { + return "Unknown encoding: " + arg; + }, TypeError); + createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); + module.exports.codes = codes; } }); - // node_modules/for-each/index.js - var require_for_each = __commonJS({ - "node_modules/for-each/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/state.js + var require_state = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var isCallable = require_is_callable(); - var toStr = Object.prototype.toString; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var forEachArray = function forEachArray2(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } - }; - var forEachString = function forEachString2(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } - }; - var forEachObject = function forEachObject2(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } - }; - var forEach = function forEach2(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError("iterator must be a function"); - } - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; - } - if (toStr.call(list) === "[object Array]") { - forEachArray(list, iterator, receiver); - } else if (typeof list === "string") { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } - }; - module.exports = forEach; - } - }); - - // node_modules/available-typed-arrays/index.js - var require_available_typed_arrays = __commonJS({ - "node_modules/available-typed-arrays/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var possibleNames = [ - "BigInt64Array", - "BigUint64Array", - "Float32Array", - "Float64Array", - "Int16Array", - "Int32Array", - "Int8Array", - "Uint16Array", - "Uint32Array", - "Uint8Array", - "Uint8ClampedArray" - ]; - var g = typeof globalThis === "undefined" ? window : globalThis; - module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === "function") { - out[out.length] = possibleNames[i]; - } - } - return out; - }; - } - }); - - // node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js - var require_getOwnPropertyDescriptor = __commonJS({ - "node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - if ($gOPD) { - try { - $gOPD([], "length"); - } catch (e) { - $gOPD = null; - } - } - module.exports = $gOPD; - } - }); - - // node_modules/is-typed-array/index.js - var require_is_typed_array = __commonJS({ - "node_modules/is-typed-array/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? window : globalThis; - var typedArrays = availableTypedArrays(); - var $indexOf = callBound("Array.prototype.indexOf", true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; - }; - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var gOPD = require_getOwnPropertyDescriptor(); - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); - } - var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function(getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { - } - } - }); - return anyTrue; - }; - module.exports = function isTypedArray(value) { - if (!value || typeof value !== "object") { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { - return false; - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/which-typed-array/index.js - var require_which_typed_array = __commonJS({ - "node_modules/which-typed-array/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? window : globalThis; - var typedArrays = availableTypedArrays(); - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var gOPD = require_getOwnPropertyDescriptor(); - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - if (typeof g[typedArray] === "function") { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - } - }); + var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE; + function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; } - var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function(getter, typedArray) { - if (!foundName) { - try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; - } - } catch (e) { - } + function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : "highWaterMark"; + throw new ERR_INVALID_OPT_VALUE(name, hwm); } - }); - return foundName; - }; - var isTypedArray = require_is_typed_array(); - module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - return $slice($toString(value), 8, -1); - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/util/support/types.js - var require_types = __commonJS({ - "node_modules/util/support/types.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var isArgumentsObject = require_is_arguments(); - var isGeneratorFunction = require_is_generator_function(); - var whichTypedArray = require_which_typed_array(); - var isTypedArray = require_is_typed_array(); - function uncurryThis(f) { - return f.call.bind(f); - } - var BigIntSupported = typeof BigInt !== "undefined"; - var SymbolSupported = typeof Symbol !== "undefined"; - var ObjectToString = uncurryThis(Object.prototype.toString); - var numberValue = uncurryThis(Number.prototype.valueOf); - var stringValue = uncurryThis(String.prototype.valueOf); - var booleanValue = uncurryThis(Boolean.prototype.valueOf); - if (BigIntSupported) { - bigIntValue = uncurryThis(BigInt.prototype.valueOf); - } - var bigIntValue; - if (SymbolSupported) { - symbolValue = uncurryThis(Symbol.prototype.valueOf); - } - var symbolValue; - function checkBoxedPrimitive(value, prototypeValueOf) { - if (typeof value !== "object") { - return false; - } - try { - prototypeValueOf(value); - return true; - } catch (e) { - return false; - } - } - exports.isArgumentsObject = isArgumentsObject; - exports.isGeneratorFunction = isGeneratorFunction; - exports.isTypedArray = isTypedArray; - function isPromise(input) { - return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function"; - } - exports.isPromise = isPromise; - function isArrayBufferView(value) { - if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - return ArrayBuffer.isView(value); - } - return isTypedArray(value) || isDataView(value); - } - exports.isArrayBufferView = isArrayBufferView; - function isUint8Array(value) { - return whichTypedArray(value) === "Uint8Array"; - } - exports.isUint8Array = isUint8Array; - function isUint8ClampedArray(value) { - return whichTypedArray(value) === "Uint8ClampedArray"; - } - exports.isUint8ClampedArray = isUint8ClampedArray; - function isUint16Array(value) { - return whichTypedArray(value) === "Uint16Array"; - } - exports.isUint16Array = isUint16Array; - function isUint32Array(value) { - return whichTypedArray(value) === "Uint32Array"; - } - exports.isUint32Array = isUint32Array; - function isInt8Array(value) { - return whichTypedArray(value) === "Int8Array"; - } - exports.isInt8Array = isInt8Array; - function isInt16Array(value) { - return whichTypedArray(value) === "Int16Array"; - } - exports.isInt16Array = isInt16Array; - function isInt32Array(value) { - return whichTypedArray(value) === "Int32Array"; - } - exports.isInt32Array = isInt32Array; - function isFloat32Array(value) { - return whichTypedArray(value) === "Float32Array"; - } - exports.isFloat32Array = isFloat32Array; - function isFloat64Array(value) { - return whichTypedArray(value) === "Float64Array"; - } - exports.isFloat64Array = isFloat64Array; - function isBigInt64Array(value) { - return whichTypedArray(value) === "BigInt64Array"; - } - exports.isBigInt64Array = isBigInt64Array; - function isBigUint64Array(value) { - return whichTypedArray(value) === "BigUint64Array"; - } - exports.isBigUint64Array = isBigUint64Array; - function isMapToString(value) { - return ObjectToString(value) === "[object Map]"; - } - isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map()); - function isMap(value) { - if (typeof Map === "undefined") { - return false; - } - return isMapToString.working ? isMapToString(value) : value instanceof Map; - } - exports.isMap = isMap; - function isSetToString(value) { - return ObjectToString(value) === "[object Set]"; - } - isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set()); - function isSet(value) { - if (typeof Set === "undefined") { - return false; - } - return isSetToString.working ? isSetToString(value) : value instanceof Set; - } - exports.isSet = isSet; - function isWeakMapToString(value) { - return ObjectToString(value) === "[object WeakMap]"; - } - isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap()); - function isWeakMap(value) { - if (typeof WeakMap === "undefined") { - return false; - } - return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; - } - exports.isWeakMap = isWeakMap; - function isWeakSetToString(value) { - return ObjectToString(value) === "[object WeakSet]"; - } - isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet()); - function isWeakSet(value) { - return isWeakSetToString(value); - } - exports.isWeakSet = isWeakSet; - function isArrayBufferToString(value) { - return ObjectToString(value) === "[object ArrayBuffer]"; - } - isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer()); - function isArrayBuffer(value) { - if (typeof ArrayBuffer === "undefined") { - return false; - } - return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; - } - exports.isArrayBuffer = isArrayBuffer; - function isDataViewToString(value) { - return ObjectToString(value) === "[object DataView]"; - } - isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)); - function isDataView(value) { - if (typeof DataView === "undefined") { - return false; - } - return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; - } - exports.isDataView = isDataView; - var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0; - function isSharedArrayBufferToString(value) { - return ObjectToString(value) === "[object SharedArrayBuffer]"; - } - function isSharedArrayBuffer(value) { - if (typeof SharedArrayBufferCopy === "undefined") { - return false; - } - if (typeof isSharedArrayBufferToString.working === "undefined") { - isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); + return Math.floor(hwm); } - return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy; - } - exports.isSharedArrayBuffer = isSharedArrayBuffer; - function isAsyncFunction(value) { - return ObjectToString(value) === "[object AsyncFunction]"; - } - exports.isAsyncFunction = isAsyncFunction; - function isMapIterator(value) { - return ObjectToString(value) === "[object Map Iterator]"; - } - exports.isMapIterator = isMapIterator; - function isSetIterator(value) { - return ObjectToString(value) === "[object Set Iterator]"; - } - exports.isSetIterator = isSetIterator; - function isGeneratorObject(value) { - return ObjectToString(value) === "[object Generator]"; - } - exports.isGeneratorObject = isGeneratorObject; - function isWebAssemblyCompiledModule(value) { - return ObjectToString(value) === "[object WebAssembly.Module]"; - } - exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); - } - exports.isNumberObject = isNumberObject; - function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); - } - exports.isStringObject = isStringObject; - function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); - } - exports.isBooleanObject = isBooleanObject; - function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); - } - exports.isBigIntObject = isBigIntObject; - function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); - } - exports.isSymbolObject = isSymbolObject; - function isBoxedPrimitive(value) { - return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value); - } - exports.isBoxedPrimitive = isBoxedPrimitive; - function isAnyArrayBuffer(value) { - return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value)); + return state.objectMode ? 16 : 16 * 1024; } - exports.isAnyArrayBuffer = isAnyArrayBuffer; - ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) { - Object.defineProperty(exports, method, { - enumerable: false, - value: function() { - throw new Error(method + " is not supported in userland"); - } - }); - }); - } - }); - - // node_modules/util/support/isBufferBrowser.js - var require_isBufferBrowser = __commonJS({ - "node_modules/util/support/isBufferBrowser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function isBuffer(arg) { - return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function"; + module.exports = { + getHighWaterMark }; } }); @@ -3784,11390 +2926,2457 @@ } }); - // node_modules/util/util.js - var require_util = __commonJS({ - "node_modules/util/util.js"(exports) { + // node_modules/util-deprecate/browser.js + var require_browser = __commonJS({ + "node_modules/util-deprecate/browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for (var i = 0; i < keys.length; i++) { - descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - } - return descriptors; - }; - var formatRegExp = /%[sdj%]/g; - exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(" "); - } - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x2) { - if (x2 === "%%") - return "%"; - if (i >= len) - return x2; - switch (x2) { - case "%s": - return String(args[i++]); - case "%d": - return Number(args[i++]); - case "%j": - try { - return JSON.stringify(args[i++]); - } catch (_) { - return "[Circular]"; - } - default: - return x2; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += " " + x; - } else { - str += " " + inspect(x); - } - } - return str; - }; - exports.deprecate = function(fn, msg) { - if (typeof process !== "undefined" && process.noDeprecation === true) { + module.exports = deprecate; + function deprecate(fn, msg) { + if (config("noDeprecation")) { return fn; } - if (typeof process === "undefined") { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } var warned = false; function deprecated() { if (!warned) { - if (process.throwDeprecation) { + if (config("throwDeprecation")) { throw new Error(msg); - } else if (process.traceDeprecation) { + } else if (config("traceDeprecation")) { console.trace(msg); } else { - console.error(msg); + console.warn(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; - }; - var debugs = {}; - var debugEnvRegex = /^$/; - if (process.env.NODE_DEBUG) { - debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(); - debugEnvRegex = new RegExp("^" + debugEnv + "$", "i"); - } - var debugEnv; - exports.debuglog = function(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (debugEnvRegex.test(set)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error("%s %d: %s", set, pid, msg); - }; - } else { - debugs[set] = function() { - }; - } + } + function config(name) { + try { + if (!window.localStorage) + return false; + } catch (_) { + return false; } - return debugs[set]; - }; - function inspect(obj, opts) { - var ctx = { - seen: [], - stylize: stylizeNoColor + var val = window.localStorage[name]; + if (val == null) + return false; + return String(val).toLowerCase() === "true"; + } + } + }); + + // node_modules/readable-stream/lib/_stream_writable.js + var require_stream_writable = __commonJS({ + "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + module.exports = Writable; + function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function() { + onCorkedFinish(_this, state); }; - if (arguments.length >= 3) - ctx.depth = arguments[2]; - if (arguments.length >= 4) - ctx.colors = arguments[3]; - if (isBoolean(opts)) { - ctx.showHidden = opts; - } else if (opts) { - exports._extend(ctx, opts); - } - if (isUndefined(ctx.showHidden)) - ctx.showHidden = false; - if (isUndefined(ctx.depth)) - ctx.depth = 2; - if (isUndefined(ctx.colors)) - ctx.colors = false; - if (isUndefined(ctx.customInspect)) - ctx.customInspect = true; - if (ctx.colors) - ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); - } - exports.inspect = inspect; - inspect.colors = { - "bold": [1, 22], - "italic": [3, 23], - "underline": [4, 24], - "inverse": [7, 27], - "white": [37, 39], - "grey": [90, 39], - "black": [30, 39], - "blue": [34, 39], - "cyan": [36, 39], - "green": [32, 39], - "magenta": [35, 39], - "red": [31, 39], - "yellow": [33, 39] + } + var Duplex; + Writable.WritableState = WritableState; + var internalUtil = { + deprecate: require_browser() }; - inspect.styles = { - "special": "cyan", - "number": "yellow", - "boolean": "yellow", - "undefined": "grey", - "null": "bold", - "string": "green", - "date": "magenta", - "regexp": "red" + var Stream = require_stream_browser(); + var Buffer14 = require_buffer().Buffer; + var OurUint8Array = window.Uint8Array || function() { }; - function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - if (style) { - return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m"; - } else { - return str; - } + function _uint8ArrayToBuffer(chunk) { + return Buffer14.from(chunk); } - function stylizeNoColor(str, styleType) { - return str; + function _isUint8Array(obj) { + return Buffer14.isBuffer(obj) || obj instanceof OurUint8Array; } - function arrayToHash(array) { - var hash2 = {}; - array.forEach(function(val, idx) { - hash2[val] = true; - }); - return hash2; + var destroyImpl = require_destroy(); + var _require = require_state(); + var getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require_errors_browser().codes; + var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; + var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE; + var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES; + var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END; + var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; + var errorOrDestroy = destroyImpl.errorOrDestroy; + require_inherits_browser()(Writable, Stream); + function nop() { } - function formatValue(ctx, value, recurseTimes) { - if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; + function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + if (typeof isDuplex !== "boolean") + isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex); + this.finalCalled = false; + this.needDrain = false; + this.ending = false; + this.ended = false; + this.finished = false; + this.destroyed = false; + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.length = 0; + this.writing = false; + this.corked = 0; + this.sync = true; + this.bufferProcessing = false; + this.onwrite = function(er) { + onwrite(stream, er); + }; + this.writecb = null; + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + this.pendingcb = 0; + this.prefinished = false; + this.errorEmitted = false; + this.emitClose = options.emitClose !== false; + this.autoDestroy = !!options.autoDestroy; + this.bufferedRequestCount = 0; + this.corkedRequestsFree = new CorkedRequest(this); + } + WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; + }; + (function() { + try { + Object.defineProperty(WritableState.prototype, "buffer", { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") + }); + } catch (_) { + } + })(); + var realHasInstance; + if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) + return true; + if (this !== Writable) + return false; + return object && object._writableState instanceof WritableState; + } + }); + } else { + realHasInstance = function realHasInstance2(object) { + return object instanceof this; + }; + } + function Writable(options) { + Duplex = Duplex || require_stream_duplex(); + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) + return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + this.writable = true; + if (options) { + if (typeof options.write === "function") + this._write = options.write; + if (typeof options.writev === "function") + this._writev = options.writev; + if (typeof options.destroy === "function") + this._destroy = options.destroy; + if (typeof options.final === "function") + this._final = options.final; } - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; + Stream.call(this); + } + Writable.prototype.pipe = function() { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); + }; + function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + errorOrDestroy(stream, er); + process.nextTick(cb, er); + } + function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== "string" && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); } - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; } - if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) { - return formatError(value); + return true; + } + Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer14.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); } - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ": " + value.name : ""; - return ctx.stylize("[Function" + name + "]", "special"); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), "date"); - } - if (isError(value)) { - return formatError(value); - } + if (typeof encoding === "function") { + cb = encoding; + encoding = null; } - var base = "", array = false, braces = ["{", "}"]; - if (isArray(value)) { - array = true; - braces = ["[", "]"]; + if (isBuf) + encoding = "buffer"; + else if (!encoding) + encoding = state.defaultEncoding; + if (typeof cb !== "function") + cb = nop; + if (state.ending) + writeAfterEnd(this, cb); + else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } - if (isFunction(value)) { - var n = value.name ? ": " + value.name : ""; - base = " [Function" + n + "]"; + return ret; + }; + Writable.prototype.cork = function() { + this._writableState.corked++; + }; + Writable.prototype.uncork = function() { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) + clearBuffer(this, state); } - if (isRegExp(value)) { - base = " " + RegExp.prototype.toString.call(value); + }; + Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + if (typeof encoding === "string") + encoding = encoding.toLowerCase(); + if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) + throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; + }; + Object.defineProperty(Writable.prototype, "writableBuffer", { + enumerable: false, + get: function get2() { + return this._writableState && this._writableState.getBuffer(); } - if (isDate(value)) { - base = " " + Date.prototype.toUTCString.call(value); + }); + function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { + chunk = Buffer14.from(chunk, encoding); } - if (isError(value)) { - base = " " + formatError(value); + return chunk; + } + Object.defineProperty(Writable.prototype, "writableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._writableState.highWaterMark; } - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; + }); + function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = "buffer"; + chunk = newChunk; + } } - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + if (!ret) + state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk, + encoding, + isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; } else { - return ctx.stylize("[Object]", "special"); + state.bufferedRequest = state.lastBufferedRequest; } - } - ctx.seen.push(value); - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + state.bufferedRequestCount += 1; } else { - output = keys.map(function(key2) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key2, array); - }); + doWrite(stream, state, false, len, chunk, encoding, cb); } - ctx.seen.pop(); - return reduceToSingleString(output, base, braces); + return ret; + } + function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) + state.onwrite(new ERR_STREAM_DESTROYED("write")); + else if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); + state.sync = false; } - function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize("undefined", "undefined"); - if (isString(value)) { - var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; - return ctx.stylize(simple, "string"); + function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + process.nextTick(cb, er); + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + finishMaybe(stream, state); } - if (isNumber(value)) - return ctx.stylize("" + value, "number"); - if (isBoolean(value)) - return ctx.stylize("" + value, "boolean"); - if (isNull(value)) - return ctx.stylize("null", "null"); } - function formatError(value) { - return "[" + Error.prototype.toString.call(value) + "]"; + function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; } - function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); - } else { - output.push(""); - } - } - keys.forEach(function(key2) { - if (!key2.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key2, true)); + function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== "function") + throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) + onwriteError(stream, state, sync, er, cb); + else { + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); } - }); - return output; - } - function formatProperty(ctx, value, recurseTimes, visibleKeys, key2, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key2) || { value: value[key2] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize("[Getter/Setter]", "special"); + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); } else { - str = ctx.stylize("[Getter]", "special"); - } - } else { - if (desc.set) { - str = ctx.stylize("[Setter]", "special"); + afterWrite(stream, state, finished, cb); } } - if (!hasOwnProperty(visibleKeys, key2)) { - name = "[" + key2 + "]"; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf("\n") > -1) { - if (array) { - str = str.split("\n").map(function(line) { - return " " + line; - }).join("\n").substr(2); - } else { - str = "\n" + str.split("\n").map(function(line) { - return " " + line; - }).join("\n"); - } - } - } else { - str = ctx.stylize("[Circular]", "special"); - } + } + function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); + } + function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit("drain"); } - if (isUndefined(name)) { - if (array && key2.match(/^\d+$/)) { - return str; + } + function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) + allBuffers = false; + entry = entry.next; + count += 1; } - name = JSON.stringify("" + key2); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, "name"); + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, "", holder.finish); + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; } else { - name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, "string"); - } - } - return name + ": " + str; - } - function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf("\n") >= 0) - numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1; - }, 0); - if (length > 60) { - return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1]; - } - return braces[0] + base + " " + output.join(", ") + " " + braces[1]; - } - exports.types = require_types(); - function isArray(ar) { - return Array.isArray(ar); - } - exports.isArray = isArray; - function isBoolean(arg) { - return typeof arg === "boolean"; - } - exports.isBoolean = isBoolean; - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; - function isNumber(arg) { - return typeof arg === "number"; - } - exports.isNumber = isNumber; - function isString(arg) { - return typeof arg === "string"; - } - exports.isString = isString; - function isSymbol(arg) { - return typeof arg === "symbol"; - } - exports.isSymbol = isSymbol; - function isUndefined(arg) { - return arg === void 0; - } - exports.isUndefined = isUndefined; - function isRegExp(re) { - return isObject(re) && objectToString(re) === "[object RegExp]"; - } - exports.isRegExp = isRegExp; - exports.types.isRegExp = isRegExp; - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - exports.isObject = isObject; - function isDate(d) { - return isObject(d) && objectToString(d) === "[object Date]"; - } - exports.isDate = isDate; - exports.types.isDate = isDate; - function isError(e) { - return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error); - } - exports.isError = isError; - exports.types.isNativeError = isError; - function isFunction(arg) { - return typeof arg === "function"; - } - exports.isFunction = isFunction; - function isPrimitive(arg) { - return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined"; - } - exports.isPrimitive = isPrimitive; - exports.isBuffer = require_isBufferBrowser(); - function objectToString(o) { - return Object.prototype.toString.call(o); - } - function pad(n) { - return n < 10 ? "0" + n.toString(10) : n.toString(10); - } - var months = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ]; - function timestamp() { - var d = new Date(); - var time = [ - pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds()) - ].join(":"); - return [d.getDate(), months[d.getMonth()], time].join(" "); - } - exports.log = function() { - console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments)); + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + if (state.writing) { + break; + } + } + if (entry === null) + state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; + } + Writable.prototype._write = function(chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); }; - exports.inherits = require_inherits_browser(); - exports._extend = function(origin, add) { - if (!add || !isObject(add)) - return origin; - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; + Writable.prototype._writev = null; + Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === "function") { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === "function") { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== void 0) + this.write(chunk, encoding); + if (state.corked) { + state.corked = 1; + this.uncork(); + } + if (!state.ending) + endWritable(this, state, cb); + return this; }; - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0; - exports.promisify = function promisify(original) { - if (typeof original !== "function") - throw new TypeError('The "original" argument must be of type Function'); - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if (typeof fn !== "function") { - throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return fn; + Object.defineProperty(Writable.prototype, "writableLength", { + enumerable: false, + get: function get2() { + return this._writableState.length; } - function fn() { - var promiseResolve, promiseReject; - var promise2 = new Promise(function(resolve2, reject) { - promiseResolve = resolve2; - promiseReject = reject; - }); - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); + }); + function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; + } + function callFinal(stream, state) { + stream._final(function(err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); } - args.push(function(err, value) { - if (err) { - promiseReject(err); - } else { - promiseResolve(value); + state.prefinished = true; + stream.emit("prefinish"); + finishMaybe(stream, state); + }); + } + function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === "function" && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit("prefinish"); + } + } + } + function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit("finish"); + if (state.autoDestroy) { + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } } - }); - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); } - return promise2; } - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - if (kCustomPromisifiedSymbol) - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return Object.defineProperties(fn, getOwnPropertyDescriptors(original)); - }; - exports.promisify.custom = kCustomPromisifiedSymbol; - function callbackifyOnRejected(reason, cb) { - if (!reason) { - var newReason = new Error("Promise was rejected with a falsy value"); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); - } - function callbackify(original) { - if (typeof original !== "function") { - throw new TypeError('The "original" argument must be of type Function'); - } - function callbackified() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - var maybeCb = args.pop(); - if (typeof maybeCb !== "function") { - throw new TypeError("The last argument must be of type Function"); - } - var self = this; - var cb = function() { - return maybeCb.apply(self, arguments); - }; - original.apply(this, args).then(function(ret) { - process.nextTick(cb.bind(null, null, ret)); - }, function(rej) { - process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); - }); + return need; + } + function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once("finish", cb); + } + state.ended = true; + stream.writable = false; + } + function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; } - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)); - return callbackified; + state.corkedRequestsFree.next = corkReq; } - exports.callbackify = callbackify; + Object.defineProperty(Writable.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._writableState === void 0) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + if (!this._writableState) { + return; + } + this._writableState.destroyed = value; + } + }); + Writable.prototype.destroy = destroyImpl.destroy; + Writable.prototype._undestroy = destroyImpl.undestroy; + Writable.prototype._destroy = function(err, cb) { + cb(err); + }; } }); - // node_modules/assert-browserify/build/internal/errors.js - var require_errors = __commonJS({ - "node_modules/assert-browserify/build/internal/errors.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_duplex.js + var require_stream_duplex = __commonJS({ + "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + var objectKeys = Object.keys || function(obj) { + var keys2 = []; + for (var key2 in obj) { + keys2.push(key2); } - return _typeof2(obj); - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + return keys2; + }; + module.exports = Duplex; + var Readable = require_stream_readable(); + var Writable = require_stream_writable(); + require_inherits_browser()(Duplex, Readable); + { + keys = objectKeys(Writable.prototype); + for (v = 0; v < keys.length; v++) { + method = keys[v]; + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; } } - function _possibleConstructorReturn(self, call) { - if (call && (_typeof2(call) === "object" || typeof call === "function")) { - return call; + var keys; + var method; + var v; + function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) + this.readable = false; + if (options.writable === false) + this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once("end", onend); + } } - return _assertThisInitialized(self); } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._writableState.highWaterMark; } - return self; - } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); - } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + }); + Object.defineProperty(Duplex.prototype, "writableBuffer", { + enumerable: false, + get: function get2() { + return this._writableState && this._writableState.getBuffer(); + } + }); + Object.defineProperty(Duplex.prototype, "writableLength", { + enumerable: false, + get: function get2() { + return this._writableState.length; } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - if (superClass) - _setPrototypeOf(subClass, superClass); + }); + function onend() { + if (this._writableState.ended) + return; + process.nextTick(onEndNT, this); } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); + function onEndNT(self) { + self.end(); } - var codes = {}; - var assert; - var util; - function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - function getMessage(arg1, arg2, arg3) { - if (typeof message === "string") { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - var NodeError = /* @__PURE__ */ function(_Base) { - _inherits(NodeError2, _Base); - function NodeError2(arg1, arg2, arg3) { - var _this; - _classCallCheck(this, NodeError2); - _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError2).call(this, getMessage(arg1, arg2, arg3))); - _this.code = code; - return _this; + Object.defineProperty(Duplex.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._readableState === void 0 || this._writableState === void 0) { + return false; } - return NodeError2; - }(Base); - codes[code] = NodeError; - } - function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function(i) { - return String(i); - }); - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + if (this._readableState === void 0 || this._writableState === void 0) { + return; } - } else { - return "of ".concat(thing, " ").concat(String(expected)); + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } + }); + } + }); + + // node_modules/safe-buffer/index.js + var require_safe_buffer = __commonJS({ + "node_modules/safe-buffer/index.js"(exports, module) { + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var buffer = require_buffer(); + var Buffer14 = buffer.Buffer; + function copyProps(src, dst) { + for (var key2 in src) { + dst[key2] = src[key2]; } } - function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; + if (Buffer14.from && Buffer14.alloc && Buffer14.allocUnsafe && Buffer14.allocUnsafeSlow) { + module.exports = buffer; + } else { + copyProps(buffer, exports); + exports.Buffer = SafeBuffer; } - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; - } - return str.substring(this_len - search.length, this_len) === search; + function SafeBuffer(arg, encodingOrOffset, length) { + return Buffer14(arg, encodingOrOffset, length); } - function includes(str, search, start) { - if (typeof start !== "number") { - start = 0; - } - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; + SafeBuffer.prototype = Object.create(Buffer14.prototype); + copyProps(Buffer14, SafeBuffer); + SafeBuffer.from = function(arg, encodingOrOffset, length) { + if (typeof arg === "number") { + throw new TypeError("Argument must not be a number"); } - } - createErrorType("ERR_AMBIGUOUS_ARGUMENT", 'The "%s" argument is ambiguous. %s', TypeError); - createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { - if (assert === void 0) - assert = require_assert(); - assert(typeof name === "string", "'name' must be a string"); - var determiner; - if (typeof expected === "string" && startsWith(expected, "not ")) { - determiner = "must not be"; - expected = expected.replace(/^not /, ""); - } else { - determiner = "must be"; + return Buffer14(arg, encodingOrOffset, length); + }; + SafeBuffer.alloc = function(size, fill, encoding) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } - var msg; - if (endsWith(name, " argument")) { - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + var buf2 = Buffer14(size); + if (fill !== void 0) { + if (typeof encoding === "string") { + buf2.fill(fill, encoding); + } else { + buf2.fill(fill); + } } else { - var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + buf2.fill(0); } - msg += ". Received type ".concat(_typeof2(actual)); - return msg; - }, TypeError); - createErrorType("ERR_INVALID_ARG_VALUE", function(name, value) { - var reason = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "is invalid"; - if (util === void 0) - util = require_util(); - var inspected = util.inspect(value); - if (inspected.length > 128) { - inspected = "".concat(inspected.slice(0, 128), "..."); - } - return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected); - }, TypeError, RangeError); - createErrorType("ERR_INVALID_RETURN_VALUE", function(input, name, value) { - var type; - if (value && value.constructor && value.constructor.name) { - type = "instance of ".concat(value.constructor.name); - } else { - type = "type ".concat(_typeof2(value)); + return buf2; + }; + SafeBuffer.allocUnsafe = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } - return "Expected ".concat(input, ' to be returned from the "').concat(name, '"') + " function but got ".concat(type, "."); - }, TypeError); - createErrorType("ERR_MISSING_ARGS", function() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - if (assert === void 0) - assert = require_assert(); - assert(args.length > 0, "At least one arg needs to be specified"); - var msg = "The "; - var len = args.length; - args = args.map(function(a) { - return '"'.concat(a, '"'); - }); - switch (len) { - case 1: - msg += "".concat(args[0], " argument"); - break; - case 2: - msg += "".concat(args[0], " and ").concat(args[1], " arguments"); - break; - default: - msg += args.slice(0, len - 1).join(", "); - msg += ", and ".concat(args[len - 1], " arguments"); - break; + return Buffer14(size); + }; + SafeBuffer.allocUnsafeSlow = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } - return "".concat(msg, " must be specified"); - }, TypeError); - module.exports.codes = codes; + return buffer.SlowBuffer(size); + }; } }); - // node_modules/assert-browserify/build/internal/assert/assertion_error.js - var require_assertion_error = __commonJS({ - "node_modules/assert-browserify/build/internal/assert/assertion_error.js"(exports, module) { + // node_modules/string_decoder/lib/string_decoder.js + var require_string_decoder = __commonJS({ + "node_modules/string_decoder/lib/string_decoder.js"(exports) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === "function") { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); + var Buffer14 = require_safe_buffer().Buffer; + var isEncoding = Buffer14.isEncoding || function(encoding) { + encoding = "" + encoding; + switch (encoding && encoding.toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + case "raw": + return true; + default: + return false; + } + }; + function _normalizeEncoding(enc) { + if (!enc) + return "utf8"; + var retried; + while (true) { + switch (enc) { + case "utf8": + case "utf-8": + return "utf8"; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return "utf16le"; + case "latin1": + case "binary": + return "latin1"; + case "base64": + case "ascii": + case "hex": + return enc; + default: + if (retried) + return; + enc = ("" + enc).toLowerCase(); + retried = true; } - ownKeys.forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }); } - return target; } - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; + function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== "string" && (Buffer14.isEncoding === isEncoding || !isEncoding(enc))) + throw new Error("Unknown encoding: " + enc); + return nenc || enc; } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + exports.StringDecoder = StringDecoder; + function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case "utf16le": + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case "utf8": + this.fillLast = utf8FillLast; + nb = 4; + break; + case "base64": + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer14.allocUnsafe(nb); } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); + StringDecoder.prototype.write = function(buf2) { + if (buf2.length === 0) + return ""; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf2); + if (r === void 0) + return ""; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - function _possibleConstructorReturn(self, call) { - if (call && (_typeof2(call) === "object" || typeof call === "function")) { - return call; + if (i < buf2.length) + return r ? r + this.text(buf2, i) : this.text(buf2, i); + return r || ""; + }; + StringDecoder.prototype.end = utf8End; + StringDecoder.prototype.text = utf8Text; + StringDecoder.prototype.fillLast = function(buf2) { + if (this.lastNeed <= buf2.length) { + buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - return _assertThisInitialized(self); - } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; + buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length); + this.lastNeed -= buf2.length; + }; + function utf8CheckByte(byte) { + if (byte <= 127) + return 0; + else if (byte >> 5 === 6) + return 2; + else if (byte >> 4 === 14) + return 3; + else if (byte >> 3 === 30) + return 4; + return byte >> 6 === 2 ? -1 : -2; } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + function utf8CheckIncomplete(self, buf2, i) { + var j = buf2.length - 1; + if (j < i) + return 0; + var nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) + self.lastNeed = nb - 1; + return nb; } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - if (superClass) - _setPrototypeOf(subClass, superClass); - } - function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; - _wrapNativeSuper = function _wrapNativeSuper2(Class2) { - if (Class2 === null || !_isNativeFunction(Class2)) - return Class2; - if (typeof Class2 !== "function") { - throw new TypeError("Super expression must either be null or a function"); + if (--j < i || nb === -2) + return 0; + nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) + self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) + return 0; + nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) + nb = 0; + else + self.lastNeed = nb - 3; } - if (typeof _cache !== "undefined") { - if (_cache.has(Class2)) - return _cache.get(Class2); - _cache.set(Class2, Wrapper); + return nb; + } + return 0; + } + function utf8CheckExtraBytes(self, buf2, p) { + if ((buf2[0] & 192) !== 128) { + self.lastNeed = 0; + return "\uFFFD"; + } + if (self.lastNeed > 1 && buf2.length > 1) { + if ((buf2[1] & 192) !== 128) { + self.lastNeed = 1; + return "\uFFFD"; } - function Wrapper() { - return _construct(Class2, arguments, _getPrototypeOf(this).constructor); + if (self.lastNeed > 2 && buf2.length > 2) { + if ((buf2[2] & 192) !== 128) { + self.lastNeed = 2; + return "\uFFFD"; + } } - Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); - return _setPrototypeOf(Wrapper, Class2); - }; - return _wrapNativeSuper(Class); - } - function isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) - return false; - if (Reflect.construct.sham) - return false; - if (typeof Proxy === "function") - return true; - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function() { - })); - return true; - } catch (e) { - return false; } } - function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct2(Parent2, args2, Class2) { - var a = [null]; - a.push.apply(a, args2); - var Constructor = Function.bind.apply(Parent2, a); - var instance18 = new Constructor(); - if (Class2) - _setPrototypeOf(instance18, Class2.prototype); - return instance18; - }; + function utf8FillLast(buf2) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf2, p); + if (r !== void 0) + return r; + if (this.lastNeed <= buf2.length) { + buf2.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - return _construct.apply(null, arguments); - } - function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; + buf2.copy(this.lastChar, p, 0, buf2.length); + this.lastNeed -= buf2.length; } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); + function utf8Text(buf2, i) { + var total = utf8CheckIncomplete(this, buf2, i); + if (!this.lastNeed) + return buf2.toString("utf8", i); + this.lastTotal = total; + var end = buf2.length - (total - this.lastNeed); + buf2.copy(this.lastChar, 0, end); + return buf2.toString("utf8", i, end); } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); + function utf8End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) + return r + "\uFFFD"; + return r; } - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + function utf16Text(buf2, i) { + if ((buf2.length - i) % 2 === 0) { + var r = buf2.toString("utf16le", i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 55296 && c <= 56319) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf2[buf2.length - 2]; + this.lastChar[1] = buf2[buf2.length - 1]; + return r.slice(0, -1); + } + } + return r; } - return _typeof2(obj); + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf2[buf2.length - 1]; + return buf2.toString("utf16le", i, buf2.length - 1); } - var _require = require_util(); - var inspect = _require.inspect; - var _require2 = require_errors(); - var ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; + function utf16End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString("utf16le", 0, end); } - return str.substring(this_len - search.length, this_len) === search; + return r; } - function repeat(str, count) { - count = Math.floor(count); - if (str.length == 0 || count == 0) - return ""; - var maxCount = str.length * count; - count = Math.floor(Math.log(count) / Math.log(2)); - while (count) { - str += str; - count--; + function base64Text(buf2, i) { + var n = (buf2.length - i) % 3; + if (n === 0) + return buf2.toString("base64", i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf2[buf2.length - 1]; + } else { + this.lastChar[0] = buf2[buf2.length - 2]; + this.lastChar[1] = buf2[buf2.length - 1]; } - str += str.substring(0, maxCount - str.length); - return str; + return buf2.toString("base64", i, buf2.length - n); } - var blue = ""; - var green = ""; - var red = ""; - var white = ""; - var kReadableOperator = { - deepStrictEqual: "Expected values to be strictly deep-equal:", - strictEqual: "Expected values to be strictly equal:", - strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', - deepEqual: "Expected values to be loosely deep-equal:", - equal: "Expected values to be loosely equal:", - notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', - notStrictEqual: 'Expected "actual" to be strictly unequal to:', - notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', - notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', - notEqual: 'Expected "actual" to be loosely unequal to:', - notIdentical: "Values identical but not reference-equal:" - }; - var kMaxShortLength = 10; - function copyError(source) { - var keys = Object.keys(source); - var target = Object.create(Object.getPrototypeOf(source)); - keys.forEach(function(key2) { - target[key2] = source[key2]; - }); - Object.defineProperty(target, "message", { - value: source.message - }); - return target; + function base64End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) + return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); + return r; } - function inspectValue(val) { - return inspect(val, { - compact: false, - customInspect: false, - depth: 1e3, - maxArrayLength: Infinity, - showHidden: false, - breakLength: Infinity, - showProxy: false, - sorted: true, - getters: true - }); + function simpleWrite(buf2) { + return buf2.toString(this.encoding); } - function createErrDiff(actual, expected, operator) { - var other = ""; - var res = ""; - var lastPos = 0; - var end = ""; - var skipped = false; - var actualInspected = inspectValue(actual); - var actualLines = actualInspected.split("\n"); - var expectedLines = inspectValue(expected).split("\n"); - var i = 0; - var indicator = ""; - if (operator === "strictEqual" && _typeof2(actual) === "object" && _typeof2(expected) === "object" && actual !== null && expected !== null) { - operator = "strictEqualObject"; - } - if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) { - var inputLength = actualLines[0].length + expectedLines[0].length; - if (inputLength <= kMaxShortLength) { - if ((_typeof2(actual) !== "object" || actual === null) && (_typeof2(expected) !== "object" || expected === null) && (actual !== 0 || expected !== 0)) { - return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n"); - } - } else if (operator !== "strictEqualObject") { - var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80; - if (inputLength < maxLength) { - while (actualLines[0][i] === expectedLines[0][i]) { - i++; - } - if (i > 2) { - indicator = "\n ".concat(repeat(" ", i), "^"); - i = 0; - } - } - } - } - var a = actualLines[actualLines.length - 1]; - var b = expectedLines[expectedLines.length - 1]; - while (a === b) { - if (i++ < 2) { - end = "\n ".concat(a).concat(end); - } else { - other = a; - } - actualLines.pop(); - expectedLines.pop(); - if (actualLines.length === 0 || expectedLines.length === 0) - break; - a = actualLines[actualLines.length - 1]; - b = expectedLines[expectedLines.length - 1]; - } - var maxLines = Math.max(actualLines.length, expectedLines.length); - if (maxLines === 0) { - var _actualLines = actualInspected.split("\n"); - if (_actualLines.length > 30) { - _actualLines[26] = "".concat(blue, "...").concat(white); - while (_actualLines.length > 27) { - _actualLines.pop(); - } - } - return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join("\n"), "\n"); - } - if (i > 3) { - end = "\n".concat(blue, "...").concat(white).concat(end); - skipped = true; - } - if (other !== "") { - end = "\n ".concat(other).concat(end); - other = ""; - } - var printedLines = 0; - var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white); - var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped"); - for (i = 0; i < maxLines; i++) { - var cur = i - lastPos; - if (actualLines.length < i + 1) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(expectedLines[i - 2]); - printedLines++; - } - res += "\n ".concat(expectedLines[i - 1]); - printedLines++; - } - lastPos = i; - other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]); - printedLines++; - } else if (expectedLines.length < i + 1) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(actualLines[i - 2]); - printedLines++; - } - res += "\n ".concat(actualLines[i - 1]); - printedLines++; - } - lastPos = i; - res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]); - printedLines++; - } else { - var expectedLine = expectedLines[i]; - var actualLine = actualLines[i]; - var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ",") || actualLine.slice(0, -1) !== expectedLine); - if (divergingLines && endsWith(expectedLine, ",") && expectedLine.slice(0, -1) === actualLine) { - divergingLines = false; - actualLine += ","; - } - if (divergingLines) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(actualLines[i - 2]); - printedLines++; - } - res += "\n ".concat(actualLines[i - 1]); - printedLines++; - } - lastPos = i; - res += "\n".concat(green, "+").concat(white, " ").concat(actualLine); - other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine); - printedLines += 2; - } else { - res += other; - other = ""; - if (cur === 1 || i === 0) { - res += "\n ".concat(actualLine); - printedLines++; - } - } - } - if (printedLines > 20 && i < maxLines - 2) { - return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white); - } - } - return "".concat(msg).concat(skipped ? skippedMsg : "", "\n").concat(res).concat(other).concat(end).concat(indicator); + function simpleEnd(buf2) { + return buf2 && buf2.length ? this.write(buf2) : ""; } - var AssertionError = /* @__PURE__ */ function(_Error) { - _inherits(AssertionError2, _Error); - function AssertionError2(options) { - var _this; - _classCallCheck(this, AssertionError2); - if (_typeof2(options) !== "object" || options === null) { - throw new ERR_INVALID_ARG_TYPE("options", "Object", options); - } - var message = options.message, operator = options.operator, stackStartFn = options.stackStartFn; - var actual = options.actual, expected = options.expected; - var limit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - if (message != null) { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, String(message))); - } else { - if (process.stderr && process.stderr.isTTY) { - if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) { - blue = "\x1B[34m"; - green = "\x1B[32m"; - white = "\x1B[39m"; - red = "\x1B[31m"; - } else { - blue = ""; - green = ""; - white = ""; - red = ""; - } - } - if (_typeof2(actual) === "object" && actual !== null && _typeof2(expected) === "object" && expected !== null && "stack" in actual && actual instanceof Error && "stack" in expected && expected instanceof Error) { - actual = copyError(actual); - expected = copyError(expected); - } - if (operator === "deepStrictEqual" || operator === "strictEqual") { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, createErrDiff(actual, expected, operator))); - } else if (operator === "notDeepStrictEqual" || operator === "notStrictEqual") { - var base = kReadableOperator[operator]; - var res = inspectValue(actual).split("\n"); - if (operator === "notStrictEqual" && _typeof2(actual) === "object" && actual !== null) { - base = kReadableOperator.notStrictEqualObject; - } - if (res.length > 30) { - res[26] = "".concat(blue, "...").concat(white); - while (res.length > 27) { - res.pop(); - } - } - if (res.length === 1) { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(base, " ").concat(res[0]))); - } else { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(base, "\n\n").concat(res.join("\n"), "\n"))); - } - } else { - var _res = inspectValue(actual); - var other = ""; - var knownOperators = kReadableOperator[operator]; - if (operator === "notDeepEqual" || operator === "notEqual") { - _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res); - if (_res.length > 1024) { - _res = "".concat(_res.slice(0, 1021), "..."); - } - } else { - other = "".concat(inspectValue(expected)); - if (_res.length > 512) { - _res = "".concat(_res.slice(0, 509), "..."); - } - if (other.length > 512) { - other = "".concat(other.slice(0, 509), "..."); - } - if (operator === "deepEqual" || operator === "equal") { - _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n"); - } else { - other = " ".concat(operator, " ").concat(other); - } - } - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(_res).concat(other))); - } - } - Error.stackTraceLimit = limit; - _this.generatedMessage = !message; - Object.defineProperty(_assertThisInitialized(_this), "name", { - value: "AssertionError [ERR_ASSERTION]", - enumerable: false, - writable: true, - configurable: true - }); - _this.code = "ERR_ASSERTION"; - _this.actual = actual; - _this.expected = expected; - _this.operator = operator; - if (Error.captureStackTrace) { - Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn); - } - _this.stack; - _this.name = "AssertionError"; - return _possibleConstructorReturn(_this); - } - _createClass(AssertionError2, [{ - key: "toString", - value: function toString2() { - return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); - } - }, { - key: inspect.custom, - value: function value(recurseTimes, ctx) { - return inspect(this, _objectSpread({}, ctx, { - customInspect: false, - depth: 0 - })); - } - }]); - return AssertionError2; - }(_wrapNativeSuper(Error)); - module.exports = AssertionError; } }); - // node_modules/es6-object-assign/index.js - var require_es6_object_assign = __commonJS({ - "node_modules/es6-object-assign/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/end-of-stream.js + var require_end_of_stream = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function assign2(target, firstSource) { - if (target === void 0 || target === null) { - throw new TypeError("Cannot convert first argument to object"); - } - var to = Object(target); - for (var i = 1; i < arguments.length; i++) { - var nextSource = arguments[i]; - if (nextSource === void 0 || nextSource === null) { - continue; - } - var keysArray = Object.keys(Object(nextSource)); - for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { - var nextKey = keysArray[nextIndex]; - var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); - if (desc !== void 0 && desc.enumerable) { - to[nextKey] = nextSource[nextKey]; - } + var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE; + function once(callback) { + var called = false; + return function() { + if (called) + return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - } - return to; + callback.apply(this, args); + }; } - function polyfill() { - if (!Object.assign) { - Object.defineProperty(Object, "assign", { - enumerable: false, - configurable: true, - writable: true, - value: assign2 - }); - } + function noop3() { } - module.exports = { - assign: assign2, - polyfill - }; - } - }); - - // node_modules/object-keys/isArguments.js - var require_isArguments = __commonJS({ - "node_modules/object-keys/isArguments.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var toStr = Object.prototype.toString; - module.exports = function isArguments(value) { - var str = toStr.call(value); - var isArgs = str === "[object Arguments]"; - if (!isArgs) { - isArgs = str !== "[object Array]" && value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && toStr.call(value.callee) === "[object Function]"; - } - return isArgs; - }; - } - }); - - // node_modules/object-keys/implementation.js - var require_implementation2 = __commonJS({ - "node_modules/object-keys/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var keysShim; - if (!Object.keys) { - has = Object.prototype.hasOwnProperty; - toStr = Object.prototype.toString; - isArgs = require_isArguments(); - isEnumerable = Object.prototype.propertyIsEnumerable; - hasDontEnumBug = !isEnumerable.call({ toString: null }, "toString"); - hasProtoEnumBug = isEnumerable.call(function() { - }, "prototype"); - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ]; - equalsConstructorPrototype = function(o) { - var ctor = o.constructor; - return ctor && ctor.prototype === o; - }; - excludedKeys = { - $applicationCache: true, - $console: true, - $external: true, - $frame: true, - $frameElement: true, - $frames: true, - $innerHeight: true, - $innerWidth: true, - $onmozfullscreenchange: true, - $onmozfullscreenerror: true, - $outerHeight: true, - $outerWidth: true, - $pageXOffset: true, - $pageYOffset: true, - $parent: true, - $scrollLeft: true, - $scrollTop: true, - $scrollX: true, - $scrollY: true, - $self: true, - $webkitIndexedDB: true, - $webkitStorageInfo: true, - $window: true - }; - hasAutomationEqualityBug = function() { - if (typeof window === "undefined") { - return false; - } - for (var k in window) { - try { - if (!excludedKeys["$" + k] && has.call(window, k) && window[k] !== null && typeof window[k] === "object") { - try { - equalsConstructorPrototype(window[k]); - } catch (e) { - return true; - } - } - } catch (e) { - return true; - } - } - return false; - }(); - equalsConstructorPrototypeIfNotBuggy = function(o) { - if (typeof window === "undefined" || !hasAutomationEqualityBug) { - return equalsConstructorPrototype(o); - } - try { - return equalsConstructorPrototype(o); - } catch (e) { - return false; - } + function isRequest(stream) { + return stream.setHeader && typeof stream.abort === "function"; + } + function eos(stream, opts, callback) { + if (typeof opts === "function") + return eos(stream, null, opts); + if (!opts) + opts = {}; + callback = once(callback || noop3); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable2 = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish2() { + if (!stream.writable) + onfinish(); }; - keysShim = function keys(object) { - var isObject = object !== null && typeof object === "object"; - var isFunction = toStr.call(object) === "[object Function]"; - var isArguments = isArgs(object); - var isString = isObject && toStr.call(object) === "[object String]"; - var theKeys = []; - if (!isObject && !isFunction && !isArguments) { - throw new TypeError("Object.keys called on a non-object"); - } - var skipProto = hasProtoEnumBug && isFunction; - if (isString && object.length > 0 && !has.call(object, 0)) { - for (var i = 0; i < object.length; ++i) { - theKeys.push(String(i)); - } - } - if (isArguments && object.length > 0) { - for (var j = 0; j < object.length; ++j) { - theKeys.push(String(j)); - } - } else { - for (var name in object) { - if (!(skipProto && name === "prototype") && has.call(object, name)) { - theKeys.push(String(name)); - } - } - } - if (hasDontEnumBug) { - var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); - for (var k = 0; k < dontEnums.length; ++k) { - if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object, dontEnums[k])) { - theKeys.push(dontEnums[k]); - } - } - } - return theKeys; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish2() { + writable2 = false; + writableEnded = true; + if (!readable) + callback.call(stream); }; - } - var has; - var toStr; - var isArgs; - var isEnumerable; - var hasDontEnumBug; - var hasProtoEnumBug; - var dontEnums; - var equalsConstructorPrototype; - var excludedKeys; - var hasAutomationEqualityBug; - var equalsConstructorPrototypeIfNotBuggy; - module.exports = keysShim; - } - }); - - // node_modules/object-keys/index.js - var require_object_keys = __commonJS({ - "node_modules/object-keys/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var slice = Array.prototype.slice; - var isArgs = require_isArguments(); - var origKeys = Object.keys; - var keysShim = origKeys ? function keys(o) { - return origKeys(o); - } : require_implementation2(); - var originalKeys = Object.keys; - keysShim.shim = function shimObjectKeys() { - if (Object.keys) { - var keysWorksWithArguments = function() { - var args = Object.keys(arguments); - return args && args.length === arguments.length; - }(1, 2); - if (!keysWorksWithArguments) { - Object.keys = function keys(object) { - if (isArgs(object)) { - return originalKeys(slice.call(object)); - } - return originalKeys(object); - }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend2() { + readable = false; + readableEnded = true; + if (!writable2) + callback.call(stream); + }; + var onerror = function onerror2(err) { + callback.call(stream, err); + }; + var onclose = function onclose2() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) + err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } - } else { - Object.keys = keysShim; - } - return Object.keys || keysShim; - }; - module.exports = keysShim; - } - }); - - // node_modules/has-property-descriptors/index.js - var require_has_property_descriptors = __commonJS({ - "node_modules/has-property-descriptors/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var hasPropertyDescriptors = function hasPropertyDescriptors2() { - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - return true; - } catch (e) { - return false; + if (writable2 && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) + err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } + }; + var onrequest = function onrequest2() { + stream.req.on("finish", onfinish); + }; + if (isRequest(stream)) { + stream.on("complete", onfinish); + stream.on("abort", onclose); + if (stream.req) + onrequest(); + else + stream.on("request", onrequest); + } else if (writable2 && !stream._writableState) { + stream.on("end", onlegacyfinish); + stream.on("close", onlegacyfinish); } - return false; - }; - hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { - if (!hasPropertyDescriptors()) { - return null; - } - try { - return $defineProperty([], "length", { value: 1 }).length !== 1; - } catch (e) { - return true; - } - }; - module.exports = hasPropertyDescriptors; + stream.on("end", onend); + stream.on("finish", onfinish); + if (opts.error !== false) + stream.on("error", onerror); + stream.on("close", onclose); + return function() { + stream.removeListener("complete", onfinish); + stream.removeListener("abort", onclose); + stream.removeListener("request", onrequest); + if (stream.req) + stream.req.removeListener("finish", onfinish); + stream.removeListener("end", onlegacyfinish); + stream.removeListener("close", onlegacyfinish); + stream.removeListener("finish", onfinish); + stream.removeListener("end", onend); + stream.removeListener("error", onerror); + stream.removeListener("close", onclose); + }; + } + module.exports = eos; } }); - // node_modules/define-properties/index.js - var require_define_properties = __commonJS({ - "node_modules/define-properties/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/async_iterator.js + var require_async_iterator = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var keys = require_object_keys(); - var hasSymbols = typeof Symbol === "function" && typeof Symbol("foo") === "symbol"; - var toStr = Object.prototype.toString; - var concat = Array.prototype.concat; - var origDefineProperty = Object.defineProperty; - var isFunction = function(fn) { - return typeof fn === "function" && toStr.call(fn) === "[object Function]"; - }; - var hasPropertyDescriptors = require_has_property_descriptors()(); - var supportsDescriptors = origDefineProperty && hasPropertyDescriptors; - var defineProperty = function(object, name, value, predicate) { - if (name in object && (!isFunction(predicate) || !predicate())) { - return; - } - if (supportsDescriptors) { - origDefineProperty(object, name, { - configurable: true, - enumerable: false, - value, - writable: true - }); + var _Object$setPrototypeO; + function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { - object[name] = value; - } - }; - var defineProperties = function(object, map) { - var predicates = arguments.length > 2 ? arguments[2] : {}; - var props = keys(map); - if (hasSymbols) { - props = concat.call(props, Object.getOwnPropertySymbols(map)); - } - for (var i = 0; i < props.length; i += 1) { - defineProperty(object, props[i], map[props[i]], predicates[props[i]]); - } - }; - defineProperties.supportsDescriptors = !!supportsDescriptors; - module.exports = defineProperties; - } - }); - - // node_modules/object-is/implementation.js - var require_implementation3 = __commonJS({ - "node_modules/object-is/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var numberIsNaN = function(value) { - return value !== value; - }; - module.exports = function is(a, b) { - if (a === 0 && b === 0) { - return 1 / a === 1 / b; - } - if (a === b) { - return true; - } - if (numberIsNaN(a) && numberIsNaN(b)) { - return true; - } - return false; - }; - } - }); - - // node_modules/object-is/polyfill.js - var require_polyfill = __commonJS({ - "node_modules/object-is/polyfill.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation3(); - module.exports = function getPolyfill() { - return typeof Object.is === "function" ? Object.is : implementation; - }; - } - }); - - // node_modules/object-is/shim.js - var require_shim = __commonJS({ - "node_modules/object-is/shim.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var getPolyfill = require_polyfill(); - var define2 = require_define_properties(); - module.exports = function shimObjectIs() { - var polyfill = getPolyfill(); - define2(Object, { is: polyfill }, { - is: function testObjectIs() { - return Object.is !== polyfill; - } - }); - return polyfill; - }; - } - }); - - // node_modules/object-is/index.js - var require_object_is = __commonJS({ - "node_modules/object-is/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var define2 = require_define_properties(); - var callBind = require_call_bind(); - var implementation = require_implementation3(); - var getPolyfill = require_polyfill(); - var shim = require_shim(); - var polyfill = callBind(getPolyfill(), Object); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module.exports = polyfill; - } - }); - - // node_modules/is-nan/implementation.js - var require_implementation4 = __commonJS({ - "node_modules/is-nan/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function isNaN2(value) { - return value !== value; - }; - } - }); - - // node_modules/is-nan/polyfill.js - var require_polyfill2 = __commonJS({ - "node_modules/is-nan/polyfill.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation4(); - module.exports = function getPolyfill() { - if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN("a")) { - return Number.isNaN; + obj[key2] = value; } - return implementation; - }; - } - }); - - // node_modules/is-nan/shim.js - var require_shim2 = __commonJS({ - "node_modules/is-nan/shim.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var define2 = require_define_properties(); - var getPolyfill = require_polyfill2(); - module.exports = function shimNumberIsNaN() { - var polyfill = getPolyfill(); - define2(Number, { isNaN: polyfill }, { - isNaN: function testIsNaN() { - return Number.isNaN !== polyfill; - } - }); - return polyfill; - }; - } - }); - - // node_modules/is-nan/index.js - var require_is_nan = __commonJS({ - "node_modules/is-nan/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var callBind = require_call_bind(); - var define2 = require_define_properties(); - var implementation = require_implementation4(); - var getPolyfill = require_polyfill2(); - var shim = require_shim2(); - var polyfill = callBind(getPolyfill(), Number); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module.exports = polyfill; - } - }); - - // node_modules/assert-browserify/build/internal/util/comparisons.js - var require_comparisons = __commonJS({ - "node_modules/assert-browserify/build/internal/util/comparisons.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); + return obj; } - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + var finished = require_end_of_stream(); + var kLastResolve = Symbol("lastResolve"); + var kLastReject = Symbol("lastReject"); + var kError = Symbol("error"); + var kEnded = Symbol("ended"); + var kLastPromise = Symbol("lastPromise"); + var kHandlePromise = Symbol("handlePromise"); + var kStream = Symbol("stream"); + function createIterResult(value, done) { + return { + value, + done + }; } - function _iterableToArrayLimit(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = void 0; - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) - break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) - _i["return"](); - } finally { - if (_d) - throw _e; + function readAndResolve(iter) { + var resolve2 = iter[kLastResolve]; + if (resolve2 !== null) { + var data = iter[kStream].read(); + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve2(createIterResult(data, false)); } } - return _arr; } - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) - return arr; + function onReadable(iter) { + process.nextTick(readAndResolve, iter); } - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof2(obj); + function wrapForNext(lastPromise, iter) { + return function(resolve2, reject) { + lastPromise.then(function() { + if (iter[kEnded]) { + resolve2(createIterResult(void 0, true)); + return; + } + iter[kHandlePromise](resolve2, reject); + }, reject); + }; } - var regexFlagsSupported = /a/g.flags !== void 0; - var arrayFromSet = function arrayFromSet2(set) { - var array = []; - set.forEach(function(value) { - return array.push(value); - }); - return array; - }; - var arrayFromMap = function arrayFromMap2(map) { - var array = []; - map.forEach(function(value, key2) { - return array.push([key2, value]); - }); - return array; - }; - var objectIs = Object.is ? Object.is : require_object_is(); - var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function() { - return []; - }; - var numberIsNaN = Number.isNaN ? Number.isNaN : require_is_nan(); - function uncurryThis(f) { - return f.call.bind(f); - } - var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); - var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable); - var objectToString = uncurryThis(Object.prototype.toString); - var _require$types = require_util().types; - var isAnyArrayBuffer = _require$types.isAnyArrayBuffer; - var isArrayBufferView = _require$types.isArrayBufferView; - var isDate = _require$types.isDate; - var isMap = _require$types.isMap; - var isRegExp = _require$types.isRegExp; - var isSet = _require$types.isSet; - var isNativeError = _require$types.isNativeError; - var isBoxedPrimitive = _require$types.isBoxedPrimitive; - var isNumberObject = _require$types.isNumberObject; - var isStringObject = _require$types.isStringObject; - var isBooleanObject = _require$types.isBooleanObject; - var isBigIntObject = _require$types.isBigIntObject; - var isSymbolObject = _require$types.isSymbolObject; - var isFloat32Array = _require$types.isFloat32Array; - var isFloat64Array = _require$types.isFloat64Array; - function isNonIndex(key2) { - if (key2.length === 0 || key2.length > 10) - return true; - for (var i = 0; i < key2.length; i++) { - var code = key2.charCodeAt(i); - if (code < 48 || code > 57) - return true; - } - return key2.length === 10 && key2 >= Math.pow(2, 32); - } - function getOwnNonIndexProperties(value) { - return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value))); - } - function compare(a, b) { - if (a === b) { - return 0; - } - var x = a.length; - var y = b.length; - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; - } - var ONLY_ENUMERABLE = void 0; - var kStrict = true; - var kLoose = false; - var kNoIterator = 0; - var kIsArray = 1; - var kIsSet = 2; - var kIsMap = 3; - function areSimilarRegExps(a, b) { - return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b); - } - function areSimilarFloatArrays(a, b) { - if (a.byteLength !== b.byteLength) { - return false; - } - for (var offset = 0; offset < a.byteLength; offset++) { - if (a[offset] !== b[offset]) { - return false; - } - } - return true; - } - function areSimilarTypedArrays(a, b) { - if (a.byteLength !== b.byteLength) { - return false; - } - return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0; - } - function areEqualArrayBuffers(buf1, buf2) { - return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0; - } - function isEqualBoxedPrimitive(val1, val2) { - if (isNumberObject(val1)) { - return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2)); - } - if (isStringObject(val1)) { - return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2); - } - if (isBooleanObject(val1)) { - return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2); - } - if (isBigIntObject(val1)) { - return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2); - } - return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2); - } - function innerDeepEqual(val1, val2, strict, memos) { - if (val1 === val2) { - if (val1 !== 0) - return true; - return strict ? objectIs(val1, val2) : true; - } - if (strict) { - if (_typeof2(val1) !== "object") { - return typeof val1 === "number" && numberIsNaN(val1) && numberIsNaN(val2); + var AsyncIteratorPrototype = Object.getPrototypeOf(function() { + }); + var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); } - if (_typeof2(val2) !== "object" || val1 === null || val2 === null) { - return false; + if (this[kEnded]) { + return Promise.resolve(createIterResult(void 0, true)); } - if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) { - return false; + if (this[kStream].destroyed) { + return new Promise(function(resolve2, reject) { + process.nextTick(function() { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve2(createIterResult(void 0, true)); + } + }); + }); } - } else { - if (val1 === null || _typeof2(val1) !== "object") { - if (val2 === null || _typeof2(val2) !== "object") { - return val1 == val2; + var lastPromise = this[kLastPromise]; + var promise2; + if (lastPromise) { + promise2 = new Promise(wrapForNext(lastPromise, this)); + } else { + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); } - return false; - } - if (val2 === null || _typeof2(val2) !== "object") { - return false; - } - } - var val1Tag = objectToString(val1); - var val2Tag = objectToString(val2); - if (val1Tag !== val2Tag) { - return false; - } - if (Array.isArray(val1)) { - if (val1.length !== val2.length) { - return false; - } - var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); - var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); - if (keys1.length !== keys2.length) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsArray, keys1); - } - if (val1Tag === "[object Object]") { - if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) { - return false; + promise2 = new Promise(this[kHandlePromise]); } + this[kLastPromise] = promise2; + return promise2; } - if (isDate(val1)) { - if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) { - return false; - } - } else if (isRegExp(val1)) { - if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) { - return false; - } - } else if (isNativeError(val1) || val1 instanceof Error) { - if (val1.message !== val2.message || val1.name !== val2.name) { - return false; - } - } else if (isArrayBufferView(val1)) { - if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) { - if (!areSimilarFloatArrays(val1, val2)) { - return false; + }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { + return this; + }), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + return new Promise(function(resolve2, reject) { + _this2[kStream].destroy(null, function(err) { + if (err) { + reject(err); + return; } - } else if (!areSimilarTypedArrays(val1, val2)) { - return false; - } - var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); - var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); - if (_keys.length !== _keys2.length) { - return false; - } - return keyCheck(val1, val2, strict, memos, kNoIterator, _keys); - } else if (isSet(val1)) { - if (!isSet(val2) || val1.size !== val2.size) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsSet); - } else if (isMap(val1)) { - if (!isMap(val2) || val1.size !== val2.size) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsMap); - } else if (isAnyArrayBuffer(val1)) { - if (!areEqualArrayBuffers(val1, val2)) { - return false; - } - } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) { - return false; - } - return keyCheck(val1, val2, strict, memos, kNoIterator); - } - function getEnumerables(val, keys) { - return keys.filter(function(k) { - return propertyIsEnumerable(val, k); + resolve2(createIterResult(void 0, true)); + }); }); - } - function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { - if (arguments.length === 5) { - aKeys = Object.keys(val1); - var bKeys = Object.keys(val2); - if (aKeys.length !== bKeys.length) { - return false; - } - } - var i = 0; - for (; i < aKeys.length; i++) { - if (!hasOwnProperty(val2, aKeys[i])) { - return false; - } - } - if (strict && arguments.length === 5) { - var symbolKeysA = objectGetOwnPropertySymbols(val1); - if (symbolKeysA.length !== 0) { - var count = 0; - for (i = 0; i < symbolKeysA.length; i++) { - var key2 = symbolKeysA[i]; - if (propertyIsEnumerable(val1, key2)) { - if (!propertyIsEnumerable(val2, key2)) { - return false; - } - aKeys.push(key2); - count++; - } else if (propertyIsEnumerable(val2, key2)) { - return false; - } - } - var symbolKeysB = objectGetOwnPropertySymbols(val2); - if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) { - return false; - } - } else { - var _symbolKeysB = objectGetOwnPropertySymbols(val2); - if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) { - return false; + }), _Object$setPrototypeO), AsyncIteratorPrototype); + var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve2, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve2(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve2; + iterator[kLastReject] = reject; } - } - } - if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) { - return true; - } - if (memos === void 0) { - memos = { - val1: /* @__PURE__ */ new Map(), - val2: /* @__PURE__ */ new Map(), - position: 0 - }; - } else { - var val2MemoA = memos.val1.get(val1); - if (val2MemoA !== void 0) { - var val2MemoB = memos.val2.get(val2); - if (val2MemoB !== void 0) { - return val2MemoA === val2MemoB; + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function(err) { + if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { + var reject = iterator[kLastReject]; + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); } + iterator[kError] = err; + return; } - memos.position++; - } - memos.val1.set(val1, memos.position); - memos.val2.set(val2, memos.position); - var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType); - memos.val1.delete(val1); - memos.val2.delete(val2); - return areEq; - } - function setHasEqualElement(set, val1, strict, memo) { - var setValues = arrayFromSet(set); - for (var i = 0; i < setValues.length; i++) { - var val2 = setValues[i]; - if (innerDeepEqual(val1, val2, strict, memo)) { - set.delete(val2); - return true; + var resolve2 = iterator[kLastResolve]; + if (resolve2 !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve2(createIterResult(void 0, true)); } - } - return false; - } - function findLooseMatchingPrimitives(prim) { - switch (_typeof2(prim)) { - case "undefined": - return null; - case "object": - return void 0; - case "symbol": - return false; - case "string": - prim = +prim; - case "number": - if (numberIsNaN(prim)) { - return false; - } - } - return true; + iterator[kEnded] = true; + }); + stream.on("readable", onReadable.bind(null, iterator)); + return iterator; + }; + module.exports = createReadableStreamAsyncIterator; + } + }); + + // node_modules/readable-stream/lib/internal/streams/from-browser.js + var require_from_browser = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) { + init_define_BUILD_VERSION(); + init_esbuild_inject(); + module.exports = function() { + throw new Error("Readable.from is not available in the browser"); + }; + } + }); + + // node_modules/readable-stream/lib/_stream_readable.js + var require_stream_readable = __commonJS({ + "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + module.exports = Readable; + var Duplex; + Readable.ReadableState = ReadableState; + var EE = require_events().EventEmitter; + var EElistenerCount = function EElistenerCount2(emitter, type) { + return emitter.listeners(type).length; + }; + var Stream = require_stream_browser(); + var Buffer14 = require_buffer().Buffer; + var OurUint8Array = window.Uint8Array || function() { + }; + function _uint8ArrayToBuffer(chunk) { + return Buffer14.from(chunk); } - function setMightHaveLoosePrim(a, b, prim) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) - return altValue; - return b.has(altValue) && !a.has(altValue); + function _isUint8Array(obj) { + return Buffer14.isBuffer(obj) || obj instanceof OurUint8Array; } - function mapMightHaveLoosePrim(a, b, prim, item, memo) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) { - return altValue; - } - var curB = b.get(altValue); - if (curB === void 0 && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) { - return false; - } - return !a.has(altValue) && innerDeepEqual(item, curB, false, memo); + var debugUtil = require_util(); + var debug; + if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog("stream"); + } else { + debug = function debug2() { + }; } - function setEquiv(a, b, strict, memo) { - var set = null; - var aValues = arrayFromSet(a); - for (var i = 0; i < aValues.length; i++) { - var val = aValues[i]; - if (_typeof2(val) === "object" && val !== null) { - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(val); - } else if (!b.has(val)) { - if (strict) - return false; - if (!setMightHaveLoosePrim(a, b, val)) { - return false; - } - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(val); - } - } - if (set !== null) { - var bValues = arrayFromSet(b); - for (var _i = 0; _i < bValues.length; _i++) { - var _val = bValues[_i]; - if (_typeof2(_val) === "object" && _val !== null) { - if (!setHasEqualElement(set, _val, strict, memo)) - return false; - } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) { - return false; - } - } - return set.size === 0; + var BufferList = require_buffer_list(); + var destroyImpl = require_destroy(); + var _require = require_state(); + var getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require_errors_browser().codes; + var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; + var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + var StringDecoder; + var createReadableStreamAsyncIterator; + var from; + require_inherits_browser()(Readable, Stream); + var errorOrDestroy = destroyImpl.errorOrDestroy; + var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; + function prependListener(emitter, event, fn) { + if (typeof emitter.prependListener === "function") + return emitter.prependListener(event, fn); + if (!emitter._events || !emitter._events[event]) + emitter.on(event, fn); + else if (Array.isArray(emitter._events[event])) + emitter._events[event].unshift(fn); + else + emitter._events[event] = [fn, emitter._events[event]]; + } + function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + if (typeof isDuplex !== "boolean") + isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex); + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + this.sync = true; + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + this.emitClose = options.emitClose !== false; + this.autoDestroy = !!options.autoDestroy; + this.destroyed = false; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.awaitDrain = 0; + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require_string_decoder().StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; } - return true; } - function mapHasEqualEntry(set, map, key1, item1, strict, memo) { - var setValues = arrayFromSet(set); - for (var i = 0; i < setValues.length; i++) { - var key2 = setValues[i]; - if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) { - set.delete(key2); - return true; - } + function Readable(options) { + Duplex = Duplex || require_stream_duplex(); + if (!(this instanceof Readable)) + return new Readable(options); + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + this.readable = true; + if (options) { + if (typeof options.read === "function") + this._read = options.read; + if (typeof options.destroy === "function") + this._destroy = options.destroy; } - return false; + Stream.call(this); } - function mapEquiv(a, b, strict, memo) { - var set = null; - var aEntries = arrayFromMap(a); - for (var i = 0; i < aEntries.length; i++) { - var _aEntries$i = _slicedToArray(aEntries[i], 2), key2 = _aEntries$i[0], item1 = _aEntries$i[1]; - if (_typeof2(key2) === "object" && key2 !== null) { - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(key2); - } else { - var item2 = b.get(key2); - if (item2 === void 0 && !b.has(key2) || !innerDeepEqual(item1, item2, strict, memo)) { - if (strict) - return false; - if (!mapMightHaveLoosePrim(a, b, key2, item1, memo)) - return false; - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(key2); - } + Object.defineProperty(Readable.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._readableState === void 0) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + if (!this._readableState) { + return; } + this._readableState.destroyed = value; } - if (set !== null) { - var bEntries = arrayFromMap(b); - for (var _i2 = 0; _i2 < bEntries.length; _i2++) { - var _bEntries$_i = _slicedToArray(bEntries[_i2], 2), key2 = _bEntries$_i[0], item = _bEntries$_i[1]; - if (_typeof2(key2) === "object" && key2 !== null) { - if (!mapHasEqualEntry(set, a, key2, item, strict, memo)) - return false; - } else if (!strict && (!a.has(key2) || !innerDeepEqual(a.get(key2), item, false, memo)) && !mapHasEqualEntry(set, a, key2, item, false, memo)) { - return false; + }); + Readable.prototype.destroy = destroyImpl.destroy; + Readable.prototype._undestroy = destroyImpl.undestroy; + Readable.prototype._destroy = function(err, cb) { + cb(err); + }; + Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === "string") { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer14.from(chunk, encoding); + encoding = ""; } + skipChunkCheck = true; } - return set.size === 0; + } else { + skipChunkCheck = true; } - return true; - } - function objEquiv(a, b, strict, keys, memos, iterationType) { - var i = 0; - if (iterationType === kIsSet) { - if (!setEquiv(a, b, strict, memos)) { - return false; - } - } else if (iterationType === kIsMap) { - if (!mapEquiv(a, b, strict, memos)) { - return false; - } - } else if (iterationType === kIsArray) { - for (; i < a.length; i++) { - if (hasOwnProperty(a, i)) { - if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) { - return false; - } - } else if (hasOwnProperty(b, i)) { + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); + }; + Readable.prototype.unshift = function(chunk) { + return readableAddChunk(this, chunk, null, true, false); + }; + function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug("readableAddChunk", chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) + er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer14.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) + errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); + else + addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { return false; } else { - var keysA = Object.keys(a); - for (; i < keysA.length; i++) { - var key2 = keysA[i]; - if (!hasOwnProperty(b, key2) || !innerDeepEqual(a[key2], b[key2], strict, memos)) { - return false; - } - } - if (keysA.length !== Object.keys(b).length) { - return false; + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) + addChunk(stream, state, chunk, false); + else + maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); } - return true; } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); } } - for (i = 0; i < keys.length; i++) { - var _key = keys[i]; - if (!innerDeepEqual(a[_key], b[_key], strict, memos)) { - return false; - } - } - return true; - } - function isDeepEqual(val1, val2) { - return innerDeepEqual(val1, val2, kLoose); - } - function isDeepStrictEqual(val1, val2) { - return innerDeepEqual(val1, val2, kStrict); - } - module.exports = { - isDeepEqual, - isDeepStrictEqual - }; - } - }); - - // node_modules/assert-browserify/build/assert.js - var require_assert = __commonJS({ - "node_modules/assert-browserify/build/assert.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof2(obj); - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } + return !state.ended && (state.length < state.highWaterMark || state.length === 0); } - var _require = require_errors(); - var _require$codes = _require.codes; - var ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE; - var ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE; - var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; - var AssertionError = require_assertion_error(); - var _require2 = require_util(); - var inspect = _require2.inspect; - var _require$types = require_util().types; - var isPromise = _require$types.isPromise; - var isRegExp = _require$types.isRegExp; - var objectAssign = Object.assign ? Object.assign : require_es6_object_assign().assign; - var objectIs = Object.is ? Object.is : require_object_is(); - var isDeepEqual; - var isDeepStrictEqual; - function lazyLoadComparison() { - var comparison = require_comparisons(); - isDeepEqual = comparison.isDeepEqual; - isDeepStrictEqual = comparison.isDeepStrictEqual; - } - var warned = false; - var assert = module.exports = ok; - var NO_EXCEPTION_SENTINEL = {}; - function innerFail(obj) { - if (obj.message instanceof Error) - throw obj.message; - throw new AssertionError(obj); - } - function fail(actual, expected, message, operator, stackStartFn) { - var argsLen = arguments.length; - var internalMessage; - if (argsLen === 0) { - internalMessage = "Failed"; - } else if (argsLen === 1) { - message = actual; - actual = void 0; + function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit("data", chunk); } else { - if (warned === false) { - warned = true; - var warn2 = process.emitWarning ? process.emitWarning : console.warn.bind(console); - warn2("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.", "DeprecationWarning", "DEP0094"); - } - if (argsLen === 2) - operator = "!="; - } - if (message instanceof Error) - throw message; - var errArgs = { - actual, - expected, - operator: operator === void 0 ? "fail" : operator, - stackStartFn: stackStartFn || fail - }; - if (message !== void 0) { - errArgs.message = message; - } - var err = new AssertionError(errArgs); - if (internalMessage) { - err.message = internalMessage; - err.generatedMessage = true; - } - throw err; - } - assert.fail = fail; - assert.AssertionError = AssertionError; - function innerOk(fn, argLen, value, message) { - if (!value) { - var generatedMessage = false; - if (argLen === 0) { - generatedMessage = true; - message = "No value argument passed to `assert.ok()`"; - } else if (message instanceof Error) { - throw message; - } - var err = new AssertionError({ - actual: value, - expected: true, - message, - operator: "==", - stackStartFn: fn - }); - err.generatedMessage = generatedMessage; - throw err; + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + if (state.needReadable) + emitReadable(stream); } + maybeReadMore(stream, state); } - function ok() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); } - innerOk.apply(void 0, [ok, args.length].concat(args)); + return er; } - assert.ok = ok; - assert.equal = function equal(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (actual != expected) { - innerFail({ - actual, - expected, - message, - operator: "==", - stackStartFn: equal - }); - } - }; - assert.notEqual = function notEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (actual == expected) { - innerFail({ - actual, - expected, - message, - operator: "!=", - stackStartFn: notEqual - }); - } - }; - assert.deepEqual = function deepEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (!isDeepEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "deepEqual", - stackStartFn: deepEqual - }); - } - }; - assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (isDeepEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notDeepEqual", - stackStartFn: notDeepEqual - }); - } + Readable.prototype.isPaused = function() { + return this._readableState.flowing === false; }; - assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (!isDeepStrictEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "deepStrictEqual", - stackStartFn: deepStrictEqual - }); + Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require_string_decoder().StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + this._readableState.encoding = this._readableState.decoder.encoding; + var p = this._readableState.buffer.head; + var content = ""; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; } + this._readableState.buffer.clear(); + if (content !== "") + this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; }; - assert.notDeepStrictEqual = notDeepStrictEqual; - function notDeepStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (isDeepStrictEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notDeepStrictEqual", - stackStartFn: notDeepStrictEqual - }); - } - } - assert.strictEqual = function strictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (!objectIs(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "strictEqual", - stackStartFn: strictEqual - }); - } - }; - assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (objectIs(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notStrictEqual", - stackStartFn: notStrictEqual - }); - } - }; - var Comparison = function Comparison2(obj, keys, actual) { - var _this = this; - _classCallCheck(this, Comparison2); - keys.forEach(function(key2) { - if (key2 in obj) { - if (actual !== void 0 && typeof actual[key2] === "string" && isRegExp(obj[key2]) && obj[key2].test(actual[key2])) { - _this[key2] = actual[key2]; - } else { - _this[key2] = obj[key2]; - } - } - }); - }; - function compareExceptionKey(actual, expected, key2, message, keys, fn) { - if (!(key2 in actual) || !isDeepStrictEqual(actual[key2], expected[key2])) { - if (!message) { - var a = new Comparison(actual, keys); - var b = new Comparison(expected, keys, actual); - var err = new AssertionError({ - actual: a, - expected: b, - operator: "deepStrictEqual", - stackStartFn: fn - }); - err.actual = actual; - err.expected = expected; - err.operator = fn.name; - throw err; - } - innerFail({ - actual, - expected, - message, - operator: fn.name, - stackStartFn: fn - }); - } - } - function expectedException(actual, expected, msg, fn) { - if (typeof expected !== "function") { - if (isRegExp(expected)) - return expected.test(actual); - if (arguments.length === 2) { - throw new ERR_INVALID_ARG_TYPE("expected", ["Function", "RegExp"], expected); - } - if (_typeof2(actual) !== "object" || actual === null) { - var err = new AssertionError({ - actual, - expected, - message: msg, - operator: "deepStrictEqual", - stackStartFn: fn - }); - err.operator = fn.name; - throw err; - } - var keys = Object.keys(expected); - if (expected instanceof Error) { - keys.push("name", "message"); - } else if (keys.length === 0) { - throw new ERR_INVALID_ARG_VALUE("error", expected, "may not be an empty object"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - keys.forEach(function(key2) { - if (typeof actual[key2] === "string" && isRegExp(expected[key2]) && expected[key2].test(actual[key2])) { - return; - } - compareExceptionKey(actual, expected, key2, msg, keys, fn); - }); - return true; - } - if (expected.prototype !== void 0 && actual instanceof expected) { - return true; - } - if (Error.isPrototypeOf(expected)) { - return false; - } - return expected.call({}, actual) === true; - } - function getActual(fn) { - if (typeof fn !== "function") { - throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn); - } - try { - fn(); - } catch (e) { - return e; - } - return NO_EXCEPTION_SENTINEL; - } - function checkIsPromise(obj) { - return isPromise(obj) || obj !== null && _typeof2(obj) === "object" && typeof obj.then === "function" && typeof obj.catch === "function"; - } - function waitForActual(promiseFn) { - return Promise.resolve().then(function() { - var resultPromise; - if (typeof promiseFn === "function") { - resultPromise = promiseFn(); - if (!checkIsPromise(resultPromise)) { - throw new ERR_INVALID_RETURN_VALUE("instance of Promise", "promiseFn", resultPromise); - } - } else if (checkIsPromise(promiseFn)) { - resultPromise = promiseFn; - } else { - throw new ERR_INVALID_ARG_TYPE("promiseFn", ["Function", "Promise"], promiseFn); - } - return Promise.resolve().then(function() { - return resultPromise; - }).then(function() { - return NO_EXCEPTION_SENTINEL; - }).catch(function(e) { - return e; - }); - }); - } - function expectsError(stackStartFn, actual, error, message) { - if (typeof error === "string") { - if (arguments.length === 4) { - throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); - } - if (_typeof2(actual) === "object" && actual !== null) { - if (actual.message === error) { - throw new ERR_AMBIGUOUS_ARGUMENT("error/message", 'The error message "'.concat(actual.message, '" is identical to the message.')); - } - } else if (actual === error) { - throw new ERR_AMBIGUOUS_ARGUMENT("error/message", 'The error "'.concat(actual, '" is identical to the message.')); - } - message = error; - error = void 0; - } else if (error != null && _typeof2(error) !== "object" && typeof error !== "function") { - throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); - } - if (actual === NO_EXCEPTION_SENTINEL) { - var details = ""; - if (error && error.name) { - details += " (".concat(error.name, ")"); - } - details += message ? ": ".concat(message) : "."; - var fnType = stackStartFn.name === "rejects" ? "rejection" : "exception"; - innerFail({ - actual: void 0, - expected: error, - operator: stackStartFn.name, - message: "Missing expected ".concat(fnType).concat(details), - stackStartFn - }); - } - if (error && !expectedException(actual, error, message, stackStartFn)) { - throw actual; - } - } - function expectsNoError(stackStartFn, actual, error, message) { - if (actual === NO_EXCEPTION_SENTINEL) - return; - if (typeof error === "string") { - message = error; - error = void 0; - } - if (!error || expectedException(actual, error)) { - var details = message ? ": ".concat(message) : "."; - var fnType = stackStartFn.name === "doesNotReject" ? "rejection" : "exception"; - innerFail({ - actual, - expected: error, - operator: stackStartFn.name, - message: "Got unwanted ".concat(fnType).concat(details, "\n") + 'Actual message: "'.concat(actual && actual.message, '"'), - stackStartFn - }); - } - throw actual; - } - assert.throws = function throws(promiseFn) { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args)); - }; - assert.rejects = function rejects(promiseFn) { - for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { - args[_key3 - 1] = arguments[_key3]; - } - return waitForActual(promiseFn).then(function(result) { - return expectsError.apply(void 0, [rejects, result].concat(args)); - }); - }; - assert.doesNotThrow = function doesNotThrow(fn) { - for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { - args[_key4 - 1] = arguments[_key4]; - } - expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args)); - }; - assert.doesNotReject = function doesNotReject(fn) { - for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { - args[_key5 - 1] = arguments[_key5]; - } - return waitForActual(fn).then(function(result) { - return expectsNoError.apply(void 0, [doesNotReject, result].concat(args)); - }); - }; - assert.ifError = function ifError(err) { - if (err !== null && err !== void 0) { - var message = "ifError got unwanted exception: "; - if (_typeof2(err) === "object" && typeof err.message === "string") { - if (err.message.length === 0 && err.constructor) { - message += err.constructor.name; - } else { - message += err.message; - } - } else { - message += inspect(err); - } - var newErr = new AssertionError({ - actual: err, - expected: null, - operator: "ifError", - message, - stackStartFn: ifError - }); - var origStack = err.stack; - if (typeof origStack === "string") { - var tmp2 = origStack.split("\n"); - tmp2.shift(); - var tmp1 = newErr.stack.split("\n"); - for (var i = 0; i < tmp2.length; i++) { - var pos = tmp1.indexOf(tmp2[i]); - if (pos !== -1) { - tmp1 = tmp1.slice(0, pos); - break; - } - } - newErr.stack = "".concat(tmp1.join("\n"), "\n").concat(tmp2.join("\n")); - } - throw newErr; - } - }; - function strict() { - for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { - args[_key6] = arguments[_key6]; - } - innerOk.apply(void 0, [strict, args.length].concat(args)); - } - assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual - }); - assert.strict.strict = assert.strict; - } - }); - - // node_modules/browser-process/dist/node_process.js - var require_node_process = __commonJS({ - "node_modules/browser-process/dist/node_process.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var __extends = exports.__extends || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - function __() { - this.constructor = d; - } - __.prototype = b.prototype; - d.prototype = new __(); - }; - var eventemitter = require_node_eventemitter(); - var path = null; - var TTY = function(_super) { - __extends(TTY2, _super); - function TTY2() { - _super.call(this, true, true); - this.isRaw = false; - this.columns = 80; - this.rows = 120; - this.isTTY = true; - } - TTY2.prototype.setReadMode = function(mode) { - if (this.isRaw !== mode) { - this.isRaw = mode; - this.emit("modeChange"); - } - }; - TTY2.prototype.changeColumns = function(columns) { - if (columns !== this.columns) { - this.columns = columns; - this.emit("resize"); - } - }; - TTY2.prototype.changeRows = function(rows) { - if (rows !== this.rows) { - this.rows = rows; - this.emit("resize"); - } - }; - TTY2.isatty = function(fd) { - return fd instanceof TTY2; - }; - return TTY2; - }(eventemitter.AbstractDuplexStream); - exports.TTY = TTY; - var Process = function() { - function Process2() { - this.startTime = Date.now(); - this._cwd = "/"; - this.platform = "browser"; - this.argv = []; - this.stdout = new TTY(); - this.stderr = new TTY(); - this.stdin = new TTY(); - } - Process2.prototype.chdir = function(dir) { - if (path === null) { - path = require_assert(); - } - this._cwd = path.resolve(dir); - }; - Process2.prototype.cwd = function() { - return this._cwd; - }; - Process2.prototype.uptime = function() { - return (Date.now() - this.startTime) / 1e3 | 0; - }; - return Process2; - }(); - exports.Process = Process; - exports.process = new Process(); - module.exports = exports.process; - } - }); - - // node_modules/crc-32/crc32.js - var require_crc32 = __commonJS({ - "node_modules/crc-32/crc32.js"(exports) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var CRC32; - (function(factory) { - if (typeof DO_NOT_EXPORT_CRC === "undefined") { - if (typeof exports === "object") { - factory(exports); - } else if (typeof define === "function" && define.amd) { - define(function() { - var module2 = {}; - factory(module2); - return module2; - }); - } else { - factory(CRC32 = {}); - } - } else { - factory(CRC32 = {}); - } - })(function(CRC322) { - CRC322.version = "1.2.0"; - function signed_crc_table() { - var c = 0, table = new Array(256); - for (var n = 0; n != 256; ++n) { - c = n; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - table[n] = c; - } - return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; - } - var T = signed_crc_table(); - function crc32_bstr(bstr, seed) { - var C = seed ^ -1, L = bstr.length - 1; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; - } - if (i === L) - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255]; - return C ^ -1; - } - function crc32_buf(buf2, seed) { - if (buf2.length > 1e4) - return crc32_buf_8(buf2, seed); - var C = seed ^ -1, L = buf2.length - 3; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - } - while (i < L + 3) - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - return C ^ -1; - } - function crc32_buf_8(buf2, seed) { - var C = seed ^ -1, L = buf2.length - 7; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - } - while (i < L + 7) - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - return C ^ -1; - } - function crc32_str(str, seed) { - var C = seed ^ -1; - for (var i = 0, L = str.length, c, d; i < L; ) { - c = str.charCodeAt(i++); - if (c < 128) { - C = C >>> 8 ^ T[(C ^ c) & 255]; - } else if (c < 2048) { - C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; - } else if (c >= 55296 && c < 57344) { - c = (c & 1023) + 64; - d = str.charCodeAt(i++) & 1023; - C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255]; - } else { - C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; - } - } - return C ^ -1; - } - CRC322.table = T; - CRC322.bstr = crc32_bstr; - CRC322.buf = crc32_buf; - CRC322.str = crc32_str; - }); - } - }); - - // node_modules/readable-stream/lib/internal/streams/stream-browser.js - var require_stream_browser = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = require_events().EventEmitter; - } - }); - - // (disabled):node_modules/util/util.js - var require_util2 = __commonJS({ - "(disabled):node_modules/util/util.js"() { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - } - }); - - // node_modules/readable-stream/lib/internal/streams/buffer_list.js - var require_buffer_list = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) - symbols = symbols.filter(function(sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - return keys; - } - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - if (i % 2) { - ownKeys(Object(source), true).forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function(key2) { - Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); - }); - } - } - return target; - } - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - var _require = require_buffer(); - var Buffer18 = _require.Buffer; - var _require2 = require_util2(); - var inspect = _require2.inspect; - var custom = inspect && inspect.custom || "inspect"; - function copyBuffer(src, target, offset) { - Buffer18.prototype.copy.call(src, target, offset); - } - module.exports = /* @__PURE__ */ function() { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; - } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) - this.tail.next = entry; - else - this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) - this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - if (this.length === 0) - return; - var ret = this.head.data; - if (this.length === 1) - this.head = this.tail = null; - else - this.head = this.head.next; - --this.length; - return ret; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) - return ""; - var p = this.head; - var ret = "" + p.data; - while (p = p.next) { - ret += s + p.data; - } - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) - return Buffer18.alloc(0); - var ret = Buffer18.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - } - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; - if (n < this.head.data.length) { - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - ret = this.shift(); - } else { - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) - ret += str; - else - ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) - this.head = p.next; - else - this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer18.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf2 = p.data; - var nb = n > buf2.length ? buf2.length : n; - buf2.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf2.length) { - ++c; - if (p.next) - this.head = p.next; - else - this.head = this.tail = null; - } else { - this.head = p; - p.data = buf2.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread({}, options, { - depth: 0, - customInspect: false - })); - } - }]); - return BufferList; - }(); - } - }); - - // node_modules/readable-stream/lib/internal/streams/destroy.js - var require_destroy = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function destroy(err, cb) { - var _this = this; - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } - return this; - } - if (this._readableState) { - this._readableState.destroyed = true; - } - if (this._writableState) { - this._writableState.destroyed = true; - } - this._destroy(err || null, function(err2) { - if (!cb && err2) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err2); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err2); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err2); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - return this; - } - function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); - } - function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) - return; - if (self._readableState && !self._readableState.emitClose) - return; - self.emit("close"); - } - function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } - } - function emitErrorNT(self, err) { - self.emit("error", err); - } - function errorOrDestroy(stream, err) { - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) - stream.destroy(err); - else - stream.emit("error", err); - } - module.exports = { - destroy, - undestroy, - errorOrDestroy - }; - } - }); - - // node_modules/readable-stream/errors-browser.js - var require_errors_browser = __commonJS({ - "node_modules/readable-stream/errors-browser.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; - } - var codes = {}; - function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - function getMessage(arg1, arg2, arg3) { - if (typeof message === "string") { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - var NodeError = /* @__PURE__ */ function(_Base) { - _inheritsLoose(NodeError2, _Base); - function NodeError2(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; - } - return NodeError2; - }(Base); - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; - } - function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function(i) { - return String(i); - }); - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } - } - function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; - } - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; - } - return str.substring(this_len - search.length, this_len) === search; - } - function includes(str, search, start) { - if (typeof start !== "number") { - start = 0; - } - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } - } - createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; - }, TypeError); - createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { - var determiner; - if (typeof expected === "string" && startsWith(expected, "not ")) { - determiner = "must not be"; - expected = expected.replace(/^not /, ""); - } else { - determiner = "must be"; - } - var msg; - if (endsWith(name, " argument")) { - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } else { - var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } - msg += ". Received type ".concat(typeof actual); - return msg; - }, TypeError); - createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); - createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { - return "The " + name + " method is not implemented"; - }); - createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); - createErrorType("ERR_STREAM_DESTROYED", function(name) { - return "Cannot call " + name + " after a stream was destroyed"; - }); - createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); - createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); - createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); - createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); - createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { - return "Unknown encoding: " + arg; - }, TypeError); - createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); - module.exports.codes = codes; - } - }); - - // node_modules/readable-stream/lib/internal/streams/state.js - var require_state = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE; - function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; - } - function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : "highWaterMark"; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - return Math.floor(hwm); - } - return state.objectMode ? 16 : 16 * 1024; - } - module.exports = { - getHighWaterMark - }; - } - }); - - // node_modules/util-deprecate/browser.js - var require_browser = __commonJS({ - "node_modules/util-deprecate/browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = deprecate; - function deprecate(fn, msg) { - if (config("noDeprecation")) { - return fn; - } - var warned = false; - function deprecated() { - if (!warned) { - if (config("throwDeprecation")) { - throw new Error(msg); - } else if (config("traceDeprecation")) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - return deprecated; - } - function config(name) { - try { - if (!window.localStorage) - return false; - } catch (_) { - return false; - } - var val = window.localStorage[name]; - if (val == null) - return false; - return String(val).toLowerCase() === "true"; - } - } - }); - - // node_modules/readable-stream/lib/_stream_writable.js - var require_stream_writable = __commonJS({ - "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Writable; - function CorkedRequest(state) { - var _this = this; - this.next = null; - this.entry = null; - this.finish = function() { - onCorkedFinish(_this, state); - }; - } - var Duplex; - Writable.WritableState = WritableState; - var internalUtil = { - deprecate: require_browser() - }; - var Stream = require_stream_browser(); - var Buffer18 = require_buffer().Buffer; - var OurUint8Array = window.Uint8Array || function() { - }; - function _uint8ArrayToBuffer(chunk) { - return Buffer18.from(chunk); - } - function _isUint8Array(obj) { - return Buffer18.isBuffer(obj) || obj instanceof OurUint8Array; - } - var destroyImpl = require_destroy(); - var _require = require_state(); - var getHighWaterMark = _require.getHighWaterMark; - var _require$codes = require_errors_browser().codes; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; - var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE; - var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES; - var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END; - var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - var errorOrDestroy = destroyImpl.errorOrDestroy; - require_inherits_browser()(Writable, Stream); - function nop() { - } - function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require_stream_duplex(); - options = options || {}; - if (typeof isDuplex !== "boolean") - isDuplex = stream instanceof Duplex; - this.objectMode = !!options.objectMode; - if (isDuplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; - this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex); - this.finalCalled = false; - this.needDrain = false; - this.ending = false; - this.ended = false; - this.finished = false; - this.destroyed = false; - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - this.defaultEncoding = options.defaultEncoding || "utf8"; - this.length = 0; - this.writing = false; - this.corked = 0; - this.sync = true; - this.bufferProcessing = false; - this.onwrite = function(er) { - onwrite(stream, er); - }; - this.writecb = null; - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; - this.pendingcb = 0; - this.prefinished = false; - this.errorEmitted = false; - this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; - this.bufferedRequestCount = 0; - this.corkedRequestsFree = new CorkedRequest(this); - } - WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; - }; - (function() { - try { - Object.defineProperty(WritableState.prototype, "buffer", { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") - }); - } catch (_) { - } - })(); - var realHasInstance; - if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) - return true; - if (this !== Writable) - return false; - return object && object._writableState instanceof WritableState; - } - }); - } else { - realHasInstance = function realHasInstance2(object) { - return object instanceof this; - }; - } - function Writable(options) { - Duplex = Duplex || require_stream_duplex(); - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) - return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); - this.writable = true; - if (options) { - if (typeof options.write === "function") - this._write = options.write; - if (typeof options.writev === "function") - this._writev = options.writev; - if (typeof options.destroy === "function") - this._destroy = options.destroy; - if (typeof options.final === "function") - this._final = options.final; - } - Stream.call(this); - } - Writable.prototype.pipe = function() { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); - }; - function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); - errorOrDestroy(stream, er); - process.nextTick(cb, er); - } - function validChunk(stream, state, chunk, cb) { - var er; - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== "string" && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); - } - if (er) { - errorOrDestroy(stream, er); - process.nextTick(cb, er); - return false; - } - return true; - } - Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer18.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (typeof encoding === "function") { - cb = encoding; - encoding = null; - } - if (isBuf) - encoding = "buffer"; - else if (!encoding) - encoding = state.defaultEncoding; - if (typeof cb !== "function") - cb = nop; - if (state.ending) - writeAfterEnd(this, cb); - else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; - }; - Writable.prototype.cork = function() { - this._writableState.corked++; - }; - Writable.prototype.uncork = function() { - var state = this._writableState; - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) - clearBuffer(this, state); - } - }; - Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - if (typeof encoding === "string") - encoding = encoding.toLowerCase(); - if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) - throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; - }; - Object.defineProperty(Writable.prototype, "writableBuffer", { - enumerable: false, - get: function get2() { - return this._writableState && this._writableState.getBuffer(); - } - }); - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { - chunk = Buffer18.from(chunk, encoding); - } - return chunk; - } - Object.defineProperty(Writable.prototype, "writableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._writableState.highWaterMark; - } - }); - function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = "buffer"; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; - if (!ret) - state.needDrain = true; - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk, - encoding, - isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - return ret; - } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) - state.onwrite(new ERR_STREAM_DESTROYED("write")); - else if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; - } - function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) { - process.nextTick(cb, er); - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - finishMaybe(stream, state); - } - } - function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; - } - function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== "function") - throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) - onwriteError(stream, state, sync, er, cb); - else { - var finished = needFinish(state) || stream.destroyed; - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); - } - } - } - function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); - } - function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit("drain"); - } - } - function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - if (stream._writev && entry && entry.next) { - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) - allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, "", holder.finish); - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - if (state.writing) { - break; - } - } - if (entry === null) - state.lastBufferedRequest = null; - } - state.bufferedRequest = entry; - state.bufferProcessing = false; - } - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); - }; - Writable.prototype._writev = null; - Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - if (typeof chunk === "function") { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === "function") { - cb = encoding; - encoding = null; - } - if (chunk !== null && chunk !== void 0) - this.write(chunk, encoding); - if (state.corked) { - state.corked = 1; - this.uncork(); - } - if (!state.ending) - endWritable(this, state, cb); - return this; - }; - Object.defineProperty(Writable.prototype, "writableLength", { - enumerable: false, - get: function get2() { - return this._writableState.length; - } - }); - function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; - } - function callFinal(stream, state) { - stream._final(function(err) { - state.pendingcb--; - if (err) { - errorOrDestroy(stream, err); - } - state.prefinished = true; - stream.emit("prefinish"); - finishMaybe(stream, state); - }); - } - function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === "function" && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit("prefinish"); - } - } - } - function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit("finish"); - if (state.autoDestroy) { - var rState = stream._readableState; - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } - } - return need; - } - function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once("finish", cb); - } - state.ended = true; - stream.writable = false; - } - function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - state.corkedRequestsFree.next = corkReq; - } - Object.defineProperty(Writable.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._writableState === void 0) { - return false; - } - return this._writableState.destroyed; - }, - set: function set(value) { - if (!this._writableState) { - return; - } - this._writableState.destroyed = value; - } - }); - Writable.prototype.destroy = destroyImpl.destroy; - Writable.prototype._undestroy = destroyImpl.undestroy; - Writable.prototype._destroy = function(err, cb) { - cb(err); - }; - } - }); - - // node_modules/readable-stream/lib/_stream_duplex.js - var require_stream_duplex = __commonJS({ - "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var objectKeys = Object.keys || function(obj) { - var keys2 = []; - for (var key2 in obj) { - keys2.push(key2); - } - return keys2; - }; - module.exports = Duplex; - var Readable = require_stream_readable(); - var Writable = require_stream_writable(); - require_inherits_browser()(Duplex, Readable); - { - keys = objectKeys(Writable.prototype); - for (v = 0; v < keys.length; v++) { - method = keys[v]; - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; - } - } - var keys; - var method; - var v; - function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - if (options) { - if (options.readable === false) - this.readable = false; - if (options.writable === false) - this.writable = false; - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once("end", onend); - } - } - } - Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._writableState.highWaterMark; - } - }); - Object.defineProperty(Duplex.prototype, "writableBuffer", { - enumerable: false, - get: function get2() { - return this._writableState && this._writableState.getBuffer(); - } - }); - Object.defineProperty(Duplex.prototype, "writableLength", { - enumerable: false, - get: function get2() { - return this._writableState.length; - } - }); - function onend() { - if (this._writableState.ended) - return; - process.nextTick(onEndNT, this); - } - function onEndNT(self) { - self.end(); - } - Object.defineProperty(Duplex.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._readableState === void 0 || this._writableState === void 0) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - if (this._readableState === void 0 || this._writableState === void 0) { - return; - } - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } - }); - } - }); - - // node_modules/safe-buffer/index.js - var require_safe_buffer = __commonJS({ - "node_modules/safe-buffer/index.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var buffer = require_buffer(); - var Buffer18 = buffer.Buffer; - function copyProps(src, dst) { - for (var key2 in src) { - dst[key2] = src[key2]; - } - } - if (Buffer18.from && Buffer18.alloc && Buffer18.allocUnsafe && Buffer18.allocUnsafeSlow) { - module.exports = buffer; - } else { - copyProps(buffer, exports); - exports.Buffer = SafeBuffer; - } - function SafeBuffer(arg, encodingOrOffset, length) { - return Buffer18(arg, encodingOrOffset, length); - } - SafeBuffer.prototype = Object.create(Buffer18.prototype); - copyProps(Buffer18, SafeBuffer); - SafeBuffer.from = function(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - throw new TypeError("Argument must not be a number"); - } - return Buffer18(arg, encodingOrOffset, length); - }; - SafeBuffer.alloc = function(size, fill, encoding) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - var buf2 = Buffer18(size); - if (fill !== void 0) { - if (typeof encoding === "string") { - buf2.fill(fill, encoding); - } else { - buf2.fill(fill); - } - } else { - buf2.fill(0); - } - return buf2; - }; - SafeBuffer.allocUnsafe = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return Buffer18(size); - }; - SafeBuffer.allocUnsafeSlow = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return buffer.SlowBuffer(size); - }; - } - }); - - // node_modules/string_decoder/lib/string_decoder.js - var require_string_decoder = __commonJS({ - "node_modules/string_decoder/lib/string_decoder.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var Buffer18 = require_safe_buffer().Buffer; - var isEncoding = Buffer18.isEncoding || function(encoding) { - encoding = "" + encoding; - switch (encoding && encoding.toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - case "raw": - return true; - default: - return false; - } - }; - function _normalizeEncoding(enc) { - if (!enc) - return "utf8"; - var retried; - while (true) { - switch (enc) { - case "utf8": - case "utf-8": - return "utf8"; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return "utf16le"; - case "latin1": - case "binary": - return "latin1"; - case "base64": - case "ascii": - case "hex": - return enc; - default: - if (retried) - return; - enc = ("" + enc).toLowerCase(); - retried = true; - } - } - } - function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== "string" && (Buffer18.isEncoding === isEncoding || !isEncoding(enc))) - throw new Error("Unknown encoding: " + enc); - return nenc || enc; - } - exports.StringDecoder = StringDecoder; - function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case "utf16le": - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case "utf8": - this.fillLast = utf8FillLast; - nb = 4; - break; - case "base64": - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer18.allocUnsafe(nb); - } - StringDecoder.prototype.write = function(buf2) { - if (buf2.length === 0) - return ""; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf2); - if (r === void 0) - return ""; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf2.length) - return r ? r + this.text(buf2, i) : this.text(buf2, i); - return r || ""; - }; - StringDecoder.prototype.end = utf8End; - StringDecoder.prototype.text = utf8Text; - StringDecoder.prototype.fillLast = function(buf2) { - if (this.lastNeed <= buf2.length) { - buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length); - this.lastNeed -= buf2.length; - }; - function utf8CheckByte(byte) { - if (byte <= 127) - return 0; - else if (byte >> 5 === 6) - return 2; - else if (byte >> 4 === 14) - return 3; - else if (byte >> 3 === 30) - return 4; - return byte >> 6 === 2 ? -1 : -2; - } - function utf8CheckIncomplete(self, buf2, i) { - var j = buf2.length - 1; - if (j < i) - return 0; - var nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) - self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) - return 0; - nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) - self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) - return 0; - nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) - nb = 0; - else - self.lastNeed = nb - 3; - } - return nb; - } - return 0; - } - function utf8CheckExtraBytes(self, buf2, p) { - if ((buf2[0] & 192) !== 128) { - self.lastNeed = 0; - return "\uFFFD"; - } - if (self.lastNeed > 1 && buf2.length > 1) { - if ((buf2[1] & 192) !== 128) { - self.lastNeed = 1; - return "\uFFFD"; - } - if (self.lastNeed > 2 && buf2.length > 2) { - if ((buf2[2] & 192) !== 128) { - self.lastNeed = 2; - return "\uFFFD"; - } - } - } - } - function utf8FillLast(buf2) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf2, p); - if (r !== void 0) - return r; - if (this.lastNeed <= buf2.length) { - buf2.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf2.copy(this.lastChar, p, 0, buf2.length); - this.lastNeed -= buf2.length; - } - function utf8Text(buf2, i) { - var total = utf8CheckIncomplete(this, buf2, i); - if (!this.lastNeed) - return buf2.toString("utf8", i); - this.lastTotal = total; - var end = buf2.length - (total - this.lastNeed); - buf2.copy(this.lastChar, 0, end); - return buf2.toString("utf8", i, end); - } - function utf8End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) - return r + "\uFFFD"; - return r; - } - function utf16Text(buf2, i) { - if ((buf2.length - i) % 2 === 0) { - var r = buf2.toString("utf16le", i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 55296 && c <= 56319) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf2[buf2.length - 2]; - this.lastChar[1] = buf2[buf2.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf2[buf2.length - 1]; - return buf2.toString("utf16le", i, buf2.length - 1); - } - function utf16End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString("utf16le", 0, end); - } - return r; - } - function base64Text(buf2, i) { - var n = (buf2.length - i) % 3; - if (n === 0) - return buf2.toString("base64", i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf2[buf2.length - 1]; - } else { - this.lastChar[0] = buf2[buf2.length - 2]; - this.lastChar[1] = buf2[buf2.length - 1]; - } - return buf2.toString("base64", i, buf2.length - n); - } - function base64End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) - return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); - return r; - } - function simpleWrite(buf2) { - return buf2.toString(this.encoding); - } - function simpleEnd(buf2) { - return buf2 && buf2.length ? this.write(buf2) : ""; - } - } - }); - - // node_modules/readable-stream/lib/internal/streams/end-of-stream.js - var require_end_of_stream = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE; - function once(callback) { - var called = false; - return function() { - if (called) - return; - called = true; - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - callback.apply(this, args); - }; - } - function noop3() { - } - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === "function"; - } - function eos(stream, opts, callback) { - if (typeof opts === "function") - return eos(stream, null, opts); - if (!opts) - opts = {}; - callback = once(callback || noop3); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable2 = opts.writable || opts.writable !== false && stream.writable; - var onlegacyfinish = function onlegacyfinish2() { - if (!stream.writable) - onfinish(); - }; - var writableEnded = stream._writableState && stream._writableState.finished; - var onfinish = function onfinish2() { - writable2 = false; - writableEnded = true; - if (!readable) - callback.call(stream); - }; - var readableEnded = stream._readableState && stream._readableState.endEmitted; - var onend = function onend2() { - readable = false; - readableEnded = true; - if (!writable2) - callback.call(stream); - }; - var onerror = function onerror2(err) { - callback.call(stream, err); - }; - var onclose = function onclose2() { - var err; - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) - err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - if (writable2 && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) - err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - }; - var onrequest = function onrequest2() { - stream.req.on("finish", onfinish); - }; - if (isRequest(stream)) { - stream.on("complete", onfinish); - stream.on("abort", onclose); - if (stream.req) - onrequest(); - else - stream.on("request", onrequest); - } else if (writable2 && !stream._writableState) { - stream.on("end", onlegacyfinish); - stream.on("close", onlegacyfinish); - } - stream.on("end", onend); - stream.on("finish", onfinish); - if (opts.error !== false) - stream.on("error", onerror); - stream.on("close", onclose); - return function() { - stream.removeListener("complete", onfinish); - stream.removeListener("abort", onclose); - stream.removeListener("request", onrequest); - if (stream.req) - stream.req.removeListener("finish", onfinish); - stream.removeListener("end", onlegacyfinish); - stream.removeListener("close", onlegacyfinish); - stream.removeListener("finish", onfinish); - stream.removeListener("end", onend); - stream.removeListener("error", onerror); - stream.removeListener("close", onclose); - }; - } - module.exports = eos; - } - }); - - // node_modules/readable-stream/lib/internal/streams/async_iterator.js - var require_async_iterator = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var _Object$setPrototypeO; - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; - } - var finished = require_end_of_stream(); - var kLastResolve = Symbol("lastResolve"); - var kLastReject = Symbol("lastReject"); - var kError = Symbol("error"); - var kEnded = Symbol("ended"); - var kLastPromise = Symbol("lastPromise"); - var kHandlePromise = Symbol("handlePromise"); - var kStream = Symbol("stream"); - function createIterResult(value, done) { - return { - value, - done - }; - } - function readAndResolve(iter) { - var resolve2 = iter[kLastResolve]; - if (resolve2 !== null) { - var data = iter[kStream].read(); - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve2(createIterResult(data, false)); - } - } - } - function onReadable(iter) { - process.nextTick(readAndResolve, iter); - } - function wrapForNext(lastPromise, iter) { - return function(resolve2, reject) { - lastPromise.then(function() { - if (iter[kEnded]) { - resolve2(createIterResult(void 0, true)); - return; - } - iter[kHandlePromise](resolve2, reject); - }, reject); - }; - } - var AsyncIteratorPrototype = Object.getPrototypeOf(function() { - }); - var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - next: function next() { - var _this = this; - var error = this[kError]; - if (error !== null) { - return Promise.reject(error); - } - if (this[kEnded]) { - return Promise.resolve(createIterResult(void 0, true)); - } - if (this[kStream].destroyed) { - return new Promise(function(resolve2, reject) { - process.nextTick(function() { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve2(createIterResult(void 0, true)); - } - }); - }); - } - var lastPromise = this[kLastPromise]; - var promise2; - if (lastPromise) { - promise2 = new Promise(wrapForNext(lastPromise, this)); - } else { - var data = this[kStream].read(); - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - promise2 = new Promise(this[kHandlePromise]); - } - this[kLastPromise] = promise2; - return promise2; - } - }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { - return this; - }), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - return new Promise(function(resolve2, reject) { - _this2[kStream].destroy(null, function(err) { - if (err) { - reject(err); - return; - } - resolve2(createIterResult(void 0, true)); - }); - }); - }), _Object$setPrototypeO), AsyncIteratorPrototype); - var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { - var _Object$create; - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve2, reject) { - var data = iterator[kStream].read(); - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve2(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve2; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function(err) { - if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { - var reject = iterator[kLastReject]; - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - iterator[kError] = err; - return; - } - var resolve2 = iterator[kLastResolve]; - if (resolve2 !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve2(createIterResult(void 0, true)); - } - iterator[kEnded] = true; - }); - stream.on("readable", onReadable.bind(null, iterator)); - return iterator; - }; - module.exports = createReadableStreamAsyncIterator; - } - }); - - // node_modules/readable-stream/lib/internal/streams/from-browser.js - var require_from_browser = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function() { - throw new Error("Readable.from is not available in the browser"); - }; - } - }); - - // node_modules/readable-stream/lib/_stream_readable.js - var require_stream_readable = __commonJS({ - "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Readable; - var Duplex; - Readable.ReadableState = ReadableState; - var EE = require_events().EventEmitter; - var EElistenerCount = function EElistenerCount2(emitter, type) { - return emitter.listeners(type).length; - }; - var Stream = require_stream_browser(); - var Buffer18 = require_buffer().Buffer; - var OurUint8Array = window.Uint8Array || function() { - }; - function _uint8ArrayToBuffer(chunk) { - return Buffer18.from(chunk); - } - function _isUint8Array(obj) { - return Buffer18.isBuffer(obj) || obj instanceof OurUint8Array; - } - var debugUtil = require_util2(); - var debug; - if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog("stream"); - } else { - debug = function debug2() { - }; - } - var BufferList = require_buffer_list(); - var destroyImpl = require_destroy(); - var _require = require_state(); - var getHighWaterMark = _require.getHighWaterMark; - var _require$codes = require_errors_browser().codes; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; - var StringDecoder; - var createReadableStreamAsyncIterator; - var from; - require_inherits_browser()(Readable, Stream); - var errorOrDestroy = destroyImpl.errorOrDestroy; - var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; - function prependListener(emitter, event, fn) { - if (typeof emitter.prependListener === "function") - return emitter.prependListener(event, fn); - if (!emitter._events || !emitter._events[event]) - emitter.on(event, fn); - else if (Array.isArray(emitter._events[event])) - emitter._events[event].unshift(fn); - else - emitter._events[event] = [fn, emitter._events[event]]; - } - function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require_stream_duplex(); - options = options || {}; - if (typeof isDuplex !== "boolean") - isDuplex = stream instanceof Duplex; - this.objectMode = !!options.objectMode; - if (isDuplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex); - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - this.sync = true; - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; - this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; - this.destroyed = false; - this.defaultEncoding = options.defaultEncoding || "utf8"; - this.awaitDrain = 0; - this.readingMore = false; - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require_string_decoder().StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } - } - function Readable(options) { - Duplex = Duplex || require_stream_duplex(); - if (!(this instanceof Readable)) - return new Readable(options); - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); - this.readable = true; - if (options) { - if (typeof options.read === "function") - this._read = options.read; - if (typeof options.destroy === "function") - this._destroy = options.destroy; - } - Stream.call(this); - } - Object.defineProperty(Readable.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._readableState === void 0) { - return false; - } - return this._readableState.destroyed; - }, - set: function set(value) { - if (!this._readableState) { - return; - } - this._readableState.destroyed = value; - } - }); - Readable.prototype.destroy = destroyImpl.destroy; - Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function(err, cb) { - cb(err); - }; - Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - if (!state.objectMode) { - if (typeof chunk === "string") { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer18.from(chunk, encoding); - encoding = ""; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); - }; - Readable.prototype.unshift = function(chunk) { - return readableAddChunk(this, chunk, null, true, false); - }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug("readableAddChunk", chunk); - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) - er = chunkInvalid(state, chunk); - if (er) { - errorOrDestroy(stream, er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer18.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (addToFront) { - if (state.endEmitted) - errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); - else - addChunk(stream, state, chunk, true); - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) - addChunk(stream, state, chunk, false); - else - maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } - return !state.ended && (state.length < state.highWaterMark || state.length === 0); - } - function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit("data", chunk); - } else { - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - if (state.needReadable) - emitReadable(stream); - } - maybeReadMore(stream, state); - } - function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); - } - return er; - } - Readable.prototype.isPaused = function() { - return this._readableState.flowing === false; - }; - Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require_string_decoder().StringDecoder; - var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; - this._readableState.encoding = this._readableState.decoder.encoding; - var p = this._readableState.buffer.head; - var content = ""; - while (p !== null) { - content += decoder.write(p.data); - p = p.next; - } - this._readableState.buffer.clear(); - if (content !== "") - this._readableState.buffer.push(content); - this._readableState.length = content.length; - return this; - }; - var MAX_HWM = 1073741824; - function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; - } - function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) - return 0; - if (state.objectMode) - return 1; - if (n !== n) { - if (state.flowing && state.length) - return state.buffer.head.data.length; - else - return state.length; - } - if (n > state.highWaterMark) - state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) - return n; - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; - } - Readable.prototype.read = function(n) { - debug("read", n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) - state.emittedReadable = false; - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug("read: emitReadable", state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - n = howMuchToRead(n, state); - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - var doRead = state.needReadable; - debug("need readable", doRead); - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug("length less than watermark", doRead); - } - if (state.ended || state.reading) { - doRead = false; - debug("reading or ended", doRead); - } else if (doRead) { - debug("do read"); - state.reading = true; - state.sync = true; - if (state.length === 0) - state.needReadable = true; - this._read(state.highWaterMark); - state.sync = false; - if (!state.reading) - n = howMuchToRead(nOrig, state); - } - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - if (state.length === 0) { - if (!state.ended) - state.needReadable = true; - if (nOrig !== n && state.ended) - endReadable(this); - } - if (ret !== null) - this.emit("data", ret); - return ret; - }; - function onEofChunk(stream, state) { - debug("onEofChunk"); - if (state.ended) - return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - if (state.sync) { - emitReadable(stream); - } else { - state.needReadable = false; - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } - } - function emitReadable(stream) { - var state = stream._readableState; - debug("emitReadable", state.needReadable, state.emittedReadable); - state.needReadable = false; - if (!state.emittedReadable) { - debug("emitReadable", state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } - } - function emitReadable_(stream) { - var state = stream._readableState; - debug("emitReadable_", state.destroyed, state.length, state.ended); - if (!state.destroyed && (state.length || state.ended)) { - stream.emit("readable"); - state.emittedReadable = false; - } - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); - } - function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } - } - function maybeReadMore_(stream, state) { - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug("maybeReadMore read 0"); - stream.read(0); - if (len === state.length) - break; - } - state.readingMore = false; - } - Readable.prototype._read = function(n) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); - }; - Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once("end", endFn); - dest.on("unpipe", onunpipe); - function onunpipe(readable, unpipeInfo) { - debug("onunpipe"); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - function onend() { - debug("onend"); - dest.end(); - } - var ondrain = pipeOnDrain(src); - dest.on("drain", ondrain); - var cleanedUp = false; - function cleanup() { - debug("cleanup"); - dest.removeListener("close", onclose); - dest.removeListener("finish", onfinish); - dest.removeListener("drain", ondrain); - dest.removeListener("error", onerror); - dest.removeListener("unpipe", onunpipe); - src.removeListener("end", onend); - src.removeListener("end", unpipe); - src.removeListener("data", ondata); - cleanedUp = true; - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - src.on("data", ondata); - function ondata(chunk) { - debug("ondata"); - var ret = dest.write(chunk); - debug("dest.write", ret); - if (ret === false) { - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug("false write response, pause", state.awaitDrain); - state.awaitDrain++; - } - src.pause(); - } - } - function onerror(er) { - debug("onerror", er); - unpipe(); - dest.removeListener("error", onerror); - if (EElistenerCount(dest, "error") === 0) - errorOrDestroy(dest, er); - } - prependListener(dest, "error", onerror); - function onclose() { - dest.removeListener("finish", onfinish); - unpipe(); - } - dest.once("close", onclose); - function onfinish() { - debug("onfinish"); - dest.removeListener("close", onclose); - unpipe(); - } - dest.once("finish", onfinish); - function unpipe() { - debug("unpipe"); - src.unpipe(dest); - } - dest.emit("pipe", src); - if (!state.flowing) { - debug("pipe resume"); - src.resume(); - } - return dest; - }; - function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug("pipeOnDrain", state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { - state.flowing = true; - flow(src); - } - }; - } - Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; - if (state.pipesCount === 0) - return this; - if (state.pipesCount === 1) { - if (dest && dest !== state.pipes) - return this; - if (!dest) - dest = state.pipes; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit("unpipe", this, unpipeInfo); - return this; - } - if (!dest) { - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - for (var i = 0; i < len; i++) { - dests[i].emit("unpipe", this, { - hasUnpiped: false - }); - } - return this; - } - var index = indexOf(state.pipes, dest); - if (index === -1) - return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - dest.emit("unpipe", this, unpipeInfo); - return this; - }; - Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; - if (ev === "data") { - state.readableListening = this.listenerCount("readable") > 0; - if (state.flowing !== false) - this.resume(); - } else if (ev === "readable") { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug("on readable", state.length, state.reading); - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } - return res; - }; - Readable.prototype.addListener = Readable.prototype.on; - Readable.prototype.removeListener = function(ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - if (ev === "readable") { - process.nextTick(updateReadableListening, this); - } - return res; - }; - Readable.prototype.removeAllListeners = function(ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - if (ev === "readable" || ev === void 0) { - process.nextTick(updateReadableListening, this); - } - return res; - }; - function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount("readable") > 0; - if (state.resumeScheduled && !state.paused) { - state.flowing = true; - } else if (self.listenerCount("data") > 0) { - self.resume(); - } - } - function nReadingNextTick(self) { - debug("readable nexttick read 0"); - self.read(0); - } - Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug("resume"); - state.flowing = !state.readableListening; - resume(this, state); - } - state.paused = false; - return this; - }; - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } - } - function resume_(stream, state) { - debug("resume", state.reading); - if (!state.reading) { - stream.read(0); - } - state.resumeScheduled = false; - stream.emit("resume"); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); - } - Readable.prototype.pause = function() { - debug("call pause flowing=%j", this._readableState.flowing); - if (this._readableState.flowing !== false) { - debug("pause"); - this._readableState.flowing = false; - this.emit("pause"); - } - this._readableState.paused = true; - return this; - }; - function flow(stream) { - var state = stream._readableState; - debug("flow", state.flowing); - while (state.flowing && stream.read() !== null) { - ; - } - } - Readable.prototype.wrap = function(stream) { - var _this = this; - var state = this._readableState; - var paused = false; - stream.on("end", function() { - debug("wrapped end"); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - _this.push(chunk); - } - _this.push(null); - }); - stream.on("data", function(chunk) { - debug("wrapped data"); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (state.objectMode && (chunk === null || chunk === void 0)) - return; - else if (!state.objectMode && (!chunk || !chunk.length)) - return; - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - for (var i in stream) { - if (this[i] === void 0 && typeof stream[i] === "function") { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - this._read = function(n2) { - debug("wrapped _read", n2); - if (paused) { - paused = false; - stream.resume(); - } - }; - return this; - }; - if (typeof Symbol === "function") { - Readable.prototype[Symbol.asyncIterator] = function() { - if (createReadableStreamAsyncIterator === void 0) { - createReadableStreamAsyncIterator = require_async_iterator(); - } - return createReadableStreamAsyncIterator(this); - }; - } - Object.defineProperty(Readable.prototype, "readableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._readableState.highWaterMark; - } - }); - Object.defineProperty(Readable.prototype, "readableBuffer", { - enumerable: false, - get: function get2() { - return this._readableState && this._readableState.buffer; - } - }); - Object.defineProperty(Readable.prototype, "readableFlowing", { - enumerable: false, - get: function get2() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } - }); - Readable._fromList = fromList; - Object.defineProperty(Readable.prototype, "readableLength", { - enumerable: false, - get: function get2() { - return this._readableState.length; - } - }); - function fromList(n, state) { - if (state.length === 0) - return null; - var ret; - if (state.objectMode) - ret = state.buffer.shift(); - else if (!n || n >= state.length) { - if (state.decoder) - ret = state.buffer.join(""); - else if (state.buffer.length === 1) - ret = state.buffer.first(); - else - ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - ret = state.buffer.consume(n, state.decoder); - } - return ret; - } - function endReadable(stream) { - var state = stream._readableState; - debug("endReadable", state.endEmitted); - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } - } - function endReadableNT(state, stream) { - debug("endReadableNT", state.endEmitted, state.length); - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit("end"); - if (state.autoDestroy) { - var wState = stream._writableState; - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); - } - } - } - } - if (typeof Symbol === "function") { - Readable.from = function(iterable, opts) { - if (from === void 0) { - from = require_from_browser(); - } - return from(Readable, iterable, opts); - }; - } - function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) - return i; - } - return -1; - } - } - }); - - // node_modules/readable-stream/lib/_stream_transform.js - var require_stream_transform = __commonJS({ - "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Transform; - var _require$codes = require_errors_browser().codes; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; - var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING; - var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - var Duplex = require_stream_duplex(); - require_inherits_browser()(Transform, Duplex); - function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - if (cb === null) { - return this.emit("error", new ERR_MULTIPLE_CALLBACK()); - } - ts.writechunk = null; - ts.writecb = null; - if (data != null) - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } - } - function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - this._readableState.needReadable = true; - this._readableState.sync = false; - if (options) { - if (typeof options.transform === "function") - this._transform = options.transform; - if (typeof options.flush === "function") - this._flush = options.flush; - } - this.on("prefinish", prefinish); - } - function prefinish() { - var _this = this; - if (typeof this._flush === "function" && !this._readableState.destroyed) { - this._flush(function(er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } - } - Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); - }; - Transform.prototype._transform = function(chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); - }; - Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } - }; - Transform.prototype._read = function(n) { - var ts = this._transformState; - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - ts.needTransform = true; - } - }; - Transform.prototype._destroy = function(err, cb) { - Duplex.prototype._destroy.call(this, err, function(err2) { - cb(err2); - }); - }; - function done(stream, er, data) { - if (er) - return stream.emit("error", er); - if (data != null) - stream.push(data); - if (stream._writableState.length) - throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) - throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); - } - } - }); - - // node_modules/readable-stream/lib/_stream_passthrough.js - var require_stream_passthrough = __commonJS({ - "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = PassThrough; - var Transform = require_stream_transform(); - require_inherits_browser()(PassThrough, Transform); - function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - Transform.call(this, options); - } - PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); - }; - } - }); - - // node_modules/readable-stream/lib/internal/streams/pipeline.js - var require_pipeline = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var eos; - function once(callback) { - var called = false; - return function() { - if (called) - return; - called = true; - callback.apply(void 0, arguments); - }; - } - var _require$codes = require_errors_browser().codes; - var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; - var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - function noop3(err) { - if (err) - throw err; - } - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === "function"; - } - function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on("close", function() { - closed = true; - }); - if (eos === void 0) - eos = require_end_of_stream(); - eos(stream, { - readable: reading, - writable: writing - }, function(err) { - if (err) - return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function(err) { - if (closed) - return; - if (destroyed) - return; - destroyed = true; - if (isRequest(stream)) - return stream.abort(); - if (typeof stream.destroy === "function") - return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED("pipe")); - }; - } - function call(fn) { - fn(); - } - function pipe(from, to) { - return from.pipe(to); - } - function popCallback(streams) { - if (!streams.length) - return noop3; - if (typeof streams[streams.length - 1] !== "function") - return noop3; - return streams.pop(); - } - function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - var callback = popCallback(streams); - if (Array.isArray(streams[0])) - streams = streams[0]; - if (streams.length < 2) { - throw new ERR_MISSING_ARGS("streams"); - } - var error; - var destroys = streams.map(function(stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function(err) { - if (!error) - error = err; - if (err) - destroys.forEach(call); - if (reading) - return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); - } - module.exports = pipeline; - } - }); - - // node_modules/readable-stream/readable-browser.js - var require_readable_browser = __commonJS({ - "node_modules/readable-stream/readable-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - exports = module.exports = require_stream_readable(); - exports.Stream = exports; - exports.Readable = exports; - exports.Writable = require_stream_writable(); - exports.Duplex = require_stream_duplex(); - exports.Transform = require_stream_transform(); - exports.PassThrough = require_stream_passthrough(); - exports.finished = require_end_of_stream(); - exports.pipeline = require_pipeline(); - } - }); - - // node_modules/readable-web-to-node-stream/lib/index.js - var require_lib = __commonJS({ - "node_modules/readable-web-to-node-stream/lib/index.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ReadableWebToNodeStream = void 0; - var readable_stream_1 = require_readable_browser(); - var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable { - constructor(stream) { - super(); - this.bytesRead = 0; - this.released = false; - this.reader = stream.getReader(); - } - async _read() { - if (this.released) { - this.push(null); - return; - } - this.pendingRead = this.reader.read(); - const data = await this.pendingRead; - delete this.pendingRead; - if (data.done || this.released) { - this.push(null); - } else { - this.bytesRead += data.value.length; - this.push(data.value); - } - } - async waitForReadToComplete() { - if (this.pendingRead) { - await this.pendingRead; - } - } - async close() { - await this.syncAndRelease(); - } - async syncAndRelease() { - this.released = true; - await this.waitForReadToComplete(); - await this.reader.releaseLock(); - } - }; - exports.ReadableWebToNodeStream = ReadableWebToNodeStream2; - } - }); - - // node_modules/base-x/src/index.js - var require_src2 = __commonJS({ - "node_modules/base-x/src/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function base(ALPHABET) { - if (ALPHABET.length >= 255) { - throw new TypeError("Alphabet too long"); - } - var BASE_MAP = new Uint8Array(256); - for (var j = 0; j < BASE_MAP.length; j++) { - BASE_MAP[j] = 255; - } - for (var i = 0; i < ALPHABET.length; i++) { - var x = ALPHABET.charAt(i); - var xc = x.charCodeAt(0); - if (BASE_MAP[xc] !== 255) { - throw new TypeError(x + " is ambiguous"); - } - BASE_MAP[xc] = i; - } - var BASE = ALPHABET.length; - var LEADER = ALPHABET.charAt(0); - var FACTOR = Math.log(BASE) / Math.log(256); - var iFACTOR = Math.log(256) / Math.log(BASE); - function encode2(source) { - if (source instanceof Uint8Array) { - } else if (ArrayBuffer.isView(source)) { - source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); - } else if (Array.isArray(source)) { - source = Uint8Array.from(source); - } - if (!(source instanceof Uint8Array)) { - throw new TypeError("Expected Uint8Array"); - } - if (source.length === 0) { - return ""; - } - var zeroes = 0; - var length = 0; - var pbegin = 0; - var pend = source.length; - while (pbegin !== pend && source[pbegin] === 0) { - pbegin++; - zeroes++; - } - var size = (pend - pbegin) * iFACTOR + 1 >>> 0; - var b58 = new Uint8Array(size); - while (pbegin !== pend) { - var carry = source[pbegin]; - var i2 = 0; - for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) { - carry += 256 * b58[it1] >>> 0; - b58[it1] = carry % BASE >>> 0; - carry = carry / BASE >>> 0; - } - if (carry !== 0) { - throw new Error("Non-zero carry"); - } - length = i2; - pbegin++; - } - var it2 = size - length; - while (it2 !== size && b58[it2] === 0) { - it2++; - } - var str = LEADER.repeat(zeroes); - for (; it2 < size; ++it2) { - str += ALPHABET.charAt(b58[it2]); - } - return str; - } - function decodeUnsafe(source) { - if (typeof source !== "string") { - throw new TypeError("Expected String"); - } - if (source.length === 0) { - return new Uint8Array(); - } - var psz = 0; - var zeroes = 0; - var length = 0; - while (source[psz] === LEADER) { - zeroes++; - psz++; - } - var size = (source.length - psz) * FACTOR + 1 >>> 0; - var b256 = new Uint8Array(size); - while (source[psz]) { - var carry = BASE_MAP[source.charCodeAt(psz)]; - if (carry === 255) { - return; - } - var i2 = 0; - for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) { - carry += BASE * b256[it3] >>> 0; - b256[it3] = carry % 256 >>> 0; - carry = carry / 256 >>> 0; - } - if (carry !== 0) { - throw new Error("Non-zero carry"); - } - length = i2; - psz++; - } - var it4 = size - length; - while (it4 !== size && b256[it4] === 0) { - it4++; - } - var vch = new Uint8Array(zeroes + (size - it4)); - var j2 = zeroes; - while (it4 !== size) { - vch[j2++] = b256[it4++]; - } - return vch; - } - function decode3(string) { - var buffer = decodeUnsafe(string); - if (buffer) { - return buffer; - } - throw new Error("Non-base" + BASE + " character"); - } - return { - encode: encode2, - decodeUnsafe, - decode: decode3 - }; - } - module.exports = base; - } - }); - - // node_modules/bs58/index.js - var require_bs58 = __commonJS({ - "node_modules/bs58/index.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var basex = require_src2(); - var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; - module.exports = basex(ALPHABET); - } - }); - - // node_modules/int64-buffer/int64-buffer.js - var require_int64_buffer = __commonJS({ - "node_modules/int64-buffer/int64-buffer.js"(exports) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var Uint64BE; - var Int64BE; - var Uint64LE; - var Int64LE; - !function(exports2) { - var UNDEFINED = "undefined"; - var BUFFER = UNDEFINED !== typeof Buffer2 && Buffer2; - var UINT8ARRAY = UNDEFINED !== typeof Uint8Array && Uint8Array; - var ARRAYBUFFER = UNDEFINED !== typeof ArrayBuffer && ArrayBuffer; - var ZERO = [0, 0, 0, 0, 0, 0, 0, 0]; - var isArray = Array.isArray || _isArray; - var BIT32 = 4294967296; - var BIT24 = 16777216; - var storage; - Uint64BE = factory("Uint64BE", true, true); - Int64BE = factory("Int64BE", true, false); - Uint64LE = factory("Uint64LE", false, true); - Int64LE = factory("Int64LE", false, false); - function factory(name, bigendian, unsigned) { - var posH = bigendian ? 0 : 4; - var posL = bigendian ? 4 : 0; - var pos0 = bigendian ? 0 : 3; - var pos1 = bigendian ? 1 : 2; - var pos2 = bigendian ? 2 : 1; - var pos3 = bigendian ? 3 : 0; - var fromPositive = bigendian ? fromPositiveBE : fromPositiveLE; - var fromNegative = bigendian ? fromNegativeBE : fromNegativeLE; - var proto = Int64.prototype; - var isName = "is" + name; - var _isInt64 = "_" + isName; - proto.buffer = void 0; - proto.offset = 0; - proto[_isInt64] = true; - proto.toNumber = toNumber; - proto.toString = toString2; - proto.toJSON = toNumber; - proto.toArray = toArray; - if (BUFFER) - proto.toBuffer = toBuffer; - if (UINT8ARRAY) - proto.toArrayBuffer = toArrayBuffer; - Int64[isName] = isInt64; - exports2[name] = Int64; - return Int64; - function Int64(buffer, offset, value, raddix) { - if (!(this instanceof Int64)) - return new Int64(buffer, offset, value, raddix); - return init5(this, buffer, offset, value, raddix); - } - function isInt64(b) { - return !!(b && b[_isInt64]); - } - function init5(that, buffer, offset, value, raddix) { - if (UINT8ARRAY && ARRAYBUFFER) { - if (buffer instanceof ARRAYBUFFER) - buffer = new UINT8ARRAY(buffer); - if (value instanceof ARRAYBUFFER) - value = new UINT8ARRAY(value); - } - if (!buffer && !offset && !value && !storage) { - that.buffer = newArray(ZERO, 0); - return; - } - if (!isValidBuffer(buffer, offset)) { - var _storage = storage || Array; - raddix = offset; - value = buffer; - offset = 0; - buffer = new _storage(8); - } - that.buffer = buffer; - that.offset = offset |= 0; - if (UNDEFINED === typeof value) - return; - if (typeof value === "string") { - fromString(buffer, offset, value, raddix || 10); - } else if (isValidBuffer(value, raddix)) { - fromArray(buffer, offset, value, raddix); - } else if (typeof raddix === "number") { - writeInt32(buffer, offset + posH, value); - writeInt32(buffer, offset + posL, raddix); - } else if (value > 0) { - fromPositive(buffer, offset, value); - } else if (value < 0) { - fromNegative(buffer, offset, value); - } else { - fromArray(buffer, offset, ZERO, 0); - } - } - function fromString(buffer, offset, str, raddix) { - var pos = 0; - var len = str.length; - var high = 0; - var low = 0; - if (str[0] === "-") - pos++; - var sign = pos; - while (pos < len) { - var chr = parseInt(str[pos++], raddix); - if (!(chr >= 0)) - break; - low = low * raddix + chr; - high = high * raddix + Math.floor(low / BIT32); - low %= BIT32; - } - if (sign) { - high = ~high; - if (low) { - low = BIT32 - low; - } else { - high++; - } - } - writeInt32(buffer, offset + posH, high); - writeInt32(buffer, offset + posL, low); - } - function toNumber() { - var buffer = this.buffer; - var offset = this.offset; - var high = readInt32(buffer, offset + posH); - var low = readInt32(buffer, offset + posL); - if (!unsigned) - high |= 0; - return high ? high * BIT32 + low : low; - } - function toString2(radix) { - var buffer = this.buffer; - var offset = this.offset; - var high = readInt32(buffer, offset + posH); - var low = readInt32(buffer, offset + posL); - var str = ""; - var sign = !unsigned && high & 2147483648; - if (sign) { - high = ~high; - low = BIT32 - low; - } - radix = radix || 10; - while (1) { - var mod = high % radix * BIT32 + low; - high = Math.floor(high / radix); - low = Math.floor(mod / radix); - str = (mod % radix).toString(radix) + str; - if (!high && !low) - break; - } - if (sign) { - str = "-" + str; - } - return str; - } - function writeInt32(buffer, offset, value) { - buffer[offset + pos3] = value & 255; - value = value >> 8; - buffer[offset + pos2] = value & 255; - value = value >> 8; - buffer[offset + pos1] = value & 255; - value = value >> 8; - buffer[offset + pos0] = value & 255; - } - function readInt32(buffer, offset) { - return buffer[offset + pos0] * BIT24 + (buffer[offset + pos1] << 16) + (buffer[offset + pos2] << 8) + buffer[offset + pos3]; - } - } - function toArray(raw) { - var buffer = this.buffer; - var offset = this.offset; - storage = null; - if (raw !== false && offset === 0 && buffer.length === 8 && isArray(buffer)) - return buffer; - return newArray(buffer, offset); - } - function toBuffer(raw) { - var buffer = this.buffer; - var offset = this.offset; - storage = BUFFER; - if (raw !== false && offset === 0 && buffer.length === 8 && Buffer2.isBuffer(buffer)) - return buffer; - var dest = new BUFFER(8); - fromArray(dest, 0, buffer, offset); - return dest; - } - function toArrayBuffer(raw) { - var buffer = this.buffer; - var offset = this.offset; - var arrbuf = buffer.buffer; - storage = UINT8ARRAY; - if (raw !== false && offset === 0 && arrbuf instanceof ARRAYBUFFER && arrbuf.byteLength === 8) - return arrbuf; - var dest = new UINT8ARRAY(8); - fromArray(dest, 0, buffer, offset); - return dest.buffer; - } - function isValidBuffer(buffer, offset) { - var len = buffer && buffer.length; - offset |= 0; - return len && offset + 8 <= len && typeof buffer[offset] !== "string"; - } - function fromArray(destbuf, destoff, srcbuf, srcoff) { - destoff |= 0; - srcoff |= 0; - for (var i = 0; i < 8; i++) { - destbuf[destoff++] = srcbuf[srcoff++] & 255; - } - } - function newArray(buffer, offset) { - return Array.prototype.slice.call(buffer, offset, offset + 8); - } - function fromPositiveBE(buffer, offset, value) { - var pos = offset + 8; - while (pos > offset) { - buffer[--pos] = value & 255; - value /= 256; - } - } - function fromNegativeBE(buffer, offset, value) { - var pos = offset + 8; - value++; - while (pos > offset) { - buffer[--pos] = -value & 255 ^ 255; - value /= 256; - } - } - function fromPositiveLE(buffer, offset, value) { - var end = offset + 8; - while (offset < end) { - buffer[offset++] = value & 255; - value /= 256; - } - } - function fromNegativeLE(buffer, offset, value) { - var end = offset + 8; - value++; - while (offset < end) { - buffer[offset++] = -value & 255 ^ 255; - value /= 256; - } - } - function _isArray(val) { - return !!val && Object.prototype.toString.call(val) == "[object Array]"; - } - }(typeof exports === "object" && typeof exports.nodeName !== "string" ? exports : exports || {}); - } - }); - - // node_modules/matroska/lib/schema.js - var require_schema = __commonJS({ - "node_modules/matroska/lib/schema.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var byEbmlID = { - 128: { - name: "ChapterDisplay", - level: 4, - type: "m", - multiple: true, - webm: true, - description: "Contains all possible strings to use for the chapter display." - }, - 131: { - name: "TrackType", - level: 3, - type: "u", - mandatory: true, - description: "The `TrackType` defines the type of each frame found in the Track. The value **SHOULD** be stored on 1 octet." - }, - 133: { - name: "ChapString", - cppname: "ChapterString", - level: 5, - type: "8", - mandatory: true, - webm: true, - description: "Contains the string to use as the chapter atom." - }, - 134: { - name: "CodecID", - level: 3, - type: "s", - mandatory: true, - description: "An ID corresponding to the codec, see [@!MatroskaCodec] for more info." - }, - 136: { - name: "FlagDefault", - cppname: "TrackFlagDefault", - level: 3, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set if that track (audio, video or subs) **SHOULD** be eligible for automatic selection by the player; see (#default-track-selection) for more details." - }, - 137: { - name: "ChapterTrackUID", - cppname: "ChapterTrackNumber", - level: 5, - type: "u", - mandatory: true, - multiple: true, - range: "not 0", - description: "UID of the Track to apply this chapter to. In the absence of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absence of this Element indicates that the Chapter **SHOULD** be applied to any currently used Tracks." - }, - 142: { - name: "Slices", - level: 3, - type: "m", - maxver: 1, - description: "Contains slices description." - }, - 143: { - name: "ChapterTrack", - level: 4, - type: "m", - description: "List of tracks on which the chapter applies. If this Element is not present, all tracks apply" - }, - 145: { - name: "ChapterTimeStart", - level: 4, - type: "u", - mandatory: true, - webm: true, - description: "Timestamp of the start of Chapter, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 146: { - name: "ChapterTimeEnd", - level: 4, - type: "u", - webm: true, - description: "Timestamp of the end of Chapter timestamp excluded, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). The value **MUST** be greater than or equal to the `ChapterTimeStart` of the same `ChapterAtom`." - }, - 150: { - name: "CueRefTime", - level: 5, - type: "u", - mandatory: true, - minver: 2, - description: "Timestamp of the referenced Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 151: { - name: "CueRefCluster", - level: 5, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - description: "The Segment Position of the Cluster containing the referenced Block." - }, - 152: { - name: "ChapterFlagHidden", - level: 4, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if a chapter is hidden. Hidden chapters **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapterflaghidden) on Chapter flags)." - }, - 154: { - name: "FlagInterlaced", - cppname: "VideoFlagInterlaced", - level: 4, - type: "u", - mandatory: true, - minver: 2, - webm: true, - "default": "0", - description: "Specify whether the video frames in this track are interlaced or not." - }, - 155: { - name: "BlockDuration", - level: 3, - type: "u", - description: "The duration of the Block, expressed in Track Ticks; see (#timestamp-ticks). The BlockDuration Element can be useful at the end of a Track to define the duration of the last frame (as there is no subsequent Block available), or when there is a break in a track like for subtitle tracks." - }, - 156: { - name: "FlagLacing", - cppname: "TrackFlagLacing", - level: 3, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the track **MAY** contain blocks using lacing. When set to 0 all blocks **MUST** have their lacing flags set to No lacing; see (#block-lacing) on Block Lacing." - }, - 157: { - name: "FieldOrder", - cppname: "VideoFieldOrder", - level: 4, - type: "u", - mandatory: true, - minver: 4, - "default": "2", - description: "Specify the field ordering of video frames in this track." - }, - 159: { - name: "Channels", - cppname: "AudioChannels", - level: 4, - type: "u", - mandatory: true, - "default": "1", - range: "not 0", - description: "Numbers of channels in the track." - }, - 160: { - name: "BlockGroup", - level: 2, - type: "m", - multiple: true, - description: "Basic container of information containing a single Block and information specific to that Block." - }, - 161: { - name: "Block", - level: 3, - type: "b", - mandatory: true, - description: "Block containing the actual data to be rendered and a timestamp relative to the Cluster Timestamp; see (#block-structure) on Block Structure." - }, - 162: { - name: "BlockVirtual", - level: 3, - type: "b", - minver: 0, - maxver: 0, - description: "A Block with no data. It **MUST** be stored in the stream at the place the real Block would be in display order. " - }, - 163: { - name: "SimpleBlock", - level: 2, - type: "b", - multiple: true, - minver: 2, - webm: true, - divx: true, - description: "Similar to Block, see (#block-structure), but without all the extra information, mostly used to reduced overhead when no extra feature is needed; see (#simpleblock-structure) on SimpleBlock Structure." - }, - 164: { - name: "CodecState", - level: 3, - type: "b", - minver: 2, - description: "The new codec state to use. Data interpretation is private to the codec. This information **SHOULD** always be referenced by a seek entry." - }, - 165: { - name: "BlockAdditional", - level: 5, - type: "b", - mandatory: true, - webm: true, - description: "Interpreted by the codec as it wishes (using the BlockAddID)." - }, - 166: { - name: "BlockMore", - level: 4, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contain the BlockAdditional and some parameters." - }, - 167: { - name: "Position", - cppname: "ClusterPosition", - level: 2, - type: "u", - description: "The Segment Position of the Cluster in the Segment (0 in live streams). It might help to resynchronise offset on damaged streams." - }, - 170: { - name: "CodecDecodeAll", - level: 3, - type: "u", - mandatory: true, - maxver: 0, - "default": "1", - range: "0-1", - description: "Set to 1 if the codec can decode potentially damaged data." - }, - 171: { - name: "PrevSize", - cppname: "ClusterPrevSize", - level: 2, - type: "u", - description: "Size of the previous Cluster, in octets. Can be useful for backward playing." - }, - 174: { - name: "TrackEntry", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Describes a track with all Elements." - }, - 175: { - name: "EncryptedBlock", - level: 2, - type: "b", - multiple: true, - minver: 0, - maxver: 0, - description: "Similar to SimpleBlock, see (#simpleblock-structure), but the data inside the Block are Transformed (encrypt and/or signed)." - }, - 176: { - name: "PixelWidth", - cppname: "VideoPixelWidth", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "Width of the encoded video frames in pixels." - }, - 178: { - name: "CueDuration", - level: 4, - type: "u", - minver: 4, - webm: true, - description: "The duration of the block, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks). If missing, the track's DefaultDuration does not apply and no duration information is available in terms of the cues." - }, - 179: { - name: "CueTime", - level: 3, - type: "u", - mandatory: true, - description: "Absolute timestamp of the seek point, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 181: { - name: "SamplingFrequency", - cppname: "AudioSamplingFreq", - level: 4, - type: "f", - mandatory: true, - "default": "0x1.f4p+12", - range: "> 0x0p+0", - description: "Sampling frequency in Hz." - }, - 182: { - name: "ChapterAtom", - level: 3, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains the atom information to use as the chapter atom (apply to all tracks)." - }, - 183: { - name: "CueTrackPositions", - level: 3, - type: "m", - mandatory: true, - multiple: true, - description: "Contain positions for different tracks corresponding to the timestamp." - }, - 185: { - name: "FlagEnabled", - cppname: "TrackFlagEnabled", - level: 3, - type: "u", - mandatory: true, - minver: 2, - webm: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the track is usable. It is possible to turn a not usable track into a usable track using chapter codecs or control tracks." - }, - 186: { - name: "PixelHeight", - cppname: "VideoPixelHeight", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "Height of the encoded video frames in pixels." - }, - 187: { - name: "CuePoint", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Contains all information relative to a seek point in the Segment." - }, - 191: { - name: "CRC-32", - level: -1, - type: "b", - minver: 1, - webm: false, - description: "The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian", - crc: true - }, - 192: { - name: "TrickTrackUID", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The TrackUID of the Smooth FF/RW video in the paired EBML structure corresponding to this video track. See [@?DivXTrickTrack]." - }, - 193: { - name: "TrickTrackSegmentUID", - level: 3, - type: "b", - minver: 0, - maxver: 0, - divx: true, - description: "The SegmentUID of the Segment containing the track identified by TrickTrackUID. See [@?DivXTrickTrack]." - }, - 196: { - name: "TrickMasterTrackSegmentUID", - level: 3, - type: "b", - minver: 0, - maxver: 0, - divx: true, - description: "The SegmentUID of the Segment containing the track identified by MasterTrackUID. See [@?DivXTrickTrack]." - }, - 198: { - name: "TrickTrackFlag", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - "default": "0", - description: "Set to 1 if this video track is a Smooth FF/RW track. If set to 1, MasterTrackUID and MasterTrackSegUID should must be present and BlockGroups for this track must contain ReferenceFrame structures. Otherwise, TrickTrackUID and TrickTrackSegUID must be present if this track has a corresponding Smooth FF/RW track. See [@?DivXTrickTrack]." - }, - 199: { - name: "TrickMasterTrackUID", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The TrackUID of the video track in the paired EBML structure that corresponds to this Smooth FF/RW track. See [@?DivXTrickTrack]." - }, - 200: { - name: "ReferenceFrame", - level: 3, - type: "m", - minver: 0, - maxver: 0, - divx: true, - description: "Contains information about the last reference frame. See [@?DivXTrickTrack]." - }, - 201: { - name: "ReferenceOffset", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - divx: true, - description: "The relative offset, in bytes, from the previous BlockGroup element for this Smooth FF/RW video track to the containing BlockGroup element. See [@?DivXTrickTrack]." - }, - 202: { - name: "ReferenceTimestamp", - cppname: "ReferenceTimeCode", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp of the BlockGroup pointed to by ReferenceOffset, expressed in Track Ticks; see (#timestamp-ticks). See [@?DivXTrickTrack]." - }, - 203: { - name: "BlockAdditionID", - cppname: "SliceBlockAddID", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The ID of the BlockAdditional Element (0 is the main Block)." - }, - 204: { - name: "LaceNumber", - cppname: "SliceLaceNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - description: "The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). Being able to interpret this Element is not **REQUIRED** for playback." - }, - 205: { - name: "FrameNumber", - cppname: "SliceFrameNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame)." - }, - 206: { - name: "Delay", - cppname: "SliceDelay", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The delay to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)." - }, - 207: { - name: "SliceDuration", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The duration to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)." - }, - 215: { - name: "TrackNumber", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number)." - }, - 219: { - name: "CueReference", - level: 4, - type: "m", - multiple: true, - minver: 2, - description: "The Clusters containing the referenced Blocks." - }, - 224: { - name: "Video", - cppname: "TrackVideo", - level: 3, - type: "m", - description: "Video settings." - }, - 225: { - name: "Audio", - cppname: "TrackAudio", - level: 3, - type: "m", - description: "Audio settings." - }, - 226: { - name: "TrackOperation", - level: 3, - type: "m", - minver: 3, - description: "Operation that needs to be applied on tracks to create this virtual track. For more details look at (#track-operation)." - }, - 227: { - name: "TrackCombinePlanes", - level: 4, - type: "m", - minver: 3, - description: "Contains the list of all video plane tracks that need to be combined to create this 3D track" - }, - 228: { - name: "TrackPlane", - level: 5, - type: "m", - mandatory: true, - multiple: true, - minver: 3, - description: "Contains a video plane track that need to be combined to create this 3D track" - }, - 229: { - name: "TrackPlaneUID", - level: 6, - type: "u", - mandatory: true, - minver: 3, - range: "not 0", - description: "The trackUID number of the track representing the plane." - }, - 230: { - name: "TrackPlaneType", - level: 6, - type: "u", - mandatory: true, - minver: 3, - description: "The kind of plane this track corresponds to." - }, - 231: { - name: "Timestamp", - cppname: "ClusterTimecode", - level: 2, - type: "u", - mandatory: true, - description: "Absolute timestamp of the cluster, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)." - }, - 232: { - name: "TimeSlice", - level: 4, - type: "m", - multiple: true, - minver: 0, - maxver: 0, - description: "Contains extra time information about the data contained in the Block. Being able to interpret this Element is not **REQUIRED** for playback." - }, - 233: { - name: "TrackJoinBlocks", - level: 4, - type: "m", - minver: 3, - description: "Contains the list of all tracks whose Blocks need to be combined to create this virtual track" - }, - 234: { - name: "CueCodecState", - level: 4, - type: "u", - mandatory: true, - minver: 2, - "default": "0", - description: "The Segment Position of the Codec State corresponding to this Cue Element. 0 means that the data is taken from the initial Track Entry." - }, - 235: { - name: "CueRefCodecState", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The Segment Position of the Codec State corresponding to this referenced Element. 0 means that the data is taken from the initial Track Entry." - }, - 236: { - name: "Void", - level: -1, - type: "b", - minver: 1, - description: "Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use." - }, - 237: { - name: "TrackJoinUID", - level: 5, - type: "u", - mandatory: true, - multiple: true, - minver: 3, - range: "not 0", - description: "The trackUID number of a track whose blocks are used to create this virtual track." - }, - 238: { - name: "BlockAddID", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "1", - range: "not 0", - description: "An ID to identify the BlockAdditional level. If BlockAddIDType of the corresponding block is 0, this value is also the value of BlockAddIDType for the meaning of the content of BlockAdditional." - }, - 240: { - name: "CueRelativePosition", - level: 4, - type: "u", - minver: 4, - webm: true, - description: "The relative position inside the Cluster of the referenced SimpleBlock or BlockGroup with 0 being the first possible position for an Element inside that Cluster." - }, - 241: { - name: "CueClusterPosition", - level: 4, - type: "u", - mandatory: true, - description: "The Segment Position of the Cluster containing the associated Block." - }, - 247: { - name: "CueTrack", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "The track for which a position is given." - }, - 250: { - name: "ReferencePriority", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced." - }, - 251: { - name: "ReferenceBlock", - level: 3, - type: "i", - multiple: true, - description: "A timestamp value, relative to the timestamp of the Block in this BlockGroup, expressed in Track Ticks; see (#timestamp-ticks). This is used to reference other frames necessary to decode this frame. The relative value **SHOULD** correspond to a valid `Block` this `Block` depends on. Historically Matroska Writer didn't write the actual `Block(s)` this `Block` depends on, but *some* `Block` in the past. The value \"0\" **MAY** also be used to signify this `Block` cannot be decoded on its own, but without knownledge of which `Block` is necessary. In this case, other `ReferenceBlock` **MUST NOT** be found in the same `BlockGroup`. If the `BlockGroup` doesn't have any `ReferenceBlock` element, then the `Block` it contains can be decoded without using any other `Block` data." - }, - 253: { - name: "ReferenceVirtual", - level: 3, - type: "i", - minver: 0, - maxver: 0, - description: "The Segment Position of the data that would otherwise be in position of the virtual block." - }, - 16804: { - name: "BlockAddIDName", - level: 4, - type: "s", - minver: 4, - description: "A human-friendly name describing the type of BlockAdditional data, as defined by the associated Block Additional Mapping." - }, - 16868: { - name: "BlockAdditionMapping", - level: 3, - type: "m", - multiple: true, - minver: 4, - description: "Contains elements that extend the track format, by adding content either to each frame, with BlockAddID ((#blockaddid-element)), or to the track as a whole with BlockAddIDExtraData." - }, - 16871: { - name: "BlockAddIDType", - level: 4, - type: "u", - mandatory: true, - minver: 4, - "default": "0", - description: "Stores the registered identifier of the Block Additional Mapping to define how the BlockAdditional data should be handled." - }, - 16877: { - name: "BlockAddIDExtraData", - level: 4, - type: "b", - minver: 4, - description: "Extra binary data that the BlockAddIDType can use to interpret the BlockAdditional data. The interpretation of the binary data depends on the BlockAddIDType value and the corresponding Block Additional Mapping." - }, - 16880: { - name: "BlockAddIDValue", - level: 4, - type: "u", - minver: 4, - range: ">=2", - description: "If the track format extension needs content beside frames, the value refers to the BlockAddID ((#blockaddid-element)), value being described. To keep MaxBlockAdditionID as low as possible, small values **SHOULD** be used." - }, - 16980: { - name: "ContentCompAlgo", - level: 6, - type: "u", - mandatory: true, - "default": "0", - description: "The compression algorithm used." - }, - 16981: { - name: "ContentCompSettings", - level: 6, - type: "b", - description: "Settings that might be needed by the decompressor. For Header Stripping (`ContentCompAlgo`=3), the bytes that were removed from the beginning of each frames of the track." - }, - 17026: { - name: "DocType", - level: 1, - type: "s", - mandatory: true, - "default": "matroska", - minver: 1, - description: "A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files." - }, - 17029: { - name: "DocTypeReadVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The minimum DocType version an interpreter has to support to read this file." - }, - 17030: { - name: "EBMLVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The version of EBML parser used to create the file." - }, - 17031: { - name: "DocTypeVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The version of DocType interpreter used to create the file." - }, - 17138: { - name: "EBMLMaxIDLength", - level: 1, - type: "u", - mandatory: true, - "default": "4", - range: "4" - }, - 17139: { - name: "EBMLMaxSizeLength", - level: 1, - type: "u", - mandatory: true, - "default": "8", - range: "1-8" - }, - 17143: { - name: "EBMLReadVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The minimum EBML version a parser has to support to read this file." - }, - 17276: { - name: "ChapLanguage", - cppname: "ChapterLanguage", - level: 5, - type: "s", - mandatory: true, - multiple: true, - webm: true, - "default": "eng", - description: "A language corresponding to the string, in the bibliographic ISO-639-2 form [@!ISO639-2]. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element." - }, - 17277: { - name: "ChapLanguageIETF", - level: 5, - type: "s", - multiple: true, - minver: 4, - description: "Specifies a language corresponding to the ChapString in the format defined in [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If a ChapLanguageIETF Element is used, then any ChapLanguage and ChapCountry Elements used in the same ChapterDisplay **MUST** be ignored." - }, - 17278: { - name: "ChapCountry", - cppname: "ChapterCountry", - level: 5, - type: "s", - multiple: true, - webm: true, - description: "A country corresponding to the string, using the same 2 octets country-codes as in Internet domains [@!IANADomains] based on [@!ISO3166-1] alpha-2 codes. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element." - }, - 17476: { - name: "SegmentFamily", - level: 2, - type: "b", - multiple: true, - description: "A randomly generated unique ID that all Segments of a Linked Segment **MUST** share (128 bits)." - }, - 17505: { - name: "DateUTC", - level: 2, - type: "d", - description: "The date and time that the Segment was created by the muxing application or library." - }, - 17530: { - name: "TagLanguage", - cppname: "TagLangue", - level: 4, - type: "s", - mandatory: true, - webm: true, - "default": "und", - description: "Specifies the language of the tag specified, in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the TagLanguageIETF Element is used within the same SimpleTag Element." - }, - 17531: { - name: "TagLanguageIETF", - level: 4, - type: "s", - minver: 4, - description: "Specifies the language used in the TagString according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any TagLanguage Elements used in the same SimpleTag **MUST** be ignored." - }, - 17540: { - name: "TagDefault", - level: 4, - type: "u", - mandatory: true, - webm: true, - "default": "1", - range: "0-1", - description: "A boolean value to indicate if this is the default/original language to use for the given tag." - }, - 17541: { - name: "TagBinary", - level: 4, - type: "b", - webm: true, - description: "The values of the Tag, if it is binary. Note that this cannot be used in the same SimpleTag as TagString." - }, - 17543: { - name: "TagString", - level: 4, - type: "8", - webm: true, - description: "The value of the Tag." - }, - 17545: { - name: "Duration", - level: 2, - type: "f", - range: "> 0x0p+0", - description: "Duration of the Segment, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)." - }, - 17588: { - name: "TagDefaultBogus", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - "default": "1", - range: "0-1", - description: "A variant of the TagDefault element with a bogus Element ID; see (#tagdefault-element)." - }, - 17677: { - name: "ChapProcessPrivate", - cppname: "ChapterProcessPrivate", - level: 5, - type: "b", - description: 'Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent; see (#menu-features) on DVD menus.' - }, - 17816: { - name: "ChapterFlagEnabled", - level: 4, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie **SHOULD** skip all the content between the TimeStart and TimeEnd of this chapter; see (#chapter-flags) on Chapter flags." - }, - 17827: { - name: "TagName", - level: 4, - type: "8", - mandatory: true, - webm: true, - description: "The name of the Tag that is going to be stored." - }, - 17849: { - name: "EditionEntry", - level: 2, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains all information about a Segment edition." - }, - 17852: { - name: "EditionUID", - level: 3, - type: "u", - range: "not 0", - description: "A unique ID to identify the edition. It's useful for tagging an edition." - }, - 17853: { - name: "EditionFlagHidden", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if an edition is hidden. Hidden editions **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapter-flags) on Chapter flags)." - }, - 17883: { - name: "EditionFlagDefault", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if the edition **SHOULD** be used as the default one." - }, - 17885: { - name: "EditionFlagOrdered", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if the chapters can be defined multiple times and the order to play them is enforced; see (#editionflagordered)." - }, - 18012: { - name: "FileData", - level: 3, - type: "b", - mandatory: true, - description: "The data of the file." - }, - 18016: { - name: "FileMimeType", - cppname: "MimeType", - level: 3, - type: "s", - mandatory: true, - description: "MIME type of the file." - }, - 18017: { - name: "FileUsedStartTime", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp at which this optimized font attachment comes into context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]." - }, - 18018: { - name: "FileUsedEndTime", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp at which this optimized font attachment goes out of context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]." - }, - 18030: { - name: "FileName", - level: 3, - type: "8", - mandatory: true, - description: "Filename of the attached file." - }, - 18037: { - name: "FileReferral", - level: 3, - type: "b", - minver: 0, - maxver: 0, - description: "A binary value that a track/codec can refer to when the attachment is needed." - }, - 18046: { - name: "FileDescription", - level: 3, - type: "8", - description: "A human-friendly name for the attached file." - }, - 18094: { - name: "FileUID", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "Unique ID representing the file, as random as possible." - }, - 18401: { - name: "ContentEncAlgo", - level: 6, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: 'The encryption algorithm used. The value "0" means that the contents have not been encrypted.' - }, - 18402: { - name: "ContentEncKeyID", - level: 6, - type: "b", - webm: true, - description: "For public key algorithms this is the ID of the public key the the data was encrypted with." - }, - 18403: { - name: "ContentSignature", - level: 6, - type: "b", - maxver: 0, - description: "A cryptographic signature of the contents." - }, - 18404: { - name: "ContentSigKeyID", - level: 6, - type: "b", - maxver: 0, - description: "This is the ID of the private key the data was signed with." - }, - 18405: { - name: "ContentSigAlgo", - level: 6, - type: "u", - maxver: 0, - "default": "0", - description: "The algorithm used for the signature." - }, - 18406: { - name: "ContentSigHashAlgo", - level: 6, - type: "u", - maxver: 0, - "default": "0", - description: "The hash algorithm used for the signature." - }, - 18407: { - name: "ContentEncAESSettings", - level: 6, - type: "m", - minver: 4, - webm: true, - description: "Settings describing the encryption algorithm used. If `ContentEncAlgo` != 5 this **MUST** be ignored." - }, - 18408: { - name: "AESSettingsCipherMode", - level: 7, - type: "u", - mandatory: true, - minver: 4, - webm: true, - description: "The AES cipher mode used in the encryption." - }, - 19840: { - name: "MuxingApp", - level: 2, - type: "8", - mandatory: true, - description: 'Muxing application or library (example: "libmatroska-0.4.3").' - }, - 19899: { - name: "Seek", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Contains a single seek entry to an EBML Element." - }, - 20529: { - name: "ContentEncodingOrder", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: "Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder Elements in the TrackEntry that contains this ContentEncodingOrder element." - }, - 20530: { - name: "ContentEncodingScope", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "1", - description: "A bit field that describes which Elements have been modified in this way. Values (big-endian) can be OR'ed." - }, - 20531: { - name: "ContentEncodingType", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: "A value describing what kind of transformation is applied." - }, - 20532: { - name: "ContentCompression", - level: 5, - type: "m", - description: "Settings describing the compression used. This Element **MUST** be present if the value of ContentEncodingType is 0 and absent otherwise. Each block **MUST** be decompressable even if no previous block is available in order not to prevent seeking." - }, - 20533: { - name: "ContentEncryption", - level: 5, - type: "m", - webm: true, - description: "Settings describing the encryption used. This Element **MUST** be present if the value of `ContentEncodingType` is 1 (encryption) and **MUST** be ignored otherwise." - }, - 21343: { - name: "CueRefNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "1", - range: "not 0", - description: "Number of the referenced Block of Track X in the specified Cluster." - }, - 21358: { - name: "Name", - cppname: "TrackName", - level: 3, - type: "8", - description: "A human-readable track name." - }, - 21368: { - name: "CueBlockNumber", - level: 4, - type: "u", - range: "not 0", - description: "Number of the Block in the specified Cluster." - }, - 21375: { - name: "TrackOffset", - level: 3, - type: "i", - minver: 0, - maxver: 0, - "default": "0", - description: "A value to add to the Block's Timestamp, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). This can be used to adjust the playback offset of a track." - }, - 21419: { - name: "SeekID", - level: 3, - type: "b", - mandatory: true, - description: "The binary ID corresponding to the Element name." - }, - 21420: { - name: "SeekPosition", - level: 3, - type: "u", - mandatory: true, - description: "The Segment Position of the Element." - }, - 21432: { - name: "StereoMode", - cppname: "VideoStereoMode", - level: 4, - type: "u", - mandatory: true, - minver: 3, - webm: true, - "default": "0", - description: "Stereo-3D video mode. There are some more details in (#multi-planar-and-3d-videos)." - }, - 21433: { - name: "OldStereoMode", - level: 4, - type: "u", - maxver: 0, - description: "DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska." - }, - 21440: { - name: "AlphaMode", - cppname: "VideoAlphaMode", - level: 4, - type: "u", - mandatory: true, - minver: 3, - webm: true, - "default": "0", - description: 'Indicate whether the BlockAdditional Element with BlockAddID of "1" contains Alpha data, as defined by to the Codec Mapping for the `CodecID`. Undefined values **SHOULD NOT** be used as the behavior of known implementations is different (considered either as 0 or 1).' - }, - 21674: { - name: "PixelCropBottom", - cppname: "VideoPixelCropBottom", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove at the bottom of the image." - }, - 21680: { - name: "DisplayWidth", - cppname: "VideoDisplayWidth", - level: 4, - type: "u", - range: "not 0", - description: "Width of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)." - }, - 21682: { - name: "DisplayUnit", - cppname: "VideoDisplayUnit", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "How DisplayWidth & DisplayHeight are interpreted." - }, - 21683: { - name: "AspectRatioType", - cppname: "VideoAspectRatio", - level: 4, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "Specify the possible modifications to the aspect ratio." - }, - 21690: { - name: "DisplayHeight", - cppname: "VideoDisplayHeight", - level: 4, - type: "u", - range: "not 0", - description: "Height of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)." - }, - 21691: { - name: "PixelCropTop", - cppname: "VideoPixelCropTop", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove at the top of the image." - }, - 21708: { - name: "PixelCropLeft", - cppname: "VideoPixelCropLeft", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove on the left of the image." - }, - 21725: { - name: "PixelCropRight", - cppname: "VideoPixelCropRight", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove on the right of the image." - }, - 21930: { - name: "FlagForced", - cppname: "TrackFlagForced", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Applies only to subtitles. Set if that track **SHOULD** be eligible for automatic selection by the player if it matches the user's language preference, even if the user's preferences would normally not enable subtitles with the selected audio track; this can be used for tracks containing only translations of foreign-language audio or onscreen text. See (#default-track-selection) for more details." - }, - 21931: { - name: "FlagHearingImpaired", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is suitable for users with hearing impairments, set to 0 if it is unsuitable for users with hearing impairments." - }, - 21932: { - name: "FlagVisualImpaired", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is suitable for users with visual impairments, set to 0 if it is unsuitable for users with visual impairments." - }, - 21933: { - name: "FlagTextDescriptions", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track contains textual descriptions of video content, set to 0 if that track does not contain textual descriptions of video content." - }, - 21934: { - name: "FlagOriginal", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is in the content's original language, set to 0 if it is a translation." - }, - 21935: { - name: "FlagCommentary", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track contains commentary, set to 0 if it does not contain commentary." - }, - 21936: { - name: "Colour", - cppname: "VideoColour", - level: 4, - type: "m", - minver: 4, - webm: true, - description: "Settings describing the colour format." - }, - 21937: { - name: "MatrixCoefficients", - cppname: "VideoColourMatrix", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273." - }, - 21938: { - name: "BitsPerChannel", - cppname: "VideoBitsPerChannel", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Number of decoded bits per channel. A value of 0 indicates that the BitsPerChannel is unspecified." - }, - 21939: { - name: "ChromaSubsamplingHorz", - cppname: "VideoChromaSubsampHorz", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cr and Cb channels for every pixel not removed horizontally. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1." - }, - 21940: { - name: "ChromaSubsamplingVert", - cppname: "VideoChromaSubsampVert", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cr and Cb channels for every pixel not removed vertically. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingVert **SHOULD** be set to 1." - }, - 21941: { - name: "CbSubsamplingHorz", - cppname: "VideoCbSubsampHorz", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cb channel for every pixel not removed horizontally. This is additive with ChromaSubsamplingHorz. Example: For video with 4:2:1 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1 and CbSubsamplingHorz **SHOULD** be set to 1." - }, - 21942: { - name: "CbSubsamplingVert", - cppname: "VideoCbSubsampVert", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cb channel for every pixel not removed vertically. This is additive with ChromaSubsamplingVert." - }, - 21943: { - name: "ChromaSitingHorz", - cppname: "VideoChromaSitHorz", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "How chroma is subsampled horizontally." - }, - 21944: { - name: "ChromaSitingVert", - cppname: "VideoChromaSitVert", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "How chroma is subsampled vertically." - }, - 21945: { - name: "Range", - cppname: "VideoColourRange", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Clipping of the color ranges." - }, - 21946: { - name: "TransferCharacteristics", - cppname: "VideoColourTransferCharacter", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics are adopted from Table 3 of ISO/IEC 23091-4 or ITU-T H.273." - }, - 21947: { - name: "Primaries", - cppname: "VideoColourPrimaries", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273." - }, - 21948: { - name: "MaxCLL", - cppname: "VideoColourMaxCLL", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "Maximum brightness of a single pixel (Maximum Content Light Level) in candelas per square meter (cd/m^2^)." - }, - 21949: { - name: "MaxFALL", - cppname: "VideoColourMaxFALL", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "Maximum brightness of a single full frame (Maximum Frame-Average Light Level) in candelas per square meter (cd/m^2^)." - }, - 21968: { - name: "MasteringMetadata", - cppname: "VideoColourMasterMeta", - level: 5, - type: "m", - minver: 4, - webm: true, - description: "SMPTE 2086 mastering data." - }, - 21969: { - name: "PrimaryRChromaticityX", - cppname: "VideoRChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Red X chromaticity coordinate, as defined by CIE 1931." - }, - 21970: { - name: "PrimaryRChromaticityY", - cppname: "VideoRChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Red Y chromaticity coordinate, as defined by CIE 1931." - }, - 21971: { - name: "PrimaryGChromaticityX", - cppname: "VideoGChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Green X chromaticity coordinate, as defined by CIE 1931." - }, - 21972: { - name: "PrimaryGChromaticityY", - cppname: "VideoGChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Green Y chromaticity coordinate, as defined by CIE 1931." - }, - 21973: { - name: "PrimaryBChromaticityX", - cppname: "VideoBChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Blue X chromaticity coordinate, as defined by CIE 1931." - }, - 21974: { - name: "PrimaryBChromaticityY", - cppname: "VideoBChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Blue Y chromaticity coordinate, as defined by CIE 1931." - }, - 21975: { - name: "WhitePointChromaticityX", - cppname: "VideoWhitePointChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "White X chromaticity coordinate, as defined by CIE 1931." - }, - 21976: { - name: "WhitePointChromaticityY", - cppname: "VideoWhitePointChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "White Y chromaticity coordinate, as defined by CIE 1931." - }, - 21977: { - name: "LuminanceMax", - cppname: "VideoLuminanceMax", - level: 6, - type: "f", - minver: 4, - webm: true, - range: ">= 0x0p+0", - description: "Maximum luminance. Represented in candelas per square meter (cd/m^2^)." - }, - 21978: { - name: "LuminanceMin", - cppname: "VideoLuminanceMin", - level: 6, - type: "f", - minver: 4, - webm: true, - range: ">= 0x0p+0", - description: "Minimum luminance. Represented in candelas per square meter (cd/m^2^)." - }, - 21998: { - name: "MaxBlockAdditionID", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "The maximum value of BlockAddID ((#blockaddid-element)). A value 0 means there is no BlockAdditions ((#blockadditions-element)) for this track." - }, - 22100: { - name: "ChapterStringUID", - level: 4, - type: "8", - minver: 3, - webm: true, - description: "A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage [@!WebVTT]." - }, - 22186: { - name: "CodecDelay", - level: 3, - type: "u", - mandatory: true, - minver: 4, - webm: true, - description: "CodecDelay is The codec-built-in delay, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). It represents the amount of codec samples that will be discarded by the decoder during playback. This timestamp value **MUST** be subtracted from each frame timestamp in order to get the timestamp that will be actually played. The value **SHOULD** be small so the muxing of tracks with the same actual timestamp are in the same Cluster." - }, - 22203: { - name: "SeekPreRoll", - level: 3, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "After a discontinuity, SeekPreRoll is the duration of the data the decoder **MUST** decode before the decoded data is valid, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 22337: { - name: "WritingApp", - level: 2, - type: "8", - mandatory: true, - description: 'Writing application (example: "mkvmerge-0.3.3").' - }, - 22612: { - name: "SilentTracks", - cppname: "ClusterSilentTracks", - level: 2, - type: "m", - minver: 0, - maxver: 0, - description: "The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking or to decide what track to use." - }, - 22743: { - name: "SilentTrackNumber", - cppname: "ClusterSilentTrackNumber", - level: 3, - type: "u", - multiple: true, - minver: 0, - maxver: 0, - description: "One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster." - }, - 24999: { - name: "AttachedFile", - cppname: "Attached", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "An attached file." - }, - 25152: { - name: "ContentEncoding", - level: 4, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Settings for one content encoding like compression or encryption." - }, - 25188: { - name: "BitDepth", - cppname: "AudioBitDepth", - level: 4, - type: "u", - range: "not 0", - description: "Bits per sample, mostly used for PCM." - }, - 25506: { - name: "CodecPrivate", - level: 3, - type: "b", - description: "Private data only known to the codec." - }, - 25536: { - name: "Targets", - cppname: "TagTargets", - level: 3, - type: "m", - mandatory: true, - webm: true, - description: "Specifies which other elements the metadata represented by the Tag applies to. If empty or not present, then the Tag describes everything in the Segment." - }, - 25539: { - name: "ChapterPhysicalEquiv", - level: 4, - type: "u", - description: 'Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50); see (#physical-types) for a complete list of values.' - }, - 25540: { - name: "TagChapterUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the Chapter(s) the tags belong to." - }, - 25541: { - name: "TagTrackUID", - level: 4, - type: "u", - multiple: true, - webm: true, - "default": "0", - description: "A unique ID to identify the Track(s) the tags belong to." - }, - 25542: { - name: "TagAttachmentUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the Attachment(s) the tags belong to." - }, - 25545: { - name: "TagEditionUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the EditionEntry(s) the tags belong to." - }, - 25546: { - name: "TargetType", - cppname: "TagTargetType", - level: 4, - type: "s", - webm: true, - description: 'An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc ; see Section 6.4 of [@!MatroskaTags].' - }, - 25906: { - name: "SignedElement", - level: 3, - type: "b", - multiple: true, - webm: false, - description: "An element ID whose data will be used to compute the signature." - }, - 26148: { - name: "TrackTranslate", - level: 3, - type: "m", - multiple: true, - description: "The mapping between this `TrackEntry` and a track value in the given Chapter Codec." - }, - 26277: { - name: "TrackTranslateTrackID", - level: 4, - type: "b", - mandatory: true, - description: "The binary value used to represent this `TrackEntry` in the chapter codec data. The format depends on the `ChapProcessCodecID` used; see (#chapprocesscodecid-element)." - }, - 26303: { - name: "TrackTranslateCodec", - level: 4, - type: "u", - mandatory: true, - description: "This `TrackTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)." - }, - 26364: { - name: "TrackTranslateEditionUID", - level: 4, - type: "u", - multiple: true, - description: "Specify a chapter edition UID on which this `TrackTranslate` applies." - }, - 26568: { - name: "SimpleTag", - cppname: "TagSimple", - level: 3, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains general information about the target." - }, - 26826: { - name: "TargetTypeValue", - cppname: "TagTargetTypeValue", - level: 4, - type: "u", - mandatory: true, - webm: true, - "default": "50", - description: "A number to indicate the logical level of the target." - }, - 26897: { - name: "ChapProcessCommand", - cppname: "ChapterProcessCommand", - level: 5, - type: "m", - multiple: true, - description: "Contains all the commands associated to the Atom." - }, - 26914: { - name: "ChapProcessTime", - cppname: "ChapterProcessTime", - level: 6, - type: "u", - mandatory: true, - description: "Defines when the process command **SHOULD** be handled" - }, - 26916: { - name: "ChapterTranslate", - level: 2, - type: "m", - multiple: true, - description: "The mapping between this `Segment` and a segment value in the given Chapter Codec." - }, - 26931: { - name: "ChapProcessData", - cppname: "ChapterProcessData", - level: 6, - type: "b", - mandatory: true, - description: "Contains the command information. The data **SHOULD** be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands; see (#menu-features) on DVD menus." - }, - 26948: { - name: "ChapProcess", - cppname: "ChapterProcess", - level: 4, - type: "m", - multiple: true, - description: "Contains all the commands associated to the Atom." - }, - 26965: { - name: "ChapProcessCodecID", - cppname: "ChapterProcessCodecID", - level: 5, - type: "u", - mandatory: true, - "default": "0", - description: "Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used; see (#menu-features) on DVD menus. More codec IDs can be added later." - }, - 27045: { - name: "ChapterTranslateID", - level: 3, - type: "b", - mandatory: true, - description: "The binary value used to represent this Segment in the chapter codec data. The format depends on the ChapProcessCodecID used; see (#chapprocesscodecid-element)." - }, - 27071: { - name: "ChapterTranslateCodec", - level: 3, - type: "u", - mandatory: true, - description: "This `ChapterTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)." - }, - 27132: { - name: "ChapterTranslateEditionUID", - level: 3, - type: "u", - multiple: true, - description: "Specify a chapter edition UID on which this `ChapterTranslate` applies." - }, - 28032: { - name: "ContentEncodings", - level: 3, - type: "m", - webm: true, - description: "Settings for several content encoding mechanisms like compression or encryption." - }, - 28135: { - name: "MinCache", - cppname: "TrackMinCache", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "The minimum number of frames a player **SHOULD** be able to cache during playback. If set to 0, the reference pseudo-cache system is not used." - }, - 28152: { - name: "MaxCache", - cppname: "TrackMaxCache", - level: 3, - type: "u", - description: "The maximum cache size necessary to store referenced frames in and the current frame. 0 means no cache is needed." - }, - 28263: { - name: "ChapterSegmentUID", - level: 4, - type: "b", - range: ">0", - description: "The SegmentUID of another Segment to play during this chapter." - }, - 28348: { - name: "ChapterSegmentEditionUID", - level: 4, - type: "u", - range: "not 0", - description: "The EditionUID to play from the Segment linked in ChapterSegmentUID. If ChapterSegmentEditionUID is undeclared, then no Edition of the linked Segment is used; see (#medium-linking) on medium-linking Segments." - }, - 28587: { - name: "TrackOverlay", - level: 3, - type: "u", - multiple: true, - description: "Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap, see (#silenttracks-element) on SilentTracks, the overlay track **SHOULD** be used instead. The order of multiple TrackOverlay matters, the first one is the one that **SHOULD** be used. If not found it **SHOULD** be the second, etc." - }, - 29555: { - name: "Tag", - level: 2, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "A single metadata descriptor." - }, - 29572: { - name: "SegmentFilename", - level: 2, - type: "8", - description: "A filename corresponding to this Segment." - }, - 29604: { - name: "SegmentUID", - level: 2, - type: "b", - range: "not 0", - description: "A randomly generated unique ID to identify the Segment amongst many others (128 bits)." - }, - 29636: { - name: "ChapterUID", - level: 4, - type: "u", - mandatory: true, - webm: true, - range: "not 0", - description: "A unique ID to identify the Chapter." - }, - 29637: { - name: "TrackUID", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "A unique ID to identify the Track." - }, - 29766: { - name: "AttachmentLink", - cppname: "TrackAttachmentLink", - level: 3, - type: "u", - maxver: 3, - range: "not 0", - description: "The UID of an attachment that is used by this codec." - }, - 30113: { - name: "BlockAdditions", - level: 3, - type: "m", - webm: true, - description: "Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data." - }, - 30114: { - name: "DiscardPadding", - level: 3, - type: "i", - minver: 4, - webm: true, - description: "Duration of the silent data added to the Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and **SHOULD** be discarded during playback." - }, - 30320: { - name: "Projection", - cppname: "VideoProjection", - level: 4, - type: "m", - minver: 4, - webm: true, - description: "Describes the video projection details. Used to render spherical, VR videos or flipping videos horizontally/vertically." - }, - 30321: { - name: "ProjectionType", - cppname: "VideoProjectionType", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Describes the projection used for this video track." - }, - 30322: { - name: "ProjectionPrivate", - cppname: "VideoProjectionPrivate", - level: 5, - type: "b", - minver: 4, - webm: true, - description: "Private data that only applies to a specific projection. * If `ProjectionType` equals 0 (Rectangular), then this element must not be present. * If `ProjectionType` equals 1 (Equirectangular), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Equirectangular Projection Box ('equi'). * If `ProjectionType` equals 2 (Cubemap), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Cubemap Projection Box ('cbmp'). * If `ProjectionType` equals 3 (Mesh), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Mesh Projection Box ('mshp')." - }, - 30323: { - name: "ProjectionPoseYaw", - cppname: "VideoProjectionPoseYaw", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0xB4p+0, <= 0xB4p+0", - description: "Specifies a yaw rotation to the projection. Value represents a clockwise rotation, in degrees, around the up vector. This rotation must be applied before any `ProjectionPosePitch` or `ProjectionPoseRoll` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseYaw` to 180 or -180 degrees, with the `ProjectionPoseRoll` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally." - }, - 30324: { - name: "ProjectionPosePitch", - cppname: "VideoProjectionPosePitch", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0x5Ap+0, <= 0x5Ap+0", - description: "Specifies a pitch rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the right vector. This rotation must be applied after the `ProjectionPoseYaw` rotation and before the `ProjectionPoseRoll` rotation. The value of this element **MUST** be in the -90 to 90 degree range, both included." - }, - 30325: { - name: "ProjectionPoseRoll", - cppname: "VideoProjectionPoseRoll", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0xB4p+0, <= 0xB4p+0", - description: "Specifies a roll rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the forward vector. This rotation must be applied after the `ProjectionPoseYaw` and `ProjectionPosePitch` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseRoll` to 180 or -180 degrees, the `ProjectionPoseYaw` to 180 or -180 degrees with `ProjectionPosePitch` set to 0 degrees flips the image vertically. Setting `ProjectionPoseRoll` to 180 or -180 degrees, with the `ProjectionPoseYaw` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally and vertically." - }, - 30901: { - name: "OutputSamplingFrequency", - cppname: "AudioOutputSamplingFreq", - level: 4, - type: "f", - range: "> 0x0p+0", - description: "Real output sampling frequency in Hz (used for SBR techniques)." - }, - 31657: { - name: "Title", - level: 2, - type: "8", - webm: true, - description: "General name of the Segment." - }, - 32123: { - name: "ChannelPositions", - cppname: "AudioPosition", - level: 4, - type: "b", - minver: 0, - maxver: 0, - description: "Table of horizontal angles for each successive channel." - }, - 32347: { - name: "SignatureElements", - level: 1, - type: "m", - webm: false, - description: "Contains elements that will be used to compute the signature." - }, - 32379: { - name: "SignatureElementList", - level: 2, - type: "m", - multiple: true, - webm: false, - i: "Cluster|Block|BlockAdditional", - description: "A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption." - }, - 32394: { - name: "SignatureAlgo", - level: 1, - type: "u", - webm: false, - description: "Signature algorithm used (1=RSA, 2=elliptic)." - }, - 32410: { - name: "SignatureHash", - level: 1, - type: "u", - webm: false, - description: "Hash algorithm used (1=SHA1-160, 2=MD5)." - }, - 32421: { - name: "SignaturePublicKey", - level: 1, - type: "b", - webm: false, - description: "The public key to use with the algorithm (in the case of a PKI-based signature)." - }, - 32437: { - name: "Signature", - level: 1, - type: "b", - webm: false, - description: "The signature of the data (until a new." - }, - 2274716: { - name: "Language", - cppname: "TrackLanguage", - level: 3, - type: "s", - mandatory: true, - "default": "eng", - description: "Specifies the language of the track in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the LanguageIETF Element is used in the same TrackEntry." - }, - 2274717: { - name: "LanguageIETF", - level: 3, - type: "s", - minver: 4, - description: "Specifies the language of the track according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any Language Elements used in the same TrackEntry **MUST** be ignored." - }, - 2306383: { - name: "TrackTimestampScale", - cppname: "TrackTimecodeScale", - level: 3, - type: "f", - mandatory: true, - maxver: 3, - "default": "0x1p+0", - range: "> 0x0p+0", - description: "DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs)." - }, - 2313850: { - name: "DefaultDecodedFieldDuration", - cppname: "TrackDefaultDecodedFieldDuration", - level: 3, - type: "u", - minver: 4, - range: "not 0", - description: "The period between two successive fields at the output of the decoding process, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). see (#defaultdecodedfieldduration) for more information" - }, - 2327523: { - name: "FrameRate", - cppname: "VideoFrameRate", - level: 4, - type: "f", - minver: 0, - maxver: 0, - range: "> 0x0p+0", - description: "Number of frames per second. This value is Informational only. It is intended for constant frame rate streams, and **SHOULD NOT** be used for a variable frame rate TrackEntry." - }, - 2352003: { - name: "DefaultDuration", - cppname: "TrackDefaultDuration", - level: 3, - type: "u", - range: "not 0", - description: "Number of nanoseconds per frame, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (frame in the Matroska sense -- one Element put into a (Simple)Block)." - }, - 2459272: { - name: "CodecName", - level: 3, - type: "8", - description: "A human-readable string specifying the codec." - }, - 2536e3: { - name: "CodecDownloadURL", - level: 3, - type: "s", - multiple: true, - minver: 0, - maxver: 0, - description: "A URL to download about the codec used." - }, - 2807729: { - name: "TimestampScale", - cppname: "TimecodeScale", - level: 2, - type: "u", - mandatory: true, - "default": "1000000", - range: "not 0", - description: "Base unit for Segment Ticks and Track Ticks, in nanoseconds. A TimestampScale value of 1.000.000 means scaled timestamps in the Segment are expressed in milliseconds; see (#timestamps) on how to interpret timestamps." - }, - 2807730: { - name: "TimecodeScaleDenominator", - level: 2, - type: "u", - mandatory: true, - minver: 4, - "default": "1000000000", - description: "Timestamp scale numerator, see TimecodeScale." - }, - 3061028: { - name: "UncompressedFourCC", - cppname: "VideoColourSpace", - level: 4, - type: "b", - description: "Specify the uncompressed pixel format used for the Track's data as a FourCC. This value is similar in scope to the biCompression value of AVI's `BITMAPINFO` [@?AVIFormat]. See the YUV video formats [@?FourCC-YUV] and RGB video formats [@?FourCC-RGB] for common values." - }, - 3126563: { - name: "GammaValue", - cppname: "VideoGamma", - level: 4, - type: "f", - minver: 0, - maxver: 0, - range: "> 0x0p+0", - description: "Gamma Value." - }, - 3839639: { - name: "CodecSettings", - level: 3, - type: "8", - minver: 0, - maxver: 0, - description: "A string describing the encoding setting used." - }, - 3883072: { - name: "CodecInfoURL", - level: 3, - type: "s", - multiple: true, - minver: 0, - maxver: 0, - description: "A URL to find information about the codec used." - }, - 3965867: { - name: "PrevFilename", - level: 2, - type: "8", - description: "A filename corresponding to the file of the previous Linked Segment." - }, - 3979555: { - name: "PrevUID", - level: 2, - type: "b", - description: "A unique ID to identify the previous Segment of a Linked Segment (128 bits)." - }, - 4096955: { - name: "NextFilename", - level: 2, - type: "8", - description: "A filename corresponding to the file of the next Linked Segment." - }, - 4110627: { - name: "NextUID", - level: 2, - type: "b", - description: "A unique ID to identify the next Segment of a Linked Segment (128 bits)." - }, - 272869232: { - name: "Chapters", - level: 1, - type: "m", - webm: true, - description: "A system to define basic menus and partition data. For more detailed information, look at the Chapters explanation in (#chapters)." - }, - 290298740: { - name: "SeekHead", - level: 1, - type: "m", - multiple: true, - description: "Contains the Segment Position of other Top-Level Elements." - }, - 307544935: { - name: "Tags", - level: 1, - type: "m", - multiple: true, - webm: true, - description: "Element containing metadata describing Tracks, Editions, Chapters, Attachments, or the Segment as a whole. A list of valid tags can be found in [@!MatroskaTags]." - }, - 357149030: { - name: "Info", - level: 1, - type: "m", - mandatory: true, - description: "Contains general information about the Segment." - }, - 374648427: { - name: "Tracks", - level: 1, - type: "m", - description: "A Top-Level Element of information with many tracks described." - }, - 408125543: { - name: "Segment", - level: 0, - type: "m", - mandatory: true, - description: "The Root Element that contains all other Top-Level Elements (Elements defined only at Level 1). A Matroska file is composed of 1 Segment." - }, - 423732329: { - name: "Attachments", - level: 1, - type: "m", - description: "Contain attached files." - }, - 440786851: { - name: "EBML", - level: "0", - type: "m", - mandatory: true, - multiple: true, - minver: 1, - description: "Set the EBML characteristics of the data to follow. Each EBML document has to start with this." - }, - 458458727: { - name: "SignatureSlot", - level: -1, - type: "m", - multiple: true, - webm: false, - description: "Contain signature of some (coming) elements in the stream." - }, - 475249515: { - name: "Cues", - level: 1, - type: "m", - description: "A Top-Level Element to speed seeking access. All entries are local to the Segment." - }, - 524531317: { - name: "Cluster", - level: 1, - type: "m", - multiple: true, - description: "The Top-Level Element containing the (monolithic) Block structure." - } - }; - var byName = {}; - var schema = { - byEbmlID, - byName - }; - for (ebmlID in byEbmlID) { - desc = byEbmlID[ebmlID]; - byName[desc.name.replace("-", "_")] = parseInt(ebmlID, 10); - } - var desc; - var ebmlID; - module.exports = schema; - } - }); - - // node_modules/ts-ebml/lib/EBMLEncoder.js - var require_EBMLEncoder = __commonJS({ - "node_modules/ts-ebml/lib/EBMLEncoder.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var tools = require_tools2(); - var tools_1 = require_tools2(); - var schema = require_schema(); - var byEbmlID = schema.byEbmlID; - var EBMLEncoder = function() { - function EBMLEncoder2() { - this._schema = byEbmlID; - this._buffers = []; - this._stack = []; - } - EBMLEncoder2.prototype.encode = function(elms) { - var _this = this; - return tools.concat(elms.reduce(function(lst, elm) { - return lst.concat(_this.encodeChunk(elm)); - }, [])).buffer; - }; - EBMLEncoder2.prototype.encodeChunk = function(elm) { - if (elm.type === "m") { - if (!elm.isEnd) { - this.startTag(elm); - } else { - this.endTag(elm); - } - } else { - this.writeTag(elm); - } - return this.flush(); - }; - EBMLEncoder2.prototype.flush = function() { - var ret = this._buffers; - this._buffers = []; - return ret; - }; - EBMLEncoder2.prototype.getSchemaInfo = function(tagName) { - var tagNums = Object.keys(this._schema).map(Number); - for (var i = 0; i < tagNums.length; i++) { - var tagNum = tagNums[i]; - if (this._schema[tagNum].name === tagName) { - return new tools_1.Buffer(tagNum.toString(16), "hex"); - } - } - return null; - }; - EBMLEncoder2.prototype.writeTag = function(elm) { - var tagName = elm.name; - var tagId = this.getSchemaInfo(tagName); - var tagData = elm.data; - if (tagId == null) { - throw new Error("No schema entry found for " + tagName); - } - var data = tools.encodeTag(tagId, tagData); - if (this._stack.length > 0) { - var last = this._stack[this._stack.length - 1]; - last.children.push({ - tagId, - elm, - children: [], - data - }); - return; - } - this._buffers = this._buffers.concat(data); - return; - }; - EBMLEncoder2.prototype.startTag = function(elm) { - var tagName = elm.name; - var tagId = this.getSchemaInfo(tagName); - if (tagId == null) { - throw new Error("No schema entry found for " + tagName); - } - if (elm.unknownSize) { - var data = tools.encodeTag(tagId, new tools_1.Buffer(0), elm.unknownSize); - this._buffers = this._buffers.concat(data); - return; - } - var tag = { - tagId, - elm, - children: [], - data: null - }; - if (this._stack.length > 0) { - this._stack[this._stack.length - 1].children.push(tag); - } - this._stack.push(tag); - }; - EBMLEncoder2.prototype.endTag = function(elm) { - var tagName = elm.name; - var tag = this._stack.pop(); - if (tag == null) { - throw new Error("EBML structure is broken"); - } - if (tag.elm.name !== elm.name) { - throw new Error("EBML structure is broken"); - } - var childTagDataBuffers = tag.children.reduce(function(lst, child) { - if (child.data === null) { - throw new Error("EBML structure is broken"); - } - return lst.concat(child.data); - }, []); - var childTagDataBuffer = tools.concat(childTagDataBuffers); - if (tag.elm.type === "m") { - tag.data = tools.encodeTag(tag.tagId, childTagDataBuffer, tag.elm.unknownSize); - } else { - tag.data = tools.encodeTag(tag.tagId, childTagDataBuffer); - } - if (this._stack.length < 1) { - this._buffers = this._buffers.concat(tag.data); - } - }; - return EBMLEncoder2; - }(); - exports.default = EBMLEncoder; - } - }); - - // node_modules/ts-ebml/node_modules/buffer/index.js - var require_buffer2 = __commonJS({ - "node_modules/ts-ebml/node_modules/buffer/index.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var base64 = require_base64_js(); - var ieee7542 = require_ieee754(); - var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer18; - exports.SlowBuffer = SlowBuffer; - exports.INSPECT_MAX_BYTES = 50; - var K_MAX_LENGTH = 2147483647; - exports.kMaxLength = K_MAX_LENGTH; - Buffer18.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer18.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { - console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); - } - function typedArraySupport() { - try { - var arr = new Uint8Array(1); - var proto = { foo: function() { - return 42; - } }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; - } - } - Object.defineProperty(Buffer18.prototype, "parent", { - enumerable: true, - get: function() { - if (!Buffer18.isBuffer(this)) - return void 0; - return this.buffer; - } - }); - Object.defineProperty(Buffer18.prototype, "offset", { - enumerable: true, - get: function() { - if (!Buffer18.isBuffer(this)) - return void 0; - return this.byteOffset; - } - }); - function createBuffer(length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"'); - } - var buf2 = new Uint8Array(length); - Object.setPrototypeOf(buf2, Buffer18.prototype); - return buf2; - } - function Buffer18(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - if (typeof encodingOrOffset === "string") { - throw new TypeError('The "string" argument must be of type string. Received type number'); - } - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); - } - Buffer18.poolSize = 8192; - function from(value, encodingOrOffset, length) { - if (typeof value === "string") { - return fromString(value, encodingOrOffset); - } - if (ArrayBuffer.isView(value)) { - return fromArrayView(value); - } - if (value == null) { - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof value === "number") { - throw new TypeError('The "value" argument must not be of type number. Received type number'); - } - var valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) { - return Buffer18.from(valueOf, encodingOrOffset, length); - } - var b = fromObject(value); - if (b) - return b; - if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer18.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); - } - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - Buffer18.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); - }; - Object.setPrototypeOf(Buffer18.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer18, Uint8Array); - function assertSize(size) { - if (typeof size !== "number") { - throw new TypeError('"size" argument must be of type number'); - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"'); - } - } - function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) { - return createBuffer(size); - } - if (fill !== void 0) { - return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - } - return createBuffer(size); - } - Buffer18.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); - }; - function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); - } - Buffer18.allocUnsafe = function(size) { - return allocUnsafe(size); - }; - Buffer18.allocUnsafeSlow = function(size) { - return allocUnsafe(size); - }; - function fromString(string, encoding) { - if (typeof encoding !== "string" || encoding === "") { - encoding = "utf8"; - } - if (!Buffer18.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - var length = byteLength(string, encoding) | 0; - var buf2 = createBuffer(length); - var actual = buf2.write(string, encoding); - if (actual !== length) { - buf2 = buf2.slice(0, actual); - } - return buf2; - } - function fromArrayLike(array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0; - var buf2 = createBuffer(length); - for (var i = 0; i < length; i += 1) { - buf2[i] = array[i] & 255; - } - return buf2; - } - function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - var copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); - } - function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds'); - } - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds'); - } - var buf2; - if (byteOffset === void 0 && length === void 0) { - buf2 = new Uint8Array(array); - } else if (length === void 0) { - buf2 = new Uint8Array(array, byteOffset); - } else { - buf2 = new Uint8Array(array, byteOffset, length); - } - Object.setPrototypeOf(buf2, Buffer18.prototype); - return buf2; - } - function fromObject(obj) { - if (Buffer18.isBuffer(obj)) { - var len = checked(obj.length) | 0; - var buf2 = createBuffer(len); - if (buf2.length === 0) { - return buf2; - } - obj.copy(buf2, 0, 0, len); - return buf2; - } - if (obj.length !== void 0) { - if (typeof obj.length !== "number" || numberIsNaN(obj.length)) { - return createBuffer(0); - } - return fromArrayLike(obj); - } - if (obj.type === "Buffer" && Array.isArray(obj.data)) { - return fromArrayLike(obj.data); - } - } - function checked(length) { - if (length >= K_MAX_LENGTH) { - throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes"); - } - return length | 0; - } - function SlowBuffer(length) { - if (+length != length) { - length = 0; - } - return Buffer18.alloc(+length); - } - Buffer18.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer18.prototype; - }; - Buffer18.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) - a = Buffer18.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) - b = Buffer18.from(b, b.offset, b.byteLength); - if (!Buffer18.isBuffer(a) || !Buffer18.isBuffer(b)) { - throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - } - if (a === b) - return 0; - var x = a.length; - var y = b.length; - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) - return -1; - if (y < x) - return 1; - return 0; - }; - Buffer18.isEncoding = function isEncoding(encoding) { - switch (String(encoding).toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "latin1": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return true; - default: - return false; - } - }; - Buffer18.concat = function concat(list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } - if (list.length === 0) { - return Buffer18.alloc(0); - } - var i; - if (length === void 0) { - length = 0; - for (i = 0; i < list.length; ++i) { - length += list[i].length; - } - } - var buffer = Buffer18.allocUnsafe(length); - var pos = 0; - for (i = 0; i < list.length; ++i) { - var buf2 = list[i]; - if (isInstance(buf2, Uint8Array)) { - if (pos + buf2.length > buffer.length) { - Buffer18.from(buf2).copy(buffer, pos); - } else { - Uint8Array.prototype.set.call(buffer, buf2, pos); - } - } else if (!Buffer18.isBuffer(buf2)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } else { - buf2.copy(buffer, pos); - } - pos += buf2.length; - } - return buffer; - }; - function byteLength(string, encoding) { - if (Buffer18.isBuffer(string)) { - return string.length; - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength; - } - if (typeof string !== "string") { - throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - } - var len = string.length; - var mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) - return 0; - var loweredCase = false; - for (; ; ) { - switch (encoding) { - case "ascii": - case "latin1": - case "binary": - return len; - case "utf8": - case "utf-8": - return utf8ToBytes(string).length; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return len * 2; - case "hex": - return len >>> 1; - case "base64": - return base64ToBytes(string).length; - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length; - } - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - } - Buffer18.byteLength = byteLength; - function slowToString(encoding, start, end) { - var loweredCase = false; - if (start === void 0 || start < 0) { - start = 0; - } - if (start > this.length) { - return ""; - } - if (end === void 0 || end > this.length) { - end = this.length; - } - if (end <= 0) { - return ""; - } - end >>>= 0; - start >>>= 0; - if (end <= start) { - return ""; - } - if (!encoding) - encoding = "utf8"; - while (true) { - switch (encoding) { - case "hex": - return hexSlice(this, start, end); - case "utf8": - case "utf-8": - return utf8Slice(this, start, end); - case "ascii": - return asciiSlice(this, start, end); - case "latin1": - case "binary": - return latin1Slice(this, start, end); - case "base64": - return base64Slice(this, start, end); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return utf16leSlice(this, start, end); - default: - if (loweredCase) - throw new TypeError("Unknown encoding: " + encoding); - encoding = (encoding + "").toLowerCase(); - loweredCase = true; - } - } - } - Buffer18.prototype._isBuffer = true; - function swap(b, n, m) { - var i = b[n]; - b[n] = b[m]; - b[m] = i; - } - Buffer18.prototype.swap16 = function swap16() { - var len = this.length; - if (len % 2 !== 0) { - throw new RangeError("Buffer size must be a multiple of 16-bits"); - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1); - } - return this; - }; - Buffer18.prototype.swap32 = function swap32() { - var len = this.length; - if (len % 4 !== 0) { - throw new RangeError("Buffer size must be a multiple of 32-bits"); - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3); - swap(this, i + 1, i + 2); - } - return this; - }; - Buffer18.prototype.swap64 = function swap64() { - var len = this.length; - if (len % 8 !== 0) { - throw new RangeError("Buffer size must be a multiple of 64-bits"); - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); - } - return this; - }; - Buffer18.prototype.toString = function toString2() { - var length = this.length; - if (length === 0) - return ""; - if (arguments.length === 0) - return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); - }; - Buffer18.prototype.toLocaleString = Buffer18.prototype.toString; - Buffer18.prototype.equals = function equals(b) { - if (!Buffer18.isBuffer(b)) - throw new TypeError("Argument must be a Buffer"); - if (this === b) - return true; - return Buffer18.compare(this, b) === 0; - }; - Buffer18.prototype.inspect = function inspect() { - var str = ""; - var max = exports.INSPECT_MAX_BYTES; - str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); - if (this.length > max) - str += " ... "; - return ""; - }; - if (customInspectSymbol) { - Buffer18.prototype[customInspectSymbol] = Buffer18.prototype.inspect; - } - Buffer18.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer18.from(target, target.offset, target.byteLength); - } - if (!Buffer18.isBuffer(target)) { - throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - } - if (start === void 0) { - start = 0; - } - if (end === void 0) { - end = target ? target.length : 0; - } - if (thisStart === void 0) { - thisStart = 0; - } - if (thisEnd === void 0) { - thisEnd = this.length; - } - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError("out of range index"); - } - if (thisStart >= thisEnd && start >= end) { - return 0; - } - if (thisStart >= thisEnd) { - return -1; - } - if (start >= end) { - return 1; - } - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) - return 0; - var x = thisEnd - thisStart; - var y = end - start; - var len = Math.min(x, y); - var thisCopy = this.slice(thisStart, thisEnd); - var targetCopy = target.slice(start, end); - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; - } - } - if (x < y) - return -1; - if (y < x) - return 1; - return 0; - }; - function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - if (buffer.length === 0) - return -1; - if (typeof byteOffset === "string") { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 2147483647) { - byteOffset = 2147483647; - } else if (byteOffset < -2147483648) { - byteOffset = -2147483648; - } - byteOffset = +byteOffset; - if (numberIsNaN(byteOffset)) { - byteOffset = dir ? 0 : buffer.length - 1; - } - if (byteOffset < 0) - byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) - return -1; - else - byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) - byteOffset = 0; - else - return -1; - } - if (typeof val === "string") { - val = Buffer18.from(val, encoding); - } - if (Buffer18.isBuffer(val)) { - if (val.length === 0) { - return -1; - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === "number") { - val = val & 255; - if (typeof Uint8Array.prototype.indexOf === "function") { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); - } - throw new TypeError("val must be string, number or Buffer"); - } - function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - var indexSize = 1; - var arrLength = arr.length; - var valLength = val.length; - if (encoding !== void 0) { - encoding = String(encoding).toLowerCase(); - if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { - if (arr.length < 2 || val.length < 2) { - return -1; - } - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read2(buf2, i2) { - if (indexSize === 1) { - return buf2[i2]; - } else { - return buf2.readUInt16BE(i2 * indexSize); - } - } - var i; - if (dir) { - var foundIndex = -1; - for (i = byteOffset; i < arrLength; i++) { - if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) - foundIndex = i; - if (i - foundIndex + 1 === valLength) - return foundIndex * indexSize; - } else { - if (foundIndex !== -1) - i -= i - foundIndex; - foundIndex = -1; - } - } - } else { - if (byteOffset + valLength > arrLength) - byteOffset = arrLength - valLength; - for (i = byteOffset; i >= 0; i--) { - var found = true; - for (var j = 0; j < valLength; j++) { - if (read2(arr, i + j) !== read2(val, j)) { - found = false; - break; - } - } - if (found) - return i; - } - } - return -1; - } - Buffer18.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; - }; - Buffer18.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); - }; - Buffer18.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); - }; - function hexWrite(buf2, string, offset, length) { - offset = Number(offset) || 0; - var remaining = buf2.length - offset; - if (!length) { - length = remaining; - } else { - length = Number(length); - if (length > remaining) { - length = remaining; - } - } - var strLen = string.length; - if (length > strLen / 2) { - length = strLen / 2; - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) - return i; - buf2[offset + i] = parsed; - } - return i; - } - function utf8Write(buf2, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf2.length - offset), buf2, offset, length); - } - function asciiWrite(buf2, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf2, offset, length); - } - function base64Write(buf2, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf2, offset, length); - } - function ucs2Write(buf2, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length); - } - Buffer18.prototype.write = function write2(string, offset, length, encoding) { - if (offset === void 0) { - encoding = "utf8"; - length = this.length; - offset = 0; - } else if (length === void 0 && typeof offset === "string") { - encoding = offset; - length = this.length; - offset = 0; - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === void 0) - encoding = "utf8"; - } else { - encoding = length; - length = void 0; - } - } else { - throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); - } - var remaining = this.length - offset; - if (length === void 0 || length > remaining) - length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { - throw new RangeError("Attempt to write outside buffer bounds"); - } - if (!encoding) - encoding = "utf8"; - var loweredCase = false; - for (; ; ) { - switch (encoding) { - case "hex": - return hexWrite(this, string, offset, length); - case "utf8": - case "utf-8": - return utf8Write(this, string, offset, length); - case "ascii": - case "latin1": - case "binary": - return asciiWrite(this, string, offset, length); - case "base64": - return base64Write(this, string, offset, length); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) - throw new TypeError("Unknown encoding: " + encoding); - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - }; - Buffer18.prototype.toJSON = function toJSON() { - return { - type: "Buffer", - data: Array.prototype.slice.call(this._arr || this, 0) - }; - }; - function base64Slice(buf2, start, end) { - if (start === 0 && end === buf2.length) { - return base64.fromByteArray(buf2); - } else { - return base64.fromByteArray(buf2.slice(start, end)); - } - } - function utf8Slice(buf2, start, end) { - end = Math.min(buf2.length, end); - var res = []; - var i = start; - while (i < end) { - var firstByte = buf2[i]; - var codePoint = null; - var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint; - switch (bytesPerSequence) { - case 1: - if (firstByte < 128) { - codePoint = firstByte; - } - break; - case 2: - secondByte = buf2[i + 1]; - if ((secondByte & 192) === 128) { - tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; - if (tempCodePoint > 127) { - codePoint = tempCodePoint; - } - } - break; - case 3: - secondByte = buf2[i + 1]; - thirdByte = buf2[i + 2]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; - if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { - codePoint = tempCodePoint; - } - } - break; - case 4: - secondByte = buf2[i + 1]; - thirdByte = buf2[i + 2]; - fourthByte = buf2[i + 3]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; - if (tempCodePoint > 65535 && tempCodePoint < 1114112) { - codePoint = tempCodePoint; - } - } - } - } - if (codePoint === null) { - codePoint = 65533; - bytesPerSequence = 1; - } else if (codePoint > 65535) { - codePoint -= 65536; - res.push(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); - } - var MAX_ARGUMENTS_LENGTH = 4096; - function decodeCodePointsArray(codePoints) { - var len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints); - } - var res = ""; - var i = 0; - while (i < len) { - res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - } - return res; - } - function asciiSlice(buf2, start, end) { - var ret = ""; - end = Math.min(buf2.length, end); - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf2[i] & 127); - } - return ret; - } - function latin1Slice(buf2, start, end) { - var ret = ""; - end = Math.min(buf2.length, end); - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf2[i]); - } - return ret; - } - function hexSlice(buf2, start, end) { - var len = buf2.length; - if (!start || start < 0) - start = 0; - if (!end || end < 0 || end > len) - end = len; - var out = ""; - for (var i = start; i < end; ++i) { - out += hexSliceLookupTable[buf2[i]]; - } - return out; - } - function utf16leSlice(buf2, start, end) { - var bytes = buf2.slice(start, end); - var res = ""; - for (var i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); + var MAX_HWM = 1073741824; + function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; } - return res; + return n; } - Buffer18.prototype.slice = function slice(start, end) { - var len = this.length; - start = ~~start; - end = end === void 0 ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) - start = 0; - } else if (start > len) { - start = len; + function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) + return 0; + if (state.objectMode) + return 1; + if (n !== n) { + if (state.flowing && state.length) + return state.buffer.head.data.length; + else + return state.length; } - if (end < 0) { - end += len; - if (end < 0) - end = 0; - } else if (end > len) { - end = len; + if (n > state.highWaterMark) + state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) + return n; + if (!state.ended) { + state.needReadable = true; + return 0; } - if (end < start) - end = start; - var newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer18.prototype); - return newBuf; - }; - function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) - throw new RangeError("offset is not uint"); - if (offset + ext > length) - throw new RangeError("Trying to access beyond buffer length"); + return state.length; } - Buffer18.prototype.readUintLE = Buffer18.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - return val; - }; - Buffer18.prototype.readUintBE = Buffer18.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - checkOffset(offset, byteLength2, this.length); - } - var val = this[offset + --byteLength2]; - var mul = 1; - while (byteLength2 > 0 && (mul *= 256)) { - val += this[offset + --byteLength2] * mul; - } - return val; - }; - Buffer18.prototype.readUint8 = Buffer18.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 1, this.length); - return this[offset]; - }; - Buffer18.prototype.readUint16LE = Buffer18.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; - }; - Buffer18.prototype.readUint16BE = Buffer18.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; - }; - Buffer18.prototype.readUint32LE = Buffer18.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; - }; - Buffer18.prototype.readUint32BE = Buffer18.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); - }; - Buffer18.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - mul *= 128; - if (val >= mul) - val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer18.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var i = byteLength2; - var mul = 1; - var val = this[offset + --i]; - while (i > 0 && (mul *= 256)) { - val += this[offset + --i] * mul; + Readable.prototype.read = function(n) { + debug("read", n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) + state.emittedReadable = false; + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug("read: emitReadable", state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); + return null; } - mul *= 128; - if (val >= mul) - val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer18.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 1, this.length); - if (!(this[offset] & 128)) - return this[offset]; - return (255 - this[offset] + 1) * -1; - }; - Buffer18.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - var val = this[offset] | this[offset + 1] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer18.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - var val = this[offset + 1] | this[offset] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer18.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; - }; - Buffer18.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; - }; - Buffer18.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return ieee7542.read(this, offset, true, 23, 4); - }; - Buffer18.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return ieee7542.read(this, offset, false, 23, 4); - }; - Buffer18.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 8, this.length); - return ieee7542.read(this, offset, true, 52, 8); - }; - Buffer18.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 8, this.length); - return ieee7542.read(this, offset, false, 52, 8); - }; - function checkInt(buf2, value, offset, ext, max, min) { - if (!Buffer18.isBuffer(buf2)) - throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) - throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf2.length) - throw new RangeError("Index out of range"); - } - Buffer18.prototype.writeUintLE = Buffer18.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); + n = howMuchToRead(n, state); + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; } - var mul = 1; - var i = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - this[offset + i] = value / mul & 255; + var doRead = state.needReadable; + debug("need readable", doRead); + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug("length less than watermark", doRead); } - return offset + byteLength2; - }; - Buffer18.prototype.writeUintBE = Buffer18.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); + if (state.ended || state.reading) { + doRead = false; + debug("reading or ended", doRead); + } else if (doRead) { + debug("do read"); + state.reading = true; + state.sync = true; + if (state.length === 0) + state.needReadable = true; + this._read(state.highWaterMark); + state.sync = false; + if (!state.reading) + n = howMuchToRead(nOrig, state); } - var i = byteLength2 - 1; - var mul = 1; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - this[offset + i] = value / mul & 255; + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; } - return offset + byteLength2; - }; - Buffer18.prototype.writeUint8 = Buffer18.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 1, 255, 0); - this[offset] = value & 255; - return offset + 1; - }; - Buffer18.prototype.writeUint16LE = Buffer18.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer18.prototype.writeUint16BE = Buffer18.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer18.prototype.writeUint32LE = Buffer18.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 4294967295, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 255; - return offset + 4; - }; - Buffer18.prototype.writeUint32BE = Buffer18.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 4294967295, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; + if (state.length === 0) { + if (!state.ended) + state.needReadable = true; + if (nOrig !== n && state.ended) + endReadable(this); + } + if (ret !== null) + this.emit("data", ret); + return ret; }; - Buffer18.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); + function onEofChunk(stream, state) { + debug("onEofChunk"); + if (state.ended) + return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } } - var i = 0; - var mul = 1; - var sub = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1; + state.ended = true; + if (state.sync) { + emitReadable(stream); + } else { + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); } - this[offset + i] = (value / mul >> 0) - sub & 255; } - return offset + byteLength2; - }; - Buffer18.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); + } + function emitReadable(stream) { + var state = stream._readableState; + debug("emitReadable", state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug("emitReadable", state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); } - var i = byteLength2 - 1; - var mul = 1; - var sub = 0; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1; - } - this[offset + i] = (value / mul >> 0) - sub & 255; + } + function emitReadable_(stream) { + var state = stream._readableState; + debug("emitReadable_", state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit("readable"); + state.emittedReadable = false; } - return offset + byteLength2; - }; - Buffer18.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 1, 127, -128); - if (value < 0) - value = 255 + value + 1; - this[offset] = value & 255; - return offset + 1; - }; - Buffer18.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer18.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer18.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 2147483647, -2147483648); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; - }; - Buffer18.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 2147483647, -2147483648); - if (value < 0) - value = 4294967295 + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; - }; - function checkIEEE754(buf2, value, offset, ext, max, min) { - if (offset + ext > buf2.length) - throw new RangeError("Index out of range"); - if (offset < 0) - throw new RangeError("Index out of range"); + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); } - function writeFloat(buf2, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22); + function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); } - ieee7542.write(buf2, value, offset, littleEndian, 23, 4); - return offset + 4; } - Buffer18.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); - }; - Buffer18.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); - }; - function writeDouble(buf2, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292); + function maybeReadMore_(stream, state) { + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug("maybeReadMore read 0"); + stream.read(0); + if (len === state.length) + break; } - ieee7542.write(buf2, value, offset, littleEndian, 52, 8); - return offset + 8; + state.readingMore = false; } - Buffer18.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); - }; - Buffer18.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); + Readable.prototype._read = function(n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); }; - Buffer18.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer18.isBuffer(target)) - throw new TypeError("argument should be a Buffer"); - if (!start) - start = 0; - if (!end && end !== 0) - end = this.length; - if (targetStart >= target.length) - targetStart = target.length; - if (!targetStart) - targetStart = 0; - if (end > 0 && end < start) - end = start; - if (end === start) - return 0; - if (target.length === 0 || this.length === 0) - return 0; - if (targetStart < 0) { - throw new RangeError("targetStart out of bounds"); + Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) + process.nextTick(endFn); + else + src.once("end", endFn); + dest.on("unpipe", onunpipe); + function onunpipe(readable, unpipeInfo) { + debug("onunpipe"); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } } - if (start < 0 || start >= this.length) - throw new RangeError("Index out of range"); - if (end < 0) - throw new RangeError("sourceEnd out of bounds"); - if (end > this.length) - end = this.length; - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start; + function onend() { + debug("onend"); + dest.end(); } - var len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === "function") { - this.copyWithin(targetStart, start, end); - } else { - Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); + var ondrain = pipeOnDrain(src); + dest.on("drain", ondrain); + var cleanedUp = false; + function cleanup() { + debug("cleanup"); + dest.removeListener("close", onclose); + dest.removeListener("finish", onfinish); + dest.removeListener("drain", ondrain); + dest.removeListener("error", onerror); + dest.removeListener("unpipe", onunpipe); + src.removeListener("end", onend); + src.removeListener("end", unpipe); + src.removeListener("data", ondata); + cleanedUp = true; + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) + ondrain(); } - return len; - }; - Buffer18.prototype.fill = function fill(val, start, end, encoding) { - if (typeof val === "string") { - if (typeof start === "string") { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === "string") { - encoding = end; - end = this.length; - } - if (encoding !== void 0 && typeof encoding !== "string") { - throw new TypeError("encoding must be a string"); - } - if (typeof encoding === "string" && !Buffer18.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - if (val.length === 1) { - var code = val.charCodeAt(0); - if (encoding === "utf8" && code < 128 || encoding === "latin1") { - val = code; + src.on("data", ondata); + function ondata(chunk) { + debug("ondata"); + var ret = dest.write(chunk); + debug("dest.write", ret); + if (ret === false) { + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug("false write response, pause", state.awaitDrain); + state.awaitDrain++; } + src.pause(); } - } else if (typeof val === "number") { - val = val & 255; - } else if (typeof val === "boolean") { - val = Number(val); } - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError("Out of range index"); + function onerror(er) { + debug("onerror", er); + unpipe(); + dest.removeListener("error", onerror); + if (EElistenerCount(dest, "error") === 0) + errorOrDestroy(dest, er); } - if (end <= start) { - return this; + prependListener(dest, "error", onerror); + function onclose() { + dest.removeListener("finish", onfinish); + unpipe(); } - start = start >>> 0; - end = end === void 0 ? this.length : end >>> 0; - if (!val) - val = 0; - var i; - if (typeof val === "number") { - for (i = start; i < end; ++i) { - this[i] = val; - } - } else { - var bytes = Buffer18.isBuffer(val) ? val : Buffer18.from(val, encoding); - var len = bytes.length; - if (len === 0) { - throw new TypeError('The value "' + val + '" is invalid for argument "value"'); + dest.once("close", onclose); + function onfinish() { + debug("onfinish"); + dest.removeListener("close", onclose); + unpipe(); + } + dest.once("finish", onfinish); + function unpipe() { + debug("unpipe"); + src.unpipe(dest); + } + dest.emit("pipe", src); + if (!state.flowing) { + debug("pipe resume"); + src.resume(); + } + return dest; + }; + function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug("pipeOnDrain", state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { + state.flowing = true; + flow(src); } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len]; + }; + } + Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + if (state.pipesCount === 0) + return this; + if (state.pipesCount === 1) { + if (dest && dest !== state.pipes) + return this; + if (!dest) + dest = state.pipes; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) + dest.emit("unpipe", this, unpipeInfo); + return this; + } + if (!dest) { + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) { + dests[i].emit("unpipe", this, { + hasUnpiped: false + }); } + return this; } + var index = indexOf(state.pipes, dest); + if (index === -1) + return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + dest.emit("unpipe", this, unpipeInfo); return this; }; - var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; - function base64clean(str) { - str = str.split("=")[0]; - str = str.trim().replace(INVALID_BASE64_RE, ""); - if (str.length < 2) - return ""; - while (str.length % 4 !== 0) { - str = str + "="; - } - return str; - } - function utf8ToBytes(string, units) { - units = units || Infinity; - var codePoint; - var length = string.length; - var leadSurrogate = null; - var bytes = []; - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i); - if (codePoint > 55295 && codePoint < 57344) { - if (!leadSurrogate) { - if (codePoint > 56319) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - continue; - } else if (i + 1 === length) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - continue; - } - leadSurrogate = codePoint; - continue; - } - if (codePoint < 56320) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - leadSurrogate = codePoint; - continue; + Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === "data") { + state.readableListening = this.listenerCount("readable") > 0; + if (state.flowing !== false) + this.resume(); + } else if (ev === "readable") { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug("on readable", state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); } - codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; - } else if (leadSurrogate) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - } - leadSurrogate = null; - if (codePoint < 128) { - if ((units -= 1) < 0) - break; - bytes.push(codePoint); - } else if (codePoint < 2048) { - if ((units -= 2) < 0) - break; - bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128); - } else if (codePoint < 65536) { - if ((units -= 3) < 0) - break; - bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128); - } else if (codePoint < 1114112) { - if ((units -= 4) < 0) - break; - bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128); - } else { - throw new Error("Invalid code point"); } } - return bytes; - } - function asciiToBytes(str) { - var byteArray = []; - for (var i = 0; i < str.length; ++i) { - byteArray.push(str.charCodeAt(i) & 255); + return res; + }; + Readable.prototype.addListener = Readable.prototype.on; + Readable.prototype.removeListener = function(ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === "readable") { + process.nextTick(updateReadableListening, this); + } + return res; + }; + Readable.prototype.removeAllListeners = function(ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === "readable" || ev === void 0) { + process.nextTick(updateReadableListening, this); } - return byteArray; - } - function utf16leToBytes(str, units) { - var c, hi, lo; - var byteArray = []; - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) - break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); + return res; + }; + function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount("readable") > 0; + if (state.resumeScheduled && !state.paused) { + state.flowing = true; + } else if (self.listenerCount("data") > 0) { + self.resume(); } - return byteArray; } - function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); + function nReadingNextTick(self) { + debug("readable nexttick read 0"); + self.read(0); } - function blitBuffer(src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if (i + offset >= dst.length || i >= src.length) - break; - dst[i + offset] = src[i]; + Readable.prototype.resume = function() { + var state = this._readableState; + if (!state.flowing) { + debug("resume"); + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; + }; + function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); } - return i; } - function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; + function resume_(stream, state) { + debug("resume", state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit("resume"); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); } - function numberIsNaN(obj) { - return obj !== obj; + Readable.prototype.pause = function() { + debug("call pause flowing=%j", this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug("pause"); + this._readableState.flowing = false; + this.emit("pause"); + } + this._readableState.paused = true; + return this; + }; + function flow(stream) { + var state = stream._readableState; + debug("flow", state.flowing); + while (state.flowing && stream.read() !== null) { + ; + } } - var hexSliceLookupTable = function() { - var alphabet = "0123456789abcdef"; - var table = new Array(256); - for (var i = 0; i < 16; ++i) { - var i16 = i * 16; - for (var j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j]; + Readable.prototype.wrap = function(stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on("end", function() { + debug("wrapped end"); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + _this.push(chunk); } - } - return table; - }(); - } - }); - - // node_modules/ebml/lib/ebml/tools.js - var require_tools = __commonJS({ - "node_modules/ebml/lib/ebml/tools.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var tools = { - readVint: function(buffer, start) { - start = start || 0; - for (var length = 1; length <= 8; length++) { - if (buffer[start] >= Math.pow(2, 8 - length)) { - break; - } + _this.push(null); + }); + stream.on("data", function(chunk) { + debug("wrapped data"); + if (state.decoder) + chunk = state.decoder.write(chunk); + if (state.objectMode && (chunk === null || chunk === void 0)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) + return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); } - if (length > 8) { - throw new Error("Unrepresentable length: " + length + " " + buffer.toString("hex", start, start + length)); + }); + for (var i in stream) { + if (this[i] === void 0 && typeof stream[i] === "function") { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); } - if (start + length > buffer.length) { - return null; + } + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + this._read = function(n2) { + debug("wrapped _read", n2); + if (paused) { + paused = false; + stream.resume(); } - var value = buffer[start] & (1 << 8 - length) - 1; - for (var i = 1; i < length; i++) { - if (i === 7) { - if (value >= Math.pow(2, 53 - 8) && buffer[start + 7] > 0) { - return { - length, - value: -1 - }; - } - } - value *= Math.pow(2, 8); - value += buffer[start + i]; + }; + return this; + }; + if (typeof Symbol === "function") { + Readable.prototype[Symbol.asyncIterator] = function() { + if (createReadableStreamAsyncIterator === void 0) { + createReadableStreamAsyncIterator = require_async_iterator(); } - return { - length, - value - }; + return createReadableStreamAsyncIterator(this); + }; + } + Object.defineProperty(Readable.prototype, "readableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._readableState.highWaterMark; + } + }); + Object.defineProperty(Readable.prototype, "readableBuffer", { + enumerable: false, + get: function get2() { + return this._readableState && this._readableState.buffer; + } + }); + Object.defineProperty(Readable.prototype, "readableFlowing", { + enumerable: false, + get: function get2() { + return this._readableState.flowing; }, - writeVint: function(value) { - if (value < 0 || value > Math.pow(2, 53)) { - throw new Error("Unrepresentable value: " + value); + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; } - for (var length = 1; length <= 8; length++) { - if (value < Math.pow(2, 7 * length) - 1) { - break; + } + }); + Readable._fromList = fromList; + Object.defineProperty(Readable.prototype, "readableLength", { + enumerable: false, + get: function get2() { + return this._readableState.length; + } + }); + function fromList(n, state) { + if (state.length === 0) + return null; + var ret; + if (state.objectMode) + ret = state.buffer.shift(); + else if (!n || n >= state.length) { + if (state.decoder) + ret = state.buffer.join(""); + else if (state.buffer.length === 1) + ret = state.buffer.first(); + else + ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + ret = state.buffer.consume(n, state.decoder); + } + return ret; + } + function endReadable(stream) { + var state = stream._readableState; + debug("endReadable", state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } + } + function endReadableNT(state, stream) { + debug("endReadableNT", state.endEmitted, state.length); + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit("end"); + if (state.autoDestroy) { + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); } } - var buffer = new Buffer2(length); - for (var i = 1; i <= length; i++) { - var b = value & 255; - buffer[length - i] = b; - value -= b; - value /= Math.pow(2, 8); + } + } + if (typeof Symbol === "function") { + Readable.from = function(iterable, opts) { + if (from === void 0) { + from = require_from_browser(); } - buffer[0] = buffer[0] | 1 << 8 - length; - return buffer; + return from(Readable, iterable, opts); + }; + } + function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) + return i; } - }; - module.exports = tools; + return -1; + } } }); - // node_modules/ebml-block/lib/vint.js - var require_vint = __commonJS({ - "node_modules/ebml-block/lib/vint.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_transform.js + var require_stream_transform = __commonJS({ + "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - module.exports = function(buffer, start, signed) { - start = start || 0; - for (var length = 1; length <= 8; length++) { - if (buffer[start] >= Math.pow(2, 8 - length)) { - break; - } - } - if (length > 8) { - throw new Error("Unrepresentable length: " + length + " " + buffer.toString("hex", start, start + length)); - } - if (start + length > buffer.length) { - return null; - } - var i; - var value = buffer[start] & (1 << 8 - length) - 1; - for (i = 1; i < length; i++) { - if (i === 7) { - if (value >= Math.pow(2, 53 - 8) && buffer[start + 7] > 0) { - return { - length, - value: -1 - }; - } - } - value *= Math.pow(2, 8); - value += buffer[start + i]; + module.exports = Transform; + var _require$codes = require_errors_browser().codes; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; + var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING; + var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; + var Duplex = require_stream_duplex(); + require_inherits_browser()(Transform, Duplex); + function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit("error", new ERR_MULTIPLE_CALLBACK()); } - if (signed) { - value -= Math.pow(2, length * 7 - 1) - 1; + ts.writechunk = null; + ts.writecb = null; + if (data != null) + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); } - return { - length, - value + } + function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null }; + this._readableState.needReadable = true; + this._readableState.sync = false; + if (options) { + if (typeof options.transform === "function") + this._transform = options.transform; + if (typeof options.flush === "function") + this._flush = options.flush; + } + this.on("prefinish", prefinish); + } + function prefinish() { + var _this = this; + if (typeof this._flush === "function" && !this._readableState.destroyed) { + this._flush(function(er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } + } + Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); }; - } - }); - - // node_modules/ebml-block/lib/buffer-reader.js - var require_buffer_reader = __commonJS({ - "node_modules/ebml-block/lib/buffer-reader.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var vint = require_vint(); - function BufferReader(buffer) { - this.buffer = buffer; - this.offset = 0; - } - BufferReader.prototype.nextInt16BE = function() { - var value = this.buffer.readInt16BE(this.offset); - this.offset += 2; - return value; - }; - BufferReader.prototype.nextUInt8 = function() { - var value = this.buffer.readUInt8(this.offset); - this.offset += 1; - return value; + Transform.prototype._transform = function(chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); }; - BufferReader.prototype.nextUIntV = function() { - var v = vint(this.buffer, this.offset); - this.offset += v.length; - return v.value; + Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } }; - BufferReader.prototype.nextIntV = function() { - var v = vint(this.buffer, this.offset, true); - this.offset += v.length; - return v.value; + Transform.prototype._read = function(n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + ts.needTransform = true; + } }; - BufferReader.prototype.nextBuffer = function(length) { - var buffer = length ? this.buffer.slice(this.offset, this.offset + length) : this.buffer.slice(this.offset); - this.offset += length || this.length; - return buffer; + Transform.prototype._destroy = function(err, cb) { + Duplex.prototype._destroy.call(this, err, function(err2) { + cb(err2); + }); }; - Object.defineProperty(BufferReader.prototype, "length", { - get: function() { - return this.buffer.length - this.offset; - } - }); - module.exports = BufferReader; + function done(stream, er, data) { + if (er) + return stream.emit("error", er); + if (data != null) + stream.push(data); + if (stream._writableState.length) + throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) + throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); + } } }); - // node_modules/ebml-block/index.js - var require_ebml_block = __commonJS({ - "node_modules/ebml-block/index.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_passthrough.js + var require_stream_passthrough = __commonJS({ + "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var BufferReader = require_buffer_reader(); - var XIPH_LACING = 1; - var EBML_LACING = 3; - var FIXED_SIZE_LACING = 2; - module.exports = function(buffer) { - var block = {}; - var reader = new BufferReader(buffer); - block.trackNumber = reader.nextUIntV(); - block.timecode = reader.nextInt16BE(); - var flags = reader.nextUInt8(); - block.invisible = !!(flags & 8); - block.keyframe = !!(flags & 128); - block.discardable = !!(flags & 1); - var lacing = (flags & 6) >> 1; - block.frames = readLacedData(reader, lacing); - return block; - }; - function readLacedData(reader, lacing) { - if (!lacing) - return [reader.nextBuffer()]; - var i, frameSize; - var frames = []; - var framesNum = reader.nextUInt8() + 1; - if (lacing === FIXED_SIZE_LACING) { - if (reader.length % framesNum !== 0) - throw new Error("Fixed-Size Lacing Error"); - frameSize = reader.length / framesNum; - for (i = 0; i < framesNum; i++) { - frames.push(reader.nextBuffer(frameSize)); - } - return frames; - } - var frameSizes = []; - if (lacing === XIPH_LACING) { - for (i = 0; i < framesNum - 1; i++) { - var val; - frameSize = 0; - do { - val = reader.nextUInt8(); - frameSize += val; - } while (val === 255); - frameSizes.push(frameSize); - } - } else if (lacing === EBML_LACING) { - frameSize = reader.nextUIntV(); - frameSizes.push(frameSize); - for (i = 1; i < framesNum - 1; i++) { - frameSize += reader.nextIntV(); - frameSizes.push(frameSize); - } - } - for (i = 0; i < framesNum - 1; i++) { - frames.push(reader.nextBuffer(frameSizes[i])); - } - frames.push(reader.nextBuffer()); - return frames; + module.exports = PassThrough; + var Transform = require_stream_transform(); + require_inherits_browser()(PassThrough, Transform); + function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + Transform.call(this, options); } + PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); + }; } }); - // node_modules/ts-ebml/lib/tools.js - var require_tools2 = __commonJS({ - "node_modules/ts-ebml/lib/tools.js"(exports) { + // node_modules/readable-stream/lib/internal/streams/pipeline.js + var require_pipeline = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var int64_buffer_1 = require_int64_buffer(); - var EBMLEncoder_1 = require_EBMLEncoder(); - var _Buffer = require_buffer2(); - var _tools = require_tools(); - var _block = require_ebml_block(); - exports.Buffer = _Buffer.Buffer; - exports.readVint = _tools.readVint; - exports.writeVint = _tools.writeVint; - exports.ebmlBlock = _block; - function readBlock(buf2) { - return exports.ebmlBlock(new exports.Buffer(buf2)); - } - exports.readBlock = readBlock; - function encodeTag(tagId, tagData, unknownSize) { - if (unknownSize === void 0) { - unknownSize = false; - } - return concat([ - tagId, - unknownSize ? new exports.Buffer("01ffffffffffffff", "hex") : exports.writeVint(tagData.length), - tagData - ]); - } - exports.encodeTag = encodeTag; - function WebPFrameFilter(elms) { - return WebPBlockFilter(elms).reduce(function(lst, elm) { - var o = exports.ebmlBlock(elm.data); - return o.frames.reduce(function(lst2, frame) { - var webpBuf = VP8BitStreamToRiffWebPBuffer(frame); - var webp = new Blob([webpBuf], { type: "image/webp" }); - return lst2.concat(webp); - }, lst); - }, []); - } - exports.WebPFrameFilter = WebPFrameFilter; - function WebPBlockFilter(elms) { - return elms.reduce(function(lst, elm) { - if (elm.type !== "b") { - return lst; - } - if (elm.name !== "SimpleBlock") { - return lst; - } - var o = exports.ebmlBlock(elm.data); - var hasWebP = o.frames.some(function(frame) { - var startcode = frame.slice(3, 6).toString("hex"); - return startcode === "9d012a"; - }); - if (!hasWebP) { - return lst; - } - return lst.concat(elm); - }, []); - } - exports.WebPBlockFilter = WebPBlockFilter; - function VP8BitStreamToRiffWebPBuffer(frame) { - var VP8Chunk = createRIFFChunk("VP8 ", frame); - var WebPChunk = concat([ - new exports.Buffer("WEBP", "ascii"), - VP8Chunk - ]); - return createRIFFChunk("RIFF", WebPChunk); - } - exports.VP8BitStreamToRiffWebPBuffer = VP8BitStreamToRiffWebPBuffer; - function createRIFFChunk(FourCC, chunk) { - var chunkSize = new exports.Buffer(4); - chunkSize.writeUInt32LE(chunk.byteLength, 0); - return concat([ - new exports.Buffer(FourCC.substr(0, 4), "ascii"), - chunkSize, - chunk, - new exports.Buffer(chunk.byteLength % 2 === 0 ? 0 : 1) - ]); - } - exports.createRIFFChunk = createRIFFChunk; - function makeMetadataSeekable(originalMetadata, duration, cuesInfo) { - var header = extractElement("EBML", originalMetadata); - var headerSize = encodedSizeOfEbml(header); - var segmentContentStartPos = headerSize + 12; - var originalMetadataSize = originalMetadata[originalMetadata.length - 1].dataEnd - segmentContentStartPos; - var info = extractElement("Info", originalMetadata); - removeElement("Duration", info); - info.splice(1, 0, { name: "Duration", type: "f", data: createFloatBuffer(duration, 8) }); - var infoSize = encodedSizeOfEbml(info); - var tracks = extractElement("Tracks", originalMetadata); - var tracksSize = encodedSizeOfEbml(tracks); - var seekHeadSize = 47; - var seekHead = []; - var cuesSize = 5 + cuesInfo.length * 15; - var cues = []; - var lastSizeDifference = -1; - var maxIterations = 10; - var _loop_1 = function(i2) { - var infoStart = seekHeadSize; - var tracksStart = infoStart + infoSize; - var cuesStart = tracksStart + tracksSize; - var newMetadataSize = cuesStart + cuesSize; - var sizeDifference = newMetadataSize - originalMetadataSize; - seekHead = []; - seekHead.push({ name: "SeekHead", type: "m", isEnd: false }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([21, 73, 169, 102]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(infoStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([22, 84, 174, 107]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(tracksStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([28, 83, 187, 107]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(cuesStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "SeekHead", type: "m", isEnd: true }); - seekHeadSize = encodedSizeOfEbml(seekHead); - cues = []; - cues.push({ name: "Cues", type: "m", isEnd: false }); - cuesInfo.forEach(function(_a) { - var CueTrack = _a.CueTrack, CueClusterPosition = _a.CueClusterPosition, CueTime = _a.CueTime; - cues.push({ name: "CuePoint", type: "m", isEnd: false }); - cues.push({ name: "CueTime", type: "u", data: createUIntBuffer(CueTime) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: false }); - cues.push({ name: "CueTrack", type: "u", data: createUIntBuffer(CueTrack) }); - CueClusterPosition -= segmentContentStartPos; - CueClusterPosition += sizeDifference; - cues.push({ name: "CueClusterPosition", type: "u", data: createUIntBuffer(CueClusterPosition) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: true }); - cues.push({ name: "CuePoint", type: "m", isEnd: true }); - }); - cues.push({ name: "Cues", type: "m", isEnd: true }); - cuesSize = encodedSizeOfEbml(cues); - if (lastSizeDifference !== sizeDifference) { - lastSizeDifference = sizeDifference; - if (i2 === maxIterations - 1) { - throw new Error("Failed to converge to a stable metadata size"); - } - } else { - return "break"; - } + var eos; + function once(callback) { + var called = false; + return function() { + if (called) + return; + called = true; + callback.apply(void 0, arguments); }; - for (var i = 0; i < maxIterations; i++) { - var state_1 = _loop_1(i); - if (state_1 === "break") - break; - } - var finalMetadata = [].concat.apply([], [ - header, - { name: "Segment", type: "m", isEnd: false, unknownSize: true }, - seekHead, - info, - tracks, - cues - ]); - var result = new EBMLEncoder_1.default().encode(finalMetadata); - return result; - } - exports.makeMetadataSeekable = makeMetadataSeekable; - function removeElement(idName, metadata) { - var result = []; - var start = -1; - for (var i = 0; i < metadata.length; i++) { - var element2 = metadata[i]; - if (element2.name === idName) { - if (element2.type === "m") { - if (!element2.isEnd) { - start = i; - } else { - if (start == -1) - throw new Error("Detected " + idName + " closing element before finding the start"); - metadata.splice(start, i - start + 1); - return; - } - } else { - metadata.splice(i, 1); - return; - } - } - } } - exports.removeElement = removeElement; - function extractElement(idName, metadata) { - var result = []; - var start = -1; - for (var i = 0; i < metadata.length; i++) { - var element2 = metadata[i]; - if (element2.name === idName) { - if (element2.type === "m") { - if (!element2.isEnd) { - start = i; - } else { - if (start == -1) - throw new Error("Detected " + idName + " closing element before finding the start"); - result = metadata.slice(start, i + 1); - break; - } - } else { - result.push(metadata[i]); - break; - } - } - } - return result; + var _require$codes = require_errors_browser().codes; + var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; + var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + function noop3(err) { + if (err) + throw err; } - exports.extractElement = extractElement; - function putRefinedMetaData(metadata, info) { - if (Array.isArray(info.cueInfos) && !Array.isArray(info.cues)) { - console.warn("putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues"); - info.cues = info.cueInfos; - } - var ebml2 = []; - var payload = []; - for (var i_1 = 0; i_1 < metadata.length; i_1++) { - var elm = metadata[i_1]; - if (elm.type === "m" && elm.name === "Segment") { - ebml2 = metadata.slice(0, i_1); - payload = metadata.slice(i_1); - if (elm.unknownSize) { - payload.shift(); - break; - } - throw new Error("this metadata is not streaming webm file"); - } - } - if (!(payload[payload.length - 1].dataEnd > 0)) { - throw new Error("metadata dataEnd has wrong number"); - } - var originalPayloadOffsetEnd = payload[payload.length - 1].dataEnd; - var ebmlSize = ebml2[ebml2.length - 1].dataEnd; - var refinedEBMLSize = new EBMLEncoder_1.default().encode(ebml2).byteLength; - var offsetDiff = refinedEBMLSize - ebmlSize; - var payloadSize = originalPayloadOffsetEnd - payload[0].tagStart; - var segmentSize = payload[0].tagStart - ebmlSize; - var segmentOffset = payload[0].tagStart; - var segmentTagBuf = new exports.Buffer([24, 83, 128, 103]); - var segmentSizeBuf = new exports.Buffer("01ffffffffffffff", "hex"); - var _segmentSize = segmentTagBuf.byteLength + segmentSizeBuf.byteLength; - var newPayloadSize = payloadSize; - var i; - for (i = 1; i < 20; i++) { - var newPayloadOffsetEnd = ebmlSize + _segmentSize + newPayloadSize; - var offsetEndDiff = newPayloadOffsetEnd - originalPayloadOffsetEnd; - var sizeDiff = offsetDiff + offsetEndDiff; - var refined = refineMetadata(payload, sizeDiff, info); - var newNewRefinedSize = new EBMLEncoder_1.default().encode(refined).byteLength; - if (newNewRefinedSize === newPayloadSize) { - return new EBMLEncoder_1.default().encode([].concat(ebml2, [{ type: "m", name: "Segment", isEnd: false, unknownSize: true }], refined)); - } - newPayloadSize = newNewRefinedSize; - } - throw new Error("unable to refine metadata, stable size could not be found in " + i + " iterations!"); - } - exports.putRefinedMetaData = putRefinedMetaData; - function encodedSizeOfEbml(refinedMetaData) { - var encorder = new EBMLEncoder_1.default(); - return refinedMetaData.reduce(function(lst, elm) { - return lst.concat(encorder.encode([elm])); - }, []).reduce(function(o, buf2) { - return o + buf2.byteLength; - }, 0); - } - function refineMetadata(mesetadata, sizeDiff, info) { - var duration = info.duration, clusterPtrs = info.clusterPtrs, cues = info.cues; - var _metadata = mesetadata.slice(0); - if (typeof duration === "number") { - var overwrited_1 = false; - _metadata.forEach(function(elm) { - if (elm.type === "f" && elm.name === "Duration") { - overwrited_1 = true; - elm.data = createFloatBuffer(duration, 8); - } - }); - if (!overwrited_1) { - insertTag(_metadata, "Info", [{ name: "Duration", type: "f", data: createFloatBuffer(duration, 8) }]); - } - } - if (Array.isArray(cues)) { - insertTag(_metadata, "Cues", create_cue(cues, sizeDiff)); - } - var seekhead_children = []; - if (Array.isArray(clusterPtrs)) { - console.warn("append cluster pointers to seekhead is deprecated. please use cues"); - seekhead_children = create_seek_from_clusters(clusterPtrs, sizeDiff); - } - insertTag(_metadata, "SeekHead", seekhead_children, true); - return _metadata; + function isRequest(stream) { + return stream.setHeader && typeof stream.abort === "function"; } - function create_seek_from_clusters(clusterPtrs, sizeDiff) { - var seeks = []; - clusterPtrs.forEach(function(start) { - seeks.push({ name: "Seek", type: "m", isEnd: false }); - seeks.push({ name: "SeekID", type: "b", data: new exports.Buffer([31, 67, 182, 117]) }); - seeks.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(start + sizeDiff) }); - seeks.push({ name: "Seek", type: "m", isEnd: true }); + function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on("close", function() { + closed = true; }); - return seeks; - } - function create_cue(cueInfos, sizeDiff) { - var cues = []; - cueInfos.forEach(function(_a) { - var CueTrack = _a.CueTrack, CueClusterPosition = _a.CueClusterPosition, CueTime = _a.CueTime; - cues.push({ name: "CuePoint", type: "m", isEnd: false }); - cues.push({ name: "CueTime", type: "u", data: createUIntBuffer(CueTime) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: false }); - cues.push({ name: "CueTrack", type: "u", data: createUIntBuffer(CueTrack) }); - cues.push({ name: "CueClusterPosition", type: "u", data: createUIntBuffer(CueClusterPosition + sizeDiff) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: true }); - cues.push({ name: "CuePoint", type: "m", isEnd: true }); + if (eos === void 0) + eos = require_end_of_stream(); + eos(stream, { + readable: reading, + writable: writing + }, function(err) { + if (err) + return callback(err); + closed = true; + callback(); }); - return cues; + var destroyed = false; + return function(err) { + if (closed) + return; + if (destroyed) + return; + destroyed = true; + if (isRequest(stream)) + return stream.abort(); + if (typeof stream.destroy === "function") + return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED("pipe")); + }; } - function insertTag(_metadata, tagName, children2, insertHead) { - if (insertHead === void 0) { - insertHead = false; - } - var idx = -1; - for (var i = 0; i < _metadata.length; i++) { - var elm = _metadata[i]; - if (elm.type === "m" && elm.name === tagName && elm.isEnd === false) { - idx = i; - break; - } - } - if (idx >= 0) { - Array.prototype.splice.apply(_metadata, [idx + 1, 0].concat(children2)); - } else if (insertHead) { - [].concat([{ name: tagName, type: "m", isEnd: false }], children2, [{ name: tagName, type: "m", isEnd: true }]).reverse().forEach(function(elm2) { - _metadata.unshift(elm2); - }); - } else { - _metadata.push({ name: tagName, type: "m", isEnd: false }); - children2.forEach(function(elm2) { - _metadata.push(elm2); - }); - _metadata.push({ name: tagName, type: "m", isEnd: true }); - } + function call(fn) { + fn(); } - function concat(list) { - var i = 0; - var length = 0; - for (; i < list.length; ++i) { - length += list[i].length; - } - var buffer = exports.Buffer.allocUnsafe(length); - var pos = 0; - for (i = 0; i < list.length; ++i) { - var buf2 = list[i]; - buf2.copy(buffer, pos); - pos += buf2.length; - } - return buffer; + function pipe(from, to) { + return from.pipe(to); } - exports.concat = concat; - function encodeValueToBuffer(elm) { - var data = new exports.Buffer(0); - if (elm.type === "m") { - return elm; - } - switch (elm.type) { - case "u": - data = createUIntBuffer(elm.value); - break; - case "i": - data = createIntBuffer(elm.value); - break; - case "f": - data = createFloatBuffer(elm.value); - break; - case "s": - data = new exports.Buffer(elm.value, "ascii"); - break; - case "8": - data = new exports.Buffer(elm.value, "utf8"); - break; - case "b": - data = elm.value; - break; - case "d": - data = new int64_buffer_1.Int64BE(elm.value.getTime().toString()).toBuffer(); - break; - } - return Object.assign({}, elm, { data }); - } - exports.encodeValueToBuffer = encodeValueToBuffer; - function createUIntBuffer(value) { - var bytes = 1; - for (; value >= Math.pow(2, 8 * bytes); bytes++) { - } - if (bytes >= 7) { - console.warn("7bit or more bigger uint not supported."); - return new int64_buffer_1.Uint64BE(value).toBuffer(); - } - var data = new exports.Buffer(bytes); - data.writeUIntBE(value, 0, bytes); - return data; - } - exports.createUIntBuffer = createUIntBuffer; - function createIntBuffer(value) { - var bytes = 1; - for (; value >= Math.pow(2, 8 * bytes); bytes++) { - } - if (bytes >= 7) { - console.warn("7bit or more bigger uint not supported."); - return new int64_buffer_1.Int64BE(value).toBuffer(); - } - var data = new exports.Buffer(bytes); - data.writeIntBE(value, 0, bytes); - return data; - } - exports.createIntBuffer = createIntBuffer; - function createFloatBuffer(value, bytes) { - if (bytes === void 0) { - bytes = 8; - } - if (bytes === 8) { - var data = new exports.Buffer(8); - data.writeDoubleBE(value, 0); - return data; - } else if (bytes === 4) { - var data = new exports.Buffer(4); - data.writeFloatBE(value, 0); - return data; - } else { - throw new Error("float type bits must 4bytes or 8bytes"); - } + function popCallback(streams) { + if (!streams.length) + return noop3; + if (typeof streams[streams.length - 1] !== "function") + return noop3; + return streams.pop(); } - exports.createFloatBuffer = createFloatBuffer; - function convertEBMLDateToJSDate(int64str) { - if (int64str instanceof Date) { - return int64str; + function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) + streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS("streams"); } - return new Date(new Date("2001-01-01T00:00:00.000Z").getTime() + Number(int64str) / 1e3 / 1e3); + var error; + var destroys = streams.map(function(stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function(err) { + if (!error) + error = err; + if (err) + destroys.forEach(call); + if (reading) + return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); } - exports.convertEBMLDateToJSDate = convertEBMLDateToJSDate; + module.exports = pipeline; } }); - // node_modules/ts-ebml/lib/EBMLDecoder.js - var require_EBMLDecoder = __commonJS({ - "node_modules/ts-ebml/lib/EBMLDecoder.js"(exports) { - "use strict"; + // node_modules/readable-stream/readable-browser.js + var require_readable_browser = __commonJS({ + "node_modules/readable-stream/readable-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var tools_1 = require_tools2(); - var int64_buffer_1 = require_int64_buffer(); - var tools = require_tools2(); - var schema = require_schema(); - var byEbmlID = schema.byEbmlID; - var State2; - (function(State3) { - State3[State3["STATE_TAG"] = 1] = "STATE_TAG"; - State3[State3["STATE_SIZE"] = 2] = "STATE_SIZE"; - State3[State3["STATE_CONTENT"] = 3] = "STATE_CONTENT"; - })(State2 || (State2 = {})); - var EBMLDecoder = function() { - function EBMLDecoder2() { - this._buffer = new tools_1.Buffer(0); - this._tag_stack = []; - this._state = State2.STATE_TAG; - this._cursor = 0; - this._total = 0; - this._schema = byEbmlID; - this._result = []; - } - EBMLDecoder2.prototype.decode = function(chunk) { - this.readChunk(chunk); - var diff = this._result; - this._result = []; - return diff; - }; - EBMLDecoder2.prototype.readChunk = function(chunk) { - this._buffer = tools.concat([this._buffer, new tools_1.Buffer(chunk)]); - while (this._cursor < this._buffer.length) { - if (this._state === State2.STATE_TAG && !this.readTag()) { - break; - } - if (this._state === State2.STATE_SIZE && !this.readSize()) { - break; - } - if (this._state === State2.STATE_CONTENT && !this.readContent()) { - break; - } - } - }; - EBMLDecoder2.prototype.getSchemaInfo = function(tagNum) { - return this._schema[tagNum] || { - name: "unknown", - level: -1, - type: "unknown", - description: "unknown" - }; - }; - EBMLDecoder2.prototype.readTag = function() { - if (this._cursor >= this._buffer.length) { - return false; - } - var tag = tools_1.readVint(this._buffer, this._cursor); - if (tag == null) { - return false; - } - var buf2 = this._buffer.slice(this._cursor, this._cursor + tag.length); - var tagNum = buf2.reduce(function(o, v, i, arr) { - return o + v * Math.pow(16, 2 * (arr.length - 1 - i)); - }, 0); - var schema2 = this.getSchemaInfo(tagNum); - var tagObj = { - EBML_ID: tagNum.toString(16), - schema: schema2, - type: schema2.type, - name: schema2.name, - level: schema2.level, - tagStart: this._total, - tagEnd: this._total + tag.length, - sizeStart: this._total + tag.length, - sizeEnd: null, - dataStart: null, - dataEnd: null, - dataSize: null, - data: null - }; - this._tag_stack.push(tagObj); - this._cursor += tag.length; - this._total += tag.length; - this._state = State2.STATE_SIZE; - return true; - }; - EBMLDecoder2.prototype.readSize = function() { - if (this._cursor >= this._buffer.length) { - return false; - } - var size = tools_1.readVint(this._buffer, this._cursor); - if (size == null) { - return false; - } - var tagObj = this._tag_stack[this._tag_stack.length - 1]; - tagObj.sizeEnd = tagObj.sizeStart + size.length; - tagObj.dataStart = tagObj.sizeEnd; - tagObj.dataSize = size.value; - if (size.value === -1) { - tagObj.dataEnd = -1; - if (tagObj.type === "m") { - tagObj.unknownSize = true; - } - } else { - tagObj.dataEnd = tagObj.sizeEnd + size.value; - } - this._cursor += size.length; - this._total += size.length; - this._state = State2.STATE_CONTENT; - return true; - }; - EBMLDecoder2.prototype.readContent = function() { - var tagObj = this._tag_stack[this._tag_stack.length - 1]; - if (tagObj.type === "m") { - tagObj.isEnd = false; - this._result.push(tagObj); - this._state = State2.STATE_TAG; - if (tagObj.dataSize === 0) { - var elm = Object.assign({}, tagObj, { isEnd: true }); - this._result.push(elm); - this._tag_stack.pop(); - } - return true; - } - if (this._buffer.length < this._cursor + tagObj.dataSize) { - return false; - } - var data = this._buffer.slice(this._cursor, this._cursor + tagObj.dataSize); - this._buffer = this._buffer.slice(this._cursor + tagObj.dataSize); - tagObj.data = data; - switch (tagObj.type) { - case "u": - tagObj.value = data.readUIntBE(0, data.length); - break; - case "i": - tagObj.value = data.readIntBE(0, data.length); - break; - case "f": - tagObj.value = tagObj.dataSize === 4 ? data.readFloatBE(0) : tagObj.dataSize === 8 ? data.readDoubleBE(0) : (console.warn("cannot read " + tagObj.dataSize + " octets float. failback to 0"), 0); - break; - case "s": - tagObj.value = data.toString("ascii"); - break; - case "8": - tagObj.value = data.toString("utf8"); - break; - case "b": - tagObj.value = data; - break; - case "d": - tagObj.value = tools_1.convertEBMLDateToJSDate(new int64_buffer_1.Int64BE(data).toNumber()); - break; - } - if (tagObj.value === null) { - throw new Error("unknown tag type:" + tagObj.type); - } - this._result.push(tagObj); - this._total += tagObj.dataSize; - this._state = State2.STATE_TAG; - this._cursor = 0; - this._tag_stack.pop(); - while (this._tag_stack.length > 0) { - var topEle = this._tag_stack[this._tag_stack.length - 1]; - if (topEle.dataEnd < 0) { - this._tag_stack.pop(); - return true; - } - if (this._total < topEle.dataEnd) { - break; - } - if (topEle.type !== "m") { - throw new Error("parent element is not master element"); - } - var elm = Object.assign({}, topEle, { isEnd: true }); - this._result.push(elm); - this._tag_stack.pop(); - } - return true; - }; - return EBMLDecoder2; - }(); - exports.default = EBMLDecoder; + exports = module.exports = require_stream_readable(); + exports.Stream = exports; + exports.Readable = exports; + exports.Writable = require_stream_writable(); + exports.Duplex = require_stream_duplex(); + exports.Transform = require_stream_transform(); + exports.PassThrough = require_stream_passthrough(); + exports.finished = require_end_of_stream(); + exports.pipeline = require_pipeline(); } }); - // node_modules/ts-ebml/node_modules/events/events.js - var require_events2 = __commonJS({ - "node_modules/ts-ebml/node_modules/events/events.js"(exports, module) { + // node_modules/readable-web-to-node-stream/lib/index.js + var require_lib = __commonJS({ + "node_modules/readable-web-to-node-stream/lib/index.js"(exports) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || void 0; - } - module.exports = EventEmitter; - EventEmitter.EventEmitter = EventEmitter; - EventEmitter.prototype._events = void 0; - EventEmitter.prototype._maxListeners = void 0; - EventEmitter.defaultMaxListeners = 10; - EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError("n must be a positive number"); - this._maxListeners = n; - return this; - }; - EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - if (!this._events) - this._events = {}; - if (type === "error") { - if (!this._events.error || isObject(this._events.error) && !this._events.error.length) { - er = arguments[1]; - if (er instanceof Error) { - throw er; - } else { - var err = new Error('Uncaught, unspecified "error" event. (' + er + ")"); - err.context = er; - throw err; - } - } - } - handler = this._events[type]; - if (isUndefined(handler)) - return false; - if (isFunction(handler)) { - switch (arguments.length) { - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); - } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - return true; - }; - EventEmitter.prototype.addListener = function(type, listener) { - var m; - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - if (!this._events) - this._events = {}; - if (this._events.newListener) - this.emit("newListener", type, isFunction(listener.listener) ? listener.listener : listener); - if (!this._events[type]) - this._events[type] = listener; - else if (isObject(this._events[type])) - this._events[type].push(listener); - else - this._events[type] = [this._events[type], listener]; - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[type].length); - if (typeof console.trace === "function") { - console.trace(); - } - } + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ReadableWebToNodeStream = void 0; + var readable_stream_1 = require_readable_browser(); + var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable { + constructor(stream) { + super(); + this.bytesRead = 0; + this.released = false; + this.reader = stream.getReader(); } - return this; - }; - EventEmitter.prototype.on = EventEmitter.prototype.addListener; - EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - var fired = false; - function g() { - this.removeListener(type, g); - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - g.listener = listener; - this.on(type, g); - return this; - }; - EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - if (!this._events || !this._events[type]) - return this; - list = this._events[type]; - length = list.length; - position = -1; - if (list === listener || isFunction(list.listener) && list.listener === listener) { - delete this._events[type]; - if (this._events.removeListener) - this.emit("removeListener", type, listener); - } else if (isObject(list)) { - for (i = length; i-- > 0; ) { - if (list[i] === listener || list[i].listener && list[i].listener === listener) { - position = i; - break; - } + async _read() { + if (this.released) { + this.push(null); + return; } - if (position < 0) - return this; - if (list.length === 1) { - list.length = 0; - delete this._events[type]; + this.pendingRead = this.reader.read(); + const data = await this.pendingRead; + delete this.pendingRead; + if (data.done || this.released) { + this.push(null); } else { - list.splice(position, 1); + this.bytesRead += data.value.length; + this.push(data.value); } - if (this._events.removeListener) - this.emit("removeListener", type, listener); - } - return this; - }; - EventEmitter.prototype.removeAllListeners = function(type) { - var key2, listeners; - if (!this._events) - return this; - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; } - if (arguments.length === 0) { - for (key2 in this._events) { - if (key2 === "removeListener") - continue; - this.removeAllListeners(key2); + async waitForReadToComplete() { + if (this.pendingRead) { + await this.pendingRead; } - this.removeAllListeners("removeListener"); - this._events = {}; - return this; } - listeners = this._events[type]; - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); + async close() { + await this.syncAndRelease(); } - delete this._events[type]; - return this; - }; - EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; - }; - EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; - if (isFunction(evlistener)) - return 1; - else if (evlistener) - return evlistener.length; + async syncAndRelease() { + this.released = true; + await this.waitForReadToComplete(); + await this.reader.releaseLock(); } - return 0; - }; - EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); }; - function isFunction(arg) { - return typeof arg === "function"; - } - function isNumber(arg) { - return typeof arg === "number"; - } - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - function isUndefined(arg) { - return arg === void 0; - } + exports.ReadableWebToNodeStream = ReadableWebToNodeStream2; } }); - // node_modules/ts-ebml/lib/EBMLReader.js - var require_EBMLReader = __commonJS({ - "node_modules/ts-ebml/lib/EBMLReader.js"(exports) { + // node_modules/base-x/src/index.js + var require_src = __commonJS({ + "node_modules/base-x/src/index.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports && exports.__extends || function() { - var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { - d.__proto__ = b; - } || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - }; - return function(d, b) { - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - Object.defineProperty(exports, "__esModule", { value: true }); - var events_1 = require_events2(); - var tools = require_tools2(); - var EBMLReader = function(_super) { - __extends(EBMLReader2, _super); - function EBMLReader2() { - var _this = _super.call(this) || this; - _this.logGroup = ""; - _this.hasLoggingStarted = false; - _this.metadataloaded = false; - _this.chunks = []; - _this.stack = []; - _this.segmentOffset = 0; - _this.last2SimpleBlockVideoTrackTimecode = [0, 0]; - _this.last2SimpleBlockAudioTrackTimecode = [0, 0]; - _this.lastClusterTimecode = 0; - _this.lastClusterPosition = 0; - _this.timecodeScale = 1e6; - _this.metadataSize = 0; - _this.metadatas = []; - _this.cues = []; - _this.firstVideoBlockRead = false; - _this.firstAudioBlockRead = false; - _this.currentTrack = { TrackNumber: -1, TrackType: -1, DefaultDuration: null, CodecDelay: null }; - _this.trackTypes = []; - _this.trackDefaultDuration = []; - _this.trackCodecDelay = []; - _this.trackInfo = { type: "nothing" }; - _this.ended = false; - _this.logging = false; - _this.use_duration_every_simpleblock = false; - _this.use_webp = false; - _this.use_segment_info = true; - _this.drop_default_duration = true; - return _this; - } - EBMLReader2.prototype.stop = function() { - this.ended = true; - this.emit_segment_info(); - while (this.stack.length) { - this.stack.pop(); - if (this.logging) { - console.groupEnd(); - } + function base(ALPHABET) { + if (ALPHABET.length >= 255) { + throw new TypeError("Alphabet too long"); + } + var BASE_MAP = new Uint8Array(256); + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255; + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i); + var xc = x.charCodeAt(0); + if (BASE_MAP[xc] !== 255) { + throw new TypeError(x + " is ambiguous"); } - if (this.logging && this.hasLoggingStarted && this.logGroup) { - console.groupEnd(); + BASE_MAP[xc] = i; + } + var BASE = ALPHABET.length; + var LEADER = ALPHABET.charAt(0); + var FACTOR = Math.log(BASE) / Math.log(256); + var iFACTOR = Math.log(256) / Math.log(BASE); + function encode2(source) { + if (source instanceof Uint8Array) { + } else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); + } else if (Array.isArray(source)) { + source = Uint8Array.from(source); } - }; - EBMLReader2.prototype.emit_segment_info = function() { - var data = this.chunks; - this.chunks = []; - if (!this.metadataloaded) { - this.metadataloaded = true; - this.metadatas = data; - var videoTrackNum = this.trackTypes.indexOf(1); - var audioTrackNum = this.trackTypes.indexOf(2); - this.trackInfo = videoTrackNum >= 0 && audioTrackNum >= 0 ? { type: "both", trackNumber: videoTrackNum } : videoTrackNum >= 0 ? { type: "video", trackNumber: videoTrackNum } : audioTrackNum >= 0 ? { type: "audio", trackNumber: audioTrackNum } : { type: "nothing" }; - if (!this.use_segment_info) { - return; - } - this.emit("metadata", { data, metadataSize: this.metadataSize }); - } else { - if (!this.use_segment_info) { - return; - } - var timecode = this.lastClusterTimecode; - var duration = this.duration; - var timecodeScale = this.timecodeScale; - this.emit("cluster", { timecode, data }); - this.emit("duration", { timecodeScale, duration }); + if (!(source instanceof Uint8Array)) { + throw new TypeError("Expected Uint8Array"); } - }; - EBMLReader2.prototype.read = function(elm) { - var _this = this; - var drop = false; - if (this.ended) { - return; + if (source.length === 0) { + return ""; } - if (elm.type === "m") { - if (elm.isEnd) { - this.stack.pop(); - } else { - var parent_1 = this.stack[this.stack.length - 1]; - if (parent_1 != null && parent_1.level >= elm.level) { - this.stack.pop(); - if (this.logging) { - console.groupEnd(); - } - parent_1.dataEnd = elm.dataEnd; - parent_1.dataSize = elm.dataEnd - parent_1.dataStart; - parent_1.unknownSize = false; - var o = Object.assign({}, parent_1, { name: parent_1.name, type: parent_1.type, isEnd: true }); - this.chunks.push(o); - } - this.stack.push(elm); - } + var zeroes = 0; + var length = 0; + var pbegin = 0; + var pend = source.length; + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++; + zeroes++; } - if (elm.type === "m" && elm.name == "Segment") { - if (this.segmentOffset != 0) { - console.warn("Multiple segments detected!"); - } - this.segmentOffset = elm.dataStart; - this.emit("segment_offset", this.segmentOffset); - } else if (elm.type === "b" && elm.name === "SimpleBlock") { - var _a = tools.ebmlBlock(elm.data), timecode = _a.timecode, trackNumber = _a.trackNumber, frames_1 = _a.frames; - if (this.trackTypes[trackNumber] === 1) { - if (!this.firstVideoBlockRead) { - this.firstVideoBlockRead = true; - if (this.trackInfo.type === "both" || this.trackInfo.type === "video") { - var CueTime = this.lastClusterTimecode + timecode; - this.cues.push({ CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - this.emit("cue_info", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime: this.lastClusterTimecode }); - this.emit("cue", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - } - } - this.last2SimpleBlockVideoTrackTimecode = [this.last2SimpleBlockVideoTrackTimecode[1], timecode]; - } else if (this.trackTypes[trackNumber] === 2) { - if (!this.firstAudioBlockRead) { - this.firstAudioBlockRead = true; - if (this.trackInfo.type === "audio") { - var CueTime = this.lastClusterTimecode + timecode; - this.cues.push({ CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - this.emit("cue_info", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime: this.lastClusterTimecode }); - this.emit("cue", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - } - } - this.last2SimpleBlockAudioTrackTimecode = [this.last2SimpleBlockAudioTrackTimecode[1], timecode]; - } - if (this.use_duration_every_simpleblock) { - this.emit("duration", { timecodeScale: this.timecodeScale, duration: this.duration }); - } - if (this.use_webp) { - frames_1.forEach(function(frame) { - var startcode = frame.slice(3, 6).toString("hex"); - if (startcode !== "9d012a") { - return; - } - ; - var webpBuf = tools.VP8BitStreamToRiffWebPBuffer(frame); - var webp = new Blob([webpBuf], { type: "image/webp" }); - var currentTime = _this.duration; - _this.emit("webp", { currentTime, webp }); - }); - } - } else if (elm.type === "m" && elm.name === "Cluster" && elm.isEnd === false) { - this.firstVideoBlockRead = false; - this.firstAudioBlockRead = false; - this.emit_segment_info(); - this.emit("cluster_ptr", elm.tagStart); - this.lastClusterPosition = elm.tagStart; - } else if (elm.type === "u" && elm.name === "Timecode") { - this.lastClusterTimecode = elm.value; - } else if (elm.type === "u" && elm.name === "TimecodeScale") { - this.timecodeScale = elm.value; - } else if (elm.type === "m" && elm.name === "TrackEntry") { - if (elm.isEnd) { - this.trackTypes[this.currentTrack.TrackNumber] = this.currentTrack.TrackType; - this.trackDefaultDuration[this.currentTrack.TrackNumber] = this.currentTrack.DefaultDuration; - this.trackCodecDelay[this.currentTrack.TrackNumber] = this.currentTrack.CodecDelay; - } else { - this.currentTrack = { TrackNumber: -1, TrackType: -1, DefaultDuration: null, CodecDelay: null }; + var size = (pend - pbegin) * iFACTOR + 1 >>> 0; + var b58 = new Uint8Array(size); + while (pbegin !== pend) { + var carry = source[pbegin]; + var i2 = 0; + for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) { + carry += 256 * b58[it1] >>> 0; + b58[it1] = carry % BASE >>> 0; + carry = carry / BASE >>> 0; } - } else if (elm.type === "u" && elm.name === "TrackType") { - this.currentTrack.TrackType = elm.value; - } else if (elm.type === "u" && elm.name === "TrackNumber") { - this.currentTrack.TrackNumber = elm.value; - } else if (elm.type === "u" && elm.name === "CodecDelay") { - this.currentTrack.CodecDelay = elm.value; - } else if (elm.type === "u" && elm.name === "DefaultDuration") { - if (this.drop_default_duration) { - console.warn("DefaultDuration detected!, remove it"); - drop = true; - } else { - this.currentTrack.DefaultDuration = elm.value; + if (carry !== 0) { + throw new Error("Non-zero carry"); } - } else if (elm.name === "unknown") { - console.warn(elm); + length = i2; + pbegin++; } - if (!this.metadataloaded && elm.dataEnd > 0) { - this.metadataSize = elm.dataEnd; + var it2 = size - length; + while (it2 !== size && b58[it2] === 0) { + it2++; + } + var str = LEADER.repeat(zeroes); + for (; it2 < size; ++it2) { + str += ALPHABET.charAt(b58[it2]); } - if (!drop) { - this.chunks.push(elm); + return str; + } + function decodeUnsafe(source) { + if (typeof source !== "string") { + throw new TypeError("Expected String"); } - if (this.logging) { - this.put(elm); + if (source.length === 0) { + return new Uint8Array(); } - }; - Object.defineProperty(EBMLReader2.prototype, "duration", { - get: function() { - if (this.trackInfo.type === "nothing") { - console.warn("no video, no audio track"); - return 0; + var psz = 0; + var zeroes = 0; + var length = 0; + while (source[psz] === LEADER) { + zeroes++; + psz++; + } + var size = (source.length - psz) * FACTOR + 1 >>> 0; + var b256 = new Uint8Array(size); + while (source[psz]) { + var carry = BASE_MAP[source.charCodeAt(psz)]; + if (carry === 255) { + return; } - var defaultDuration = 0; - var codecDelay = 0; - var lastTimecode = 0; - var _defaultDuration = this.trackDefaultDuration[this.trackInfo.trackNumber]; - if (typeof _defaultDuration === "number") { - defaultDuration = _defaultDuration; - } else { - if (this.trackInfo.type === "both") { - if (this.last2SimpleBlockAudioTrackTimecode[1] > this.last2SimpleBlockVideoTrackTimecode[1]) { - defaultDuration = (this.last2SimpleBlockAudioTrackTimecode[1] - this.last2SimpleBlockAudioTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackTypes.indexOf(2)]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockAudioTrackTimecode[1]; - } else { - defaultDuration = (this.last2SimpleBlockVideoTrackTimecode[1] - this.last2SimpleBlockVideoTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackTypes.indexOf(1)]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockVideoTrackTimecode[1]; - } - } else if (this.trackInfo.type === "video") { - defaultDuration = (this.last2SimpleBlockVideoTrackTimecode[1] - this.last2SimpleBlockVideoTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackInfo.trackNumber]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockVideoTrackTimecode[1]; - } else if (this.trackInfo.type === "audio") { - defaultDuration = (this.last2SimpleBlockAudioTrackTimecode[1] - this.last2SimpleBlockAudioTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackInfo.trackNumber]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockAudioTrackTimecode[1]; - } + var i2 = 0; + for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) { + carry += BASE * b256[it3] >>> 0; + b256[it3] = carry % 256 >>> 0; + carry = carry / 256 >>> 0; } - var duration_nanosec = (this.lastClusterTimecode + lastTimecode) * this.timecodeScale + defaultDuration - codecDelay; - var duration = duration_nanosec / this.timecodeScale; - return Math.floor(duration); - }, - enumerable: true, - configurable: true - }); - EBMLReader2.prototype.addListener = function(event, listener) { - return _super.prototype.addListener.call(this, event, listener); - }; - EBMLReader2.prototype.put = function(elm) { - if (!this.hasLoggingStarted) { - this.hasLoggingStarted = true; - if (this.logging && this.logGroup) { - console.groupCollapsed(this.logGroup); + if (carry !== 0) { + throw new Error("Non-zero carry"); } + length = i2; + psz++; } - if (elm.type === "m") { - if (elm.isEnd) { - console.groupEnd(); - } else { - console.group(elm.name + ":" + elm.tagStart); - } - } else if (elm.type === "b") { - console.log(elm.name, elm.type); - } else { - console.log(elm.name, elm.tagStart, elm.type, elm.value); + var it4 = size - length; + while (it4 !== size && b256[it4] === 0) { + it4++; + } + var vch = new Uint8Array(zeroes + (size - it4)); + var j2 = zeroes; + while (it4 !== size) { + vch[j2++] = b256[it4++]; + } + return vch; + } + function decode3(string) { + var buffer = decodeUnsafe(string); + if (buffer) { + return buffer; } + throw new Error("Non-base" + BASE + " character"); + } + return { + encode: encode2, + decodeUnsafe, + decode: decode3 }; - return EBMLReader2; - }(events_1.EventEmitter); - exports.default = EBMLReader; - } - }); - - // node_modules/ts-ebml/package.json - var require_package = __commonJS({ - "node_modules/ts-ebml/package.json"(exports, module) { - module.exports = { - name: "ts-ebml", - version: "2.0.2", - description: "ebml decoder and encoder", - scripts: { - setup: "npm install -g http-server;", - init: "npm run update; npm run mkdir; npm run build", - update: "npm run reset; npm update", - reset: "rm -rf node_modules", - mkdir: "mkdir lib dist 2>/dev/null", - clean: "rm -rf lib/* dist/* test/*.js; mkdir -p dist", - build: "npm run clean && tsc -p .; npm run browserify", - start: "http-server . -s & tsc -w -p .& watchify lib/example_seekable.js -o test/example_seekable.js", - stop: "killall -- node */tsc -w -p", - browserify: "browserify lib/index.js --standalone EBML -o dist/EBML.js", - watchify: "watchify lib/index.js --standalone EBML -o dist/EBMl.js -v", - test: "tsc; espower lib/test.js > lib/test.tmp; mv -f lib/test.tmp lib/test.js; browserify lib/test.js -o test/test.js", - example: "tsc; browserify lib/example_seekable.js -o test/example_seekable.js", - examples: "tsc; for file in `find lib -name 'example_*.js' -type f -printf '%f\\n'`; do browserify lib/$file -o test/$file; done", - examples_bsd: "tsc; for file in `find lib -name 'example_*.js' -type f -print`; do browserify lib/$(basename $file) -o test/$(basename $file); done", - check: "tsc -w --noEmit -p ./", - lint: "tslint -c ./tslint.json --project ./tsconfig.json --type-check", - doc: "typedoc --mode modules --out doc --disableOutputCheck" - }, - repository: { - type: "git", - url: "git+https://github.com/legokichi/ts-ebml.git" - }, - keywords: [ - "ebml", - "webm", - "mkv", - "matrosika", - "webp" - ], - author: "legokichi duckscallion", - license: "MIT", - bugs: { - url: "https://github.com/legokichi/ts-ebml/issues" - }, - homepage: "https://github.com/legokichi/ts-ebml#readme", - dependencies: { - buffer: "^5.0.7", - commander: "^2.11.0", - ebml: "^2.2.1", - "ebml-block": "^1.1.0", - events: "^1.1.1", - "int64-buffer": "^0.1.9", - matroska: "^2.2.3" - }, - devDependencies: { - "@types/commander": "^2.9.1", - "@types/qunit": "^2.0.31", - browserify: "^13.1.0", - empower: "^1.2.3", - "espower-cli": "^1.1.0", - "power-assert": "^1.4.4", - "power-assert-formatter": "^1.4.1", - "qunit-tap": "^1.5.1", - qunitjs: "^2.4.0", - tslint: "^3.15.1", - typedoc: "^0.5.3", - typescript: "^2.4.2", - watchify: "^3.7.0" - }, - bin: "./lib/cli.js", - main: "./lib/index.js", - typings: "./lib/index.d.ts" - }; + } + module.exports = base; } }); - // node_modules/ts-ebml/lib/index.js - var require_lib2 = __commonJS({ - "node_modules/ts-ebml/lib/index.js"(exports) { - "use strict"; + // node_modules/bs58/index.js + var require_bs58 = __commonJS({ + "node_modules/bs58/index.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var EBMLDecoder_1 = require_EBMLDecoder(); - exports.Decoder = EBMLDecoder_1.default; - var EBMLEncoder_1 = require_EBMLEncoder(); - exports.Encoder = EBMLEncoder_1.default; - var EBMLReader_1 = require_EBMLReader(); - exports.Reader = EBMLReader_1.default; - var tools = require_tools2(); - exports.tools = tools; - var version = require_package().version; - exports.version = version; + var basex = require_src(); + var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + module.exports = basex(ALPHABET); } }); @@ -17032,10 +7241,10 @@ if (frames.length != 1) throw new Error("only single frame JPEGs supported"); for (var i = 0; i < frames.length; i++) { - var cp = frames[i].components; - for (var j in cp) { - cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx]; - delete cp[j].quantizationIdx; + var cp2 = frames[i].components; + for (var j in cp2) { + cp2[j].quantizationTable = quantizationTables[cp2[j].quantizationIdx]; + delete cp2[j].quantizationIdx; } } this.width = frame.samplesPerLine; @@ -17311,8 +7520,7 @@ // src/main.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_process = __toESM(require_node_process(), 1); - var import_buffer11 = __toESM(require_buffer(), 1); + var import_buffer9 = __toESM(require_buffer(), 1); // src/stores.ts init_define_BUILD_VERSION(); @@ -18188,6 +8396,9 @@ // src/stores.ts var localLoad = async (key2, def) => { + if (false) { + return def; + } const isinls = "__pee__" + key2 in localStorage; let ret; if (isinls) { @@ -18212,6 +8423,9 @@ return ret; }; var localSet = (key2, value) => { + if (false) { + return; + } if (true) chrome.storage.local.set({ [key2]: JSON.stringify(value) }); else @@ -18431,15 +8645,6 @@ this.writer.releaseLock(); } }; - var BufferWriteStream = () => { - let b = import_buffer.Buffer.from([]); - const ret = new WritableStream({ - write(chunk) { - b = import_buffer.Buffer.concat([b, chunk]); - } - }); - return [ret, () => b]; - }; // src/utils.ts init_define_BUILD_VERSION(); @@ -18530,9 +8735,13 @@ var lqueue = {}; var localLoad2 = (key2, def) => "__pee__" + key2 in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key2)) : def; var localSet2 = (key2, value) => localStorage.setItem("__pee__" + key2, JSON.stringify(value)); - var { port1, port2 } = new MessageChannel(); + var port1; + var port2; console.log("ff_api", false); if (true) { + const nmc = new MessageChannel(); + port1 = nmc.port1; + port2 = nmc.port2; const iframe = document.createElement("iframe"); iframe.style.display = "none"; iframe.name = location.origin; @@ -18540,7 +8749,6 @@ iframe.onload = _; }); iframe.src = `${chrome.runtime.getURL("")}options.html`; - const meself = new URL(chrome.runtime.getURL("")).origin; document.documentElement.appendChild(iframe); iframeloaded.then(() => { iframe.contentWindow?.postMessage("", "*", [port2]); @@ -18549,12 +8757,27 @@ lqueue[ev.data.id](ev.data); }; } + console.log("ff_api"); + if (false) { + port1 = { + onmessage(ev) { + lqueue[ev.data.id](ev.data); + }, + postMessage(msg, tr) { + postMessage({ + type: "ipc", + tr, + msg + }, tr); + } + }; + } var gid = 0; var sendCmd = (cmd, tr) => { const prom = new Promise((_) => { const id = gid++; lqueue[id] = (e) => { - _(e.res); + _(e); delete lqueue[id]; }; port1.postMessage({ id, ...cmd }, tr || []); @@ -18776,36 +8999,6 @@ return corsFetch(url.toString(), opt, lisn); return GM_fetch(url, opt, lisn); } - async function* streamRemote(url, chunkSize = 72 * 1024, fetchRestOnNonCanceled = true) { - let size = Number.POSITIVE_INFINITY; - let ptr = 0; - let fetchSize = chunkSize; - while (ptr != size) { - let obj; - const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } }); - if (false) { - obj = headerStringToObject(fres.responseHeaders); - } else { - obj = fres.headers; - } - if (!("content-length" in obj)) { - console.warn("no content lenght???", url); - break; - } - if ("content-range" in obj) { - size = +obj["content-range"].split("/")[1]; - } - const len = +obj["content-length"]; - ptr += len; - if (fetchRestOnNonCanceled) - fetchSize = size; - const val = Buffer2.from(await fres.arrayBuffer()); - const e = yield val; - if (e) { - break; - } - } - } // src/filehosts.ts function parseForm(data) { @@ -18964,12 +9157,12 @@ static inRange(a, min, max) { return min <= a && a <= max; } - static codePointToString(cp) { - if (cp <= 65535) { - return String.fromCharCode(cp); + static codePointToString(cp2) { + if (cp2 <= 65535) { + return String.fromCharCode(cp2); } else { - cp -= 65536; - return String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320); + cp2 -= 65536; + return String.fromCharCode((cp2 >> 10) + 55296, (cp2 & 1023) + 56320); } } static singleByteDecoder(bite) { @@ -20840,11 +11033,7 @@ }, filename: fn, thumbnail: csettings.hotlink ? prev || full : import_buffer2.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings.hotlink ? full || prev : async (lsn) => { - if (!cachedFile) - cachedFile = await (await ifetch(full || prev, void 0, lsn)).arrayBuffer(); - return import_buffer2.Buffer.from(cachedFile); - } + data: csettings.hotlink ? full || prev : { url: full || prev } }]; ret.push([end, true]); } @@ -20897,17 +11086,17 @@ if (hasThumbnail) { thumbsize = header.readInt32LE(ptr); ptr += 4; - if (header.byteLength < ptr + thumbsize) + if (header.byteLength >= ptr + thumbsize) thumb = header.slice(ptr, ptr + thumbsize); else thumb = import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer()); ptr += thumbsize; } - const unzip = async (lsn) => import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } }, lsn)).arrayBuffer()); + const unzip = { url: pee, headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } }; let data; data = unzip; if (size < 3072) { - thumb = data = await unzip(); + thumb = data = import_buffer2.Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer()); } return { filename: fn, @@ -20950,7 +11139,7 @@ if (typeof ef.data == "string") { const req = await ifetch(ef.data); buff = import_buffer2.Buffer.from(await req.arrayBuffer()); - } else if (!import_buffer2.Buffer.isBuffer(ef.data)) + } else if (!(ef.data instanceof Uint8Array)) buff = await ef.data(); else buff = ef.data; @@ -20994,197 +11183,34 @@ } addEventListener(ev, cb) { this.targets[ev] = this.targets[ev] || []; - this.targets[ev].push(cb); - } - dispatchEvent(ev) { - const evs = this.targets[ev.type]; - if (evs) - for (const cb of evs) - cb(ev); - return true; - } - removeEventListener(ev, cb) { - const evs = this.targets[ev]; - if (!evs) - return; - for (let i = 0; i < evs.length; ++i) { - if (evs[i] == cb) { - evs.splice(i, 1); - return; - } - } - } - }; - - // src/pngv3.ts - var bs58 = __toESM(require_bs58(), 1); - - // src/bitstream.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/reader.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/string-encoding-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/writer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/array-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/array-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/resolve-length.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/structure-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/utils.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/boolean-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/boolean-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/buffer-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/buffer-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/element.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/buffered-writable.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/constructor.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/discriminant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/writable.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/incomplete-read-result.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/element.js - var _parent; - var _readFields; - var _isBeingRead; - var _fieldBeingComputed; - var _fieldBeingComputedIntrospectable; - var SERIALIZE_WRITERS = Symbol("Writers used by Bitstream#serialize() for this element type."); - _parent = /* @__PURE__ */ new WeakMap(), _readFields = /* @__PURE__ */ new WeakMap(), _isBeingRead = /* @__PURE__ */ new WeakMap(), _fieldBeingComputed = /* @__PURE__ */ new WeakMap(), _fieldBeingComputedIntrospectable = /* @__PURE__ */ new WeakMap(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field-definition.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/null-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/number-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/string-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/length-determinant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/number-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/value-determinant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant-definition.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/reserved.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); + this.targets[ev].push(cb); + } + dispatchEvent(ev) { + const evs = this.targets[ev.type]; + if (evs) + for (const cb of evs) + cb(ev); + return true; + } + removeEventListener(ev, cb) { + const evs = this.targets[ev]; + if (!evs) + return; + for (let i = 0; i < evs.length; ++i) { + if (evs[i] == cb) { + evs.splice(i, 1); + return; + } + } + } + }; - // node_modules/@astronautlabs/bitstream/dist.esm/elements/reserved-low.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); + // src/pngv3.ts + var bs58 = __toESM(require_bs58(), 1); - // node_modules/@astronautlabs/bitstream/dist.esm/elements/marker.js + // src/bitstream.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - - // src/bitstream.ts var revbyte = (n, len = 8) => { let acc = 0; let n2 = n; @@ -21196,7 +11222,7 @@ } return acc; }; - var BitstreamReader2 = class { + var BitstreamReader = class { constructor() { this.buffers = []; this.bufferedLength = 0; @@ -21235,7 +11261,7 @@ this.bufferedLength += buffer.length * 8; } }; - var BitstreamWriter2 = class { + var BitstreamWriter = class { constructor(stream, bufferSize = 1) { this.stream = stream; this.pendingBits = 0; @@ -21259,8 +11285,6 @@ this.buffer.fill(0); } setBit(b) { - if (b) - debugger; let byte = this.buffer[0]; byte |= b << (this._offset & 7); this.buffer[0] = byte; @@ -21555,7 +11579,7 @@ let backoffset = tinf_read_bits(d, dist_bits[dist], dist_base[dist]); const offs2 = d.dest.length - backoffset; let match; - const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader2 && d.to_hide.available == 0; + const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader && d.to_hide.available == 0; if (!skip && (match = Buffer2.from(d.dest.slice(offs2, offs2 + length))).length == length) { let begin = d.dest.length - 32768; if (begin < 0) @@ -21581,7 +11605,7 @@ matches.reverse(); const v = Math.floor(Math.log2(matches.length)); capacity += v; - if (d.to_hide instanceof BitstreamReader2) { + if (d.to_hide instanceof BitstreamReader) { if (d.to_hide.available) { const s = d.to_hide.readSync(Math.min(d.to_hide.available, v)); backoffset = matches[s]; @@ -21622,8 +11646,8 @@ return TINF_OK; } function tinf_uncompress(source, decompressed, to_hide, hidden, opt = 0) { - const decomp = decompressed ? new BitstreamWriter2({ write: decompressed }) : null; - const hid = hidden && new BitstreamWriter2({ write: hidden }, 4); + const decomp = decompressed ? new BitstreamWriter({ write: decompressed }) : null; + const hid = hidden && new BitstreamWriter({ write: hidden }, 4); const d = new Data(source, decomp, to_hide, hid); let res; let bfinal, btype; @@ -21706,10 +11730,10 @@ "z": "z.zz.fo" }; var extractFromRawDeflate = (b) => { - const src = new BitstreamReader2(); + const src = new BitstreamReader(); src.addBuffer(b); const chnks = []; - const hidden = new BitstreamWriter2({ + const hidden = new BitstreamWriter({ write(chunk) { for (const i of chunk) { if (i) @@ -21727,7 +11751,7 @@ } return false; }; - var extract = async (png) => { + var extract = async (png, doextract = true) => { const reader = BufferReadStream(png).getReader(); const sneed = new PNGDecoder(reader, false); const ret = []; @@ -21743,22 +11767,28 @@ case "tEXt": buff = chunk; if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) { + if (!doextract) + return true; const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM4.length); xor(passed, password); const k = await decodeCoom3Payload(passed); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM5.length); const decoded = import_buffer3.Buffer.from(passed.toString(), "base64").toString().split(" ").map((e) => { return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (w = [CUM6, CUM7].find((e) => buff.slice(4, 4 + e.length).equals(e))) { const passed = buff.slice(4 + w.length); @@ -21775,8 +11805,10 @@ throw "Uhh"; return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); + if (!doextract) + return true; const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } catch (e) { } } @@ -21803,10 +11835,13 @@ throw "Uhh"; return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); - return decodeCoom3Payload(import_buffer3.Buffer.from(dec)); + if (doextract) + return decodeCoom3Payload(import_buffer3.Buffer.from(dec)); + return true; } } catch (e) { - console.error(e); + if (e != "Uhh") + console.error(e); } finally { reader.releaseLock(); } @@ -21817,7 +11852,7 @@ data.copy(ret, 4); return ret; }; - var BufferWriteStream2 = () => { + var BufferWriteStream = () => { let b = import_buffer3.Buffer.from([]); const ret = new WritableStream({ write(chunk) { @@ -21828,8 +11863,8 @@ return [ret, () => b]; }; var embedInRawDeflate = (b, h) => { - const src = new BitstreamReader2(); - const hid = new BitstreamReader2(); + const src = new BitstreamReader(); + const hid = new BitstreamReader(); hid.addBuffer(h); src.addBuffer(b); const chnks = []; @@ -21840,14 +11875,14 @@ if (!csettings2) throw new Error("Settings uninit"); if (csettings2.pmeth < 5) { - let magic4 = false; - const [writestream2, extract8] = BufferWriteStream2(); + let magic = false; + const [writestream2, extract6] = BufferWriteStream(); const encoder = new PNGEncoder(writestream2); const decoder = new PNGDecoder(container.stream().getReader()); for await (const [name, chunk, crc, offset] of decoder.chunks()) { - if (magic4 && name != "IDAT") + if (magic && name != "IDAT") break; - if (!magic4 && name == "IDAT") { + if (!magic && name == "IDAT") { const passed = import_buffer3.Buffer.from(injb); switch (csettings2.pmeth) { case 0: @@ -21867,7 +11902,7 @@ await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM7, import_buffer3.Buffer.from(bs58.encode(passed))])), 0, 0]); break; } - magic4 = true; + magic = true; } await encoder.insertchunk([name, chunk, crc, offset]); } @@ -21877,7 +11912,7 @@ 0, 0 ]); - return extract8(); + return extract6(); } let pdec = new PNGDecoder(container.stream().getReader()); const concat = []; @@ -21888,7 +11923,7 @@ const head = comp.slice(0, 2); const chksum = comp.slice(-4); const idatblk = embedInRawDeflate(comp.slice(2, -4), injb); - const [writestream, extract7] = BufferWriteStream2(); + const [writestream, extract5] = BufferWriteStream(); const penc = new PNGEncoder(writestream); pdec = new PNGDecoder(container.stream().getReader()); let ins = false; @@ -21904,7 +11939,7 @@ } await penc.dtor(); console.log("Finished writing"); - return extract7(); + return extract5(); }; var inject = async (container, links) => { links = links.map((link) => { @@ -21920,7 +11955,7 @@ return inject_data(container, injb); }; var has_embed = async (png) => { - const r = await extract(png); + const r = await extract(png, false); return !!r; }; var pngv3_default = { @@ -21930,287 +11965,10 @@ match: (fn) => !!fn.match(/\.png$/) }; - // src/webm.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var import_buffer4 = __toESM(require_buffer(), 1); - var ebml = __toESM(require_lib2(), 1); - var password2 = import_buffer4.Buffer.from("NOA"); - var xor2 = (a, p) => { - let n = 0; - for (let i = 0; i < a.byteLength; ++i) { - a[i] ^= p[n]; - n++; - n %= p.byteLength; - } - }; - var findEnclosingTag = (ch, name) => { - const first = ch.findIndex((e) => e.type == "m" && e.name == name); - if (first < 0) - return; - const second = ch.slice(first).findIndex((e) => e.type == "m" && e.name == name); - if (second < 0) - return; - return [ - first, - first + second - ]; - }; - var embed = (webm, data) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const enc = new ebml.Encoder(); - let embed2 = chunks.findIndex((e) => e.name == "Tracks" && e.type == "m" && e.isEnd); - const findOrInsert = (n) => { - let tags = findEnclosingTag(chunks, n); - const stack = []; - if (!tags) { - stack.push({ - type: "m", - isEnd: false, - name: n, - data: import_buffer4.Buffer.from("") - }); - stack.push({ - type: "m", - isEnd: true, - name: n, - data: import_buffer4.Buffer.from("") - }); - chunks.splice(embed2 + 1, 0, ...stack); - tags = findEnclosingTag(chunks, n); - } - embed2 = tags[1]; - }; - findOrInsert("Tags"); - findOrInsert("Tag"); - findOrInsert("Targets"); - embed2++; - chunks.splice(embed2 + 1, 0, ...[ - { - type: "m", - isEnd: false, - name: "SimpleTag", - data: import_buffer4.Buffer.from("") - }, - { - type: "8", - isEnd: false, - name: "TagName", - data: import_buffer4.Buffer.from("VOOM") - }, - { - type: "8", - isEnd: false, - name: "TagBinary", - data - }, - { - type: "m", - isEnd: true, - name: "SimpleTag", - data: import_buffer4.Buffer.from("") - } - ]); - return import_buffer4.Buffer.from(enc.encode(chunks.filter((e) => e.name != "unknown"))); - }; - var extract2 = (webm) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM")); - const cl = chunks.find((e) => e.name == "Cluster"); - if (cl && embed2 == -1) - return; - if (embed2 == -1) - return; - const echk = chunks[embed2]; - const chk = chunks[embed2 + 1]; - if (chk.type == "b" && chk.name == "TagBinary") { - if (echk.type == "8" && echk.value == "VOOM") { - xor2(chk.data, password2); - } - return decodeCoom3Payload(chk.data); - } - }; - var inject2 = async (container, links) => { - const buff = import_buffer4.Buffer.from(links.join(" ")); - xor2(buff, password2); - return embed(import_buffer4.Buffer.from(await container.arrayBuffer()), buff); - }; - var has_embed2 = (webm) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM")); - const cl = chunks.find((e) => e.name == "Cluster"); - if (cl && embed2 == -1) - return false; - if (embed2 == -1) - return; - return true; - }; - var webm_default = { - extract: extract2, - has_embed: has_embed2, - inject: inject2, - match: (fn) => !!fn.match(/\.webm$/) - }; - - // src/gif.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var import_buffer5 = __toESM(require_buffer(), 1); - var netscape = import_buffer5.Buffer.from("!\xFF\vNETSCAPE2.0", "ascii"); - var magic = import_buffer5.Buffer.from("!\xFF\vDOOMTECH1.1", "ascii"); - var magic2 = import_buffer5.Buffer.from("!\xFF\vVOOMTECH1.1", "ascii"); - var magic3 = import_buffer5.Buffer.from("!\xFF\vANIMEXTS1.0", "ascii"); - var read_section = (gif, pos) => { - const begin = pos; - pos += 3 + gif[pos + 2]; - let buf2 = import_buffer5.Buffer.alloc(0); - while (pos < gif.byteLength) { - const v = gif[pos++]; - buf2 = import_buffer5.Buffer.concat([buf2, gif.slice(pos, pos + v)]); - if (v == 0) - break; - pos += v; - } - const appname = gif.slice(begin + 3, begin + 11).toString("ascii"); - return { - appname, - data: buf2, - end: pos - }; - }; - var password3 = import_buffer5.Buffer.from("NOA"); - var xor3 = (a, p) => { - let n = 0; - for (let i = 0; i < a.byteLength; ++i) { - a[i] ^= p[n]; - n++; - n %= p.byteLength; - } - }; - var extractBuff = (gif) => { - const field = gif.readUInt8(10); - const gcte = !!(field & 1 << 7); - let end = 13; - if (gcte) { - end += 3 * (1 << (field & 7) + 1); - } - while (gif[end] == "!".charCodeAt(0)) { - let sec = read_section(gif, end); - if (sec.appname == "DOOMTECH") { - const ret = import_buffer5.Buffer.alloc(sec.data.readInt32LE(0)); - let ptr = 0; - do { - sec = read_section(gif, sec.end); - sec.data.copy(ret, ptr); - ptr += sec.data.byteLength; - end = sec.end; - } while (sec.appname == "DOOMTECH" && gif[end] == "!".charCodeAt(0)); - return decodeCoom3Payload(ret); - } - const cond = () => sec.appname == "VOOMTECH" || sec.appname == "ANIMEXTS"; - if (cond()) { - const ret = import_buffer5.Buffer.alloc(sec.data.readInt32LE(0)); - let ptr = 0; - do { - sec = read_section(gif, sec.end); - sec.data.copy(ret, ptr); - ptr += sec.data.byteLength; - end = sec.end; - } while (cond() && gif[end] == "!".charCodeAt(0)); - xor3(ret, password3); - return decodeCoom3Payload(ret); - } - end = sec.end; - } - throw new Error("Shouldn't happen"); - }; - var extract3 = extractBuff; - var write_data = async (writer, inj) => { - await writer.write(magic3); - const byte = import_buffer5.Buffer.from([0]); - let size = inj.byteLength; - let ws; - let offset = 0; - while (size != 0) { - ws = size >= 255 ? 255 : size; - byte.writeUInt8(ws, 0); - await writer.write(byte); - await writer.write(inj.slice(offset, offset + ws)); - size -= ws; - offset += ws; - } - byte.writeUInt8(0, 0); - await writer.write(byte); - }; - var write_embedding = async (writer, inj) => { - const b = import_buffer5.Buffer.alloc(4); - b.writeInt32LE(inj.byteLength, 0); - await write_data(writer, b); - let size = inj.byteLength; - let offset = 0; - while (size != 0) { - const ws = size >= 3 << 13 ? 3 << 13 : size; - await write_data(writer, inj.slice(offset, offset + ws)); - offset += ws; - size -= ws; - } - }; - var inject3 = async (container, links) => { - const [writestream, extract7] = BufferWriteStream(); - const writer = writestream.getWriter(); - const inj = import_buffer5.Buffer.from(links.join(" ")); - xor3(inj, password3); - const contbuff = import_buffer5.Buffer.from(await container.arrayBuffer()); - const field = contbuff.readUInt8(10); - const gcte = !!(field & 1 << 7); - let endo = 13; - if (gcte) - endo += 3 * (1 << (field & 7) + 1); - if (netscape.compare(contbuff, endo, endo + netscape.byteLength) == 0) - endo += 19; - await writer.write(contbuff.slice(0, endo)); - await write_embedding(writer, import_buffer5.Buffer.from(inj)); - await writer.write(contbuff.slice(endo)); - return extract7(); - }; - var has_embed3 = (gif) => { - const field = gif.readUInt8(10); - const gcte = !!(field & 1 << 7); - let end = 13; - if (gcte) { - end += 3 * (1 << (field & 7) + 1); - } - while (end < gif.byteLength && gif.readUInt8(end) == "!".charCodeAt(0)) { - if ([magic, magic2, magic3].every((m) => m.compare(gif, end, end + m.byteLength) != 0)) { - end += 3 + gif.readUInt8(end + 2); - while (true) { - const v = gif.readUInt8(end++); - if (!v) - break; - end += v; - } - } else { - return true; - } - } - if (end >= gif.byteLength) - return; - return false; - }; - var gif_default = { - extract: extract3, - has_embed: has_embed3, - inject: inject3, - match: (fn) => !!fn.match(/\.gif$/) - }; - // src/jpg.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer6 = __toESM(require_buffer(), 1); + var import_buffer4 = __toESM(require_buffer(), 1); // src/f5stego.ts init_define_BUILD_VERSION(); @@ -23851,23 +13609,23 @@ }; // src/jpg.ts - var key = import_buffer6.Buffer.from("CUNNYCUNNYCUNNY"); + var key = import_buffer4.Buffer.from("CUNNYCUNNYCUNNY"); var f5inst = new f5stego(key); - var inject4 = async (b, links) => { + var inject2 = async (b, links) => { if (b.size / 20 < links.join(" ").length) throw "Image too small to embed."; const arr = new Uint8Array(new Uint8Array(await b.arrayBuffer())); const buff = f5inst.embed(arr, new TextEncoder().encode(links.join(" ")), 1); - return import_buffer6.Buffer.from(buff); + return import_buffer4.Buffer.from(buff); }; - var has_embed4 = (b) => { + var has_embed2 = (b) => { try { const res = f5inst.extract(b); if (!res) return false; if (res.length > 1024) return false; - const str = import_buffer6.Buffer.from(res).toString(); + const str = import_buffer4.Buffer.from(res).toString(); if (!str.match(/^[a-zA-Z0-9:/.\-_ ]+$/)) return false; return str; @@ -23875,20 +13633,20 @@ return false; } }; - var extract4 = (b, ex) => { - return decodeCoom3Payload(import_buffer6.Buffer.from(ex)); + var extract2 = (b, ex) => { + return decodeCoom3Payload(import_buffer4.Buffer.from(ex)); }; var jpg_default = { match: (fn) => !!fn.match(/\.jpe?g$/), - has_embed: has_embed4, - extract: extract4, - inject: inject4 + has_embed: has_embed2, + extract: extract2, + inject: inject2 }; // src/thirdeye.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer7 = __toESM(require_buffer(), 1); + var import_buffer5 = __toESM(require_buffer(), 1); var import_jpeg_js = __toESM(require_jpeg_js(), 1); // src/phash.ts @@ -24004,7 +13762,7 @@ return []; } }; - var extract5 = async (b, fn) => { + var extract3 = async (b, fn) => { if (!csettings3) throw new Error("Settings uninit"); let result; @@ -24028,12 +13786,8 @@ url: result[0].page }, filename: fn.substring(0, 33) + result[0].ext, - thumbnail: csettings3.hotlink ? prev || full : import_buffer7.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings3.hotlink ? full || prev : async (lsn) => { - if (!cachedFile) - cachedFile = await (await ifetch(full || prev, void 0, lsn)).arrayBuffer(); - return import_buffer7.Buffer.from(cachedFile); - } + thumbnail: csettings3.hotlink ? prev || full : import_buffer5.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), + data: csettings3.hotlink ? full || prev : { url: full || prev } }]; }; var phash = (b) => { @@ -24049,8 +13803,8 @@ } return acc; }; - var has_embed5 = async (b, fn, prevlink) => { - if (import_buffer7.Buffer.from(fn, "hex").equals(b)) + var has_embed3 = async (b, fn, prevlink) => { + if (import_buffer5.Buffer.from(fn, "hex").equals(b)) return false; let result = void 0; for (const e of Object.values(boorus)) { @@ -24067,7 +13821,7 @@ const getHash = async (l) => { const ogreq = await ifetch(l); const origPreview = await ogreq.arrayBuffer(); - return phash(import_buffer7.Buffer.from(origPreview)); + return phash(import_buffer5.Buffer.from(origPreview)); }; const [orighash, tehash] = await Promise.all([ getHash(prevlink), @@ -24081,15 +13835,15 @@ }; var thirdeye_default = { skip: true, - extract: extract5, - has_embed: has_embed5, + extract: extract3, + has_embed: has_embed3, match: (fn) => !!fn.match(/^[0-9a-f]{32}\.....?/) }; // src/pomf.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer8 = __toESM(require_buffer(), 1); + var import_buffer6 = __toESM(require_buffer(), 1); var sources = [ { host: "Catbox", prefix: "files.catbox.moe/" }, { host: "Litter", prefix: "litter.catbox.moe/" }, @@ -24122,7 +13876,7 @@ } return { ext, source }; }; - var extract6 = async (b, fn) => { + var extract4 = async (b, fn) => { if (!csettings4) throw new Error("Settings uninit"); const { ext, source } = getExt(fn); @@ -24139,16 +13893,11 @@ } return [{ filename: ext, - data: csettings4.hotlink ? rsource : async (lsn) => { - try { - return import_buffer8.Buffer.from(await (await ifetch(rsource, void 0, lsn)).arrayBuffer()); - } catch (e) { - } - }, - thumbnail: import_buffer8.Buffer.from(hasembed_default) + data: csettings4.hotlink ? rsource : { url: rsource }, + thumbnail: import_buffer6.Buffer.from(hasembed_default) }]; }; - var has_embed6 = async (b, fn) => { + var has_embed4 = async (b, fn) => { const { ext, source } = getExt(fn); if (!ext) return false; @@ -24165,8 +13914,8 @@ }; var pomf_default = { skip: true, - extract: extract6, - has_embed: has_embed6, + extract: extract4, + has_embed: has_embed4, match: (fn) => !!getExt(fn) }; @@ -24886,7 +14635,7 @@ // src/Components/Embedding.svelte init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer9 = __toESM(require_buffer(), 1); + var import_buffer7 = __toESM(require_buffer(), 1); function add_css6(target) { append_styles(target, "svelte-olzxr6", ".plaace.svelte-olzxr6.svelte-olzxr6{cursor:pointer;max-width:100vw;max-height:100vh}.unzipping.svelte-olzxr6>img.svelte-olzxr6{filter:brightness(0.5) blur(10px)}.progress.svelte-olzxr6.svelte-olzxr6{color:black;-webkit-text-stroke:0.7px white;font-weight:bold;left:50%;top:50%;font-size:larger;display:inline-block;position:absolute;z-index:10}.hoverer.svelte-olzxr6.svelte-olzxr6{display:none;position:fixed;pointer-events:none}.visible.svelte-olzxr6.svelte-olzxr6{display:block;z-index:9}.contract.svelte-olzxr6 img.svelte-olzxr6,.contract.svelte-olzxr6 video.svelte-olzxr6{max-width:125px !important;max-height:125px !important;width:auto;height:auto}.plaace.svelte-olzxr6:not(.contract) video.svelte-olzxr6,.plaace.svelte-olzxr6:not(.contract) img.svelte-olzxr6,.hoverer.svelte-olzxr6>video.svelte-olzxr6,.hoverer.svelte-olzxr6>img.svelte-olzxr6{max-width:100vw;max-height:100vh}"); } @@ -25424,7 +15173,7 @@ const thumb = file.thumbnail || file.data; let type; if (typeof thumb != "string") { - let buff = import_buffer9.Buffer.isBuffer(thumb) ? thumb : await thumb(); + let buff = thumb instanceof Uint8Array ? thumb : await thumb(); type = await fileTypeFromBuffer(buff); if (!type && file.filename.endsWith(".txt") && file.filename.startsWith("message")) { type = { ext: "txt", mime: "text/plain" }; @@ -25488,7 +15237,7 @@ lisn.addEventListener("progress", (e) => { $$invalidate(18, progress = e.detail); }); - let full = import_buffer9.Buffer.isBuffer(file.data) ? file.data : await file.data(lisn); + let full = file.data instanceof Uint8Array ? file.data : await file.data(lisn); type = await fileTypeFromBuffer(full); if (!type && file.filename.endsWith(".txt") && file.filename.startsWith("message")) { type = { ext: "txt", mime: "text/plain" }; @@ -29958,7 +19707,7 @@ // src/Components/EyeButton.svelte init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer10 = __toESM(require_buffer(), 1); + var import_buffer8 = __toESM(require_buffer(), 1); function add_css12(target) { append_styles(target, "svelte-64lw6s", ".clickable.svelte-64lw6s{cursor:pointer;margin-left:5px}.clickable.svelte-64lw6s:hover{text-shadow:0 0 4px palevioletred}"); } @@ -30306,7 +20055,7 @@ a.style.display = "none"; let url; if (typeof file.data != "string") { - const thumb = import_buffer10.Buffer.isBuffer(file.data) ? file.data : await file.data(); + const thumb = file.data instanceof Uint8Array ? file.data : await file.data(); const type = await fileTypeFromBuffer(thumb); url = URL.createObjectURL(new Blob([thumb], { type: type?.mime })); } else @@ -30560,11 +20309,7 @@ catalogControlHost: () => document.getElementById("index-options"), getImageLink: async function* (post) { if (location.host == "arch.b4k.co") { - const pid = post.id.match(/\d+/)[0]; - const board = location.pathname.match(/\/(..?.?)\//)[1]; - const res = await ifetch(`https://archive.wakarimasen.moe/_/api/chan/post/?board=${board}&num=${pid}`); - const data = await res.json(); - yield data.media.media_link; + return; } yield post.querySelector("a[rel]")?.getAttribute("href") || ""; }, @@ -31793,12 +21538,33 @@ }; var ViewCount_default = ViewCount; + // src/processor.worker.ts + init_define_BUILD_VERSION(); + init_esbuild_inject(); + + // inline-worker:__inline-worker + init_define_BUILD_VERSION(); + init_esbuild_inject(); + function inlineWorker(scriptText) { + let blob = new Blob([scriptText], { type: "text/javascript" }); + let url = URL.createObjectURL(blob); + let worker = new Worker(url); + URL.revokeObjectURL(url); + return worker; + } + + // src/processor.worker.ts + function Worker2() { + return inlineWorker('var __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n};\nvar __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key2 of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key2) && key2 !== except)\n __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));\nvar __decorateClass = (decorators, target, key2, kind) => {\n var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;\n for (var i = decorators.length - 1, decorator; i >= 0; i--)\n if (decorator = decorators[i])\n result = (kind ? decorator(target, key2, result) : decorator(result)) || result;\n if (kind && result)\n __defProp(target, key2, result);\n return result;\n};\nvar __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError("Cannot " + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, "read from private field");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError("Cannot add the same private member more than once");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, "write to private field");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, "access private method");\n return method;\n};\nvar __toBinary = /* @__PURE__ */ (() => {\n var table = new Uint8Array(128);\n for (var i = 0; i < 64; i++)\n table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;\n return (base64) => {\n var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0);\n for (var i2 = 0, j = 0; i2 < n; ) {\n var c0 = table[base64.charCodeAt(i2++)], c1 = table[base64.charCodeAt(i2++)];\n var c2 = table[base64.charCodeAt(i2++)], c3 = table[base64.charCodeAt(i2++)];\n bytes[j++] = c0 << 2 | c1 >> 4;\n bytes[j++] = c1 << 4 | c2 >> 2;\n bytes[j++] = c2 << 6 | c3;\n }\n return bytes;\n };\n})();\n\n// \nvar init_define_BUILD_VERSION = __esm({\n ""() {\n }\n});\n\n// node_modules/base64-js/index.js\nvar require_base64_js = __commonJS({\n "node_modules/base64-js/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports.byteLength = byteLength;\n exports.toByteArray = toByteArray;\n exports.fromByteArray = fromByteArray;\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;\n var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n for (i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n var i;\n var len;\n revLookup["-".charCodeAt(0)] = 62;\n revLookup["_".charCodeAt(0)] = 63;\n function getLens(b64) {\n var len2 = b64.length;\n if (len2 % 4 > 0) {\n throw new Error("Invalid string. Length must be a multiple of 4");\n }\n var validLen = b64.indexOf("=");\n if (validLen === -1)\n validLen = len2;\n var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n }\n function byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function _byteLength(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i2;\n for (i2 = 0; i2 < len2; i2 += 4) {\n tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];\n arr[curByte++] = tmp >> 16 & 255;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 2) {\n tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n }\n function tripletToBase64(num) {\n return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\n }\n function encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i2 = start; i2 < end; i2 += 3) {\n tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);\n output.push(tripletToBase64(tmp));\n }\n return output.join("");\n }\n function fromByteArray(uint8) {\n var tmp;\n var len2 = uint8.length;\n var extraBytes = len2 % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {\n parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));\n }\n if (extraBytes === 1) {\n tmp = uint8[len2 - 1];\n parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");\n } else if (extraBytes === 2) {\n tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];\n parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");\n }\n return parts.join("");\n }\n }\n});\n\n// node_modules/ieee754/index.js\nvar require_ieee754 = __commonJS({\n "node_modules/ieee754/index.js"(exports) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports.read = function(buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? nBytes - 1 : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n i += d;\n e = s & (1 << -nBits) - 1;\n s >>= -nBits;\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {\n }\n m = e & (1 << -nBits) - 1;\n e >>= -nBits;\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {\n }\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : (s ? -1 : 1) * Infinity;\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n };\n exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;\n var i = isLE ? 0 : nBytes - 1;\n var d = isLE ? 1 : -1;\n var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n value = Math.abs(value);\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {\n }\n buffer[offset + i - d] |= s * 128;\n };\n }\n});\n\n// node_modules/buffer/index.js\nvar require_buffer = __commonJS({\n "node_modules/buffer/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var base64 = require_base64_js();\n var ieee7542 = require_ieee754();\n var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;\n exports.Buffer = Buffer13;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n var K_MAX_LENGTH = 2147483647;\n exports.kMaxLength = K_MAX_LENGTH;\n Buffer13.TYPED_ARRAY_SUPPORT = typedArraySupport();\n if (!Buffer13.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {\n console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");\n }\n function typedArraySupport() {\n try {\n const arr = new Uint8Array(1);\n const proto = { foo: function() {\n return 42;\n } };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42;\n } catch (e) {\n return false;\n }\n }\n Object.defineProperty(Buffer13.prototype, "parent", {\n enumerable: true,\n get: function() {\n if (!Buffer13.isBuffer(this))\n return void 0;\n return this.buffer;\n }\n });\n Object.defineProperty(Buffer13.prototype, "offset", {\n enumerable: true,\n get: function() {\n if (!Buffer13.isBuffer(this))\n return void 0;\n return this.byteOffset;\n }\n });\n function createBuffer(length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError(\'The value "\' + length + \'" is invalid for option "size"\');\n }\n const buf2 = new Uint8Array(length);\n Object.setPrototypeOf(buf2, Buffer13.prototype);\n return buf2;\n }\n function Buffer13(arg, encodingOrOffset, length) {\n if (typeof arg === "number") {\n if (typeof encodingOrOffset === "string") {\n throw new TypeError(\'The "string" argument must be of type string. Received type number\');\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }\n Buffer13.poolSize = 8192;\n function from(value, encodingOrOffset, length) {\n if (typeof value === "string") {\n return fromString(value, encodingOrOffset);\n }\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value);\n }\n if (value == null) {\n throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);\n }\n if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof value === "number") {\n throw new TypeError(\'The "value" argument must not be of type number. Received type number\');\n }\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer13.from(valueOf, encodingOrOffset, length);\n }\n const b = fromObject(value);\n if (b)\n return b;\n if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {\n return Buffer13.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);\n }\n throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);\n }\n Buffer13.from = function(value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length);\n };\n Object.setPrototypeOf(Buffer13.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer13, Uint8Array);\n function assertSize(size) {\n if (typeof size !== "number") {\n throw new TypeError(\'"size" argument must be of type number\');\n } else if (size < 0) {\n throw new RangeError(\'The value "\' + size + \'" is invalid for option "size"\');\n }\n }\n function alloc(size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size);\n }\n if (fill !== void 0) {\n return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);\n }\n return createBuffer(size);\n }\n Buffer13.alloc = function(size, fill, encoding) {\n return alloc(size, fill, encoding);\n };\n function allocUnsafe(size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0);\n }\n Buffer13.allocUnsafe = function(size) {\n return allocUnsafe(size);\n };\n Buffer13.allocUnsafeSlow = function(size) {\n return allocUnsafe(size);\n };\n function fromString(string, encoding) {\n if (typeof encoding !== "string" || encoding === "") {\n encoding = "utf8";\n }\n if (!Buffer13.isEncoding(encoding)) {\n throw new TypeError("Unknown encoding: " + encoding);\n }\n const length = byteLength(string, encoding) | 0;\n let buf2 = createBuffer(length);\n const actual = buf2.write(string, encoding);\n if (actual !== length) {\n buf2 = buf2.slice(0, actual);\n }\n return buf2;\n }\n function fromArrayLike(array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0;\n const buf2 = createBuffer(length);\n for (let i = 0; i < length; i += 1) {\n buf2[i] = array[i] & 255;\n }\n return buf2;\n }\n function fromArrayView(arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);\n }\n return fromArrayLike(arrayView);\n }\n function fromArrayBuffer(array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError(\'"offset" is outside of buffer bounds\');\n }\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError(\'"length" is outside of buffer bounds\');\n }\n let buf2;\n if (byteOffset === void 0 && length === void 0) {\n buf2 = new Uint8Array(array);\n } else if (length === void 0) {\n buf2 = new Uint8Array(array, byteOffset);\n } else {\n buf2 = new Uint8Array(array, byteOffset, length);\n }\n Object.setPrototypeOf(buf2, Buffer13.prototype);\n return buf2;\n }\n function fromObject(obj) {\n if (Buffer13.isBuffer(obj)) {\n const len = checked(obj.length) | 0;\n const buf2 = createBuffer(len);\n if (buf2.length === 0) {\n return buf2;\n }\n obj.copy(buf2, 0, 0, len);\n return buf2;\n }\n if (obj.length !== void 0) {\n if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {\n return createBuffer(0);\n }\n return fromArrayLike(obj);\n }\n if (obj.type === "Buffer" && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n }\n function checked(length) {\n if (length >= K_MAX_LENGTH) {\n throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");\n }\n return length | 0;\n }\n function SlowBuffer(length) {\n if (+length != length) {\n length = 0;\n }\n return Buffer13.alloc(+length);\n }\n Buffer13.isBuffer = function isBuffer(b) {\n return b != null && b._isBuffer === true && b !== Buffer13.prototype;\n };\n Buffer13.compare = function compare(a, b) {\n if (isInstance(a, Uint8Array))\n a = Buffer13.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array))\n b = Buffer13.from(b, b.offset, b.byteLength);\n if (!Buffer13.isBuffer(a) || !Buffer13.isBuffer(b)) {\n throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');\n }\n if (a === b)\n return 0;\n let x = a.length;\n let y = b.length;\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n if (x < y)\n return -1;\n if (y < x)\n return 1;\n return 0;\n };\n Buffer13.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case "hex":\n case "utf8":\n case "utf-8":\n case "ascii":\n case "latin1":\n case "binary":\n case "base64":\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return true;\n default:\n return false;\n }\n };\n Buffer13.concat = function concat(list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\');\n }\n if (list.length === 0) {\n return Buffer13.alloc(0);\n }\n let i;\n if (length === void 0) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n const buffer = Buffer13.allocUnsafe(length);\n let pos = 0;\n for (i = 0; i < list.length; ++i) {\n let buf2 = list[i];\n if (isInstance(buf2, Uint8Array)) {\n if (pos + buf2.length > buffer.length) {\n if (!Buffer13.isBuffer(buf2))\n buf2 = Buffer13.from(buf2);\n buf2.copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(buffer, buf2, pos);\n }\n } else if (!Buffer13.isBuffer(buf2)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\');\n } else {\n buf2.copy(buffer, pos);\n }\n pos += buf2.length;\n }\n return buffer;\n };\n function byteLength(string, encoding) {\n if (Buffer13.isBuffer(string)) {\n return string.length;\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength;\n }\n if (typeof string !== "string") {\n throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \' + typeof string);\n }\n const len = string.length;\n const mustMatch = arguments.length > 2 && arguments[2] === true;\n if (!mustMatch && len === 0)\n return 0;\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case "ascii":\n case "latin1":\n case "binary":\n return len;\n case "utf8":\n case "utf-8":\n return utf8ToBytes(string).length;\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return len * 2;\n case "hex":\n return len >>> 1;\n case "base64":\n return base64ToBytes(string).length;\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length;\n }\n encoding = ("" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer13.byteLength = byteLength;\n function slowToString(encoding, start, end) {\n let loweredCase = false;\n if (start === void 0 || start < 0) {\n start = 0;\n }\n if (start > this.length) {\n return "";\n }\n if (end === void 0 || end > this.length) {\n end = this.length;\n }\n if (end <= 0) {\n return "";\n }\n end >>>= 0;\n start >>>= 0;\n if (end <= start) {\n return "";\n }\n if (!encoding)\n encoding = "utf8";\n while (true) {\n switch (encoding) {\n case "hex":\n return hexSlice(this, start, end);\n case "utf8":\n case "utf-8":\n return utf8Slice(this, start, end);\n case "ascii":\n return asciiSlice(this, start, end);\n case "latin1":\n case "binary":\n return latin1Slice(this, start, end);\n case "base64":\n return base64Slice(this, start, end);\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return utf16leSlice(this, start, end);\n default:\n if (loweredCase)\n throw new TypeError("Unknown encoding: " + encoding);\n encoding = (encoding + "").toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer13.prototype._isBuffer = true;\n function swap(b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n Buffer13.prototype.swap16 = function swap16() {\n const len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 16-bits");\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this;\n };\n Buffer13.prototype.swap32 = function swap32() {\n const len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 32-bits");\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n };\n Buffer13.prototype.swap64 = function swap64() {\n const len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 64-bits");\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n };\n Buffer13.prototype.toString = function toString() {\n const length = this.length;\n if (length === 0)\n return "";\n if (arguments.length === 0)\n return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n };\n Buffer13.prototype.toLocaleString = Buffer13.prototype.toString;\n Buffer13.prototype.equals = function equals(b) {\n if (!Buffer13.isBuffer(b))\n throw new TypeError("Argument must be a Buffer");\n if (this === b)\n return true;\n return Buffer13.compare(this, b) === 0;\n };\n Buffer13.prototype.inspect = function inspect() {\n let str = "";\n const max = exports.INSPECT_MAX_BYTES;\n str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();\n if (this.length > max)\n str += " ... ";\n return "";\n };\n if (customInspectSymbol) {\n Buffer13.prototype[customInspectSymbol] = Buffer13.prototype.inspect;\n }\n Buffer13.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer13.from(target, target.offset, target.byteLength);\n }\n if (!Buffer13.isBuffer(target)) {\n throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \' + typeof target);\n }\n if (start === void 0) {\n start = 0;\n }\n if (end === void 0) {\n end = target ? target.length : 0;\n }\n if (thisStart === void 0) {\n thisStart = 0;\n }\n if (thisEnd === void 0) {\n thisEnd = this.length;\n }\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError("out of range index");\n }\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n if (thisStart >= thisEnd) {\n return -1;\n }\n if (start >= end) {\n return 1;\n }\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target)\n return 0;\n let x = thisEnd - thisStart;\n let y = end - start;\n const len = Math.min(x, y);\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n if (x < y)\n return -1;\n if (y < x)\n return 1;\n return 0;\n };\n function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n if (buffer.length === 0)\n return -1;\n if (typeof byteOffset === "string") {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 2147483647) {\n byteOffset = 2147483647;\n } else if (byteOffset < -2147483648) {\n byteOffset = -2147483648;\n }\n byteOffset = +byteOffset;\n if (numberIsNaN(byteOffset)) {\n byteOffset = dir ? 0 : buffer.length - 1;\n }\n if (byteOffset < 0)\n byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir)\n return -1;\n else\n byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir)\n byteOffset = 0;\n else\n return -1;\n }\n if (typeof val === "string") {\n val = Buffer13.from(val, encoding);\n }\n if (Buffer13.isBuffer(val)) {\n if (val.length === 0) {\n return -1;\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === "number") {\n val = val & 255;\n if (typeof Uint8Array.prototype.indexOf === "function") {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);\n }\n throw new TypeError("val must be string, number or Buffer");\n }\n function arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n let indexSize = 1;\n let arrLength = arr.length;\n let valLength = val.length;\n if (encoding !== void 0) {\n encoding = String(encoding).toLowerCase();\n if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n function read2(buf2, i2) {\n if (indexSize === 1) {\n return buf2[i2];\n } else {\n return buf2.readUInt16BE(i2 * indexSize);\n }\n }\n let i;\n if (dir) {\n let foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1)\n foundIndex = i;\n if (i - foundIndex + 1 === valLength)\n return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1)\n i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength)\n byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read2(arr, i + j) !== read2(val, j)) {\n found = false;\n break;\n }\n }\n if (found)\n return i;\n }\n }\n return -1;\n }\n Buffer13.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n };\n Buffer13.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n };\n Buffer13.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n };\n function hexWrite(buf2, string, offset, length) {\n offset = Number(offset) || 0;\n const remaining = buf2.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n const strLen = string.length;\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n let i;\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed))\n return i;\n buf2[offset + i] = parsed;\n }\n return i;\n }\n function utf8Write(buf2, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf2.length - offset), buf2, offset, length);\n }\n function asciiWrite(buf2, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf2, offset, length);\n }\n function base64Write(buf2, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf2, offset, length);\n }\n function ucs2Write(buf2, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length);\n }\n Buffer13.prototype.write = function write2(string, offset, length, encoding) {\n if (offset === void 0) {\n encoding = "utf8";\n length = this.length;\n offset = 0;\n } else if (length === void 0 && typeof offset === "string") {\n encoding = offset;\n length = this.length;\n offset = 0;\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === void 0)\n encoding = "utf8";\n } else {\n encoding = length;\n length = void 0;\n }\n } else {\n throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");\n }\n const remaining = this.length - offset;\n if (length === void 0 || length > remaining)\n length = remaining;\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError("Attempt to write outside buffer bounds");\n }\n if (!encoding)\n encoding = "utf8";\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case "hex":\n return hexWrite(this, string, offset, length);\n case "utf8":\n case "utf-8":\n return utf8Write(this, string, offset, length);\n case "ascii":\n case "latin1":\n case "binary":\n return asciiWrite(this, string, offset, length);\n case "base64":\n return base64Write(this, string, offset, length);\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return ucs2Write(this, string, offset, length);\n default:\n if (loweredCase)\n throw new TypeError("Unknown encoding: " + encoding);\n encoding = ("" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n Buffer13.prototype.toJSON = function toJSON() {\n return {\n type: "Buffer",\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n };\n function base64Slice(buf2, start, end) {\n if (start === 0 && end === buf2.length) {\n return base64.fromByteArray(buf2);\n } else {\n return base64.fromByteArray(buf2.slice(start, end));\n }\n }\n function utf8Slice(buf2, start, end) {\n end = Math.min(buf2.length, end);\n const res = [];\n let i = start;\n while (i < end) {\n const firstByte = buf2[i];\n let codePoint = null;\n let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint;\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 128) {\n codePoint = firstByte;\n }\n break;\n case 2:\n secondByte = buf2[i + 1];\n if ((secondByte & 192) === 128) {\n tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;\n if (tempCodePoint > 127) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 3:\n secondByte = buf2[i + 1];\n thirdByte = buf2[i + 2];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;\n if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 4:\n secondByte = buf2[i + 1];\n thirdByte = buf2[i + 2];\n fourthByte = buf2[i + 3];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;\n if (tempCodePoint > 65535 && tempCodePoint < 1114112) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n if (codePoint === null) {\n codePoint = 65533;\n bytesPerSequence = 1;\n } else if (codePoint > 65535) {\n codePoint -= 65536;\n res.push(codePoint >>> 10 & 1023 | 55296);\n codePoint = 56320 | codePoint & 1023;\n }\n res.push(codePoint);\n i += bytesPerSequence;\n }\n return decodeCodePointsArray(res);\n }\n var MAX_ARGUMENTS_LENGTH = 4096;\n function decodeCodePointsArray(codePoints) {\n const len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints);\n }\n let res = "";\n let i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));\n }\n return res;\n }\n function asciiSlice(buf2, start, end) {\n let ret = "";\n end = Math.min(buf2.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf2[i] & 127);\n }\n return ret;\n }\n function latin1Slice(buf2, start, end) {\n let ret = "";\n end = Math.min(buf2.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf2[i]);\n }\n return ret;\n }\n function hexSlice(buf2, start, end) {\n const len = buf2.length;\n if (!start || start < 0)\n start = 0;\n if (!end || end < 0 || end > len)\n end = len;\n let out = "";\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf2[i]];\n }\n return out;\n }\n function utf16leSlice(buf2, start, end) {\n const bytes = buf2.slice(start, end);\n let res = "";\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n return res;\n }\n Buffer13.prototype.slice = function slice(start, end) {\n const len = this.length;\n start = ~~start;\n end = end === void 0 ? len : ~~end;\n if (start < 0) {\n start += len;\n if (start < 0)\n start = 0;\n } else if (start > len) {\n start = len;\n }\n if (end < 0) {\n end += len;\n if (end < 0)\n end = 0;\n } else if (end > len) {\n end = len;\n }\n if (end < start)\n end = start;\n const newBuf = this.subarray(start, end);\n Object.setPrototypeOf(newBuf, Buffer13.prototype);\n return newBuf;\n };\n function checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0)\n throw new RangeError("offset is not uint");\n if (offset + ext > length)\n throw new RangeError("Trying to access beyond buffer length");\n }\n Buffer13.prototype.readUintLE = Buffer13.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n return val;\n };\n Buffer13.prototype.readUintBE = Buffer13.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength2, this.length);\n }\n let val = this[offset + --byteLength2];\n let mul = 1;\n while (byteLength2 > 0 && (mul *= 256)) {\n val += this[offset + --byteLength2] * mul;\n }\n return val;\n };\n Buffer13.prototype.readUint8 = Buffer13.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 1, this.length);\n return this[offset];\n };\n Buffer13.prototype.readUint16LE = Buffer13.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n };\n Buffer13.prototype.readUint16BE = Buffer13.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n };\n Buffer13.prototype.readUint32LE = Buffer13.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;\n };\n Buffer13.prototype.readUint32BE = Buffer13.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n };\n Buffer13.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;\n const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;\n return BigInt(lo) + (BigInt(hi) << BigInt(32));\n });\n Buffer13.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;\n return (BigInt(hi) << BigInt(32)) + BigInt(lo);\n });\n Buffer13.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n mul *= 128;\n if (val >= mul)\n val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer13.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let i = byteLength2;\n let mul = 1;\n let val = this[offset + --i];\n while (i > 0 && (mul *= 256)) {\n val += this[offset + --i] * mul;\n }\n mul *= 128;\n if (val >= mul)\n val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer13.prototype.readInt8 = function readInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 1, this.length);\n if (!(this[offset] & 128))\n return this[offset];\n return (255 - this[offset] + 1) * -1;\n };\n Buffer13.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n const val = this[offset] | this[offset + 1] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer13.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n const val = this[offset + 1] | this[offset] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer13.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\n };\n Buffer13.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n };\n Buffer13.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);\n return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);\n });\n Buffer13.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);\n });\n Buffer13.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return ieee7542.read(this, offset, true, 23, 4);\n };\n Buffer13.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return ieee7542.read(this, offset, false, 23, 4);\n };\n Buffer13.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 8, this.length);\n return ieee7542.read(this, offset, true, 52, 8);\n };\n Buffer13.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 8, this.length);\n return ieee7542.read(this, offset, false, 52, 8);\n };\n function checkInt(buf2, value, offset, ext, max, min) {\n if (!Buffer13.isBuffer(buf2))\n throw new TypeError(\'"buffer" argument must be a Buffer instance\');\n if (value > max || value < min)\n throw new RangeError(\'"value" argument is out of bounds\');\n if (offset + ext > buf2.length)\n throw new RangeError("Index out of range");\n }\n Buffer13.prototype.writeUintLE = Buffer13.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let mul = 1;\n let i = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeUintBE = Buffer13.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeUint8 = Buffer13.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 1, 255, 0);\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer13.prototype.writeUint16LE = Buffer13.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer13.prototype.writeUint16BE = Buffer13.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer13.prototype.writeUint32LE = Buffer13.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset + 3] = value >>> 24;\n this[offset + 2] = value >>> 16;\n this[offset + 1] = value >>> 8;\n this[offset] = value & 255;\n return offset + 4;\n };\n Buffer13.prototype.writeUint32BE = Buffer13.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n function wrtBigUInt64LE(buf2, value, offset, min, max) {\n checkIntBI(value, min, max, buf2, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n return offset;\n }\n function wrtBigUInt64BE(buf2, value, offset, min, max) {\n checkIntBI(value, min, max, buf2, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf2[offset + 7] = lo;\n lo = lo >> 8;\n buf2[offset + 6] = lo;\n lo = lo >> 8;\n buf2[offset + 5] = lo;\n lo = lo >> 8;\n buf2[offset + 4] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf2[offset + 3] = hi;\n hi = hi >> 8;\n buf2[offset + 2] = hi;\n hi = hi >> 8;\n buf2[offset + 1] = hi;\n hi = hi >> 8;\n buf2[offset] = hi;\n return offset + 8;\n }\n Buffer13.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));\n });\n Buffer13.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));\n });\n Buffer13.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = 0;\n let mul = 1;\n let sub = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n let sub = 0;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 1, 127, -128);\n if (value < 0)\n value = 255 + value + 1;\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer13.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer13.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer13.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 2147483647, -2147483648);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n this[offset + 2] = value >>> 16;\n this[offset + 3] = value >>> 24;\n return offset + 4;\n };\n Buffer13.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 2147483647, -2147483648);\n if (value < 0)\n value = 4294967295 + value + 1;\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n Buffer13.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));\n });\n Buffer13.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));\n });\n function checkIEEE754(buf2, value, offset, ext, max, min) {\n if (offset + ext > buf2.length)\n throw new RangeError("Index out of range");\n if (offset < 0)\n throw new RangeError("Index out of range");\n }\n function writeFloat(buf2, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22);\n }\n ieee7542.write(buf2, value, offset, littleEndian, 23, 4);\n return offset + 4;\n }\n Buffer13.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert);\n };\n Buffer13.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert);\n };\n function writeDouble(buf2, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292);\n }\n ieee7542.write(buf2, value, offset, littleEndian, 52, 8);\n return offset + 8;\n }\n Buffer13.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert);\n };\n Buffer13.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert);\n };\n Buffer13.prototype.copy = function copy(target, targetStart, start, end) {\n if (!Buffer13.isBuffer(target))\n throw new TypeError("argument should be a Buffer");\n if (!start)\n start = 0;\n if (!end && end !== 0)\n end = this.length;\n if (targetStart >= target.length)\n targetStart = target.length;\n if (!targetStart)\n targetStart = 0;\n if (end > 0 && end < start)\n end = start;\n if (end === start)\n return 0;\n if (target.length === 0 || this.length === 0)\n return 0;\n if (targetStart < 0) {\n throw new RangeError("targetStart out of bounds");\n }\n if (start < 0 || start >= this.length)\n throw new RangeError("Index out of range");\n if (end < 0)\n throw new RangeError("sourceEnd out of bounds");\n if (end > this.length)\n end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n const len = end - start;\n if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);\n }\n return len;\n };\n Buffer13.prototype.fill = function fill(val, start, end, encoding) {\n if (typeof val === "string") {\n if (typeof start === "string") {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === "string") {\n encoding = end;\n end = this.length;\n }\n if (encoding !== void 0 && typeof encoding !== "string") {\n throw new TypeError("encoding must be a string");\n }\n if (typeof encoding === "string" && !Buffer13.isEncoding(encoding)) {\n throw new TypeError("Unknown encoding: " + encoding);\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0);\n if (encoding === "utf8" && code < 128 || encoding === "latin1") {\n val = code;\n }\n }\n } else if (typeof val === "number") {\n val = val & 255;\n } else if (typeof val === "boolean") {\n val = Number(val);\n }\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError("Out of range index");\n }\n if (end <= start) {\n return this;\n }\n start = start >>> 0;\n end = end === void 0 ? this.length : end >>> 0;\n if (!val)\n val = 0;\n let i;\n if (typeof val === "number") {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n const bytes = Buffer13.isBuffer(val) ? val : Buffer13.from(val, encoding);\n const len = bytes.length;\n if (len === 0) {\n throw new TypeError(\'The value "\' + val + \'" is invalid for argument "value"\');\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n return this;\n };\n var errors = {};\n function E(sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor() {\n super();\n Object.defineProperty(this, "message", {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n });\n this.name = `${this.name} [${sym}]`;\n this.stack;\n delete this.name;\n }\n get code() {\n return sym;\n }\n set code(value) {\n Object.defineProperty(this, "code", {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n toString() {\n return `${this.name} [${sym}]: ${this.message}`;\n }\n };\n }\n E("ERR_BUFFER_OUT_OF_BOUNDS", function(name) {\n if (name) {\n return `${name} is outside of buffer bounds`;\n }\n return "Attempt to access memory outside buffer bounds";\n }, RangeError);\n E("ERR_INVALID_ARG_TYPE", function(name, actual) {\n return `The "${name}" argument must be of type number. Received type ${typeof actual}`;\n }, TypeError);\n E("ERR_OUT_OF_RANGE", function(str, range, input) {\n let msg = `The value of "${str}" is out of range.`;\n let received = input;\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input));\n } else if (typeof input === "bigint") {\n received = String(input);\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received);\n }\n received += "n";\n }\n msg += ` It must be ${range}. Received ${received}`;\n return msg;\n }, RangeError);\n function addNumericalSeparator(val) {\n let res = "";\n let i = val.length;\n const start = val[0] === "-" ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`;\n }\n return `${val.slice(0, i)}${res}`;\n }\n function checkBounds(buf2, offset, byteLength2) {\n validateNumber(offset, "offset");\n if (buf2[offset] === void 0 || buf2[offset + byteLength2] === void 0) {\n boundsError(offset, buf2.length - (byteLength2 + 1));\n }\n }\n function checkIntBI(value, min, max, buf2, offset, byteLength2) {\n if (value > max || value < min) {\n const n = typeof min === "bigint" ? "n" : "";\n let range;\n if (byteLength2 > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;\n } else {\n range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`;\n }\n throw new errors.ERR_OUT_OF_RANGE("value", range, value);\n }\n checkBounds(buf2, offset, byteLength2);\n }\n function validateNumber(value, name) {\n if (typeof value !== "number") {\n throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);\n }\n }\n function boundsError(value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type);\n throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);\n }\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();\n }\n throw new errors.ERR_OUT_OF_RANGE(type || "offset", `>= ${type ? 1 : 0} and <= ${length}`, value);\n }\n var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n function base64clean(str) {\n str = str.split("=")[0];\n str = str.trim().replace(INVALID_BASE64_RE, "");\n if (str.length < 2)\n return "";\n while (str.length % 4 !== 0) {\n str = str + "=";\n }\n return str;\n }\n function utf8ToBytes(string, units) {\n units = units || Infinity;\n let codePoint;\n const length = string.length;\n let leadSurrogate = null;\n const bytes = [];\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n if (codePoint > 55295 && codePoint < 57344) {\n if (!leadSurrogate) {\n if (codePoint > 56319) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n continue;\n } else if (i + 1 === length) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n continue;\n }\n leadSurrogate = codePoint;\n continue;\n }\n if (codePoint < 56320) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n leadSurrogate = codePoint;\n continue;\n }\n codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;\n } else if (leadSurrogate) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n }\n leadSurrogate = null;\n if (codePoint < 128) {\n if ((units -= 1) < 0)\n break;\n bytes.push(codePoint);\n } else if (codePoint < 2048) {\n if ((units -= 2) < 0)\n break;\n bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);\n } else if (codePoint < 65536) {\n if ((units -= 3) < 0)\n break;\n bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else if (codePoint < 1114112) {\n if ((units -= 4) < 0)\n break;\n bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else {\n throw new Error("Invalid code point");\n }\n }\n return bytes;\n }\n function asciiToBytes(str) {\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n byteArray.push(str.charCodeAt(i) & 255);\n }\n return byteArray;\n }\n function utf16leToBytes(str, units) {\n let c, hi, lo;\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0)\n break;\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n return byteArray;\n }\n function base64ToBytes(str) {\n return base64.toByteArray(base64clean(str));\n }\n function blitBuffer(src, dst, offset, length) {\n let i;\n for (i = 0; i < length; ++i) {\n if (i + offset >= dst.length || i >= src.length)\n break;\n dst[i + offset] = src[i];\n }\n return i;\n }\n function isInstance(obj, type) {\n return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;\n }\n function numberIsNaN(obj) {\n return obj !== obj;\n }\n var hexSliceLookupTable = function() {\n const alphabet = "0123456789abcdef";\n const table = new Array(256);\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16;\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table;\n }();\n function defineBigIntMethod(fn) {\n return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;\n }\n function BufferBigIntNotDefined() {\n throw new Error("BigInt not supported");\n }\n }\n});\n\n// esbuild.inject.js\nvar Buffer2;\nvar init_esbuild_inject = __esm({\n "esbuild.inject.js"() {\n "use strict";\n Buffer2 = require_buffer().Buffer;\n }\n});\n\n// node_modules/crc-32/crc32.js\nvar require_crc32 = __commonJS({\n "node_modules/crc-32/crc32.js"(exports) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var CRC32;\n (function(factory) {\n if (typeof DO_NOT_EXPORT_CRC === "undefined") {\n if (typeof exports === "object") {\n factory(exports);\n } else if (typeof define === "function" && define.amd) {\n define(function() {\n var module2 = {};\n factory(module2);\n return module2;\n });\n } else {\n factory(CRC32 = {});\n }\n } else {\n factory(CRC32 = {});\n }\n })(function(CRC322) {\n CRC322.version = "1.2.0";\n function signed_crc_table() {\n var c = 0, table = new Array(256);\n for (var n = 0; n != 256; ++n) {\n c = n;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n table[n] = c;\n }\n return typeof Int32Array !== "undefined" ? new Int32Array(table) : table;\n }\n var T = signed_crc_table();\n function crc32_bstr(bstr, seed) {\n var C = seed ^ -1, L = bstr.length - 1;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];\n }\n if (i === L)\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255];\n return C ^ -1;\n }\n function crc32_buf(buf2, seed) {\n if (buf2.length > 1e4)\n return crc32_buf_8(buf2, seed);\n var C = seed ^ -1, L = buf2.length - 3;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n }\n while (i < L + 3)\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n return C ^ -1;\n }\n function crc32_buf_8(buf2, seed) {\n var C = seed ^ -1, L = buf2.length - 7;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n }\n while (i < L + 7)\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n return C ^ -1;\n }\n function crc32_str(str, seed) {\n var C = seed ^ -1;\n for (var i = 0, L = str.length, c, d; i < L; ) {\n c = str.charCodeAt(i++);\n if (c < 128) {\n C = C >>> 8 ^ T[(C ^ c) & 255];\n } else if (c < 2048) {\n C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];\n } else if (c >= 55296 && c < 57344) {\n c = (c & 1023) + 64;\n d = str.charCodeAt(i++) & 1023;\n C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255];\n } else {\n C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];\n }\n }\n return C ^ -1;\n }\n CRC322.table = T;\n CRC322.bstr = crc32_bstr;\n CRC322.buf = crc32_buf;\n CRC322.str = crc32_str;\n });\n }\n});\n\n// node_modules/events/events.js\nvar require_events = __commonJS({\n "node_modules/events/events.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var R = typeof Reflect === "object" ? Reflect : null;\n var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n };\n var ReflectOwnKeys;\n if (R && typeof R.ownKeys === "function") {\n ReflectOwnKeys = R.ownKeys;\n } else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));\n };\n } else {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target);\n };\n }\n function ProcessEmitWarning(warning) {\n if (console && console.warn)\n console.warn(warning);\n }\n var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {\n return value !== value;\n };\n function EventEmitter() {\n EventEmitter.init.call(this);\n }\n module.exports = EventEmitter;\n module.exports.once = once;\n EventEmitter.EventEmitter = EventEmitter;\n EventEmitter.prototype._events = void 0;\n EventEmitter.prototype._eventsCount = 0;\n EventEmitter.prototype._maxListeners = void 0;\n var defaultMaxListeners = 10;\n function checkListener(listener) {\n if (typeof listener !== "function") {\n throw new TypeError(\'The "listener" argument must be of type Function. Received type \' + typeof listener);\n }\n }\n Object.defineProperty(EventEmitter, "defaultMaxListeners", {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError(\'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received \' + arg + ".");\n }\n defaultMaxListeners = arg;\n }\n });\n EventEmitter.init = function() {\n if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n }\n this._maxListeners = this._maxListeners || void 0;\n };\n EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {\n throw new RangeError(\'The value of "n" is out of range. It must be a non-negative number. Received \' + n + ".");\n }\n this._maxListeners = n;\n return this;\n };\n function _getMaxListeners(that) {\n if (that._maxListeners === void 0)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n }\n EventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n };\n EventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++)\n args.push(arguments[i]);\n var doError = type === "error";\n var events = this._events;\n if (events !== void 0)\n doError = doError && events.error === void 0;\n else if (!doError)\n return false;\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n throw er;\n }\n var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));\n err.context = er;\n throw err;\n }\n var handler = events[type];\n if (handler === void 0)\n return false;\n if (typeof handler === "function") {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n return true;\n };\n function _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n checkListener(listener);\n events = target._events;\n if (events === void 0) {\n events = target._events = /* @__PURE__ */ Object.create(null);\n target._eventsCount = 0;\n } else {\n if (events.newListener !== void 0) {\n target.emit("newListener", type, listener.listener ? listener.listener : listener);\n events = target._events;\n }\n existing = events[type];\n }\n if (existing === void 0) {\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === "function") {\n existing = events[type] = prepend ? [listener, existing] : [existing, listener];\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");\n w.name = "MaxListenersExceededWarning";\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n return target;\n }\n EventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n };\n EventEmitter.prototype.on = EventEmitter.prototype.addListener;\n EventEmitter.prototype.prependListener = function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n function onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n }\n function _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: void 0, target, type, listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n }\n EventEmitter.prototype.once = function once2(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.removeListener = function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n checkListener(listener);\n events = this._events;\n if (events === void 0)\n return this;\n list = events[type];\n if (list === void 0)\n return this;\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit("removeListener", type, list.listener || listener);\n }\n } else if (typeof list !== "function") {\n position = -1;\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n if (position < 0)\n return this;\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n if (list.length === 1)\n events[type] = list[0];\n if (events.removeListener !== void 0)\n this.emit("removeListener", type, originalListener || listener);\n }\n return this;\n };\n EventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {\n var listeners, events, i;\n events = this._events;\n if (events === void 0)\n return this;\n if (events.removeListener === void 0) {\n if (arguments.length === 0) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== void 0) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key2;\n for (i = 0; i < keys.length; ++i) {\n key2 = keys[i];\n if (key2 === "removeListener")\n continue;\n this.removeAllListeners(key2);\n }\n this.removeAllListeners("removeListener");\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n listeners = events[type];\n if (typeof listeners === "function") {\n this.removeListener(type, listeners);\n } else if (listeners !== void 0) {\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n return this;\n };\n function _listeners(target, type, unwrap) {\n var events = target._events;\n if (events === void 0)\n return [];\n var evlistener = events[type];\n if (evlistener === void 0)\n return [];\n if (typeof evlistener === "function")\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n }\n EventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n };\n EventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n };\n EventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === "function") {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n };\n EventEmitter.prototype.listenerCount = listenerCount;\n function listenerCount(type) {\n var events = this._events;\n if (events !== void 0) {\n var evlistener = events[type];\n if (typeof evlistener === "function") {\n return 1;\n } else if (evlistener !== void 0) {\n return evlistener.length;\n }\n }\n return 0;\n }\n EventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n };\n function arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n }\n function spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n }\n function unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n }\n function once(emitter, name) {\n return new Promise(function(resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n function resolver() {\n if (typeof emitter.removeListener === "function") {\n emitter.removeListener("error", errorListener);\n }\n resolve([].slice.call(arguments));\n }\n ;\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== "error") {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n }\n function addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === "function") {\n eventTargetAgnosticAddListener(emitter, "error", handler, flags);\n }\n }\n function eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === "function") {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === "function") {\n emitter.addEventListener(name, function wrapListener(arg) {\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError(\'The "emitter" argument must be of type EventEmitter. Received type \' + typeof emitter);\n }\n }\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/stream-browser.js\nvar require_stream_browser = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = require_events().EventEmitter;\n }\n});\n\n// (disabled):node_modules/util/util.js\nvar require_util = __commonJS({\n "(disabled):node_modules/util/util.js"() {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/buffer_list.js\nvar require_buffer_list = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly)\n symbols = symbols.filter(function(sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n return keys;\n }\n function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function(key2) {\n _defineProperty(target, key2, source[key2]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function(key2) {\n Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));\n });\n }\n }\n return target;\n }\n function _defineProperty(obj, key2, value) {\n if (key2 in obj) {\n Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key2] = value;\n }\n return obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor)\n descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps)\n _defineProperties(Constructor.prototype, protoProps);\n if (staticProps)\n _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n var _require = require_buffer();\n var Buffer13 = _require.Buffer;\n var _require2 = require_util();\n var inspect = _require2.inspect;\n var custom = inspect && inspect.custom || "inspect";\n function copyBuffer(src, target, offset) {\n Buffer13.prototype.copy.call(src, target, offset);\n }\n module.exports = /* @__PURE__ */ function() {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: "push",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0)\n this.tail.next = entry;\n else\n this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: "unshift",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0)\n this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: "shift",\n value: function shift() {\n if (this.length === 0)\n return;\n var ret = this.head.data;\n if (this.length === 1)\n this.head = this.tail = null;\n else\n this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: "clear",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: "join",\n value: function join(s) {\n if (this.length === 0)\n return "";\n var p = this.head;\n var ret = "" + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }\n return ret;\n }\n }, {\n key: "concat",\n value: function concat(n) {\n if (this.length === 0)\n return Buffer13.alloc(0);\n var ret = Buffer13.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n }, {\n key: "consume",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n ret = this.shift();\n } else {\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: "first",\n value: function first() {\n return this.head.data;\n }\n }, {\n key: "_getString",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length)\n ret += str;\n else\n ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n }, {\n key: "_getBuffer",\n value: function _getBuffer(n) {\n var ret = Buffer13.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf2 = p.data;\n var nb = n > buf2.length ? buf2.length : n;\n buf2.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf2.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf2.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread({}, options, {\n depth: 0,\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n }();\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/destroy.js\nvar require_destroy = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function(err2) {\n if (!cb && err2) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n }\n function emitErrorAndCloseNT(self2, err) {\n emitErrorNT(self2, err);\n emitCloseNT(self2);\n }\n function emitCloseNT(self2) {\n if (self2._writableState && !self2._writableState.emitClose)\n return;\n if (self2._readableState && !self2._readableState.emitClose)\n return;\n self2.emit("close");\n }\n function undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n }\n function emitErrorNT(self2, err) {\n self2.emit("error", err);\n }\n function errorOrDestroy(stream, err) {\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy)\n stream.destroy(err);\n else\n stream.emit("error", err);\n }\n module.exports = {\n destroy,\n undestroy,\n errorOrDestroy\n };\n }\n});\n\n// node_modules/readable-stream/errors-browser.js\nvar require_errors_browser = __commonJS({\n "node_modules/readable-stream/errors-browser.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n }\n var codes = {};\n function createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === "string") {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n var NodeError = /* @__PURE__ */ function(_Base) {\n _inheritsLoose(NodeError2, _Base);\n function NodeError2(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n return NodeError2;\n }(Base);\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function(i) {\n return String(i);\n });\n if (len > 2) {\n return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1];\n } else if (len === 2) {\n return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);\n } else {\n return "of ".concat(thing, " ").concat(expected[0]);\n }\n } else {\n return "of ".concat(thing, " ").concat(String(expected));\n }\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n if (this_len === void 0 || this_len > str.length) {\n this_len = str.length;\n }\n return str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n if (typeof start !== "number") {\n start = 0;\n }\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n }\n createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {\n return \'The value "\' + value + \'" is invalid for option "\' + name + \'"\';\n }, TypeError);\n createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {\n var determiner;\n if (typeof expected === "string" && startsWith(expected, "not ")) {\n determiner = "must not be";\n expected = expected.replace(/^not /, "");\n } else {\n determiner = "must be";\n }\n var msg;\n if (endsWith(name, " argument")) {\n msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));\n } else {\n var type = includes(name, ".") ? "property" : "argument";\n msg = \'The "\'.concat(name, \'" \').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));\n }\n msg += ". Received type ".concat(typeof actual);\n return msg;\n }, TypeError);\n createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");\n createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {\n return "The " + name + " method is not implemented";\n });\n createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");\n createErrorType("ERR_STREAM_DESTROYED", function(name) {\n return "Cannot call " + name + " after a stream was destroyed";\n });\n createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");\n createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");\n createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");\n createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);\n createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {\n return "Unknown encoding: " + arg;\n }, TypeError);\n createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");\n module.exports.codes = codes;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/state.js\nvar require_state = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE;\n function highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n }\n function getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : "highWaterMark";\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n return state.objectMode ? 16 : 16 * 1024;\n }\n module.exports = {\n getHighWaterMark\n };\n }\n});\n\n// node_modules/inherits/inherits_browser.js\nvar require_inherits_browser = __commonJS({\n "node_modules/inherits/inherits_browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n if (typeof Object.create === "function") {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n };\n } else {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n };\n }\n }\n});\n\n// node_modules/util-deprecate/browser.js\nvar require_browser = __commonJS({\n "node_modules/util-deprecate/browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = deprecate;\n function deprecate(fn, msg) {\n if (config("noDeprecation")) {\n return fn;\n }\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config("throwDeprecation")) {\n throw new Error(msg);\n } else if (config("traceDeprecation")) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n return deprecated;\n }\n function config(name) {\n try {\n if (!self.localStorage)\n return false;\n } catch (_) {\n return false;\n }\n var val = self.localStorage[name];\n if (val == null)\n return false;\n return String(val).toLowerCase() === "true";\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_writable.js\nvar require_stream_writable = __commonJS({\n "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Writable;\n function CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function() {\n onCorkedFinish(_this, state);\n };\n }\n var Duplex;\n Writable.WritableState = WritableState;\n var internalUtil = {\n deprecate: require_browser()\n };\n var Stream = require_stream_browser();\n var Buffer13 = require_buffer().Buffer;\n var OurUint8Array = self.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer13.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer13.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;\n var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;\n var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n require_inherits_browser()(Writable, Stream);\n function nop() {\n }\n function WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== "boolean")\n isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);\n this.finalCalled = false;\n this.needDrain = false;\n this.ending = false;\n this.ended = false;\n this.finished = false;\n this.destroyed = false;\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n this.defaultEncoding = options.defaultEncoding || "utf8";\n this.length = 0;\n this.writing = false;\n this.corked = 0;\n this.sync = true;\n this.bufferProcessing = false;\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n this.writecb = null;\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n this.pendingcb = 0;\n this.prefinished = false;\n this.errorEmitted = false;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.bufferedRequestCount = 0;\n this.corkedRequestsFree = new CorkedRequest(this);\n }\n WritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n };\n (function() {\n try {\n Object.defineProperty(WritableState.prototype, "buffer", {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")\n });\n } catch (_) {\n }\n })();\n var realHasInstance;\n if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object))\n return true;\n if (this !== Writable)\n return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n } else {\n realHasInstance = function realHasInstance2(object) {\n return object instanceof this;\n };\n }\n function Writable(options) {\n Duplex = Duplex || require_stream_duplex();\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this))\n return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n this.writable = true;\n if (options) {\n if (typeof options.write === "function")\n this._write = options.write;\n if (typeof options.writev === "function")\n this._writev = options.writev;\n if (typeof options.destroy === "function")\n this._destroy = options.destroy;\n if (typeof options.final === "function")\n this._final = options.final;\n }\n Stream.call(this);\n }\n Writable.prototype.pipe = function() {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n };\n function writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n }\n function validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== "string" && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n }\n Writable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer13.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === "function") {\n cb = encoding;\n encoding = null;\n }\n if (isBuf)\n encoding = "buffer";\n else if (!encoding)\n encoding = state.defaultEncoding;\n if (typeof cb !== "function")\n cb = nop;\n if (state.ending)\n writeAfterEnd(this, cb);\n else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n };\n Writable.prototype.cork = function() {\n this._writableState.corked++;\n };\n Writable.prototype.uncork = function() {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)\n clearBuffer(this, state);\n }\n };\n Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n if (typeof encoding === "string")\n encoding = encoding.toLowerCase();\n if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n };\n Object.defineProperty(Writable.prototype, "writableBuffer", {\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n function decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {\n chunk = Buffer13.from(chunk, encoding);\n }\n return chunk;\n }\n Object.defineProperty(Writable.prototype, "writableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = "buffer";\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n if (!ret)\n state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk,\n encoding,\n isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n }\n function doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed)\n state.onwrite(new ERR_STREAM_DESTROYED("write"));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n }\n function onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n process.nextTick(cb, er);\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n finishMaybe(stream, state);\n }\n }\n function onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n }\n function onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== "function")\n throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n }\n function afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n }\n function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit("drain");\n }\n }\n function clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf)\n allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, "", holder.finish);\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n if (state.writing) {\n break;\n }\n }\n if (entry === null)\n state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n }\n Writable.prototype._write = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));\n };\n Writable.prototype._writev = null;\n Writable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === "function") {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === "function") {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== void 0)\n this.write(chunk, encoding);\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n if (!state.ending)\n endWritable(this, state, cb);\n return this;\n };\n Object.defineProperty(Writable.prototype, "writableLength", {\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n }\n function callFinal(stream, state) {\n stream._final(function(err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit("prefinish");\n finishMaybe(stream, state);\n });\n }\n function prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === "function" && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit("prefinish");\n }\n }\n }\n function finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit("finish");\n if (state.autoDestroy) {\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n }\n function endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once("finish", cb);\n }\n state.ended = true;\n stream.writable = false;\n }\n function onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n state.corkedRequestsFree.next = corkReq;\n }\n Object.defineProperty(Writable.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._writableState === void 0) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n if (!this._writableState) {\n return;\n }\n this._writableState.destroyed = value;\n }\n });\n Writable.prototype.destroy = destroyImpl.destroy;\n Writable.prototype._undestroy = destroyImpl.undestroy;\n Writable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n }\n});\n\n// node_modules/readable-stream/lib/_stream_duplex.js\nvar require_stream_duplex = __commonJS({\n "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var objectKeys = Object.keys || function(obj) {\n var keys2 = [];\n for (var key2 in obj) {\n keys2.push(key2);\n }\n return keys2;\n };\n module.exports = Duplex;\n var Readable = require_stream_readable();\n var Writable = require_stream_writable();\n require_inherits_browser()(Duplex, Readable);\n {\n keys = objectKeys(Writable.prototype);\n for (v = 0; v < keys.length; v++) {\n method = keys[v];\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n }\n }\n var keys;\n var method;\n var v;\n function Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false)\n this.readable = false;\n if (options.writable === false)\n this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once("end", onend);\n }\n }\n }\n Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n Object.defineProperty(Duplex.prototype, "writableBuffer", {\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n Object.defineProperty(Duplex.prototype, "writableLength", {\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function onend() {\n if (this._writableState.ended)\n return;\n process.nextTick(onEndNT, this);\n }\n function onEndNT(self2) {\n self2.end();\n }\n Object.defineProperty(Duplex.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return;\n }\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n });\n }\n});\n\n// node_modules/safe-buffer/index.js\nvar require_safe_buffer = __commonJS({\n "node_modules/safe-buffer/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var buffer = require_buffer();\n var Buffer13 = buffer.Buffer;\n function copyProps(src, dst) {\n for (var key2 in src) {\n dst[key2] = src[key2];\n }\n }\n if (Buffer13.from && Buffer13.alloc && Buffer13.allocUnsafe && Buffer13.allocUnsafeSlow) {\n module.exports = buffer;\n } else {\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n }\n function SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer13(arg, encodingOrOffset, length);\n }\n SafeBuffer.prototype = Object.create(Buffer13.prototype);\n copyProps(Buffer13, SafeBuffer);\n SafeBuffer.from = function(arg, encodingOrOffset, length) {\n if (typeof arg === "number") {\n throw new TypeError("Argument must not be a number");\n }\n return Buffer13(arg, encodingOrOffset, length);\n };\n SafeBuffer.alloc = function(size, fill, encoding) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n var buf2 = Buffer13(size);\n if (fill !== void 0) {\n if (typeof encoding === "string") {\n buf2.fill(fill, encoding);\n } else {\n buf2.fill(fill);\n }\n } else {\n buf2.fill(0);\n }\n return buf2;\n };\n SafeBuffer.allocUnsafe = function(size) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n return Buffer13(size);\n };\n SafeBuffer.allocUnsafeSlow = function(size) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n return buffer.SlowBuffer(size);\n };\n }\n});\n\n// node_modules/string_decoder/lib/string_decoder.js\nvar require_string_decoder = __commonJS({\n "node_modules/string_decoder/lib/string_decoder.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var Buffer13 = require_safe_buffer().Buffer;\n var isEncoding = Buffer13.isEncoding || function(encoding) {\n encoding = "" + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case "hex":\n case "utf8":\n case "utf-8":\n case "ascii":\n case "binary":\n case "base64":\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n case "raw":\n return true;\n default:\n return false;\n }\n };\n function _normalizeEncoding(enc) {\n if (!enc)\n return "utf8";\n var retried;\n while (true) {\n switch (enc) {\n case "utf8":\n case "utf-8":\n return "utf8";\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return "utf16le";\n case "latin1":\n case "binary":\n return "latin1";\n case "base64":\n case "ascii":\n case "hex":\n return enc;\n default:\n if (retried)\n return;\n enc = ("" + enc).toLowerCase();\n retried = true;\n }\n }\n }\n function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== "string" && (Buffer13.isEncoding === isEncoding || !isEncoding(enc)))\n throw new Error("Unknown encoding: " + enc);\n return nenc || enc;\n }\n exports.StringDecoder = StringDecoder;\n function StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case "utf16le":\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case "utf8":\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case "base64":\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer13.allocUnsafe(nb);\n }\n StringDecoder.prototype.write = function(buf2) {\n if (buf2.length === 0)\n return "";\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf2);\n if (r === void 0)\n return "";\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf2.length)\n return r ? r + this.text(buf2, i) : this.text(buf2, i);\n return r || "";\n };\n StringDecoder.prototype.end = utf8End;\n StringDecoder.prototype.text = utf8Text;\n StringDecoder.prototype.fillLast = function(buf2) {\n if (this.lastNeed <= buf2.length) {\n buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length);\n this.lastNeed -= buf2.length;\n };\n function utf8CheckByte(byte) {\n if (byte <= 127)\n return 0;\n else if (byte >> 5 === 6)\n return 2;\n else if (byte >> 4 === 14)\n return 3;\n else if (byte >> 3 === 30)\n return 4;\n return byte >> 6 === 2 ? -1 : -2;\n }\n function utf8CheckIncomplete(self2, buf2, i) {\n var j = buf2.length - 1;\n if (j < i)\n return 0;\n var nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0)\n self2.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2)\n return 0;\n nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0)\n self2.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2)\n return 0;\n nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2)\n nb = 0;\n else\n self2.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n }\n function utf8CheckExtraBytes(self2, buf2, p) {\n if ((buf2[0] & 192) !== 128) {\n self2.lastNeed = 0;\n return "\\uFFFD";\n }\n if (self2.lastNeed > 1 && buf2.length > 1) {\n if ((buf2[1] & 192) !== 128) {\n self2.lastNeed = 1;\n return "\\uFFFD";\n }\n if (self2.lastNeed > 2 && buf2.length > 2) {\n if ((buf2[2] & 192) !== 128) {\n self2.lastNeed = 2;\n return "\\uFFFD";\n }\n }\n }\n }\n function utf8FillLast(buf2) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf2, p);\n if (r !== void 0)\n return r;\n if (this.lastNeed <= buf2.length) {\n buf2.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf2.copy(this.lastChar, p, 0, buf2.length);\n this.lastNeed -= buf2.length;\n }\n function utf8Text(buf2, i) {\n var total = utf8CheckIncomplete(this, buf2, i);\n if (!this.lastNeed)\n return buf2.toString("utf8", i);\n this.lastTotal = total;\n var end = buf2.length - (total - this.lastNeed);\n buf2.copy(this.lastChar, 0, end);\n return buf2.toString("utf8", i, end);\n }\n function utf8End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed)\n return r + "\\uFFFD";\n return r;\n }\n function utf16Text(buf2, i) {\n if ((buf2.length - i) % 2 === 0) {\n var r = buf2.toString("utf16le", i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 55296 && c <= 56319) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf2[buf2.length - 2];\n this.lastChar[1] = buf2[buf2.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf2[buf2.length - 1];\n return buf2.toString("utf16le", i, buf2.length - 1);\n }\n function utf16End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString("utf16le", 0, end);\n }\n return r;\n }\n function base64Text(buf2, i) {\n var n = (buf2.length - i) % 3;\n if (n === 0)\n return buf2.toString("base64", i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf2[buf2.length - 1];\n } else {\n this.lastChar[0] = buf2[buf2.length - 2];\n this.lastChar[1] = buf2[buf2.length - 1];\n }\n return buf2.toString("base64", i, buf2.length - n);\n }\n function base64End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed)\n return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);\n return r;\n }\n function simpleWrite(buf2) {\n return buf2.toString(this.encoding);\n }\n function simpleEnd(buf2) {\n return buf2 && buf2.length ? this.write(buf2) : "";\n }\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/end-of-stream.js\nvar require_end_of_stream = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE;\n function once(callback) {\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n }\n function noop2() {\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === "function";\n }\n function eos(stream, opts, callback) {\n if (typeof opts === "function")\n return eos(stream, null, opts);\n if (!opts)\n opts = {};\n callback = once(callback || noop2);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable2 = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish2() {\n if (!stream.writable)\n onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish2() {\n writable2 = false;\n writableEnded = true;\n if (!readable)\n callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend2() {\n readable = false;\n readableEnded = true;\n if (!writable2)\n callback.call(stream);\n };\n var onerror = function onerror2(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose2() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended)\n err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable2 && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended)\n err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest2() {\n stream.req.on("finish", onfinish);\n };\n if (isRequest(stream)) {\n stream.on("complete", onfinish);\n stream.on("abort", onclose);\n if (stream.req)\n onrequest();\n else\n stream.on("request", onrequest);\n } else if (writable2 && !stream._writableState) {\n stream.on("end", onlegacyfinish);\n stream.on("close", onlegacyfinish);\n }\n stream.on("end", onend);\n stream.on("finish", onfinish);\n if (opts.error !== false)\n stream.on("error", onerror);\n stream.on("close", onclose);\n return function() {\n stream.removeListener("complete", onfinish);\n stream.removeListener("abort", onclose);\n stream.removeListener("request", onrequest);\n if (stream.req)\n stream.req.removeListener("finish", onfinish);\n stream.removeListener("end", onlegacyfinish);\n stream.removeListener("close", onlegacyfinish);\n stream.removeListener("finish", onfinish);\n stream.removeListener("end", onend);\n stream.removeListener("error", onerror);\n stream.removeListener("close", onclose);\n };\n }\n module.exports = eos;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/async_iterator.js\nvar require_async_iterator = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var _Object$setPrototypeO;\n function _defineProperty(obj, key2, value) {\n if (key2 in obj) {\n Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key2] = value;\n }\n return obj;\n }\n var finished = require_end_of_stream();\n var kLastResolve = Symbol("lastResolve");\n var kLastReject = Symbol("lastReject");\n var kError = Symbol("error");\n var kEnded = Symbol("ended");\n var kLastPromise = Symbol("lastPromise");\n var kHandlePromise = Symbol("handlePromise");\n var kStream = Symbol("stream");\n function createIterResult(value, done) {\n return {\n value,\n done\n };\n }\n function readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n }\n function onReadable(iter) {\n process.nextTick(readAndResolve, iter);\n }\n function wrapForNext(lastPromise, iter) {\n return function(resolve, reject) {\n lastPromise.then(function() {\n if (iter[kEnded]) {\n resolve(createIterResult(void 0, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n }\n var AsyncIteratorPrototype = Object.getPrototypeOf(function() {\n });\n var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(void 0, true));\n }\n if (this[kStream].destroyed) {\n return new Promise(function(resolve, reject) {\n process.nextTick(function() {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(void 0, true));\n }\n });\n });\n }\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {\n return this;\n }), _defineProperty(_Object$setPrototypeO, "return", function _return() {\n var _this2 = this;\n return new Promise(function(resolve, reject) {\n _this2[kStream].destroy(null, function(err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(void 0, true));\n });\n });\n }), _Object$setPrototypeO), AsyncIteratorPrototype);\n var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function(err) {\n if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {\n var reject = iterator[kLastReject];\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(void 0, true));\n }\n iterator[kEnded] = true;\n });\n stream.on("readable", onReadable.bind(null, iterator));\n return iterator;\n };\n module.exports = createReadableStreamAsyncIterator;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/from-browser.js\nvar require_from_browser = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = function() {\n throw new Error("Readable.from is not available in the browser");\n };\n }\n});\n\n// node_modules/readable-stream/lib/_stream_readable.js\nvar require_stream_readable = __commonJS({\n "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Readable;\n var Duplex;\n Readable.ReadableState = ReadableState;\n var EE = require_events().EventEmitter;\n var EElistenerCount = function EElistenerCount2(emitter, type) {\n return emitter.listeners(type).length;\n };\n var Stream = require_stream_browser();\n var Buffer13 = require_buffer().Buffer;\n var OurUint8Array = self.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer13.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer13.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var debugUtil = require_util();\n var debug;\n if (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog("stream");\n } else {\n debug = function debug2() {\n };\n }\n var BufferList = require_buffer_list();\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n var StringDecoder;\n var createReadableStreamAsyncIterator;\n var from;\n require_inherits_browser()(Readable, Stream);\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];\n function prependListener(emitter, event, fn) {\n if (typeof emitter.prependListener === "function")\n return emitter.prependListener(event, fn);\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (Array.isArray(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n }\n function ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== "boolean")\n isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n this.sync = true;\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.destroyed = false;\n this.defaultEncoding = options.defaultEncoding || "utf8";\n this.awaitDrain = 0;\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require_string_decoder().StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n }\n function Readable(options) {\n Duplex = Duplex || require_stream_duplex();\n if (!(this instanceof Readable))\n return new Readable(options);\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n this.readable = true;\n if (options) {\n if (typeof options.read === "function")\n this._read = options.read;\n if (typeof options.destroy === "function")\n this._destroy = options.destroy;\n }\n Stream.call(this);\n }\n Object.defineProperty(Readable.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n if (!this._readableState) {\n return;\n }\n this._readableState.destroyed = value;\n }\n });\n Readable.prototype.destroy = destroyImpl.destroy;\n Readable.prototype._undestroy = destroyImpl.undestroy;\n Readable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n Readable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === "string") {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer13.from(chunk, encoding);\n encoding = "";\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n };\n Readable.prototype.unshift = function(chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n };\n function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug("readableAddChunk", chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck)\n er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer13.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted)\n errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());\n else\n addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0)\n addChunk(stream, state, chunk, false);\n else\n maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n }\n function addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit("data", chunk);\n } else {\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n if (state.needReadable)\n emitReadable(stream);\n }\n maybeReadMore(stream, state);\n }\n function chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);\n }\n return er;\n }\n Readable.prototype.isPaused = function() {\n return this._readableState.flowing === false;\n };\n Readable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require_string_decoder().StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n this._readableState.encoding = this._readableState.decoder.encoding;\n var p = this._readableState.buffer.head;\n var content = "";\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== "")\n this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n };\n var MAX_HWM = 1073741824;\n function computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n }\n function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended)\n return 0;\n if (state.objectMode)\n return 1;\n if (n !== n) {\n if (state.flowing && state.length)\n return state.buffer.head.data.length;\n else\n return state.length;\n }\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length)\n return n;\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n }\n Readable.prototype.read = function(n) {\n debug("read", n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0)\n state.emittedReadable = false;\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug("read: emitReadable", state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n var doRead = state.needReadable;\n debug("need readable", doRead);\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug("length less than watermark", doRead);\n }\n if (state.ended || state.reading) {\n doRead = false;\n debug("reading or ended", doRead);\n } else if (doRead) {\n debug("do read");\n state.reading = true;\n state.sync = true;\n if (state.length === 0)\n state.needReadable = true;\n this._read(state.highWaterMark);\n state.sync = false;\n if (!state.reading)\n n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n if (!state.ended)\n state.needReadable = true;\n if (nOrig !== n && state.ended)\n endReadable(this);\n }\n if (ret !== null)\n this.emit("data", ret);\n return ret;\n };\n function onEofChunk(stream, state) {\n debug("onEofChunk");\n if (state.ended)\n return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n emitReadable(stream);\n } else {\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n }\n function emitReadable(stream) {\n var state = stream._readableState;\n debug("emitReadable", state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug("emitReadable", state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n }\n function emitReadable_(stream) {\n var state = stream._readableState;\n debug("emitReadable_", state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit("readable");\n state.emittedReadable = false;\n }\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n }\n function maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n }\n function maybeReadMore_(stream, state) {\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug("maybeReadMore read 0");\n stream.read(0);\n if (len === state.length)\n break;\n }\n state.readingMore = false;\n }\n Readable.prototype._read = function(n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));\n };\n Readable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once("end", endFn);\n dest.on("unpipe", onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug("onunpipe");\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug("onend");\n dest.end();\n }\n var ondrain = pipeOnDrain(src);\n dest.on("drain", ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug("cleanup");\n dest.removeListener("close", onclose);\n dest.removeListener("finish", onfinish);\n dest.removeListener("drain", ondrain);\n dest.removeListener("error", onerror);\n dest.removeListener("unpipe", onunpipe);\n src.removeListener("end", onend);\n src.removeListener("end", unpipe);\n src.removeListener("data", ondata);\n cleanedUp = true;\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n src.on("data", ondata);\n function ondata(chunk) {\n debug("ondata");\n var ret = dest.write(chunk);\n debug("dest.write", ret);\n if (ret === false) {\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug("false write response, pause", state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n function onerror(er) {\n debug("onerror", er);\n unpipe();\n dest.removeListener("error", onerror);\n if (EElistenerCount(dest, "error") === 0)\n errorOrDestroy(dest, er);\n }\n prependListener(dest, "error", onerror);\n function onclose() {\n dest.removeListener("finish", onfinish);\n unpipe();\n }\n dest.once("close", onclose);\n function onfinish() {\n debug("onfinish");\n dest.removeListener("close", onclose);\n unpipe();\n }\n dest.once("finish", onfinish);\n function unpipe() {\n debug("unpipe");\n src.unpipe(dest);\n }\n dest.emit("pipe", src);\n if (!state.flowing) {\n debug("pipe resume");\n src.resume();\n }\n return dest;\n };\n function pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug("pipeOnDrain", state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {\n state.flowing = true;\n flow(src);\n }\n };\n }\n Readable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n if (state.pipesCount === 0)\n return this;\n if (state.pipesCount === 1) {\n if (dest && dest !== state.pipes)\n return this;\n if (!dest)\n dest = state.pipes;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit("unpipe", this, unpipeInfo);\n return this;\n }\n if (!dest) {\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) {\n dests[i].emit("unpipe", this, {\n hasUnpiped: false\n });\n }\n return this;\n }\n var index = indexOf(state.pipes, dest);\n if (index === -1)\n return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n dest.emit("unpipe", this, unpipeInfo);\n return this;\n };\n Readable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === "data") {\n state.readableListening = this.listenerCount("readable") > 0;\n if (state.flowing !== false)\n this.resume();\n } else if (ev === "readable") {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug("on readable", state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n };\n Readable.prototype.addListener = Readable.prototype.on;\n Readable.prototype.removeListener = function(ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === "readable") {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n Readable.prototype.removeAllListeners = function(ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === "readable" || ev === void 0) {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n function updateReadableListening(self2) {\n var state = self2._readableState;\n state.readableListening = self2.listenerCount("readable") > 0;\n if (state.resumeScheduled && !state.paused) {\n state.flowing = true;\n } else if (self2.listenerCount("data") > 0) {\n self2.resume();\n }\n }\n function nReadingNextTick(self2) {\n debug("readable nexttick read 0");\n self2.read(0);\n }\n Readable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug("resume");\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n };\n function resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n }\n function resume_(stream, state) {\n debug("resume", state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit("resume");\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n }\n Readable.prototype.pause = function() {\n debug("call pause flowing=%j", this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug("pause");\n this._readableState.flowing = false;\n this.emit("pause");\n }\n this._readableState.paused = true;\n return this;\n };\n function flow(stream) {\n var state = stream._readableState;\n debug("flow", state.flowing);\n while (state.flowing && stream.read() !== null) {\n ;\n }\n }\n Readable.prototype.wrap = function(stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on("end", function() {\n debug("wrapped end");\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on("data", function(chunk) {\n debug("wrapped data");\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n if (state.objectMode && (chunk === null || chunk === void 0))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n for (var i in stream) {\n if (this[i] === void 0 && typeof stream[i] === "function") {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n this._read = function(n2) {\n debug("wrapped _read", n2);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n };\n if (typeof Symbol === "function") {\n Readable.prototype[Symbol.asyncIterator] = function() {\n if (createReadableStreamAsyncIterator === void 0) {\n createReadableStreamAsyncIterator = require_async_iterator();\n }\n return createReadableStreamAsyncIterator(this);\n };\n }\n Object.defineProperty(Readable.prototype, "readableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n });\n Object.defineProperty(Readable.prototype, "readableBuffer", {\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n });\n Object.defineProperty(Readable.prototype, "readableFlowing", {\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n });\n Readable._fromList = fromList;\n Object.defineProperty(Readable.prototype, "readableLength", {\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n });\n function fromList(n, state) {\n if (state.length === 0)\n return null;\n var ret;\n if (state.objectMode)\n ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n if (state.decoder)\n ret = state.buffer.join("");\n else if (state.buffer.length === 1)\n ret = state.buffer.first();\n else\n ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n }\n function endReadable(stream) {\n var state = stream._readableState;\n debug("endReadable", state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n }\n function endReadableNT(state, stream) {\n debug("endReadableNT", state.endEmitted, state.length);\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit("end");\n if (state.autoDestroy) {\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n }\n if (typeof Symbol === "function") {\n Readable.from = function(iterable, opts) {\n if (from === void 0) {\n from = require_from_browser();\n }\n return from(Readable, iterable, opts);\n };\n }\n function indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x)\n return i;\n }\n return -1;\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_transform.js\nvar require_stream_transform = __commonJS({\n "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Transform;\n var _require$codes = require_errors_browser().codes;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;\n var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n var Duplex = require_stream_duplex();\n require_inherits_browser()(Transform, Duplex);\n function afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit("error", new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n }\n function Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n this._readableState.needReadable = true;\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === "function")\n this._transform = options.transform;\n if (typeof options.flush === "function")\n this._flush = options.flush;\n }\n this.on("prefinish", prefinish);\n }\n function prefinish() {\n var _this = this;\n if (typeof this._flush === "function" && !this._readableState.destroyed) {\n this._flush(function(er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n }\n Transform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n };\n Transform.prototype._transform = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));\n };\n Transform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n };\n Transform.prototype._read = function(n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n ts.needTransform = true;\n }\n };\n Transform.prototype._destroy = function(err, cb) {\n Duplex.prototype._destroy.call(this, err, function(err2) {\n cb(err2);\n });\n };\n function done(stream, er, data) {\n if (er)\n return stream.emit("error", er);\n if (data != null)\n stream.push(data);\n if (stream._writableState.length)\n throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming)\n throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_passthrough.js\nvar require_stream_passthrough = __commonJS({\n "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = PassThrough;\n var Transform = require_stream_transform();\n require_inherits_browser()(PassThrough, Transform);\n function PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n Transform.call(this, options);\n }\n PassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n };\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/pipeline.js\nvar require_pipeline = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var eos;\n function once(callback) {\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n callback.apply(void 0, arguments);\n };\n }\n var _require$codes = require_errors_browser().codes;\n var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n function noop2(err) {\n if (err)\n throw err;\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === "function";\n }\n function destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on("close", function() {\n closed = true;\n });\n if (eos === void 0)\n eos = require_end_of_stream();\n eos(stream, {\n readable: reading,\n writable: writing\n }, function(err) {\n if (err)\n return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function(err) {\n if (closed)\n return;\n if (destroyed)\n return;\n destroyed = true;\n if (isRequest(stream))\n return stream.abort();\n if (typeof stream.destroy === "function")\n return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED("pipe"));\n };\n }\n function call(fn) {\n fn();\n }\n function pipe(from, to) {\n return from.pipe(to);\n }\n function popCallback(streams) {\n if (!streams.length)\n return noop2;\n if (typeof streams[streams.length - 1] !== "function")\n return noop2;\n return streams.pop();\n }\n function pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0]))\n streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS("streams");\n }\n var error;\n var destroys = streams.map(function(stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function(err) {\n if (!error)\n error = err;\n if (err)\n destroys.forEach(call);\n if (reading)\n return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n }\n module.exports = pipeline;\n }\n});\n\n// node_modules/readable-stream/readable-browser.js\nvar require_readable_browser = __commonJS({\n "node_modules/readable-stream/readable-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports = module.exports = require_stream_readable();\n exports.Stream = exports;\n exports.Readable = exports;\n exports.Writable = require_stream_writable();\n exports.Duplex = require_stream_duplex();\n exports.Transform = require_stream_transform();\n exports.PassThrough = require_stream_passthrough();\n exports.finished = require_end_of_stream();\n exports.pipeline = require_pipeline();\n }\n});\n\n// node_modules/readable-web-to-node-stream/lib/index.js\nvar require_lib = __commonJS({\n "node_modules/readable-web-to-node-stream/lib/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.ReadableWebToNodeStream = void 0;\n var readable_stream_1 = require_readable_browser();\n var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable {\n constructor(stream) {\n super();\n this.bytesRead = 0;\n this.released = false;\n this.reader = stream.getReader();\n }\n async _read() {\n if (this.released) {\n this.push(null);\n return;\n }\n this.pendingRead = this.reader.read();\n const data = await this.pendingRead;\n delete this.pendingRead;\n if (data.done || this.released) {\n this.push(null);\n } else {\n this.bytesRead += data.value.length;\n this.push(data.value);\n }\n }\n async waitForReadToComplete() {\n if (this.pendingRead) {\n await this.pendingRead;\n }\n }\n async close() {\n await this.syncAndRelease();\n }\n async syncAndRelease() {\n this.released = true;\n await this.waitForReadToComplete();\n await this.reader.releaseLock();\n }\n };\n exports.ReadableWebToNodeStream = ReadableWebToNodeStream2;\n }\n});\n\n// node_modules/base-x/src/index.js\nvar require_src = __commonJS({\n "node_modules/base-x/src/index.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function base(ALPHABET) {\n if (ALPHABET.length >= 255) {\n throw new TypeError("Alphabet too long");\n }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) {\n throw new TypeError(x + " is ambiguous");\n }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256);\n var iFACTOR = Math.log(256) / Math.log(BASE);\n function encode2(source) {\n if (source instanceof Uint8Array) {\n } else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) {\n throw new TypeError("Expected Uint8Array");\n }\n if (source.length === 0) {\n return "";\n }\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n var size = (pend - pbegin) * iFACTOR + 1 >>> 0;\n var b58 = new Uint8Array(size);\n while (pbegin !== pend) {\n var carry = source[pbegin];\n var i2 = 0;\n for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {\n carry += 256 * b58[it1] >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = carry / BASE >>> 0;\n }\n if (carry !== 0) {\n throw new Error("Non-zero carry");\n }\n length = i2;\n pbegin++;\n }\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n return str;\n }\n function decodeUnsafe(source) {\n if (typeof source !== "string") {\n throw new TypeError("Expected String");\n }\n if (source.length === 0) {\n return new Uint8Array();\n }\n var psz = 0;\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n var size = (source.length - psz) * FACTOR + 1 >>> 0;\n var b256 = new Uint8Array(size);\n while (source[psz]) {\n var carry = BASE_MAP[source.charCodeAt(psz)];\n if (carry === 255) {\n return;\n }\n var i2 = 0;\n for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {\n carry += BASE * b256[it3] >>> 0;\n b256[it3] = carry % 256 >>> 0;\n carry = carry / 256 >>> 0;\n }\n if (carry !== 0) {\n throw new Error("Non-zero carry");\n }\n length = i2;\n psz++;\n }\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j2 = zeroes;\n while (it4 !== size) {\n vch[j2++] = b256[it4++];\n }\n return vch;\n }\n function decode3(string) {\n var buffer = decodeUnsafe(string);\n if (buffer) {\n return buffer;\n }\n throw new Error("Non-base" + BASE + " character");\n }\n return {\n encode: encode2,\n decodeUnsafe,\n decode: decode3\n };\n }\n module.exports = base;\n }\n});\n\n// node_modules/bs58/index.js\nvar require_bs58 = __commonJS({\n "node_modules/bs58/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var basex = require_src();\n var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";\n module.exports = basex(ALPHABET);\n }\n});\n\n// node_modules/jpeg-js/lib/encoder.js\nvar require_encoder = __commonJS({\n "node_modules/jpeg-js/lib/encoder.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var btoa = btoa || function(buf2) {\n return Buffer2.from(buf2).toString("base64");\n };\n function JPEGEncoder(quality) {\n var self2 = this;\n var fround = Math.round;\n var ffloor = Math.floor;\n var YTable = new Array(64);\n var UVTable = new Array(64);\n var fdtbl_Y = new Array(64);\n var fdtbl_UV = new Array(64);\n var YDC_HT2;\n var UVDC_HT2;\n var YAC_HT2;\n var UVAC_HT2;\n var bitcode2 = new Array(65535);\n var category2 = new Array(65535);\n var outputfDCTQuant = new Array(64);\n var DU = new Array(64);\n var byteout = [];\n var bytenew = 0;\n var bytepos = 7;\n var YDU = new Array(64);\n var UDU = new Array(64);\n var VDU = new Array(64);\n var clt = new Array(256);\n var RGB_YUV_TABLE = new Array(2048);\n var currentQuality;\n var ZigZag = [\n 0,\n 1,\n 5,\n 6,\n 14,\n 15,\n 27,\n 28,\n 2,\n 4,\n 7,\n 13,\n 16,\n 26,\n 29,\n 42,\n 3,\n 8,\n 12,\n 17,\n 25,\n 30,\n 41,\n 43,\n 9,\n 11,\n 18,\n 24,\n 31,\n 40,\n 44,\n 53,\n 10,\n 19,\n 23,\n 32,\n 39,\n 45,\n 52,\n 54,\n 20,\n 22,\n 33,\n 38,\n 46,\n 51,\n 55,\n 60,\n 21,\n 34,\n 37,\n 47,\n 50,\n 56,\n 59,\n 61,\n 35,\n 36,\n 48,\n 49,\n 57,\n 58,\n 62,\n 63\n ];\n var std_dc_luminance_nrcodes2 = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];\n var std_dc_luminance_values2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n var std_ac_luminance_nrcodes2 = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125];\n var std_ac_luminance_values2 = [\n 1,\n 2,\n 3,\n 0,\n 4,\n 17,\n 5,\n 18,\n 33,\n 49,\n 65,\n 6,\n 19,\n 81,\n 97,\n 7,\n 34,\n 113,\n 20,\n 50,\n 129,\n 145,\n 161,\n 8,\n 35,\n 66,\n 177,\n 193,\n 21,\n 82,\n 209,\n 240,\n 36,\n 51,\n 98,\n 114,\n 130,\n 9,\n 10,\n 22,\n 23,\n 24,\n 25,\n 26,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n ];\n var std_dc_chrominance_nrcodes2 = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];\n var std_dc_chrominance_values2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n var std_ac_chrominance_nrcodes2 = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119];\n var std_ac_chrominance_values2 = [\n 0,\n 1,\n 2,\n 3,\n 17,\n 4,\n 5,\n 33,\n 49,\n 6,\n 18,\n 65,\n 81,\n 7,\n 97,\n 113,\n 19,\n 34,\n 50,\n 129,\n 8,\n 20,\n 66,\n 145,\n 161,\n 177,\n 193,\n 9,\n 35,\n 51,\n 82,\n 240,\n 21,\n 98,\n 114,\n 209,\n 10,\n 22,\n 36,\n 52,\n 225,\n 37,\n 241,\n 23,\n 24,\n 25,\n 26,\n 38,\n 39,\n 40,\n 41,\n 42,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n ];\n function initQuantTables(sf) {\n var YQT = [\n 16,\n 11,\n 10,\n 16,\n 24,\n 40,\n 51,\n 61,\n 12,\n 12,\n 14,\n 19,\n 26,\n 58,\n 60,\n 55,\n 14,\n 13,\n 16,\n 24,\n 40,\n 57,\n 69,\n 56,\n 14,\n 17,\n 22,\n 29,\n 51,\n 87,\n 80,\n 62,\n 18,\n 22,\n 37,\n 56,\n 68,\n 109,\n 103,\n 77,\n 24,\n 35,\n 55,\n 64,\n 81,\n 104,\n 113,\n 92,\n 49,\n 64,\n 78,\n 87,\n 103,\n 121,\n 120,\n 101,\n 72,\n 92,\n 95,\n 98,\n 112,\n 100,\n 103,\n 99\n ];\n for (var i = 0; i < 64; i++) {\n var t = ffloor((YQT[i] * sf + 50) / 100);\n if (t < 1) {\n t = 1;\n } else if (t > 255) {\n t = 255;\n }\n YTable[ZigZag[i]] = t;\n }\n var UVQT = [\n 17,\n 18,\n 24,\n 47,\n 99,\n 99,\n 99,\n 99,\n 18,\n 21,\n 26,\n 66,\n 99,\n 99,\n 99,\n 99,\n 24,\n 26,\n 56,\n 99,\n 99,\n 99,\n 99,\n 99,\n 47,\n 66,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99\n ];\n for (var j = 0; j < 64; j++) {\n var u = ffloor((UVQT[j] * sf + 50) / 100);\n if (u < 1) {\n u = 1;\n } else if (u > 255) {\n u = 255;\n }\n UVTable[ZigZag[j]] = u;\n }\n var aasf = [\n 1,\n 1.387039845,\n 1.306562965,\n 1.175875602,\n 1,\n 0.785694958,\n 0.5411961,\n 0.275899379\n ];\n var k = 0;\n for (var row = 0; row < 8; row++) {\n for (var col = 0; col < 8; col++) {\n fdtbl_Y[k] = 1 / (YTable[ZigZag[k]] * aasf[row] * aasf[col] * 8);\n fdtbl_UV[k] = 1 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8);\n k++;\n }\n }\n }\n function computeHuffmanTbl(nrcodes, std_table) {\n var codevalue = 0;\n var pos_in_table = 0;\n var HT = new Array();\n for (var k = 1; k <= 16; k++) {\n for (var j = 1; j <= nrcodes[k]; j++) {\n HT[std_table[pos_in_table]] = [];\n HT[std_table[pos_in_table]][0] = codevalue;\n HT[std_table[pos_in_table]][1] = k;\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n }\n function initHuffmanTbl() {\n YDC_HT2 = computeHuffmanTbl(std_dc_luminance_nrcodes2, std_dc_luminance_values2);\n UVDC_HT2 = computeHuffmanTbl(std_dc_chrominance_nrcodes2, std_dc_chrominance_values2);\n YAC_HT2 = computeHuffmanTbl(std_ac_luminance_nrcodes2, std_ac_luminance_values2);\n UVAC_HT2 = computeHuffmanTbl(std_ac_chrominance_nrcodes2, std_ac_chrominance_values2);\n }\n function initCategoryNumber() {\n var nrlower = 1;\n var nrupper = 2;\n for (var cat = 1; cat <= 15; cat++) {\n for (var nr = nrlower; nr < nrupper; nr++) {\n category2[32767 + nr] = cat;\n bitcode2[32767 + nr] = [];\n bitcode2[32767 + nr][1] = cat;\n bitcode2[32767 + nr][0] = nr;\n }\n for (var nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) {\n category2[32767 + nrneg] = cat;\n bitcode2[32767 + nrneg] = [];\n bitcode2[32767 + nrneg][1] = cat;\n bitcode2[32767 + nrneg][0] = nrupper - 1 + nrneg;\n }\n nrlower <<= 1;\n nrupper <<= 1;\n }\n }\n function initRGBYUVTable() {\n for (var i = 0; i < 256; i++) {\n RGB_YUV_TABLE[i] = 19595 * i;\n RGB_YUV_TABLE[i + 256 >> 0] = 38470 * i;\n RGB_YUV_TABLE[i + 512 >> 0] = 7471 * i + 32768;\n RGB_YUV_TABLE[i + 768 >> 0] = -11059 * i;\n RGB_YUV_TABLE[i + 1024 >> 0] = -21709 * i;\n RGB_YUV_TABLE[i + 1280 >> 0] = 32768 * i + 8421375;\n RGB_YUV_TABLE[i + 1536 >> 0] = -27439 * i;\n RGB_YUV_TABLE[i + 1792 >> 0] = -5329 * i;\n }\n }\n function writeBits(bs) {\n var value = bs[0];\n var posval = bs[1] - 1;\n while (posval >= 0) {\n if (value & 1 << posval) {\n bytenew |= 1 << bytepos;\n }\n posval--;\n bytepos--;\n if (bytepos < 0) {\n if (bytenew == 255) {\n writeByte(255);\n writeByte(0);\n } else {\n writeByte(bytenew);\n }\n bytepos = 7;\n bytenew = 0;\n }\n }\n }\n function writeByte(value) {\n byteout.push(value);\n }\n function writeWord(value) {\n writeByte(value >> 8 & 255);\n writeByte(value & 255);\n }\n function fDCTQuant(data, fdtbl) {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n var dataOff = 0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i = 0; i < I8; ++i) {\n d0 = data[dataOff];\n d1 = data[dataOff + 1];\n d2 = data[dataOff + 2];\n d3 = data[dataOff + 3];\n d4 = data[dataOff + 4];\n d5 = data[dataOff + 5];\n d6 = data[dataOff + 6];\n d7 = data[dataOff + 7];\n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n var tmp10 = tmp0 + tmp3;\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n data[dataOff] = tmp10 + tmp11;\n data[dataOff + 4] = tmp10 - tmp11;\n var z1 = (tmp12 + tmp13) * 0.707106781;\n data[dataOff + 2] = tmp13 + z1;\n data[dataOff + 6] = tmp13 - z1;\n tmp10 = tmp4 + tmp5;\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n var z5 = (tmp10 - tmp12) * 0.382683433;\n var z2 = 0.5411961 * tmp10 + z5;\n var z4 = 1.306562965 * tmp12 + z5;\n var z3 = tmp11 * 0.707106781;\n var z11 = tmp7 + z3;\n var z13 = tmp7 - z3;\n data[dataOff + 5] = z13 + z2;\n data[dataOff + 3] = z13 - z2;\n data[dataOff + 1] = z11 + z4;\n data[dataOff + 7] = z11 - z4;\n dataOff += 8;\n }\n dataOff = 0;\n for (i = 0; i < I8; ++i) {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n var tmp10p2 = tmp0p2 + tmp3p2;\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n data[dataOff] = tmp10p2 + tmp11p2;\n data[dataOff + 32] = tmp10p2 - tmp11p2;\n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781;\n data[dataOff + 16] = tmp13p2 + z1p2;\n data[dataOff + 48] = tmp13p2 - z1p2;\n tmp10p2 = tmp4p2 + tmp5p2;\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433;\n var z2p2 = 0.5411961 * tmp10p2 + z5p2;\n var z4p2 = 1.306562965 * tmp12p2 + z5p2;\n var z3p2 = tmp11p2 * 0.707106781;\n var z11p2 = tmp7p2 + z3p2;\n var z13p2 = tmp7p2 - z3p2;\n data[dataOff + 40] = z13p2 + z2p2;\n data[dataOff + 24] = z13p2 - z2p2;\n data[dataOff + 8] = z11p2 + z4p2;\n data[dataOff + 56] = z11p2 - z4p2;\n dataOff++;\n }\n var fDCTQuant2;\n for (i = 0; i < I64; ++i) {\n fDCTQuant2 = data[i] * fdtbl[i];\n outputfDCTQuant[i] = fDCTQuant2 > 0 ? fDCTQuant2 + 0.5 | 0 : fDCTQuant2 - 0.5 | 0;\n }\n return outputfDCTQuant;\n }\n function writeAPP0() {\n writeWord(65504);\n writeWord(16);\n writeByte(74);\n writeByte(70);\n writeByte(73);\n writeByte(70);\n writeByte(0);\n writeByte(1);\n writeByte(1);\n writeByte(0);\n writeWord(1);\n writeWord(1);\n writeByte(0);\n writeByte(0);\n }\n function writeAPP1(exifBuffer) {\n if (!exifBuffer)\n return;\n writeWord(65505);\n if (exifBuffer[0] === 69 && exifBuffer[1] === 120 && exifBuffer[2] === 105 && exifBuffer[3] === 102) {\n writeWord(exifBuffer.length + 2);\n } else {\n writeWord(exifBuffer.length + 5 + 2);\n writeByte(69);\n writeByte(120);\n writeByte(105);\n writeByte(102);\n writeByte(0);\n }\n for (var i = 0; i < exifBuffer.length; i++) {\n writeByte(exifBuffer[i]);\n }\n }\n function writeSOF0(width, height) {\n writeWord(65472);\n writeWord(17);\n writeByte(8);\n writeWord(height);\n writeWord(width);\n writeByte(3);\n writeByte(1);\n writeByte(17);\n writeByte(0);\n writeByte(2);\n writeByte(17);\n writeByte(1);\n writeByte(3);\n writeByte(17);\n writeByte(1);\n }\n function writeDQT() {\n writeWord(65499);\n writeWord(132);\n writeByte(0);\n for (var i = 0; i < 64; i++) {\n writeByte(YTable[i]);\n }\n writeByte(1);\n for (var j = 0; j < 64; j++) {\n writeByte(UVTable[j]);\n }\n }\n function writeDHT() {\n writeWord(65476);\n writeWord(418);\n writeByte(0);\n for (var i = 0; i < 16; i++) {\n writeByte(std_dc_luminance_nrcodes2[i + 1]);\n }\n for (var j = 0; j <= 11; j++) {\n writeByte(std_dc_luminance_values2[j]);\n }\n writeByte(16);\n for (var k = 0; k < 16; k++) {\n writeByte(std_ac_luminance_nrcodes2[k + 1]);\n }\n for (var l = 0; l <= 161; l++) {\n writeByte(std_ac_luminance_values2[l]);\n }\n writeByte(1);\n for (var m = 0; m < 16; m++) {\n writeByte(std_dc_chrominance_nrcodes2[m + 1]);\n }\n for (var n = 0; n <= 11; n++) {\n writeByte(std_dc_chrominance_values2[n]);\n }\n writeByte(17);\n for (var o = 0; o < 16; o++) {\n writeByte(std_ac_chrominance_nrcodes2[o + 1]);\n }\n for (var p = 0; p <= 161; p++) {\n writeByte(std_ac_chrominance_values2[p]);\n }\n }\n function writeCOM(comments) {\n if (typeof comments === "undefined" || comments.constructor !== Array)\n return;\n comments.forEach((e) => {\n if (typeof e !== "string")\n return;\n writeWord(65534);\n var l = e.length;\n writeWord(l + 2);\n var i;\n for (i = 0; i < l; i++)\n writeByte(e.charCodeAt(i));\n });\n }\n function writeSOS() {\n writeWord(65498);\n writeWord(12);\n writeByte(3);\n writeByte(1);\n writeByte(0);\n writeByte(2);\n writeByte(17);\n writeByte(3);\n writeByte(17);\n writeByte(0);\n writeByte(63);\n writeByte(0);\n }\n function processDU(CDU, fdtbl, DC, HTDC, HTAC) {\n var EOB = HTAC[0];\n var M16zeroes = HTAC[240];\n var pos;\n var I16 = 16;\n var I63 = 63;\n var I64 = 64;\n var DU_DCT = fDCTQuant(CDU, fdtbl);\n for (var j = 0; j < I64; ++j) {\n DU[ZigZag[j]] = DU_DCT[j];\n }\n var Diff = DU[0] - DC;\n DC = DU[0];\n if (Diff == 0) {\n writeBits(HTDC[0]);\n } else {\n pos = 32767 + Diff;\n writeBits(HTDC[category2[pos]]);\n writeBits(bitcode2[pos]);\n }\n var end0pos = 63;\n for (; end0pos > 0 && DU[end0pos] == 0; end0pos--) {\n }\n ;\n if (end0pos == 0) {\n writeBits(EOB);\n return DC;\n }\n var i = 1;\n var lng;\n while (i <= end0pos) {\n var startpos = i;\n for (; DU[i] == 0 && i <= end0pos; ++i) {\n }\n var nrzeroes = i - startpos;\n if (nrzeroes >= I16) {\n lng = nrzeroes >> 4;\n for (var nrmarker = 1; nrmarker <= lng; ++nrmarker)\n writeBits(M16zeroes);\n nrzeroes = nrzeroes & 15;\n }\n pos = 32767 + DU[i];\n writeBits(HTAC[(nrzeroes << 4) + category2[pos]]);\n writeBits(bitcode2[pos]);\n i++;\n }\n if (end0pos != I63) {\n writeBits(EOB);\n }\n return DC;\n }\n function initCharLookupTable() {\n var sfcc = String.fromCharCode;\n for (var i = 0; i < 256; i++) {\n clt[i] = sfcc(i);\n }\n }\n this.encode = function(image, quality2) {\n var time_start = new Date().getTime();\n if (quality2)\n setQuality(quality2);\n byteout = new Array();\n bytenew = 0;\n bytepos = 7;\n writeWord(65496);\n writeAPP0();\n writeCOM(image.comments);\n writeAPP1(image.exifBuffer);\n writeDQT();\n writeSOF0(image.width, image.height);\n writeDHT();\n writeSOS();\n var DCY = 0;\n var DCU = 0;\n var DCV = 0;\n bytenew = 0;\n bytepos = 7;\n this.encode.displayName = "_encode_";\n var imageData = image.data;\n var width = image.width;\n var height = image.height;\n var quadWidth = width * 4;\n var tripleWidth = width * 3;\n var x, y = 0;\n var r, g, b;\n var start, p, col, row, pos;\n while (y < height) {\n x = 0;\n while (x < quadWidth) {\n start = quadWidth * y + x;\n p = start;\n col = -1;\n row = 0;\n for (pos = 0; pos < 64; pos++) {\n row = pos >> 3;\n col = (pos & 7) * 4;\n p = start + row * quadWidth + col;\n if (y + row >= height) {\n p -= quadWidth * (y + 1 + row - height);\n }\n if (x + col >= quadWidth) {\n p -= x + col - quadWidth + 4;\n }\n r = imageData[p++];\n g = imageData[p++];\n b = imageData[p++];\n YDU[pos] = (RGB_YUV_TABLE[r] + RGB_YUV_TABLE[g + 256 >> 0] + RGB_YUV_TABLE[b + 512 >> 0] >> 16) - 128;\n UDU[pos] = (RGB_YUV_TABLE[r + 768 >> 0] + RGB_YUV_TABLE[g + 1024 >> 0] + RGB_YUV_TABLE[b + 1280 >> 0] >> 16) - 128;\n VDU[pos] = (RGB_YUV_TABLE[r + 1280 >> 0] + RGB_YUV_TABLE[g + 1536 >> 0] + RGB_YUV_TABLE[b + 1792 >> 0] >> 16) - 128;\n }\n DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT2, YAC_HT2);\n DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT2, UVAC_HT2);\n DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT2, UVAC_HT2);\n x += 32;\n }\n y += 8;\n }\n if (bytepos >= 0) {\n var fillbits = [];\n fillbits[1] = bytepos + 1;\n fillbits[0] = (1 << bytepos + 1) - 1;\n writeBits(fillbits);\n }\n writeWord(65497);\n if (typeof module === "undefined")\n return new Uint8Array(byteout);\n return Buffer2.from(byteout);\n var jpegDataUri = "data:image/jpeg;base64," + btoa(byteout.join(""));\n byteout = [];\n var duration = new Date().getTime() - time_start;\n return jpegDataUri;\n };\n function setQuality(quality2) {\n if (quality2 <= 0) {\n quality2 = 1;\n }\n if (quality2 > 100) {\n quality2 = 100;\n }\n if (currentQuality == quality2)\n return;\n var sf = 0;\n if (quality2 < 50) {\n sf = Math.floor(5e3 / quality2);\n } else {\n sf = Math.floor(200 - quality2 * 2);\n }\n initQuantTables(sf);\n currentQuality = quality2;\n }\n function init2() {\n var time_start = new Date().getTime();\n if (!quality)\n quality = 50;\n initCharLookupTable();\n initHuffmanTbl();\n initCategoryNumber();\n initRGBYUVTable();\n setQuality(quality);\n var duration = new Date().getTime() - time_start;\n }\n init2();\n }\n if (typeof module !== "undefined") {\n module.exports = encode2;\n } else if (typeof window !== "undefined") {\n window["jpeg-js"] = window["jpeg-js"] || {};\n window["jpeg-js"].encode = encode2;\n }\n function encode2(imgData, qu) {\n if (typeof qu === "undefined")\n qu = 50;\n var encoder = new JPEGEncoder(qu);\n var data = encoder.encode(imgData, qu);\n return {\n data,\n width: imgData.width,\n height: imgData.height\n };\n }\n }\n});\n\n// node_modules/jpeg-js/lib/decoder.js\nvar require_decoder = __commonJS({\n "node_modules/jpeg-js/lib/decoder.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var JpegImage = function jpegImage() {\n "use strict";\n var dctZigZag = new Int32Array([\n 0,\n 1,\n 8,\n 16,\n 9,\n 2,\n 3,\n 10,\n 17,\n 24,\n 32,\n 25,\n 18,\n 11,\n 4,\n 5,\n 12,\n 19,\n 26,\n 33,\n 40,\n 48,\n 41,\n 34,\n 27,\n 20,\n 13,\n 6,\n 7,\n 14,\n 21,\n 28,\n 35,\n 42,\n 49,\n 56,\n 57,\n 50,\n 43,\n 36,\n 29,\n 22,\n 15,\n 23,\n 30,\n 37,\n 44,\n 51,\n 58,\n 59,\n 52,\n 45,\n 38,\n 31,\n 39,\n 46,\n 53,\n 60,\n 61,\n 54,\n 47,\n 55,\n 62,\n 63\n ]);\n var dctCos1 = 4017;\n var dctSin1 = 799;\n var dctCos3 = 3406;\n var dctSin3 = 2276;\n var dctCos6 = 1567;\n var dctSin6 = 3784;\n var dctSqrt2 = 5793;\n var dctSqrt1d2 = 2896;\n function constructor() {\n }\n function buildHuffmanTable2(codeLengths, values) {\n var k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({ children: [], index: 0 });\n var p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error("Could not recreate Huffman Table");\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n }\n function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, opts) {\n var precision = frame.precision;\n var samplesPerLine = frame.samplesPerLine;\n var scanLines = frame.scanLines;\n var mcusPerLine = frame.mcusPerLine;\n var progressive = frame.progressive;\n var maxH = frame.maxH, maxV = frame.maxV;\n var startOffset = offset, bitsData = 0, bitsCount = 0;\n function readBit() {\n if (bitsCount > 0) {\n bitsCount--;\n return bitsData >> bitsCount & 1;\n }\n bitsData = data[offset++];\n if (bitsData == 255) {\n var nextByte = data[offset++];\n if (nextByte) {\n throw new Error("unexpected marker: " + (bitsData << 8 | nextByte).toString(16));\n }\n }\n bitsCount = 7;\n return bitsData >>> 7;\n }\n function decodeHuffman(tree) {\n var node = tree, bit;\n while ((bit = readBit()) !== null) {\n node = node[bit];\n if (typeof node === "number")\n return node;\n if (typeof node !== "object")\n throw new Error("invalid huffman sequence");\n }\n return null;\n }\n function receive(length) {\n var n2 = 0;\n while (length > 0) {\n var bit = readBit();\n if (bit === null)\n return;\n n2 = n2 << 1 | bit;\n length--;\n }\n return n2;\n }\n function receiveAndExtend(length) {\n var n2 = receive(length);\n if (n2 >= 1 << length - 1)\n return n2;\n return n2 + (-1 << length) + 1;\n }\n function decodeBaseline(component2, zz) {\n var t = decodeHuffman(component2.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t);\n zz[0] = component2.pred += diff;\n var k2 = 1;\n while (k2 < 64) {\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15)\n break;\n k2 += 16;\n continue;\n }\n k2 += r;\n var z = dctZigZag[k2];\n zz[z] = receiveAndExtend(s);\n k2++;\n }\n }\n function decodeDCFirst(component2, zz) {\n var t = decodeHuffman(component2.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;\n zz[0] = component2.pred += diff;\n }\n function decodeDCSuccessive(component2, zz) {\n zz[0] |= readBit() << successive;\n }\n var eobrun = 0;\n function decodeACFirst(component2, zz) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k2 = spectralStart, e = spectralEnd;\n while (k2 <= e) {\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r) - 1;\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n var z = dctZigZag[k2];\n zz[z] = receiveAndExtend(s) * (1 << successive);\n k2++;\n }\n }\n var successiveACState = 0, successiveACNextValue;\n function decodeACSuccessive(component2, zz) {\n var k2 = spectralStart, e = spectralEnd, r = 0;\n while (k2 <= e) {\n var z = dctZigZag[k2];\n var direction = zz[z] < 0 ? -1 : 1;\n switch (successiveACState) {\n case 0:\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r);\n successiveACState = 4;\n } else {\n r = 16;\n successiveACState = 1;\n }\n } else {\n if (s !== 1)\n throw new Error("invalid ACn encoding");\n successiveACNextValue = receiveAndExtend(s);\n successiveACState = r ? 2 : 3;\n }\n continue;\n case 1:\n case 2:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n r--;\n if (r === 0)\n successiveACState = successiveACState == 2 ? 3 : 0;\n }\n break;\n case 3:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n zz[z] = successiveACNextValue << successive;\n successiveACState = 0;\n }\n break;\n case 4:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n break;\n }\n k2++;\n }\n if (successiveACState === 4) {\n eobrun--;\n if (eobrun === 0)\n successiveACState = 0;\n }\n }\n function decodeMcu(component2, decode4, mcu2, row, col) {\n var mcuRow = mcu2 / mcusPerLine | 0;\n var mcuCol = mcu2 % mcusPerLine;\n var blockRow = mcuRow * component2.v + row;\n var blockCol = mcuCol * component2.h + col;\n if (component2.blocks[blockRow] === void 0 && opts.tolerantDecoding)\n return;\n decode4(component2, component2.blocks[blockRow][blockCol]);\n }\n function decodeBlock(component2, decode4, mcu2) {\n var blockRow = mcu2 / component2.blocksPerLine | 0;\n var blockCol = mcu2 % component2.blocksPerLine;\n if (component2.blocks[blockRow] === void 0 && opts.tolerantDecoding)\n return;\n decode4(component2, component2.blocks[blockRow][blockCol]);\n }\n var componentsLength = components.length;\n var component, i, j, k, n;\n var decodeFn;\n if (progressive) {\n if (spectralStart === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n var mcu = 0, marker;\n var mcuExpected;\n if (componentsLength == 1) {\n mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;\n } else {\n mcuExpected = mcusPerLine * frame.mcusPerColumn;\n }\n if (!resetInterval)\n resetInterval = mcuExpected;\n var h, v;\n while (mcu < mcuExpected) {\n for (i = 0; i < componentsLength; i++)\n components[i].pred = 0;\n eobrun = 0;\n if (componentsLength == 1) {\n component = components[0];\n for (n = 0; n < resetInterval; n++) {\n decodeBlock(component, decodeFn, mcu);\n mcu++;\n }\n } else {\n for (n = 0; n < resetInterval; n++) {\n for (i = 0; i < componentsLength; i++) {\n component = components[i];\n h = component.h;\n v = component.v;\n for (j = 0; j < v; j++) {\n for (k = 0; k < h; k++) {\n decodeMcu(component, decodeFn, mcu, j, k);\n }\n }\n }\n mcu++;\n if (mcu === mcuExpected)\n break;\n }\n }\n if (mcu === mcuExpected) {\n do {\n if (data[offset] === 255) {\n if (data[offset + 1] !== 0) {\n break;\n }\n }\n offset += 1;\n } while (offset < data.length - 2);\n }\n bitsCount = 0;\n marker = data[offset] << 8 | data[offset + 1];\n if (marker < 65280) {\n throw new Error("marker was not found");\n }\n if (marker >= 65488 && marker <= 65495) {\n offset += 2;\n } else\n break;\n }\n return offset - startOffset;\n }\n function buildComponentData(frame, component) {\n var lines = [];\n var blocksPerLine = component.blocksPerLine;\n var blocksPerColumn = component.blocksPerColumn;\n var samplesPerLine = blocksPerLine << 3;\n var R = new Int32Array(64), r = new Uint8Array(64);\n function quantizeAndInverse(zz, dataOut, dataIn) {\n var qt = component.quantizationTable;\n var v0, v1, v2, v3, v4, v5, v6, v7, t;\n var p = dataIn;\n var i2;\n for (i2 = 0; i2 < 64; i2++)\n p[i2] = zz[i2] * qt[i2];\n for (i2 = 0; i2 < 8; ++i2) {\n var row = 8 * i2;\n if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 && p[4 + row] == 0 && p[5 + row] == 0 && p[6 + row] == 0 && p[7 + row] == 0) {\n t = dctSqrt2 * p[0 + row] + 512 >> 10;\n p[0 + row] = t;\n p[1 + row] = t;\n p[2 + row] = t;\n p[3 + row] = t;\n p[4 + row] = t;\n p[5 + row] = t;\n p[6 + row] = t;\n p[7 + row] = t;\n continue;\n }\n v0 = dctSqrt2 * p[0 + row] + 128 >> 8;\n v1 = dctSqrt2 * p[4 + row] + 128 >> 8;\n v2 = p[2 + row];\n v3 = p[6 + row];\n v4 = dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128 >> 8;\n v7 = dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128 >> 8;\n v5 = p[3 + row] << 4;\n v6 = p[5 + row] << 4;\n t = v0 - v1 + 1 >> 1;\n v0 = v0 + v1 + 1 >> 1;\n v1 = t;\n t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;\n v3 = t;\n t = v4 - v6 + 1 >> 1;\n v4 = v4 + v6 + 1 >> 1;\n v6 = t;\n t = v7 + v5 + 1 >> 1;\n v5 = v7 - v5 + 1 >> 1;\n v7 = t;\n t = v0 - v3 + 1 >> 1;\n v0 = v0 + v3 + 1 >> 1;\n v3 = t;\n t = v1 - v2 + 1 >> 1;\n v1 = v1 + v2 + 1 >> 1;\n v2 = t;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[0 + row] = v0 + v7;\n p[7 + row] = v0 - v7;\n p[1 + row] = v1 + v6;\n p[6 + row] = v1 - v6;\n p[2 + row] = v2 + v5;\n p[5 + row] = v2 - v5;\n p[3 + row] = v3 + v4;\n p[4 + row] = v3 - v4;\n }\n for (i2 = 0; i2 < 8; ++i2) {\n var col = i2;\n if (p[1 * 8 + col] == 0 && p[2 * 8 + col] == 0 && p[3 * 8 + col] == 0 && p[4 * 8 + col] == 0 && p[5 * 8 + col] == 0 && p[6 * 8 + col] == 0 && p[7 * 8 + col] == 0) {\n t = dctSqrt2 * dataIn[i2 + 0] + 8192 >> 14;\n p[0 * 8 + col] = t;\n p[1 * 8 + col] = t;\n p[2 * 8 + col] = t;\n p[3 * 8 + col] = t;\n p[4 * 8 + col] = t;\n p[5 * 8 + col] = t;\n p[6 * 8 + col] = t;\n p[7 * 8 + col] = t;\n continue;\n }\n v0 = dctSqrt2 * p[0 * 8 + col] + 2048 >> 12;\n v1 = dctSqrt2 * p[4 * 8 + col] + 2048 >> 12;\n v2 = p[2 * 8 + col];\n v3 = p[6 * 8 + col];\n v4 = dctSqrt1d2 * (p[1 * 8 + col] - p[7 * 8 + col]) + 2048 >> 12;\n v7 = dctSqrt1d2 * (p[1 * 8 + col] + p[7 * 8 + col]) + 2048 >> 12;\n v5 = p[3 * 8 + col];\n v6 = p[5 * 8 + col];\n t = v0 - v1 + 1 >> 1;\n v0 = v0 + v1 + 1 >> 1;\n v1 = t;\n t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;\n v3 = t;\n t = v4 - v6 + 1 >> 1;\n v4 = v4 + v6 + 1 >> 1;\n v6 = t;\n t = v7 + v5 + 1 >> 1;\n v5 = v7 - v5 + 1 >> 1;\n v7 = t;\n t = v0 - v3 + 1 >> 1;\n v0 = v0 + v3 + 1 >> 1;\n v3 = t;\n t = v1 - v2 + 1 >> 1;\n v1 = v1 + v2 + 1 >> 1;\n v2 = t;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[0 * 8 + col] = v0 + v7;\n p[7 * 8 + col] = v0 - v7;\n p[1 * 8 + col] = v1 + v6;\n p[6 * 8 + col] = v1 - v6;\n p[2 * 8 + col] = v2 + v5;\n p[5 * 8 + col] = v2 - v5;\n p[3 * 8 + col] = v3 + v4;\n p[4 * 8 + col] = v3 - v4;\n }\n for (i2 = 0; i2 < 64; ++i2) {\n var sample2 = 128 + (p[i2] + 8 >> 4);\n dataOut[i2] = sample2 < 0 ? 0 : sample2 > 255 ? 255 : sample2;\n }\n }\n requestMemoryAllocation(samplesPerLine * blocksPerColumn * 8);\n var i, j;\n for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {\n var scanLine = blockRow << 3;\n for (i = 0; i < 8; i++)\n lines.push(new Uint8Array(samplesPerLine));\n for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {\n quantizeAndInverse(component.blocks[blockRow][blockCol], r, R);\n var offset = 0, sample = blockCol << 3;\n for (j = 0; j < 8; j++) {\n var line = lines[scanLine + j];\n for (i = 0; i < 8; i++)\n line[sample + i] = r[offset++];\n }\n }\n }\n return lines;\n }\n function clampTo8bit(a) {\n return a < 0 ? 0 : a > 255 ? 255 : a;\n }\n constructor.prototype = {\n load: function load(path) {\n var xhr = new XMLHttpRequest();\n xhr.open("GET", path, true);\n xhr.responseType = "arraybuffer";\n xhr.onload = function() {\n var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);\n this.parse(data);\n if (this.onload)\n this.onload();\n }.bind(this);\n xhr.send(null);\n },\n parse: function parse(data) {\n var maxResolutionInPixels = this.opts.maxResolutionInMP * 1e3 * 1e3;\n var offset = 0, length = data.length;\n function readUint16() {\n var value = data[offset] << 8 | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length2 = readUint16();\n var array = data.subarray(offset, offset + length2 - 2);\n offset += array.length;\n return array;\n }\n function prepareComponents(frame2) {\n var maxH2 = 1, maxV2 = 1;\n var component2, componentId2;\n for (componentId2 in frame2.components) {\n if (frame2.components.hasOwnProperty(componentId2)) {\n component2 = frame2.components[componentId2];\n if (maxH2 < component2.h)\n maxH2 = component2.h;\n if (maxV2 < component2.v)\n maxV2 = component2.v;\n }\n }\n var mcusPerLine = Math.ceil(frame2.samplesPerLine / 8 / maxH2);\n var mcusPerColumn = Math.ceil(frame2.scanLines / 8 / maxV2);\n for (componentId2 in frame2.components) {\n if (frame2.components.hasOwnProperty(componentId2)) {\n component2 = frame2.components[componentId2];\n var blocksPerLine = Math.ceil(Math.ceil(frame2.samplesPerLine / 8) * component2.h / maxH2);\n var blocksPerColumn = Math.ceil(Math.ceil(frame2.scanLines / 8) * component2.v / maxV2);\n var blocksPerLineForMcu = mcusPerLine * component2.h;\n var blocksPerColumnForMcu = mcusPerColumn * component2.v;\n var blocksToAllocate = blocksPerColumnForMcu * blocksPerLineForMcu;\n var blocks = [];\n requestMemoryAllocation(blocksToAllocate * 256);\n for (var i2 = 0; i2 < blocksPerColumnForMcu; i2++) {\n var row = [];\n for (var j2 = 0; j2 < blocksPerLineForMcu; j2++)\n row.push(new Int32Array(64));\n blocks.push(row);\n }\n component2.blocksPerLine = blocksPerLine;\n component2.blocksPerColumn = blocksPerColumn;\n component2.blocks = blocks;\n }\n }\n frame2.maxH = maxH2;\n frame2.maxV = maxV2;\n frame2.mcusPerLine = mcusPerLine;\n frame2.mcusPerColumn = mcusPerColumn;\n }\n var jfif = null;\n var adobe = null;\n var pixels = null;\n var frame, resetInterval;\n var quantizationTables = [], frames = [];\n var huffmanTablesAC = [], huffmanTablesDC = [];\n var fileMarker = readUint16();\n var malformedDataOffset = -1;\n this.comments = [];\n if (fileMarker != 65496) {\n throw new Error("SOI not found");\n }\n fileMarker = readUint16();\n while (fileMarker != 65497) {\n var i, j, l;\n switch (fileMarker) {\n case 65280:\n break;\n case 65504:\n case 65505:\n case 65506:\n case 65507:\n case 65508:\n case 65509:\n case 65510:\n case 65511:\n case 65512:\n case 65513:\n case 65514:\n case 65515:\n case 65516:\n case 65517:\n case 65518:\n case 65519:\n case 65534:\n var appData = readDataBlock();\n if (fileMarker === 65534) {\n var comment = String.fromCharCode.apply(null, appData);\n this.comments.push(comment);\n }\n if (fileMarker === 65504) {\n if (appData[0] === 74 && appData[1] === 70 && appData[2] === 73 && appData[3] === 70 && appData[4] === 0) {\n jfif = {\n version: { major: appData[5], minor: appData[6] },\n densityUnits: appData[7],\n xDensity: appData[8] << 8 | appData[9],\n yDensity: appData[10] << 8 | appData[11],\n thumbWidth: appData[12],\n thumbHeight: appData[13],\n thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])\n };\n }\n }\n if (fileMarker === 65505) {\n if (appData[0] === 69 && appData[1] === 120 && appData[2] === 105 && appData[3] === 102 && appData[4] === 0) {\n this.exifBuffer = appData.subarray(5, appData.length);\n }\n }\n if (fileMarker === 65518) {\n if (appData[0] === 65 && appData[1] === 100 && appData[2] === 111 && appData[3] === 98 && appData[4] === 101 && appData[5] === 0) {\n adobe = {\n version: appData[6],\n flags0: appData[7] << 8 | appData[8],\n flags1: appData[9] << 8 | appData[10],\n transformCode: appData[11]\n };\n }\n }\n break;\n case 65499:\n var quantizationTablesLength = readUint16();\n var quantizationTablesEnd = quantizationTablesLength + offset - 2;\n while (offset < quantizationTablesEnd) {\n var quantizationTableSpec = data[offset++];\n requestMemoryAllocation(64 * 4);\n var tableData = new Int32Array(64);\n if (quantizationTableSpec >> 4 === 0) {\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = data[offset++];\n }\n } else if (quantizationTableSpec >> 4 === 1) {\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = readUint16();\n }\n } else\n throw new Error("DQT: invalid table spec");\n quantizationTables[quantizationTableSpec & 15] = tableData;\n }\n break;\n case 65472:\n case 65473:\n case 65474:\n readUint16();\n frame = {};\n frame.extended = fileMarker === 65473;\n frame.progressive = fileMarker === 65474;\n frame.precision = data[offset++];\n frame.scanLines = readUint16();\n frame.samplesPerLine = readUint16();\n frame.components = {};\n frame.componentsOrder = [];\n var pixelsInFrame = frame.scanLines * frame.samplesPerLine;\n if (pixelsInFrame > maxResolutionInPixels) {\n var exceededAmount = Math.ceil((pixelsInFrame - maxResolutionInPixels) / 1e6);\n throw new Error(`maxResolutionInMP limit exceeded by ${exceededAmount}MP`);\n }\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n var qId = data[offset + 2];\n if (h <= 0 || v <= 0) {\n throw new Error("Invalid sampling factor, expected values above 0");\n }\n frame.componentsOrder.push(componentId);\n frame.components[componentId] = {\n h,\n v,\n quantizationIdx: qId\n };\n offset += 3;\n }\n prepareComponents(frame);\n frames.push(frame);\n break;\n case 65476:\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength; ) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++) {\n codeLengthSum += codeLengths[j] = data[offset];\n }\n requestMemoryAllocation(16 + codeLengthSum);\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable2(codeLengths, huffmanValues);\n }\n break;\n case 65501:\n readUint16();\n resetInterval = readUint16();\n break;\n case 65500:\n readUint16();\n readUint16();\n break;\n case 65498:\n var scanLength = readUint16();\n var selectorsCount = data[offset++];\n var components = [], component;\n for (i = 0; i < selectorsCount; i++) {\n component = frame.components[data[offset++]];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, this.opts);\n offset += processed;\n break;\n case 65535:\n if (data[offset] !== 255) {\n offset--;\n }\n break;\n default:\n if (data[offset - 3] == 255 && data[offset - 2] >= 192 && data[offset - 2] <= 254) {\n offset -= 3;\n break;\n } else if (fileMarker === 224 || fileMarker == 225) {\n if (malformedDataOffset !== -1) {\n throw new Error(`first unknown JPEG marker at offset ${malformedDataOffset.toString(16)}, second unknown JPEG marker ${fileMarker.toString(16)} at offset ${(offset - 1).toString(16)}`);\n }\n malformedDataOffset = offset - 1;\n const nextOffset = readUint16();\n if (data[offset + nextOffset - 2] === 255) {\n offset += nextOffset - 2;\n break;\n }\n }\n throw new Error("unknown JPEG marker " + fileMarker.toString(16));\n }\n fileMarker = readUint16();\n }\n if (frames.length != 1)\n throw new Error("only single frame JPEGs supported");\n for (var i = 0; i < frames.length; i++) {\n var cp = frames[i].components;\n for (var j in cp) {\n cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx];\n delete cp[j].quantizationIdx;\n }\n }\n this.width = frame.samplesPerLine;\n this.height = frame.scanLines;\n this.jfif = jfif;\n this.adobe = adobe;\n this.components = [];\n for (var i = 0; i < frame.componentsOrder.length; i++) {\n var component = frame.components[frame.componentsOrder[i]];\n this.components.push({\n lines: buildComponentData(frame, component),\n scaleX: component.h / frame.maxH,\n scaleY: component.v / frame.maxV\n });\n }\n },\n getData: function getData(width, height) {\n var scaleX = this.width / width, scaleY = this.height / height;\n var component1, component2, component3, component4;\n var component1Line, component2Line, component3Line, component4Line;\n var x, y;\n var offset = 0;\n var Y, Cb, Cr, K, C, M, Ye, R, G, B;\n var colorTransform;\n var dataLength = width * height * this.components.length;\n requestMemoryAllocation(dataLength);\n var data = new Uint8Array(dataLength);\n switch (this.components.length) {\n case 1:\n component1 = this.components[0];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n data[offset++] = Y;\n }\n }\n break;\n case 2:\n component1 = this.components[0];\n component2 = this.components[1];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n data[offset++] = Y;\n Y = component2Line[0 | x * component2.scaleX * scaleX];\n data[offset++] = Y;\n }\n }\n break;\n case 3:\n colorTransform = true;\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== "undefined")\n colorTransform = !!this.opts.colorTransform;\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n component3Line = component3.lines[0 | y * component3.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n R = component1Line[0 | x * component1.scaleX * scaleX];\n G = component2Line[0 | x * component2.scaleX * scaleX];\n B = component3Line[0 | x * component3.scaleX * scaleX];\n } else {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n Cb = component2Line[0 | x * component2.scaleX * scaleX];\n Cr = component3Line[0 | x * component3.scaleX * scaleX];\n R = clampTo8bit(Y + 1.402 * (Cr - 128));\n G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n B = clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = R;\n data[offset++] = G;\n data[offset++] = B;\n }\n }\n break;\n case 4:\n if (!this.adobe)\n throw new Error("Unsupported color mode (4 components)");\n colorTransform = false;\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== "undefined")\n colorTransform = !!this.opts.colorTransform;\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n component4 = this.components[3];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n component3Line = component3.lines[0 | y * component3.scaleY * scaleY];\n component4Line = component4.lines[0 | y * component4.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n C = component1Line[0 | x * component1.scaleX * scaleX];\n M = component2Line[0 | x * component2.scaleX * scaleX];\n Ye = component3Line[0 | x * component3.scaleX * scaleX];\n K = component4Line[0 | x * component4.scaleX * scaleX];\n } else {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n Cb = component2Line[0 | x * component2.scaleX * scaleX];\n Cr = component3Line[0 | x * component3.scaleX * scaleX];\n K = component4Line[0 | x * component4.scaleX * scaleX];\n C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128));\n M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = 255 - C;\n data[offset++] = 255 - M;\n data[offset++] = 255 - Ye;\n data[offset++] = 255 - K;\n }\n }\n break;\n default:\n throw new Error("Unsupported color mode");\n }\n return data;\n },\n copyToImageData: function copyToImageData(imageData, formatAsRGBA) {\n var width = imageData.width, height = imageData.height;\n var imageDataArray = imageData.data;\n var data = this.getData(width, height);\n var i = 0, j = 0, x, y;\n var Y, K, C, M, R, G, B;\n switch (this.components.length) {\n case 1:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n Y = data[i++];\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 3:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n R = data[i++];\n G = data[i++];\n B = data[i++];\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 4:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n C = data[i++];\n M = data[i++];\n Y = data[i++];\n K = data[i++];\n R = 255 - clampTo8bit(C * (1 - K / 255) + K);\n G = 255 - clampTo8bit(M * (1 - K / 255) + K);\n B = 255 - clampTo8bit(Y * (1 - K / 255) + K);\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n default:\n throw new Error("Unsupported color mode");\n }\n }\n };\n var totalBytesAllocated = 0;\n var maxMemoryUsageBytes = 0;\n function requestMemoryAllocation(increaseAmount = 0) {\n var totalMemoryImpactBytes = totalBytesAllocated + increaseAmount;\n if (totalMemoryImpactBytes > maxMemoryUsageBytes) {\n var exceededAmount = Math.ceil((totalMemoryImpactBytes - maxMemoryUsageBytes) / 1024 / 1024);\n throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB`);\n }\n totalBytesAllocated = totalMemoryImpactBytes;\n }\n constructor.resetMaxMemoryUsage = function(maxMemoryUsageBytes_) {\n totalBytesAllocated = 0;\n maxMemoryUsageBytes = maxMemoryUsageBytes_;\n };\n constructor.getBytesAllocated = function() {\n return totalBytesAllocated;\n };\n constructor.requestMemoryAllocation = requestMemoryAllocation;\n return constructor;\n }();\n if (typeof module !== "undefined") {\n module.exports = decode3;\n } else if (typeof window !== "undefined") {\n window["jpeg-js"] = window["jpeg-js"] || {};\n window["jpeg-js"].decode = decode3;\n }\n function decode3(jpegData, userOpts = {}) {\n var defaultOpts = {\n colorTransform: void 0,\n useTArray: false,\n formatAsRGBA: true,\n tolerantDecoding: true,\n maxResolutionInMP: 100,\n maxMemoryUsageInMB: 512\n };\n var opts = { ...defaultOpts, ...userOpts };\n var arr = new Uint8Array(jpegData);\n var decoder = new JpegImage();\n decoder.opts = opts;\n JpegImage.resetMaxMemoryUsage(opts.maxMemoryUsageInMB * 1024 * 1024);\n decoder.parse(arr);\n var channels = opts.formatAsRGBA ? 4 : 3;\n var bytesNeeded = decoder.width * decoder.height * channels;\n try {\n JpegImage.requestMemoryAllocation(bytesNeeded);\n var image = {\n width: decoder.width,\n height: decoder.height,\n exifBuffer: decoder.exifBuffer,\n data: opts.useTArray ? new Uint8Array(bytesNeeded) : Buffer2.alloc(bytesNeeded)\n };\n if (decoder.comments.length > 0) {\n image["comments"] = decoder.comments;\n }\n } catch (err) {\n if (err instanceof RangeError) {\n throw new Error("Could not allocate enough memory for the image. Required: " + bytesNeeded);\n }\n if (err instanceof ReferenceError) {\n if (err.message === "Buffer is not defined") {\n throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");\n }\n }\n throw err;\n }\n decoder.copyToImageData(image, opts.formatAsRGBA);\n return image;\n }\n }\n});\n\n// node_modules/jpeg-js/index.js\nvar require_jpeg_js = __commonJS({\n "node_modules/jpeg-js/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var encode2 = require_encoder();\n var decode3 = require_decoder();\n module.exports = {\n encode: encode2,\n decode: decode3\n };\n }\n});\n\n// src/processor.worker.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// src/platform.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// src/requests.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar xmlhttprequest;\nif (false)\n xmlhttprequest = typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : typeof GM != "undefined" ? GM.xmlHttpRequest : window["GM_xmlhttpRequest"];\nvar GM_fetch = (...[url, opt, lisn]) => {\n function blobTo(to, blob) {\n if (to == "arrayBuffer" && blob.arrayBuffer) {\n const ret = blob.arrayBuffer();\n if (ret)\n return ret;\n }\n return new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = function(event) {\n if (!event)\n return;\n if (to == "base64")\n resolve(event.target.result);\n else\n resolve(event.target.result);\n };\n if (to == "arrayBuffer")\n fileReader.readAsArrayBuffer(blob);\n else if (to == "base64")\n fileReader.readAsDataURL(blob);\n else if (to == "text")\n fileReader.readAsText(blob, "utf-8");\n else\n reject(new Error("unknown to"));\n });\n }\n return new Promise((resolve, reject) => {\n const gmopt = {\n url: url.toString(),\n data: opt?.body,\n responseType: "blob",\n headers: opt?.headers,\n method: opt?.method || "GET",\n ...lisn ? {\n onprogress: (prog) => {\n if (prog.loaded != prog.total && prog.total != 0)\n lisn.dispatchEvent(new CustomEvent("progress", { detail: [prog.loaded, prog.total] }));\n }\n } : {},\n onload: (resp) => {\n if (resp.status / 100 >= 4) {\n reject(new Error("Server Error: " + resp.status));\n return;\n }\n const blob = resp.response;\n const ref = resp;\n ref.blob = () => Promise.resolve(blob);\n ref.arrayBuffer = () => blobTo("arrayBuffer", blob);\n ref.text = () => blobTo("text", blob);\n ref.json = async () => JSON.parse(await blobTo("text", blob));\n resolve(resp);\n },\n ontimeout: () => reject(new Error("fetch timeout")),\n onerror: (...args) => {\n reject(new Error("fetch error"));\n },\n onabort: () => reject(new Error("fetch abort"))\n };\n xmlhttprequest(gmopt);\n });\n};\n\n// src/platform.ts\nvar lqueue = {};\nvar localLoad = (key2, def) => "__pee__" + key2 in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key2)) : def;\nvar localSet = (key2, value) => localStorage.setItem("__pee__" + key2, JSON.stringify(value));\nvar port1;\nconsole.log("worker", false);\nif (false) {\n const nmc = new MessageChannel();\n port1 = nmc.port1;\n port2 = nmc.port2;\n const iframe = document.createElement("iframe");\n iframe.style.display = "none";\n iframe.name = location.origin;\n const iframeloaded = new Promise((_) => {\n iframe.onload = _;\n });\n iframe.src = `${chrome.runtime.getURL("")}options.html`;\n document.documentElement.appendChild(iframe);\n iframeloaded.then(() => {\n iframe.contentWindow?.postMessage("", "*", [port2]);\n });\n port1.onmessage = (ev) => {\n lqueue[ev.data.id](ev.data);\n };\n}\nconsole.log("worker");\nif (true) {\n port1 = {\n onmessage(ev) {\n lqueue[ev.data.id](ev.data);\n },\n postMessage(msg, tr) {\n postMessage({\n type: "ipc",\n tr,\n msg\n }, tr);\n }\n };\n}\nvar gid = 0;\nvar sendCmd = (cmd, tr) => {\n const prom = new Promise((_) => {\n const id = gid++;\n lqueue[id] = (e) => {\n _(e);\n delete lqueue[id];\n };\n port1.postMessage({ id, ...cmd }, tr || []);\n });\n return prom;\n};\nvar bridge = (name, f) => {\n if (false)\n return f;\n return (...args) => {\n return sendCmd({ name, args });\n };\n};\nvar Bridged = (ctor) => {\n const keys = Object.getOwnPropertyNames(ctor).filter((k) => typeof ctor[k] == "function");\n for (const k of keys)\n ctor[k] = bridge(k, ctor[k]);\n};\nif (false) {\n popupport = chrome.runtime.connect({ name: "popup" });\n popupport.onMessage.addListener((msg) => {\n if (msg.id in pendingcmds) {\n pendingcmds[msg.id](msg);\n delete pendingcmds[msg.id];\n }\n });\n}\nvar Platform = class {\n static async openInTab(src, opts) {\n if (false) {\n return GM.openInTab(src, opts);\n }\n const obj = false ? chrome : browser;\n let i;\n if (opts.insert)\n i = (await obj.tabs.getCurrent()).index + 1;\n return obj.tabs.create({ active: opts.active, url: src, index: i });\n }\n static getValue(name, def) {\n return localLoad(name, def);\n }\n static setValue(name, val) {\n localSet(name, val);\n }\n};\nPlatform.cmdid = 0;\nPlatform = __decorateClass([\n Bridged\n], Platform);\nvar corsFetch = async (input, init2, lsn) => {\n const id = gid++;\n let transfer = [];\n if (init2?.body) {\n if (false) {\n [init2.body, transfer] = await braveserialize(init2.body);\n }\n }\n const prom = new Promise((_, rej) => {\n let gcontroller;\n let buffer = [];\n let finished = false;\n const rs = new ReadableStream({\n start(controller) {\n gcontroller = controller;\n buffer.forEach((b) => gcontroller?.enqueue(b));\n buffer = [];\n if (finished) {\n gcontroller.close();\n }\n }\n });\n let s;\n s = 0;\n const cmdbuff = [];\n lqueue[id] = async (e) => {\n if (e.progress) {\n if (lsn)\n lsn.dispatchEvent(new CustomEvent("progress", { detail: e.progress }));\n }\n if (e.pushData) {\n if (e.s > s) {\n let idx = 0;\n while (idx < cmdbuff.length) {\n if (cmdbuff[idx].s > e.s)\n break;\n idx++;\n }\n cmdbuff.splice(idx, 0, e);\n return;\n }\n const processCmd = (e2) => {\n if (e2.pushData.data) {\n const data = new Uint8Array(e2.pushData.data);\n if (gcontroller)\n gcontroller.enqueue(data);\n else\n buffer.push(data);\n } else {\n if (gcontroller)\n gcontroller?.close();\n else\n finished = true;\n }\n };\n await processCmd(e);\n s++;\n while (cmdbuff[0]?.s == s) {\n await processCmd(cmdbuff.shift());\n s++;\n }\n }\n if (e.setRes) {\n const arrayBuffer = async () => {\n const r = rs.getReader();\n await sendCmd({ name: "fullyRead", fid: id });\n const abs = [];\n let res;\n do {\n res = await r.read();\n if (res.done)\n break;\n abs.push(res.value);\n } while (!res.done);\n const sum = abs.reduce((a, b) => a + b.byteLength, 0);\n const ret = new Uint8Array(sum);\n abs.reduce((ptr, arr) => {\n ret.set(arr, ptr);\n return ptr + arr.byteLength;\n }, 0);\n r.releaseLock();\n return ret;\n };\n const blob = async () => new Blob([await arrayBuffer()]);\n const text = async () => new TextDecoder().decode(await arrayBuffer());\n const json = async () => JSON.parse(await text());\n if (e.ok)\n _({\n body: rs,\n ok: e.ok,\n headers: e.headers,\n redirected: e.redirected,\n type: e.type,\n url: e.url,\n status: e.status,\n bodyUsed: e.bodyUsed,\n statusText: e.statusText,\n clone() {\n return this;\n },\n arrayBuffer,\n blob,\n text,\n json,\n async formData() {\n return new FormData();\n }\n });\n else {\n rej(new Error(`${e.url} - ${e.status}`));\n }\n }\n };\n port1.postMessage({\n id,\n name: "corsFetch",\n args: [input, init2]\n }, transfer);\n });\n return prom;\n};\nasync function getHeaders(s) {\n if (false)\n return headerStringToObject(await GM_head(s));\n const res = await ifetch(s, {\n method: "HEAD"\n });\n return res.headers;\n}\nasync function ifetch(...[url, opt, lisn]) {\n if (true)\n return corsFetch(url.toString(), opt, lisn);\n return GM_fetch(url, opt, lisn);\n}\nasync function* streamRemote(url, chunkSize = 72 * 1024, fetchRestOnNonCanceled = true) {\n let size = Number.POSITIVE_INFINITY;\n let ptr = 0;\n let fetchSize = chunkSize;\n while (ptr != size) {\n let obj;\n const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } });\n if (false) {\n obj = headerStringToObject(fres.responseHeaders);\n } else {\n obj = fres.headers;\n }\n if (!("content-length" in obj)) {\n console.warn("no content lenght???", url);\n break;\n }\n if ("content-range" in obj) {\n size = +obj["content-range"].split("/")[1];\n }\n const len = +obj["content-length"];\n ptr += len;\n if (fetchRestOnNonCanceled)\n fetchSize = size;\n const val = Buffer2.from(await fres.arrayBuffer());\n const e = yield val;\n if (e) {\n break;\n }\n }\n}\n\n// src/pngv3.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer3 = __toESM(require_buffer(), 1);\n\n// src/png.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_crc_32 = __toESM(require_crc32(), 1);\nvar import_buffer = __toESM(require_buffer(), 1);\nvar PNGDecoder = class {\n constructor(reader, strict = true) {\n this.reader = reader;\n this.strict = strict;\n this.req = 8;\n this.ptr = 8;\n this.stopped = false;\n this.repr = import_buffer.Buffer.from([]);\n }\n async catchup() {\n while (this.repr.byteLength < this.req) {\n const chunk = await this.reader.read();\n if (chunk.done) {\n if (this.strict)\n throw new Error(`Unexpected EOF, got ${this.repr.byteLength}, required ${this.req}, ${chunk.value}`);\n this.stopped = true;\n return;\n }\n this.repr = import_buffer.Buffer.concat([this.repr, chunk.value]);\n }\n }\n async *chunks() {\n while (true) {\n this.req += 8;\n await this.catchup();\n if (this.stopped)\n break;\n const length = this.repr.readUInt32BE(this.ptr);\n const name = this.repr.slice(this.ptr + 4, this.ptr + 8).toString();\n this.ptr += 4;\n this.req += length + 4;\n await this.catchup();\n yield [\n name,\n this.repr.slice(this.ptr, this.ptr + length + 4),\n this.ptr + length > this.repr.length ? -1 : this.repr.readUInt32BE(this.ptr + length + 4),\n this.ptr\n ];\n if (this.stopped)\n break;\n this.ptr += length + 8;\n if (name == "IEND")\n break;\n }\n }\n async dtor() {\n }\n};\nvar PNGEncoder = class {\n constructor(bytes) {\n this.writer = bytes.getWriter();\n this.writer.write(import_buffer.Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]));\n }\n async insertchunk(chunk) {\n let b = import_buffer.Buffer.alloc(4);\n const buff = chunk[1];\n b.writeInt32BE(buff.length - 4, 0);\n await this.writer.write(b);\n await this.writer.write(buff);\n b = import_buffer.Buffer.alloc(4);\n b.writeInt32BE((0, import_crc_32.buf)(buff), 0);\n await this.writer.write(b);\n }\n async dtor() {\n this.writer.releaseLock();\n }\n};\n\n// src/utils.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer2 = __toESM(require_buffer(), 1);\n\n// src/assets/hasembed.png\nvar hasembed_default = __toBinary("iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAMFBMVEX+/v3c3c2moZhda1ODfnfKvK49RDgCAgIbHxpsGhv6BQT9hIOV0Hh4pWO03Z//5coEk9oIAAAHdUlEQVR42qWZDXurIAyFhcDJsS31///bKzEWHX6sd2fPVqYbLycJwXXDTiGKSMrDkQKGc8WwjhCHa0WoSY5u5guIYIUk5BuGEc4oUYZTaVztUq4ZWZtSfzulCyPrCAjXEGgT+9vncQhoRtI1I1BnIdEouYecG5FmZPhNRsLn9T4l3fIjwq8gcXlFv9xwXpPriDLcKHjGYeX1RW0J2uBWUid3FsPPm+flz7Qd3FtJbqhzkuSiYHIzcq8Ybb7KiCRju5PlqirdNdLwewlT2u/IcNUrEvyVwzfKAbvEhHS1RrBF6ysK1ZRvGW0DxhbekGOSlGKzfxgIbpyE8XqJEI9W8GZN6ioi2VU9osSWk8jx8byCMC1zw5JHEiIwOY4YHmM8PDx0sZ/Gx6w9JeQcq3JoRZUUFeFLD+G1qBSh6vB4jBchjzI8NpSQE6BNgAiiodQINg4hvF9NxeYY02mFShw+lAogCUCAFhAiW3wpS/wNsGPQphjloP2FmINtkIdJoCSkvH5OIYZUxAURXk0CcsmJaQRi2IVdLGe1dJ7z7ZEkDNApDEFY27drYwRqC1shdR4dIalKBBhbwg3RCB3Edj39KNmnQ1QtZeoQJ4lIijF4kKzQZkaLUq+3zQ0iz+kwwkYFygrZUaahyr7m52TbHYa4gQxFwBT7u0XICtGO0fZFhAfqzskyHV69KkUbxeeefOQ2XjeyXEjx2JQDCgbdUAbTh5fdxr2RSBpFDillUNMmXB9bibxFFGOEIv6z9tqlxSH6CVirNL1nENGrtlCPKJWuNEijNFHlykHxfYCU1vyqXRRFo1CVJAzSU0bVKxsgpKyzoBRrLrTpy7ZWyroZDylm/lxic9ugYhapmvnSAmbfBId0FD2OlZQWB5JiSzWJFBGSHsMNRWGQnkJ2DDdP+SQDJPzk8/wV240esGY67SG6JgTHmVCQCo9JEiNQZZq82sUpdiaUspoOg/YU8n1sJE3zfLBoCGk2INT5aiTFKFoxhl9ro9QS7ijUGA4hzFNVpMKObskZBBTzxSykRUp1xkFjSIB6cRhkRxk1DXsI1zxMroRqw5iJBKRSUjVTaCbEn3SMUzhoJ/jp1hzI6z3vamBalaEEYUOSFWdmzOE6yeAcooNQ47A4efsRJCyhXmKamiIISh0FKhd8qGZIxMRGGQI6iN99z2sf3BGY67BodoDPqOpJEmX0OFo5LIPho9A7yX6jyijUWHugp6RppsBtESs6qiqMkhqlgzSbwb6E4t0CmH4okqu5sE2XWQbDOUTWe2kZVQjKLMr0UwEy9YrKClOcQ8rbjdhSLExWSYVp6oWpV6DWFAnzOcQO1DkJ5Dx428FdP4T5aNU2q6gydlbIMwjs1A7WDV5vY8xieQmnE2U1bRYhmtzKMUTs8eNlkLL0CQRhKcAZg+qU0LBmBXIMYakbJBhEizE0TplSKOdGXOmHFeIAQlmiFd4VQpUCUnReICCMJ5B0AAnKXRVvI1VsR1SEQQBy2YMgKutQoqvihly/SR3EMuAnu0NYjQEWXup0oqir8rSz0kNgrXAHsXr27QHV6UyfxG8vQvM2XG6jhxjZ22KyhnRdXnlfDjJxB+Hr1UP8JKUvN0/nygKJnT+2Humh6iCiSraOFacvlZRxWGWMc4gH4Xvl7TuyjbFWl2DNCUUw/a+IBnFGgxRygRAk/x8iG8jrFBInIfN/QwLCCUQsTss4b3dHTpK+BGo8hlBLg4QpKnZbQb6DSAcxoUKgxSETkv+8K32f+R4iNV5CMUhN3o9Gy/AFBAqEDuInlRDGu26090oKQo6cKDwp4BEkfQUpRYC+ulTFkrKHpP+F1NgjO6T1xE+8yKMTNn8JMQq2ENEqWbYjscuhiV9Vl3fCAg47I1WweBmkSayTfbcbSZ8Xw86IaYnXz1Mq5/BlW1G+XMPOiAkFykJMf1M6hOhW0PhHCCjrzMPWiItI1L9Cco27SVripblItjPyH6NFfmb+QLBrHVn1z9Fqjw5DlxF6zf6NEeup0RK/jGUHyRHyXXAQfrZgvhoErJSCLSRSVZF/v2wwHRtxiD8FcwuBplQx4Xd1hH5BXI2UskAUxVKygcyfjFDG35VR6tuWwpyQhJRBjSIbSJ6gFTKlOr6PlIR+j0AAKyeRkWoQFWqTTBEzJNUSS3eR4kHqApmGNEqFxOH5GBcIdCPa2Z5gfyyH60jhKKBkPXRH1iyE+ob5AqFuZcs3K8R1Og6NUsdh1nOmCOeBQTr5O0tMWeOUbk+RnvEYqsYRglOI0mudFUd+QwmV8Xi6FT2HtHd/kjn6gpJJ+fxr4TFyfObnGURl37Tl18c607zy1crD/mnVIL2XJlX+MlRknqduVkynECoRg/1mAvmr5xSxsnLIdA/xomaVklKZt91FvaxunTQRIqgQyHIQMN8hPBeTG7mFeG+uascmTjBBqMpHczANpucdhHht9LkYekLCksN1wqbHDYQsHcTE/V91GcaOWXvK4xYiW0bplgCA9OKQmRq1UZ7ZY3UDIXZGuAOQ68AApqROabqHlDMjNKlKzGG31a8o/wBpRk19RswBZgAAAABJRU5ErkJggg==");\n\n// src/stores.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/svelte/store/index.mjs\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/svelte/internal/index.mjs\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nfunction noop() {\n}\nfunction run(fn) {\n return fn();\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === "function";\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nvar resolved_promise = Promise.resolve();\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nvar SvelteElement;\nif (typeof HTMLElement === "function") {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: "open" });\n }\n connectedCallback() {\n const { on_mount } = this.$$;\n this.$$.on_disconnect = on_mount.map(run).filter(is_function);\n for (const key2 in this.$$.slotted) {\n this.appendChild(this.$$.slotted[key2]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n disconnectedCallback() {\n run_all(this.$$.on_disconnect);\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n\n// node_modules/svelte/store/index.mjs\nvar subscriber_queue = [];\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = /* @__PURE__ */ new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) {\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe2(run2, invalidate = noop) {\n const subscriber = [run2, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set) || noop;\n }\n run2(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe: subscribe2 };\n}\n\n// src/stores.ts\nvar localLoad2 = async (key2, def) => {\n if (true) {\n return def;\n }\n const isinls = "__pee__" + key2 in localStorage;\n let ret;\n if (isinls) {\n let it = localStorage.getItem("__pee__" + key2);\n if (it === "undefined")\n it = null;\n ret = { ...def, ...JSON.parse(it || "{}") };\n } else\n ret = def;\n if (true) {\n if (isinls) {\n delete localStorage["__pee__" + key2];\n await chrome.storage.local.set({\n [key2]: JSON.stringify(ret)\n });\n } else {\n const d = await chrome.storage.local.get([key2]);\n if (typeof d[key2] == "string")\n return { ...def, ...await JSON.parse("" + d[key2] || "{}") };\n }\n }\n return ret;\n};\nvar localSet2 = (key2, value) => {\n if (true) {\n return;\n }\n if (true)\n chrome.storage.local.set({ [key2]: JSON.stringify(value) });\n else\n localStorage.setItem("__pee__" + key2, JSON.stringify(value));\n};\nvar initial_settings = localLoad2("settingsv2", {\n loop: true,\n dh: false,\n pmeth: 5,\n xpv: false,\n xpi: false,\n hyd: false,\n notcata: false,\n ak: "",\n auto_embed: 0,\n auto_tags: "",\n te: false,\n eye: false,\n ca: false,\n pre: false,\n prev: false,\n sh: false,\n ep: false,\n tm: false,\n dvc: false,\n expte: false,\n mdist: -1,\n phash: false,\n hotlink: false,\n jpeg: false,\n vercheck: false,\n cache: void 0,\n fhost: 0,\n maxe: 5,\n conc: 8,\n ho: false,\n blacklist: [],\n rsources: []\n});\nvar settings = writable();\ninitial_settings.then((v) => {\n settings.set(v);\n});\nvar appState = writable({\n isCatalog: false,\n is4chanX: false,\n akValid: false,\n herror: "",\n client: null,\n foundPosts: []\n});\nsettings.subscribe((newVal) => {\n localSet2("settingsv2", newVal);\n});\n\n// src/filehosts.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nfunction parseForm(data) {\n const form = new FormData();\n Object.entries(data).filter(([key2, value]) => value !== null).map(([key2, value]) => form.append(key2, value));\n return form;\n}\nvar lolisafe = (domain, serving = domain) => ({\n domain,\n serving,\n async uploadFile(f) {\n const resp = await ifetch(`https://${domain}/api/upload`, {\n headers: {\n accept: "application/json"\n },\n "body": parseForm({\n reqtype: "fileupload",\n "files[]": new File([f], "f.pee")\n }),\n "method": "POST"\n });\n const res = await resp.json();\n return res.files.map((e) => e.url)[0];\n }\n});\nvar catbox = (domain, serving) => ({\n domain,\n serving,\n async uploadFile(inj) {\n const resp = await ifetch(`https://${domain}/user/api.php`, {\n method: "POST",\n body: parseForm({\n reqtype: "fileupload",\n fileToUpload: inj\n })\n });\n return resp.text();\n }\n});\nvar filehosts = [\n catbox("catbox.moe", "files.catbox.moe"),\n catbox("pomf.moe", "a.pomf.cat"),\n lolisafe("take-me-to.space"),\n lolisafe("zz.ht", "z.zz.fo")\n];\n\n// node_modules/file-type/browser.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_node_buffer4 = __toESM(require_buffer(), 1);\nvar import_readable_web_to_node_stream = __toESM(require_lib(), 1);\n\n// node_modules/file-type/core.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_node_buffer3 = __toESM(require_buffer(), 1);\n\n// node_modules/token-types/lib/index.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar ieee754 = __toESM(require_ieee754(), 1);\nvar import_node_buffer = __toESM(require_buffer(), 1);\nvar AnsiStringType = class {\n constructor(len) {\n this.len = len;\n }\n static decode(buffer, offset, until) {\n let str = "";\n for (let i = offset; i < until; ++i) {\n str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i]));\n }\n return str;\n }\n static inRange(a, min, max) {\n return min <= a && a <= max;\n }\n static codePointToString(cp) {\n if (cp <= 65535) {\n return String.fromCharCode(cp);\n } else {\n cp -= 65536;\n return String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320);\n }\n }\n static singleByteDecoder(bite) {\n if (AnsiStringType.inRange(bite, 0, 127)) {\n return bite;\n }\n const codePoint = AnsiStringType.windows1252[bite - 128];\n if (codePoint === null) {\n throw Error("invaliding encoding");\n }\n return codePoint;\n }\n get(buffer, offset = 0) {\n return AnsiStringType.decode(buffer, offset, offset + this.len);\n }\n};\nAnsiStringType.windows1252 = [\n 8364,\n 129,\n 8218,\n 402,\n 8222,\n 8230,\n 8224,\n 8225,\n 710,\n 8240,\n 352,\n 8249,\n 338,\n 141,\n 381,\n 143,\n 144,\n 8216,\n 8217,\n 8220,\n 8221,\n 8226,\n 8211,\n 8212,\n 732,\n 8482,\n 353,\n 8250,\n 339,\n 157,\n 382,\n 376,\n 160,\n 161,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 171,\n 172,\n 173,\n 174,\n 175,\n 176,\n 177,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 187,\n 188,\n 189,\n 190,\n 191,\n 192,\n 193,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 203,\n 204,\n 205,\n 206,\n 207,\n 208,\n 209,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 219,\n 220,\n 221,\n 222,\n 223,\n 224,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 235,\n 236,\n 237,\n 238,\n 239,\n 240,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250,\n 251,\n 252,\n 253,\n 254,\n 255\n];\n\n// node_modules/strtok3/lib/core.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/strtok3/lib/ReadStreamTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/strtok3/lib/AbstractTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/index.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/EndOfFileStream.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/StreamReader.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/Deferred.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/StreamReader.js\nvar maxStreamReadSize = 1 * 1024 * 1024;\n\n// node_modules/strtok3/lib/AbstractTokenizer.js\nvar import_node_buffer2 = __toESM(require_buffer(), 1);\n\n// node_modules/strtok3/lib/BufferTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/file-type/util.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/file-type/supported.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar extensions = [\n "jpg",\n "png",\n "apng",\n "gif",\n "webp",\n "flif",\n "xcf",\n "cr2",\n "cr3",\n "orf",\n "arw",\n "dng",\n "nef",\n "rw2",\n "raf",\n "tif",\n "bmp",\n "icns",\n "jxr",\n "psd",\n "indd",\n "zip",\n "tar",\n "rar",\n "gz",\n "bz2",\n "7z",\n "dmg",\n "mp4",\n "mid",\n "mkv",\n "webm",\n "mov",\n "avi",\n "mpg",\n "mp2",\n "mp3",\n "m4a",\n "oga",\n "ogg",\n "ogv",\n "opus",\n "flac",\n "wav",\n "spx",\n "amr",\n "pdf",\n "epub",\n "elf",\n "exe",\n "swf",\n "rtf",\n "wasm",\n "woff",\n "woff2",\n "eot",\n "ttf",\n "otf",\n "ico",\n "flv",\n "ps",\n "xz",\n "sqlite",\n "nes",\n "crx",\n "xpi",\n "cab",\n "deb",\n "ar",\n "rpm",\n "Z",\n "lz",\n "cfb",\n "mxf",\n "mts",\n "blend",\n "bpg",\n "docx",\n "pptx",\n "xlsx",\n "3gp",\n "3g2",\n "jp2",\n "jpm",\n "jpx",\n "mj2",\n "aif",\n "qcp",\n "odt",\n "ods",\n "odp",\n "xml",\n "mobi",\n "heic",\n "cur",\n "ktx",\n "ape",\n "wv",\n "dcm",\n "ics",\n "glb",\n "pcap",\n "dsf",\n "lnk",\n "alias",\n "voc",\n "ac3",\n "m4v",\n "m4p",\n "m4b",\n "f4v",\n "f4p",\n "f4b",\n "f4a",\n "mie",\n "asf",\n "ogm",\n "ogx",\n "mpc",\n "arrow",\n "shp",\n "aac",\n "mp1",\n "it",\n "s3m",\n "xm",\n "ai",\n "skp",\n "avif",\n "eps",\n "lzh",\n "pgp",\n "asar",\n "stl",\n "chm",\n "3mf",\n "zst",\n "jxl",\n "vcf"\n];\nvar mimeTypes = [\n "image/jpeg",\n "image/png",\n "image/gif",\n "image/webp",\n "image/flif",\n "image/x-xcf",\n "image/x-canon-cr2",\n "image/x-canon-cr3",\n "image/tiff",\n "image/bmp",\n "image/vnd.ms-photo",\n "image/vnd.adobe.photoshop",\n "application/x-indesign",\n "application/epub+zip",\n "application/x-xpinstall",\n "application/vnd.oasis.opendocument.text",\n "application/vnd.oasis.opendocument.spreadsheet",\n "application/vnd.oasis.opendocument.presentation",\n "application/vnd.openxmlformats-officedocument.wordprocessingml.document",\n "application/vnd.openxmlformats-officedocument.presentationml.presentation",\n "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",\n "application/zip",\n "application/x-tar",\n "application/x-rar-compressed",\n "application/gzip",\n "application/x-bzip2",\n "application/x-7z-compressed",\n "application/x-apple-diskimage",\n "application/x-apache-arrow",\n "video/mp4",\n "audio/midi",\n "video/x-matroska",\n "video/webm",\n "video/quicktime",\n "video/vnd.avi",\n "audio/vnd.wave",\n "audio/qcelp",\n "audio/x-ms-asf",\n "video/x-ms-asf",\n "application/vnd.ms-asf",\n "video/mpeg",\n "video/3gpp",\n "audio/mpeg",\n "audio/mp4",\n "audio/opus",\n "video/ogg",\n "audio/ogg",\n "application/ogg",\n "audio/x-flac",\n "audio/ape",\n "audio/wavpack",\n "audio/amr",\n "application/pdf",\n "application/x-elf",\n "application/x-msdownload",\n "application/x-shockwave-flash",\n "application/rtf",\n "application/wasm",\n "font/woff",\n "font/woff2",\n "application/vnd.ms-fontobject",\n "font/ttf",\n "font/otf",\n "image/x-icon",\n "video/x-flv",\n "application/postscript",\n "application/eps",\n "application/x-xz",\n "application/x-sqlite3",\n "application/x-nintendo-nes-rom",\n "application/x-google-chrome-extension",\n "application/vnd.ms-cab-compressed",\n "application/x-deb",\n "application/x-unix-archive",\n "application/x-rpm",\n "application/x-compress",\n "application/x-lzip",\n "application/x-cfb",\n "application/x-mie",\n "application/mxf",\n "video/mp2t",\n "application/x-blender",\n "image/bpg",\n "image/jp2",\n "image/jpx",\n "image/jpm",\n "image/mj2",\n "audio/aiff",\n "application/xml",\n "application/x-mobipocket-ebook",\n "image/heif",\n "image/heif-sequence",\n "image/heic",\n "image/heic-sequence",\n "image/icns",\n "image/ktx",\n "application/dicom",\n "audio/x-musepack",\n "text/calendar",\n "text/vcard",\n "model/gltf-binary",\n "application/vnd.tcpdump.pcap",\n "audio/x-dsf",\n "application/x.ms.shortcut",\n "application/x.apple.alias",\n "audio/x-voc",\n "audio/vnd.dolby.dd-raw",\n "audio/x-m4a",\n "image/apng",\n "image/x-olympus-orf",\n "image/x-sony-arw",\n "image/x-adobe-dng",\n "image/x-nikon-nef",\n "image/x-panasonic-rw2",\n "image/x-fujifilm-raf",\n "video/x-m4v",\n "video/3gpp2",\n "application/x-esri-shape",\n "audio/aac",\n "audio/x-it",\n "audio/x-s3m",\n "audio/x-xm",\n "video/MP1S",\n "video/MP2P",\n "application/vnd.sketchup.skp",\n "image/avif",\n "application/x-lzh-compressed",\n "application/pgp-encrypted",\n "application/x-asar",\n "model/stl",\n "application/vnd.ms-htmlhelp",\n "model/3mf",\n "image/jxl",\n "application/zstd"\n];\n\n// node_modules/file-type/core.js\nvar supportedExtensions = new Set(extensions);\nvar supportedMimeTypes = new Set(mimeTypes);\n\n// src/utils.ts\nvar csettings;\nsettings.subscribe((b) => {\n csettings = b;\n});\nvar threadDataCache = writable();\nvar cthreadDataCache;\nthreadDataCache.subscribe((newval) => {\n cthreadDataCache = newval;\n});\nvar decodeCoom3Payload = async (buff) => {\n if (!csettings)\n throw new Error("Settings uninit");\n const allowed_domains = filehosts.map((e) => e.serving.replaceAll(".", "\\\\."));\n const pees = buff.toString().split(" ").slice(0, csettings.maxe).filter((e) => allowed_domains.some((v) => e.match(`https://(.*\\\\.)?${v}/`)));\n return (await Promise.all(pees.map(async (pee) => {\n try {\n const m = pee.match(/(?https?):\\/\\/(?.*?)(?\\/.*)/);\n if (!m)\n return;\n const { domain, file } = m.groups;\n const headers = await getHeaders(pee);\n const res = await ifetch(pee, {\n headers: { range: "bytes=0-32767", "user-agent": "" },\n mode: "cors",\n referrerPolicy: "no-referrer"\n });\n const size = +headers["content-length"] || 0;\n const header = import_buffer2.Buffer.from(await res.arrayBuffer());\n let hptr = 0;\n if (header.slice(0, 4).toString() == "PEE\\0")\n hptr += 4;\n else\n return;\n const flags = header[hptr];\n const hasFn = !!(flags & 1);\n const hasTags = !!(flags & 2);\n const hasThumbnail = !!(flags & 4);\n let [ptr, ptr2] = [hptr + 1, hptr + 1];\n let fn = "embedded";\n let tags = [];\n let thumb = import_buffer2.Buffer.from(hasembed_default);\n if (hasFn) {\n while (header[ptr2] != 0)\n ptr2++;\n fn = header.slice(ptr, ptr2).toString();\n ptr = ++ptr2;\n }\n if (hasTags) {\n while (header[ptr2] != 0)\n ptr2++;\n tags = header.slice(ptr, ptr2).toString().split(/\\s+/);\n }\n let thumbsize = 0;\n if (hasThumbnail) {\n thumbsize = header.readInt32LE(ptr);\n ptr += 4;\n if (header.byteLength >= ptr + thumbsize)\n thumb = header.slice(ptr, ptr + thumbsize);\n else\n thumb = import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer());\n ptr += thumbsize;\n }\n const unzip = { url: pee, headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } };\n let data;\n data = unzip;\n if (size < 3072) {\n thumb = data = import_buffer2.Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer());\n }\n return {\n filename: fn,\n data,\n thumbnail: thumb\n };\n } catch (e) {\n console.warn(e);\n }\n }))).filter((e) => e).map((e) => e);\n};\n\n// src/pngv3.ts\nvar bs58 = __toESM(require_bs58(), 1);\n\n// src/bitstream.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar revbyte = (n, len = 8) => {\n let acc = 0;\n let n2 = n;\n let len2 = len;\n while (len2) {\n acc = acc * 2 + (n2 & 1);\n n2 >>= 1;\n len2--;\n }\n return acc;\n};\nvar BitstreamReader = class {\n constructor() {\n this.buffers = [];\n this.bufferedLength = 0;\n this._offsetIntoBuffer = 0;\n this._bufferIndex = 0;\n this._offset = 0;\n this.skippedLength = 0;\n }\n get bufferIndex() {\n return this._bufferIndex;\n }\n get offset() {\n return this._offset;\n }\n get available() {\n return this.bufferedLength - this.skippedLength;\n }\n getBit(offset) {\n const byte = this.buffers[0][offset >> 3];\n return +!!(byte & 1 << (offset & 7));\n }\n readSync(length) {\n let value = 0;\n if (this._offset >> 3 > this.buffers[0].byteLength) {\n throw "Out of data";\n }\n for (let i = length - 1; i >= 0; --i) {\n value = value * 2 + this.getBit(this._offset + i);\n }\n this._offset += length;\n this.bufferedLength -= length;\n return value;\n }\n addBuffer(buffer) {\n this.buffers.push(buffer);\n this.bufferedLength += buffer.length * 8;\n }\n};\nvar BitstreamWriter = class {\n constructor(stream, bufferSize = 1) {\n this.stream = stream;\n this.pendingBits = 0;\n this.bufferoffset = 0;\n this._offset = 0;\n bufferSize = 1;\n this.buffer = new Uint8Array(bufferSize);\n }\n get offset() {\n return this._offset;\n }\n get byteOffset() {\n return this.pendingBits;\n }\n end() {\n this.flush();\n }\n flush() {\n this.stream.write(new Uint8Array(this.buffer));\n this.bufferoffset = 0;\n this.buffer.fill(0);\n }\n setBit(b) {\n let byte = this.buffer[0];\n byte |= b << (this._offset & 7);\n this.buffer[0] = byte;\n this._offset += 1;\n if (++this.bufferoffset == this.buffer.length * 8) {\n this.flush();\n }\n }\n write(length, value) {\n while (length--) {\n this.setBit(value & 1);\n value >>= 1;\n }\n }\n};\n\n// src/dh-deflate.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar TINF_OK = 0;\nvar Tree = class {\n constructor() {\n this.table = new Uint16Array(16);\n this.trans = new Uint16Array(288);\n }\n};\nvar getPathTo = (tree, value) => {\n if (tree[0] === value)\n return "0";\n if (tree[1] === value)\n return "1";\n let p;\n if (typeof tree[0] != "number")\n p = getPathTo(tree[0], value);\n let b = "0";\n if (!p) {\n if (tree[1] && typeof tree[1] != "number")\n p = getPathTo(tree[1], value);\n b = "1";\n }\n if (p)\n return b + p;\n};\nfunction buildHuffmanTable(codeLengths, values) {\n let k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({ children: [], index: 0 });\n let p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error("Could not recreate Huffman Table");\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n}\nvar Data = class {\n constructor(source, dests, to_hide, hidden) {\n this.source = source;\n this.dests = dests;\n this.to_hide = to_hide;\n this.hidden = hidden;\n this.pathMap = /* @__PURE__ */ new Map();\n this.dest = [];\n this.ltree = new Tree();\n this.dtree = new Tree();\n }\n computeReverse() {\n this.rltree = buildHuffmanTable(this.ltree.table, this.ltree.trans)[0];\n this.rdtree = buildHuffmanTable(this.dtree.table, this.dtree.trans)[0];\n this.adists = new Set(this.rdtree.flat(16));\n }\n};\nvar sltree = new Tree();\nvar sdtree = new Tree();\nvar rltree;\nvar rdtree;\nvar sadist;\nvar length_bits = new Uint8Array(30);\nvar length_base = new Uint16Array(30);\nvar dist_bits = new Uint8Array(30);\nvar dist_base = new Uint16Array(30);\nvar clcidx = new Uint8Array([\n 16,\n 17,\n 18,\n 0,\n 8,\n 7,\n 9,\n 6,\n 10,\n 5,\n 11,\n 4,\n 12,\n 3,\n 13,\n 2,\n 14,\n 1,\n 15\n]);\nvar code_tree = new Tree();\nvar lengths = new Uint8Array(288 + 32);\nfunction tinf_build_bits_base(bits, base, delta, first) {\n let i, sum;\n for (i = 0; i < delta; ++i)\n bits[i] = 0;\n for (i = 0; i < 30 - delta; ++i)\n bits[i + delta] = i / delta | 0;\n for (sum = first, i = 0; i < 30; ++i) {\n base[i] = sum;\n sum += 1 << bits[i];\n }\n}\nfunction tinf_build_fixed_trees(lt, dt) {\n let i;\n for (i = 0; i < 7; ++i)\n lt.table[i] = 0;\n lt.table[7] = 24;\n lt.table[8] = 152;\n lt.table[9] = 112;\n for (i = 0; i < 24; ++i)\n lt.trans[i] = 256 + i;\n for (i = 0; i < 144; ++i)\n lt.trans[24 + i] = i;\n for (i = 0; i < 8; ++i)\n lt.trans[24 + 144 + i] = 280 + i;\n for (i = 0; i < 112; ++i)\n lt.trans[24 + 144 + 8 + i] = 144 + i;\n for (i = 0; i < 5; ++i)\n dt.table[i] = 0;\n dt.table[5] = 32;\n for (i = 0; i < 32; ++i)\n dt.trans[i] = i;\n}\nvar offs = new Uint16Array(16);\nfunction tinf_build_tree(t, lengths2, off, num) {\n let i, sum;\n for (i = 0; i < 16; ++i)\n t.table[i] = 0;\n for (i = 0; i < num; ++i)\n t.table[lengths2[off + i]]++;\n t.table[0] = 0;\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum;\n sum += t.table[i];\n }\n for (i = 0; i < num; ++i) {\n if (lengths2[off + i])\n t.trans[offs[lengths2[off + i]]++] = i;\n }\n}\nfunction tinf_getbit(d) {\n const v = d.source.readSync(1);\n return v;\n}\nvar loff = 0;\nvar loffs = [];\nfunction tinf_read_bits(d, num, base) {\n if (!num)\n return base;\n const v = d.source.readSync(num) + base;\n loff = v;\n loffs.push(v);\n if (loffs.length > 4) {\n loffs.shift();\n }\n return v;\n}\nfunction tinf_decode_symbol(d, t, copy = true, ext = {}) {\n let sum = 0, cur = 0, len = 0;\n let s = 0;\n do {\n const b = d.source.readSync(1);\n copy && d.hidden?.write(1, b);\n s = s << 1 | b;\n cur = 2 * cur + b;\n ++len;\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n ext.length = len;\n ext.sym = s;\n return t.trans[sum + cur];\n}\nfunction tinf_decode_trees(d, lt, dt, copy = true) {\n let i, num, length;\n const hlit = tinf_read_bits(d, 5, 257);\n copy && d.hidden?.write(5, hlit - 257);\n const hdist = tinf_read_bits(d, 5, 1);\n copy && d.hidden?.write(5, hdist - 1);\n const hclen = tinf_read_bits(d, 4, 4);\n copy && d.hidden?.write(4, hclen - 4);\n for (i = 0; i < 19; ++i)\n lengths[i] = 0;\n for (i = 0; i < hclen; ++i) {\n const clen = tinf_read_bits(d, 3, 0);\n copy && d.hidden?.write(3, clen);\n lengths[clcidx[i]] = clen;\n }\n tinf_build_tree(code_tree, lengths, 0, 19);\n for (num = 0; num < hlit + hdist; ) {\n const sym = tinf_decode_symbol(d, code_tree, copy);\n let prev;\n switch (sym) {\n case 16:\n prev = lengths[num - 1];\n length = tinf_read_bits(d, 2, 3);\n copy && d.hidden?.write(2, length - 3);\n for (; length; --length) {\n lengths[num++] = prev;\n }\n break;\n case 17:\n length = tinf_read_bits(d, 3, 3);\n copy && d.hidden?.write(3, length - 3);\n for (; length; --length) {\n lengths[num++] = 0;\n }\n break;\n case 18:\n length = tinf_read_bits(d, 7, 11);\n copy && d.hidden?.write(7, length - 11);\n for (; length; --length) {\n lengths[num++] = 0;\n }\n break;\n default:\n lengths[num++] = sym;\n break;\n }\n }\n tinf_build_tree(lt, lengths, 0, hlit);\n tinf_build_tree(dt, lengths, hlit, hdist);\n}\nvar get_symbol = (value, bits_table, base_table) => {\n let i = 0;\n for (i = 0; i < base_table.length; ++i) {\n if (base_table[i] > value) {\n i--;\n return [i, bits_table[i], value - base_table[i]];\n }\n }\n i--;\n return [i, bits_table[i], value - base_table[i]];\n};\nvar encode_symbol = (sym, tree, pathMap) => {\n const code = getPathTo(tree, sym);\n const v = {\n length: code?.length,\n val: parseInt(code, 2)\n };\n return v;\n};\nvar capacity = 0;\nfunction tinf_inflate_block_data(d, lt, dt) {\n while (1) {\n let sym = tinf_decode_symbol(d, lt);\n if (sym === 256) {\n return TINF_OK;\n }\n if (sym < 256) {\n d.dest.push(sym);\n } else {\n sym -= 257;\n const length = tinf_read_bits(d, length_bits[sym], length_base[sym]);\n if (length_bits[sym])\n d.hidden?.write(length_bits[sym], length - length_base[sym]);\n const ext = { length: 0, sym: 0 };\n const dist = tinf_decode_symbol(d, dt, false, ext);\n let backoffset = tinf_read_bits(d, dist_bits[dist], dist_base[dist]);\n const offs2 = d.dest.length - backoffset;\n let match;\n const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader && d.to_hide.available == 0;\n if (!skip && (match = Buffer2.from(d.dest.slice(offs2, offs2 + length))).length == length) {\n let begin = d.dest.length - 32768;\n if (begin < 0)\n begin = 0;\n let matches = [];\n let o = 0;\n const slic = Buffer2.from(d.dest.slice(begin + o, d.dest.length));\n while (begin + o < d.dest.length) {\n const r = slic.slice(o, d.dest.length).indexOf(match);\n if (r >= 0) {\n matches.push(r + begin + o);\n o += r;\n } else {\n break;\n }\n o++;\n }\n if (matches.length > 1) {\n matches = matches.map((e) => -(e - d.dest.length)).filter((e) => {\n const [dsym2] = get_symbol(e, dist_bits, dist_base);\n return d.adists.has(dsym2);\n });\n matches.reverse();\n const v = Math.floor(Math.log2(matches.length));\n capacity += v;\n if (d.to_hide instanceof BitstreamReader) {\n if (d.to_hide.available) {\n const s = d.to_hide.readSync(Math.min(d.to_hide.available, v));\n backoffset = matches[s];\n }\n } else {\n const idx = matches.indexOf(backoffset);\n d.to_hide.write(v, idx);\n }\n }\n }\n const [dsym, dlen, doff] = get_symbol(backoffset, dist_bits, dist_base);\n const encdist = encode_symbol(dsym, d.rdtree, d.pathMap);\n d.hidden?.write(encdist.length, revbyte(encdist.val, encdist.length));\n d.hidden?.write(dlen, doff);\n for (let i = offs2; i < offs2 + length; ++i) {\n d.dest.push(d.dest[i]);\n }\n }\n }\n}\nfunction tinf_inflate_uncompressed_block(d) {\n if (d.source.offset & 7)\n d.source.readSync(8 - d.source.offset & 7);\n if (d.hidden && d.hidden.offset & 7)\n d.hidden?.write(8 - d.hidden.offset & 7, 0);\n const length = d.source.readSync(16);\n d.hidden?.write(16, length);\n const invlength = d.source.readSync(16);\n d.hidden?.write(16, invlength);\n if (length !== (~invlength & 65535)) {\n return -4;\n }\n for (let i = length; i; --i) {\n const v = d.source.readSync(8);\n d.dest.push(v);\n d.hidden?.write(8, v);\n }\n return TINF_OK;\n}\nfunction tinf_uncompress(source, decompressed, to_hide, hidden, opt = 0) {\n const decomp = decompressed ? new BitstreamWriter({ write: decompressed }) : null;\n const hid = hidden && new BitstreamWriter({ write: hidden }, 4);\n const d = new Data(source, decomp, to_hide, hid);\n let res;\n let bfinal, btype;\n do {\n bfinal = tinf_getbit(d);\n d.hidden?.write(1, bfinal);\n btype = tinf_read_bits(d, 2, 0);\n d.hidden?.write(2, btype);\n switch (btype) {\n case 0:\n res = tinf_inflate_uncompressed_block(d);\n break;\n case 1:\n d.rdtree = rdtree;\n d.rltree = rltree;\n d.adists = sadist;\n res = tinf_inflate_block_data(d, sltree, sdtree);\n break;\n case 2:\n tinf_decode_trees(d, d.ltree, d.dtree);\n d.computeReverse();\n res = tinf_inflate_block_data(d, d.ltree, d.dtree);\n break;\n default:\n res = -2;\n }\n if (res !== TINF_OK)\n throw new Error("Data error " + res);\n } while (!bfinal);\n decomp?.end();\n hid?.end();\n}\ntinf_build_fixed_trees(sltree, sdtree);\ntinf_build_bits_base(length_bits, length_base, 4, 3);\ntinf_build_bits_base(dist_bits, dist_base, 2, 1);\nrltree = buildHuffmanTable(sltree.table, sltree.trans)[0];\nrdtree = buildHuffmanTable(sdtree.table, sdtree.trans)[0];\nsadist = new Set(rdtree.flat(16));\nlength_bits[28] = 0;\nlength_base[28] = 258;\n\n// src/pngv3.ts\nvar csettings2;\nsettings.subscribe((b) => {\n csettings2 = b;\n});\nvar CUM3 = import_buffer3.Buffer.from("doo\\0m");\nvar CUM4 = import_buffer3.Buffer.from("voo\\0m");\nvar CUM5 = import_buffer3.Buffer.from("boo\\0");\nvar CUM6 = import_buffer3.Buffer.from("Creation Time\\0");\nvar CUM7 = import_buffer3.Buffer.from("Software\\0");\nvar BufferReadStream = (b) => {\n const ret = new ReadableStream({\n pull(cont) {\n cont.enqueue(b);\n cont.close();\n }\n });\n return ret;\n};\nvar password = import_buffer3.Buffer.from("NOA");\nvar xor = (a, p) => {\n let n = 0;\n for (let i = 0; i < a.byteLength; ++i) {\n a[i] ^= p[n];\n n++;\n n %= p.byteLength;\n }\n};\nvar prefs = {\n "files.catbox.moe": "c",\n "a.pomf.cat": "p",\n "take-me-to.space": "t",\n "z.zz.fo": "z"\n};\nvar rprefs = {\n "c": "files.catbox.moe",\n "p": "a.pomf.cat",\n "t": "take-me-to.space",\n "z": "z.zz.fo"\n};\nvar extractFromRawDeflate = (b) => {\n const src = new BitstreamReader();\n src.addBuffer(b);\n const chnks = [];\n const hidden = new BitstreamWriter({\n write(chunk) {\n for (const i of chunk) {\n if (i)\n chnks.push(i);\n else\n throw "Finish";\n }\n }\n });\n try {\n tinf_uncompress(src, void 0, hidden, void 0);\n } catch (e) {\n if (e == "Finish")\n return import_buffer3.Buffer.from(chnks);\n }\n return false;\n};\nvar extract = async (png, doextract = true) => {\n const reader = BufferReadStream(png).getReader();\n const sneed = new PNGDecoder(reader, false);\n const ret = [];\n let w;\n if (!csettings2)\n throw new Error("Settings uninit");\n try {\n let complete = false;\n const idats = [];\n for await (const [name, chunk, crc, offset] of sneed.chunks()) {\n let buff;\n switch (name) {\n case "tEXt":\n buff = chunk;\n if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) {\n if (!doextract)\n return true;\n const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length));\n ret.push(...k.filter((e) => e));\n }\n if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) {\n if (!doextract)\n return true;\n const passed = buff.slice(4 + CUM4.length);\n xor(passed, password);\n const k = await decodeCoom3Payload(passed);\n ret.push(...k.filter((e) => e));\n }\n if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) {\n if (!doextract)\n return true;\n const passed = buff.slice(4 + CUM5.length);\n const decoded = import_buffer3.Buffer.from(passed.toString(), "base64").toString().split(" ").map((e) => {\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded));\n ret.push(...k.filter((e) => e));\n }\n if (w = [CUM6, CUM7].find((e) => buff.slice(4, 4 + e.length).equals(e))) {\n const passed = buff.slice(4 + w.length);\n if (!passed.toString().match(/^[0-9a-zA-Z+/=]+$/g))\n continue;\n const decoders = [\n (b) => import_buffer3.Buffer.from(b.toString(), "base64").toString(),\n (b) => import_buffer3.Buffer.from(bs58.decode(passed.toString())).toString()\n ];\n for (const d of decoders) {\n try {\n const decoded = d(passed).split(" ").map((e) => {\n if (!(e[0] in rprefs))\n throw "Uhh";\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n if (!doextract)\n return true;\n const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded));\n ret.push(...k.filter((e) => e));\n } catch (e) {\n }\n }\n }\n break;\n case "IDAT":\n if (ret.length)\n return ret;\n buff = chunk;\n idats.push(buff.slice(4));\n break;\n case "IEND":\n complete = true;\n default:\n break;\n }\n }\n if (idats.length) {\n let decoded;\n if ((decoded = extractFromRawDeflate(import_buffer3.Buffer.concat(idats).slice(2))) === false)\n return false;\n const dec = decoded.toString().split(" ").map((e) => {\n if (!(e[0] in rprefs))\n throw "Uhh";\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n if (doextract)\n return decodeCoom3Payload(import_buffer3.Buffer.from(dec));\n return true;\n }\n } catch (e) {\n if (e != "Uhh")\n console.error(e);\n } finally {\n reader.releaseLock();\n }\n};\nvar buildChunk = (tag, data) => {\n const ret = import_buffer3.Buffer.alloc(data.byteLength + 4);\n ret.write(tag.slice(0, 4), 0);\n data.copy(ret, 4);\n return ret;\n};\nvar BufferWriteStream = () => {\n let b = import_buffer3.Buffer.from([]);\n const ret = new WritableStream({\n write(chunk) {\n b = import_buffer3.Buffer.concat([b, chunk]);\n console.log("finished appending");\n }\n });\n return [ret, () => b];\n};\nvar embedInRawDeflate = (b, h) => {\n const src = new BitstreamReader();\n const hid = new BitstreamReader();\n hid.addBuffer(h);\n src.addBuffer(b);\n const chnks = [];\n tinf_uncompress(src, void 0, hid, (c) => chnks.push(c));\n return import_buffer3.Buffer.concat(chnks);\n};\nvar inject_data = async (container, injb) => {\n if (!csettings2)\n throw new Error("Settings uninit");\n if (csettings2.pmeth < 5) {\n let magic = false;\n const [writestream2, extract6] = BufferWriteStream();\n const encoder = new PNGEncoder(writestream2);\n const decoder = new PNGDecoder(container.stream().getReader());\n for await (const [name, chunk, crc, offset] of decoder.chunks()) {\n if (magic && name != "IDAT")\n break;\n if (!magic && name == "IDAT") {\n const passed = import_buffer3.Buffer.from(injb);\n switch (csettings2.pmeth) {\n case 0:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM3, passed])), 0, 0]);\n break;\n case 1:\n xor(passed, password);\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM4, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 2:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM5, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 3:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM6, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 4:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM7, import_buffer3.Buffer.from(bs58.encode(passed))])), 0, 0]);\n break;\n }\n magic = true;\n }\n await encoder.insertchunk([name, chunk, crc, offset]);\n }\n await encoder.insertchunk([\n "IEND",\n buildChunk("IEND", import_buffer3.Buffer.from([])),\n 0,\n 0\n ]);\n return extract6();\n }\n let pdec = new PNGDecoder(container.stream().getReader());\n const concat = [];\n for await (const chk of pdec.chunks())\n if (chk[0] == "IDAT")\n concat.push(chk[1].slice(4));\n const comp = import_buffer3.Buffer.concat(concat);\n const head = comp.slice(0, 2);\n const chksum = comp.slice(-4);\n const idatblk = embedInRawDeflate(comp.slice(2, -4), injb);\n const [writestream, extract5] = BufferWriteStream();\n const penc = new PNGEncoder(writestream);\n pdec = new PNGDecoder(container.stream().getReader());\n let ins = false;\n for await (const chk of pdec.chunks()) {\n if (chk[0] != "IDAT") {\n await penc.insertchunk(chk);\n } else {\n if (!ins) {\n await penc.insertchunk(["IDAT", import_buffer3.Buffer.concat([import_buffer3.Buffer.from("IDAT"), head, idatblk, chksum]), 0, 0]);\n ins = true;\n }\n }\n }\n await penc.dtor();\n console.log("Finished writing");\n return extract5();\n};\nvar inject = async (container, links) => {\n links = links.map((link) => {\n for (const h of filehosts) {\n if (link.includes(h.serving)) {\n const end = link.split("/").slice(-1)[0];\n return `${prefs[h.serving]}${end}`;\n }\n }\n return "";\n });\n const injb = import_buffer3.Buffer.from(links.join(" "));\n return inject_data(container, injb);\n};\nvar has_embed = async (png) => {\n const r = await extract(png, false);\n return !!r;\n};\nvar pngv3_default = {\n extract,\n has_embed,\n inject,\n match: (fn) => !!fn.match(/\\.png$/)\n};\n\n// src/jpg.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer4 = __toESM(require_buffer(), 1);\n\n// src/f5stego.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar bitcode = new Array(65535);\nvar category = new Array(65535);\nvar std_dc_luminance_nrcodes = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];\nvar std_dc_luminance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nvar std_ac_luminance_nrcodes = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125];\nvar std_ac_luminance_values = [\n 1,\n 2,\n 3,\n 0,\n 4,\n 17,\n 5,\n 18,\n 33,\n 49,\n 65,\n 6,\n 19,\n 81,\n 97,\n 7,\n 34,\n 113,\n 20,\n 50,\n 129,\n 145,\n 161,\n 8,\n 35,\n 66,\n 177,\n 193,\n 21,\n 82,\n 209,\n 240,\n 36,\n 51,\n 98,\n 114,\n 130,\n 9,\n 10,\n 22,\n 23,\n 24,\n 25,\n 26,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n];\nvar std_dc_chrominance_nrcodes = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];\nvar std_dc_chrominance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nvar std_ac_chrominance_nrcodes = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119];\nvar std_ac_chrominance_values = [\n 0,\n 1,\n 2,\n 3,\n 17,\n 4,\n 5,\n 33,\n 49,\n 6,\n 18,\n 65,\n 81,\n 7,\n 97,\n 113,\n 19,\n 34,\n 50,\n 129,\n 8,\n 20,\n 66,\n 145,\n 161,\n 177,\n 193,\n 9,\n 35,\n 51,\n 82,\n 240,\n 21,\n 98,\n 114,\n 209,\n 10,\n 22,\n 36,\n 52,\n 225,\n 37,\n 241,\n 23,\n 24,\n 25,\n 26,\n 38,\n 39,\n 40,\n 41,\n 42,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n];\nfunction _initCategoryNumber() {\n var nrlower = 1;\n var nrupper = 2;\n for (var cat = 1; cat <= 15; cat++) {\n for (var nr = nrlower; nr < nrupper; nr++) {\n category[32767 + nr] = cat;\n bitcode[32767 + nr] = [];\n bitcode[32767 + nr][1] = cat;\n bitcode[32767 + nr][0] = nr;\n }\n for (var nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) {\n category[32767 + nrneg] = cat;\n bitcode[32767 + nrneg] = [];\n bitcode[32767 + nrneg][1] = cat;\n bitcode[32767 + nrneg][0] = nrupper - 1 + nrneg;\n }\n nrlower <<= 1;\n nrupper <<= 1;\n }\n}\n_initCategoryNumber();\nfunction _computeHuffmanTbl(nrcodes, std_table) {\n var codevalue = 0;\n var pos_in_table = 0;\n var HT = [];\n for (var k = 1; k <= 16; k++) {\n for (var j = 1; j <= nrcodes[k]; j++) {\n HT[std_table[pos_in_table]] = [];\n HT[std_table[pos_in_table]][0] = codevalue;\n HT[std_table[pos_in_table]][1] = k;\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n}\nvar YDC_HT = _computeHuffmanTbl(std_dc_luminance_nrcodes, std_dc_luminance_values);\nvar UVDC_HT = _computeHuffmanTbl(std_dc_chrominance_nrcodes, std_dc_chrominance_values);\nvar YAC_HT = _computeHuffmanTbl(std_ac_luminance_nrcodes, std_ac_luminance_values);\nvar UVAC_HT = _computeHuffmanTbl(std_ac_chrominance_nrcodes, std_ac_chrominance_values);\nvar _randPool, __raw, _jfif, _APPn, _qts, _frame, _tail, _shuffleInit, shuffleInit_fn, _stegShuffle, stegShuffle_fn, __analyze, _analyze_fn, __f5write, _f5write_fn;\nvar f5stego = class {\n constructor(key2, maxPixels = 4096 * 4096) {\n this.maxPixels = maxPixels;\n __privateAdd(this, _shuffleInit);\n __privateAdd(this, _stegShuffle);\n __privateAdd(this, __analyze);\n __privateAdd(this, __f5write);\n __privateAdd(this, _randPool, void 0);\n __privateAdd(this, __raw, void 0);\n __privateAdd(this, _jfif, void 0);\n __privateAdd(this, _APPn, void 0);\n __privateAdd(this, _qts, void 0);\n __privateAdd(this, _frame, null);\n __privateAdd(this, _tail, null);\n __privateMethod(this, _shuffleInit, shuffleInit_fn).call(this, key2);\n }\n embed(image, data, k) {\n this.parse(image);\n this.f5put(data, k);\n return this.pack();\n }\n extract(image) {\n this.parse(image, true);\n return this.f5get();\n }\n analyze() {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var i, comp = __privateGet(this, _frame).components[0];\n if (comp.componentId != 1) {\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n return __privateMethod(this, __analyze, _analyze_fn).call(this, comp.blocks);\n }\n f5put(data, k) {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var t, i, comp = __privateGet(this, _frame).components[0];\n if (data.length > 8388607)\n throw "Data too big. Max 8388607 bytes allowed.";\n if (data.length < 32768) {\n t = new Uint8Array(2 + data.length);\n t[0] = data.length & 255;\n t[1] = data.length >>> 8;\n t.set(data, 2);\n } else {\n t = new Uint8Array(3 + data.length);\n t[0] = data.length & 255;\n t[1] = (data.length >>> 8 & 127) + 128;\n t[2] = data.length >>> 15;\n t.set(data, 3);\n }\n if (comp.componentId != 1) {\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (k) {\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n return __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n let ret;\n let prop = __privateMethod(this, __analyze, _analyze_fn).call(this, comp.blocks);\n k = 0;\n for (i = prop.capacity.length - 1; i >= 0; i--) {\n if (prop.capacity[i] >= t.length) {\n k = i;\n break;\n }\n }\n if (k === 0)\n throw "capacity exceeded";\n try {\n ret = __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n } catch (e) {\n k--;\n if (k === 0)\n throw "capacity exceeded";\n ret = __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n }\n ret["stats"] = prop;\n return ret;\n }\n f5get() {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var comp = __privateGet(this, _frame).components[0];\n if (comp.componentId != 1) {\n for (var i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n var coeff = new Int16Array(comp.blocks.length);\n coeff.set(comp.blocks);\n var pos = -1, extrBit = 0, cCount = coeff.length - 1;\n var n, k = 0;\n var out = new Uint8Array(coeff.length / 8 | 0), extrByte = 0, outPos = 0, bitsAvail = 0, code = 0, hash = 0;\n while (bitsAvail < 4) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n k |= extrBit << bitsAvail;\n bitsAvail++;\n }\n k = (k & 15) + 1;\n n = (1 << k) - 1;\n bitsAvail = 0;\n if (k == 1) {\n while (pos < cCount) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n extrByte |= extrBit << bitsAvail;\n bitsAvail++;\n if (bitsAvail == 8) {\n out[outPos++] = extrByte;\n extrByte = 0;\n bitsAvail = 0;\n }\n }\n } else {\n while (pos < cCount) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n hash ^= extrBit * ++code;\n if (code == n) {\n extrByte |= hash << bitsAvail;\n bitsAvail += k;\n code = 0;\n hash = 0;\n while (bitsAvail >= 8) {\n out[outPos++] = extrByte & 255;\n bitsAvail -= 8;\n extrByte = extrByte >> 8;\n }\n }\n }\n }\n while (bitsAvail > 0) {\n out[outPos++] = extrByte & 255;\n bitsAvail -= 8;\n extrByte = extrByte >> 8;\n }\n var s = 2, l = out[0];\n if (out[1] & 128) {\n s++;\n l += ((out[1] & 127) << 8) + (out[2] << 15);\n } else {\n l += out[1] << 8;\n }\n return out.subarray(s, s + l);\n }\n parse(data, tolerant = false) {\n var offset = 0;\n function _buildHuffmanTable(nrcodes, values) {\n var codevalue = 0, pos_in_table = 0, HT = new Uint16Array(65536);\n for (var k = 0; k < 16; k++) {\n for (var j2 = 0; j2 < nrcodes[k]; j2++) {\n for (var i2 = codevalue << 15 - k, cntTo = codevalue + 1 << 15 - k; i2 < cntTo; i2++) {\n HT[i2] = values[pos_in_table] + (k + 1 << 8);\n }\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n }\n function decodeScan(data2, offset2, frame, components2, resetInterval2, spectralStart2, spectralEnd2, successivePrev, successive) {\n var startOffset = offset2, bitsData = 0, bitsCount = 0, eobrun = 0, p1 = 1 << successive, m1 = -1 << successive;\n function decodeBaseline(component2, pos) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n var t = component2.huffmanTableDC[bitsData >>> bitsCount - 16 & 65535];\n if (!t)\n throw "invalid huffman sequence";\n bitsCount -= t >>> 8;\n t &= 255;\n var diff = 0;\n if (t !== 0) {\n while (bitsCount < t) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n diff = bitsData >>> bitsCount - t & (1 << t) - 1;\n bitsCount -= t;\n if (diff < 1 << t - 1)\n diff += (-1 << t) + 1;\n }\n component2.blocksDC[pos >> 6] = component2.pred += diff;\n var k2 = 1, s, r;\n while (k2 < 64) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s === 0) {\n if (r < 15) {\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n while (bitsCount < s) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n component2.blocks[pos + k2] = bitsData >>> bitsCount - s & (1 << s) - 1;\n bitsCount -= s;\n if (component2.blocks[pos + k2] < 1 << s - 1)\n component2.blocks[pos + k2] += (-1 << s) + 1;\n k2++;\n }\n }\n function decodeDCFirst(component2, pos) {\n var diff = 0;\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n var t = component2.huffmanTableDC[bitsData >>> bitsCount - 16 & 65535];\n if (!t)\n throw "invalid huffman sequence";\n bitsCount -= t >>> 8;\n t &= 255;\n if (t !== 0) {\n while (bitsCount < t) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n diff = bitsData >>> bitsCount - t & (1 << t) - 1;\n bitsCount -= t;\n if (diff < 1 << t - 1)\n diff += (-1 << t) + 1;\n }\n component2.blocksDC[pos >> 6] = component2.pred += diff << successive;\n }\n function decodeDCSuccessive(component2, pos) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocksDC[pos >> 6] |= (bitsData >>> --bitsCount & 1) << successive;\n }\n if (!frame)\n throw "Frame not parsed yet";\n function decodeACFirst(component2, pos) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k2 = spectralStart2, s, r;\n while (k2 <= spectralEnd2) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s === 0) {\n if (r != 15) {\n eobrun = (1 << r) - 1;\n if (r) {\n while (bitsCount < r) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n eobrun += bitsData >>> bitsCount - r & (1 << r) - 1;\n bitsCount -= r;\n }\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n while (bitsCount < s) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n component2.blocks[pos + k2] = bitsData >>> bitsCount - s & (1 << s) - 1;\n bitsCount -= s;\n if (component2.blocks[pos + k2] < 1 << s - 1)\n component2.blocks[pos + k2] += (-1 << s) + 1;\n component2.blocks[pos + k2] *= p1;\n k2++;\n }\n }\n function decodeACSuccessive(component2, pos) {\n var k2 = spectralStart2, r, s;\n if (frame == null)\n throw "Frame not defined";\n if (!eobrun) {\n while (k2 <= spectralEnd2) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s) {\n if (s != 1)\n throw "bad jpeg";\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n s = bitsData >>> --bitsCount & 1 ? p1 : m1;\n } else {\n if (r != 15) {\n eobrun = 1 << r;\n if (r) {\n while (bitsCount < r) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n eobrun += bitsData >>> bitsCount - r & (1 << r) - 1;\n bitsCount -= r;\n }\n break;\n }\n }\n while (k2 <= spectralEnd2) {\n if (component2.blocks[pos + k2]) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocks[pos + k2] += (bitsData >>> --bitsCount & 1) * (component2.blocks[pos + k2] >= 0 ? p1 : m1);\n } else {\n if (--r < 0)\n break;\n }\n k2++;\n }\n if (s)\n component2.blocks[pos + k2] = s;\n k2++;\n }\n }\n if (eobrun) {\n while (k2 <= spectralEnd2) {\n if (component2.blocks[pos + k2]) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocks[pos + k2] += (bitsData >>> --bitsCount & 1) * (component2.blocks[pos + k2] >= 0 ? p1 : m1);\n }\n k2++;\n }\n eobrun--;\n }\n }\n var decodeFn;\n if (frame.progressive) {\n if (spectralStart2 === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n var marker, mcuExpected, i2, j2, k, n, mcusPerLine2, mcusPerRow, x, y;\n if (components2.length == 1) {\n mcusPerLine2 = components2[0].blocksPerLine;\n mcusPerRow = components2[0].blocksPerColumn;\n mcuExpected = mcusPerRow * mcusPerLine2;\n if (!resetInterval2)\n resetInterval2 = mcuExpected;\n n = resetInterval2;\n components2[0].pred = 0;\n eobrun = 0;\n for (y = 0; y < mcusPerRow; y++) {\n for (x = 0; x < mcusPerLine2; x++) {\n if (!n) {\n n = resetInterval2;\n components2[0].pred = 0;\n eobrun = 0;\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n bitsCount = 0;\n marker = data2[offset2] << 8 | data2[offset2 + 1];\n if (marker >= 65488 && marker <= 65495) {\n offset2 += 2;\n } else {\n if (marker <= 65280) {\n throw "bad jpeg";\n }\n break;\n }\n }\n n--;\n for (i2 = 0; i2 < components2.length; i2++) {\n decodeFn(components2[i2], (y * components2[i2].blocksPerLineForMcu + x) * 64);\n }\n }\n }\n } else {\n mcusPerLine2 = frame.mcusPerLine;\n mcusPerRow = frame.mcusPerColumn;\n mcuExpected = mcusPerRow * mcusPerLine2;\n if (!resetInterval2)\n resetInterval2 = mcuExpected;\n n = resetInterval2;\n for (i2 = 0; i2 < components2.length; i2++)\n components2[i2].pred = 0;\n eobrun = 0;\n for (y = 0; y < mcusPerRow; y++) {\n for (x = 0; x < mcusPerLine2; x++) {\n if (!n) {\n n = resetInterval2;\n for (i2 = 0; i2 < components2.length; i2++)\n components2[i2].pred = 0;\n eobrun = 0;\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n bitsCount = 0;\n marker = data2[offset2] << 8 | data2[offset2 + 1];\n if (marker >= 65488 && marker <= 65495) {\n offset2 += 2;\n } else {\n if (marker <= 65280) {\n throw "bad jpeg";\n }\n break;\n }\n }\n n--;\n for (i2 = 0; i2 < components2.length; i2++) {\n for (j2 = 0; j2 < components2[i2].v; j2++) {\n for (k = 0; k < components2[i2].h; k++) {\n decodeFn(components2[i2], ((y * components2[i2].v + j2) * components2[i2].blocksPerLineForMcu + x * components2[i2].h + k) * 64);\n }\n }\n }\n }\n }\n }\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n return offset2 - startOffset;\n }\n function readUint16() {\n var value = data[offset] << 8 | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length = readUint16();\n var array = data.subarray(offset, offset + length - 2);\n offset += array.length;\n return array;\n }\n __privateSet(this, __raw, data);\n __privateSet(this, _jfif, null);\n __privateSet(this, _APPn, []);\n __privateSet(this, _qts, []);\n __privateSet(this, _frame, null);\n __privateSet(this, _tail, null);\n var markerHi, markerLo, i, j, resetInterval, component;\n let huffmanTablesAC = [];\n let huffmanTablesDC = [];\n while (1) {\n if (offset >= data.length) {\n if (tolerant)\n break;\n throw "unexpected EOF";\n }\n markerHi = data[offset++];\n markerLo = data[offset++];\n if (markerHi == 255) {\n if (markerLo == 224) {\n __privateSet(this, _jfif, readDataBlock());\n }\n if (markerLo > 224 && markerLo < 240 || markerLo == 254) {\n __privateGet(this, _APPn).push({\n "app": markerLo,\n "data": readDataBlock()\n });\n }\n if (markerLo == 219) {\n __privateGet(this, _qts).push(readDataBlock());\n }\n if (markerLo >= 192 && markerLo <= 194) {\n if (__privateGet(this, _frame))\n throw "Only single frame JPEGs supported";\n readUint16();\n __privateSet(this, _frame, {\n "extended": markerLo === 193,\n "progressive": markerLo === 194,\n "precision": data[offset++],\n "scanLines": readUint16(),\n "samplesPerLine": readUint16(),\n "components": [],\n "componentIds": {},\n "maxH": 1,\n "maxV": 1\n });\n if (__privateGet(this, _frame).scanLines * __privateGet(this, _frame).samplesPerLine > this.maxPixels)\n throw "Image is too big.";\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n if (maxH < h)\n maxH = h;\n if (maxV < v)\n maxV = v;\n var qId = data[offset + 2];\n var l = __privateGet(this, _frame).components.push({\n componentId,\n h,\n v,\n quantizationTable: qId\n });\n __privateGet(this, _frame).componentIds[componentId] = l - 1;\n offset += 3;\n }\n __privateGet(this, _frame).maxH = maxH;\n __privateGet(this, _frame).maxV = maxV;\n var mcusPerLine = Math.ceil(__privateGet(this, _frame).samplesPerLine / 8 / maxH);\n var mcusPerColumn = Math.ceil(__privateGet(this, _frame).scanLines / 8 / maxV);\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n component = __privateGet(this, _frame).components[i];\n var blocksPerLine = Math.ceil(Math.ceil(__privateGet(this, _frame).samplesPerLine / 8) * component.h / maxH);\n var blocksPerColumn = Math.ceil(Math.ceil(__privateGet(this, _frame).scanLines / 8) * component.v / maxV);\n var blocksPerLineForMcu = mcusPerLine * component.h;\n var blocksPerColumnForMcu = mcusPerColumn * component.v;\n __privateGet(this, _frame).components[i] = {\n ...component,\n blocks: new Int16Array(blocksPerColumnForMcu * blocksPerLineForMcu * 64),\n blocksDC: new Int16Array(blocksPerColumnForMcu * blocksPerLineForMcu),\n blocksPerLine,\n blocksPerColumn,\n blocksPerLineForMcu,\n blocksPerColumnForMcu\n };\n }\n __privateGet(this, _frame).mcusPerLine = mcusPerLine;\n __privateGet(this, _frame).mcusPerColumn = mcusPerColumn;\n }\n if (markerLo == 196) {\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength; ) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++)\n codeLengthSum += codeLengths[j] = data[offset];\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n const v2 = _buildHuffmanTable(codeLengths, huffmanValues);\n if (huffmanTableSpec >> 4 === 0)\n huffmanTablesDC[huffmanTableSpec & 15] = v2;\n else\n huffmanTablesAC[huffmanTableSpec & 15] = v2;\n }\n }\n if (markerLo == 221) {\n resetInterval = readUint16();\n }\n if (markerLo == 218) {\n if (__privateGet(this, _frame) == null)\n throw "SOS before SOF";\n readUint16();\n var selectorsCount = data[offset++];\n var components = [];\n for (i = 0; i < selectorsCount; i++) {\n var componentIndex = __privateGet(this, _frame).componentIds[data[offset++]];\n component = __privateGet(this, _frame).components[componentIndex];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset, __privateGet(this, _frame), components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);\n offset += processed;\n }\n if (markerLo == 217) {\n break;\n }\n } else {\n if (data[offset - 3] == 255 && data[offset - 2] >= 192 && data[offset - 2] <= 254) {\n offset -= 3;\n }\n while (data[offset] != 255 && offset < data.length) {\n offset++;\n }\n if (data[offset] != 255) {\n throw "bad jpeg ";\n }\n }\n }\n if (!__privateGet(this, _frame))\n throw "bad jpeg";\n if (offset < data.length)\n __privateSet(this, _tail, data.subarray(offset));\n return this;\n }\n pack() {\n let byteout;\n let bytenew;\n let bytepos;\n let poslast;\n let outpos;\n let byte;\n function writeByte(value) {\n var t;\n byteout[outpos++] = value;\n if (outpos > poslast) {\n t = new Uint8Array(byteout.length * 2);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n }\n function writeWord(value) {\n writeByte(value >> 8 & 255);\n writeByte(value & 255);\n }\n function writeBlock(block) {\n var t;\n if (outpos + block.length > poslast) {\n t = new Uint8Array(byteout.length * 2 + block.length);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n byteout.set(block, outpos);\n outpos += block.length;\n }\n function writeAPP0(self2) {\n writeWord(65504);\n if (!__privateGet(self2, _jfif)) {\n writeWord(16);\n writeByte(74);\n writeByte(70);\n writeByte(73);\n writeByte(70);\n writeByte(0);\n writeByte(1);\n writeByte(1);\n writeByte(0);\n writeWord(1);\n writeWord(1);\n writeByte(0);\n writeByte(0);\n } else {\n writeWord(__privateGet(self2, _jfif).length + 2);\n writeBlock(__privateGet(self2, _jfif));\n }\n }\n function writeDQT(self2) {\n for (var i2 = 0; i2 < __privateGet(self2, _qts).length; i2++) {\n writeWord(65499);\n writeWord(__privateGet(self2, _qts)[i2].length + 2);\n writeBlock(__privateGet(self2, _qts)[i2]);\n }\n }\n function writeAPPn(self2) {\n for (var i2 = 0; i2 < __privateGet(self2, _APPn).length; i2++) {\n writeWord(65280 | __privateGet(self2, _APPn)[i2].app);\n writeWord(__privateGet(self2, _APPn)[i2].data.length + 2);\n writeBlock(__privateGet(self2, _APPn)[i2].data);\n }\n }\n function writeSOF0(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65472);\n writeWord(8 + __privateGet(self2, _frame).components.length * 3);\n writeByte(__privateGet(self2, _frame).precision);\n writeWord(__privateGet(self2, _frame).scanLines);\n writeWord(__privateGet(self2, _frame).samplesPerLine);\n writeByte(__privateGet(self2, _frame).components.length);\n for (var i2 = 0; i2 < __privateGet(self2, _frame).components.length; i2++) {\n var c2 = __privateGet(self2, _frame).components[i2];\n writeByte(c2.componentId);\n writeByte(c2.h << 4 | c2.v);\n writeByte(c2.quantizationTable);\n }\n }\n function writeDHT(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65476);\n writeWord(31);\n writeByte(0);\n for (var i2 = 0; i2 < 16; i2++) {\n writeByte(std_dc_luminance_nrcodes[i2 + 1]);\n }\n for (var j = 0; j <= 11; j++) {\n writeByte(std_dc_luminance_values[j]);\n }\n writeWord(65476);\n writeWord(181);\n writeByte(16);\n for (var k = 0; k < 16; k++) {\n writeByte(std_ac_luminance_nrcodes[k + 1]);\n }\n for (var l = 0; l <= 161; l++) {\n writeByte(std_ac_luminance_values[l]);\n }\n if (__privateGet(self2, _frame).components.length != 1) {\n writeWord(65476);\n writeWord(31);\n writeByte(1);\n for (var m = 0; m < 16; m++) {\n writeByte(std_dc_chrominance_nrcodes[m + 1]);\n }\n for (var n = 0; n <= 11; n++) {\n writeByte(std_dc_chrominance_values[n]);\n }\n writeWord(65476);\n writeWord(181);\n writeByte(17);\n for (var o = 0; o < 16; o++) {\n writeByte(std_ac_chrominance_nrcodes[o + 1]);\n }\n for (var p = 0; p <= 161; p++) {\n writeByte(std_ac_chrominance_values[p]);\n }\n }\n }\n function writeSOS(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65498);\n writeWord(6 + __privateGet(self2, _frame).components.length * 2);\n writeByte(__privateGet(self2, _frame).components.length);\n for (var i2 = 0; i2 < __privateGet(self2, _frame).components.length; i2++) {\n var c2 = __privateGet(self2, _frame).components[i2];\n writeByte(c2.componentId);\n if (i2 === 0) {\n writeByte(0);\n } else {\n writeByte(17);\n }\n }\n writeByte(0);\n writeByte(63);\n writeByte(0);\n }\n function processDU(comp, POS, DC, HTDC, HTAC) {\n var pos, posval, t;\n if (bytepos === 0)\n bytenew = 0;\n if (!("blocks" in comp))\n throw "Blocks not parsed";\n var Diff = comp.blocksDC[POS >> 6] - DC;\n DC = comp.blocksDC[POS >> 6];\n if (Diff === 0) {\n posval = HTDC[0][1];\n bytenew <<= posval;\n bytenew += HTDC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n } else {\n pos = 32767 + Diff;\n posval = HTDC[category[pos]][1];\n bytenew <<= posval;\n bytenew += HTDC[category[pos]][0];\n bytepos += posval;\n posval = bitcode[pos][1];\n bytenew <<= posval;\n bytenew += bitcode[pos][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n var end0pos = 63;\n for (; end0pos > 0 && comp.blocks[POS + end0pos] === 0; end0pos--) {\n }\n if (end0pos === 0) {\n posval = HTAC[0][1];\n bytenew <<= posval;\n bytenew += HTAC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n return DC;\n }\n var i2 = 1;\n var lng;\n while (i2 <= end0pos) {\n var startpos = i2;\n for (; comp.blocks[POS + i2] === 0 && i2 <= end0pos; ++i2) {\n }\n var nrzeroes = i2 - startpos;\n if (nrzeroes >= 16) {\n lng = nrzeroes >> 4;\n for (var nrmarker = 1; nrmarker <= lng; ++nrmarker) {\n posval = HTAC[240][1];\n bytenew <<= posval;\n bytenew += HTAC[240][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n nrzeroes = nrzeroes & 15;\n }\n pos = 32767 + comp.blocks[POS + i2];\n posval = HTAC[(nrzeroes << 4) + category[pos]][1];\n bytenew <<= posval;\n bytenew += HTAC[(nrzeroes << 4) + category[pos]][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n posval = bitcode[pos][1];\n bytenew <<= posval;\n bytenew += bitcode[pos][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n i2++;\n }\n if (end0pos != 63) {\n posval = HTAC[0][1];\n bytenew <<= posval;\n bytenew += HTAC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n if (outpos > poslast) {\n t = new Uint8Array(byteout.length * 2);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n return DC;\n }\n byteout = new Uint8Array(65536);\n poslast = 65536 - 128;\n outpos = 0;\n bytenew = 0;\n bytepos = 0;\n writeWord(65496);\n writeAPP0(this);\n writeAPPn(this);\n writeDQT(this);\n writeSOF0(this);\n writeDHT(this);\n writeSOS(this);\n bytenew = 0;\n bytepos = 0;\n if (!__privateGet(this, _frame))\n throw "Frame not ready";\n var c, mcuRow, mcuCol, blockRow, blockCol, mcu, i, v, h;\n var DCdiff = [];\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n DCdiff.push(0);\n }\n for (mcu = 0; mcu < __privateGet(this, _frame).mcusPerLine * __privateGet(this, _frame).mcusPerColumn; mcu++) {\n mcuRow = mcu / __privateGet(this, _frame).mcusPerLine | 0;\n mcuCol = mcu % __privateGet(this, _frame).mcusPerLine;\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n c = __privateGet(this, _frame).components[i];\n for (v = 0; v < c.v; v++) {\n blockRow = mcuRow * c.v + v;\n for (h = 0; h < c.h; h++) {\n blockCol = mcuCol * c.h + h;\n if (i === 0) {\n DCdiff[i] = processDU(c, (blockRow * __privateGet(this, _frame).mcusPerLine * c.h + blockCol) * 64, DCdiff[i], YDC_HT, YAC_HT);\n } else {\n DCdiff[i] = processDU(c, (blockRow * __privateGet(this, _frame).mcusPerLine * c.h + blockCol) * 64, DCdiff[i], UVDC_HT, UVAC_HT);\n }\n }\n }\n }\n }\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n }\n if (bytepos > 0) {\n bytenew <<= 8 - bytepos;\n bytenew += (1 << 8 - bytepos) - 1;\n byteout[outpos++] = 255 & bytenew;\n }\n writeWord(65497);\n if (__privateGet(this, _tail))\n writeBlock(__privateGet(this, _tail));\n return byteout.slice(0, outpos);\n }\n};\n_randPool = new WeakMap();\n__raw = new WeakMap();\n_jfif = new WeakMap();\n_APPn = new WeakMap();\n_qts = new WeakMap();\n_frame = new WeakMap();\n_tail = new WeakMap();\n_shuffleInit = new WeakSet();\nshuffleInit_fn = function(key2) {\n __privateSet(this, _randPool, new ArrayBuffer(this.maxPixels * 4.125));\n if (!key2.length)\n throw "key needed";\n var i = 0, j = 0, t = 0, k = 0, S = new Uint8Array(256), rnd = new Uint8Array(__privateGet(this, _randPool));\n for (i = 0; i < 256; ++i)\n S[i] = i;\n for (i = 0; i < 256; ++i) {\n j = j + S[i] + key2[i % key2.length] & 255;\n t = S[i];\n S[i] = S[j];\n S[j] = t;\n }\n i = 0;\n j = 0;\n for (k = 0; k < this.maxPixels * 4.125; ++k) {\n i = i + 1 & 255;\n j = j + S[i] & 255;\n t = S[i];\n S[i] = S[j];\n S[j] = t;\n rnd[k] = S[t + S[i] & 255];\n }\n};\n_stegShuffle = new WeakSet();\nstegShuffle_fn = function(pm) {\n let t, l, k, random_index, rand32Array = new Uint32Array(__privateGet(this, _randPool));\n if (typeof pm == "number") {\n l = pm;\n pm = new Uint32Array(l);\n for (k = 1; k < l; k++) {\n random_index = rand32Array[k] % (k + 1);\n if (random_index != k)\n pm[k] = pm[random_index];\n pm[random_index] = k;\n }\n } else {\n l = pm.length;\n for (k = 1; k < l; k++) {\n random_index = rand32Array[k] % (k + 1);\n t = pm[k];\n pm[k] = pm[random_index];\n pm[random_index] = t;\n }\n }\n return { pm, gamma: new Uint8Array(__privateGet(this, _randPool), l * 4) };\n};\n__analyze = new WeakSet();\n_analyze_fn = function(coeff) {\n var _one = 0, _zero = 0, _large, _ratio, usable, i, k, embedded, matched, changed;\n for (i = 0; i < coeff.length; i++) {\n if (i % 64 === 0)\n continue;\n if (coeff[i] === 0)\n _zero++;\n if (coeff[i] == 1 || coeff[i] == -1)\n _one++;\n }\n _large = coeff.length - _zero - _one - coeff.length / 64;\n _ratio = _one / (_large + _one);\n var res = {\n "capacity": [0, (_large + 0.49 * _one >> 3) - 1],\n "coeff_total": coeff.length,\n "coeff_large": _large,\n "coeff_zero": _zero,\n "coeff_one": _one,\n "coeff_one_ratio": _one / (_large + _one)\n };\n for (i = 2; i < 17; i++) {\n k = (1 << i) - 1;\n usable = _large + _one;\n embedded = 0;\n while (usable > k) {\n matched = usable / k / (1 << i) / (1 << i) | 0;\n usable -= matched * k;\n changed = usable * (1 - _ratio) / k * 0.96 | 0;\n usable -= changed * k;\n embedded += changed + matched;\n k++;\n }\n res.capacity[i] = (i * embedded >> 3) - 1;\n }\n return res;\n};\n__f5write = new WeakSet();\n_f5write_fn = function(coeff, data, k) {\n var coeff_count = coeff.length;\n var _changed = 0, _embedded = 0, _examined = 0, _thrown = 0, shuffled_index = 0, i, n, ii;\n var next_bit_to_embed = 0, byte_to_embed = data.length, data_idx = 0, available_bits_to_embed = 0;\n n = (1 << k) - 1;\n byte_to_embed = k - 1;\n byte_to_embed ^= 0;\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed = 3;\n for (ii = 0; ii < coeff_count; ii++) {\n shuffled_index = ii;\n if (shuffled_index % 64 === 0 || coeff[shuffled_index] === 0)\n continue;\n var cc = coeff[shuffled_index];\n _examined++;\n if (cc > 0 && (cc & 1) != next_bit_to_embed) {\n coeff[shuffled_index]--;\n _changed++;\n } else if (cc < 0 && (cc & 1) == next_bit_to_embed) {\n coeff[shuffled_index]++;\n _changed++;\n }\n if (coeff[shuffled_index] !== 0) {\n _embedded++;\n if (available_bits_to_embed === 0) {\n if (k != 1 || data_idx >= data.length)\n break;\n byte_to_embed = data[data_idx++];\n byte_to_embed ^= 0;\n available_bits_to_embed = 8;\n }\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed--;\n } else {\n _thrown++;\n }\n }\n if (k == 1 && _embedded < data.length * 8)\n throw "capacity exceeded " + _embedded / 8 + " " + data.length;\n if (k != 1) {\n var is_last_byte = false, k_bits_to_embed = 0;\n while (!is_last_byte || available_bits_to_embed !== 0 && is_last_byte) {\n k_bits_to_embed = 0;\n for (i = 0; i < k; i++) {\n if (available_bits_to_embed === 0) {\n if (data_idx >= data.length) {\n is_last_byte = true;\n break;\n }\n byte_to_embed = data[data_idx++];\n byte_to_embed ^= 0;\n available_bits_to_embed = 8;\n }\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed--;\n k_bits_to_embed |= next_bit_to_embed << i;\n }\n var code_word = [];\n var ci = null;\n for (i = 0; i < n; i++) {\n while (true) {\n if (++ii >= coeff_count) {\n throw "capacity exceeded " + _embedded / 8;\n }\n ci = ii;\n if (ci % 64 !== 0 && coeff[ci] !== 0)\n break;\n }\n code_word.push(ci);\n }\n _examined += n;\n while (true) {\n var vhash = 0, extracted_bit;\n for (i = 0; i < code_word.length; i++) {\n if (coeff[code_word[i]] > 0) {\n extracted_bit = coeff[code_word[i]] & 1;\n } else {\n extracted_bit = 1 - (coeff[code_word[i]] & 1);\n }\n if (extracted_bit == 1)\n vhash ^= i + 1;\n }\n i = vhash ^ k_bits_to_embed;\n if (!i) {\n _embedded += k;\n break;\n }\n i--;\n coeff[code_word[i]] += coeff[code_word[i]] < 0 ? 1 : -1;\n _changed++;\n if (coeff[code_word[i]] === 0) {\n _thrown++;\n code_word.splice(i, 1);\n while (true) {\n if (++ii >= coeff_count) {\n throw "capacity exceeded " + _embedded / 8;\n }\n ci = ii;\n if (ci % 64 !== 0 && coeff[ci] !== 0)\n break;\n }\n _examined++;\n code_word.push(ci);\n } else {\n _embedded += k;\n break;\n }\n }\n }\n }\n return {\n "k": k,\n "embedded": _embedded / 8,\n "examined": _examined,\n "changed": _changed,\n "thrown": _thrown,\n "efficiency": (_embedded / _changed).toFixed(2)\n };\n};\n\n// src/jpg.ts\nvar key = import_buffer4.Buffer.from("CUNNYCUNNYCUNNY");\nvar f5inst = new f5stego(key);\nvar inject2 = async (b, links) => {\n if (b.size / 20 < links.join(" ").length)\n throw "Image too small to embed.";\n const arr = new Uint8Array(new Uint8Array(await b.arrayBuffer()));\n const buff = f5inst.embed(arr, new TextEncoder().encode(links.join(" ")), 1);\n return import_buffer4.Buffer.from(buff);\n};\nvar has_embed2 = (b) => {\n try {\n const res = f5inst.extract(b);\n if (!res)\n return false;\n if (res.length > 1024)\n return false;\n const str = import_buffer4.Buffer.from(res).toString();\n if (!str.match(/^[a-zA-Z0-9:/.\\-_ ]+$/))\n return false;\n return str;\n } catch {\n return false;\n }\n};\nvar extract2 = (b, ex) => {\n return decodeCoom3Payload(import_buffer4.Buffer.from(ex));\n};\nvar jpg_default = {\n match: (fn) => !!fn.match(/\\.jpe?g$/),\n has_embed: has_embed2,\n extract: extract2,\n inject: inject2\n};\n\n// src/thirdeye.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer5 = __toESM(require_buffer(), 1);\nvar import_jpeg_js = __toESM(require_jpeg_js(), 1);\n\n// src/phash.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar median = (data) => {\n const mdarr = data.slice(0);\n mdarr.sort((a, b) => a - b);\n if (mdarr.length % 2 === 0)\n return (mdarr[mdarr.length / 2 - 1] + mdarr[mdarr.length / 2]) / 2;\n return mdarr[Math.floor(mdarr.length / 2)];\n};\nvar translate_blocks_to_bits = function(blocks, pixels_per_block) {\n const half_block_value = pixels_per_block * 256 * 3 / 2;\n const bandsize = blocks.length / 4;\n for (let i = 0; i < 4; i++) {\n const m = median(blocks.slice(i * bandsize, (i + 1) * bandsize));\n for (let j = i * bandsize; j < (i + 1) * bandsize; j++) {\n const v = blocks[j];\n blocks[j] = Number(v > m || Math.abs(v - m) < 1 && m > half_block_value);\n }\n }\n};\nvar bits_to_hexhash = (bitsArray) => {\n const hex = [];\n for (let i = 0; i < bitsArray.length; i += 4) {\n const nibble = bitsArray.slice(i, i + 4);\n hex.push(parseInt(nibble.join(""), 2).toString(16));\n }\n return hex.join("");\n};\nvar bmvbhash_even = (data, bits) => {\n const blocksize_x = Math.floor(data.width / bits);\n const blocksize_y = Math.floor(data.height / bits);\n const result = [];\n for (let y = 0; y < bits; y++) {\n for (let x = 0; x < bits; x++) {\n let total = 0;\n for (let iy = 0; iy < blocksize_y; iy++) {\n for (let ix = 0; ix < blocksize_x; ix++) {\n const cx = x * blocksize_x + ix;\n const cy = y * blocksize_y + iy;\n const ii = (cy * data.width + cx) * 4;\n const alpha = data.data[ii + 3];\n if (alpha === 0) {\n total += 765;\n } else {\n total += data.data[ii] + data.data[ii + 1] + data.data[ii + 2];\n }\n }\n }\n result.push(total);\n }\n }\n translate_blocks_to_bits(result, blocksize_x * blocksize_y);\n return bits_to_hexhash(result);\n};\n\n// src/thirdeye.ts\nvar csettings3;\nsettings.subscribe((b) => {\n csettings3 = b;\n});\nvar gelquirk = (prefix) => (a) => {\n let base = a.post || a.data || a;\n if (!Array.isArray(base))\n return [];\n base = base.filter((e) => e.file_url);\n return base.map((e) => ({\n full_url: e.file_url,\n preview_url: e.preview_url || e.preview_url,\n source: e.source,\n ext: e.file_ext || e.file_url.substr(e.file_url.lastIndexOf(".") + 1),\n page: `${prefix}${e.id || e.parent_id}`,\n tags: (e.tag_string || (e.tags && (Array.isArray(e.tags) && (typeof e.tags[0] == "string" ? e.tags.join(" ") : e.tags.map((e2) => e2.name_en).join(" "))) || e.tags) || "").split(" ")\n })) || [];\n};\nvar experimentalApi = false;\nvar black = /* @__PURE__ */ new Set();\nvar phashEn = false;\nvar mindist = 5;\nsettings.subscribe((s) => {\n if (!s)\n return;\n experimentalApi = s.expte;\n boorus = s.rsources.map((e) => ({\n ...e,\n quirks: gelquirk(e.view)\n }));\n black = new Set(s.blacklist);\n mindist = s.mdist || 5;\n phashEn = s.phash;\n});\nvar boorus = [];\nvar unlockQueue = Promise.resolve();\nvar cache = {};\nvar findFileFrom = async (b, hex, abort) => {\n try {\n if (b.domain in cache && hex in cache[b.domain])\n return cache[b.domain][hex];\n const res = await ifetch(`https://${b.domain}${b.endpoint}${hex}`);\n const txt = await res.text();\n const pres = JSON.parse(txt);\n const tran = b.quirks(pres).filter((e) => !e.tags.some((e2) => black.has(e2)));\n if (!(b.domain in cache))\n cache[b.domain] = {};\n cache[b.domain][hex] = tran;\n return tran;\n } catch (e) {\n const error = e;\n if (!error.message.includes("Unexpected end of JSON input"))\n console.error(e);\n return [];\n }\n};\nvar extract3 = async (b, fn) => {\n if (!csettings3)\n throw new Error("Settings uninit");\n let result;\n let booru;\n for (const e of Object.values(boorus)) {\n if (e.disabled)\n continue;\n result = await findFileFrom(e, fn.substring(0, 32));\n if (result.length) {\n booru = e.name;\n break;\n }\n }\n let cachedFile;\n const prev = result[0].preview_url;\n const full = result[0].full_url;\n return [{\n source: result[0].source,\n page: {\n title: booru,\n url: result[0].page\n },\n filename: fn.substring(0, 33) + result[0].ext,\n thumbnail: csettings3.hotlink ? prev || full : import_buffer5.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()),\n data: csettings3.hotlink ? full || prev : { url: full || prev }\n }];\n};\nvar phash = (b) => {\n const res = (0, import_jpeg_js.decode)(b);\n return bmvbhash_even(res, 8);\n};\nvar hammingDist = (a, b) => {\n let res = BigInt("0x" + a) ^ BigInt("0x" + b);\n let acc = 0;\n while (res != 0n) {\n acc += Number(res & 1n);\n res >>= 1n;\n }\n return acc;\n};\nvar has_embed3 = async (b, fn, prevlink) => {\n if (import_buffer5.Buffer.from(fn, "hex").equals(b))\n return false;\n let result = void 0;\n for (const e of Object.values(boorus)) {\n if (e.disabled)\n continue;\n result = await findFileFrom(e, fn.substring(0, 32));\n result = result.filter((e2) => e2.full_url || e2.preview_url);\n if (result.length)\n break;\n }\n if (result && result.length != 0 && phashEn && prevlink) {\n if (!result[0].preview_url)\n return true;\n const getHash = async (l) => {\n const ogreq = await ifetch(l);\n const origPreview = await ogreq.arrayBuffer();\n return phash(import_buffer5.Buffer.from(origPreview));\n };\n const [orighash, tehash] = await Promise.all([\n getHash(prevlink),\n getHash(result[0].preview_url)\n ]);\n const d = hammingDist(orighash, tehash);\n console.log(d, prevlink);\n return d > mindist;\n }\n return result && result.length != 0;\n};\nvar thirdeye_default = {\n skip: true,\n extract: extract3,\n has_embed: has_embed3,\n match: (fn) => !!fn.match(/^[0-9a-f]{32}\\.....?/)\n};\n\n// src/pomf.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer6 = __toESM(require_buffer(), 1);\nvar sources = [\n { host: "Catbox", prefix: "files.catbox.moe/" },\n { host: "Litter", prefix: "litter.catbox.moe/" },\n { host: "Zzzz", prefix: "z.zz.fo/" }\n];\nvar csettings4;\nsettings.subscribe((b) => {\n csettings4 = b;\n});\nvar getExt = (fn) => {\n const isB64 = fn.match(/^((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=))?\\.(gif|jpe?g|png|webm)/);\n const isExt = fn.match(/\\[.*=(.*)\\]/);\n let ext;\n let source;\n try {\n if (isB64) {\n ext = atob(isB64[1]);\n } else if (isExt) {\n ext = decodeURIComponent(isExt[1]);\n if (ext.startsWith("https://"))\n ext = ext.slice("https://".length);\n for (const cs of sources)\n if (ext.startsWith(cs.prefix)) {\n source = cs.prefix;\n ext = ext.slice(cs.prefix.length);\n break;\n }\n }\n } catch {\n }\n return { ext, source };\n};\nvar extract4 = async (b, fn) => {\n if (!csettings4)\n throw new Error("Settings uninit");\n const { ext, source } = getExt(fn);\n let rsource;\n for (const cs of sources) {\n if (source && cs.prefix != source)\n continue;\n try {\n await getHeaders("https://" + cs.prefix + ext);\n rsource = "https://" + cs.prefix + ext;\n break;\n } catch {\n }\n }\n return [{\n filename: ext,\n data: csettings4.hotlink ? rsource : { url: rsource },\n thumbnail: import_buffer6.Buffer.from(hasembed_default)\n }];\n};\nvar has_embed4 = async (b, fn) => {\n const { ext, source } = getExt(fn);\n if (!ext)\n return false;\n for (const cs of sources) {\n if (source && cs.prefix != source)\n continue;\n try {\n const e = await getHeaders("https://" + cs.prefix + ext);\n return true;\n } catch {\n }\n }\n return false;\n};\nvar pomf_default = {\n skip: true,\n extract: extract4,\n has_embed: has_embed4,\n match: (fn) => !!getExt(fn)\n};\n\n// src/processor.worker.ts\nconsole.log("Worker started");\nvar pendinggens = {};\nvar proxyAsyncGen = (id) => {\n return {\n next(arg) {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n return(v) {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n throw() {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n};\nvar deserializeMessage = (m) => {\n if (typeof m == "object" && m.type == "AsyncGenerator") {\n return proxyAsyncGen(m.id);\n }\n if (typeof m == "object") {\n for (const p in m) {\n m[p] = deserializeMessage(m[p]);\n }\n }\n return m;\n};\nvar processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default];\nvar processImage = async (srcs, fn, hex, prevurl) => {\n const ret = await Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => {\n if (proc.skip) {\n const md5 = Buffer2.from(hex, "base64");\n if (await proc.has_embed(md5, fn, prevurl) === true) {\n return [await proc.extract(md5, fn), true];\n }\n return;\n }\n let succ = false;\n let cumul;\n do {\n try {\n const n = await srcs.next();\n if (n.done)\n return;\n const iter = streamRemote(n.value);\n if (!iter)\n return;\n cumul = Buffer2.alloc(0);\n let found;\n let chunk = { done: true };\n do {\n const { value, done } = await iter.next(typeof found === "boolean");\n if (done) {\n chunk = { done: true };\n } else {\n chunk = { done: false, value };\n cumul = Buffer2.concat([cumul, value]);\n const v = await proc.has_embed(cumul);\n if (typeof v == "string") {\n return [await proc.extract(cumul, v), false];\n }\n found = v;\n }\n } while (found !== false && !chunk.done);\n succ = true;\n await iter.next(true);\n if (found !== true) {\n return;\n }\n return [await proc.extract(cumul), false];\n } catch (err) {\n console.log(err);\n }\n } while (!succ);\n }));\n return ret.filter((e) => e).map((e) => e);\n};\n(async () => {\n onmessage = async (msg) => {\n const des = deserializeMessage(msg.data);\n switch (des.type) {\n case "ipc": {\n if (port1.onmessage)\n port1.onmessage(new MessageEvent("message", { data: des.res }));\n break;\n }\n case "cmd": {\n switch (des.fun) {\n case "processImage": {\n const res = await processImage(des.args[0], des.args[1], des.args[2], des.args[3]);\n const tr = [];\n for (const ef of res) {\n for (const e of ef[0]) {\n if (Buffer2.isBuffer(e.thumbnail) || e.thumbnail instanceof Uint8Array)\n tr.push(e.thumbnail.buffer);\n if (Buffer2.isBuffer(e.data) || e.data instanceof Uint8Array)\n tr.push(e.data.buffer);\n }\n }\n postMessage({\n type: "reply",\n id: des.id,\n res\n }, [...new Set(tr)]);\n }\n }\n break;\n }\n case "ag": {\n const cb = pendinggens[des.id].shift();\n if (cb) {\n cb(des.res);\n }\n break;\n }\n }\n };\n})();\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\n/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n'); + } + // src/main.ts + var ProcessWorker = Worker2; if (!supportedMainDomain(location.host) && !supportedAltDomain(location.host)) throw "PEE not supported here, skipping"; var qp; var csettings5; - var processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default, webm_default, gif_default]; + var processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default]; var cappState; settings.subscribe(async (b) => { if (!b) @@ -31820,68 +21586,13 @@ } } csettings5 = b; - processors = [ - ...!csettings5.te ? [thirdeye_default] : [], - pngv3_default, - pomf_default, - jpg_default, - webm_default, - gif_default - ]; }); appState.subscribe((v) => { cappState = v; }); - var processImage = async (srcs, fn, hex, prevurl) => { - const ret = await Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { - if (proc.skip) { - const md5 = import_buffer11.Buffer.from(hex, "base64"); - if (await proc.has_embed(md5, fn, prevurl) === true) { - return [await proc.extract(md5, fn), true]; - } - return; - } - let succ = false; - let cumul; - do { - try { - const n = await srcs.next(); - if (n.done) - return; - const iter = streamRemote(n.value); - if (!iter) - return; - cumul = import_buffer11.Buffer.alloc(0); - let found; - let chunk = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true }; - } else { - chunk = { done: false, value }; - cumul = import_buffer11.Buffer.concat([cumul, value]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return [await proc.extract(cumul, v), false]; - } - found = v; - } - } while (found !== false && !chunk.done); - succ = true; - await iter.next(true); - if (found !== true) { - return; - } - return [await proc.extract(cumul), false]; - } catch { - } - } while (!succ); - })); - return ret.filter((e) => e).map((e) => e); - }; var textToElement = (s) => document.createRange().createContextualFragment(s).children[0]; var pendingPosts = []; + var pendingNoPosts = []; var signalNewEmbeds = debounce(async () => { if (!csettings5) return; @@ -31890,16 +21601,20 @@ try { const boardname = location.pathname.match(/\/([^/]*)\//)[1]; const reshaped = Object.fromEntries([...new Set(pendingPosts.map((e) => e.op))].map((e) => [e, pendingPosts.filter((p) => p.op == e).map((e2) => e2.id)])); - console.log(reshaped); + const reshaped2 = Object.fromEntries([...new Set(pendingNoPosts.map((e) => e.op))].map((e) => [e, pendingPosts.filter((p) => p.op == e).map((e2) => e2.id)])); const res = await ifetch("https://shoujo.coom.tech/listing/" + boardname, { method: "POST", - body: JSON.stringify(reshaped), + body: JSON.stringify({ + emb: reshaped, + noemb: reshaped2 + }), headers: { "content-type": "application/json" } }); await res.json(); pendingPosts = []; + pendingNoPosts = []; } catch (e) { console.error(e); } @@ -31911,6 +21626,177 @@ return false; return typeof csettings5.cache == "boolean" ? csettings5.cache : location.hostname.includes("b4k"); }; + var cp; + var CommandProcessor = class { + constructor() { + this.processor = ProcessWorker(); + this.genid = 0; + this.pendinggens = {}; + this.cmdid = 0; + this.pendingprom = {}; + this.processor.onmessage = async (msg) => { + let gen; + let res; + switch (msg.data.type) { + case "ipc": + { + const id = msg.data.msg.id; + if (true) { + if (msg.data.msg.name == "corsFetch") { + sendCmd(msg.data.msg, msg.data.tr); + lqueue[id] = (res2) => { + this.processor.postMessage({ + type: "ipc", + id, + res: res2 + }); + }; + } else { + const repl = await sendCmd(msg.data.msg, msg.data.tr); + repl.id = id; + this.processor.postMessage({ + type: "ipc", + id, + res: repl + }); + } + } else { + if (msg.data.msg.name == "fullyRead") { + this.processor.postMessage({ + type: "ipc", + res: { + id, + ok: 1 + } + }); + } + if (msg.data.msg.name == "corsFetch") { + const { args } = msg.data.msg; + const res2 = await ifetch(args[0], args[1]); + const headersStr = res2.responseHeaders; + const headerObj = headerStringToObject2(headersStr); + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + ok: res2.ok || true, + setRes: true, + headers: headerObj, + responseHeaders: headersStr, + redirected: res2.redirected, + type: res2.type, + url: res2.url, + status: res2.status, + bodyUsed: res2.bodyUsed, + statusText: res2.statusText + } + }); + if (!args[1].method || ["GET", "POST"].includes(args[1].method)) { + const data = await res2.arrayBuffer(); + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + pushData: { + data + } + } + }, [data]); + } + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + pushData: {} + } + }, []); + } + } + } + break; + case "reply": + if (msg.data.id in this.pendingprom) { + this.pendingprom[msg.data.id](msg.data.res); + delete this.pendingprom[msg.data.id]; + } + break; + case "ag": + gen = this.pendinggens[msg.data.id]; + res = await gen.next(msg.data.args); + if (res.done) { + delete this.pendinggens[msg.data.id]; + } + this.processor.postMessage({ + type: "ag", + id: msg.data.id, + res + }); + break; + } + }; + } + serializeArg(m) { + if (m[Symbol.toStringTag] == "AsyncGenerator") { + const genid = this.genid++; + this.pendinggens[genid] = m; + return { + type: "AsyncGenerator", + id: genid + }; + } + return m; + } + sendCmd(cmd, ...args) { + const id = this.cmdid++; + this.processor.postMessage({ + type: "cmd", + id, + fun: cmd, + args: args.map((a) => this.serializeArg(a)) + }); + return new Promise((res) => { + this.pendingprom[id] = res; + }); + } + sendAg(id, res) { + this.processor.postMessage({ + type: "ag", + id, + res + }); + } + processImage(origlink, fn, md5, thumb) { + return this.sendCmd("processImage", origlink, fn, md5, thumb); + } + }; + var convertToLocalEmbed = (wef) => { + let ret; + ret = wef; + if (typeof wef.data == "object") { + if (!(wef.data instanceof Uint8Array)) { + const ref = wef.data; + if (!wef.thumbnail) + return wef; + ret = { + ...wef, + thumbnail: import_buffer9.Buffer.from(wef.thumbnail), + data: async (lsn) => { + return import_buffer9.Buffer.from(await (await ifetch(ref.url, { headers: ref.headers }, lsn)).arrayBuffer()); + } + }; + } + } + if (wef.data instanceof Uint8Array) { + ret.data = import_buffer9.Buffer.from(wef.data); + } + if (wef.thumbnail instanceof Uint8Array) { + ret.thumbnail = import_buffer9.Buffer.from(wef.thumbnail); + } + return ret; + }; var processPost = async (post) => { const origlink = qp.getImageLink(post); if (!origlink) @@ -31919,25 +21805,39 @@ if (!thumbLink) return; let res2 = void 0; + const op = +location.pathname.match(/\/thread\/(.*)/)[1]; const reportEmbed = () => { if (!csettings5) - return false; + return; if (csettings5.tm) { if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { if (!cappState.isCatalog) { - const op = +location.pathname.match(/\/thread\/(.*)/)[1]; pendingPosts.push({ id: +post.id.match(/([0-9]+)/)[1], op }); signalNewEmbeds(); } } } }; + const reportNoEmbed = () => { + if (!csettings5) + return; + if (csettings5.tm) { + if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { + if (!cappState.isCatalog) { + pendingNoPosts.push({ id: +post.id.match(/([0-9]+)/)[1], op }); + signalNewEmbeds(); + } + } + } + }; try { if (shouldUseCache()) { res2 = await getEmbedsFromCache(qp.getCurrentBoard(), +qp.getCurrentThread(), post.id); } if (!res2) { - res2 = await processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2 = []; + const tmp = await cp.processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2.push(...tmp); res2 = res2?.filter((e) => e); } } catch (e) { @@ -31945,10 +21845,10 @@ return; } if (!res2 || res2.length == 0) - return; + return reportNoEmbed(); reportEmbed(); post.querySelector(".post")?.classList.add("embedfound"); - processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [k, e[1]]))); + processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [convertToLocalEmbed(k), e[1]]))); }; var versionCheck = async () => { const txt = await (await ifetch("https://raw.githubusercontent.com/coomdev/pngextraembedder/main/main.meta.js")).text(); @@ -31958,111 +21858,8 @@ fireNotification("info", `Last PEE version is ${lmajor}.${lminor}, you're on ${major}.${minor}`); } }; - function copyTextToClipboard(text3) { - const copyFrom = document.createElement("textarea"); - copyFrom.textContent = text3; - document.body.appendChild(copyFrom); - copyFrom.select(); - document.execCommand("copy"); - copyFrom.blur(); - document.body.removeChild(copyFrom); - navigator.clipboard.writeText(text3); - } var scrapeBoard = async (self) => { - if (!csettings5) - return false; - if (csettings5.tm) { - fireNotification("success", "Scrapping board with telemetry on! Thank you for your service, selfless stranger ;_;7"); - } - self.disabled = true; - self.textContent = "Searching..."; - const boardname = location.pathname.match(/\/([^/]*)\//)[1]; - const res = await ifetch(`https://a.4cdn.org/${boardname}/threads.json`); - const pages = await res.json(); - fireNotification("info", "Fetching all threads..."); - const threads = (await Promise.all(pages.reduce((a, b) => [...a, ...b.threads], []).map((e) => e.no).map(async (id) => { - try { - const res2 = await ifetch(`https://a.4cdn.org/${boardname}/thread/${id}.json`); - return await res2.json(); - } catch { - return void 0; - } - }))).filter((e) => e).map((e) => e); - const filenames = threads.reduce((a, b) => [...a, ...b.posts.filter((p) => p.ext).map((p) => p)], []).filter((p) => p.ext != ".webm" && p.ext != ".gif").map((p) => [p.resto || p.no, `https://i.4cdn.org/${boardname}/${p.tim}${p.ext}`, p.md5, p.filename + p.ext, p.no]); - console.log(filenames); - fireNotification("info", "Analyzing images..."); - const n = 1; - const processFile = (src, fn, hex) => { - return Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { - if (proc.skip) { - const md5 = import_buffer11.Buffer.from(hex, "base64"); - return await proc.has_embed(md5, fn); - } - const iter = streamRemote(src); - if (!iter) - return false; - let cumul = import_buffer11.Buffer.alloc(0); - let found; - let chunk = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true }; - } else { - chunk = { done: false, value }; - cumul = import_buffer11.Buffer.concat([cumul, value]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return true; - } - found = v; - } - } while (found !== false && !chunk.done); - await iter.next(true); - return found === true; - })); - }; - const range = ~~(filenames.length / n) + 1; - const hasEmbed = []; - const total = filenames.length; - let processed = 0; - const int = setInterval(() => { - fireNotification("info", `Processed [${processed} / ${total}] files`); - }, 5e3); - await Promise.all([...new Array(n + 1)].map(async (e, i) => { - const postsslice = filenames.slice(i * range, (i + 1) * range); - for (const post of postsslice) { - try { - const res2 = await processFile(post[1], post[3], post[2]); - processed++; - if (res2.some((e2) => e2)) { - hasEmbed.push(post); - if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { - pendingPosts.push({ id: post[4], op: post[0] }); - signalNewEmbeds(); - } - } - } catch (e2) { - console.log(e2); - } - } - })); - clearInterval(int); - const counters = {}; - for (const k of hasEmbed) - counters[k[0]] = k[0] in counters ? counters[k[0]] + 1 : 1; - console.log(counters); - fireNotification("success", "Processing finished! Results pasted in the clipboard"); - const text3 = Object.entries(counters).sort((a, b) => b[1] - a[1]).map((e) => `>>${e[0]} (${e[1]})`).join("\n"); - console.log(text3); - copyTextToClipboard(text3); - self.textContent = "Copy Results"; - self.disabled = false; - self.onclick = () => { - copyTextToClipboard(text3); - }; }; - var __DOMParser = false ? _DOMParser : DOMParser; var gmo; var earlystartup = async () => { if (["arch.b4k.co", "desuarchive.org"].includes(location.host) && false) { @@ -32185,6 +21982,12 @@ Use the WebExtension version of PEE if you want to use b4k!`); mo2.observe(document.documentElement, { childList: true, subtree: true }); await bodyInit; } + try { + cp = new CommandProcessor(); + } catch { + alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list."); + return; + } if (!is4chanX && location.host.startsWith("boards.4chan")) { const notificationHost = document.createElement("span"); new NotificationsHandler_default({ @@ -32382,7 +22185,7 @@ Use the WebExtension version of PEE if you want to use b4k!`); const text3 = new TextEmbeddings_default({ target: textInsertCursor, props: { - files: ress.map((e) => e[0]).filter((e) => import_buffer11.Buffer.isBuffer(e.data) && e.filename.endsWith(".txt") && e.filename.startsWith("message")) + files: ress.map((e) => e[0]).filter((e) => (import_buffer9.Buffer.isBuffer(e.data) || e.data instanceof Uint8Array) && e.filename.endsWith(".txt") && e.filename.startsWith("message")) } }); const emb = new Embeddings_default({ @@ -32420,12 +22223,6 @@ Use the WebExtension version of PEE if you want to use b4k!`); post.setAttribute("data-processed", "true"); } })(); -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ /*! * The buffer module from node.js, for the browser. * diff --git a/firefox/manifest.json b/firefox/manifest.json index 32f9cea..060f486 100644 --- a/firefox/manifest.json +++ b/firefox/manifest.json @@ -7,7 +7,7 @@ }, "name": "PngExtraEmbedder", "description": "Discover embedded files on 4chan and archives!", - "version": "0.291", + "version": "0.292", "icons": { "64": "1449696017588.png" }, diff --git a/firefox_update.json b/firefox_update.json index 80de929..35ed49b 100644 --- a/firefox_update.json +++ b/firefox_update.json @@ -1 +1 @@ -{"addons":{"{34ac4994-07f2-44d2-8599-682516a6c6a6}":{"updates":[{"version":"0.291","update_link":"https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.291.xpi"}]}}} \ No newline at end of file +{"addons":{"{34ac4994-07f2-44d2-8599-682516a6c6a6}":{"updates":[{"version":"0.292","update_link":"https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.292.xpi"}]}}} \ No newline at end of file diff --git a/main.d.ts b/main.d.ts index 481250e..6b51c80 100644 --- a/main.d.ts +++ b/main.d.ts @@ -140,7 +140,7 @@ declare module "jpeg-js/lib/decoder" { declare const QR: any; declare const BUILD_VERSION: [number, number]; -declare const execution_mode: 'userscript' | 'chrome_api' | 'ff_api'; +declare const execution_mode: 'userscript' | 'chrome_api' | 'ff_api' | 'worker'; declare const isBackground: boolean; declare const chrome: typeof browser; declare const _DOMParser: typeof DOMParser; diff --git a/main.meta.js b/main.meta.js index 57a1f2f..4022b11 100644 --- a/main.meta.js +++ b/main.meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.291 +// @version 0.292 // @description uhh // @author You // @match https://boards.4channel.org/* diff --git a/main.user.js b/main.user.js index 1b42d06..9859959 100644 --- a/main.user.js +++ b/main.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.291 +// @version 0.292 // @description uhh // @author You // @match https://boards.4channel.org/* @@ -109,7 +109,7 @@ const _DOMParser = DOMParser; var define_BUILD_VERSION_default; var init_define_BUILD_VERSION = __esm({ ""() { - define_BUILD_VERSION_default = [0, 291]; + define_BUILD_VERSION_default = [0, 292]; } }); @@ -307,13 +307,13 @@ const _DOMParser = DOMParser; var base64 = require_base64_js(); var ieee7542 = require_ieee754(); var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer18; + exports.Buffer = Buffer14; exports.SlowBuffer = SlowBuffer; exports.INSPECT_MAX_BYTES = 50; var K_MAX_LENGTH = 2147483647; exports.kMaxLength = K_MAX_LENGTH; - Buffer18.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer18.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { + Buffer14.TYPED_ARRAY_SUPPORT = typedArraySupport(); + if (!Buffer14.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); } function typedArraySupport() { @@ -329,18 +329,18 @@ const _DOMParser = DOMParser; return false; } } - Object.defineProperty(Buffer18.prototype, "parent", { + Object.defineProperty(Buffer14.prototype, "parent", { enumerable: true, get: function() { - if (!Buffer18.isBuffer(this)) + if (!Buffer14.isBuffer(this)) return void 0; return this.buffer; } }); - Object.defineProperty(Buffer18.prototype, "offset", { + Object.defineProperty(Buffer14.prototype, "offset", { enumerable: true, get: function() { - if (!Buffer18.isBuffer(this)) + if (!Buffer14.isBuffer(this)) return void 0; return this.byteOffset; } @@ -350,10 +350,10 @@ const _DOMParser = DOMParser; throw new RangeError('The value "' + length + '" is invalid for option "size"'); } const buf2 = new Uint8Array(length); - Object.setPrototypeOf(buf2, Buffer18.prototype); + Object.setPrototypeOf(buf2, Buffer14.prototype); return buf2; } - function Buffer18(arg, encodingOrOffset, length) { + function Buffer14(arg, encodingOrOffset, length) { if (typeof arg === "number") { if (typeof encodingOrOffset === "string") { throw new TypeError('The "string" argument must be of type string. Received type number'); @@ -362,7 +362,7 @@ const _DOMParser = DOMParser; } return from(arg, encodingOrOffset, length); } - Buffer18.poolSize = 8192; + Buffer14.poolSize = 8192; function from(value, encodingOrOffset, length) { if (typeof value === "string") { return fromString(value, encodingOrOffset); @@ -384,21 +384,21 @@ const _DOMParser = DOMParser; } const valueOf = value.valueOf && value.valueOf(); if (valueOf != null && valueOf !== value) { - return Buffer18.from(valueOf, encodingOrOffset, length); + return Buffer14.from(valueOf, encodingOrOffset, length); } const b = fromObject(value); if (b) return b; if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer18.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); + return Buffer14.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); } throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); } - Buffer18.from = function(value, encodingOrOffset, length) { + Buffer14.from = function(value, encodingOrOffset, length) { return from(value, encodingOrOffset, length); }; - Object.setPrototypeOf(Buffer18.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer18, Uint8Array); + Object.setPrototypeOf(Buffer14.prototype, Uint8Array.prototype); + Object.setPrototypeOf(Buffer14, Uint8Array); function assertSize(size) { if (typeof size !== "number") { throw new TypeError('"size" argument must be of type number'); @@ -416,24 +416,24 @@ const _DOMParser = DOMParser; } return createBuffer(size); } - Buffer18.alloc = function(size, fill, encoding) { + Buffer14.alloc = function(size, fill, encoding) { return alloc(size, fill, encoding); }; function allocUnsafe(size) { assertSize(size); return createBuffer(size < 0 ? 0 : checked(size) | 0); } - Buffer18.allocUnsafe = function(size) { + Buffer14.allocUnsafe = function(size) { return allocUnsafe(size); }; - Buffer18.allocUnsafeSlow = function(size) { + Buffer14.allocUnsafeSlow = function(size) { return allocUnsafe(size); }; function fromString(string, encoding) { if (typeof encoding !== "string" || encoding === "") { encoding = "utf8"; } - if (!Buffer18.isEncoding(encoding)) { + if (!Buffer14.isEncoding(encoding)) { throw new TypeError("Unknown encoding: " + encoding); } const length = byteLength(string, encoding) | 0; @@ -474,11 +474,11 @@ const _DOMParser = DOMParser; } else { buf2 = new Uint8Array(array, byteOffset, length); } - Object.setPrototypeOf(buf2, Buffer18.prototype); + Object.setPrototypeOf(buf2, Buffer14.prototype); return buf2; } function fromObject(obj) { - if (Buffer18.isBuffer(obj)) { + if (Buffer14.isBuffer(obj)) { const len = checked(obj.length) | 0; const buf2 = createBuffer(len); if (buf2.length === 0) { @@ -507,17 +507,17 @@ const _DOMParser = DOMParser; if (+length != length) { length = 0; } - return Buffer18.alloc(+length); + return Buffer14.alloc(+length); } - Buffer18.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer18.prototype; + Buffer14.isBuffer = function isBuffer(b) { + return b != null && b._isBuffer === true && b !== Buffer14.prototype; }; - Buffer18.compare = function compare(a, b) { + Buffer14.compare = function compare(a, b) { if (isInstance(a, Uint8Array)) - a = Buffer18.from(a, a.offset, a.byteLength); + a = Buffer14.from(a, a.offset, a.byteLength); if (isInstance(b, Uint8Array)) - b = Buffer18.from(b, b.offset, b.byteLength); - if (!Buffer18.isBuffer(a) || !Buffer18.isBuffer(b)) { + b = Buffer14.from(b, b.offset, b.byteLength); + if (!Buffer14.isBuffer(a) || !Buffer14.isBuffer(b)) { throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); } if (a === b) @@ -537,7 +537,7 @@ const _DOMParser = DOMParser; return 1; return 0; }; - Buffer18.isEncoding = function isEncoding(encoding) { + Buffer14.isEncoding = function isEncoding(encoding) { switch (String(encoding).toLowerCase()) { case "hex": case "utf8": @@ -555,12 +555,12 @@ const _DOMParser = DOMParser; return false; } }; - Buffer18.concat = function concat(list, length) { + Buffer14.concat = function concat(list, length) { if (!Array.isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers'); } if (list.length === 0) { - return Buffer18.alloc(0); + return Buffer14.alloc(0); } let i; if (length === void 0) { @@ -569,19 +569,19 @@ const _DOMParser = DOMParser; length += list[i].length; } } - const buffer = Buffer18.allocUnsafe(length); + const buffer = Buffer14.allocUnsafe(length); let pos = 0; for (i = 0; i < list.length; ++i) { let buf2 = list[i]; if (isInstance(buf2, Uint8Array)) { if (pos + buf2.length > buffer.length) { - if (!Buffer18.isBuffer(buf2)) - buf2 = Buffer18.from(buf2); + if (!Buffer14.isBuffer(buf2)) + buf2 = Buffer14.from(buf2); buf2.copy(buffer, pos); } else { Uint8Array.prototype.set.call(buffer, buf2, pos); } - } else if (!Buffer18.isBuffer(buf2)) { + } else if (!Buffer14.isBuffer(buf2)) { throw new TypeError('"list" argument must be an Array of Buffers'); } else { buf2.copy(buffer, pos); @@ -591,7 +591,7 @@ const _DOMParser = DOMParser; return buffer; }; function byteLength(string, encoding) { - if (Buffer18.isBuffer(string)) { + if (Buffer14.isBuffer(string)) { return string.length; } if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { @@ -632,7 +632,7 @@ const _DOMParser = DOMParser; } } } - Buffer18.byteLength = byteLength; + Buffer14.byteLength = byteLength; function slowToString(encoding, start, end) { let loweredCase = false; if (start === void 0 || start < 0) { @@ -681,13 +681,13 @@ const _DOMParser = DOMParser; } } } - Buffer18.prototype._isBuffer = true; + Buffer14.prototype._isBuffer = true; function swap(b, n, m) { const i = b[n]; b[n] = b[m]; b[m] = i; } - Buffer18.prototype.swap16 = function swap16() { + Buffer14.prototype.swap16 = function swap16() { const len = this.length; if (len % 2 !== 0) { throw new RangeError("Buffer size must be a multiple of 16-bits"); @@ -697,7 +697,7 @@ const _DOMParser = DOMParser; } return this; }; - Buffer18.prototype.swap32 = function swap32() { + Buffer14.prototype.swap32 = function swap32() { const len = this.length; if (len % 4 !== 0) { throw new RangeError("Buffer size must be a multiple of 32-bits"); @@ -708,7 +708,7 @@ const _DOMParser = DOMParser; } return this; }; - Buffer18.prototype.swap64 = function swap64() { + Buffer14.prototype.swap64 = function swap64() { const len = this.length; if (len % 8 !== 0) { throw new RangeError("Buffer size must be a multiple of 64-bits"); @@ -721,7 +721,7 @@ const _DOMParser = DOMParser; } return this; }; - Buffer18.prototype.toString = function toString2() { + Buffer14.prototype.toString = function toString2() { const length = this.length; if (length === 0) return ""; @@ -729,15 +729,15 @@ const _DOMParser = DOMParser; return utf8Slice(this, 0, length); return slowToString.apply(this, arguments); }; - Buffer18.prototype.toLocaleString = Buffer18.prototype.toString; - Buffer18.prototype.equals = function equals(b) { - if (!Buffer18.isBuffer(b)) + Buffer14.prototype.toLocaleString = Buffer14.prototype.toString; + Buffer14.prototype.equals = function equals(b) { + if (!Buffer14.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); if (this === b) return true; - return Buffer18.compare(this, b) === 0; + return Buffer14.compare(this, b) === 0; }; - Buffer18.prototype.inspect = function inspect() { + Buffer14.prototype.inspect = function inspect() { let str = ""; const max = exports.INSPECT_MAX_BYTES; str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); @@ -746,13 +746,13 @@ const _DOMParser = DOMParser; return ""; }; if (customInspectSymbol) { - Buffer18.prototype[customInspectSymbol] = Buffer18.prototype.inspect; + Buffer14.prototype[customInspectSymbol] = Buffer14.prototype.inspect; } - Buffer18.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { + Buffer14.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { if (isInstance(target, Uint8Array)) { - target = Buffer18.from(target, target.offset, target.byteLength); + target = Buffer14.from(target, target.offset, target.byteLength); } - if (!Buffer18.isBuffer(target)) { + if (!Buffer14.isBuffer(target)) { throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); } if (start === void 0) { @@ -832,9 +832,9 @@ const _DOMParser = DOMParser; return -1; } if (typeof val === "string") { - val = Buffer18.from(val, encoding); + val = Buffer14.from(val, encoding); } - if (Buffer18.isBuffer(val)) { + if (Buffer14.isBuffer(val)) { if (val.length === 0) { return -1; } @@ -907,13 +907,13 @@ const _DOMParser = DOMParser; } return -1; } - Buffer18.prototype.includes = function includes(val, byteOffset, encoding) { + Buffer14.prototype.includes = function includes(val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1; }; - Buffer18.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + Buffer14.prototype.indexOf = function indexOf(val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true); }; - Buffer18.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + Buffer14.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false); }; function hexWrite(buf2, string, offset, length) { @@ -952,7 +952,7 @@ const _DOMParser = DOMParser; function ucs2Write(buf2, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length); } - Buffer18.prototype.write = function write2(string, offset, length, encoding) { + Buffer14.prototype.write = function write2(string, offset, length, encoding) { if (offset === void 0) { encoding = "utf8"; length = this.length; @@ -1009,7 +1009,7 @@ const _DOMParser = DOMParser; } } }; - Buffer18.prototype.toJSON = function toJSON() { + Buffer14.prototype.toJSON = function toJSON() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) @@ -1131,7 +1131,7 @@ const _DOMParser = DOMParser; } return res; } - Buffer18.prototype.slice = function slice(start, end) { + Buffer14.prototype.slice = function slice(start, end) { const len = this.length; start = ~~start; end = end === void 0 ? len : ~~end; @@ -1152,7 +1152,7 @@ const _DOMParser = DOMParser; if (end < start) end = start; const newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer18.prototype); + Object.setPrototypeOf(newBuf, Buffer14.prototype); return newBuf; }; function checkOffset(offset, ext, length) { @@ -1161,7 +1161,7 @@ const _DOMParser = DOMParser; if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length"); } - Buffer18.prototype.readUintLE = Buffer18.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { + Buffer14.prototype.readUintLE = Buffer14.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1174,7 +1174,7 @@ const _DOMParser = DOMParser; } return val; }; - Buffer18.prototype.readUintBE = Buffer18.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { + Buffer14.prototype.readUintBE = Buffer14.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) { @@ -1187,37 +1187,37 @@ const _DOMParser = DOMParser; } return val; }; - Buffer18.prototype.readUint8 = Buffer18.prototype.readUInt8 = function readUInt8(offset, noAssert) { + Buffer14.prototype.readUint8 = Buffer14.prototype.readUInt8 = function readUInt8(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 1, this.length); return this[offset]; }; - Buffer18.prototype.readUint16LE = Buffer18.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + Buffer14.prototype.readUint16LE = Buffer14.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] | this[offset + 1] << 8; }; - Buffer18.prototype.readUint16BE = Buffer18.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + Buffer14.prototype.readUint16BE = Buffer14.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] << 8 | this[offset + 1]; }; - Buffer18.prototype.readUint32LE = Buffer18.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + Buffer14.prototype.readUint32LE = Buffer14.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; }; - Buffer18.prototype.readUint32BE = Buffer18.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + Buffer14.prototype.readUint32BE = Buffer14.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); }; - Buffer18.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { + Buffer14.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1229,7 +1229,7 @@ const _DOMParser = DOMParser; const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24; return BigInt(lo) + (BigInt(hi) << BigInt(32)); }); - Buffer18.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { + Buffer14.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1241,7 +1241,7 @@ const _DOMParser = DOMParser; const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last; return (BigInt(hi) << BigInt(32)) + BigInt(lo); }); - Buffer18.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { + Buffer14.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1257,7 +1257,7 @@ const _DOMParser = DOMParser; val -= Math.pow(2, 8 * byteLength2); return val; }; - Buffer18.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { + Buffer14.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; if (!noAssert) @@ -1273,7 +1273,7 @@ const _DOMParser = DOMParser; val -= Math.pow(2, 8 * byteLength2); return val; }; - Buffer18.prototype.readInt8 = function readInt8(offset, noAssert) { + Buffer14.prototype.readInt8 = function readInt8(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 1, this.length); @@ -1281,33 +1281,33 @@ const _DOMParser = DOMParser; return this[offset]; return (255 - this[offset] + 1) * -1; }; - Buffer18.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + Buffer14.prototype.readInt16LE = function readInt16LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); const val = this[offset] | this[offset + 1] << 8; return val & 32768 ? val | 4294901760 : val; }; - Buffer18.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + Buffer14.prototype.readInt16BE = function readInt16BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 2, this.length); const val = this[offset + 1] | this[offset] << 8; return val & 32768 ? val | 4294901760 : val; }; - Buffer18.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + Buffer14.prototype.readInt32LE = function readInt32LE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; }; - Buffer18.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + Buffer14.prototype.readInt32BE = function readInt32BE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; }; - Buffer18.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { + Buffer14.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1318,7 +1318,7 @@ const _DOMParser = DOMParser; const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24); return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); }); - Buffer18.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { + Buffer14.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { offset = offset >>> 0; validateNumber(offset, "offset"); const first = this[offset]; @@ -1329,39 +1329,39 @@ const _DOMParser = DOMParser; const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset]; return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last); }); - Buffer18.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + Buffer14.prototype.readFloatLE = function readFloatLE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return ieee7542.read(this, offset, true, 23, 4); }; - Buffer18.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + Buffer14.prototype.readFloatBE = function readFloatBE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 4, this.length); return ieee7542.read(this, offset, false, 23, 4); }; - Buffer18.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + Buffer14.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 8, this.length); return ieee7542.read(this, offset, true, 52, 8); }; - Buffer18.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + Buffer14.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { offset = offset >>> 0; if (!noAssert) checkOffset(offset, 8, this.length); return ieee7542.read(this, offset, false, 52, 8); }; function checkInt(buf2, value, offset, ext, max, min) { - if (!Buffer18.isBuffer(buf2)) + if (!Buffer14.isBuffer(buf2)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); if (offset + ext > buf2.length) throw new RangeError("Index out of range"); } - Buffer18.prototype.writeUintLE = Buffer18.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeUintLE = Buffer14.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; @@ -1377,7 +1377,7 @@ const _DOMParser = DOMParser; } return offset + byteLength2; }; - Buffer18.prototype.writeUintBE = Buffer18.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeUintBE = Buffer14.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; byteLength2 = byteLength2 >>> 0; @@ -1393,7 +1393,7 @@ const _DOMParser = DOMParser; } return offset + byteLength2; }; - Buffer18.prototype.writeUint8 = Buffer18.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + Buffer14.prototype.writeUint8 = Buffer14.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1401,7 +1401,7 @@ const _DOMParser = DOMParser; this[offset] = value & 255; return offset + 1; }; - Buffer18.prototype.writeUint16LE = Buffer18.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { + Buffer14.prototype.writeUint16LE = Buffer14.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1410,7 +1410,7 @@ const _DOMParser = DOMParser; this[offset + 1] = value >>> 8; return offset + 2; }; - Buffer18.prototype.writeUint16BE = Buffer18.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { + Buffer14.prototype.writeUint16BE = Buffer14.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1419,7 +1419,7 @@ const _DOMParser = DOMParser; this[offset + 1] = value & 255; return offset + 2; }; - Buffer18.prototype.writeUint32LE = Buffer18.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { + Buffer14.prototype.writeUint32LE = Buffer14.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1430,7 +1430,7 @@ const _DOMParser = DOMParser; this[offset] = value & 255; return offset + 4; }; - Buffer18.prototype.writeUint32BE = Buffer18.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { + Buffer14.prototype.writeUint32BE = Buffer14.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1481,13 +1481,13 @@ const _DOMParser = DOMParser; buf2[offset] = hi; return offset + 8; } - Buffer18.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { + Buffer14.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); }); - Buffer18.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { + Buffer14.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); }); - Buffer18.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) { @@ -1506,7 +1506,7 @@ const _DOMParser = DOMParser; } return offset + byteLength2; }; - Buffer18.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { + Buffer14.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) { @@ -1525,7 +1525,7 @@ const _DOMParser = DOMParser; } return offset + byteLength2; }; - Buffer18.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + Buffer14.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1535,7 +1535,7 @@ const _DOMParser = DOMParser; this[offset] = value & 255; return offset + 1; }; - Buffer18.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + Buffer14.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1544,7 +1544,7 @@ const _DOMParser = DOMParser; this[offset + 1] = value >>> 8; return offset + 2; }; - Buffer18.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + Buffer14.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1553,7 +1553,7 @@ const _DOMParser = DOMParser; this[offset + 1] = value & 255; return offset + 2; }; - Buffer18.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + Buffer14.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1564,7 +1564,7 @@ const _DOMParser = DOMParser; this[offset + 3] = value >>> 24; return offset + 4; }; - Buffer18.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + Buffer14.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { value = +value; offset = offset >>> 0; if (!noAssert) @@ -1577,10 +1577,10 @@ const _DOMParser = DOMParser; this[offset + 3] = value & 255; return offset + 4; }; - Buffer18.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { + Buffer14.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); }); - Buffer18.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { + Buffer14.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); }); function checkIEEE754(buf2, value, offset, ext, max, min) { @@ -1598,10 +1598,10 @@ const _DOMParser = DOMParser; ieee7542.write(buf2, value, offset, littleEndian, 23, 4); return offset + 4; } - Buffer18.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + Buffer14.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert); }; - Buffer18.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + Buffer14.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert); }; function writeDouble(buf2, value, offset, littleEndian, noAssert) { @@ -1613,14 +1613,14 @@ const _DOMParser = DOMParser; ieee7542.write(buf2, value, offset, littleEndian, 52, 8); return offset + 8; } - Buffer18.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { + Buffer14.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert); }; - Buffer18.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { + Buffer14.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert); }; - Buffer18.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer18.isBuffer(target)) + Buffer14.prototype.copy = function copy(target, targetStart, start, end) { + if (!Buffer14.isBuffer(target)) throw new TypeError("argument should be a Buffer"); if (!start) start = 0; @@ -1656,7 +1656,7 @@ const _DOMParser = DOMParser; } return len; }; - Buffer18.prototype.fill = function fill(val, start, end, encoding) { + Buffer14.prototype.fill = function fill(val, start, end, encoding) { if (typeof val === "string") { if (typeof start === "string") { encoding = start; @@ -1669,7 +1669,7 @@ const _DOMParser = DOMParser; if (encoding !== void 0 && typeof encoding !== "string") { throw new TypeError("encoding must be a string"); } - if (typeof encoding === "string" && !Buffer18.isEncoding(encoding)) { + if (typeof encoding === "string" && !Buffer14.isEncoding(encoding)) { throw new TypeError("Unknown encoding: " + encoding); } if (val.length === 1) { @@ -1699,7 +1699,7 @@ const _DOMParser = DOMParser; this[i] = val; } } else { - const bytes = Buffer18.isBuffer(val) ? val : Buffer18.from(val, encoding); + const bytes = Buffer14.isBuffer(val) ? val : Buffer14.from(val, encoding); const len = bytes.length; if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"'); @@ -1946,6 +1946,119 @@ const _DOMParser = DOMParser; } }); + // node_modules/crc-32/crc32.js + var require_crc32 = __commonJS({ + "node_modules/crc-32/crc32.js"(exports) { + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var CRC32; + (function(factory) { + if (typeof DO_NOT_EXPORT_CRC === "undefined") { + if (typeof exports === "object") { + factory(exports); + } else if (typeof define === "function" && define.amd) { + define(function() { + var module2 = {}; + factory(module2); + return module2; + }); + } else { + factory(CRC32 = {}); + } + } else { + factory(CRC32 = {}); + } + })(function(CRC322) { + CRC322.version = "1.2.0"; + function signed_crc_table() { + var c = 0, table = new Array(256); + for (var n = 0; n != 256; ++n) { + c = n; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; + table[n] = c; + } + return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; + } + var T = signed_crc_table(); + function crc32_bstr(bstr, seed) { + var C = seed ^ -1, L = bstr.length - 1; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; + } + if (i === L) + C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255]; + return C ^ -1; + } + function crc32_buf(buf2, seed) { + if (buf2.length > 1e4) + return crc32_buf_8(buf2, seed); + var C = seed ^ -1, L = buf2.length - 3; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + } + while (i < L + 3) + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + return C ^ -1; + } + function crc32_buf_8(buf2, seed) { + var C = seed ^ -1, L = buf2.length - 7; + for (var i = 0; i < L; ) { + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + } + while (i < L + 7) + C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + return C ^ -1; + } + function crc32_str(str, seed) { + var C = seed ^ -1; + for (var i = 0, L = str.length, c, d; i < L; ) { + c = str.charCodeAt(i++); + if (c < 128) { + C = C >>> 8 ^ T[(C ^ c) & 255]; + } else if (c < 2048) { + C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + } else if (c >= 55296 && c < 57344) { + c = (c & 1023) + 64; + d = str.charCodeAt(i++) & 1023; + C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255]; + } else { + C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255]; + C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + } + } + return C ^ -1; + } + CRC322.table = T; + CRC322.bstr = crc32_bstr; + CRC322.buf = crc32_buf; + CRC322.str = crc32_str; + }); + } + }); + // node_modules/events/events.js var require_events = __commonJS({ "node_modules/events/events.js"(exports, module) { @@ -2316,1472 +2429,501 @@ const _DOMParser = DOMParser; } }); - // node_modules/browser-process/dist/api_error.js - var require_api_error = __commonJS({ - "node_modules/browser-process/dist/api_error.js"(exports) { + // node_modules/readable-stream/lib/internal/streams/stream-browser.js + var require_stream_browser = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var Buffer18 = Buffer18; - (function(ErrorCode2) { - ErrorCode2[ErrorCode2["EPERM"] = 0] = "EPERM"; - ErrorCode2[ErrorCode2["ENOENT"] = 1] = "ENOENT"; - ErrorCode2[ErrorCode2["EIO"] = 2] = "EIO"; - ErrorCode2[ErrorCode2["EBADF"] = 3] = "EBADF"; - ErrorCode2[ErrorCode2["EACCES"] = 4] = "EACCES"; - ErrorCode2[ErrorCode2["EBUSY"] = 5] = "EBUSY"; - ErrorCode2[ErrorCode2["EEXIST"] = 6] = "EEXIST"; - ErrorCode2[ErrorCode2["ENOTDIR"] = 7] = "ENOTDIR"; - ErrorCode2[ErrorCode2["EISDIR"] = 8] = "EISDIR"; - ErrorCode2[ErrorCode2["EINVAL"] = 9] = "EINVAL"; - ErrorCode2[ErrorCode2["EFBIG"] = 10] = "EFBIG"; - ErrorCode2[ErrorCode2["ENOSPC"] = 11] = "ENOSPC"; - ErrorCode2[ErrorCode2["EROFS"] = 12] = "EROFS"; - ErrorCode2[ErrorCode2["ENOTEMPTY"] = 13] = "ENOTEMPTY"; - ErrorCode2[ErrorCode2["ENOTSUP"] = 14] = "ENOTSUP"; - })(exports.ErrorCode || (exports.ErrorCode = {})); - var ErrorCode = exports.ErrorCode; - var ErrorStrings = {}; - ErrorStrings[ErrorCode.EPERM] = "Operation not permitted."; - ErrorStrings[ErrorCode.ENOENT] = "No such file or directory."; - ErrorStrings[ErrorCode.EIO] = "Input/output error."; - ErrorStrings[ErrorCode.EBADF] = "Bad file descriptor."; - ErrorStrings[ErrorCode.EACCES] = "Permission denied."; - ErrorStrings[ErrorCode.EBUSY] = "Resource busy or locked."; - ErrorStrings[ErrorCode.EEXIST] = "File exists."; - ErrorStrings[ErrorCode.ENOTDIR] = "File is not a directory."; - ErrorStrings[ErrorCode.EISDIR] = "File is a directory."; - ErrorStrings[ErrorCode.EINVAL] = "Invalid argument."; - ErrorStrings[ErrorCode.EFBIG] = "File is too big."; - ErrorStrings[ErrorCode.ENOSPC] = "No space left on disk."; - ErrorStrings[ErrorCode.EROFS] = "Cannot modify a read-only file system."; - ErrorStrings[ErrorCode.ENOTEMPTY] = "Directory is not empty."; - ErrorStrings[ErrorCode.ENOTSUP] = "Operation is not supported."; - var ApiError = function() { - function ApiError2(type, message) { - this.type = type; - this.code = ErrorCode[type]; - if (message != null) { - this.message = message; - } else { - this.message = ErrorStrings[type]; - } - } - ApiError2.prototype.toString = function() { - return this.code + ": " + ErrorStrings[this.type] + " " + this.message; - }; - ApiError2.prototype.writeToBuffer = function(buffer, i) { - if (buffer === void 0) { - buffer = new Buffer18(this.bufferSize()); - } - if (i === void 0) { - i = 0; - } - buffer.writeUInt8(this.type, i); - var bytesWritten = buffer.write(this.message, i + 5); - buffer.writeUInt32LE(bytesWritten, i + 1); - return buffer; - }; - ApiError2.fromBuffer = function(buffer, i) { - if (i === void 0) { - i = 0; - } - return new ApiError2(buffer.readUInt8(i), buffer.toString("utf8", i + 5, i + 5 + buffer.readUInt32LE(i + 1))); - }; - ApiError2.prototype.bufferSize = function() { - return 5 + Buffer18.byteLength(this.message); - }; - ApiError2.FileError = function(code, p) { - return new ApiError2(code, p + ": " + ErrorStrings[code]); - }; - ApiError2.ENOENT = function(path) { - return this.FileError(ErrorCode.ENOENT, path); - }; - ApiError2.EEXIST = function(path) { - return this.FileError(ErrorCode.EEXIST, path); - }; - ApiError2.EISDIR = function(path) { - return this.FileError(ErrorCode.EISDIR, path); - }; - ApiError2.ENOTDIR = function(path) { - return this.FileError(ErrorCode.ENOTDIR, path); - }; - ApiError2.EPERM = function(path) { - return this.FileError(ErrorCode.EPERM, path); - }; - return ApiError2; - }(); - exports.ApiError = ApiError; + module.exports = require_events().EventEmitter; } }); - // node_modules/browser-process/dist/node_eventemitter.js - var require_node_eventemitter = __commonJS({ - "node_modules/browser-process/dist/node_eventemitter.js"(exports) { + // (disabled):node_modules/util/util.js + var require_util = __commonJS({ + "(disabled):node_modules/util/util.js"() { init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports.__extends || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - function __() { - this.constructor = d; - } - __.prototype = b.prototype; - d.prototype = new __(); - }; - var events = require_events(); - var api_error = require_api_error(); - var ApiError = api_error.ApiError; - var ErrorCode = api_error.ErrorCode; - var BufferedEvent = function() { - function BufferedEvent2(data, encoding, cb) { - this.data = data; - this.encoding = encoding; - this.cb = cb; - this.size = typeof data !== "string" ? data.length : Buffer2.byteLength(data, encoding != null ? encoding : void 0); - if (typeof this.data !== "string") { - this.data = typeof this.data.sliceCopy !== "undefined" ? this.data.sliceCopy() : Buffer2.concat([this.data]); - } - } - BufferedEvent2.prototype.getData = function(encoding) { - if (encoding == null) { - if (typeof this.data === "string") { - return new Buffer2(this.data, this.encoding != null ? this.encoding : void 0); - } else { - return this.data; - } - } else { - if (typeof this.data === "string") { - if (encoding === this.encoding) { - return this.data; - } else { - return new Buffer2(this.data, this.encoding != null ? this.encoding : void 0).toString(encoding); - } - } else { - return this.data.toString(encoding); - } - } - }; - return BufferedEvent2; - }(); - var AbstractDuplexStream = function(_super) { - __extends(AbstractDuplexStream2, _super); - function AbstractDuplexStream2(writable2, readable) { - _super.call(this); - this.writable = writable2; - this.readable = readable; - this.encoding = null; - this.flowing = false; - this.buffer = []; - this.endEvent = null; - this.ended = false; - this.drained = true; - } - AbstractDuplexStream2.prototype.addListener = function(event, listener) { - var rv = _super.prototype.addListener.call(this, event, listener), _this = this; - if (event === "data" && !this.flowing) { - this.resume(); - } else if (event === "readable" && this.buffer.length > 0) { - setTimeout(function() { - _this.emit("readable"); - }, 0); - } - return rv; - }; - AbstractDuplexStream2.prototype._processArgs = function(data, arg2, arg3) { - if (typeof arg2 === "string") { - return new BufferedEvent(data, arg2, arg3); - } else { - return new BufferedEvent(data, null, arg2); - } - }; - AbstractDuplexStream2.prototype._processEvents = function() { - var drained = this.buffer.length === 0; - if (this.drained !== drained) { - if (this.drained) { - this.emit("readable"); - } - } - if (this.flowing && this.buffer.length !== 0) { - this.emit("data", this.read()); - } - this.drained = this.buffer.length === 0; - }; - AbstractDuplexStream2.prototype.emitEvent = function(type, event) { - this.emit(type, event.getData(this.encoding)); - if (event.cb) { - event.cb(); - } - }; - AbstractDuplexStream2.prototype.write = function(data, arg2, arg3) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Cannot write to an ended stream."); - } - var event = this._processArgs(data, arg2, arg3); - this._push(event); - return this.flowing; - }; - AbstractDuplexStream2.prototype.end = function(data, arg2, arg3) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Stream is already closed."); - } - var event = this._processArgs(data, arg2, arg3); - this.ended = true; - this.endEvent = event; - this._processEvents(); - }; - AbstractDuplexStream2.prototype.read = function(size) { - var events2 = [], eventsCbs = [], lastCb, eventsSize = 0, event, buff, trueSize, i = 0, sizeUnspecified = typeof size !== "number"; - if (sizeUnspecified) - size = 4294967295; - for (i = 0; i < this.buffer.length && eventsSize < size; i++) { - event = this.buffer[i]; - events2.push(event.getData()); - if (event.cb) { - eventsCbs.push(event.cb); - } - eventsSize += event.size; - lastCb = event.cb; - } - if (!sizeUnspecified && eventsSize < size) { - return null; - } - this.buffer = this.buffer.slice(events2.length); - trueSize = eventsSize > size ? size : eventsSize; - buff = Buffer2.concat(events2); - if (eventsSize > size) { - if (lastCb) - eventsCbs.pop(); - this._push(new BufferedEvent(buff.slice(size), null, lastCb)); - } - if (eventsCbs.length > 0) { - setTimeout(function() { - var i2; - for (i2 = 0; i2 < eventsCbs.length; i2++) { - eventsCbs[i2](); - } - }, 0); - } - if (this.ended && this.buffer.length === 0 && this.endEvent !== null) { - var endEvent = this.endEvent, _this = this; - this.endEvent = null; - setTimeout(function() { - _this.emitEvent("end", endEvent); - }, 0); - } - if (events2.length === 0) { - this.emit("_read"); - return null; - } else if (this.encoding === null) { - return buff.slice(0, trueSize); - } else { - return buff.toString(this.encoding, 0, trueSize); - } - }; - AbstractDuplexStream2.prototype.setEncoding = function(encoding) { - this.encoding = encoding; - }; - AbstractDuplexStream2.prototype.pause = function() { - this.flowing = false; - }; - AbstractDuplexStream2.prototype.resume = function() { - this.flowing = true; - this._processEvents(); - }; - AbstractDuplexStream2.prototype.pipe = function(destination, options) { - throw new ApiError(ErrorCode.EPERM, "Unimplemented."); - }; - AbstractDuplexStream2.prototype.unpipe = function(destination) { - }; - AbstractDuplexStream2.prototype.unshift = function(chunk) { - if (this.ended) { - throw new ApiError(ErrorCode.EPERM, "Stream has ended."); - } - this.buffer.unshift(new BufferedEvent(chunk, this.encoding)); - this._processEvents(); - }; - AbstractDuplexStream2.prototype._push = function(event) { - this.buffer.push(event); - this._processEvents(); - }; - AbstractDuplexStream2.prototype.wrap = function(stream) { - throw new ApiError(ErrorCode.EPERM, "Unimplemented."); - }; - return AbstractDuplexStream2; - }(events.EventEmitter); - exports.AbstractDuplexStream = AbstractDuplexStream; } }); - // node_modules/has-symbols/shams.js - var require_shams = __commonJS({ - "node_modules/has-symbols/shams.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/buffer_list.js + var require_buffer_list = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - module.exports = function hasSymbols() { - if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { - return false; - } - if (typeof Symbol.iterator === "symbol") { - return true; - } - var obj = {}; - var sym = Symbol("test"); - var symObj = Object(sym); - if (typeof sym === "string") { - return false; - } - if (Object.prototype.toString.call(sym) !== "[object Symbol]") { - return false; - } - if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { - return false; - } - var symVal = 42; - obj[sym] = symVal; - for (sym in obj) { - return false; - } - if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { - return false; + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) + symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); } - if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { - return false; + return keys; + } + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { + ownKeys(Object(source), true).forEach(function(key2) { + _defineProperty(target, key2, source[key2]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function(key2) { + Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); + }); + } } - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { - return false; + return target; + } + function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); + } else { + obj[key2] = value; } - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { - return false; + return obj; + } + function _classCallCheck(instance18, Constructor) { + if (!(instance18 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } - if (typeof Object.getOwnPropertyDescriptor === "function") { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { - return false; - } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); } - return true; - }; - } - }); - - // node_modules/has-tostringtag/shams.js - var require_shams2 = __commonJS({ - "node_modules/has-tostringtag/shams.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var hasSymbols = require_shams(); - module.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; - }; - } - }); - - // node_modules/has-symbols/index.js - var require_has_symbols = __commonJS({ - "node_modules/has-symbols/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var origSymbol = typeof Symbol !== "undefined" && Symbol; - var hasSymbolSham = require_shams(); - module.exports = function hasNativeSymbols() { - if (typeof origSymbol !== "function") { - return false; - } - if (typeof Symbol !== "function") { - return false; - } - if (typeof origSymbol("foo") !== "symbol") { - return false; - } - if (typeof Symbol("bar") !== "symbol") { - return false; + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) + _defineProperties(Constructor.prototype, protoProps); + if (staticProps) + _defineProperties(Constructor, staticProps); + return Constructor; + } + var _require = require_buffer(); + var Buffer14 = _require.Buffer; + var _require2 = require_util(); + var inspect = _require2.inspect; + var custom = inspect && inspect.custom || "inspect"; + function copyBuffer(src, target, offset) { + Buffer14.prototype.copy.call(src, target, offset); + } + module.exports = /* @__PURE__ */ function() { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; } - return hasSymbolSham(); - }; - } - }); - - // node_modules/function-bind/implementation.js - var require_implementation = __commonJS({ - "node_modules/function-bind/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; - var slice = Array.prototype.slice; - var toStr = Object.prototype.toString; - var funcType = "[object Function]"; - module.exports = function bind(that) { - var target = this; - if (typeof target !== "function" || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - var bound; - var binder = function() { - if (this instanceof bound) { - var result = target.apply(this, args.concat(slice.call(arguments))); - if (Object(result) === result) { - return result; + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) + this.tail.next = entry; + else + this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) + this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) + return; + var ret = this.head.data; + if (this.length === 1) + this.head = this.tail = null; + else + this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) + return ""; + var p = this.head; + var ret = "" + p.data; + while (p = p.next) { + ret += s + p.data; } - return this; - } else { - return target.apply(that, args.concat(slice.call(arguments))); + return ret; } - }; - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push("$" + i); - } - bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder); - if (target.prototype) { - var Empty = function Empty2() { - }; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; - } - }); - - // node_modules/function-bind/index.js - var require_function_bind = __commonJS({ - "node_modules/function-bind/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation(); - module.exports = Function.prototype.bind || implementation; - } - }); - - // node_modules/has/src/index.js - var require_src = __commonJS({ - "node_modules/has/src/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var bind = require_function_bind(); - module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); - } - }); - - // node_modules/get-intrinsic/index.js - var require_get_intrinsic = __commonJS({ - "node_modules/get-intrinsic/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var undefined2; - var $SyntaxError = SyntaxError; - var $Function = Function; - var $TypeError = TypeError; - var getEvalledConstructor = function(expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); - } catch (e) { - } - }; - var $gOPD = Object.getOwnPropertyDescriptor; - if ($gOPD) { - try { - $gOPD({}, ""); - } catch (e) { - $gOPD = null; - } - } - var throwTypeError = function() { - throw new $TypeError(); - }; - var ThrowTypeError = $gOPD ? function() { - try { - arguments.callee; - return throwTypeError; - } catch (calleeThrows) { - try { - return $gOPD(arguments, "callee").get; - } catch (gOPDthrows) { - return throwTypeError; + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) + return Buffer14.alloc(0); + var ret = Buffer14.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; } - } - }() : throwTypeError; - var hasSymbols = require_has_symbols()(); - var getProto = Object.getPrototypeOf || function(x) { - return x.__proto__; - }; - var needsEval = {}; - var TypedArray = typeof Uint8Array === "undefined" ? undefined2 : getProto(Uint8Array); - var INTRINSICS = { - "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError, - "%Array%": Array, - "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer, - "%ArrayIteratorPrototype%": hasSymbols ? getProto([][Symbol.iterator]()) : undefined2, - "%AsyncFromSyncIteratorPrototype%": undefined2, - "%AsyncFunction%": needsEval, - "%AsyncGenerator%": needsEval, - "%AsyncGeneratorFunction%": needsEval, - "%AsyncIteratorPrototype%": needsEval, - "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics, - "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt, - "%Boolean%": Boolean, - "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView, - "%Date%": Date, - "%decodeURI%": decodeURI, - "%decodeURIComponent%": decodeURIComponent, - "%encodeURI%": encodeURI, - "%encodeURIComponent%": encodeURIComponent, - "%Error%": Error, - "%eval%": eval, - "%EvalError%": EvalError, - "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array, - "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array, - "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry, - "%Function%": $Function, - "%GeneratorFunction%": needsEval, - "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array, - "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array, - "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array, - "%isFinite%": isFinite, - "%isNaN%": isNaN, - "%IteratorPrototype%": hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined2, - "%JSON%": typeof JSON === "object" ? JSON : undefined2, - "%Map%": typeof Map === "undefined" ? undefined2 : Map, - "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), - "%Math%": Math, - "%Number%": Number, - "%Object%": Object, - "%parseFloat%": parseFloat, - "%parseInt%": parseInt, - "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise, - "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy, - "%RangeError%": RangeError, - "%ReferenceError%": ReferenceError, - "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect, - "%RegExp%": RegExp, - "%Set%": typeof Set === "undefined" ? undefined2 : Set, - "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), - "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer, - "%String%": String, - "%StringIteratorPrototype%": hasSymbols ? getProto(""[Symbol.iterator]()) : undefined2, - "%Symbol%": hasSymbols ? Symbol : undefined2, - "%SyntaxError%": $SyntaxError, - "%ThrowTypeError%": ThrowTypeError, - "%TypedArray%": TypedArray, - "%TypeError%": $TypeError, - "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array, - "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray, - "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array, - "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array, - "%URIError%": URIError, - "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap, - "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef, - "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet - }; - var doEval = function doEval2(name) { - var value; - if (name === "%AsyncFunction%") { - value = getEvalledConstructor("async function () {}"); - } else if (name === "%GeneratorFunction%") { - value = getEvalledConstructor("function* () {}"); - } else if (name === "%AsyncGeneratorFunction%") { - value = getEvalledConstructor("async function* () {}"); - } else if (name === "%AsyncGenerator%") { - var fn = doEval2("%AsyncGeneratorFunction%"); - if (fn) { - value = fn.prototype; - } - } else if (name === "%AsyncIteratorPrototype%") { - var gen = doEval2("%AsyncGenerator%"); - if (gen) { - value = getProto(gen.prototype); - } - } - INTRINSICS[name] = value; - return value; - }; - var LEGACY_ALIASES = { - "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], - "%ArrayPrototype%": ["Array", "prototype"], - "%ArrayProto_entries%": ["Array", "prototype", "entries"], - "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], - "%ArrayProto_keys%": ["Array", "prototype", "keys"], - "%ArrayProto_values%": ["Array", "prototype", "values"], - "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], - "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], - "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], - "%BooleanPrototype%": ["Boolean", "prototype"], - "%DataViewPrototype%": ["DataView", "prototype"], - "%DatePrototype%": ["Date", "prototype"], - "%ErrorPrototype%": ["Error", "prototype"], - "%EvalErrorPrototype%": ["EvalError", "prototype"], - "%Float32ArrayPrototype%": ["Float32Array", "prototype"], - "%Float64ArrayPrototype%": ["Float64Array", "prototype"], - "%FunctionPrototype%": ["Function", "prototype"], - "%Generator%": ["GeneratorFunction", "prototype"], - "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], - "%Int8ArrayPrototype%": ["Int8Array", "prototype"], - "%Int16ArrayPrototype%": ["Int16Array", "prototype"], - "%Int32ArrayPrototype%": ["Int32Array", "prototype"], - "%JSONParse%": ["JSON", "parse"], - "%JSONStringify%": ["JSON", "stringify"], - "%MapPrototype%": ["Map", "prototype"], - "%NumberPrototype%": ["Number", "prototype"], - "%ObjectPrototype%": ["Object", "prototype"], - "%ObjProto_toString%": ["Object", "prototype", "toString"], - "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], - "%PromisePrototype%": ["Promise", "prototype"], - "%PromiseProto_then%": ["Promise", "prototype", "then"], - "%Promise_all%": ["Promise", "all"], - "%Promise_reject%": ["Promise", "reject"], - "%Promise_resolve%": ["Promise", "resolve"], - "%RangeErrorPrototype%": ["RangeError", "prototype"], - "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], - "%RegExpPrototype%": ["RegExp", "prototype"], - "%SetPrototype%": ["Set", "prototype"], - "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], - "%StringPrototype%": ["String", "prototype"], - "%SymbolPrototype%": ["Symbol", "prototype"], - "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], - "%TypedArrayPrototype%": ["TypedArray", "prototype"], - "%TypeErrorPrototype%": ["TypeError", "prototype"], - "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], - "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], - "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], - "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], - "%URIErrorPrototype%": ["URIError", "prototype"], - "%WeakMapPrototype%": ["WeakMap", "prototype"], - "%WeakSetPrototype%": ["WeakSet", "prototype"] - }; - var bind = require_function_bind(); - var hasOwn = require_src(); - var $concat = bind.call(Function.call, Array.prototype.concat); - var $spliceApply = bind.call(Function.apply, Array.prototype.splice); - var $replace = bind.call(Function.call, String.prototype.replace); - var $strSlice = bind.call(Function.call, String.prototype.slice); - var $exec = bind.call(Function.call, RegExp.prototype.exec); - var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; - var reEscapeChar = /\\(\\)?/g; - var stringToPath = function stringToPath2(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === "%" && last !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); - } else if (last === "%" && first !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); - } - var result = []; - $replace(string, rePropName, function(match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; - }); - return result; - }; - var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = "%" + alias[0] + "%"; - } - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + ret = this.shift(); + } else { + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; } - if (typeof value === "undefined" && !allowMissing) { - throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); + }, { + key: "first", + value: function first() { + return this.head.data; } - return { - alias, - name: intrinsicName, - value - }; - } - throw new $SyntaxError("intrinsic " + name + " does not exist!"); - }; - module.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== "string" || name.length === 0) { - throw new $TypeError("intrinsic name must be a non-empty string"); - } - if (arguments.length > 1 && typeof allowMissing !== "boolean") { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - if ($exec(/^%?[^%]*%?$/g, name) === null) { - throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); - } - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; - var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { - throw new $SyntaxError("property names with quotes must have matching quotes"); - } - if (part === "constructor" || !isOwn) { - skipFurtherCaching = true; - } - intrinsicBaseName += "." + part; - intrinsicRealName = "%" + intrinsicBaseName + "%"; - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) + ret += str; + else + ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) + this.head = p.next; + else + this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; } - return void 0; + ++c; } - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - if (isOwn && "get" in desc && !("originalValue" in desc.get)) { - value = desc.get; - } else { - value = value[part]; + this.length -= c; + return ret; + } + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer14.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf2 = p.data; + var nb = n > buf2.length ? buf2.length : n; + buf2.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf2.length) { + ++c; + if (p.next) + this.head = p.next; + else + this.head = this.tail = null; + } else { + this.head = p; + p.data = buf2.slice(nb); + } + break; } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; + ++c; } + this.length -= c; + return ret; } - } - return value; - }; + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + depth: 0, + customInspect: false + })); + } + }]); + return BufferList; + }(); } }); - // node_modules/call-bind/index.js - var require_call_bind = __commonJS({ - "node_modules/call-bind/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/destroy.js + var require_destroy = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var bind = require_function_bind(); - var GetIntrinsic = require_get_intrinsic(); - var $apply = GetIntrinsic("%Function.prototype.apply%"); - var $call = GetIntrinsic("%Function.prototype.call%"); - var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var $max = GetIntrinsic("%Math.max%"); - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - } catch (e) { - $defineProperty = null; - } - } - module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, "length"); - if (desc.configurable) { - $defineProperty(func, "length", { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }); + function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } } + return this; } - return func; - }; - var applyBind = function applyBind2() { - return $reflectApply(bind, $apply, arguments); - }; - if ($defineProperty) { - $defineProperty(module.exports, "apply", { value: applyBind }); - } else { - module.exports.apply = applyBind; - } - } - }); - - // node_modules/call-bind/callBound.js - var require_callBound = __commonJS({ - "node_modules/call-bind/callBound.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var callBind = require_call_bind(); - var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf")); - module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { - return callBind(intrinsic); - } - return intrinsic; - }; - } - }); - - // node_modules/is-arguments/index.js - var require_is_arguments = __commonJS({ - "node_modules/is-arguments/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var hasToStringTag = require_shams2()(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) { - return false; - } - return $toString(value) === "[object Arguments]"; - }; - var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]"; - }; - var supportsStandardArguments = function() { - return isStandardArguments(arguments); - }(); - isStandardArguments.isLegacyArguments = isLegacyArguments; - module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - } - }); - - // node_modules/is-generator-function/index.js - var require_is_generator_function = __commonJS({ - "node_modules/is-generator-function/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var toStr = Object.prototype.toString; - var fnToStr = Function.prototype.toString; - var isFnRegex = /^\s*(?:function)?\*/; - var hasToStringTag = require_shams2()(); - var getProto = Object.getPrototypeOf; - var getGeneratorFunc = function() { - if (!hasToStringTag) { - return false; - } - try { - return Function("return function*() {}")(); - } catch (e) { - } - }; - var GeneratorFunction; - module.exports = function isGeneratorFunction(fn) { - if (typeof fn !== "function") { - return false; - } - if (isFnRegex.test(fnToStr.call(fn))) { - return true; + if (this._readableState) { + this._readableState.destroyed = true; } - if (!hasToStringTag) { - var str = toStr.call(fn); - return str === "[object GeneratorFunction]"; + if (this._writableState) { + this._writableState.destroyed = true; } - if (!getProto) { - return false; + this._destroy(err || null, function(err2) { + if (!cb && err2) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err2); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err2); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err2); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; + } + function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); + } + function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) + return; + if (self._readableState && !self._readableState.emitClose) + return; + self.emit("close"); + } + function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; } - if (typeof GeneratorFunction === "undefined") { - var generatorFunc = getGeneratorFunc(); - GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; } - return getProto(fn) === GeneratorFunction; + } + function emitErrorNT(self, err) { + self.emit("error", err); + } + function errorOrDestroy(stream, err) { + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) + stream.destroy(err); + else + stream.emit("error", err); + } + module.exports = { + destroy, + undestroy, + errorOrDestroy }; } }); - // node_modules/is-callable/index.js - var require_is_callable = __commonJS({ - "node_modules/is-callable/index.js"(exports, module) { + // node_modules/readable-stream/errors-browser.js + var require_errors_browser = __commonJS({ + "node_modules/readable-stream/errors-browser.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var fnToStr = Function.prototype.toString; - var reflectApply = typeof Reflect === "object" && Reflect !== null && Reflect.apply; - var badArrayLike; - var isCallableMarker; - if (typeof reflectApply === "function" && typeof Object.defineProperty === "function") { - try { - badArrayLike = Object.defineProperty({}, "length", { - get: function() { - throw isCallableMarker; - } - }); - isCallableMarker = {}; - reflectApply(function() { - throw 42; - }, null, badArrayLike); - } catch (_) { - if (_ !== isCallableMarker) { - reflectApply = null; - } - } - } else { - reflectApply = null; + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; } - var constructorRegex = /^\s*class\b/; - var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; + var codes = {}; + function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; } - }; - var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { - return false; + function getMessage(arg1, arg2, arg3) { + if (typeof message === "string") { + return message; + } else { + return message(arg1, arg2, arg3); } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var fnClass = "[object Function]"; - var genClass = "[object GeneratorFunction]"; - var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag; - var documentDotAll = typeof document === "object" && typeof document.all === "undefined" && document.all !== void 0 ? document.all : {}; - module.exports = reflectApply ? function isCallable(value) { - if (value === documentDotAll) { - return true; - } - if (!value) { - return false; - } - if (typeof value !== "function" && typeof value !== "object") { - return false; } - if (typeof value === "function" && !value.prototype) { - return true; - } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { - return false; + var NodeError = /* @__PURE__ */ function(_Base) { + _inheritsLoose(NodeError2, _Base); + function NodeError2(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + return NodeError2; + }(Base); + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; + } + function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function(i) { + return String(i); + }); + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); } + } else { + return "of ".concat(thing, " ").concat(String(expected)); } - return !isES6ClassFn(value); - } : function isCallable(value) { - if (value === documentDotAll) { - return true; + } + function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; + } + function endsWith(str, search, this_len) { + if (this_len === void 0 || this_len > str.length) { + this_len = str.length; } - if (!value) { - return false; + return str.substring(this_len - search.length, this_len) === search; + } + function includes(str, search, start) { + if (typeof start !== "number") { + start = 0; } - if (typeof value !== "function" && typeof value !== "object") { + if (start + search.length > str.length) { return false; + } else { + return str.indexOf(search, start) !== -1; } - if (typeof value === "function" && !value.prototype) { - return true; - } - if (hasToStringTag) { - return tryFunctionObject(value); + } + createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; + }, TypeError); + createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { + var determiner; + if (typeof expected === "string" && startsWith(expected, "not ")) { + determiner = "must not be"; + expected = expected.replace(/^not /, ""); + } else { + determiner = "must be"; } - if (isES6ClassFn(value)) { - return false; + var msg; + if (endsWith(name, " argument")) { + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + } else { + var type = includes(name, ".") ? "property" : "argument"; + msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); } - var strClass = toStr.call(value); - return strClass === fnClass || strClass === genClass; - }; + msg += ". Received type ".concat(typeof actual); + return msg; + }, TypeError); + createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); + createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { + return "The " + name + " method is not implemented"; + }); + createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); + createErrorType("ERR_STREAM_DESTROYED", function(name) { + return "Cannot call " + name + " after a stream was destroyed"; + }); + createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); + createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); + createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); + createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); + createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { + return "Unknown encoding: " + arg; + }, TypeError); + createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); + module.exports.codes = codes; } }); - // node_modules/for-each/index.js - var require_for_each = __commonJS({ - "node_modules/for-each/index.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/state.js + var require_state = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var isCallable = require_is_callable(); - var toStr = Object.prototype.toString; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var forEachArray = function forEachArray2(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } - }; - var forEachString = function forEachString2(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } - }; - var forEachObject = function forEachObject2(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } - }; - var forEach = function forEach2(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError("iterator must be a function"); - } - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; - } - if (toStr.call(list) === "[object Array]") { - forEachArray(list, iterator, receiver); - } else if (typeof list === "string") { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } - }; - module.exports = forEach; - } - }); - - // node_modules/available-typed-arrays/index.js - var require_available_typed_arrays = __commonJS({ - "node_modules/available-typed-arrays/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var possibleNames = [ - "BigInt64Array", - "BigUint64Array", - "Float32Array", - "Float64Array", - "Int16Array", - "Int32Array", - "Int8Array", - "Uint16Array", - "Uint32Array", - "Uint8Array", - "Uint8ClampedArray" - ]; - var g = typeof globalThis === "undefined" ? window : globalThis; - module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === "function") { - out[out.length] = possibleNames[i]; - } - } - return out; - }; - } - }); - - // node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js - var require_getOwnPropertyDescriptor = __commonJS({ - "node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true); - if ($gOPD) { - try { - $gOPD([], "length"); - } catch (e) { - $gOPD = null; - } - } - module.exports = $gOPD; - } - }); - - // node_modules/is-typed-array/index.js - var require_is_typed_array = __commonJS({ - "node_modules/is-typed-array/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? window : globalThis; - var typedArrays = availableTypedArrays(); - var $indexOf = callBound("Array.prototype.indexOf", true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; - }; - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var gOPD = require_getOwnPropertyDescriptor(); - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); - } - var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function(getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { - } - } - }); - return anyTrue; - }; - module.exports = function isTypedArray(value) { - if (!value || typeof value !== "object") { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { - return false; - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/which-typed-array/index.js - var require_which_typed_array = __commonJS({ - "node_modules/which-typed-array/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var forEach = require_for_each(); - var availableTypedArrays = require_available_typed_arrays(); - var callBound = require_callBound(); - var $toString = callBound("Object.prototype.toString"); - var hasToStringTag = require_shams2()(); - var g = typeof globalThis === "undefined" ? window : globalThis; - var typedArrays = availableTypedArrays(); - var $slice = callBound("String.prototype.slice"); - var toStrTags = {}; - var gOPD = require_getOwnPropertyDescriptor(); - var getPrototypeOf = Object.getPrototypeOf; - if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function(typedArray) { - if (typeof g[typedArray] === "function") { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - } - }); + var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE; + function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; } - var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function(getter, typedArray) { - if (!foundName) { - try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; - } - } catch (e) { - } + function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : "highWaterMark"; + throw new ERR_INVALID_OPT_VALUE(name, hwm); } - }); - return foundName; - }; - var isTypedArray = require_is_typed_array(); - module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { - return false; - } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - return $slice($toString(value), 8, -1); - } - return tryTypedArrays(value); - }; - } - }); - - // node_modules/util/support/types.js - var require_types = __commonJS({ - "node_modules/util/support/types.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var isArgumentsObject = require_is_arguments(); - var isGeneratorFunction = require_is_generator_function(); - var whichTypedArray = require_which_typed_array(); - var isTypedArray = require_is_typed_array(); - function uncurryThis(f) { - return f.call.bind(f); - } - var BigIntSupported = typeof BigInt !== "undefined"; - var SymbolSupported = typeof Symbol !== "undefined"; - var ObjectToString = uncurryThis(Object.prototype.toString); - var numberValue = uncurryThis(Number.prototype.valueOf); - var stringValue = uncurryThis(String.prototype.valueOf); - var booleanValue = uncurryThis(Boolean.prototype.valueOf); - if (BigIntSupported) { - bigIntValue = uncurryThis(BigInt.prototype.valueOf); - } - var bigIntValue; - if (SymbolSupported) { - symbolValue = uncurryThis(Symbol.prototype.valueOf); - } - var symbolValue; - function checkBoxedPrimitive(value, prototypeValueOf) { - if (typeof value !== "object") { - return false; - } - try { - prototypeValueOf(value); - return true; - } catch (e) { - return false; - } - } - exports.isArgumentsObject = isArgumentsObject; - exports.isGeneratorFunction = isGeneratorFunction; - exports.isTypedArray = isTypedArray; - function isPromise(input) { - return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function"; - } - exports.isPromise = isPromise; - function isArrayBufferView(value) { - if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - return ArrayBuffer.isView(value); - } - return isTypedArray(value) || isDataView(value); - } - exports.isArrayBufferView = isArrayBufferView; - function isUint8Array(value) { - return whichTypedArray(value) === "Uint8Array"; - } - exports.isUint8Array = isUint8Array; - function isUint8ClampedArray(value) { - return whichTypedArray(value) === "Uint8ClampedArray"; - } - exports.isUint8ClampedArray = isUint8ClampedArray; - function isUint16Array(value) { - return whichTypedArray(value) === "Uint16Array"; - } - exports.isUint16Array = isUint16Array; - function isUint32Array(value) { - return whichTypedArray(value) === "Uint32Array"; - } - exports.isUint32Array = isUint32Array; - function isInt8Array(value) { - return whichTypedArray(value) === "Int8Array"; - } - exports.isInt8Array = isInt8Array; - function isInt16Array(value) { - return whichTypedArray(value) === "Int16Array"; - } - exports.isInt16Array = isInt16Array; - function isInt32Array(value) { - return whichTypedArray(value) === "Int32Array"; - } - exports.isInt32Array = isInt32Array; - function isFloat32Array(value) { - return whichTypedArray(value) === "Float32Array"; - } - exports.isFloat32Array = isFloat32Array; - function isFloat64Array(value) { - return whichTypedArray(value) === "Float64Array"; - } - exports.isFloat64Array = isFloat64Array; - function isBigInt64Array(value) { - return whichTypedArray(value) === "BigInt64Array"; - } - exports.isBigInt64Array = isBigInt64Array; - function isBigUint64Array(value) { - return whichTypedArray(value) === "BigUint64Array"; - } - exports.isBigUint64Array = isBigUint64Array; - function isMapToString(value) { - return ObjectToString(value) === "[object Map]"; - } - isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map()); - function isMap(value) { - if (typeof Map === "undefined") { - return false; - } - return isMapToString.working ? isMapToString(value) : value instanceof Map; - } - exports.isMap = isMap; - function isSetToString(value) { - return ObjectToString(value) === "[object Set]"; - } - isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set()); - function isSet(value) { - if (typeof Set === "undefined") { - return false; - } - return isSetToString.working ? isSetToString(value) : value instanceof Set; - } - exports.isSet = isSet; - function isWeakMapToString(value) { - return ObjectToString(value) === "[object WeakMap]"; - } - isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap()); - function isWeakMap(value) { - if (typeof WeakMap === "undefined") { - return false; - } - return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; - } - exports.isWeakMap = isWeakMap; - function isWeakSetToString(value) { - return ObjectToString(value) === "[object WeakSet]"; - } - isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet()); - function isWeakSet(value) { - return isWeakSetToString(value); - } - exports.isWeakSet = isWeakSet; - function isArrayBufferToString(value) { - return ObjectToString(value) === "[object ArrayBuffer]"; - } - isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer()); - function isArrayBuffer(value) { - if (typeof ArrayBuffer === "undefined") { - return false; - } - return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; - } - exports.isArrayBuffer = isArrayBuffer; - function isDataViewToString(value) { - return ObjectToString(value) === "[object DataView]"; - } - isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)); - function isDataView(value) { - if (typeof DataView === "undefined") { - return false; - } - return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; - } - exports.isDataView = isDataView; - var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0; - function isSharedArrayBufferToString(value) { - return ObjectToString(value) === "[object SharedArrayBuffer]"; - } - function isSharedArrayBuffer(value) { - if (typeof SharedArrayBufferCopy === "undefined") { - return false; - } - if (typeof isSharedArrayBufferToString.working === "undefined") { - isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); + return Math.floor(hwm); } - return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy; - } - exports.isSharedArrayBuffer = isSharedArrayBuffer; - function isAsyncFunction(value) { - return ObjectToString(value) === "[object AsyncFunction]"; - } - exports.isAsyncFunction = isAsyncFunction; - function isMapIterator(value) { - return ObjectToString(value) === "[object Map Iterator]"; - } - exports.isMapIterator = isMapIterator; - function isSetIterator(value) { - return ObjectToString(value) === "[object Set Iterator]"; - } - exports.isSetIterator = isSetIterator; - function isGeneratorObject(value) { - return ObjectToString(value) === "[object Generator]"; - } - exports.isGeneratorObject = isGeneratorObject; - function isWebAssemblyCompiledModule(value) { - return ObjectToString(value) === "[object WebAssembly.Module]"; - } - exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); - } - exports.isNumberObject = isNumberObject; - function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); - } - exports.isStringObject = isStringObject; - function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); - } - exports.isBooleanObject = isBooleanObject; - function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); - } - exports.isBigIntObject = isBigIntObject; - function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); - } - exports.isSymbolObject = isSymbolObject; - function isBoxedPrimitive(value) { - return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value); - } - exports.isBoxedPrimitive = isBoxedPrimitive; - function isAnyArrayBuffer(value) { - return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value)); + return state.objectMode ? 16 : 16 * 1024; } - exports.isAnyArrayBuffer = isAnyArrayBuffer; - ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) { - Object.defineProperty(exports, method, { - enumerable: false, - value: function() { - throw new Error(method + " is not supported in userland"); - } - }); - }); - } - }); - - // node_modules/util/support/isBufferBrowser.js - var require_isBufferBrowser = __commonJS({ - "node_modules/util/support/isBufferBrowser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function isBuffer(arg) { - return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function"; + module.exports = { + getHighWaterMark }; } }); @@ -3820,11390 +2962,2457 @@ const _DOMParser = DOMParser; } }); - // node_modules/util/util.js - var require_util = __commonJS({ - "node_modules/util/util.js"(exports) { + // node_modules/util-deprecate/browser.js + var require_browser = __commonJS({ + "node_modules/util-deprecate/browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for (var i = 0; i < keys.length; i++) { - descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - } - return descriptors; - }; - var formatRegExp = /%[sdj%]/g; - exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(" "); - } - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x2) { - if (x2 === "%%") - return "%"; - if (i >= len) - return x2; - switch (x2) { - case "%s": - return String(args[i++]); - case "%d": - return Number(args[i++]); - case "%j": - try { - return JSON.stringify(args[i++]); - } catch (_) { - return "[Circular]"; - } - default: - return x2; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += " " + x; - } else { - str += " " + inspect(x); - } - } - return str; - }; - exports.deprecate = function(fn, msg) { - if (typeof process !== "undefined" && process.noDeprecation === true) { + module.exports = deprecate; + function deprecate(fn, msg) { + if (config("noDeprecation")) { return fn; } - if (typeof process === "undefined") { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } var warned = false; function deprecated() { if (!warned) { - if (process.throwDeprecation) { + if (config("throwDeprecation")) { throw new Error(msg); - } else if (process.traceDeprecation) { + } else if (config("traceDeprecation")) { console.trace(msg); } else { - console.error(msg); + console.warn(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; - }; - var debugs = {}; - var debugEnvRegex = /^$/; - if (process.env.NODE_DEBUG) { - debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(); - debugEnvRegex = new RegExp("^" + debugEnv + "$", "i"); - } - var debugEnv; - exports.debuglog = function(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (debugEnvRegex.test(set)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error("%s %d: %s", set, pid, msg); - }; - } else { - debugs[set] = function() { - }; - } + } + function config(name) { + try { + if (!window.localStorage) + return false; + } catch (_) { + return false; } - return debugs[set]; - }; - function inspect(obj, opts) { - var ctx = { - seen: [], - stylize: stylizeNoColor + var val = window.localStorage[name]; + if (val == null) + return false; + return String(val).toLowerCase() === "true"; + } + } + }); + + // node_modules/readable-stream/lib/_stream_writable.js + var require_stream_writable = __commonJS({ + "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + module.exports = Writable; + function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function() { + onCorkedFinish(_this, state); }; - if (arguments.length >= 3) - ctx.depth = arguments[2]; - if (arguments.length >= 4) - ctx.colors = arguments[3]; - if (isBoolean(opts)) { - ctx.showHidden = opts; - } else if (opts) { - exports._extend(ctx, opts); - } - if (isUndefined(ctx.showHidden)) - ctx.showHidden = false; - if (isUndefined(ctx.depth)) - ctx.depth = 2; - if (isUndefined(ctx.colors)) - ctx.colors = false; - if (isUndefined(ctx.customInspect)) - ctx.customInspect = true; - if (ctx.colors) - ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); - } - exports.inspect = inspect; - inspect.colors = { - "bold": [1, 22], - "italic": [3, 23], - "underline": [4, 24], - "inverse": [7, 27], - "white": [37, 39], - "grey": [90, 39], - "black": [30, 39], - "blue": [34, 39], - "cyan": [36, 39], - "green": [32, 39], - "magenta": [35, 39], - "red": [31, 39], - "yellow": [33, 39] + } + var Duplex; + Writable.WritableState = WritableState; + var internalUtil = { + deprecate: require_browser() }; - inspect.styles = { - "special": "cyan", - "number": "yellow", - "boolean": "yellow", - "undefined": "grey", - "null": "bold", - "string": "green", - "date": "magenta", - "regexp": "red" + var Stream = require_stream_browser(); + var Buffer14 = require_buffer().Buffer; + var OurUint8Array = window.Uint8Array || function() { }; - function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - if (style) { - return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m"; - } else { - return str; - } + function _uint8ArrayToBuffer(chunk) { + return Buffer14.from(chunk); } - function stylizeNoColor(str, styleType) { - return str; + function _isUint8Array(obj) { + return Buffer14.isBuffer(obj) || obj instanceof OurUint8Array; } - function arrayToHash(array) { - var hash2 = {}; - array.forEach(function(val, idx) { - hash2[val] = true; - }); - return hash2; + var destroyImpl = require_destroy(); + var _require = require_state(); + var getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require_errors_browser().codes; + var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; + var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE; + var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES; + var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END; + var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; + var errorOrDestroy = destroyImpl.errorOrDestroy; + require_inherits_browser()(Writable, Stream); + function nop() { } - function formatValue(ctx, value, recurseTimes) { - if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) { - return formatError(value); - } - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ": " + value.name : ""; - return ctx.stylize("[Function" + name + "]", "special"); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), "date"); - } - if (isError(value)) { - return formatError(value); - } - } - var base = "", array = false, braces = ["{", "}"]; - if (isArray(value)) { - array = true; - braces = ["[", "]"]; - } - if (isFunction(value)) { - var n = value.name ? ": " + value.name : ""; - base = " [Function" + n + "]"; - } - if (isRegExp(value)) { - base = " " + RegExp.prototype.toString.call(value); - } - if (isDate(value)) { - base = " " + Date.prototype.toUTCString.call(value); - } - if (isError(value)) { - base = " " + formatError(value); - } - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } else { - return ctx.stylize("[Object]", "special"); - } + function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + if (typeof isDuplex !== "boolean") + isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex); + this.finalCalled = false; + this.needDrain = false; + this.ending = false; + this.ended = false; + this.finished = false; + this.destroyed = false; + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.length = 0; + this.writing = false; + this.corked = 0; + this.sync = true; + this.bufferProcessing = false; + this.onwrite = function(er) { + onwrite(stream, er); + }; + this.writecb = null; + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + this.pendingcb = 0; + this.prefinished = false; + this.errorEmitted = false; + this.emitClose = options.emitClose !== false; + this.autoDestroy = !!options.autoDestroy; + this.bufferedRequestCount = 0; + this.corkedRequestsFree = new CorkedRequest(this); + } + WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; } - ctx.seen.push(value); - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key2) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key2, array); + return out; + }; + (function() { + try { + Object.defineProperty(WritableState.prototype, "buffer", { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") }); + } catch (_) { } - ctx.seen.pop(); - return reduceToSingleString(output, base, braces); + })(); + var realHasInstance; + if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) + return true; + if (this !== Writable) + return false; + return object && object._writableState instanceof WritableState; + } + }); + } else { + realHasInstance = function realHasInstance2(object) { + return object instanceof this; + }; } - function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize("undefined", "undefined"); - if (isString(value)) { - var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; - return ctx.stylize(simple, "string"); + function Writable(options) { + Duplex = Duplex || require_stream_duplex(); + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) + return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + this.writable = true; + if (options) { + if (typeof options.write === "function") + this._write = options.write; + if (typeof options.writev === "function") + this._writev = options.writev; + if (typeof options.destroy === "function") + this._destroy = options.destroy; + if (typeof options.final === "function") + this._final = options.final; } - if (isNumber(value)) - return ctx.stylize("" + value, "number"); - if (isBoolean(value)) - return ctx.stylize("" + value, "boolean"); - if (isNull(value)) - return ctx.stylize("null", "null"); + Stream.call(this); } - function formatError(value) { - return "[" + Error.prototype.toString.call(value) + "]"; + Writable.prototype.pipe = function() { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); + }; + function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + errorOrDestroy(stream, er); + process.nextTick(cb, er); } - function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); - } else { - output.push(""); - } + function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== "string" && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); } - keys.forEach(function(key2) { - if (!key2.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key2, true)); - } - }); - return output; - } - function formatProperty(ctx, value, recurseTimes, visibleKeys, key2, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key2) || { value: value[key2] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize("[Getter/Setter]", "special"); - } else { - str = ctx.stylize("[Getter]", "special"); - } - } else { - if (desc.set) { - str = ctx.stylize("[Setter]", "special"); - } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; + } + Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer14.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); } - if (!hasOwnProperty(visibleKeys, key2)) { - name = "[" + key2 + "]"; + if (typeof encoding === "function") { + cb = encoding; + encoding = null; } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf("\n") > -1) { - if (array) { - str = str.split("\n").map(function(line) { - return " " + line; - }).join("\n").substr(2); - } else { - str = "\n" + str.split("\n").map(function(line) { - return " " + line; - }).join("\n"); - } - } - } else { - str = ctx.stylize("[Circular]", "special"); - } + if (isBuf) + encoding = "buffer"; + else if (!encoding) + encoding = state.defaultEncoding; + if (typeof cb !== "function") + cb = nop; + if (state.ending) + writeAfterEnd(this, cb); + else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } - if (isUndefined(name)) { - if (array && key2.match(/^\d+$/)) { - return str; - } - name = JSON.stringify("" + key2); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, "name"); - } else { - name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, "string"); - } - } - return name + ": " + str; - } - function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf("\n") >= 0) - numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1; - }, 0); - if (length > 60) { - return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1]; - } - return braces[0] + base + " " + output.join(", ") + " " + braces[1]; - } - exports.types = require_types(); - function isArray(ar) { - return Array.isArray(ar); - } - exports.isArray = isArray; - function isBoolean(arg) { - return typeof arg === "boolean"; - } - exports.isBoolean = isBoolean; - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; - function isNumber(arg) { - return typeof arg === "number"; - } - exports.isNumber = isNumber; - function isString(arg) { - return typeof arg === "string"; - } - exports.isString = isString; - function isSymbol(arg) { - return typeof arg === "symbol"; - } - exports.isSymbol = isSymbol; - function isUndefined(arg) { - return arg === void 0; - } - exports.isUndefined = isUndefined; - function isRegExp(re) { - return isObject(re) && objectToString(re) === "[object RegExp]"; - } - exports.isRegExp = isRegExp; - exports.types.isRegExp = isRegExp; - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - exports.isObject = isObject; - function isDate(d) { - return isObject(d) && objectToString(d) === "[object Date]"; - } - exports.isDate = isDate; - exports.types.isDate = isDate; - function isError(e) { - return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error); - } - exports.isError = isError; - exports.types.isNativeError = isError; - function isFunction(arg) { - return typeof arg === "function"; - } - exports.isFunction = isFunction; - function isPrimitive(arg) { - return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined"; - } - exports.isPrimitive = isPrimitive; - exports.isBuffer = require_isBufferBrowser(); - function objectToString(o) { - return Object.prototype.toString.call(o); - } - function pad(n) { - return n < 10 ? "0" + n.toString(10) : n.toString(10); - } - var months = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ]; - function timestamp() { - var d = new Date(); - var time = [ - pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds()) - ].join(":"); - return [d.getDate(), months[d.getMonth()], time].join(" "); - } - exports.log = function() { - console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments)); + return ret; }; - exports.inherits = require_inherits_browser(); - exports._extend = function(origin, add) { - if (!add || !isObject(add)) - return origin; - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; + Writable.prototype.cork = function() { + this._writableState.corked++; }; - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0; - exports.promisify = function promisify(original) { - if (typeof original !== "function") - throw new TypeError('The "original" argument must be of type Function'); - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if (typeof fn !== "function") { - throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return fn; - } - function fn() { - var promiseResolve, promiseReject; - var promise2 = new Promise(function(resolve2, reject) { - promiseResolve = resolve2; - promiseReject = reject; - }); - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - args.push(function(err, value) { - if (err) { - promiseReject(err); - } else { - promiseResolve(value); - } - }); - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); - } - return promise2; + Writable.prototype.uncork = function() { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) + clearBuffer(this, state); } - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - if (kCustomPromisifiedSymbol) - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return Object.defineProperties(fn, getOwnPropertyDescriptors(original)); }; - exports.promisify.custom = kCustomPromisifiedSymbol; - function callbackifyOnRejected(reason, cb) { - if (!reason) { - var newReason = new Error("Promise was rejected with a falsy value"); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); - } - function callbackify(original) { - if (typeof original !== "function") { - throw new TypeError('The "original" argument must be of type Function'); - } - function callbackified() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - var maybeCb = args.pop(); - if (typeof maybeCb !== "function") { - throw new TypeError("The last argument must be of type Function"); - } - var self = this; - var cb = function() { - return maybeCb.apply(self, arguments); - }; - original.apply(this, args).then(function(ret) { - process.nextTick(cb.bind(null, null, ret)); - }, function(rej) { - process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); - }); - } - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)); - return callbackified; - } - exports.callbackify = callbackify; - } - }); - - // node_modules/assert-browserify/build/internal/errors.js - var require_errors = __commonJS({ - "node_modules/assert-browserify/build/internal/errors.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + if (typeof encoding === "string") + encoding = encoding.toLowerCase(); + if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) + throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; + }; + Object.defineProperty(Writable.prototype, "writableBuffer", { + enumerable: false, + get: function get2() { + return this._writableState && this._writableState.getBuffer(); } - return _typeof2(obj); - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + }); + function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { + chunk = Buffer14.from(chunk, encoding); } + return chunk; } - function _possibleConstructorReturn(self, call) { - if (call && (_typeof2(call) === "object" || typeof call === "function")) { - return call; + Object.defineProperty(Writable.prototype, "writableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._writableState.highWaterMark; } - return _assertThisInitialized(self); - } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }); + function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = "buffer"; + chunk = newChunk; + } } - return self; - } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); - } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + if (!ret) + state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk, + encoding, + isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - if (superClass) - _setPrototypeOf(subClass, superClass); - } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); + return ret; } - var codes = {}; - var assert; - var util; - function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - function getMessage(arg1, arg2, arg3) { - if (typeof message === "string") { - return message; - } else { - return message(arg1, arg2, arg3); - } + function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) + state.onwrite(new ERR_STREAM_DESTROYED("write")); + else if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); + state.sync = false; + } + function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + process.nextTick(cb, er); + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + finishMaybe(stream, state); } - var NodeError = /* @__PURE__ */ function(_Base) { - _inherits(NodeError2, _Base); - function NodeError2(arg1, arg2, arg3) { - var _this; - _classCallCheck(this, NodeError2); - _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError2).call(this, getMessage(arg1, arg2, arg3))); - _this.code = code; - return _this; - } - return NodeError2; - }(Base); - codes[code] = NodeError; } - function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function(i) { - return String(i); - }); - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; + } + function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== "function") + throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) + onwriteError(stream, state, sync, er, cb); + else { + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); } else { - return "of ".concat(thing, " ").concat(expected[0]); + afterWrite(stream, state, finished, cb); } - } else { - return "of ".concat(thing, " ").concat(String(expected)); } } - function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; + function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); } - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; + function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit("drain"); } - return str.substring(this_len - search.length, this_len) === search; } - function includes(str, search, start) { - if (typeof start !== "number") { - start = 0; - } - if (start + search.length > str.length) { - return false; + function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) + allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, "", holder.finish); + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; } else { - return str.indexOf(search, start) !== -1; + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + if (state.writing) { + break; + } + } + if (entry === null) + state.lastBufferedRequest = null; } + state.bufferedRequest = entry; + state.bufferProcessing = false; } - createErrorType("ERR_AMBIGUOUS_ARGUMENT", 'The "%s" argument is ambiguous. %s', TypeError); - createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { - if (assert === void 0) - assert = require_assert(); - assert(typeof name === "string", "'name' must be a string"); - var determiner; - if (typeof expected === "string" && startsWith(expected, "not ")) { - determiner = "must not be"; - expected = expected.replace(/^not /, ""); - } else { - determiner = "must be"; - } - var msg; - if (endsWith(name, " argument")) { - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } else { - var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); + Writable.prototype._write = function(chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); + }; + Writable.prototype._writev = null; + Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === "function") { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === "function") { + cb = encoding; + encoding = null; } - msg += ". Received type ".concat(_typeof2(actual)); - return msg; - }, TypeError); - createErrorType("ERR_INVALID_ARG_VALUE", function(name, value) { - var reason = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "is invalid"; - if (util === void 0) - util = require_util(); - var inspected = util.inspect(value); - if (inspected.length > 128) { - inspected = "".concat(inspected.slice(0, 128), "..."); - } - return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected); - }, TypeError, RangeError); - createErrorType("ERR_INVALID_RETURN_VALUE", function(input, name, value) { - var type; - if (value && value.constructor && value.constructor.name) { - type = "instance of ".concat(value.constructor.name); - } else { - type = "type ".concat(_typeof2(value)); + if (chunk !== null && chunk !== void 0) + this.write(chunk, encoding); + if (state.corked) { + state.corked = 1; + this.uncork(); } - return "Expected ".concat(input, ' to be returned from the "').concat(name, '"') + " function but got ".concat(type, "."); - }, TypeError); - createErrorType("ERR_MISSING_ARGS", function() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - if (assert === void 0) - assert = require_assert(); - assert(args.length > 0, "At least one arg needs to be specified"); - var msg = "The "; - var len = args.length; - args = args.map(function(a) { - return '"'.concat(a, '"'); - }); - switch (len) { - case 1: - msg += "".concat(args[0], " argument"); - break; - case 2: - msg += "".concat(args[0], " and ").concat(args[1], " arguments"); - break; - default: - msg += args.slice(0, len - 1).join(", "); - msg += ", and ".concat(args[len - 1], " arguments"); - break; + if (!state.ending) + endWritable(this, state, cb); + return this; + }; + Object.defineProperty(Writable.prototype, "writableLength", { + enumerable: false, + get: function get2() { + return this._writableState.length; } - return "".concat(msg, " must be specified"); - }, TypeError); - module.exports.codes = codes; - } - }); - - // node_modules/assert-browserify/build/internal/assert/assertion_error.js - var require_assertion_error = __commonJS({ - "node_modules/assert-browserify/build/internal/assert/assertion_error.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === "function") { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); + }); + function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; + } + function callFinal(stream, state) { + stream._final(function(err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); } - ownKeys.forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }); - } - return target; + state.prefinished = true; + stream.emit("prefinish"); + finishMaybe(stream, state); + }); } - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; + function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === "function" && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit("prefinish"); + } } - return obj; } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit("finish"); + if (state.autoDestroy) { + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } } + return need; } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - function _possibleConstructorReturn(self, call) { - if (call && (_typeof2(call) === "object" || typeof call === "function")) { - return call; - } - return _assertThisInitialized(self); - } - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once("finish", cb); } - return self; + state.ended = true; + stream.writable = false; } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - if (superClass) - _setPrototypeOf(subClass, superClass); + state.corkedRequestsFree.next = corkReq; } - function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; - _wrapNativeSuper = function _wrapNativeSuper2(Class2) { - if (Class2 === null || !_isNativeFunction(Class2)) - return Class2; - if (typeof Class2 !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class2)) - return _cache.get(Class2); - _cache.set(Class2, Wrapper); + Object.defineProperty(Writable.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._writableState === void 0) { + return false; } - function Wrapper() { - return _construct(Class2, arguments, _getPrototypeOf(this).constructor); + return this._writableState.destroyed; + }, + set: function set(value) { + if (!this._writableState) { + return; } - Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); - return _setPrototypeOf(Wrapper, Class2); - }; - return _wrapNativeSuper(Class); - } - function isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) - return false; - if (Reflect.construct.sham) - return false; - if (typeof Proxy === "function") - return true; - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function() { - })); - return true; - } catch (e) { - return false; + this._writableState.destroyed = value; } - } - function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct2(Parent2, args2, Class2) { - var a = [null]; - a.push.apply(a, args2); - var Constructor = Function.bind.apply(Parent2, a); - var instance18 = new Constructor(); - if (Class2) - _setPrototypeOf(instance18, Class2.prototype); - return instance18; - }; + }); + Writable.prototype.destroy = destroyImpl.destroy; + Writable.prototype._undestroy = destroyImpl.undestroy; + Writable.prototype._destroy = function(err, cb) { + cb(err); + }; + } + }); + + // node_modules/readable-stream/lib/_stream_duplex.js + var require_stream_duplex = __commonJS({ + "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var objectKeys = Object.keys || function(obj) { + var keys2 = []; + for (var key2 in obj) { + keys2.push(key2); } - return _construct.apply(null, arguments); - } - function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; - } - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); - } - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); - } - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; - } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + return keys2; + }; + module.exports = Duplex; + var Readable = require_stream_readable(); + var Writable = require_stream_writable(); + require_inherits_browser()(Duplex, Readable); + { + keys = objectKeys(Writable.prototype); + for (v = 0; v < keys.length; v++) { + method = keys[v]; + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; } - return _typeof2(obj); } - var _require = require_util(); - var inspect = _require.inspect; - var _require2 = require_errors(); - var ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; + var keys; + var method; + var v; + function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) + this.readable = false; + if (options.writable === false) + this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once("end", onend); + } } - return str.substring(this_len - search.length, this_len) === search; } - function repeat(str, count) { - count = Math.floor(count); - if (str.length == 0 || count == 0) - return ""; - var maxCount = str.length * count; - count = Math.floor(Math.log(count) / Math.log(2)); - while (count) { - str += str; - count--; + Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._writableState.highWaterMark; } - str += str.substring(0, maxCount - str.length); - return str; - } - var blue = ""; - var green = ""; - var red = ""; - var white = ""; - var kReadableOperator = { - deepStrictEqual: "Expected values to be strictly deep-equal:", - strictEqual: "Expected values to be strictly equal:", - strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', - deepEqual: "Expected values to be loosely deep-equal:", - equal: "Expected values to be loosely equal:", - notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', - notStrictEqual: 'Expected "actual" to be strictly unequal to:', - notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', - notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', - notEqual: 'Expected "actual" to be loosely unequal to:', - notIdentical: "Values identical but not reference-equal:" - }; - var kMaxShortLength = 10; - function copyError(source) { - var keys = Object.keys(source); - var target = Object.create(Object.getPrototypeOf(source)); - keys.forEach(function(key2) { - target[key2] = source[key2]; - }); - Object.defineProperty(target, "message", { - value: source.message - }); - return target; - } - function inspectValue(val) { - return inspect(val, { - compact: false, - customInspect: false, - depth: 1e3, - maxArrayLength: Infinity, - showHidden: false, - breakLength: Infinity, - showProxy: false, - sorted: true, - getters: true - }); - } - function createErrDiff(actual, expected, operator) { - var other = ""; - var res = ""; - var lastPos = 0; - var end = ""; - var skipped = false; - var actualInspected = inspectValue(actual); - var actualLines = actualInspected.split("\n"); - var expectedLines = inspectValue(expected).split("\n"); - var i = 0; - var indicator = ""; - if (operator === "strictEqual" && _typeof2(actual) === "object" && _typeof2(expected) === "object" && actual !== null && expected !== null) { - operator = "strictEqualObject"; - } - if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) { - var inputLength = actualLines[0].length + expectedLines[0].length; - if (inputLength <= kMaxShortLength) { - if ((_typeof2(actual) !== "object" || actual === null) && (_typeof2(expected) !== "object" || expected === null) && (actual !== 0 || expected !== 0)) { - return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n"); - } - } else if (operator !== "strictEqualObject") { - var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80; - if (inputLength < maxLength) { - while (actualLines[0][i] === expectedLines[0][i]) { - i++; - } - if (i > 2) { - indicator = "\n ".concat(repeat(" ", i), "^"); - i = 0; - } - } - } + }); + Object.defineProperty(Duplex.prototype, "writableBuffer", { + enumerable: false, + get: function get2() { + return this._writableState && this._writableState.getBuffer(); } - var a = actualLines[actualLines.length - 1]; - var b = expectedLines[expectedLines.length - 1]; - while (a === b) { - if (i++ < 2) { - end = "\n ".concat(a).concat(end); - } else { - other = a; - } - actualLines.pop(); - expectedLines.pop(); - if (actualLines.length === 0 || expectedLines.length === 0) - break; - a = actualLines[actualLines.length - 1]; - b = expectedLines[expectedLines.length - 1]; - } - var maxLines = Math.max(actualLines.length, expectedLines.length); - if (maxLines === 0) { - var _actualLines = actualInspected.split("\n"); - if (_actualLines.length > 30) { - _actualLines[26] = "".concat(blue, "...").concat(white); - while (_actualLines.length > 27) { - _actualLines.pop(); - } - } - return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join("\n"), "\n"); - } - if (i > 3) { - end = "\n".concat(blue, "...").concat(white).concat(end); - skipped = true; - } - if (other !== "") { - end = "\n ".concat(other).concat(end); - other = ""; - } - var printedLines = 0; - var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white); - var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped"); - for (i = 0; i < maxLines; i++) { - var cur = i - lastPos; - if (actualLines.length < i + 1) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(expectedLines[i - 2]); - printedLines++; - } - res += "\n ".concat(expectedLines[i - 1]); - printedLines++; - } - lastPos = i; - other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]); - printedLines++; - } else if (expectedLines.length < i + 1) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(actualLines[i - 2]); - printedLines++; - } - res += "\n ".concat(actualLines[i - 1]); - printedLines++; - } - lastPos = i; - res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]); - printedLines++; - } else { - var expectedLine = expectedLines[i]; - var actualLine = actualLines[i]; - var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ",") || actualLine.slice(0, -1) !== expectedLine); - if (divergingLines && endsWith(expectedLine, ",") && expectedLine.slice(0, -1) === actualLine) { - divergingLines = false; - actualLine += ","; - } - if (divergingLines) { - if (cur > 1 && i > 2) { - if (cur > 4) { - res += "\n".concat(blue, "...").concat(white); - skipped = true; - } else if (cur > 3) { - res += "\n ".concat(actualLines[i - 2]); - printedLines++; - } - res += "\n ".concat(actualLines[i - 1]); - printedLines++; - } - lastPos = i; - res += "\n".concat(green, "+").concat(white, " ").concat(actualLine); - other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine); - printedLines += 2; - } else { - res += other; - other = ""; - if (cur === 1 || i === 0) { - res += "\n ".concat(actualLine); - printedLines++; - } - } - } - if (printedLines > 20 && i < maxLines - 2) { - return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white); - } + }); + Object.defineProperty(Duplex.prototype, "writableLength", { + enumerable: false, + get: function get2() { + return this._writableState.length; } - return "".concat(msg).concat(skipped ? skippedMsg : "", "\n").concat(res).concat(other).concat(end).concat(indicator); + }); + function onend() { + if (this._writableState.ended) + return; + process.nextTick(onEndNT, this); } - var AssertionError = /* @__PURE__ */ function(_Error) { - _inherits(AssertionError2, _Error); - function AssertionError2(options) { - var _this; - _classCallCheck(this, AssertionError2); - if (_typeof2(options) !== "object" || options === null) { - throw new ERR_INVALID_ARG_TYPE("options", "Object", options); - } - var message = options.message, operator = options.operator, stackStartFn = options.stackStartFn; - var actual = options.actual, expected = options.expected; - var limit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - if (message != null) { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, String(message))); - } else { - if (process.stderr && process.stderr.isTTY) { - if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) { - blue = "\x1B[34m"; - green = "\x1B[32m"; - white = "\x1B[39m"; - red = "\x1B[31m"; - } else { - blue = ""; - green = ""; - white = ""; - red = ""; - } - } - if (_typeof2(actual) === "object" && actual !== null && _typeof2(expected) === "object" && expected !== null && "stack" in actual && actual instanceof Error && "stack" in expected && expected instanceof Error) { - actual = copyError(actual); - expected = copyError(expected); - } - if (operator === "deepStrictEqual" || operator === "strictEqual") { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, createErrDiff(actual, expected, operator))); - } else if (operator === "notDeepStrictEqual" || operator === "notStrictEqual") { - var base = kReadableOperator[operator]; - var res = inspectValue(actual).split("\n"); - if (operator === "notStrictEqual" && _typeof2(actual) === "object" && actual !== null) { - base = kReadableOperator.notStrictEqualObject; - } - if (res.length > 30) { - res[26] = "".concat(blue, "...").concat(white); - while (res.length > 27) { - res.pop(); - } - } - if (res.length === 1) { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(base, " ").concat(res[0]))); - } else { - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(base, "\n\n").concat(res.join("\n"), "\n"))); - } - } else { - var _res = inspectValue(actual); - var other = ""; - var knownOperators = kReadableOperator[operator]; - if (operator === "notDeepEqual" || operator === "notEqual") { - _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res); - if (_res.length > 1024) { - _res = "".concat(_res.slice(0, 1021), "..."); - } - } else { - other = "".concat(inspectValue(expected)); - if (_res.length > 512) { - _res = "".concat(_res.slice(0, 509), "..."); - } - if (other.length > 512) { - other = "".concat(other.slice(0, 509), "..."); - } - if (operator === "deepEqual" || operator === "equal") { - _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n"); - } else { - other = " ".concat(operator, " ").concat(other); - } - } - _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, "".concat(_res).concat(other))); - } - } - Error.stackTraceLimit = limit; - _this.generatedMessage = !message; - Object.defineProperty(_assertThisInitialized(_this), "name", { - value: "AssertionError [ERR_ASSERTION]", - enumerable: false, - writable: true, - configurable: true - }); - _this.code = "ERR_ASSERTION"; - _this.actual = actual; - _this.expected = expected; - _this.operator = operator; - if (Error.captureStackTrace) { - Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn); - } - _this.stack; - _this.name = "AssertionError"; - return _possibleConstructorReturn(_this); - } - _createClass(AssertionError2, [{ - key: "toString", - value: function toString2() { - return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); + function onEndNT(self) { + self.end(); + } + Object.defineProperty(Duplex.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._readableState === void 0 || this._writableState === void 0) { + return false; } - }, { - key: inspect.custom, - value: function value(recurseTimes, ctx) { - return inspect(this, _objectSpread({}, ctx, { - customInspect: false, - depth: 0 - })); + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + if (this._readableState === void 0 || this._writableState === void 0) { + return; } - }]); - return AssertionError2; - }(_wrapNativeSuper(Error)); - module.exports = AssertionError; + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } + }); } }); - // node_modules/es6-object-assign/index.js - var require_es6_object_assign = __commonJS({ - "node_modules/es6-object-assign/index.js"(exports, module) { - "use strict"; + // node_modules/safe-buffer/index.js + var require_safe_buffer = __commonJS({ + "node_modules/safe-buffer/index.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - function assign2(target, firstSource) { - if (target === void 0 || target === null) { - throw new TypeError("Cannot convert first argument to object"); - } - var to = Object(target); - for (var i = 1; i < arguments.length; i++) { - var nextSource = arguments[i]; - if (nextSource === void 0 || nextSource === null) { - continue; - } - var keysArray = Object.keys(Object(nextSource)); - for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { - var nextKey = keysArray[nextIndex]; - var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); - if (desc !== void 0 && desc.enumerable) { - to[nextKey] = nextSource[nextKey]; - } - } + var buffer = require_buffer(); + var Buffer14 = buffer.Buffer; + function copyProps(src, dst) { + for (var key2 in src) { + dst[key2] = src[key2]; } - return to; } - function polyfill() { - if (!Object.assign) { - Object.defineProperty(Object, "assign", { - enumerable: false, - configurable: true, - writable: true, - value: assign2 - }); - } + if (Buffer14.from && Buffer14.alloc && Buffer14.allocUnsafe && Buffer14.allocUnsafeSlow) { + module.exports = buffer; + } else { + copyProps(buffer, exports); + exports.Buffer = SafeBuffer; } - module.exports = { - assign: assign2, - polyfill - }; - } - }); - - // node_modules/object-keys/isArguments.js - var require_isArguments = __commonJS({ - "node_modules/object-keys/isArguments.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var toStr = Object.prototype.toString; - module.exports = function isArguments(value) { - var str = toStr.call(value); - var isArgs = str === "[object Arguments]"; - if (!isArgs) { - isArgs = str !== "[object Array]" && value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && toStr.call(value.callee) === "[object Function]"; - } - return isArgs; + function SafeBuffer(arg, encodingOrOffset, length) { + return Buffer14(arg, encodingOrOffset, length); + } + SafeBuffer.prototype = Object.create(Buffer14.prototype); + copyProps(Buffer14, SafeBuffer); + SafeBuffer.from = function(arg, encodingOrOffset, length) { + if (typeof arg === "number") { + throw new TypeError("Argument must not be a number"); + } + return Buffer14(arg, encodingOrOffset, length); }; - } - }); - - // node_modules/object-keys/implementation.js - var require_implementation2 = __commonJS({ - "node_modules/object-keys/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var keysShim; - if (!Object.keys) { - has = Object.prototype.hasOwnProperty; - toStr = Object.prototype.toString; - isArgs = require_isArguments(); - isEnumerable = Object.prototype.propertyIsEnumerable; - hasDontEnumBug = !isEnumerable.call({ toString: null }, "toString"); - hasProtoEnumBug = isEnumerable.call(function() { - }, "prototype"); - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ]; - equalsConstructorPrototype = function(o) { - var ctor = o.constructor; - return ctor && ctor.prototype === o; - }; - excludedKeys = { - $applicationCache: true, - $console: true, - $external: true, - $frame: true, - $frameElement: true, - $frames: true, - $innerHeight: true, - $innerWidth: true, - $onmozfullscreenchange: true, - $onmozfullscreenerror: true, - $outerHeight: true, - $outerWidth: true, - $pageXOffset: true, - $pageYOffset: true, - $parent: true, - $scrollLeft: true, - $scrollTop: true, - $scrollX: true, - $scrollY: true, - $self: true, - $webkitIndexedDB: true, - $webkitStorageInfo: true, - $window: true - }; - hasAutomationEqualityBug = function() { - if (typeof window === "undefined") { - return false; - } - for (var k in window) { - try { - if (!excludedKeys["$" + k] && has.call(window, k) && window[k] !== null && typeof window[k] === "object") { - try { - equalsConstructorPrototype(window[k]); - } catch (e) { - return true; - } - } - } catch (e) { - return true; - } - } - return false; - }(); - equalsConstructorPrototypeIfNotBuggy = function(o) { - if (typeof window === "undefined" || !hasAutomationEqualityBug) { - return equalsConstructorPrototype(o); - } - try { - return equalsConstructorPrototype(o); - } catch (e) { - return false; - } - }; - keysShim = function keys(object) { - var isObject = object !== null && typeof object === "object"; - var isFunction = toStr.call(object) === "[object Function]"; - var isArguments = isArgs(object); - var isString = isObject && toStr.call(object) === "[object String]"; - var theKeys = []; - if (!isObject && !isFunction && !isArguments) { - throw new TypeError("Object.keys called on a non-object"); - } - var skipProto = hasProtoEnumBug && isFunction; - if (isString && object.length > 0 && !has.call(object, 0)) { - for (var i = 0; i < object.length; ++i) { - theKeys.push(String(i)); - } - } - if (isArguments && object.length > 0) { - for (var j = 0; j < object.length; ++j) { - theKeys.push(String(j)); - } + SafeBuffer.alloc = function(size, fill, encoding) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); + } + var buf2 = Buffer14(size); + if (fill !== void 0) { + if (typeof encoding === "string") { + buf2.fill(fill, encoding); } else { - for (var name in object) { - if (!(skipProto && name === "prototype") && has.call(object, name)) { - theKeys.push(String(name)); - } - } - } - if (hasDontEnumBug) { - var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); - for (var k = 0; k < dontEnums.length; ++k) { - if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object, dontEnums[k])) { - theKeys.push(dontEnums[k]); - } - } - } - return theKeys; - }; - } - var has; - var toStr; - var isArgs; - var isEnumerable; - var hasDontEnumBug; - var hasProtoEnumBug; - var dontEnums; - var equalsConstructorPrototype; - var excludedKeys; - var hasAutomationEqualityBug; - var equalsConstructorPrototypeIfNotBuggy; - module.exports = keysShim; - } - }); - - // node_modules/object-keys/index.js - var require_object_keys = __commonJS({ - "node_modules/object-keys/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var slice = Array.prototype.slice; - var isArgs = require_isArguments(); - var origKeys = Object.keys; - var keysShim = origKeys ? function keys(o) { - return origKeys(o); - } : require_implementation2(); - var originalKeys = Object.keys; - keysShim.shim = function shimObjectKeys() { - if (Object.keys) { - var keysWorksWithArguments = function() { - var args = Object.keys(arguments); - return args && args.length === arguments.length; - }(1, 2); - if (!keysWorksWithArguments) { - Object.keys = function keys(object) { - if (isArgs(object)) { - return originalKeys(slice.call(object)); - } - return originalKeys(object); - }; + buf2.fill(fill); } } else { - Object.keys = keysShim; - } - return Object.keys || keysShim; - }; - module.exports = keysShim; - } - }); - - // node_modules/has-property-descriptors/index.js - var require_has_property_descriptors = __commonJS({ - "node_modules/has-property-descriptors/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var GetIntrinsic = require_get_intrinsic(); - var $defineProperty = GetIntrinsic("%Object.defineProperty%", true); - var hasPropertyDescriptors = function hasPropertyDescriptors2() { - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - return true; - } catch (e) { - return false; - } - } - return false; - }; - hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { - if (!hasPropertyDescriptors()) { - return null; - } - try { - return $defineProperty([], "length", { value: 1 }).length !== 1; - } catch (e) { - return true; + buf2.fill(0); } + return buf2; }; - module.exports = hasPropertyDescriptors; - } - }); - - // node_modules/define-properties/index.js - var require_define_properties = __commonJS({ - "node_modules/define-properties/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var keys = require_object_keys(); - var hasSymbols = typeof Symbol === "function" && typeof Symbol("foo") === "symbol"; - var toStr = Object.prototype.toString; - var concat = Array.prototype.concat; - var origDefineProperty = Object.defineProperty; - var isFunction = function(fn) { - return typeof fn === "function" && toStr.call(fn) === "[object Function]"; - }; - var hasPropertyDescriptors = require_has_property_descriptors()(); - var supportsDescriptors = origDefineProperty && hasPropertyDescriptors; - var defineProperty = function(object, name, value, predicate) { - if (name in object && (!isFunction(predicate) || !predicate())) { - return; - } - if (supportsDescriptors) { - origDefineProperty(object, name, { - configurable: true, - enumerable: false, - value, - writable: true - }); - } else { - object[name] = value; + SafeBuffer.allocUnsafe = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } + return Buffer14(size); }; - var defineProperties = function(object, map) { - var predicates = arguments.length > 2 ? arguments[2] : {}; - var props = keys(map); - if (hasSymbols) { - props = concat.call(props, Object.getOwnPropertySymbols(map)); - } - for (var i = 0; i < props.length; i += 1) { - defineProperty(object, props[i], map[props[i]], predicates[props[i]]); + SafeBuffer.allocUnsafeSlow = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); } + return buffer.SlowBuffer(size); }; - defineProperties.supportsDescriptors = !!supportsDescriptors; - module.exports = defineProperties; } }); - // node_modules/object-is/implementation.js - var require_implementation3 = __commonJS({ - "node_modules/object-is/implementation.js"(exports, module) { + // node_modules/string_decoder/lib/string_decoder.js + var require_string_decoder = __commonJS({ + "node_modules/string_decoder/lib/string_decoder.js"(exports) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var numberIsNaN = function(value) { - return value !== value; - }; - module.exports = function is(a, b) { - if (a === 0 && b === 0) { - return 1 / a === 1 / b; - } - if (a === b) { - return true; - } - if (numberIsNaN(a) && numberIsNaN(b)) { - return true; + var Buffer14 = require_safe_buffer().Buffer; + var isEncoding = Buffer14.isEncoding || function(encoding) { + encoding = "" + encoding; + switch (encoding && encoding.toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + case "raw": + return true; + default: + return false; } - return false; - }; - } - }); - - // node_modules/object-is/polyfill.js - var require_polyfill = __commonJS({ - "node_modules/object-is/polyfill.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation3(); - module.exports = function getPolyfill() { - return typeof Object.is === "function" ? Object.is : implementation; }; - } - }); - - // node_modules/object-is/shim.js - var require_shim = __commonJS({ - "node_modules/object-is/shim.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var getPolyfill = require_polyfill(); - var define2 = require_define_properties(); - module.exports = function shimObjectIs() { - var polyfill = getPolyfill(); - define2(Object, { is: polyfill }, { - is: function testObjectIs() { - return Object.is !== polyfill; + function _normalizeEncoding(enc) { + if (!enc) + return "utf8"; + var retried; + while (true) { + switch (enc) { + case "utf8": + case "utf-8": + return "utf8"; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return "utf16le"; + case "latin1": + case "binary": + return "latin1"; + case "base64": + case "ascii": + case "hex": + return enc; + default: + if (retried) + return; + enc = ("" + enc).toLowerCase(); + retried = true; } - }); - return polyfill; - }; - } - }); - - // node_modules/object-is/index.js - var require_object_is = __commonJS({ - "node_modules/object-is/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var define2 = require_define_properties(); - var callBind = require_call_bind(); - var implementation = require_implementation3(); - var getPolyfill = require_polyfill(); - var shim = require_shim(); - var polyfill = callBind(getPolyfill(), Object); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module.exports = polyfill; - } - }); - - // node_modules/is-nan/implementation.js - var require_implementation4 = __commonJS({ - "node_modules/is-nan/implementation.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function isNaN2(value) { - return value !== value; - }; - } - }); - - // node_modules/is-nan/polyfill.js - var require_polyfill2 = __commonJS({ - "node_modules/is-nan/polyfill.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var implementation = require_implementation4(); - module.exports = function getPolyfill() { - if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN("a")) { - return Number.isNaN; } - return implementation; - }; - } - }); - - // node_modules/is-nan/shim.js - var require_shim2 = __commonJS({ - "node_modules/is-nan/shim.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var define2 = require_define_properties(); - var getPolyfill = require_polyfill2(); - module.exports = function shimNumberIsNaN() { - var polyfill = getPolyfill(); - define2(Number, { isNaN: polyfill }, { - isNaN: function testIsNaN() { - return Number.isNaN !== polyfill; - } - }); - return polyfill; - }; - } - }); - - // node_modules/is-nan/index.js - var require_is_nan = __commonJS({ - "node_modules/is-nan/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var callBind = require_call_bind(); - var define2 = require_define_properties(); - var implementation = require_implementation4(); - var getPolyfill = require_polyfill2(); - var shim = require_shim2(); - var polyfill = callBind(getPolyfill(), Number); - define2(polyfill, { - getPolyfill, - implementation, - shim - }); - module.exports = polyfill; - } - }); - - // node_modules/assert-browserify/build/internal/util/comparisons.js - var require_comparisons = __commonJS({ - "node_modules/assert-browserify/build/internal/util/comparisons.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== "string" && (Buffer14.isEncoding === isEncoding || !isEncoding(enc))) + throw new Error("Unknown encoding: " + enc); + return nenc || enc; } - function _iterableToArrayLimit(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = void 0; - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) - break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) - _i["return"](); - } finally { - if (_d) - throw _e; - } + exports.StringDecoder = StringDecoder; + function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case "utf16le": + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case "utf8": + this.fillLast = utf8FillLast; + nb = 4; + break; + case "base64": + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; } - return _arr; - } - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) - return arr; + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer14.allocUnsafe(nb); } - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; + StringDecoder.prototype.write = function(buf2) { + if (buf2.length === 0) + return ""; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf2); + if (r === void 0) + return ""; + i = this.lastNeed; + this.lastNeed = 0; } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; + i = 0; } - return _typeof2(obj); - } - var regexFlagsSupported = /a/g.flags !== void 0; - var arrayFromSet = function arrayFromSet2(set) { - var array = []; - set.forEach(function(value) { - return array.push(value); - }); - return array; + if (i < buf2.length) + return r ? r + this.text(buf2, i) : this.text(buf2, i); + return r || ""; }; - var arrayFromMap = function arrayFromMap2(map) { - var array = []; - map.forEach(function(value, key2) { - return array.push([key2, value]); - }); - return array; - }; - var objectIs = Object.is ? Object.is : require_object_is(); - var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function() { - return []; - }; - var numberIsNaN = Number.isNaN ? Number.isNaN : require_is_nan(); - function uncurryThis(f) { - return f.call.bind(f); - } - var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); - var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable); - var objectToString = uncurryThis(Object.prototype.toString); - var _require$types = require_util().types; - var isAnyArrayBuffer = _require$types.isAnyArrayBuffer; - var isArrayBufferView = _require$types.isArrayBufferView; - var isDate = _require$types.isDate; - var isMap = _require$types.isMap; - var isRegExp = _require$types.isRegExp; - var isSet = _require$types.isSet; - var isNativeError = _require$types.isNativeError; - var isBoxedPrimitive = _require$types.isBoxedPrimitive; - var isNumberObject = _require$types.isNumberObject; - var isStringObject = _require$types.isStringObject; - var isBooleanObject = _require$types.isBooleanObject; - var isBigIntObject = _require$types.isBigIntObject; - var isSymbolObject = _require$types.isSymbolObject; - var isFloat32Array = _require$types.isFloat32Array; - var isFloat64Array = _require$types.isFloat64Array; - function isNonIndex(key2) { - if (key2.length === 0 || key2.length > 10) - return true; - for (var i = 0; i < key2.length; i++) { - var code = key2.charCodeAt(i); - if (code < 48 || code > 57) - return true; + StringDecoder.prototype.end = utf8End; + StringDecoder.prototype.text = utf8Text; + StringDecoder.prototype.fillLast = function(buf2) { + if (this.lastNeed <= buf2.length) { + buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - return key2.length === 10 && key2 >= Math.pow(2, 32); - } - function getOwnNonIndexProperties(value) { - return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value))); + buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length); + this.lastNeed -= buf2.length; + }; + function utf8CheckByte(byte) { + if (byte <= 127) + return 0; + else if (byte >> 5 === 6) + return 2; + else if (byte >> 4 === 14) + return 3; + else if (byte >> 3 === 30) + return 4; + return byte >> 6 === 2 ? -1 : -2; } - function compare(a, b) { - if (a === b) { + function utf8CheckIncomplete(self, buf2, i) { + var j = buf2.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) + self.lastNeed = nb - 1; + return nb; } - var x = a.length; - var y = b.length; - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) { - return -1; + if (--j < i || nb === -2) + return 0; + nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) + self.lastNeed = nb - 2; + return nb; } - if (y < x) { - return 1; + if (--j < i || nb === -2) + return 0; + nb = utf8CheckByte(buf2[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) + nb = 0; + else + self.lastNeed = nb - 3; + } + return nb; } return 0; } - var ONLY_ENUMERABLE = void 0; - var kStrict = true; - var kLoose = false; - var kNoIterator = 0; - var kIsArray = 1; - var kIsSet = 2; - var kIsMap = 3; - function areSimilarRegExps(a, b) { - return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b); - } - function areSimilarFloatArrays(a, b) { - if (a.byteLength !== b.byteLength) { - return false; + function utf8CheckExtraBytes(self, buf2, p) { + if ((buf2[0] & 192) !== 128) { + self.lastNeed = 0; + return "\uFFFD"; } - for (var offset = 0; offset < a.byteLength; offset++) { - if (a[offset] !== b[offset]) { - return false; + if (self.lastNeed > 1 && buf2.length > 1) { + if ((buf2[1] & 192) !== 128) { + self.lastNeed = 1; + return "\uFFFD"; + } + if (self.lastNeed > 2 && buf2.length > 2) { + if ((buf2[2] & 192) !== 128) { + self.lastNeed = 2; + return "\uFFFD"; + } } } - return true; } - function areSimilarTypedArrays(a, b) { - if (a.byteLength !== b.byteLength) { - return false; + function utf8FillLast(buf2) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf2, p); + if (r !== void 0) + return r; + if (this.lastNeed <= buf2.length) { + buf2.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0; + buf2.copy(this.lastChar, p, 0, buf2.length); + this.lastNeed -= buf2.length; } - function areEqualArrayBuffers(buf1, buf2) { - return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0; + function utf8Text(buf2, i) { + var total = utf8CheckIncomplete(this, buf2, i); + if (!this.lastNeed) + return buf2.toString("utf8", i); + this.lastTotal = total; + var end = buf2.length - (total - this.lastNeed); + buf2.copy(this.lastChar, 0, end); + return buf2.toString("utf8", i, end); } - function isEqualBoxedPrimitive(val1, val2) { - if (isNumberObject(val1)) { - return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2)); - } - if (isStringObject(val1)) { - return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2); - } - if (isBooleanObject(val1)) { - return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2); - } - if (isBigIntObject(val1)) { - return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2); - } - return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2); + function utf8End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) + return r + "\uFFFD"; + return r; } - function innerDeepEqual(val1, val2, strict, memos) { - if (val1 === val2) { - if (val1 !== 0) - return true; - return strict ? objectIs(val1, val2) : true; - } - if (strict) { - if (_typeof2(val1) !== "object") { - return typeof val1 === "number" && numberIsNaN(val1) && numberIsNaN(val2); - } - if (_typeof2(val2) !== "object" || val1 === null || val2 === null) { - return false; - } - if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) { - return false; - } - } else { - if (val1 === null || _typeof2(val1) !== "object") { - if (val2 === null || _typeof2(val2) !== "object") { - return val1 == val2; - } - return false; - } - if (val2 === null || _typeof2(val2) !== "object") { - return false; - } - } - var val1Tag = objectToString(val1); - var val2Tag = objectToString(val2); - if (val1Tag !== val2Tag) { - return false; - } - if (Array.isArray(val1)) { - if (val1.length !== val2.length) { - return false; - } - var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); - var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); - if (keys1.length !== keys2.length) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsArray, keys1); - } - if (val1Tag === "[object Object]") { - if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) { - return false; - } - } - if (isDate(val1)) { - if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) { - return false; - } - } else if (isRegExp(val1)) { - if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) { - return false; - } - } else if (isNativeError(val1) || val1 instanceof Error) { - if (val1.message !== val2.message || val1.name !== val2.name) { - return false; - } - } else if (isArrayBufferView(val1)) { - if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) { - if (!areSimilarFloatArrays(val1, val2)) { - return false; + function utf16Text(buf2, i) { + if ((buf2.length - i) % 2 === 0) { + var r = buf2.toString("utf16le", i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 55296 && c <= 56319) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf2[buf2.length - 2]; + this.lastChar[1] = buf2[buf2.length - 1]; + return r.slice(0, -1); } - } else if (!areSimilarTypedArrays(val1, val2)) { - return false; - } - var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); - var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); - if (_keys.length !== _keys2.length) { - return false; - } - return keyCheck(val1, val2, strict, memos, kNoIterator, _keys); - } else if (isSet(val1)) { - if (!isSet(val2) || val1.size !== val2.size) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsSet); - } else if (isMap(val1)) { - if (!isMap(val2) || val1.size !== val2.size) { - return false; - } - return keyCheck(val1, val2, strict, memos, kIsMap); - } else if (isAnyArrayBuffer(val1)) { - if (!areEqualArrayBuffers(val1, val2)) { - return false; } - } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) { - return false; + return r; } - return keyCheck(val1, val2, strict, memos, kNoIterator); - } - function getEnumerables(val, keys) { - return keys.filter(function(k) { - return propertyIsEnumerable(val, k); - }); + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf2[buf2.length - 1]; + return buf2.toString("utf16le", i, buf2.length - 1); } - function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { - if (arguments.length === 5) { - aKeys = Object.keys(val1); - var bKeys = Object.keys(val2); - if (aKeys.length !== bKeys.length) { - return false; - } - } - var i = 0; - for (; i < aKeys.length; i++) { - if (!hasOwnProperty(val2, aKeys[i])) { - return false; - } - } - if (strict && arguments.length === 5) { - var symbolKeysA = objectGetOwnPropertySymbols(val1); - if (symbolKeysA.length !== 0) { - var count = 0; - for (i = 0; i < symbolKeysA.length; i++) { - var key2 = symbolKeysA[i]; - if (propertyIsEnumerable(val1, key2)) { - if (!propertyIsEnumerable(val2, key2)) { - return false; - } - aKeys.push(key2); - count++; - } else if (propertyIsEnumerable(val2, key2)) { - return false; - } - } - var symbolKeysB = objectGetOwnPropertySymbols(val2); - if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) { - return false; - } - } else { - var _symbolKeysB = objectGetOwnPropertySymbols(val2); - if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) { - return false; - } - } - } - if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) { - return true; + function utf16End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString("utf16le", 0, end); } - if (memos === void 0) { - memos = { - val1: /* @__PURE__ */ new Map(), - val2: /* @__PURE__ */ new Map(), - position: 0 - }; + return r; + } + function base64Text(buf2, i) { + var n = (buf2.length - i) % 3; + if (n === 0) + return buf2.toString("base64", i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf2[buf2.length - 1]; } else { - var val2MemoA = memos.val1.get(val1); - if (val2MemoA !== void 0) { - var val2MemoB = memos.val2.get(val2); - if (val2MemoB !== void 0) { - return val2MemoA === val2MemoB; - } - } - memos.position++; - } - memos.val1.set(val1, memos.position); - memos.val2.set(val2, memos.position); - var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType); - memos.val1.delete(val1); - memos.val2.delete(val2); - return areEq; - } - function setHasEqualElement(set, val1, strict, memo) { - var setValues = arrayFromSet(set); - for (var i = 0; i < setValues.length; i++) { - var val2 = setValues[i]; - if (innerDeepEqual(val1, val2, strict, memo)) { - set.delete(val2); - return true; - } + this.lastChar[0] = buf2[buf2.length - 2]; + this.lastChar[1] = buf2[buf2.length - 1]; } - return false; + return buf2.toString("base64", i, buf2.length - n); } - function findLooseMatchingPrimitives(prim) { - switch (_typeof2(prim)) { - case "undefined": - return null; - case "object": - return void 0; - case "symbol": - return false; - case "string": - prim = +prim; - case "number": - if (numberIsNaN(prim)) { - return false; - } - } - return true; + function base64End(buf2) { + var r = buf2 && buf2.length ? this.write(buf2) : ""; + if (this.lastNeed) + return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); + return r; } - function setMightHaveLoosePrim(a, b, prim) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) - return altValue; - return b.has(altValue) && !a.has(altValue); + function simpleWrite(buf2) { + return buf2.toString(this.encoding); } - function mapMightHaveLoosePrim(a, b, prim, item, memo) { - var altValue = findLooseMatchingPrimitives(prim); - if (altValue != null) { - return altValue; - } - var curB = b.get(altValue); - if (curB === void 0 && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) { - return false; - } - return !a.has(altValue) && innerDeepEqual(item, curB, false, memo); + function simpleEnd(buf2) { + return buf2 && buf2.length ? this.write(buf2) : ""; } - function setEquiv(a, b, strict, memo) { - var set = null; - var aValues = arrayFromSet(a); - for (var i = 0; i < aValues.length; i++) { - var val = aValues[i]; - if (_typeof2(val) === "object" && val !== null) { - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(val); - } else if (!b.has(val)) { - if (strict) - return false; - if (!setMightHaveLoosePrim(a, b, val)) { - return false; - } - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(val); - } - } - if (set !== null) { - var bValues = arrayFromSet(b); - for (var _i = 0; _i < bValues.length; _i++) { - var _val = bValues[_i]; - if (_typeof2(_val) === "object" && _val !== null) { - if (!setHasEqualElement(set, _val, strict, memo)) - return false; - } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) { - return false; - } + } + }); + + // node_modules/readable-stream/lib/internal/streams/end-of-stream.js + var require_end_of_stream = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) { + "use strict"; + init_define_BUILD_VERSION(); + init_esbuild_inject(); + var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE; + function once(callback) { + var called = false; + return function() { + if (called) + return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - return set.size === 0; - } - return true; + callback.apply(this, args); + }; } - function mapHasEqualEntry(set, map, key1, item1, strict, memo) { - var setValues = arrayFromSet(set); - for (var i = 0; i < setValues.length; i++) { - var key2 = setValues[i]; - if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) { - set.delete(key2); - return true; - } - } - return false; + function noop3() { } - function mapEquiv(a, b, strict, memo) { - var set = null; - var aEntries = arrayFromMap(a); - for (var i = 0; i < aEntries.length; i++) { - var _aEntries$i = _slicedToArray(aEntries[i], 2), key2 = _aEntries$i[0], item1 = _aEntries$i[1]; - if (_typeof2(key2) === "object" && key2 !== null) { - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(key2); - } else { - var item2 = b.get(key2); - if (item2 === void 0 && !b.has(key2) || !innerDeepEqual(item1, item2, strict, memo)) { - if (strict) - return false; - if (!mapMightHaveLoosePrim(a, b, key2, item1, memo)) - return false; - if (set === null) { - set = /* @__PURE__ */ new Set(); - } - set.add(key2); - } - } - } - if (set !== null) { - var bEntries = arrayFromMap(b); - for (var _i2 = 0; _i2 < bEntries.length; _i2++) { - var _bEntries$_i = _slicedToArray(bEntries[_i2], 2), key2 = _bEntries$_i[0], item = _bEntries$_i[1]; - if (_typeof2(key2) === "object" && key2 !== null) { - if (!mapHasEqualEntry(set, a, key2, item, strict, memo)) - return false; - } else if (!strict && (!a.has(key2) || !innerDeepEqual(a.get(key2), item, false, memo)) && !mapHasEqualEntry(set, a, key2, item, false, memo)) { - return false; - } - } - return set.size === 0; - } - return true; + function isRequest(stream) { + return stream.setHeader && typeof stream.abort === "function"; } - function objEquiv(a, b, strict, keys, memos, iterationType) { - var i = 0; - if (iterationType === kIsSet) { - if (!setEquiv(a, b, strict, memos)) { - return false; - } - } else if (iterationType === kIsMap) { - if (!mapEquiv(a, b, strict, memos)) { - return false; - } - } else if (iterationType === kIsArray) { - for (; i < a.length; i++) { - if (hasOwnProperty(a, i)) { - if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) { - return false; - } - } else if (hasOwnProperty(b, i)) { - return false; - } else { - var keysA = Object.keys(a); - for (; i < keysA.length; i++) { - var key2 = keysA[i]; - if (!hasOwnProperty(b, key2) || !innerDeepEqual(a[key2], b[key2], strict, memos)) { - return false; - } - } - if (keysA.length !== Object.keys(b).length) { - return false; - } - return true; - } + function eos(stream, opts, callback) { + if (typeof opts === "function") + return eos(stream, null, opts); + if (!opts) + opts = {}; + callback = once(callback || noop3); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable2 = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish2() { + if (!stream.writable) + onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish2() { + writable2 = false; + writableEnded = true; + if (!readable) + callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend2() { + readable = false; + readableEnded = true; + if (!writable2) + callback.call(stream); + }; + var onerror = function onerror2(err) { + callback.call(stream, err); + }; + var onclose = function onclose2() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) + err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } - } - for (i = 0; i < keys.length; i++) { - var _key = keys[i]; - if (!innerDeepEqual(a[_key], b[_key], strict, memos)) { - return false; + if (writable2 && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) + err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); } + }; + var onrequest = function onrequest2() { + stream.req.on("finish", onfinish); + }; + if (isRequest(stream)) { + stream.on("complete", onfinish); + stream.on("abort", onclose); + if (stream.req) + onrequest(); + else + stream.on("request", onrequest); + } else if (writable2 && !stream._writableState) { + stream.on("end", onlegacyfinish); + stream.on("close", onlegacyfinish); } - return true; - } - function isDeepEqual(val1, val2) { - return innerDeepEqual(val1, val2, kLoose); - } - function isDeepStrictEqual(val1, val2) { - return innerDeepEqual(val1, val2, kStrict); + stream.on("end", onend); + stream.on("finish", onfinish); + if (opts.error !== false) + stream.on("error", onerror); + stream.on("close", onclose); + return function() { + stream.removeListener("complete", onfinish); + stream.removeListener("abort", onclose); + stream.removeListener("request", onrequest); + if (stream.req) + stream.req.removeListener("finish", onfinish); + stream.removeListener("end", onlegacyfinish); + stream.removeListener("close", onlegacyfinish); + stream.removeListener("finish", onfinish); + stream.removeListener("end", onend); + stream.removeListener("error", onerror); + stream.removeListener("close", onclose); + }; } - module.exports = { - isDeepEqual, - isDeepStrictEqual - }; + module.exports = eos; } }); - // node_modules/assert-browserify/build/assert.js - var require_assert = __commonJS({ - "node_modules/assert-browserify/build/assert.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/async_iterator.js + var require_async_iterator = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function _typeof2(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof2 = function _typeof3(obj2) { - return typeof obj2; - }; + var _Object$setPrototypeO; + function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { - _typeof2 = function _typeof3(obj2) { - return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }; - } - return _typeof2(obj); - } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + obj[key2] = value; } + return obj; } - var _require = require_errors(); - var _require$codes = _require.codes; - var ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE; - var ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE; - var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; - var AssertionError = require_assertion_error(); - var _require2 = require_util(); - var inspect = _require2.inspect; - var _require$types = require_util().types; - var isPromise = _require$types.isPromise; - var isRegExp = _require$types.isRegExp; - var objectAssign = Object.assign ? Object.assign : require_es6_object_assign().assign; - var objectIs = Object.is ? Object.is : require_object_is(); - var isDeepEqual; - var isDeepStrictEqual; - function lazyLoadComparison() { - var comparison = require_comparisons(); - isDeepEqual = comparison.isDeepEqual; - isDeepStrictEqual = comparison.isDeepStrictEqual; - } - var warned = false; - var assert = module.exports = ok; - var NO_EXCEPTION_SENTINEL = {}; - function innerFail(obj) { - if (obj.message instanceof Error) - throw obj.message; - throw new AssertionError(obj); - } - function fail(actual, expected, message, operator, stackStartFn) { - var argsLen = arguments.length; - var internalMessage; - if (argsLen === 0) { - internalMessage = "Failed"; - } else if (argsLen === 1) { - message = actual; - actual = void 0; - } else { - if (warned === false) { - warned = true; - var warn2 = process.emitWarning ? process.emitWarning : console.warn.bind(console); - warn2("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.", "DeprecationWarning", "DEP0094"); - } - if (argsLen === 2) - operator = "!="; - } - if (message instanceof Error) - throw message; - var errArgs = { - actual, - expected, - operator: operator === void 0 ? "fail" : operator, - stackStartFn: stackStartFn || fail + var finished = require_end_of_stream(); + var kLastResolve = Symbol("lastResolve"); + var kLastReject = Symbol("lastReject"); + var kError = Symbol("error"); + var kEnded = Symbol("ended"); + var kLastPromise = Symbol("lastPromise"); + var kHandlePromise = Symbol("handlePromise"); + var kStream = Symbol("stream"); + function createIterResult(value, done) { + return { + value, + done }; - if (message !== void 0) { - errArgs.message = message; - } - var err = new AssertionError(errArgs); - if (internalMessage) { - err.message = internalMessage; - err.generatedMessage = true; - } - throw err; - } - assert.fail = fail; - assert.AssertionError = AssertionError; - function innerOk(fn, argLen, value, message) { - if (!value) { - var generatedMessage = false; - if (argLen === 0) { - generatedMessage = true; - message = "No value argument passed to `assert.ok()`"; - } else if (message instanceof Error) { - throw message; - } - var err = new AssertionError({ - actual: value, - expected: true, - message, - operator: "==", - stackStartFn: fn - }); - err.generatedMessage = generatedMessage; - throw err; - } } - function ok() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + function readAndResolve(iter) { + var resolve2 = iter[kLastResolve]; + if (resolve2 !== null) { + var data = iter[kStream].read(); + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve2(createIterResult(data, false)); + } } - innerOk.apply(void 0, [ok, args.length].concat(args)); } - assert.ok = ok; - assert.equal = function equal(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (actual != expected) { - innerFail({ - actual, - expected, - message, - operator: "==", - stackStartFn: equal - }); - } - }; - assert.notEqual = function notEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (actual == expected) { - innerFail({ - actual, - expected, - message, - operator: "!=", - stackStartFn: notEqual - }); - } - }; - assert.deepEqual = function deepEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (!isDeepEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "deepEqual", - stackStartFn: deepEqual - }); - } - }; - assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (isDeepEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notDeepEqual", - stackStartFn: notDeepEqual - }); - } - }; - assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (!isDeepStrictEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "deepStrictEqual", - stackStartFn: deepStrictEqual - }); - } - }; - assert.notDeepStrictEqual = notDeepStrictEqual; - function notDeepStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - if (isDeepStrictEqual(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notDeepStrictEqual", - stackStartFn: notDeepStrictEqual - }); - } + function onReadable(iter) { + process.nextTick(readAndResolve, iter); } - assert.strictEqual = function strictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (!objectIs(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "strictEqual", - stackStartFn: strictEqual - }); - } - }; - assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (arguments.length < 2) { - throw new ERR_MISSING_ARGS("actual", "expected"); - } - if (objectIs(actual, expected)) { - innerFail({ - actual, - expected, - message, - operator: "notStrictEqual", - stackStartFn: notStrictEqual - }); - } - }; - var Comparison = function Comparison2(obj, keys, actual) { - var _this = this; - _classCallCheck(this, Comparison2); - keys.forEach(function(key2) { - if (key2 in obj) { - if (actual !== void 0 && typeof actual[key2] === "string" && isRegExp(obj[key2]) && obj[key2].test(actual[key2])) { - _this[key2] = actual[key2]; - } else { - _this[key2] = obj[key2]; + function wrapForNext(lastPromise, iter) { + return function(resolve2, reject) { + lastPromise.then(function() { + if (iter[kEnded]) { + resolve2(createIterResult(void 0, true)); + return; } + iter[kHandlePromise](resolve2, reject); + }, reject); + }; + } + var AsyncIteratorPrototype = Object.getPrototypeOf(function() { + }); + var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); } - }); - }; - function compareExceptionKey(actual, expected, key2, message, keys, fn) { - if (!(key2 in actual) || !isDeepStrictEqual(actual[key2], expected[key2])) { - if (!message) { - var a = new Comparison(actual, keys); - var b = new Comparison(expected, keys, actual); - var err = new AssertionError({ - actual: a, - expected: b, - operator: "deepStrictEqual", - stackStartFn: fn + if (this[kEnded]) { + return Promise.resolve(createIterResult(void 0, true)); + } + if (this[kStream].destroyed) { + return new Promise(function(resolve2, reject) { + process.nextTick(function() { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve2(createIterResult(void 0, true)); + } + }); }); - err.actual = actual; - err.expected = expected; - err.operator = fn.name; - throw err; - } - innerFail({ - actual, - expected, - message, - operator: fn.name, - stackStartFn: fn - }); + } + var lastPromise = this[kLastPromise]; + var promise2; + if (lastPromise) { + promise2 = new Promise(wrapForNext(lastPromise, this)); + } else { + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise2 = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise2; + return promise2; } - } - function expectedException(actual, expected, msg, fn) { - if (typeof expected !== "function") { - if (isRegExp(expected)) - return expected.test(actual); - if (arguments.length === 2) { - throw new ERR_INVALID_ARG_TYPE("expected", ["Function", "RegExp"], expected); - } - if (_typeof2(actual) !== "object" || actual === null) { - var err = new AssertionError({ - actual, - expected, - message: msg, - operator: "deepStrictEqual", - stackStartFn: fn - }); - err.operator = fn.name; - throw err; - } - var keys = Object.keys(expected); - if (expected instanceof Error) { - keys.push("name", "message"); - } else if (keys.length === 0) { - throw new ERR_INVALID_ARG_VALUE("error", expected, "may not be an empty object"); - } - if (isDeepEqual === void 0) - lazyLoadComparison(); - keys.forEach(function(key2) { - if (typeof actual[key2] === "string" && isRegExp(expected[key2]) && expected[key2].test(actual[key2])) { + }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { + return this; + }), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + return new Promise(function(resolve2, reject) { + _this2[kStream].destroy(null, function(err) { + if (err) { + reject(err); return; } - compareExceptionKey(actual, expected, key2, msg, keys, fn); + resolve2(createIterResult(void 0, true)); }); - return true; - } - if (expected.prototype !== void 0 && actual instanceof expected) { - return true; - } - if (Error.isPrototypeOf(expected)) { - return false; - } - return expected.call({}, actual) === true; - } - function getActual(fn) { - if (typeof fn !== "function") { - throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn); - } - try { - fn(); - } catch (e) { - return e; - } - return NO_EXCEPTION_SENTINEL; - } - function checkIsPromise(obj) { - return isPromise(obj) || obj !== null && _typeof2(obj) === "object" && typeof obj.then === "function" && typeof obj.catch === "function"; - } - function waitForActual(promiseFn) { - return Promise.resolve().then(function() { - var resultPromise; - if (typeof promiseFn === "function") { - resultPromise = promiseFn(); - if (!checkIsPromise(resultPromise)) { - throw new ERR_INVALID_RETURN_VALUE("instance of Promise", "promiseFn", resultPromise); - } - } else if (checkIsPromise(promiseFn)) { - resultPromise = promiseFn; - } else { - throw new ERR_INVALID_ARG_TYPE("promiseFn", ["Function", "Promise"], promiseFn); - } - return Promise.resolve().then(function() { - return resultPromise; - }).then(function() { - return NO_EXCEPTION_SENTINEL; - }).catch(function(e) { - return e; - }); - }); - } - function expectsError(stackStartFn, actual, error, message) { - if (typeof error === "string") { - if (arguments.length === 4) { - throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); - } - if (_typeof2(actual) === "object" && actual !== null) { - if (actual.message === error) { - throw new ERR_AMBIGUOUS_ARGUMENT("error/message", 'The error message "'.concat(actual.message, '" is identical to the message.')); - } - } else if (actual === error) { - throw new ERR_AMBIGUOUS_ARGUMENT("error/message", 'The error "'.concat(actual, '" is identical to the message.')); - } - message = error; - error = void 0; - } else if (error != null && _typeof2(error) !== "object" && typeof error !== "function") { - throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error); - } - if (actual === NO_EXCEPTION_SENTINEL) { - var details = ""; - if (error && error.name) { - details += " (".concat(error.name, ")"); - } - details += message ? ": ".concat(message) : "."; - var fnType = stackStartFn.name === "rejects" ? "rejection" : "exception"; - innerFail({ - actual: void 0, - expected: error, - operator: stackStartFn.name, - message: "Missing expected ".concat(fnType).concat(details), - stackStartFn - }); - } - if (error && !expectedException(actual, error, message, stackStartFn)) { - throw actual; - } - } - function expectsNoError(stackStartFn, actual, error, message) { - if (actual === NO_EXCEPTION_SENTINEL) - return; - if (typeof error === "string") { - message = error; - error = void 0; - } - if (!error || expectedException(actual, error)) { - var details = message ? ": ".concat(message) : "."; - var fnType = stackStartFn.name === "doesNotReject" ? "rejection" : "exception"; - innerFail({ - actual, - expected: error, - operator: stackStartFn.name, - message: "Got unwanted ".concat(fnType).concat(details, "\n") + 'Actual message: "'.concat(actual && actual.message, '"'), - stackStartFn - }); - } - throw actual; - } - assert.throws = function throws(promiseFn) { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args)); - }; - assert.rejects = function rejects(promiseFn) { - for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { - args[_key3 - 1] = arguments[_key3]; - } - return waitForActual(promiseFn).then(function(result) { - return expectsError.apply(void 0, [rejects, result].concat(args)); - }); - }; - assert.doesNotThrow = function doesNotThrow(fn) { - for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { - args[_key4 - 1] = arguments[_key4]; - } - expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args)); - }; - assert.doesNotReject = function doesNotReject(fn) { - for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { - args[_key5 - 1] = arguments[_key5]; - } - return waitForActual(fn).then(function(result) { - return expectsNoError.apply(void 0, [doesNotReject, result].concat(args)); }); - }; - assert.ifError = function ifError(err) { - if (err !== null && err !== void 0) { - var message = "ifError got unwanted exception: "; - if (_typeof2(err) === "object" && typeof err.message === "string") { - if (err.message.length === 0 && err.constructor) { - message += err.constructor.name; + }), _Object$setPrototypeO), AsyncIteratorPrototype); + var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve2, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve2(createIterResult(data, false)); } else { - message += err.message; + iterator[kLastResolve] = resolve2; + iterator[kLastReject] = reject; } - } else { - message += inspect(err); - } - var newErr = new AssertionError({ - actual: err, - expected: null, - operator: "ifError", - message, - stackStartFn: ifError - }); - var origStack = err.stack; - if (typeof origStack === "string") { - var tmp2 = origStack.split("\n"); - tmp2.shift(); - var tmp1 = newErr.stack.split("\n"); - for (var i = 0; i < tmp2.length; i++) { - var pos = tmp1.indexOf(tmp2[i]); - if (pos !== -1) { - tmp1 = tmp1.slice(0, pos); - break; - } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function(err) { + if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { + var reject = iterator[kLastReject]; + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); } - newErr.stack = "".concat(tmp1.join("\n"), "\n").concat(tmp2.join("\n")); + iterator[kError] = err; + return; } - throw newErr; - } + var resolve2 = iterator[kLastResolve]; + if (resolve2 !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve2(createIterResult(void 0, true)); + } + iterator[kEnded] = true; + }); + stream.on("readable", onReadable.bind(null, iterator)); + return iterator; }; - function strict() { - for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { - args[_key6] = arguments[_key6]; - } - innerOk.apply(void 0, [strict, args.length].concat(args)); - } - assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual - }); - assert.strict.strict = assert.strict; + module.exports = createReadableStreamAsyncIterator; } }); - // node_modules/browser-process/dist/node_process.js - var require_node_process = __commonJS({ - "node_modules/browser-process/dist/node_process.js"(exports, module) { + // node_modules/readable-stream/lib/internal/streams/from-browser.js + var require_from_browser = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports.__extends || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - function __() { - this.constructor = d; - } - __.prototype = b.prototype; - d.prototype = new __(); + module.exports = function() { + throw new Error("Readable.from is not available in the browser"); }; - var eventemitter = require_node_eventemitter(); - var path = null; - var TTY = function(_super) { - __extends(TTY2, _super); - function TTY2() { - _super.call(this, true, true); - this.isRaw = false; - this.columns = 80; - this.rows = 120; - this.isTTY = true; - } - TTY2.prototype.setReadMode = function(mode) { - if (this.isRaw !== mode) { - this.isRaw = mode; - this.emit("modeChange"); - } - }; - TTY2.prototype.changeColumns = function(columns) { - if (columns !== this.columns) { - this.columns = columns; - this.emit("resize"); - } - }; - TTY2.prototype.changeRows = function(rows) { - if (rows !== this.rows) { - this.rows = rows; - this.emit("resize"); - } - }; - TTY2.isatty = function(fd) { - return fd instanceof TTY2; - }; - return TTY2; - }(eventemitter.AbstractDuplexStream); - exports.TTY = TTY; - var Process = function() { - function Process2() { - this.startTime = Date.now(); - this._cwd = "/"; - this.platform = "browser"; - this.argv = []; - this.stdout = new TTY(); - this.stderr = new TTY(); - this.stdin = new TTY(); - } - Process2.prototype.chdir = function(dir) { - if (path === null) { - path = require_assert(); - } - this._cwd = path.resolve(dir); - }; - Process2.prototype.cwd = function() { - return this._cwd; - }; - Process2.prototype.uptime = function() { - return (Date.now() - this.startTime) / 1e3 | 0; - }; - return Process2; - }(); - exports.Process = Process; - exports.process = new Process(); - module.exports = exports.process; } }); - // node_modules/crc-32/crc32.js - var require_crc32 = __commonJS({ - "node_modules/crc-32/crc32.js"(exports) { + // node_modules/readable-stream/lib/_stream_readable.js + var require_stream_readable = __commonJS({ + "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var CRC32; - (function(factory) { - if (typeof DO_NOT_EXPORT_CRC === "undefined") { - if (typeof exports === "object") { - factory(exports); - } else if (typeof define === "function" && define.amd) { - define(function() { - var module2 = {}; - factory(module2); - return module2; - }); - } else { - factory(CRC32 = {}); - } - } else { - factory(CRC32 = {}); - } - })(function(CRC322) { - CRC322.version = "1.2.0"; - function signed_crc_table() { - var c = 0, table = new Array(256); - for (var n = 0; n != 256; ++n) { - c = n; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1; - table[n] = c; - } - return typeof Int32Array !== "undefined" ? new Int32Array(table) : table; + module.exports = Readable; + var Duplex; + Readable.ReadableState = ReadableState; + var EE = require_events().EventEmitter; + var EElistenerCount = function EElistenerCount2(emitter, type) { + return emitter.listeners(type).length; + }; + var Stream = require_stream_browser(); + var Buffer14 = require_buffer().Buffer; + var OurUint8Array = window.Uint8Array || function() { + }; + function _uint8ArrayToBuffer(chunk) { + return Buffer14.from(chunk); + } + function _isUint8Array(obj) { + return Buffer14.isBuffer(obj) || obj instanceof OurUint8Array; + } + var debugUtil = require_util(); + var debug; + if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog("stream"); + } else { + debug = function debug2() { + }; + } + var BufferList = require_buffer_list(); + var destroyImpl = require_destroy(); + var _require = require_state(); + var getHighWaterMark = _require.getHighWaterMark; + var _require$codes = require_errors_browser().codes; + var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; + var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + var StringDecoder; + var createReadableStreamAsyncIterator; + var from; + require_inherits_browser()(Readable, Stream); + var errorOrDestroy = destroyImpl.errorOrDestroy; + var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; + function prependListener(emitter, event, fn) { + if (typeof emitter.prependListener === "function") + return emitter.prependListener(event, fn); + if (!emitter._events || !emitter._events[event]) + emitter.on(event, fn); + else if (Array.isArray(emitter._events[event])) + emitter._events[event].unshift(fn); + else + emitter._events[event] = [fn, emitter._events[event]]; + } + function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require_stream_duplex(); + options = options || {}; + if (typeof isDuplex !== "boolean") + isDuplex = stream instanceof Duplex; + this.objectMode = !!options.objectMode; + if (isDuplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex); + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + this.sync = true; + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + this.emitClose = options.emitClose !== false; + this.autoDestroy = !!options.autoDestroy; + this.destroyed = false; + this.defaultEncoding = options.defaultEncoding || "utf8"; + this.awaitDrain = 0; + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require_string_decoder().StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; } - var T = signed_crc_table(); - function crc32_bstr(bstr, seed) { - var C = seed ^ -1, L = bstr.length - 1; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255]; - } - if (i === L) - C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255]; - return C ^ -1; + } + function Readable(options) { + Duplex = Duplex || require_stream_duplex(); + if (!(this instanceof Readable)) + return new Readable(options); + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + this.readable = true; + if (options) { + if (typeof options.read === "function") + this._read = options.read; + if (typeof options.destroy === "function") + this._destroy = options.destroy; } - function crc32_buf(buf2, seed) { - if (buf2.length > 1e4) - return crc32_buf_8(buf2, seed); - var C = seed ^ -1, L = buf2.length - 3; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + Stream.call(this); + } + Object.defineProperty(Readable.prototype, "destroyed", { + enumerable: false, + get: function get2() { + if (this._readableState === void 0) { + return false; } - while (i < L + 3) - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - return C ^ -1; + return this._readableState.destroyed; + }, + set: function set(value) { + if (!this._readableState) { + return; + } + this._readableState.destroyed = value; } - function crc32_buf_8(buf2, seed) { - var C = seed ^ -1, L = buf2.length - 7; - for (var i = 0; i < L; ) { - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; + }); + Readable.prototype.destroy = destroyImpl.destroy; + Readable.prototype._undestroy = destroyImpl.undestroy; + Readable.prototype._destroy = function(err, cb) { + cb(err); + }; + Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === "string") { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer14.from(chunk, encoding); + encoding = ""; + } + skipChunkCheck = true; } - while (i < L + 7) - C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255]; - return C ^ -1; + } else { + skipChunkCheck = true; } - function crc32_str(str, seed) { - var C = seed ^ -1; - for (var i = 0, L = str.length, c, d; i < L; ) { - c = str.charCodeAt(i++); - if (c < 128) { - C = C >>> 8 ^ T[(C ^ c) & 255]; - } else if (c < 2048) { - C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; - } else if (c >= 55296 && c < 57344) { - c = (c & 1023) + 64; - d = str.charCodeAt(i++) & 1023; - C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255]; + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); + }; + Readable.prototype.unshift = function(chunk) { + return readableAddChunk(this, chunk, null, true, false); + }; + function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug("readableAddChunk", chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) + er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer14.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) + errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); + else + addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; } else { - C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255]; - C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255]; + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) + addChunk(stream, state, chunk, false); + else + maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); } - return C ^ -1; } - CRC322.table = T; - CRC322.bstr = crc32_bstr; - CRC322.buf = crc32_buf; - CRC322.str = crc32_str; - }); - } - }); - - // node_modules/readable-stream/lib/internal/streams/stream-browser.js - var require_stream_browser = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = require_events().EventEmitter; - } - }); - - // (disabled):node_modules/util/util.js - var require_util2 = __commonJS({ - "(disabled):node_modules/util/util.js"() { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - } - }); - - // node_modules/readable-stream/lib/internal/streams/buffer_list.js - var require_buffer_list = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) - symbols = symbols.filter(function(sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); + return !state.ended && (state.length < state.highWaterMark || state.length === 0); + } + function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit("data", chunk); + } else { + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + if (state.needReadable) + emitReadable(stream); } - return keys; + maybeReadMore(stream, state); } - function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - if (i % 2) { - ownKeys(Object(source), true).forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function(key2) { - Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); - }); - } + function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); } - return target; + return er; } - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); + Readable.prototype.isPaused = function() { + return this._readableState.flowing === false; + }; + Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require_string_decoder().StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + this._readableState.encoding = this._readableState.decoder.encoding; + var p = this._readableState.buffer.head; + var content = ""; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== "") + this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; + }; + var MAX_HWM = 1073741824; + function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; } else { - obj[key2] = value; + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; } - return obj; + return n; } - function _classCallCheck(instance18, Constructor) { - if (!(instance18 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) + return 0; + if (state.objectMode) + return 1; + if (n !== n) { + if (state.flowing && state.length) + return state.buffer.head.data.length; + else + return state.length; + } + if (n > state.highWaterMark) + state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) + return n; + if (!state.ended) { + state.needReadable = true; + return 0; } + return state.length; } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - return Constructor; - } - var _require = require_buffer(); - var Buffer18 = _require.Buffer; - var _require2 = require_util2(); - var inspect = _require2.inspect; - var custom = inspect && inspect.custom || "inspect"; - function copyBuffer(src, target, offset) { - Buffer18.prototype.copy.call(src, target, offset); - } - module.exports = /* @__PURE__ */ function() { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; - } - _createClass(BufferList, [{ - key: "push", - value: function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) - this.tail.next = entry; - else - this.head = entry; - this.tail = entry; - ++this.length; - } - }, { - key: "unshift", - value: function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) - this.tail = entry; - this.head = entry; - ++this.length; - } - }, { - key: "shift", - value: function shift() { - if (this.length === 0) - return; - var ret = this.head.data; - if (this.length === 1) - this.head = this.tail = null; - else - this.head = this.head.next; - --this.length; - return ret; - } - }, { - key: "clear", - value: function clear() { - this.head = this.tail = null; - this.length = 0; - } - }, { - key: "join", - value: function join(s) { - if (this.length === 0) - return ""; - var p = this.head; - var ret = "" + p.data; - while (p = p.next) { - ret += s + p.data; - } - return ret; - } - }, { - key: "concat", - value: function concat(n) { - if (this.length === 0) - return Buffer18.alloc(0); - var ret = Buffer18.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - } - }, { - key: "consume", - value: function consume(n, hasStrings) { - var ret; - if (n < this.head.data.length) { - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - ret = this.shift(); - } else { - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - return ret; - } - }, { - key: "first", - value: function first() { - return this.head.data; - } - }, { - key: "_getString", - value: function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) - ret += str; - else - ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) - this.head = p.next; - else - this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - }, { - key: "_getBuffer", - value: function _getBuffer(n) { - var ret = Buffer18.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf2 = p.data; - var nb = n > buf2.length ? buf2.length : n; - buf2.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf2.length) { - ++c; - if (p.next) - this.head = p.next; - else - this.head = this.tail = null; - } else { - this.head = p; - p.data = buf2.slice(nb); - } - break; - } - ++c; - } - this.length -= c; - return ret; - } - }, { - key: custom, - value: function value(_, options) { - return inspect(this, _objectSpread({}, options, { - depth: 0, - customInspect: false - })); - } - }]); - return BufferList; - }(); - } - }); - - // node_modules/readable-stream/lib/internal/streams/destroy.js - var require_destroy = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function destroy(err, cb) { - var _this = this; - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } - return this; - } - if (this._readableState) { - this._readableState.destroyed = true; - } - if (this._writableState) { - this._writableState.destroyed = true; - } - this._destroy(err || null, function(err2) { - if (!cb && err2) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err2); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err2); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err2); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - return this; - } - function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); - } - function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) - return; - if (self._readableState && !self._readableState.emitClose) - return; - self.emit("close"); - } - function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } - } - function emitErrorNT(self, err) { - self.emit("error", err); - } - function errorOrDestroy(stream, err) { - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) - stream.destroy(err); - else - stream.emit("error", err); - } - module.exports = { - destroy, - undestroy, - errorOrDestroy - }; - } - }); - - // node_modules/readable-stream/errors-browser.js - var require_errors_browser = __commonJS({ - "node_modules/readable-stream/errors-browser.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; - } - var codes = {}; - function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - function getMessage(arg1, arg2, arg3) { - if (typeof message === "string") { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - var NodeError = /* @__PURE__ */ function(_Base) { - _inheritsLoose(NodeError2, _Base); - function NodeError2(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; - } - return NodeError2; - }(Base); - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; - } - function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function(i) { - return String(i); - }); - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } - } - function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; - } - function endsWith(str, search, this_len) { - if (this_len === void 0 || this_len > str.length) { - this_len = str.length; - } - return str.substring(this_len - search.length, this_len) === search; - } - function includes(str, search, start) { - if (typeof start !== "number") { - start = 0; - } - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } - } - createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; - }, TypeError); - createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) { - var determiner; - if (typeof expected === "string" && startsWith(expected, "not ")) { - determiner = "must not be"; - expected = expected.replace(/^not /, ""); - } else { - determiner = "must be"; - } - var msg; - if (endsWith(name, " argument")) { - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } else { - var type = includes(name, ".") ? "property" : "argument"; - msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type")); - } - msg += ". Received type ".concat(typeof actual); - return msg; - }, TypeError); - createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"); - createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) { - return "The " + name + " method is not implemented"; - }); - createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close"); - createErrorType("ERR_STREAM_DESTROYED", function(name) { - return "Cannot call " + name + " after a stream was destroyed"; - }); - createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); - createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"); - createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end"); - createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError); - createErrorType("ERR_UNKNOWN_ENCODING", function(arg) { - return "Unknown encoding: " + arg; - }, TypeError); - createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"); - module.exports.codes = codes; - } - }); - - // node_modules/readable-stream/lib/internal/streams/state.js - var require_state = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE; - function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; - } - function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : "highWaterMark"; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - return Math.floor(hwm); - } - return state.objectMode ? 16 : 16 * 1024; - } - module.exports = { - getHighWaterMark - }; - } - }); - - // node_modules/util-deprecate/browser.js - var require_browser = __commonJS({ - "node_modules/util-deprecate/browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = deprecate; - function deprecate(fn, msg) { - if (config("noDeprecation")) { - return fn; - } - var warned = false; - function deprecated() { - if (!warned) { - if (config("throwDeprecation")) { - throw new Error(msg); - } else if (config("traceDeprecation")) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - return deprecated; - } - function config(name) { - try { - if (!window.localStorage) - return false; - } catch (_) { - return false; - } - var val = window.localStorage[name]; - if (val == null) - return false; - return String(val).toLowerCase() === "true"; - } - } - }); - - // node_modules/readable-stream/lib/_stream_writable.js - var require_stream_writable = __commonJS({ - "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Writable; - function CorkedRequest(state) { - var _this = this; - this.next = null; - this.entry = null; - this.finish = function() { - onCorkedFinish(_this, state); - }; - } - var Duplex; - Writable.WritableState = WritableState; - var internalUtil = { - deprecate: require_browser() - }; - var Stream = require_stream_browser(); - var Buffer18 = require_buffer().Buffer; - var OurUint8Array = window.Uint8Array || function() { - }; - function _uint8ArrayToBuffer(chunk) { - return Buffer18.from(chunk); - } - function _isUint8Array(obj) { - return Buffer18.isBuffer(obj) || obj instanceof OurUint8Array; - } - var destroyImpl = require_destroy(); - var _require = require_state(); - var getHighWaterMark = _require.getHighWaterMark; - var _require$codes = require_errors_browser().codes; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; - var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE; - var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES; - var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END; - var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - var errorOrDestroy = destroyImpl.errorOrDestroy; - require_inherits_browser()(Writable, Stream); - function nop() { - } - function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require_stream_duplex(); - options = options || {}; - if (typeof isDuplex !== "boolean") - isDuplex = stream instanceof Duplex; - this.objectMode = !!options.objectMode; - if (isDuplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; - this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex); - this.finalCalled = false; - this.needDrain = false; - this.ending = false; - this.ended = false; - this.finished = false; - this.destroyed = false; - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - this.defaultEncoding = options.defaultEncoding || "utf8"; - this.length = 0; - this.writing = false; - this.corked = 0; - this.sync = true; - this.bufferProcessing = false; - this.onwrite = function(er) { - onwrite(stream, er); - }; - this.writecb = null; - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; - this.pendingcb = 0; - this.prefinished = false; - this.errorEmitted = false; - this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; - this.bufferedRequestCount = 0; - this.corkedRequestsFree = new CorkedRequest(this); - } - WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; - }; - (function() { - try { - Object.defineProperty(WritableState.prototype, "buffer", { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") - }); - } catch (_) { - } - })(); - var realHasInstance; - if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) - return true; - if (this !== Writable) - return false; - return object && object._writableState instanceof WritableState; - } - }); - } else { - realHasInstance = function realHasInstance2(object) { - return object instanceof this; - }; - } - function Writable(options) { - Duplex = Duplex || require_stream_duplex(); - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) - return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); - this.writable = true; - if (options) { - if (typeof options.write === "function") - this._write = options.write; - if (typeof options.writev === "function") - this._writev = options.writev; - if (typeof options.destroy === "function") - this._destroy = options.destroy; - if (typeof options.final === "function") - this._final = options.final; - } - Stream.call(this); - } - Writable.prototype.pipe = function() { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); - }; - function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); - errorOrDestroy(stream, er); - process.nextTick(cb, er); - } - function validChunk(stream, state, chunk, cb) { - var er; - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== "string" && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk); - } - if (er) { - errorOrDestroy(stream, er); - process.nextTick(cb, er); - return false; - } - return true; - } - Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer18.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (typeof encoding === "function") { - cb = encoding; - encoding = null; - } - if (isBuf) - encoding = "buffer"; - else if (!encoding) - encoding = state.defaultEncoding; - if (typeof cb !== "function") - cb = nop; - if (state.ending) - writeAfterEnd(this, cb); - else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; - }; - Writable.prototype.cork = function() { - this._writableState.corked++; - }; - Writable.prototype.uncork = function() { - var state = this._writableState; - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) - clearBuffer(this, state); - } - }; - Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - if (typeof encoding === "string") - encoding = encoding.toLowerCase(); - if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) - throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; - }; - Object.defineProperty(Writable.prototype, "writableBuffer", { - enumerable: false, - get: function get2() { - return this._writableState && this._writableState.getBuffer(); - } - }); - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { - chunk = Buffer18.from(chunk, encoding); - } - return chunk; - } - Object.defineProperty(Writable.prototype, "writableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._writableState.highWaterMark; - } - }); - function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = "buffer"; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; - if (!ret) - state.needDrain = true; - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk, - encoding, - isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - return ret; - } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) - state.onwrite(new ERR_STREAM_DESTROYED("write")); - else if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; - } - function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) { - process.nextTick(cb, er); - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - } else { - cb(er); - stream._writableState.errorEmitted = true; - errorOrDestroy(stream, er); - finishMaybe(stream, state); - } - } - function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; - } - function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== "function") - throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) - onwriteError(stream, state, sync, er, cb); - else { - var finished = needFinish(state) || stream.destroyed; - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); - } - } - } - function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); - } - function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit("drain"); - } - } - function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - if (stream._writev && entry && entry.next) { - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) - allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, "", holder.finish); - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - if (state.writing) { - break; - } - } - if (entry === null) - state.lastBufferedRequest = null; - } - state.bufferedRequest = entry; - state.bufferProcessing = false; - } - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()")); - }; - Writable.prototype._writev = null; - Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - if (typeof chunk === "function") { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === "function") { - cb = encoding; - encoding = null; - } - if (chunk !== null && chunk !== void 0) - this.write(chunk, encoding); - if (state.corked) { - state.corked = 1; - this.uncork(); - } - if (!state.ending) - endWritable(this, state, cb); - return this; - }; - Object.defineProperty(Writable.prototype, "writableLength", { - enumerable: false, - get: function get2() { - return this._writableState.length; - } - }); - function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; - } - function callFinal(stream, state) { - stream._final(function(err) { - state.pendingcb--; - if (err) { - errorOrDestroy(stream, err); - } - state.prefinished = true; - stream.emit("prefinish"); - finishMaybe(stream, state); - }); - } - function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === "function" && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit("prefinish"); - } - } - } - function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit("finish"); - if (state.autoDestroy) { - var rState = stream._readableState; - if (!rState || rState.autoDestroy && rState.endEmitted) { - stream.destroy(); - } - } - } - } - return need; - } - function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once("finish", cb); - } - state.ended = true; - stream.writable = false; - } - function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - state.corkedRequestsFree.next = corkReq; - } - Object.defineProperty(Writable.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._writableState === void 0) { - return false; - } - return this._writableState.destroyed; - }, - set: function set(value) { - if (!this._writableState) { - return; - } - this._writableState.destroyed = value; - } - }); - Writable.prototype.destroy = destroyImpl.destroy; - Writable.prototype._undestroy = destroyImpl.undestroy; - Writable.prototype._destroy = function(err, cb) { - cb(err); - }; - } - }); - - // node_modules/readable-stream/lib/_stream_duplex.js - var require_stream_duplex = __commonJS({ - "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var objectKeys = Object.keys || function(obj) { - var keys2 = []; - for (var key2 in obj) { - keys2.push(key2); - } - return keys2; - }; - module.exports = Duplex; - var Readable = require_stream_readable(); - var Writable = require_stream_writable(); - require_inherits_browser()(Duplex, Readable); - { - keys = objectKeys(Writable.prototype); - for (v = 0; v < keys.length; v++) { - method = keys[v]; - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; - } - } - var keys; - var method; - var v; - function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - if (options) { - if (options.readable === false) - this.readable = false; - if (options.writable === false) - this.writable = false; - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once("end", onend); - } - } - } - Object.defineProperty(Duplex.prototype, "writableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._writableState.highWaterMark; - } - }); - Object.defineProperty(Duplex.prototype, "writableBuffer", { - enumerable: false, - get: function get2() { - return this._writableState && this._writableState.getBuffer(); - } - }); - Object.defineProperty(Duplex.prototype, "writableLength", { - enumerable: false, - get: function get2() { - return this._writableState.length; - } - }); - function onend() { - if (this._writableState.ended) - return; - process.nextTick(onEndNT, this); - } - function onEndNT(self) { - self.end(); - } - Object.defineProperty(Duplex.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._readableState === void 0 || this._writableState === void 0) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - if (this._readableState === void 0 || this._writableState === void 0) { - return; - } - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } - }); - } - }); - - // node_modules/safe-buffer/index.js - var require_safe_buffer = __commonJS({ - "node_modules/safe-buffer/index.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var buffer = require_buffer(); - var Buffer18 = buffer.Buffer; - function copyProps(src, dst) { - for (var key2 in src) { - dst[key2] = src[key2]; - } - } - if (Buffer18.from && Buffer18.alloc && Buffer18.allocUnsafe && Buffer18.allocUnsafeSlow) { - module.exports = buffer; - } else { - copyProps(buffer, exports); - exports.Buffer = SafeBuffer; - } - function SafeBuffer(arg, encodingOrOffset, length) { - return Buffer18(arg, encodingOrOffset, length); - } - SafeBuffer.prototype = Object.create(Buffer18.prototype); - copyProps(Buffer18, SafeBuffer); - SafeBuffer.from = function(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - throw new TypeError("Argument must not be a number"); - } - return Buffer18(arg, encodingOrOffset, length); - }; - SafeBuffer.alloc = function(size, fill, encoding) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - var buf2 = Buffer18(size); - if (fill !== void 0) { - if (typeof encoding === "string") { - buf2.fill(fill, encoding); - } else { - buf2.fill(fill); - } - } else { - buf2.fill(0); - } - return buf2; - }; - SafeBuffer.allocUnsafe = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return Buffer18(size); - }; - SafeBuffer.allocUnsafeSlow = function(size) { - if (typeof size !== "number") { - throw new TypeError("Argument must be a number"); - } - return buffer.SlowBuffer(size); - }; - } - }); - - // node_modules/string_decoder/lib/string_decoder.js - var require_string_decoder = __commonJS({ - "node_modules/string_decoder/lib/string_decoder.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var Buffer18 = require_safe_buffer().Buffer; - var isEncoding = Buffer18.isEncoding || function(encoding) { - encoding = "" + encoding; - switch (encoding && encoding.toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - case "raw": - return true; - default: - return false; - } - }; - function _normalizeEncoding(enc) { - if (!enc) - return "utf8"; - var retried; - while (true) { - switch (enc) { - case "utf8": - case "utf-8": - return "utf8"; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return "utf16le"; - case "latin1": - case "binary": - return "latin1"; - case "base64": - case "ascii": - case "hex": - return enc; - default: - if (retried) - return; - enc = ("" + enc).toLowerCase(); - retried = true; - } - } - } - function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== "string" && (Buffer18.isEncoding === isEncoding || !isEncoding(enc))) - throw new Error("Unknown encoding: " + enc); - return nenc || enc; - } - exports.StringDecoder = StringDecoder; - function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case "utf16le": - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case "utf8": - this.fillLast = utf8FillLast; - nb = 4; - break; - case "base64": - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer18.allocUnsafe(nb); - } - StringDecoder.prototype.write = function(buf2) { - if (buf2.length === 0) - return ""; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf2); - if (r === void 0) - return ""; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf2.length) - return r ? r + this.text(buf2, i) : this.text(buf2, i); - return r || ""; - }; - StringDecoder.prototype.end = utf8End; - StringDecoder.prototype.text = utf8Text; - StringDecoder.prototype.fillLast = function(buf2) { - if (this.lastNeed <= buf2.length) { - buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length); - this.lastNeed -= buf2.length; - }; - function utf8CheckByte(byte) { - if (byte <= 127) - return 0; - else if (byte >> 5 === 6) - return 2; - else if (byte >> 4 === 14) - return 3; - else if (byte >> 3 === 30) - return 4; - return byte >> 6 === 2 ? -1 : -2; - } - function utf8CheckIncomplete(self, buf2, i) { - var j = buf2.length - 1; - if (j < i) - return 0; - var nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) - self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) - return 0; - nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) - self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) - return 0; - nb = utf8CheckByte(buf2[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) - nb = 0; - else - self.lastNeed = nb - 3; - } - return nb; - } - return 0; - } - function utf8CheckExtraBytes(self, buf2, p) { - if ((buf2[0] & 192) !== 128) { - self.lastNeed = 0; - return "\uFFFD"; - } - if (self.lastNeed > 1 && buf2.length > 1) { - if ((buf2[1] & 192) !== 128) { - self.lastNeed = 1; - return "\uFFFD"; - } - if (self.lastNeed > 2 && buf2.length > 2) { - if ((buf2[2] & 192) !== 128) { - self.lastNeed = 2; - return "\uFFFD"; - } - } - } - } - function utf8FillLast(buf2) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf2, p); - if (r !== void 0) - return r; - if (this.lastNeed <= buf2.length) { - buf2.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf2.copy(this.lastChar, p, 0, buf2.length); - this.lastNeed -= buf2.length; - } - function utf8Text(buf2, i) { - var total = utf8CheckIncomplete(this, buf2, i); - if (!this.lastNeed) - return buf2.toString("utf8", i); - this.lastTotal = total; - var end = buf2.length - (total - this.lastNeed); - buf2.copy(this.lastChar, 0, end); - return buf2.toString("utf8", i, end); - } - function utf8End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) - return r + "\uFFFD"; - return r; - } - function utf16Text(buf2, i) { - if ((buf2.length - i) % 2 === 0) { - var r = buf2.toString("utf16le", i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 55296 && c <= 56319) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf2[buf2.length - 2]; - this.lastChar[1] = buf2[buf2.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf2[buf2.length - 1]; - return buf2.toString("utf16le", i, buf2.length - 1); - } - function utf16End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString("utf16le", 0, end); - } - return r; - } - function base64Text(buf2, i) { - var n = (buf2.length - i) % 3; - if (n === 0) - return buf2.toString("base64", i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf2[buf2.length - 1]; - } else { - this.lastChar[0] = buf2[buf2.length - 2]; - this.lastChar[1] = buf2[buf2.length - 1]; - } - return buf2.toString("base64", i, buf2.length - n); - } - function base64End(buf2) { - var r = buf2 && buf2.length ? this.write(buf2) : ""; - if (this.lastNeed) - return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed); - return r; - } - function simpleWrite(buf2) { - return buf2.toString(this.encoding); - } - function simpleEnd(buf2) { - return buf2 && buf2.length ? this.write(buf2) : ""; - } - } - }); - - // node_modules/readable-stream/lib/internal/streams/end-of-stream.js - var require_end_of_stream = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE; - function once(callback) { - var called = false; - return function() { - if (called) - return; - called = true; - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - callback.apply(this, args); - }; - } - function noop3() { - } - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === "function"; - } - function eos(stream, opts, callback) { - if (typeof opts === "function") - return eos(stream, null, opts); - if (!opts) - opts = {}; - callback = once(callback || noop3); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable2 = opts.writable || opts.writable !== false && stream.writable; - var onlegacyfinish = function onlegacyfinish2() { - if (!stream.writable) - onfinish(); - }; - var writableEnded = stream._writableState && stream._writableState.finished; - var onfinish = function onfinish2() { - writable2 = false; - writableEnded = true; - if (!readable) - callback.call(stream); - }; - var readableEnded = stream._readableState && stream._readableState.endEmitted; - var onend = function onend2() { - readable = false; - readableEnded = true; - if (!writable2) - callback.call(stream); - }; - var onerror = function onerror2(err) { - callback.call(stream, err); - }; - var onclose = function onclose2() { - var err; - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) - err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - if (writable2 && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) - err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - }; - var onrequest = function onrequest2() { - stream.req.on("finish", onfinish); - }; - if (isRequest(stream)) { - stream.on("complete", onfinish); - stream.on("abort", onclose); - if (stream.req) - onrequest(); - else - stream.on("request", onrequest); - } else if (writable2 && !stream._writableState) { - stream.on("end", onlegacyfinish); - stream.on("close", onlegacyfinish); - } - stream.on("end", onend); - stream.on("finish", onfinish); - if (opts.error !== false) - stream.on("error", onerror); - stream.on("close", onclose); - return function() { - stream.removeListener("complete", onfinish); - stream.removeListener("abort", onclose); - stream.removeListener("request", onrequest); - if (stream.req) - stream.req.removeListener("finish", onfinish); - stream.removeListener("end", onlegacyfinish); - stream.removeListener("close", onlegacyfinish); - stream.removeListener("finish", onfinish); - stream.removeListener("end", onend); - stream.removeListener("error", onerror); - stream.removeListener("close", onclose); - }; - } - module.exports = eos; - } - }); - - // node_modules/readable-stream/lib/internal/streams/async_iterator.js - var require_async_iterator = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var _Object$setPrototypeO; - function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; - } - var finished = require_end_of_stream(); - var kLastResolve = Symbol("lastResolve"); - var kLastReject = Symbol("lastReject"); - var kError = Symbol("error"); - var kEnded = Symbol("ended"); - var kLastPromise = Symbol("lastPromise"); - var kHandlePromise = Symbol("handlePromise"); - var kStream = Symbol("stream"); - function createIterResult(value, done) { - return { - value, - done - }; - } - function readAndResolve(iter) { - var resolve2 = iter[kLastResolve]; - if (resolve2 !== null) { - var data = iter[kStream].read(); - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve2(createIterResult(data, false)); - } - } - } - function onReadable(iter) { - process.nextTick(readAndResolve, iter); - } - function wrapForNext(lastPromise, iter) { - return function(resolve2, reject) { - lastPromise.then(function() { - if (iter[kEnded]) { - resolve2(createIterResult(void 0, true)); - return; - } - iter[kHandlePromise](resolve2, reject); - }, reject); - }; - } - var AsyncIteratorPrototype = Object.getPrototypeOf(function() { - }); - var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - next: function next() { - var _this = this; - var error = this[kError]; - if (error !== null) { - return Promise.reject(error); - } - if (this[kEnded]) { - return Promise.resolve(createIterResult(void 0, true)); - } - if (this[kStream].destroyed) { - return new Promise(function(resolve2, reject) { - process.nextTick(function() { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve2(createIterResult(void 0, true)); - } - }); - }); - } - var lastPromise = this[kLastPromise]; - var promise2; - if (lastPromise) { - promise2 = new Promise(wrapForNext(lastPromise, this)); - } else { - var data = this[kStream].read(); - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - promise2 = new Promise(this[kHandlePromise]); - } - this[kLastPromise] = promise2; - return promise2; - } - }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() { - return this; - }), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - return new Promise(function(resolve2, reject) { - _this2[kStream].destroy(null, function(err) { - if (err) { - reject(err); - return; - } - resolve2(createIterResult(void 0, true)); - }); - }); - }), _Object$setPrototypeO), AsyncIteratorPrototype); - var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) { - var _Object$create; - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve2, reject) { - var data = iterator[kStream].read(); - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve2(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve2; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function(err) { - if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { - var reject = iterator[kLastReject]; - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - iterator[kError] = err; - return; - } - var resolve2 = iterator[kLastResolve]; - if (resolve2 !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve2(createIterResult(void 0, true)); - } - iterator[kEnded] = true; - }); - stream.on("readable", onReadable.bind(null, iterator)); - return iterator; - }; - module.exports = createReadableStreamAsyncIterator; - } - }); - - // node_modules/readable-stream/lib/internal/streams/from-browser.js - var require_from_browser = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = function() { - throw new Error("Readable.from is not available in the browser"); - }; - } - }); - - // node_modules/readable-stream/lib/_stream_readable.js - var require_stream_readable = __commonJS({ - "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Readable; - var Duplex; - Readable.ReadableState = ReadableState; - var EE = require_events().EventEmitter; - var EElistenerCount = function EElistenerCount2(emitter, type) { - return emitter.listeners(type).length; - }; - var Stream = require_stream_browser(); - var Buffer18 = require_buffer().Buffer; - var OurUint8Array = window.Uint8Array || function() { - }; - function _uint8ArrayToBuffer(chunk) { - return Buffer18.from(chunk); - } - function _isUint8Array(obj) { - return Buffer18.isBuffer(obj) || obj instanceof OurUint8Array; - } - var debugUtil = require_util2(); - var debug; - if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog("stream"); - } else { - debug = function debug2() { - }; - } - var BufferList = require_buffer_list(); - var destroyImpl = require_destroy(); - var _require = require_state(); - var getHighWaterMark = _require.getHighWaterMark; - var _require$codes = require_errors_browser().codes; - var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE; - var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; - var StringDecoder; - var createReadableStreamAsyncIterator; - var from; - require_inherits_browser()(Readable, Stream); - var errorOrDestroy = destroyImpl.errorOrDestroy; - var kProxyEvents = ["error", "close", "destroy", "pause", "resume"]; - function prependListener(emitter, event, fn) { - if (typeof emitter.prependListener === "function") - return emitter.prependListener(event, fn); - if (!emitter._events || !emitter._events[event]) - emitter.on(event, fn); - else if (Array.isArray(emitter._events[event])) - emitter._events[event].unshift(fn); - else - emitter._events[event] = [fn, emitter._events[event]]; - } - function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require_stream_duplex(); - options = options || {}; - if (typeof isDuplex !== "boolean") - isDuplex = stream instanceof Duplex; - this.objectMode = !!options.objectMode; - if (isDuplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex); - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - this.sync = true; - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; - this.emitClose = options.emitClose !== false; - this.autoDestroy = !!options.autoDestroy; - this.destroyed = false; - this.defaultEncoding = options.defaultEncoding || "utf8"; - this.awaitDrain = 0; - this.readingMore = false; - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require_string_decoder().StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } - } - function Readable(options) { - Duplex = Duplex || require_stream_duplex(); - if (!(this instanceof Readable)) - return new Readable(options); - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); - this.readable = true; - if (options) { - if (typeof options.read === "function") - this._read = options.read; - if (typeof options.destroy === "function") - this._destroy = options.destroy; - } - Stream.call(this); - } - Object.defineProperty(Readable.prototype, "destroyed", { - enumerable: false, - get: function get2() { - if (this._readableState === void 0) { - return false; - } - return this._readableState.destroyed; - }, - set: function set(value) { - if (!this._readableState) { - return; - } - this._readableState.destroyed = value; - } - }); - Readable.prototype.destroy = destroyImpl.destroy; - Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function(err, cb) { - cb(err); - }; - Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - if (!state.objectMode) { - if (typeof chunk === "string") { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer18.from(chunk, encoding); - encoding = ""; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); - }; - Readable.prototype.unshift = function(chunk) { - return readableAddChunk(this, chunk, null, true, false); - }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug("readableAddChunk", chunk); - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) - er = chunkInvalid(state, chunk); - if (er) { - errorOrDestroy(stream, er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer18.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - if (addToFront) { - if (state.endEmitted) - errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()); - else - addChunk(stream, state, chunk, true); - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) - addChunk(stream, state, chunk, false); - else - maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } - return !state.ended && (state.length < state.highWaterMark || state.length === 0); - } - function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit("data", chunk); - } else { - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - if (state.needReadable) - emitReadable(stream); - } - maybeReadMore(stream, state); - } - function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk); - } - return er; - } - Readable.prototype.isPaused = function() { - return this._readableState.flowing === false; - }; - Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require_string_decoder().StringDecoder; - var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; - this._readableState.encoding = this._readableState.decoder.encoding; - var p = this._readableState.buffer.head; - var content = ""; - while (p !== null) { - content += decoder.write(p.data); - p = p.next; - } - this._readableState.buffer.clear(); - if (content !== "") - this._readableState.buffer.push(content); - this._readableState.length = content.length; - return this; - }; - var MAX_HWM = 1073741824; - function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; - } - function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) - return 0; - if (state.objectMode) - return 1; - if (n !== n) { - if (state.flowing && state.length) - return state.buffer.head.data.length; - else - return state.length; - } - if (n > state.highWaterMark) - state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) - return n; - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; - } - Readable.prototype.read = function(n) { - debug("read", n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) - state.emittedReadable = false; - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug("read: emitReadable", state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - n = howMuchToRead(n, state); - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - var doRead = state.needReadable; - debug("need readable", doRead); - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug("length less than watermark", doRead); - } - if (state.ended || state.reading) { - doRead = false; - debug("reading or ended", doRead); - } else if (doRead) { - debug("do read"); - state.reading = true; - state.sync = true; - if (state.length === 0) - state.needReadable = true; - this._read(state.highWaterMark); - state.sync = false; - if (!state.reading) - n = howMuchToRead(nOrig, state); - } - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - if (state.length === 0) { - if (!state.ended) - state.needReadable = true; - if (nOrig !== n && state.ended) - endReadable(this); - } - if (ret !== null) - this.emit("data", ret); - return ret; - }; - function onEofChunk(stream, state) { - debug("onEofChunk"); - if (state.ended) - return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - if (state.sync) { - emitReadable(stream); - } else { - state.needReadable = false; - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } - } - function emitReadable(stream) { - var state = stream._readableState; - debug("emitReadable", state.needReadable, state.emittedReadable); - state.needReadable = false; - if (!state.emittedReadable) { - debug("emitReadable", state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } - } - function emitReadable_(stream) { - var state = stream._readableState; - debug("emitReadable_", state.destroyed, state.length, state.ended); - if (!state.destroyed && (state.length || state.ended)) { - stream.emit("readable"); - state.emittedReadable = false; - } - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); - } - function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } - } - function maybeReadMore_(stream, state) { - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug("maybeReadMore read 0"); - stream.read(0); - if (len === state.length) - break; - } - state.readingMore = false; - } - Readable.prototype._read = function(n) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); - }; - Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once("end", endFn); - dest.on("unpipe", onunpipe); - function onunpipe(readable, unpipeInfo) { - debug("onunpipe"); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - function onend() { - debug("onend"); - dest.end(); - } - var ondrain = pipeOnDrain(src); - dest.on("drain", ondrain); - var cleanedUp = false; - function cleanup() { - debug("cleanup"); - dest.removeListener("close", onclose); - dest.removeListener("finish", onfinish); - dest.removeListener("drain", ondrain); - dest.removeListener("error", onerror); - dest.removeListener("unpipe", onunpipe); - src.removeListener("end", onend); - src.removeListener("end", unpipe); - src.removeListener("data", ondata); - cleanedUp = true; - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - src.on("data", ondata); - function ondata(chunk) { - debug("ondata"); - var ret = dest.write(chunk); - debug("dest.write", ret); - if (ret === false) { - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug("false write response, pause", state.awaitDrain); - state.awaitDrain++; - } - src.pause(); - } - } - function onerror(er) { - debug("onerror", er); - unpipe(); - dest.removeListener("error", onerror); - if (EElistenerCount(dest, "error") === 0) - errorOrDestroy(dest, er); - } - prependListener(dest, "error", onerror); - function onclose() { - dest.removeListener("finish", onfinish); - unpipe(); - } - dest.once("close", onclose); - function onfinish() { - debug("onfinish"); - dest.removeListener("close", onclose); - unpipe(); - } - dest.once("finish", onfinish); - function unpipe() { - debug("unpipe"); - src.unpipe(dest); - } - dest.emit("pipe", src); - if (!state.flowing) { - debug("pipe resume"); - src.resume(); - } - return dest; - }; - function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug("pipeOnDrain", state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { - state.flowing = true; - flow(src); - } - }; - } - Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; - if (state.pipesCount === 0) - return this; - if (state.pipesCount === 1) { - if (dest && dest !== state.pipes) - return this; - if (!dest) - dest = state.pipes; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit("unpipe", this, unpipeInfo); - return this; - } - if (!dest) { - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - for (var i = 0; i < len; i++) { - dests[i].emit("unpipe", this, { - hasUnpiped: false - }); - } - return this; - } - var index = indexOf(state.pipes, dest); - if (index === -1) - return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - dest.emit("unpipe", this, unpipeInfo); - return this; - }; - Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; - if (ev === "data") { - state.readableListening = this.listenerCount("readable") > 0; - if (state.flowing !== false) - this.resume(); - } else if (ev === "readable") { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug("on readable", state.length, state.reading); - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } - return res; - }; - Readable.prototype.addListener = Readable.prototype.on; - Readable.prototype.removeListener = function(ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - if (ev === "readable") { - process.nextTick(updateReadableListening, this); - } - return res; - }; - Readable.prototype.removeAllListeners = function(ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - if (ev === "readable" || ev === void 0) { - process.nextTick(updateReadableListening, this); - } - return res; - }; - function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount("readable") > 0; - if (state.resumeScheduled && !state.paused) { - state.flowing = true; - } else if (self.listenerCount("data") > 0) { - self.resume(); - } - } - function nReadingNextTick(self) { - debug("readable nexttick read 0"); - self.read(0); - } - Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug("resume"); - state.flowing = !state.readableListening; - resume(this, state); - } - state.paused = false; - return this; - }; - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } - } - function resume_(stream, state) { - debug("resume", state.reading); - if (!state.reading) { - stream.read(0); - } - state.resumeScheduled = false; - stream.emit("resume"); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); - } - Readable.prototype.pause = function() { - debug("call pause flowing=%j", this._readableState.flowing); - if (this._readableState.flowing !== false) { - debug("pause"); - this._readableState.flowing = false; - this.emit("pause"); - } - this._readableState.paused = true; - return this; - }; - function flow(stream) { - var state = stream._readableState; - debug("flow", state.flowing); - while (state.flowing && stream.read() !== null) { - ; - } - } - Readable.prototype.wrap = function(stream) { - var _this = this; - var state = this._readableState; - var paused = false; - stream.on("end", function() { - debug("wrapped end"); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - _this.push(chunk); - } - _this.push(null); - }); - stream.on("data", function(chunk) { - debug("wrapped data"); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (state.objectMode && (chunk === null || chunk === void 0)) - return; - else if (!state.objectMode && (!chunk || !chunk.length)) - return; - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - for (var i in stream) { - if (this[i] === void 0 && typeof stream[i] === "function") { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - this._read = function(n2) { - debug("wrapped _read", n2); - if (paused) { - paused = false; - stream.resume(); - } - }; - return this; - }; - if (typeof Symbol === "function") { - Readable.prototype[Symbol.asyncIterator] = function() { - if (createReadableStreamAsyncIterator === void 0) { - createReadableStreamAsyncIterator = require_async_iterator(); - } - return createReadableStreamAsyncIterator(this); - }; - } - Object.defineProperty(Readable.prototype, "readableHighWaterMark", { - enumerable: false, - get: function get2() { - return this._readableState.highWaterMark; - } - }); - Object.defineProperty(Readable.prototype, "readableBuffer", { - enumerable: false, - get: function get2() { - return this._readableState && this._readableState.buffer; - } - }); - Object.defineProperty(Readable.prototype, "readableFlowing", { - enumerable: false, - get: function get2() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } - }); - Readable._fromList = fromList; - Object.defineProperty(Readable.prototype, "readableLength", { - enumerable: false, - get: function get2() { - return this._readableState.length; - } - }); - function fromList(n, state) { - if (state.length === 0) - return null; - var ret; - if (state.objectMode) - ret = state.buffer.shift(); - else if (!n || n >= state.length) { - if (state.decoder) - ret = state.buffer.join(""); - else if (state.buffer.length === 1) - ret = state.buffer.first(); - else - ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - ret = state.buffer.consume(n, state.decoder); - } - return ret; - } - function endReadable(stream) { - var state = stream._readableState; - debug("endReadable", state.endEmitted); - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } - } - function endReadableNT(state, stream) { - debug("endReadableNT", state.endEmitted, state.length); - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit("end"); - if (state.autoDestroy) { - var wState = stream._writableState; - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); - } - } - } - } - if (typeof Symbol === "function") { - Readable.from = function(iterable, opts) { - if (from === void 0) { - from = require_from_browser(); - } - return from(Readable, iterable, opts); - }; - } - function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) - return i; - } - return -1; - } - } - }); - - // node_modules/readable-stream/lib/_stream_transform.js - var require_stream_transform = __commonJS({ - "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = Transform; - var _require$codes = require_errors_browser().codes; - var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; - var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; - var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING; - var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - var Duplex = require_stream_duplex(); - require_inherits_browser()(Transform, Duplex); - function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - if (cb === null) { - return this.emit("error", new ERR_MULTIPLE_CALLBACK()); - } - ts.writechunk = null; - ts.writecb = null; - if (data != null) - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } - } - function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - this._readableState.needReadable = true; - this._readableState.sync = false; - if (options) { - if (typeof options.transform === "function") - this._transform = options.transform; - if (typeof options.flush === "function") - this._flush = options.flush; - } - this.on("prefinish", prefinish); - } - function prefinish() { - var _this = this; - if (typeof this._flush === "function" && !this._readableState.destroyed) { - this._flush(function(er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } - } - Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); - }; - Transform.prototype._transform = function(chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); - }; - Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } - }; - Transform.prototype._read = function(n) { - var ts = this._transformState; - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - ts.needTransform = true; - } - }; - Transform.prototype._destroy = function(err, cb) { - Duplex.prototype._destroy.call(this, err, function(err2) { - cb(err2); - }); - }; - function done(stream, er, data) { - if (er) - return stream.emit("error", er); - if (data != null) - stream.push(data); - if (stream._writableState.length) - throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) - throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); - } - } - }); - - // node_modules/readable-stream/lib/_stream_passthrough.js - var require_stream_passthrough = __commonJS({ - "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - module.exports = PassThrough; - var Transform = require_stream_transform(); - require_inherits_browser()(PassThrough, Transform); - function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - Transform.call(this, options); - } - PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); - }; - } - }); - - // node_modules/readable-stream/lib/internal/streams/pipeline.js - var require_pipeline = __commonJS({ - "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var eos; - function once(callback) { - var called = false; - return function() { - if (called) - return; - called = true; - callback.apply(void 0, arguments); - }; - } - var _require$codes = require_errors_browser().codes; - var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; - var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - function noop3(err) { - if (err) - throw err; - } - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === "function"; - } - function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on("close", function() { - closed = true; - }); - if (eos === void 0) - eos = require_end_of_stream(); - eos(stream, { - readable: reading, - writable: writing - }, function(err) { - if (err) - return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function(err) { - if (closed) - return; - if (destroyed) - return; - destroyed = true; - if (isRequest(stream)) - return stream.abort(); - if (typeof stream.destroy === "function") - return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED("pipe")); - }; - } - function call(fn) { - fn(); - } - function pipe(from, to) { - return from.pipe(to); - } - function popCallback(streams) { - if (!streams.length) - return noop3; - if (typeof streams[streams.length - 1] !== "function") - return noop3; - return streams.pop(); - } - function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - var callback = popCallback(streams); - if (Array.isArray(streams[0])) - streams = streams[0]; - if (streams.length < 2) { - throw new ERR_MISSING_ARGS("streams"); - } - var error; - var destroys = streams.map(function(stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function(err) { - if (!error) - error = err; - if (err) - destroys.forEach(call); - if (reading) - return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); - } - module.exports = pipeline; - } - }); - - // node_modules/readable-stream/readable-browser.js - var require_readable_browser = __commonJS({ - "node_modules/readable-stream/readable-browser.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - exports = module.exports = require_stream_readable(); - exports.Stream = exports; - exports.Readable = exports; - exports.Writable = require_stream_writable(); - exports.Duplex = require_stream_duplex(); - exports.Transform = require_stream_transform(); - exports.PassThrough = require_stream_passthrough(); - exports.finished = require_end_of_stream(); - exports.pipeline = require_pipeline(); - } - }); - - // node_modules/readable-web-to-node-stream/lib/index.js - var require_lib = __commonJS({ - "node_modules/readable-web-to-node-stream/lib/index.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ReadableWebToNodeStream = void 0; - var readable_stream_1 = require_readable_browser(); - var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable { - constructor(stream) { - super(); - this.bytesRead = 0; - this.released = false; - this.reader = stream.getReader(); - } - async _read() { - if (this.released) { - this.push(null); - return; - } - this.pendingRead = this.reader.read(); - const data = await this.pendingRead; - delete this.pendingRead; - if (data.done || this.released) { - this.push(null); - } else { - this.bytesRead += data.value.length; - this.push(data.value); - } - } - async waitForReadToComplete() { - if (this.pendingRead) { - await this.pendingRead; - } - } - async close() { - await this.syncAndRelease(); - } - async syncAndRelease() { - this.released = true; - await this.waitForReadToComplete(); - await this.reader.releaseLock(); - } - }; - exports.ReadableWebToNodeStream = ReadableWebToNodeStream2; - } - }); - - // node_modules/base-x/src/index.js - var require_src2 = __commonJS({ - "node_modules/base-x/src/index.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - function base(ALPHABET) { - if (ALPHABET.length >= 255) { - throw new TypeError("Alphabet too long"); - } - var BASE_MAP = new Uint8Array(256); - for (var j = 0; j < BASE_MAP.length; j++) { - BASE_MAP[j] = 255; - } - for (var i = 0; i < ALPHABET.length; i++) { - var x = ALPHABET.charAt(i); - var xc = x.charCodeAt(0); - if (BASE_MAP[xc] !== 255) { - throw new TypeError(x + " is ambiguous"); - } - BASE_MAP[xc] = i; - } - var BASE = ALPHABET.length; - var LEADER = ALPHABET.charAt(0); - var FACTOR = Math.log(BASE) / Math.log(256); - var iFACTOR = Math.log(256) / Math.log(BASE); - function encode2(source) { - if (source instanceof Uint8Array) { - } else if (ArrayBuffer.isView(source)) { - source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); - } else if (Array.isArray(source)) { - source = Uint8Array.from(source); - } - if (!(source instanceof Uint8Array)) { - throw new TypeError("Expected Uint8Array"); - } - if (source.length === 0) { - return ""; - } - var zeroes = 0; - var length = 0; - var pbegin = 0; - var pend = source.length; - while (pbegin !== pend && source[pbegin] === 0) { - pbegin++; - zeroes++; - } - var size = (pend - pbegin) * iFACTOR + 1 >>> 0; - var b58 = new Uint8Array(size); - while (pbegin !== pend) { - var carry = source[pbegin]; - var i2 = 0; - for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) { - carry += 256 * b58[it1] >>> 0; - b58[it1] = carry % BASE >>> 0; - carry = carry / BASE >>> 0; - } - if (carry !== 0) { - throw new Error("Non-zero carry"); - } - length = i2; - pbegin++; - } - var it2 = size - length; - while (it2 !== size && b58[it2] === 0) { - it2++; - } - var str = LEADER.repeat(zeroes); - for (; it2 < size; ++it2) { - str += ALPHABET.charAt(b58[it2]); - } - return str; - } - function decodeUnsafe(source) { - if (typeof source !== "string") { - throw new TypeError("Expected String"); - } - if (source.length === 0) { - return new Uint8Array(); - } - var psz = 0; - var zeroes = 0; - var length = 0; - while (source[psz] === LEADER) { - zeroes++; - psz++; - } - var size = (source.length - psz) * FACTOR + 1 >>> 0; - var b256 = new Uint8Array(size); - while (source[psz]) { - var carry = BASE_MAP[source.charCodeAt(psz)]; - if (carry === 255) { - return; - } - var i2 = 0; - for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) { - carry += BASE * b256[it3] >>> 0; - b256[it3] = carry % 256 >>> 0; - carry = carry / 256 >>> 0; - } - if (carry !== 0) { - throw new Error("Non-zero carry"); - } - length = i2; - psz++; - } - var it4 = size - length; - while (it4 !== size && b256[it4] === 0) { - it4++; - } - var vch = new Uint8Array(zeroes + (size - it4)); - var j2 = zeroes; - while (it4 !== size) { - vch[j2++] = b256[it4++]; - } - return vch; - } - function decode3(string) { - var buffer = decodeUnsafe(string); - if (buffer) { - return buffer; - } - throw new Error("Non-base" + BASE + " character"); - } - return { - encode: encode2, - decodeUnsafe, - decode: decode3 - }; - } - module.exports = base; - } - }); - - // node_modules/bs58/index.js - var require_bs58 = __commonJS({ - "node_modules/bs58/index.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var basex = require_src2(); - var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; - module.exports = basex(ALPHABET); - } - }); - - // node_modules/int64-buffer/int64-buffer.js - var require_int64_buffer = __commonJS({ - "node_modules/int64-buffer/int64-buffer.js"(exports) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var Uint64BE; - var Int64BE; - var Uint64LE; - var Int64LE; - !function(exports2) { - var UNDEFINED = "undefined"; - var BUFFER = UNDEFINED !== typeof Buffer2 && Buffer2; - var UINT8ARRAY = UNDEFINED !== typeof Uint8Array && Uint8Array; - var ARRAYBUFFER = UNDEFINED !== typeof ArrayBuffer && ArrayBuffer; - var ZERO = [0, 0, 0, 0, 0, 0, 0, 0]; - var isArray = Array.isArray || _isArray; - var BIT32 = 4294967296; - var BIT24 = 16777216; - var storage; - Uint64BE = factory("Uint64BE", true, true); - Int64BE = factory("Int64BE", true, false); - Uint64LE = factory("Uint64LE", false, true); - Int64LE = factory("Int64LE", false, false); - function factory(name, bigendian, unsigned) { - var posH = bigendian ? 0 : 4; - var posL = bigendian ? 4 : 0; - var pos0 = bigendian ? 0 : 3; - var pos1 = bigendian ? 1 : 2; - var pos2 = bigendian ? 2 : 1; - var pos3 = bigendian ? 3 : 0; - var fromPositive = bigendian ? fromPositiveBE : fromPositiveLE; - var fromNegative = bigendian ? fromNegativeBE : fromNegativeLE; - var proto = Int64.prototype; - var isName = "is" + name; - var _isInt64 = "_" + isName; - proto.buffer = void 0; - proto.offset = 0; - proto[_isInt64] = true; - proto.toNumber = toNumber; - proto.toString = toString2; - proto.toJSON = toNumber; - proto.toArray = toArray; - if (BUFFER) - proto.toBuffer = toBuffer; - if (UINT8ARRAY) - proto.toArrayBuffer = toArrayBuffer; - Int64[isName] = isInt64; - exports2[name] = Int64; - return Int64; - function Int64(buffer, offset, value, raddix) { - if (!(this instanceof Int64)) - return new Int64(buffer, offset, value, raddix); - return init5(this, buffer, offset, value, raddix); - } - function isInt64(b) { - return !!(b && b[_isInt64]); - } - function init5(that, buffer, offset, value, raddix) { - if (UINT8ARRAY && ARRAYBUFFER) { - if (buffer instanceof ARRAYBUFFER) - buffer = new UINT8ARRAY(buffer); - if (value instanceof ARRAYBUFFER) - value = new UINT8ARRAY(value); - } - if (!buffer && !offset && !value && !storage) { - that.buffer = newArray(ZERO, 0); - return; - } - if (!isValidBuffer(buffer, offset)) { - var _storage = storage || Array; - raddix = offset; - value = buffer; - offset = 0; - buffer = new _storage(8); - } - that.buffer = buffer; - that.offset = offset |= 0; - if (UNDEFINED === typeof value) - return; - if (typeof value === "string") { - fromString(buffer, offset, value, raddix || 10); - } else if (isValidBuffer(value, raddix)) { - fromArray(buffer, offset, value, raddix); - } else if (typeof raddix === "number") { - writeInt32(buffer, offset + posH, value); - writeInt32(buffer, offset + posL, raddix); - } else if (value > 0) { - fromPositive(buffer, offset, value); - } else if (value < 0) { - fromNegative(buffer, offset, value); - } else { - fromArray(buffer, offset, ZERO, 0); - } - } - function fromString(buffer, offset, str, raddix) { - var pos = 0; - var len = str.length; - var high = 0; - var low = 0; - if (str[0] === "-") - pos++; - var sign = pos; - while (pos < len) { - var chr = parseInt(str[pos++], raddix); - if (!(chr >= 0)) - break; - low = low * raddix + chr; - high = high * raddix + Math.floor(low / BIT32); - low %= BIT32; - } - if (sign) { - high = ~high; - if (low) { - low = BIT32 - low; - } else { - high++; - } - } - writeInt32(buffer, offset + posH, high); - writeInt32(buffer, offset + posL, low); - } - function toNumber() { - var buffer = this.buffer; - var offset = this.offset; - var high = readInt32(buffer, offset + posH); - var low = readInt32(buffer, offset + posL); - if (!unsigned) - high |= 0; - return high ? high * BIT32 + low : low; - } - function toString2(radix) { - var buffer = this.buffer; - var offset = this.offset; - var high = readInt32(buffer, offset + posH); - var low = readInt32(buffer, offset + posL); - var str = ""; - var sign = !unsigned && high & 2147483648; - if (sign) { - high = ~high; - low = BIT32 - low; - } - radix = radix || 10; - while (1) { - var mod = high % radix * BIT32 + low; - high = Math.floor(high / radix); - low = Math.floor(mod / radix); - str = (mod % radix).toString(radix) + str; - if (!high && !low) - break; - } - if (sign) { - str = "-" + str; - } - return str; - } - function writeInt32(buffer, offset, value) { - buffer[offset + pos3] = value & 255; - value = value >> 8; - buffer[offset + pos2] = value & 255; - value = value >> 8; - buffer[offset + pos1] = value & 255; - value = value >> 8; - buffer[offset + pos0] = value & 255; - } - function readInt32(buffer, offset) { - return buffer[offset + pos0] * BIT24 + (buffer[offset + pos1] << 16) + (buffer[offset + pos2] << 8) + buffer[offset + pos3]; - } - } - function toArray(raw) { - var buffer = this.buffer; - var offset = this.offset; - storage = null; - if (raw !== false && offset === 0 && buffer.length === 8 && isArray(buffer)) - return buffer; - return newArray(buffer, offset); - } - function toBuffer(raw) { - var buffer = this.buffer; - var offset = this.offset; - storage = BUFFER; - if (raw !== false && offset === 0 && buffer.length === 8 && Buffer2.isBuffer(buffer)) - return buffer; - var dest = new BUFFER(8); - fromArray(dest, 0, buffer, offset); - return dest; - } - function toArrayBuffer(raw) { - var buffer = this.buffer; - var offset = this.offset; - var arrbuf = buffer.buffer; - storage = UINT8ARRAY; - if (raw !== false && offset === 0 && arrbuf instanceof ARRAYBUFFER && arrbuf.byteLength === 8) - return arrbuf; - var dest = new UINT8ARRAY(8); - fromArray(dest, 0, buffer, offset); - return dest.buffer; - } - function isValidBuffer(buffer, offset) { - var len = buffer && buffer.length; - offset |= 0; - return len && offset + 8 <= len && typeof buffer[offset] !== "string"; - } - function fromArray(destbuf, destoff, srcbuf, srcoff) { - destoff |= 0; - srcoff |= 0; - for (var i = 0; i < 8; i++) { - destbuf[destoff++] = srcbuf[srcoff++] & 255; - } - } - function newArray(buffer, offset) { - return Array.prototype.slice.call(buffer, offset, offset + 8); - } - function fromPositiveBE(buffer, offset, value) { - var pos = offset + 8; - while (pos > offset) { - buffer[--pos] = value & 255; - value /= 256; - } - } - function fromNegativeBE(buffer, offset, value) { - var pos = offset + 8; - value++; - while (pos > offset) { - buffer[--pos] = -value & 255 ^ 255; - value /= 256; - } - } - function fromPositiveLE(buffer, offset, value) { - var end = offset + 8; - while (offset < end) { - buffer[offset++] = value & 255; - value /= 256; - } - } - function fromNegativeLE(buffer, offset, value) { - var end = offset + 8; - value++; - while (offset < end) { - buffer[offset++] = -value & 255 ^ 255; - value /= 256; - } - } - function _isArray(val) { - return !!val && Object.prototype.toString.call(val) == "[object Array]"; - } - }(typeof exports === "object" && typeof exports.nodeName !== "string" ? exports : exports || {}); - } - }); - - // node_modules/matroska/lib/schema.js - var require_schema = __commonJS({ - "node_modules/matroska/lib/schema.js"(exports, module) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var byEbmlID = { - 128: { - name: "ChapterDisplay", - level: 4, - type: "m", - multiple: true, - webm: true, - description: "Contains all possible strings to use for the chapter display." - }, - 131: { - name: "TrackType", - level: 3, - type: "u", - mandatory: true, - description: "The `TrackType` defines the type of each frame found in the Track. The value **SHOULD** be stored on 1 octet." - }, - 133: { - name: "ChapString", - cppname: "ChapterString", - level: 5, - type: "8", - mandatory: true, - webm: true, - description: "Contains the string to use as the chapter atom." - }, - 134: { - name: "CodecID", - level: 3, - type: "s", - mandatory: true, - description: "An ID corresponding to the codec, see [@!MatroskaCodec] for more info." - }, - 136: { - name: "FlagDefault", - cppname: "TrackFlagDefault", - level: 3, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set if that track (audio, video or subs) **SHOULD** be eligible for automatic selection by the player; see (#default-track-selection) for more details." - }, - 137: { - name: "ChapterTrackUID", - cppname: "ChapterTrackNumber", - level: 5, - type: "u", - mandatory: true, - multiple: true, - range: "not 0", - description: "UID of the Track to apply this chapter to. In the absence of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absence of this Element indicates that the Chapter **SHOULD** be applied to any currently used Tracks." - }, - 142: { - name: "Slices", - level: 3, - type: "m", - maxver: 1, - description: "Contains slices description." - }, - 143: { - name: "ChapterTrack", - level: 4, - type: "m", - description: "List of tracks on which the chapter applies. If this Element is not present, all tracks apply" - }, - 145: { - name: "ChapterTimeStart", - level: 4, - type: "u", - mandatory: true, - webm: true, - description: "Timestamp of the start of Chapter, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 146: { - name: "ChapterTimeEnd", - level: 4, - type: "u", - webm: true, - description: "Timestamp of the end of Chapter timestamp excluded, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). The value **MUST** be greater than or equal to the `ChapterTimeStart` of the same `ChapterAtom`." - }, - 150: { - name: "CueRefTime", - level: 5, - type: "u", - mandatory: true, - minver: 2, - description: "Timestamp of the referenced Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 151: { - name: "CueRefCluster", - level: 5, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - description: "The Segment Position of the Cluster containing the referenced Block." - }, - 152: { - name: "ChapterFlagHidden", - level: 4, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if a chapter is hidden. Hidden chapters **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapterflaghidden) on Chapter flags)." - }, - 154: { - name: "FlagInterlaced", - cppname: "VideoFlagInterlaced", - level: 4, - type: "u", - mandatory: true, - minver: 2, - webm: true, - "default": "0", - description: "Specify whether the video frames in this track are interlaced or not." - }, - 155: { - name: "BlockDuration", - level: 3, - type: "u", - description: "The duration of the Block, expressed in Track Ticks; see (#timestamp-ticks). The BlockDuration Element can be useful at the end of a Track to define the duration of the last frame (as there is no subsequent Block available), or when there is a break in a track like for subtitle tracks." - }, - 156: { - name: "FlagLacing", - cppname: "TrackFlagLacing", - level: 3, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the track **MAY** contain blocks using lacing. When set to 0 all blocks **MUST** have their lacing flags set to No lacing; see (#block-lacing) on Block Lacing." - }, - 157: { - name: "FieldOrder", - cppname: "VideoFieldOrder", - level: 4, - type: "u", - mandatory: true, - minver: 4, - "default": "2", - description: "Specify the field ordering of video frames in this track." - }, - 159: { - name: "Channels", - cppname: "AudioChannels", - level: 4, - type: "u", - mandatory: true, - "default": "1", - range: "not 0", - description: "Numbers of channels in the track." - }, - 160: { - name: "BlockGroup", - level: 2, - type: "m", - multiple: true, - description: "Basic container of information containing a single Block and information specific to that Block." - }, - 161: { - name: "Block", - level: 3, - type: "b", - mandatory: true, - description: "Block containing the actual data to be rendered and a timestamp relative to the Cluster Timestamp; see (#block-structure) on Block Structure." - }, - 162: { - name: "BlockVirtual", - level: 3, - type: "b", - minver: 0, - maxver: 0, - description: "A Block with no data. It **MUST** be stored in the stream at the place the real Block would be in display order. " - }, - 163: { - name: "SimpleBlock", - level: 2, - type: "b", - multiple: true, - minver: 2, - webm: true, - divx: true, - description: "Similar to Block, see (#block-structure), but without all the extra information, mostly used to reduced overhead when no extra feature is needed; see (#simpleblock-structure) on SimpleBlock Structure." - }, - 164: { - name: "CodecState", - level: 3, - type: "b", - minver: 2, - description: "The new codec state to use. Data interpretation is private to the codec. This information **SHOULD** always be referenced by a seek entry." - }, - 165: { - name: "BlockAdditional", - level: 5, - type: "b", - mandatory: true, - webm: true, - description: "Interpreted by the codec as it wishes (using the BlockAddID)." - }, - 166: { - name: "BlockMore", - level: 4, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contain the BlockAdditional and some parameters." - }, - 167: { - name: "Position", - cppname: "ClusterPosition", - level: 2, - type: "u", - description: "The Segment Position of the Cluster in the Segment (0 in live streams). It might help to resynchronise offset on damaged streams." - }, - 170: { - name: "CodecDecodeAll", - level: 3, - type: "u", - mandatory: true, - maxver: 0, - "default": "1", - range: "0-1", - description: "Set to 1 if the codec can decode potentially damaged data." - }, - 171: { - name: "PrevSize", - cppname: "ClusterPrevSize", - level: 2, - type: "u", - description: "Size of the previous Cluster, in octets. Can be useful for backward playing." - }, - 174: { - name: "TrackEntry", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Describes a track with all Elements." - }, - 175: { - name: "EncryptedBlock", - level: 2, - type: "b", - multiple: true, - minver: 0, - maxver: 0, - description: "Similar to SimpleBlock, see (#simpleblock-structure), but the data inside the Block are Transformed (encrypt and/or signed)." - }, - 176: { - name: "PixelWidth", - cppname: "VideoPixelWidth", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "Width of the encoded video frames in pixels." - }, - 178: { - name: "CueDuration", - level: 4, - type: "u", - minver: 4, - webm: true, - description: "The duration of the block, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks). If missing, the track's DefaultDuration does not apply and no duration information is available in terms of the cues." - }, - 179: { - name: "CueTime", - level: 3, - type: "u", - mandatory: true, - description: "Absolute timestamp of the seek point, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 181: { - name: "SamplingFrequency", - cppname: "AudioSamplingFreq", - level: 4, - type: "f", - mandatory: true, - "default": "0x1.f4p+12", - range: "> 0x0p+0", - description: "Sampling frequency in Hz." - }, - 182: { - name: "ChapterAtom", - level: 3, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains the atom information to use as the chapter atom (apply to all tracks)." - }, - 183: { - name: "CueTrackPositions", - level: 3, - type: "m", - mandatory: true, - multiple: true, - description: "Contain positions for different tracks corresponding to the timestamp." - }, - 185: { - name: "FlagEnabled", - cppname: "TrackFlagEnabled", - level: 3, - type: "u", - mandatory: true, - minver: 2, - webm: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the track is usable. It is possible to turn a not usable track into a usable track using chapter codecs or control tracks." - }, - 186: { - name: "PixelHeight", - cppname: "VideoPixelHeight", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "Height of the encoded video frames in pixels." - }, - 187: { - name: "CuePoint", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Contains all information relative to a seek point in the Segment." - }, - 191: { - name: "CRC-32", - level: -1, - type: "b", - minver: 1, - webm: false, - description: "The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian", - crc: true - }, - 192: { - name: "TrickTrackUID", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The TrackUID of the Smooth FF/RW video in the paired EBML structure corresponding to this video track. See [@?DivXTrickTrack]." - }, - 193: { - name: "TrickTrackSegmentUID", - level: 3, - type: "b", - minver: 0, - maxver: 0, - divx: true, - description: "The SegmentUID of the Segment containing the track identified by TrickTrackUID. See [@?DivXTrickTrack]." - }, - 196: { - name: "TrickMasterTrackSegmentUID", - level: 3, - type: "b", - minver: 0, - maxver: 0, - divx: true, - description: "The SegmentUID of the Segment containing the track identified by MasterTrackUID. See [@?DivXTrickTrack]." - }, - 198: { - name: "TrickTrackFlag", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - "default": "0", - description: "Set to 1 if this video track is a Smooth FF/RW track. If set to 1, MasterTrackUID and MasterTrackSegUID should must be present and BlockGroups for this track must contain ReferenceFrame structures. Otherwise, TrickTrackUID and TrickTrackSegUID must be present if this track has a corresponding Smooth FF/RW track. See [@?DivXTrickTrack]." - }, - 199: { - name: "TrickMasterTrackUID", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The TrackUID of the video track in the paired EBML structure that corresponds to this Smooth FF/RW track. See [@?DivXTrickTrack]." - }, - 200: { - name: "ReferenceFrame", - level: 3, - type: "m", - minver: 0, - maxver: 0, - divx: true, - description: "Contains information about the last reference frame. See [@?DivXTrickTrack]." - }, - 201: { - name: "ReferenceOffset", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - divx: true, - description: "The relative offset, in bytes, from the previous BlockGroup element for this Smooth FF/RW video track to the containing BlockGroup element. See [@?DivXTrickTrack]." - }, - 202: { - name: "ReferenceTimestamp", - cppname: "ReferenceTimeCode", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp of the BlockGroup pointed to by ReferenceOffset, expressed in Track Ticks; see (#timestamp-ticks). See [@?DivXTrickTrack]." - }, - 203: { - name: "BlockAdditionID", - cppname: "SliceBlockAddID", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The ID of the BlockAdditional Element (0 is the main Block)." - }, - 204: { - name: "LaceNumber", - cppname: "SliceLaceNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - description: "The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). Being able to interpret this Element is not **REQUIRED** for playback." - }, - 205: { - name: "FrameNumber", - cppname: "SliceFrameNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame)." - }, - 206: { - name: "Delay", - cppname: "SliceDelay", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The delay to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)." - }, - 207: { - name: "SliceDuration", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The duration to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)." - }, - 215: { - name: "TrackNumber", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number)." - }, - 219: { - name: "CueReference", - level: 4, - type: "m", - multiple: true, - minver: 2, - description: "The Clusters containing the referenced Blocks." - }, - 224: { - name: "Video", - cppname: "TrackVideo", - level: 3, - type: "m", - description: "Video settings." - }, - 225: { - name: "Audio", - cppname: "TrackAudio", - level: 3, - type: "m", - description: "Audio settings." - }, - 226: { - name: "TrackOperation", - level: 3, - type: "m", - minver: 3, - description: "Operation that needs to be applied on tracks to create this virtual track. For more details look at (#track-operation)." - }, - 227: { - name: "TrackCombinePlanes", - level: 4, - type: "m", - minver: 3, - description: "Contains the list of all video plane tracks that need to be combined to create this 3D track" - }, - 228: { - name: "TrackPlane", - level: 5, - type: "m", - mandatory: true, - multiple: true, - minver: 3, - description: "Contains a video plane track that need to be combined to create this 3D track" - }, - 229: { - name: "TrackPlaneUID", - level: 6, - type: "u", - mandatory: true, - minver: 3, - range: "not 0", - description: "The trackUID number of the track representing the plane." - }, - 230: { - name: "TrackPlaneType", - level: 6, - type: "u", - mandatory: true, - minver: 3, - description: "The kind of plane this track corresponds to." - }, - 231: { - name: "Timestamp", - cppname: "ClusterTimecode", - level: 2, - type: "u", - mandatory: true, - description: "Absolute timestamp of the cluster, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)." - }, - 232: { - name: "TimeSlice", - level: 4, - type: "m", - multiple: true, - minver: 0, - maxver: 0, - description: "Contains extra time information about the data contained in the Block. Being able to interpret this Element is not **REQUIRED** for playback." - }, - 233: { - name: "TrackJoinBlocks", - level: 4, - type: "m", - minver: 3, - description: "Contains the list of all tracks whose Blocks need to be combined to create this virtual track" - }, - 234: { - name: "CueCodecState", - level: 4, - type: "u", - mandatory: true, - minver: 2, - "default": "0", - description: "The Segment Position of the Codec State corresponding to this Cue Element. 0 means that the data is taken from the initial Track Entry." - }, - 235: { - name: "CueRefCodecState", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "The Segment Position of the Codec State corresponding to this referenced Element. 0 means that the data is taken from the initial Track Entry." - }, - 236: { - name: "Void", - level: -1, - type: "b", - minver: 1, - description: "Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use." - }, - 237: { - name: "TrackJoinUID", - level: 5, - type: "u", - mandatory: true, - multiple: true, - minver: 3, - range: "not 0", - description: "The trackUID number of a track whose blocks are used to create this virtual track." - }, - 238: { - name: "BlockAddID", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "1", - range: "not 0", - description: "An ID to identify the BlockAdditional level. If BlockAddIDType of the corresponding block is 0, this value is also the value of BlockAddIDType for the meaning of the content of BlockAdditional." - }, - 240: { - name: "CueRelativePosition", - level: 4, - type: "u", - minver: 4, - webm: true, - description: "The relative position inside the Cluster of the referenced SimpleBlock or BlockGroup with 0 being the first possible position for an Element inside that Cluster." - }, - 241: { - name: "CueClusterPosition", - level: 4, - type: "u", - mandatory: true, - description: "The Segment Position of the Cluster containing the associated Block." - }, - 247: { - name: "CueTrack", - level: 4, - type: "u", - mandatory: true, - range: "not 0", - description: "The track for which a position is given." - }, - 250: { - name: "ReferencePriority", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced." - }, - 251: { - name: "ReferenceBlock", - level: 3, - type: "i", - multiple: true, - description: "A timestamp value, relative to the timestamp of the Block in this BlockGroup, expressed in Track Ticks; see (#timestamp-ticks). This is used to reference other frames necessary to decode this frame. The relative value **SHOULD** correspond to a valid `Block` this `Block` depends on. Historically Matroska Writer didn't write the actual `Block(s)` this `Block` depends on, but *some* `Block` in the past. The value \"0\" **MAY** also be used to signify this `Block` cannot be decoded on its own, but without knownledge of which `Block` is necessary. In this case, other `ReferenceBlock` **MUST NOT** be found in the same `BlockGroup`. If the `BlockGroup` doesn't have any `ReferenceBlock` element, then the `Block` it contains can be decoded without using any other `Block` data." - }, - 253: { - name: "ReferenceVirtual", - level: 3, - type: "i", - minver: 0, - maxver: 0, - description: "The Segment Position of the data that would otherwise be in position of the virtual block." - }, - 16804: { - name: "BlockAddIDName", - level: 4, - type: "s", - minver: 4, - description: "A human-friendly name describing the type of BlockAdditional data, as defined by the associated Block Additional Mapping." - }, - 16868: { - name: "BlockAdditionMapping", - level: 3, - type: "m", - multiple: true, - minver: 4, - description: "Contains elements that extend the track format, by adding content either to each frame, with BlockAddID ((#blockaddid-element)), or to the track as a whole with BlockAddIDExtraData." - }, - 16871: { - name: "BlockAddIDType", - level: 4, - type: "u", - mandatory: true, - minver: 4, - "default": "0", - description: "Stores the registered identifier of the Block Additional Mapping to define how the BlockAdditional data should be handled." - }, - 16877: { - name: "BlockAddIDExtraData", - level: 4, - type: "b", - minver: 4, - description: "Extra binary data that the BlockAddIDType can use to interpret the BlockAdditional data. The interpretation of the binary data depends on the BlockAddIDType value and the corresponding Block Additional Mapping." - }, - 16880: { - name: "BlockAddIDValue", - level: 4, - type: "u", - minver: 4, - range: ">=2", - description: "If the track format extension needs content beside frames, the value refers to the BlockAddID ((#blockaddid-element)), value being described. To keep MaxBlockAdditionID as low as possible, small values **SHOULD** be used." - }, - 16980: { - name: "ContentCompAlgo", - level: 6, - type: "u", - mandatory: true, - "default": "0", - description: "The compression algorithm used." - }, - 16981: { - name: "ContentCompSettings", - level: 6, - type: "b", - description: "Settings that might be needed by the decompressor. For Header Stripping (`ContentCompAlgo`=3), the bytes that were removed from the beginning of each frames of the track." - }, - 17026: { - name: "DocType", - level: 1, - type: "s", - mandatory: true, - "default": "matroska", - minver: 1, - description: "A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files." - }, - 17029: { - name: "DocTypeReadVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The minimum DocType version an interpreter has to support to read this file." - }, - 17030: { - name: "EBMLVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The version of EBML parser used to create the file." - }, - 17031: { - name: "DocTypeVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The version of DocType interpreter used to create the file." - }, - 17138: { - name: "EBMLMaxIDLength", - level: 1, - type: "u", - mandatory: true, - "default": "4", - range: "4" - }, - 17139: { - name: "EBMLMaxSizeLength", - level: 1, - type: "u", - mandatory: true, - "default": "8", - range: "1-8" - }, - 17143: { - name: "EBMLReadVersion", - level: 1, - type: "u", - mandatory: true, - "default": 1, - minver: 1, - description: "The minimum EBML version a parser has to support to read this file." - }, - 17276: { - name: "ChapLanguage", - cppname: "ChapterLanguage", - level: 5, - type: "s", - mandatory: true, - multiple: true, - webm: true, - "default": "eng", - description: "A language corresponding to the string, in the bibliographic ISO-639-2 form [@!ISO639-2]. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element." - }, - 17277: { - name: "ChapLanguageIETF", - level: 5, - type: "s", - multiple: true, - minver: 4, - description: "Specifies a language corresponding to the ChapString in the format defined in [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If a ChapLanguageIETF Element is used, then any ChapLanguage and ChapCountry Elements used in the same ChapterDisplay **MUST** be ignored." - }, - 17278: { - name: "ChapCountry", - cppname: "ChapterCountry", - level: 5, - type: "s", - multiple: true, - webm: true, - description: "A country corresponding to the string, using the same 2 octets country-codes as in Internet domains [@!IANADomains] based on [@!ISO3166-1] alpha-2 codes. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element." - }, - 17476: { - name: "SegmentFamily", - level: 2, - type: "b", - multiple: true, - description: "A randomly generated unique ID that all Segments of a Linked Segment **MUST** share (128 bits)." - }, - 17505: { - name: "DateUTC", - level: 2, - type: "d", - description: "The date and time that the Segment was created by the muxing application or library." - }, - 17530: { - name: "TagLanguage", - cppname: "TagLangue", - level: 4, - type: "s", - mandatory: true, - webm: true, - "default": "und", - description: "Specifies the language of the tag specified, in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the TagLanguageIETF Element is used within the same SimpleTag Element." - }, - 17531: { - name: "TagLanguageIETF", - level: 4, - type: "s", - minver: 4, - description: "Specifies the language used in the TagString according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any TagLanguage Elements used in the same SimpleTag **MUST** be ignored." - }, - 17540: { - name: "TagDefault", - level: 4, - type: "u", - mandatory: true, - webm: true, - "default": "1", - range: "0-1", - description: "A boolean value to indicate if this is the default/original language to use for the given tag." - }, - 17541: { - name: "TagBinary", - level: 4, - type: "b", - webm: true, - description: "The values of the Tag, if it is binary. Note that this cannot be used in the same SimpleTag as TagString." - }, - 17543: { - name: "TagString", - level: 4, - type: "8", - webm: true, - description: "The value of the Tag." - }, - 17545: { - name: "Duration", - level: 2, - type: "f", - range: "> 0x0p+0", - description: "Duration of the Segment, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)." - }, - 17588: { - name: "TagDefaultBogus", - level: 4, - type: "u", - mandatory: true, - minver: 0, - maxver: 0, - "default": "1", - range: "0-1", - description: "A variant of the TagDefault element with a bogus Element ID; see (#tagdefault-element)." - }, - 17677: { - name: "ChapProcessPrivate", - cppname: "ChapterProcessPrivate", - level: 5, - type: "b", - description: 'Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent; see (#menu-features) on DVD menus.' - }, - 17816: { - name: "ChapterFlagEnabled", - level: 4, - type: "u", - mandatory: true, - "default": "1", - range: "0-1", - description: "Set to 1 if the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie **SHOULD** skip all the content between the TimeStart and TimeEnd of this chapter; see (#chapter-flags) on Chapter flags." - }, - 17827: { - name: "TagName", - level: 4, - type: "8", - mandatory: true, - webm: true, - description: "The name of the Tag that is going to be stored." - }, - 17849: { - name: "EditionEntry", - level: 2, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains all information about a Segment edition." - }, - 17852: { - name: "EditionUID", - level: 3, - type: "u", - range: "not 0", - description: "A unique ID to identify the edition. It's useful for tagging an edition." - }, - 17853: { - name: "EditionFlagHidden", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if an edition is hidden. Hidden editions **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapter-flags) on Chapter flags)." - }, - 17883: { - name: "EditionFlagDefault", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if the edition **SHOULD** be used as the default one." - }, - 17885: { - name: "EditionFlagOrdered", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Set to 1 if the chapters can be defined multiple times and the order to play them is enforced; see (#editionflagordered)." - }, - 18012: { - name: "FileData", - level: 3, - type: "b", - mandatory: true, - description: "The data of the file." - }, - 18016: { - name: "FileMimeType", - cppname: "MimeType", - level: 3, - type: "s", - mandatory: true, - description: "MIME type of the file." - }, - 18017: { - name: "FileUsedStartTime", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp at which this optimized font attachment comes into context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]." - }, - 18018: { - name: "FileUsedEndTime", - level: 3, - type: "u", - minver: 0, - maxver: 0, - divx: true, - description: "The timestamp at which this optimized font attachment goes out of context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]." - }, - 18030: { - name: "FileName", - level: 3, - type: "8", - mandatory: true, - description: "Filename of the attached file." - }, - 18037: { - name: "FileReferral", - level: 3, - type: "b", - minver: 0, - maxver: 0, - description: "A binary value that a track/codec can refer to when the attachment is needed." - }, - 18046: { - name: "FileDescription", - level: 3, - type: "8", - description: "A human-friendly name for the attached file." - }, - 18094: { - name: "FileUID", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "Unique ID representing the file, as random as possible." - }, - 18401: { - name: "ContentEncAlgo", - level: 6, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: 'The encryption algorithm used. The value "0" means that the contents have not been encrypted.' - }, - 18402: { - name: "ContentEncKeyID", - level: 6, - type: "b", - webm: true, - description: "For public key algorithms this is the ID of the public key the the data was encrypted with." - }, - 18403: { - name: "ContentSignature", - level: 6, - type: "b", - maxver: 0, - description: "A cryptographic signature of the contents." - }, - 18404: { - name: "ContentSigKeyID", - level: 6, - type: "b", - maxver: 0, - description: "This is the ID of the private key the data was signed with." - }, - 18405: { - name: "ContentSigAlgo", - level: 6, - type: "u", - maxver: 0, - "default": "0", - description: "The algorithm used for the signature." - }, - 18406: { - name: "ContentSigHashAlgo", - level: 6, - type: "u", - maxver: 0, - "default": "0", - description: "The hash algorithm used for the signature." - }, - 18407: { - name: "ContentEncAESSettings", - level: 6, - type: "m", - minver: 4, - webm: true, - description: "Settings describing the encryption algorithm used. If `ContentEncAlgo` != 5 this **MUST** be ignored." - }, - 18408: { - name: "AESSettingsCipherMode", - level: 7, - type: "u", - mandatory: true, - minver: 4, - webm: true, - description: "The AES cipher mode used in the encryption." - }, - 19840: { - name: "MuxingApp", - level: 2, - type: "8", - mandatory: true, - description: 'Muxing application or library (example: "libmatroska-0.4.3").' - }, - 19899: { - name: "Seek", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "Contains a single seek entry to an EBML Element." - }, - 20529: { - name: "ContentEncodingOrder", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: "Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder Elements in the TrackEntry that contains this ContentEncodingOrder element." - }, - 20530: { - name: "ContentEncodingScope", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "1", - description: "A bit field that describes which Elements have been modified in this way. Values (big-endian) can be OR'ed." - }, - 20531: { - name: "ContentEncodingType", - level: 5, - type: "u", - mandatory: true, - webm: true, - "default": "0", - description: "A value describing what kind of transformation is applied." - }, - 20532: { - name: "ContentCompression", - level: 5, - type: "m", - description: "Settings describing the compression used. This Element **MUST** be present if the value of ContentEncodingType is 0 and absent otherwise. Each block **MUST** be decompressable even if no previous block is available in order not to prevent seeking." - }, - 20533: { - name: "ContentEncryption", - level: 5, - type: "m", - webm: true, - description: "Settings describing the encryption used. This Element **MUST** be present if the value of `ContentEncodingType` is 1 (encryption) and **MUST** be ignored otherwise." - }, - 21343: { - name: "CueRefNumber", - level: 5, - type: "u", - minver: 0, - maxver: 0, - "default": "1", - range: "not 0", - description: "Number of the referenced Block of Track X in the specified Cluster." - }, - 21358: { - name: "Name", - cppname: "TrackName", - level: 3, - type: "8", - description: "A human-readable track name." - }, - 21368: { - name: "CueBlockNumber", - level: 4, - type: "u", - range: "not 0", - description: "Number of the Block in the specified Cluster." - }, - 21375: { - name: "TrackOffset", - level: 3, - type: "i", - minver: 0, - maxver: 0, - "default": "0", - description: "A value to add to the Block's Timestamp, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). This can be used to adjust the playback offset of a track." - }, - 21419: { - name: "SeekID", - level: 3, - type: "b", - mandatory: true, - description: "The binary ID corresponding to the Element name." - }, - 21420: { - name: "SeekPosition", - level: 3, - type: "u", - mandatory: true, - description: "The Segment Position of the Element." - }, - 21432: { - name: "StereoMode", - cppname: "VideoStereoMode", - level: 4, - type: "u", - mandatory: true, - minver: 3, - webm: true, - "default": "0", - description: "Stereo-3D video mode. There are some more details in (#multi-planar-and-3d-videos)." - }, - 21433: { - name: "OldStereoMode", - level: 4, - type: "u", - maxver: 0, - description: "DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska." - }, - 21440: { - name: "AlphaMode", - cppname: "VideoAlphaMode", - level: 4, - type: "u", - mandatory: true, - minver: 3, - webm: true, - "default": "0", - description: 'Indicate whether the BlockAdditional Element with BlockAddID of "1" contains Alpha data, as defined by to the Codec Mapping for the `CodecID`. Undefined values **SHOULD NOT** be used as the behavior of known implementations is different (considered either as 0 or 1).' - }, - 21674: { - name: "PixelCropBottom", - cppname: "VideoPixelCropBottom", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove at the bottom of the image." - }, - 21680: { - name: "DisplayWidth", - cppname: "VideoDisplayWidth", - level: 4, - type: "u", - range: "not 0", - description: "Width of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)." - }, - 21682: { - name: "DisplayUnit", - cppname: "VideoDisplayUnit", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "How DisplayWidth & DisplayHeight are interpreted." - }, - 21683: { - name: "AspectRatioType", - cppname: "VideoAspectRatio", - level: 4, - type: "u", - minver: 0, - maxver: 0, - "default": "0", - description: "Specify the possible modifications to the aspect ratio." - }, - 21690: { - name: "DisplayHeight", - cppname: "VideoDisplayHeight", - level: 4, - type: "u", - range: "not 0", - description: "Height of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)." - }, - 21691: { - name: "PixelCropTop", - cppname: "VideoPixelCropTop", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove at the top of the image." - }, - 21708: { - name: "PixelCropLeft", - cppname: "VideoPixelCropLeft", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove on the left of the image." - }, - 21725: { - name: "PixelCropRight", - cppname: "VideoPixelCropRight", - level: 4, - type: "u", - mandatory: true, - "default": "0", - description: "The number of video pixels to remove on the right of the image." - }, - 21930: { - name: "FlagForced", - cppname: "TrackFlagForced", - level: 3, - type: "u", - mandatory: true, - "default": "0", - range: "0-1", - description: "Applies only to subtitles. Set if that track **SHOULD** be eligible for automatic selection by the player if it matches the user's language preference, even if the user's preferences would normally not enable subtitles with the selected audio track; this can be used for tracks containing only translations of foreign-language audio or onscreen text. See (#default-track-selection) for more details." - }, - 21931: { - name: "FlagHearingImpaired", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is suitable for users with hearing impairments, set to 0 if it is unsuitable for users with hearing impairments." - }, - 21932: { - name: "FlagVisualImpaired", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is suitable for users with visual impairments, set to 0 if it is unsuitable for users with visual impairments." - }, - 21933: { - name: "FlagTextDescriptions", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track contains textual descriptions of video content, set to 0 if that track does not contain textual descriptions of video content." - }, - 21934: { - name: "FlagOriginal", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track is in the content's original language, set to 0 if it is a translation." - }, - 21935: { - name: "FlagCommentary", - level: 3, - type: "u", - minver: 4, - range: "0-1", - description: "Set to 1 if that track contains commentary, set to 0 if it does not contain commentary." - }, - 21936: { - name: "Colour", - cppname: "VideoColour", - level: 4, - type: "m", - minver: 4, - webm: true, - description: "Settings describing the colour format." - }, - 21937: { - name: "MatrixCoefficients", - cppname: "VideoColourMatrix", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273." - }, - 21938: { - name: "BitsPerChannel", - cppname: "VideoBitsPerChannel", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Number of decoded bits per channel. A value of 0 indicates that the BitsPerChannel is unspecified." - }, - 21939: { - name: "ChromaSubsamplingHorz", - cppname: "VideoChromaSubsampHorz", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cr and Cb channels for every pixel not removed horizontally. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1." - }, - 21940: { - name: "ChromaSubsamplingVert", - cppname: "VideoChromaSubsampVert", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cr and Cb channels for every pixel not removed vertically. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingVert **SHOULD** be set to 1." - }, - 21941: { - name: "CbSubsamplingHorz", - cppname: "VideoCbSubsampHorz", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cb channel for every pixel not removed horizontally. This is additive with ChromaSubsamplingHorz. Example: For video with 4:2:1 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1 and CbSubsamplingHorz **SHOULD** be set to 1." - }, - 21942: { - name: "CbSubsamplingVert", - cppname: "VideoCbSubsampVert", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "The amount of pixels to remove in the Cb channel for every pixel not removed vertically. This is additive with ChromaSubsamplingVert." - }, - 21943: { - name: "ChromaSitingHorz", - cppname: "VideoChromaSitHorz", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "How chroma is subsampled horizontally." - }, - 21944: { - name: "ChromaSitingVert", - cppname: "VideoChromaSitVert", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "How chroma is subsampled vertically." - }, - 21945: { - name: "Range", - cppname: "VideoColourRange", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Clipping of the color ranges." - }, - 21946: { - name: "TransferCharacteristics", - cppname: "VideoColourTransferCharacter", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics are adopted from Table 3 of ISO/IEC 23091-4 or ITU-T H.273." - }, - 21947: { - name: "Primaries", - cppname: "VideoColourPrimaries", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "2", - description: "The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273." - }, - 21948: { - name: "MaxCLL", - cppname: "VideoColourMaxCLL", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "Maximum brightness of a single pixel (Maximum Content Light Level) in candelas per square meter (cd/m^2^)." - }, - 21949: { - name: "MaxFALL", - cppname: "VideoColourMaxFALL", - level: 5, - type: "u", - minver: 4, - webm: true, - description: "Maximum brightness of a single full frame (Maximum Frame-Average Light Level) in candelas per square meter (cd/m^2^)." - }, - 21968: { - name: "MasteringMetadata", - cppname: "VideoColourMasterMeta", - level: 5, - type: "m", - minver: 4, - webm: true, - description: "SMPTE 2086 mastering data." - }, - 21969: { - name: "PrimaryRChromaticityX", - cppname: "VideoRChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Red X chromaticity coordinate, as defined by CIE 1931." - }, - 21970: { - name: "PrimaryRChromaticityY", - cppname: "VideoRChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Red Y chromaticity coordinate, as defined by CIE 1931." - }, - 21971: { - name: "PrimaryGChromaticityX", - cppname: "VideoGChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Green X chromaticity coordinate, as defined by CIE 1931." - }, - 21972: { - name: "PrimaryGChromaticityY", - cppname: "VideoGChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Green Y chromaticity coordinate, as defined by CIE 1931." - }, - 21973: { - name: "PrimaryBChromaticityX", - cppname: "VideoBChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Blue X chromaticity coordinate, as defined by CIE 1931." - }, - 21974: { - name: "PrimaryBChromaticityY", - cppname: "VideoBChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "Blue Y chromaticity coordinate, as defined by CIE 1931." - }, - 21975: { - name: "WhitePointChromaticityX", - cppname: "VideoWhitePointChromaX", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "White X chromaticity coordinate, as defined by CIE 1931." - }, - 21976: { - name: "WhitePointChromaticityY", - cppname: "VideoWhitePointChromaY", - level: 6, - type: "f", - minver: 4, - webm: true, - range: "0-1", - description: "White Y chromaticity coordinate, as defined by CIE 1931." - }, - 21977: { - name: "LuminanceMax", - cppname: "VideoLuminanceMax", - level: 6, - type: "f", - minver: 4, - webm: true, - range: ">= 0x0p+0", - description: "Maximum luminance. Represented in candelas per square meter (cd/m^2^)." - }, - 21978: { - name: "LuminanceMin", - cppname: "VideoLuminanceMin", - level: 6, - type: "f", - minver: 4, - webm: true, - range: ">= 0x0p+0", - description: "Minimum luminance. Represented in candelas per square meter (cd/m^2^)." - }, - 21998: { - name: "MaxBlockAdditionID", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "The maximum value of BlockAddID ((#blockaddid-element)). A value 0 means there is no BlockAdditions ((#blockadditions-element)) for this track." - }, - 22100: { - name: "ChapterStringUID", - level: 4, - type: "8", - minver: 3, - webm: true, - description: "A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage [@!WebVTT]." - }, - 22186: { - name: "CodecDelay", - level: 3, - type: "u", - mandatory: true, - minver: 4, - webm: true, - description: "CodecDelay is The codec-built-in delay, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). It represents the amount of codec samples that will be discarded by the decoder during playback. This timestamp value **MUST** be subtracted from each frame timestamp in order to get the timestamp that will be actually played. The value **SHOULD** be small so the muxing of tracks with the same actual timestamp are in the same Cluster." - }, - 22203: { - name: "SeekPreRoll", - level: 3, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "After a discontinuity, SeekPreRoll is the duration of the data the decoder **MUST** decode before the decoded data is valid, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)." - }, - 22337: { - name: "WritingApp", - level: 2, - type: "8", - mandatory: true, - description: 'Writing application (example: "mkvmerge-0.3.3").' - }, - 22612: { - name: "SilentTracks", - cppname: "ClusterSilentTracks", - level: 2, - type: "m", - minver: 0, - maxver: 0, - description: "The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking or to decide what track to use." - }, - 22743: { - name: "SilentTrackNumber", - cppname: "ClusterSilentTrackNumber", - level: 3, - type: "u", - multiple: true, - minver: 0, - maxver: 0, - description: "One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster." - }, - 24999: { - name: "AttachedFile", - cppname: "Attached", - level: 2, - type: "m", - mandatory: true, - multiple: true, - description: "An attached file." - }, - 25152: { - name: "ContentEncoding", - level: 4, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Settings for one content encoding like compression or encryption." - }, - 25188: { - name: "BitDepth", - cppname: "AudioBitDepth", - level: 4, - type: "u", - range: "not 0", - description: "Bits per sample, mostly used for PCM." - }, - 25506: { - name: "CodecPrivate", - level: 3, - type: "b", - description: "Private data only known to the codec." - }, - 25536: { - name: "Targets", - cppname: "TagTargets", - level: 3, - type: "m", - mandatory: true, - webm: true, - description: "Specifies which other elements the metadata represented by the Tag applies to. If empty or not present, then the Tag describes everything in the Segment." - }, - 25539: { - name: "ChapterPhysicalEquiv", - level: 4, - type: "u", - description: 'Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50); see (#physical-types) for a complete list of values.' - }, - 25540: { - name: "TagChapterUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the Chapter(s) the tags belong to." - }, - 25541: { - name: "TagTrackUID", - level: 4, - type: "u", - multiple: true, - webm: true, - "default": "0", - description: "A unique ID to identify the Track(s) the tags belong to." - }, - 25542: { - name: "TagAttachmentUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the Attachment(s) the tags belong to." - }, - 25545: { - name: "TagEditionUID", - level: 4, - type: "u", - multiple: true, - "default": "0", - description: "A unique ID to identify the EditionEntry(s) the tags belong to." - }, - 25546: { - name: "TargetType", - cppname: "TagTargetType", - level: 4, - type: "s", - webm: true, - description: 'An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc ; see Section 6.4 of [@!MatroskaTags].' - }, - 25906: { - name: "SignedElement", - level: 3, - type: "b", - multiple: true, - webm: false, - description: "An element ID whose data will be used to compute the signature." - }, - 26148: { - name: "TrackTranslate", - level: 3, - type: "m", - multiple: true, - description: "The mapping between this `TrackEntry` and a track value in the given Chapter Codec." - }, - 26277: { - name: "TrackTranslateTrackID", - level: 4, - type: "b", - mandatory: true, - description: "The binary value used to represent this `TrackEntry` in the chapter codec data. The format depends on the `ChapProcessCodecID` used; see (#chapprocesscodecid-element)." - }, - 26303: { - name: "TrackTranslateCodec", - level: 4, - type: "u", - mandatory: true, - description: "This `TrackTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)." - }, - 26364: { - name: "TrackTranslateEditionUID", - level: 4, - type: "u", - multiple: true, - description: "Specify a chapter edition UID on which this `TrackTranslate` applies." - }, - 26568: { - name: "SimpleTag", - cppname: "TagSimple", - level: 3, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "Contains general information about the target." - }, - 26826: { - name: "TargetTypeValue", - cppname: "TagTargetTypeValue", - level: 4, - type: "u", - mandatory: true, - webm: true, - "default": "50", - description: "A number to indicate the logical level of the target." - }, - 26897: { - name: "ChapProcessCommand", - cppname: "ChapterProcessCommand", - level: 5, - type: "m", - multiple: true, - description: "Contains all the commands associated to the Atom." - }, - 26914: { - name: "ChapProcessTime", - cppname: "ChapterProcessTime", - level: 6, - type: "u", - mandatory: true, - description: "Defines when the process command **SHOULD** be handled" - }, - 26916: { - name: "ChapterTranslate", - level: 2, - type: "m", - multiple: true, - description: "The mapping between this `Segment` and a segment value in the given Chapter Codec." - }, - 26931: { - name: "ChapProcessData", - cppname: "ChapterProcessData", - level: 6, - type: "b", - mandatory: true, - description: "Contains the command information. The data **SHOULD** be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands; see (#menu-features) on DVD menus." - }, - 26948: { - name: "ChapProcess", - cppname: "ChapterProcess", - level: 4, - type: "m", - multiple: true, - description: "Contains all the commands associated to the Atom." - }, - 26965: { - name: "ChapProcessCodecID", - cppname: "ChapterProcessCodecID", - level: 5, - type: "u", - mandatory: true, - "default": "0", - description: "Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used; see (#menu-features) on DVD menus. More codec IDs can be added later." - }, - 27045: { - name: "ChapterTranslateID", - level: 3, - type: "b", - mandatory: true, - description: "The binary value used to represent this Segment in the chapter codec data. The format depends on the ChapProcessCodecID used; see (#chapprocesscodecid-element)." - }, - 27071: { - name: "ChapterTranslateCodec", - level: 3, - type: "u", - mandatory: true, - description: "This `ChapterTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)." - }, - 27132: { - name: "ChapterTranslateEditionUID", - level: 3, - type: "u", - multiple: true, - description: "Specify a chapter edition UID on which this `ChapterTranslate` applies." - }, - 28032: { - name: "ContentEncodings", - level: 3, - type: "m", - webm: true, - description: "Settings for several content encoding mechanisms like compression or encryption." - }, - 28135: { - name: "MinCache", - cppname: "TrackMinCache", - level: 3, - type: "u", - mandatory: true, - "default": "0", - description: "The minimum number of frames a player **SHOULD** be able to cache during playback. If set to 0, the reference pseudo-cache system is not used." - }, - 28152: { - name: "MaxCache", - cppname: "TrackMaxCache", - level: 3, - type: "u", - description: "The maximum cache size necessary to store referenced frames in and the current frame. 0 means no cache is needed." - }, - 28263: { - name: "ChapterSegmentUID", - level: 4, - type: "b", - range: ">0", - description: "The SegmentUID of another Segment to play during this chapter." - }, - 28348: { - name: "ChapterSegmentEditionUID", - level: 4, - type: "u", - range: "not 0", - description: "The EditionUID to play from the Segment linked in ChapterSegmentUID. If ChapterSegmentEditionUID is undeclared, then no Edition of the linked Segment is used; see (#medium-linking) on medium-linking Segments." - }, - 28587: { - name: "TrackOverlay", - level: 3, - type: "u", - multiple: true, - description: "Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap, see (#silenttracks-element) on SilentTracks, the overlay track **SHOULD** be used instead. The order of multiple TrackOverlay matters, the first one is the one that **SHOULD** be used. If not found it **SHOULD** be the second, etc." - }, - 29555: { - name: "Tag", - level: 2, - type: "m", - mandatory: true, - multiple: true, - webm: true, - description: "A single metadata descriptor." - }, - 29572: { - name: "SegmentFilename", - level: 2, - type: "8", - description: "A filename corresponding to this Segment." - }, - 29604: { - name: "SegmentUID", - level: 2, - type: "b", - range: "not 0", - description: "A randomly generated unique ID to identify the Segment amongst many others (128 bits)." - }, - 29636: { - name: "ChapterUID", - level: 4, - type: "u", - mandatory: true, - webm: true, - range: "not 0", - description: "A unique ID to identify the Chapter." - }, - 29637: { - name: "TrackUID", - level: 3, - type: "u", - mandatory: true, - range: "not 0", - description: "A unique ID to identify the Track." - }, - 29766: { - name: "AttachmentLink", - cppname: "TrackAttachmentLink", - level: 3, - type: "u", - maxver: 3, - range: "not 0", - description: "The UID of an attachment that is used by this codec." - }, - 30113: { - name: "BlockAdditions", - level: 3, - type: "m", - webm: true, - description: "Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data." - }, - 30114: { - name: "DiscardPadding", - level: 3, - type: "i", - minver: 4, - webm: true, - description: "Duration of the silent data added to the Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and **SHOULD** be discarded during playback." - }, - 30320: { - name: "Projection", - cppname: "VideoProjection", - level: 4, - type: "m", - minver: 4, - webm: true, - description: "Describes the video projection details. Used to render spherical, VR videos or flipping videos horizontally/vertically." - }, - 30321: { - name: "ProjectionType", - cppname: "VideoProjectionType", - level: 5, - type: "u", - mandatory: true, - minver: 4, - webm: true, - "default": "0", - description: "Describes the projection used for this video track." - }, - 30322: { - name: "ProjectionPrivate", - cppname: "VideoProjectionPrivate", - level: 5, - type: "b", - minver: 4, - webm: true, - description: "Private data that only applies to a specific projection. * If `ProjectionType` equals 0 (Rectangular), then this element must not be present. * If `ProjectionType` equals 1 (Equirectangular), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Equirectangular Projection Box ('equi'). * If `ProjectionType` equals 2 (Cubemap), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Cubemap Projection Box ('cbmp'). * If `ProjectionType` equals 3 (Mesh), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Mesh Projection Box ('mshp')." - }, - 30323: { - name: "ProjectionPoseYaw", - cppname: "VideoProjectionPoseYaw", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0xB4p+0, <= 0xB4p+0", - description: "Specifies a yaw rotation to the projection. Value represents a clockwise rotation, in degrees, around the up vector. This rotation must be applied before any `ProjectionPosePitch` or `ProjectionPoseRoll` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseYaw` to 180 or -180 degrees, with the `ProjectionPoseRoll` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally." - }, - 30324: { - name: "ProjectionPosePitch", - cppname: "VideoProjectionPosePitch", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0x5Ap+0, <= 0x5Ap+0", - description: "Specifies a pitch rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the right vector. This rotation must be applied after the `ProjectionPoseYaw` rotation and before the `ProjectionPoseRoll` rotation. The value of this element **MUST** be in the -90 to 90 degree range, both included." - }, - 30325: { - name: "ProjectionPoseRoll", - cppname: "VideoProjectionPoseRoll", - level: 5, - type: "f", - mandatory: true, - minver: 4, - webm: true, - "default": "0x0p+0", - range: ">= -0xB4p+0, <= 0xB4p+0", - description: "Specifies a roll rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the forward vector. This rotation must be applied after the `ProjectionPoseYaw` and `ProjectionPosePitch` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseRoll` to 180 or -180 degrees, the `ProjectionPoseYaw` to 180 or -180 degrees with `ProjectionPosePitch` set to 0 degrees flips the image vertically. Setting `ProjectionPoseRoll` to 180 or -180 degrees, with the `ProjectionPoseYaw` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally and vertically." - }, - 30901: { - name: "OutputSamplingFrequency", - cppname: "AudioOutputSamplingFreq", - level: 4, - type: "f", - range: "> 0x0p+0", - description: "Real output sampling frequency in Hz (used for SBR techniques)." - }, - 31657: { - name: "Title", - level: 2, - type: "8", - webm: true, - description: "General name of the Segment." - }, - 32123: { - name: "ChannelPositions", - cppname: "AudioPosition", - level: 4, - type: "b", - minver: 0, - maxver: 0, - description: "Table of horizontal angles for each successive channel." - }, - 32347: { - name: "SignatureElements", - level: 1, - type: "m", - webm: false, - description: "Contains elements that will be used to compute the signature." - }, - 32379: { - name: "SignatureElementList", - level: 2, - type: "m", - multiple: true, - webm: false, - i: "Cluster|Block|BlockAdditional", - description: "A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption." - }, - 32394: { - name: "SignatureAlgo", - level: 1, - type: "u", - webm: false, - description: "Signature algorithm used (1=RSA, 2=elliptic)." - }, - 32410: { - name: "SignatureHash", - level: 1, - type: "u", - webm: false, - description: "Hash algorithm used (1=SHA1-160, 2=MD5)." - }, - 32421: { - name: "SignaturePublicKey", - level: 1, - type: "b", - webm: false, - description: "The public key to use with the algorithm (in the case of a PKI-based signature)." - }, - 32437: { - name: "Signature", - level: 1, - type: "b", - webm: false, - description: "The signature of the data (until a new." - }, - 2274716: { - name: "Language", - cppname: "TrackLanguage", - level: 3, - type: "s", - mandatory: true, - "default": "eng", - description: "Specifies the language of the track in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the LanguageIETF Element is used in the same TrackEntry." - }, - 2274717: { - name: "LanguageIETF", - level: 3, - type: "s", - minver: 4, - description: "Specifies the language of the track according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any Language Elements used in the same TrackEntry **MUST** be ignored." - }, - 2306383: { - name: "TrackTimestampScale", - cppname: "TrackTimecodeScale", - level: 3, - type: "f", - mandatory: true, - maxver: 3, - "default": "0x1p+0", - range: "> 0x0p+0", - description: "DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs)." - }, - 2313850: { - name: "DefaultDecodedFieldDuration", - cppname: "TrackDefaultDecodedFieldDuration", - level: 3, - type: "u", - minver: 4, - range: "not 0", - description: "The period between two successive fields at the output of the decoding process, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). see (#defaultdecodedfieldduration) for more information" - }, - 2327523: { - name: "FrameRate", - cppname: "VideoFrameRate", - level: 4, - type: "f", - minver: 0, - maxver: 0, - range: "> 0x0p+0", - description: "Number of frames per second. This value is Informational only. It is intended for constant frame rate streams, and **SHOULD NOT** be used for a variable frame rate TrackEntry." - }, - 2352003: { - name: "DefaultDuration", - cppname: "TrackDefaultDuration", - level: 3, - type: "u", - range: "not 0", - description: "Number of nanoseconds per frame, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (frame in the Matroska sense -- one Element put into a (Simple)Block)." - }, - 2459272: { - name: "CodecName", - level: 3, - type: "8", - description: "A human-readable string specifying the codec." - }, - 2536e3: { - name: "CodecDownloadURL", - level: 3, - type: "s", - multiple: true, - minver: 0, - maxver: 0, - description: "A URL to download about the codec used." - }, - 2807729: { - name: "TimestampScale", - cppname: "TimecodeScale", - level: 2, - type: "u", - mandatory: true, - "default": "1000000", - range: "not 0", - description: "Base unit for Segment Ticks and Track Ticks, in nanoseconds. A TimestampScale value of 1.000.000 means scaled timestamps in the Segment are expressed in milliseconds; see (#timestamps) on how to interpret timestamps." - }, - 2807730: { - name: "TimecodeScaleDenominator", - level: 2, - type: "u", - mandatory: true, - minver: 4, - "default": "1000000000", - description: "Timestamp scale numerator, see TimecodeScale." - }, - 3061028: { - name: "UncompressedFourCC", - cppname: "VideoColourSpace", - level: 4, - type: "b", - description: "Specify the uncompressed pixel format used for the Track's data as a FourCC. This value is similar in scope to the biCompression value of AVI's `BITMAPINFO` [@?AVIFormat]. See the YUV video formats [@?FourCC-YUV] and RGB video formats [@?FourCC-RGB] for common values." - }, - 3126563: { - name: "GammaValue", - cppname: "VideoGamma", - level: 4, - type: "f", - minver: 0, - maxver: 0, - range: "> 0x0p+0", - description: "Gamma Value." - }, - 3839639: { - name: "CodecSettings", - level: 3, - type: "8", - minver: 0, - maxver: 0, - description: "A string describing the encoding setting used." - }, - 3883072: { - name: "CodecInfoURL", - level: 3, - type: "s", - multiple: true, - minver: 0, - maxver: 0, - description: "A URL to find information about the codec used." - }, - 3965867: { - name: "PrevFilename", - level: 2, - type: "8", - description: "A filename corresponding to the file of the previous Linked Segment." - }, - 3979555: { - name: "PrevUID", - level: 2, - type: "b", - description: "A unique ID to identify the previous Segment of a Linked Segment (128 bits)." - }, - 4096955: { - name: "NextFilename", - level: 2, - type: "8", - description: "A filename corresponding to the file of the next Linked Segment." - }, - 4110627: { - name: "NextUID", - level: 2, - type: "b", - description: "A unique ID to identify the next Segment of a Linked Segment (128 bits)." - }, - 272869232: { - name: "Chapters", - level: 1, - type: "m", - webm: true, - description: "A system to define basic menus and partition data. For more detailed information, look at the Chapters explanation in (#chapters)." - }, - 290298740: { - name: "SeekHead", - level: 1, - type: "m", - multiple: true, - description: "Contains the Segment Position of other Top-Level Elements." - }, - 307544935: { - name: "Tags", - level: 1, - type: "m", - multiple: true, - webm: true, - description: "Element containing metadata describing Tracks, Editions, Chapters, Attachments, or the Segment as a whole. A list of valid tags can be found in [@!MatroskaTags]." - }, - 357149030: { - name: "Info", - level: 1, - type: "m", - mandatory: true, - description: "Contains general information about the Segment." - }, - 374648427: { - name: "Tracks", - level: 1, - type: "m", - description: "A Top-Level Element of information with many tracks described." - }, - 408125543: { - name: "Segment", - level: 0, - type: "m", - mandatory: true, - description: "The Root Element that contains all other Top-Level Elements (Elements defined only at Level 1). A Matroska file is composed of 1 Segment." - }, - 423732329: { - name: "Attachments", - level: 1, - type: "m", - description: "Contain attached files." - }, - 440786851: { - name: "EBML", - level: "0", - type: "m", - mandatory: true, - multiple: true, - minver: 1, - description: "Set the EBML characteristics of the data to follow. Each EBML document has to start with this." - }, - 458458727: { - name: "SignatureSlot", - level: -1, - type: "m", - multiple: true, - webm: false, - description: "Contain signature of some (coming) elements in the stream." - }, - 475249515: { - name: "Cues", - level: 1, - type: "m", - description: "A Top-Level Element to speed seeking access. All entries are local to the Segment." - }, - 524531317: { - name: "Cluster", - level: 1, - type: "m", - multiple: true, - description: "The Top-Level Element containing the (monolithic) Block structure." - } - }; - var byName = {}; - var schema = { - byEbmlID, - byName - }; - for (ebmlID in byEbmlID) { - desc = byEbmlID[ebmlID]; - byName[desc.name.replace("-", "_")] = parseInt(ebmlID, 10); - } - var desc; - var ebmlID; - module.exports = schema; - } - }); - - // node_modules/ts-ebml/lib/EBMLEncoder.js - var require_EBMLEncoder = __commonJS({ - "node_modules/ts-ebml/lib/EBMLEncoder.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var tools = require_tools2(); - var tools_1 = require_tools2(); - var schema = require_schema(); - var byEbmlID = schema.byEbmlID; - var EBMLEncoder = function() { - function EBMLEncoder2() { - this._schema = byEbmlID; - this._buffers = []; - this._stack = []; - } - EBMLEncoder2.prototype.encode = function(elms) { - var _this = this; - return tools.concat(elms.reduce(function(lst, elm) { - return lst.concat(_this.encodeChunk(elm)); - }, [])).buffer; - }; - EBMLEncoder2.prototype.encodeChunk = function(elm) { - if (elm.type === "m") { - if (!elm.isEnd) { - this.startTag(elm); - } else { - this.endTag(elm); - } - } else { - this.writeTag(elm); - } - return this.flush(); - }; - EBMLEncoder2.prototype.flush = function() { - var ret = this._buffers; - this._buffers = []; - return ret; - }; - EBMLEncoder2.prototype.getSchemaInfo = function(tagName) { - var tagNums = Object.keys(this._schema).map(Number); - for (var i = 0; i < tagNums.length; i++) { - var tagNum = tagNums[i]; - if (this._schema[tagNum].name === tagName) { - return new tools_1.Buffer(tagNum.toString(16), "hex"); - } - } - return null; - }; - EBMLEncoder2.prototype.writeTag = function(elm) { - var tagName = elm.name; - var tagId = this.getSchemaInfo(tagName); - var tagData = elm.data; - if (tagId == null) { - throw new Error("No schema entry found for " + tagName); - } - var data = tools.encodeTag(tagId, tagData); - if (this._stack.length > 0) { - var last = this._stack[this._stack.length - 1]; - last.children.push({ - tagId, - elm, - children: [], - data - }); - return; - } - this._buffers = this._buffers.concat(data); - return; - }; - EBMLEncoder2.prototype.startTag = function(elm) { - var tagName = elm.name; - var tagId = this.getSchemaInfo(tagName); - if (tagId == null) { - throw new Error("No schema entry found for " + tagName); - } - if (elm.unknownSize) { - var data = tools.encodeTag(tagId, new tools_1.Buffer(0), elm.unknownSize); - this._buffers = this._buffers.concat(data); - return; - } - var tag = { - tagId, - elm, - children: [], - data: null - }; - if (this._stack.length > 0) { - this._stack[this._stack.length - 1].children.push(tag); - } - this._stack.push(tag); - }; - EBMLEncoder2.prototype.endTag = function(elm) { - var tagName = elm.name; - var tag = this._stack.pop(); - if (tag == null) { - throw new Error("EBML structure is broken"); - } - if (tag.elm.name !== elm.name) { - throw new Error("EBML structure is broken"); - } - var childTagDataBuffers = tag.children.reduce(function(lst, child) { - if (child.data === null) { - throw new Error("EBML structure is broken"); - } - return lst.concat(child.data); - }, []); - var childTagDataBuffer = tools.concat(childTagDataBuffers); - if (tag.elm.type === "m") { - tag.data = tools.encodeTag(tag.tagId, childTagDataBuffer, tag.elm.unknownSize); - } else { - tag.data = tools.encodeTag(tag.tagId, childTagDataBuffer); - } - if (this._stack.length < 1) { - this._buffers = this._buffers.concat(tag.data); - } - }; - return EBMLEncoder2; - }(); - exports.default = EBMLEncoder; - } - }); - - // node_modules/ts-ebml/node_modules/buffer/index.js - var require_buffer2 = __commonJS({ - "node_modules/ts-ebml/node_modules/buffer/index.js"(exports) { - "use strict"; - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var base64 = require_base64_js(); - var ieee7542 = require_ieee754(); - var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer18; - exports.SlowBuffer = SlowBuffer; - exports.INSPECT_MAX_BYTES = 50; - var K_MAX_LENGTH = 2147483647; - exports.kMaxLength = K_MAX_LENGTH; - Buffer18.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer18.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { - console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); - } - function typedArraySupport() { - try { - var arr = new Uint8Array(1); - var proto = { foo: function() { - return 42; - } }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; - } - } - Object.defineProperty(Buffer18.prototype, "parent", { - enumerable: true, - get: function() { - if (!Buffer18.isBuffer(this)) - return void 0; - return this.buffer; - } - }); - Object.defineProperty(Buffer18.prototype, "offset", { - enumerable: true, - get: function() { - if (!Buffer18.isBuffer(this)) - return void 0; - return this.byteOffset; - } - }); - function createBuffer(length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"'); - } - var buf2 = new Uint8Array(length); - Object.setPrototypeOf(buf2, Buffer18.prototype); - return buf2; - } - function Buffer18(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - if (typeof encodingOrOffset === "string") { - throw new TypeError('The "string" argument must be of type string. Received type number'); - } - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); - } - Buffer18.poolSize = 8192; - function from(value, encodingOrOffset, length) { - if (typeof value === "string") { - return fromString(value, encodingOrOffset); - } - if (ArrayBuffer.isView(value)) { - return fromArrayView(value); - } - if (value == null) { - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof value === "number") { - throw new TypeError('The "value" argument must not be of type number. Received type number'); - } - var valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) { - return Buffer18.from(valueOf, encodingOrOffset, length); - } - var b = fromObject(value); - if (b) - return b; - if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer18.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); - } - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - Buffer18.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); - }; - Object.setPrototypeOf(Buffer18.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer18, Uint8Array); - function assertSize(size) { - if (typeof size !== "number") { - throw new TypeError('"size" argument must be of type number'); - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"'); - } - } - function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) { - return createBuffer(size); - } - if (fill !== void 0) { - return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - } - return createBuffer(size); - } - Buffer18.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); - }; - function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); - } - Buffer18.allocUnsafe = function(size) { - return allocUnsafe(size); - }; - Buffer18.allocUnsafeSlow = function(size) { - return allocUnsafe(size); - }; - function fromString(string, encoding) { - if (typeof encoding !== "string" || encoding === "") { - encoding = "utf8"; - } - if (!Buffer18.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - var length = byteLength(string, encoding) | 0; - var buf2 = createBuffer(length); - var actual = buf2.write(string, encoding); - if (actual !== length) { - buf2 = buf2.slice(0, actual); - } - return buf2; - } - function fromArrayLike(array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0; - var buf2 = createBuffer(length); - for (var i = 0; i < length; i += 1) { - buf2[i] = array[i] & 255; - } - return buf2; - } - function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - var copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); - } - function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds'); - } - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds'); - } - var buf2; - if (byteOffset === void 0 && length === void 0) { - buf2 = new Uint8Array(array); - } else if (length === void 0) { - buf2 = new Uint8Array(array, byteOffset); - } else { - buf2 = new Uint8Array(array, byteOffset, length); - } - Object.setPrototypeOf(buf2, Buffer18.prototype); - return buf2; - } - function fromObject(obj) { - if (Buffer18.isBuffer(obj)) { - var len = checked(obj.length) | 0; - var buf2 = createBuffer(len); - if (buf2.length === 0) { - return buf2; - } - obj.copy(buf2, 0, 0, len); - return buf2; - } - if (obj.length !== void 0) { - if (typeof obj.length !== "number" || numberIsNaN(obj.length)) { - return createBuffer(0); - } - return fromArrayLike(obj); - } - if (obj.type === "Buffer" && Array.isArray(obj.data)) { - return fromArrayLike(obj.data); - } - } - function checked(length) { - if (length >= K_MAX_LENGTH) { - throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes"); - } - return length | 0; - } - function SlowBuffer(length) { - if (+length != length) { - length = 0; - } - return Buffer18.alloc(+length); - } - Buffer18.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer18.prototype; - }; - Buffer18.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) - a = Buffer18.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) - b = Buffer18.from(b, b.offset, b.byteLength); - if (!Buffer18.isBuffer(a) || !Buffer18.isBuffer(b)) { - throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - } - if (a === b) - return 0; - var x = a.length; - var y = b.length; - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) - return -1; - if (y < x) - return 1; - return 0; - }; - Buffer18.isEncoding = function isEncoding(encoding) { - switch (String(encoding).toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "latin1": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return true; - default: - return false; - } - }; - Buffer18.concat = function concat(list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } - if (list.length === 0) { - return Buffer18.alloc(0); - } - var i; - if (length === void 0) { - length = 0; - for (i = 0; i < list.length; ++i) { - length += list[i].length; - } - } - var buffer = Buffer18.allocUnsafe(length); - var pos = 0; - for (i = 0; i < list.length; ++i) { - var buf2 = list[i]; - if (isInstance(buf2, Uint8Array)) { - if (pos + buf2.length > buffer.length) { - Buffer18.from(buf2).copy(buffer, pos); - } else { - Uint8Array.prototype.set.call(buffer, buf2, pos); - } - } else if (!Buffer18.isBuffer(buf2)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } else { - buf2.copy(buffer, pos); - } - pos += buf2.length; - } - return buffer; - }; - function byteLength(string, encoding) { - if (Buffer18.isBuffer(string)) { - return string.length; - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength; - } - if (typeof string !== "string") { - throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - } - var len = string.length; - var mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) - return 0; - var loweredCase = false; - for (; ; ) { - switch (encoding) { - case "ascii": - case "latin1": - case "binary": - return len; - case "utf8": - case "utf-8": - return utf8ToBytes(string).length; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return len * 2; - case "hex": - return len >>> 1; - case "base64": - return base64ToBytes(string).length; - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length; - } - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - } - Buffer18.byteLength = byteLength; - function slowToString(encoding, start, end) { - var loweredCase = false; - if (start === void 0 || start < 0) { - start = 0; - } - if (start > this.length) { - return ""; - } - if (end === void 0 || end > this.length) { - end = this.length; - } - if (end <= 0) { - return ""; - } - end >>>= 0; - start >>>= 0; - if (end <= start) { - return ""; - } - if (!encoding) - encoding = "utf8"; - while (true) { - switch (encoding) { - case "hex": - return hexSlice(this, start, end); - case "utf8": - case "utf-8": - return utf8Slice(this, start, end); - case "ascii": - return asciiSlice(this, start, end); - case "latin1": - case "binary": - return latin1Slice(this, start, end); - case "base64": - return base64Slice(this, start, end); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return utf16leSlice(this, start, end); - default: - if (loweredCase) - throw new TypeError("Unknown encoding: " + encoding); - encoding = (encoding + "").toLowerCase(); - loweredCase = true; - } - } - } - Buffer18.prototype._isBuffer = true; - function swap(b, n, m) { - var i = b[n]; - b[n] = b[m]; - b[m] = i; - } - Buffer18.prototype.swap16 = function swap16() { - var len = this.length; - if (len % 2 !== 0) { - throw new RangeError("Buffer size must be a multiple of 16-bits"); - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1); - } - return this; - }; - Buffer18.prototype.swap32 = function swap32() { - var len = this.length; - if (len % 4 !== 0) { - throw new RangeError("Buffer size must be a multiple of 32-bits"); - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3); - swap(this, i + 1, i + 2); - } - return this; - }; - Buffer18.prototype.swap64 = function swap64() { - var len = this.length; - if (len % 8 !== 0) { - throw new RangeError("Buffer size must be a multiple of 64-bits"); - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); - } - return this; - }; - Buffer18.prototype.toString = function toString2() { - var length = this.length; - if (length === 0) - return ""; - if (arguments.length === 0) - return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); - }; - Buffer18.prototype.toLocaleString = Buffer18.prototype.toString; - Buffer18.prototype.equals = function equals(b) { - if (!Buffer18.isBuffer(b)) - throw new TypeError("Argument must be a Buffer"); - if (this === b) - return true; - return Buffer18.compare(this, b) === 0; - }; - Buffer18.prototype.inspect = function inspect() { - var str = ""; - var max = exports.INSPECT_MAX_BYTES; - str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); - if (this.length > max) - str += " ... "; - return ""; - }; - if (customInspectSymbol) { - Buffer18.prototype[customInspectSymbol] = Buffer18.prototype.inspect; - } - Buffer18.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer18.from(target, target.offset, target.byteLength); - } - if (!Buffer18.isBuffer(target)) { - throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - } - if (start === void 0) { - start = 0; - } - if (end === void 0) { - end = target ? target.length : 0; - } - if (thisStart === void 0) { - thisStart = 0; - } - if (thisEnd === void 0) { - thisEnd = this.length; - } - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError("out of range index"); - } - if (thisStart >= thisEnd && start >= end) { - return 0; - } - if (thisStart >= thisEnd) { - return -1; - } - if (start >= end) { - return 1; - } - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) - return 0; - var x = thisEnd - thisStart; - var y = end - start; - var len = Math.min(x, y); - var thisCopy = this.slice(thisStart, thisEnd); - var targetCopy = target.slice(start, end); - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; - } - } - if (x < y) - return -1; - if (y < x) - return 1; - return 0; - }; - function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - if (buffer.length === 0) - return -1; - if (typeof byteOffset === "string") { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 2147483647) { - byteOffset = 2147483647; - } else if (byteOffset < -2147483648) { - byteOffset = -2147483648; - } - byteOffset = +byteOffset; - if (numberIsNaN(byteOffset)) { - byteOffset = dir ? 0 : buffer.length - 1; - } - if (byteOffset < 0) - byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) - return -1; - else - byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) - byteOffset = 0; - else - return -1; - } - if (typeof val === "string") { - val = Buffer18.from(val, encoding); - } - if (Buffer18.isBuffer(val)) { - if (val.length === 0) { - return -1; - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === "number") { - val = val & 255; - if (typeof Uint8Array.prototype.indexOf === "function") { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); - } - throw new TypeError("val must be string, number or Buffer"); - } - function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - var indexSize = 1; - var arrLength = arr.length; - var valLength = val.length; - if (encoding !== void 0) { - encoding = String(encoding).toLowerCase(); - if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { - if (arr.length < 2 || val.length < 2) { - return -1; - } - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read2(buf2, i2) { - if (indexSize === 1) { - return buf2[i2]; - } else { - return buf2.readUInt16BE(i2 * indexSize); - } - } - var i; - if (dir) { - var foundIndex = -1; - for (i = byteOffset; i < arrLength; i++) { - if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) - foundIndex = i; - if (i - foundIndex + 1 === valLength) - return foundIndex * indexSize; - } else { - if (foundIndex !== -1) - i -= i - foundIndex; - foundIndex = -1; - } - } - } else { - if (byteOffset + valLength > arrLength) - byteOffset = arrLength - valLength; - for (i = byteOffset; i >= 0; i--) { - var found = true; - for (var j = 0; j < valLength; j++) { - if (read2(arr, i + j) !== read2(val, j)) { - found = false; - break; - } - } - if (found) - return i; - } - } - return -1; - } - Buffer18.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; - }; - Buffer18.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); - }; - Buffer18.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); - }; - function hexWrite(buf2, string, offset, length) { - offset = Number(offset) || 0; - var remaining = buf2.length - offset; - if (!length) { - length = remaining; - } else { - length = Number(length); - if (length > remaining) { - length = remaining; - } - } - var strLen = string.length; - if (length > strLen / 2) { - length = strLen / 2; - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) - return i; - buf2[offset + i] = parsed; - } - return i; - } - function utf8Write(buf2, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf2.length - offset), buf2, offset, length); - } - function asciiWrite(buf2, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf2, offset, length); - } - function base64Write(buf2, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf2, offset, length); - } - function ucs2Write(buf2, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length); - } - Buffer18.prototype.write = function write2(string, offset, length, encoding) { - if (offset === void 0) { - encoding = "utf8"; - length = this.length; - offset = 0; - } else if (length === void 0 && typeof offset === "string") { - encoding = offset; - length = this.length; - offset = 0; - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === void 0) - encoding = "utf8"; - } else { - encoding = length; - length = void 0; - } - } else { - throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); - } - var remaining = this.length - offset; - if (length === void 0 || length > remaining) - length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { - throw new RangeError("Attempt to write outside buffer bounds"); - } - if (!encoding) - encoding = "utf8"; - var loweredCase = false; - for (; ; ) { - switch (encoding) { - case "hex": - return hexWrite(this, string, offset, length); - case "utf8": - case "utf-8": - return utf8Write(this, string, offset, length); - case "ascii": - case "latin1": - case "binary": - return asciiWrite(this, string, offset, length); - case "base64": - return base64Write(this, string, offset, length); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) - throw new TypeError("Unknown encoding: " + encoding); - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - }; - Buffer18.prototype.toJSON = function toJSON() { - return { - type: "Buffer", - data: Array.prototype.slice.call(this._arr || this, 0) - }; - }; - function base64Slice(buf2, start, end) { - if (start === 0 && end === buf2.length) { - return base64.fromByteArray(buf2); - } else { - return base64.fromByteArray(buf2.slice(start, end)); - } - } - function utf8Slice(buf2, start, end) { - end = Math.min(buf2.length, end); - var res = []; - var i = start; - while (i < end) { - var firstByte = buf2[i]; - var codePoint = null; - var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint; - switch (bytesPerSequence) { - case 1: - if (firstByte < 128) { - codePoint = firstByte; - } - break; - case 2: - secondByte = buf2[i + 1]; - if ((secondByte & 192) === 128) { - tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; - if (tempCodePoint > 127) { - codePoint = tempCodePoint; - } - } - break; - case 3: - secondByte = buf2[i + 1]; - thirdByte = buf2[i + 2]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; - if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { - codePoint = tempCodePoint; - } - } - break; - case 4: - secondByte = buf2[i + 1]; - thirdByte = buf2[i + 2]; - fourthByte = buf2[i + 3]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; - if (tempCodePoint > 65535 && tempCodePoint < 1114112) { - codePoint = tempCodePoint; - } - } - } - } - if (codePoint === null) { - codePoint = 65533; - bytesPerSequence = 1; - } else if (codePoint > 65535) { - codePoint -= 65536; - res.push(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); - } - var MAX_ARGUMENTS_LENGTH = 4096; - function decodeCodePointsArray(codePoints) { - var len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints); - } - var res = ""; - var i = 0; - while (i < len) { - res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - } - return res; - } - function asciiSlice(buf2, start, end) { - var ret = ""; - end = Math.min(buf2.length, end); - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf2[i] & 127); - } - return ret; - } - function latin1Slice(buf2, start, end) { - var ret = ""; - end = Math.min(buf2.length, end); - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf2[i]); - } - return ret; - } - function hexSlice(buf2, start, end) { - var len = buf2.length; - if (!start || start < 0) - start = 0; - if (!end || end < 0 || end > len) - end = len; - var out = ""; - for (var i = start; i < end; ++i) { - out += hexSliceLookupTable[buf2[i]]; - } - return out; - } - function utf16leSlice(buf2, start, end) { - var bytes = buf2.slice(start, end); - var res = ""; - for (var i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - } - return res; - } - Buffer18.prototype.slice = function slice(start, end) { - var len = this.length; - start = ~~start; - end = end === void 0 ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) - start = 0; - } else if (start > len) { - start = len; - } - if (end < 0) { - end += len; - if (end < 0) - end = 0; - } else if (end > len) { - end = len; - } - if (end < start) - end = start; - var newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer18.prototype); - return newBuf; - }; - function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) - throw new RangeError("offset is not uint"); - if (offset + ext > length) - throw new RangeError("Trying to access beyond buffer length"); - } - Buffer18.prototype.readUintLE = Buffer18.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - return val; - }; - Buffer18.prototype.readUintBE = Buffer18.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - checkOffset(offset, byteLength2, this.length); - } - var val = this[offset + --byteLength2]; - var mul = 1; - while (byteLength2 > 0 && (mul *= 256)) { - val += this[offset + --byteLength2] * mul; - } - return val; - }; - Buffer18.prototype.readUint8 = Buffer18.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 1, this.length); - return this[offset]; - }; - Buffer18.prototype.readUint16LE = Buffer18.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; - }; - Buffer18.prototype.readUint16BE = Buffer18.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; - }; - Buffer18.prototype.readUint32LE = Buffer18.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; - }; - Buffer18.prototype.readUint32BE = Buffer18.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); - }; - Buffer18.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; + Readable.prototype.read = function(n) { + debug("read", n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) + state.emittedReadable = false; + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug("read: emitReadable", state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); + return null; } - mul *= 128; - if (val >= mul) - val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer18.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) - checkOffset(offset, byteLength2, this.length); - var i = byteLength2; - var mul = 1; - var val = this[offset + --i]; - while (i > 0 && (mul *= 256)) { - val += this[offset + --i] * mul; + n = howMuchToRead(n, state); + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; } - mul *= 128; - if (val >= mul) - val -= Math.pow(2, 8 * byteLength2); - return val; - }; - Buffer18.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 1, this.length); - if (!(this[offset] & 128)) - return this[offset]; - return (255 - this[offset] + 1) * -1; - }; - Buffer18.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - var val = this[offset] | this[offset + 1] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer18.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 2, this.length); - var val = this[offset + 1] | this[offset] << 8; - return val & 32768 ? val | 4294901760 : val; - }; - Buffer18.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; - }; - Buffer18.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; - }; - Buffer18.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return ieee7542.read(this, offset, true, 23, 4); - }; - Buffer18.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 4, this.length); - return ieee7542.read(this, offset, false, 23, 4); - }; - Buffer18.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 8, this.length); - return ieee7542.read(this, offset, true, 52, 8); - }; - Buffer18.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) - checkOffset(offset, 8, this.length); - return ieee7542.read(this, offset, false, 52, 8); - }; - function checkInt(buf2, value, offset, ext, max, min) { - if (!Buffer18.isBuffer(buf2)) - throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) - throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf2.length) - throw new RangeError("Index out of range"); - } - Buffer18.prototype.writeUintLE = Buffer18.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); + var doRead = state.needReadable; + debug("need readable", doRead); + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug("length less than watermark", doRead); } - var mul = 1; - var i = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - this[offset + i] = value / mul & 255; + if (state.ended || state.reading) { + doRead = false; + debug("reading or ended", doRead); + } else if (doRead) { + debug("do read"); + state.reading = true; + state.sync = true; + if (state.length === 0) + state.needReadable = true; + this._read(state.highWaterMark); + state.sync = false; + if (!state.reading) + n = howMuchToRead(nOrig, state); } - return offset + byteLength2; - }; - Buffer18.prototype.writeUintBE = Buffer18.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; } - var i = byteLength2 - 1; - var mul = 1; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - this[offset + i] = value / mul & 255; + if (state.length === 0) { + if (!state.ended) + state.needReadable = true; + if (nOrig !== n && state.ended) + endReadable(this); } - return offset + byteLength2; - }; - Buffer18.prototype.writeUint8 = Buffer18.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 1, 255, 0); - this[offset] = value & 255; - return offset + 1; - }; - Buffer18.prototype.writeUint16LE = Buffer18.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer18.prototype.writeUint16BE = Buffer18.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer18.prototype.writeUint32LE = Buffer18.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 4294967295, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 255; - return offset + 4; - }; - Buffer18.prototype.writeUint32BE = Buffer18.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 4294967295, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; + if (ret !== null) + this.emit("data", ret); + return ret; }; - Buffer18.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); + function onEofChunk(stream, state) { + debug("onEofChunk"); + if (state.ended) + return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } } - var i = 0; - var mul = 1; - var sub = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1; + state.ended = true; + if (state.sync) { + emitReadable(stream); + } else { + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); } - this[offset + i] = (value / mul >> 0) - sub & 255; } - return offset + byteLength2; - }; - Buffer18.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); + } + function emitReadable(stream) { + var state = stream._readableState; + debug("emitReadable", state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug("emitReadable", state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); } - var i = byteLength2 - 1; - var mul = 1; - var sub = 0; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1; - } - this[offset + i] = (value / mul >> 0) - sub & 255; + } + function emitReadable_(stream) { + var state = stream._readableState; + debug("emitReadable_", state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit("readable"); + state.emittedReadable = false; } - return offset + byteLength2; - }; - Buffer18.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 1, 127, -128); - if (value < 0) - value = 255 + value + 1; - this[offset] = value & 255; - return offset + 1; - }; - Buffer18.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer18.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }; - Buffer18.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 2147483647, -2147483648); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; - }; - Buffer18.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) - checkInt(this, value, offset, 4, 2147483647, -2147483648); - if (value < 0) - value = 4294967295 + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; - }; - function checkIEEE754(buf2, value, offset, ext, max, min) { - if (offset + ext > buf2.length) - throw new RangeError("Index out of range"); - if (offset < 0) - throw new RangeError("Index out of range"); + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); } - function writeFloat(buf2, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22); + function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); } - ieee7542.write(buf2, value, offset, littleEndian, 23, 4); - return offset + 4; } - Buffer18.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); - }; - Buffer18.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); - }; - function writeDouble(buf2, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292); + function maybeReadMore_(stream, state) { + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug("maybeReadMore read 0"); + stream.read(0); + if (len === state.length) + break; } - ieee7542.write(buf2, value, offset, littleEndian, 52, 8); - return offset + 8; + state.readingMore = false; } - Buffer18.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); - }; - Buffer18.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); + Readable.prototype._read = function(n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()")); }; - Buffer18.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer18.isBuffer(target)) - throw new TypeError("argument should be a Buffer"); - if (!start) - start = 0; - if (!end && end !== 0) - end = this.length; - if (targetStart >= target.length) - targetStart = target.length; - if (!targetStart) - targetStart = 0; - if (end > 0 && end < start) - end = start; - if (end === start) - return 0; - if (target.length === 0 || this.length === 0) - return 0; - if (targetStart < 0) { - throw new RangeError("targetStart out of bounds"); + Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) + process.nextTick(endFn); + else + src.once("end", endFn); + dest.on("unpipe", onunpipe); + function onunpipe(readable, unpipeInfo) { + debug("onunpipe"); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } } - if (start < 0 || start >= this.length) - throw new RangeError("Index out of range"); - if (end < 0) - throw new RangeError("sourceEnd out of bounds"); - if (end > this.length) - end = this.length; - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start; + function onend() { + debug("onend"); + dest.end(); } - var len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === "function") { - this.copyWithin(targetStart, start, end); - } else { - Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); + var ondrain = pipeOnDrain(src); + dest.on("drain", ondrain); + var cleanedUp = false; + function cleanup() { + debug("cleanup"); + dest.removeListener("close", onclose); + dest.removeListener("finish", onfinish); + dest.removeListener("drain", ondrain); + dest.removeListener("error", onerror); + dest.removeListener("unpipe", onunpipe); + src.removeListener("end", onend); + src.removeListener("end", unpipe); + src.removeListener("data", ondata); + cleanedUp = true; + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) + ondrain(); } - return len; - }; - Buffer18.prototype.fill = function fill(val, start, end, encoding) { - if (typeof val === "string") { - if (typeof start === "string") { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === "string") { - encoding = end; - end = this.length; - } - if (encoding !== void 0 && typeof encoding !== "string") { - throw new TypeError("encoding must be a string"); - } - if (typeof encoding === "string" && !Buffer18.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - if (val.length === 1) { - var code = val.charCodeAt(0); - if (encoding === "utf8" && code < 128 || encoding === "latin1") { - val = code; + src.on("data", ondata); + function ondata(chunk) { + debug("ondata"); + var ret = dest.write(chunk); + debug("dest.write", ret); + if (ret === false) { + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug("false write response, pause", state.awaitDrain); + state.awaitDrain++; } + src.pause(); } - } else if (typeof val === "number") { - val = val & 255; - } else if (typeof val === "boolean") { - val = Number(val); } - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError("Out of range index"); + function onerror(er) { + debug("onerror", er); + unpipe(); + dest.removeListener("error", onerror); + if (EElistenerCount(dest, "error") === 0) + errorOrDestroy(dest, er); } - if (end <= start) { - return this; + prependListener(dest, "error", onerror); + function onclose() { + dest.removeListener("finish", onfinish); + unpipe(); } - start = start >>> 0; - end = end === void 0 ? this.length : end >>> 0; - if (!val) - val = 0; - var i; - if (typeof val === "number") { - for (i = start; i < end; ++i) { - this[i] = val; - } - } else { - var bytes = Buffer18.isBuffer(val) ? val : Buffer18.from(val, encoding); - var len = bytes.length; - if (len === 0) { - throw new TypeError('The value "' + val + '" is invalid for argument "value"'); + dest.once("close", onclose); + function onfinish() { + debug("onfinish"); + dest.removeListener("close", onclose); + unpipe(); + } + dest.once("finish", onfinish); + function unpipe() { + debug("unpipe"); + src.unpipe(dest); + } + dest.emit("pipe", src); + if (!state.flowing) { + debug("pipe resume"); + src.resume(); + } + return dest; + }; + function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug("pipeOnDrain", state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, "data")) { + state.flowing = true; + flow(src); } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len]; + }; + } + Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + if (state.pipesCount === 0) + return this; + if (state.pipesCount === 1) { + if (dest && dest !== state.pipes) + return this; + if (!dest) + dest = state.pipes; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) + dest.emit("unpipe", this, unpipeInfo); + return this; + } + if (!dest) { + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) { + dests[i].emit("unpipe", this, { + hasUnpiped: false + }); } + return this; } + var index = indexOf(state.pipes, dest); + if (index === -1) + return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + dest.emit("unpipe", this, unpipeInfo); return this; }; - var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; - function base64clean(str) { - str = str.split("=")[0]; - str = str.trim().replace(INVALID_BASE64_RE, ""); - if (str.length < 2) - return ""; - while (str.length % 4 !== 0) { - str = str + "="; - } - return str; - } - function utf8ToBytes(string, units) { - units = units || Infinity; - var codePoint; - var length = string.length; - var leadSurrogate = null; - var bytes = []; - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i); - if (codePoint > 55295 && codePoint < 57344) { - if (!leadSurrogate) { - if (codePoint > 56319) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - continue; - } else if (i + 1 === length) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - continue; - } - leadSurrogate = codePoint; - continue; - } - if (codePoint < 56320) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - leadSurrogate = codePoint; - continue; + Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === "data") { + state.readableListening = this.listenerCount("readable") > 0; + if (state.flowing !== false) + this.resume(); + } else if (ev === "readable") { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug("on readable", state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); } - codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; - } else if (leadSurrogate) { - if ((units -= 3) > -1) - bytes.push(239, 191, 189); - } - leadSurrogate = null; - if (codePoint < 128) { - if ((units -= 1) < 0) - break; - bytes.push(codePoint); - } else if (codePoint < 2048) { - if ((units -= 2) < 0) - break; - bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128); - } else if (codePoint < 65536) { - if ((units -= 3) < 0) - break; - bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128); - } else if (codePoint < 1114112) { - if ((units -= 4) < 0) - break; - bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128); - } else { - throw new Error("Invalid code point"); } } - return bytes; - } - function asciiToBytes(str) { - var byteArray = []; - for (var i = 0; i < str.length; ++i) { - byteArray.push(str.charCodeAt(i) & 255); + return res; + }; + Readable.prototype.addListener = Readable.prototype.on; + Readable.prototype.removeListener = function(ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === "readable") { + process.nextTick(updateReadableListening, this); } - return byteArray; - } - function utf16leToBytes(str, units) { - var c, hi, lo; - var byteArray = []; - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) - break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); + return res; + }; + Readable.prototype.removeAllListeners = function(ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === "readable" || ev === void 0) { + process.nextTick(updateReadableListening, this); + } + return res; + }; + function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount("readable") > 0; + if (state.resumeScheduled && !state.paused) { + state.flowing = true; + } else if (self.listenerCount("data") > 0) { + self.resume(); } - return byteArray; } - function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); + function nReadingNextTick(self) { + debug("readable nexttick read 0"); + self.read(0); } - function blitBuffer(src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if (i + offset >= dst.length || i >= src.length) - break; - dst[i + offset] = src[i]; + Readable.prototype.resume = function() { + var state = this._readableState; + if (!state.flowing) { + debug("resume"); + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; + }; + function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); } - return i; } - function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; + function resume_(stream, state) { + debug("resume", state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit("resume"); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); } - function numberIsNaN(obj) { - return obj !== obj; + Readable.prototype.pause = function() { + debug("call pause flowing=%j", this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug("pause"); + this._readableState.flowing = false; + this.emit("pause"); + } + this._readableState.paused = true; + return this; + }; + function flow(stream) { + var state = stream._readableState; + debug("flow", state.flowing); + while (state.flowing && stream.read() !== null) { + ; + } } - var hexSliceLookupTable = function() { - var alphabet = "0123456789abcdef"; - var table = new Array(256); - for (var i = 0; i < 16; ++i) { - var i16 = i * 16; - for (var j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j]; + Readable.prototype.wrap = function(stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on("end", function() { + debug("wrapped end"); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + _this.push(chunk); } - } - return table; - }(); - } - }); - - // node_modules/ebml/lib/ebml/tools.js - var require_tools = __commonJS({ - "node_modules/ebml/lib/ebml/tools.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var tools = { - readVint: function(buffer, start) { - start = start || 0; - for (var length = 1; length <= 8; length++) { - if (buffer[start] >= Math.pow(2, 8 - length)) { - break; - } + _this.push(null); + }); + stream.on("data", function(chunk) { + debug("wrapped data"); + if (state.decoder) + chunk = state.decoder.write(chunk); + if (state.objectMode && (chunk === null || chunk === void 0)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) + return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); } - if (length > 8) { - throw new Error("Unrepresentable length: " + length + " " + buffer.toString("hex", start, start + length)); + }); + for (var i in stream) { + if (this[i] === void 0 && typeof stream[i] === "function") { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); } - if (start + length > buffer.length) { - return null; + } + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + this._read = function(n2) { + debug("wrapped _read", n2); + if (paused) { + paused = false; + stream.resume(); } - var value = buffer[start] & (1 << 8 - length) - 1; - for (var i = 1; i < length; i++) { - if (i === 7) { - if (value >= Math.pow(2, 53 - 8) && buffer[start + 7] > 0) { - return { - length, - value: -1 - }; - } - } - value *= Math.pow(2, 8); - value += buffer[start + i]; + }; + return this; + }; + if (typeof Symbol === "function") { + Readable.prototype[Symbol.asyncIterator] = function() { + if (createReadableStreamAsyncIterator === void 0) { + createReadableStreamAsyncIterator = require_async_iterator(); } - return { - length, - value - }; + return createReadableStreamAsyncIterator(this); + }; + } + Object.defineProperty(Readable.prototype, "readableHighWaterMark", { + enumerable: false, + get: function get2() { + return this._readableState.highWaterMark; + } + }); + Object.defineProperty(Readable.prototype, "readableBuffer", { + enumerable: false, + get: function get2() { + return this._readableState && this._readableState.buffer; + } + }); + Object.defineProperty(Readable.prototype, "readableFlowing", { + enumerable: false, + get: function get2() { + return this._readableState.flowing; }, - writeVint: function(value) { - if (value < 0 || value > Math.pow(2, 53)) { - throw new Error("Unrepresentable value: " + value); + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; } - for (var length = 1; length <= 8; length++) { - if (value < Math.pow(2, 7 * length) - 1) { - break; + } + }); + Readable._fromList = fromList; + Object.defineProperty(Readable.prototype, "readableLength", { + enumerable: false, + get: function get2() { + return this._readableState.length; + } + }); + function fromList(n, state) { + if (state.length === 0) + return null; + var ret; + if (state.objectMode) + ret = state.buffer.shift(); + else if (!n || n >= state.length) { + if (state.decoder) + ret = state.buffer.join(""); + else if (state.buffer.length === 1) + ret = state.buffer.first(); + else + ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + ret = state.buffer.consume(n, state.decoder); + } + return ret; + } + function endReadable(stream) { + var state = stream._readableState; + debug("endReadable", state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } + } + function endReadableNT(state, stream) { + debug("endReadableNT", state.endEmitted, state.length); + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit("end"); + if (state.autoDestroy) { + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); } } - var buffer = new Buffer2(length); - for (var i = 1; i <= length; i++) { - var b = value & 255; - buffer[length - i] = b; - value -= b; - value /= Math.pow(2, 8); + } + } + if (typeof Symbol === "function") { + Readable.from = function(iterable, opts) { + if (from === void 0) { + from = require_from_browser(); } - buffer[0] = buffer[0] | 1 << 8 - length; - return buffer; + return from(Readable, iterable, opts); + }; + } + function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) + return i; } - }; - module.exports = tools; + return -1; + } } }); - // node_modules/ebml-block/lib/vint.js - var require_vint = __commonJS({ - "node_modules/ebml-block/lib/vint.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_transform.js + var require_stream_transform = __commonJS({ + "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - module.exports = function(buffer, start, signed) { - start = start || 0; - for (var length = 1; length <= 8; length++) { - if (buffer[start] >= Math.pow(2, 8 - length)) { - break; - } - } - if (length > 8) { - throw new Error("Unrepresentable length: " + length + " " + buffer.toString("hex", start, start + length)); - } - if (start + length > buffer.length) { - return null; - } - var i; - var value = buffer[start] & (1 << 8 - length) - 1; - for (i = 1; i < length; i++) { - if (i === 7) { - if (value >= Math.pow(2, 53 - 8) && buffer[start + 7] > 0) { - return { - length, - value: -1 - }; - } - } - value *= Math.pow(2, 8); - value += buffer[start + i]; + module.exports = Transform; + var _require$codes = require_errors_browser().codes; + var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED; + var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK; + var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING; + var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; + var Duplex = require_stream_duplex(); + require_inherits_browser()(Transform, Duplex); + function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit("error", new ERR_MULTIPLE_CALLBACK()); } - if (signed) { - value -= Math.pow(2, length * 7 - 1) - 1; + ts.writechunk = null; + ts.writecb = null; + if (data != null) + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); } - return { - length, - value + } + function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null }; + this._readableState.needReadable = true; + this._readableState.sync = false; + if (options) { + if (typeof options.transform === "function") + this._transform = options.transform; + if (typeof options.flush === "function") + this._flush = options.flush; + } + this.on("prefinish", prefinish); + } + function prefinish() { + var _this = this; + if (typeof this._flush === "function" && !this._readableState.destroyed) { + this._flush(function(er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } + } + Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); }; - } - }); - - // node_modules/ebml-block/lib/buffer-reader.js - var require_buffer_reader = __commonJS({ - "node_modules/ebml-block/lib/buffer-reader.js"(exports, module) { - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var vint = require_vint(); - function BufferReader(buffer) { - this.buffer = buffer; - this.offset = 0; - } - BufferReader.prototype.nextInt16BE = function() { - var value = this.buffer.readInt16BE(this.offset); - this.offset += 2; - return value; - }; - BufferReader.prototype.nextUInt8 = function() { - var value = this.buffer.readUInt8(this.offset); - this.offset += 1; - return value; + Transform.prototype._transform = function(chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); }; - BufferReader.prototype.nextUIntV = function() { - var v = vint(this.buffer, this.offset); - this.offset += v.length; - return v.value; + Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } }; - BufferReader.prototype.nextIntV = function() { - var v = vint(this.buffer, this.offset, true); - this.offset += v.length; - return v.value; + Transform.prototype._read = function(n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + ts.needTransform = true; + } }; - BufferReader.prototype.nextBuffer = function(length) { - var buffer = length ? this.buffer.slice(this.offset, this.offset + length) : this.buffer.slice(this.offset); - this.offset += length || this.length; - return buffer; + Transform.prototype._destroy = function(err, cb) { + Duplex.prototype._destroy.call(this, err, function(err2) { + cb(err2); + }); }; - Object.defineProperty(BufferReader.prototype, "length", { - get: function() { - return this.buffer.length - this.offset; - } - }); - module.exports = BufferReader; + function done(stream, er, data) { + if (er) + return stream.emit("error", er); + if (data != null) + stream.push(data); + if (stream._writableState.length) + throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) + throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); + } } }); - // node_modules/ebml-block/index.js - var require_ebml_block = __commonJS({ - "node_modules/ebml-block/index.js"(exports, module) { + // node_modules/readable-stream/lib/_stream_passthrough.js + var require_stream_passthrough = __commonJS({ + "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var BufferReader = require_buffer_reader(); - var XIPH_LACING = 1; - var EBML_LACING = 3; - var FIXED_SIZE_LACING = 2; - module.exports = function(buffer) { - var block = {}; - var reader = new BufferReader(buffer); - block.trackNumber = reader.nextUIntV(); - block.timecode = reader.nextInt16BE(); - var flags = reader.nextUInt8(); - block.invisible = !!(flags & 8); - block.keyframe = !!(flags & 128); - block.discardable = !!(flags & 1); - var lacing = (flags & 6) >> 1; - block.frames = readLacedData(reader, lacing); - return block; - }; - function readLacedData(reader, lacing) { - if (!lacing) - return [reader.nextBuffer()]; - var i, frameSize; - var frames = []; - var framesNum = reader.nextUInt8() + 1; - if (lacing === FIXED_SIZE_LACING) { - if (reader.length % framesNum !== 0) - throw new Error("Fixed-Size Lacing Error"); - frameSize = reader.length / framesNum; - for (i = 0; i < framesNum; i++) { - frames.push(reader.nextBuffer(frameSize)); - } - return frames; - } - var frameSizes = []; - if (lacing === XIPH_LACING) { - for (i = 0; i < framesNum - 1; i++) { - var val; - frameSize = 0; - do { - val = reader.nextUInt8(); - frameSize += val; - } while (val === 255); - frameSizes.push(frameSize); - } - } else if (lacing === EBML_LACING) { - frameSize = reader.nextUIntV(); - frameSizes.push(frameSize); - for (i = 1; i < framesNum - 1; i++) { - frameSize += reader.nextIntV(); - frameSizes.push(frameSize); - } - } - for (i = 0; i < framesNum - 1; i++) { - frames.push(reader.nextBuffer(frameSizes[i])); - } - frames.push(reader.nextBuffer()); - return frames; + module.exports = PassThrough; + var Transform = require_stream_transform(); + require_inherits_browser()(PassThrough, Transform); + function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + Transform.call(this, options); } + PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); + }; } }); - // node_modules/ts-ebml/lib/tools.js - var require_tools2 = __commonJS({ - "node_modules/ts-ebml/lib/tools.js"(exports) { + // node_modules/readable-stream/lib/internal/streams/pipeline.js + var require_pipeline = __commonJS({ + "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var int64_buffer_1 = require_int64_buffer(); - var EBMLEncoder_1 = require_EBMLEncoder(); - var _Buffer = require_buffer2(); - var _tools = require_tools(); - var _block = require_ebml_block(); - exports.Buffer = _Buffer.Buffer; - exports.readVint = _tools.readVint; - exports.writeVint = _tools.writeVint; - exports.ebmlBlock = _block; - function readBlock(buf2) { - return exports.ebmlBlock(new exports.Buffer(buf2)); - } - exports.readBlock = readBlock; - function encodeTag(tagId, tagData, unknownSize) { - if (unknownSize === void 0) { - unknownSize = false; - } - return concat([ - tagId, - unknownSize ? new exports.Buffer("01ffffffffffffff", "hex") : exports.writeVint(tagData.length), - tagData - ]); - } - exports.encodeTag = encodeTag; - function WebPFrameFilter(elms) { - return WebPBlockFilter(elms).reduce(function(lst, elm) { - var o = exports.ebmlBlock(elm.data); - return o.frames.reduce(function(lst2, frame) { - var webpBuf = VP8BitStreamToRiffWebPBuffer(frame); - var webp = new Blob([webpBuf], { type: "image/webp" }); - return lst2.concat(webp); - }, lst); - }, []); - } - exports.WebPFrameFilter = WebPFrameFilter; - function WebPBlockFilter(elms) { - return elms.reduce(function(lst, elm) { - if (elm.type !== "b") { - return lst; - } - if (elm.name !== "SimpleBlock") { - return lst; - } - var o = exports.ebmlBlock(elm.data); - var hasWebP = o.frames.some(function(frame) { - var startcode = frame.slice(3, 6).toString("hex"); - return startcode === "9d012a"; - }); - if (!hasWebP) { - return lst; - } - return lst.concat(elm); - }, []); - } - exports.WebPBlockFilter = WebPBlockFilter; - function VP8BitStreamToRiffWebPBuffer(frame) { - var VP8Chunk = createRIFFChunk("VP8 ", frame); - var WebPChunk = concat([ - new exports.Buffer("WEBP", "ascii"), - VP8Chunk - ]); - return createRIFFChunk("RIFF", WebPChunk); - } - exports.VP8BitStreamToRiffWebPBuffer = VP8BitStreamToRiffWebPBuffer; - function createRIFFChunk(FourCC, chunk) { - var chunkSize = new exports.Buffer(4); - chunkSize.writeUInt32LE(chunk.byteLength, 0); - return concat([ - new exports.Buffer(FourCC.substr(0, 4), "ascii"), - chunkSize, - chunk, - new exports.Buffer(chunk.byteLength % 2 === 0 ? 0 : 1) - ]); - } - exports.createRIFFChunk = createRIFFChunk; - function makeMetadataSeekable(originalMetadata, duration, cuesInfo) { - var header = extractElement("EBML", originalMetadata); - var headerSize = encodedSizeOfEbml(header); - var segmentContentStartPos = headerSize + 12; - var originalMetadataSize = originalMetadata[originalMetadata.length - 1].dataEnd - segmentContentStartPos; - var info = extractElement("Info", originalMetadata); - removeElement("Duration", info); - info.splice(1, 0, { name: "Duration", type: "f", data: createFloatBuffer(duration, 8) }); - var infoSize = encodedSizeOfEbml(info); - var tracks = extractElement("Tracks", originalMetadata); - var tracksSize = encodedSizeOfEbml(tracks); - var seekHeadSize = 47; - var seekHead = []; - var cuesSize = 5 + cuesInfo.length * 15; - var cues = []; - var lastSizeDifference = -1; - var maxIterations = 10; - var _loop_1 = function(i2) { - var infoStart = seekHeadSize; - var tracksStart = infoStart + infoSize; - var cuesStart = tracksStart + tracksSize; - var newMetadataSize = cuesStart + cuesSize; - var sizeDifference = newMetadataSize - originalMetadataSize; - seekHead = []; - seekHead.push({ name: "SeekHead", type: "m", isEnd: false }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([21, 73, 169, 102]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(infoStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([22, 84, 174, 107]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(tracksStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "Seek", type: "m", isEnd: false }); - seekHead.push({ name: "SeekID", type: "b", data: new exports.Buffer([28, 83, 187, 107]) }); - seekHead.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(cuesStart) }); - seekHead.push({ name: "Seek", type: "m", isEnd: true }); - seekHead.push({ name: "SeekHead", type: "m", isEnd: true }); - seekHeadSize = encodedSizeOfEbml(seekHead); - cues = []; - cues.push({ name: "Cues", type: "m", isEnd: false }); - cuesInfo.forEach(function(_a) { - var CueTrack = _a.CueTrack, CueClusterPosition = _a.CueClusterPosition, CueTime = _a.CueTime; - cues.push({ name: "CuePoint", type: "m", isEnd: false }); - cues.push({ name: "CueTime", type: "u", data: createUIntBuffer(CueTime) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: false }); - cues.push({ name: "CueTrack", type: "u", data: createUIntBuffer(CueTrack) }); - CueClusterPosition -= segmentContentStartPos; - CueClusterPosition += sizeDifference; - cues.push({ name: "CueClusterPosition", type: "u", data: createUIntBuffer(CueClusterPosition) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: true }); - cues.push({ name: "CuePoint", type: "m", isEnd: true }); - }); - cues.push({ name: "Cues", type: "m", isEnd: true }); - cuesSize = encodedSizeOfEbml(cues); - if (lastSizeDifference !== sizeDifference) { - lastSizeDifference = sizeDifference; - if (i2 === maxIterations - 1) { - throw new Error("Failed to converge to a stable metadata size"); - } - } else { - return "break"; - } + var eos; + function once(callback) { + var called = false; + return function() { + if (called) + return; + called = true; + callback.apply(void 0, arguments); }; - for (var i = 0; i < maxIterations; i++) { - var state_1 = _loop_1(i); - if (state_1 === "break") - break; - } - var finalMetadata = [].concat.apply([], [ - header, - { name: "Segment", type: "m", isEnd: false, unknownSize: true }, - seekHead, - info, - tracks, - cues - ]); - var result = new EBMLEncoder_1.default().encode(finalMetadata); - return result; - } - exports.makeMetadataSeekable = makeMetadataSeekable; - function removeElement(idName, metadata) { - var result = []; - var start = -1; - for (var i = 0; i < metadata.length; i++) { - var element2 = metadata[i]; - if (element2.name === idName) { - if (element2.type === "m") { - if (!element2.isEnd) { - start = i; - } else { - if (start == -1) - throw new Error("Detected " + idName + " closing element before finding the start"); - metadata.splice(start, i - start + 1); - return; - } - } else { - metadata.splice(i, 1); - return; - } - } - } } - exports.removeElement = removeElement; - function extractElement(idName, metadata) { - var result = []; - var start = -1; - for (var i = 0; i < metadata.length; i++) { - var element2 = metadata[i]; - if (element2.name === idName) { - if (element2.type === "m") { - if (!element2.isEnd) { - start = i; - } else { - if (start == -1) - throw new Error("Detected " + idName + " closing element before finding the start"); - result = metadata.slice(start, i + 1); - break; - } - } else { - result.push(metadata[i]); - break; - } - } - } - return result; + var _require$codes = require_errors_browser().codes; + var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; + var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + function noop3(err) { + if (err) + throw err; } - exports.extractElement = extractElement; - function putRefinedMetaData(metadata, info) { - if (Array.isArray(info.cueInfos) && !Array.isArray(info.cues)) { - console.warn("putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues"); - info.cues = info.cueInfos; - } - var ebml2 = []; - var payload = []; - for (var i_1 = 0; i_1 < metadata.length; i_1++) { - var elm = metadata[i_1]; - if (elm.type === "m" && elm.name === "Segment") { - ebml2 = metadata.slice(0, i_1); - payload = metadata.slice(i_1); - if (elm.unknownSize) { - payload.shift(); - break; - } - throw new Error("this metadata is not streaming webm file"); - } - } - if (!(payload[payload.length - 1].dataEnd > 0)) { - throw new Error("metadata dataEnd has wrong number"); - } - var originalPayloadOffsetEnd = payload[payload.length - 1].dataEnd; - var ebmlSize = ebml2[ebml2.length - 1].dataEnd; - var refinedEBMLSize = new EBMLEncoder_1.default().encode(ebml2).byteLength; - var offsetDiff = refinedEBMLSize - ebmlSize; - var payloadSize = originalPayloadOffsetEnd - payload[0].tagStart; - var segmentSize = payload[0].tagStart - ebmlSize; - var segmentOffset = payload[0].tagStart; - var segmentTagBuf = new exports.Buffer([24, 83, 128, 103]); - var segmentSizeBuf = new exports.Buffer("01ffffffffffffff", "hex"); - var _segmentSize = segmentTagBuf.byteLength + segmentSizeBuf.byteLength; - var newPayloadSize = payloadSize; - var i; - for (i = 1; i < 20; i++) { - var newPayloadOffsetEnd = ebmlSize + _segmentSize + newPayloadSize; - var offsetEndDiff = newPayloadOffsetEnd - originalPayloadOffsetEnd; - var sizeDiff = offsetDiff + offsetEndDiff; - var refined = refineMetadata(payload, sizeDiff, info); - var newNewRefinedSize = new EBMLEncoder_1.default().encode(refined).byteLength; - if (newNewRefinedSize === newPayloadSize) { - return new EBMLEncoder_1.default().encode([].concat(ebml2, [{ type: "m", name: "Segment", isEnd: false, unknownSize: true }], refined)); - } - newPayloadSize = newNewRefinedSize; - } - throw new Error("unable to refine metadata, stable size could not be found in " + i + " iterations!"); - } - exports.putRefinedMetaData = putRefinedMetaData; - function encodedSizeOfEbml(refinedMetaData) { - var encorder = new EBMLEncoder_1.default(); - return refinedMetaData.reduce(function(lst, elm) { - return lst.concat(encorder.encode([elm])); - }, []).reduce(function(o, buf2) { - return o + buf2.byteLength; - }, 0); - } - function refineMetadata(mesetadata, sizeDiff, info) { - var duration = info.duration, clusterPtrs = info.clusterPtrs, cues = info.cues; - var _metadata = mesetadata.slice(0); - if (typeof duration === "number") { - var overwrited_1 = false; - _metadata.forEach(function(elm) { - if (elm.type === "f" && elm.name === "Duration") { - overwrited_1 = true; - elm.data = createFloatBuffer(duration, 8); - } - }); - if (!overwrited_1) { - insertTag(_metadata, "Info", [{ name: "Duration", type: "f", data: createFloatBuffer(duration, 8) }]); - } - } - if (Array.isArray(cues)) { - insertTag(_metadata, "Cues", create_cue(cues, sizeDiff)); - } - var seekhead_children = []; - if (Array.isArray(clusterPtrs)) { - console.warn("append cluster pointers to seekhead is deprecated. please use cues"); - seekhead_children = create_seek_from_clusters(clusterPtrs, sizeDiff); - } - insertTag(_metadata, "SeekHead", seekhead_children, true); - return _metadata; + function isRequest(stream) { + return stream.setHeader && typeof stream.abort === "function"; } - function create_seek_from_clusters(clusterPtrs, sizeDiff) { - var seeks = []; - clusterPtrs.forEach(function(start) { - seeks.push({ name: "Seek", type: "m", isEnd: false }); - seeks.push({ name: "SeekID", type: "b", data: new exports.Buffer([31, 67, 182, 117]) }); - seeks.push({ name: "SeekPosition", type: "u", data: createUIntBuffer(start + sizeDiff) }); - seeks.push({ name: "Seek", type: "m", isEnd: true }); + function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on("close", function() { + closed = true; }); - return seeks; - } - function create_cue(cueInfos, sizeDiff) { - var cues = []; - cueInfos.forEach(function(_a) { - var CueTrack = _a.CueTrack, CueClusterPosition = _a.CueClusterPosition, CueTime = _a.CueTime; - cues.push({ name: "CuePoint", type: "m", isEnd: false }); - cues.push({ name: "CueTime", type: "u", data: createUIntBuffer(CueTime) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: false }); - cues.push({ name: "CueTrack", type: "u", data: createUIntBuffer(CueTrack) }); - cues.push({ name: "CueClusterPosition", type: "u", data: createUIntBuffer(CueClusterPosition + sizeDiff) }); - cues.push({ name: "CueTrackPositions", type: "m", isEnd: true }); - cues.push({ name: "CuePoint", type: "m", isEnd: true }); + if (eos === void 0) + eos = require_end_of_stream(); + eos(stream, { + readable: reading, + writable: writing + }, function(err) { + if (err) + return callback(err); + closed = true; + callback(); }); - return cues; + var destroyed = false; + return function(err) { + if (closed) + return; + if (destroyed) + return; + destroyed = true; + if (isRequest(stream)) + return stream.abort(); + if (typeof stream.destroy === "function") + return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED("pipe")); + }; } - function insertTag(_metadata, tagName, children2, insertHead) { - if (insertHead === void 0) { - insertHead = false; - } - var idx = -1; - for (var i = 0; i < _metadata.length; i++) { - var elm = _metadata[i]; - if (elm.type === "m" && elm.name === tagName && elm.isEnd === false) { - idx = i; - break; - } - } - if (idx >= 0) { - Array.prototype.splice.apply(_metadata, [idx + 1, 0].concat(children2)); - } else if (insertHead) { - [].concat([{ name: tagName, type: "m", isEnd: false }], children2, [{ name: tagName, type: "m", isEnd: true }]).reverse().forEach(function(elm2) { - _metadata.unshift(elm2); - }); - } else { - _metadata.push({ name: tagName, type: "m", isEnd: false }); - children2.forEach(function(elm2) { - _metadata.push(elm2); - }); - _metadata.push({ name: tagName, type: "m", isEnd: true }); - } + function call(fn) { + fn(); } - function concat(list) { - var i = 0; - var length = 0; - for (; i < list.length; ++i) { - length += list[i].length; - } - var buffer = exports.Buffer.allocUnsafe(length); - var pos = 0; - for (i = 0; i < list.length; ++i) { - var buf2 = list[i]; - buf2.copy(buffer, pos); - pos += buf2.length; - } - return buffer; + function pipe(from, to) { + return from.pipe(to); } - exports.concat = concat; - function encodeValueToBuffer(elm) { - var data = new exports.Buffer(0); - if (elm.type === "m") { - return elm; - } - switch (elm.type) { - case "u": - data = createUIntBuffer(elm.value); - break; - case "i": - data = createIntBuffer(elm.value); - break; - case "f": - data = createFloatBuffer(elm.value); - break; - case "s": - data = new exports.Buffer(elm.value, "ascii"); - break; - case "8": - data = new exports.Buffer(elm.value, "utf8"); - break; - case "b": - data = elm.value; - break; - case "d": - data = new int64_buffer_1.Int64BE(elm.value.getTime().toString()).toBuffer(); - break; - } - return Object.assign({}, elm, { data }); - } - exports.encodeValueToBuffer = encodeValueToBuffer; - function createUIntBuffer(value) { - var bytes = 1; - for (; value >= Math.pow(2, 8 * bytes); bytes++) { - } - if (bytes >= 7) { - console.warn("7bit or more bigger uint not supported."); - return new int64_buffer_1.Uint64BE(value).toBuffer(); - } - var data = new exports.Buffer(bytes); - data.writeUIntBE(value, 0, bytes); - return data; - } - exports.createUIntBuffer = createUIntBuffer; - function createIntBuffer(value) { - var bytes = 1; - for (; value >= Math.pow(2, 8 * bytes); bytes++) { - } - if (bytes >= 7) { - console.warn("7bit or more bigger uint not supported."); - return new int64_buffer_1.Int64BE(value).toBuffer(); - } - var data = new exports.Buffer(bytes); - data.writeIntBE(value, 0, bytes); - return data; - } - exports.createIntBuffer = createIntBuffer; - function createFloatBuffer(value, bytes) { - if (bytes === void 0) { - bytes = 8; - } - if (bytes === 8) { - var data = new exports.Buffer(8); - data.writeDoubleBE(value, 0); - return data; - } else if (bytes === 4) { - var data = new exports.Buffer(4); - data.writeFloatBE(value, 0); - return data; - } else { - throw new Error("float type bits must 4bytes or 8bytes"); - } + function popCallback(streams) { + if (!streams.length) + return noop3; + if (typeof streams[streams.length - 1] !== "function") + return noop3; + return streams.pop(); } - exports.createFloatBuffer = createFloatBuffer; - function convertEBMLDateToJSDate(int64str) { - if (int64str instanceof Date) { - return int64str; + function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) + streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS("streams"); } - return new Date(new Date("2001-01-01T00:00:00.000Z").getTime() + Number(int64str) / 1e3 / 1e3); + var error; + var destroys = streams.map(function(stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function(err) { + if (!error) + error = err; + if (err) + destroys.forEach(call); + if (reading) + return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); } - exports.convertEBMLDateToJSDate = convertEBMLDateToJSDate; + module.exports = pipeline; } }); - // node_modules/ts-ebml/lib/EBMLDecoder.js - var require_EBMLDecoder = __commonJS({ - "node_modules/ts-ebml/lib/EBMLDecoder.js"(exports) { - "use strict"; + // node_modules/readable-stream/readable-browser.js + var require_readable_browser = __commonJS({ + "node_modules/readable-stream/readable-browser.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var tools_1 = require_tools2(); - var int64_buffer_1 = require_int64_buffer(); - var tools = require_tools2(); - var schema = require_schema(); - var byEbmlID = schema.byEbmlID; - var State2; - (function(State3) { - State3[State3["STATE_TAG"] = 1] = "STATE_TAG"; - State3[State3["STATE_SIZE"] = 2] = "STATE_SIZE"; - State3[State3["STATE_CONTENT"] = 3] = "STATE_CONTENT"; - })(State2 || (State2 = {})); - var EBMLDecoder = function() { - function EBMLDecoder2() { - this._buffer = new tools_1.Buffer(0); - this._tag_stack = []; - this._state = State2.STATE_TAG; - this._cursor = 0; - this._total = 0; - this._schema = byEbmlID; - this._result = []; - } - EBMLDecoder2.prototype.decode = function(chunk) { - this.readChunk(chunk); - var diff = this._result; - this._result = []; - return diff; - }; - EBMLDecoder2.prototype.readChunk = function(chunk) { - this._buffer = tools.concat([this._buffer, new tools_1.Buffer(chunk)]); - while (this._cursor < this._buffer.length) { - if (this._state === State2.STATE_TAG && !this.readTag()) { - break; - } - if (this._state === State2.STATE_SIZE && !this.readSize()) { - break; - } - if (this._state === State2.STATE_CONTENT && !this.readContent()) { - break; - } - } - }; - EBMLDecoder2.prototype.getSchemaInfo = function(tagNum) { - return this._schema[tagNum] || { - name: "unknown", - level: -1, - type: "unknown", - description: "unknown" - }; - }; - EBMLDecoder2.prototype.readTag = function() { - if (this._cursor >= this._buffer.length) { - return false; - } - var tag = tools_1.readVint(this._buffer, this._cursor); - if (tag == null) { - return false; - } - var buf2 = this._buffer.slice(this._cursor, this._cursor + tag.length); - var tagNum = buf2.reduce(function(o, v, i, arr) { - return o + v * Math.pow(16, 2 * (arr.length - 1 - i)); - }, 0); - var schema2 = this.getSchemaInfo(tagNum); - var tagObj = { - EBML_ID: tagNum.toString(16), - schema: schema2, - type: schema2.type, - name: schema2.name, - level: schema2.level, - tagStart: this._total, - tagEnd: this._total + tag.length, - sizeStart: this._total + tag.length, - sizeEnd: null, - dataStart: null, - dataEnd: null, - dataSize: null, - data: null - }; - this._tag_stack.push(tagObj); - this._cursor += tag.length; - this._total += tag.length; - this._state = State2.STATE_SIZE; - return true; - }; - EBMLDecoder2.prototype.readSize = function() { - if (this._cursor >= this._buffer.length) { - return false; - } - var size = tools_1.readVint(this._buffer, this._cursor); - if (size == null) { - return false; - } - var tagObj = this._tag_stack[this._tag_stack.length - 1]; - tagObj.sizeEnd = tagObj.sizeStart + size.length; - tagObj.dataStart = tagObj.sizeEnd; - tagObj.dataSize = size.value; - if (size.value === -1) { - tagObj.dataEnd = -1; - if (tagObj.type === "m") { - tagObj.unknownSize = true; - } - } else { - tagObj.dataEnd = tagObj.sizeEnd + size.value; - } - this._cursor += size.length; - this._total += size.length; - this._state = State2.STATE_CONTENT; - return true; - }; - EBMLDecoder2.prototype.readContent = function() { - var tagObj = this._tag_stack[this._tag_stack.length - 1]; - if (tagObj.type === "m") { - tagObj.isEnd = false; - this._result.push(tagObj); - this._state = State2.STATE_TAG; - if (tagObj.dataSize === 0) { - var elm = Object.assign({}, tagObj, { isEnd: true }); - this._result.push(elm); - this._tag_stack.pop(); - } - return true; - } - if (this._buffer.length < this._cursor + tagObj.dataSize) { - return false; - } - var data = this._buffer.slice(this._cursor, this._cursor + tagObj.dataSize); - this._buffer = this._buffer.slice(this._cursor + tagObj.dataSize); - tagObj.data = data; - switch (tagObj.type) { - case "u": - tagObj.value = data.readUIntBE(0, data.length); - break; - case "i": - tagObj.value = data.readIntBE(0, data.length); - break; - case "f": - tagObj.value = tagObj.dataSize === 4 ? data.readFloatBE(0) : tagObj.dataSize === 8 ? data.readDoubleBE(0) : (console.warn("cannot read " + tagObj.dataSize + " octets float. failback to 0"), 0); - break; - case "s": - tagObj.value = data.toString("ascii"); - break; - case "8": - tagObj.value = data.toString("utf8"); - break; - case "b": - tagObj.value = data; - break; - case "d": - tagObj.value = tools_1.convertEBMLDateToJSDate(new int64_buffer_1.Int64BE(data).toNumber()); - break; - } - if (tagObj.value === null) { - throw new Error("unknown tag type:" + tagObj.type); - } - this._result.push(tagObj); - this._total += tagObj.dataSize; - this._state = State2.STATE_TAG; - this._cursor = 0; - this._tag_stack.pop(); - while (this._tag_stack.length > 0) { - var topEle = this._tag_stack[this._tag_stack.length - 1]; - if (topEle.dataEnd < 0) { - this._tag_stack.pop(); - return true; - } - if (this._total < topEle.dataEnd) { - break; - } - if (topEle.type !== "m") { - throw new Error("parent element is not master element"); - } - var elm = Object.assign({}, topEle, { isEnd: true }); - this._result.push(elm); - this._tag_stack.pop(); - } - return true; - }; - return EBMLDecoder2; - }(); - exports.default = EBMLDecoder; + exports = module.exports = require_stream_readable(); + exports.Stream = exports; + exports.Readable = exports; + exports.Writable = require_stream_writable(); + exports.Duplex = require_stream_duplex(); + exports.Transform = require_stream_transform(); + exports.PassThrough = require_stream_passthrough(); + exports.finished = require_end_of_stream(); + exports.pipeline = require_pipeline(); } }); - // node_modules/ts-ebml/node_modules/events/events.js - var require_events2 = __commonJS({ - "node_modules/ts-ebml/node_modules/events/events.js"(exports, module) { + // node_modules/readable-web-to-node-stream/lib/index.js + var require_lib = __commonJS({ + "node_modules/readable-web-to-node-stream/lib/index.js"(exports) { + "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || void 0; - } - module.exports = EventEmitter; - EventEmitter.EventEmitter = EventEmitter; - EventEmitter.prototype._events = void 0; - EventEmitter.prototype._maxListeners = void 0; - EventEmitter.defaultMaxListeners = 10; - EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError("n must be a positive number"); - this._maxListeners = n; - return this; - }; - EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - if (!this._events) - this._events = {}; - if (type === "error") { - if (!this._events.error || isObject(this._events.error) && !this._events.error.length) { - er = arguments[1]; - if (er instanceof Error) { - throw er; - } else { - var err = new Error('Uncaught, unspecified "error" event. (' + er + ")"); - err.context = er; - throw err; - } - } - } - handler = this._events[type]; - if (isUndefined(handler)) - return false; - if (isFunction(handler)) { - switch (arguments.length) { - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); - } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - return true; - }; - EventEmitter.prototype.addListener = function(type, listener) { - var m; - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - if (!this._events) - this._events = {}; - if (this._events.newListener) - this.emit("newListener", type, isFunction(listener.listener) ? listener.listener : listener); - if (!this._events[type]) - this._events[type] = listener; - else if (isObject(this._events[type])) - this._events[type].push(listener); - else - this._events[type] = [this._events[type], listener]; - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[type].length); - if (typeof console.trace === "function") { - console.trace(); - } - } + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ReadableWebToNodeStream = void 0; + var readable_stream_1 = require_readable_browser(); + var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable { + constructor(stream) { + super(); + this.bytesRead = 0; + this.released = false; + this.reader = stream.getReader(); } - return this; - }; - EventEmitter.prototype.on = EventEmitter.prototype.addListener; - EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - var fired = false; - function g() { - this.removeListener(type, g); - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - g.listener = listener; - this.on(type, g); - return this; - }; - EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - if (!isFunction(listener)) - throw TypeError("listener must be a function"); - if (!this._events || !this._events[type]) - return this; - list = this._events[type]; - length = list.length; - position = -1; - if (list === listener || isFunction(list.listener) && list.listener === listener) { - delete this._events[type]; - if (this._events.removeListener) - this.emit("removeListener", type, listener); - } else if (isObject(list)) { - for (i = length; i-- > 0; ) { - if (list[i] === listener || list[i].listener && list[i].listener === listener) { - position = i; - break; - } + async _read() { + if (this.released) { + this.push(null); + return; } - if (position < 0) - return this; - if (list.length === 1) { - list.length = 0; - delete this._events[type]; + this.pendingRead = this.reader.read(); + const data = await this.pendingRead; + delete this.pendingRead; + if (data.done || this.released) { + this.push(null); } else { - list.splice(position, 1); + this.bytesRead += data.value.length; + this.push(data.value); } - if (this._events.removeListener) - this.emit("removeListener", type, listener); - } - return this; - }; - EventEmitter.prototype.removeAllListeners = function(type) { - var key2, listeners; - if (!this._events) - return this; - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; } - if (arguments.length === 0) { - for (key2 in this._events) { - if (key2 === "removeListener") - continue; - this.removeAllListeners(key2); + async waitForReadToComplete() { + if (this.pendingRead) { + await this.pendingRead; } - this.removeAllListeners("removeListener"); - this._events = {}; - return this; } - listeners = this._events[type]; - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); + async close() { + await this.syncAndRelease(); } - delete this._events[type]; - return this; - }; - EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; - }; - EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; - if (isFunction(evlistener)) - return 1; - else if (evlistener) - return evlistener.length; + async syncAndRelease() { + this.released = true; + await this.waitForReadToComplete(); + await this.reader.releaseLock(); } - return 0; }; - EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); - }; - function isFunction(arg) { - return typeof arg === "function"; - } - function isNumber(arg) { - return typeof arg === "number"; - } - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - function isUndefined(arg) { - return arg === void 0; - } + exports.ReadableWebToNodeStream = ReadableWebToNodeStream2; } }); - // node_modules/ts-ebml/lib/EBMLReader.js - var require_EBMLReader = __commonJS({ - "node_modules/ts-ebml/lib/EBMLReader.js"(exports) { + // node_modules/base-x/src/index.js + var require_src = __commonJS({ + "node_modules/base-x/src/index.js"(exports, module) { "use strict"; init_define_BUILD_VERSION(); init_esbuild_inject(); - var __extends = exports && exports.__extends || function() { - var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { - d.__proto__ = b; - } || function(d, b) { - for (var p in b) - if (b.hasOwnProperty(p)) - d[p] = b[p]; - }; - return function(d, b) { - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - Object.defineProperty(exports, "__esModule", { value: true }); - var events_1 = require_events2(); - var tools = require_tools2(); - var EBMLReader = function(_super) { - __extends(EBMLReader2, _super); - function EBMLReader2() { - var _this = _super.call(this) || this; - _this.logGroup = ""; - _this.hasLoggingStarted = false; - _this.metadataloaded = false; - _this.chunks = []; - _this.stack = []; - _this.segmentOffset = 0; - _this.last2SimpleBlockVideoTrackTimecode = [0, 0]; - _this.last2SimpleBlockAudioTrackTimecode = [0, 0]; - _this.lastClusterTimecode = 0; - _this.lastClusterPosition = 0; - _this.timecodeScale = 1e6; - _this.metadataSize = 0; - _this.metadatas = []; - _this.cues = []; - _this.firstVideoBlockRead = false; - _this.firstAudioBlockRead = false; - _this.currentTrack = { TrackNumber: -1, TrackType: -1, DefaultDuration: null, CodecDelay: null }; - _this.trackTypes = []; - _this.trackDefaultDuration = []; - _this.trackCodecDelay = []; - _this.trackInfo = { type: "nothing" }; - _this.ended = false; - _this.logging = false; - _this.use_duration_every_simpleblock = false; - _this.use_webp = false; - _this.use_segment_info = true; - _this.drop_default_duration = true; - return _this; - } - EBMLReader2.prototype.stop = function() { - this.ended = true; - this.emit_segment_info(); - while (this.stack.length) { - this.stack.pop(); - if (this.logging) { - console.groupEnd(); - } + function base(ALPHABET) { + if (ALPHABET.length >= 255) { + throw new TypeError("Alphabet too long"); + } + var BASE_MAP = new Uint8Array(256); + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255; + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i); + var xc = x.charCodeAt(0); + if (BASE_MAP[xc] !== 255) { + throw new TypeError(x + " is ambiguous"); } - if (this.logging && this.hasLoggingStarted && this.logGroup) { - console.groupEnd(); + BASE_MAP[xc] = i; + } + var BASE = ALPHABET.length; + var LEADER = ALPHABET.charAt(0); + var FACTOR = Math.log(BASE) / Math.log(256); + var iFACTOR = Math.log(256) / Math.log(BASE); + function encode2(source) { + if (source instanceof Uint8Array) { + } else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength); + } else if (Array.isArray(source)) { + source = Uint8Array.from(source); } - }; - EBMLReader2.prototype.emit_segment_info = function() { - var data = this.chunks; - this.chunks = []; - if (!this.metadataloaded) { - this.metadataloaded = true; - this.metadatas = data; - var videoTrackNum = this.trackTypes.indexOf(1); - var audioTrackNum = this.trackTypes.indexOf(2); - this.trackInfo = videoTrackNum >= 0 && audioTrackNum >= 0 ? { type: "both", trackNumber: videoTrackNum } : videoTrackNum >= 0 ? { type: "video", trackNumber: videoTrackNum } : audioTrackNum >= 0 ? { type: "audio", trackNumber: audioTrackNum } : { type: "nothing" }; - if (!this.use_segment_info) { - return; - } - this.emit("metadata", { data, metadataSize: this.metadataSize }); - } else { - if (!this.use_segment_info) { - return; - } - var timecode = this.lastClusterTimecode; - var duration = this.duration; - var timecodeScale = this.timecodeScale; - this.emit("cluster", { timecode, data }); - this.emit("duration", { timecodeScale, duration }); + if (!(source instanceof Uint8Array)) { + throw new TypeError("Expected Uint8Array"); } - }; - EBMLReader2.prototype.read = function(elm) { - var _this = this; - var drop = false; - if (this.ended) { - return; + if (source.length === 0) { + return ""; } - if (elm.type === "m") { - if (elm.isEnd) { - this.stack.pop(); - } else { - var parent_1 = this.stack[this.stack.length - 1]; - if (parent_1 != null && parent_1.level >= elm.level) { - this.stack.pop(); - if (this.logging) { - console.groupEnd(); - } - parent_1.dataEnd = elm.dataEnd; - parent_1.dataSize = elm.dataEnd - parent_1.dataStart; - parent_1.unknownSize = false; - var o = Object.assign({}, parent_1, { name: parent_1.name, type: parent_1.type, isEnd: true }); - this.chunks.push(o); - } - this.stack.push(elm); - } + var zeroes = 0; + var length = 0; + var pbegin = 0; + var pend = source.length; + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++; + zeroes++; } - if (elm.type === "m" && elm.name == "Segment") { - if (this.segmentOffset != 0) { - console.warn("Multiple segments detected!"); - } - this.segmentOffset = elm.dataStart; - this.emit("segment_offset", this.segmentOffset); - } else if (elm.type === "b" && elm.name === "SimpleBlock") { - var _a = tools.ebmlBlock(elm.data), timecode = _a.timecode, trackNumber = _a.trackNumber, frames_1 = _a.frames; - if (this.trackTypes[trackNumber] === 1) { - if (!this.firstVideoBlockRead) { - this.firstVideoBlockRead = true; - if (this.trackInfo.type === "both" || this.trackInfo.type === "video") { - var CueTime = this.lastClusterTimecode + timecode; - this.cues.push({ CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - this.emit("cue_info", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime: this.lastClusterTimecode }); - this.emit("cue", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - } - } - this.last2SimpleBlockVideoTrackTimecode = [this.last2SimpleBlockVideoTrackTimecode[1], timecode]; - } else if (this.trackTypes[trackNumber] === 2) { - if (!this.firstAudioBlockRead) { - this.firstAudioBlockRead = true; - if (this.trackInfo.type === "audio") { - var CueTime = this.lastClusterTimecode + timecode; - this.cues.push({ CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - this.emit("cue_info", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime: this.lastClusterTimecode }); - this.emit("cue", { CueTrack: trackNumber, CueClusterPosition: this.lastClusterPosition, CueTime }); - } - } - this.last2SimpleBlockAudioTrackTimecode = [this.last2SimpleBlockAudioTrackTimecode[1], timecode]; - } - if (this.use_duration_every_simpleblock) { - this.emit("duration", { timecodeScale: this.timecodeScale, duration: this.duration }); - } - if (this.use_webp) { - frames_1.forEach(function(frame) { - var startcode = frame.slice(3, 6).toString("hex"); - if (startcode !== "9d012a") { - return; - } - ; - var webpBuf = tools.VP8BitStreamToRiffWebPBuffer(frame); - var webp = new Blob([webpBuf], { type: "image/webp" }); - var currentTime = _this.duration; - _this.emit("webp", { currentTime, webp }); - }); - } - } else if (elm.type === "m" && elm.name === "Cluster" && elm.isEnd === false) { - this.firstVideoBlockRead = false; - this.firstAudioBlockRead = false; - this.emit_segment_info(); - this.emit("cluster_ptr", elm.tagStart); - this.lastClusterPosition = elm.tagStart; - } else if (elm.type === "u" && elm.name === "Timecode") { - this.lastClusterTimecode = elm.value; - } else if (elm.type === "u" && elm.name === "TimecodeScale") { - this.timecodeScale = elm.value; - } else if (elm.type === "m" && elm.name === "TrackEntry") { - if (elm.isEnd) { - this.trackTypes[this.currentTrack.TrackNumber] = this.currentTrack.TrackType; - this.trackDefaultDuration[this.currentTrack.TrackNumber] = this.currentTrack.DefaultDuration; - this.trackCodecDelay[this.currentTrack.TrackNumber] = this.currentTrack.CodecDelay; - } else { - this.currentTrack = { TrackNumber: -1, TrackType: -1, DefaultDuration: null, CodecDelay: null }; + var size = (pend - pbegin) * iFACTOR + 1 >>> 0; + var b58 = new Uint8Array(size); + while (pbegin !== pend) { + var carry = source[pbegin]; + var i2 = 0; + for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) { + carry += 256 * b58[it1] >>> 0; + b58[it1] = carry % BASE >>> 0; + carry = carry / BASE >>> 0; } - } else if (elm.type === "u" && elm.name === "TrackType") { - this.currentTrack.TrackType = elm.value; - } else if (elm.type === "u" && elm.name === "TrackNumber") { - this.currentTrack.TrackNumber = elm.value; - } else if (elm.type === "u" && elm.name === "CodecDelay") { - this.currentTrack.CodecDelay = elm.value; - } else if (elm.type === "u" && elm.name === "DefaultDuration") { - if (this.drop_default_duration) { - console.warn("DefaultDuration detected!, remove it"); - drop = true; - } else { - this.currentTrack.DefaultDuration = elm.value; + if (carry !== 0) { + throw new Error("Non-zero carry"); } - } else if (elm.name === "unknown") { - console.warn(elm); + length = i2; + pbegin++; + } + var it2 = size - length; + while (it2 !== size && b58[it2] === 0) { + it2++; } - if (!this.metadataloaded && elm.dataEnd > 0) { - this.metadataSize = elm.dataEnd; + var str = LEADER.repeat(zeroes); + for (; it2 < size; ++it2) { + str += ALPHABET.charAt(b58[it2]); } - if (!drop) { - this.chunks.push(elm); + return str; + } + function decodeUnsafe(source) { + if (typeof source !== "string") { + throw new TypeError("Expected String"); } - if (this.logging) { - this.put(elm); + if (source.length === 0) { + return new Uint8Array(); } - }; - Object.defineProperty(EBMLReader2.prototype, "duration", { - get: function() { - if (this.trackInfo.type === "nothing") { - console.warn("no video, no audio track"); - return 0; + var psz = 0; + var zeroes = 0; + var length = 0; + while (source[psz] === LEADER) { + zeroes++; + psz++; + } + var size = (source.length - psz) * FACTOR + 1 >>> 0; + var b256 = new Uint8Array(size); + while (source[psz]) { + var carry = BASE_MAP[source.charCodeAt(psz)]; + if (carry === 255) { + return; } - var defaultDuration = 0; - var codecDelay = 0; - var lastTimecode = 0; - var _defaultDuration = this.trackDefaultDuration[this.trackInfo.trackNumber]; - if (typeof _defaultDuration === "number") { - defaultDuration = _defaultDuration; - } else { - if (this.trackInfo.type === "both") { - if (this.last2SimpleBlockAudioTrackTimecode[1] > this.last2SimpleBlockVideoTrackTimecode[1]) { - defaultDuration = (this.last2SimpleBlockAudioTrackTimecode[1] - this.last2SimpleBlockAudioTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackTypes.indexOf(2)]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockAudioTrackTimecode[1]; - } else { - defaultDuration = (this.last2SimpleBlockVideoTrackTimecode[1] - this.last2SimpleBlockVideoTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackTypes.indexOf(1)]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockVideoTrackTimecode[1]; - } - } else if (this.trackInfo.type === "video") { - defaultDuration = (this.last2SimpleBlockVideoTrackTimecode[1] - this.last2SimpleBlockVideoTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackInfo.trackNumber]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockVideoTrackTimecode[1]; - } else if (this.trackInfo.type === "audio") { - defaultDuration = (this.last2SimpleBlockAudioTrackTimecode[1] - this.last2SimpleBlockAudioTrackTimecode[0]) * this.timecodeScale; - var delay = this.trackCodecDelay[this.trackInfo.trackNumber]; - if (typeof delay === "number") { - codecDelay = delay; - } - lastTimecode = this.last2SimpleBlockAudioTrackTimecode[1]; - } + var i2 = 0; + for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) { + carry += BASE * b256[it3] >>> 0; + b256[it3] = carry % 256 >>> 0; + carry = carry / 256 >>> 0; } - var duration_nanosec = (this.lastClusterTimecode + lastTimecode) * this.timecodeScale + defaultDuration - codecDelay; - var duration = duration_nanosec / this.timecodeScale; - return Math.floor(duration); - }, - enumerable: true, - configurable: true - }); - EBMLReader2.prototype.addListener = function(event, listener) { - return _super.prototype.addListener.call(this, event, listener); - }; - EBMLReader2.prototype.put = function(elm) { - if (!this.hasLoggingStarted) { - this.hasLoggingStarted = true; - if (this.logging && this.logGroup) { - console.groupCollapsed(this.logGroup); + if (carry !== 0) { + throw new Error("Non-zero carry"); } + length = i2; + psz++; } - if (elm.type === "m") { - if (elm.isEnd) { - console.groupEnd(); - } else { - console.group(elm.name + ":" + elm.tagStart); - } - } else if (elm.type === "b") { - console.log(elm.name, elm.type); - } else { - console.log(elm.name, elm.tagStart, elm.type, elm.value); + var it4 = size - length; + while (it4 !== size && b256[it4] === 0) { + it4++; + } + var vch = new Uint8Array(zeroes + (size - it4)); + var j2 = zeroes; + while (it4 !== size) { + vch[j2++] = b256[it4++]; + } + return vch; + } + function decode3(string) { + var buffer = decodeUnsafe(string); + if (buffer) { + return buffer; } + throw new Error("Non-base" + BASE + " character"); + } + return { + encode: encode2, + decodeUnsafe, + decode: decode3 }; - return EBMLReader2; - }(events_1.EventEmitter); - exports.default = EBMLReader; - } - }); - - // node_modules/ts-ebml/package.json - var require_package = __commonJS({ - "node_modules/ts-ebml/package.json"(exports, module) { - module.exports = { - name: "ts-ebml", - version: "2.0.2", - description: "ebml decoder and encoder", - scripts: { - setup: "npm install -g http-server;", - init: "npm run update; npm run mkdir; npm run build", - update: "npm run reset; npm update", - reset: "rm -rf node_modules", - mkdir: "mkdir lib dist 2>/dev/null", - clean: "rm -rf lib/* dist/* test/*.js; mkdir -p dist", - build: "npm run clean && tsc -p .; npm run browserify", - start: "http-server . -s & tsc -w -p .& watchify lib/example_seekable.js -o test/example_seekable.js", - stop: "killall -- node */tsc -w -p", - browserify: "browserify lib/index.js --standalone EBML -o dist/EBML.js", - watchify: "watchify lib/index.js --standalone EBML -o dist/EBMl.js -v", - test: "tsc; espower lib/test.js > lib/test.tmp; mv -f lib/test.tmp lib/test.js; browserify lib/test.js -o test/test.js", - example: "tsc; browserify lib/example_seekable.js -o test/example_seekable.js", - examples: "tsc; for file in `find lib -name 'example_*.js' -type f -printf '%f\\n'`; do browserify lib/$file -o test/$file; done", - examples_bsd: "tsc; for file in `find lib -name 'example_*.js' -type f -print`; do browserify lib/$(basename $file) -o test/$(basename $file); done", - check: "tsc -w --noEmit -p ./", - lint: "tslint -c ./tslint.json --project ./tsconfig.json --type-check", - doc: "typedoc --mode modules --out doc --disableOutputCheck" - }, - repository: { - type: "git", - url: "git+https://github.com/legokichi/ts-ebml.git" - }, - keywords: [ - "ebml", - "webm", - "mkv", - "matrosika", - "webp" - ], - author: "legokichi duckscallion", - license: "MIT", - bugs: { - url: "https://github.com/legokichi/ts-ebml/issues" - }, - homepage: "https://github.com/legokichi/ts-ebml#readme", - dependencies: { - buffer: "^5.0.7", - commander: "^2.11.0", - ebml: "^2.2.1", - "ebml-block": "^1.1.0", - events: "^1.1.1", - "int64-buffer": "^0.1.9", - matroska: "^2.2.3" - }, - devDependencies: { - "@types/commander": "^2.9.1", - "@types/qunit": "^2.0.31", - browserify: "^13.1.0", - empower: "^1.2.3", - "espower-cli": "^1.1.0", - "power-assert": "^1.4.4", - "power-assert-formatter": "^1.4.1", - "qunit-tap": "^1.5.1", - qunitjs: "^2.4.0", - tslint: "^3.15.1", - typedoc: "^0.5.3", - typescript: "^2.4.2", - watchify: "^3.7.0" - }, - bin: "./lib/cli.js", - main: "./lib/index.js", - typings: "./lib/index.d.ts" - }; + } + module.exports = base; } }); - // node_modules/ts-ebml/lib/index.js - var require_lib2 = __commonJS({ - "node_modules/ts-ebml/lib/index.js"(exports) { - "use strict"; + // node_modules/bs58/index.js + var require_bs58 = __commonJS({ + "node_modules/bs58/index.js"(exports, module) { init_define_BUILD_VERSION(); init_esbuild_inject(); - Object.defineProperty(exports, "__esModule", { value: true }); - var EBMLDecoder_1 = require_EBMLDecoder(); - exports.Decoder = EBMLDecoder_1.default; - var EBMLEncoder_1 = require_EBMLEncoder(); - exports.Encoder = EBMLEncoder_1.default; - var EBMLReader_1 = require_EBMLReader(); - exports.Reader = EBMLReader_1.default; - var tools = require_tools2(); - exports.tools = tools; - var version = require_package().version; - exports.version = version; + var basex = require_src(); + var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + module.exports = basex(ALPHABET); } }); @@ -17068,10 +7277,10 @@ const _DOMParser = DOMParser; if (frames.length != 1) throw new Error("only single frame JPEGs supported"); for (var i = 0; i < frames.length; i++) { - var cp = frames[i].components; - for (var j in cp) { - cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx]; - delete cp[j].quantizationIdx; + var cp2 = frames[i].components; + for (var j in cp2) { + cp2[j].quantizationTable = quantizationTables[cp2[j].quantizationIdx]; + delete cp2[j].quantizationIdx; } } this.width = frame.samplesPerLine; @@ -17347,8 +7556,7 @@ const _DOMParser = DOMParser; // src/main.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_process = __toESM(require_node_process(), 1); - var import_buffer11 = __toESM(require_buffer(), 1); + var import_buffer9 = __toESM(require_buffer(), 1); // src/stores.ts init_define_BUILD_VERSION(); @@ -18224,6 +8432,9 @@ const _DOMParser = DOMParser; // src/stores.ts var localLoad = async (key2, def) => { + if (false) { + return def; + } const isinls = "__pee__" + key2 in localStorage; let ret; if (isinls) { @@ -18248,6 +8459,9 @@ const _DOMParser = DOMParser; return ret; }; var localSet = (key2, value) => { + if (false) { + return; + } if (false) chrome.storage.local.set({ [key2]: JSON.stringify(value) }); else @@ -18467,15 +8681,6 @@ const _DOMParser = DOMParser; this.writer.releaseLock(); } }; - var BufferWriteStream = () => { - let b = import_buffer.Buffer.from([]); - const ret = new WritableStream({ - write(chunk) { - b = import_buffer.Buffer.concat([b, chunk]); - } - }); - return [ret, () => b]; - }; // src/utils.ts init_define_BUILD_VERSION(); @@ -18589,9 +8794,12 @@ const _DOMParser = DOMParser; var lqueue = {}; var localLoad2 = (key2, def) => "__pee__" + key2 in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key2)) : def; var localSet2 = (key2, value) => localStorage.setItem("__pee__" + key2, JSON.stringify(value)); - var { port1, port2 } = new MessageChannel(); - console.log("userscript", "false"); + var port1; + console.log("userscript", false); if (false) { + const nmc = new MessageChannel(); + port1 = nmc.port1; + port2 = nmc.port2; const iframe = document.createElement("iframe"); iframe.style.display = "none"; iframe.name = location.origin; @@ -18599,7 +8807,6 @@ const _DOMParser = DOMParser; iframe.onload = _; }); iframe.src = `${chrome.runtime.getURL("")}options.html`; - const meself = new URL(chrome.runtime.getURL("")).origin; document.documentElement.appendChild(iframe); iframeloaded.then(() => { iframe.contentWindow?.postMessage("", "*", [port2]); @@ -18608,12 +8815,27 @@ const _DOMParser = DOMParser; lqueue[ev.data.id](ev.data); }; } + console.log("userscript"); + if (false) { + port1 = { + onmessage(ev) { + lqueue[ev.data.id](ev.data); + }, + postMessage(msg, tr) { + postMessage({ + type: "ipc", + tr, + msg + }, tr); + } + }; + } var gid = 0; var sendCmd = (cmd, tr) => { const prom = new Promise((_) => { const id = gid++; lqueue[id] = (e) => { - _(e.res); + _(e); delete lqueue[id]; }; port1.postMessage({ id, ...cmd }, tr || []); @@ -18694,36 +8916,6 @@ const _DOMParser = DOMParser; return corsFetch(url.toString(), opt, lisn); return GM_fetch(url, opt, lisn); } - async function* streamRemote(url, chunkSize = 72 * 1024, fetchRestOnNonCanceled = true) { - let size = Number.POSITIVE_INFINITY; - let ptr = 0; - let fetchSize = chunkSize; - while (ptr != size) { - let obj; - const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } }); - if (true) { - obj = headerStringToObject(fres.responseHeaders); - } else { - obj = fres.headers; - } - if (!("content-length" in obj)) { - console.warn("no content lenght???", url); - break; - } - if ("content-range" in obj) { - size = +obj["content-range"].split("/")[1]; - } - const len = +obj["content-length"]; - ptr += len; - if (fetchRestOnNonCanceled) - fetchSize = size; - const val = Buffer2.from(await fres.arrayBuffer()); - const e = yield val; - if (e) { - break; - } - } - } // src/filehosts.ts function parseForm(data) { @@ -18882,12 +9074,12 @@ const _DOMParser = DOMParser; static inRange(a, min, max) { return min <= a && a <= max; } - static codePointToString(cp) { - if (cp <= 65535) { - return String.fromCharCode(cp); + static codePointToString(cp2) { + if (cp2 <= 65535) { + return String.fromCharCode(cp2); } else { - cp -= 65536; - return String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320); + cp2 -= 65536; + return String.fromCharCode((cp2 >> 10) + 55296, (cp2 & 1023) + 56320); } } static singleByteDecoder(bite) { @@ -20734,11 +10926,7 @@ const _DOMParser = DOMParser; }, filename: fn, thumbnail: csettings.hotlink ? prev || full : import_buffer2.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings.hotlink ? full || prev : async (lsn) => { - if (!cachedFile) - cachedFile = await (await ifetch(full || prev, void 0, lsn)).arrayBuffer(); - return import_buffer2.Buffer.from(cachedFile); - } + data: csettings.hotlink ? full || prev : { url: full || prev } }]; ret.push([end, true]); } @@ -20791,17 +10979,17 @@ const _DOMParser = DOMParser; if (hasThumbnail) { thumbsize = header.readInt32LE(ptr); ptr += 4; - if (header.byteLength < ptr + thumbsize) + if (header.byteLength >= ptr + thumbsize) thumb = header.slice(ptr, ptr + thumbsize); else thumb = import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer()); ptr += thumbsize; } - const unzip = async (lsn) => import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } }, lsn)).arrayBuffer()); + const unzip = { url: pee, headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } }; let data; data = unzip; if (size < 3072) { - thumb = data = await unzip(); + thumb = data = import_buffer2.Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer()); } return { filename: fn, @@ -20844,7 +11032,7 @@ const _DOMParser = DOMParser; if (typeof ef.data == "string") { const req = await ifetch(ef.data); buff = import_buffer2.Buffer.from(await req.arrayBuffer()); - } else if (!import_buffer2.Buffer.isBuffer(ef.data)) + } else if (!(ef.data instanceof Uint8Array)) buff = await ef.data(); else buff = ef.data; @@ -20888,197 +11076,34 @@ const _DOMParser = DOMParser; } addEventListener(ev, cb) { this.targets[ev] = this.targets[ev] || []; - this.targets[ev].push(cb); - } - dispatchEvent(ev) { - const evs = this.targets[ev.type]; - if (evs) - for (const cb of evs) - cb(ev); - return true; - } - removeEventListener(ev, cb) { - const evs = this.targets[ev]; - if (!evs) - return; - for (let i = 0; i < evs.length; ++i) { - if (evs[i] == cb) { - evs.splice(i, 1); - return; - } - } - } - }; - - // src/pngv3.ts - var bs58 = __toESM(require_bs58(), 1); - - // src/bitstream.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/reader.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/string-encoding-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/bitstream/writer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/array-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/array-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/resolve-length.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/structure-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/utils.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/boolean-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/boolean-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/buffer-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/buffer-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/element.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/index.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/buffered-writable.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/constructor.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/discriminant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/writable.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/common/incomplete-read-result.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/element.js - var _parent; - var _readFields; - var _isBeingRead; - var _fieldBeingComputed; - var _fieldBeingComputedIntrospectable; - var SERIALIZE_WRITERS = Symbol("Writers used by Bitstream#serialize() for this element type."); - _parent = /* @__PURE__ */ new WeakMap(), _readFields = /* @__PURE__ */ new WeakMap(), _isBeingRead = /* @__PURE__ */ new WeakMap(), _fieldBeingComputed = /* @__PURE__ */ new WeakMap(), _fieldBeingComputedIntrospectable = /* @__PURE__ */ new WeakMap(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field-definition.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/field.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/null-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/number-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/string-serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/length-determinant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/number-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/serializer.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/value-determinant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant-definition.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant-options.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/variant.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); - - // node_modules/@astronautlabs/bitstream/dist.esm/elements/reserved.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); + this.targets[ev].push(cb); + } + dispatchEvent(ev) { + const evs = this.targets[ev.type]; + if (evs) + for (const cb of evs) + cb(ev); + return true; + } + removeEventListener(ev, cb) { + const evs = this.targets[ev]; + if (!evs) + return; + for (let i = 0; i < evs.length; ++i) { + if (evs[i] == cb) { + evs.splice(i, 1); + return; + } + } + } + }; - // node_modules/@astronautlabs/bitstream/dist.esm/elements/reserved-low.js - init_define_BUILD_VERSION(); - init_esbuild_inject(); + // src/pngv3.ts + var bs58 = __toESM(require_bs58(), 1); - // node_modules/@astronautlabs/bitstream/dist.esm/elements/marker.js + // src/bitstream.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - - // src/bitstream.ts var revbyte = (n, len = 8) => { let acc = 0; let n2 = n; @@ -21090,7 +11115,7 @@ const _DOMParser = DOMParser; } return acc; }; - var BitstreamReader2 = class { + var BitstreamReader = class { constructor() { this.buffers = []; this.bufferedLength = 0; @@ -21129,7 +11154,7 @@ const _DOMParser = DOMParser; this.bufferedLength += buffer.length * 8; } }; - var BitstreamWriter2 = class { + var BitstreamWriter = class { constructor(stream, bufferSize = 1) { this.stream = stream; this.pendingBits = 0; @@ -21153,8 +11178,6 @@ const _DOMParser = DOMParser; this.buffer.fill(0); } setBit(b) { - if (b) - debugger; let byte = this.buffer[0]; byte |= b << (this._offset & 7); this.buffer[0] = byte; @@ -21449,7 +11472,7 @@ const _DOMParser = DOMParser; let backoffset = tinf_read_bits(d, dist_bits[dist], dist_base[dist]); const offs2 = d.dest.length - backoffset; let match; - const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader2 && d.to_hide.available == 0; + const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader && d.to_hide.available == 0; if (!skip && (match = Buffer2.from(d.dest.slice(offs2, offs2 + length))).length == length) { let begin = d.dest.length - 32768; if (begin < 0) @@ -21475,7 +11498,7 @@ const _DOMParser = DOMParser; matches.reverse(); const v = Math.floor(Math.log2(matches.length)); capacity += v; - if (d.to_hide instanceof BitstreamReader2) { + if (d.to_hide instanceof BitstreamReader) { if (d.to_hide.available) { const s = d.to_hide.readSync(Math.min(d.to_hide.available, v)); backoffset = matches[s]; @@ -21516,8 +11539,8 @@ const _DOMParser = DOMParser; return TINF_OK; } function tinf_uncompress(source, decompressed, to_hide, hidden, opt = 0) { - const decomp = decompressed ? new BitstreamWriter2({ write: decompressed }) : null; - const hid = hidden && new BitstreamWriter2({ write: hidden }, 4); + const decomp = decompressed ? new BitstreamWriter({ write: decompressed }) : null; + const hid = hidden && new BitstreamWriter({ write: hidden }, 4); const d = new Data(source, decomp, to_hide, hid); let res; let bfinal, btype; @@ -21600,10 +11623,10 @@ const _DOMParser = DOMParser; "z": "z.zz.fo" }; var extractFromRawDeflate = (b) => { - const src = new BitstreamReader2(); + const src = new BitstreamReader(); src.addBuffer(b); const chnks = []; - const hidden = new BitstreamWriter2({ + const hidden = new BitstreamWriter({ write(chunk) { for (const i of chunk) { if (i) @@ -21621,7 +11644,7 @@ const _DOMParser = DOMParser; } return false; }; - var extract = async (png) => { + var extract = async (png, doextract = true) => { const reader = BufferReadStream(png).getReader(); const sneed = new PNGDecoder(reader, false); const ret = []; @@ -21637,22 +11660,28 @@ const _DOMParser = DOMParser; case "tEXt": buff = chunk; if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) { + if (!doextract) + return true; const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM4.length); xor(passed, password); const k = await decodeCoom3Payload(passed); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM5.length); const decoded = import_buffer3.Buffer.from(passed.toString(), "base64").toString().split(" ").map((e) => { return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } if (w = [CUM6, CUM7].find((e) => buff.slice(4, 4 + e.length).equals(e))) { const passed = buff.slice(4 + w.length); @@ -21669,8 +11698,10 @@ const _DOMParser = DOMParser; throw "Uhh"; return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); + if (!doextract) + return true; const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded)); - ret.push(...k.filter((e) => e).map((e) => e)); + ret.push(...k.filter((e) => e)); } catch (e) { } } @@ -21697,10 +11728,13 @@ const _DOMParser = DOMParser; throw "Uhh"; return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(" "); - return decodeCoom3Payload(import_buffer3.Buffer.from(dec)); + if (doextract) + return decodeCoom3Payload(import_buffer3.Buffer.from(dec)); + return true; } } catch (e) { - console.error(e); + if (e != "Uhh") + console.error(e); } finally { reader.releaseLock(); } @@ -21711,7 +11745,7 @@ const _DOMParser = DOMParser; data.copy(ret, 4); return ret; }; - var BufferWriteStream2 = () => { + var BufferWriteStream = () => { let b = import_buffer3.Buffer.from([]); const ret = new WritableStream({ write(chunk) { @@ -21722,8 +11756,8 @@ const _DOMParser = DOMParser; return [ret, () => b]; }; var embedInRawDeflate = (b, h) => { - const src = new BitstreamReader2(); - const hid = new BitstreamReader2(); + const src = new BitstreamReader(); + const hid = new BitstreamReader(); hid.addBuffer(h); src.addBuffer(b); const chnks = []; @@ -21734,14 +11768,14 @@ const _DOMParser = DOMParser; if (!csettings2) throw new Error("Settings uninit"); if (csettings2.pmeth < 5) { - let magic4 = false; - const [writestream2, extract8] = BufferWriteStream2(); + let magic = false; + const [writestream2, extract6] = BufferWriteStream(); const encoder = new PNGEncoder(writestream2); const decoder = new PNGDecoder(container.stream().getReader()); for await (const [name, chunk, crc, offset] of decoder.chunks()) { - if (magic4 && name != "IDAT") + if (magic && name != "IDAT") break; - if (!magic4 && name == "IDAT") { + if (!magic && name == "IDAT") { const passed = import_buffer3.Buffer.from(injb); switch (csettings2.pmeth) { case 0: @@ -21761,7 +11795,7 @@ const _DOMParser = DOMParser; await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM7, import_buffer3.Buffer.from(bs58.encode(passed))])), 0, 0]); break; } - magic4 = true; + magic = true; } await encoder.insertchunk([name, chunk, crc, offset]); } @@ -21771,7 +11805,7 @@ const _DOMParser = DOMParser; 0, 0 ]); - return extract8(); + return extract6(); } let pdec = new PNGDecoder(container.stream().getReader()); const concat = []; @@ -21782,7 +11816,7 @@ const _DOMParser = DOMParser; const head = comp.slice(0, 2); const chksum = comp.slice(-4); const idatblk = embedInRawDeflate(comp.slice(2, -4), injb); - const [writestream, extract7] = BufferWriteStream2(); + const [writestream, extract5] = BufferWriteStream(); const penc = new PNGEncoder(writestream); pdec = new PNGDecoder(container.stream().getReader()); let ins = false; @@ -21798,7 +11832,7 @@ const _DOMParser = DOMParser; } await penc.dtor(); console.log("Finished writing"); - return extract7(); + return extract5(); }; var inject = async (container, links) => { links = links.map((link) => { @@ -21814,7 +11848,7 @@ const _DOMParser = DOMParser; return inject_data(container, injb); }; var has_embed = async (png) => { - const r = await extract(png); + const r = await extract(png, false); return !!r; }; var pngv3_default = { @@ -21824,287 +11858,10 @@ const _DOMParser = DOMParser; match: (fn) => !!fn.match(/\.png$/) }; - // src/webm.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var import_buffer4 = __toESM(require_buffer(), 1); - var ebml = __toESM(require_lib2(), 1); - var password2 = import_buffer4.Buffer.from("NOA"); - var xor2 = (a, p) => { - let n = 0; - for (let i = 0; i < a.byteLength; ++i) { - a[i] ^= p[n]; - n++; - n %= p.byteLength; - } - }; - var findEnclosingTag = (ch, name) => { - const first = ch.findIndex((e) => e.type == "m" && e.name == name); - if (first < 0) - return; - const second = ch.slice(first).findIndex((e) => e.type == "m" && e.name == name); - if (second < 0) - return; - return [ - first, - first + second - ]; - }; - var embed = (webm, data) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const enc = new ebml.Encoder(); - let embed2 = chunks.findIndex((e) => e.name == "Tracks" && e.type == "m" && e.isEnd); - const findOrInsert = (n) => { - let tags = findEnclosingTag(chunks, n); - const stack = []; - if (!tags) { - stack.push({ - type: "m", - isEnd: false, - name: n, - data: import_buffer4.Buffer.from("") - }); - stack.push({ - type: "m", - isEnd: true, - name: n, - data: import_buffer4.Buffer.from("") - }); - chunks.splice(embed2 + 1, 0, ...stack); - tags = findEnclosingTag(chunks, n); - } - embed2 = tags[1]; - }; - findOrInsert("Tags"); - findOrInsert("Tag"); - findOrInsert("Targets"); - embed2++; - chunks.splice(embed2 + 1, 0, ...[ - { - type: "m", - isEnd: false, - name: "SimpleTag", - data: import_buffer4.Buffer.from("") - }, - { - type: "8", - isEnd: false, - name: "TagName", - data: import_buffer4.Buffer.from("VOOM") - }, - { - type: "8", - isEnd: false, - name: "TagBinary", - data - }, - { - type: "m", - isEnd: true, - name: "SimpleTag", - data: import_buffer4.Buffer.from("") - } - ]); - return import_buffer4.Buffer.from(enc.encode(chunks.filter((e) => e.name != "unknown"))); - }; - var extract2 = (webm) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM")); - const cl = chunks.find((e) => e.name == "Cluster"); - if (cl && embed2 == -1) - return; - if (embed2 == -1) - return; - const echk = chunks[embed2]; - const chk = chunks[embed2 + 1]; - if (chk.type == "b" && chk.name == "TagBinary") { - if (echk.type == "8" && echk.value == "VOOM") { - xor2(chk.data, password2); - } - return decodeCoom3Payload(chk.data); - } - }; - var inject2 = async (container, links) => { - const buff = import_buffer4.Buffer.from(links.join(" ")); - xor2(buff, password2); - return embed(import_buffer4.Buffer.from(await container.arrayBuffer()), buff); - }; - var has_embed2 = (webm) => { - const dec = new ebml.Decoder(); - const chunks = dec.decode(webm); - const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM")); - const cl = chunks.find((e) => e.name == "Cluster"); - if (cl && embed2 == -1) - return false; - if (embed2 == -1) - return; - return true; - }; - var webm_default = { - extract: extract2, - has_embed: has_embed2, - inject: inject2, - match: (fn) => !!fn.match(/\.webm$/) - }; - - // src/gif.ts - init_define_BUILD_VERSION(); - init_esbuild_inject(); - var import_buffer5 = __toESM(require_buffer(), 1); - var netscape = import_buffer5.Buffer.from("!\xFF\vNETSCAPE2.0", "ascii"); - var magic = import_buffer5.Buffer.from("!\xFF\vDOOMTECH1.1", "ascii"); - var magic2 = import_buffer5.Buffer.from("!\xFF\vVOOMTECH1.1", "ascii"); - var magic3 = import_buffer5.Buffer.from("!\xFF\vANIMEXTS1.0", "ascii"); - var read_section = (gif, pos) => { - const begin = pos; - pos += 3 + gif[pos + 2]; - let buf2 = import_buffer5.Buffer.alloc(0); - while (pos < gif.byteLength) { - const v = gif[pos++]; - buf2 = import_buffer5.Buffer.concat([buf2, gif.slice(pos, pos + v)]); - if (v == 0) - break; - pos += v; - } - const appname = gif.slice(begin + 3, begin + 11).toString("ascii"); - return { - appname, - data: buf2, - end: pos - }; - }; - var password3 = import_buffer5.Buffer.from("NOA"); - var xor3 = (a, p) => { - let n = 0; - for (let i = 0; i < a.byteLength; ++i) { - a[i] ^= p[n]; - n++; - n %= p.byteLength; - } - }; - var extractBuff = (gif) => { - const field = gif.readUInt8(10); - const gcte = !!(field & 1 << 7); - let end = 13; - if (gcte) { - end += 3 * (1 << (field & 7) + 1); - } - while (gif[end] == "!".charCodeAt(0)) { - let sec = read_section(gif, end); - if (sec.appname == "DOOMTECH") { - const ret = import_buffer5.Buffer.alloc(sec.data.readInt32LE(0)); - let ptr = 0; - do { - sec = read_section(gif, sec.end); - sec.data.copy(ret, ptr); - ptr += sec.data.byteLength; - end = sec.end; - } while (sec.appname == "DOOMTECH" && gif[end] == "!".charCodeAt(0)); - return decodeCoom3Payload(ret); - } - const cond = () => sec.appname == "VOOMTECH" || sec.appname == "ANIMEXTS"; - if (cond()) { - const ret = import_buffer5.Buffer.alloc(sec.data.readInt32LE(0)); - let ptr = 0; - do { - sec = read_section(gif, sec.end); - sec.data.copy(ret, ptr); - ptr += sec.data.byteLength; - end = sec.end; - } while (cond() && gif[end] == "!".charCodeAt(0)); - xor3(ret, password3); - return decodeCoom3Payload(ret); - } - end = sec.end; - } - throw new Error("Shouldn't happen"); - }; - var extract3 = extractBuff; - var write_data = async (writer, inj) => { - await writer.write(magic3); - const byte = import_buffer5.Buffer.from([0]); - let size = inj.byteLength; - let ws; - let offset = 0; - while (size != 0) { - ws = size >= 255 ? 255 : size; - byte.writeUInt8(ws, 0); - await writer.write(byte); - await writer.write(inj.slice(offset, offset + ws)); - size -= ws; - offset += ws; - } - byte.writeUInt8(0, 0); - await writer.write(byte); - }; - var write_embedding = async (writer, inj) => { - const b = import_buffer5.Buffer.alloc(4); - b.writeInt32LE(inj.byteLength, 0); - await write_data(writer, b); - let size = inj.byteLength; - let offset = 0; - while (size != 0) { - const ws = size >= 3 << 13 ? 3 << 13 : size; - await write_data(writer, inj.slice(offset, offset + ws)); - offset += ws; - size -= ws; - } - }; - var inject3 = async (container, links) => { - const [writestream, extract7] = BufferWriteStream(); - const writer = writestream.getWriter(); - const inj = import_buffer5.Buffer.from(links.join(" ")); - xor3(inj, password3); - const contbuff = import_buffer5.Buffer.from(await container.arrayBuffer()); - const field = contbuff.readUInt8(10); - const gcte = !!(field & 1 << 7); - let endo = 13; - if (gcte) - endo += 3 * (1 << (field & 7) + 1); - if (netscape.compare(contbuff, endo, endo + netscape.byteLength) == 0) - endo += 19; - await writer.write(contbuff.slice(0, endo)); - await write_embedding(writer, import_buffer5.Buffer.from(inj)); - await writer.write(contbuff.slice(endo)); - return extract7(); - }; - var has_embed3 = (gif) => { - const field = gif.readUInt8(10); - const gcte = !!(field & 1 << 7); - let end = 13; - if (gcte) { - end += 3 * (1 << (field & 7) + 1); - } - while (end < gif.byteLength && gif.readUInt8(end) == "!".charCodeAt(0)) { - if ([magic, magic2, magic3].every((m) => m.compare(gif, end, end + m.byteLength) != 0)) { - end += 3 + gif.readUInt8(end + 2); - while (true) { - const v = gif.readUInt8(end++); - if (!v) - break; - end += v; - } - } else { - return true; - } - } - if (end >= gif.byteLength) - return; - return false; - }; - var gif_default = { - extract: extract3, - has_embed: has_embed3, - inject: inject3, - match: (fn) => !!fn.match(/\.gif$/) - }; - // src/jpg.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer6 = __toESM(require_buffer(), 1); + var import_buffer4 = __toESM(require_buffer(), 1); // src/f5stego.ts init_define_BUILD_VERSION(); @@ -23745,23 +13502,23 @@ const _DOMParser = DOMParser; }; // src/jpg.ts - var key = import_buffer6.Buffer.from("CUNNYCUNNYCUNNY"); + var key = import_buffer4.Buffer.from("CUNNYCUNNYCUNNY"); var f5inst = new f5stego(key); - var inject4 = async (b, links) => { + var inject2 = async (b, links) => { if (b.size / 20 < links.join(" ").length) throw "Image too small to embed."; const arr = new Uint8Array(new Uint8Array(await b.arrayBuffer())); const buff = f5inst.embed(arr, new TextEncoder().encode(links.join(" ")), 1); - return import_buffer6.Buffer.from(buff); + return import_buffer4.Buffer.from(buff); }; - var has_embed4 = (b) => { + var has_embed2 = (b) => { try { const res = f5inst.extract(b); if (!res) return false; if (res.length > 1024) return false; - const str = import_buffer6.Buffer.from(res).toString(); + const str = import_buffer4.Buffer.from(res).toString(); if (!str.match(/^[a-zA-Z0-9:/.\-_ ]+$/)) return false; return str; @@ -23769,20 +13526,20 @@ const _DOMParser = DOMParser; return false; } }; - var extract4 = (b, ex) => { - return decodeCoom3Payload(import_buffer6.Buffer.from(ex)); + var extract2 = (b, ex) => { + return decodeCoom3Payload(import_buffer4.Buffer.from(ex)); }; var jpg_default = { match: (fn) => !!fn.match(/\.jpe?g$/), - has_embed: has_embed4, - extract: extract4, - inject: inject4 + has_embed: has_embed2, + extract: extract2, + inject: inject2 }; // src/thirdeye.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer7 = __toESM(require_buffer(), 1); + var import_buffer5 = __toESM(require_buffer(), 1); var import_jpeg_js = __toESM(require_jpeg_js(), 1); // src/phash.ts @@ -23898,7 +13655,7 @@ const _DOMParser = DOMParser; return []; } }; - var extract5 = async (b, fn) => { + var extract3 = async (b, fn) => { if (!csettings3) throw new Error("Settings uninit"); let result; @@ -23922,12 +13679,8 @@ const _DOMParser = DOMParser; url: result[0].page }, filename: fn.substring(0, 33) + result[0].ext, - thumbnail: csettings3.hotlink ? prev || full : import_buffer7.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings3.hotlink ? full || prev : async (lsn) => { - if (!cachedFile) - cachedFile = await (await ifetch(full || prev, void 0, lsn)).arrayBuffer(); - return import_buffer7.Buffer.from(cachedFile); - } + thumbnail: csettings3.hotlink ? prev || full : import_buffer5.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), + data: csettings3.hotlink ? full || prev : { url: full || prev } }]; }; var phash = (b) => { @@ -23943,8 +13696,8 @@ const _DOMParser = DOMParser; } return acc; }; - var has_embed5 = async (b, fn, prevlink) => { - if (import_buffer7.Buffer.from(fn, "hex").equals(b)) + var has_embed3 = async (b, fn, prevlink) => { + if (import_buffer5.Buffer.from(fn, "hex").equals(b)) return false; let result = void 0; for (const e of Object.values(boorus)) { @@ -23961,7 +13714,7 @@ const _DOMParser = DOMParser; const getHash = async (l) => { const ogreq = await ifetch(l); const origPreview = await ogreq.arrayBuffer(); - return phash(import_buffer7.Buffer.from(origPreview)); + return phash(import_buffer5.Buffer.from(origPreview)); }; const [orighash, tehash] = await Promise.all([ getHash(prevlink), @@ -23975,15 +13728,15 @@ const _DOMParser = DOMParser; }; var thirdeye_default = { skip: true, - extract: extract5, - has_embed: has_embed5, + extract: extract3, + has_embed: has_embed3, match: (fn) => !!fn.match(/^[0-9a-f]{32}\.....?/) }; // src/pomf.ts init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer8 = __toESM(require_buffer(), 1); + var import_buffer6 = __toESM(require_buffer(), 1); var sources = [ { host: "Catbox", prefix: "files.catbox.moe/" }, { host: "Litter", prefix: "litter.catbox.moe/" }, @@ -24016,7 +13769,7 @@ const _DOMParser = DOMParser; } return { ext, source }; }; - var extract6 = async (b, fn) => { + var extract4 = async (b, fn) => { if (!csettings4) throw new Error("Settings uninit"); const { ext, source } = getExt(fn); @@ -24033,16 +13786,11 @@ const _DOMParser = DOMParser; } return [{ filename: ext, - data: csettings4.hotlink ? rsource : async (lsn) => { - try { - return import_buffer8.Buffer.from(await (await ifetch(rsource, void 0, lsn)).arrayBuffer()); - } catch (e) { - } - }, - thumbnail: import_buffer8.Buffer.from(hasembed_default) + data: csettings4.hotlink ? rsource : { url: rsource }, + thumbnail: import_buffer6.Buffer.from(hasembed_default) }]; }; - var has_embed6 = async (b, fn) => { + var has_embed4 = async (b, fn) => { const { ext, source } = getExt(fn); if (!ext) return false; @@ -24059,8 +13807,8 @@ const _DOMParser = DOMParser; }; var pomf_default = { skip: true, - extract: extract6, - has_embed: has_embed6, + extract: extract4, + has_embed: has_embed4, match: (fn) => !!getExt(fn) }; @@ -24780,7 +14528,7 @@ const _DOMParser = DOMParser; // src/Components/Embedding.svelte init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer9 = __toESM(require_buffer(), 1); + var import_buffer7 = __toESM(require_buffer(), 1); function add_css6(target) { append_styles(target, "svelte-olzxr6", ".plaace.svelte-olzxr6.svelte-olzxr6{cursor:pointer;max-width:100vw;max-height:100vh}.unzipping.svelte-olzxr6>img.svelte-olzxr6{filter:brightness(0.5) blur(10px)}.progress.svelte-olzxr6.svelte-olzxr6{color:black;-webkit-text-stroke:0.7px white;font-weight:bold;left:50%;top:50%;font-size:larger;display:inline-block;position:absolute;z-index:10}.hoverer.svelte-olzxr6.svelte-olzxr6{display:none;position:fixed;pointer-events:none}.visible.svelte-olzxr6.svelte-olzxr6{display:block;z-index:9}.contract.svelte-olzxr6 img.svelte-olzxr6,.contract.svelte-olzxr6 video.svelte-olzxr6{max-width:125px !important;max-height:125px !important;width:auto;height:auto}.plaace.svelte-olzxr6:not(.contract) video.svelte-olzxr6,.plaace.svelte-olzxr6:not(.contract) img.svelte-olzxr6,.hoverer.svelte-olzxr6>video.svelte-olzxr6,.hoverer.svelte-olzxr6>img.svelte-olzxr6{max-width:100vw;max-height:100vh}"); } @@ -25318,7 +15066,7 @@ const _DOMParser = DOMParser; const thumb = file.thumbnail || file.data; let type; if (typeof thumb != "string") { - let buff = import_buffer9.Buffer.isBuffer(thumb) ? thumb : await thumb(); + let buff = thumb instanceof Uint8Array ? thumb : await thumb(); type = await fileTypeFromBuffer(buff); if (!type && file.filename.endsWith(".txt") && file.filename.startsWith("message")) { type = { ext: "txt", mime: "text/plain" }; @@ -25382,7 +15130,7 @@ const _DOMParser = DOMParser; lisn.addEventListener("progress", (e) => { $$invalidate(18, progress = e.detail); }); - let full = import_buffer9.Buffer.isBuffer(file.data) ? file.data : await file.data(lisn); + let full = file.data instanceof Uint8Array ? file.data : await file.data(lisn); type = await fileTypeFromBuffer(full); if (!type && file.filename.endsWith(".txt") && file.filename.startsWith("message")) { type = { ext: "txt", mime: "text/plain" }; @@ -29852,7 +19600,7 @@ const _DOMParser = DOMParser; // src/Components/EyeButton.svelte init_define_BUILD_VERSION(); init_esbuild_inject(); - var import_buffer10 = __toESM(require_buffer(), 1); + var import_buffer8 = __toESM(require_buffer(), 1); function add_css12(target) { append_styles(target, "svelte-64lw6s", ".clickable.svelte-64lw6s{cursor:pointer;margin-left:5px}.clickable.svelte-64lw6s:hover{text-shadow:0 0 4px palevioletred}"); } @@ -30200,7 +19948,7 @@ const _DOMParser = DOMParser; a.style.display = "none"; let url; if (typeof file.data != "string") { - const thumb = import_buffer10.Buffer.isBuffer(file.data) ? file.data : await file.data(); + const thumb = file.data instanceof Uint8Array ? file.data : await file.data(); const type = await fileTypeFromBuffer(thumb); url = URL.createObjectURL(new Blob([thumb], { type: type?.mime })); } else @@ -30454,11 +20202,7 @@ const _DOMParser = DOMParser; catalogControlHost: () => document.getElementById("index-options"), getImageLink: async function* (post) { if (location.host == "arch.b4k.co") { - const pid = post.id.match(/\d+/)[0]; - const board = location.pathname.match(/\/(..?.?)\//)[1]; - const res = await ifetch(`https://archive.wakarimasen.moe/_/api/chan/post/?board=${board}&num=${pid}`); - const data = await res.json(); - yield data.media.media_link; + return; } yield post.querySelector("a[rel]")?.getAttribute("href") || ""; }, @@ -31687,12 +21431,33 @@ const _DOMParser = DOMParser; }; var ViewCount_default = ViewCount; + // src/processor.worker.ts + init_define_BUILD_VERSION(); + init_esbuild_inject(); + + // inline-worker:__inline-worker + init_define_BUILD_VERSION(); + init_esbuild_inject(); + function inlineWorker(scriptText) { + let blob = new Blob([scriptText], { type: "text/javascript" }); + let url = URL.createObjectURL(blob); + let worker = new Worker(url); + URL.revokeObjectURL(url); + return worker; + } + + // src/processor.worker.ts + function Worker2() { + return inlineWorker('var __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n};\nvar __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key2 of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key2) && key2 !== except)\n __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));\nvar __decorateClass = (decorators, target, key2, kind) => {\n var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;\n for (var i = decorators.length - 1, decorator; i >= 0; i--)\n if (decorator = decorators[i])\n result = (kind ? decorator(target, key2, result) : decorator(result)) || result;\n if (kind && result)\n __defProp(target, key2, result);\n return result;\n};\nvar __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError("Cannot " + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, "read from private field");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError("Cannot add the same private member more than once");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, "write to private field");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, "access private method");\n return method;\n};\nvar __toBinary = /* @__PURE__ */ (() => {\n var table = new Uint8Array(128);\n for (var i = 0; i < 64; i++)\n table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;\n return (base64) => {\n var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0);\n for (var i2 = 0, j = 0; i2 < n; ) {\n var c0 = table[base64.charCodeAt(i2++)], c1 = table[base64.charCodeAt(i2++)];\n var c2 = table[base64.charCodeAt(i2++)], c3 = table[base64.charCodeAt(i2++)];\n bytes[j++] = c0 << 2 | c1 >> 4;\n bytes[j++] = c1 << 4 | c2 >> 2;\n bytes[j++] = c2 << 6 | c3;\n }\n return bytes;\n };\n})();\n\n// \nvar init_define_BUILD_VERSION = __esm({\n ""() {\n }\n});\n\n// node_modules/base64-js/index.js\nvar require_base64_js = __commonJS({\n "node_modules/base64-js/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports.byteLength = byteLength;\n exports.toByteArray = toByteArray;\n exports.fromByteArray = fromByteArray;\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;\n var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n for (i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n var i;\n var len;\n revLookup["-".charCodeAt(0)] = 62;\n revLookup["_".charCodeAt(0)] = 63;\n function getLens(b64) {\n var len2 = b64.length;\n if (len2 % 4 > 0) {\n throw new Error("Invalid string. Length must be a multiple of 4");\n }\n var validLen = b64.indexOf("=");\n if (validLen === -1)\n validLen = len2;\n var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n }\n function byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function _byteLength(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n }\n function toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0;\n var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i2;\n for (i2 = 0; i2 < len2; i2 += 4) {\n tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];\n arr[curByte++] = tmp >> 16 & 255;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 2) {\n tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;\n arr[curByte++] = tmp & 255;\n }\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 255;\n arr[curByte++] = tmp & 255;\n }\n return arr;\n }\n function tripletToBase64(num) {\n return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\n }\n function encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n for (var i2 = start; i2 < end; i2 += 3) {\n tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);\n output.push(tripletToBase64(tmp));\n }\n return output.join("");\n }\n function fromByteArray(uint8) {\n var tmp;\n var len2 = uint8.length;\n var extraBytes = len2 % 3;\n var parts = [];\n var maxChunkLength = 16383;\n for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {\n parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));\n }\n if (extraBytes === 1) {\n tmp = uint8[len2 - 1];\n parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");\n } else if (extraBytes === 2) {\n tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];\n parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");\n }\n return parts.join("");\n }\n }\n});\n\n// node_modules/ieee754/index.js\nvar require_ieee754 = __commonJS({\n "node_modules/ieee754/index.js"(exports) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports.read = function(buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? nBytes - 1 : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n i += d;\n e = s & (1 << -nBits) - 1;\n s >>= -nBits;\n nBits += eLen;\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {\n }\n m = e & (1 << -nBits) - 1;\n e >>= -nBits;\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {\n }\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : (s ? -1 : 1) * Infinity;\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen);\n };\n exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;\n var i = isLE ? 0 : nBytes - 1;\n var d = isLE ? 1 : -1;\n var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n value = Math.abs(value);\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {\n }\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {\n }\n buffer[offset + i - d] |= s * 128;\n };\n }\n});\n\n// node_modules/buffer/index.js\nvar require_buffer = __commonJS({\n "node_modules/buffer/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var base64 = require_base64_js();\n var ieee7542 = require_ieee754();\n var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;\n exports.Buffer = Buffer13;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n var K_MAX_LENGTH = 2147483647;\n exports.kMaxLength = K_MAX_LENGTH;\n Buffer13.TYPED_ARRAY_SUPPORT = typedArraySupport();\n if (!Buffer13.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {\n console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");\n }\n function typedArraySupport() {\n try {\n const arr = new Uint8Array(1);\n const proto = { foo: function() {\n return 42;\n } };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42;\n } catch (e) {\n return false;\n }\n }\n Object.defineProperty(Buffer13.prototype, "parent", {\n enumerable: true,\n get: function() {\n if (!Buffer13.isBuffer(this))\n return void 0;\n return this.buffer;\n }\n });\n Object.defineProperty(Buffer13.prototype, "offset", {\n enumerable: true,\n get: function() {\n if (!Buffer13.isBuffer(this))\n return void 0;\n return this.byteOffset;\n }\n });\n function createBuffer(length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError(\'The value "\' + length + \'" is invalid for option "size"\');\n }\n const buf2 = new Uint8Array(length);\n Object.setPrototypeOf(buf2, Buffer13.prototype);\n return buf2;\n }\n function Buffer13(arg, encodingOrOffset, length) {\n if (typeof arg === "number") {\n if (typeof encodingOrOffset === "string") {\n throw new TypeError(\'The "string" argument must be of type string. Received type number\');\n }\n return allocUnsafe(arg);\n }\n return from(arg, encodingOrOffset, length);\n }\n Buffer13.poolSize = 8192;\n function from(value, encodingOrOffset, length) {\n if (typeof value === "string") {\n return fromString(value, encodingOrOffset);\n }\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value);\n }\n if (value == null) {\n throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);\n }\n if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length);\n }\n if (typeof value === "number") {\n throw new TypeError(\'The "value" argument must not be of type number. Received type number\');\n }\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer13.from(valueOf, encodingOrOffset, length);\n }\n const b = fromObject(value);\n if (b)\n return b;\n if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {\n return Buffer13.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);\n }\n throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);\n }\n Buffer13.from = function(value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length);\n };\n Object.setPrototypeOf(Buffer13.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer13, Uint8Array);\n function assertSize(size) {\n if (typeof size !== "number") {\n throw new TypeError(\'"size" argument must be of type number\');\n } else if (size < 0) {\n throw new RangeError(\'The value "\' + size + \'" is invalid for option "size"\');\n }\n }\n function alloc(size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size);\n }\n if (fill !== void 0) {\n return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);\n }\n return createBuffer(size);\n }\n Buffer13.alloc = function(size, fill, encoding) {\n return alloc(size, fill, encoding);\n };\n function allocUnsafe(size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0);\n }\n Buffer13.allocUnsafe = function(size) {\n return allocUnsafe(size);\n };\n Buffer13.allocUnsafeSlow = function(size) {\n return allocUnsafe(size);\n };\n function fromString(string, encoding) {\n if (typeof encoding !== "string" || encoding === "") {\n encoding = "utf8";\n }\n if (!Buffer13.isEncoding(encoding)) {\n throw new TypeError("Unknown encoding: " + encoding);\n }\n const length = byteLength(string, encoding) | 0;\n let buf2 = createBuffer(length);\n const actual = buf2.write(string, encoding);\n if (actual !== length) {\n buf2 = buf2.slice(0, actual);\n }\n return buf2;\n }\n function fromArrayLike(array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0;\n const buf2 = createBuffer(length);\n for (let i = 0; i < length; i += 1) {\n buf2[i] = array[i] & 255;\n }\n return buf2;\n }\n function fromArrayView(arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);\n }\n return fromArrayLike(arrayView);\n }\n function fromArrayBuffer(array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError(\'"offset" is outside of buffer bounds\');\n }\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError(\'"length" is outside of buffer bounds\');\n }\n let buf2;\n if (byteOffset === void 0 && length === void 0) {\n buf2 = new Uint8Array(array);\n } else if (length === void 0) {\n buf2 = new Uint8Array(array, byteOffset);\n } else {\n buf2 = new Uint8Array(array, byteOffset, length);\n }\n Object.setPrototypeOf(buf2, Buffer13.prototype);\n return buf2;\n }\n function fromObject(obj) {\n if (Buffer13.isBuffer(obj)) {\n const len = checked(obj.length) | 0;\n const buf2 = createBuffer(len);\n if (buf2.length === 0) {\n return buf2;\n }\n obj.copy(buf2, 0, 0, len);\n return buf2;\n }\n if (obj.length !== void 0) {\n if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {\n return createBuffer(0);\n }\n return fromArrayLike(obj);\n }\n if (obj.type === "Buffer" && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n }\n function checked(length) {\n if (length >= K_MAX_LENGTH) {\n throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");\n }\n return length | 0;\n }\n function SlowBuffer(length) {\n if (+length != length) {\n length = 0;\n }\n return Buffer13.alloc(+length);\n }\n Buffer13.isBuffer = function isBuffer(b) {\n return b != null && b._isBuffer === true && b !== Buffer13.prototype;\n };\n Buffer13.compare = function compare(a, b) {\n if (isInstance(a, Uint8Array))\n a = Buffer13.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array))\n b = Buffer13.from(b, b.offset, b.byteLength);\n if (!Buffer13.isBuffer(a) || !Buffer13.isBuffer(b)) {\n throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');\n }\n if (a === b)\n return 0;\n let x = a.length;\n let y = b.length;\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n if (x < y)\n return -1;\n if (y < x)\n return 1;\n return 0;\n };\n Buffer13.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case "hex":\n case "utf8":\n case "utf-8":\n case "ascii":\n case "latin1":\n case "binary":\n case "base64":\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return true;\n default:\n return false;\n }\n };\n Buffer13.concat = function concat(list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\');\n }\n if (list.length === 0) {\n return Buffer13.alloc(0);\n }\n let i;\n if (length === void 0) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n const buffer = Buffer13.allocUnsafe(length);\n let pos = 0;\n for (i = 0; i < list.length; ++i) {\n let buf2 = list[i];\n if (isInstance(buf2, Uint8Array)) {\n if (pos + buf2.length > buffer.length) {\n if (!Buffer13.isBuffer(buf2))\n buf2 = Buffer13.from(buf2);\n buf2.copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(buffer, buf2, pos);\n }\n } else if (!Buffer13.isBuffer(buf2)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\');\n } else {\n buf2.copy(buffer, pos);\n }\n pos += buf2.length;\n }\n return buffer;\n };\n function byteLength(string, encoding) {\n if (Buffer13.isBuffer(string)) {\n return string.length;\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength;\n }\n if (typeof string !== "string") {\n throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \' + typeof string);\n }\n const len = string.length;\n const mustMatch = arguments.length > 2 && arguments[2] === true;\n if (!mustMatch && len === 0)\n return 0;\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case "ascii":\n case "latin1":\n case "binary":\n return len;\n case "utf8":\n case "utf-8":\n return utf8ToBytes(string).length;\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return len * 2;\n case "hex":\n return len >>> 1;\n case "base64":\n return base64ToBytes(string).length;\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length;\n }\n encoding = ("" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer13.byteLength = byteLength;\n function slowToString(encoding, start, end) {\n let loweredCase = false;\n if (start === void 0 || start < 0) {\n start = 0;\n }\n if (start > this.length) {\n return "";\n }\n if (end === void 0 || end > this.length) {\n end = this.length;\n }\n if (end <= 0) {\n return "";\n }\n end >>>= 0;\n start >>>= 0;\n if (end <= start) {\n return "";\n }\n if (!encoding)\n encoding = "utf8";\n while (true) {\n switch (encoding) {\n case "hex":\n return hexSlice(this, start, end);\n case "utf8":\n case "utf-8":\n return utf8Slice(this, start, end);\n case "ascii":\n return asciiSlice(this, start, end);\n case "latin1":\n case "binary":\n return latin1Slice(this, start, end);\n case "base64":\n return base64Slice(this, start, end);\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return utf16leSlice(this, start, end);\n default:\n if (loweredCase)\n throw new TypeError("Unknown encoding: " + encoding);\n encoding = (encoding + "").toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer13.prototype._isBuffer = true;\n function swap(b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n Buffer13.prototype.swap16 = function swap16() {\n const len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 16-bits");\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this;\n };\n Buffer13.prototype.swap32 = function swap32() {\n const len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 32-bits");\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n };\n Buffer13.prototype.swap64 = function swap64() {\n const len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError("Buffer size must be a multiple of 64-bits");\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n };\n Buffer13.prototype.toString = function toString() {\n const length = this.length;\n if (length === 0)\n return "";\n if (arguments.length === 0)\n return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n };\n Buffer13.prototype.toLocaleString = Buffer13.prototype.toString;\n Buffer13.prototype.equals = function equals(b) {\n if (!Buffer13.isBuffer(b))\n throw new TypeError("Argument must be a Buffer");\n if (this === b)\n return true;\n return Buffer13.compare(this, b) === 0;\n };\n Buffer13.prototype.inspect = function inspect() {\n let str = "";\n const max = exports.INSPECT_MAX_BYTES;\n str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();\n if (this.length > max)\n str += " ... ";\n return "";\n };\n if (customInspectSymbol) {\n Buffer13.prototype[customInspectSymbol] = Buffer13.prototype.inspect;\n }\n Buffer13.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer13.from(target, target.offset, target.byteLength);\n }\n if (!Buffer13.isBuffer(target)) {\n throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \' + typeof target);\n }\n if (start === void 0) {\n start = 0;\n }\n if (end === void 0) {\n end = target ? target.length : 0;\n }\n if (thisStart === void 0) {\n thisStart = 0;\n }\n if (thisEnd === void 0) {\n thisEnd = this.length;\n }\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError("out of range index");\n }\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n if (thisStart >= thisEnd) {\n return -1;\n }\n if (start >= end) {\n return 1;\n }\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target)\n return 0;\n let x = thisEnd - thisStart;\n let y = end - start;\n const len = Math.min(x, y);\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n if (x < y)\n return -1;\n if (y < x)\n return 1;\n return 0;\n };\n function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n if (buffer.length === 0)\n return -1;\n if (typeof byteOffset === "string") {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 2147483647) {\n byteOffset = 2147483647;\n } else if (byteOffset < -2147483648) {\n byteOffset = -2147483648;\n }\n byteOffset = +byteOffset;\n if (numberIsNaN(byteOffset)) {\n byteOffset = dir ? 0 : buffer.length - 1;\n }\n if (byteOffset < 0)\n byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir)\n return -1;\n else\n byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir)\n byteOffset = 0;\n else\n return -1;\n }\n if (typeof val === "string") {\n val = Buffer13.from(val, encoding);\n }\n if (Buffer13.isBuffer(val)) {\n if (val.length === 0) {\n return -1;\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === "number") {\n val = val & 255;\n if (typeof Uint8Array.prototype.indexOf === "function") {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);\n }\n throw new TypeError("val must be string, number or Buffer");\n }\n function arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n let indexSize = 1;\n let arrLength = arr.length;\n let valLength = val.length;\n if (encoding !== void 0) {\n encoding = String(encoding).toLowerCase();\n if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n function read2(buf2, i2) {\n if (indexSize === 1) {\n return buf2[i2];\n } else {\n return buf2.readUInt16BE(i2 * indexSize);\n }\n }\n let i;\n if (dir) {\n let foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1)\n foundIndex = i;\n if (i - foundIndex + 1 === valLength)\n return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1)\n i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength)\n byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read2(arr, i + j) !== read2(val, j)) {\n found = false;\n break;\n }\n }\n if (found)\n return i;\n }\n }\n return -1;\n }\n Buffer13.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n };\n Buffer13.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n };\n Buffer13.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n };\n function hexWrite(buf2, string, offset, length) {\n offset = Number(offset) || 0;\n const remaining = buf2.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n const strLen = string.length;\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n let i;\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed))\n return i;\n buf2[offset + i] = parsed;\n }\n return i;\n }\n function utf8Write(buf2, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf2.length - offset), buf2, offset, length);\n }\n function asciiWrite(buf2, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf2, offset, length);\n }\n function base64Write(buf2, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf2, offset, length);\n }\n function ucs2Write(buf2, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf2.length - offset), buf2, offset, length);\n }\n Buffer13.prototype.write = function write2(string, offset, length, encoding) {\n if (offset === void 0) {\n encoding = "utf8";\n length = this.length;\n offset = 0;\n } else if (length === void 0 && typeof offset === "string") {\n encoding = offset;\n length = this.length;\n offset = 0;\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === void 0)\n encoding = "utf8";\n } else {\n encoding = length;\n length = void 0;\n }\n } else {\n throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");\n }\n const remaining = this.length - offset;\n if (length === void 0 || length > remaining)\n length = remaining;\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError("Attempt to write outside buffer bounds");\n }\n if (!encoding)\n encoding = "utf8";\n let loweredCase = false;\n for (; ; ) {\n switch (encoding) {\n case "hex":\n return hexWrite(this, string, offset, length);\n case "utf8":\n case "utf-8":\n return utf8Write(this, string, offset, length);\n case "ascii":\n case "latin1":\n case "binary":\n return asciiWrite(this, string, offset, length);\n case "base64":\n return base64Write(this, string, offset, length);\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return ucs2Write(this, string, offset, length);\n default:\n if (loweredCase)\n throw new TypeError("Unknown encoding: " + encoding);\n encoding = ("" + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n Buffer13.prototype.toJSON = function toJSON() {\n return {\n type: "Buffer",\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n };\n function base64Slice(buf2, start, end) {\n if (start === 0 && end === buf2.length) {\n return base64.fromByteArray(buf2);\n } else {\n return base64.fromByteArray(buf2.slice(start, end));\n }\n }\n function utf8Slice(buf2, start, end) {\n end = Math.min(buf2.length, end);\n const res = [];\n let i = start;\n while (i < end) {\n const firstByte = buf2[i];\n let codePoint = null;\n let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint;\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 128) {\n codePoint = firstByte;\n }\n break;\n case 2:\n secondByte = buf2[i + 1];\n if ((secondByte & 192) === 128) {\n tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;\n if (tempCodePoint > 127) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 3:\n secondByte = buf2[i + 1];\n thirdByte = buf2[i + 2];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;\n if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {\n codePoint = tempCodePoint;\n }\n }\n break;\n case 4:\n secondByte = buf2[i + 1];\n thirdByte = buf2[i + 2];\n fourthByte = buf2[i + 3];\n if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {\n tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;\n if (tempCodePoint > 65535 && tempCodePoint < 1114112) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n if (codePoint === null) {\n codePoint = 65533;\n bytesPerSequence = 1;\n } else if (codePoint > 65535) {\n codePoint -= 65536;\n res.push(codePoint >>> 10 & 1023 | 55296);\n codePoint = 56320 | codePoint & 1023;\n }\n res.push(codePoint);\n i += bytesPerSequence;\n }\n return decodeCodePointsArray(res);\n }\n var MAX_ARGUMENTS_LENGTH = 4096;\n function decodeCodePointsArray(codePoints) {\n const len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints);\n }\n let res = "";\n let i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));\n }\n return res;\n }\n function asciiSlice(buf2, start, end) {\n let ret = "";\n end = Math.min(buf2.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf2[i] & 127);\n }\n return ret;\n }\n function latin1Slice(buf2, start, end) {\n let ret = "";\n end = Math.min(buf2.length, end);\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf2[i]);\n }\n return ret;\n }\n function hexSlice(buf2, start, end) {\n const len = buf2.length;\n if (!start || start < 0)\n start = 0;\n if (!end || end < 0 || end > len)\n end = len;\n let out = "";\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf2[i]];\n }\n return out;\n }\n function utf16leSlice(buf2, start, end) {\n const bytes = buf2.slice(start, end);\n let res = "";\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n return res;\n }\n Buffer13.prototype.slice = function slice(start, end) {\n const len = this.length;\n start = ~~start;\n end = end === void 0 ? len : ~~end;\n if (start < 0) {\n start += len;\n if (start < 0)\n start = 0;\n } else if (start > len) {\n start = len;\n }\n if (end < 0) {\n end += len;\n if (end < 0)\n end = 0;\n } else if (end > len) {\n end = len;\n }\n if (end < start)\n end = start;\n const newBuf = this.subarray(start, end);\n Object.setPrototypeOf(newBuf, Buffer13.prototype);\n return newBuf;\n };\n function checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0)\n throw new RangeError("offset is not uint");\n if (offset + ext > length)\n throw new RangeError("Trying to access beyond buffer length");\n }\n Buffer13.prototype.readUintLE = Buffer13.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n return val;\n };\n Buffer13.prototype.readUintBE = Buffer13.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength2, this.length);\n }\n let val = this[offset + --byteLength2];\n let mul = 1;\n while (byteLength2 > 0 && (mul *= 256)) {\n val += this[offset + --byteLength2] * mul;\n }\n return val;\n };\n Buffer13.prototype.readUint8 = Buffer13.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 1, this.length);\n return this[offset];\n };\n Buffer13.prototype.readUint16LE = Buffer13.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n };\n Buffer13.prototype.readUint16BE = Buffer13.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n };\n Buffer13.prototype.readUint32LE = Buffer13.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;\n };\n Buffer13.prototype.readUint32BE = Buffer13.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n };\n Buffer13.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;\n const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;\n return BigInt(lo) + (BigInt(hi) << BigInt(32));\n });\n Buffer13.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;\n return (BigInt(hi) << BigInt(32)) + BigInt(lo);\n });\n Buffer13.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength2 && (mul *= 256)) {\n val += this[offset + i] * mul;\n }\n mul *= 128;\n if (val >= mul)\n val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer13.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert)\n checkOffset(offset, byteLength2, this.length);\n let i = byteLength2;\n let mul = 1;\n let val = this[offset + --i];\n while (i > 0 && (mul *= 256)) {\n val += this[offset + --i] * mul;\n }\n mul *= 128;\n if (val >= mul)\n val -= Math.pow(2, 8 * byteLength2);\n return val;\n };\n Buffer13.prototype.readInt8 = function readInt8(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 1, this.length);\n if (!(this[offset] & 128))\n return this[offset];\n return (255 - this[offset] + 1) * -1;\n };\n Buffer13.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n const val = this[offset] | this[offset + 1] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer13.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 2, this.length);\n const val = this[offset + 1] | this[offset] << 8;\n return val & 32768 ? val | 4294901760 : val;\n };\n Buffer13.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\n };\n Buffer13.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n };\n Buffer13.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);\n return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);\n });\n Buffer13.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {\n offset = offset >>> 0;\n validateNumber(offset, "offset");\n const first = this[offset];\n const last = this[offset + 7];\n if (first === void 0 || last === void 0) {\n boundsError(offset, this.length - 8);\n }\n const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\n return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);\n });\n Buffer13.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return ieee7542.read(this, offset, true, 23, 4);\n };\n Buffer13.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 4, this.length);\n return ieee7542.read(this, offset, false, 23, 4);\n };\n Buffer13.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 8, this.length);\n return ieee7542.read(this, offset, true, 52, 8);\n };\n Buffer13.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert)\n checkOffset(offset, 8, this.length);\n return ieee7542.read(this, offset, false, 52, 8);\n };\n function checkInt(buf2, value, offset, ext, max, min) {\n if (!Buffer13.isBuffer(buf2))\n throw new TypeError(\'"buffer" argument must be a Buffer instance\');\n if (value > max || value < min)\n throw new RangeError(\'"value" argument is out of bounds\');\n if (offset + ext > buf2.length)\n throw new RangeError("Index out of range");\n }\n Buffer13.prototype.writeUintLE = Buffer13.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let mul = 1;\n let i = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeUintBE = Buffer13.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength2 = byteLength2 >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength2) - 1;\n checkInt(this, value, offset, byteLength2, maxBytes, 0);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n this[offset + i] = value / mul & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeUint8 = Buffer13.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 1, 255, 0);\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer13.prototype.writeUint16LE = Buffer13.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer13.prototype.writeUint16BE = Buffer13.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 65535, 0);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer13.prototype.writeUint32LE = Buffer13.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset + 3] = value >>> 24;\n this[offset + 2] = value >>> 16;\n this[offset + 1] = value >>> 8;\n this[offset] = value & 255;\n return offset + 4;\n };\n Buffer13.prototype.writeUint32BE = Buffer13.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 4294967295, 0);\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n function wrtBigUInt64LE(buf2, value, offset, min, max) {\n checkIntBI(value, min, max, buf2, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n lo = lo >> 8;\n buf2[offset++] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n hi = hi >> 8;\n buf2[offset++] = hi;\n return offset;\n }\n function wrtBigUInt64BE(buf2, value, offset, min, max) {\n checkIntBI(value, min, max, buf2, offset, 7);\n let lo = Number(value & BigInt(4294967295));\n buf2[offset + 7] = lo;\n lo = lo >> 8;\n buf2[offset + 6] = lo;\n lo = lo >> 8;\n buf2[offset + 5] = lo;\n lo = lo >> 8;\n buf2[offset + 4] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(4294967295));\n buf2[offset + 3] = hi;\n hi = hi >> 8;\n buf2[offset + 2] = hi;\n hi = hi >> 8;\n buf2[offset + 1] = hi;\n hi = hi >> 8;\n buf2[offset] = hi;\n return offset + 8;\n }\n Buffer13.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));\n });\n Buffer13.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));\n });\n Buffer13.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = 0;\n let mul = 1;\n let sub = 0;\n this[offset] = value & 255;\n while (++i < byteLength2 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, 8 * byteLength2 - 1);\n checkInt(this, value, offset, byteLength2, limit - 1, -limit);\n }\n let i = byteLength2 - 1;\n let mul = 1;\n let sub = 0;\n this[offset + i] = value & 255;\n while (--i >= 0 && (mul *= 256)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = (value / mul >> 0) - sub & 255;\n }\n return offset + byteLength2;\n };\n Buffer13.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 1, 127, -128);\n if (value < 0)\n value = 255 + value + 1;\n this[offset] = value & 255;\n return offset + 1;\n };\n Buffer13.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n return offset + 2;\n };\n Buffer13.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 2, 32767, -32768);\n this[offset] = value >>> 8;\n this[offset + 1] = value & 255;\n return offset + 2;\n };\n Buffer13.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 2147483647, -2147483648);\n this[offset] = value & 255;\n this[offset + 1] = value >>> 8;\n this[offset + 2] = value >>> 16;\n this[offset + 3] = value >>> 24;\n return offset + 4;\n };\n Buffer13.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert)\n checkInt(this, value, offset, 4, 2147483647, -2147483648);\n if (value < 0)\n value = 4294967295 + value + 1;\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 255;\n return offset + 4;\n };\n Buffer13.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));\n });\n Buffer13.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));\n });\n function checkIEEE754(buf2, value, offset, ext, max, min) {\n if (offset + ext > buf2.length)\n throw new RangeError("Index out of range");\n if (offset < 0)\n throw new RangeError("Index out of range");\n }\n function writeFloat(buf2, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22);\n }\n ieee7542.write(buf2, value, offset, littleEndian, 23, 4);\n return offset + 4;\n }\n Buffer13.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert);\n };\n Buffer13.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert);\n };\n function writeDouble(buf2, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292);\n }\n ieee7542.write(buf2, value, offset, littleEndian, 52, 8);\n return offset + 8;\n }\n Buffer13.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert);\n };\n Buffer13.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert);\n };\n Buffer13.prototype.copy = function copy(target, targetStart, start, end) {\n if (!Buffer13.isBuffer(target))\n throw new TypeError("argument should be a Buffer");\n if (!start)\n start = 0;\n if (!end && end !== 0)\n end = this.length;\n if (targetStart >= target.length)\n targetStart = target.length;\n if (!targetStart)\n targetStart = 0;\n if (end > 0 && end < start)\n end = start;\n if (end === start)\n return 0;\n if (target.length === 0 || this.length === 0)\n return 0;\n if (targetStart < 0) {\n throw new RangeError("targetStart out of bounds");\n }\n if (start < 0 || start >= this.length)\n throw new RangeError("Index out of range");\n if (end < 0)\n throw new RangeError("sourceEnd out of bounds");\n if (end > this.length)\n end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n const len = end - start;\n if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);\n }\n return len;\n };\n Buffer13.prototype.fill = function fill(val, start, end, encoding) {\n if (typeof val === "string") {\n if (typeof start === "string") {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === "string") {\n encoding = end;\n end = this.length;\n }\n if (encoding !== void 0 && typeof encoding !== "string") {\n throw new TypeError("encoding must be a string");\n }\n if (typeof encoding === "string" && !Buffer13.isEncoding(encoding)) {\n throw new TypeError("Unknown encoding: " + encoding);\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0);\n if (encoding === "utf8" && code < 128 || encoding === "latin1") {\n val = code;\n }\n }\n } else if (typeof val === "number") {\n val = val & 255;\n } else if (typeof val === "boolean") {\n val = Number(val);\n }\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError("Out of range index");\n }\n if (end <= start) {\n return this;\n }\n start = start >>> 0;\n end = end === void 0 ? this.length : end >>> 0;\n if (!val)\n val = 0;\n let i;\n if (typeof val === "number") {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n const bytes = Buffer13.isBuffer(val) ? val : Buffer13.from(val, encoding);\n const len = bytes.length;\n if (len === 0) {\n throw new TypeError(\'The value "\' + val + \'" is invalid for argument "value"\');\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n return this;\n };\n var errors = {};\n function E(sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor() {\n super();\n Object.defineProperty(this, "message", {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n });\n this.name = `${this.name} [${sym}]`;\n this.stack;\n delete this.name;\n }\n get code() {\n return sym;\n }\n set code(value) {\n Object.defineProperty(this, "code", {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n toString() {\n return `${this.name} [${sym}]: ${this.message}`;\n }\n };\n }\n E("ERR_BUFFER_OUT_OF_BOUNDS", function(name) {\n if (name) {\n return `${name} is outside of buffer bounds`;\n }\n return "Attempt to access memory outside buffer bounds";\n }, RangeError);\n E("ERR_INVALID_ARG_TYPE", function(name, actual) {\n return `The "${name}" argument must be of type number. Received type ${typeof actual}`;\n }, TypeError);\n E("ERR_OUT_OF_RANGE", function(str, range, input) {\n let msg = `The value of "${str}" is out of range.`;\n let received = input;\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input));\n } else if (typeof input === "bigint") {\n received = String(input);\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received);\n }\n received += "n";\n }\n msg += ` It must be ${range}. Received ${received}`;\n return msg;\n }, RangeError);\n function addNumericalSeparator(val) {\n let res = "";\n let i = val.length;\n const start = val[0] === "-" ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`;\n }\n return `${val.slice(0, i)}${res}`;\n }\n function checkBounds(buf2, offset, byteLength2) {\n validateNumber(offset, "offset");\n if (buf2[offset] === void 0 || buf2[offset + byteLength2] === void 0) {\n boundsError(offset, buf2.length - (byteLength2 + 1));\n }\n }\n function checkIntBI(value, min, max, buf2, offset, byteLength2) {\n if (value > max || value < min) {\n const n = typeof min === "bigint" ? "n" : "";\n let range;\n if (byteLength2 > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;\n } else {\n range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`;\n }\n throw new errors.ERR_OUT_OF_RANGE("value", range, value);\n }\n checkBounds(buf2, offset, byteLength2);\n }\n function validateNumber(value, name) {\n if (typeof value !== "number") {\n throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);\n }\n }\n function boundsError(value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type);\n throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);\n }\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();\n }\n throw new errors.ERR_OUT_OF_RANGE(type || "offset", `>= ${type ? 1 : 0} and <= ${length}`, value);\n }\n var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n function base64clean(str) {\n str = str.split("=")[0];\n str = str.trim().replace(INVALID_BASE64_RE, "");\n if (str.length < 2)\n return "";\n while (str.length % 4 !== 0) {\n str = str + "=";\n }\n return str;\n }\n function utf8ToBytes(string, units) {\n units = units || Infinity;\n let codePoint;\n const length = string.length;\n let leadSurrogate = null;\n const bytes = [];\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n if (codePoint > 55295 && codePoint < 57344) {\n if (!leadSurrogate) {\n if (codePoint > 56319) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n continue;\n } else if (i + 1 === length) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n continue;\n }\n leadSurrogate = codePoint;\n continue;\n }\n if (codePoint < 56320) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n leadSurrogate = codePoint;\n continue;\n }\n codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;\n } else if (leadSurrogate) {\n if ((units -= 3) > -1)\n bytes.push(239, 191, 189);\n }\n leadSurrogate = null;\n if (codePoint < 128) {\n if ((units -= 1) < 0)\n break;\n bytes.push(codePoint);\n } else if (codePoint < 2048) {\n if ((units -= 2) < 0)\n break;\n bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);\n } else if (codePoint < 65536) {\n if ((units -= 3) < 0)\n break;\n bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else if (codePoint < 1114112) {\n if ((units -= 4) < 0)\n break;\n bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\n } else {\n throw new Error("Invalid code point");\n }\n }\n return bytes;\n }\n function asciiToBytes(str) {\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n byteArray.push(str.charCodeAt(i) & 255);\n }\n return byteArray;\n }\n function utf16leToBytes(str, units) {\n let c, hi, lo;\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0)\n break;\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n return byteArray;\n }\n function base64ToBytes(str) {\n return base64.toByteArray(base64clean(str));\n }\n function blitBuffer(src, dst, offset, length) {\n let i;\n for (i = 0; i < length; ++i) {\n if (i + offset >= dst.length || i >= src.length)\n break;\n dst[i + offset] = src[i];\n }\n return i;\n }\n function isInstance(obj, type) {\n return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;\n }\n function numberIsNaN(obj) {\n return obj !== obj;\n }\n var hexSliceLookupTable = function() {\n const alphabet = "0123456789abcdef";\n const table = new Array(256);\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16;\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table;\n }();\n function defineBigIntMethod(fn) {\n return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;\n }\n function BufferBigIntNotDefined() {\n throw new Error("BigInt not supported");\n }\n }\n});\n\n// esbuild.inject.js\nvar Buffer2;\nvar init_esbuild_inject = __esm({\n "esbuild.inject.js"() {\n "use strict";\n Buffer2 = require_buffer().Buffer;\n }\n});\n\n// node_modules/crc-32/crc32.js\nvar require_crc32 = __commonJS({\n "node_modules/crc-32/crc32.js"(exports) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var CRC32;\n (function(factory) {\n if (typeof DO_NOT_EXPORT_CRC === "undefined") {\n if (typeof exports === "object") {\n factory(exports);\n } else if (typeof define === "function" && define.amd) {\n define(function() {\n var module2 = {};\n factory(module2);\n return module2;\n });\n } else {\n factory(CRC32 = {});\n }\n } else {\n factory(CRC32 = {});\n }\n })(function(CRC322) {\n CRC322.version = "1.2.0";\n function signed_crc_table() {\n var c = 0, table = new Array(256);\n for (var n = 0; n != 256; ++n) {\n c = n;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;\n table[n] = c;\n }\n return typeof Int32Array !== "undefined" ? new Int32Array(table) : table;\n }\n var T = signed_crc_table();\n function crc32_bstr(bstr, seed) {\n var C = seed ^ -1, L = bstr.length - 1;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];\n }\n if (i === L)\n C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255];\n return C ^ -1;\n }\n function crc32_buf(buf2, seed) {\n if (buf2.length > 1e4)\n return crc32_buf_8(buf2, seed);\n var C = seed ^ -1, L = buf2.length - 3;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n }\n while (i < L + 3)\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n return C ^ -1;\n }\n function crc32_buf_8(buf2, seed) {\n var C = seed ^ -1, L = buf2.length - 7;\n for (var i = 0; i < L; ) {\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n }\n while (i < L + 7)\n C = C >>> 8 ^ T[(C ^ buf2[i++]) & 255];\n return C ^ -1;\n }\n function crc32_str(str, seed) {\n var C = seed ^ -1;\n for (var i = 0, L = str.length, c, d; i < L; ) {\n c = str.charCodeAt(i++);\n if (c < 128) {\n C = C >>> 8 ^ T[(C ^ c) & 255];\n } else if (c < 2048) {\n C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];\n } else if (c >= 55296 && c < 57344) {\n c = (c & 1023) + 64;\n d = str.charCodeAt(i++) & 1023;\n C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255];\n } else {\n C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255];\n C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];\n }\n }\n return C ^ -1;\n }\n CRC322.table = T;\n CRC322.bstr = crc32_bstr;\n CRC322.buf = crc32_buf;\n CRC322.str = crc32_str;\n });\n }\n});\n\n// node_modules/events/events.js\nvar require_events = __commonJS({\n "node_modules/events/events.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var R = typeof Reflect === "object" ? Reflect : null;\n var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n };\n var ReflectOwnKeys;\n if (R && typeof R.ownKeys === "function") {\n ReflectOwnKeys = R.ownKeys;\n } else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));\n };\n } else {\n ReflectOwnKeys = function ReflectOwnKeys2(target) {\n return Object.getOwnPropertyNames(target);\n };\n }\n function ProcessEmitWarning(warning) {\n if (console && console.warn)\n console.warn(warning);\n }\n var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {\n return value !== value;\n };\n function EventEmitter() {\n EventEmitter.init.call(this);\n }\n module.exports = EventEmitter;\n module.exports.once = once;\n EventEmitter.EventEmitter = EventEmitter;\n EventEmitter.prototype._events = void 0;\n EventEmitter.prototype._eventsCount = 0;\n EventEmitter.prototype._maxListeners = void 0;\n var defaultMaxListeners = 10;\n function checkListener(listener) {\n if (typeof listener !== "function") {\n throw new TypeError(\'The "listener" argument must be of type Function. Received type \' + typeof listener);\n }\n }\n Object.defineProperty(EventEmitter, "defaultMaxListeners", {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError(\'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received \' + arg + ".");\n }\n defaultMaxListeners = arg;\n }\n });\n EventEmitter.init = function() {\n if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n }\n this._maxListeners = this._maxListeners || void 0;\n };\n EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {\n throw new RangeError(\'The value of "n" is out of range. It must be a non-negative number. Received \' + n + ".");\n }\n this._maxListeners = n;\n return this;\n };\n function _getMaxListeners(that) {\n if (that._maxListeners === void 0)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n }\n EventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n };\n EventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++)\n args.push(arguments[i]);\n var doError = type === "error";\n var events = this._events;\n if (events !== void 0)\n doError = doError && events.error === void 0;\n else if (!doError)\n return false;\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n throw er;\n }\n var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));\n err.context = er;\n throw err;\n }\n var handler = events[type];\n if (handler === void 0)\n return false;\n if (typeof handler === "function") {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n return true;\n };\n function _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n checkListener(listener);\n events = target._events;\n if (events === void 0) {\n events = target._events = /* @__PURE__ */ Object.create(null);\n target._eventsCount = 0;\n } else {\n if (events.newListener !== void 0) {\n target.emit("newListener", type, listener.listener ? listener.listener : listener);\n events = target._events;\n }\n existing = events[type];\n }\n if (existing === void 0) {\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === "function") {\n existing = events[type] = prepend ? [listener, existing] : [existing, listener];\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");\n w.name = "MaxListenersExceededWarning";\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n return target;\n }\n EventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n };\n EventEmitter.prototype.on = EventEmitter.prototype.addListener;\n EventEmitter.prototype.prependListener = function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n function onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n }\n function _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: void 0, target, type, listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n }\n EventEmitter.prototype.once = function once2(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n EventEmitter.prototype.removeListener = function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n checkListener(listener);\n events = this._events;\n if (events === void 0)\n return this;\n list = events[type];\n if (list === void 0)\n return this;\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit("removeListener", type, list.listener || listener);\n }\n } else if (typeof list !== "function") {\n position = -1;\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n if (position < 0)\n return this;\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n if (list.length === 1)\n events[type] = list[0];\n if (events.removeListener !== void 0)\n this.emit("removeListener", type, originalListener || listener);\n }\n return this;\n };\n EventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {\n var listeners, events, i;\n events = this._events;\n if (events === void 0)\n return this;\n if (events.removeListener === void 0) {\n if (arguments.length === 0) {\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== void 0) {\n if (--this._eventsCount === 0)\n this._events = /* @__PURE__ */ Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key2;\n for (i = 0; i < keys.length; ++i) {\n key2 = keys[i];\n if (key2 === "removeListener")\n continue;\n this.removeAllListeners(key2);\n }\n this.removeAllListeners("removeListener");\n this._events = /* @__PURE__ */ Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n listeners = events[type];\n if (typeof listeners === "function") {\n this.removeListener(type, listeners);\n } else if (listeners !== void 0) {\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n return this;\n };\n function _listeners(target, type, unwrap) {\n var events = target._events;\n if (events === void 0)\n return [];\n var evlistener = events[type];\n if (evlistener === void 0)\n return [];\n if (typeof evlistener === "function")\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n }\n EventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n };\n EventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n };\n EventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === "function") {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n };\n EventEmitter.prototype.listenerCount = listenerCount;\n function listenerCount(type) {\n var events = this._events;\n if (events !== void 0) {\n var evlistener = events[type];\n if (typeof evlistener === "function") {\n return 1;\n } else if (evlistener !== void 0) {\n return evlistener.length;\n }\n }\n return 0;\n }\n EventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n };\n function arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n }\n function spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n }\n function unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n }\n function once(emitter, name) {\n return new Promise(function(resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n function resolver() {\n if (typeof emitter.removeListener === "function") {\n emitter.removeListener("error", errorListener);\n }\n resolve([].slice.call(arguments));\n }\n ;\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== "error") {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n }\n function addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === "function") {\n eventTargetAgnosticAddListener(emitter, "error", handler, flags);\n }\n }\n function eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === "function") {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === "function") {\n emitter.addEventListener(name, function wrapListener(arg) {\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError(\'The "emitter" argument must be of type EventEmitter. Received type \' + typeof emitter);\n }\n }\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/stream-browser.js\nvar require_stream_browser = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = require_events().EventEmitter;\n }\n});\n\n// (disabled):node_modules/util/util.js\nvar require_util = __commonJS({\n "(disabled):node_modules/util/util.js"() {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/buffer_list.js\nvar require_buffer_list = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly)\n symbols = symbols.filter(function(sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n return keys;\n }\n function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function(key2) {\n _defineProperty(target, key2, source[key2]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function(key2) {\n Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));\n });\n }\n }\n return target;\n }\n function _defineProperty(obj, key2, value) {\n if (key2 in obj) {\n Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key2] = value;\n }\n return obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor)\n descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps)\n _defineProperties(Constructor.prototype, protoProps);\n if (staticProps)\n _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n var _require = require_buffer();\n var Buffer13 = _require.Buffer;\n var _require2 = require_util();\n var inspect = _require2.inspect;\n var custom = inspect && inspect.custom || "inspect";\n function copyBuffer(src, target, offset) {\n Buffer13.prototype.copy.call(src, target, offset);\n }\n module.exports = /* @__PURE__ */ function() {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: "push",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0)\n this.tail.next = entry;\n else\n this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: "unshift",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0)\n this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: "shift",\n value: function shift() {\n if (this.length === 0)\n return;\n var ret = this.head.data;\n if (this.length === 1)\n this.head = this.tail = null;\n else\n this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: "clear",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: "join",\n value: function join(s) {\n if (this.length === 0)\n return "";\n var p = this.head;\n var ret = "" + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }\n return ret;\n }\n }, {\n key: "concat",\n value: function concat(n) {\n if (this.length === 0)\n return Buffer13.alloc(0);\n var ret = Buffer13.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n }, {\n key: "consume",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n ret = this.shift();\n } else {\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: "first",\n value: function first() {\n return this.head.data;\n }\n }, {\n key: "_getString",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length)\n ret += str;\n else\n ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n }, {\n key: "_getBuffer",\n value: function _getBuffer(n) {\n var ret = Buffer13.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf2 = p.data;\n var nb = n > buf2.length ? buf2.length : n;\n buf2.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf2.length) {\n ++c;\n if (p.next)\n this.head = p.next;\n else\n this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf2.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread({}, options, {\n depth: 0,\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n }();\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/destroy.js\nvar require_destroy = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function(err2) {\n if (!cb && err2) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err2);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n }\n function emitErrorAndCloseNT(self2, err) {\n emitErrorNT(self2, err);\n emitCloseNT(self2);\n }\n function emitCloseNT(self2) {\n if (self2._writableState && !self2._writableState.emitClose)\n return;\n if (self2._readableState && !self2._readableState.emitClose)\n return;\n self2.emit("close");\n }\n function undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n }\n function emitErrorNT(self2, err) {\n self2.emit("error", err);\n }\n function errorOrDestroy(stream, err) {\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy)\n stream.destroy(err);\n else\n stream.emit("error", err);\n }\n module.exports = {\n destroy,\n undestroy,\n errorOrDestroy\n };\n }\n});\n\n// node_modules/readable-stream/errors-browser.js\nvar require_errors_browser = __commonJS({\n "node_modules/readable-stream/errors-browser.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n }\n var codes = {};\n function createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === "string") {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n var NodeError = /* @__PURE__ */ function(_Base) {\n _inheritsLoose(NodeError2, _Base);\n function NodeError2(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n return NodeError2;\n }(Base);\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n }\n function oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function(i) {\n return String(i);\n });\n if (len > 2) {\n return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1];\n } else if (len === 2) {\n return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);\n } else {\n return "of ".concat(thing, " ").concat(expected[0]);\n }\n } else {\n return "of ".concat(thing, " ").concat(String(expected));\n }\n }\n function startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n }\n function endsWith(str, search, this_len) {\n if (this_len === void 0 || this_len > str.length) {\n this_len = str.length;\n }\n return str.substring(this_len - search.length, this_len) === search;\n }\n function includes(str, search, start) {\n if (typeof start !== "number") {\n start = 0;\n }\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n }\n createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {\n return \'The value "\' + value + \'" is invalid for option "\' + name + \'"\';\n }, TypeError);\n createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {\n var determiner;\n if (typeof expected === "string" && startsWith(expected, "not ")) {\n determiner = "must not be";\n expected = expected.replace(/^not /, "");\n } else {\n determiner = "must be";\n }\n var msg;\n if (endsWith(name, " argument")) {\n msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));\n } else {\n var type = includes(name, ".") ? "property" : "argument";\n msg = \'The "\'.concat(name, \'" \').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));\n }\n msg += ". Received type ".concat(typeof actual);\n return msg;\n }, TypeError);\n createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");\n createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {\n return "The " + name + " method is not implemented";\n });\n createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");\n createErrorType("ERR_STREAM_DESTROYED", function(name) {\n return "Cannot call " + name + " after a stream was destroyed";\n });\n createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");\n createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");\n createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");\n createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);\n createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {\n return "Unknown encoding: " + arg;\n }, TypeError);\n createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");\n module.exports.codes = codes;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/state.js\nvar require_state = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var ERR_INVALID_OPT_VALUE = require_errors_browser().codes.ERR_INVALID_OPT_VALUE;\n function highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n }\n function getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : "highWaterMark";\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n return state.objectMode ? 16 : 16 * 1024;\n }\n module.exports = {\n getHighWaterMark\n };\n }\n});\n\n// node_modules/inherits/inherits_browser.js\nvar require_inherits_browser = __commonJS({\n "node_modules/inherits/inherits_browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n if (typeof Object.create === "function") {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n };\n } else {\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function() {\n };\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n };\n }\n }\n});\n\n// node_modules/util-deprecate/browser.js\nvar require_browser = __commonJS({\n "node_modules/util-deprecate/browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = deprecate;\n function deprecate(fn, msg) {\n if (config("noDeprecation")) {\n return fn;\n }\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config("throwDeprecation")) {\n throw new Error(msg);\n } else if (config("traceDeprecation")) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n return deprecated;\n }\n function config(name) {\n try {\n if (!self.localStorage)\n return false;\n } catch (_) {\n return false;\n }\n var val = self.localStorage[name];\n if (val == null)\n return false;\n return String(val).toLowerCase() === "true";\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_writable.js\nvar require_stream_writable = __commonJS({\n "node_modules/readable-stream/lib/_stream_writable.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Writable;\n function CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function() {\n onCorkedFinish(_this, state);\n };\n }\n var Duplex;\n Writable.WritableState = WritableState;\n var internalUtil = {\n deprecate: require_browser()\n };\n var Stream = require_stream_browser();\n var Buffer13 = require_buffer().Buffer;\n var OurUint8Array = self.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer13.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer13.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;\n var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;\n var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n require_inherits_browser()(Writable, Stream);\n function nop() {\n }\n function WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== "boolean")\n isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);\n this.finalCalled = false;\n this.needDrain = false;\n this.ending = false;\n this.ended = false;\n this.finished = false;\n this.destroyed = false;\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n this.defaultEncoding = options.defaultEncoding || "utf8";\n this.length = 0;\n this.writing = false;\n this.corked = 0;\n this.sync = true;\n this.bufferProcessing = false;\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n this.writecb = null;\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n this.pendingcb = 0;\n this.prefinished = false;\n this.errorEmitted = false;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.bufferedRequestCount = 0;\n this.corkedRequestsFree = new CorkedRequest(this);\n }\n WritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n };\n (function() {\n try {\n Object.defineProperty(WritableState.prototype, "buffer", {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")\n });\n } catch (_) {\n }\n })();\n var realHasInstance;\n if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object))\n return true;\n if (this !== Writable)\n return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n } else {\n realHasInstance = function realHasInstance2(object) {\n return object instanceof this;\n };\n }\n function Writable(options) {\n Duplex = Duplex || require_stream_duplex();\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this))\n return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n this.writable = true;\n if (options) {\n if (typeof options.write === "function")\n this._write = options.write;\n if (typeof options.writev === "function")\n this._writev = options.writev;\n if (typeof options.destroy === "function")\n this._destroy = options.destroy;\n if (typeof options.final === "function")\n this._final = options.final;\n }\n Stream.call(this);\n }\n Writable.prototype.pipe = function() {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n };\n function writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n }\n function validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== "string" && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n }\n Writable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer13.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === "function") {\n cb = encoding;\n encoding = null;\n }\n if (isBuf)\n encoding = "buffer";\n else if (!encoding)\n encoding = state.defaultEncoding;\n if (typeof cb !== "function")\n cb = nop;\n if (state.ending)\n writeAfterEnd(this, cb);\n else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n };\n Writable.prototype.cork = function() {\n this._writableState.corked++;\n };\n Writable.prototype.uncork = function() {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)\n clearBuffer(this, state);\n }\n };\n Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n if (typeof encoding === "string")\n encoding = encoding.toLowerCase();\n if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n };\n Object.defineProperty(Writable.prototype, "writableBuffer", {\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n function decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {\n chunk = Buffer13.from(chunk, encoding);\n }\n return chunk;\n }\n Object.defineProperty(Writable.prototype, "writableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = "buffer";\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n if (!ret)\n state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk,\n encoding,\n isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n }\n function doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed)\n state.onwrite(new ERR_STREAM_DESTROYED("write"));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n }\n function onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n process.nextTick(cb, er);\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n finishMaybe(stream, state);\n }\n }\n function onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n }\n function onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== "function")\n throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n }\n function afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n }\n function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit("drain");\n }\n }\n function clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf)\n allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, "", holder.finish);\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n if (state.writing) {\n break;\n }\n }\n if (entry === null)\n state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n }\n Writable.prototype._write = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));\n };\n Writable.prototype._writev = null;\n Writable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === "function") {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === "function") {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== void 0)\n this.write(chunk, encoding);\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n if (!state.ending)\n endWritable(this, state, cb);\n return this;\n };\n Object.defineProperty(Writable.prototype, "writableLength", {\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n }\n function callFinal(stream, state) {\n stream._final(function(err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit("prefinish");\n finishMaybe(stream, state);\n });\n }\n function prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === "function" && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit("prefinish");\n }\n }\n }\n function finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit("finish");\n if (state.autoDestroy) {\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n }\n function endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once("finish", cb);\n }\n state.ended = true;\n stream.writable = false;\n }\n function onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n state.corkedRequestsFree.next = corkReq;\n }\n Object.defineProperty(Writable.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._writableState === void 0) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n if (!this._writableState) {\n return;\n }\n this._writableState.destroyed = value;\n }\n });\n Writable.prototype.destroy = destroyImpl.destroy;\n Writable.prototype._undestroy = destroyImpl.undestroy;\n Writable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n }\n});\n\n// node_modules/readable-stream/lib/_stream_duplex.js\nvar require_stream_duplex = __commonJS({\n "node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var objectKeys = Object.keys || function(obj) {\n var keys2 = [];\n for (var key2 in obj) {\n keys2.push(key2);\n }\n return keys2;\n };\n module.exports = Duplex;\n var Readable = require_stream_readable();\n var Writable = require_stream_writable();\n require_inherits_browser()(Duplex, Readable);\n {\n keys = objectKeys(Writable.prototype);\n for (v = 0; v < keys.length; v++) {\n method = keys[v];\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n }\n }\n var keys;\n var method;\n var v;\n function Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false)\n this.readable = false;\n if (options.writable === false)\n this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once("end", onend);\n }\n }\n }\n Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n });\n Object.defineProperty(Duplex.prototype, "writableBuffer", {\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n });\n Object.defineProperty(Duplex.prototype, "writableLength", {\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n });\n function onend() {\n if (this._writableState.ended)\n return;\n process.nextTick(onEndNT, this);\n }\n function onEndNT(self2) {\n self2.end();\n }\n Object.defineProperty(Duplex.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n if (this._readableState === void 0 || this._writableState === void 0) {\n return;\n }\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n });\n }\n});\n\n// node_modules/safe-buffer/index.js\nvar require_safe_buffer = __commonJS({\n "node_modules/safe-buffer/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var buffer = require_buffer();\n var Buffer13 = buffer.Buffer;\n function copyProps(src, dst) {\n for (var key2 in src) {\n dst[key2] = src[key2];\n }\n }\n if (Buffer13.from && Buffer13.alloc && Buffer13.allocUnsafe && Buffer13.allocUnsafeSlow) {\n module.exports = buffer;\n } else {\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n }\n function SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer13(arg, encodingOrOffset, length);\n }\n SafeBuffer.prototype = Object.create(Buffer13.prototype);\n copyProps(Buffer13, SafeBuffer);\n SafeBuffer.from = function(arg, encodingOrOffset, length) {\n if (typeof arg === "number") {\n throw new TypeError("Argument must not be a number");\n }\n return Buffer13(arg, encodingOrOffset, length);\n };\n SafeBuffer.alloc = function(size, fill, encoding) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n var buf2 = Buffer13(size);\n if (fill !== void 0) {\n if (typeof encoding === "string") {\n buf2.fill(fill, encoding);\n } else {\n buf2.fill(fill);\n }\n } else {\n buf2.fill(0);\n }\n return buf2;\n };\n SafeBuffer.allocUnsafe = function(size) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n return Buffer13(size);\n };\n SafeBuffer.allocUnsafeSlow = function(size) {\n if (typeof size !== "number") {\n throw new TypeError("Argument must be a number");\n }\n return buffer.SlowBuffer(size);\n };\n }\n});\n\n// node_modules/string_decoder/lib/string_decoder.js\nvar require_string_decoder = __commonJS({\n "node_modules/string_decoder/lib/string_decoder.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var Buffer13 = require_safe_buffer().Buffer;\n var isEncoding = Buffer13.isEncoding || function(encoding) {\n encoding = "" + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case "hex":\n case "utf8":\n case "utf-8":\n case "ascii":\n case "binary":\n case "base64":\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n case "raw":\n return true;\n default:\n return false;\n }\n };\n function _normalizeEncoding(enc) {\n if (!enc)\n return "utf8";\n var retried;\n while (true) {\n switch (enc) {\n case "utf8":\n case "utf-8":\n return "utf8";\n case "ucs2":\n case "ucs-2":\n case "utf16le":\n case "utf-16le":\n return "utf16le";\n case "latin1":\n case "binary":\n return "latin1";\n case "base64":\n case "ascii":\n case "hex":\n return enc;\n default:\n if (retried)\n return;\n enc = ("" + enc).toLowerCase();\n retried = true;\n }\n }\n }\n function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== "string" && (Buffer13.isEncoding === isEncoding || !isEncoding(enc)))\n throw new Error("Unknown encoding: " + enc);\n return nenc || enc;\n }\n exports.StringDecoder = StringDecoder;\n function StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case "utf16le":\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case "utf8":\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case "base64":\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer13.allocUnsafe(nb);\n }\n StringDecoder.prototype.write = function(buf2) {\n if (buf2.length === 0)\n return "";\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf2);\n if (r === void 0)\n return "";\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf2.length)\n return r ? r + this.text(buf2, i) : this.text(buf2, i);\n return r || "";\n };\n StringDecoder.prototype.end = utf8End;\n StringDecoder.prototype.text = utf8Text;\n StringDecoder.prototype.fillLast = function(buf2) {\n if (this.lastNeed <= buf2.length) {\n buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf2.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf2.length);\n this.lastNeed -= buf2.length;\n };\n function utf8CheckByte(byte) {\n if (byte <= 127)\n return 0;\n else if (byte >> 5 === 6)\n return 2;\n else if (byte >> 4 === 14)\n return 3;\n else if (byte >> 3 === 30)\n return 4;\n return byte >> 6 === 2 ? -1 : -2;\n }\n function utf8CheckIncomplete(self2, buf2, i) {\n var j = buf2.length - 1;\n if (j < i)\n return 0;\n var nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0)\n self2.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2)\n return 0;\n nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0)\n self2.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2)\n return 0;\n nb = utf8CheckByte(buf2[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2)\n nb = 0;\n else\n self2.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n }\n function utf8CheckExtraBytes(self2, buf2, p) {\n if ((buf2[0] & 192) !== 128) {\n self2.lastNeed = 0;\n return "\\uFFFD";\n }\n if (self2.lastNeed > 1 && buf2.length > 1) {\n if ((buf2[1] & 192) !== 128) {\n self2.lastNeed = 1;\n return "\\uFFFD";\n }\n if (self2.lastNeed > 2 && buf2.length > 2) {\n if ((buf2[2] & 192) !== 128) {\n self2.lastNeed = 2;\n return "\\uFFFD";\n }\n }\n }\n }\n function utf8FillLast(buf2) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf2, p);\n if (r !== void 0)\n return r;\n if (this.lastNeed <= buf2.length) {\n buf2.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf2.copy(this.lastChar, p, 0, buf2.length);\n this.lastNeed -= buf2.length;\n }\n function utf8Text(buf2, i) {\n var total = utf8CheckIncomplete(this, buf2, i);\n if (!this.lastNeed)\n return buf2.toString("utf8", i);\n this.lastTotal = total;\n var end = buf2.length - (total - this.lastNeed);\n buf2.copy(this.lastChar, 0, end);\n return buf2.toString("utf8", i, end);\n }\n function utf8End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed)\n return r + "\\uFFFD";\n return r;\n }\n function utf16Text(buf2, i) {\n if ((buf2.length - i) % 2 === 0) {\n var r = buf2.toString("utf16le", i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 55296 && c <= 56319) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf2[buf2.length - 2];\n this.lastChar[1] = buf2[buf2.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf2[buf2.length - 1];\n return buf2.toString("utf16le", i, buf2.length - 1);\n }\n function utf16End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString("utf16le", 0, end);\n }\n return r;\n }\n function base64Text(buf2, i) {\n var n = (buf2.length - i) % 3;\n if (n === 0)\n return buf2.toString("base64", i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf2[buf2.length - 1];\n } else {\n this.lastChar[0] = buf2[buf2.length - 2];\n this.lastChar[1] = buf2[buf2.length - 1];\n }\n return buf2.toString("base64", i, buf2.length - n);\n }\n function base64End(buf2) {\n var r = buf2 && buf2.length ? this.write(buf2) : "";\n if (this.lastNeed)\n return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);\n return r;\n }\n function simpleWrite(buf2) {\n return buf2.toString(this.encoding);\n }\n function simpleEnd(buf2) {\n return buf2 && buf2.length ? this.write(buf2) : "";\n }\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/end-of-stream.js\nvar require_end_of_stream = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser().codes.ERR_STREAM_PREMATURE_CLOSE;\n function once(callback) {\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n }\n function noop2() {\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === "function";\n }\n function eos(stream, opts, callback) {\n if (typeof opts === "function")\n return eos(stream, null, opts);\n if (!opts)\n opts = {};\n callback = once(callback || noop2);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable2 = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish2() {\n if (!stream.writable)\n onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish2() {\n writable2 = false;\n writableEnded = true;\n if (!readable)\n callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend2() {\n readable = false;\n readableEnded = true;\n if (!writable2)\n callback.call(stream);\n };\n var onerror = function onerror2(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose2() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended)\n err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable2 && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended)\n err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest2() {\n stream.req.on("finish", onfinish);\n };\n if (isRequest(stream)) {\n stream.on("complete", onfinish);\n stream.on("abort", onclose);\n if (stream.req)\n onrequest();\n else\n stream.on("request", onrequest);\n } else if (writable2 && !stream._writableState) {\n stream.on("end", onlegacyfinish);\n stream.on("close", onlegacyfinish);\n }\n stream.on("end", onend);\n stream.on("finish", onfinish);\n if (opts.error !== false)\n stream.on("error", onerror);\n stream.on("close", onclose);\n return function() {\n stream.removeListener("complete", onfinish);\n stream.removeListener("abort", onclose);\n stream.removeListener("request", onrequest);\n if (stream.req)\n stream.req.removeListener("finish", onfinish);\n stream.removeListener("end", onlegacyfinish);\n stream.removeListener("close", onlegacyfinish);\n stream.removeListener("finish", onfinish);\n stream.removeListener("end", onend);\n stream.removeListener("error", onerror);\n stream.removeListener("close", onclose);\n };\n }\n module.exports = eos;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/async_iterator.js\nvar require_async_iterator = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var _Object$setPrototypeO;\n function _defineProperty(obj, key2, value) {\n if (key2 in obj) {\n Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true });\n } else {\n obj[key2] = value;\n }\n return obj;\n }\n var finished = require_end_of_stream();\n var kLastResolve = Symbol("lastResolve");\n var kLastReject = Symbol("lastReject");\n var kError = Symbol("error");\n var kEnded = Symbol("ended");\n var kLastPromise = Symbol("lastPromise");\n var kHandlePromise = Symbol("handlePromise");\n var kStream = Symbol("stream");\n function createIterResult(value, done) {\n return {\n value,\n done\n };\n }\n function readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n }\n function onReadable(iter) {\n process.nextTick(readAndResolve, iter);\n }\n function wrapForNext(lastPromise, iter) {\n return function(resolve, reject) {\n lastPromise.then(function() {\n if (iter[kEnded]) {\n resolve(createIterResult(void 0, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n }\n var AsyncIteratorPrototype = Object.getPrototypeOf(function() {\n });\n var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(void 0, true));\n }\n if (this[kStream].destroyed) {\n return new Promise(function(resolve, reject) {\n process.nextTick(function() {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(void 0, true));\n }\n });\n });\n }\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {\n return this;\n }), _defineProperty(_Object$setPrototypeO, "return", function _return() {\n var _this2 = this;\n return new Promise(function(resolve, reject) {\n _this2[kStream].destroy(null, function(err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(void 0, true));\n });\n });\n }), _Object$setPrototypeO), AsyncIteratorPrototype);\n var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function(err) {\n if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {\n var reject = iterator[kLastReject];\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(void 0, true));\n }\n iterator[kEnded] = true;\n });\n stream.on("readable", onReadable.bind(null, iterator));\n return iterator;\n };\n module.exports = createReadableStreamAsyncIterator;\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/from-browser.js\nvar require_from_browser = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = function() {\n throw new Error("Readable.from is not available in the browser");\n };\n }\n});\n\n// node_modules/readable-stream/lib/_stream_readable.js\nvar require_stream_readable = __commonJS({\n "node_modules/readable-stream/lib/_stream_readable.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Readable;\n var Duplex;\n Readable.ReadableState = ReadableState;\n var EE = require_events().EventEmitter;\n var EElistenerCount = function EElistenerCount2(emitter, type) {\n return emitter.listeners(type).length;\n };\n var Stream = require_stream_browser();\n var Buffer13 = require_buffer().Buffer;\n var OurUint8Array = self.Uint8Array || function() {\n };\n function _uint8ArrayToBuffer(chunk) {\n return Buffer13.from(chunk);\n }\n function _isUint8Array(obj) {\n return Buffer13.isBuffer(obj) || obj instanceof OurUint8Array;\n }\n var debugUtil = require_util();\n var debug;\n if (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog("stream");\n } else {\n debug = function debug2() {\n };\n }\n var BufferList = require_buffer_list();\n var destroyImpl = require_destroy();\n var _require = require_state();\n var getHighWaterMark = _require.getHighWaterMark;\n var _require$codes = require_errors_browser().codes;\n var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;\n var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n var StringDecoder;\n var createReadableStreamAsyncIterator;\n var from;\n require_inherits_browser()(Readable, Stream);\n var errorOrDestroy = destroyImpl.errorOrDestroy;\n var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];\n function prependListener(emitter, event, fn) {\n if (typeof emitter.prependListener === "function")\n return emitter.prependListener(event, fn);\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (Array.isArray(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n }\n function ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require_stream_duplex();\n options = options || {};\n if (typeof isDuplex !== "boolean")\n isDuplex = stream instanceof Duplex;\n this.objectMode = !!options.objectMode;\n if (isDuplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n this.sync = true;\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n this.emitClose = options.emitClose !== false;\n this.autoDestroy = !!options.autoDestroy;\n this.destroyed = false;\n this.defaultEncoding = options.defaultEncoding || "utf8";\n this.awaitDrain = 0;\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require_string_decoder().StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n }\n function Readable(options) {\n Duplex = Duplex || require_stream_duplex();\n if (!(this instanceof Readable))\n return new Readable(options);\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n this.readable = true;\n if (options) {\n if (typeof options.read === "function")\n this._read = options.read;\n if (typeof options.destroy === "function")\n this._destroy = options.destroy;\n }\n Stream.call(this);\n }\n Object.defineProperty(Readable.prototype, "destroyed", {\n enumerable: false,\n get: function get() {\n if (this._readableState === void 0) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n if (!this._readableState) {\n return;\n }\n this._readableState.destroyed = value;\n }\n });\n Readable.prototype.destroy = destroyImpl.destroy;\n Readable.prototype._undestroy = destroyImpl.undestroy;\n Readable.prototype._destroy = function(err, cb) {\n cb(err);\n };\n Readable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === "string") {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer13.from(chunk, encoding);\n encoding = "";\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n };\n Readable.prototype.unshift = function(chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n };\n function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug("readableAddChunk", chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck)\n er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer13.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted)\n errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());\n else\n addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0)\n addChunk(stream, state, chunk, false);\n else\n maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n }\n function addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit("data", chunk);\n } else {\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n if (state.needReadable)\n emitReadable(stream);\n }\n maybeReadMore(stream, state);\n }\n function chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);\n }\n return er;\n }\n Readable.prototype.isPaused = function() {\n return this._readableState.flowing === false;\n };\n Readable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require_string_decoder().StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n this._readableState.encoding = this._readableState.decoder.encoding;\n var p = this._readableState.buffer.head;\n var content = "";\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== "")\n this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n };\n var MAX_HWM = 1073741824;\n function computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n }\n function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended)\n return 0;\n if (state.objectMode)\n return 1;\n if (n !== n) {\n if (state.flowing && state.length)\n return state.buffer.head.data.length;\n else\n return state.length;\n }\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length)\n return n;\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n }\n Readable.prototype.read = function(n) {\n debug("read", n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0)\n state.emittedReadable = false;\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug("read: emitReadable", state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n var doRead = state.needReadable;\n debug("need readable", doRead);\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug("length less than watermark", doRead);\n }\n if (state.ended || state.reading) {\n doRead = false;\n debug("reading or ended", doRead);\n } else if (doRead) {\n debug("do read");\n state.reading = true;\n state.sync = true;\n if (state.length === 0)\n state.needReadable = true;\n this._read(state.highWaterMark);\n state.sync = false;\n if (!state.reading)\n n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n if (!state.ended)\n state.needReadable = true;\n if (nOrig !== n && state.ended)\n endReadable(this);\n }\n if (ret !== null)\n this.emit("data", ret);\n return ret;\n };\n function onEofChunk(stream, state) {\n debug("onEofChunk");\n if (state.ended)\n return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n emitReadable(stream);\n } else {\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n }\n function emitReadable(stream) {\n var state = stream._readableState;\n debug("emitReadable", state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug("emitReadable", state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n }\n function emitReadable_(stream) {\n var state = stream._readableState;\n debug("emitReadable_", state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit("readable");\n state.emittedReadable = false;\n }\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n }\n function maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n }\n function maybeReadMore_(stream, state) {\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug("maybeReadMore read 0");\n stream.read(0);\n if (len === state.length)\n break;\n }\n state.readingMore = false;\n }\n Readable.prototype._read = function(n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));\n };\n Readable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once("end", endFn);\n dest.on("unpipe", onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug("onunpipe");\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug("onend");\n dest.end();\n }\n var ondrain = pipeOnDrain(src);\n dest.on("drain", ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug("cleanup");\n dest.removeListener("close", onclose);\n dest.removeListener("finish", onfinish);\n dest.removeListener("drain", ondrain);\n dest.removeListener("error", onerror);\n dest.removeListener("unpipe", onunpipe);\n src.removeListener("end", onend);\n src.removeListener("end", unpipe);\n src.removeListener("data", ondata);\n cleanedUp = true;\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n src.on("data", ondata);\n function ondata(chunk) {\n debug("ondata");\n var ret = dest.write(chunk);\n debug("dest.write", ret);\n if (ret === false) {\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug("false write response, pause", state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n function onerror(er) {\n debug("onerror", er);\n unpipe();\n dest.removeListener("error", onerror);\n if (EElistenerCount(dest, "error") === 0)\n errorOrDestroy(dest, er);\n }\n prependListener(dest, "error", onerror);\n function onclose() {\n dest.removeListener("finish", onfinish);\n unpipe();\n }\n dest.once("close", onclose);\n function onfinish() {\n debug("onfinish");\n dest.removeListener("close", onclose);\n unpipe();\n }\n dest.once("finish", onfinish);\n function unpipe() {\n debug("unpipe");\n src.unpipe(dest);\n }\n dest.emit("pipe", src);\n if (!state.flowing) {\n debug("pipe resume");\n src.resume();\n }\n return dest;\n };\n function pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug("pipeOnDrain", state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {\n state.flowing = true;\n flow(src);\n }\n };\n }\n Readable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n if (state.pipesCount === 0)\n return this;\n if (state.pipesCount === 1) {\n if (dest && dest !== state.pipes)\n return this;\n if (!dest)\n dest = state.pipes;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit("unpipe", this, unpipeInfo);\n return this;\n }\n if (!dest) {\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) {\n dests[i].emit("unpipe", this, {\n hasUnpiped: false\n });\n }\n return this;\n }\n var index = indexOf(state.pipes, dest);\n if (index === -1)\n return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n dest.emit("unpipe", this, unpipeInfo);\n return this;\n };\n Readable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === "data") {\n state.readableListening = this.listenerCount("readable") > 0;\n if (state.flowing !== false)\n this.resume();\n } else if (ev === "readable") {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug("on readable", state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n };\n Readable.prototype.addListener = Readable.prototype.on;\n Readable.prototype.removeListener = function(ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === "readable") {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n Readable.prototype.removeAllListeners = function(ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === "readable" || ev === void 0) {\n process.nextTick(updateReadableListening, this);\n }\n return res;\n };\n function updateReadableListening(self2) {\n var state = self2._readableState;\n state.readableListening = self2.listenerCount("readable") > 0;\n if (state.resumeScheduled && !state.paused) {\n state.flowing = true;\n } else if (self2.listenerCount("data") > 0) {\n self2.resume();\n }\n }\n function nReadingNextTick(self2) {\n debug("readable nexttick read 0");\n self2.read(0);\n }\n Readable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug("resume");\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n };\n function resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n }\n function resume_(stream, state) {\n debug("resume", state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit("resume");\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n }\n Readable.prototype.pause = function() {\n debug("call pause flowing=%j", this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug("pause");\n this._readableState.flowing = false;\n this.emit("pause");\n }\n this._readableState.paused = true;\n return this;\n };\n function flow(stream) {\n var state = stream._readableState;\n debug("flow", state.flowing);\n while (state.flowing && stream.read() !== null) {\n ;\n }\n }\n Readable.prototype.wrap = function(stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on("end", function() {\n debug("wrapped end");\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on("data", function(chunk) {\n debug("wrapped data");\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n if (state.objectMode && (chunk === null || chunk === void 0))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n for (var i in stream) {\n if (this[i] === void 0 && typeof stream[i] === "function") {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n this._read = function(n2) {\n debug("wrapped _read", n2);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n };\n if (typeof Symbol === "function") {\n Readable.prototype[Symbol.asyncIterator] = function() {\n if (createReadableStreamAsyncIterator === void 0) {\n createReadableStreamAsyncIterator = require_async_iterator();\n }\n return createReadableStreamAsyncIterator(this);\n };\n }\n Object.defineProperty(Readable.prototype, "readableHighWaterMark", {\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n });\n Object.defineProperty(Readable.prototype, "readableBuffer", {\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n });\n Object.defineProperty(Readable.prototype, "readableFlowing", {\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n });\n Readable._fromList = fromList;\n Object.defineProperty(Readable.prototype, "readableLength", {\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n });\n function fromList(n, state) {\n if (state.length === 0)\n return null;\n var ret;\n if (state.objectMode)\n ret = state.buffer.shift();\n else if (!n || n >= state.length) {\n if (state.decoder)\n ret = state.buffer.join("");\n else if (state.buffer.length === 1)\n ret = state.buffer.first();\n else\n ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n }\n function endReadable(stream) {\n var state = stream._readableState;\n debug("endReadable", state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n }\n function endReadableNT(state, stream) {\n debug("endReadableNT", state.endEmitted, state.length);\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit("end");\n if (state.autoDestroy) {\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n }\n if (typeof Symbol === "function") {\n Readable.from = function(iterable, opts) {\n if (from === void 0) {\n from = require_from_browser();\n }\n return from(Readable, iterable, opts);\n };\n }\n function indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x)\n return i;\n }\n return -1;\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_transform.js\nvar require_stream_transform = __commonJS({\n "node_modules/readable-stream/lib/_stream_transform.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = Transform;\n var _require$codes = require_errors_browser().codes;\n var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;\n var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;\n var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;\n var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n var Duplex = require_stream_duplex();\n require_inherits_browser()(Transform, Duplex);\n function afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit("error", new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n }\n function Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n this._readableState.needReadable = true;\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === "function")\n this._transform = options.transform;\n if (typeof options.flush === "function")\n this._flush = options.flush;\n }\n this.on("prefinish", prefinish);\n }\n function prefinish() {\n var _this = this;\n if (typeof this._flush === "function" && !this._readableState.destroyed) {\n this._flush(function(er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n }\n Transform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n };\n Transform.prototype._transform = function(chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));\n };\n Transform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n };\n Transform.prototype._read = function(n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n ts.needTransform = true;\n }\n };\n Transform.prototype._destroy = function(err, cb) {\n Duplex.prototype._destroy.call(this, err, function(err2) {\n cb(err2);\n });\n };\n function done(stream, er, data) {\n if (er)\n return stream.emit("error", er);\n if (data != null)\n stream.push(data);\n if (stream._writableState.length)\n throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming)\n throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n }\n }\n});\n\n// node_modules/readable-stream/lib/_stream_passthrough.js\nvar require_stream_passthrough = __commonJS({\n "node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n module.exports = PassThrough;\n var Transform = require_stream_transform();\n require_inherits_browser()(PassThrough, Transform);\n function PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n Transform.call(this, options);\n }\n PassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n };\n }\n});\n\n// node_modules/readable-stream/lib/internal/streams/pipeline.js\nvar require_pipeline = __commonJS({\n "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var eos;\n function once(callback) {\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n callback.apply(void 0, arguments);\n };\n }\n var _require$codes = require_errors_browser().codes;\n var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n function noop2(err) {\n if (err)\n throw err;\n }\n function isRequest(stream) {\n return stream.setHeader && typeof stream.abort === "function";\n }\n function destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on("close", function() {\n closed = true;\n });\n if (eos === void 0)\n eos = require_end_of_stream();\n eos(stream, {\n readable: reading,\n writable: writing\n }, function(err) {\n if (err)\n return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function(err) {\n if (closed)\n return;\n if (destroyed)\n return;\n destroyed = true;\n if (isRequest(stream))\n return stream.abort();\n if (typeof stream.destroy === "function")\n return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED("pipe"));\n };\n }\n function call(fn) {\n fn();\n }\n function pipe(from, to) {\n return from.pipe(to);\n }\n function popCallback(streams) {\n if (!streams.length)\n return noop2;\n if (typeof streams[streams.length - 1] !== "function")\n return noop2;\n return streams.pop();\n }\n function pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0]))\n streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS("streams");\n }\n var error;\n var destroys = streams.map(function(stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function(err) {\n if (!error)\n error = err;\n if (err)\n destroys.forEach(call);\n if (reading)\n return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n }\n module.exports = pipeline;\n }\n});\n\n// node_modules/readable-stream/readable-browser.js\nvar require_readable_browser = __commonJS({\n "node_modules/readable-stream/readable-browser.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n exports = module.exports = require_stream_readable();\n exports.Stream = exports;\n exports.Readable = exports;\n exports.Writable = require_stream_writable();\n exports.Duplex = require_stream_duplex();\n exports.Transform = require_stream_transform();\n exports.PassThrough = require_stream_passthrough();\n exports.finished = require_end_of_stream();\n exports.pipeline = require_pipeline();\n }\n});\n\n// node_modules/readable-web-to-node-stream/lib/index.js\nvar require_lib = __commonJS({\n "node_modules/readable-web-to-node-stream/lib/index.js"(exports) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n Object.defineProperty(exports, "__esModule", { value: true });\n exports.ReadableWebToNodeStream = void 0;\n var readable_stream_1 = require_readable_browser();\n var ReadableWebToNodeStream2 = class extends readable_stream_1.Readable {\n constructor(stream) {\n super();\n this.bytesRead = 0;\n this.released = false;\n this.reader = stream.getReader();\n }\n async _read() {\n if (this.released) {\n this.push(null);\n return;\n }\n this.pendingRead = this.reader.read();\n const data = await this.pendingRead;\n delete this.pendingRead;\n if (data.done || this.released) {\n this.push(null);\n } else {\n this.bytesRead += data.value.length;\n this.push(data.value);\n }\n }\n async waitForReadToComplete() {\n if (this.pendingRead) {\n await this.pendingRead;\n }\n }\n async close() {\n await this.syncAndRelease();\n }\n async syncAndRelease() {\n this.released = true;\n await this.waitForReadToComplete();\n await this.reader.releaseLock();\n }\n };\n exports.ReadableWebToNodeStream = ReadableWebToNodeStream2;\n }\n});\n\n// node_modules/base-x/src/index.js\nvar require_src = __commonJS({\n "node_modules/base-x/src/index.js"(exports, module) {\n "use strict";\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n function base(ALPHABET) {\n if (ALPHABET.length >= 255) {\n throw new TypeError("Alphabet too long");\n }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) {\n throw new TypeError(x + " is ambiguous");\n }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256);\n var iFACTOR = Math.log(256) / Math.log(BASE);\n function encode2(source) {\n if (source instanceof Uint8Array) {\n } else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) {\n throw new TypeError("Expected Uint8Array");\n }\n if (source.length === 0) {\n return "";\n }\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n var size = (pend - pbegin) * iFACTOR + 1 >>> 0;\n var b58 = new Uint8Array(size);\n while (pbegin !== pend) {\n var carry = source[pbegin];\n var i2 = 0;\n for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {\n carry += 256 * b58[it1] >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = carry / BASE >>> 0;\n }\n if (carry !== 0) {\n throw new Error("Non-zero carry");\n }\n length = i2;\n pbegin++;\n }\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n return str;\n }\n function decodeUnsafe(source) {\n if (typeof source !== "string") {\n throw new TypeError("Expected String");\n }\n if (source.length === 0) {\n return new Uint8Array();\n }\n var psz = 0;\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n var size = (source.length - psz) * FACTOR + 1 >>> 0;\n var b256 = new Uint8Array(size);\n while (source[psz]) {\n var carry = BASE_MAP[source.charCodeAt(psz)];\n if (carry === 255) {\n return;\n }\n var i2 = 0;\n for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {\n carry += BASE * b256[it3] >>> 0;\n b256[it3] = carry % 256 >>> 0;\n carry = carry / 256 >>> 0;\n }\n if (carry !== 0) {\n throw new Error("Non-zero carry");\n }\n length = i2;\n psz++;\n }\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j2 = zeroes;\n while (it4 !== size) {\n vch[j2++] = b256[it4++];\n }\n return vch;\n }\n function decode3(string) {\n var buffer = decodeUnsafe(string);\n if (buffer) {\n return buffer;\n }\n throw new Error("Non-base" + BASE + " character");\n }\n return {\n encode: encode2,\n decodeUnsafe,\n decode: decode3\n };\n }\n module.exports = base;\n }\n});\n\n// node_modules/bs58/index.js\nvar require_bs58 = __commonJS({\n "node_modules/bs58/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var basex = require_src();\n var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";\n module.exports = basex(ALPHABET);\n }\n});\n\n// node_modules/jpeg-js/lib/encoder.js\nvar require_encoder = __commonJS({\n "node_modules/jpeg-js/lib/encoder.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var btoa = btoa || function(buf2) {\n return Buffer2.from(buf2).toString("base64");\n };\n function JPEGEncoder(quality) {\n var self2 = this;\n var fround = Math.round;\n var ffloor = Math.floor;\n var YTable = new Array(64);\n var UVTable = new Array(64);\n var fdtbl_Y = new Array(64);\n var fdtbl_UV = new Array(64);\n var YDC_HT2;\n var UVDC_HT2;\n var YAC_HT2;\n var UVAC_HT2;\n var bitcode2 = new Array(65535);\n var category2 = new Array(65535);\n var outputfDCTQuant = new Array(64);\n var DU = new Array(64);\n var byteout = [];\n var bytenew = 0;\n var bytepos = 7;\n var YDU = new Array(64);\n var UDU = new Array(64);\n var VDU = new Array(64);\n var clt = new Array(256);\n var RGB_YUV_TABLE = new Array(2048);\n var currentQuality;\n var ZigZag = [\n 0,\n 1,\n 5,\n 6,\n 14,\n 15,\n 27,\n 28,\n 2,\n 4,\n 7,\n 13,\n 16,\n 26,\n 29,\n 42,\n 3,\n 8,\n 12,\n 17,\n 25,\n 30,\n 41,\n 43,\n 9,\n 11,\n 18,\n 24,\n 31,\n 40,\n 44,\n 53,\n 10,\n 19,\n 23,\n 32,\n 39,\n 45,\n 52,\n 54,\n 20,\n 22,\n 33,\n 38,\n 46,\n 51,\n 55,\n 60,\n 21,\n 34,\n 37,\n 47,\n 50,\n 56,\n 59,\n 61,\n 35,\n 36,\n 48,\n 49,\n 57,\n 58,\n 62,\n 63\n ];\n var std_dc_luminance_nrcodes2 = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];\n var std_dc_luminance_values2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n var std_ac_luminance_nrcodes2 = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125];\n var std_ac_luminance_values2 = [\n 1,\n 2,\n 3,\n 0,\n 4,\n 17,\n 5,\n 18,\n 33,\n 49,\n 65,\n 6,\n 19,\n 81,\n 97,\n 7,\n 34,\n 113,\n 20,\n 50,\n 129,\n 145,\n 161,\n 8,\n 35,\n 66,\n 177,\n 193,\n 21,\n 82,\n 209,\n 240,\n 36,\n 51,\n 98,\n 114,\n 130,\n 9,\n 10,\n 22,\n 23,\n 24,\n 25,\n 26,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n ];\n var std_dc_chrominance_nrcodes2 = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];\n var std_dc_chrominance_values2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n var std_ac_chrominance_nrcodes2 = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119];\n var std_ac_chrominance_values2 = [\n 0,\n 1,\n 2,\n 3,\n 17,\n 4,\n 5,\n 33,\n 49,\n 6,\n 18,\n 65,\n 81,\n 7,\n 97,\n 113,\n 19,\n 34,\n 50,\n 129,\n 8,\n 20,\n 66,\n 145,\n 161,\n 177,\n 193,\n 9,\n 35,\n 51,\n 82,\n 240,\n 21,\n 98,\n 114,\n 209,\n 10,\n 22,\n 36,\n 52,\n 225,\n 37,\n 241,\n 23,\n 24,\n 25,\n 26,\n 38,\n 39,\n 40,\n 41,\n 42,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n ];\n function initQuantTables(sf) {\n var YQT = [\n 16,\n 11,\n 10,\n 16,\n 24,\n 40,\n 51,\n 61,\n 12,\n 12,\n 14,\n 19,\n 26,\n 58,\n 60,\n 55,\n 14,\n 13,\n 16,\n 24,\n 40,\n 57,\n 69,\n 56,\n 14,\n 17,\n 22,\n 29,\n 51,\n 87,\n 80,\n 62,\n 18,\n 22,\n 37,\n 56,\n 68,\n 109,\n 103,\n 77,\n 24,\n 35,\n 55,\n 64,\n 81,\n 104,\n 113,\n 92,\n 49,\n 64,\n 78,\n 87,\n 103,\n 121,\n 120,\n 101,\n 72,\n 92,\n 95,\n 98,\n 112,\n 100,\n 103,\n 99\n ];\n for (var i = 0; i < 64; i++) {\n var t = ffloor((YQT[i] * sf + 50) / 100);\n if (t < 1) {\n t = 1;\n } else if (t > 255) {\n t = 255;\n }\n YTable[ZigZag[i]] = t;\n }\n var UVQT = [\n 17,\n 18,\n 24,\n 47,\n 99,\n 99,\n 99,\n 99,\n 18,\n 21,\n 26,\n 66,\n 99,\n 99,\n 99,\n 99,\n 24,\n 26,\n 56,\n 99,\n 99,\n 99,\n 99,\n 99,\n 47,\n 66,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99,\n 99\n ];\n for (var j = 0; j < 64; j++) {\n var u = ffloor((UVQT[j] * sf + 50) / 100);\n if (u < 1) {\n u = 1;\n } else if (u > 255) {\n u = 255;\n }\n UVTable[ZigZag[j]] = u;\n }\n var aasf = [\n 1,\n 1.387039845,\n 1.306562965,\n 1.175875602,\n 1,\n 0.785694958,\n 0.5411961,\n 0.275899379\n ];\n var k = 0;\n for (var row = 0; row < 8; row++) {\n for (var col = 0; col < 8; col++) {\n fdtbl_Y[k] = 1 / (YTable[ZigZag[k]] * aasf[row] * aasf[col] * 8);\n fdtbl_UV[k] = 1 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8);\n k++;\n }\n }\n }\n function computeHuffmanTbl(nrcodes, std_table) {\n var codevalue = 0;\n var pos_in_table = 0;\n var HT = new Array();\n for (var k = 1; k <= 16; k++) {\n for (var j = 1; j <= nrcodes[k]; j++) {\n HT[std_table[pos_in_table]] = [];\n HT[std_table[pos_in_table]][0] = codevalue;\n HT[std_table[pos_in_table]][1] = k;\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n }\n function initHuffmanTbl() {\n YDC_HT2 = computeHuffmanTbl(std_dc_luminance_nrcodes2, std_dc_luminance_values2);\n UVDC_HT2 = computeHuffmanTbl(std_dc_chrominance_nrcodes2, std_dc_chrominance_values2);\n YAC_HT2 = computeHuffmanTbl(std_ac_luminance_nrcodes2, std_ac_luminance_values2);\n UVAC_HT2 = computeHuffmanTbl(std_ac_chrominance_nrcodes2, std_ac_chrominance_values2);\n }\n function initCategoryNumber() {\n var nrlower = 1;\n var nrupper = 2;\n for (var cat = 1; cat <= 15; cat++) {\n for (var nr = nrlower; nr < nrupper; nr++) {\n category2[32767 + nr] = cat;\n bitcode2[32767 + nr] = [];\n bitcode2[32767 + nr][1] = cat;\n bitcode2[32767 + nr][0] = nr;\n }\n for (var nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) {\n category2[32767 + nrneg] = cat;\n bitcode2[32767 + nrneg] = [];\n bitcode2[32767 + nrneg][1] = cat;\n bitcode2[32767 + nrneg][0] = nrupper - 1 + nrneg;\n }\n nrlower <<= 1;\n nrupper <<= 1;\n }\n }\n function initRGBYUVTable() {\n for (var i = 0; i < 256; i++) {\n RGB_YUV_TABLE[i] = 19595 * i;\n RGB_YUV_TABLE[i + 256 >> 0] = 38470 * i;\n RGB_YUV_TABLE[i + 512 >> 0] = 7471 * i + 32768;\n RGB_YUV_TABLE[i + 768 >> 0] = -11059 * i;\n RGB_YUV_TABLE[i + 1024 >> 0] = -21709 * i;\n RGB_YUV_TABLE[i + 1280 >> 0] = 32768 * i + 8421375;\n RGB_YUV_TABLE[i + 1536 >> 0] = -27439 * i;\n RGB_YUV_TABLE[i + 1792 >> 0] = -5329 * i;\n }\n }\n function writeBits(bs) {\n var value = bs[0];\n var posval = bs[1] - 1;\n while (posval >= 0) {\n if (value & 1 << posval) {\n bytenew |= 1 << bytepos;\n }\n posval--;\n bytepos--;\n if (bytepos < 0) {\n if (bytenew == 255) {\n writeByte(255);\n writeByte(0);\n } else {\n writeByte(bytenew);\n }\n bytepos = 7;\n bytenew = 0;\n }\n }\n }\n function writeByte(value) {\n byteout.push(value);\n }\n function writeWord(value) {\n writeByte(value >> 8 & 255);\n writeByte(value & 255);\n }\n function fDCTQuant(data, fdtbl) {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n var dataOff = 0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i = 0; i < I8; ++i) {\n d0 = data[dataOff];\n d1 = data[dataOff + 1];\n d2 = data[dataOff + 2];\n d3 = data[dataOff + 3];\n d4 = data[dataOff + 4];\n d5 = data[dataOff + 5];\n d6 = data[dataOff + 6];\n d7 = data[dataOff + 7];\n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n var tmp10 = tmp0 + tmp3;\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n data[dataOff] = tmp10 + tmp11;\n data[dataOff + 4] = tmp10 - tmp11;\n var z1 = (tmp12 + tmp13) * 0.707106781;\n data[dataOff + 2] = tmp13 + z1;\n data[dataOff + 6] = tmp13 - z1;\n tmp10 = tmp4 + tmp5;\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n var z5 = (tmp10 - tmp12) * 0.382683433;\n var z2 = 0.5411961 * tmp10 + z5;\n var z4 = 1.306562965 * tmp12 + z5;\n var z3 = tmp11 * 0.707106781;\n var z11 = tmp7 + z3;\n var z13 = tmp7 - z3;\n data[dataOff + 5] = z13 + z2;\n data[dataOff + 3] = z13 - z2;\n data[dataOff + 1] = z11 + z4;\n data[dataOff + 7] = z11 - z4;\n dataOff += 8;\n }\n dataOff = 0;\n for (i = 0; i < I8; ++i) {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n var tmp10p2 = tmp0p2 + tmp3p2;\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n data[dataOff] = tmp10p2 + tmp11p2;\n data[dataOff + 32] = tmp10p2 - tmp11p2;\n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781;\n data[dataOff + 16] = tmp13p2 + z1p2;\n data[dataOff + 48] = tmp13p2 - z1p2;\n tmp10p2 = tmp4p2 + tmp5p2;\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433;\n var z2p2 = 0.5411961 * tmp10p2 + z5p2;\n var z4p2 = 1.306562965 * tmp12p2 + z5p2;\n var z3p2 = tmp11p2 * 0.707106781;\n var z11p2 = tmp7p2 + z3p2;\n var z13p2 = tmp7p2 - z3p2;\n data[dataOff + 40] = z13p2 + z2p2;\n data[dataOff + 24] = z13p2 - z2p2;\n data[dataOff + 8] = z11p2 + z4p2;\n data[dataOff + 56] = z11p2 - z4p2;\n dataOff++;\n }\n var fDCTQuant2;\n for (i = 0; i < I64; ++i) {\n fDCTQuant2 = data[i] * fdtbl[i];\n outputfDCTQuant[i] = fDCTQuant2 > 0 ? fDCTQuant2 + 0.5 | 0 : fDCTQuant2 - 0.5 | 0;\n }\n return outputfDCTQuant;\n }\n function writeAPP0() {\n writeWord(65504);\n writeWord(16);\n writeByte(74);\n writeByte(70);\n writeByte(73);\n writeByte(70);\n writeByte(0);\n writeByte(1);\n writeByte(1);\n writeByte(0);\n writeWord(1);\n writeWord(1);\n writeByte(0);\n writeByte(0);\n }\n function writeAPP1(exifBuffer) {\n if (!exifBuffer)\n return;\n writeWord(65505);\n if (exifBuffer[0] === 69 && exifBuffer[1] === 120 && exifBuffer[2] === 105 && exifBuffer[3] === 102) {\n writeWord(exifBuffer.length + 2);\n } else {\n writeWord(exifBuffer.length + 5 + 2);\n writeByte(69);\n writeByte(120);\n writeByte(105);\n writeByte(102);\n writeByte(0);\n }\n for (var i = 0; i < exifBuffer.length; i++) {\n writeByte(exifBuffer[i]);\n }\n }\n function writeSOF0(width, height) {\n writeWord(65472);\n writeWord(17);\n writeByte(8);\n writeWord(height);\n writeWord(width);\n writeByte(3);\n writeByte(1);\n writeByte(17);\n writeByte(0);\n writeByte(2);\n writeByte(17);\n writeByte(1);\n writeByte(3);\n writeByte(17);\n writeByte(1);\n }\n function writeDQT() {\n writeWord(65499);\n writeWord(132);\n writeByte(0);\n for (var i = 0; i < 64; i++) {\n writeByte(YTable[i]);\n }\n writeByte(1);\n for (var j = 0; j < 64; j++) {\n writeByte(UVTable[j]);\n }\n }\n function writeDHT() {\n writeWord(65476);\n writeWord(418);\n writeByte(0);\n for (var i = 0; i < 16; i++) {\n writeByte(std_dc_luminance_nrcodes2[i + 1]);\n }\n for (var j = 0; j <= 11; j++) {\n writeByte(std_dc_luminance_values2[j]);\n }\n writeByte(16);\n for (var k = 0; k < 16; k++) {\n writeByte(std_ac_luminance_nrcodes2[k + 1]);\n }\n for (var l = 0; l <= 161; l++) {\n writeByte(std_ac_luminance_values2[l]);\n }\n writeByte(1);\n for (var m = 0; m < 16; m++) {\n writeByte(std_dc_chrominance_nrcodes2[m + 1]);\n }\n for (var n = 0; n <= 11; n++) {\n writeByte(std_dc_chrominance_values2[n]);\n }\n writeByte(17);\n for (var o = 0; o < 16; o++) {\n writeByte(std_ac_chrominance_nrcodes2[o + 1]);\n }\n for (var p = 0; p <= 161; p++) {\n writeByte(std_ac_chrominance_values2[p]);\n }\n }\n function writeCOM(comments) {\n if (typeof comments === "undefined" || comments.constructor !== Array)\n return;\n comments.forEach((e) => {\n if (typeof e !== "string")\n return;\n writeWord(65534);\n var l = e.length;\n writeWord(l + 2);\n var i;\n for (i = 0; i < l; i++)\n writeByte(e.charCodeAt(i));\n });\n }\n function writeSOS() {\n writeWord(65498);\n writeWord(12);\n writeByte(3);\n writeByte(1);\n writeByte(0);\n writeByte(2);\n writeByte(17);\n writeByte(3);\n writeByte(17);\n writeByte(0);\n writeByte(63);\n writeByte(0);\n }\n function processDU(CDU, fdtbl, DC, HTDC, HTAC) {\n var EOB = HTAC[0];\n var M16zeroes = HTAC[240];\n var pos;\n var I16 = 16;\n var I63 = 63;\n var I64 = 64;\n var DU_DCT = fDCTQuant(CDU, fdtbl);\n for (var j = 0; j < I64; ++j) {\n DU[ZigZag[j]] = DU_DCT[j];\n }\n var Diff = DU[0] - DC;\n DC = DU[0];\n if (Diff == 0) {\n writeBits(HTDC[0]);\n } else {\n pos = 32767 + Diff;\n writeBits(HTDC[category2[pos]]);\n writeBits(bitcode2[pos]);\n }\n var end0pos = 63;\n for (; end0pos > 0 && DU[end0pos] == 0; end0pos--) {\n }\n ;\n if (end0pos == 0) {\n writeBits(EOB);\n return DC;\n }\n var i = 1;\n var lng;\n while (i <= end0pos) {\n var startpos = i;\n for (; DU[i] == 0 && i <= end0pos; ++i) {\n }\n var nrzeroes = i - startpos;\n if (nrzeroes >= I16) {\n lng = nrzeroes >> 4;\n for (var nrmarker = 1; nrmarker <= lng; ++nrmarker)\n writeBits(M16zeroes);\n nrzeroes = nrzeroes & 15;\n }\n pos = 32767 + DU[i];\n writeBits(HTAC[(nrzeroes << 4) + category2[pos]]);\n writeBits(bitcode2[pos]);\n i++;\n }\n if (end0pos != I63) {\n writeBits(EOB);\n }\n return DC;\n }\n function initCharLookupTable() {\n var sfcc = String.fromCharCode;\n for (var i = 0; i < 256; i++) {\n clt[i] = sfcc(i);\n }\n }\n this.encode = function(image, quality2) {\n var time_start = new Date().getTime();\n if (quality2)\n setQuality(quality2);\n byteout = new Array();\n bytenew = 0;\n bytepos = 7;\n writeWord(65496);\n writeAPP0();\n writeCOM(image.comments);\n writeAPP1(image.exifBuffer);\n writeDQT();\n writeSOF0(image.width, image.height);\n writeDHT();\n writeSOS();\n var DCY = 0;\n var DCU = 0;\n var DCV = 0;\n bytenew = 0;\n bytepos = 7;\n this.encode.displayName = "_encode_";\n var imageData = image.data;\n var width = image.width;\n var height = image.height;\n var quadWidth = width * 4;\n var tripleWidth = width * 3;\n var x, y = 0;\n var r, g, b;\n var start, p, col, row, pos;\n while (y < height) {\n x = 0;\n while (x < quadWidth) {\n start = quadWidth * y + x;\n p = start;\n col = -1;\n row = 0;\n for (pos = 0; pos < 64; pos++) {\n row = pos >> 3;\n col = (pos & 7) * 4;\n p = start + row * quadWidth + col;\n if (y + row >= height) {\n p -= quadWidth * (y + 1 + row - height);\n }\n if (x + col >= quadWidth) {\n p -= x + col - quadWidth + 4;\n }\n r = imageData[p++];\n g = imageData[p++];\n b = imageData[p++];\n YDU[pos] = (RGB_YUV_TABLE[r] + RGB_YUV_TABLE[g + 256 >> 0] + RGB_YUV_TABLE[b + 512 >> 0] >> 16) - 128;\n UDU[pos] = (RGB_YUV_TABLE[r + 768 >> 0] + RGB_YUV_TABLE[g + 1024 >> 0] + RGB_YUV_TABLE[b + 1280 >> 0] >> 16) - 128;\n VDU[pos] = (RGB_YUV_TABLE[r + 1280 >> 0] + RGB_YUV_TABLE[g + 1536 >> 0] + RGB_YUV_TABLE[b + 1792 >> 0] >> 16) - 128;\n }\n DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT2, YAC_HT2);\n DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT2, UVAC_HT2);\n DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT2, UVAC_HT2);\n x += 32;\n }\n y += 8;\n }\n if (bytepos >= 0) {\n var fillbits = [];\n fillbits[1] = bytepos + 1;\n fillbits[0] = (1 << bytepos + 1) - 1;\n writeBits(fillbits);\n }\n writeWord(65497);\n if (typeof module === "undefined")\n return new Uint8Array(byteout);\n return Buffer2.from(byteout);\n var jpegDataUri = "data:image/jpeg;base64," + btoa(byteout.join(""));\n byteout = [];\n var duration = new Date().getTime() - time_start;\n return jpegDataUri;\n };\n function setQuality(quality2) {\n if (quality2 <= 0) {\n quality2 = 1;\n }\n if (quality2 > 100) {\n quality2 = 100;\n }\n if (currentQuality == quality2)\n return;\n var sf = 0;\n if (quality2 < 50) {\n sf = Math.floor(5e3 / quality2);\n } else {\n sf = Math.floor(200 - quality2 * 2);\n }\n initQuantTables(sf);\n currentQuality = quality2;\n }\n function init2() {\n var time_start = new Date().getTime();\n if (!quality)\n quality = 50;\n initCharLookupTable();\n initHuffmanTbl();\n initCategoryNumber();\n initRGBYUVTable();\n setQuality(quality);\n var duration = new Date().getTime() - time_start;\n }\n init2();\n }\n if (typeof module !== "undefined") {\n module.exports = encode2;\n } else if (typeof window !== "undefined") {\n window["jpeg-js"] = window["jpeg-js"] || {};\n window["jpeg-js"].encode = encode2;\n }\n function encode2(imgData, qu) {\n if (typeof qu === "undefined")\n qu = 50;\n var encoder = new JPEGEncoder(qu);\n var data = encoder.encode(imgData, qu);\n return {\n data,\n width: imgData.width,\n height: imgData.height\n };\n }\n }\n});\n\n// node_modules/jpeg-js/lib/decoder.js\nvar require_decoder = __commonJS({\n "node_modules/jpeg-js/lib/decoder.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var JpegImage = function jpegImage() {\n "use strict";\n var dctZigZag = new Int32Array([\n 0,\n 1,\n 8,\n 16,\n 9,\n 2,\n 3,\n 10,\n 17,\n 24,\n 32,\n 25,\n 18,\n 11,\n 4,\n 5,\n 12,\n 19,\n 26,\n 33,\n 40,\n 48,\n 41,\n 34,\n 27,\n 20,\n 13,\n 6,\n 7,\n 14,\n 21,\n 28,\n 35,\n 42,\n 49,\n 56,\n 57,\n 50,\n 43,\n 36,\n 29,\n 22,\n 15,\n 23,\n 30,\n 37,\n 44,\n 51,\n 58,\n 59,\n 52,\n 45,\n 38,\n 31,\n 39,\n 46,\n 53,\n 60,\n 61,\n 54,\n 47,\n 55,\n 62,\n 63\n ]);\n var dctCos1 = 4017;\n var dctSin1 = 799;\n var dctCos3 = 3406;\n var dctSin3 = 2276;\n var dctCos6 = 1567;\n var dctSin6 = 3784;\n var dctSqrt2 = 5793;\n var dctSqrt1d2 = 2896;\n function constructor() {\n }\n function buildHuffmanTable2(codeLengths, values) {\n var k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({ children: [], index: 0 });\n var p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error("Could not recreate Huffman Table");\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n }\n function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, opts) {\n var precision = frame.precision;\n var samplesPerLine = frame.samplesPerLine;\n var scanLines = frame.scanLines;\n var mcusPerLine = frame.mcusPerLine;\n var progressive = frame.progressive;\n var maxH = frame.maxH, maxV = frame.maxV;\n var startOffset = offset, bitsData = 0, bitsCount = 0;\n function readBit() {\n if (bitsCount > 0) {\n bitsCount--;\n return bitsData >> bitsCount & 1;\n }\n bitsData = data[offset++];\n if (bitsData == 255) {\n var nextByte = data[offset++];\n if (nextByte) {\n throw new Error("unexpected marker: " + (bitsData << 8 | nextByte).toString(16));\n }\n }\n bitsCount = 7;\n return bitsData >>> 7;\n }\n function decodeHuffman(tree) {\n var node = tree, bit;\n while ((bit = readBit()) !== null) {\n node = node[bit];\n if (typeof node === "number")\n return node;\n if (typeof node !== "object")\n throw new Error("invalid huffman sequence");\n }\n return null;\n }\n function receive(length) {\n var n2 = 0;\n while (length > 0) {\n var bit = readBit();\n if (bit === null)\n return;\n n2 = n2 << 1 | bit;\n length--;\n }\n return n2;\n }\n function receiveAndExtend(length) {\n var n2 = receive(length);\n if (n2 >= 1 << length - 1)\n return n2;\n return n2 + (-1 << length) + 1;\n }\n function decodeBaseline(component2, zz) {\n var t = decodeHuffman(component2.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t);\n zz[0] = component2.pred += diff;\n var k2 = 1;\n while (k2 < 64) {\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15)\n break;\n k2 += 16;\n continue;\n }\n k2 += r;\n var z = dctZigZag[k2];\n zz[z] = receiveAndExtend(s);\n k2++;\n }\n }\n function decodeDCFirst(component2, zz) {\n var t = decodeHuffman(component2.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;\n zz[0] = component2.pred += diff;\n }\n function decodeDCSuccessive(component2, zz) {\n zz[0] |= readBit() << successive;\n }\n var eobrun = 0;\n function decodeACFirst(component2, zz) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k2 = spectralStart, e = spectralEnd;\n while (k2 <= e) {\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r) - 1;\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n var z = dctZigZag[k2];\n zz[z] = receiveAndExtend(s) * (1 << successive);\n k2++;\n }\n }\n var successiveACState = 0, successiveACNextValue;\n function decodeACSuccessive(component2, zz) {\n var k2 = spectralStart, e = spectralEnd, r = 0;\n while (k2 <= e) {\n var z = dctZigZag[k2];\n var direction = zz[z] < 0 ? -1 : 1;\n switch (successiveACState) {\n case 0:\n var rs = decodeHuffman(component2.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r);\n successiveACState = 4;\n } else {\n r = 16;\n successiveACState = 1;\n }\n } else {\n if (s !== 1)\n throw new Error("invalid ACn encoding");\n successiveACNextValue = receiveAndExtend(s);\n successiveACState = r ? 2 : 3;\n }\n continue;\n case 1:\n case 2:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n r--;\n if (r === 0)\n successiveACState = successiveACState == 2 ? 3 : 0;\n }\n break;\n case 3:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n zz[z] = successiveACNextValue << successive;\n successiveACState = 0;\n }\n break;\n case 4:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n break;\n }\n k2++;\n }\n if (successiveACState === 4) {\n eobrun--;\n if (eobrun === 0)\n successiveACState = 0;\n }\n }\n function decodeMcu(component2, decode4, mcu2, row, col) {\n var mcuRow = mcu2 / mcusPerLine | 0;\n var mcuCol = mcu2 % mcusPerLine;\n var blockRow = mcuRow * component2.v + row;\n var blockCol = mcuCol * component2.h + col;\n if (component2.blocks[blockRow] === void 0 && opts.tolerantDecoding)\n return;\n decode4(component2, component2.blocks[blockRow][blockCol]);\n }\n function decodeBlock(component2, decode4, mcu2) {\n var blockRow = mcu2 / component2.blocksPerLine | 0;\n var blockCol = mcu2 % component2.blocksPerLine;\n if (component2.blocks[blockRow] === void 0 && opts.tolerantDecoding)\n return;\n decode4(component2, component2.blocks[blockRow][blockCol]);\n }\n var componentsLength = components.length;\n var component, i, j, k, n;\n var decodeFn;\n if (progressive) {\n if (spectralStart === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n var mcu = 0, marker;\n var mcuExpected;\n if (componentsLength == 1) {\n mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;\n } else {\n mcuExpected = mcusPerLine * frame.mcusPerColumn;\n }\n if (!resetInterval)\n resetInterval = mcuExpected;\n var h, v;\n while (mcu < mcuExpected) {\n for (i = 0; i < componentsLength; i++)\n components[i].pred = 0;\n eobrun = 0;\n if (componentsLength == 1) {\n component = components[0];\n for (n = 0; n < resetInterval; n++) {\n decodeBlock(component, decodeFn, mcu);\n mcu++;\n }\n } else {\n for (n = 0; n < resetInterval; n++) {\n for (i = 0; i < componentsLength; i++) {\n component = components[i];\n h = component.h;\n v = component.v;\n for (j = 0; j < v; j++) {\n for (k = 0; k < h; k++) {\n decodeMcu(component, decodeFn, mcu, j, k);\n }\n }\n }\n mcu++;\n if (mcu === mcuExpected)\n break;\n }\n }\n if (mcu === mcuExpected) {\n do {\n if (data[offset] === 255) {\n if (data[offset + 1] !== 0) {\n break;\n }\n }\n offset += 1;\n } while (offset < data.length - 2);\n }\n bitsCount = 0;\n marker = data[offset] << 8 | data[offset + 1];\n if (marker < 65280) {\n throw new Error("marker was not found");\n }\n if (marker >= 65488 && marker <= 65495) {\n offset += 2;\n } else\n break;\n }\n return offset - startOffset;\n }\n function buildComponentData(frame, component) {\n var lines = [];\n var blocksPerLine = component.blocksPerLine;\n var blocksPerColumn = component.blocksPerColumn;\n var samplesPerLine = blocksPerLine << 3;\n var R = new Int32Array(64), r = new Uint8Array(64);\n function quantizeAndInverse(zz, dataOut, dataIn) {\n var qt = component.quantizationTable;\n var v0, v1, v2, v3, v4, v5, v6, v7, t;\n var p = dataIn;\n var i2;\n for (i2 = 0; i2 < 64; i2++)\n p[i2] = zz[i2] * qt[i2];\n for (i2 = 0; i2 < 8; ++i2) {\n var row = 8 * i2;\n if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 && p[4 + row] == 0 && p[5 + row] == 0 && p[6 + row] == 0 && p[7 + row] == 0) {\n t = dctSqrt2 * p[0 + row] + 512 >> 10;\n p[0 + row] = t;\n p[1 + row] = t;\n p[2 + row] = t;\n p[3 + row] = t;\n p[4 + row] = t;\n p[5 + row] = t;\n p[6 + row] = t;\n p[7 + row] = t;\n continue;\n }\n v0 = dctSqrt2 * p[0 + row] + 128 >> 8;\n v1 = dctSqrt2 * p[4 + row] + 128 >> 8;\n v2 = p[2 + row];\n v3 = p[6 + row];\n v4 = dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128 >> 8;\n v7 = dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128 >> 8;\n v5 = p[3 + row] << 4;\n v6 = p[5 + row] << 4;\n t = v0 - v1 + 1 >> 1;\n v0 = v0 + v1 + 1 >> 1;\n v1 = t;\n t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;\n v3 = t;\n t = v4 - v6 + 1 >> 1;\n v4 = v4 + v6 + 1 >> 1;\n v6 = t;\n t = v7 + v5 + 1 >> 1;\n v5 = v7 - v5 + 1 >> 1;\n v7 = t;\n t = v0 - v3 + 1 >> 1;\n v0 = v0 + v3 + 1 >> 1;\n v3 = t;\n t = v1 - v2 + 1 >> 1;\n v1 = v1 + v2 + 1 >> 1;\n v2 = t;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[0 + row] = v0 + v7;\n p[7 + row] = v0 - v7;\n p[1 + row] = v1 + v6;\n p[6 + row] = v1 - v6;\n p[2 + row] = v2 + v5;\n p[5 + row] = v2 - v5;\n p[3 + row] = v3 + v4;\n p[4 + row] = v3 - v4;\n }\n for (i2 = 0; i2 < 8; ++i2) {\n var col = i2;\n if (p[1 * 8 + col] == 0 && p[2 * 8 + col] == 0 && p[3 * 8 + col] == 0 && p[4 * 8 + col] == 0 && p[5 * 8 + col] == 0 && p[6 * 8 + col] == 0 && p[7 * 8 + col] == 0) {\n t = dctSqrt2 * dataIn[i2 + 0] + 8192 >> 14;\n p[0 * 8 + col] = t;\n p[1 * 8 + col] = t;\n p[2 * 8 + col] = t;\n p[3 * 8 + col] = t;\n p[4 * 8 + col] = t;\n p[5 * 8 + col] = t;\n p[6 * 8 + col] = t;\n p[7 * 8 + col] = t;\n continue;\n }\n v0 = dctSqrt2 * p[0 * 8 + col] + 2048 >> 12;\n v1 = dctSqrt2 * p[4 * 8 + col] + 2048 >> 12;\n v2 = p[2 * 8 + col];\n v3 = p[6 * 8 + col];\n v4 = dctSqrt1d2 * (p[1 * 8 + col] - p[7 * 8 + col]) + 2048 >> 12;\n v7 = dctSqrt1d2 * (p[1 * 8 + col] + p[7 * 8 + col]) + 2048 >> 12;\n v5 = p[3 * 8 + col];\n v6 = p[5 * 8 + col];\n t = v0 - v1 + 1 >> 1;\n v0 = v0 + v1 + 1 >> 1;\n v1 = t;\n t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;\n v3 = t;\n t = v4 - v6 + 1 >> 1;\n v4 = v4 + v6 + 1 >> 1;\n v6 = t;\n t = v7 + v5 + 1 >> 1;\n v5 = v7 - v5 + 1 >> 1;\n v7 = t;\n t = v0 - v3 + 1 >> 1;\n v0 = v0 + v3 + 1 >> 1;\n v3 = t;\n t = v1 - v2 + 1 >> 1;\n v1 = v1 + v2 + 1 >> 1;\n v2 = t;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[0 * 8 + col] = v0 + v7;\n p[7 * 8 + col] = v0 - v7;\n p[1 * 8 + col] = v1 + v6;\n p[6 * 8 + col] = v1 - v6;\n p[2 * 8 + col] = v2 + v5;\n p[5 * 8 + col] = v2 - v5;\n p[3 * 8 + col] = v3 + v4;\n p[4 * 8 + col] = v3 - v4;\n }\n for (i2 = 0; i2 < 64; ++i2) {\n var sample2 = 128 + (p[i2] + 8 >> 4);\n dataOut[i2] = sample2 < 0 ? 0 : sample2 > 255 ? 255 : sample2;\n }\n }\n requestMemoryAllocation(samplesPerLine * blocksPerColumn * 8);\n var i, j;\n for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {\n var scanLine = blockRow << 3;\n for (i = 0; i < 8; i++)\n lines.push(new Uint8Array(samplesPerLine));\n for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {\n quantizeAndInverse(component.blocks[blockRow][blockCol], r, R);\n var offset = 0, sample = blockCol << 3;\n for (j = 0; j < 8; j++) {\n var line = lines[scanLine + j];\n for (i = 0; i < 8; i++)\n line[sample + i] = r[offset++];\n }\n }\n }\n return lines;\n }\n function clampTo8bit(a) {\n return a < 0 ? 0 : a > 255 ? 255 : a;\n }\n constructor.prototype = {\n load: function load(path) {\n var xhr = new XMLHttpRequest();\n xhr.open("GET", path, true);\n xhr.responseType = "arraybuffer";\n xhr.onload = function() {\n var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);\n this.parse(data);\n if (this.onload)\n this.onload();\n }.bind(this);\n xhr.send(null);\n },\n parse: function parse(data) {\n var maxResolutionInPixels = this.opts.maxResolutionInMP * 1e3 * 1e3;\n var offset = 0, length = data.length;\n function readUint16() {\n var value = data[offset] << 8 | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length2 = readUint16();\n var array = data.subarray(offset, offset + length2 - 2);\n offset += array.length;\n return array;\n }\n function prepareComponents(frame2) {\n var maxH2 = 1, maxV2 = 1;\n var component2, componentId2;\n for (componentId2 in frame2.components) {\n if (frame2.components.hasOwnProperty(componentId2)) {\n component2 = frame2.components[componentId2];\n if (maxH2 < component2.h)\n maxH2 = component2.h;\n if (maxV2 < component2.v)\n maxV2 = component2.v;\n }\n }\n var mcusPerLine = Math.ceil(frame2.samplesPerLine / 8 / maxH2);\n var mcusPerColumn = Math.ceil(frame2.scanLines / 8 / maxV2);\n for (componentId2 in frame2.components) {\n if (frame2.components.hasOwnProperty(componentId2)) {\n component2 = frame2.components[componentId2];\n var blocksPerLine = Math.ceil(Math.ceil(frame2.samplesPerLine / 8) * component2.h / maxH2);\n var blocksPerColumn = Math.ceil(Math.ceil(frame2.scanLines / 8) * component2.v / maxV2);\n var blocksPerLineForMcu = mcusPerLine * component2.h;\n var blocksPerColumnForMcu = mcusPerColumn * component2.v;\n var blocksToAllocate = blocksPerColumnForMcu * blocksPerLineForMcu;\n var blocks = [];\n requestMemoryAllocation(blocksToAllocate * 256);\n for (var i2 = 0; i2 < blocksPerColumnForMcu; i2++) {\n var row = [];\n for (var j2 = 0; j2 < blocksPerLineForMcu; j2++)\n row.push(new Int32Array(64));\n blocks.push(row);\n }\n component2.blocksPerLine = blocksPerLine;\n component2.blocksPerColumn = blocksPerColumn;\n component2.blocks = blocks;\n }\n }\n frame2.maxH = maxH2;\n frame2.maxV = maxV2;\n frame2.mcusPerLine = mcusPerLine;\n frame2.mcusPerColumn = mcusPerColumn;\n }\n var jfif = null;\n var adobe = null;\n var pixels = null;\n var frame, resetInterval;\n var quantizationTables = [], frames = [];\n var huffmanTablesAC = [], huffmanTablesDC = [];\n var fileMarker = readUint16();\n var malformedDataOffset = -1;\n this.comments = [];\n if (fileMarker != 65496) {\n throw new Error("SOI not found");\n }\n fileMarker = readUint16();\n while (fileMarker != 65497) {\n var i, j, l;\n switch (fileMarker) {\n case 65280:\n break;\n case 65504:\n case 65505:\n case 65506:\n case 65507:\n case 65508:\n case 65509:\n case 65510:\n case 65511:\n case 65512:\n case 65513:\n case 65514:\n case 65515:\n case 65516:\n case 65517:\n case 65518:\n case 65519:\n case 65534:\n var appData = readDataBlock();\n if (fileMarker === 65534) {\n var comment = String.fromCharCode.apply(null, appData);\n this.comments.push(comment);\n }\n if (fileMarker === 65504) {\n if (appData[0] === 74 && appData[1] === 70 && appData[2] === 73 && appData[3] === 70 && appData[4] === 0) {\n jfif = {\n version: { major: appData[5], minor: appData[6] },\n densityUnits: appData[7],\n xDensity: appData[8] << 8 | appData[9],\n yDensity: appData[10] << 8 | appData[11],\n thumbWidth: appData[12],\n thumbHeight: appData[13],\n thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])\n };\n }\n }\n if (fileMarker === 65505) {\n if (appData[0] === 69 && appData[1] === 120 && appData[2] === 105 && appData[3] === 102 && appData[4] === 0) {\n this.exifBuffer = appData.subarray(5, appData.length);\n }\n }\n if (fileMarker === 65518) {\n if (appData[0] === 65 && appData[1] === 100 && appData[2] === 111 && appData[3] === 98 && appData[4] === 101 && appData[5] === 0) {\n adobe = {\n version: appData[6],\n flags0: appData[7] << 8 | appData[8],\n flags1: appData[9] << 8 | appData[10],\n transformCode: appData[11]\n };\n }\n }\n break;\n case 65499:\n var quantizationTablesLength = readUint16();\n var quantizationTablesEnd = quantizationTablesLength + offset - 2;\n while (offset < quantizationTablesEnd) {\n var quantizationTableSpec = data[offset++];\n requestMemoryAllocation(64 * 4);\n var tableData = new Int32Array(64);\n if (quantizationTableSpec >> 4 === 0) {\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = data[offset++];\n }\n } else if (quantizationTableSpec >> 4 === 1) {\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = readUint16();\n }\n } else\n throw new Error("DQT: invalid table spec");\n quantizationTables[quantizationTableSpec & 15] = tableData;\n }\n break;\n case 65472:\n case 65473:\n case 65474:\n readUint16();\n frame = {};\n frame.extended = fileMarker === 65473;\n frame.progressive = fileMarker === 65474;\n frame.precision = data[offset++];\n frame.scanLines = readUint16();\n frame.samplesPerLine = readUint16();\n frame.components = {};\n frame.componentsOrder = [];\n var pixelsInFrame = frame.scanLines * frame.samplesPerLine;\n if (pixelsInFrame > maxResolutionInPixels) {\n var exceededAmount = Math.ceil((pixelsInFrame - maxResolutionInPixels) / 1e6);\n throw new Error(`maxResolutionInMP limit exceeded by ${exceededAmount}MP`);\n }\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n var qId = data[offset + 2];\n if (h <= 0 || v <= 0) {\n throw new Error("Invalid sampling factor, expected values above 0");\n }\n frame.componentsOrder.push(componentId);\n frame.components[componentId] = {\n h,\n v,\n quantizationIdx: qId\n };\n offset += 3;\n }\n prepareComponents(frame);\n frames.push(frame);\n break;\n case 65476:\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength; ) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++) {\n codeLengthSum += codeLengths[j] = data[offset];\n }\n requestMemoryAllocation(16 + codeLengthSum);\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable2(codeLengths, huffmanValues);\n }\n break;\n case 65501:\n readUint16();\n resetInterval = readUint16();\n break;\n case 65500:\n readUint16();\n readUint16();\n break;\n case 65498:\n var scanLength = readUint16();\n var selectorsCount = data[offset++];\n var components = [], component;\n for (i = 0; i < selectorsCount; i++) {\n component = frame.components[data[offset++]];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, this.opts);\n offset += processed;\n break;\n case 65535:\n if (data[offset] !== 255) {\n offset--;\n }\n break;\n default:\n if (data[offset - 3] == 255 && data[offset - 2] >= 192 && data[offset - 2] <= 254) {\n offset -= 3;\n break;\n } else if (fileMarker === 224 || fileMarker == 225) {\n if (malformedDataOffset !== -1) {\n throw new Error(`first unknown JPEG marker at offset ${malformedDataOffset.toString(16)}, second unknown JPEG marker ${fileMarker.toString(16)} at offset ${(offset - 1).toString(16)}`);\n }\n malformedDataOffset = offset - 1;\n const nextOffset = readUint16();\n if (data[offset + nextOffset - 2] === 255) {\n offset += nextOffset - 2;\n break;\n }\n }\n throw new Error("unknown JPEG marker " + fileMarker.toString(16));\n }\n fileMarker = readUint16();\n }\n if (frames.length != 1)\n throw new Error("only single frame JPEGs supported");\n for (var i = 0; i < frames.length; i++) {\n var cp = frames[i].components;\n for (var j in cp) {\n cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx];\n delete cp[j].quantizationIdx;\n }\n }\n this.width = frame.samplesPerLine;\n this.height = frame.scanLines;\n this.jfif = jfif;\n this.adobe = adobe;\n this.components = [];\n for (var i = 0; i < frame.componentsOrder.length; i++) {\n var component = frame.components[frame.componentsOrder[i]];\n this.components.push({\n lines: buildComponentData(frame, component),\n scaleX: component.h / frame.maxH,\n scaleY: component.v / frame.maxV\n });\n }\n },\n getData: function getData(width, height) {\n var scaleX = this.width / width, scaleY = this.height / height;\n var component1, component2, component3, component4;\n var component1Line, component2Line, component3Line, component4Line;\n var x, y;\n var offset = 0;\n var Y, Cb, Cr, K, C, M, Ye, R, G, B;\n var colorTransform;\n var dataLength = width * height * this.components.length;\n requestMemoryAllocation(dataLength);\n var data = new Uint8Array(dataLength);\n switch (this.components.length) {\n case 1:\n component1 = this.components[0];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n data[offset++] = Y;\n }\n }\n break;\n case 2:\n component1 = this.components[0];\n component2 = this.components[1];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n data[offset++] = Y;\n Y = component2Line[0 | x * component2.scaleX * scaleX];\n data[offset++] = Y;\n }\n }\n break;\n case 3:\n colorTransform = true;\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== "undefined")\n colorTransform = !!this.opts.colorTransform;\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n component3Line = component3.lines[0 | y * component3.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n R = component1Line[0 | x * component1.scaleX * scaleX];\n G = component2Line[0 | x * component2.scaleX * scaleX];\n B = component3Line[0 | x * component3.scaleX * scaleX];\n } else {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n Cb = component2Line[0 | x * component2.scaleX * scaleX];\n Cr = component3Line[0 | x * component3.scaleX * scaleX];\n R = clampTo8bit(Y + 1.402 * (Cr - 128));\n G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n B = clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = R;\n data[offset++] = G;\n data[offset++] = B;\n }\n }\n break;\n case 4:\n if (!this.adobe)\n throw new Error("Unsupported color mode (4 components)");\n colorTransform = false;\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== "undefined")\n colorTransform = !!this.opts.colorTransform;\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n component4 = this.components[3];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | y * component1.scaleY * scaleY];\n component2Line = component2.lines[0 | y * component2.scaleY * scaleY];\n component3Line = component3.lines[0 | y * component3.scaleY * scaleY];\n component4Line = component4.lines[0 | y * component4.scaleY * scaleY];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n C = component1Line[0 | x * component1.scaleX * scaleX];\n M = component2Line[0 | x * component2.scaleX * scaleX];\n Ye = component3Line[0 | x * component3.scaleX * scaleX];\n K = component4Line[0 | x * component4.scaleX * scaleX];\n } else {\n Y = component1Line[0 | x * component1.scaleX * scaleX];\n Cb = component2Line[0 | x * component2.scaleX * scaleX];\n Cr = component3Line[0 | x * component3.scaleX * scaleX];\n K = component4Line[0 | x * component4.scaleX * scaleX];\n C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128));\n M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = 255 - C;\n data[offset++] = 255 - M;\n data[offset++] = 255 - Ye;\n data[offset++] = 255 - K;\n }\n }\n break;\n default:\n throw new Error("Unsupported color mode");\n }\n return data;\n },\n copyToImageData: function copyToImageData(imageData, formatAsRGBA) {\n var width = imageData.width, height = imageData.height;\n var imageDataArray = imageData.data;\n var data = this.getData(width, height);\n var i = 0, j = 0, x, y;\n var Y, K, C, M, R, G, B;\n switch (this.components.length) {\n case 1:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n Y = data[i++];\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 3:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n R = data[i++];\n G = data[i++];\n B = data[i++];\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 4:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n C = data[i++];\n M = data[i++];\n Y = data[i++];\n K = data[i++];\n R = 255 - clampTo8bit(C * (1 - K / 255) + K);\n G = 255 - clampTo8bit(M * (1 - K / 255) + K);\n B = 255 - clampTo8bit(Y * (1 - K / 255) + K);\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n default:\n throw new Error("Unsupported color mode");\n }\n }\n };\n var totalBytesAllocated = 0;\n var maxMemoryUsageBytes = 0;\n function requestMemoryAllocation(increaseAmount = 0) {\n var totalMemoryImpactBytes = totalBytesAllocated + increaseAmount;\n if (totalMemoryImpactBytes > maxMemoryUsageBytes) {\n var exceededAmount = Math.ceil((totalMemoryImpactBytes - maxMemoryUsageBytes) / 1024 / 1024);\n throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB`);\n }\n totalBytesAllocated = totalMemoryImpactBytes;\n }\n constructor.resetMaxMemoryUsage = function(maxMemoryUsageBytes_) {\n totalBytesAllocated = 0;\n maxMemoryUsageBytes = maxMemoryUsageBytes_;\n };\n constructor.getBytesAllocated = function() {\n return totalBytesAllocated;\n };\n constructor.requestMemoryAllocation = requestMemoryAllocation;\n return constructor;\n }();\n if (typeof module !== "undefined") {\n module.exports = decode3;\n } else if (typeof window !== "undefined") {\n window["jpeg-js"] = window["jpeg-js"] || {};\n window["jpeg-js"].decode = decode3;\n }\n function decode3(jpegData, userOpts = {}) {\n var defaultOpts = {\n colorTransform: void 0,\n useTArray: false,\n formatAsRGBA: true,\n tolerantDecoding: true,\n maxResolutionInMP: 100,\n maxMemoryUsageInMB: 512\n };\n var opts = { ...defaultOpts, ...userOpts };\n var arr = new Uint8Array(jpegData);\n var decoder = new JpegImage();\n decoder.opts = opts;\n JpegImage.resetMaxMemoryUsage(opts.maxMemoryUsageInMB * 1024 * 1024);\n decoder.parse(arr);\n var channels = opts.formatAsRGBA ? 4 : 3;\n var bytesNeeded = decoder.width * decoder.height * channels;\n try {\n JpegImage.requestMemoryAllocation(bytesNeeded);\n var image = {\n width: decoder.width,\n height: decoder.height,\n exifBuffer: decoder.exifBuffer,\n data: opts.useTArray ? new Uint8Array(bytesNeeded) : Buffer2.alloc(bytesNeeded)\n };\n if (decoder.comments.length > 0) {\n image["comments"] = decoder.comments;\n }\n } catch (err) {\n if (err instanceof RangeError) {\n throw new Error("Could not allocate enough memory for the image. Required: " + bytesNeeded);\n }\n if (err instanceof ReferenceError) {\n if (err.message === "Buffer is not defined") {\n throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");\n }\n }\n throw err;\n }\n decoder.copyToImageData(image, opts.formatAsRGBA);\n return image;\n }\n }\n});\n\n// node_modules/jpeg-js/index.js\nvar require_jpeg_js = __commonJS({\n "node_modules/jpeg-js/index.js"(exports, module) {\n init_define_BUILD_VERSION();\n init_esbuild_inject();\n var encode2 = require_encoder();\n var decode3 = require_decoder();\n module.exports = {\n encode: encode2,\n decode: decode3\n };\n }\n});\n\n// src/processor.worker.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// src/platform.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// src/requests.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar xmlhttprequest;\nif (false)\n xmlhttprequest = typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : typeof GM != "undefined" ? GM.xmlHttpRequest : window["GM_xmlhttpRequest"];\nvar GM_fetch = (...[url, opt, lisn]) => {\n function blobTo(to, blob) {\n if (to == "arrayBuffer" && blob.arrayBuffer) {\n const ret = blob.arrayBuffer();\n if (ret)\n return ret;\n }\n return new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = function(event) {\n if (!event)\n return;\n if (to == "base64")\n resolve(event.target.result);\n else\n resolve(event.target.result);\n };\n if (to == "arrayBuffer")\n fileReader.readAsArrayBuffer(blob);\n else if (to == "base64")\n fileReader.readAsDataURL(blob);\n else if (to == "text")\n fileReader.readAsText(blob, "utf-8");\n else\n reject(new Error("unknown to"));\n });\n }\n return new Promise((resolve, reject) => {\n const gmopt = {\n url: url.toString(),\n data: opt?.body,\n responseType: "blob",\n headers: opt?.headers,\n method: opt?.method || "GET",\n ...lisn ? {\n onprogress: (prog) => {\n if (prog.loaded != prog.total && prog.total != 0)\n lisn.dispatchEvent(new CustomEvent("progress", { detail: [prog.loaded, prog.total] }));\n }\n } : {},\n onload: (resp) => {\n if (resp.status / 100 >= 4) {\n reject(new Error("Server Error: " + resp.status));\n return;\n }\n const blob = resp.response;\n const ref = resp;\n ref.blob = () => Promise.resolve(blob);\n ref.arrayBuffer = () => blobTo("arrayBuffer", blob);\n ref.text = () => blobTo("text", blob);\n ref.json = async () => JSON.parse(await blobTo("text", blob));\n resolve(resp);\n },\n ontimeout: () => reject(new Error("fetch timeout")),\n onerror: (...args) => {\n reject(new Error("fetch error"));\n },\n onabort: () => reject(new Error("fetch abort"))\n };\n xmlhttprequest(gmopt);\n });\n};\n\n// src/platform.ts\nvar lqueue = {};\nvar localLoad = (key2, def) => "__pee__" + key2 in localStorage ? JSON.parse(localStorage.getItem("__pee__" + key2)) : def;\nvar localSet = (key2, value) => localStorage.setItem("__pee__" + key2, JSON.stringify(value));\nvar port1;\nconsole.log("worker", false);\nif (false) {\n const nmc = new MessageChannel();\n port1 = nmc.port1;\n port2 = nmc.port2;\n const iframe = document.createElement("iframe");\n iframe.style.display = "none";\n iframe.name = location.origin;\n const iframeloaded = new Promise((_) => {\n iframe.onload = _;\n });\n iframe.src = `${chrome.runtime.getURL("")}options.html`;\n document.documentElement.appendChild(iframe);\n iframeloaded.then(() => {\n iframe.contentWindow?.postMessage("", "*", [port2]);\n });\n port1.onmessage = (ev) => {\n lqueue[ev.data.id](ev.data);\n };\n}\nconsole.log("worker");\nif (true) {\n port1 = {\n onmessage(ev) {\n lqueue[ev.data.id](ev.data);\n },\n postMessage(msg, tr) {\n postMessage({\n type: "ipc",\n tr,\n msg\n }, tr);\n }\n };\n}\nvar gid = 0;\nvar sendCmd = (cmd, tr) => {\n const prom = new Promise((_) => {\n const id = gid++;\n lqueue[id] = (e) => {\n _(e);\n delete lqueue[id];\n };\n port1.postMessage({ id, ...cmd }, tr || []);\n });\n return prom;\n};\nvar bridge = (name, f) => {\n if (false)\n return f;\n return (...args) => {\n return sendCmd({ name, args });\n };\n};\nvar Bridged = (ctor) => {\n const keys = Object.getOwnPropertyNames(ctor).filter((k) => typeof ctor[k] == "function");\n for (const k of keys)\n ctor[k] = bridge(k, ctor[k]);\n};\nif (false) {\n popupport = chrome.runtime.connect({ name: "popup" });\n popupport.onMessage.addListener((msg) => {\n if (msg.id in pendingcmds) {\n pendingcmds[msg.id](msg);\n delete pendingcmds[msg.id];\n }\n });\n}\nvar Platform = class {\n static async openInTab(src, opts) {\n if (false) {\n return GM.openInTab(src, opts);\n }\n const obj = false ? chrome : browser;\n let i;\n if (opts.insert)\n i = (await obj.tabs.getCurrent()).index + 1;\n return obj.tabs.create({ active: opts.active, url: src, index: i });\n }\n static getValue(name, def) {\n return localLoad(name, def);\n }\n static setValue(name, val) {\n localSet(name, val);\n }\n};\nPlatform.cmdid = 0;\nPlatform = __decorateClass([\n Bridged\n], Platform);\nvar corsFetch = async (input, init2, lsn) => {\n const id = gid++;\n let transfer = [];\n if (init2?.body) {\n if (false) {\n [init2.body, transfer] = await braveserialize(init2.body);\n }\n }\n const prom = new Promise((_, rej) => {\n let gcontroller;\n let buffer = [];\n let finished = false;\n const rs = new ReadableStream({\n start(controller) {\n gcontroller = controller;\n buffer.forEach((b) => gcontroller?.enqueue(b));\n buffer = [];\n if (finished) {\n gcontroller.close();\n }\n }\n });\n let s;\n s = 0;\n const cmdbuff = [];\n lqueue[id] = async (e) => {\n if (e.progress) {\n if (lsn)\n lsn.dispatchEvent(new CustomEvent("progress", { detail: e.progress }));\n }\n if (e.pushData) {\n if (e.s > s) {\n let idx = 0;\n while (idx < cmdbuff.length) {\n if (cmdbuff[idx].s > e.s)\n break;\n idx++;\n }\n cmdbuff.splice(idx, 0, e);\n return;\n }\n const processCmd = (e2) => {\n if (e2.pushData.data) {\n const data = new Uint8Array(e2.pushData.data);\n if (gcontroller)\n gcontroller.enqueue(data);\n else\n buffer.push(data);\n } else {\n if (gcontroller)\n gcontroller?.close();\n else\n finished = true;\n }\n };\n await processCmd(e);\n s++;\n while (cmdbuff[0]?.s == s) {\n await processCmd(cmdbuff.shift());\n s++;\n }\n }\n if (e.setRes) {\n const arrayBuffer = async () => {\n const r = rs.getReader();\n await sendCmd({ name: "fullyRead", fid: id });\n const abs = [];\n let res;\n do {\n res = await r.read();\n if (res.done)\n break;\n abs.push(res.value);\n } while (!res.done);\n const sum = abs.reduce((a, b) => a + b.byteLength, 0);\n const ret = new Uint8Array(sum);\n abs.reduce((ptr, arr) => {\n ret.set(arr, ptr);\n return ptr + arr.byteLength;\n }, 0);\n r.releaseLock();\n return ret;\n };\n const blob = async () => new Blob([await arrayBuffer()]);\n const text = async () => new TextDecoder().decode(await arrayBuffer());\n const json = async () => JSON.parse(await text());\n if (e.ok)\n _({\n body: rs,\n ok: e.ok,\n headers: e.headers,\n redirected: e.redirected,\n type: e.type,\n url: e.url,\n status: e.status,\n bodyUsed: e.bodyUsed,\n statusText: e.statusText,\n clone() {\n return this;\n },\n arrayBuffer,\n blob,\n text,\n json,\n async formData() {\n return new FormData();\n }\n });\n else {\n rej(new Error(`${e.url} - ${e.status}`));\n }\n }\n };\n port1.postMessage({\n id,\n name: "corsFetch",\n args: [input, init2]\n }, transfer);\n });\n return prom;\n};\nasync function getHeaders(s) {\n if (false)\n return headerStringToObject(await GM_head(s));\n const res = await ifetch(s, {\n method: "HEAD"\n });\n return res.headers;\n}\nasync function ifetch(...[url, opt, lisn]) {\n if (true)\n return corsFetch(url.toString(), opt, lisn);\n return GM_fetch(url, opt, lisn);\n}\nasync function* streamRemote(url, chunkSize = 72 * 1024, fetchRestOnNonCanceled = true) {\n let size = Number.POSITIVE_INFINITY;\n let ptr = 0;\n let fetchSize = chunkSize;\n while (ptr != size) {\n let obj;\n const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } });\n if (false) {\n obj = headerStringToObject(fres.responseHeaders);\n } else {\n obj = fres.headers;\n }\n if (!("content-length" in obj)) {\n console.warn("no content lenght???", url);\n break;\n }\n if ("content-range" in obj) {\n size = +obj["content-range"].split("/")[1];\n }\n const len = +obj["content-length"];\n ptr += len;\n if (fetchRestOnNonCanceled)\n fetchSize = size;\n const val = Buffer2.from(await fres.arrayBuffer());\n const e = yield val;\n if (e) {\n break;\n }\n }\n}\n\n// src/pngv3.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer3 = __toESM(require_buffer(), 1);\n\n// src/png.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_crc_32 = __toESM(require_crc32(), 1);\nvar import_buffer = __toESM(require_buffer(), 1);\nvar PNGDecoder = class {\n constructor(reader, strict = true) {\n this.reader = reader;\n this.strict = strict;\n this.req = 8;\n this.ptr = 8;\n this.stopped = false;\n this.repr = import_buffer.Buffer.from([]);\n }\n async catchup() {\n while (this.repr.byteLength < this.req) {\n const chunk = await this.reader.read();\n if (chunk.done) {\n if (this.strict)\n throw new Error(`Unexpected EOF, got ${this.repr.byteLength}, required ${this.req}, ${chunk.value}`);\n this.stopped = true;\n return;\n }\n this.repr = import_buffer.Buffer.concat([this.repr, chunk.value]);\n }\n }\n async *chunks() {\n while (true) {\n this.req += 8;\n await this.catchup();\n if (this.stopped)\n break;\n const length = this.repr.readUInt32BE(this.ptr);\n const name = this.repr.slice(this.ptr + 4, this.ptr + 8).toString();\n this.ptr += 4;\n this.req += length + 4;\n await this.catchup();\n yield [\n name,\n this.repr.slice(this.ptr, this.ptr + length + 4),\n this.ptr + length > this.repr.length ? -1 : this.repr.readUInt32BE(this.ptr + length + 4),\n this.ptr\n ];\n if (this.stopped)\n break;\n this.ptr += length + 8;\n if (name == "IEND")\n break;\n }\n }\n async dtor() {\n }\n};\nvar PNGEncoder = class {\n constructor(bytes) {\n this.writer = bytes.getWriter();\n this.writer.write(import_buffer.Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]));\n }\n async insertchunk(chunk) {\n let b = import_buffer.Buffer.alloc(4);\n const buff = chunk[1];\n b.writeInt32BE(buff.length - 4, 0);\n await this.writer.write(b);\n await this.writer.write(buff);\n b = import_buffer.Buffer.alloc(4);\n b.writeInt32BE((0, import_crc_32.buf)(buff), 0);\n await this.writer.write(b);\n }\n async dtor() {\n this.writer.releaseLock();\n }\n};\n\n// src/utils.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer2 = __toESM(require_buffer(), 1);\n\n// src/assets/hasembed.png\nvar hasembed_default = __toBinary("iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAMFBMVEX+/v3c3c2moZhda1ODfnfKvK49RDgCAgIbHxpsGhv6BQT9hIOV0Hh4pWO03Z//5coEk9oIAAAHdUlEQVR42qWZDXurIAyFhcDJsS31///bKzEWHX6sd2fPVqYbLycJwXXDTiGKSMrDkQKGc8WwjhCHa0WoSY5u5guIYIUk5BuGEc4oUYZTaVztUq4ZWZtSfzulCyPrCAjXEGgT+9vncQhoRtI1I1BnIdEouYecG5FmZPhNRsLn9T4l3fIjwq8gcXlFv9xwXpPriDLcKHjGYeX1RW0J2uBWUid3FsPPm+flz7Qd3FtJbqhzkuSiYHIzcq8Ybb7KiCRju5PlqirdNdLwewlT2u/IcNUrEvyVwzfKAbvEhHS1RrBF6ysK1ZRvGW0DxhbekGOSlGKzfxgIbpyE8XqJEI9W8GZN6ioi2VU9osSWk8jx8byCMC1zw5JHEiIwOY4YHmM8PDx0sZ/Gx6w9JeQcq3JoRZUUFeFLD+G1qBSh6vB4jBchjzI8NpSQE6BNgAiiodQINg4hvF9NxeYY02mFShw+lAogCUCAFhAiW3wpS/wNsGPQphjloP2FmINtkIdJoCSkvH5OIYZUxAURXk0CcsmJaQRi2IVdLGe1dJ7z7ZEkDNApDEFY27drYwRqC1shdR4dIalKBBhbwg3RCB3Edj39KNmnQ1QtZeoQJ4lIijF4kKzQZkaLUq+3zQ0iz+kwwkYFygrZUaahyr7m52TbHYa4gQxFwBT7u0XICtGO0fZFhAfqzskyHV69KkUbxeeefOQ2XjeyXEjx2JQDCgbdUAbTh5fdxr2RSBpFDillUNMmXB9bibxFFGOEIv6z9tqlxSH6CVirNL1nENGrtlCPKJWuNEijNFHlykHxfYCU1vyqXRRFo1CVJAzSU0bVKxsgpKyzoBRrLrTpy7ZWyroZDylm/lxic9ugYhapmvnSAmbfBId0FD2OlZQWB5JiSzWJFBGSHsMNRWGQnkJ2DDdP+SQDJPzk8/wV240esGY67SG6JgTHmVCQCo9JEiNQZZq82sUpdiaUspoOg/YU8n1sJE3zfLBoCGk2INT5aiTFKFoxhl9ro9QS7ijUGA4hzFNVpMKObskZBBTzxSykRUp1xkFjSIB6cRhkRxk1DXsI1zxMroRqw5iJBKRSUjVTaCbEn3SMUzhoJ/jp1hzI6z3vamBalaEEYUOSFWdmzOE6yeAcooNQ47A4efsRJCyhXmKamiIISh0FKhd8qGZIxMRGGQI6iN99z2sf3BGY67BodoDPqOpJEmX0OFo5LIPho9A7yX6jyijUWHugp6RppsBtESs6qiqMkhqlgzSbwb6E4t0CmH4okqu5sE2XWQbDOUTWe2kZVQjKLMr0UwEy9YrKClOcQ8rbjdhSLExWSYVp6oWpV6DWFAnzOcQO1DkJ5Dx428FdP4T5aNU2q6gydlbIMwjs1A7WDV5vY8xieQmnE2U1bRYhmtzKMUTs8eNlkLL0CQRhKcAZg+qU0LBmBXIMYakbJBhEizE0TplSKOdGXOmHFeIAQlmiFd4VQpUCUnReICCMJ5B0AAnKXRVvI1VsR1SEQQBy2YMgKutQoqvihly/SR3EMuAnu0NYjQEWXup0oqir8rSz0kNgrXAHsXr27QHV6UyfxG8vQvM2XG6jhxjZ22KyhnRdXnlfDjJxB+Hr1UP8JKUvN0/nygKJnT+2Humh6iCiSraOFacvlZRxWGWMc4gH4Xvl7TuyjbFWl2DNCUUw/a+IBnFGgxRygRAk/x8iG8jrFBInIfN/QwLCCUQsTss4b3dHTpK+BGo8hlBLg4QpKnZbQb6DSAcxoUKgxSETkv+8K32f+R4iNV5CMUhN3o9Gy/AFBAqEDuInlRDGu26090oKQo6cKDwp4BEkfQUpRYC+ulTFkrKHpP+F1NgjO6T1xE+8yKMTNn8JMQq2ENEqWbYjscuhiV9Vl3fCAg47I1WweBmkSayTfbcbSZ8Xw86IaYnXz1Mq5/BlW1G+XMPOiAkFykJMf1M6hOhW0PhHCCjrzMPWiItI1L9Cco27SVripblItjPyH6NFfmb+QLBrHVn1z9Fqjw5DlxF6zf6NEeup0RK/jGUHyRHyXXAQfrZgvhoErJSCLSRSVZF/v2wwHRtxiD8FcwuBplQx4Xd1hH5BXI2UskAUxVKygcyfjFDG35VR6tuWwpyQhJRBjSIbSJ6gFTKlOr6PlIR+j0AAKyeRkWoQFWqTTBEzJNUSS3eR4kHqApmGNEqFxOH5GBcIdCPa2Z5gfyyH60jhKKBkPXRH1iyE+ob5AqFuZcs3K8R1Og6NUsdh1nOmCOeBQTr5O0tMWeOUbk+RnvEYqsYRglOI0mudFUd+QwmV8Xi6FT2HtHd/kjn6gpJJ+fxr4TFyfObnGURl37Tl18c607zy1crD/mnVIL2XJlX+MlRknqduVkynECoRg/1mAvmr5xSxsnLIdA/xomaVklKZt91FvaxunTQRIqgQyHIQMN8hPBeTG7mFeG+uascmTjBBqMpHczANpucdhHht9LkYekLCksN1wqbHDYQsHcTE/V91GcaOWXvK4xYiW0bplgCA9OKQmRq1UZ7ZY3UDIXZGuAOQ68AApqROabqHlDMjNKlKzGG31a8o/wBpRk19RswBZgAAAABJRU5ErkJggg==");\n\n// src/stores.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/svelte/store/index.mjs\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/svelte/internal/index.mjs\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nfunction noop() {\n}\nfunction run(fn) {\n return fn();\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === "function";\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nvar resolved_promise = Promise.resolve();\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nvar SvelteElement;\nif (typeof HTMLElement === "function") {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: "open" });\n }\n connectedCallback() {\n const { on_mount } = this.$$;\n this.$$.on_disconnect = on_mount.map(run).filter(is_function);\n for (const key2 in this.$$.slotted) {\n this.appendChild(this.$$.slotted[key2]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n disconnectedCallback() {\n run_all(this.$$.on_disconnect);\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n\n// node_modules/svelte/store/index.mjs\nvar subscriber_queue = [];\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = /* @__PURE__ */ new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) {\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe2(run2, invalidate = noop) {\n const subscriber = [run2, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set) || noop;\n }\n run2(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe: subscribe2 };\n}\n\n// src/stores.ts\nvar localLoad2 = async (key2, def) => {\n if (true) {\n return def;\n }\n const isinls = "__pee__" + key2 in localStorage;\n let ret;\n if (isinls) {\n let it = localStorage.getItem("__pee__" + key2);\n if (it === "undefined")\n it = null;\n ret = { ...def, ...JSON.parse(it || "{}") };\n } else\n ret = def;\n if (true) {\n if (isinls) {\n delete localStorage["__pee__" + key2];\n await chrome.storage.local.set({\n [key2]: JSON.stringify(ret)\n });\n } else {\n const d = await chrome.storage.local.get([key2]);\n if (typeof d[key2] == "string")\n return { ...def, ...await JSON.parse("" + d[key2] || "{}") };\n }\n }\n return ret;\n};\nvar localSet2 = (key2, value) => {\n if (true) {\n return;\n }\n if (true)\n chrome.storage.local.set({ [key2]: JSON.stringify(value) });\n else\n localStorage.setItem("__pee__" + key2, JSON.stringify(value));\n};\nvar initial_settings = localLoad2("settingsv2", {\n loop: true,\n dh: false,\n pmeth: 5,\n xpv: false,\n xpi: false,\n hyd: false,\n notcata: false,\n ak: "",\n auto_embed: 0,\n auto_tags: "",\n te: false,\n eye: false,\n ca: false,\n pre: false,\n prev: false,\n sh: false,\n ep: false,\n tm: false,\n dvc: false,\n expte: false,\n mdist: -1,\n phash: false,\n hotlink: false,\n jpeg: false,\n vercheck: false,\n cache: void 0,\n fhost: 0,\n maxe: 5,\n conc: 8,\n ho: false,\n blacklist: [],\n rsources: []\n});\nvar settings = writable();\ninitial_settings.then((v) => {\n settings.set(v);\n});\nvar appState = writable({\n isCatalog: false,\n is4chanX: false,\n akValid: false,\n herror: "",\n client: null,\n foundPosts: []\n});\nsettings.subscribe((newVal) => {\n localSet2("settingsv2", newVal);\n});\n\n// src/filehosts.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nfunction parseForm(data) {\n const form = new FormData();\n Object.entries(data).filter(([key2, value]) => value !== null).map(([key2, value]) => form.append(key2, value));\n return form;\n}\nvar lolisafe = (domain, serving = domain) => ({\n domain,\n serving,\n async uploadFile(f) {\n const resp = await ifetch(`https://${domain}/api/upload`, {\n headers: {\n accept: "application/json"\n },\n "body": parseForm({\n reqtype: "fileupload",\n "files[]": new File([f], "f.pee")\n }),\n "method": "POST"\n });\n const res = await resp.json();\n return res.files.map((e) => e.url)[0];\n }\n});\nvar catbox = (domain, serving) => ({\n domain,\n serving,\n async uploadFile(inj) {\n const resp = await ifetch(`https://${domain}/user/api.php`, {\n method: "POST",\n body: parseForm({\n reqtype: "fileupload",\n fileToUpload: inj\n })\n });\n return resp.text();\n }\n});\nvar filehosts = [\n catbox("catbox.moe", "files.catbox.moe"),\n catbox("pomf.moe", "a.pomf.cat"),\n lolisafe("take-me-to.space"),\n lolisafe("zz.ht", "z.zz.fo")\n];\n\n// node_modules/file-type/browser.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_node_buffer4 = __toESM(require_buffer(), 1);\nvar import_readable_web_to_node_stream = __toESM(require_lib(), 1);\n\n// node_modules/file-type/core.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_node_buffer3 = __toESM(require_buffer(), 1);\n\n// node_modules/token-types/lib/index.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar ieee754 = __toESM(require_ieee754(), 1);\nvar import_node_buffer = __toESM(require_buffer(), 1);\nvar AnsiStringType = class {\n constructor(len) {\n this.len = len;\n }\n static decode(buffer, offset, until) {\n let str = "";\n for (let i = offset; i < until; ++i) {\n str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i]));\n }\n return str;\n }\n static inRange(a, min, max) {\n return min <= a && a <= max;\n }\n static codePointToString(cp) {\n if (cp <= 65535) {\n return String.fromCharCode(cp);\n } else {\n cp -= 65536;\n return String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320);\n }\n }\n static singleByteDecoder(bite) {\n if (AnsiStringType.inRange(bite, 0, 127)) {\n return bite;\n }\n const codePoint = AnsiStringType.windows1252[bite - 128];\n if (codePoint === null) {\n throw Error("invaliding encoding");\n }\n return codePoint;\n }\n get(buffer, offset = 0) {\n return AnsiStringType.decode(buffer, offset, offset + this.len);\n }\n};\nAnsiStringType.windows1252 = [\n 8364,\n 129,\n 8218,\n 402,\n 8222,\n 8230,\n 8224,\n 8225,\n 710,\n 8240,\n 352,\n 8249,\n 338,\n 141,\n 381,\n 143,\n 144,\n 8216,\n 8217,\n 8220,\n 8221,\n 8226,\n 8211,\n 8212,\n 732,\n 8482,\n 353,\n 8250,\n 339,\n 157,\n 382,\n 376,\n 160,\n 161,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 171,\n 172,\n 173,\n 174,\n 175,\n 176,\n 177,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 187,\n 188,\n 189,\n 190,\n 191,\n 192,\n 193,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 203,\n 204,\n 205,\n 206,\n 207,\n 208,\n 209,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 219,\n 220,\n 221,\n 222,\n 223,\n 224,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 235,\n 236,\n 237,\n 238,\n 239,\n 240,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250,\n 251,\n 252,\n 253,\n 254,\n 255\n];\n\n// node_modules/strtok3/lib/core.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/strtok3/lib/ReadStreamTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/strtok3/lib/AbstractTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/index.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/EndOfFileStream.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/StreamReader.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/Deferred.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/peek-readable/lib/StreamReader.js\nvar maxStreamReadSize = 1 * 1024 * 1024;\n\n// node_modules/strtok3/lib/AbstractTokenizer.js\nvar import_node_buffer2 = __toESM(require_buffer(), 1);\n\n// node_modules/strtok3/lib/BufferTokenizer.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/file-type/util.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\n\n// node_modules/file-type/supported.js\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar extensions = [\n "jpg",\n "png",\n "apng",\n "gif",\n "webp",\n "flif",\n "xcf",\n "cr2",\n "cr3",\n "orf",\n "arw",\n "dng",\n "nef",\n "rw2",\n "raf",\n "tif",\n "bmp",\n "icns",\n "jxr",\n "psd",\n "indd",\n "zip",\n "tar",\n "rar",\n "gz",\n "bz2",\n "7z",\n "dmg",\n "mp4",\n "mid",\n "mkv",\n "webm",\n "mov",\n "avi",\n "mpg",\n "mp2",\n "mp3",\n "m4a",\n "oga",\n "ogg",\n "ogv",\n "opus",\n "flac",\n "wav",\n "spx",\n "amr",\n "pdf",\n "epub",\n "elf",\n "exe",\n "swf",\n "rtf",\n "wasm",\n "woff",\n "woff2",\n "eot",\n "ttf",\n "otf",\n "ico",\n "flv",\n "ps",\n "xz",\n "sqlite",\n "nes",\n "crx",\n "xpi",\n "cab",\n "deb",\n "ar",\n "rpm",\n "Z",\n "lz",\n "cfb",\n "mxf",\n "mts",\n "blend",\n "bpg",\n "docx",\n "pptx",\n "xlsx",\n "3gp",\n "3g2",\n "jp2",\n "jpm",\n "jpx",\n "mj2",\n "aif",\n "qcp",\n "odt",\n "ods",\n "odp",\n "xml",\n "mobi",\n "heic",\n "cur",\n "ktx",\n "ape",\n "wv",\n "dcm",\n "ics",\n "glb",\n "pcap",\n "dsf",\n "lnk",\n "alias",\n "voc",\n "ac3",\n "m4v",\n "m4p",\n "m4b",\n "f4v",\n "f4p",\n "f4b",\n "f4a",\n "mie",\n "asf",\n "ogm",\n "ogx",\n "mpc",\n "arrow",\n "shp",\n "aac",\n "mp1",\n "it",\n "s3m",\n "xm",\n "ai",\n "skp",\n "avif",\n "eps",\n "lzh",\n "pgp",\n "asar",\n "stl",\n "chm",\n "3mf",\n "zst",\n "jxl",\n "vcf"\n];\nvar mimeTypes = [\n "image/jpeg",\n "image/png",\n "image/gif",\n "image/webp",\n "image/flif",\n "image/x-xcf",\n "image/x-canon-cr2",\n "image/x-canon-cr3",\n "image/tiff",\n "image/bmp",\n "image/vnd.ms-photo",\n "image/vnd.adobe.photoshop",\n "application/x-indesign",\n "application/epub+zip",\n "application/x-xpinstall",\n "application/vnd.oasis.opendocument.text",\n "application/vnd.oasis.opendocument.spreadsheet",\n "application/vnd.oasis.opendocument.presentation",\n "application/vnd.openxmlformats-officedocument.wordprocessingml.document",\n "application/vnd.openxmlformats-officedocument.presentationml.presentation",\n "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",\n "application/zip",\n "application/x-tar",\n "application/x-rar-compressed",\n "application/gzip",\n "application/x-bzip2",\n "application/x-7z-compressed",\n "application/x-apple-diskimage",\n "application/x-apache-arrow",\n "video/mp4",\n "audio/midi",\n "video/x-matroska",\n "video/webm",\n "video/quicktime",\n "video/vnd.avi",\n "audio/vnd.wave",\n "audio/qcelp",\n "audio/x-ms-asf",\n "video/x-ms-asf",\n "application/vnd.ms-asf",\n "video/mpeg",\n "video/3gpp",\n "audio/mpeg",\n "audio/mp4",\n "audio/opus",\n "video/ogg",\n "audio/ogg",\n "application/ogg",\n "audio/x-flac",\n "audio/ape",\n "audio/wavpack",\n "audio/amr",\n "application/pdf",\n "application/x-elf",\n "application/x-msdownload",\n "application/x-shockwave-flash",\n "application/rtf",\n "application/wasm",\n "font/woff",\n "font/woff2",\n "application/vnd.ms-fontobject",\n "font/ttf",\n "font/otf",\n "image/x-icon",\n "video/x-flv",\n "application/postscript",\n "application/eps",\n "application/x-xz",\n "application/x-sqlite3",\n "application/x-nintendo-nes-rom",\n "application/x-google-chrome-extension",\n "application/vnd.ms-cab-compressed",\n "application/x-deb",\n "application/x-unix-archive",\n "application/x-rpm",\n "application/x-compress",\n "application/x-lzip",\n "application/x-cfb",\n "application/x-mie",\n "application/mxf",\n "video/mp2t",\n "application/x-blender",\n "image/bpg",\n "image/jp2",\n "image/jpx",\n "image/jpm",\n "image/mj2",\n "audio/aiff",\n "application/xml",\n "application/x-mobipocket-ebook",\n "image/heif",\n "image/heif-sequence",\n "image/heic",\n "image/heic-sequence",\n "image/icns",\n "image/ktx",\n "application/dicom",\n "audio/x-musepack",\n "text/calendar",\n "text/vcard",\n "model/gltf-binary",\n "application/vnd.tcpdump.pcap",\n "audio/x-dsf",\n "application/x.ms.shortcut",\n "application/x.apple.alias",\n "audio/x-voc",\n "audio/vnd.dolby.dd-raw",\n "audio/x-m4a",\n "image/apng",\n "image/x-olympus-orf",\n "image/x-sony-arw",\n "image/x-adobe-dng",\n "image/x-nikon-nef",\n "image/x-panasonic-rw2",\n "image/x-fujifilm-raf",\n "video/x-m4v",\n "video/3gpp2",\n "application/x-esri-shape",\n "audio/aac",\n "audio/x-it",\n "audio/x-s3m",\n "audio/x-xm",\n "video/MP1S",\n "video/MP2P",\n "application/vnd.sketchup.skp",\n "image/avif",\n "application/x-lzh-compressed",\n "application/pgp-encrypted",\n "application/x-asar",\n "model/stl",\n "application/vnd.ms-htmlhelp",\n "model/3mf",\n "image/jxl",\n "application/zstd"\n];\n\n// node_modules/file-type/core.js\nvar supportedExtensions = new Set(extensions);\nvar supportedMimeTypes = new Set(mimeTypes);\n\n// src/utils.ts\nvar csettings;\nsettings.subscribe((b) => {\n csettings = b;\n});\nvar threadDataCache = writable();\nvar cthreadDataCache;\nthreadDataCache.subscribe((newval) => {\n cthreadDataCache = newval;\n});\nvar decodeCoom3Payload = async (buff) => {\n if (!csettings)\n throw new Error("Settings uninit");\n const allowed_domains = filehosts.map((e) => e.serving.replaceAll(".", "\\\\."));\n const pees = buff.toString().split(" ").slice(0, csettings.maxe).filter((e) => allowed_domains.some((v) => e.match(`https://(.*\\\\.)?${v}/`)));\n return (await Promise.all(pees.map(async (pee) => {\n try {\n const m = pee.match(/(?https?):\\/\\/(?.*?)(?\\/.*)/);\n if (!m)\n return;\n const { domain, file } = m.groups;\n const headers = await getHeaders(pee);\n const res = await ifetch(pee, {\n headers: { range: "bytes=0-32767", "user-agent": "" },\n mode: "cors",\n referrerPolicy: "no-referrer"\n });\n const size = +headers["content-length"] || 0;\n const header = import_buffer2.Buffer.from(await res.arrayBuffer());\n let hptr = 0;\n if (header.slice(0, 4).toString() == "PEE\\0")\n hptr += 4;\n else\n return;\n const flags = header[hptr];\n const hasFn = !!(flags & 1);\n const hasTags = !!(flags & 2);\n const hasThumbnail = !!(flags & 4);\n let [ptr, ptr2] = [hptr + 1, hptr + 1];\n let fn = "embedded";\n let tags = [];\n let thumb = import_buffer2.Buffer.from(hasembed_default);\n if (hasFn) {\n while (header[ptr2] != 0)\n ptr2++;\n fn = header.slice(ptr, ptr2).toString();\n ptr = ++ptr2;\n }\n if (hasTags) {\n while (header[ptr2] != 0)\n ptr2++;\n tags = header.slice(ptr, ptr2).toString().split(/\\s+/);\n }\n let thumbsize = 0;\n if (hasThumbnail) {\n thumbsize = header.readInt32LE(ptr);\n ptr += 4;\n if (header.byteLength >= ptr + thumbsize)\n thumb = header.slice(ptr, ptr + thumbsize);\n else\n thumb = import_buffer2.Buffer.from(await (await ifetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer());\n ptr += thumbsize;\n }\n const unzip = { url: pee, headers: { "user-agent": "", range: `bytes=${ptr}-${size - 1}` } };\n let data;\n data = unzip;\n if (size < 3072) {\n thumb = data = import_buffer2.Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer());\n }\n return {\n filename: fn,\n data,\n thumbnail: thumb\n };\n } catch (e) {\n console.warn(e);\n }\n }))).filter((e) => e).map((e) => e);\n};\n\n// src/pngv3.ts\nvar bs58 = __toESM(require_bs58(), 1);\n\n// src/bitstream.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar revbyte = (n, len = 8) => {\n let acc = 0;\n let n2 = n;\n let len2 = len;\n while (len2) {\n acc = acc * 2 + (n2 & 1);\n n2 >>= 1;\n len2--;\n }\n return acc;\n};\nvar BitstreamReader = class {\n constructor() {\n this.buffers = [];\n this.bufferedLength = 0;\n this._offsetIntoBuffer = 0;\n this._bufferIndex = 0;\n this._offset = 0;\n this.skippedLength = 0;\n }\n get bufferIndex() {\n return this._bufferIndex;\n }\n get offset() {\n return this._offset;\n }\n get available() {\n return this.bufferedLength - this.skippedLength;\n }\n getBit(offset) {\n const byte = this.buffers[0][offset >> 3];\n return +!!(byte & 1 << (offset & 7));\n }\n readSync(length) {\n let value = 0;\n if (this._offset >> 3 > this.buffers[0].byteLength) {\n throw "Out of data";\n }\n for (let i = length - 1; i >= 0; --i) {\n value = value * 2 + this.getBit(this._offset + i);\n }\n this._offset += length;\n this.bufferedLength -= length;\n return value;\n }\n addBuffer(buffer) {\n this.buffers.push(buffer);\n this.bufferedLength += buffer.length * 8;\n }\n};\nvar BitstreamWriter = class {\n constructor(stream, bufferSize = 1) {\n this.stream = stream;\n this.pendingBits = 0;\n this.bufferoffset = 0;\n this._offset = 0;\n bufferSize = 1;\n this.buffer = new Uint8Array(bufferSize);\n }\n get offset() {\n return this._offset;\n }\n get byteOffset() {\n return this.pendingBits;\n }\n end() {\n this.flush();\n }\n flush() {\n this.stream.write(new Uint8Array(this.buffer));\n this.bufferoffset = 0;\n this.buffer.fill(0);\n }\n setBit(b) {\n let byte = this.buffer[0];\n byte |= b << (this._offset & 7);\n this.buffer[0] = byte;\n this._offset += 1;\n if (++this.bufferoffset == this.buffer.length * 8) {\n this.flush();\n }\n }\n write(length, value) {\n while (length--) {\n this.setBit(value & 1);\n value >>= 1;\n }\n }\n};\n\n// src/dh-deflate.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar TINF_OK = 0;\nvar Tree = class {\n constructor() {\n this.table = new Uint16Array(16);\n this.trans = new Uint16Array(288);\n }\n};\nvar getPathTo = (tree, value) => {\n if (tree[0] === value)\n return "0";\n if (tree[1] === value)\n return "1";\n let p;\n if (typeof tree[0] != "number")\n p = getPathTo(tree[0], value);\n let b = "0";\n if (!p) {\n if (tree[1] && typeof tree[1] != "number")\n p = getPathTo(tree[1], value);\n b = "1";\n }\n if (p)\n return b + p;\n};\nfunction buildHuffmanTable(codeLengths, values) {\n let k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({ children: [], index: 0 });\n let p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error("Could not recreate Huffman Table");\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n code.push(q = { children: [], index: 0 });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n}\nvar Data = class {\n constructor(source, dests, to_hide, hidden) {\n this.source = source;\n this.dests = dests;\n this.to_hide = to_hide;\n this.hidden = hidden;\n this.pathMap = /* @__PURE__ */ new Map();\n this.dest = [];\n this.ltree = new Tree();\n this.dtree = new Tree();\n }\n computeReverse() {\n this.rltree = buildHuffmanTable(this.ltree.table, this.ltree.trans)[0];\n this.rdtree = buildHuffmanTable(this.dtree.table, this.dtree.trans)[0];\n this.adists = new Set(this.rdtree.flat(16));\n }\n};\nvar sltree = new Tree();\nvar sdtree = new Tree();\nvar rltree;\nvar rdtree;\nvar sadist;\nvar length_bits = new Uint8Array(30);\nvar length_base = new Uint16Array(30);\nvar dist_bits = new Uint8Array(30);\nvar dist_base = new Uint16Array(30);\nvar clcidx = new Uint8Array([\n 16,\n 17,\n 18,\n 0,\n 8,\n 7,\n 9,\n 6,\n 10,\n 5,\n 11,\n 4,\n 12,\n 3,\n 13,\n 2,\n 14,\n 1,\n 15\n]);\nvar code_tree = new Tree();\nvar lengths = new Uint8Array(288 + 32);\nfunction tinf_build_bits_base(bits, base, delta, first) {\n let i, sum;\n for (i = 0; i < delta; ++i)\n bits[i] = 0;\n for (i = 0; i < 30 - delta; ++i)\n bits[i + delta] = i / delta | 0;\n for (sum = first, i = 0; i < 30; ++i) {\n base[i] = sum;\n sum += 1 << bits[i];\n }\n}\nfunction tinf_build_fixed_trees(lt, dt) {\n let i;\n for (i = 0; i < 7; ++i)\n lt.table[i] = 0;\n lt.table[7] = 24;\n lt.table[8] = 152;\n lt.table[9] = 112;\n for (i = 0; i < 24; ++i)\n lt.trans[i] = 256 + i;\n for (i = 0; i < 144; ++i)\n lt.trans[24 + i] = i;\n for (i = 0; i < 8; ++i)\n lt.trans[24 + 144 + i] = 280 + i;\n for (i = 0; i < 112; ++i)\n lt.trans[24 + 144 + 8 + i] = 144 + i;\n for (i = 0; i < 5; ++i)\n dt.table[i] = 0;\n dt.table[5] = 32;\n for (i = 0; i < 32; ++i)\n dt.trans[i] = i;\n}\nvar offs = new Uint16Array(16);\nfunction tinf_build_tree(t, lengths2, off, num) {\n let i, sum;\n for (i = 0; i < 16; ++i)\n t.table[i] = 0;\n for (i = 0; i < num; ++i)\n t.table[lengths2[off + i]]++;\n t.table[0] = 0;\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum;\n sum += t.table[i];\n }\n for (i = 0; i < num; ++i) {\n if (lengths2[off + i])\n t.trans[offs[lengths2[off + i]]++] = i;\n }\n}\nfunction tinf_getbit(d) {\n const v = d.source.readSync(1);\n return v;\n}\nvar loff = 0;\nvar loffs = [];\nfunction tinf_read_bits(d, num, base) {\n if (!num)\n return base;\n const v = d.source.readSync(num) + base;\n loff = v;\n loffs.push(v);\n if (loffs.length > 4) {\n loffs.shift();\n }\n return v;\n}\nfunction tinf_decode_symbol(d, t, copy = true, ext = {}) {\n let sum = 0, cur = 0, len = 0;\n let s = 0;\n do {\n const b = d.source.readSync(1);\n copy && d.hidden?.write(1, b);\n s = s << 1 | b;\n cur = 2 * cur + b;\n ++len;\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n ext.length = len;\n ext.sym = s;\n return t.trans[sum + cur];\n}\nfunction tinf_decode_trees(d, lt, dt, copy = true) {\n let i, num, length;\n const hlit = tinf_read_bits(d, 5, 257);\n copy && d.hidden?.write(5, hlit - 257);\n const hdist = tinf_read_bits(d, 5, 1);\n copy && d.hidden?.write(5, hdist - 1);\n const hclen = tinf_read_bits(d, 4, 4);\n copy && d.hidden?.write(4, hclen - 4);\n for (i = 0; i < 19; ++i)\n lengths[i] = 0;\n for (i = 0; i < hclen; ++i) {\n const clen = tinf_read_bits(d, 3, 0);\n copy && d.hidden?.write(3, clen);\n lengths[clcidx[i]] = clen;\n }\n tinf_build_tree(code_tree, lengths, 0, 19);\n for (num = 0; num < hlit + hdist; ) {\n const sym = tinf_decode_symbol(d, code_tree, copy);\n let prev;\n switch (sym) {\n case 16:\n prev = lengths[num - 1];\n length = tinf_read_bits(d, 2, 3);\n copy && d.hidden?.write(2, length - 3);\n for (; length; --length) {\n lengths[num++] = prev;\n }\n break;\n case 17:\n length = tinf_read_bits(d, 3, 3);\n copy && d.hidden?.write(3, length - 3);\n for (; length; --length) {\n lengths[num++] = 0;\n }\n break;\n case 18:\n length = tinf_read_bits(d, 7, 11);\n copy && d.hidden?.write(7, length - 11);\n for (; length; --length) {\n lengths[num++] = 0;\n }\n break;\n default:\n lengths[num++] = sym;\n break;\n }\n }\n tinf_build_tree(lt, lengths, 0, hlit);\n tinf_build_tree(dt, lengths, hlit, hdist);\n}\nvar get_symbol = (value, bits_table, base_table) => {\n let i = 0;\n for (i = 0; i < base_table.length; ++i) {\n if (base_table[i] > value) {\n i--;\n return [i, bits_table[i], value - base_table[i]];\n }\n }\n i--;\n return [i, bits_table[i], value - base_table[i]];\n};\nvar encode_symbol = (sym, tree, pathMap) => {\n const code = getPathTo(tree, sym);\n const v = {\n length: code?.length,\n val: parseInt(code, 2)\n };\n return v;\n};\nvar capacity = 0;\nfunction tinf_inflate_block_data(d, lt, dt) {\n while (1) {\n let sym = tinf_decode_symbol(d, lt);\n if (sym === 256) {\n return TINF_OK;\n }\n if (sym < 256) {\n d.dest.push(sym);\n } else {\n sym -= 257;\n const length = tinf_read_bits(d, length_bits[sym], length_base[sym]);\n if (length_bits[sym])\n d.hidden?.write(length_bits[sym], length - length_base[sym]);\n const ext = { length: 0, sym: 0 };\n const dist = tinf_decode_symbol(d, dt, false, ext);\n let backoffset = tinf_read_bits(d, dist_bits[dist], dist_base[dist]);\n const offs2 = d.dest.length - backoffset;\n let match;\n const skip = !d.to_hide || d.to_hide && d.to_hide instanceof BitstreamReader && d.to_hide.available == 0;\n if (!skip && (match = Buffer2.from(d.dest.slice(offs2, offs2 + length))).length == length) {\n let begin = d.dest.length - 32768;\n if (begin < 0)\n begin = 0;\n let matches = [];\n let o = 0;\n const slic = Buffer2.from(d.dest.slice(begin + o, d.dest.length));\n while (begin + o < d.dest.length) {\n const r = slic.slice(o, d.dest.length).indexOf(match);\n if (r >= 0) {\n matches.push(r + begin + o);\n o += r;\n } else {\n break;\n }\n o++;\n }\n if (matches.length > 1) {\n matches = matches.map((e) => -(e - d.dest.length)).filter((e) => {\n const [dsym2] = get_symbol(e, dist_bits, dist_base);\n return d.adists.has(dsym2);\n });\n matches.reverse();\n const v = Math.floor(Math.log2(matches.length));\n capacity += v;\n if (d.to_hide instanceof BitstreamReader) {\n if (d.to_hide.available) {\n const s = d.to_hide.readSync(Math.min(d.to_hide.available, v));\n backoffset = matches[s];\n }\n } else {\n const idx = matches.indexOf(backoffset);\n d.to_hide.write(v, idx);\n }\n }\n }\n const [dsym, dlen, doff] = get_symbol(backoffset, dist_bits, dist_base);\n const encdist = encode_symbol(dsym, d.rdtree, d.pathMap);\n d.hidden?.write(encdist.length, revbyte(encdist.val, encdist.length));\n d.hidden?.write(dlen, doff);\n for (let i = offs2; i < offs2 + length; ++i) {\n d.dest.push(d.dest[i]);\n }\n }\n }\n}\nfunction tinf_inflate_uncompressed_block(d) {\n if (d.source.offset & 7)\n d.source.readSync(8 - d.source.offset & 7);\n if (d.hidden && d.hidden.offset & 7)\n d.hidden?.write(8 - d.hidden.offset & 7, 0);\n const length = d.source.readSync(16);\n d.hidden?.write(16, length);\n const invlength = d.source.readSync(16);\n d.hidden?.write(16, invlength);\n if (length !== (~invlength & 65535)) {\n return -4;\n }\n for (let i = length; i; --i) {\n const v = d.source.readSync(8);\n d.dest.push(v);\n d.hidden?.write(8, v);\n }\n return TINF_OK;\n}\nfunction tinf_uncompress(source, decompressed, to_hide, hidden, opt = 0) {\n const decomp = decompressed ? new BitstreamWriter({ write: decompressed }) : null;\n const hid = hidden && new BitstreamWriter({ write: hidden }, 4);\n const d = new Data(source, decomp, to_hide, hid);\n let res;\n let bfinal, btype;\n do {\n bfinal = tinf_getbit(d);\n d.hidden?.write(1, bfinal);\n btype = tinf_read_bits(d, 2, 0);\n d.hidden?.write(2, btype);\n switch (btype) {\n case 0:\n res = tinf_inflate_uncompressed_block(d);\n break;\n case 1:\n d.rdtree = rdtree;\n d.rltree = rltree;\n d.adists = sadist;\n res = tinf_inflate_block_data(d, sltree, sdtree);\n break;\n case 2:\n tinf_decode_trees(d, d.ltree, d.dtree);\n d.computeReverse();\n res = tinf_inflate_block_data(d, d.ltree, d.dtree);\n break;\n default:\n res = -2;\n }\n if (res !== TINF_OK)\n throw new Error("Data error " + res);\n } while (!bfinal);\n decomp?.end();\n hid?.end();\n}\ntinf_build_fixed_trees(sltree, sdtree);\ntinf_build_bits_base(length_bits, length_base, 4, 3);\ntinf_build_bits_base(dist_bits, dist_base, 2, 1);\nrltree = buildHuffmanTable(sltree.table, sltree.trans)[0];\nrdtree = buildHuffmanTable(sdtree.table, sdtree.trans)[0];\nsadist = new Set(rdtree.flat(16));\nlength_bits[28] = 0;\nlength_base[28] = 258;\n\n// src/pngv3.ts\nvar csettings2;\nsettings.subscribe((b) => {\n csettings2 = b;\n});\nvar CUM3 = import_buffer3.Buffer.from("doo\\0m");\nvar CUM4 = import_buffer3.Buffer.from("voo\\0m");\nvar CUM5 = import_buffer3.Buffer.from("boo\\0");\nvar CUM6 = import_buffer3.Buffer.from("Creation Time\\0");\nvar CUM7 = import_buffer3.Buffer.from("Software\\0");\nvar BufferReadStream = (b) => {\n const ret = new ReadableStream({\n pull(cont) {\n cont.enqueue(b);\n cont.close();\n }\n });\n return ret;\n};\nvar password = import_buffer3.Buffer.from("NOA");\nvar xor = (a, p) => {\n let n = 0;\n for (let i = 0; i < a.byteLength; ++i) {\n a[i] ^= p[n];\n n++;\n n %= p.byteLength;\n }\n};\nvar prefs = {\n "files.catbox.moe": "c",\n "a.pomf.cat": "p",\n "take-me-to.space": "t",\n "z.zz.fo": "z"\n};\nvar rprefs = {\n "c": "files.catbox.moe",\n "p": "a.pomf.cat",\n "t": "take-me-to.space",\n "z": "z.zz.fo"\n};\nvar extractFromRawDeflate = (b) => {\n const src = new BitstreamReader();\n src.addBuffer(b);\n const chnks = [];\n const hidden = new BitstreamWriter({\n write(chunk) {\n for (const i of chunk) {\n if (i)\n chnks.push(i);\n else\n throw "Finish";\n }\n }\n });\n try {\n tinf_uncompress(src, void 0, hidden, void 0);\n } catch (e) {\n if (e == "Finish")\n return import_buffer3.Buffer.from(chnks);\n }\n return false;\n};\nvar extract = async (png, doextract = true) => {\n const reader = BufferReadStream(png).getReader();\n const sneed = new PNGDecoder(reader, false);\n const ret = [];\n let w;\n if (!csettings2)\n throw new Error("Settings uninit");\n try {\n let complete = false;\n const idats = [];\n for await (const [name, chunk, crc, offset] of sneed.chunks()) {\n let buff;\n switch (name) {\n case "tEXt":\n buff = chunk;\n if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) {\n if (!doextract)\n return true;\n const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length));\n ret.push(...k.filter((e) => e));\n }\n if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) {\n if (!doextract)\n return true;\n const passed = buff.slice(4 + CUM4.length);\n xor(passed, password);\n const k = await decodeCoom3Payload(passed);\n ret.push(...k.filter((e) => e));\n }\n if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) {\n if (!doextract)\n return true;\n const passed = buff.slice(4 + CUM5.length);\n const decoded = import_buffer3.Buffer.from(passed.toString(), "base64").toString().split(" ").map((e) => {\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded));\n ret.push(...k.filter((e) => e));\n }\n if (w = [CUM6, CUM7].find((e) => buff.slice(4, 4 + e.length).equals(e))) {\n const passed = buff.slice(4 + w.length);\n if (!passed.toString().match(/^[0-9a-zA-Z+/=]+$/g))\n continue;\n const decoders = [\n (b) => import_buffer3.Buffer.from(b.toString(), "base64").toString(),\n (b) => import_buffer3.Buffer.from(bs58.decode(passed.toString())).toString()\n ];\n for (const d of decoders) {\n try {\n const decoded = d(passed).split(" ").map((e) => {\n if (!(e[0] in rprefs))\n throw "Uhh";\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n if (!doextract)\n return true;\n const k = await decodeCoom3Payload(import_buffer3.Buffer.from(decoded));\n ret.push(...k.filter((e) => e));\n } catch (e) {\n }\n }\n }\n break;\n case "IDAT":\n if (ret.length)\n return ret;\n buff = chunk;\n idats.push(buff.slice(4));\n break;\n case "IEND":\n complete = true;\n default:\n break;\n }\n }\n if (idats.length) {\n let decoded;\n if ((decoded = extractFromRawDeflate(import_buffer3.Buffer.concat(idats).slice(2))) === false)\n return false;\n const dec = decoded.toString().split(" ").map((e) => {\n if (!(e[0] in rprefs))\n throw "Uhh";\n return `https://${rprefs[e[0]]}/${e.slice(1)}`;\n }).join(" ");\n if (doextract)\n return decodeCoom3Payload(import_buffer3.Buffer.from(dec));\n return true;\n }\n } catch (e) {\n if (e != "Uhh")\n console.error(e);\n } finally {\n reader.releaseLock();\n }\n};\nvar buildChunk = (tag, data) => {\n const ret = import_buffer3.Buffer.alloc(data.byteLength + 4);\n ret.write(tag.slice(0, 4), 0);\n data.copy(ret, 4);\n return ret;\n};\nvar BufferWriteStream = () => {\n let b = import_buffer3.Buffer.from([]);\n const ret = new WritableStream({\n write(chunk) {\n b = import_buffer3.Buffer.concat([b, chunk]);\n console.log("finished appending");\n }\n });\n return [ret, () => b];\n};\nvar embedInRawDeflate = (b, h) => {\n const src = new BitstreamReader();\n const hid = new BitstreamReader();\n hid.addBuffer(h);\n src.addBuffer(b);\n const chnks = [];\n tinf_uncompress(src, void 0, hid, (c) => chnks.push(c));\n return import_buffer3.Buffer.concat(chnks);\n};\nvar inject_data = async (container, injb) => {\n if (!csettings2)\n throw new Error("Settings uninit");\n if (csettings2.pmeth < 5) {\n let magic = false;\n const [writestream2, extract6] = BufferWriteStream();\n const encoder = new PNGEncoder(writestream2);\n const decoder = new PNGDecoder(container.stream().getReader());\n for await (const [name, chunk, crc, offset] of decoder.chunks()) {\n if (magic && name != "IDAT")\n break;\n if (!magic && name == "IDAT") {\n const passed = import_buffer3.Buffer.from(injb);\n switch (csettings2.pmeth) {\n case 0:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM3, passed])), 0, 0]);\n break;\n case 1:\n xor(passed, password);\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM4, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 2:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM5, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 3:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM6, import_buffer3.Buffer.from(import_buffer3.Buffer.from(passed).toString("base64"))])), 0, 0]);\n break;\n case 4:\n await encoder.insertchunk(["tEXt", buildChunk("tEXt", import_buffer3.Buffer.concat([CUM7, import_buffer3.Buffer.from(bs58.encode(passed))])), 0, 0]);\n break;\n }\n magic = true;\n }\n await encoder.insertchunk([name, chunk, crc, offset]);\n }\n await encoder.insertchunk([\n "IEND",\n buildChunk("IEND", import_buffer3.Buffer.from([])),\n 0,\n 0\n ]);\n return extract6();\n }\n let pdec = new PNGDecoder(container.stream().getReader());\n const concat = [];\n for await (const chk of pdec.chunks())\n if (chk[0] == "IDAT")\n concat.push(chk[1].slice(4));\n const comp = import_buffer3.Buffer.concat(concat);\n const head = comp.slice(0, 2);\n const chksum = comp.slice(-4);\n const idatblk = embedInRawDeflate(comp.slice(2, -4), injb);\n const [writestream, extract5] = BufferWriteStream();\n const penc = new PNGEncoder(writestream);\n pdec = new PNGDecoder(container.stream().getReader());\n let ins = false;\n for await (const chk of pdec.chunks()) {\n if (chk[0] != "IDAT") {\n await penc.insertchunk(chk);\n } else {\n if (!ins) {\n await penc.insertchunk(["IDAT", import_buffer3.Buffer.concat([import_buffer3.Buffer.from("IDAT"), head, idatblk, chksum]), 0, 0]);\n ins = true;\n }\n }\n }\n await penc.dtor();\n console.log("Finished writing");\n return extract5();\n};\nvar inject = async (container, links) => {\n links = links.map((link) => {\n for (const h of filehosts) {\n if (link.includes(h.serving)) {\n const end = link.split("/").slice(-1)[0];\n return `${prefs[h.serving]}${end}`;\n }\n }\n return "";\n });\n const injb = import_buffer3.Buffer.from(links.join(" "));\n return inject_data(container, injb);\n};\nvar has_embed = async (png) => {\n const r = await extract(png, false);\n return !!r;\n};\nvar pngv3_default = {\n extract,\n has_embed,\n inject,\n match: (fn) => !!fn.match(/\\.png$/)\n};\n\n// src/jpg.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer4 = __toESM(require_buffer(), 1);\n\n// src/f5stego.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar bitcode = new Array(65535);\nvar category = new Array(65535);\nvar std_dc_luminance_nrcodes = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0];\nvar std_dc_luminance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nvar std_ac_luminance_nrcodes = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125];\nvar std_ac_luminance_values = [\n 1,\n 2,\n 3,\n 0,\n 4,\n 17,\n 5,\n 18,\n 33,\n 49,\n 65,\n 6,\n 19,\n 81,\n 97,\n 7,\n 34,\n 113,\n 20,\n 50,\n 129,\n 145,\n 161,\n 8,\n 35,\n 66,\n 177,\n 193,\n 21,\n 82,\n 209,\n 240,\n 36,\n 51,\n 98,\n 114,\n 130,\n 9,\n 10,\n 22,\n 23,\n 24,\n 25,\n 26,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 225,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 241,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n];\nvar std_dc_chrominance_nrcodes = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];\nvar std_dc_chrominance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nvar std_ac_chrominance_nrcodes = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119];\nvar std_ac_chrominance_values = [\n 0,\n 1,\n 2,\n 3,\n 17,\n 4,\n 5,\n 33,\n 49,\n 6,\n 18,\n 65,\n 81,\n 7,\n 97,\n 113,\n 19,\n 34,\n 50,\n 129,\n 8,\n 20,\n 66,\n 145,\n 161,\n 177,\n 193,\n 9,\n 35,\n 51,\n 82,\n 240,\n 21,\n 98,\n 114,\n 209,\n 10,\n 22,\n 36,\n 52,\n 225,\n 37,\n 241,\n 23,\n 24,\n 25,\n 26,\n 38,\n 39,\n 40,\n 41,\n 42,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 67,\n 68,\n 69,\n 70,\n 71,\n 72,\n 73,\n 74,\n 83,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 99,\n 100,\n 101,\n 102,\n 103,\n 104,\n 105,\n 106,\n 115,\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 152,\n 153,\n 154,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 178,\n 179,\n 180,\n 181,\n 182,\n 183,\n 184,\n 185,\n 186,\n 194,\n 195,\n 196,\n 197,\n 198,\n 199,\n 200,\n 201,\n 202,\n 210,\n 211,\n 212,\n 213,\n 214,\n 215,\n 216,\n 217,\n 218,\n 226,\n 227,\n 228,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 242,\n 243,\n 244,\n 245,\n 246,\n 247,\n 248,\n 249,\n 250\n];\nfunction _initCategoryNumber() {\n var nrlower = 1;\n var nrupper = 2;\n for (var cat = 1; cat <= 15; cat++) {\n for (var nr = nrlower; nr < nrupper; nr++) {\n category[32767 + nr] = cat;\n bitcode[32767 + nr] = [];\n bitcode[32767 + nr][1] = cat;\n bitcode[32767 + nr][0] = nr;\n }\n for (var nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) {\n category[32767 + nrneg] = cat;\n bitcode[32767 + nrneg] = [];\n bitcode[32767 + nrneg][1] = cat;\n bitcode[32767 + nrneg][0] = nrupper - 1 + nrneg;\n }\n nrlower <<= 1;\n nrupper <<= 1;\n }\n}\n_initCategoryNumber();\nfunction _computeHuffmanTbl(nrcodes, std_table) {\n var codevalue = 0;\n var pos_in_table = 0;\n var HT = [];\n for (var k = 1; k <= 16; k++) {\n for (var j = 1; j <= nrcodes[k]; j++) {\n HT[std_table[pos_in_table]] = [];\n HT[std_table[pos_in_table]][0] = codevalue;\n HT[std_table[pos_in_table]][1] = k;\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n}\nvar YDC_HT = _computeHuffmanTbl(std_dc_luminance_nrcodes, std_dc_luminance_values);\nvar UVDC_HT = _computeHuffmanTbl(std_dc_chrominance_nrcodes, std_dc_chrominance_values);\nvar YAC_HT = _computeHuffmanTbl(std_ac_luminance_nrcodes, std_ac_luminance_values);\nvar UVAC_HT = _computeHuffmanTbl(std_ac_chrominance_nrcodes, std_ac_chrominance_values);\nvar _randPool, __raw, _jfif, _APPn, _qts, _frame, _tail, _shuffleInit, shuffleInit_fn, _stegShuffle, stegShuffle_fn, __analyze, _analyze_fn, __f5write, _f5write_fn;\nvar f5stego = class {\n constructor(key2, maxPixels = 4096 * 4096) {\n this.maxPixels = maxPixels;\n __privateAdd(this, _shuffleInit);\n __privateAdd(this, _stegShuffle);\n __privateAdd(this, __analyze);\n __privateAdd(this, __f5write);\n __privateAdd(this, _randPool, void 0);\n __privateAdd(this, __raw, void 0);\n __privateAdd(this, _jfif, void 0);\n __privateAdd(this, _APPn, void 0);\n __privateAdd(this, _qts, void 0);\n __privateAdd(this, _frame, null);\n __privateAdd(this, _tail, null);\n __privateMethod(this, _shuffleInit, shuffleInit_fn).call(this, key2);\n }\n embed(image, data, k) {\n this.parse(image);\n this.f5put(data, k);\n return this.pack();\n }\n extract(image) {\n this.parse(image, true);\n return this.f5get();\n }\n analyze() {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var i, comp = __privateGet(this, _frame).components[0];\n if (comp.componentId != 1) {\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n return __privateMethod(this, __analyze, _analyze_fn).call(this, comp.blocks);\n }\n f5put(data, k) {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var t, i, comp = __privateGet(this, _frame).components[0];\n if (data.length > 8388607)\n throw "Data too big. Max 8388607 bytes allowed.";\n if (data.length < 32768) {\n t = new Uint8Array(2 + data.length);\n t[0] = data.length & 255;\n t[1] = data.length >>> 8;\n t.set(data, 2);\n } else {\n t = new Uint8Array(3 + data.length);\n t[0] = data.length & 255;\n t[1] = (data.length >>> 8 & 127) + 128;\n t[2] = data.length >>> 15;\n t.set(data, 3);\n }\n if (comp.componentId != 1) {\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (k) {\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n return __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n let ret;\n let prop = __privateMethod(this, __analyze, _analyze_fn).call(this, comp.blocks);\n k = 0;\n for (i = prop.capacity.length - 1; i >= 0; i--) {\n if (prop.capacity[i] >= t.length) {\n k = i;\n break;\n }\n }\n if (k === 0)\n throw "capacity exceeded";\n try {\n ret = __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n } catch (e) {\n k--;\n if (k === 0)\n throw "capacity exceeded";\n ret = __privateMethod(this, __f5write, _f5write_fn).call(this, comp.blocks, t, k);\n }\n ret["stats"] = prop;\n return ret;\n }\n f5get() {\n if (!__privateGet(this, _frame))\n throw "Parser not run";\n var comp = __privateGet(this, _frame).components[0];\n if (comp.componentId != 1) {\n for (var i = 0; i < __privateGet(this, _frame).components.length; i++) {\n if (__privateGet(this, _frame).components[i].componentId == 1) {\n comp = __privateGet(this, _frame).components[i];\n break;\n }\n }\n }\n if (!("blocks" in comp)) {\n throw "Blocks failed to be parsed";\n }\n var coeff = new Int16Array(comp.blocks.length);\n coeff.set(comp.blocks);\n var pos = -1, extrBit = 0, cCount = coeff.length - 1;\n var n, k = 0;\n var out = new Uint8Array(coeff.length / 8 | 0), extrByte = 0, outPos = 0, bitsAvail = 0, code = 0, hash = 0;\n while (bitsAvail < 4) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n k |= extrBit << bitsAvail;\n bitsAvail++;\n }\n k = (k & 15) + 1;\n n = (1 << k) - 1;\n bitsAvail = 0;\n if (k == 1) {\n while (pos < cCount) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n extrByte |= extrBit << bitsAvail;\n bitsAvail++;\n if (bitsAvail == 8) {\n out[outPos++] = extrByte;\n extrByte = 0;\n bitsAvail = 0;\n }\n }\n } else {\n while (pos < cCount) {\n pos++;\n if (coeff[pos] === 0) {\n continue;\n }\n extrBit = coeff[pos] & 1;\n if (coeff[pos] < 0) {\n extrBit = 1 - extrBit;\n }\n hash ^= extrBit * ++code;\n if (code == n) {\n extrByte |= hash << bitsAvail;\n bitsAvail += k;\n code = 0;\n hash = 0;\n while (bitsAvail >= 8) {\n out[outPos++] = extrByte & 255;\n bitsAvail -= 8;\n extrByte = extrByte >> 8;\n }\n }\n }\n }\n while (bitsAvail > 0) {\n out[outPos++] = extrByte & 255;\n bitsAvail -= 8;\n extrByte = extrByte >> 8;\n }\n var s = 2, l = out[0];\n if (out[1] & 128) {\n s++;\n l += ((out[1] & 127) << 8) + (out[2] << 15);\n } else {\n l += out[1] << 8;\n }\n return out.subarray(s, s + l);\n }\n parse(data, tolerant = false) {\n var offset = 0;\n function _buildHuffmanTable(nrcodes, values) {\n var codevalue = 0, pos_in_table = 0, HT = new Uint16Array(65536);\n for (var k = 0; k < 16; k++) {\n for (var j2 = 0; j2 < nrcodes[k]; j2++) {\n for (var i2 = codevalue << 15 - k, cntTo = codevalue + 1 << 15 - k; i2 < cntTo; i2++) {\n HT[i2] = values[pos_in_table] + (k + 1 << 8);\n }\n pos_in_table++;\n codevalue++;\n }\n codevalue *= 2;\n }\n return HT;\n }\n function decodeScan(data2, offset2, frame, components2, resetInterval2, spectralStart2, spectralEnd2, successivePrev, successive) {\n var startOffset = offset2, bitsData = 0, bitsCount = 0, eobrun = 0, p1 = 1 << successive, m1 = -1 << successive;\n function decodeBaseline(component2, pos) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n var t = component2.huffmanTableDC[bitsData >>> bitsCount - 16 & 65535];\n if (!t)\n throw "invalid huffman sequence";\n bitsCount -= t >>> 8;\n t &= 255;\n var diff = 0;\n if (t !== 0) {\n while (bitsCount < t) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n diff = bitsData >>> bitsCount - t & (1 << t) - 1;\n bitsCount -= t;\n if (diff < 1 << t - 1)\n diff += (-1 << t) + 1;\n }\n component2.blocksDC[pos >> 6] = component2.pred += diff;\n var k2 = 1, s, r;\n while (k2 < 64) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s === 0) {\n if (r < 15) {\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n while (bitsCount < s) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n component2.blocks[pos + k2] = bitsData >>> bitsCount - s & (1 << s) - 1;\n bitsCount -= s;\n if (component2.blocks[pos + k2] < 1 << s - 1)\n component2.blocks[pos + k2] += (-1 << s) + 1;\n k2++;\n }\n }\n function decodeDCFirst(component2, pos) {\n var diff = 0;\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n var t = component2.huffmanTableDC[bitsData >>> bitsCount - 16 & 65535];\n if (!t)\n throw "invalid huffman sequence";\n bitsCount -= t >>> 8;\n t &= 255;\n if (t !== 0) {\n while (bitsCount < t) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n diff = bitsData >>> bitsCount - t & (1 << t) - 1;\n bitsCount -= t;\n if (diff < 1 << t - 1)\n diff += (-1 << t) + 1;\n }\n component2.blocksDC[pos >> 6] = component2.pred += diff << successive;\n }\n function decodeDCSuccessive(component2, pos) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocksDC[pos >> 6] |= (bitsData >>> --bitsCount & 1) << successive;\n }\n if (!frame)\n throw "Frame not parsed yet";\n function decodeACFirst(component2, pos) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k2 = spectralStart2, s, r;\n while (k2 <= spectralEnd2) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s === 0) {\n if (r != 15) {\n eobrun = (1 << r) - 1;\n if (r) {\n while (bitsCount < r) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n eobrun += bitsData >>> bitsCount - r & (1 << r) - 1;\n bitsCount -= r;\n }\n break;\n }\n k2 += 16;\n continue;\n }\n k2 += r;\n while (bitsCount < s) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n component2.blocks[pos + k2] = bitsData >>> bitsCount - s & (1 << s) - 1;\n bitsCount -= s;\n if (component2.blocks[pos + k2] < 1 << s - 1)\n component2.blocks[pos + k2] += (-1 << s) + 1;\n component2.blocks[pos + k2] *= p1;\n k2++;\n }\n }\n function decodeACSuccessive(component2, pos) {\n var k2 = spectralStart2, r, s;\n if (frame == null)\n throw "Frame not defined";\n if (!eobrun) {\n while (k2 <= spectralEnd2) {\n while (bitsCount < 16) {\n bitsData = (bitsData << 8) + (data2[offset2] | 0);\n bitsCount += 8;\n if (data2[offset2] == 255)\n offset2++;\n offset2++;\n }\n s = component2.huffmanTableAC[bitsData >>> bitsCount - 16 & 65535];\n if (!s)\n throw "invalid huffman sequence";\n bitsCount -= s >>> 8;\n r = s >> 4 & 15;\n s &= 15;\n if (s) {\n if (s != 1)\n throw "bad jpeg";\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n s = bitsData >>> --bitsCount & 1 ? p1 : m1;\n } else {\n if (r != 15) {\n eobrun = 1 << r;\n if (r) {\n while (bitsCount < r) {\n bitsData = (bitsData << 8) + data2[offset2++];\n if ((bitsData & 255) == 255)\n offset2++;\n bitsCount += 8;\n }\n eobrun += bitsData >>> bitsCount - r & (1 << r) - 1;\n bitsCount -= r;\n }\n break;\n }\n }\n while (k2 <= spectralEnd2) {\n if (component2.blocks[pos + k2]) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocks[pos + k2] += (bitsData >>> --bitsCount & 1) * (component2.blocks[pos + k2] >= 0 ? p1 : m1);\n } else {\n if (--r < 0)\n break;\n }\n k2++;\n }\n if (s)\n component2.blocks[pos + k2] = s;\n k2++;\n }\n }\n if (eobrun) {\n while (k2 <= spectralEnd2) {\n if (component2.blocks[pos + k2]) {\n if (!bitsCount) {\n bitsData = data2[offset2++];\n if (bitsData == 255)\n offset2++;\n bitsCount = 8;\n }\n component2.blocks[pos + k2] += (bitsData >>> --bitsCount & 1) * (component2.blocks[pos + k2] >= 0 ? p1 : m1);\n }\n k2++;\n }\n eobrun--;\n }\n }\n var decodeFn;\n if (frame.progressive) {\n if (spectralStart2 === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n var marker, mcuExpected, i2, j2, k, n, mcusPerLine2, mcusPerRow, x, y;\n if (components2.length == 1) {\n mcusPerLine2 = components2[0].blocksPerLine;\n mcusPerRow = components2[0].blocksPerColumn;\n mcuExpected = mcusPerRow * mcusPerLine2;\n if (!resetInterval2)\n resetInterval2 = mcuExpected;\n n = resetInterval2;\n components2[0].pred = 0;\n eobrun = 0;\n for (y = 0; y < mcusPerRow; y++) {\n for (x = 0; x < mcusPerLine2; x++) {\n if (!n) {\n n = resetInterval2;\n components2[0].pred = 0;\n eobrun = 0;\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n bitsCount = 0;\n marker = data2[offset2] << 8 | data2[offset2 + 1];\n if (marker >= 65488 && marker <= 65495) {\n offset2 += 2;\n } else {\n if (marker <= 65280) {\n throw "bad jpeg";\n }\n break;\n }\n }\n n--;\n for (i2 = 0; i2 < components2.length; i2++) {\n decodeFn(components2[i2], (y * components2[i2].blocksPerLineForMcu + x) * 64);\n }\n }\n }\n } else {\n mcusPerLine2 = frame.mcusPerLine;\n mcusPerRow = frame.mcusPerColumn;\n mcuExpected = mcusPerRow * mcusPerLine2;\n if (!resetInterval2)\n resetInterval2 = mcuExpected;\n n = resetInterval2;\n for (i2 = 0; i2 < components2.length; i2++)\n components2[i2].pred = 0;\n eobrun = 0;\n for (y = 0; y < mcusPerRow; y++) {\n for (x = 0; x < mcusPerLine2; x++) {\n if (!n) {\n n = resetInterval2;\n for (i2 = 0; i2 < components2.length; i2++)\n components2[i2].pred = 0;\n eobrun = 0;\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n bitsCount = 0;\n marker = data2[offset2] << 8 | data2[offset2 + 1];\n if (marker >= 65488 && marker <= 65495) {\n offset2 += 2;\n } else {\n if (marker <= 65280) {\n throw "bad jpeg";\n }\n break;\n }\n }\n n--;\n for (i2 = 0; i2 < components2.length; i2++) {\n for (j2 = 0; j2 < components2[i2].v; j2++) {\n for (k = 0; k < components2[i2].h; k++) {\n decodeFn(components2[i2], ((y * components2[i2].v + j2) * components2[i2].blocksPerLineForMcu + x * components2[i2].h + k) * 64);\n }\n }\n }\n }\n }\n }\n offset2 -= bitsCount / 8 | 0;\n if (data2[offset2 - 1] == 255)\n offset2--;\n return offset2 - startOffset;\n }\n function readUint16() {\n var value = data[offset] << 8 | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length = readUint16();\n var array = data.subarray(offset, offset + length - 2);\n offset += array.length;\n return array;\n }\n __privateSet(this, __raw, data);\n __privateSet(this, _jfif, null);\n __privateSet(this, _APPn, []);\n __privateSet(this, _qts, []);\n __privateSet(this, _frame, null);\n __privateSet(this, _tail, null);\n var markerHi, markerLo, i, j, resetInterval, component;\n let huffmanTablesAC = [];\n let huffmanTablesDC = [];\n while (1) {\n if (offset >= data.length) {\n if (tolerant)\n break;\n throw "unexpected EOF";\n }\n markerHi = data[offset++];\n markerLo = data[offset++];\n if (markerHi == 255) {\n if (markerLo == 224) {\n __privateSet(this, _jfif, readDataBlock());\n }\n if (markerLo > 224 && markerLo < 240 || markerLo == 254) {\n __privateGet(this, _APPn).push({\n "app": markerLo,\n "data": readDataBlock()\n });\n }\n if (markerLo == 219) {\n __privateGet(this, _qts).push(readDataBlock());\n }\n if (markerLo >= 192 && markerLo <= 194) {\n if (__privateGet(this, _frame))\n throw "Only single frame JPEGs supported";\n readUint16();\n __privateSet(this, _frame, {\n "extended": markerLo === 193,\n "progressive": markerLo === 194,\n "precision": data[offset++],\n "scanLines": readUint16(),\n "samplesPerLine": readUint16(),\n "components": [],\n "componentIds": {},\n "maxH": 1,\n "maxV": 1\n });\n if (__privateGet(this, _frame).scanLines * __privateGet(this, _frame).samplesPerLine > this.maxPixels)\n throw "Image is too big.";\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n if (maxH < h)\n maxH = h;\n if (maxV < v)\n maxV = v;\n var qId = data[offset + 2];\n var l = __privateGet(this, _frame).components.push({\n componentId,\n h,\n v,\n quantizationTable: qId\n });\n __privateGet(this, _frame).componentIds[componentId] = l - 1;\n offset += 3;\n }\n __privateGet(this, _frame).maxH = maxH;\n __privateGet(this, _frame).maxV = maxV;\n var mcusPerLine = Math.ceil(__privateGet(this, _frame).samplesPerLine / 8 / maxH);\n var mcusPerColumn = Math.ceil(__privateGet(this, _frame).scanLines / 8 / maxV);\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n component = __privateGet(this, _frame).components[i];\n var blocksPerLine = Math.ceil(Math.ceil(__privateGet(this, _frame).samplesPerLine / 8) * component.h / maxH);\n var blocksPerColumn = Math.ceil(Math.ceil(__privateGet(this, _frame).scanLines / 8) * component.v / maxV);\n var blocksPerLineForMcu = mcusPerLine * component.h;\n var blocksPerColumnForMcu = mcusPerColumn * component.v;\n __privateGet(this, _frame).components[i] = {\n ...component,\n blocks: new Int16Array(blocksPerColumnForMcu * blocksPerLineForMcu * 64),\n blocksDC: new Int16Array(blocksPerColumnForMcu * blocksPerLineForMcu),\n blocksPerLine,\n blocksPerColumn,\n blocksPerLineForMcu,\n blocksPerColumnForMcu\n };\n }\n __privateGet(this, _frame).mcusPerLine = mcusPerLine;\n __privateGet(this, _frame).mcusPerColumn = mcusPerColumn;\n }\n if (markerLo == 196) {\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength; ) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++)\n codeLengthSum += codeLengths[j] = data[offset];\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n const v2 = _buildHuffmanTable(codeLengths, huffmanValues);\n if (huffmanTableSpec >> 4 === 0)\n huffmanTablesDC[huffmanTableSpec & 15] = v2;\n else\n huffmanTablesAC[huffmanTableSpec & 15] = v2;\n }\n }\n if (markerLo == 221) {\n resetInterval = readUint16();\n }\n if (markerLo == 218) {\n if (__privateGet(this, _frame) == null)\n throw "SOS before SOF";\n readUint16();\n var selectorsCount = data[offset++];\n var components = [];\n for (i = 0; i < selectorsCount; i++) {\n var componentIndex = __privateGet(this, _frame).componentIds[data[offset++]];\n component = __privateGet(this, _frame).components[componentIndex];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset, __privateGet(this, _frame), components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);\n offset += processed;\n }\n if (markerLo == 217) {\n break;\n }\n } else {\n if (data[offset - 3] == 255 && data[offset - 2] >= 192 && data[offset - 2] <= 254) {\n offset -= 3;\n }\n while (data[offset] != 255 && offset < data.length) {\n offset++;\n }\n if (data[offset] != 255) {\n throw "bad jpeg ";\n }\n }\n }\n if (!__privateGet(this, _frame))\n throw "bad jpeg";\n if (offset < data.length)\n __privateSet(this, _tail, data.subarray(offset));\n return this;\n }\n pack() {\n let byteout;\n let bytenew;\n let bytepos;\n let poslast;\n let outpos;\n let byte;\n function writeByte(value) {\n var t;\n byteout[outpos++] = value;\n if (outpos > poslast) {\n t = new Uint8Array(byteout.length * 2);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n }\n function writeWord(value) {\n writeByte(value >> 8 & 255);\n writeByte(value & 255);\n }\n function writeBlock(block) {\n var t;\n if (outpos + block.length > poslast) {\n t = new Uint8Array(byteout.length * 2 + block.length);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n byteout.set(block, outpos);\n outpos += block.length;\n }\n function writeAPP0(self2) {\n writeWord(65504);\n if (!__privateGet(self2, _jfif)) {\n writeWord(16);\n writeByte(74);\n writeByte(70);\n writeByte(73);\n writeByte(70);\n writeByte(0);\n writeByte(1);\n writeByte(1);\n writeByte(0);\n writeWord(1);\n writeWord(1);\n writeByte(0);\n writeByte(0);\n } else {\n writeWord(__privateGet(self2, _jfif).length + 2);\n writeBlock(__privateGet(self2, _jfif));\n }\n }\n function writeDQT(self2) {\n for (var i2 = 0; i2 < __privateGet(self2, _qts).length; i2++) {\n writeWord(65499);\n writeWord(__privateGet(self2, _qts)[i2].length + 2);\n writeBlock(__privateGet(self2, _qts)[i2]);\n }\n }\n function writeAPPn(self2) {\n for (var i2 = 0; i2 < __privateGet(self2, _APPn).length; i2++) {\n writeWord(65280 | __privateGet(self2, _APPn)[i2].app);\n writeWord(__privateGet(self2, _APPn)[i2].data.length + 2);\n writeBlock(__privateGet(self2, _APPn)[i2].data);\n }\n }\n function writeSOF0(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65472);\n writeWord(8 + __privateGet(self2, _frame).components.length * 3);\n writeByte(__privateGet(self2, _frame).precision);\n writeWord(__privateGet(self2, _frame).scanLines);\n writeWord(__privateGet(self2, _frame).samplesPerLine);\n writeByte(__privateGet(self2, _frame).components.length);\n for (var i2 = 0; i2 < __privateGet(self2, _frame).components.length; i2++) {\n var c2 = __privateGet(self2, _frame).components[i2];\n writeByte(c2.componentId);\n writeByte(c2.h << 4 | c2.v);\n writeByte(c2.quantizationTable);\n }\n }\n function writeDHT(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65476);\n writeWord(31);\n writeByte(0);\n for (var i2 = 0; i2 < 16; i2++) {\n writeByte(std_dc_luminance_nrcodes[i2 + 1]);\n }\n for (var j = 0; j <= 11; j++) {\n writeByte(std_dc_luminance_values[j]);\n }\n writeWord(65476);\n writeWord(181);\n writeByte(16);\n for (var k = 0; k < 16; k++) {\n writeByte(std_ac_luminance_nrcodes[k + 1]);\n }\n for (var l = 0; l <= 161; l++) {\n writeByte(std_ac_luminance_values[l]);\n }\n if (__privateGet(self2, _frame).components.length != 1) {\n writeWord(65476);\n writeWord(31);\n writeByte(1);\n for (var m = 0; m < 16; m++) {\n writeByte(std_dc_chrominance_nrcodes[m + 1]);\n }\n for (var n = 0; n <= 11; n++) {\n writeByte(std_dc_chrominance_values[n]);\n }\n writeWord(65476);\n writeWord(181);\n writeByte(17);\n for (var o = 0; o < 16; o++) {\n writeByte(std_ac_chrominance_nrcodes[o + 1]);\n }\n for (var p = 0; p <= 161; p++) {\n writeByte(std_ac_chrominance_values[p]);\n }\n }\n }\n function writeSOS(self2) {\n if (!__privateGet(self2, _frame))\n throw "Frame not ready";\n writeWord(65498);\n writeWord(6 + __privateGet(self2, _frame).components.length * 2);\n writeByte(__privateGet(self2, _frame).components.length);\n for (var i2 = 0; i2 < __privateGet(self2, _frame).components.length; i2++) {\n var c2 = __privateGet(self2, _frame).components[i2];\n writeByte(c2.componentId);\n if (i2 === 0) {\n writeByte(0);\n } else {\n writeByte(17);\n }\n }\n writeByte(0);\n writeByte(63);\n writeByte(0);\n }\n function processDU(comp, POS, DC, HTDC, HTAC) {\n var pos, posval, t;\n if (bytepos === 0)\n bytenew = 0;\n if (!("blocks" in comp))\n throw "Blocks not parsed";\n var Diff = comp.blocksDC[POS >> 6] - DC;\n DC = comp.blocksDC[POS >> 6];\n if (Diff === 0) {\n posval = HTDC[0][1];\n bytenew <<= posval;\n bytenew += HTDC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n } else {\n pos = 32767 + Diff;\n posval = HTDC[category[pos]][1];\n bytenew <<= posval;\n bytenew += HTDC[category[pos]][0];\n bytepos += posval;\n posval = bitcode[pos][1];\n bytenew <<= posval;\n bytenew += bitcode[pos][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n var end0pos = 63;\n for (; end0pos > 0 && comp.blocks[POS + end0pos] === 0; end0pos--) {\n }\n if (end0pos === 0) {\n posval = HTAC[0][1];\n bytenew <<= posval;\n bytenew += HTAC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n return DC;\n }\n var i2 = 1;\n var lng;\n while (i2 <= end0pos) {\n var startpos = i2;\n for (; comp.blocks[POS + i2] === 0 && i2 <= end0pos; ++i2) {\n }\n var nrzeroes = i2 - startpos;\n if (nrzeroes >= 16) {\n lng = nrzeroes >> 4;\n for (var nrmarker = 1; nrmarker <= lng; ++nrmarker) {\n posval = HTAC[240][1];\n bytenew <<= posval;\n bytenew += HTAC[240][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n nrzeroes = nrzeroes & 15;\n }\n pos = 32767 + comp.blocks[POS + i2];\n posval = HTAC[(nrzeroes << 4) + category[pos]][1];\n bytenew <<= posval;\n bytenew += HTAC[(nrzeroes << 4) + category[pos]][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n posval = bitcode[pos][1];\n bytenew <<= posval;\n bytenew += bitcode[pos][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n i2++;\n }\n if (end0pos != 63) {\n posval = HTAC[0][1];\n bytenew <<= posval;\n bytenew += HTAC[0][0];\n bytepos += posval;\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n bytenew &= (1 << bytepos) - 1;\n }\n }\n if (outpos > poslast) {\n t = new Uint8Array(byteout.length * 2);\n t.set(byteout);\n byteout = t;\n poslast = t.length - 128;\n }\n return DC;\n }\n byteout = new Uint8Array(65536);\n poslast = 65536 - 128;\n outpos = 0;\n bytenew = 0;\n bytepos = 0;\n writeWord(65496);\n writeAPP0(this);\n writeAPPn(this);\n writeDQT(this);\n writeSOF0(this);\n writeDHT(this);\n writeSOS(this);\n bytenew = 0;\n bytepos = 0;\n if (!__privateGet(this, _frame))\n throw "Frame not ready";\n var c, mcuRow, mcuCol, blockRow, blockCol, mcu, i, v, h;\n var DCdiff = [];\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n DCdiff.push(0);\n }\n for (mcu = 0; mcu < __privateGet(this, _frame).mcusPerLine * __privateGet(this, _frame).mcusPerColumn; mcu++) {\n mcuRow = mcu / __privateGet(this, _frame).mcusPerLine | 0;\n mcuCol = mcu % __privateGet(this, _frame).mcusPerLine;\n for (i = 0; i < __privateGet(this, _frame).components.length; i++) {\n c = __privateGet(this, _frame).components[i];\n for (v = 0; v < c.v; v++) {\n blockRow = mcuRow * c.v + v;\n for (h = 0; h < c.h; h++) {\n blockCol = mcuCol * c.h + h;\n if (i === 0) {\n DCdiff[i] = processDU(c, (blockRow * __privateGet(this, _frame).mcusPerLine * c.h + blockCol) * 64, DCdiff[i], YDC_HT, YAC_HT);\n } else {\n DCdiff[i] = processDU(c, (blockRow * __privateGet(this, _frame).mcusPerLine * c.h + blockCol) * 64, DCdiff[i], UVDC_HT, UVAC_HT);\n }\n }\n }\n }\n }\n while (bytepos > 7) {\n byte = 255 & bytenew >>> bytepos - 8;\n byteout[outpos++] = byte;\n if (byte == 255) {\n outpos++;\n }\n bytepos -= 8;\n }\n if (bytepos > 0) {\n bytenew <<= 8 - bytepos;\n bytenew += (1 << 8 - bytepos) - 1;\n byteout[outpos++] = 255 & bytenew;\n }\n writeWord(65497);\n if (__privateGet(this, _tail))\n writeBlock(__privateGet(this, _tail));\n return byteout.slice(0, outpos);\n }\n};\n_randPool = new WeakMap();\n__raw = new WeakMap();\n_jfif = new WeakMap();\n_APPn = new WeakMap();\n_qts = new WeakMap();\n_frame = new WeakMap();\n_tail = new WeakMap();\n_shuffleInit = new WeakSet();\nshuffleInit_fn = function(key2) {\n __privateSet(this, _randPool, new ArrayBuffer(this.maxPixels * 4.125));\n if (!key2.length)\n throw "key needed";\n var i = 0, j = 0, t = 0, k = 0, S = new Uint8Array(256), rnd = new Uint8Array(__privateGet(this, _randPool));\n for (i = 0; i < 256; ++i)\n S[i] = i;\n for (i = 0; i < 256; ++i) {\n j = j + S[i] + key2[i % key2.length] & 255;\n t = S[i];\n S[i] = S[j];\n S[j] = t;\n }\n i = 0;\n j = 0;\n for (k = 0; k < this.maxPixels * 4.125; ++k) {\n i = i + 1 & 255;\n j = j + S[i] & 255;\n t = S[i];\n S[i] = S[j];\n S[j] = t;\n rnd[k] = S[t + S[i] & 255];\n }\n};\n_stegShuffle = new WeakSet();\nstegShuffle_fn = function(pm) {\n let t, l, k, random_index, rand32Array = new Uint32Array(__privateGet(this, _randPool));\n if (typeof pm == "number") {\n l = pm;\n pm = new Uint32Array(l);\n for (k = 1; k < l; k++) {\n random_index = rand32Array[k] % (k + 1);\n if (random_index != k)\n pm[k] = pm[random_index];\n pm[random_index] = k;\n }\n } else {\n l = pm.length;\n for (k = 1; k < l; k++) {\n random_index = rand32Array[k] % (k + 1);\n t = pm[k];\n pm[k] = pm[random_index];\n pm[random_index] = t;\n }\n }\n return { pm, gamma: new Uint8Array(__privateGet(this, _randPool), l * 4) };\n};\n__analyze = new WeakSet();\n_analyze_fn = function(coeff) {\n var _one = 0, _zero = 0, _large, _ratio, usable, i, k, embedded, matched, changed;\n for (i = 0; i < coeff.length; i++) {\n if (i % 64 === 0)\n continue;\n if (coeff[i] === 0)\n _zero++;\n if (coeff[i] == 1 || coeff[i] == -1)\n _one++;\n }\n _large = coeff.length - _zero - _one - coeff.length / 64;\n _ratio = _one / (_large + _one);\n var res = {\n "capacity": [0, (_large + 0.49 * _one >> 3) - 1],\n "coeff_total": coeff.length,\n "coeff_large": _large,\n "coeff_zero": _zero,\n "coeff_one": _one,\n "coeff_one_ratio": _one / (_large + _one)\n };\n for (i = 2; i < 17; i++) {\n k = (1 << i) - 1;\n usable = _large + _one;\n embedded = 0;\n while (usable > k) {\n matched = usable / k / (1 << i) / (1 << i) | 0;\n usable -= matched * k;\n changed = usable * (1 - _ratio) / k * 0.96 | 0;\n usable -= changed * k;\n embedded += changed + matched;\n k++;\n }\n res.capacity[i] = (i * embedded >> 3) - 1;\n }\n return res;\n};\n__f5write = new WeakSet();\n_f5write_fn = function(coeff, data, k) {\n var coeff_count = coeff.length;\n var _changed = 0, _embedded = 0, _examined = 0, _thrown = 0, shuffled_index = 0, i, n, ii;\n var next_bit_to_embed = 0, byte_to_embed = data.length, data_idx = 0, available_bits_to_embed = 0;\n n = (1 << k) - 1;\n byte_to_embed = k - 1;\n byte_to_embed ^= 0;\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed = 3;\n for (ii = 0; ii < coeff_count; ii++) {\n shuffled_index = ii;\n if (shuffled_index % 64 === 0 || coeff[shuffled_index] === 0)\n continue;\n var cc = coeff[shuffled_index];\n _examined++;\n if (cc > 0 && (cc & 1) != next_bit_to_embed) {\n coeff[shuffled_index]--;\n _changed++;\n } else if (cc < 0 && (cc & 1) == next_bit_to_embed) {\n coeff[shuffled_index]++;\n _changed++;\n }\n if (coeff[shuffled_index] !== 0) {\n _embedded++;\n if (available_bits_to_embed === 0) {\n if (k != 1 || data_idx >= data.length)\n break;\n byte_to_embed = data[data_idx++];\n byte_to_embed ^= 0;\n available_bits_to_embed = 8;\n }\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed--;\n } else {\n _thrown++;\n }\n }\n if (k == 1 && _embedded < data.length * 8)\n throw "capacity exceeded " + _embedded / 8 + " " + data.length;\n if (k != 1) {\n var is_last_byte = false, k_bits_to_embed = 0;\n while (!is_last_byte || available_bits_to_embed !== 0 && is_last_byte) {\n k_bits_to_embed = 0;\n for (i = 0; i < k; i++) {\n if (available_bits_to_embed === 0) {\n if (data_idx >= data.length) {\n is_last_byte = true;\n break;\n }\n byte_to_embed = data[data_idx++];\n byte_to_embed ^= 0;\n available_bits_to_embed = 8;\n }\n next_bit_to_embed = byte_to_embed & 1;\n byte_to_embed >>= 1;\n available_bits_to_embed--;\n k_bits_to_embed |= next_bit_to_embed << i;\n }\n var code_word = [];\n var ci = null;\n for (i = 0; i < n; i++) {\n while (true) {\n if (++ii >= coeff_count) {\n throw "capacity exceeded " + _embedded / 8;\n }\n ci = ii;\n if (ci % 64 !== 0 && coeff[ci] !== 0)\n break;\n }\n code_word.push(ci);\n }\n _examined += n;\n while (true) {\n var vhash = 0, extracted_bit;\n for (i = 0; i < code_word.length; i++) {\n if (coeff[code_word[i]] > 0) {\n extracted_bit = coeff[code_word[i]] & 1;\n } else {\n extracted_bit = 1 - (coeff[code_word[i]] & 1);\n }\n if (extracted_bit == 1)\n vhash ^= i + 1;\n }\n i = vhash ^ k_bits_to_embed;\n if (!i) {\n _embedded += k;\n break;\n }\n i--;\n coeff[code_word[i]] += coeff[code_word[i]] < 0 ? 1 : -1;\n _changed++;\n if (coeff[code_word[i]] === 0) {\n _thrown++;\n code_word.splice(i, 1);\n while (true) {\n if (++ii >= coeff_count) {\n throw "capacity exceeded " + _embedded / 8;\n }\n ci = ii;\n if (ci % 64 !== 0 && coeff[ci] !== 0)\n break;\n }\n _examined++;\n code_word.push(ci);\n } else {\n _embedded += k;\n break;\n }\n }\n }\n }\n return {\n "k": k,\n "embedded": _embedded / 8,\n "examined": _examined,\n "changed": _changed,\n "thrown": _thrown,\n "efficiency": (_embedded / _changed).toFixed(2)\n };\n};\n\n// src/jpg.ts\nvar key = import_buffer4.Buffer.from("CUNNYCUNNYCUNNY");\nvar f5inst = new f5stego(key);\nvar inject2 = async (b, links) => {\n if (b.size / 20 < links.join(" ").length)\n throw "Image too small to embed.";\n const arr = new Uint8Array(new Uint8Array(await b.arrayBuffer()));\n const buff = f5inst.embed(arr, new TextEncoder().encode(links.join(" ")), 1);\n return import_buffer4.Buffer.from(buff);\n};\nvar has_embed2 = (b) => {\n try {\n const res = f5inst.extract(b);\n if (!res)\n return false;\n if (res.length > 1024)\n return false;\n const str = import_buffer4.Buffer.from(res).toString();\n if (!str.match(/^[a-zA-Z0-9:/.\\-_ ]+$/))\n return false;\n return str;\n } catch {\n return false;\n }\n};\nvar extract2 = (b, ex) => {\n return decodeCoom3Payload(import_buffer4.Buffer.from(ex));\n};\nvar jpg_default = {\n match: (fn) => !!fn.match(/\\.jpe?g$/),\n has_embed: has_embed2,\n extract: extract2,\n inject: inject2\n};\n\n// src/thirdeye.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer5 = __toESM(require_buffer(), 1);\nvar import_jpeg_js = __toESM(require_jpeg_js(), 1);\n\n// src/phash.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar median = (data) => {\n const mdarr = data.slice(0);\n mdarr.sort((a, b) => a - b);\n if (mdarr.length % 2 === 0)\n return (mdarr[mdarr.length / 2 - 1] + mdarr[mdarr.length / 2]) / 2;\n return mdarr[Math.floor(mdarr.length / 2)];\n};\nvar translate_blocks_to_bits = function(blocks, pixels_per_block) {\n const half_block_value = pixels_per_block * 256 * 3 / 2;\n const bandsize = blocks.length / 4;\n for (let i = 0; i < 4; i++) {\n const m = median(blocks.slice(i * bandsize, (i + 1) * bandsize));\n for (let j = i * bandsize; j < (i + 1) * bandsize; j++) {\n const v = blocks[j];\n blocks[j] = Number(v > m || Math.abs(v - m) < 1 && m > half_block_value);\n }\n }\n};\nvar bits_to_hexhash = (bitsArray) => {\n const hex = [];\n for (let i = 0; i < bitsArray.length; i += 4) {\n const nibble = bitsArray.slice(i, i + 4);\n hex.push(parseInt(nibble.join(""), 2).toString(16));\n }\n return hex.join("");\n};\nvar bmvbhash_even = (data, bits) => {\n const blocksize_x = Math.floor(data.width / bits);\n const blocksize_y = Math.floor(data.height / bits);\n const result = [];\n for (let y = 0; y < bits; y++) {\n for (let x = 0; x < bits; x++) {\n let total = 0;\n for (let iy = 0; iy < blocksize_y; iy++) {\n for (let ix = 0; ix < blocksize_x; ix++) {\n const cx = x * blocksize_x + ix;\n const cy = y * blocksize_y + iy;\n const ii = (cy * data.width + cx) * 4;\n const alpha = data.data[ii + 3];\n if (alpha === 0) {\n total += 765;\n } else {\n total += data.data[ii] + data.data[ii + 1] + data.data[ii + 2];\n }\n }\n }\n result.push(total);\n }\n }\n translate_blocks_to_bits(result, blocksize_x * blocksize_y);\n return bits_to_hexhash(result);\n};\n\n// src/thirdeye.ts\nvar csettings3;\nsettings.subscribe((b) => {\n csettings3 = b;\n});\nvar gelquirk = (prefix) => (a) => {\n let base = a.post || a.data || a;\n if (!Array.isArray(base))\n return [];\n base = base.filter((e) => e.file_url);\n return base.map((e) => ({\n full_url: e.file_url,\n preview_url: e.preview_url || e.preview_url,\n source: e.source,\n ext: e.file_ext || e.file_url.substr(e.file_url.lastIndexOf(".") + 1),\n page: `${prefix}${e.id || e.parent_id}`,\n tags: (e.tag_string || (e.tags && (Array.isArray(e.tags) && (typeof e.tags[0] == "string" ? e.tags.join(" ") : e.tags.map((e2) => e2.name_en).join(" "))) || e.tags) || "").split(" ")\n })) || [];\n};\nvar experimentalApi = false;\nvar black = /* @__PURE__ */ new Set();\nvar phashEn = false;\nvar mindist = 5;\nsettings.subscribe((s) => {\n if (!s)\n return;\n experimentalApi = s.expte;\n boorus = s.rsources.map((e) => ({\n ...e,\n quirks: gelquirk(e.view)\n }));\n black = new Set(s.blacklist);\n mindist = s.mdist || 5;\n phashEn = s.phash;\n});\nvar boorus = [];\nvar unlockQueue = Promise.resolve();\nvar cache = {};\nvar findFileFrom = async (b, hex, abort) => {\n try {\n if (b.domain in cache && hex in cache[b.domain])\n return cache[b.domain][hex];\n const res = await ifetch(`https://${b.domain}${b.endpoint}${hex}`);\n const txt = await res.text();\n const pres = JSON.parse(txt);\n const tran = b.quirks(pres).filter((e) => !e.tags.some((e2) => black.has(e2)));\n if (!(b.domain in cache))\n cache[b.domain] = {};\n cache[b.domain][hex] = tran;\n return tran;\n } catch (e) {\n const error = e;\n if (!error.message.includes("Unexpected end of JSON input"))\n console.error(e);\n return [];\n }\n};\nvar extract3 = async (b, fn) => {\n if (!csettings3)\n throw new Error("Settings uninit");\n let result;\n let booru;\n for (const e of Object.values(boorus)) {\n if (e.disabled)\n continue;\n result = await findFileFrom(e, fn.substring(0, 32));\n if (result.length) {\n booru = e.name;\n break;\n }\n }\n let cachedFile;\n const prev = result[0].preview_url;\n const full = result[0].full_url;\n return [{\n source: result[0].source,\n page: {\n title: booru,\n url: result[0].page\n },\n filename: fn.substring(0, 33) + result[0].ext,\n thumbnail: csettings3.hotlink ? prev || full : import_buffer5.Buffer.from(await (await ifetch(prev || full)).arrayBuffer()),\n data: csettings3.hotlink ? full || prev : { url: full || prev }\n }];\n};\nvar phash = (b) => {\n const res = (0, import_jpeg_js.decode)(b);\n return bmvbhash_even(res, 8);\n};\nvar hammingDist = (a, b) => {\n let res = BigInt("0x" + a) ^ BigInt("0x" + b);\n let acc = 0;\n while (res != 0n) {\n acc += Number(res & 1n);\n res >>= 1n;\n }\n return acc;\n};\nvar has_embed3 = async (b, fn, prevlink) => {\n if (import_buffer5.Buffer.from(fn, "hex").equals(b))\n return false;\n let result = void 0;\n for (const e of Object.values(boorus)) {\n if (e.disabled)\n continue;\n result = await findFileFrom(e, fn.substring(0, 32));\n result = result.filter((e2) => e2.full_url || e2.preview_url);\n if (result.length)\n break;\n }\n if (result && result.length != 0 && phashEn && prevlink) {\n if (!result[0].preview_url)\n return true;\n const getHash = async (l) => {\n const ogreq = await ifetch(l);\n const origPreview = await ogreq.arrayBuffer();\n return phash(import_buffer5.Buffer.from(origPreview));\n };\n const [orighash, tehash] = await Promise.all([\n getHash(prevlink),\n getHash(result[0].preview_url)\n ]);\n const d = hammingDist(orighash, tehash);\n console.log(d, prevlink);\n return d > mindist;\n }\n return result && result.length != 0;\n};\nvar thirdeye_default = {\n skip: true,\n extract: extract3,\n has_embed: has_embed3,\n match: (fn) => !!fn.match(/^[0-9a-f]{32}\\.....?/)\n};\n\n// src/pomf.ts\ninit_define_BUILD_VERSION();\ninit_esbuild_inject();\nvar import_buffer6 = __toESM(require_buffer(), 1);\nvar sources = [\n { host: "Catbox", prefix: "files.catbox.moe/" },\n { host: "Litter", prefix: "litter.catbox.moe/" },\n { host: "Zzzz", prefix: "z.zz.fo/" }\n];\nvar csettings4;\nsettings.subscribe((b) => {\n csettings4 = b;\n});\nvar getExt = (fn) => {\n const isB64 = fn.match(/^((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=))?\\.(gif|jpe?g|png|webm)/);\n const isExt = fn.match(/\\[.*=(.*)\\]/);\n let ext;\n let source;\n try {\n if (isB64) {\n ext = atob(isB64[1]);\n } else if (isExt) {\n ext = decodeURIComponent(isExt[1]);\n if (ext.startsWith("https://"))\n ext = ext.slice("https://".length);\n for (const cs of sources)\n if (ext.startsWith(cs.prefix)) {\n source = cs.prefix;\n ext = ext.slice(cs.prefix.length);\n break;\n }\n }\n } catch {\n }\n return { ext, source };\n};\nvar extract4 = async (b, fn) => {\n if (!csettings4)\n throw new Error("Settings uninit");\n const { ext, source } = getExt(fn);\n let rsource;\n for (const cs of sources) {\n if (source && cs.prefix != source)\n continue;\n try {\n await getHeaders("https://" + cs.prefix + ext);\n rsource = "https://" + cs.prefix + ext;\n break;\n } catch {\n }\n }\n return [{\n filename: ext,\n data: csettings4.hotlink ? rsource : { url: rsource },\n thumbnail: import_buffer6.Buffer.from(hasembed_default)\n }];\n};\nvar has_embed4 = async (b, fn) => {\n const { ext, source } = getExt(fn);\n if (!ext)\n return false;\n for (const cs of sources) {\n if (source && cs.prefix != source)\n continue;\n try {\n const e = await getHeaders("https://" + cs.prefix + ext);\n return true;\n } catch {\n }\n }\n return false;\n};\nvar pomf_default = {\n skip: true,\n extract: extract4,\n has_embed: has_embed4,\n match: (fn) => !!getExt(fn)\n};\n\n// src/processor.worker.ts\nconsole.log("Worker started");\nvar pendinggens = {};\nvar proxyAsyncGen = (id) => {\n return {\n next(arg) {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n return(v) {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n throw() {\n postMessage({\n type: "ag",\n id\n });\n return new Promise((res) => {\n if (!pendinggens[id])\n pendinggens[id] = [];\n pendinggens[id].push(res);\n });\n },\n [Symbol.asyncIterator]() {\n return this;\n }\n };\n};\nvar deserializeMessage = (m) => {\n if (typeof m == "object" && m.type == "AsyncGenerator") {\n return proxyAsyncGen(m.id);\n }\n if (typeof m == "object") {\n for (const p in m) {\n m[p] = deserializeMessage(m[p]);\n }\n }\n return m;\n};\nvar processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default];\nvar processImage = async (srcs, fn, hex, prevurl) => {\n const ret = await Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => {\n if (proc.skip) {\n const md5 = Buffer2.from(hex, "base64");\n if (await proc.has_embed(md5, fn, prevurl) === true) {\n return [await proc.extract(md5, fn), true];\n }\n return;\n }\n let succ = false;\n let cumul;\n do {\n try {\n const n = await srcs.next();\n if (n.done)\n return;\n const iter = streamRemote(n.value);\n if (!iter)\n return;\n cumul = Buffer2.alloc(0);\n let found;\n let chunk = { done: true };\n do {\n const { value, done } = await iter.next(typeof found === "boolean");\n if (done) {\n chunk = { done: true };\n } else {\n chunk = { done: false, value };\n cumul = Buffer2.concat([cumul, value]);\n const v = await proc.has_embed(cumul);\n if (typeof v == "string") {\n return [await proc.extract(cumul, v), false];\n }\n found = v;\n }\n } while (found !== false && !chunk.done);\n succ = true;\n await iter.next(true);\n if (found !== true) {\n return;\n }\n return [await proc.extract(cumul), false];\n } catch (err) {\n console.log(err);\n }\n } while (!succ);\n }));\n return ret.filter((e) => e).map((e) => e);\n};\n(async () => {\n onmessage = async (msg) => {\n const des = deserializeMessage(msg.data);\n switch (des.type) {\n case "ipc": {\n if (port1.onmessage)\n port1.onmessage(new MessageEvent("message", { data: des.res }));\n break;\n }\n case "cmd": {\n switch (des.fun) {\n case "processImage": {\n const res = await processImage(des.args[0], des.args[1], des.args[2], des.args[3]);\n const tr = [];\n for (const ef of res) {\n for (const e of ef[0]) {\n if (Buffer2.isBuffer(e.thumbnail) || e.thumbnail instanceof Uint8Array)\n tr.push(e.thumbnail.buffer);\n if (Buffer2.isBuffer(e.data) || e.data instanceof Uint8Array)\n tr.push(e.data.buffer);\n }\n }\n postMessage({\n type: "reply",\n id: des.id,\n res\n }, [...new Set(tr)]);\n }\n }\n break;\n }\n case "ag": {\n const cb = pendinggens[des.id].shift();\n if (cb) {\n cb(des.res);\n }\n break;\n }\n }\n };\n})();\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\n/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n'); + } + // src/main.ts + var ProcessWorker = Worker2; if (!supportedMainDomain(location.host) && !supportedAltDomain(location.host)) throw "PEE not supported here, skipping"; var qp; var csettings5; - var processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default, webm_default, gif_default]; + var processors = [thirdeye_default, pomf_default, pngv3_default, jpg_default]; var cappState; settings.subscribe(async (b) => { if (!b) @@ -31714,68 +21479,13 @@ const _DOMParser = DOMParser; } } csettings5 = b; - processors = [ - ...!csettings5.te ? [thirdeye_default] : [], - pngv3_default, - pomf_default, - jpg_default, - webm_default, - gif_default - ]; }); appState.subscribe((v) => { cappState = v; }); - var processImage = async (srcs, fn, hex, prevurl) => { - const ret = await Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { - if (proc.skip) { - const md5 = import_buffer11.Buffer.from(hex, "base64"); - if (await proc.has_embed(md5, fn, prevurl) === true) { - return [await proc.extract(md5, fn), true]; - } - return; - } - let succ = false; - let cumul; - do { - try { - const n = await srcs.next(); - if (n.done) - return; - const iter = streamRemote(n.value); - if (!iter) - return; - cumul = import_buffer11.Buffer.alloc(0); - let found; - let chunk = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true }; - } else { - chunk = { done: false, value }; - cumul = import_buffer11.Buffer.concat([cumul, value]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return [await proc.extract(cumul, v), false]; - } - found = v; - } - } while (found !== false && !chunk.done); - succ = true; - await iter.next(true); - if (found !== true) { - return; - } - return [await proc.extract(cumul), false]; - } catch { - } - } while (!succ); - })); - return ret.filter((e) => e).map((e) => e); - }; var textToElement = (s) => document.createRange().createContextualFragment(s).children[0]; var pendingPosts = []; + var pendingNoPosts = []; var signalNewEmbeds = debounce(async () => { if (!csettings5) return; @@ -31784,16 +21494,20 @@ const _DOMParser = DOMParser; try { const boardname = location.pathname.match(/\/([^/]*)\//)[1]; const reshaped = Object.fromEntries([...new Set(pendingPosts.map((e) => e.op))].map((e) => [e, pendingPosts.filter((p) => p.op == e).map((e2) => e2.id)])); - console.log(reshaped); + const reshaped2 = Object.fromEntries([...new Set(pendingNoPosts.map((e) => e.op))].map((e) => [e, pendingPosts.filter((p) => p.op == e).map((e2) => e2.id)])); const res = await ifetch("https://shoujo.coom.tech/listing/" + boardname, { method: "POST", - body: JSON.stringify(reshaped), + body: JSON.stringify({ + emb: reshaped, + noemb: reshaped2 + }), headers: { "content-type": "application/json" } }); await res.json(); pendingPosts = []; + pendingNoPosts = []; } catch (e) { console.error(e); } @@ -31805,6 +21519,177 @@ const _DOMParser = DOMParser; return false; return typeof csettings5.cache == "boolean" ? csettings5.cache : location.hostname.includes("b4k"); }; + var cp; + var CommandProcessor = class { + constructor() { + this.processor = ProcessWorker(); + this.genid = 0; + this.pendinggens = {}; + this.cmdid = 0; + this.pendingprom = {}; + this.processor.onmessage = async (msg) => { + let gen; + let res; + switch (msg.data.type) { + case "ipc": + { + const id = msg.data.msg.id; + if (false) { + if (msg.data.msg.name == "corsFetch") { + sendCmd2(msg.data.msg, msg.data.tr); + lqueue2[id] = (res2) => { + this.processor.postMessage({ + type: "ipc", + id, + res: res2 + }); + }; + } else { + const repl = await sendCmd2(msg.data.msg, msg.data.tr); + repl.id = id; + this.processor.postMessage({ + type: "ipc", + id, + res: repl + }); + } + } else { + if (msg.data.msg.name == "fullyRead") { + this.processor.postMessage({ + type: "ipc", + res: { + id, + ok: 1 + } + }); + } + if (msg.data.msg.name == "corsFetch") { + const { args } = msg.data.msg; + const res2 = await ifetch(args[0], args[1]); + const headersStr = res2.responseHeaders; + const headerObj = headerStringToObject(headersStr); + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + ok: res2.ok || true, + setRes: true, + headers: headerObj, + responseHeaders: headersStr, + redirected: res2.redirected, + type: res2.type, + url: res2.url, + status: res2.status, + bodyUsed: res2.bodyUsed, + statusText: res2.statusText + } + }); + if (!args[1].method || ["GET", "POST"].includes(args[1].method)) { + const data = await res2.arrayBuffer(); + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + pushData: { + data + } + } + }, [data]); + } + this.processor.postMessage({ + type: "ipc", + id, + res: { + id, + pushData: {} + } + }, []); + } + } + } + break; + case "reply": + if (msg.data.id in this.pendingprom) { + this.pendingprom[msg.data.id](msg.data.res); + delete this.pendingprom[msg.data.id]; + } + break; + case "ag": + gen = this.pendinggens[msg.data.id]; + res = await gen.next(msg.data.args); + if (res.done) { + delete this.pendinggens[msg.data.id]; + } + this.processor.postMessage({ + type: "ag", + id: msg.data.id, + res + }); + break; + } + }; + } + serializeArg(m) { + if (m[Symbol.toStringTag] == "AsyncGenerator") { + const genid = this.genid++; + this.pendinggens[genid] = m; + return { + type: "AsyncGenerator", + id: genid + }; + } + return m; + } + sendCmd(cmd, ...args) { + const id = this.cmdid++; + this.processor.postMessage({ + type: "cmd", + id, + fun: cmd, + args: args.map((a) => this.serializeArg(a)) + }); + return new Promise((res) => { + this.pendingprom[id] = res; + }); + } + sendAg(id, res) { + this.processor.postMessage({ + type: "ag", + id, + res + }); + } + processImage(origlink, fn, md5, thumb) { + return this.sendCmd("processImage", origlink, fn, md5, thumb); + } + }; + var convertToLocalEmbed = (wef) => { + let ret; + ret = wef; + if (typeof wef.data == "object") { + if (!(wef.data instanceof Uint8Array)) { + const ref = wef.data; + if (!wef.thumbnail) + return wef; + ret = { + ...wef, + thumbnail: import_buffer9.Buffer.from(wef.thumbnail), + data: async (lsn) => { + return import_buffer9.Buffer.from(await (await ifetch(ref.url, { headers: ref.headers }, lsn)).arrayBuffer()); + } + }; + } + } + if (wef.data instanceof Uint8Array) { + ret.data = import_buffer9.Buffer.from(wef.data); + } + if (wef.thumbnail instanceof Uint8Array) { + ret.thumbnail = import_buffer9.Buffer.from(wef.thumbnail); + } + return ret; + }; var processPost = async (post) => { const origlink = qp.getImageLink(post); if (!origlink) @@ -31813,25 +21698,39 @@ const _DOMParser = DOMParser; if (!thumbLink) return; let res2 = void 0; + const op = +location.pathname.match(/\/thread\/(.*)/)[1]; const reportEmbed = () => { if (!csettings5) - return false; + return; if (csettings5.tm) { if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { if (!cappState.isCatalog) { - const op = +location.pathname.match(/\/thread\/(.*)/)[1]; pendingPosts.push({ id: +post.id.match(/([0-9]+)/)[1], op }); signalNewEmbeds(); } } } }; + const reportNoEmbed = () => { + if (!csettings5) + return; + if (csettings5.tm) { + if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { + if (!cappState.isCatalog) { + pendingNoPosts.push({ id: +post.id.match(/([0-9]+)/)[1], op }); + signalNewEmbeds(); + } + } + } + }; try { if (shouldUseCache()) { res2 = await getEmbedsFromCache(qp.getCurrentBoard(), +qp.getCurrentThread(), post.id); } if (!res2) { - res2 = await processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2 = []; + const tmp = await cp.processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2.push(...tmp); res2 = res2?.filter((e) => e); } } catch (e) { @@ -31839,10 +21738,10 @@ const _DOMParser = DOMParser; return; } if (!res2 || res2.length == 0) - return; + return reportNoEmbed(); reportEmbed(); post.querySelector(".post")?.classList.add("embedfound"); - processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [k, e[1]]))); + processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [convertToLocalEmbed(k), e[1]]))); }; var versionCheck = async () => { const txt = await (await ifetch("https://raw.githubusercontent.com/coomdev/pngextraembedder/main/main.meta.js")).text(); @@ -31852,111 +21751,8 @@ const _DOMParser = DOMParser; fireNotification("info", `Last PEE version is ${lmajor}.${lminor}, you're on ${major}.${minor}`); } }; - function copyTextToClipboard(text3) { - const copyFrom = document.createElement("textarea"); - copyFrom.textContent = text3; - document.body.appendChild(copyFrom); - copyFrom.select(); - document.execCommand("copy"); - copyFrom.blur(); - document.body.removeChild(copyFrom); - navigator.clipboard.writeText(text3); - } var scrapeBoard = async (self) => { - if (!csettings5) - return false; - if (csettings5.tm) { - fireNotification("success", "Scrapping board with telemetry on! Thank you for your service, selfless stranger ;_;7"); - } - self.disabled = true; - self.textContent = "Searching..."; - const boardname = location.pathname.match(/\/([^/]*)\//)[1]; - const res = await ifetch(`https://a.4cdn.org/${boardname}/threads.json`); - const pages = await res.json(); - fireNotification("info", "Fetching all threads..."); - const threads = (await Promise.all(pages.reduce((a, b) => [...a, ...b.threads], []).map((e) => e.no).map(async (id) => { - try { - const res2 = await ifetch(`https://a.4cdn.org/${boardname}/thread/${id}.json`); - return await res2.json(); - } catch { - return void 0; - } - }))).filter((e) => e).map((e) => e); - const filenames = threads.reduce((a, b) => [...a, ...b.posts.filter((p) => p.ext).map((p) => p)], []).filter((p) => p.ext != ".webm" && p.ext != ".gif").map((p) => [p.resto || p.no, `https://i.4cdn.org/${boardname}/${p.tim}${p.ext}`, p.md5, p.filename + p.ext, p.no]); - console.log(filenames); - fireNotification("info", "Analyzing images..."); - const n = 1; - const processFile = (src, fn, hex) => { - return Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { - if (proc.skip) { - const md5 = import_buffer11.Buffer.from(hex, "base64"); - return await proc.has_embed(md5, fn); - } - const iter = streamRemote(src); - if (!iter) - return false; - let cumul = import_buffer11.Buffer.alloc(0); - let found; - let chunk = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true }; - } else { - chunk = { done: false, value }; - cumul = import_buffer11.Buffer.concat([cumul, value]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return true; - } - found = v; - } - } while (found !== false && !chunk.done); - await iter.next(true); - return found === true; - })); - }; - const range = ~~(filenames.length / n) + 1; - const hasEmbed = []; - const total = filenames.length; - let processed = 0; - const int = setInterval(() => { - fireNotification("info", `Processed [${processed} / ${total}] files`); - }, 5e3); - await Promise.all([...new Array(n + 1)].map(async (e, i) => { - const postsslice = filenames.slice(i * range, (i + 1) * range); - for (const post of postsslice) { - try { - const res2 = await processFile(post[1], post[3], post[2]); - processed++; - if (res2.some((e2) => e2)) { - hasEmbed.push(post); - if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) { - pendingPosts.push({ id: post[4], op: post[0] }); - signalNewEmbeds(); - } - } - } catch (e2) { - console.log(e2); - } - } - })); - clearInterval(int); - const counters = {}; - for (const k of hasEmbed) - counters[k[0]] = k[0] in counters ? counters[k[0]] + 1 : 1; - console.log(counters); - fireNotification("success", "Processing finished! Results pasted in the clipboard"); - const text3 = Object.entries(counters).sort((a, b) => b[1] - a[1]).map((e) => `>>${e[0]} (${e[1]})`).join("\n"); - console.log(text3); - copyTextToClipboard(text3); - self.textContent = "Copy Results"; - self.disabled = false; - self.onclick = () => { - copyTextToClipboard(text3); - }; }; - var __DOMParser = true ? _DOMParser : DOMParser; var gmo; var earlystartup = async () => { if (["arch.b4k.co", "desuarchive.org"].includes(location.host) && true) { @@ -32079,6 +21875,12 @@ Use the WebExtension version of PEE if you want to use b4k!`); mo2.observe(document.documentElement, { childList: true, subtree: true }); await bodyInit; } + try { + cp = new CommandProcessor(); + } catch { + alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list."); + return; + } if (!is4chanX && location.host.startsWith("boards.4chan")) { const notificationHost = document.createElement("span"); new NotificationsHandler_default({ @@ -32276,7 +22078,7 @@ Use the WebExtension version of PEE if you want to use b4k!`); const text3 = new TextEmbeddings_default({ target: textInsertCursor, props: { - files: ress.map((e) => e[0]).filter((e) => import_buffer11.Buffer.isBuffer(e.data) && e.filename.endsWith(".txt") && e.filename.startsWith("message")) + files: ress.map((e) => e[0]).filter((e) => (import_buffer9.Buffer.isBuffer(e.data) || e.data instanceof Uint8Array) && e.filename.endsWith(".txt") && e.filename.startsWith("message")) } }); const emb = new Embeddings_default({ @@ -32314,12 +22116,6 @@ Use the WebExtension version of PEE if you want to use b4k!`); post.setAttribute("data-processed", "true"); } })(); -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ /*! * The buffer module from node.js, for the browser. * diff --git a/src/Components/Embedding.svelte b/src/Components/Embedding.svelte index 25c171b..6793d5c 100644 --- a/src/Components/Embedding.svelte +++ b/src/Components/Embedding.svelte @@ -50,7 +50,7 @@ import { peeTarget } from "../utils"; const thumb = file.thumbnail || file.data; let type: FileTypeResult | undefined; if (typeof thumb != "string") { - let buff = Buffer.isBuffer(thumb) ? thumb : await thumb(); + let buff = thumb instanceof Uint8Array ? thumb : await thumb(); type = await fileTypeFromBuffer(buff); if ( !type && @@ -116,7 +116,7 @@ import { peeTarget } from "../utils"; lisn.addEventListener("progress", (e: any) => { progress = e.detail; }); - let full = Buffer.isBuffer(file.data) ? file.data : await file.data(lisn); + let full = file.data instanceof Uint8Array ? file.data : await file.data(lisn); type = await fileTypeFromBuffer(full); if ( !type && diff --git a/src/Components/EyeButton.svelte b/src/Components/EyeButton.svelte index 6506066..60be081 100644 --- a/src/Components/EyeButton.svelte +++ b/src/Components/EyeButton.svelte @@ -31,7 +31,7 @@ a.style.display = "none"; let url: string; if (typeof file.data != "string") { - const thumb = Buffer.isBuffer(file.data) ? file.data : await file.data(); + const thumb = file.data instanceof Uint8Array ? file.data : await file.data(); const type = await fileTypeFromBuffer(thumb); url = URL.createObjectURL(new Blob([thumb], { type: type?.mime })); } else url = file.data; diff --git a/src/bitstream.ts b/src/bitstream.ts index 7267875..7f30a84 100644 --- a/src/bitstream.ts +++ b/src/bitstream.ts @@ -1,5 +1,3 @@ -import { BitstreamReader as br, BitstreamWriter as bw } from '@astronautlabs/bitstream'; - export const revbyte = (n: number, len = 8) => { let acc = 0; let n2 = n; @@ -142,8 +140,6 @@ export class BitstreamWriter { } setBit(b: number) { - if (b) - debugger; let byte = this.buffer[0]; byte |= b << (this._offset & 7); this.buffer[0] = byte; diff --git a/src/jpg.ts b/src/jpg.ts index 459311d..bb468fd 100644 --- a/src/jpg.ts +++ b/src/jpg.ts @@ -1,5 +1,5 @@ import { Buffer } from "buffer"; -import type { ImageProcessor } from "./main"; +import type { ImageProcessor } from "./processor.worker"; import { f5stego } from './f5stego'; import { settings } from "./stores"; import { decodeCoom3Payload } from "./utils"; @@ -19,7 +19,7 @@ const inject = async (b: File, links: string[]) => { // unfortunately, because of the way f5 work, we can't determine // if there's an embedded message until we have the complete file // but the way PEE was designed forces us to just try to extract something until it works -const has_embed = (b: Buffer) => { +const has_embed = (b: Uint8Array) => { try { const res = f5inst.extract(b); if (!res) @@ -35,7 +35,7 @@ const has_embed = (b: Buffer) => { } }; -const extract = (b: Buffer, ex: string) => { +const extract = (b: Uint8Array, ex: string) => { // if we reached here then ex is heckin cute and valid return decodeCoom3Payload(Buffer.from(ex)); }; diff --git a/src/main.ts b/src/main.ts index e2aa96f..1f9c7b5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,12 +1,14 @@ -import 'process'; +/// +/// + import { Buffer } from "buffer"; import { appState, settings, initial_settings } from "./stores"; import { debounce } from './debounce'; import globalCss from './global.css'; import pngv3 from "./pngv3"; -import webm from "./webm"; -import gif from "./gif"; +//import webm from "./webm"; +//import gif from "./gif"; import jpg from "./jpg"; import thirdeye from "./thirdeye"; import pomf from "./pomf"; @@ -21,27 +23,26 @@ import NotificationsHandler from './Components/NotificationsHandler.svelte'; import { fireNotification, getEmbedsFromCache, getSelectedFile } from "./utils"; import { getQueryProcessor, QueryProcessor } from "./websites"; -import { ifetch, Platform, streamRemote, supportedAltDomain, supportedMainDomain } from "./platform"; +import { ifetch, Platform, sendCmd, lqueue, supportedAltDomain, supportedMainDomain } from "./platform"; import TextEmbeddingsSvelte from "./Components/TextEmbeddings.svelte"; import { HydrusClient } from "./hydrus"; import { registerPlugin } from 'linkifyjs'; import ViewCountSvelte from "./Components/ViewCount.svelte"; +import type { ImageProcessor, WorkerEmbeddedFile } from './processor.worker'; + +import ProcessWorkerAny from './processor.worker'; +import { headerStringToObject } from "./requests"; + +const ProcessWorker = ProcessWorkerAny as () => Worker; if (!supportedMainDomain(location.host) && !supportedAltDomain(location.host)) throw "PEE not supported here, skipping"; -export interface ImageProcessor { - skip?: true; - match(fn: string): boolean; - has_embed(b: Buffer, fn?: string, prevurl?: string): boolean | string | undefined | Promise; - extract(b: Buffer, fn?: string): EmbeddedFile[] | Promise; - inject?(b: File, c: string[]): Buffer | Promise; -} let qp: QueryProcessor; export let csettings: Parameters[0]; -let processors: ImageProcessor[] = - [thirdeye, pomf, pngv3, jpg, webm, gif]; +const processors: ImageProcessor[] = + [thirdeye, pomf, pngv3, jpg];//, webm, gif let cappState: Parameters[0]; settings.subscribe(async b => { @@ -64,9 +65,9 @@ settings.subscribe(async b => { } } csettings = b; - processors = [...(!csettings.te ? [thirdeye] : []), - pngv3, pomf, jpg, webm, gif - ]; + //processors = [...(!csettings.te ? [thirdeye] : []), + // pngv3, pomf, jpg, webm, gif + //]; }); @@ -79,7 +80,7 @@ type EmbeddedFileWithPreview = { source?: string; // can be like a twitter post this was posted in originally thumbnail: string | Buffer; filename: string; - data: EmbeddedFileWithoutPreview['data'] | ((lisn?: EventTarget) => Promise); + data: EmbeddedFileWithoutPreview['data'] | ((lisn?: EventTarget) => Promise); }; type EmbeddedFileWithoutPreview = { @@ -92,6 +93,7 @@ type EmbeddedFileWithoutPreview = { export type EmbeddedFile = EmbeddedFileWithPreview | EmbeddedFileWithoutPreview; +/* const processImage = async (srcs: AsyncGenerator, fn: string, hex: string, prevurl: string) => { const ret = await Promise.all(processors.filter(e => e.match(fn)).map(async proc => { if (proc.skip) { @@ -109,7 +111,7 @@ const processImage = async (srcs: AsyncGenerator, fn: string try { const n = await srcs.next(); if (n.done) - return; // no more links to try + return; // no more links to try const iter = streamRemote(n.value); if (!iter) return; @@ -129,7 +131,7 @@ const processImage = async (srcs: AsyncGenerator, fn: string } found = v; } - } while (found !== false && !chunk.done /* Because we only embed links now, it's safe to assume we get everything we need in the first chunk */); + } while (found !== false && !chunk.done); succ = true; await iter.next(true); if (found !== true) { @@ -143,7 +145,7 @@ const processImage = async (srcs: AsyncGenerator, fn: string } while (!succ); })); return ret.filter(e => e).map(e => e!); -}; +};*/ const textToElement = (s: string) => document.createRange().createContextualFragment(s).children[0] as any as T; @@ -163,6 +165,8 @@ const buildCumFun = (f: (args: T[]) => void, ...r: Parameter }; let pendingPosts: { id: number, op: number }[] = []; +let pendingNoPosts: { id: number, op: number }[] = []; + // should be equivalent to buildCumFun(signalNewEmbeds, 5000, {trailing: true}) const signalNewEmbeds = debounce(async () => { // ensure user explicitely enabled telemetry @@ -174,17 +178,22 @@ const signalNewEmbeds = debounce(async () => { const boardname = location.pathname.match(/\/([^/]*)\//)![1]; // restructure to minimize redundancy const reshaped = Object.fromEntries([...new Set(pendingPosts.map(e => e.op))].map(e => [e, pendingPosts.filter(p => p.op == e).map(e => e.id)])); - console.log(reshaped); + const reshaped2 = Object.fromEntries([...new Set(pendingNoPosts.map(e => e.op))].map(e => [e, pendingPosts.filter(p => p.op == e).map(e => e.id)])); + //console.log(reshaped); const res = await ifetch("https://shoujo.coom.tech/listing/" + boardname, { method: "POST", - body: JSON.stringify(reshaped), + body: JSON.stringify({ + emb: reshaped, + noemb: reshaped2 + }), headers: { 'content-type': 'application/json' } }); await res.json(); pendingPosts = []; + pendingNoPosts = []; } catch (e) { // silently fail console.error(e); @@ -201,6 +210,197 @@ const shouldUseCache = () => { : location.hostname.includes('b4k'); }; +let cp: CommandProcessor; + +class CommandProcessor { + processor = ProcessWorker(); + + genid = 0; + + pendinggens: Record = {}; + + cmdid = 0; + + pendingprom: Record void> = {}; + + constructor() { + this.processor.onmessage = async (msg) => { + let gen: AsyncGenerator; + let res: IteratorResult; + + switch (msg.data.type) { + case 'ipc': + { + const id = msg.data.msg.id; + if (execution_mode != "userscript") { + if (msg.data.msg.name == 'corsFetch') { + sendCmd(msg.data.msg, msg.data.tr); + lqueue[id] = (res: any) => { + this.processor.postMessage({ + type: 'ipc', + id, + res + }); + }; + } else { + // for complitude, but technically the webworker doesn't run anything besides corsFetch + const repl: any = await sendCmd(msg.data.msg, msg.data.tr); + repl.id = id; + this.processor.postMessage({ + type: 'ipc', + id, + res: repl + }); + } + } else { + if (msg.data.msg.name == 'fullyRead') { + // ignore + this.processor.postMessage({ + type: 'ipc', + res: { + id, + ok: 1 + } + }); + } + if (msg.data.msg.name == 'corsFetch') { + const { args } = msg.data.msg; + const res = await ifetch(args[0], args[1]); + // don't report progress because monkeys don't have a way to expose partial responses anyway + const headersStr = (res as any).responseHeaders; + const headerObj = headerStringToObject(headersStr); + + this.processor.postMessage({ + type: 'ipc', + id, + res: { + id, + ok: res.ok || true, + setRes: true, + headers: headerObj, + responseHeaders: headersStr, + redirected: res.redirected, + type: res.type, + url: res.url, + status: res.status, + bodyUsed: res.bodyUsed, + statusText: res.statusText, + } + }); + if (!args[1].method || ['GET', 'POST'].includes(args[1].method)) { + const data = await res.arrayBuffer(); + this.processor.postMessage({ + type: 'ipc', + id, + res: { + id, + pushData: { + data + } + } + }, [data]); + } + // let's hope these are delivered in order :%) + this.processor.postMessage({ + type: 'ipc', + id, + res: { + id, + pushData: { + } + } + }, []); + } + // ignore other commands + } + } break; + case 'reply': + if (msg.data.id in this.pendingprom) { + this.pendingprom[msg.data.id](msg.data.res); + delete this.pendingprom[msg.data.id]; + } + break; + case 'ag': + gen = this.pendinggens[msg.data.id]; + res = await gen.next(msg.data.args); + if (res.done) { + delete this.pendinggens[msg.data.id]; + } + this.processor.postMessage({ + type: 'ag', + id: msg.data.id, + res + }); + break; + } + }; + } + + serializeArg(m: any) { + if (m[Symbol.toStringTag] == 'AsyncGenerator') { + const genid = this.genid++; + this.pendinggens[genid] = m; + return { + type: 'AsyncGenerator', + id: genid + }; + } + return m; + } + + sendCmd(cmd: string, ...args: any[]) { + const id = this.cmdid++; + this.processor.postMessage({ + type: 'cmd', + id, + fun: cmd, + args: args.map(a => this.serializeArg(a)) + }); + return new Promise(res => { + this.pendingprom[id] = res; + }); + } + + sendAg(id: number, res: IteratorResult) { + this.processor.postMessage({ + type: 'ag', + id, res // todo: call serializeArg? + }); + } + + processImage(origlink: AsyncGenerator, fn: string, md5: string, thumb: string): Promise<[WorkerEmbeddedFile[], boolean][]> { + return this.sendCmd('processImage', origlink, fn, md5, thumb); + } +} + +const convertToLocalEmbed = (wef: WorkerEmbeddedFile) => { + let ret: EmbeddedFileWithPreview; + ret = wef as any; + // handles bigger files where data is represented as a {url, header} object + if (typeof wef.data == "object") { + if (!(wef.data instanceof Uint8Array)) { + const ref = wef.data; + if (!wef.thumbnail) + return wef; + ret = { + ...wef, + thumbnail: Buffer.from(wef.thumbnail), + data: async (lsn) => { + return Buffer.from(await (await ifetch(ref.url, { headers: ref.headers }, lsn)).arrayBuffer()); + } + }; + } + } + + if (wef.data instanceof Uint8Array) { + ret.data = Buffer.from(wef.data); + } + if (wef.thumbnail instanceof Uint8Array) { + ret.thumbnail = Buffer.from(wef.thumbnail); + } + return ret!; +}; + const processPost = async (post: HTMLDivElement) => { const origlink = qp.getImageLink(post); if (!origlink) @@ -208,17 +408,17 @@ const processPost = async (post: HTMLDivElement) => { const thumbLink = qp.getThumbnailLink(post); if (!thumbLink) return; - let res2: [EmbeddedFile[], boolean][] | undefined = undefined; + let res2: [WorkerEmbeddedFile[], boolean][] | undefined = undefined; + const op = +location.pathname.match(/\/thread\/(.*)/)![1]; const reportEmbed = () => { if (!csettings) - return false; + return; if (csettings.tm) { // dont report results from archive, only live threads if (['boards.4chan.org', 'boards.4channel.org'].includes(location.host)) { if (!cappState.isCatalog) { // only save from within threads // we must be in a thread, thus the following is valid - const op = +location.pathname.match(/\/thread\/(.*)/)![1]; pendingPosts.push({ id: +(post.id.match(/([0-9]+)/)![1]), op }); signalNewEmbeds(); // let it run async } @@ -226,12 +426,29 @@ const processPost = async (post: HTMLDivElement) => { } }; + const reportNoEmbed = () => { + if (!csettings) + return; + if (csettings.tm) { + // dont report results from archive, only live threads + if (['boards.4chan.org', 'boards.4channel.org'].includes(location.host)) { + if (!cappState.isCatalog) { // only save from within threads + // we must be in a thread, thus the following is valid + pendingNoPosts.push({ id: +(post.id.match(/([0-9]+)/)![1]), op }); + signalNewEmbeds(); // let it run async + } + } + } + }; + try { if (shouldUseCache()) { res2 = await getEmbedsFromCache(qp.getCurrentBoard(), +qp.getCurrentThread()!, post.id); } if (!res2) { - res2 = await processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2 = []; + const tmp = await cp.processImage(origlink, qp.getFilename(post), qp.getMD5(post), thumbLink); + res2.push(...tmp); res2 = res2?.filter(e => e); } } catch (e) { @@ -239,10 +456,10 @@ const processPost = async (post: HTMLDivElement) => { return; } if (!res2 || res2.length == 0) - return; + return reportNoEmbed(); reportEmbed(); post.querySelector('.post')?.classList.add("embedfound"); - processAttachments(post, res2?.flatMap(e => e![0].map(k => [k, e![1]] as [EmbeddedFile, boolean]))); + processAttachments(post, res2?.flatMap(e => e![0].map(k => [convertToLocalEmbed(k), e![1]] as [EmbeddedFile, boolean]))); }; const versionCheck = async () => { @@ -269,156 +486,118 @@ function copyTextToClipboard(text: string) { } const scrapeBoard = async (self: HTMLButtonElement) => { - if (!csettings) - return false; - if (csettings.tm) { - fireNotification("success", "Scrapping board with telemetry on! Thank you for your service, selfless stranger ;_;7"); - } - self.disabled = true; - self.textContent = "Searching..."; - const boardname = location.pathname.match(/\/([^/]*)\//)![1]; - const res = await ifetch(`https://a.4cdn.org/${boardname}/threads.json`); - const pages = await res.json() as Page[]; - type Page = { threads: Thread[] } - type Thread = { no: number; posts: Post[] }; - type BasePost = { no: number, resto: number, tim: number }; - type PostWithFile = BasePost & { tim: number, ext: string, md5: string, filename: string }; - type PostWithoutFile = BasePost & Record; - type Post = (PostWithoutFile | PostWithFile); - fireNotification("info", "Fetching all threads..."); - const threads = (await Promise.all(pages - .reduce((a: Thread[], b: Page) => [...a, ...b.threads], []) - .map(e => e.no) - .map(async id => { - try { - const res = await ifetch(`https://a.4cdn.org/${boardname}/thread/${id}.json`); - return await res.json() as Thread; - } catch { - return undefined; - } - }))).filter(e => e).map(e => e as Thread); - const filenames = threads - .reduce((a, b) => [...a, ...b.posts.filter(p => p.ext) - .map(p => p as PostWithFile)], [] as PostWithFile[]).filter(p => p.ext != '.webm' && p.ext != '.gif') - .map(p => [p.resto || p.no, `https://i.4cdn.org/${boardname}/${p.tim}${p.ext}`, p.md5, p.filename + p.ext, p.no] as [number, string, string, string, number]); - - console.log(filenames); - fireNotification("info", "Analyzing images..."); - const n = 1; - //console.log(posts); - const processFile = (src: string, fn: string, hex: string) => { - return Promise.all(processors.filter(e => e.match(fn)).map(async proc => { - if (proc.skip) { - const md5 = Buffer.from(hex, 'base64'); - return await proc.has_embed(md5, fn); - } - // TODO: Move this outside the loop? - const iter = streamRemote(src); - if (!iter) - return false; - let cumul = Buffer.alloc(0); - let found: boolean | undefined; - let chunk: ReadableStreamDefaultReadResult = { done: true }; - do { - const { value, done } = await iter.next(typeof found === "boolean"); - if (done) { - chunk = { done: true } as ReadableStreamDefaultReadDoneResult; - } else { - chunk = { done: false, value } as ReadableStreamDefaultReadValueResult; - cumul = Buffer.concat([cumul, value!]); - const v = await proc.has_embed(cumul); - if (typeof v == "string") { - return true; - } - found = v; + /* if (!csettings) + return false; + if (csettings.tm) { + fireNotification("success", "Scrapping board with telemetry on! Thank you for your service, selfless stranger ;_;7"); + } + self.disabled = true; + self.textContent = "Searching..."; + const boardname = location.pathname.match(/\/([^/]*)\//)![1]; + const res = await ifetch(`https://a.4cdn.org/${boardname}/threads.json`); + const pages = await res.json() as Page[]; + type Page = { threads: Thread[] } + type Thread = { no: number; posts: Post[] }; + type BasePost = { no: number, resto: number, tim: number }; + type PostWithFile = BasePost & { tim: number, ext: string, md5: string, filename: string }; + type PostWithoutFile = BasePost & Record; + type Post = (PostWithoutFile | PostWithFile); + fireNotification("info", "Fetching all threads..."); + const threads = (await Promise.all(pages + .reduce((a: Thread[], b: Page) => [...a, ...b.threads], []) + .map(e => e.no) + .map(async id => { + try { + const res = await ifetch(`https://a.4cdn.org/${boardname}/thread/${id}.json`); + return await res.json() as Thread; + } catch { + return undefined; } - } while (found !== false && !chunk.done); - await iter.next(true); - return found === true; - })); - }; - const range = ~~(filenames.length / n) + 1; - const hasEmbed: typeof filenames = []; - const total = filenames.length; - let processed = 0; - - const int = setInterval(() => { - fireNotification("info", `Processed [${processed} / ${total}] files`); - }, 5000); - - await Promise.all([...new Array(n + 1)].map(async (e, i) => { - const postsslice = filenames.slice(i * range, (i + 1) * range); - for (const post of postsslice) { - try { - const res = await processFile(post[1], post[3], post[2]); - processed++; - if (res.some(e => e)) { - hasEmbed.push(post); - // dont report results from archive, only live threads - if (['boards.4chan.org', 'boards.4channel.org'].includes(location.host)) { - pendingPosts.push({ id: post[4], op: post[0] }); - signalNewEmbeds(); // let it run async + }))).filter(e => e).map(e => e as Thread); + const filenames = threads + .reduce((a, b) => [...a, ...b.posts.filter(p => p.ext) + .map(p => p as PostWithFile)], [] as PostWithFile[]).filter(p => p.ext != '.webm' && p.ext != '.gif') + .map(p => [p.resto || p.no, `https://i.4cdn.org/${boardname}/${p.tim}${p.ext}`, p.md5, p.filename + p.ext, p.no] as [number, string, string, string, number]); + + console.log(filenames); + fireNotification("info", "Analyzing images..."); + const n = 1; + //console.log(posts); + const processFile = (src: string, fn: string, hex: string) => { + return Promise.all(processors.filter(e => e.match(fn)).map(async proc => { + if (proc.skip) { + const md5 = Buffer.from(hex, 'base64'); + return await proc.has_embed(md5, fn); + } + // TODO: Move this outside the loop? + const iter = streamRemote(src); + if (!iter) + return false; + let cumul = Buffer.alloc(0); + let found: boolean | undefined; + let chunk: ReadableStreamDefaultReadResult = { done: true }; + do { + const { value, done } = await iter.next(typeof found === "boolean"); + if (done) { + chunk = { done: true } as ReadableStreamDefaultReadDoneResult; + } else { + chunk = { done: false, value } as ReadableStreamDefaultReadValueResult; + cumul = Buffer.concat([cumul, value!]); + const v = await proc.has_embed(cumul); + if (typeof v == "string") { + return true; + } + found = v; + } + } while (found !== false && !chunk.done); + await iter.next(true); + return found === true; + })); + }; + const range = ~~(filenames.length / n) + 1; + const hasEmbed: typeof filenames = []; + const total = filenames.length; + let processed = 0; + + const int = setInterval(() => { + fireNotification("info", `Processed [${processed} / ${total}] files`); + }, 5000); + + await Promise.all([...new Array(n + 1)].map(async (e, i) => { + const postsslice = filenames.slice(i * range, (i + 1) * range); + for (const post of postsslice) { + try { + const res = await processFile(post[1], post[3], post[2]); + processed++; + if (res.some(e => e)) { + hasEmbed.push(post); + // dont report results from archive, only live threads + if (['boards.4chan.org', 'boards.4channel.org'].includes(location.host)) { + pendingPosts.push({ id: post[4], op: post[0] }); + signalNewEmbeds(); // let it run async + } } + } catch (e) { + console.log(e); } - } catch (e) { - console.log(e); } - } - })); - - clearInterval(int); - - const counters: Record = {}; - for (const k of hasEmbed) - counters[k[0]] = k[0] in counters ? counters[k[0]] + 1 : 1; - console.log(counters); - fireNotification("success", "Processing finished! Results pasted in the clipboard"); - const text = Object.entries(counters).sort((a, b) => b[1] - a[1]).map(e => `>>${e[0]} (${e[1]})`).join('\n'); - console.log(text); - copyTextToClipboard(text); - self.textContent = "Copy Results"; - self.disabled = false; - self.onclick = () => { - copyTextToClipboard(text); - }; -}; - -const __DOMParser = execution_mode == "userscript" ? _DOMParser : DOMParser; -const cleanupHTML = (ndom: Document) => { - const evalWhenReady: string[] = []; - const addFromSource = (elem: HTMLElement, url: string) => { - const scr = document.createElement('script'); - scr.type = 'text/javascript'; - scr.src = url; - elem.append(scr); - }; - - const addFromCode = (elem: HTMLElement, sr: string) => { - const scr = document.createElement('script'); - scr.type = 'text/javascript'; - scr.innerText = sr; - elem.append(scr); - }; - - const rm = (e: any) => e.remove(); - [...ndom.head.children].filter(e => e.tagName == "SCRIPT").forEach(rm); - [...ndom.body.children].filter(e => e.tagName == "SCRIPT").forEach(rm); - - addFromSource(ndom.body, "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"); - addFromSource(ndom.head, "https://based.coom.tech/highlight.pack.js"); - /* - addFromCode(ndom.body, `document.documentElement.className = "";document.documentElement.lang = "en";document.documentElement.dataset.site = "arch.b4k.co";`); - addFromCode(ndom.body, `hljs.configure({ tableReplace: ' ' }); $('pre,code').each(function(i, block) { hljs.highlightBlock(block); }); var backend_vars = {"user_name":false,"user_email":false,"user_pass":"9fOK4K8","site_url":"https://arch.b4k.co/","default_url":"https://arch.b4k.co/","archive_url":"https://arch.b4k.co/","system_url":"https://arch.b4k.co/","api_url":"https://arch.b4k.co/","cookie_domain":null,"cookie_prefix":"foolfuuka_a2e7d4_","selected_theme":"foolz/foolfuuka-theme-foolfuuka","csrf_token_key":"csrf_token","images":{"banned_image":"https://arch.b4k.co/foolfuuka/foolz/foolfuuka-theme-foolfuuka/assets-1.2.28/images/banned-image.png","banned_image_width":150,"banned_image_height":150,"missing_image":"https://arch.b4k.co/foolfuuka/foolz/foolfuuka-theme-foolfuuka/assets-1.2.28/images/missing-image.jpg","missing_image_width":150,"missing_image_height":150},"gettext":{"submit_state":"Submitting","thread_is_real_time":"This thread is being displayed in real time.","update_now":"Update now","ghost_mode":"This thread has entered ghost mode. Your reply will be marked as a ghost post and will only affect the ghost index."},"board_shortname":"v"};`); - // head - //body - await addFromSource(ndom.body, "https://based.coom.tech/bootstrap.min.js"); - await addFromSource(ndom.body, "https://based.coom.tech/plugins.js"); + })); - await addFromSource(ndom.body, "https://based.coom.tech/board.js"); - await addFromSource(ndom.body, "https://based.coom.tech/fuuka.js"); - await addFromSource(ndom.body, "https://based.coom.tech/lazyload.js"); - */ - return [ndom.documentElement.innerHTML, evalWhenReady] as [string, string[]]; + clearInterval(int); + + const counters: Record = {}; + for (const k of hasEmbed) + counters[k[0]] = k[0] in counters ? counters[k[0]] + 1 : 1; + console.log(counters); + fireNotification("success", "Processing finished! Results pasted in the clipboard"); + const text = Object.entries(counters).sort((a, b) => b[1] - a[1]).map(e => `>>${e[0]} (${e[1]})`).join('\n'); + console.log(text); + copyTextToClipboard(text); + self.textContent = "Copy Results"; + self.disabled = false; + self.onclick = () => { + copyTextToClipboard(text); + };*/ }; let gmo: MutationObserver; @@ -564,6 +743,13 @@ const startup = async (is4chanX = true) => { await bodyInit; } + try { + cp = new CommandProcessor(); + } catch { + alert("You may be using 4chanX\n\nGo to 4chanX's settings, Advanced > JS Whitelist and add 'blob:' without quotes to the list."); + return; + } + if (!is4chanX && location.host.startsWith('boards.4chan')) { const notificationHost = document.createElement('span'); new NotificationsHandler({ @@ -793,7 +979,7 @@ function processAttachments(post: HTMLDivElement, ress: [EmbeddedFile, boolean][ target: textInsertCursor, props: { files: ress.map(e => e[0]).filter(e => - Buffer.isBuffer(e.data) && e.filename.endsWith('.txt') && e.filename.startsWith('message') + (Buffer.isBuffer(e.data) || e.data instanceof Uint8Array) && e.filename.endsWith('.txt') && e.filename.startsWith('message') ) } }); diff --git a/src/platform.ts b/src/platform.ts index 27c219c..93537cc 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -1,6 +1,6 @@ import { GM_fetch, GM_head, headerStringToObject } from './requests'; -const lqueue = {} as any; +export const lqueue = {} as any; const localLoad = (key: string, def: T) => ('__pee__' + key) in localStorage @@ -10,9 +10,19 @@ const localLoad = (key: string, def: T) => const localSet = (key: string, value: any) => localStorage.setItem('__pee__' + key, JSON.stringify(value)); -const { port1, port2 } = new MessageChannel(); +export let port1: MessagePort; +let port2: MessagePort; + console.log(execution_mode, isBackground); -if (execution_mode != 'userscript' && !isBackground) { + +/* +A web worker has no access to the dom, so things like remote fetches are proxied through the main frame +*/ + +if (execution_mode != 'userscript' && !isBackground && execution_mode != 'worker') { + const nmc = new MessageChannel(); + port1 = nmc.port1; + port2 = nmc.port2; // It has to be a content script const iframe = document.createElement('iframe'); iframe.style.display = 'none'; @@ -21,7 +31,7 @@ if (execution_mode != 'userscript' && !isBackground) { iframe.onload = _; }); iframe.src = `${chrome.runtime.getURL('')}options.html`; - const meself = new URL(chrome.runtime.getURL('')).origin; + //const meself = new URL(chrome.runtime.getURL('')).origin; document.documentElement.appendChild(iframe); iframeloaded.then(() => { iframe.contentWindow?.postMessage('', '*', [port2]); @@ -31,6 +41,24 @@ if (execution_mode != 'userscript' && !isBackground) { }; } +console.log(execution_mode); + +if (execution_mode == "worker") { + port1 = { + onmessage(ev) { + lqueue[ev.data.id](ev.data); + }, + postMessage(msg, tr?: Transferable[]) { + (postMessage as any)({ + type: 'ipc', + tr, + msg + }, tr); + } + } as MessagePort; +} + +// hack let gid = 0; const visit = (e: any, cb: (e: any) => true | undefined) => { @@ -42,11 +70,11 @@ const visit = (e: any, cb: (e: any) => true | undefined) => { cb(e); }; -const sendCmd = (cmd: any, tr?: Transferable[]) => { +export const sendCmd = (cmd: any, tr?: Transferable[]) => { const prom = new Promise(_ => { const id = gid++; lqueue[id] = (e: any) => { - _(e.res); + _(e); delete lqueue[id]; }; port1.postMessage({ id, ...cmd }, tr || []); @@ -55,7 +83,7 @@ const sendCmd = (cmd: any, tr?: Transferable[]) => { }; const bridge = V>(name: string, f: T) => { - if (execution_mode != 'userscript' && !isBackground) + if (execution_mode != 'userscript' && !isBackground && execution_mode != 'worker') return f; // It has to be the background script return (...args: U) => { @@ -386,7 +414,6 @@ export async function* streamRemote(url: string, chunkSize = 72 * 1024, fetchRes while (ptr != size) { //console.log('doing a fetch of ', url, ptr, ptr + fetchSize - 1); let obj: Record; - const fres = await ifetch(url, { headers: { range: `bytes=${ptr}-${ptr + fetchSize - 1}` } }); if (execution_mode == "userscript") { obj = headerStringToObject((fres as any as Tampermonkey.Response).responseHeaders); diff --git a/src/pngv3.ts b/src/pngv3.ts index 03cef9c..bd68e66 100644 --- a/src/pngv3.ts +++ b/src/pngv3.ts @@ -1,5 +1,5 @@ import { Buffer } from "buffer"; -import type { EmbeddedFile, ImageProcessor } from "./main"; +import type { WorkerEmbeddedFile, ImageProcessor } from "./processor.worker"; import { PNGDecoder, PNGEncoder } from "./png"; import { decodeCoom3Payload } from "./utils"; import { settings } from "./stores"; @@ -141,10 +141,10 @@ const extractFromRawDeflate = (b: Buffer) => { return false; // possibly incorrect? }; -const extract = async (png: Buffer) => { +const extract = async (png: Buffer, doextract = true) => { const reader = BufferReadStream(png).getReader(); const sneed = new PNGDecoder(reader, false); - const ret: EmbeddedFile[] = []; + const ret: WorkerEmbeddedFile[] = []; let w: Buffer | undefined; if (!csettings) throw new Error("Settings uninit"); @@ -159,22 +159,28 @@ const extract = async (png: Buffer) => { case 'tEXt': buff = chunk; if (buff.slice(4, 4 + CUM3.length).equals(CUM3)) { + if (!doextract) + return true; const k = await decodeCoom3Payload(buff.slice(4 + CUM3.length)); - ret.push(...k.filter(e => e).map(e => e as EmbeddedFile)); + ret.push(...k.filter(e => e)); } if (buff.slice(4, 4 + CUM4.length).equals(CUM4)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM4.length); xor(passed, password); const k = await decodeCoom3Payload(passed); - ret.push(...k.filter(e => e).map(e => e as EmbeddedFile)); + ret.push(...k.filter(e => e)); } if (buff.slice(4, 4 + CUM5.length).equals(CUM5)) { + if (!doextract) + return true; const passed = buff.slice(4 + CUM5.length); const decoded = Buffer.from(passed.toString(), 'base64').toString().split(' ').map(e => { return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(' '); const k = await decodeCoom3Payload(Buffer.from(decoded)); - ret.push(...k.filter(e => e).map(e => e as EmbeddedFile)); + ret.push(...k.filter(e => e)); } // eslint-disable-next-line no-cond-assign @@ -194,8 +200,10 @@ const extract = async (png: Buffer) => { // should also check if the id has a len of 6-8 or ends in .pee return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(' '); + if (!doextract) + return true; const k = await decodeCoom3Payload(Buffer.from(decoded)); - ret.push(...k.filter(e => e).map(e => e as EmbeddedFile)); + ret.push(...k.filter(e => e)); } catch (e) { // } @@ -231,10 +239,13 @@ const extract = async (png: Buffer) => { // should also check if the id has a len of 6-8 or ends in .pee return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(' '); - return decodeCoom3Payload(Buffer.from(dec)); + if (doextract) + return decodeCoom3Payload(Buffer.from(dec)); + return true; } } catch (e) { - console.error(e); + if (e != "Uhh") + console.error(e); } finally { reader.releaseLock(); } @@ -359,7 +370,7 @@ const inject = async (container: File, links: string[]) => { }; const has_embed = async (png: Buffer) => { - const r = await extract(png); + const r = await extract(png, false); return !!r; }; diff --git a/src/pomf.ts b/src/pomf.ts index c304350..db5aa5f 100644 --- a/src/pomf.ts +++ b/src/pomf.ts @@ -1,4 +1,5 @@ -import type { EmbeddedFile, ImageProcessor } from "./main"; +import type { ImageProcessor, WorkerEmbeddedFile } from './processor.worker'; + import { Buffer } from "buffer"; import thumbnail from "./assets/hasembed.png"; import { settings } from "./stores"; @@ -16,7 +17,7 @@ settings.subscribe(b => { }); const getExt = (fn: string) => { -// const isDum = fn!.match(/^[a-z0-9]{6}\./i); + // const isDum = fn!.match(/^[a-z0-9]{6}\./i); const isB64 = fn!.match(/^((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=))?\.(gif|jpe?g|png|webm)/); const isExt = fn!.match(/\[.*=(.*)\]/); let ext; @@ -61,15 +62,9 @@ const extract = async (b: Buffer, fn?: string) => { return [{ filename: ext, - data: csettings.hotlink ? rsource! : async (lsn) => { - try { - return Buffer.from(await (await ifetch(rsource, undefined, lsn)).arrayBuffer()); - } catch (e) { - //404 - } - }, + data: csettings.hotlink ? rsource! : { url: rsource! }, thumbnail: Buffer.from(thumbnail) - } as EmbeddedFile]; + } as WorkerEmbeddedFile]; }; const has_embed = async (b: Buffer, fn?: string) => { diff --git a/src/processor.worker.ts b/src/processor.worker.ts index 3e21c16..465cb4c 100644 --- a/src/processor.worker.ts +++ b/src/processor.worker.ts @@ -1,16 +1,199 @@ -//export default ((() => {/* */ }) as () => Worker); -//const exports = {}; - -//import * as platform from './platform'; -// -//console.log("Worker started"); -// -//const deserializeMessage = (m: any) => { -// -//} -// -//(async () => { -// onmessage = (msg: MessageEvent) => { -// const des = deserializeMessage(msg); -// }; -//})(); \ No newline at end of file +/// +/// + +import * as platform from './platform'; +import pngv3 from "./pngv3"; +//import webm from "./webm"; +//import gif from "./gif"; +import jpg from "./jpg"; +import thirdeye from "./thirdeye"; +import pomf from "./pomf"; + +console.log("Worker started"); + +const pendinggens: Record) => void)[]> = {}; +const pendingcmds: Record void)[]> = {}; + +const proxyAsyncGen = (id: number) => { + return { + next(arg) { + postMessage({ + type: 'ag', + id + }); + return new Promise>(res => { + if (!pendinggens[id]) + pendinggens[id] = []; + pendinggens[id].push(res); + }); + }, + + return(v) { + postMessage({ + type: 'ag', + id + }); + return new Promise>(res => { + if (!pendinggens[id]) + pendinggens[id] = []; + pendinggens[id].push(res); + }); + }, + + throw() { + postMessage({ + type: 'ag', + id + }); + return new Promise>(res => { + if (!pendinggens[id]) + pendinggens[id] = []; + pendinggens[id].push(res); + }); + }, + + [Symbol.asyncIterator]() { + return this as AsyncGenerator; + } + } as AsyncGenerator; +}; + +const deserializeMessage = (m: any) => { + if (typeof m == "object" && m.type == 'AsyncGenerator') { + return proxyAsyncGen(m.id); + } + if (typeof m == "object") { + for (const p in m) { + m[p] = deserializeMessage(m[p]); + } + } + return m; +}; + +type WorkerEmbeddedFileWithPreview = { + page?: { title: string, url: string }; // can be a booru page + source?: string; // can be like a twitter post this was posted in originally + thumbnail: string | Uint8Array; + filename: string; + data: WorkerEmbeddedFileWithoutPreview['data'] | { url: string, headers?: Record }; +}; + +type WorkerEmbeddedFileWithoutPreview = { + page: undefined; + source: undefined; + thumbnail?: string; + filename: string; + data: string | Uint8Array; +}; + +export type WorkerEmbeddedFile = WorkerEmbeddedFileWithPreview | WorkerEmbeddedFileWithoutPreview; + +export interface ImageProcessor { + skip?: true; + match(fn: string): boolean; + has_embed(b: Uint8Array, fn?: string, prevurl?: string): boolean | string | undefined | Promise; + extract(b: Uint8Array, fn?: string): WorkerEmbeddedFile[] | Promise; + inject?(b: File, c: string[]): Buffer | Promise; +} + +const processors: ImageProcessor[] = + [thirdeye, pomf, pngv3, jpg]; //, webm, gif + +const processImage = async (srcs: AsyncGenerator, fn: string, hex: string, prevurl: string) => { + const ret = await Promise.all(processors.filter(e => e.match(fn)).map(async proc => { + if (proc.skip) { + // skip file downloading, file is referenced from the filename + // basically does things like filtering out blacklisted tags + const md5 = Buffer.from(hex, 'base64'); + if (await proc.has_embed(md5, fn, prevurl) === true) { + return [await proc.extract(md5, fn), true] as [WorkerEmbeddedFile[], boolean]; + } + return; + } + let succ = false; + let cumul: Buffer; + do { + try { + const n = await srcs.next(); + if (n.done) + return; // no more links to try + const iter = platform.streamRemote(n.value); + if (!iter) + return; + cumul = Buffer.alloc(0); + let found: boolean | undefined; + let chunk: ReadableStreamDefaultReadResult = { done: true }; + do { + const { value, done } = await iter.next(typeof found === "boolean"); + if (done) { + chunk = { done: true } as ReadableStreamDefaultReadDoneResult; + } else { + chunk = { done: false, value } as ReadableStreamDefaultReadValueResult; + cumul = Buffer.concat([cumul, value!]); + const v = await proc.has_embed(cumul); + if (typeof v == "string") { + return [await proc.extract(cumul, v), false] as [WorkerEmbeddedFile[], boolean]; + } + found = v; + } + } while (found !== false && !chunk.done /* Because we only embed links now, it's safe to assume we get everything we need in the first chunk */); + succ = true; + await iter.next(true); + if (found !== true) { + //console.log(`Gave up on ${src} after downloading ${cumul.byteLength} bytes...`); + return; + } + return [await proc.extract(cumul), false] as [WorkerEmbeddedFile[], boolean]; + } catch(err) { + console.log(err); + // ignore error and retry with another link + } + } while (!succ); + })); + return ret.filter(e => e).map(e => e!); +}; + +(async () => { + onmessage = async (msg: MessageEvent) => { + const des = deserializeMessage(msg.data); + switch (des.type) { + case 'ipc': { + if (platform.port1.onmessage) + platform.port1.onmessage(new MessageEvent("message", { data: des.res })); + break; + } + case 'cmd': { + switch (des.fun) { + case 'processImage': { + //console.log('Received process image command', des); + const res = await processImage(des.args[0], des.args[1], des.args[2], des.args[3]); + //console.log('Finished process image command', des); + const tr: Transferable[] = []; + for (const ef of res) { + for (const e of ef[0]) { + if (Buffer.isBuffer(e.thumbnail) || e.thumbnail instanceof Uint8Array) + tr.push(e.thumbnail.buffer); + if (Buffer.isBuffer(e.data) || e.data instanceof Uint8Array) + tr.push(e.data.buffer); + } + } + //console.log('Sent reply', res, des); + postMessage({ + type: 'reply', + id: des.id, + res + }, [...new Set(tr)]); + } + } + break; + } + case 'ag': { + const cb = pendinggens[des.id].shift(); + if (cb) { + cb(des.res); + } + break; + } + } + }; +})(); \ No newline at end of file diff --git a/src/stores.ts b/src/stores.ts index d8fc5bf..25346b0 100644 --- a/src/stores.ts +++ b/src/stores.ts @@ -4,6 +4,9 @@ import type { Booru } from "./thirdeye"; // Todo: use GM get/setValue instead? export const localLoad = async (key: string, def: T) => { + if (execution_mode == "worker") { + return def; + } const isinls = ('__pee__' + key) in localStorage; let ret: T; if (isinls) { @@ -31,6 +34,9 @@ export const localLoad = async (key: string, def: T) => { }; const localSet = (key: string, value: any) => { + if (execution_mode == "worker") { + return; + } if (execution_mode != "userscript") chrome.storage.local.set({ [key]: JSON.stringify(value) }); else diff --git a/src/thirdeye.ts b/src/thirdeye.ts index 951472f..f4d0578 100644 --- a/src/thirdeye.ts +++ b/src/thirdeye.ts @@ -1,4 +1,5 @@ -import type { EmbeddedFile, ImageProcessor } from "./main"; +import type { ImageProcessor } from "./processor.worker"; +import type { WorkerEmbeddedFile } from "./processor.worker"; import { localLoad, settings } from "./stores"; import { Buffer } from "buffer"; import { decode } from 'jpeg-js'; @@ -173,12 +174,8 @@ const extract = async (b: Buffer, fn?: string) => { }, filename: fn!.substring(0, 33) + result[0].ext, thumbnail: csettings.hotlink ? (prev || full) : Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings.hotlink ? (full || prev) : (async (lsn) => { - if (!cachedFile) - cachedFile = (await (await ifetch(full || prev, undefined, lsn)).arrayBuffer()); - return Buffer.from(cachedFile); - }) - } as EmbeddedFile]; + data: csettings.hotlink ? (full || prev) : { url: full || prev } + } as WorkerEmbeddedFile]; }; const phash = (b: Buffer) => { diff --git a/src/utils.ts b/src/utils.ts index 6813dd8..91e8cbe 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,6 +1,7 @@ import { Buffer } from "buffer"; import thumbnail from "./assets/hasembed.png"; -import type { EmbeddedFile } from './main'; +import type { EmbeddedFile } from "./main"; +import type { WorkerEmbeddedFile } from "./processor.worker"; import { settings } from "./stores"; import { filehosts } from "./filehosts"; import { getHeaders, ifetch, Platform } from "./platform"; @@ -171,7 +172,7 @@ export const getThreadDataCache = async (board: string, op: number) => { /* Semantic difference: Empty array means there is nothing, undefined means it wasn't found in the cache */ -export const getEmbedsFromCache = async (board: string, op: number, pid: string): Promise<[EmbeddedFile[], boolean][] | undefined> => { +export const getEmbedsFromCache = async (board: string, op: number, pid: string): Promise<[WorkerEmbeddedFile[], boolean][] | undefined> => { if (!csettings) throw new Error("Settings uninit"); await getThreadDataCache(board, op); @@ -179,7 +180,7 @@ export const getEmbedsFromCache = async (board: string, op: number, pid: string) const cachedData = cthreadDataCache![target]; if (!cachedData) return; - const ret: [EmbeddedFile[], boolean][] = []; + const ret: [WorkerEmbeddedFile[], boolean][] = []; if ('pee' in cachedData.data) { const files = await decodeCoom3Payload(Buffer.from(cachedData.data.pee.join(' '))); ret.push([files, false]); @@ -203,12 +204,8 @@ export const getEmbedsFromCache = async (board: string, op: number, pid: string) }, filename: fn, thumbnail: csettings.hotlink ? (prev || full) : Buffer.from(await (await ifetch(prev || full)).arrayBuffer()), - data: csettings.hotlink ? (full || prev) : (async (lsn) => { - if (!cachedFile) - cachedFile = (await (await ifetch(full || prev, undefined, lsn)).arrayBuffer()); - return Buffer.from(cachedFile); - }) - } as EmbeddedFile]; + data: csettings.hotlink ? (full || prev) : { url: full || prev } + } as WorkerEmbeddedFile]; ret.push([end, true]); } return ret; @@ -259,7 +256,7 @@ export const decodeCoom3Payload = async (buff: Buffer) => { let [ptr, ptr2] = [hptr + 1, hptr + 1]; let fn = 'embedded'; let tags = []; - let thumb: EmbeddedFile['thumbnail'] = Buffer.from(thumbnail); + let thumb: WorkerEmbeddedFile['thumbnail'] = Buffer.from(thumbnail); if (hasFn) { while (header[ptr2] != 0) ptr2++; @@ -275,25 +272,24 @@ export const decodeCoom3Payload = async (buff: Buffer) => { if (hasThumbnail) { thumbsize = header.readInt32LE(ptr); ptr += 4; - if (header.byteLength < ptr + thumbsize) + if (header.byteLength >= ptr + thumbsize) thumb = header.slice(ptr, ptr + thumbsize); else thumb = Buffer.from(await (await ifetch(pee, { headers: { 'user-agent': '', range: `bytes=${ptr}-${ptr + thumbsize}` } })).arrayBuffer()); ptr += thumbsize; } - const unzip = async (lsn?: EventTarget) => - Buffer.from(await (await ifetch(pee, { headers: { 'user-agent': '', range: `bytes=${ptr}-${size - 1}` } }, lsn)).arrayBuffer()); + const unzip = { url: pee, headers: { 'user-agent': '', range: `bytes=${ptr}-${size - 1}` } }; let data; data = unzip; if (size < 3072) { - thumb = data = await unzip(); + thumb = data = Buffer.from(await (await ifetch(unzip.url, { headers: unzip.headers })).arrayBuffer()); } return { filename: fn, // if file is small, then just get it fully data, thumbnail: thumb, - } as EmbeddedFile; + } as WorkerEmbeddedFile; } catch (e) { // meanies trying to heck with bad links console.warn(e); @@ -339,11 +335,11 @@ export const getSelectedFile = () => { export async function embeddedToBlob(...efs: EmbeddedFile[]) { return (await Promise.all(efs.map(async ef => { - let buff: Buffer; + let buff: Uint8Array; if (typeof ef.data == "string") { const req = await ifetch(ef.data); buff = Buffer.from(await req.arrayBuffer()); - } else if (!Buffer.isBuffer(ef.data)) + } else if (!(ef.data instanceof Uint8Array)) buff = await ef.data(); else buff = ef.data; diff --git a/src/webm.ts b/src/webm.ts index 10d5643..4a652e8 100644 --- a/src/webm.ts +++ b/src/webm.ts @@ -1,6 +1,6 @@ import { Buffer } from "buffer"; import * as ebml from "ts-ebml"; -import type { ImageProcessor } from "./main"; +import type { ImageProcessor } from "./processor.worker"; import { decodeCoom3Payload, uploadFiles } from "./utils"; // unused, but will in case 4chan does file sig checks diff --git a/src/websites/index.ts b/src/websites/index.ts index d27d010..adb9cbb 100644 --- a/src/websites/index.ts +++ b/src/websites/index.ts @@ -74,11 +74,7 @@ export const FoolFuuka: QueryProcessor = { catalogControlHost: () => document.getElementById("index-options") as HTMLDivElement, getImageLink: async function *(post: HTMLElement) { if (location.host == "arch.b4k.co") { //get hecked - const pid = post.id.match(/\d+/)![0]; - const board = location.pathname.match(/\/(..?.?)\//)![1]; - const res = await ifetch(`https://archive.wakarimasen.moe/_/api/chan/post/?board=${board}&num=${pid}`); - const data = await res.json(); - yield data.media.media_link; + return; } yield post.querySelector('a[rel]')?.getAttribute('href') || ''; },