lakutata
Version:
An IoC-based universal application framework.
2,069 lines (1,693 loc) • 281 kB
JavaScript
/* Build Date: Mon Jan 05 2026 23:52:23 GMT+0800 (China Standard Time) */
import { _ as e, a as t } from "../../../vendor/Package.internal.3.mjs";
import { Component as n } from "../../lib/core/Component.mjs";
import { Singleton as i } from "../../decorators/di/Lifetime.mjs";
import { DockerImage as r } from "./lib/DockerImage.mjs";
import { DockerContainer as s } from "./lib/DockerContainer.mjs";
import { platform as a } from "os";
import { Configurable as o } from "../../decorators/di/Configurable.mjs";
import { D as u } from "../../../vendor/Package.internal.7.mjs";
import { D as c, a as l } from "../../../vendor/Package.internal.56.mjs";
import { DockerConnectionException as f } from "./exceptions/DockerConnectionException.mjs";
import { DockerImageNotFoundException as h } from "./exceptions/DockerImageNotFoundException.mjs";
import { ImagePullOptions as d } from "./options/image/ImagePullOptions.mjs";
import { Accept as g } from "../../decorators/dto/Accept.mjs";
import { createInterface as p } from "node:readline";
import { DockerImagePullException as m } from "./exceptions/DockerImagePullException.mjs";
import { IsAbortError as b } from "../../lib/helpers/IsAbortError.mjs";
import { ImageBuildOptions as _ } from "./options/image/ImageBuildOptions.mjs";
import { DockerImageBuildException as y } from "./exceptions/DockerImageBuildException.mjs";
import { ImageImportOptions as v } from "./options/image/ImageImportOptions.mjs";
import { DockerImageImportException as A } from "./exceptions/DockerImageImportException.mjs";
import { c as w, a as k, g as x } from "../../../vendor/Package.internal.2.mjs";
import S from "events";
import { createReadStream as R } from "node:fs";
import { PassThrough as I } from "node:stream";
import { NetworkCreateOptions as P } from "./options/network/NetworkCreateOptions.mjs";
import { As as C } from "../../lib/helpers/As.mjs";
import { Time as O } from "../../lib/core/Time.mjs";
import { DockerNetworkNotFoundException as E } from "./exceptions/DockerNetworkNotFoundException.mjs";
import { ContainerSettingOptions as j } from "./options/container/ContainerSettingOptions.mjs";
import { DockerPruneOptions as T } from "./options/DockerPruneOptions.mjs";
import { DockerAuthOptions as L } from "./options/auth/DockerAuthOptions.mjs";
import { DevNull as N } from "../../lib/helpers/DevNull.mjs";
import { c as D } from "../../../vendor/Package.internal.6.mjs";
import { readFile as F } from "node:fs/promises";
import M from "node:path";
import "../../../vendor/Package.internal.4.mjs";
import "../../lib/base/async-constructor/AsyncConstructor.mjs";
import "../../lib/base/async-constructor/Append.mjs";
import "../../lib/helpers/IsPromiseLike.mjs";
import "../../lib/helpers/IsPromise.mjs";
import "util/types";
import "../../exceptions/MethodNotFoundException.mjs";
import "../../lib/base/abstracts/Exception.mjs";
import "../../../vendor/Package.internal.5.mjs";
import "../../lib/base/internal/ThrowWarning.mjs";
import "../../lib/helpers/Templating.mjs";
import "../../lib/base/internal/CamelCase.mjs";
import "../../lib/helpers/NoCase.mjs";
import "../../lib/ioc/DependencyInjectionContainer.mjs";
import "util";
import "../../lib/ioc/Errors.mjs";
import "../../exceptions/di/DependencyInjectionException.mjs";
import "../../lib/base/internal/ConstructorSymbol.mjs";
import "../../constants/DIMetadataKey.mjs";
import "../../../vendor/Package.internal.1.mjs";
import "node:crypto";
import "../../lib/base/internal/DataValidator.mjs";
import "node:util/types";
import "../../lib/validation/VLD.mjs";
import "url";
import "../../exceptions/dto/InvalidValueException.mjs";
import "../../../vendor/Package.internal.8.mjs";
import "../../lib/helpers/IsHtml.mjs";
import "../../lib/helpers/IsXML.mjs";
import "../../constants/DTOMetadataKey.mjs";
import "../../lib/helpers/ObjectConstructor.mjs";
import "../../lib/helpers/ObjectParentConstructors.mjs";
import "../../lib/helpers/ObjectParentConstructor.mjs";
import "../../lib/helpers/ObjectPrototype.mjs";
import "../../lib/ioc/InjectionMode.mjs";
import "../../lib/ioc/Lifetime.mjs";
import "../../lib/ioc/ListModules.mjs";
import "path";
import "stream";
import "fs";
import "../../lib/ioc/Utils.mjs";
import "../../lib/ioc/FunctionTokenizer.mjs";
import "../../lib/ioc/LoadModules.mjs";
import "../../lib/ioc/Resolvers.mjs";
import "../../lib/ioc/ParamParser.mjs";
import "../../lib/base/internal/ObjectLifetime.mjs";
import "../../exceptions/di/LifetimeLockedException.mjs";
import "../../lib/base/internal/ObjectWeakRefs.mjs";
import "../../lib/base/internal/ConfigurableRecordsInjection.mjs";
import "../../lib/base/internal/ObjectConfiguration.mjs";
import "../../lib/base/internal/ObjectInjection.mjs";
import "../../lib/base/internal/ObjectContainer.mjs";
import "../../decorators/dto/Expect.mjs";
import "../../decorators/dto/IndexSignature.mjs";
import "../../lib/helpers/IsEmptyObject.mjs";
import "../../lib/base/EventEmitter.mjs";
import "../../lib/core/Provider.mjs";
import "../../lib/base/internal/MethodValidation.mjs";
import "../../exceptions/dto/InvalidMethodAcceptException.mjs";
import "../../exceptions/dto/InvalidMethodReturnException.mjs";
import "./options/image/ImageTagOptions.mjs";
import "./options/image/ImageExportOptions.mjs";
import "stream/promises";
import "./exceptions/DockerImageRepoTagNotFoundException.mjs";
import "./options/image/ImageRemoveOptions.mjs";
import "./options/image/ImagePushOptions.mjs";
import "./exceptions/DockerImagePushException.mjs";
import "./lib/ParseRepositoryTag.mjs";
import "./lib/ParseEnvToRecord.mjs";
import "./types/ContainerCapability.mjs";
import "./options/container/ContainerStopOptions.mjs";
import "./options/container/ContainerRemoveOptions.mjs";
import "./options/container/ContainerKillOptions.mjs";
import "../../lib/helpers/UniqueArray.mjs";
import "./options/container/ContainerCommitOptions.mjs";
import "./options/container/ContainerCreateTTYOptions.mjs";
import "./options/container/ContainerTTYConsoleSizeOptions.mjs";
import "./options/container/ContainerLogsOptions.mjs";
import "./options/container/ContainerExecOptions.mjs";
import "./options/container/ContainerExportDirectoryOptions.mjs";
import "querystring";
import "https";
import "http";
import "net";
import "child_process";
import "crypto";
import "assert";
import "buffer";
import "tls";
import "dns";
import "zlib";
import "../../../vendor/Package.internal.52.mjs";
import "tty";
import "constants";
import "../../../vendor/Package.internal.54.mjs";
import "node:os";
import "node:events";
import "node:diagnostics_channel";
import "worker_threads";
import "module";
import "string_decoder";
import "node:worker_threads";
import "process";
import "http2";
import "../../decorators/di/Inject.mjs";
// -- Shims --
import cjsUrl from 'node:url';
import cjsPath from 'node:path';
import cjsModule from 'node:module';
const __filename = cjsUrl.fileURLToPath(import.meta.url);
const __dirname = cjsPath.dirname(__filename);
const require = cjsModule.createRequire(import.meta.url);
var V = {};
var B = S;
var U = class FixedFIFO {
constructor(e) {
if (!(e > 0) || (e - 1 & e) !== 0) throw new Error("Max size for a FixedFIFO should be a power of two");
this.buffer = new Array(e);
this.mask = e - 1;
this.top = 0;
this.btm = 0;
this.next = null;
}
clear() {
this.top = this.btm = 0;
this.next = null;
this.buffer.fill(undefined);
}
push(e) {
if (this.buffer[this.top] !== undefined) return false;
this.buffer[this.top] = e;
this.top = this.top + 1 & this.mask;
return true;
}
shift() {
const e = this.buffer[this.btm];
if (e === undefined) return undefined;
this.buffer[this.btm] = undefined;
this.btm = this.btm + 1 & this.mask;
return e;
}
peek() {
return this.buffer[this.btm];
}
isEmpty() {
return this.buffer[this.btm] === undefined;
}
};
const W = U;
var H = class FastFIFO {
constructor(e) {
this.hwm = e || 16;
this.head = new W(this.hwm);
this.tail = this.head;
this.length = 0;
}
clear() {
this.head = this.tail;
this.head.clear();
this.length = 0;
}
push(e) {
this.length++;
if (!this.head.push(e)) {
const t = this.head;
this.head = t.next = new W(2 * this.head.buffer.length);
this.head.push(e);
}
}
shift() {
if (this.length !== 0) this.length--;
const e = this.tail.shift();
if (e === undefined && this.tail.next) {
const e = this.tail.next;
this.tail.next = null;
this.tail = e;
return this.tail.shift();
}
return e;
}
peek() {
const e = this.tail.peek();
if (e === undefined && this.tail.next) return this.tail.next.peek();
return e;
}
isEmpty() {
return this.length === 0;
}
};
function z(e) {
return Buffer.isBuffer(e) || e instanceof Uint8Array;
}
function K(e) {
return Buffer.isEncoding(e);
}
function q(e, t, n) {
return Buffer.alloc(e, t, n);
}
function $(e) {
return Buffer.allocUnsafe(e);
}
function J(e) {
return Buffer.allocUnsafeSlow(e);
}
function G(e, t) {
return Buffer.byteLength(e, t);
}
function X(e, t) {
return Buffer.compare(e, t);
}
function Y(e, t) {
return Buffer.concat(e, t);
}
function Z(e, t, n, i, r) {
return ue(e).copy(t, n, i, r);
}
function Q(e, t) {
return ue(e).equals(t);
}
function ee(e, t, n, i, r) {
return ue(e).fill(t, n, i, r);
}
function te(e, t, n) {
return Buffer.from(e, t, n);
}
function ne(e, t, n, i) {
return ue(e).includes(t, n, i);
}
function ie(e, t, n, i) {
return ue(e).indexOf(t, n, i);
}
function re(e, t, n, i) {
return ue(e).lastIndexOf(t, n, i);
}
function se(e) {
return ue(e).swap16();
}
function ae(e) {
return ue(e).swap32();
}
function oe(e) {
return ue(e).swap64();
}
function ue(e) {
if (Buffer.isBuffer(e)) return e;
return Buffer.from(e.buffer, e.byteOffset, e.byteLength);
}
function ce(e, t, n, i) {
return ue(e).toString(t, n, i);
}
function le(e, t, n, i, r) {
return ue(e).write(t, n, i, r);
}
function fe(e, t) {
return ue(e).readDoubleBE(t);
}
function he(e, t) {
return ue(e).readDoubleLE(t);
}
function de(e, t) {
return ue(e).readFloatBE(t);
}
function ge(e, t) {
return ue(e).readFloatLE(t);
}
function pe(e, t) {
return ue(e).readInt32BE(t);
}
function me(e, t) {
return ue(e).readInt32LE(t);
}
function be(e, t) {
return ue(e).readUInt32BE(t);
}
function _e(e, t) {
return ue(e).readUInt32LE(t);
}
function ye(e, t, n) {
return ue(e).writeDoubleBE(t, n);
}
function ve(e, t, n) {
return ue(e).writeDoubleLE(t, n);
}
function Ae(e, t, n) {
return ue(e).writeFloatBE(t, n);
}
function we(e, t, n) {
return ue(e).writeFloatLE(t, n);
}
function ke(e, t, n) {
return ue(e).writeInt32BE(t, n);
}
function xe(e, t, n) {
return ue(e).writeInt32LE(t, n);
}
function Se(e, t, n) {
return ue(e).writeUInt32BE(t, n);
}
function Re(e, t, n) {
return ue(e).writeUInt32LE(t, n);
}
var Ie = {
isBuffer: z,
isEncoding: K,
alloc: q,
allocUnsafe: $,
allocUnsafeSlow: J,
byteLength: G,
compare: X,
concat: Y,
copy: Z,
equals: Q,
fill: ee,
from: te,
includes: ne,
indexOf: ie,
lastIndexOf: re,
swap16: se,
swap32: ae,
swap64: oe,
toBuffer: ue,
toString: ce,
write: le,
readDoubleBE: fe,
readDoubleLE: he,
readFloatBE: de,
readFloatLE: ge,
readInt32BE: pe,
readInt32LE: me,
readUInt32BE: be,
readUInt32LE: _e,
writeDoubleBE: ye,
writeDoubleLE: ve,
writeFloatBE: Ae,
writeFloatLE: we,
writeInt32BE: ke,
writeInt32LE: xe,
writeUInt32BE: Se,
writeUInt32LE: Re
};
const Pe = Ie;
var Ce = class PassThroughDecoder {
constructor(e) {
this.encoding = e;
}
get remaining() {
return 0;
}
decode(e) {
return Pe.toString(e, this.encoding);
}
flush() {
return "";
}
};
const Oe = Ie;
var Ee = class UTF8Decoder {
constructor() {
this.codePoint = 0;
this.bytesSeen = 0;
this.bytesNeeded = 0;
this.lowerBoundary = 128;
this.upperBoundary = 191;
}
get remaining() {
return this.bytesSeen;
}
decode(e) {
if (this.bytesNeeded === 0) {
let t = true;
for (let n = Math.max(0, e.byteLength - 4), i = e.byteLength; n < i && t; n++) {
t = e[n] <= 127;
}
if (t) return Oe.toString(e, "utf8");
}
let t = "";
for (let n = 0, i = e.byteLength; n < i; n++) {
const i = e[n];
if (this.bytesNeeded === 0) {
if (i <= 127) {
t += String.fromCharCode(i);
} else {
this.bytesSeen = 1;
if (i >= 194 && i <= 223) {
this.bytesNeeded = 2;
this.codePoint = i & 31;
} else if (i >= 224 && i <= 239) {
if (i === 224) this.lowerBoundary = 160; else if (i === 237) this.upperBoundary = 159;
this.bytesNeeded = 3;
this.codePoint = i & 15;
} else if (i >= 240 && i <= 244) {
if (i === 240) this.lowerBoundary = 144;
if (i === 244) this.upperBoundary = 143;
this.bytesNeeded = 4;
this.codePoint = i & 7;
} else {
t += "�";
}
}
continue;
}
if (i < this.lowerBoundary || i > this.upperBoundary) {
this.codePoint = 0;
this.bytesNeeded = 0;
this.bytesSeen = 0;
this.lowerBoundary = 128;
this.upperBoundary = 191;
t += "�";
continue;
}
this.lowerBoundary = 128;
this.upperBoundary = 191;
this.codePoint = this.codePoint << 6 | i & 63;
this.bytesSeen++;
if (this.bytesSeen !== this.bytesNeeded) continue;
t += String.fromCodePoint(this.codePoint);
this.codePoint = 0;
this.bytesNeeded = 0;
this.bytesSeen = 0;
}
return t;
}
flush() {
const e = this.bytesNeeded > 0 ? "�" : "";
this.codePoint = 0;
this.bytesNeeded = 0;
this.bytesSeen = 0;
this.lowerBoundary = 128;
this.upperBoundary = 191;
return e;
}
};
const je = Ce;
const Te = Ee;
var Le = class TextDecoder {
constructor(e = "utf8") {
this.encoding = Ne(e);
switch (this.encoding) {
case "utf8":
this.decoder = new Te;
break;
case "utf16le":
case "base64":
throw new Error("Unsupported encoding: " + this.encoding);
default:
this.decoder = new je(this.encoding);
}
}
get remaining() {
return this.decoder.remaining;
}
push(e) {
if (typeof e === "string") return e;
return this.decoder.decode(e);
}
write(e) {
return this.push(e);
}
end(e) {
let t = "";
if (e) t = this.push(e);
t += this.decoder.flush();
return t;
}
};
function Ne(e) {
e = e.toLowerCase();
switch (e) {
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 e;
default:
throw new Error("Unknown encoding: " + e);
}
}
const {EventEmitter: De} = B;
const Fe = new Error("Stream was destroyed");
const Me = new Error("Premature close");
const Ve = H;
const Be = Le;
const Ue = typeof queueMicrotask === "undefined" ? e => w.process.nextTick(e) : queueMicrotask;
const We = (1 << 29) - 1;
const He = 1;
const ze = 2;
const Ke = 4;
const qe = 8;
const $e = We ^ He;
const Je = We ^ ze;
const Ge = 1 << 4;
const Xe = 2 << 4;
const Ye = 4 << 4;
const Ze = 8 << 4;
const Qe = 16 << 4;
const et = 32 << 4;
const tt = 64 << 4;
const nt = 128 << 4;
const it = 256 << 4;
const rt = 512 << 4;
const st = 1024 << 4;
const at = 2048 << 4;
const ot = 4096 << 4;
const ut = 8192 << 4;
const ct = Qe | et;
const lt = Ge | ot;
const ft = Ye | Ge;
const ht = it | Ze;
const dt = Qe | ut;
const gt = We ^ Ge;
const pt = We ^ Ye;
const mt = We ^ (Ye | ot);
const bt = We ^ ot;
const _t = We ^ Qe;
const yt = We ^ (Ze | rt);
const vt = We ^ tt;
const At = We ^ ct;
const wt = We ^ at;
const kt = We ^ Xe;
const xt = We ^ ut;
const St = We ^ dt;
const Rt = 1 << 18;
const It = 2 << 18;
const Pt = 4 << 18;
const Ct = 8 << 18;
const Ot = 16 << 18;
const Et = 32 << 18;
const jt = 64 << 18;
const Tt = 128 << 18;
const Lt = 256 << 18;
const Nt = 512 << 18;
const Dt = 1024 << 18;
const Ft = We ^ (Rt | Lt);
const Mt = We ^ Pt;
const Vt = We ^ (Rt | Nt);
const Bt = We ^ Ot;
const Ut = We ^ Ct;
const Wt = We ^ Tt;
const Ht = We ^ It;
const zt = We ^ Dt;
const Kt = Ge | Rt;
const qt = We ^ Kt;
const $t = st | Et;
const Jt = Ke | qe | ze;
const Gt = Jt | He;
const Xt = Jt | $t;
const Yt = Mt & pt;
const Zt = Tt | at;
const Qt = Zt & qt;
const en = Gt | Qt;
const tn = Gt | tt | st;
const nn = Gt | st | Ze;
const rn = Gt | tt | Ze;
const sn = Gt | it | Ze | rt;
const an = Gt | Ge | tt | st | ot | ut;
const on = Jt | tt | st;
const un = Xe | Gt | at | Ye;
const cn = at | He;
const ln = Gt | Nt | Et;
const fn = Ct | Ot;
const hn = Ct | Rt;
const dn = Ct | Ot | Gt | Rt;
const gn = Gt | Rt | Ct | Dt;
const pn = Pt | Rt;
const mn = Rt | Lt;
const bn = Gt | Nt | hn | Et;
const _n = Ot | Jt | Nt | Et;
const yn = It | Gt | Tt | Pt;
const vn = Nt | Et | Jt;
const An = Symbol.asyncIterator || Symbol("asyncIterator");
class WritableState {
constructor(e, {highWaterMark: t = 16384, map: n = null, mapWritable: i, byteLength: r, byteLengthWritable: s} = {}) {
this.stream = e;
this.queue = new Ve;
this.highWaterMark = t;
this.buffered = 0;
this.error = null;
this.pipeline = null;
this.drains = null;
this.byteLength = s || r || $n;
this.map = i || n;
this.afterWrite = Sn.bind(this);
this.afterUpdateNextTick = Pn.bind(this);
}
get ended() {
return (this.stream._duplexState & Et) !== 0;
}
push(e) {
if ((this.stream._duplexState & vn) !== 0) return false;
if (this.map !== null) e = this.map(e);
this.buffered += this.byteLength(e);
this.queue.push(e);
if (this.buffered < this.highWaterMark) {
this.stream._duplexState |= Ct;
return true;
}
this.stream._duplexState |= fn;
return false;
}
shift() {
const e = this.queue.shift();
this.buffered -= this.byteLength(e);
if (this.buffered === 0) this.stream._duplexState &= Ut;
return e;
}
end(e) {
if (typeof e === "function") this.stream.once("finish", e); else if (e !== undefined && e !== null) this.push(e);
this.stream._duplexState = (this.stream._duplexState | Nt) & Mt;
}
autoBatch(e, t) {
const n = [];
const i = this.stream;
n.push(e);
while ((i._duplexState & gn) === hn) {
n.push(i._writableState.shift());
}
if ((i._duplexState & Gt) !== 0) return t(null);
i._writev(n, t);
}
update() {
const e = this.stream;
e._duplexState |= It;
do {
while ((e._duplexState & gn) === Ct) {
const t = this.shift();
e._duplexState |= mn;
e._write(t, this.afterWrite);
}
if ((e._duplexState & pn) === 0) this.updateNonPrimary();
} while (this.continueUpdate() === true);
e._duplexState &= Ht;
}
updateNonPrimary() {
const e = this.stream;
if ((e._duplexState & bn) === Nt) {
e._duplexState = e._duplexState | Rt;
e._final(kn.bind(this));
return;
}
if ((e._duplexState & Jt) === Ke) {
if ((e._duplexState & Zt) === 0) {
e._duplexState |= Kt;
e._destroy(xn.bind(this));
}
return;
}
if ((e._duplexState & en) === He) {
e._duplexState = (e._duplexState | Kt) & $e;
e._open(On.bind(this));
}
}
continueUpdate() {
if ((this.stream._duplexState & Tt) === 0) return false;
this.stream._duplexState &= Wt;
return true;
}
updateCallback() {
if ((this.stream._duplexState & yn) === Pt) this.update(); else this.updateNextTick();
}
updateNextTick() {
if ((this.stream._duplexState & Tt) !== 0) return;
this.stream._duplexState |= Tt;
if ((this.stream._duplexState & It) === 0) Ue(this.afterUpdateNextTick);
}
}
class ReadableState {
constructor(e, {highWaterMark: t = 16384, map: n = null, mapReadable: i, byteLength: r, byteLengthReadable: s} = {}) {
this.stream = e;
this.queue = new Ve;
this.highWaterMark = t === 0 ? 1 : t;
this.buffered = 0;
this.readAhead = t > 0;
this.error = null;
this.pipeline = null;
this.byteLength = s || r || $n;
this.map = i || n;
this.pipeTo = null;
this.afterRead = Rn.bind(this);
this.afterUpdateNextTick = In.bind(this);
}
get ended() {
return (this.stream._duplexState & st) !== 0;
}
pipe(e, t) {
if (this.pipeTo !== null) throw new Error("Can only pipe to one destination");
if (typeof t !== "function") t = null;
this.stream._duplexState |= et;
this.pipeTo = e;
this.pipeline = new Pipeline(this.stream, e, t);
if (t) this.stream.on("error", Jn);
if (Bn(e)) {
e._writableState.pipeline = this.pipeline;
if (t) e.on("error", Jn);
e.on("finish", this.pipeline.finished.bind(this.pipeline));
} else {
const t = this.pipeline.done.bind(this.pipeline, e);
const n = this.pipeline.done.bind(this.pipeline, e, null);
e.on("error", t);
e.on("close", n);
e.on("finish", this.pipeline.finished.bind(this.pipeline));
}
e.on("drain", wn.bind(this));
this.stream.emit("piping", e);
e.emit("pipe", this.stream);
}
push(e) {
const t = this.stream;
if (e === null) {
this.highWaterMark = 0;
t._duplexState = (t._duplexState | tt) & mt;
return false;
}
if (this.map !== null) {
e = this.map(e);
if (e === null) {
t._duplexState &= bt;
return this.buffered < this.highWaterMark;
}
}
this.buffered += this.byteLength(e);
this.queue.push(e);
t._duplexState = (t._duplexState | Ze) & bt;
return this.buffered < this.highWaterMark;
}
shift() {
const e = this.queue.shift();
this.buffered -= this.byteLength(e);
if (this.buffered === 0) this.stream._duplexState &= yt;
return e;
}
unshift(e) {
const t = [ this.map !== null ? this.map(e) : e ];
while (this.buffered > 0) t.push(this.shift());
for (let e = 0; e < t.length - 1; e++) {
const n = t[e];
this.buffered += this.byteLength(n);
this.queue.push(n);
}
this.push(t[t.length - 1]);
}
read() {
const e = this.stream;
if ((e._duplexState & nn) === Ze) {
const t = this.shift();
if (this.pipeTo !== null && this.pipeTo.write(t) === false) e._duplexState &= At;
if ((e._duplexState & nt) !== 0) e.emit("data", t);
return t;
}
if (this.readAhead === false) {
e._duplexState |= ut;
this.updateNextTick();
}
return null;
}
drain() {
const e = this.stream;
while ((e._duplexState & nn) === Ze && (e._duplexState & ct) !== 0) {
const t = this.shift();
if (this.pipeTo !== null && this.pipeTo.write(t) === false) e._duplexState &= At;
if ((e._duplexState & nt) !== 0) e.emit("data", t);
}
}
update() {
const e = this.stream;
e._duplexState |= Xe;
do {
this.drain();
while (this.buffered < this.highWaterMark && (e._duplexState & an) === ut) {
e._duplexState |= lt;
e._read(this.afterRead);
this.drain();
}
if ((e._duplexState & sn) === ht) {
e._duplexState |= rt;
e.emit("readable");
}
if ((e._duplexState & ft) === 0) this.updateNonPrimary();
} while (this.continueUpdate() === true);
e._duplexState &= kt;
}
updateNonPrimary() {
const e = this.stream;
if ((e._duplexState & rn) === tt) {
e._duplexState = (e._duplexState | st) & vt;
e.emit("end");
if ((e._duplexState & Xt) === $t) e._duplexState |= Ke;
if (this.pipeTo !== null) this.pipeTo.end();
}
if ((e._duplexState & Jt) === Ke) {
if ((e._duplexState & Zt) === 0) {
e._duplexState |= Kt;
e._destroy(xn.bind(this));
}
return;
}
if ((e._duplexState & en) === He) {
e._duplexState = (e._duplexState | Kt) & $e;
e._open(On.bind(this));
}
}
continueUpdate() {
if ((this.stream._duplexState & at) === 0) return false;
this.stream._duplexState &= wt;
return true;
}
updateCallback() {
if ((this.stream._duplexState & un) === Ye) this.update(); else this.updateNextTick();
}
updateNextTickIfOpen() {
if ((this.stream._duplexState & cn) !== 0) return;
this.stream._duplexState |= at;
if ((this.stream._duplexState & Xe) === 0) Ue(this.afterUpdateNextTick);
}
updateNextTick() {
if ((this.stream._duplexState & at) !== 0) return;
this.stream._duplexState |= at;
if ((this.stream._duplexState & Xe) === 0) Ue(this.afterUpdateNextTick);
}
}
class TransformState {
constructor(e) {
this.data = null;
this.afterTransform = En.bind(e);
this.afterFinal = null;
}
}
class Pipeline {
constructor(e, t, n) {
this.from = e;
this.to = t;
this.afterPipe = n;
this.error = null;
this.pipeToFinished = false;
}
finished() {
this.pipeToFinished = true;
}
done(e, t) {
if (t) this.error = t;
if (e === this.to) {
this.to = null;
if (this.from !== null) {
if ((this.from._duplexState & st) === 0 || !this.pipeToFinished) {
this.from.destroy(this.error || new Error("Writable stream closed prematurely"));
}
return;
}
}
if (e === this.from) {
this.from = null;
if (this.to !== null) {
if ((e._duplexState & st) === 0) {
this.to.destroy(this.error || new Error("Readable stream closed before ending"));
}
return;
}
}
if (this.afterPipe !== null) this.afterPipe(this.error);
this.to = this.from = this.afterPipe = null;
}
}
function wn() {
this.stream._duplexState |= et;
this.updateCallback();
}
function kn(e) {
const t = this.stream;
if (e) t.destroy(e);
if ((t._duplexState & Jt) === 0) {
t._duplexState |= Et;
t.emit("finish");
}
if ((t._duplexState & Xt) === $t) {
t._duplexState |= Ke;
}
t._duplexState &= Vt;
if ((t._duplexState & It) === 0) this.update(); else this.updateNextTick();
}
function xn(e) {
const t = this.stream;
if (!e && this.error !== Fe) e = this.error;
if (e) t.emit("error", e);
t._duplexState |= qe;
t.emit("close");
const n = t._readableState;
const i = t._writableState;
if (n !== null && n.pipeline !== null) n.pipeline.done(t, e);
if (i !== null) {
while (i.drains !== null && i.drains.length > 0) i.drains.shift().resolve(false);
if (i.pipeline !== null) i.pipeline.done(t, e);
}
}
function Sn(e) {
const t = this.stream;
if (e) t.destroy(e);
t._duplexState &= Ft;
if (this.drains !== null) Cn(this.drains);
if ((t._duplexState & dn) === Ot) {
t._duplexState &= Bt;
if ((t._duplexState & jt) === jt) {
t.emit("drain");
}
}
this.updateCallback();
}
function Rn(e) {
if (e) this.stream.destroy(e);
this.stream._duplexState &= gt;
if (this.readAhead === false && (this.stream._duplexState & Qe) === 0) this.stream._duplexState &= xt;
this.updateCallback();
}
function In() {
if ((this.stream._duplexState & Xe) === 0) {
this.stream._duplexState &= wt;
this.update();
}
}
function Pn() {
if ((this.stream._duplexState & It) === 0) {
this.stream._duplexState &= Wt;
this.update();
}
}
function Cn(e) {
for (let t = 0; t < e.length; t++) {
if (--e[t].writes === 0) {
e.shift().resolve(true);
t--;
}
}
}
function On(e) {
const t = this.stream;
if (e) t.destroy(e);
if ((t._duplexState & Ke) === 0) {
if ((t._duplexState & tn) === 0) t._duplexState |= Ye;
if ((t._duplexState & ln) === 0) t._duplexState |= Pt;
t.emit("open");
}
t._duplexState &= qt;
if (t._writableState !== null) {
t._writableState.updateCallback();
}
if (t._readableState !== null) {
t._readableState.updateCallback();
}
}
function En(e, t) {
if (t !== undefined && t !== null) this.push(t);
this._writableState.afterWrite(e);
}
function jn(e) {
if (this._readableState !== null) {
if (e === "data") {
this._duplexState |= nt | dt;
this._readableState.updateNextTick();
}
if (e === "readable") {
this._duplexState |= it;
this._readableState.updateNextTick();
}
}
if (this._writableState !== null) {
if (e === "drain") {
this._duplexState |= jt;
this._writableState.updateNextTick();
}
}
}
class Stream extends De {
constructor(e) {
super();
this._duplexState = 0;
this._readableState = null;
this._writableState = null;
if (e) {
if (e.open) this._open = e.open;
if (e.destroy) this._destroy = e.destroy;
if (e.predestroy) this._predestroy = e.predestroy;
if (e.signal) {
e.signal.addEventListener("abort", Gn.bind(this));
}
}
this.on("newListener", jn);
}
_open(e) {
e(null);
}
_destroy(e) {
e(null);
}
_predestroy() {}
get readable() {
return this._readableState !== null ? true : undefined;
}
get writable() {
return this._writableState !== null ? true : undefined;
}
get destroyed() {
return (this._duplexState & qe) !== 0;
}
get destroying() {
return (this._duplexState & Jt) !== 0;
}
destroy(e) {
if ((this._duplexState & Jt) === 0) {
if (!e) e = Fe;
this._duplexState = (this._duplexState | Ke) & Yt;
if (this._readableState !== null) {
this._readableState.highWaterMark = 0;
this._readableState.error = e;
}
if (this._writableState !== null) {
this._writableState.highWaterMark = 0;
this._writableState.error = e;
}
this._duplexState |= ze;
this._predestroy();
this._duplexState &= Je;
if (this._readableState !== null) this._readableState.updateNextTick();
if (this._writableState !== null) this._writableState.updateNextTick();
}
}
}
let Tn = class Readable extends Stream {
constructor(e) {
super(e);
this._duplexState |= He | Et | ut;
this._readableState = new ReadableState(this, e);
if (e) {
if (this._readableState.readAhead === false) this._duplexState &= xt;
if (e.read) this._read = e.read;
if (e.eagerOpen) this._readableState.updateNextTick();
if (e.encoding) this.setEncoding(e.encoding);
}
}
setEncoding(e) {
const t = new Be(e);
const n = this._readableState.map || Mn;
this._readableState.map = i;
return this;
function i(e) {
const i = t.push(e);
return i === "" && (e.byteLength !== 0 || t.remaining > 0) ? null : n(i);
}
}
_read(e) {
e(null);
}
pipe(e, t) {
this._readableState.updateNextTick();
this._readableState.pipe(e, t);
return e;
}
read() {
this._readableState.updateNextTick();
return this._readableState.read();
}
push(e) {
this._readableState.updateNextTickIfOpen();
return this._readableState.push(e);
}
unshift(e) {
this._readableState.updateNextTickIfOpen();
return this._readableState.unshift(e);
}
resume() {
this._duplexState |= dt;
this._readableState.updateNextTick();
return this;
}
pause() {
this._duplexState &= this._readableState.readAhead === false ? St : _t;
return this;
}
static _fromAsyncIterator(e, t) {
let n;
const i = new Readable({
...t,
read(t) {
e.next().then(r).then(t.bind(null, null)).catch(t);
},
predestroy() {
n = e.return();
},
destroy(e) {
if (!n) return e(null);
n.then(e.bind(null, null)).catch(e);
}
});
return i;
function r(e) {
if (e.done) i.push(null); else i.push(e.value);
}
}
static from(e, t) {
if (zn(e)) return e;
if (e[An]) return this._fromAsyncIterator(e[An](), t);
if (!Array.isArray(e)) e = e === undefined ? [] : [ e ];
let n = 0;
return new Readable({
...t,
read(t) {
this.push(n === e.length ? null : e[n++]);
t(null);
}
});
}
static isBackpressured(e) {
return (e._duplexState & on) !== 0 || e._readableState.buffered >= e._readableState.highWaterMark;
}
static isPaused(e) {
return (e._duplexState & Qe) === 0;
}
[An]() {
const e = this;
let t = null;
let n = null;
let i = null;
this.on("error", e => {
t = e;
});
this.on("readable", r);
this.on("close", s);
return {
[An]() {
return this;
},
next() {
return new Promise(function(t, r) {
n = t;
i = r;
const s = e.read();
if (s !== null) a(s); else if ((e._duplexState & qe) !== 0) a(null);
});
},
return() {
return o(null);
},
throw(e) {
return o(e);
}
};
function r() {
if (n !== null) a(e.read());
}
function s() {
if (n !== null) a(null);
}
function a(r) {
if (i === null) return;
if (t) i(t); else if (r === null && (e._duplexState & st) === 0) i(Fe); else n({
value: r,
done: r === null
});
i = n = null;
}
function o(t) {
e.destroy(t);
return new Promise((n, i) => {
if (e._duplexState & qe) return n({
value: undefined,
done: true
});
e.once("close", function() {
if (t) i(t); else n({
value: undefined,
done: true
});
});
});
}
}
};
let Ln = class Writable extends Stream {
constructor(e) {
super(e);
this._duplexState |= He | st;
this._writableState = new WritableState(this, e);
if (e) {
if (e.writev) this._writev = e.writev;
if (e.write) this._write = e.write;
if (e.final) this._final = e.final;
if (e.eagerOpen) this._writableState.updateNextTick();
}
}
cork() {
this._duplexState |= Dt;
}
uncork() {
this._duplexState &= zt;
this._writableState.updateNextTick();
}
_writev(e, t) {
t(null);
}
_write(e, t) {
this._writableState.autoBatch(e, t);
}
_final(e) {
e(null);
}
static isBackpressured(e) {
return (e._duplexState & _n) !== 0;
}
static drained(e) {
if (e.destroyed) return Promise.resolve(false);
const t = e._writableState;
const n = Xn(e) ? Math.min(1, t.queue.length) : t.queue.length;
const i = n + (e._duplexState & Lt ? 1 : 0);
if (i === 0) return Promise.resolve(true);
if (t.drains === null) t.drains = [];
return new Promise(e => {
t.drains.push({
writes: i,
resolve: e
});
});
}
write(e) {
this._writableState.updateNextTick();
return this._writableState.push(e);
}
end(e) {
this._writableState.updateNextTick();
this._writableState.end(e);
return this;
}
};
class Duplex extends Tn {
constructor(e) {
super(e);
this._duplexState = He | this._duplexState & ut;
this._writableState = new WritableState(this, e);
if (e) {
if (e.writev) this._writev = e.writev;
if (e.write) this._write = e.write;
if (e.final) this._final = e.final;
}
}
cork() {
this._duplexState |= Dt;
}
uncork() {
this._duplexState &= zt;
this._writableState.updateNextTick();
}
_writev(e, t) {
t(null);
}
_write(e, t) {
this._writableState.autoBatch(e, t);
}
_final(e) {
e(null);
}
write(e) {
this._writableState.updateNextTick();
return this._writableState.push(e);
}
end(e) {
this._writableState.updateNextTick();
this._writableState.end(e);
return this;
}
}
class Transform extends Duplex {
constructor(e) {
super(e);
this._transformState = new TransformState(this);
if (e) {
if (e.transform) this._transform = e.transform;
if (e.flush) this._flush = e.flush;
}
}
_write(e, t) {
if (this._readableState.buffered >= this._readableState.highWaterMark) {
this._transformState.data = e;
} else {
this._transform(e, this._transformState.afterTransform);
}
}
_read(e) {
if (this._transformState.data !== null) {
const t = this._transformState.data;
this._transformState.data = null;
e(null);
this._transform(t, this._transformState.afterTransform);
} else {
e(null);
}
}
destroy(e) {
super.destroy(e);
if (this._transformState.data !== null) {
this._transformState.data = null;
this._transformState.afterTransform();
}
}
_transform(e, t) {
t(null, e);
}
_flush(e) {
e(null);
}
_final(e) {
this._transformState.afterFinal = e;
this._flush(Nn.bind(this));
}
}
class PassThrough extends Transform {}
function Nn(e, t) {
const n = this._transformState.afterFinal;
if (e) return n(e);
if (t !== null && t !== undefined) this.push(t);
this.push(null);
n(null);
}
function Dn(...e) {
return new Promise((t, n) => Fn(...e, e => {
if (e) return n(e);
t();
}));
}
function Fn(e, ...t) {
const n = Array.isArray(e) ? [ ...e, ...t ] : [ e, ...t ];
const i = n.length && typeof n[n.length - 1] === "function" ? n.pop() : null;
if (n.length < 2) throw new Error("Pipeline requires at least 2 streams");
let r = n[0];
let s = null;
let a = null;
for (let e = 1; e < n.length; e++) {
s = n[e];
if (Bn(r)) {
r.pipe(s, u);
} else {
o(r, true, e > 1, u);
r.pipe(s);
}
r = s;
}
if (i) {
let e = false;
const t = Bn(s) || !!(s._writableState && s._writableState.autoDestroy);
s.on("error", e => {
if (a === null) a = e;
});
s.on("finish", () => {
e = true;
if (!t) i(a);
});
if (t) {
s.on("close", () => i(a || (e ? null : Me)));
}
}
return s;
function o(e, t, n, i) {
e.on("error", i);
e.on("close", r);
function r() {
if (e._readableState && !e._readableState.ended) return i(Me);
if (n && e._writableState && !e._writableState.ended) return i(Me);
}
}
function u(e) {
if (!e || a) return;
a = e;
for (const t of n) {
t.destroy(e);
}
}
}
function Mn(e) {
return e;
}
function Vn(e) {
return !!e._readableState || !!e._writableState;
}
function Bn(e) {
return typeof e._duplexState === "number" && Vn(e);
}
function Un(e) {
return !!e._readableState && e._readableState.ended;
}
function Wn(e) {
return !!e._writableState && e._writableState.ended;
}
function Hn(e, t = {}) {
const n = e._readableState && e._readableState.error || e._writableState && e._writableState.error;
return !t.all && n === Fe ? null : n;
}
function zn(e) {
return Bn(e) && e.readable;
}
function Kn(e) {
return (e._duplexState & He) !== He || (e._duplexState & Zt) !== 0;
}
function qn(e) {
return typeof e === "object" && e !== null && typeof e.byteLength === "number";
}
function $n(e) {
return qn(e) ? e.byteLength : 1024;
}
function Jn() {}
function Gn() {
this.destroy(new Error("Stream aborted."));
}
function Xn(e) {
return e._writev !== Ln.prototype._writev && e._writev !== Duplex.prototype._writev;
}
var Yn = {
pipeline: Fn,
pipelinePromise: Dn,
isStream: Vn,
isStreamx: Bn,
isEnded: Un,
isFinished: Wn,
isDisturbed: Kn,
getStreamError: Hn,
Stream: Stream,
Writable: Ln,
Readable: Tn,
Duplex: Duplex,
Transform: Transform,
PassThrough: PassThrough
};
var Zn = {};
const Qn = Ie;
const ei = "0000000000000000000";
const ti = "7777777777777777777";
const ni = "0".charCodeAt(0);
const ii = Qn.from([ 117, 115, 116, 97, 114, 0 ]);
const ri = Qn.from([ ni, ni ]);
const si = Qn.from([ 117, 115, 116, 97, 114, 32 ]);
const ai = Qn.from([ 32, 0 ]);
const oi = 4095;
const ui = 257;
const ci = 263;
Zn.decodeLongPath = function e(t, n) {
return wi(t, 0, t.length, n);
};
Zn.encodePax = function e(t) {
let n = "";
if (t.name) n += ki(" path=" + t.name + "\n");
if (t.linkname) n += ki(" linkpath=" + t.linkname + "\n");
const i = t.pax;
if (i) {
for (const e in i) {
n += ki(" " + e + "=" + i[e] + "\n");
}
}
return Qn.from(n);
};
Zn.decodePax = function e(t) {
const n = {};
while (t.length) {
let e = 0;
while (e < t.length && t[e] !== 32) e++;
const i = parseInt(Qn.toString(t.subarray(0, e)), 10);
if (!i) return n;
const r = Qn.toString(t.subarray(e + 1, i - 1));
const s = r.indexOf("=");
if (s === -1) return n;
n[r.slice(0, s)] = r.slice(s + 1);
t = t.subarray(i);
}
return n;
};
Zn.encode = function e(t) {
const n = Qn.alloc(512);
let i = t.name;
let r = "";
if (t.typeflag === 5 && i[i.length - 1] !== "/") i += "/";
if (Qn.byteLength(i) !== i.length) return null;
while (Qn.byteLength(i) > 100) {
const e = i.indexOf("/");
if (e === -1) return null;
r += r ? "/" + i.slice(0, e) : i.slice(0, e);
i = i.slice(e + 1);
}
if (Qn.byteLength(i) > 100 || Qn.byteLength(r) > 155) return null;
if (t.linkname && Qn.byteLength(t.linkname) > 100) return null;
Qn.write(n, i);
Qn.write(n, bi(t.mode & oi, 6), 100);
Qn.write(n, bi(t.uid, 6), 108);
Qn.write(n, bi(t.gid, 6), 116);
yi(t.size, n, 124);
Qn.write(n, bi(t.mtime.getTime() / 1e3 | 0, 11), 136);
n[156] = ni + gi(t.type);
if (t.linkname) Qn.write(n, t.linkname, 157);
Qn.copy(ii, n, ui);
Qn.copy(ri, n, ci);
if (t.uname) Qn.write(n, t.uname, 265);
if (t.gname) Qn.write(n, t.gname, 297);
Qn.write(n, bi(t.devmajor || 0, 6), 329);
Qn.write(n, bi(t.devminor || 0, 6), 337);
if (r) Qn.write(n, r, 345);
Qn.write(n, bi(mi(n), 6), 148);
return n;
};
Zn.decode = function e(t, n, i) {
let r = t[156] === 0 ? 0 : t[156] - ni;
let s = wi(t, 0, 100, n);
const a = Ai(t, 100, 8);
const o = Ai(t, 108, 8);
const u = Ai(t, 116, 8);
const c = Ai(t, 124, 12);
const l = Ai(t, 136, 12);
const f = di(r);
const h = t[157] === 0 ? null : wi(t, 157, 100, n);
const d = wi(t, 265, 32);
const g = wi(t, 297, 32);
const p = Ai(t, 329, 8);
const m = Ai(t, 337, 8);
const b = mi(t);
if (b === 8 * 32) return null;
if (b !== Ai(t, 148, 8)) throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");
if (li(t)) {
if (t[345]) s = wi(t, 345, 155, n) + "/" + s;
} else if (fi(t)) ; else {
if (!i) {
throw new Error("Invalid tar header: unknown format.");
}
}
if (r === 0 && s && s[s.length - 1] === "/") r = 5;
return {
name: s,
mode: a,
uid: o,
gid: u,
size: c,
mtime: new Date(1e3 * l),
type: f,
linkname: h,
uname: d,
gname: g,
devmajor: p,
devminor: m,
pax: null
};
};
function li(e) {
return Qn.equals(ii, e.subarray(ui, ui + 6));
}
function fi(e) {
return Qn.equals(si, e.subarray(ui, ui + 6)) && Qn.equals(ai, e.subarray(ci, ci + 2));
}
function hi(e, t, n) {
if (typeof e !== "number") return n;
e = ~~e;
if (e >= t) return t;
if (e >= 0) return e;
e += t;
if (e >= 0) return e;
return 0;
}
function di(e) {
switch (e) {
case 0:
return "file";
case 1:
return "link";
case 2:
return "symlink";
case 3:
return "character-device";
case 4:
return "block-device";
case 5:
return "directory";
case 6:
return "fifo";
case 7:
return "contiguous-file";
case 72:
return "pax-header";
case 55:
return "pax-global-header";
case 27:
return "gnu-long-link-path";
case 28:
case 30:
return "gnu-long-path";
}
return null;
}
function gi(e) {
switch (e) {
case "file":
return 0;
case "link":
return 1;
case "symlink":
return 2;
case "character-device":
return 3;
case "block-device":
return 4;
case "directory":
return 5;
case "fifo":
return 6;
case "contiguous-file":
return 7;
case "pax-header":
return 72;
}
return 0;
}
function pi(e, t, n, i) {
for (;n < i; n++) {
if (e[n] === t) return n;
}
return i;
}
function mi(e) {
let t = 8 * 32;
for (let n = 0; n < 148; n++) t += e[n];
for (let n = 156; n < 512; n++) t += e[n];
return t;
}
function bi(e, t) {
e = e.toString(8);
if (e.length > t) return ti.slice(0, t) + " ";
return ei.slice(0, t - e.length) + e + " ";
}
function _i(e, t, n) {
t[n] = 128;
for (let i = 11; i > 0; i--) {
t[n + i] = e & 255;
e = Math.floor(e / 256);
}
}
function yi(e, t, n) {
if (e.toString(8).length > 11) {
_i(e, t, n);
} else {
Qn.write(t, bi(e, 11), n);
}
}
function vi(e) {
let t;
if (e[0] === 128) t = true; else if (e[0] === 255) t = false; else return null;
const n = [];
let i;
for (i = e.length - 1; i > 0; i--) {
const r = e[i];