@storm-software/git-tools
Version:
Tools for managing Git repositories within a Nx workspace.
1,031 lines (1,026 loc) • 176 kB
JavaScript
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
var _chunkIG6EXAQUcjs = require('./chunk-IG6EXAQU.cjs');
// ../../node_modules/.pnpm/node-fetch-native@1.6.6/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs
var require_node_fetch_native_DhEqb06g = _chunkIG6EXAQUcjs.__commonJS.call(void 0, {
"../../node_modules/.pnpm/node-fetch-native@1.6.6/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs"(exports) {
"use strict";
_chunkIG6EXAQUcjs.init_cjs_shims.call(void 0, );
var l = Object.defineProperty;
var o = (e, t) => l(e, "name", { value: t, configurable: true });
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function getDefaultExportFromCjs(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
o(getDefaultExportFromCjs, "getDefaultExportFromCjs"), exports.commonjsGlobal = commonjsGlobal, exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
}
});
// ../../node_modules/.pnpm/node-fetch-native@1.6.6/node_modules/node-fetch-native/dist/node.cjs
var require_node = _chunkIG6EXAQUcjs.__commonJS.call(void 0, {
"../../node_modules/.pnpm/node-fetch-native@1.6.6/node_modules/node-fetch-native/dist/node.cjs"(exports) {
"use strict";
_chunkIG6EXAQUcjs.init_cjs_shims.call(void 0, );
var qi = Object.defineProperty;
var u = (c, l) => qi(c, "name", { value: l, configurable: true });
Object.defineProperty(exports, "__esModule", { value: true });
var http = _chunkIG6EXAQUcjs.__require.call(void 0, "http");
var https = _chunkIG6EXAQUcjs.__require.call(void 0, "https");
var zlib = _chunkIG6EXAQUcjs.__require.call(void 0, "zlib");
var Stream = _chunkIG6EXAQUcjs.__require.call(void 0, "stream");
var require$$0 = _chunkIG6EXAQUcjs.__require.call(void 0, "buffer");
var require$$0$1 = _chunkIG6EXAQUcjs.__require.call(void 0, "util");
var _commonjsHelpers = require_node_fetch_native_DhEqb06g();
var require$$1 = _chunkIG6EXAQUcjs.__require.call(void 0, "url");
var require$$0$2 = _chunkIG6EXAQUcjs.__require.call(void 0, "net");
var node_fs = _chunkIG6EXAQUcjs.__require.call(void 0, "fs");
var node_path = _chunkIG6EXAQUcjs.__require.call(void 0, "path");
function _interopDefaultCompat(c) {
return c && typeof c == "object" && "default" in c ? c.default : c;
}
u(_interopDefaultCompat, "_interopDefaultCompat");
var http__default = _interopDefaultCompat(http);
var https__default = _interopDefaultCompat(https);
var zlib__default = _interopDefaultCompat(zlib);
var Stream__default = _interopDefaultCompat(Stream);
function dataUriToBuffer(c) {
if (!/^data:/i.test(c)) throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');
c = c.replace(/\r?\n/g, "");
const l = c.indexOf(",");
if (l === -1 || l <= 4) throw new TypeError("malformed data: URI");
const d = c.substring(5, l).split(";");
let y = "", b = false;
const R = d[0] || "text/plain";
let w = R;
for (let z = 1; z < d.length; z++) d[z] === "base64" ? b = true : d[z] && (w += `;${d[z]}`, d[z].indexOf("charset=") === 0 && (y = d[z].substring(8)));
!d[0] && !y.length && (w += ";charset=US-ASCII", y = "US-ASCII");
const A = b ? "base64" : "ascii", F = unescape(c.substring(l + 1)), B = Buffer.from(F, A);
return B.type = R, B.typeFull = w, B.charset = y, B;
}
u(dataUriToBuffer, "dataUriToBuffer");
var streams = {};
var ponyfill_es2018$1 = { exports: {} };
var ponyfill_es2018 = ponyfill_es2018$1.exports;
var hasRequiredPonyfill_es2018;
function requirePonyfill_es2018() {
return hasRequiredPonyfill_es2018 || (hasRequiredPonyfill_es2018 = 1, function(c, l) {
(function(d, y) {
y(l);
})(ponyfill_es2018, function(d) {
function y() {
}
u(y, "noop");
function b(n) {
return typeof n == "object" && n !== null || typeof n == "function";
}
u(b, "typeIsObject");
const R = y;
function w(n, o) {
try {
Object.defineProperty(n, "name", { value: o, configurable: true });
} catch (e2) {
}
}
u(w, "setFunctionName");
const A = Promise, F = Promise.prototype.then, B = Promise.reject.bind(A);
function z(n) {
return new A(n);
}
u(z, "newPromise");
function W(n) {
return z((o) => o(n));
}
u(W, "promiseResolvedWith");
function T(n) {
return B(n);
}
u(T, "promiseRejectedWith");
function D(n, o, a) {
return F.call(n, o, a);
}
u(D, "PerformPromiseThen");
function E(n, o, a) {
D(D(n, o, a), void 0, R);
}
u(E, "uponPromise");
function Z(n, o) {
E(n, o);
}
u(Z, "uponFulfillment");
function M(n, o) {
E(n, void 0, o);
}
u(M, "uponRejection");
function U(n, o, a) {
return D(n, o, a);
}
u(U, "transformPromiseWith");
function K(n) {
D(n, void 0, R);
}
u(K, "setPromiseIsHandledToTrue");
let se = u((n) => {
if (typeof queueMicrotask == "function") se = queueMicrotask;
else {
const o = W(void 0);
se = u((a) => D(o, a), "_queueMicrotask");
}
return se(n);
}, "_queueMicrotask");
function $(n, o, a) {
if (typeof n != "function") throw new TypeError("Argument is not a function");
return Function.prototype.apply.call(n, o, a);
}
u($, "reflectCall");
function N(n, o, a) {
try {
return W($(n, o, a));
} catch (p) {
return T(p);
}
}
u(N, "promiseCall");
const V = 16384;
class Q {
static {
u(this, "SimpleQueue");
}
constructor() {
this._cursor = 0, this._size = 0, this._front = { _elements: [], _next: void 0 }, this._back = this._front, this._cursor = 0, this._size = 0;
}
get length() {
return this._size;
}
push(o) {
const a = this._back;
let p = a;
a._elements.length === V - 1 && (p = { _elements: [], _next: void 0 }), a._elements.push(o), p !== a && (this._back = p, a._next = p), ++this._size;
}
shift() {
const o = this._front;
let a = o;
const p = this._cursor;
let g = p + 1;
const _ = o._elements, S = _[p];
return g === V && (a = o._next, g = 0), --this._size, this._cursor = g, o !== a && (this._front = a), _[p] = void 0, S;
}
forEach(o) {
let a = this._cursor, p = this._front, g = p._elements;
for (; (a !== g.length || p._next !== void 0) && !(a === g.length && (p = p._next, g = p._elements, a = 0, g.length === 0)); ) o(g[a]), ++a;
}
peek() {
const o = this._front, a = this._cursor;
return o._elements[a];
}
}
const rt = Symbol("[[AbortSteps]]"), wr = Symbol("[[ErrorSteps]]"), Ot = Symbol("[[CancelSteps]]"), Ft = Symbol("[[PullSteps]]"), It = Symbol("[[ReleaseSteps]]");
function Rr(n, o) {
n._ownerReadableStream = o, o._reader = n, o._state === "readable" ? jt(n) : o._state === "closed" ? Dn(n) : Tr(n, o._storedError);
}
u(Rr, "ReadableStreamReaderGenericInitialize");
function zt(n, o) {
const a = n._ownerReadableStream;
return ne(a, o);
}
u(zt, "ReadableStreamReaderGenericCancel");
function ue(n) {
const o = n._ownerReadableStream;
o._state === "readable" ? Lt(n, new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")) : $n(n, new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")), o._readableStreamController[It](), o._reader = void 0, n._ownerReadableStream = void 0;
}
u(ue, "ReadableStreamReaderGenericRelease");
function nt(n) {
return new TypeError("Cannot " + n + " a stream using a released reader");
}
u(nt, "readerLockException");
function jt(n) {
n._closedPromise = z((o, a) => {
n._closedPromise_resolve = o, n._closedPromise_reject = a;
});
}
u(jt, "defaultReaderClosedPromiseInitialize");
function Tr(n, o) {
jt(n), Lt(n, o);
}
u(Tr, "defaultReaderClosedPromiseInitializeAsRejected");
function Dn(n) {
jt(n), Cr(n);
}
u(Dn, "defaultReaderClosedPromiseInitializeAsResolved");
function Lt(n, o) {
n._closedPromise_reject !== void 0 && (K(n._closedPromise), n._closedPromise_reject(o), n._closedPromise_resolve = void 0, n._closedPromise_reject = void 0);
}
u(Lt, "defaultReaderClosedPromiseReject");
function $n(n, o) {
Tr(n, o);
}
u($n, "defaultReaderClosedPromiseResetToRejected");
function Cr(n) {
n._closedPromise_resolve !== void 0 && (n._closedPromise_resolve(void 0), n._closedPromise_resolve = void 0, n._closedPromise_reject = void 0);
}
u(Cr, "defaultReaderClosedPromiseResolve");
const Pr = Number.isFinite || function(n) {
return typeof n == "number" && isFinite(n);
}, Mn = Math.trunc || function(n) {
return n < 0 ? Math.ceil(n) : Math.floor(n);
};
function xn(n) {
return typeof n == "object" || typeof n == "function";
}
u(xn, "isDictionary");
function ie(n, o) {
if (n !== void 0 && !xn(n)) throw new TypeError(`${o} is not an object.`);
}
u(ie, "assertDictionary");
function X(n, o) {
if (typeof n != "function") throw new TypeError(`${o} is not a function.`);
}
u(X, "assertFunction");
function Un(n) {
return typeof n == "object" && n !== null || typeof n == "function";
}
u(Un, "isObject");
function Er(n, o) {
if (!Un(n)) throw new TypeError(`${o} is not an object.`);
}
u(Er, "assertObject");
function le(n, o, a) {
if (n === void 0) throw new TypeError(`Parameter ${o} is required in '${a}'.`);
}
u(le, "assertRequiredArgument");
function Dt(n, o, a) {
if (n === void 0) throw new TypeError(`${o} is required in '${a}'.`);
}
u(Dt, "assertRequiredField");
function $t(n) {
return Number(n);
}
u($t, "convertUnrestrictedDouble");
function vr(n) {
return n === 0 ? 0 : n;
}
u(vr, "censorNegativeZero");
function Nn(n) {
return vr(Mn(n));
}
u(Nn, "integerPart");
function Mt(n, o) {
const p = Number.MAX_SAFE_INTEGER;
let g = Number(n);
if (g = vr(g), !Pr(g)) throw new TypeError(`${o} is not a finite number`);
if (g = Nn(g), g < 0 || g > p) throw new TypeError(`${o} is outside the accepted range of 0 to ${p}, inclusive`);
return !Pr(g) || g === 0 ? 0 : g;
}
u(Mt, "convertUnsignedLongLongWithEnforceRange");
function xt(n, o) {
if (!Re(n)) throw new TypeError(`${o} is not a ReadableStream.`);
}
u(xt, "assertReadableStream");
function Fe(n) {
return new me(n);
}
u(Fe, "AcquireReadableStreamDefaultReader");
function Ar(n, o) {
n._reader._readRequests.push(o);
}
u(Ar, "ReadableStreamAddReadRequest");
function Ut(n, o, a) {
const g = n._reader._readRequests.shift();
a ? g._closeSteps() : g._chunkSteps(o);
}
u(Ut, "ReadableStreamFulfillReadRequest");
function ot(n) {
return n._reader._readRequests.length;
}
u(ot, "ReadableStreamGetNumReadRequests");
function Br(n) {
const o = n._reader;
return !(o === void 0 || !ye(o));
}
u(Br, "ReadableStreamHasDefaultReader");
class me {
static {
u(this, "ReadableStreamDefaultReader");
}
constructor(o) {
if (le(o, 1, "ReadableStreamDefaultReader"), xt(o, "First parameter"), Te(o)) throw new TypeError("This stream has already been locked for exclusive reading by another reader");
Rr(this, o), this._readRequests = new Q();
}
get closed() {
return ye(this) ? this._closedPromise : T(it("closed"));
}
cancel(o = void 0) {
return ye(this) ? this._ownerReadableStream === void 0 ? T(nt("cancel")) : zt(this, o) : T(it("cancel"));
}
read() {
if (!ye(this)) return T(it("read"));
if (this._ownerReadableStream === void 0) return T(nt("read from"));
let o, a;
const p = z((_, S) => {
o = _, a = S;
});
return Ve(this, { _chunkSteps: u((_) => o({ value: _, done: false }), "_chunkSteps"), _closeSteps: u(() => o({ value: void 0, done: true }), "_closeSteps"), _errorSteps: u((_) => a(_), "_errorSteps") }), p;
}
releaseLock() {
if (!ye(this)) throw it("releaseLock");
this._ownerReadableStream !== void 0 && Hn(this);
}
}
Object.defineProperties(me.prototype, { cancel: { enumerable: true }, read: { enumerable: true }, releaseLock: { enumerable: true }, closed: { enumerable: true } }), w(me.prototype.cancel, "cancel"), w(me.prototype.read, "read"), w(me.prototype.releaseLock, "releaseLock"), typeof Symbol.toStringTag == "symbol" && Object.defineProperty(me.prototype, Symbol.toStringTag, { value: "ReadableStreamDefaultReader", configurable: true });
function ye(n) {
return !b(n) || !Object.prototype.hasOwnProperty.call(n, "_readRequests") ? false : n instanceof me;
}
u(ye, "IsReadableStreamDefaultReader");
function Ve(n, o) {
const a = n._ownerReadableStream;
a._disturbed = true, a._state === "closed" ? o._closeSteps() : a._state === "errored" ? o._errorSteps(a._storedError) : a._readableStreamController[Ft](o);
}
u(Ve, "ReadableStreamDefaultReaderRead");
function Hn(n) {
ue(n);
const o = new TypeError("Reader was released");
qr(n, o);
}
u(Hn, "ReadableStreamDefaultReaderRelease");
function qr(n, o) {
const a = n._readRequests;
n._readRequests = new Q(), a.forEach((p) => {
p._errorSteps(o);
});
}
u(qr, "ReadableStreamDefaultReaderErrorReadRequests");
function it(n) {
return new TypeError(`ReadableStreamDefaultReader.prototype.${n} can only be used on a ReadableStreamDefaultReader`);
}
u(it, "defaultReaderBrandCheckException");
const Vn = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {
}).prototype);
class Wr {
static {
u(this, "ReadableStreamAsyncIteratorImpl");
}
constructor(o, a) {
this._ongoingPromise = void 0, this._isFinished = false, this._reader = o, this._preventCancel = a;
}
next() {
const o = u(() => this._nextSteps(), "nextSteps");
return this._ongoingPromise = this._ongoingPromise ? U(this._ongoingPromise, o, o) : o(), this._ongoingPromise;
}
return(o) {
const a = u(() => this._returnSteps(o), "returnSteps");
return this._ongoingPromise ? U(this._ongoingPromise, a, a) : a();
}
_nextSteps() {
if (this._isFinished) return Promise.resolve({ value: void 0, done: true });
const o = this._reader;
let a, p;
const g = z((S, C) => {
a = S, p = C;
});
return Ve(o, { _chunkSteps: u((S) => {
this._ongoingPromise = void 0, se(() => a({ value: S, done: false }));
}, "_chunkSteps"), _closeSteps: u(() => {
this._ongoingPromise = void 0, this._isFinished = true, ue(o), a({ value: void 0, done: true });
}, "_closeSteps"), _errorSteps: u((S) => {
this._ongoingPromise = void 0, this._isFinished = true, ue(o), p(S);
}, "_errorSteps") }), g;
}
_returnSteps(o) {
if (this._isFinished) return Promise.resolve({ value: o, done: true });
this._isFinished = true;
const a = this._reader;
if (!this._preventCancel) {
const p = zt(a, o);
return ue(a), U(p, () => ({ value: o, done: true }));
}
return ue(a), W({ value: o, done: true });
}
}
const kr = { next() {
return Or(this) ? this._asyncIteratorImpl.next() : T(Fr("next"));
}, return(n) {
return Or(this) ? this._asyncIteratorImpl.return(n) : T(Fr("return"));
} };
Object.setPrototypeOf(kr, Vn);
function Qn(n, o) {
const a = Fe(n), p = new Wr(a, o), g = Object.create(kr);
return g._asyncIteratorImpl = p, g;
}
u(Qn, "AcquireReadableStreamAsyncIterator");
function Or(n) {
if (!b(n) || !Object.prototype.hasOwnProperty.call(n, "_asyncIteratorImpl")) return false;
try {
return n._asyncIteratorImpl instanceof Wr;
} catch (e3) {
return false;
}
}
u(Or, "IsReadableStreamAsyncIterator");
function Fr(n) {
return new TypeError(`ReadableStreamAsyncIterator.${n} can only be used on a ReadableSteamAsyncIterator`);
}
u(Fr, "streamAsyncIteratorBrandCheckException");
const Ir = Number.isNaN || function(n) {
return n !== n;
};
var Nt, Ht, Vt;
function Qe(n) {
return n.slice();
}
u(Qe, "CreateArrayFromList");
function zr(n, o, a, p, g) {
new Uint8Array(n).set(new Uint8Array(a, p, g), o);
}
u(zr, "CopyDataBlockBytes");
let fe = u((n) => (typeof n.transfer == "function" ? fe = u((o) => o.transfer(), "TransferArrayBuffer") : typeof structuredClone == "function" ? fe = u((o) => structuredClone(o, { transfer: [o] }), "TransferArrayBuffer") : fe = u((o) => o, "TransferArrayBuffer"), fe(n)), "TransferArrayBuffer"), ge = u((n) => (typeof n.detached == "boolean" ? ge = u((o) => o.detached, "IsDetachedBuffer") : ge = u((o) => o.byteLength === 0, "IsDetachedBuffer"), ge(n)), "IsDetachedBuffer");
function jr(n, o, a) {
if (n.slice) return n.slice(o, a);
const p = a - o, g = new ArrayBuffer(p);
return zr(g, 0, n, o, p), g;
}
u(jr, "ArrayBufferSlice");
function at(n, o) {
const a = n[o];
if (a != null) {
if (typeof a != "function") throw new TypeError(`${String(o)} is not a function`);
return a;
}
}
u(at, "GetMethod");
function Yn(n) {
const o = { [Symbol.iterator]: () => n.iterator }, a = async function* () {
return yield* o;
}(), p = a.next;
return { iterator: a, nextMethod: p, done: false };
}
u(Yn, "CreateAsyncFromSyncIterator");
const Qt = (Vt = (Nt = Symbol.asyncIterator) !== null && Nt !== void 0 ? Nt : (Ht = Symbol.for) === null || Ht === void 0 ? void 0 : Ht.call(Symbol, "Symbol.asyncIterator")) !== null && Vt !== void 0 ? Vt : "@@asyncIterator";
function Lr(n, o = "sync", a) {
if (a === void 0) if (o === "async") {
if (a = at(n, Qt), a === void 0) {
const _ = at(n, Symbol.iterator), S = Lr(n, "sync", _);
return Yn(S);
}
} else a = at(n, Symbol.iterator);
if (a === void 0) throw new TypeError("The object is not iterable");
const p = $(a, n, []);
if (!b(p)) throw new TypeError("The iterator method must return an object");
const g = p.next;
return { iterator: p, nextMethod: g, done: false };
}
u(Lr, "GetIterator");
function Gn(n) {
const o = $(n.nextMethod, n.iterator, []);
if (!b(o)) throw new TypeError("The iterator.next() method must return an object");
return o;
}
u(Gn, "IteratorNext");
function Zn(n) {
return !!n.done;
}
u(Zn, "IteratorComplete");
function Kn(n) {
return n.value;
}
u(Kn, "IteratorValue");
function Jn(n) {
return !(typeof n != "number" || Ir(n) || n < 0);
}
u(Jn, "IsNonNegativeNumber");
function Dr(n) {
const o = jr(n.buffer, n.byteOffset, n.byteOffset + n.byteLength);
return new Uint8Array(o);
}
u(Dr, "CloneAsUint8Array");
function Yt(n) {
const o = n._queue.shift();
return n._queueTotalSize -= o.size, n._queueTotalSize < 0 && (n._queueTotalSize = 0), o.value;
}
u(Yt, "DequeueValue");
function Gt(n, o, a) {
if (!Jn(a) || a === 1 / 0) throw new RangeError("Size must be a finite, non-NaN, non-negative number.");
n._queue.push({ value: o, size: a }), n._queueTotalSize += a;
}
u(Gt, "EnqueueValueWithSize");
function Xn(n) {
return n._queue.peek().value;
}
u(Xn, "PeekQueueValue");
function _e(n) {
n._queue = new Q(), n._queueTotalSize = 0;
}
u(_e, "ResetQueue");
function $r(n) {
return n === DataView;
}
u($r, "isDataViewConstructor");
function eo(n) {
return $r(n.constructor);
}
u(eo, "isDataView");
function to(n) {
return $r(n) ? 1 : n.BYTES_PER_ELEMENT;
}
u(to, "arrayBufferViewElementSize");
class Ee {
static {
u(this, "ReadableStreamBYOBRequest");
}
constructor() {
throw new TypeError("Illegal constructor");
}
get view() {
if (!Zt(this)) throw tr("view");
return this._view;
}
respond(o) {
if (!Zt(this)) throw tr("respond");
if (le(o, 1, "respond"), o = Mt(o, "First parameter"), this._associatedReadableByteStreamController === void 0) throw new TypeError("This BYOB request has been invalidated");
if (ge(this._view.buffer)) throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");
ft(this._associatedReadableByteStreamController, o);
}
respondWithNewView(o) {
if (!Zt(this)) throw tr("respondWithNewView");
if (le(o, 1, "respondWithNewView"), !ArrayBuffer.isView(o)) throw new TypeError("You can only respond with array buffer views");
if (this._associatedReadableByteStreamController === void 0) throw new TypeError("This BYOB request has been invalidated");
if (ge(o.buffer)) throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");
ct(this._associatedReadableByteStreamController, o);
}
}
Object.defineProperties(Ee.prototype, { respond: { enumerable: true }, respondWithNewView: { enumerable: true }, view: { enumerable: true } }), w(Ee.prototype.respond, "respond"), w(Ee.prototype.respondWithNewView, "respondWithNewView"), typeof Symbol.toStringTag == "symbol" && Object.defineProperty(Ee.prototype, Symbol.toStringTag, { value: "ReadableStreamBYOBRequest", configurable: true });
class ce {
static {
u(this, "ReadableByteStreamController");
}
constructor() {
throw new TypeError("Illegal constructor");
}
get byobRequest() {
if (!ve(this)) throw Ge("byobRequest");
return er(this);
}
get desiredSize() {
if (!ve(this)) throw Ge("desiredSize");
return Zr(this);
}
close() {
if (!ve(this)) throw Ge("close");
if (this._closeRequested) throw new TypeError("The stream has already been closed; do not close it again!");
const o = this._controlledReadableByteStream._state;
if (o !== "readable") throw new TypeError(`The stream (in ${o} state) is not in the readable state and cannot be closed`);
Ye(this);
}
enqueue(o) {
if (!ve(this)) throw Ge("enqueue");
if (le(o, 1, "enqueue"), !ArrayBuffer.isView(o)) throw new TypeError("chunk must be an array buffer view");
if (o.byteLength === 0) throw new TypeError("chunk must have non-zero byteLength");
if (o.buffer.byteLength === 0) throw new TypeError("chunk's buffer must have non-zero byteLength");
if (this._closeRequested) throw new TypeError("stream is closed or draining");
const a = this._controlledReadableByteStream._state;
if (a !== "readable") throw new TypeError(`The stream (in ${a} state) is not in the readable state and cannot be enqueued to`);
lt(this, o);
}
error(o = void 0) {
if (!ve(this)) throw Ge("error");
ee(this, o);
}
[Ot](o) {
Mr(this), _e(this);
const a = this._cancelAlgorithm(o);
return ut(this), a;
}
[Ft](o) {
const a = this._controlledReadableByteStream;
if (this._queueTotalSize > 0) {
Gr(this, o);
return;
}
const p = this._autoAllocateChunkSize;
if (p !== void 0) {
let g;
try {
g = new ArrayBuffer(p);
} catch (S) {
o._errorSteps(S);
return;
}
const _ = { buffer: g, bufferByteLength: p, byteOffset: 0, byteLength: p, bytesFilled: 0, minimumFill: 1, elementSize: 1, viewConstructor: Uint8Array, readerType: "default" };
this._pendingPullIntos.push(_);
}
Ar(a, o), Ae(this);
}
[It]() {
if (this._pendingPullIntos.length > 0) {
const o = this._pendingPullIntos.peek();
o.readerType = "none", this._pendingPullIntos = new Q(), this._pendingPullIntos.push(o);
}
}
}
Object.defineProperties(ce.prototype, { close: { enumerable: true }, enqueue: { enumerable: true }, error: { enumerable: true }, byobRequest: { enumerable: true }, desiredSize: { enumerable: true } }), w(ce.prototype.close, "close"), w(ce.prototype.enqueue, "enqueue"), w(ce.prototype.error, "error"), typeof Symbol.toStringTag == "symbol" && Object.defineProperty(ce.prototype, Symbol.toStringTag, { value: "ReadableByteStreamController", configurable: true });
function ve(n) {
return !b(n) || !Object.prototype.hasOwnProperty.call(n, "_controlledReadableByteStream") ? false : n instanceof ce;
}
u(ve, "IsReadableByteStreamController");
function Zt(n) {
return !b(n) || !Object.prototype.hasOwnProperty.call(n, "_associatedReadableByteStreamController") ? false : n instanceof Ee;
}
u(Zt, "IsReadableStreamBYOBRequest");
function Ae(n) {
if (!ao(n)) return;
if (n._pulling) {
n._pullAgain = true;
return;
}
n._pulling = true;
const a = n._pullAlgorithm();
E(a, () => (n._pulling = false, n._pullAgain && (n._pullAgain = false, Ae(n)), null), (p) => (ee(n, p), null));
}
u(Ae, "ReadableByteStreamControllerCallPullIfNeeded");
function Mr(n) {
Jt(n), n._pendingPullIntos = new Q();
}
u(Mr, "ReadableByteStreamControllerClearPendingPullIntos");
function Kt(n, o) {
let a = false;
n._state === "closed" && (a = true);
const p = xr(o);
o.readerType === "default" ? Ut(n, p, a) : ho(n, p, a);
}
u(Kt, "ReadableByteStreamControllerCommitPullIntoDescriptor");
function xr(n) {
const o = n.bytesFilled, a = n.elementSize;
return new n.viewConstructor(n.buffer, n.byteOffset, o / a);
}
u(xr, "ReadableByteStreamControllerConvertPullIntoDescriptor");
function st(n, o, a, p) {
n._queue.push({ buffer: o, byteOffset: a, byteLength: p }), n._queueTotalSize += p;
}
u(st, "ReadableByteStreamControllerEnqueueChunkToQueue");
function Ur(n, o, a, p) {
let g;
try {
g = jr(o, a, a + p);
} catch (_) {
throw ee(n, _), _;
}
st(n, g, 0, p);
}
u(Ur, "ReadableByteStreamControllerEnqueueClonedChunkToQueue");
function Nr(n, o) {
o.bytesFilled > 0 && Ur(n, o.buffer, o.byteOffset, o.bytesFilled), Ie(n);
}
u(Nr, "ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue");
function Hr(n, o) {
const a = Math.min(n._queueTotalSize, o.byteLength - o.bytesFilled), p = o.bytesFilled + a;
let g = a, _ = false;
const S = p % o.elementSize, C = p - S;
C >= o.minimumFill && (g = C - o.bytesFilled, _ = true);
const q = n._queue;
for (; g > 0; ) {
const P = q.peek(), k = Math.min(g, P.byteLength), O = o.byteOffset + o.bytesFilled;
zr(o.buffer, O, P.buffer, P.byteOffset, k), P.byteLength === k ? q.shift() : (P.byteOffset += k, P.byteLength -= k), n._queueTotalSize -= k, Vr(n, k, o), g -= k;
}
return _;
}
u(Hr, "ReadableByteStreamControllerFillPullIntoDescriptorFromQueue");
function Vr(n, o, a) {
a.bytesFilled += o;
}
u(Vr, "ReadableByteStreamControllerFillHeadPullIntoDescriptor");
function Qr(n) {
n._queueTotalSize === 0 && n._closeRequested ? (ut(n), tt(n._controlledReadableByteStream)) : Ae(n);
}
u(Qr, "ReadableByteStreamControllerHandleQueueDrain");
function Jt(n) {
n._byobRequest !== null && (n._byobRequest._associatedReadableByteStreamController = void 0, n._byobRequest._view = null, n._byobRequest = null);
}
u(Jt, "ReadableByteStreamControllerInvalidateBYOBRequest");
function Xt(n) {
for (; n._pendingPullIntos.length > 0; ) {
if (n._queueTotalSize === 0) return;
const o = n._pendingPullIntos.peek();
Hr(n, o) && (Ie(n), Kt(n._controlledReadableByteStream, o));
}
}
u(Xt, "ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue");
function ro(n) {
const o = n._controlledReadableByteStream._reader;
for (; o._readRequests.length > 0; ) {
if (n._queueTotalSize === 0) return;
const a = o._readRequests.shift();
Gr(n, a);
}
}
u(ro, "ReadableByteStreamControllerProcessReadRequestsUsingQueue");
function no(n, o, a, p) {
const g = n._controlledReadableByteStream, _ = o.constructor, S = to(_), { byteOffset: C, byteLength: q } = o, P = a * S;
let k;
try {
k = fe(o.buffer);
} catch (j) {
p._errorSteps(j);
return;
}
const O = { buffer: k, bufferByteLength: k.byteLength, byteOffset: C, byteLength: q, bytesFilled: 0, minimumFill: P, elementSize: S, viewConstructor: _, readerType: "byob" };
if (n._pendingPullIntos.length > 0) {
n._pendingPullIntos.push(O), Xr(g, p);
return;
}
if (g._state === "closed") {
const j = new _(O.buffer, O.byteOffset, 0);
p._closeSteps(j);
return;
}
if (n._queueTotalSize > 0) {
if (Hr(n, O)) {
const j = xr(O);
Qr(n), p._chunkSteps(j);
return;
}
if (n._closeRequested) {
const j = new TypeError("Insufficient bytes to fill elements in the given buffer");
ee(n, j), p._errorSteps(j);
return;
}
}
n._pendingPullIntos.push(O), Xr(g, p), Ae(n);
}
u(no, "ReadableByteStreamControllerPullInto");
function oo(n, o) {
o.readerType === "none" && Ie(n);
const a = n._controlledReadableByteStream;
if (rr(a)) for (; en(a) > 0; ) {
const p = Ie(n);
Kt(a, p);
}
}
u(oo, "ReadableByteStreamControllerRespondInClosedState");
function io(n, o, a) {
if (Vr(n, o, a), a.readerType === "none") {
Nr(n, a), Xt(n);
return;
}
if (a.bytesFilled < a.minimumFill) return;
Ie(n);
const p = a.bytesFilled % a.elementSize;
if (p > 0) {
const g = a.byteOffset + a.bytesFilled;
Ur(n, a.buffer, g - p, p);
}
a.bytesFilled -= p, Kt(n._controlledReadableByteStream, a), Xt(n);
}
u(io, "ReadableByteStreamControllerRespondInReadableState");
function Yr(n, o) {
const a = n._pendingPullIntos.peek();
Jt(n), n._controlledReadableByteStream._state === "closed" ? oo(n, a) : io(n, o, a), Ae(n);
}
u(Yr, "ReadableByteStreamControllerRespondInternal");
function Ie(n) {
return n._pendingPullIntos.shift();
}
u(Ie, "ReadableByteStreamControllerShiftPendingPullInto");
function ao(n) {
const o = n._controlledReadableByteStream;
return o._state !== "readable" || n._closeRequested || !n._started ? false : !!(Br(o) && ot(o) > 0 || rr(o) && en(o) > 0 || Zr(n) > 0);
}
u(ao, "ReadableByteStreamControllerShouldCallPull");
function ut(n) {
n._pullAlgorithm = void 0, n._cancelAlgorithm = void 0;
}
u(ut, "ReadableByteStreamControllerClearAlgorithms");
function Ye(n) {
const o = n._controlledReadableByteStream;
if (!(n._closeRequested || o._state !== "readable")) {
if (n._queueTotalSize > 0) {
n._closeRequested = true;
return;
}
if (n._pendingPullIntos.length > 0) {
const a = n._pendingPullIntos.peek();
if (a.bytesFilled % a.elementSize !== 0) {
const p = new TypeError("Insufficient bytes to fill elements in the given buffer");
throw ee(n, p), p;
}
}
ut(n), tt(o);
}
}
u(Ye, "ReadableByteStreamControllerClose");
function lt(n, o) {
const a = n._controlledReadableByteStream;
if (n._closeRequested || a._state !== "readable") return;
const { buffer: p, byteOffset: g, byteLength: _ } = o;
if (ge(p)) throw new TypeError("chunk's buffer is detached and so cannot be enqueued");
const S = fe(p);
if (n._pendingPullIntos.length > 0) {
const C = n._pendingPullIntos.peek();
if (ge(C.buffer)) throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");
Jt(n), C.buffer = fe(C.buffer), C.readerType === "none" && Nr(n, C);
}
if (Br(a)) if (ro(n), ot(a) === 0) st(n, S, g, _);
else {
n._pendingPullIntos.length > 0 && Ie(n);
const C = new Uint8Array(S, g, _);
Ut(a, C, false);
}
else rr(a) ? (st(n, S, g, _), Xt(n)) : st(n, S, g, _);
Ae(n);
}
u(lt, "ReadableByteStreamControllerEnqueue");
function ee(n, o) {
const a = n._controlledReadableByteStream;
a._state === "readable" && (Mr(n), _e(n), ut(n), Pn(a, o));
}
u(ee, "ReadableByteStreamControllerError");
function Gr(n, o) {
const a = n._queue.shift();
n._queueTotalSize -= a.byteLength, Qr(n);
const p = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
o._chunkSteps(p);
}
u(Gr, "ReadableByteStreamControllerFillReadRequestFromQueue");
function er(n) {
if (n._byobRequest === null && n._pendingPullIntos.length > 0) {
const o = n._pendingPullIntos.peek(), a = new Uint8Array(o.buffer, o.byteOffset + o.bytesFilled, o.byteLength - o.bytesFilled), p = Object.create(Ee.prototype);
uo(p, n, a), n._byobRequest = p;
}
return n._byobRequest;
}
u(er, "ReadableByteStreamControllerGetBYOBRequest");
function Zr(n) {
const o = n._controlledReadableByteStream._state;
return o === "errored" ? null : o === "closed" ? 0 : n._strategyHWM - n._queueTotalSize;
}
u(Zr, "ReadableByteStreamControllerGetDesiredSize");
function ft(n, o) {
const a = n._pendingPullIntos.peek();
if (n._controlledReadableByteStream._state === "closed") {
if (o !== 0) throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");
} else {
if (o === 0) throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");
if (a.bytesFilled + o > a.byteLength) throw new RangeError("bytesWritten out of range");
}
a.buffer = fe(a.buffer), Yr(n, o);
}
u(ft, "ReadableByteStreamControllerRespond");
function ct(n, o) {
const a = n._pendingPullIntos.peek();
if (n._controlledReadableByteStream._state === "closed") {
if (o.byteLength !== 0) throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream");
} else if (o.byteLength === 0) throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");
if (a.byteOffset + a.bytesFilled !== o.byteOffset) throw new RangeError("The region specified by view does not match byobRequest");
if (a.bufferByteLength !== o.buffer.byteLength) throw new RangeError("The buffer of view has different capacity than byobRequest");
if (a.bytesFilled + o.byteLength > a.byteLength) throw new RangeError("The region specified by view is larger than byobRequest");
const g = o.byteLength;
a.buffer = fe(o.buffer), Yr(n, g);
}
u(ct, "ReadableByteStreamControllerRespondWithNewView");
function Kr(n, o, a, p, g, _, S) {
o._controlledReadableByteStream = n, o._pullAgain = false, o._pulling = false, o._byobRequest = null, o._queue = o._queueTotalSize = void 0, _e(o), o._closeRequested = false, o._started = false, o._strategyHWM = _, o._pullAlgorithm = p, o._cancelAlgorithm = g, o._autoAllocateChunkSize = S, o._pendingPullIntos = new Q(), n._readableStreamController = o;
const C = a();
E(W(C), () => (o._started = true, Ae(o), null), (q) => (ee(o, q), null));
}
u(Kr, "SetUpReadableByteStreamController");
function so(n, o, a) {
const p = Object.create(ce.prototype);
let g, _, S;
o.start !== void 0 ? g = u(() => o.start(p), "startAlgorithm") : g = u(() => {
}, "startAlgorithm"), o.pull !== void 0 ? _ = u(() => o.pull(p), "pullAlgorithm") : _ = u(() => W(void 0), "pullAlgorithm"), o.cancel !== void 0 ? S = u((q) => o.cancel(q), "cancelAlgorithm") : S = u(() => W(void 0), "cancelAlgorithm");
const C = o.autoAllocateChunkSize;
if (C === 0) throw new TypeError("autoAllocateChunkSize must be greater than 0");
Kr(n, p, g, _, S, a, C);
}
u(so, "SetUpReadableByteStreamControllerFromUnderlyingSource");
function uo(n, o, a) {
n._associatedReadableByteStreamController = o, n._view = a;
}
u(uo, "SetUpReadableStreamBYOBRequest");
function tr(n) {
return new TypeError(`ReadableStreamBYOBRequest.prototype.${n} can only be used on a ReadableStreamBYOBRequest`);
}
u(tr, "byobRequestBrandCheckException");
function Ge(n) {
return new TypeError(`ReadableByteStreamController.prototype.${n} can only be used on a ReadableByteStreamController`);
}
u(Ge, "byteStreamControllerBrandCheckException");
function lo(n, o) {
ie(n, o);
const a = _optionalChain([n, 'optionalAccess', _2 => _2.mode]);
return { mode: a === void 0 ? void 0 : fo(a, `${o} has member 'mode' that`) };
}
u(lo, "convertReaderOptions");
function fo(n, o) {
if (n = `${n}`, n !== "byob") throw new TypeError(`${o} '${n}' is not a valid enumeration value for ReadableStreamReaderMode`);
return n;
}
u(fo, "convertReadableStreamReaderMode");
function co(n, o) {
var a;
ie(n, o);
const p = (a = _optionalChain([n, 'optionalAccess', _3 => _3.min])) !== null && a !== void 0 ? a : 1;
return { min: Mt(p, `${o} has member 'min' that`) };
}
u(co, "convertByobReadOptions");
function Jr(n) {
return new Se(n);
}
u(Jr, "AcquireReadableStreamBYOBReader");
function Xr(n, o) {
n._reader._readIntoRequests.push(o);
}
u(Xr, "ReadableStreamAddReadIntoRequest");
function ho(n, o, a) {
const g = n._reader._readIntoRequests.shift();
a ? g._closeSteps(o) : g._chunkSteps(o);
}
u(ho, "ReadableStreamFulfillReadIntoRequest");
function en(n) {
return n._reader._readIntoRequests.length;
}
u(en, "ReadableStreamGetNumReadIntoRequests");
function rr(n) {
const o = n._reader;
return !(o === void 0 || !Be(o));
}
u(rr, "ReadableStreamHasBYOBReader");
class Se {
static {
u(this, "ReadableStreamBYOBReader");
}
constructor(o) {
if (le(o, 1, "ReadableStreamBYOBReader"), xt(o, "First parameter"), Te(o)) throw new TypeError("This stream has already been locked for exclusive reading by another reader");
if (!ve(o._readableStreamController)) throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");
Rr(this, o), this._readIntoRequests = new Q();
}
get closed() {
return Be(this) ? this._closedPromise : T(dt("closed"));
}
cancel(o = void 0) {
return Be(this) ? this._ownerReadableStream === void 0 ? T(nt("cancel")) : zt(this, o) : T(dt("cancel"));
}
read(o, a = {}) {
if (!Be(this)) return T(dt("read"));
if (!ArrayBuffer.isView(o)) return T(new TypeError("view must be an array buffer view"));
if (o.byteLength === 0) return T(new TypeError("view must have non-zero byteLength"));
if (o.buffer.byteLength === 0) return T(new TypeError("view's buffer must have non-zero byteLength"));
if (ge(o.buffer)) return T(new TypeError("view's buffer has been detached"));
let p;
try {
p = co(a, "options");
} catch (P) {
return T(P);
}
const g = p.min;
if (g === 0) return T(new TypeError("options.min must be greater than 0"));
if (eo(o)) {
if (g > o.byteLength) return T(new RangeError("options.min must be less than or equal to view's byteLength"));
} else if (g > o.length) return T(new RangeError("options.min must be less than or equal to view's length"));
if (this._ownerReadableStream === void 0) return T(nt("read from"));
let _, S;
const C = z((P, k) => {
_ = P, S = k;
});
return tn(this, o, g, { _chunkSteps: u((P) => _({ value: P, done: false }), "_chunkSteps"), _closeSteps: u((P) => _({ value: P, done: true }), "_closeSteps"), _errorSteps: u((P) => S(P), "_errorSteps") }), C;
}
releaseLock() {
if (!Be(this)) throw dt("releaseLock");
this._ownerReadableStream !== void 0 && po(this);
}
}
Object.defineProperties(Se.prototype, { cancel: { enumerable: true }, read: { enumerable: true }, releaseLock: { enumerable: true }, closed: { enumerable: true } }), w(Se.prototype.cancel, "cancel"), w(Se.prototype.read, "read"), w(Se.prototype.releaseLock, "releaseLock"), typeof Symbol.toStringTag == "symbol" && Object.defineProperty(Se.prototype, Symbol.toStringTag, { value: "ReadableStreamBYOBReader", configurable: true });
function Be(n) {
return !b(n) || !Object.prototype.hasOwnProperty.call(n, "_readIntoRequests") ? false : n instanceof Se;
}
u(Be, "IsReadableStreamBYOBReader");
function tn(n, o, a, p) {
const g = n._ownerReadableStream;
g._disturbed = true, g._state === "errored" ? p._errorSteps(g._storedError) : no(g._readableStreamController, o, a, p);
}
u(tn, "ReadableStreamBYOBReaderRead");
function po(n) {
ue(n);
const o = new TypeError("Reader was released");
rn(n, o);
}
u(po, "ReadableStreamBYOBReaderRelease");
function rn(n, o) {
const a = n._readIntoRequests;
n._readIntoRequests = new Q(), a.forEach((p) => {
p._errorSteps(o);
});
}
u(rn, "ReadableStreamBYOBReaderErrorReadIntoRequests");
function dt(n) {
return new TypeError(`ReadableStreamBYOBReader.prototype.${n} can only be used on a ReadableStreamBYOBReader`);
}
u(dt, "byobReaderBrandCheckException");
function Ze(n, o) {
const { highWaterMark: a } = n;
if (a === void 0) return o;
if (Ir(a) || a < 0) throw new RangeError("Invalid highWaterMark");
return a;
}
u(Ze, "ExtractHighWaterMark");
function ht(n) {
const { size: o } = n;
return o || (() => 1);
}
u(ht, "ExtractSizeAlgorithm");
fu