diff --git a/README.md b/README.md index b20edfb..34707db 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ jobs: contents: write steps: - name: devcard - uses: dailydotdev/action-devcard@3.0.0 + uses: dailydotdev/action-devcard@3.1.0 with: user_id: ${{ secrets.USER_ID }} ``` @@ -24,7 +24,7 @@ jobs: ### Required - `user_id`: this is the unique id of the devcard, it can be found in the URL of the devcard or [here](https://app.daily.dev/api/id). - - e.g. `https://api.daily.dev/devcards/v2/0b156485612243bfa39093.0.071e276.png` where the user_id is `0b156485612243bfa39093.0.071e276` + - e.g. `https://api.daily.dev/devcards/v2/0b156485612243bfa39093.1.071e276.png` where the user_id is `0b156485612243bfa39093.1.071e276` - Can be found at [https://app.daily.dev/api/id](https://app.daily.dev/api/id) ### Optional @@ -54,7 +54,7 @@ jobs: contents: write steps: - name: devcard - uses: dailydotdev/action-devcard@3.0.0 + uses: dailydotdev/action-devcard@3.1.0 with: user_id: ${{ secrets.USER_ID }} commit_branch: devcard diff --git a/dist/index.js b/dist/index.js index 57e8b57..6e71ee0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12,4 +12,4 @@ if(!globalThis.DOMException){try{const{MessageChannel:t}=A(1267),r=(new t).port1 */ (function(t,A){true?A(r):0})(this,(function(t){"use strict";const r=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?Symbol:t=>`Symbol(${t})`;function noop(){return undefined}function typeIsObject(t){return typeof t==="object"&&t!==null||typeof t==="function"}const A=noop;function setFunctionName(t,r){try{Object.defineProperty(t,"name",{value:r,configurable:true})}catch(t){}}const s=Promise;const o=Promise.prototype.then;const n=Promise.reject.bind(s);function newPromise(t){return new s(t)}function promiseResolvedWith(t){return newPromise((r=>r(t)))}function promiseRejectedWith(t){return n(t)}function PerformPromiseThen(t,r,A){return o.call(t,r,A)}function uponPromise(t,r,s){PerformPromiseThen(PerformPromiseThen(t,r,s),undefined,A)}function uponFulfillment(t,r){uponPromise(t,r)}function uponRejection(t,r){uponPromise(t,undefined,r)}function transformPromiseWith(t,r,A){return PerformPromiseThen(t,r,A)}function setPromiseIsHandledToTrue(t){PerformPromiseThen(t,undefined,A)}let _queueMicrotask=t=>{if(typeof queueMicrotask==="function"){_queueMicrotask=queueMicrotask}else{const t=promiseResolvedWith(undefined);_queueMicrotask=r=>PerformPromiseThen(t,r)}return _queueMicrotask(t)};function reflectCall(t,r,A){if(typeof t!=="function"){throw new TypeError("Argument is not a function")}return Function.prototype.apply.call(t,r,A)}function promiseCall(t,r,A){try{return promiseResolvedWith(reflectCall(t,r,A))}catch(t){return promiseRejectedWith(t)}}const i=16384;class SimpleQueue{constructor(){this._cursor=0;this._size=0;this._front={_elements:[],_next:undefined};this._back=this._front;this._cursor=0;this._size=0}get length(){return this._size}push(t){const r=this._back;let A=r;if(r._elements.length===i-1){A={_elements:[],_next:undefined}}r._elements.push(t);if(A!==r){this._back=A;r._next=A}++this._size}shift(){const t=this._front;let r=t;const A=this._cursor;let s=A+1;const o=t._elements;const n=o[A];if(s===i){r=t._next;s=0}--this._size;this._cursor=s;if(t!==r){this._front=r}o[A]=undefined;return n}forEach(t){let r=this._cursor;let A=this._front;let s=A._elements;while(r!==s.length||A._next!==undefined){if(r===s.length){A=A._next;s=A._elements;r=0;if(s.length===0){break}}t(s[r]);++r}}peek(){const t=this._front;const r=this._cursor;return t._elements[r]}}const a=r("[[AbortSteps]]");const c=r("[[ErrorSteps]]");const l=r("[[CancelSteps]]");const u=r("[[PullSteps]]");const g=r("[[ReleaseSteps]]");function ReadableStreamReaderGenericInitialize(t,r){t._ownerReadableStream=r;r._reader=t;if(r._state==="readable"){defaultReaderClosedPromiseInitialize(t)}else if(r._state==="closed"){defaultReaderClosedPromiseInitializeAsResolved(t)}else{defaultReaderClosedPromiseInitializeAsRejected(t,r._storedError)}}function ReadableStreamReaderGenericCancel(t,r){const A=t._ownerReadableStream;return ReadableStreamCancel(A,r)}function ReadableStreamReaderGenericRelease(t){const r=t._ownerReadableStream;if(r._state==="readable"){defaultReaderClosedPromiseReject(t,new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`))}else{defaultReaderClosedPromiseResetToRejected(t,new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`))}r._readableStreamController[g]();r._reader=undefined;t._ownerReadableStream=undefined}function readerLockException(t){return new TypeError("Cannot "+t+" a stream using a released reader")}function defaultReaderClosedPromiseInitialize(t){t._closedPromise=newPromise(((r,A)=>{t._closedPromise_resolve=r;t._closedPromise_reject=A}))}function defaultReaderClosedPromiseInitializeAsRejected(t,r){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseReject(t,r)}function defaultReaderClosedPromiseInitializeAsResolved(t){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseResolve(t)}function defaultReaderClosedPromiseReject(t,r){if(t._closedPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined}function defaultReaderClosedPromiseResetToRejected(t,r){defaultReaderClosedPromiseInitializeAsRejected(t,r)}function defaultReaderClosedPromiseResolve(t){if(t._closedPromise_resolve===undefined){return}t._closedPromise_resolve(undefined);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined}const d=Number.isFinite||function(t){return typeof t==="number"&&isFinite(t)};const E=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};function isDictionary(t){return typeof t==="object"||typeof t==="function"}function assertDictionary(t,r){if(t!==undefined&&!isDictionary(t)){throw new TypeError(`${r} is not an object.`)}}function assertFunction(t,r){if(typeof t!=="function"){throw new TypeError(`${r} is not a function.`)}}function isObject(t){return typeof t==="object"&&t!==null||typeof t==="function"}function assertObject(t,r){if(!isObject(t)){throw new TypeError(`${r} is not an object.`)}}function assertRequiredArgument(t,r,A){if(t===undefined){throw new TypeError(`Parameter ${r} is required in '${A}'.`)}}function assertRequiredField(t,r,A){if(t===undefined){throw new TypeError(`${r} is required in '${A}'.`)}}function convertUnrestrictedDouble(t){return Number(t)}function censorNegativeZero(t){return t===0?0:t}function integerPart(t){return censorNegativeZero(E(t))}function convertUnsignedLongLongWithEnforceRange(t,r){const A=0;const s=Number.MAX_SAFE_INTEGER;let o=Number(t);o=censorNegativeZero(o);if(!d(o)){throw new TypeError(`${r} is not a finite number`)}o=integerPart(o);if(os){throw new TypeError(`${r} is outside the accepted range of ${A} to ${s}, inclusive`)}if(!d(o)||o===0){return 0}return o}function assertReadableStream(t,r){if(!IsReadableStream(t)){throw new TypeError(`${r} is not a ReadableStream.`)}}function AcquireReadableStreamDefaultReader(t){return new ReadableStreamDefaultReader(t)}function ReadableStreamAddReadRequest(t,r){t._reader._readRequests.push(r)}function ReadableStreamFulfillReadRequest(t,r,A){const s=t._reader;const o=s._readRequests.shift();if(A){o._closeSteps()}else{o._chunkSteps(r)}}function ReadableStreamGetNumReadRequests(t){return t._reader._readRequests.length}function ReadableStreamHasDefaultReader(t){const r=t._reader;if(r===undefined){return false}if(!IsReadableStreamDefaultReader(r)){return false}return true}class ReadableStreamDefaultReader{constructor(t){assertRequiredArgument(t,1,"ReadableStreamDefaultReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive reading by another reader")}ReadableStreamReaderGenericInitialize(this,t);this._readRequests=new SimpleQueue}get closed(){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("closed"))}return this._closedPromise}cancel(t=undefined){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("cancel"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("cancel"))}return ReadableStreamReaderGenericCancel(this,t)}read(){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("read"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("read from"))}let t;let r;const A=newPromise(((A,s)=>{t=A;r=s}));const s={_chunkSteps:r=>t({value:r,done:false}),_closeSteps:()=>t({value:undefined,done:true}),_errorSteps:t=>r(t)};ReadableStreamDefaultReaderRead(this,s);return A}releaseLock(){if(!IsReadableStreamDefaultReader(this)){throw defaultReaderBrandCheckException("releaseLock")}if(this._ownerReadableStream===undefined){return}ReadableStreamDefaultReaderRelease(this)}}Object.defineProperties(ReadableStreamDefaultReader.prototype,{cancel:{enumerable:true},read:{enumerable:true},releaseLock:{enumerable:true},closed:{enumerable:true}});setFunctionName(ReadableStreamDefaultReader.prototype.cancel,"cancel");setFunctionName(ReadableStreamDefaultReader.prototype.read,"read");setFunctionName(ReadableStreamDefaultReader.prototype.releaseLock,"releaseLock");if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamDefaultReader.prototype,r.toStringTag,{value:"ReadableStreamDefaultReader",configurable:true})}function IsReadableStreamDefaultReader(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readRequests")){return false}return t instanceof ReadableStreamDefaultReader}function ReadableStreamDefaultReaderRead(t,r){const A=t._ownerReadableStream;A._disturbed=true;if(A._state==="closed"){r._closeSteps()}else if(A._state==="errored"){r._errorSteps(A._storedError)}else{A._readableStreamController[u](r)}}function ReadableStreamDefaultReaderRelease(t){ReadableStreamReaderGenericRelease(t);const r=new TypeError("Reader was released");ReadableStreamDefaultReaderErrorReadRequests(t,r)}function ReadableStreamDefaultReaderErrorReadRequests(t,r){const A=t._readRequests;t._readRequests=new SimpleQueue;A.forEach((t=>{t._errorSteps(r)}))}function defaultReaderBrandCheckException(t){return new TypeError(`ReadableStreamDefaultReader.prototype.${t} can only be used on a ReadableStreamDefaultReader`)}const h=Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})).prototype);class ReadableStreamAsyncIteratorImpl{constructor(t,r){this._ongoingPromise=undefined;this._isFinished=false;this._reader=t;this._preventCancel=r}next(){const nextSteps=()=>this._nextSteps();this._ongoingPromise=this._ongoingPromise?transformPromiseWith(this._ongoingPromise,nextSteps,nextSteps):nextSteps();return this._ongoingPromise}return(t){const returnSteps=()=>this._returnSteps(t);return this._ongoingPromise?transformPromiseWith(this._ongoingPromise,returnSteps,returnSteps):returnSteps()}_nextSteps(){if(this._isFinished){return Promise.resolve({value:undefined,done:true})}const t=this._reader;let r;let A;const s=newPromise(((t,s)=>{r=t;A=s}));const o={_chunkSteps:t=>{this._ongoingPromise=undefined;_queueMicrotask((()=>r({value:t,done:false})))},_closeSteps:()=>{this._ongoingPromise=undefined;this._isFinished=true;ReadableStreamReaderGenericRelease(t);r({value:undefined,done:true})},_errorSteps:r=>{this._ongoingPromise=undefined;this._isFinished=true;ReadableStreamReaderGenericRelease(t);A(r)}};ReadableStreamDefaultReaderRead(t,o);return s}_returnSteps(t){if(this._isFinished){return Promise.resolve({value:t,done:true})}this._isFinished=true;const r=this._reader;if(!this._preventCancel){const A=ReadableStreamReaderGenericCancel(r,t);ReadableStreamReaderGenericRelease(r);return transformPromiseWith(A,(()=>({value:t,done:true})))}ReadableStreamReaderGenericRelease(r);return promiseResolvedWith({value:t,done:true})}}const C={next(){if(!IsReadableStreamAsyncIterator(this)){return promiseRejectedWith(streamAsyncIteratorBrandCheckException("next"))}return this._asyncIteratorImpl.next()},return(t){if(!IsReadableStreamAsyncIterator(this)){return promiseRejectedWith(streamAsyncIteratorBrandCheckException("return"))}return this._asyncIteratorImpl.return(t)}};if(h!==undefined){Object.setPrototypeOf(C,h)}function AcquireReadableStreamAsyncIterator(t,r){const A=AcquireReadableStreamDefaultReader(t);const s=new ReadableStreamAsyncIteratorImpl(A,r);const o=Object.create(C);o._asyncIteratorImpl=s;return o}function IsReadableStreamAsyncIterator(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_asyncIteratorImpl")){return false}try{return t._asyncIteratorImpl instanceof ReadableStreamAsyncIteratorImpl}catch(t){return false}}function streamAsyncIteratorBrandCheckException(t){return new TypeError(`ReadableStreamAsyncIterator.${t} can only be used on a ReadableSteamAsyncIterator`)}const Q=Number.isNaN||function(t){return t!==t};function CreateArrayFromList(t){return t.slice()}function CopyDataBlockBytes(t,r,A,s,o){new Uint8Array(t).set(new Uint8Array(A,s,o),r)}let TransferArrayBuffer=t=>{if(typeof t.transfer==="function"){TransferArrayBuffer=t=>t.transfer()}else if(typeof structuredClone==="function"){TransferArrayBuffer=t=>structuredClone(t,{transfer:[t]})}else{TransferArrayBuffer=t=>t}return TransferArrayBuffer(t)};let IsDetachedBuffer=t=>{if(typeof t.detached==="boolean"){IsDetachedBuffer=t=>t.detached}else{IsDetachedBuffer=t=>t.byteLength===0}return IsDetachedBuffer(t)};function ArrayBufferSlice(t,r,A){if(t.slice){return t.slice(r,A)}const s=A-r;const o=new ArrayBuffer(s);CopyDataBlockBytes(o,0,t,r,s);return o}function GetMethod(t,r){const A=t[r];if(A===undefined||A===null){return undefined}if(typeof A!=="function"){throw new TypeError(`${String(r)} is not a function`)}return A}function CreateAsyncFromSyncIterator(t){const A={[r.iterator]:()=>t.iterator};const s=async function*(){return yield*A}();const o=s.next;return{iterator:s,nextMethod:o,done:false}}function GetIterator(t,A="sync",s){if(s===undefined){if(A==="async"){s=GetMethod(t,r.asyncIterator);if(s===undefined){const A=GetMethod(t,r.iterator);const s=GetIterator(t,"sync",A);return CreateAsyncFromSyncIterator(s)}}else{s=GetMethod(t,r.iterator)}}if(s===undefined){throw new TypeError("The object is not iterable")}const o=reflectCall(s,t,[]);if(!typeIsObject(o)){throw new TypeError("The iterator method must return an object")}const n=o.next;return{iterator:o,nextMethod:n,done:false}}function IteratorNext(t){const r=reflectCall(t.nextMethod,t.iterator,[]);if(!typeIsObject(r)){throw new TypeError("The iterator.next() method must return an object")}return r}function IteratorComplete(t){return Boolean(t.done)}function IteratorValue(t){return t.value}function IsNonNegativeNumber(t){if(typeof t!=="number"){return false}if(Q(t)){return false}if(t<0){return false}return true}function CloneAsUint8Array(t){const r=ArrayBufferSlice(t.buffer,t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(r)}function DequeueValue(t){const r=t._queue.shift();t._queueTotalSize-=r.size;if(t._queueTotalSize<0){t._queueTotalSize=0}return r.value}function EnqueueValueWithSize(t,r,A){if(!IsNonNegativeNumber(A)||A===Infinity){throw new RangeError("Size must be a finite, non-NaN, non-negative number.")}t._queue.push({value:r,size:A});t._queueTotalSize+=A}function PeekQueueValue(t){const r=t._queue.peek();return r.value}function ResetQueue(t){t._queue=new SimpleQueue;t._queueTotalSize=0}function isDataViewConstructor(t){return t===DataView}function isDataView(t){return isDataViewConstructor(t.constructor)}function arrayBufferViewElementSize(t){if(isDataViewConstructor(t)){return 1}return t.BYTES_PER_ELEMENT}class ReadableStreamBYOBRequest{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("view")}return this._view}respond(t){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("respond")}assertRequiredArgument(t,1,"respond");t=convertUnsignedLongLongWithEnforceRange(t,"First parameter");if(this._associatedReadableByteStreamController===undefined){throw new TypeError("This BYOB request has been invalidated")}if(IsDetachedBuffer(this._view.buffer)){throw new TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`)}ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("respondWithNewView")}assertRequiredArgument(t,1,"respondWithNewView");if(!ArrayBuffer.isView(t)){throw new TypeError("You can only respond with array buffer views")}if(this._associatedReadableByteStreamController===undefined){throw new TypeError("This BYOB request has been invalidated")}if(IsDetachedBuffer(t.buffer)){throw new TypeError("The given view's buffer has been detached and so cannot be used as a response")}ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController,t)}}Object.defineProperties(ReadableStreamBYOBRequest.prototype,{respond:{enumerable:true},respondWithNewView:{enumerable:true},view:{enumerable:true}});setFunctionName(ReadableStreamBYOBRequest.prototype.respond,"respond");setFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView,"respondWithNewView");if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamBYOBRequest.prototype,r.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:true})}class ReadableByteStreamController{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("byobRequest")}return ReadableByteStreamControllerGetBYOBRequest(this)}get desiredSize(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("desiredSize")}return ReadableByteStreamControllerGetDesiredSize(this)}close(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("close")}if(this._closeRequested){throw new TypeError("The stream has already been closed; do not close it again!")}const t=this._controlledReadableByteStream._state;if(t!=="readable"){throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`)}ReadableByteStreamControllerClose(this)}enqueue(t){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("enqueue")}assertRequiredArgument(t,1,"enqueue");if(!ArrayBuffer.isView(t)){throw new TypeError("chunk must be an array buffer view")}if(t.byteLength===0){throw new TypeError("chunk must have non-zero byteLength")}if(t.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 r=this._controlledReadableByteStream._state;if(r!=="readable"){throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`)}ReadableByteStreamControllerEnqueue(this,t)}error(t=undefined){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("error")}ReadableByteStreamControllerError(this,t)}[l](t){ReadableByteStreamControllerClearPendingPullIntos(this);ResetQueue(this);const r=this._cancelAlgorithm(t);ReadableByteStreamControllerClearAlgorithms(this);return r}[u](t){const r=this._controlledReadableByteStream;if(this._queueTotalSize>0){ReadableByteStreamControllerFillReadRequestFromQueue(this,t);return}const A=this._autoAllocateChunkSize;if(A!==undefined){let r;try{r=new ArrayBuffer(A)}catch(r){t._errorSteps(r);return}const s={buffer:r,bufferByteLength:A,byteOffset:0,byteLength:A,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(s)}ReadableStreamAddReadRequest(r,t);ReadableByteStreamControllerCallPullIfNeeded(this)}[g](){if(this._pendingPullIntos.length>0){const t=this._pendingPullIntos.peek();t.readerType="none";this._pendingPullIntos=new SimpleQueue;this._pendingPullIntos.push(t)}}}Object.defineProperties(ReadableByteStreamController.prototype,{close:{enumerable:true},enqueue:{enumerable:true},error:{enumerable:true},byobRequest:{enumerable:true},desiredSize:{enumerable:true}});setFunctionName(ReadableByteStreamController.prototype.close,"close");setFunctionName(ReadableByteStreamController.prototype.enqueue,"enqueue");setFunctionName(ReadableByteStreamController.prototype.error,"error");if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableByteStreamController.prototype,r.toStringTag,{value:"ReadableByteStreamController",configurable:true})}function IsReadableByteStreamController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledReadableByteStream")){return false}return t instanceof ReadableByteStreamController}function IsReadableStreamBYOBRequest(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_associatedReadableByteStreamController")){return false}return t instanceof ReadableStreamBYOBRequest}function ReadableByteStreamControllerCallPullIfNeeded(t){const r=ReadableByteStreamControllerShouldCallPull(t);if(!r){return}if(t._pulling){t._pullAgain=true;return}t._pulling=true;const A=t._pullAlgorithm();uponPromise(A,(()=>{t._pulling=false;if(t._pullAgain){t._pullAgain=false;ReadableByteStreamControllerCallPullIfNeeded(t)}return null}),(r=>{ReadableByteStreamControllerError(t,r);return null}))}function ReadableByteStreamControllerClearPendingPullIntos(t){ReadableByteStreamControllerInvalidateBYOBRequest(t);t._pendingPullIntos=new SimpleQueue}function ReadableByteStreamControllerCommitPullIntoDescriptor(t,r){let A=false;if(t._state==="closed"){A=true}const s=ReadableByteStreamControllerConvertPullIntoDescriptor(r);if(r.readerType==="default"){ReadableStreamFulfillReadRequest(t,s,A)}else{ReadableStreamFulfillReadIntoRequest(t,s,A)}}function ReadableByteStreamControllerConvertPullIntoDescriptor(t){const r=t.bytesFilled;const A=t.elementSize;return new t.viewConstructor(t.buffer,t.byteOffset,r/A)}function ReadableByteStreamControllerEnqueueChunkToQueue(t,r,A,s){t._queue.push({buffer:r,byteOffset:A,byteLength:s});t._queueTotalSize+=s}function ReadableByteStreamControllerEnqueueClonedChunkToQueue(t,r,A,s){let o;try{o=ArrayBufferSlice(r,A,A+s)}catch(r){ReadableByteStreamControllerError(t,r);throw r}ReadableByteStreamControllerEnqueueChunkToQueue(t,o,0,s)}function ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(t,r){if(r.bytesFilled>0){ReadableByteStreamControllerEnqueueClonedChunkToQueue(t,r.buffer,r.byteOffset,r.bytesFilled)}ReadableByteStreamControllerShiftPendingPullInto(t)}function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r){const A=Math.min(t._queueTotalSize,r.byteLength-r.bytesFilled);const s=r.bytesFilled+A;let o=A;let n=false;const i=s%r.elementSize;const a=s-i;if(a>=r.minimumFill){o=a-r.bytesFilled;n=true}const c=t._queue;while(o>0){const A=c.peek();const s=Math.min(o,A.byteLength);const n=r.byteOffset+r.bytesFilled;CopyDataBlockBytes(r.buffer,n,A.buffer,A.byteOffset,s);if(A.byteLength===s){c.shift()}else{A.byteOffset+=s;A.byteLength-=s}t._queueTotalSize-=s;ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,s,r);o-=s}return n}function ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,r,A){A.bytesFilled+=r}function ReadableByteStreamControllerHandleQueueDrain(t){if(t._queueTotalSize===0&&t._closeRequested){ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(t._controlledReadableByteStream)}else{ReadableByteStreamControllerCallPullIfNeeded(t)}}function ReadableByteStreamControllerInvalidateBYOBRequest(t){if(t._byobRequest===null){return}t._byobRequest._associatedReadableByteStreamController=undefined;t._byobRequest._view=null;t._byobRequest=null}function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t){while(t._pendingPullIntos.length>0){if(t._queueTotalSize===0){return}const r=t._pendingPullIntos.peek();if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r)){ReadableByteStreamControllerShiftPendingPullInto(t);ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,r)}}}function ReadableByteStreamControllerProcessReadRequestsUsingQueue(t){const r=t._controlledReadableByteStream._reader;while(r._readRequests.length>0){if(t._queueTotalSize===0){return}const A=r._readRequests.shift();ReadableByteStreamControllerFillReadRequestFromQueue(t,A)}}function ReadableByteStreamControllerPullInto(t,r,A,s){const o=t._controlledReadableByteStream;const n=r.constructor;const i=arrayBufferViewElementSize(n);const{byteOffset:a,byteLength:c}=r;const l=A*i;let u;try{u=TransferArrayBuffer(r.buffer)}catch(t){s._errorSteps(t);return}const g={buffer:u,bufferByteLength:u.byteLength,byteOffset:a,byteLength:c,bytesFilled:0,minimumFill:l,elementSize:i,viewConstructor:n,readerType:"byob"};if(t._pendingPullIntos.length>0){t._pendingPullIntos.push(g);ReadableStreamAddReadIntoRequest(o,s);return}if(o._state==="closed"){const t=new n(g.buffer,g.byteOffset,0);s._closeSteps(t);return}if(t._queueTotalSize>0){if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,g)){const r=ReadableByteStreamControllerConvertPullIntoDescriptor(g);ReadableByteStreamControllerHandleQueueDrain(t);s._chunkSteps(r);return}if(t._closeRequested){const r=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,r);s._errorSteps(r);return}}t._pendingPullIntos.push(g);ReadableStreamAddReadIntoRequest(o,s);ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerRespondInClosedState(t,r){if(r.readerType==="none"){ReadableByteStreamControllerShiftPendingPullInto(t)}const A=t._controlledReadableByteStream;if(ReadableStreamHasBYOBReader(A)){while(ReadableStreamGetNumReadIntoRequests(A)>0){const r=ReadableByteStreamControllerShiftPendingPullInto(t);ReadableByteStreamControllerCommitPullIntoDescriptor(A,r)}}}function ReadableByteStreamControllerRespondInReadableState(t,r,A){ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,r,A);if(A.readerType==="none"){ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(t,A);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t);return}if(A.bytesFilled0){const r=A.byteOffset+A.bytesFilled;ReadableByteStreamControllerEnqueueClonedChunkToQueue(t,A.buffer,r-s,s)}A.bytesFilled-=s;ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,A);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}function ReadableByteStreamControllerRespondInternal(t,r){const A=t._pendingPullIntos.peek();ReadableByteStreamControllerInvalidateBYOBRequest(t);const s=t._controlledReadableByteStream._state;if(s==="closed"){ReadableByteStreamControllerRespondInClosedState(t,A)}else{ReadableByteStreamControllerRespondInReadableState(t,r,A)}ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerShiftPendingPullInto(t){const r=t._pendingPullIntos.shift();return r}function ReadableByteStreamControllerShouldCallPull(t){const r=t._controlledReadableByteStream;if(r._state!=="readable"){return false}if(t._closeRequested){return false}if(!t._started){return false}if(ReadableStreamHasDefaultReader(r)&&ReadableStreamGetNumReadRequests(r)>0){return true}if(ReadableStreamHasBYOBReader(r)&&ReadableStreamGetNumReadIntoRequests(r)>0){return true}const A=ReadableByteStreamControllerGetDesiredSize(t);if(A>0){return true}return false}function ReadableByteStreamControllerClearAlgorithms(t){t._pullAlgorithm=undefined;t._cancelAlgorithm=undefined}function ReadableByteStreamControllerClose(t){const r=t._controlledReadableByteStream;if(t._closeRequested||r._state!=="readable"){return}if(t._queueTotalSize>0){t._closeRequested=true;return}if(t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();if(r.bytesFilled%r.elementSize!==0){const r=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,r);throw r}}ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(r)}function ReadableByteStreamControllerEnqueue(t,r){const A=t._controlledReadableByteStream;if(t._closeRequested||A._state!=="readable"){return}const{buffer:s,byteOffset:o,byteLength:n}=r;if(IsDetachedBuffer(s)){throw new TypeError("chunk's buffer is detached and so cannot be enqueued")}const i=TransferArrayBuffer(s);if(t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();if(IsDetachedBuffer(r.buffer)){throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk")}ReadableByteStreamControllerInvalidateBYOBRequest(t);r.buffer=TransferArrayBuffer(r.buffer);if(r.readerType==="none"){ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(t,r)}}if(ReadableStreamHasDefaultReader(A)){ReadableByteStreamControllerProcessReadRequestsUsingQueue(t);if(ReadableStreamGetNumReadRequests(A)===0){ReadableByteStreamControllerEnqueueChunkToQueue(t,i,o,n)}else{if(t._pendingPullIntos.length>0){ReadableByteStreamControllerShiftPendingPullInto(t)}const r=new Uint8Array(i,o,n);ReadableStreamFulfillReadRequest(A,r,false)}}else if(ReadableStreamHasBYOBReader(A)){ReadableByteStreamControllerEnqueueChunkToQueue(t,i,o,n);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}else{ReadableByteStreamControllerEnqueueChunkToQueue(t,i,o,n)}ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerError(t,r){const A=t._controlledReadableByteStream;if(A._state!=="readable"){return}ReadableByteStreamControllerClearPendingPullIntos(t);ResetQueue(t);ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamError(A,r)}function ReadableByteStreamControllerFillReadRequestFromQueue(t,r){const A=t._queue.shift();t._queueTotalSize-=A.byteLength;ReadableByteStreamControllerHandleQueueDrain(t);const s=new Uint8Array(A.buffer,A.byteOffset,A.byteLength);r._chunkSteps(s)}function ReadableByteStreamControllerGetBYOBRequest(t){if(t._byobRequest===null&&t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();const A=new Uint8Array(r.buffer,r.byteOffset+r.bytesFilled,r.byteLength-r.bytesFilled);const s=Object.create(ReadableStreamBYOBRequest.prototype);SetUpReadableStreamBYOBRequest(s,t,A);t._byobRequest=s}return t._byobRequest}function ReadableByteStreamControllerGetDesiredSize(t){const r=t._controlledReadableByteStream._state;if(r==="errored"){return null}if(r==="closed"){return 0}return t._strategyHWM-t._queueTotalSize}function ReadableByteStreamControllerRespond(t,r){const A=t._pendingPullIntos.peek();const s=t._controlledReadableByteStream._state;if(s==="closed"){if(r!==0){throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}}else{if(r===0){throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream")}if(A.bytesFilled+r>A.byteLength){throw new RangeError("bytesWritten out of range")}}A.buffer=TransferArrayBuffer(A.buffer);ReadableByteStreamControllerRespondInternal(t,r)}function ReadableByteStreamControllerRespondWithNewView(t,r){const A=t._pendingPullIntos.peek();const s=t._controlledReadableByteStream._state;if(s==="closed"){if(r.byteLength!==0){throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}}else{if(r.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!==r.byteOffset){throw new RangeError("The region specified by view does not match byobRequest")}if(A.bufferByteLength!==r.buffer.byteLength){throw new RangeError("The buffer of view has different capacity than byobRequest")}if(A.bytesFilled+r.byteLength>A.byteLength){throw new RangeError("The region specified by view is larger than byobRequest")}const o=r.byteLength;A.buffer=TransferArrayBuffer(r.buffer);ReadableByteStreamControllerRespondInternal(t,o)}function SetUpReadableByteStreamController(t,r,A,s,o,n,i){r._controlledReadableByteStream=t;r._pullAgain=false;r._pulling=false;r._byobRequest=null;r._queue=r._queueTotalSize=undefined;ResetQueue(r);r._closeRequested=false;r._started=false;r._strategyHWM=n;r._pullAlgorithm=s;r._cancelAlgorithm=o;r._autoAllocateChunkSize=i;r._pendingPullIntos=new SimpleQueue;t._readableStreamController=r;const a=A();uponPromise(promiseResolvedWith(a),(()=>{r._started=true;ReadableByteStreamControllerCallPullIfNeeded(r);return null}),(t=>{ReadableByteStreamControllerError(r,t);return null}))}function SetUpReadableByteStreamControllerFromUnderlyingSource(t,r,A){const s=Object.create(ReadableByteStreamController.prototype);let o;let n;let i;if(r.start!==undefined){o=()=>r.start(s)}else{o=()=>undefined}if(r.pull!==undefined){n=()=>r.pull(s)}else{n=()=>promiseResolvedWith(undefined)}if(r.cancel!==undefined){i=t=>r.cancel(t)}else{i=()=>promiseResolvedWith(undefined)}const a=r.autoAllocateChunkSize;if(a===0){throw new TypeError("autoAllocateChunkSize must be greater than 0")}SetUpReadableByteStreamController(t,s,o,n,i,A,a)}function SetUpReadableStreamBYOBRequest(t,r,A){t._associatedReadableByteStreamController=r;t._view=A}function byobRequestBrandCheckException(t){return new TypeError(`ReadableStreamBYOBRequest.prototype.${t} can only be used on a ReadableStreamBYOBRequest`)}function byteStreamControllerBrandCheckException(t){return new TypeError(`ReadableByteStreamController.prototype.${t} can only be used on a ReadableByteStreamController`)}function convertReaderOptions(t,r){assertDictionary(t,r);const A=t===null||t===void 0?void 0:t.mode;return{mode:A===undefined?undefined:convertReadableStreamReaderMode(A,`${r} has member 'mode' that`)}}function convertReadableStreamReaderMode(t,r){t=`${t}`;if(t!=="byob"){throw new TypeError(`${r} '${t}' is not a valid enumeration value for ReadableStreamReaderMode`)}return t}function convertByobReadOptions(t,r){var A;assertDictionary(t,r);const s=(A=t===null||t===void 0?void 0:t.min)!==null&&A!==void 0?A:1;return{min:convertUnsignedLongLongWithEnforceRange(s,`${r} has member 'min' that`)}}function AcquireReadableStreamBYOBReader(t){return new ReadableStreamBYOBReader(t)}function ReadableStreamAddReadIntoRequest(t,r){t._reader._readIntoRequests.push(r)}function ReadableStreamFulfillReadIntoRequest(t,r,A){const s=t._reader;const o=s._readIntoRequests.shift();if(A){o._closeSteps(r)}else{o._chunkSteps(r)}}function ReadableStreamGetNumReadIntoRequests(t){return t._reader._readIntoRequests.length}function ReadableStreamHasBYOBReader(t){const r=t._reader;if(r===undefined){return false}if(!IsReadableStreamBYOBReader(r)){return false}return true}class ReadableStreamBYOBReader{constructor(t){assertRequiredArgument(t,1,"ReadableStreamBYOBReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive reading by another reader")}if(!IsReadableByteStreamController(t._readableStreamController)){throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte "+"source")}ReadableStreamReaderGenericInitialize(this,t);this._readIntoRequests=new SimpleQueue}get closed(){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("closed"))}return this._closedPromise}cancel(t=undefined){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("cancel"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("cancel"))}return ReadableStreamReaderGenericCancel(this,t)}read(t,r={}){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("read"))}if(!ArrayBuffer.isView(t)){return promiseRejectedWith(new TypeError("view must be an array buffer view"))}if(t.byteLength===0){return promiseRejectedWith(new TypeError("view must have non-zero byteLength"))}if(t.buffer.byteLength===0){return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`))}if(IsDetachedBuffer(t.buffer)){return promiseRejectedWith(new TypeError("view's buffer has been detached"))}let A;try{A=convertByobReadOptions(r,"options")}catch(t){return promiseRejectedWith(t)}const s=A.min;if(s===0){return promiseRejectedWith(new TypeError("options.min must be greater than 0"))}if(!isDataView(t)){if(s>t.length){return promiseRejectedWith(new RangeError("options.min must be less than or equal to view's length"))}}else if(s>t.byteLength){return promiseRejectedWith(new RangeError("options.min must be less than or equal to view's byteLength"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("read from"))}let o;let n;const i=newPromise(((t,r)=>{o=t;n=r}));const a={_chunkSteps:t=>o({value:t,done:false}),_closeSteps:t=>o({value:t,done:true}),_errorSteps:t=>n(t)};ReadableStreamBYOBReaderRead(this,t,s,a);return i}releaseLock(){if(!IsReadableStreamBYOBReader(this)){throw byobReaderBrandCheckException("releaseLock")}if(this._ownerReadableStream===undefined){return}ReadableStreamBYOBReaderRelease(this)}}Object.defineProperties(ReadableStreamBYOBReader.prototype,{cancel:{enumerable:true},read:{enumerable:true},releaseLock:{enumerable:true},closed:{enumerable:true}});setFunctionName(ReadableStreamBYOBReader.prototype.cancel,"cancel");setFunctionName(ReadableStreamBYOBReader.prototype.read,"read");setFunctionName(ReadableStreamBYOBReader.prototype.releaseLock,"releaseLock");if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamBYOBReader.prototype,r.toStringTag,{value:"ReadableStreamBYOBReader",configurable:true})}function IsReadableStreamBYOBReader(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readIntoRequests")){return false}return t instanceof ReadableStreamBYOBReader}function ReadableStreamBYOBReaderRead(t,r,A,s){const o=t._ownerReadableStream;o._disturbed=true;if(o._state==="errored"){s._errorSteps(o._storedError)}else{ReadableByteStreamControllerPullInto(o._readableStreamController,r,A,s)}}function ReadableStreamBYOBReaderRelease(t){ReadableStreamReaderGenericRelease(t);const r=new TypeError("Reader was released");ReadableStreamBYOBReaderErrorReadIntoRequests(t,r)}function ReadableStreamBYOBReaderErrorReadIntoRequests(t,r){const A=t._readIntoRequests;t._readIntoRequests=new SimpleQueue;A.forEach((t=>{t._errorSteps(r)}))}function byobReaderBrandCheckException(t){return new TypeError(`ReadableStreamBYOBReader.prototype.${t} can only be used on a ReadableStreamBYOBReader`)}function ExtractHighWaterMark(t,r){const{highWaterMark:A}=t;if(A===undefined){return r}if(Q(A)||A<0){throw new RangeError("Invalid highWaterMark")}return A}function ExtractSizeAlgorithm(t){const{size:r}=t;if(!r){return()=>1}return r}function convertQueuingStrategy(t,r){assertDictionary(t,r);const A=t===null||t===void 0?void 0:t.highWaterMark;const s=t===null||t===void 0?void 0:t.size;return{highWaterMark:A===undefined?undefined:convertUnrestrictedDouble(A),size:s===undefined?undefined:convertQueuingStrategySize(s,`${r} has member 'size' that`)}}function convertQueuingStrategySize(t,r){assertFunction(t,r);return r=>convertUnrestrictedDouble(t(r))}function convertUnderlyingSink(t,r){assertDictionary(t,r);const A=t===null||t===void 0?void 0:t.abort;const s=t===null||t===void 0?void 0:t.close;const o=t===null||t===void 0?void 0:t.start;const n=t===null||t===void 0?void 0:t.type;const i=t===null||t===void 0?void 0:t.write;return{abort:A===undefined?undefined:convertUnderlyingSinkAbortCallback(A,t,`${r} has member 'abort' that`),close:s===undefined?undefined:convertUnderlyingSinkCloseCallback(s,t,`${r} has member 'close' that`),start:o===undefined?undefined:convertUnderlyingSinkStartCallback(o,t,`${r} has member 'start' that`),write:i===undefined?undefined:convertUnderlyingSinkWriteCallback(i,t,`${r} has member 'write' that`),type:n}}function convertUnderlyingSinkAbortCallback(t,r,A){assertFunction(t,A);return A=>promiseCall(t,r,[A])}function convertUnderlyingSinkCloseCallback(t,r,A){assertFunction(t,A);return()=>promiseCall(t,r,[])}function convertUnderlyingSinkStartCallback(t,r,A){assertFunction(t,A);return A=>reflectCall(t,r,[A])}function convertUnderlyingSinkWriteCallback(t,r,A){assertFunction(t,A);return(A,s)=>promiseCall(t,r,[A,s])}function assertWritableStream(t,r){if(!IsWritableStream(t)){throw new TypeError(`${r} is not a WritableStream.`)}}function isAbortSignal(t){if(typeof t!=="object"||t===null){return false}try{return typeof t.aborted==="boolean"}catch(t){return false}}const p=typeof AbortController==="function";function createAbortController(){if(p){return new AbortController}return undefined}class WritableStream{constructor(t={},r={}){if(t===undefined){t=null}else{assertObject(t,"First parameter")}const A=convertQueuingStrategy(r,"Second parameter");const s=convertUnderlyingSink(t,"First parameter");InitializeWritableStream(this);const o=s.type;if(o!==undefined){throw new RangeError("Invalid type is specified")}const n=ExtractSizeAlgorithm(A);const i=ExtractHighWaterMark(A,1);SetUpWritableStreamDefaultControllerFromUnderlyingSink(this,s,i,n)}get locked(){if(!IsWritableStream(this)){throw streamBrandCheckException$2("locked")}return IsWritableStreamLocked(this)}abort(t=undefined){if(!IsWritableStream(this)){return promiseRejectedWith(streamBrandCheckException$2("abort"))}if(IsWritableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot abort a stream that already has a writer"))}return WritableStreamAbort(this,t)}close(){if(!IsWritableStream(this)){return promiseRejectedWith(streamBrandCheckException$2("close"))}if(IsWritableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot close a stream that already has a writer"))}if(WritableStreamCloseQueuedOrInFlight(this)){return promiseRejectedWith(new TypeError("Cannot close an already-closing stream"))}return WritableStreamClose(this)}getWriter(){if(!IsWritableStream(this)){throw streamBrandCheckException$2("getWriter")}return AcquireWritableStreamDefaultWriter(this)}}Object.defineProperties(WritableStream.prototype,{abort:{enumerable:true},close:{enumerable:true},getWriter:{enumerable:true},locked:{enumerable:true}});setFunctionName(WritableStream.prototype.abort,"abort");setFunctionName(WritableStream.prototype.close,"close");setFunctionName(WritableStream.prototype.getWriter,"getWriter");if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStream.prototype,r.toStringTag,{value:"WritableStream",configurable:true})}function AcquireWritableStreamDefaultWriter(t){return new WritableStreamDefaultWriter(t)}function CreateWritableStream(t,r,A,s,o=1,n=(()=>1)){const i=Object.create(WritableStream.prototype);InitializeWritableStream(i);const a=Object.create(WritableStreamDefaultController.prototype);SetUpWritableStreamDefaultController(i,a,t,r,A,s,o,n);return i}function InitializeWritableStream(t){t._state="writable";t._storedError=undefined;t._writer=undefined;t._writableStreamController=undefined;t._writeRequests=new SimpleQueue;t._inFlightWriteRequest=undefined;t._closeRequest=undefined;t._inFlightCloseRequest=undefined;t._pendingAbortRequest=undefined;t._backpressure=false}function IsWritableStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_writableStreamController")){return false}return t instanceof WritableStream}function IsWritableStreamLocked(t){if(t._writer===undefined){return false}return true}function WritableStreamAbort(t,r){var A;if(t._state==="closed"||t._state==="errored"){return promiseResolvedWith(undefined)}t._writableStreamController._abortReason=r;(A=t._writableStreamController._abortController)===null||A===void 0?void 0:A.abort(r);const s=t._state;if(s==="closed"||s==="errored"){return promiseResolvedWith(undefined)}if(t._pendingAbortRequest!==undefined){return t._pendingAbortRequest._promise}let o=false;if(s==="erroring"){o=true;r=undefined}const n=newPromise(((A,s)=>{t._pendingAbortRequest={_promise:undefined,_resolve:A,_reject:s,_reason:r,_wasAlreadyErroring:o}}));t._pendingAbortRequest._promise=n;if(!o){WritableStreamStartErroring(t,r)}return n}function WritableStreamClose(t){const r=t._state;if(r==="closed"||r==="errored"){return promiseRejectedWith(new TypeError(`The stream (in ${r} state) is not in the writable state and cannot be closed`))}const A=newPromise(((r,A)=>{const s={_resolve:r,_reject:A};t._closeRequest=s}));const s=t._writer;if(s!==undefined&&t._backpressure&&r==="writable"){defaultWriterReadyPromiseResolve(s)}WritableStreamDefaultControllerClose(t._writableStreamController);return A}function WritableStreamAddWriteRequest(t){const r=newPromise(((r,A)=>{const s={_resolve:r,_reject:A};t._writeRequests.push(s)}));return r}function WritableStreamDealWithRejection(t,r){const A=t._state;if(A==="writable"){WritableStreamStartErroring(t,r);return}WritableStreamFinishErroring(t)}function WritableStreamStartErroring(t,r){const A=t._writableStreamController;t._state="erroring";t._storedError=r;const s=t._writer;if(s!==undefined){WritableStreamDefaultWriterEnsureReadyPromiseRejected(s,r)}if(!WritableStreamHasOperationMarkedInFlight(t)&&A._started){WritableStreamFinishErroring(t)}}function WritableStreamFinishErroring(t){t._state="errored";t._writableStreamController[c]();const r=t._storedError;t._writeRequests.forEach((t=>{t._reject(r)}));t._writeRequests=new SimpleQueue;if(t._pendingAbortRequest===undefined){WritableStreamRejectCloseAndClosedPromiseIfNeeded(t);return}const A=t._pendingAbortRequest;t._pendingAbortRequest=undefined;if(A._wasAlreadyErroring){A._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t);return}const s=t._writableStreamController[a](A._reason);uponPromise(s,(()=>{A._resolve();WritableStreamRejectCloseAndClosedPromiseIfNeeded(t);return null}),(r=>{A._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t);return null}))}function WritableStreamFinishInFlightWrite(t){t._inFlightWriteRequest._resolve(undefined);t._inFlightWriteRequest=undefined}function WritableStreamFinishInFlightWriteWithError(t,r){t._inFlightWriteRequest._reject(r);t._inFlightWriteRequest=undefined;WritableStreamDealWithRejection(t,r)}function WritableStreamFinishInFlightClose(t){t._inFlightCloseRequest._resolve(undefined);t._inFlightCloseRequest=undefined;const r=t._state;if(r==="erroring"){t._storedError=undefined;if(t._pendingAbortRequest!==undefined){t._pendingAbortRequest._resolve();t._pendingAbortRequest=undefined}}t._state="closed";const A=t._writer;if(A!==undefined){defaultWriterClosedPromiseResolve(A)}}function WritableStreamFinishInFlightCloseWithError(t,r){t._inFlightCloseRequest._reject(r);t._inFlightCloseRequest=undefined;if(t._pendingAbortRequest!==undefined){t._pendingAbortRequest._reject(r);t._pendingAbortRequest=undefined}WritableStreamDealWithRejection(t,r)}function WritableStreamCloseQueuedOrInFlight(t){if(t._closeRequest===undefined&&t._inFlightCloseRequest===undefined){return false}return true}function WritableStreamHasOperationMarkedInFlight(t){if(t._inFlightWriteRequest===undefined&&t._inFlightCloseRequest===undefined){return false}return true}function WritableStreamMarkCloseRequestInFlight(t){t._inFlightCloseRequest=t._closeRequest;t._closeRequest=undefined}function WritableStreamMarkFirstWriteRequestInFlight(t){t._inFlightWriteRequest=t._writeRequests.shift()}function WritableStreamRejectCloseAndClosedPromiseIfNeeded(t){if(t._closeRequest!==undefined){t._closeRequest._reject(t._storedError);t._closeRequest=undefined}const r=t._writer;if(r!==undefined){defaultWriterClosedPromiseReject(r,t._storedError)}}function WritableStreamUpdateBackpressure(t,r){const A=t._writer;if(A!==undefined&&r!==t._backpressure){if(r){defaultWriterReadyPromiseReset(A)}else{defaultWriterReadyPromiseResolve(A)}}t._backpressure=r}class WritableStreamDefaultWriter{constructor(t){assertRequiredArgument(t,1,"WritableStreamDefaultWriter");assertWritableStream(t,"First parameter");if(IsWritableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive writing by another writer")}this._ownerWritableStream=t;t._writer=this;const r=t._state;if(r==="writable"){if(!WritableStreamCloseQueuedOrInFlight(t)&&t._backpressure){defaultWriterReadyPromiseInitialize(this)}else{defaultWriterReadyPromiseInitializeAsResolved(this)}defaultWriterClosedPromiseInitialize(this)}else if(r==="erroring"){defaultWriterReadyPromiseInitializeAsRejected(this,t._storedError);defaultWriterClosedPromiseInitialize(this)}else if(r==="closed"){defaultWriterReadyPromiseInitializeAsResolved(this);defaultWriterClosedPromiseInitializeAsResolved(this)}else{const r=t._storedError;defaultWriterReadyPromiseInitializeAsRejected(this,r);defaultWriterClosedPromiseInitializeAsRejected(this,r)}}get closed(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("closed"))}return this._closedPromise}get desiredSize(){if(!IsWritableStreamDefaultWriter(this)){throw defaultWriterBrandCheckException("desiredSize")}if(this._ownerWritableStream===undefined){throw defaultWriterLockException("desiredSize")}return WritableStreamDefaultWriterGetDesiredSize(this)}get ready(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("ready"))}return this._readyPromise}abort(t=undefined){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("abort"))}if(this._ownerWritableStream===undefined){return promiseRejectedWith(defaultWriterLockException("abort"))}return WritableStreamDefaultWriterAbort(this,t)}close(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("close"))}const t=this._ownerWritableStream;if(t===undefined){return promiseRejectedWith(defaultWriterLockException("close"))}if(WritableStreamCloseQueuedOrInFlight(t)){return promiseRejectedWith(new TypeError("Cannot close an already-closing stream"))}return WritableStreamDefaultWriterClose(this)}releaseLock(){if(!IsWritableStreamDefaultWriter(this)){throw defaultWriterBrandCheckException("releaseLock")}const t=this._ownerWritableStream;if(t===undefined){return}WritableStreamDefaultWriterRelease(this)}write(t=undefined){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("write"))}if(this._ownerWritableStream===undefined){return promiseRejectedWith(defaultWriterLockException("write to"))}return WritableStreamDefaultWriterWrite(this,t)}}Object.defineProperties(WritableStreamDefaultWriter.prototype,{abort:{enumerable:true},close:{enumerable:true},releaseLock:{enumerable:true},write:{enumerable:true},closed:{enumerable:true},desiredSize:{enumerable:true},ready:{enumerable:true}});setFunctionName(WritableStreamDefaultWriter.prototype.abort,"abort");setFunctionName(WritableStreamDefaultWriter.prototype.close,"close");setFunctionName(WritableStreamDefaultWriter.prototype.releaseLock,"releaseLock");setFunctionName(WritableStreamDefaultWriter.prototype.write,"write");if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStreamDefaultWriter.prototype,r.toStringTag,{value:"WritableStreamDefaultWriter",configurable:true})}function IsWritableStreamDefaultWriter(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_ownerWritableStream")){return false}return t instanceof WritableStreamDefaultWriter}function WritableStreamDefaultWriterAbort(t,r){const A=t._ownerWritableStream;return WritableStreamAbort(A,r)}function WritableStreamDefaultWriterClose(t){const r=t._ownerWritableStream;return WritableStreamClose(r)}function WritableStreamDefaultWriterCloseWithErrorPropagation(t){const r=t._ownerWritableStream;const A=r._state;if(WritableStreamCloseQueuedOrInFlight(r)||A==="closed"){return promiseResolvedWith(undefined)}if(A==="errored"){return promiseRejectedWith(r._storedError)}return WritableStreamDefaultWriterClose(t)}function WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,r){if(t._closedPromiseState==="pending"){defaultWriterClosedPromiseReject(t,r)}else{defaultWriterClosedPromiseResetToRejected(t,r)}}function WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,r){if(t._readyPromiseState==="pending"){defaultWriterReadyPromiseReject(t,r)}else{defaultWriterReadyPromiseResetToRejected(t,r)}}function WritableStreamDefaultWriterGetDesiredSize(t){const r=t._ownerWritableStream;const A=r._state;if(A==="errored"||A==="erroring"){return null}if(A==="closed"){return 0}return WritableStreamDefaultControllerGetDesiredSize(r._writableStreamController)}function WritableStreamDefaultWriterRelease(t){const r=t._ownerWritableStream;const A=new TypeError(`Writer was released and can no longer be used to monitor the stream's closedness`);WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,A);WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,A);r._writer=undefined;t._ownerWritableStream=undefined}function WritableStreamDefaultWriterWrite(t,r){const A=t._ownerWritableStream;const s=A._writableStreamController;const o=WritableStreamDefaultControllerGetChunkSize(s,r);if(A!==t._ownerWritableStream){return promiseRejectedWith(defaultWriterLockException("write to"))}const n=A._state;if(n==="errored"){return promiseRejectedWith(A._storedError)}if(WritableStreamCloseQueuedOrInFlight(A)||n==="closed"){return promiseRejectedWith(new TypeError("The stream is closing or closed and cannot be written to"))}if(n==="erroring"){return promiseRejectedWith(A._storedError)}const i=WritableStreamAddWriteRequest(A);WritableStreamDefaultControllerWrite(s,r,o);return i}const B={};class WritableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("abortReason")}return this._abortReason}get signal(){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("signal")}if(this._abortController===undefined){throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported")}return this._abortController.signal}error(t=undefined){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("error")}const r=this._controlledWritableStream._state;if(r!=="writable"){return}WritableStreamDefaultControllerError(this,t)}[a](t){const r=this._abortAlgorithm(t);WritableStreamDefaultControllerClearAlgorithms(this);return r}[c](){ResetQueue(this)}}Object.defineProperties(WritableStreamDefaultController.prototype,{abortReason:{enumerable:true},signal:{enumerable:true},error:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStreamDefaultController.prototype,r.toStringTag,{value:"WritableStreamDefaultController",configurable:true})}function IsWritableStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledWritableStream")){return false}return t instanceof WritableStreamDefaultController}function SetUpWritableStreamDefaultController(t,r,A,s,o,n,i,a){r._controlledWritableStream=t;t._writableStreamController=r;r._queue=undefined;r._queueTotalSize=undefined;ResetQueue(r);r._abortReason=undefined;r._abortController=createAbortController();r._started=false;r._strategySizeAlgorithm=a;r._strategyHWM=i;r._writeAlgorithm=s;r._closeAlgorithm=o;r._abortAlgorithm=n;const c=WritableStreamDefaultControllerGetBackpressure(r);WritableStreamUpdateBackpressure(t,c);const l=A();const u=promiseResolvedWith(l);uponPromise(u,(()=>{r._started=true;WritableStreamDefaultControllerAdvanceQueueIfNeeded(r);return null}),(A=>{r._started=true;WritableStreamDealWithRejection(t,A);return null}))}function SetUpWritableStreamDefaultControllerFromUnderlyingSink(t,r,A,s){const o=Object.create(WritableStreamDefaultController.prototype);let n;let i;let a;let c;if(r.start!==undefined){n=()=>r.start(o)}else{n=()=>undefined}if(r.write!==undefined){i=t=>r.write(t,o)}else{i=()=>promiseResolvedWith(undefined)}if(r.close!==undefined){a=()=>r.close()}else{a=()=>promiseResolvedWith(undefined)}if(r.abort!==undefined){c=t=>r.abort(t)}else{c=()=>promiseResolvedWith(undefined)}SetUpWritableStreamDefaultController(t,o,n,i,a,c,A,s)}function WritableStreamDefaultControllerClearAlgorithms(t){t._writeAlgorithm=undefined;t._closeAlgorithm=undefined;t._abortAlgorithm=undefined;t._strategySizeAlgorithm=undefined}function WritableStreamDefaultControllerClose(t){EnqueueValueWithSize(t,B,0);WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}function WritableStreamDefaultControllerGetChunkSize(t,r){try{return t._strategySizeAlgorithm(r)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return 1}}function WritableStreamDefaultControllerGetDesiredSize(t){return t._strategyHWM-t._queueTotalSize}function WritableStreamDefaultControllerWrite(t,r,A){try{EnqueueValueWithSize(t,r,A)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return}const s=t._controlledWritableStream;if(!WritableStreamCloseQueuedOrInFlight(s)&&s._state==="writable"){const r=WritableStreamDefaultControllerGetBackpressure(t);WritableStreamUpdateBackpressure(s,r)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}function WritableStreamDefaultControllerAdvanceQueueIfNeeded(t){const r=t._controlledWritableStream;if(!t._started){return}if(r._inFlightWriteRequest!==undefined){return}const A=r._state;if(A==="erroring"){WritableStreamFinishErroring(r);return}if(t._queue.length===0){return}const s=PeekQueueValue(t);if(s===B){WritableStreamDefaultControllerProcessClose(t)}else{WritableStreamDefaultControllerProcessWrite(t,s)}}function WritableStreamDefaultControllerErrorIfNeeded(t,r){if(t._controlledWritableStream._state==="writable"){WritableStreamDefaultControllerError(t,r)}}function WritableStreamDefaultControllerProcessClose(t){const r=t._controlledWritableStream;WritableStreamMarkCloseRequestInFlight(r);DequeueValue(t);const A=t._closeAlgorithm();WritableStreamDefaultControllerClearAlgorithms(t);uponPromise(A,(()=>{WritableStreamFinishInFlightClose(r);return null}),(t=>{WritableStreamFinishInFlightCloseWithError(r,t);return null}))}function WritableStreamDefaultControllerProcessWrite(t,r){const A=t._controlledWritableStream;WritableStreamMarkFirstWriteRequestInFlight(A);const s=t._writeAlgorithm(r);uponPromise(s,(()=>{WritableStreamFinishInFlightWrite(A);const r=A._state;DequeueValue(t);if(!WritableStreamCloseQueuedOrInFlight(A)&&r==="writable"){const r=WritableStreamDefaultControllerGetBackpressure(t);WritableStreamUpdateBackpressure(A,r)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(t);return null}),(r=>{if(A._state==="writable"){WritableStreamDefaultControllerClearAlgorithms(t)}WritableStreamFinishInFlightWriteWithError(A,r);return null}))}function WritableStreamDefaultControllerGetBackpressure(t){const r=WritableStreamDefaultControllerGetDesiredSize(t);return r<=0}function WritableStreamDefaultControllerError(t,r){const A=t._controlledWritableStream;WritableStreamDefaultControllerClearAlgorithms(t);WritableStreamStartErroring(A,r)}function streamBrandCheckException$2(t){return new TypeError(`WritableStream.prototype.${t} can only be used on a WritableStream`)}function defaultControllerBrandCheckException$2(t){return new TypeError(`WritableStreamDefaultController.prototype.${t} can only be used on a WritableStreamDefaultController`)}function defaultWriterBrandCheckException(t){return new TypeError(`WritableStreamDefaultWriter.prototype.${t} can only be used on a WritableStreamDefaultWriter`)}function defaultWriterLockException(t){return new TypeError("Cannot "+t+" a stream using a released writer")}function defaultWriterClosedPromiseInitialize(t){t._closedPromise=newPromise(((r,A)=>{t._closedPromise_resolve=r;t._closedPromise_reject=A;t._closedPromiseState="pending"}))}function defaultWriterClosedPromiseInitializeAsRejected(t,r){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseReject(t,r)}function defaultWriterClosedPromiseInitializeAsResolved(t){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseResolve(t)}function defaultWriterClosedPromiseReject(t,r){if(t._closedPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined;t._closedPromiseState="rejected"}function defaultWriterClosedPromiseResetToRejected(t,r){defaultWriterClosedPromiseInitializeAsRejected(t,r)}function defaultWriterClosedPromiseResolve(t){if(t._closedPromise_resolve===undefined){return}t._closedPromise_resolve(undefined);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined;t._closedPromiseState="resolved"}function defaultWriterReadyPromiseInitialize(t){t._readyPromise=newPromise(((r,A)=>{t._readyPromise_resolve=r;t._readyPromise_reject=A}));t._readyPromiseState="pending"}function defaultWriterReadyPromiseInitializeAsRejected(t,r){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseReject(t,r)}function defaultWriterReadyPromiseInitializeAsResolved(t){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseResolve(t)}function defaultWriterReadyPromiseReject(t,r){if(t._readyPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._readyPromise);t._readyPromise_reject(r);t._readyPromise_resolve=undefined;t._readyPromise_reject=undefined;t._readyPromiseState="rejected"}function defaultWriterReadyPromiseReset(t){defaultWriterReadyPromiseInitialize(t)}function defaultWriterReadyPromiseResetToRejected(t,r){defaultWriterReadyPromiseInitializeAsRejected(t,r)}function defaultWriterReadyPromiseResolve(t){if(t._readyPromise_resolve===undefined){return}t._readyPromise_resolve(undefined);t._readyPromise_resolve=undefined;t._readyPromise_reject=undefined;t._readyPromiseState="fulfilled"}function getGlobals(){if(typeof globalThis!=="undefined"){return globalThis}else if(typeof self!=="undefined"){return self}else if(typeof global!=="undefined"){return global}return undefined}const I=getGlobals();function isDOMExceptionConstructor(t){if(!(typeof t==="function"||typeof t==="object")){return false}if(t.name!=="DOMException"){return false}try{new t;return true}catch(t){return false}}function getFromGlobal(){const t=I===null||I===void 0?void 0:I.DOMException;return isDOMExceptionConstructor(t)?t:undefined}function createPolyfill(){const t=function DOMException(t,r){this.message=t||"";this.name=r||"Error";if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}};setFunctionName(t,"DOMException");t.prototype=Object.create(Error.prototype);Object.defineProperty(t.prototype,"constructor",{value:t,writable:true,configurable:true});return t}const m=getFromGlobal()||createPolyfill();function ReadableStreamPipeTo(t,r,A,s,o,n){const i=AcquireReadableStreamDefaultReader(t);const a=AcquireWritableStreamDefaultWriter(r);t._disturbed=true;let c=false;let l=promiseResolvedWith(undefined);return newPromise(((u,g)=>{let d;if(n!==undefined){d=()=>{const A=n.reason!==undefined?n.reason:new m("Aborted","AbortError");const i=[];if(!s){i.push((()=>{if(r._state==="writable"){return WritableStreamAbort(r,A)}return promiseResolvedWith(undefined)}))}if(!o){i.push((()=>{if(t._state==="readable"){return ReadableStreamCancel(t,A)}return promiseResolvedWith(undefined)}))}shutdownWithAction((()=>Promise.all(i.map((t=>t())))),true,A)};if(n.aborted){d();return}n.addEventListener("abort",d)}function pipeLoop(){return newPromise(((t,r)=>{function next(A){if(A){t()}else{PerformPromiseThen(pipeStep(),next,r)}}next(false)}))}function pipeStep(){if(c){return promiseResolvedWith(true)}return PerformPromiseThen(a._readyPromise,(()=>newPromise(((t,r)=>{ReadableStreamDefaultReaderRead(i,{_chunkSteps:r=>{l=PerformPromiseThen(WritableStreamDefaultWriterWrite(a,r),undefined,noop);t(false)},_closeSteps:()=>t(true),_errorSteps:r})}))))}isOrBecomesErrored(t,i._closedPromise,(t=>{if(!s){shutdownWithAction((()=>WritableStreamAbort(r,t)),true,t)}else{shutdown(true,t)}return null}));isOrBecomesErrored(r,a._closedPromise,(r=>{if(!o){shutdownWithAction((()=>ReadableStreamCancel(t,r)),true,r)}else{shutdown(true,r)}return null}));isOrBecomesClosed(t,i._closedPromise,(()=>{if(!A){shutdownWithAction((()=>WritableStreamDefaultWriterCloseWithErrorPropagation(a)))}else{shutdown()}return null}));if(WritableStreamCloseQueuedOrInFlight(r)||r._state==="closed"){const r=new TypeError("the destination writable stream closed before all data could be piped to it");if(!o){shutdownWithAction((()=>ReadableStreamCancel(t,r)),true,r)}else{shutdown(true,r)}}setPromiseIsHandledToTrue(pipeLoop());function waitForWritesToFinish(){const t=l;return PerformPromiseThen(l,(()=>t!==l?waitForWritesToFinish():undefined))}function isOrBecomesErrored(t,r,A){if(t._state==="errored"){A(t._storedError)}else{uponRejection(r,A)}}function isOrBecomesClosed(t,r,A){if(t._state==="closed"){A()}else{uponFulfillment(r,A)}}function shutdownWithAction(t,A,s){if(c){return}c=true;if(r._state==="writable"&&!WritableStreamCloseQueuedOrInFlight(r)){uponFulfillment(waitForWritesToFinish(),doTheRest)}else{doTheRest()}function doTheRest(){uponPromise(t(),(()=>finalize(A,s)),(t=>finalize(true,t)));return null}}function shutdown(t,A){if(c){return}c=true;if(r._state==="writable"&&!WritableStreamCloseQueuedOrInFlight(r)){uponFulfillment(waitForWritesToFinish(),(()=>finalize(t,A)))}else{finalize(t,A)}}function finalize(t,r){WritableStreamDefaultWriterRelease(a);ReadableStreamReaderGenericRelease(i);if(n!==undefined){n.removeEventListener("abort",d)}if(t){g(r)}else{u(undefined)}return null}}))}class ReadableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("desiredSize")}return ReadableStreamDefaultControllerGetDesiredSize(this)}close(){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("close")}if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)){throw new TypeError("The stream is not in a state that permits close")}ReadableStreamDefaultControllerClose(this)}enqueue(t=undefined){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("enqueue")}if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)){throw new TypeError("The stream is not in a state that permits enqueue")}return ReadableStreamDefaultControllerEnqueue(this,t)}error(t=undefined){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("error")}ReadableStreamDefaultControllerError(this,t)}[l](t){ResetQueue(this);const r=this._cancelAlgorithm(t);ReadableStreamDefaultControllerClearAlgorithms(this);return r}[u](t){const r=this._controlledReadableStream;if(this._queue.length>0){const A=DequeueValue(this);if(this._closeRequested&&this._queue.length===0){ReadableStreamDefaultControllerClearAlgorithms(this);ReadableStreamClose(r)}else{ReadableStreamDefaultControllerCallPullIfNeeded(this)}t._chunkSteps(A)}else{ReadableStreamAddReadRequest(r,t);ReadableStreamDefaultControllerCallPullIfNeeded(this)}}[g](){}}Object.defineProperties(ReadableStreamDefaultController.prototype,{close:{enumerable:true},enqueue:{enumerable:true},error:{enumerable:true},desiredSize:{enumerable:true}});setFunctionName(ReadableStreamDefaultController.prototype.close,"close");setFunctionName(ReadableStreamDefaultController.prototype.enqueue,"enqueue");setFunctionName(ReadableStreamDefaultController.prototype.error,"error");if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamDefaultController.prototype,r.toStringTag,{value:"ReadableStreamDefaultController",configurable:true})}function IsReadableStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledReadableStream")){return false}return t instanceof ReadableStreamDefaultController}function ReadableStreamDefaultControllerCallPullIfNeeded(t){const r=ReadableStreamDefaultControllerShouldCallPull(t);if(!r){return}if(t._pulling){t._pullAgain=true;return}t._pulling=true;const A=t._pullAlgorithm();uponPromise(A,(()=>{t._pulling=false;if(t._pullAgain){t._pullAgain=false;ReadableStreamDefaultControllerCallPullIfNeeded(t)}return null}),(r=>{ReadableStreamDefaultControllerError(t,r);return null}))}function ReadableStreamDefaultControllerShouldCallPull(t){const r=t._controlledReadableStream;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return false}if(!t._started){return false}if(IsReadableStreamLocked(r)&&ReadableStreamGetNumReadRequests(r)>0){return true}const A=ReadableStreamDefaultControllerGetDesiredSize(t);if(A>0){return true}return false}function ReadableStreamDefaultControllerClearAlgorithms(t){t._pullAlgorithm=undefined;t._cancelAlgorithm=undefined;t._strategySizeAlgorithm=undefined}function ReadableStreamDefaultControllerClose(t){if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return}const r=t._controlledReadableStream;t._closeRequested=true;if(t._queue.length===0){ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamClose(r)}}function ReadableStreamDefaultControllerEnqueue(t,r){if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return}const A=t._controlledReadableStream;if(IsReadableStreamLocked(A)&&ReadableStreamGetNumReadRequests(A)>0){ReadableStreamFulfillReadRequest(A,r,false)}else{let A;try{A=t._strategySizeAlgorithm(r)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}try{EnqueueValueWithSize(t,r,A)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}}ReadableStreamDefaultControllerCallPullIfNeeded(t)}function ReadableStreamDefaultControllerError(t,r){const A=t._controlledReadableStream;if(A._state!=="readable"){return}ResetQueue(t);ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamError(A,r)}function ReadableStreamDefaultControllerGetDesiredSize(t){const r=t._controlledReadableStream._state;if(r==="errored"){return null}if(r==="closed"){return 0}return t._strategyHWM-t._queueTotalSize}function ReadableStreamDefaultControllerHasBackpressure(t){if(ReadableStreamDefaultControllerShouldCallPull(t)){return false}return true}function ReadableStreamDefaultControllerCanCloseOrEnqueue(t){const r=t._controlledReadableStream._state;if(!t._closeRequested&&r==="readable"){return true}return false}function SetUpReadableStreamDefaultController(t,r,A,s,o,n,i){r._controlledReadableStream=t;r._queue=undefined;r._queueTotalSize=undefined;ResetQueue(r);r._started=false;r._closeRequested=false;r._pullAgain=false;r._pulling=false;r._strategySizeAlgorithm=i;r._strategyHWM=n;r._pullAlgorithm=s;r._cancelAlgorithm=o;t._readableStreamController=r;const a=A();uponPromise(promiseResolvedWith(a),(()=>{r._started=true;ReadableStreamDefaultControllerCallPullIfNeeded(r);return null}),(t=>{ReadableStreamDefaultControllerError(r,t);return null}))}function SetUpReadableStreamDefaultControllerFromUnderlyingSource(t,r,A,s){const o=Object.create(ReadableStreamDefaultController.prototype);let n;let i;let a;if(r.start!==undefined){n=()=>r.start(o)}else{n=()=>undefined}if(r.pull!==undefined){i=()=>r.pull(o)}else{i=()=>promiseResolvedWith(undefined)}if(r.cancel!==undefined){a=t=>r.cancel(t)}else{a=()=>promiseResolvedWith(undefined)}SetUpReadableStreamDefaultController(t,o,n,i,a,A,s)}function defaultControllerBrandCheckException$1(t){return new TypeError(`ReadableStreamDefaultController.prototype.${t} can only be used on a ReadableStreamDefaultController`)}function ReadableStreamTee(t,r){if(IsReadableByteStreamController(t._readableStreamController)){return ReadableByteStreamTee(t)}return ReadableStreamDefaultTee(t)}function ReadableStreamDefaultTee(t,r){const A=AcquireReadableStreamDefaultReader(t);let s=false;let o=false;let n=false;let i=false;let a;let c;let l;let u;let g;const d=newPromise((t=>{g=t}));function pullAlgorithm(){if(s){o=true;return promiseResolvedWith(undefined)}s=true;const t={_chunkSteps:t=>{_queueMicrotask((()=>{o=false;const r=t;const A=t;if(!n){ReadableStreamDefaultControllerEnqueue(l._readableStreamController,r)}if(!i){ReadableStreamDefaultControllerEnqueue(u._readableStreamController,A)}s=false;if(o){pullAlgorithm()}}))},_closeSteps:()=>{s=false;if(!n){ReadableStreamDefaultControllerClose(l._readableStreamController)}if(!i){ReadableStreamDefaultControllerClose(u._readableStreamController)}if(!n||!i){g(undefined)}},_errorSteps:()=>{s=false}};ReadableStreamDefaultReaderRead(A,t);return promiseResolvedWith(undefined)}function cancel1Algorithm(r){n=true;a=r;if(i){const r=CreateArrayFromList([a,c]);const A=ReadableStreamCancel(t,r);g(A)}return d}function cancel2Algorithm(r){i=true;c=r;if(n){const r=CreateArrayFromList([a,c]);const A=ReadableStreamCancel(t,r);g(A)}return d}function startAlgorithm(){}l=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel1Algorithm);u=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel2Algorithm);uponRejection(A._closedPromise,(t=>{ReadableStreamDefaultControllerError(l._readableStreamController,t);ReadableStreamDefaultControllerError(u._readableStreamController,t);if(!n||!i){g(undefined)}return null}));return[l,u]}function ReadableByteStreamTee(t){let r=AcquireReadableStreamDefaultReader(t);let A=false;let s=false;let o=false;let n=false;let i=false;let a;let c;let l;let u;let g;const d=newPromise((t=>{g=t}));function forwardReaderError(t){uponRejection(t._closedPromise,(A=>{if(t!==r){return null}ReadableByteStreamControllerError(l._readableStreamController,A);ReadableByteStreamControllerError(u._readableStreamController,A);if(!n||!i){g(undefined)}return null}))}function pullWithDefaultReader(){if(IsReadableStreamBYOBReader(r)){ReadableStreamReaderGenericRelease(r);r=AcquireReadableStreamDefaultReader(t);forwardReaderError(r)}const a={_chunkSteps:r=>{_queueMicrotask((()=>{s=false;o=false;const a=r;let c=r;if(!n&&!i){try{c=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(l._readableStreamController,r);ReadableByteStreamControllerError(u._readableStreamController,r);g(ReadableStreamCancel(t,r));return}}if(!n){ReadableByteStreamControllerEnqueue(l._readableStreamController,a)}if(!i){ReadableByteStreamControllerEnqueue(u._readableStreamController,c)}A=false;if(s){pull1Algorithm()}else if(o){pull2Algorithm()}}))},_closeSteps:()=>{A=false;if(!n){ReadableByteStreamControllerClose(l._readableStreamController)}if(!i){ReadableByteStreamControllerClose(u._readableStreamController)}if(l._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(l._readableStreamController,0)}if(u._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(u._readableStreamController,0)}if(!n||!i){g(undefined)}},_errorSteps:()=>{A=false}};ReadableStreamDefaultReaderRead(r,a)}function pullWithBYOBReader(a,c){if(IsReadableStreamDefaultReader(r)){ReadableStreamReaderGenericRelease(r);r=AcquireReadableStreamBYOBReader(t);forwardReaderError(r)}const d=c?u:l;const E=c?l:u;const h={_chunkSteps:r=>{_queueMicrotask((()=>{s=false;o=false;const a=c?i:n;const l=c?n:i;if(!l){let A;try{A=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(d._readableStreamController,r);ReadableByteStreamControllerError(E._readableStreamController,r);g(ReadableStreamCancel(t,r));return}if(!a){ReadableByteStreamControllerRespondWithNewView(d._readableStreamController,r)}ReadableByteStreamControllerEnqueue(E._readableStreamController,A)}else if(!a){ReadableByteStreamControllerRespondWithNewView(d._readableStreamController,r)}A=false;if(s){pull1Algorithm()}else if(o){pull2Algorithm()}}))},_closeSteps:t=>{A=false;const r=c?i:n;const s=c?n:i;if(!r){ReadableByteStreamControllerClose(d._readableStreamController)}if(!s){ReadableByteStreamControllerClose(E._readableStreamController)}if(t!==undefined){if(!r){ReadableByteStreamControllerRespondWithNewView(d._readableStreamController,t)}if(!s&&E._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(E._readableStreamController,0)}}if(!r||!s){g(undefined)}},_errorSteps:()=>{A=false}};ReadableStreamBYOBReaderRead(r,a,1,h)}function pull1Algorithm(){if(A){s=true;return promiseResolvedWith(undefined)}A=true;const t=ReadableByteStreamControllerGetBYOBRequest(l._readableStreamController);if(t===null){pullWithDefaultReader()}else{pullWithBYOBReader(t._view,false)}return promiseResolvedWith(undefined)}function pull2Algorithm(){if(A){o=true;return promiseResolvedWith(undefined)}A=true;const t=ReadableByteStreamControllerGetBYOBRequest(u._readableStreamController);if(t===null){pullWithDefaultReader()}else{pullWithBYOBReader(t._view,true)}return promiseResolvedWith(undefined)}function cancel1Algorithm(r){n=true;a=r;if(i){const r=CreateArrayFromList([a,c]);const A=ReadableStreamCancel(t,r);g(A)}return d}function cancel2Algorithm(r){i=true;c=r;if(n){const r=CreateArrayFromList([a,c]);const A=ReadableStreamCancel(t,r);g(A)}return d}function startAlgorithm(){return}l=CreateReadableByteStream(startAlgorithm,pull1Algorithm,cancel1Algorithm);u=CreateReadableByteStream(startAlgorithm,pull2Algorithm,cancel2Algorithm);forwardReaderError(r);return[l,u]}function isReadableStreamLike(t){return typeIsObject(t)&&typeof t.getReader!=="undefined"}function ReadableStreamFrom(t){if(isReadableStreamLike(t)){return ReadableStreamFromDefaultReader(t.getReader())}return ReadableStreamFromIterable(t)}function ReadableStreamFromIterable(t){let r;const A=GetIterator(t,"async");const s=noop;function pullAlgorithm(){let t;try{t=IteratorNext(A)}catch(t){return promiseRejectedWith(t)}const s=promiseResolvedWith(t);return transformPromiseWith(s,(t=>{if(!typeIsObject(t)){throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object")}const A=IteratorComplete(t);if(A){ReadableStreamDefaultControllerClose(r._readableStreamController)}else{const A=IteratorValue(t);ReadableStreamDefaultControllerEnqueue(r._readableStreamController,A)}}))}function cancelAlgorithm(t){const r=A.iterator;let s;try{s=GetMethod(r,"return")}catch(t){return promiseRejectedWith(t)}if(s===undefined){return promiseResolvedWith(undefined)}let o;try{o=reflectCall(s,r,[t])}catch(t){return promiseRejectedWith(t)}const n=promiseResolvedWith(o);return transformPromiseWith(n,(t=>{if(!typeIsObject(t)){throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")}return undefined}))}r=CreateReadableStream(s,pullAlgorithm,cancelAlgorithm,0);return r}function ReadableStreamFromDefaultReader(t){let r;const A=noop;function pullAlgorithm(){let A;try{A=t.read()}catch(t){return promiseRejectedWith(t)}return transformPromiseWith(A,(t=>{if(!typeIsObject(t)){throw new TypeError("The promise returned by the reader.read() method must fulfill with an object")}if(t.done){ReadableStreamDefaultControllerClose(r._readableStreamController)}else{const A=t.value;ReadableStreamDefaultControllerEnqueue(r._readableStreamController,A)}}))}function cancelAlgorithm(r){try{return promiseResolvedWith(t.cancel(r))}catch(t){return promiseRejectedWith(t)}}r=CreateReadableStream(A,pullAlgorithm,cancelAlgorithm,0);return r}function convertUnderlyingDefaultOrByteSource(t,r){assertDictionary(t,r);const A=t;const s=A===null||A===void 0?void 0:A.autoAllocateChunkSize;const o=A===null||A===void 0?void 0:A.cancel;const n=A===null||A===void 0?void 0:A.pull;const i=A===null||A===void 0?void 0:A.start;const a=A===null||A===void 0?void 0:A.type;return{autoAllocateChunkSize:s===undefined?undefined:convertUnsignedLongLongWithEnforceRange(s,`${r} has member 'autoAllocateChunkSize' that`),cancel:o===undefined?undefined:convertUnderlyingSourceCancelCallback(o,A,`${r} has member 'cancel' that`),pull:n===undefined?undefined:convertUnderlyingSourcePullCallback(n,A,`${r} has member 'pull' that`),start:i===undefined?undefined:convertUnderlyingSourceStartCallback(i,A,`${r} has member 'start' that`),type:a===undefined?undefined:convertReadableStreamType(a,`${r} has member 'type' that`)}}function convertUnderlyingSourceCancelCallback(t,r,A){assertFunction(t,A);return A=>promiseCall(t,r,[A])}function convertUnderlyingSourcePullCallback(t,r,A){assertFunction(t,A);return A=>promiseCall(t,r,[A])}function convertUnderlyingSourceStartCallback(t,r,A){assertFunction(t,A);return A=>reflectCall(t,r,[A])}function convertReadableStreamType(t,r){t=`${t}`;if(t!=="bytes"){throw new TypeError(`${r} '${t}' is not a valid enumeration value for ReadableStreamType`)}return t}function convertIteratorOptions(t,r){assertDictionary(t,r);const A=t===null||t===void 0?void 0:t.preventCancel;return{preventCancel:Boolean(A)}}function convertPipeOptions(t,r){assertDictionary(t,r);const A=t===null||t===void 0?void 0:t.preventAbort;const s=t===null||t===void 0?void 0:t.preventCancel;const o=t===null||t===void 0?void 0:t.preventClose;const n=t===null||t===void 0?void 0:t.signal;if(n!==undefined){assertAbortSignal(n,`${r} has member 'signal' that`)}return{preventAbort:Boolean(A),preventCancel:Boolean(s),preventClose:Boolean(o),signal:n}}function assertAbortSignal(t,r){if(!isAbortSignal(t)){throw new TypeError(`${r} is not an AbortSignal.`)}}function convertReadableWritablePair(t,r){assertDictionary(t,r);const A=t===null||t===void 0?void 0:t.readable;assertRequiredField(A,"readable","ReadableWritablePair");assertReadableStream(A,`${r} has member 'readable' that`);const s=t===null||t===void 0?void 0:t.writable;assertRequiredField(s,"writable","ReadableWritablePair");assertWritableStream(s,`${r} has member 'writable' that`);return{readable:A,writable:s}}class ReadableStream{constructor(t={},r={}){if(t===undefined){t=null}else{assertObject(t,"First parameter")}const A=convertQueuingStrategy(r,"Second parameter");const s=convertUnderlyingDefaultOrByteSource(t,"First parameter");InitializeReadableStream(this);if(s.type==="bytes"){if(A.size!==undefined){throw new RangeError("The strategy for a byte stream cannot have a size function")}const t=ExtractHighWaterMark(A,0);SetUpReadableByteStreamControllerFromUnderlyingSource(this,s,t)}else{const t=ExtractSizeAlgorithm(A);const r=ExtractHighWaterMark(A,1);SetUpReadableStreamDefaultControllerFromUnderlyingSource(this,s,r,t)}}get locked(){if(!IsReadableStream(this)){throw streamBrandCheckException$1("locked")}return IsReadableStreamLocked(this)}cancel(t=undefined){if(!IsReadableStream(this)){return promiseRejectedWith(streamBrandCheckException$1("cancel"))}if(IsReadableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot cancel a stream that already has a reader"))}return ReadableStreamCancel(this,t)}getReader(t=undefined){if(!IsReadableStream(this)){throw streamBrandCheckException$1("getReader")}const r=convertReaderOptions(t,"First parameter");if(r.mode===undefined){return AcquireReadableStreamDefaultReader(this)}return AcquireReadableStreamBYOBReader(this)}pipeThrough(t,r={}){if(!IsReadableStream(this)){throw streamBrandCheckException$1("pipeThrough")}assertRequiredArgument(t,1,"pipeThrough");const A=convertReadableWritablePair(t,"First parameter");const s=convertPipeOptions(r,"Second parameter");if(IsReadableStreamLocked(this)){throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream")}if(IsWritableStreamLocked(A.writable)){throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream")}const o=ReadableStreamPipeTo(this,A.writable,s.preventClose,s.preventAbort,s.preventCancel,s.signal);setPromiseIsHandledToTrue(o);return A.readable}pipeTo(t,r={}){if(!IsReadableStream(this)){return promiseRejectedWith(streamBrandCheckException$1("pipeTo"))}if(t===undefined){return promiseRejectedWith(`Parameter 1 is required in 'pipeTo'.`)}if(!IsWritableStream(t)){return promiseRejectedWith(new TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`))}let A;try{A=convertPipeOptions(r,"Second parameter")}catch(t){return promiseRejectedWith(t)}if(IsReadableStreamLocked(this)){return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"))}if(IsWritableStreamLocked(t)){return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"))}return ReadableStreamPipeTo(this,t,A.preventClose,A.preventAbort,A.preventCancel,A.signal)}tee(){if(!IsReadableStream(this)){throw streamBrandCheckException$1("tee")}const t=ReadableStreamTee(this);return CreateArrayFromList(t)}values(t=undefined){if(!IsReadableStream(this)){throw streamBrandCheckException$1("values")}const r=convertIteratorOptions(t,"First parameter");return AcquireReadableStreamAsyncIterator(this,r.preventCancel)}static from(t){return ReadableStreamFrom(t)}}Object.defineProperties(ReadableStream,{from:{enumerable:true}});Object.defineProperties(ReadableStream.prototype,{cancel:{enumerable:true},getReader:{enumerable:true},pipeThrough:{enumerable:true},pipeTo:{enumerable:true},tee:{enumerable:true},values:{enumerable:true},locked:{enumerable:true}});setFunctionName(ReadableStream.from,"from");setFunctionName(ReadableStream.prototype.cancel,"cancel");setFunctionName(ReadableStream.prototype.getReader,"getReader");setFunctionName(ReadableStream.prototype.pipeThrough,"pipeThrough");setFunctionName(ReadableStream.prototype.pipeTo,"pipeTo");setFunctionName(ReadableStream.prototype.tee,"tee");setFunctionName(ReadableStream.prototype.values,"values");if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStream.prototype,r.toStringTag,{value:"ReadableStream",configurable:true})}if(typeof r.asyncIterator==="symbol"){Object.defineProperty(ReadableStream.prototype,r.asyncIterator,{value:ReadableStream.prototype.values,writable:true,configurable:true})}function CreateReadableStream(t,r,A,s=1,o=(()=>1)){const n=Object.create(ReadableStream.prototype);InitializeReadableStream(n);const i=Object.create(ReadableStreamDefaultController.prototype);SetUpReadableStreamDefaultController(n,i,t,r,A,s,o);return n}function CreateReadableByteStream(t,r,A){const s=Object.create(ReadableStream.prototype);InitializeReadableStream(s);const o=Object.create(ReadableByteStreamController.prototype);SetUpReadableByteStreamController(s,o,t,r,A,0,undefined);return s}function InitializeReadableStream(t){t._state="readable";t._reader=undefined;t._storedError=undefined;t._disturbed=false}function IsReadableStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readableStreamController")){return false}return t instanceof ReadableStream}function IsReadableStreamLocked(t){if(t._reader===undefined){return false}return true}function ReadableStreamCancel(t,r){t._disturbed=true;if(t._state==="closed"){return promiseResolvedWith(undefined)}if(t._state==="errored"){return promiseRejectedWith(t._storedError)}ReadableStreamClose(t);const A=t._reader;if(A!==undefined&&IsReadableStreamBYOBReader(A)){const t=A._readIntoRequests;A._readIntoRequests=new SimpleQueue;t.forEach((t=>{t._closeSteps(undefined)}))}const s=t._readableStreamController[l](r);return transformPromiseWith(s,noop)}function ReadableStreamClose(t){t._state="closed";const r=t._reader;if(r===undefined){return}defaultReaderClosedPromiseResolve(r);if(IsReadableStreamDefaultReader(r)){const t=r._readRequests;r._readRequests=new SimpleQueue;t.forEach((t=>{t._closeSteps()}))}}function ReadableStreamError(t,r){t._state="errored";t._storedError=r;const A=t._reader;if(A===undefined){return}defaultReaderClosedPromiseReject(A,r);if(IsReadableStreamDefaultReader(A)){ReadableStreamDefaultReaderErrorReadRequests(A,r)}else{ReadableStreamBYOBReaderErrorReadIntoRequests(A,r)}}function streamBrandCheckException$1(t){return new TypeError(`ReadableStream.prototype.${t} can only be used on a ReadableStream`)}function convertQueuingStrategyInit(t,r){assertDictionary(t,r);const A=t===null||t===void 0?void 0:t.highWaterMark;assertRequiredField(A,"highWaterMark","QueuingStrategyInit");return{highWaterMark:convertUnrestrictedDouble(A)}}const byteLengthSizeFunction=t=>t.byteLength;setFunctionName(byteLengthSizeFunction,"size");class ByteLengthQueuingStrategy{constructor(t){assertRequiredArgument(t,1,"ByteLengthQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!IsByteLengthQueuingStrategy(this)){throw byteLengthBrandCheckException("highWaterMark")}return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!IsByteLengthQueuingStrategy(this)){throw byteLengthBrandCheckException("size")}return byteLengthSizeFunction}}Object.defineProperties(ByteLengthQueuingStrategy.prototype,{highWaterMark:{enumerable:true},size:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ByteLengthQueuingStrategy.prototype,r.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:true})}function byteLengthBrandCheckException(t){return new TypeError(`ByteLengthQueuingStrategy.prototype.${t} can only be used on a ByteLengthQueuingStrategy`)}function IsByteLengthQueuingStrategy(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_byteLengthQueuingStrategyHighWaterMark")){return false}return t instanceof ByteLengthQueuingStrategy}const countSizeFunction=()=>1;setFunctionName(countSizeFunction,"size");class CountQueuingStrategy{constructor(t){assertRequiredArgument(t,1,"CountQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!IsCountQueuingStrategy(this)){throw countBrandCheckException("highWaterMark")}return this._countQueuingStrategyHighWaterMark}get size(){if(!IsCountQueuingStrategy(this)){throw countBrandCheckException("size")}return countSizeFunction}}Object.defineProperties(CountQueuingStrategy.prototype,{highWaterMark:{enumerable:true},size:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(CountQueuingStrategy.prototype,r.toStringTag,{value:"CountQueuingStrategy",configurable:true})}function countBrandCheckException(t){return new TypeError(`CountQueuingStrategy.prototype.${t} can only be used on a CountQueuingStrategy`)}function IsCountQueuingStrategy(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_countQueuingStrategyHighWaterMark")){return false}return t instanceof CountQueuingStrategy}function convertTransformer(t,r){assertDictionary(t,r);const A=t===null||t===void 0?void 0:t.cancel;const s=t===null||t===void 0?void 0:t.flush;const o=t===null||t===void 0?void 0:t.readableType;const n=t===null||t===void 0?void 0:t.start;const i=t===null||t===void 0?void 0:t.transform;const a=t===null||t===void 0?void 0:t.writableType;return{cancel:A===undefined?undefined:convertTransformerCancelCallback(A,t,`${r} has member 'cancel' that`),flush:s===undefined?undefined:convertTransformerFlushCallback(s,t,`${r} has member 'flush' that`),readableType:o,start:n===undefined?undefined:convertTransformerStartCallback(n,t,`${r} has member 'start' that`),transform:i===undefined?undefined:convertTransformerTransformCallback(i,t,`${r} has member 'transform' that`),writableType:a}}function convertTransformerFlushCallback(t,r,A){assertFunction(t,A);return A=>promiseCall(t,r,[A])}function convertTransformerStartCallback(t,r,A){assertFunction(t,A);return A=>reflectCall(t,r,[A])}function convertTransformerTransformCallback(t,r,A){assertFunction(t,A);return(A,s)=>promiseCall(t,r,[A,s])}function convertTransformerCancelCallback(t,r,A){assertFunction(t,A);return A=>promiseCall(t,r,[A])}class TransformStream{constructor(t={},r={},A={}){if(t===undefined){t=null}const s=convertQueuingStrategy(r,"Second parameter");const o=convertQueuingStrategy(A,"Third parameter");const n=convertTransformer(t,"First parameter");if(n.readableType!==undefined){throw new RangeError("Invalid readableType specified")}if(n.writableType!==undefined){throw new RangeError("Invalid writableType specified")}const i=ExtractHighWaterMark(o,0);const a=ExtractSizeAlgorithm(o);const c=ExtractHighWaterMark(s,1);const l=ExtractSizeAlgorithm(s);let u;const g=newPromise((t=>{u=t}));InitializeTransformStream(this,g,c,l,i,a);SetUpTransformStreamDefaultControllerFromTransformer(this,n);if(n.start!==undefined){u(n.start(this._transformStreamController))}else{u(undefined)}}get readable(){if(!IsTransformStream(this)){throw streamBrandCheckException("readable")}return this._readable}get writable(){if(!IsTransformStream(this)){throw streamBrandCheckException("writable")}return this._writable}}Object.defineProperties(TransformStream.prototype,{readable:{enumerable:true},writable:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(TransformStream.prototype,r.toStringTag,{value:"TransformStream",configurable:true})}function InitializeTransformStream(t,r,A,s,o,n){function startAlgorithm(){return r}function writeAlgorithm(r){return TransformStreamDefaultSinkWriteAlgorithm(t,r)}function abortAlgorithm(r){return TransformStreamDefaultSinkAbortAlgorithm(t,r)}function closeAlgorithm(){return TransformStreamDefaultSinkCloseAlgorithm(t)}t._writable=CreateWritableStream(startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,A,s);function pullAlgorithm(){return TransformStreamDefaultSourcePullAlgorithm(t)}function cancelAlgorithm(r){return TransformStreamDefaultSourceCancelAlgorithm(t,r)}t._readable=CreateReadableStream(startAlgorithm,pullAlgorithm,cancelAlgorithm,o,n);t._backpressure=undefined;t._backpressureChangePromise=undefined;t._backpressureChangePromise_resolve=undefined;TransformStreamSetBackpressure(t,true);t._transformStreamController=undefined}function IsTransformStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_transformStreamController")){return false}return t instanceof TransformStream}function TransformStreamError(t,r){ReadableStreamDefaultControllerError(t._readable._readableStreamController,r);TransformStreamErrorWritableAndUnblockWrite(t,r)}function TransformStreamErrorWritableAndUnblockWrite(t,r){TransformStreamDefaultControllerClearAlgorithms(t._transformStreamController);WritableStreamDefaultControllerErrorIfNeeded(t._writable._writableStreamController,r);TransformStreamUnblockWrite(t)}function TransformStreamUnblockWrite(t){if(t._backpressure){TransformStreamSetBackpressure(t,false)}}function TransformStreamSetBackpressure(t,r){if(t._backpressureChangePromise!==undefined){t._backpressureChangePromise_resolve()}t._backpressureChangePromise=newPromise((r=>{t._backpressureChangePromise_resolve=r}));t._backpressure=r}class TransformStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("desiredSize")}const t=this._controlledTransformStream._readable._readableStreamController;return ReadableStreamDefaultControllerGetDesiredSize(t)}enqueue(t=undefined){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("enqueue")}TransformStreamDefaultControllerEnqueue(this,t)}error(t=undefined){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("error")}TransformStreamDefaultControllerError(this,t)}terminate(){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("terminate")}TransformStreamDefaultControllerTerminate(this)}}Object.defineProperties(TransformStreamDefaultController.prototype,{enqueue:{enumerable:true},error:{enumerable:true},terminate:{enumerable:true},desiredSize:{enumerable:true}});setFunctionName(TransformStreamDefaultController.prototype.enqueue,"enqueue");setFunctionName(TransformStreamDefaultController.prototype.error,"error");setFunctionName(TransformStreamDefaultController.prototype.terminate,"terminate");if(typeof r.toStringTag==="symbol"){Object.defineProperty(TransformStreamDefaultController.prototype,r.toStringTag,{value:"TransformStreamDefaultController",configurable:true})}function IsTransformStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledTransformStream")){return false}return t instanceof TransformStreamDefaultController}function SetUpTransformStreamDefaultController(t,r,A,s,o){r._controlledTransformStream=t;t._transformStreamController=r;r._transformAlgorithm=A;r._flushAlgorithm=s;r._cancelAlgorithm=o;r._finishPromise=undefined;r._finishPromise_resolve=undefined;r._finishPromise_reject=undefined}function SetUpTransformStreamDefaultControllerFromTransformer(t,r){const A=Object.create(TransformStreamDefaultController.prototype);let s;let o;let n;if(r.transform!==undefined){s=t=>r.transform(t,A)}else{s=t=>{try{TransformStreamDefaultControllerEnqueue(A,t);return promiseResolvedWith(undefined)}catch(t){return promiseRejectedWith(t)}}}if(r.flush!==undefined){o=()=>r.flush(A)}else{o=()=>promiseResolvedWith(undefined)}if(r.cancel!==undefined){n=t=>r.cancel(t)}else{n=()=>promiseResolvedWith(undefined)}SetUpTransformStreamDefaultController(t,A,s,o,n)}function TransformStreamDefaultControllerClearAlgorithms(t){t._transformAlgorithm=undefined;t._flushAlgorithm=undefined;t._cancelAlgorithm=undefined}function TransformStreamDefaultControllerEnqueue(t,r){const A=t._controlledTransformStream;const s=A._readable._readableStreamController;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(s)){throw new TypeError("Readable side is not in a state that permits enqueue")}try{ReadableStreamDefaultControllerEnqueue(s,r)}catch(t){TransformStreamErrorWritableAndUnblockWrite(A,t);throw A._readable._storedError}const o=ReadableStreamDefaultControllerHasBackpressure(s);if(o!==A._backpressure){TransformStreamSetBackpressure(A,true)}}function TransformStreamDefaultControllerError(t,r){TransformStreamError(t._controlledTransformStream,r)}function TransformStreamDefaultControllerPerformTransform(t,r){const A=t._transformAlgorithm(r);return transformPromiseWith(A,undefined,(r=>{TransformStreamError(t._controlledTransformStream,r);throw r}))}function TransformStreamDefaultControllerTerminate(t){const r=t._controlledTransformStream;const A=r._readable._readableStreamController;ReadableStreamDefaultControllerClose(A);const s=new TypeError("TransformStream terminated");TransformStreamErrorWritableAndUnblockWrite(r,s)}function TransformStreamDefaultSinkWriteAlgorithm(t,r){const A=t._transformStreamController;if(t._backpressure){const s=t._backpressureChangePromise;return transformPromiseWith(s,(()=>{const s=t._writable;const o=s._state;if(o==="erroring"){throw s._storedError}return TransformStreamDefaultControllerPerformTransform(A,r)}))}return TransformStreamDefaultControllerPerformTransform(A,r)}function TransformStreamDefaultSinkAbortAlgorithm(t,r){const A=t._transformStreamController;if(A._finishPromise!==undefined){return A._finishPromise}const s=t._readable;A._finishPromise=newPromise(((t,r)=>{A._finishPromise_resolve=t;A._finishPromise_reject=r}));const o=A._cancelAlgorithm(r);TransformStreamDefaultControllerClearAlgorithms(A);uponPromise(o,(()=>{if(s._state==="errored"){defaultControllerFinishPromiseReject(A,s._storedError)}else{ReadableStreamDefaultControllerError(s._readableStreamController,r);defaultControllerFinishPromiseResolve(A)}return null}),(t=>{ReadableStreamDefaultControllerError(s._readableStreamController,t);defaultControllerFinishPromiseReject(A,t);return null}));return A._finishPromise}function TransformStreamDefaultSinkCloseAlgorithm(t){const r=t._transformStreamController;if(r._finishPromise!==undefined){return r._finishPromise}const A=t._readable;r._finishPromise=newPromise(((t,A)=>{r._finishPromise_resolve=t;r._finishPromise_reject=A}));const s=r._flushAlgorithm();TransformStreamDefaultControllerClearAlgorithms(r);uponPromise(s,(()=>{if(A._state==="errored"){defaultControllerFinishPromiseReject(r,A._storedError)}else{ReadableStreamDefaultControllerClose(A._readableStreamController);defaultControllerFinishPromiseResolve(r)}return null}),(t=>{ReadableStreamDefaultControllerError(A._readableStreamController,t);defaultControllerFinishPromiseReject(r,t);return null}));return r._finishPromise}function TransformStreamDefaultSourcePullAlgorithm(t){TransformStreamSetBackpressure(t,false);return t._backpressureChangePromise}function TransformStreamDefaultSourceCancelAlgorithm(t,r){const A=t._transformStreamController;if(A._finishPromise!==undefined){return A._finishPromise}const s=t._writable;A._finishPromise=newPromise(((t,r)=>{A._finishPromise_resolve=t;A._finishPromise_reject=r}));const o=A._cancelAlgorithm(r);TransformStreamDefaultControllerClearAlgorithms(A);uponPromise(o,(()=>{if(s._state==="errored"){defaultControllerFinishPromiseReject(A,s._storedError)}else{WritableStreamDefaultControllerErrorIfNeeded(s._writableStreamController,r);TransformStreamUnblockWrite(t);defaultControllerFinishPromiseResolve(A)}return null}),(r=>{WritableStreamDefaultControllerErrorIfNeeded(s._writableStreamController,r);TransformStreamUnblockWrite(t);defaultControllerFinishPromiseReject(A,r);return null}));return A._finishPromise}function defaultControllerBrandCheckException(t){return new TypeError(`TransformStreamDefaultController.prototype.${t} can only be used on a TransformStreamDefaultController`)}function defaultControllerFinishPromiseResolve(t){if(t._finishPromise_resolve===undefined){return}t._finishPromise_resolve();t._finishPromise_resolve=undefined;t._finishPromise_reject=undefined}function defaultControllerFinishPromiseReject(t,r){if(t._finishPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._finishPromise);t._finishPromise_reject(r);t._finishPromise_resolve=undefined;t._finishPromise_reject=undefined}function streamBrandCheckException(t){return new TypeError(`TransformStream.prototype.${t} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=ByteLengthQueuingStrategy;t.CountQueuingStrategy=CountQueuingStrategy;t.ReadableByteStreamController=ReadableByteStreamController;t.ReadableStream=ReadableStream;t.ReadableStreamBYOBReader=ReadableStreamBYOBReader;t.ReadableStreamBYOBRequest=ReadableStreamBYOBRequest;t.ReadableStreamDefaultController=ReadableStreamDefaultController;t.ReadableStreamDefaultReader=ReadableStreamDefaultReader;t.TransformStream=TransformStream;t.TransformStreamDefaultController=TransformStreamDefaultController;t.WritableStream=WritableStream;t.WritableStreamDefaultController=WritableStreamDefaultController;t.WritableStreamDefaultWriter=WritableStreamDefaultWriter}))},2940:t=>{t.exports=wrappy;function wrappy(t,r){if(t&&r)return wrappy(t)(r);if(typeof t!=="function")throw new TypeError("need wrapper function");Object.keys(t).forEach((function(r){wrapper[r]=t[r]}));return wrapper;function wrapper(){var r=new Array(arguments.length);for(var A=0;A{"use strict";t.exports=require("assert")},852:t=>{"use strict";t.exports=require("async_hooks")},4300:t=>{"use strict";t.exports=require("buffer")},6206:t=>{"use strict";t.exports=require("console")},6113:t=>{"use strict";t.exports=require("crypto")},7643:t=>{"use strict";t.exports=require("diagnostics_channel")},2361:t=>{"use strict";t.exports=require("events")},7147:t=>{"use strict";t.exports=require("fs")},3685:t=>{"use strict";t.exports=require("http")},5158:t=>{"use strict";t.exports=require("http2")},5687:t=>{"use strict";t.exports=require("https")},1808:t=>{"use strict";t.exports=require("net")},5673:t=>{"use strict";t.exports=require("node:events")},7742:t=>{"use strict";t.exports=require("node:process")},4492:t=>{"use strict";t.exports=require("node:stream")},2477:t=>{"use strict";t.exports=require("node:stream/web")},7261:t=>{"use strict";t.exports=require("node:util")},2037:t=>{"use strict";t.exports=require("os")},1017:t=>{"use strict";t.exports=require("path")},4074:t=>{"use strict";t.exports=require("perf_hooks")},3477:t=>{"use strict";t.exports=require("querystring")},2781:t=>{"use strict";t.exports=require("stream")},5356:t=>{"use strict";t.exports=require("stream/web")},1576:t=>{"use strict";t.exports=require("string_decoder")},4404:t=>{"use strict";t.exports=require("tls")},6224:t=>{"use strict";t.exports=require("tty")},7310:t=>{"use strict";t.exports=require("url")},3837:t=>{"use strict";t.exports=require("util")},9830:t=>{"use strict";t.exports=require("util/types")},1267:t=>{"use strict";t.exports=require("worker_threads")},9796:t=>{"use strict";t.exports=require("zlib")},2960:(t,r,A)=>{"use strict";const s=A(4492).Writable;const o=A(7261).inherits;const n=A(1142);const i=A(1620);const a=A(2032);const c=45;const l=Buffer.from("-");const u=Buffer.from("\r\n");const EMPTY_FN=function(){};function Dicer(t){if(!(this instanceof Dicer)){return new Dicer(t)}s.call(this,t);if(!t||!t.headerFirst&&typeof t.boundary!=="string"){throw new TypeError("Boundary required")}if(typeof t.boundary==="string"){this.setBoundary(t.boundary)}else{this._bparser=undefined}this._headerFirst=t.headerFirst;this._dashes=0;this._parts=0;this._finished=false;this._realFinish=false;this._isPreamble=true;this._justMatched=false;this._firstWrite=true;this._inHeader=true;this._part=undefined;this._cb=undefined;this._ignoreData=false;this._partOpts={highWaterMark:t.partHwm};this._pause=false;const r=this;this._hparser=new a(t);this._hparser.on("header",(function(t){r._inHeader=false;r._part.emit("header",t)}))}o(Dicer,s);Dicer.prototype.emit=function(t){if(t==="finish"&&!this._realFinish){if(!this._finished){const t=this;process.nextTick((function(){t.emit("error",new Error("Unexpected end of multipart data"));if(t._part&&!t._ignoreData){const r=t._isPreamble?"Preamble":"Part";t._part.emit("error",new Error(r+" terminated early due to unexpected end of multipart data"));t._part.push(null);process.nextTick((function(){t._realFinish=true;t.emit("finish");t._realFinish=false}));return}t._realFinish=true;t.emit("finish");t._realFinish=false}))}}else{s.prototype.emit.apply(this,arguments)}};Dicer.prototype._write=function(t,r,A){if(!this._hparser&&!this._bparser){return A()}if(this._headerFirst&&this._isPreamble){if(!this._part){this._part=new i(this._partOpts);if(this._events.preamble){this.emit("preamble",this._part)}else{this._ignore()}}const r=this._hparser.push(t);if(!this._inHeader&&r!==undefined&&r{"use strict";const s=A(5673).EventEmitter;const o=A(7261).inherits;const n=A(1467);const i=A(1142);const a=Buffer.from("\r\n\r\n");const c=/\r\n/g;const l=/^([^:]+):[ \t]?([\x00-\xFF]+)?$/;function HeaderParser(t){s.call(this);t=t||{};const r=this;this.nread=0;this.maxed=false;this.npairs=0;this.maxHeaderPairs=n(t,"maxHeaderPairs",2e3);this.maxHeaderSize=n(t,"maxHeaderSize",80*1024);this.buffer="";this.header={};this.finished=false;this.ss=new i(a);this.ss.on("info",(function(t,A,s,o){if(A&&!r.maxed){if(r.nread+o-s>=r.maxHeaderSize){o=r.maxHeaderSize-r.nread+s;r.nread=r.maxHeaderSize;r.maxed=true}else{r.nread+=o-s}r.buffer+=A.toString("binary",s,o)}if(t){r._finish()}}))}o(HeaderParser,s);HeaderParser.prototype.push=function(t){const r=this.ss.push(t);if(this.finished){return r}};HeaderParser.prototype.reset=function(){this.finished=false;this.buffer="";this.header={};this.ss.reset()};HeaderParser.prototype._finish=function(){if(this.buffer){this._parseHeader()}this.ss.matches=this.ss.maxMatches;const t=this.header;this.header={};this.buffer="";this.finished=true;this.nread=this.npairs=0;this.maxed=false;this.emit("header",t)};HeaderParser.prototype._parseHeader=function(){if(this.npairs===this.maxHeaderPairs){return}const t=this.buffer.split(c);const r=t.length;let A,s;for(var o=0;o{"use strict";const s=A(7261).inherits;const o=A(4492).Readable;function PartStream(t){o.call(this,t)}s(PartStream,o);PartStream.prototype._read=function(t){};t.exports=PartStream},1142:(t,r,A)=>{"use strict";const s=A(5673).EventEmitter;const o=A(7261).inherits;function SBMH(t){if(typeof t==="string"){t=Buffer.from(t)}if(!Buffer.isBuffer(t)){throw new TypeError("The needle has to be a String or a Buffer.")}const r=t.length;if(r===0){throw new Error("The needle cannot be an empty String/Buffer.")}if(r>256){throw new Error("The needle cannot have a length bigger than 256.")}this.maxMatches=Infinity;this.matches=0;this._occ=new Array(256).fill(r);this._lookbehind_size=0;this._needle=t;this._bufpos=0;this._lookbehind=Buffer.alloc(r);for(var A=0;A=0){this.emit("info",false,this._lookbehind,0,this._lookbehind_size);this._lookbehind_size=0}else{const A=this._lookbehind_size+n;if(A>0){this.emit("info",false,this._lookbehind,0,A)}this._lookbehind.copy(this._lookbehind,0,A,this._lookbehind_size-A);this._lookbehind_size-=A;t.copy(this._lookbehind,this._lookbehind_size);this._lookbehind_size+=r;this._bufpos=r;return r}}n+=(n>=0)*this._bufpos;if(t.indexOf(A,n)!==-1){n=t.indexOf(A,n);++this.matches;if(n>0){this.emit("info",true,t,this._bufpos,n)}else{this.emit("info",true)}return this._bufpos=n+s}else{n=r-s}while(n0){this.emit("info",false,t,this._bufpos,n{"use strict";const s=A(4492).Writable;const{inherits:o}=A(7261);const n=A(2960);const i=A(2183);const a=A(8306);const c=A(1854);function Busboy(t){if(!(this instanceof Busboy)){return new Busboy(t)}if(typeof t!=="object"){throw new TypeError("Busboy expected an options-Object.")}if(typeof t.headers!=="object"){throw new TypeError("Busboy expected an options-Object with headers-attribute.")}if(typeof t.headers["content-type"]!=="string"){throw new TypeError("Missing Content-Type-header.")}const{headers:r,...A}=t;this.opts={autoDestroy:false,...A};s.call(this,this.opts);this._done=false;this._parser=this.getParserByHeaders(r);this._finished=false}o(Busboy,s);Busboy.prototype.emit=function(t){if(t==="finish"){if(!this._done){this._parser?.end();return}else if(this._finished){return}this._finished=true}s.prototype.emit.apply(this,arguments)};Busboy.prototype.getParserByHeaders=function(t){const r=c(t["content-type"]);const A={defCharset:this.opts.defCharset,fileHwm:this.opts.fileHwm,headers:t,highWaterMark:this.opts.highWaterMark,isPartAFile:this.opts.isPartAFile,limits:this.opts.limits,parsedConType:r,preservePath:this.opts.preservePath};if(i.detect.test(r[0])){return new i(this,A)}if(a.detect.test(r[0])){return new a(this,A)}throw new Error("Unsupported Content-Type.")};Busboy.prototype._write=function(t,r,A){this._parser.write(t,A)};t.exports=Busboy;t.exports["default"]=Busboy;t.exports.Busboy=Busboy;t.exports.Dicer=n},2183:(t,r,A)=>{"use strict";const{Readable:s}=A(4492);const{inherits:o}=A(7261);const n=A(2960);const i=A(1854);const a=A(4619);const c=A(8647);const l=A(1467);const u=/^boundary$/i;const g=/^form-data$/i;const d=/^charset$/i;const E=/^filename$/i;const h=/^name$/i;Multipart.detect=/^multipart\/form-data/i;function Multipart(t,r){let A;let s;const o=this;let C;const Q=r.limits;const p=r.isPartAFile||((t,r,A)=>r==="application/octet-stream"||A!==undefined);const B=r.parsedConType||[];const I=r.defCharset||"utf8";const m=r.preservePath;const y={highWaterMark:r.fileHwm};for(A=0,s=B.length;AS){o.parser.removeListener("part",onPart);o.parser.on("part",skipPart);t.hitPartsLimit=true;t.emit("partsLimit");return skipPart(r)}if(_){const t=_;t.emit("end");t.removeAllListeners("end")}r.on("header",(function(n){let l;let u;let C;let Q;let B;let S;let D=0;if(n["content-type"]){C=i(n["content-type"][0]);if(C[0]){l=C[0].toLowerCase();for(A=0,s=C.length;AR){const s=R-D+t.length;if(s>0){A.push(t.slice(0,s))}A.truncated=true;A.bytesRead=R;r.removeAllListeners("data");A.emit("limit");return}else if(!A.push(t)){o._pause=true}A.bytesRead=D};L=function(){U=undefined;A.push(null)}}else{if(v===k){if(!t.hitFieldsLimit){t.hitFieldsLimit=true;t.emit("fieldsLimit")}return skipPart(r)}++v;++N;let A="";let s=false;_=r;T=function(t){if((D+=t.length)>b){const o=b-(D-t.length);A+=t.toString("binary",0,o);s=true;r.removeAllListeners("data")}else{A+=t.toString("binary")}};L=function(){_=undefined;if(A.length){A=a(A,"binary",Q)}t.emit("field",u,A,false,s,B,l);--N;checkFinished()}}r._readableState.sync=false;r.on("data",T);r.on("end",L)})).on("error",(function(t){if(U){U.emit("error",t)}}))})).on("error",(function(r){t.emit("error",r)})).on("finish",(function(){L=true;checkFinished()}))}Multipart.prototype.write=function(t,r){const A=this.parser.write(t);if(A&&!this._pause){r()}else{this._needDrain=!A;this._cb=r}};Multipart.prototype.end=function(){const t=this;if(t.parser.writable){t.parser.end()}else if(!t._boy._done){process.nextTick((function(){t._boy._done=true;t._boy.emit("finish")}))}};function skipPart(t){t.resume()}function FileStream(t){s.call(this,t);this.bytesRead=0;this.truncated=false}o(FileStream,s);FileStream.prototype._read=function(t){};t.exports=Multipart},8306:(t,r,A)=>{"use strict";const s=A(7100);const o=A(4619);const n=A(1467);const i=/^charset$/i;UrlEncoded.detect=/^application\/x-www-form-urlencoded/i;function UrlEncoded(t,r){const A=r.limits;const o=r.parsedConType;this.boy=t;this.fieldSizeLimit=n(A,"fieldSize",1*1024*1024);this.fieldNameSizeLimit=n(A,"fieldNameSize",100);this.fieldsLimit=n(A,"fields",Infinity);let a;for(var c=0,l=o.length;ci){this._key+=this.decoder.write(t.toString("binary",i,A))}this._state="val";this._hitLimit=false;this._checkingBytes=true;this._val="";this._bytesVal=0;this._valTrunc=false;this.decoder.reset();i=A+1}else if(s!==undefined){++this._fields;let A;const n=this._keyTrunc;if(s>i){A=this._key+=this.decoder.write(t.toString("binary",i,s))}else{A=this._key}this._hitLimit=false;this._checkingBytes=true;this._key="";this._bytesKey=0;this._keyTrunc=false;this.decoder.reset();if(A.length){this.boy.emit("field",o(A,"binary",this.charset),"",n,false)}i=s+1;if(this._fields===this.fieldsLimit){return r()}}else if(this._hitLimit){if(n>i){this._key+=this.decoder.write(t.toString("binary",i,n))}i=n;if((this._bytesKey=this._key.length)===this.fieldNameSizeLimit){this._checkingBytes=false;this._keyTrunc=true}}else{if(ii){this._val+=this.decoder.write(t.toString("binary",i,s))}this.boy.emit("field",o(this._key,"binary",this.charset),o(this._val,"binary",this.charset),this._keyTrunc,this._valTrunc);this._state="key";this._hitLimit=false;this._checkingBytes=true;this._key="";this._bytesKey=0;this._keyTrunc=false;this.decoder.reset();i=s+1;if(this._fields===this.fieldsLimit){return r()}}else if(this._hitLimit){if(n>i){this._val+=this.decoder.write(t.toString("binary",i,n))}i=n;if(this._val===""&&this.fieldSizeLimit===0||(this._bytesVal=this._val.length)===this.fieldSizeLimit){this._checkingBytes=false;this._valTrunc=true}}else{if(i0){this.boy.emit("field",o(this._key,"binary",this.charset),"",this._keyTrunc,false)}else if(this._state==="val"){this.boy.emit("field",o(this._key,"binary",this.charset),o(this._val,"binary",this.charset),this._keyTrunc,this._valTrunc)}this.boy._done=true;this.boy.emit("finish")};t.exports=UrlEncoded},7100:t=>{"use strict";const r=/\+/g;const A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function Decoder(){this.buffer=undefined}Decoder.prototype.write=function(t){t=t.replace(r," ");let s="";let o=0;let n=0;const i=t.length;for(;on){s+=t.substring(n,o);n=o}this.buffer="";++n}}if(n{"use strict";t.exports=function basename(t){if(typeof t!=="string"){return""}for(var r=t.length-1;r>=0;--r){switch(t.charCodeAt(r)){case 47:case 92:t=t.slice(r+1);return t===".."||t==="."?"":t}}return t===".."||t==="."?"":t}},4619:function(t){"use strict";const r=new TextDecoder("utf-8");const A=new Map([["utf-8",r],["utf8",r]]);function getDecoder(t){let r;while(true){switch(t){case"utf-8":case"utf8":return s.utf8;case"latin1":case"ascii":case"us-ascii":case"iso-8859-1":case"iso8859-1":case"iso88591":case"iso_8859-1":case"windows-1252":case"iso_8859-1:1987":case"cp1252":case"x-cp1252":return s.latin1;case"utf16le":case"utf-16le":case"ucs2":case"ucs-2":return s.utf16le;case"base64":return s.base64;default:if(r===undefined){r=true;t=t.toLowerCase();continue}return s.other.bind(t)}}}const s={utf8:(t,r)=>{if(t.length===0){return""}if(typeof t==="string"){t=Buffer.from(t,r)}return t.utf8Slice(0,t.length)},latin1:(t,r)=>{if(t.length===0){return""}if(typeof t==="string"){return t}return t.latin1Slice(0,t.length)},utf16le:(t,r)=>{if(t.length===0){return""}if(typeof t==="string"){t=Buffer.from(t,r)}return t.ucs2Slice(0,t.length)},base64:(t,r)=>{if(t.length===0){return""}if(typeof t==="string"){t=Buffer.from(t,r)}return t.base64Slice(0,t.length)},other:(t,r)=>{if(t.length===0){return""}if(typeof t==="string"){t=Buffer.from(t,r)}if(A.has(this.toString())){try{return A.get(this).decode(t)}catch(t){}}return typeof t==="string"?t:t.toString()}};function decodeText(t,r,A){if(t){return getDecoder(A)(t,r)}return t}t.exports=decodeText},1467:t=>{"use strict";t.exports=function getLimit(t,r,A){if(!t||t[r]===undefined||t[r]===null){return A}if(typeof t[r]!=="number"||isNaN(t[r])){throw new TypeError("Limit "+r+" is not a valid number")}return t[r]}},1854:(t,r,A)=>{"use strict";const s=A(4619);const o=/%[a-fA-F0-9][a-fA-F0-9]/g;const n={"%00":"\0","%01":"","%02":"","%03":"","%04":"","%05":"","%06":"","%07":"","%08":"\b","%09":"\t","%0a":"\n","%0A":"\n","%0b":"\v","%0B":"\v","%0c":"\f","%0C":"\f","%0d":"\r","%0D":"\r","%0e":"","%0E":"","%0f":"","%0F":"","%10":"","%11":"","%12":"","%13":"","%14":"","%15":"","%16":"","%17":"","%18":"","%19":"","%1a":"","%1A":"","%1b":"","%1B":"","%1c":"","%1C":"","%1d":"","%1D":"","%1e":"","%1E":"","%1f":"","%1F":"","%20":" ","%21":"!","%22":'"',"%23":"#","%24":"$","%25":"%","%26":"&","%27":"'","%28":"(","%29":")","%2a":"*","%2A":"*","%2b":"+","%2B":"+","%2c":",","%2C":",","%2d":"-","%2D":"-","%2e":".","%2E":".","%2f":"/","%2F":"/","%30":"0","%31":"1","%32":"2","%33":"3","%34":"4","%35":"5","%36":"6","%37":"7","%38":"8","%39":"9","%3a":":","%3A":":","%3b":";","%3B":";","%3c":"<","%3C":"<","%3d":"=","%3D":"=","%3e":">","%3E":">","%3f":"?","%3F":"?","%40":"@","%41":"A","%42":"B","%43":"C","%44":"D","%45":"E","%46":"F","%47":"G","%48":"H","%49":"I","%4a":"J","%4A":"J","%4b":"K","%4B":"K","%4c":"L","%4C":"L","%4d":"M","%4D":"M","%4e":"N","%4E":"N","%4f":"O","%4F":"O","%50":"P","%51":"Q","%52":"R","%53":"S","%54":"T","%55":"U","%56":"V","%57":"W","%58":"X","%59":"Y","%5a":"Z","%5A":"Z","%5b":"[","%5B":"[","%5c":"\\","%5C":"\\","%5d":"]","%5D":"]","%5e":"^","%5E":"^","%5f":"_","%5F":"_","%60":"`","%61":"a","%62":"b","%63":"c","%64":"d","%65":"e","%66":"f","%67":"g","%68":"h","%69":"i","%6a":"j","%6A":"j","%6b":"k","%6B":"k","%6c":"l","%6C":"l","%6d":"m","%6D":"m","%6e":"n","%6E":"n","%6f":"o","%6F":"o","%70":"p","%71":"q","%72":"r","%73":"s","%74":"t","%75":"u","%76":"v","%77":"w","%78":"x","%79":"y","%7a":"z","%7A":"z","%7b":"{","%7B":"{","%7c":"|","%7C":"|","%7d":"}","%7D":"}","%7e":"~","%7E":"~","%7f":"","%7F":"","%80":"€","%81":"","%82":"‚","%83":"ƒ","%84":"„","%85":"…","%86":"†","%87":"‡","%88":"ˆ","%89":"‰","%8a":"Š","%8A":"Š","%8b":"‹","%8B":"‹","%8c":"Œ","%8C":"Œ","%8d":"","%8D":"","%8e":"Ž","%8E":"Ž","%8f":"","%8F":"","%90":"","%91":"‘","%92":"’","%93":"“","%94":"”","%95":"•","%96":"–","%97":"—","%98":"˜","%99":"™","%9a":"š","%9A":"š","%9b":"›","%9B":"›","%9c":"œ","%9C":"œ","%9d":"","%9D":"","%9e":"ž","%9E":"ž","%9f":"Ÿ","%9F":"Ÿ","%a0":" ","%A0":" ","%a1":"¡","%A1":"¡","%a2":"¢","%A2":"¢","%a3":"£","%A3":"£","%a4":"¤","%A4":"¤","%a5":"¥","%A5":"¥","%a6":"¦","%A6":"¦","%a7":"§","%A7":"§","%a8":"¨","%A8":"¨","%a9":"©","%A9":"©","%aa":"ª","%Aa":"ª","%aA":"ª","%AA":"ª","%ab":"«","%Ab":"«","%aB":"«","%AB":"«","%ac":"¬","%Ac":"¬","%aC":"¬","%AC":"¬","%ad":"­","%Ad":"­","%aD":"­","%AD":"­","%ae":"®","%Ae":"®","%aE":"®","%AE":"®","%af":"¯","%Af":"¯","%aF":"¯","%AF":"¯","%b0":"°","%B0":"°","%b1":"±","%B1":"±","%b2":"²","%B2":"²","%b3":"³","%B3":"³","%b4":"´","%B4":"´","%b5":"µ","%B5":"µ","%b6":"¶","%B6":"¶","%b7":"·","%B7":"·","%b8":"¸","%B8":"¸","%b9":"¹","%B9":"¹","%ba":"º","%Ba":"º","%bA":"º","%BA":"º","%bb":"»","%Bb":"»","%bB":"»","%BB":"»","%bc":"¼","%Bc":"¼","%bC":"¼","%BC":"¼","%bd":"½","%Bd":"½","%bD":"½","%BD":"½","%be":"¾","%Be":"¾","%bE":"¾","%BE":"¾","%bf":"¿","%Bf":"¿","%bF":"¿","%BF":"¿","%c0":"À","%C0":"À","%c1":"Á","%C1":"Á","%c2":"Â","%C2":"Â","%c3":"Ã","%C3":"Ã","%c4":"Ä","%C4":"Ä","%c5":"Å","%C5":"Å","%c6":"Æ","%C6":"Æ","%c7":"Ç","%C7":"Ç","%c8":"È","%C8":"È","%c9":"É","%C9":"É","%ca":"Ê","%Ca":"Ê","%cA":"Ê","%CA":"Ê","%cb":"Ë","%Cb":"Ë","%cB":"Ë","%CB":"Ë","%cc":"Ì","%Cc":"Ì","%cC":"Ì","%CC":"Ì","%cd":"Í","%Cd":"Í","%cD":"Í","%CD":"Í","%ce":"Î","%Ce":"Î","%cE":"Î","%CE":"Î","%cf":"Ï","%Cf":"Ï","%cF":"Ï","%CF":"Ï","%d0":"Ð","%D0":"Ð","%d1":"Ñ","%D1":"Ñ","%d2":"Ò","%D2":"Ò","%d3":"Ó","%D3":"Ó","%d4":"Ô","%D4":"Ô","%d5":"Õ","%D5":"Õ","%d6":"Ö","%D6":"Ö","%d7":"×","%D7":"×","%d8":"Ø","%D8":"Ø","%d9":"Ù","%D9":"Ù","%da":"Ú","%Da":"Ú","%dA":"Ú","%DA":"Ú","%db":"Û","%Db":"Û","%dB":"Û","%DB":"Û","%dc":"Ü","%Dc":"Ü","%dC":"Ü","%DC":"Ü","%dd":"Ý","%Dd":"Ý","%dD":"Ý","%DD":"Ý","%de":"Þ","%De":"Þ","%dE":"Þ","%DE":"Þ","%df":"ß","%Df":"ß","%dF":"ß","%DF":"ß","%e0":"à","%E0":"à","%e1":"á","%E1":"á","%e2":"â","%E2":"â","%e3":"ã","%E3":"ã","%e4":"ä","%E4":"ä","%e5":"å","%E5":"å","%e6":"æ","%E6":"æ","%e7":"ç","%E7":"ç","%e8":"è","%E8":"è","%e9":"é","%E9":"é","%ea":"ê","%Ea":"ê","%eA":"ê","%EA":"ê","%eb":"ë","%Eb":"ë","%eB":"ë","%EB":"ë","%ec":"ì","%Ec":"ì","%eC":"ì","%EC":"ì","%ed":"í","%Ed":"í","%eD":"í","%ED":"í","%ee":"î","%Ee":"î","%eE":"î","%EE":"î","%ef":"ï","%Ef":"ï","%eF":"ï","%EF":"ï","%f0":"ð","%F0":"ð","%f1":"ñ","%F1":"ñ","%f2":"ò","%F2":"ò","%f3":"ó","%F3":"ó","%f4":"ô","%F4":"ô","%f5":"õ","%F5":"õ","%f6":"ö","%F6":"ö","%f7":"÷","%F7":"÷","%f8":"ø","%F8":"ø","%f9":"ù","%F9":"ù","%fa":"ú","%Fa":"ú","%fA":"ú","%FA":"ú","%fb":"û","%Fb":"û","%fB":"û","%FB":"û","%fc":"ü","%Fc":"ü","%fC":"ü","%FC":"ü","%fd":"ý","%Fd":"ý","%fD":"ý","%FD":"ý","%fe":"þ","%Fe":"þ","%fE":"þ","%FE":"þ","%ff":"ÿ","%Ff":"ÿ","%fF":"ÿ","%FF":"ÿ"};function encodedReplacer(t){return n[t]}const i=0;const a=1;const c=2;const l=3;function parseParams(t){const r=[];let A=i;let n="";let u=false;let g=false;let d=0;let E="";const h=t.length;for(var C=0;C{const s=65536;if(!globalThis.ReadableStream){try{const t=A(7742);const{emitWarning:r}=t;try{t.emitWarning=()=>{};Object.assign(globalThis,A(2477));t.emitWarning=r}catch(A){t.emitWarning=r;throw A}}catch(t){Object.assign(globalThis,A(1452))}}try{const{Blob:t}=A(4300);if(t&&!t.prototype.stream){t.prototype.stream=function name(t){let r=0;const A=this;return new ReadableStream({type:"bytes",async pull(t){const o=A.slice(r,Math.min(A.size,r+s));const n=await o.arrayBuffer();r+=n.byteLength;t.enqueue(new Uint8Array(n));if(r===A.size){t.close()}}})}}}catch(t){}},3213:(t,r,A)=>{"use strict";A.d(r,{Z:()=>i});var s=A(1410);const o=class File extends s.Z{#C=0;#f="";constructor(t,r,A={}){if(arguments.length<2){throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)}super(t,A);if(A===null)A={};const s=A.lastModified===undefined?Date.now():Number(A.lastModified);if(!Number.isNaN(s)){this.#C=s}this.#f=String(r)}get name(){return this.#f}get lastModified(){return this.#C}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](t){return!!t&&t instanceof s.Z&&/^(File)$/.test(t[Symbol.toStringTag])}};const n=o;const i=n},2777:(t,r,A)=>{"use strict";A.d(r,{$B:()=>i.Z});const s=require("node:fs");const o=require("node:path");var n=A(7760);var i=A(3213);var a=A(1410);const{stat:c}=s.promises;const blobFromSync=(t,r)=>fromBlob(statSync(t),t,r);const blobFrom=(t,r)=>c(t).then((A=>fromBlob(A,t,r)));const fileFrom=(t,r)=>c(t).then((A=>fromFile(A,t,r)));const fileFromSync=(t,r)=>fromFile(statSync(t),t,r);const fromBlob=(t,r,A="")=>new Blob([new BlobDataItem({path:r,size:t.size,lastModified:t.mtimeMs,start:0})],{type:A});const fromFile=(t,r,A="")=>new File([new BlobDataItem({path:r,size:t.size,lastModified:t.mtimeMs,start:0})],basename(r),{type:A,lastModified:t.mtimeMs});class BlobDataItem{#Q;#p;constructor(t){this.#Q=t.path;this.#p=t.start;this.size=t.size;this.lastModified=t.lastModified}slice(t,r){return new BlobDataItem({path:this.#Q,lastModified:this.lastModified,size:r-t,start:this.#p+t})}async*stream(){const{mtimeMs:t}=await c(this.#Q);if(t>this.lastModified){throw new DOMException("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError")}yield*createReadStream(this.#Q,{start:this.#p,end:this.#p+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}const l=null&&blobFromSync},1410:(t,r,A)=>{"use strict";A.d(r,{Z:()=>a});var s=A(8572); /*! fetch-blob. MIT License. Jimmy Wärting */const o=65536;async function*toIterator(t,r=true){for(const A of t){if("stream"in A){yield*A.stream()}else if(ArrayBuffer.isView(A)){if(r){let t=A.byteOffset;const r=A.byteOffset+A.byteLength;while(t!==r){const s=Math.min(r-t,o);const n=A.buffer.slice(t,t+s);t+=n.byteLength;yield new Uint8Array(n)}}else{yield A}}else{let t=0,r=A;while(t!==r.size){const A=r.slice(t,Math.min(r.size,t+o));const s=await A.arrayBuffer();t+=s.byteLength;yield new Uint8Array(s)}}}}const n=class Blob{#B=[];#I="";#m=0;#y="transparent";constructor(t=[],r={}){if(typeof t!=="object"||t===null){throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.")}if(typeof t[Symbol.iterator]!=="function"){throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.")}if(typeof r!=="object"&&typeof r!=="function"){throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.")}if(r===null)r={};const A=new TextEncoder;for(const r of t){let t;if(ArrayBuffer.isView(r)){t=new Uint8Array(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength))}else if(r instanceof ArrayBuffer){t=new Uint8Array(r.slice(0))}else if(r instanceof Blob){t=r}else{t=A.encode(`${r}`)}this.#m+=ArrayBuffer.isView(t)?t.byteLength:t.size;this.#B.push(t)}this.#y=`${r.endings===undefined?"transparent":r.endings}`;const s=r.type===undefined?"":String(r.type);this.#I=/^[\x20-\x7E]*$/.test(s)?s:""}get size(){return this.#m}get type(){return this.#I}async text(){const t=new TextDecoder;let r="";for await(const A of toIterator(this.#B,false)){r+=t.decode(A,{stream:true})}r+=t.decode();return r}async arrayBuffer(){const t=new Uint8Array(this.size);let r=0;for await(const A of toIterator(this.#B,false)){t.set(A,r);r+=A.length}return t.buffer}stream(){const t=toIterator(this.#B,true);return new globalThis.ReadableStream({type:"bytes",async pull(r){const A=await t.next();A.done?r.close():r.enqueue(A.value)},async cancel(){await t.return()}})}slice(t=0,r=this.size,A=""){const{size:s}=this;let o=t<0?Math.max(s+t,0):Math.min(t,s);let n=r<0?Math.max(s+r,0):Math.min(r,s);const i=Math.max(n-o,0);const a=this.#B;const c=[];let l=0;for(const t of a){if(l>=i){break}const r=ArrayBuffer.isView(t)?t.byteLength:t.size;if(o&&r<=o){o-=r;n-=r}else{let A;if(ArrayBuffer.isView(t)){A=t.subarray(o,Math.min(r,n));l+=A.byteLength}else{A=t.slice(o,Math.min(r,n));l+=A.size}n-=r;c.push(A);o=0}}const u=new Blob([],{type:String(A).toLowerCase()});u.#m=i;u.#B=c;return u}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](t){return t&&typeof t==="object"&&typeof t.constructor==="function"&&(typeof t.stream==="function"||typeof t.arrayBuffer==="function")&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}};Object.defineProperties(n.prototype,{size:{enumerable:true},type:{enumerable:true},slice:{enumerable:true}});const i=n;const a=i},8010:(t,r,A)=>{"use strict";A.d(r,{Ct:()=>g,au:()=>formDataToBlob});var s=A(1410);var o=A(3213); -/*! formdata-polyfill. MIT License. Jimmy Wärting */var{toStringTag:n,iterator:i,hasInstance:a}=Symbol,c=Math.random,l="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),f=(t,r,A)=>(t+="",/^(Blob|File)$/.test(r&&r[n])?[(A=A!==void 0?A+"":r[n]=="File"?r.name:"blob",t),r.name!==A||r[n]=="blob"?new o.Z([r],A,r):r]:[t,r+""]),e=(t,r)=>(r?t:t.replace(/\r?\n|\r/g,"\r\n")).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),x=(t,r,A)=>{if(r.lengthtypeof t[r]!="function"))}append(...t){x("append",arguments,2);this.#b.push(f(...t))}delete(t){x("delete",arguments,1);t+="";this.#b=this.#b.filter((([r])=>r!==t))}get(t){x("get",arguments,1);t+="";for(var r=this.#b,A=r.length,s=0;sA[0]===t&&r.push(A[1])));return r}has(t){x("has",arguments,1);t+="";return this.#b.some((r=>r[0]===t))}forEach(t,r){x("forEach",arguments,1);for(var[A,s]of this)t.call(r,s,A,this)}set(...t){x("set",arguments,2);var r=[],A=!0;t=f(...t);this.#b.forEach((s=>{s[0]===t[0]?A&&(A=!r.push(t)):r.push(s)}));A&&r.push(t);this.#b=r}*entries(){yield*this.#b}*keys(){for(var[t]of this)yield t}*values(){for(var[,t]of this)yield t}};function formDataToBlob(t,r=s.Z){var A=`${c()}${c()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),o=[],n=`--${A}\r\nContent-Disposition: form-data; name="`;t.forEach(((t,r)=>typeof t=="string"?o.push(n+e(r)+`"\r\n\r\n${t.replace(/\r(?!\n)|(?{__nccwpck_require__.n=t=>{var r=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(t,r)=>{for(var A in r){if(__nccwpck_require__.o(r,A)&&!__nccwpck_require__.o(t,A)){Object.defineProperty(t,A,{enumerable:true,get:r[A]})}}}})();(()=>{__nccwpck_require__.f={};__nccwpck_require__.e=t=>Promise.all(Object.keys(__nccwpck_require__.f).reduce(((r,A)=>{__nccwpck_require__.f[A](t,r);return r}),[]))})();(()=>{__nccwpck_require__.u=t=>""+t+".index.js"})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";(()=>{var t={179:1};var installChunk=r=>{var A=r.modules,s=r.ids,o=r.runtime;for(var n in A){if(__nccwpck_require__.o(A,n)){__nccwpck_require__.m[n]=A[n]}}if(o)o(__nccwpck_require__);for(var i=0;i{if(!t[r]){if(true){installChunk(require("./"+__nccwpck_require__.u(r)))}else t[r]=1}}})();var A={};(()=>{"use strict";__nccwpck_require__.r(A);var t=__nccwpck_require__(2186);var r=__nccwpck_require__(5438);const s=require("node:http");const o=require("node:https");const n=require("node:zlib");var i=__nccwpck_require__(4492);const a=require("node:buffer");function dataUriToBuffer(t){if(!/^data:/i.test(t)){throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")')}t=t.replace(/\r?\n/g,"");const r=t.indexOf(",");if(r===-1||r<=4){throw new TypeError("malformed data: URI")}const A=t.substring(5,r).split(";");let s="";let o=false;const n=A[0]||"text/plain";let i=n;for(let t=1;ttypeof t==="object"&&typeof t.append==="function"&&typeof t.delete==="function"&&typeof t.get==="function"&&typeof t.getAll==="function"&&typeof t.has==="function"&&typeof t.set==="function"&&typeof t.sort==="function"&&t[d]==="URLSearchParams";const isBlob=t=>t&&typeof t==="object"&&typeof t.arrayBuffer==="function"&&typeof t.type==="string"&&typeof t.stream==="function"&&typeof t.constructor==="function"&&/^(Blob|File)$/.test(t[d]);const isAbortSignal=t=>typeof t==="object"&&(t[d]==="AbortSignal"||t[d]==="EventTarget");const isDomainOrSubdomain=(t,r)=>{const A=new URL(r).hostname;const s=new URL(t).hostname;return A===s||A.endsWith(`.${s}`)};const isSameProtocol=(t,r)=>{const A=new URL(r).protocol;const s=new URL(t).protocol;return A===s};const E=(0,l.promisify)(i.pipeline);const h=Symbol("Body internals");class Body{constructor(t,{size:r=0}={}){let A=null;if(t===null){t=null}else if(isURLSearchParameters(t)){t=a.Buffer.from(t.toString())}else if(isBlob(t)){}else if(a.Buffer.isBuffer(t)){}else if(l.types.isAnyArrayBuffer(t)){t=a.Buffer.from(t)}else if(ArrayBuffer.isView(t)){t=a.Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(t instanceof i){}else if(t instanceof g.Ct){t=(0,g.au)(t);A=t.type.split("=")[1]}else{t=a.Buffer.from(String(t))}let s=t;if(a.Buffer.isBuffer(t)){s=i.Readable.from(t)}else if(isBlob(t)){s=i.Readable.from(t.stream())}this[h]={body:t,stream:s,boundary:A,disturbed:false,error:null};this.size=r;if(t instanceof i){t.on("error",(t=>{const r=t instanceof FetchBaseError?t:new FetchError(`Invalid response body while trying to fetch ${this.url}: ${t.message}`,"system",t);this[h].error=r}))}}get body(){return this[h].stream}get bodyUsed(){return this[h].disturbed}async arrayBuffer(){const{buffer:t,byteOffset:r,byteLength:A}=await consumeBody(this);return t.slice(r,r+A)}async formData(){const t=this.headers.get("content-type");if(t.startsWith("application/x-www-form-urlencoded")){const t=new g.Ct;const r=new URLSearchParams(await this.text());for(const[A,s]of r){t.append(A,s)}return t}const{toFormData:r}=await __nccwpck_require__.e(37).then(__nccwpck_require__.bind(__nccwpck_require__,4037));return r(this.body,t)}async blob(){const t=this.headers&&this.headers.get("content-type")||this[h].body&&this[h].body.type||"";const r=await this.arrayBuffer();return new u.Z([r],{type:t})}async json(){const t=await this.text();return JSON.parse(t)}async text(){const t=await consumeBody(this);return(new TextDecoder).decode(t)}buffer(){return consumeBody(this)}}Body.prototype.buffer=(0,l.deprecate)(Body.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Body.prototype,{body:{enumerable:true},bodyUsed:{enumerable:true},arrayBuffer:{enumerable:true},blob:{enumerable:true},json:{enumerable:true},text:{enumerable:true},data:{get:(0,l.deprecate)((()=>{}),"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function consumeBody(t){if(t[h].disturbed){throw new TypeError(`body used already for: ${t.url}`)}t[h].disturbed=true;if(t[h].error){throw t[h].error}const{body:r}=t;if(r===null){return a.Buffer.alloc(0)}if(!(r instanceof i)){return a.Buffer.alloc(0)}const A=[];let s=0;try{for await(const o of r){if(t.size>0&&s+o.length>t.size){const A=new FetchError(`content size at ${t.url} over limit: ${t.size}`,"max-size");r.destroy(A);throw A}s+=o.length;A.push(o)}}catch(r){const A=r instanceof FetchBaseError?r:new FetchError(`Invalid response body while trying to fetch ${t.url}: ${r.message}`,"system",r);throw A}if(r.readableEnded===true||r._readableState.ended===true){try{if(A.every((t=>typeof t==="string"))){return a.Buffer.from(A.join(""))}return a.Buffer.concat(A,s)}catch(r){throw new FetchError(`Could not create Buffer from response body for ${t.url}: ${r.message}`,"system",r)}}else{throw new FetchError(`Premature close of server response while trying to fetch ${t.url}`)}}const clone=(t,r)=>{let A;let s;let{body:o}=t[h];if(t.bodyUsed){throw new Error("cannot clone body after it is used")}if(o instanceof i&&typeof o.getBoundary!=="function"){A=new i.PassThrough({highWaterMark:r});s=new i.PassThrough({highWaterMark:r});o.pipe(A);o.pipe(s);t[h].stream=A;o=s}return o};const C=(0,l.deprecate)((t=>t.getBoundary()),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167");const extractContentType=(t,r)=>{if(t===null){return null}if(typeof t==="string"){return"text/plain;charset=UTF-8"}if(isURLSearchParameters(t)){return"application/x-www-form-urlencoded;charset=UTF-8"}if(isBlob(t)){return t.type||null}if(a.Buffer.isBuffer(t)||l.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)){return null}if(t instanceof g.Ct){return`multipart/form-data; boundary=${r[h].boundary}`}if(t&&typeof t.getBoundary==="function"){return`multipart/form-data;boundary=${C(t)}`}if(t instanceof i){return null}return"text/plain;charset=UTF-8"};const getTotalBytes=t=>{const{body:r}=t[h];if(r===null){return 0}if(isBlob(r)){return r.size}if(a.Buffer.isBuffer(r)){return r.length}if(r&&typeof r.getLengthSync==="function"){return r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null}return null};const writeToStream=async(t,{body:r})=>{if(r===null){t.end()}else{await E(r,t)}};const Q=typeof s.validateHeaderName==="function"?s.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){const r=new TypeError(`Header name must be a valid HTTP token [${t}]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_HTTP_TOKEN"});throw r}};const p=typeof s.validateHeaderValue==="function"?s.validateHeaderValue:(t,r)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(r)){const r=new TypeError(`Invalid character in header content ["${t}"]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"});throw r}};class Headers extends URLSearchParams{constructor(t){let r=[];if(t instanceof Headers){const A=t.raw();for(const[t,s]of Object.entries(A)){r.push(...s.map((r=>[t,r])))}}else if(t==null){}else if(typeof t==="object"&&!l.types.isBoxedPrimitive(t)){const A=t[Symbol.iterator];if(A==null){r.push(...Object.entries(t))}else{if(typeof A!=="function"){throw new TypeError("Header pairs must be iterable")}r=[...t].map((t=>{if(typeof t!=="object"||l.types.isBoxedPrimitive(t)){throw new TypeError("Each header pair must be an iterable object")}return[...t]})).map((t=>{if(t.length!==2){throw new TypeError("Each header pair must be a name/value tuple")}return[...t]}))}}else{throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence> or record)")}r=r.length>0?r.map((([t,r])=>{Q(t);p(t,String(r));return[String(t).toLowerCase(),String(r)]})):undefined;super(r);return new Proxy(this,{get(t,r,A){switch(r){case"append":case"set":return(A,s)=>{Q(A);p(A,String(s));return URLSearchParams.prototype[r].call(t,String(A).toLowerCase(),String(s))};case"delete":case"has":case"getAll":return A=>{Q(A);return URLSearchParams.prototype[r].call(t,String(A).toLowerCase())};case"keys":return()=>{t.sort();return new Set(URLSearchParams.prototype.keys.call(t)).keys()};default:return Reflect.get(t,r,A)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){const r=this.getAll(t);if(r.length===0){return null}let A=r.join(", ");if(/^content-encoding$/i.test(t)){A=A.toLowerCase()}return A}forEach(t,r=undefined){for(const A of this.keys()){Reflect.apply(t,r,[this.get(A),A,this])}}*values(){for(const t of this.keys()){yield this.get(t)}}*entries(){for(const t of this.keys()){yield[t,this.get(t)]}}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(((t,r)=>{t[r]=this.getAll(r);return t}),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(((t,r)=>{const A=this.getAll(r);if(r==="host"){t[r]=A[0]}else{t[r]=A.length>1?A:A[0]}return t}),{})}}Object.defineProperties(Headers.prototype,["get","entries","forEach","values"].reduce(((t,r)=>{t[r]={enumerable:true};return t}),{}));function fromRawHeaders(t=[]){return new Headers(t.reduce(((t,r,A,s)=>{if(A%2===0){t.push(s.slice(A,A+2))}return t}),[]).filter((([t,r])=>{try{Q(t);p(t,String(r));return true}catch{return false}})))}const B=new Set([301,302,303,307,308]);const isRedirect=t=>B.has(t);const I=Symbol("Response internals");class Response extends Body{constructor(t=null,r={}){super(t,r);const A=r.status!=null?r.status:200;const s=new Headers(r.headers);if(t!==null&&!s.has("Content-Type")){const r=extractContentType(t,this);if(r){s.append("Content-Type",r)}}this[I]={type:"default",url:r.url,status:A,statusText:r.statusText||"",headers:s,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[I].type}get url(){return this[I].url||""}get status(){return this[I].status}get ok(){return this[I].status>=200&&this[I].status<300}get redirected(){return this[I].counter>0}get statusText(){return this[I].statusText}get headers(){return this[I].headers}get highWaterMark(){return this[I].highWaterMark}clone(){return new Response(clone(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,r=302){if(!isRedirect(r)){throw new RangeError('Failed to execute "redirect" on "response": Invalid status code')}return new Response(null,{headers:{location:new URL(t).toString()},status:r})}static error(){const t=new Response(null,{status:0,statusText:""});t[I].type="error";return t}static json(t=undefined,r={}){const A=JSON.stringify(t);if(A===undefined){throw new TypeError("data is not JSON serializable")}const s=new Headers(r&&r.headers);if(!s.has("content-type")){s.set("content-type","application/json")}return new Response(A,{...r,headers:s})}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(Response.prototype,{type:{enumerable:true},url:{enumerable:true},status:{enumerable:true},ok:{enumerable:true},redirected:{enumerable:true},statusText:{enumerable:true},headers:{enumerable:true},clone:{enumerable:true}});const m=require("node:url");const getSearch=t=>{if(t.search){return t.search}const r=t.href.length-1;const A=t.hash||(t.href[r]==="#"?"#":"");return t.href[r-A.length]==="?"?"?":""};const y=require("node:net");function stripURLForUseAsAReferrer(t,r=false){if(t==null){return"no-referrer"}t=new URL(t);if(/^(about|blob|data):$/.test(t.protocol)){return"no-referrer"}t.username="";t.password="";t.hash="";if(r){t.pathname="";t.search=""}return t}const b=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);const R="strict-origin-when-cross-origin";function validateReferrerPolicy(t){if(!b.has(t)){throw new TypeError(`Invalid referrerPolicy: ${t}`)}return t}function isOriginPotentiallyTrustworthy(t){if(/^(http|ws)s:$/.test(t.protocol)){return true}const r=t.host.replace(/(^\[)|(]$)/g,"");const A=(0,y.isIP)(r);if(A===4&&/^127\./.test(r)){return true}if(A===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(r)){return true}if(t.host==="localhost"||t.host.endsWith(".localhost")){return false}if(t.protocol==="file:"){return true}return false}function isUrlPotentiallyTrustworthy(t){if(/^about:(blank|srcdoc)$/.test(t)){return true}if(t.protocol==="data:"){return true}if(/^(blob|filesystem):$/.test(t.protocol)){return true}return isOriginPotentiallyTrustworthy(t)}function determineRequestsReferrer(t,{referrerURLCallback:r,referrerOriginCallback:A}={}){if(t.referrer==="no-referrer"||t.referrerPolicy===""){return null}const s=t.referrerPolicy;if(t.referrer==="about:client"){return"no-referrer"}const o=t.referrer;let n=stripURLForUseAsAReferrer(o);let i=stripURLForUseAsAReferrer(o,true);if(n.toString().length>4096){n=i}if(r){n=r(n)}if(A){i=A(i)}const a=new URL(t.url);switch(s){case"no-referrer":return"no-referrer";case"origin":return i;case"unsafe-url":return n;case"strict-origin":if(isUrlPotentiallyTrustworthy(n)&&!isUrlPotentiallyTrustworthy(a)){return"no-referrer"}return i.toString();case"strict-origin-when-cross-origin":if(n.origin===a.origin){return n}if(isUrlPotentiallyTrustworthy(n)&&!isUrlPotentiallyTrustworthy(a)){return"no-referrer"}return i;case"same-origin":if(n.origin===a.origin){return n}return"no-referrer";case"origin-when-cross-origin":if(n.origin===a.origin){return n}return i;case"no-referrer-when-downgrade":if(isUrlPotentiallyTrustworthy(n)&&!isUrlPotentiallyTrustworthy(a)){return"no-referrer"}return n;default:throw new TypeError(`Invalid referrerPolicy: ${s}`)}}function parseReferrerPolicyFromHeader(t){const r=(t.get("referrer-policy")||"").split(/[,\s]+/);let A="";for(const t of r){if(t&&b.has(t)){A=t}}return A}const w=Symbol("Request internals");const isRequest=t=>typeof t==="object"&&typeof t[w]==="object";const k=(0,l.deprecate)((()=>{}),".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");class Request extends Body{constructor(t,r={}){let A;if(isRequest(t)){A=new URL(t.url)}else{A=new URL(t);t={}}if(A.username!==""||A.password!==""){throw new TypeError(`${A} is an url with embedded credentials.`)}let s=r.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(s)){s=s.toUpperCase()}if(!isRequest(r)&&"data"in r){k()}if((r.body!=null||isRequest(t)&&t.body!==null)&&(s==="GET"||s==="HEAD")){throw new TypeError("Request with GET/HEAD method cannot have body")}const o=r.body?r.body:isRequest(t)&&t.body!==null?clone(t):null;super(o,{size:r.size||t.size||0});const n=new Headers(r.headers||t.headers||{});if(o!==null&&!n.has("Content-Type")){const t=extractContentType(o,this);if(t){n.set("Content-Type",t)}}let i=isRequest(t)?t.signal:null;if("signal"in r){i=r.signal}if(i!=null&&!isAbortSignal(i)){throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget")}let a=r.referrer==null?t.referrer:r.referrer;if(a===""){a="no-referrer"}else if(a){const t=new URL(a);a=/^about:(\/\/)?client$/.test(t)?"client":t}else{a=undefined}this[w]={method:s,redirect:r.redirect||t.redirect||"follow",headers:n,parsedURL:A,signal:i,referrer:a};this.follow=r.follow===undefined?t.follow===undefined?20:t.follow:r.follow;this.compress=r.compress===undefined?t.compress===undefined?true:t.compress:r.compress;this.counter=r.counter||t.counter||0;this.agent=r.agent||t.agent;this.highWaterMark=r.highWaterMark||t.highWaterMark||16384;this.insecureHTTPParser=r.insecureHTTPParser||t.insecureHTTPParser||false;this.referrerPolicy=r.referrerPolicy||t.referrerPolicy||""}get method(){return this[w].method}get url(){return(0,m.format)(this[w].parsedURL)}get headers(){return this[w].headers}get redirect(){return this[w].redirect}get signal(){return this[w].signal}get referrer(){if(this[w].referrer==="no-referrer"){return""}if(this[w].referrer==="client"){return"about:client"}if(this[w].referrer){return this[w].referrer.toString()}return undefined}get referrerPolicy(){return this[w].referrerPolicy}set referrerPolicy(t){this[w].referrerPolicy=validateReferrerPolicy(t)}clone(){return new Request(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(Request.prototype,{method:{enumerable:true},url:{enumerable:true},headers:{enumerable:true},redirect:{enumerable:true},clone:{enumerable:true},signal:{enumerable:true},referrer:{enumerable:true},referrerPolicy:{enumerable:true}});const getNodeRequestOptions=t=>{const{parsedURL:r}=t[w];const A=new Headers(t[w].headers);if(!A.has("Accept")){A.set("Accept","*/*")}let s=null;if(t.body===null&&/^(post|put)$/i.test(t.method)){s="0"}if(t.body!==null){const r=getTotalBytes(t);if(typeof r==="number"&&!Number.isNaN(r)){s=String(r)}}if(s){A.set("Content-Length",s)}if(t.referrerPolicy===""){t.referrerPolicy=R}if(t.referrer&&t.referrer!=="no-referrer"){t[w].referrer=determineRequestsReferrer(t)}else{t[w].referrer="no-referrer"}if(t[w].referrer instanceof URL){A.set("Referer",t.referrer)}if(!A.has("User-Agent")){A.set("User-Agent","node-fetch")}if(t.compress&&!A.has("Accept-Encoding")){A.set("Accept-Encoding","gzip, deflate, br")}let{agent:o}=t;if(typeof o==="function"){o=o(r)}const n=getSearch(r);const i={path:r.pathname+n,method:t.method,headers:A[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:o};return{parsedURL:r,options:i}};class AbortError extends FetchBaseError{constructor(t,r="aborted"){super(t,r)}}var S=__nccwpck_require__(2777);const D=new Set(["data:","http:","https:"]);async function fetch(t,r){return new Promise(((A,a)=>{const l=new Request(t,r);const{parsedURL:u,options:g}=getNodeRequestOptions(l);if(!D.has(u.protocol)){throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${u.protocol.replace(/:$/,"")}" is not supported.`)}if(u.protocol==="data:"){const t=c(l.url);const r=new Response(t,{headers:{"Content-Type":t.typeFull}});A(r);return}const d=(u.protocol==="https:"?o:s).request;const{signal:E}=l;let h=null;const abort=()=>{const t=new AbortError("The operation was aborted.");a(t);if(l.body&&l.body instanceof i.Readable){l.body.destroy(t)}if(!h||!h.body){return}h.body.emit("error",t)};if(E&&E.aborted){abort();return}const abortAndFinalize=()=>{abort();finalize()};const C=d(u.toString(),g);if(E){E.addEventListener("abort",abortAndFinalize)}const finalize=()=>{C.abort();if(E){E.removeEventListener("abort",abortAndFinalize)}};C.on("error",(t=>{a(new FetchError(`request to ${l.url} failed, reason: ${t.message}`,"system",t));finalize()}));fixResponseChunkedTransferBadEnding(C,(t=>{if(h&&h.body){h.body.destroy(t)}}));if(process.version<"v14"){C.on("socket",(t=>{let r;t.prependListener("end",(()=>{r=t._eventsCount}));t.prependListener("close",(A=>{if(h&&r{C.setTimeout(0);const s=fromRawHeaders(t.rawHeaders);if(isRedirect(t.statusCode)){const o=s.get("Location");let n=null;try{n=o===null?null:new URL(o,l.url)}catch{if(l.redirect!=="manual"){a(new FetchError(`uri requested responds with an invalid redirect URL: ${o}`,"invalid-redirect"));finalize();return}}switch(l.redirect){case"error":a(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${l.url}`,"no-redirect"));finalize();return;case"manual":break;case"follow":{if(n===null){break}if(l.counter>=l.follow){a(new FetchError(`maximum redirect reached at: ${l.url}`,"max-redirect"));finalize();return}const o={headers:new Headers(l.headers),follow:l.follow,counter:l.counter+1,agent:l.agent,compress:l.compress,method:l.method,body:clone(l),signal:l.signal,size:l.size,referrer:l.referrer,referrerPolicy:l.referrerPolicy};if(!isDomainOrSubdomain(l.url,n)||!isSameProtocol(l.url,n)){for(const t of["authorization","www-authenticate","cookie","cookie2"]){o.headers.delete(t)}}if(t.statusCode!==303&&l.body&&r.body instanceof i.Readable){a(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect"));finalize();return}if(t.statusCode===303||(t.statusCode===301||t.statusCode===302)&&l.method==="POST"){o.method="GET";o.body=undefined;o.headers.delete("content-length")}const c=parseReferrerPolicyFromHeader(s);if(c){o.referrerPolicy=c}A(fetch(new Request(n,o)));finalize();return}default:return a(new TypeError(`Redirect option '${l.redirect}' is not a valid value of RequestRedirect`))}}if(E){t.once("end",(()=>{E.removeEventListener("abort",abortAndFinalize)}))}let o=(0,i.pipeline)(t,new i.PassThrough,(t=>{if(t){a(t)}}));if(process.version<"v12.10"){t.on("aborted",abortAndFinalize)}const c={url:l.url,status:t.statusCode,statusText:t.statusMessage,headers:s,size:l.size,counter:l.counter,highWaterMark:l.highWaterMark};const u=s.get("Content-Encoding");if(!l.compress||l.method==="HEAD"||u===null||t.statusCode===204||t.statusCode===304){h=new Response(o,c);A(h);return}const g={flush:n.Z_SYNC_FLUSH,finishFlush:n.Z_SYNC_FLUSH};if(u==="gzip"||u==="x-gzip"){o=(0,i.pipeline)(o,n.createGunzip(g),(t=>{if(t){a(t)}}));h=new Response(o,c);A(h);return}if(u==="deflate"||u==="x-deflate"){const r=(0,i.pipeline)(t,new i.PassThrough,(t=>{if(t){a(t)}}));r.once("data",(t=>{if((t[0]&15)===8){o=(0,i.pipeline)(o,n.createInflate(),(t=>{if(t){a(t)}}))}else{o=(0,i.pipeline)(o,n.createInflateRaw(),(t=>{if(t){a(t)}}))}h=new Response(o,c);A(h)}));r.once("end",(()=>{if(!h){h=new Response(o,c);A(h)}}));return}if(u==="br"){o=(0,i.pipeline)(o,n.createBrotliDecompress(),(t=>{if(t){a(t)}}));h=new Response(o,c);A(h);return}h=new Response(o,c);A(h)}));writeToStream(C,l).catch(a)}))}function fixResponseChunkedTransferBadEnding(t,r){const A=a.Buffer.from("0\r\n\r\n");let s=false;let o=false;let n;t.on("response",(t=>{const{headers:r}=t;s=r["transfer-encoding"]==="chunked"&&!r["content-length"]}));t.on("socket",(i=>{const onSocketClose=()=>{if(s&&!o){const t=new Error("Premature close");t.code="ERR_STREAM_PREMATURE_CLOSE";r(t)}};const onData=t=>{o=a.Buffer.compare(t.slice(-5),A)===0;if(!o&&n){o=a.Buffer.compare(n.slice(-3),A.slice(0,3))===0&&a.Buffer.compare(t.slice(-2),A.slice(3))===0}n=t};i.prependListener("close",onSocketClose);i.on("data",onData);t.on("close",(()=>{i.removeListener("close",onSocketClose);i.removeListener("data",onData)}))}))}const T=require("stream/promises");var F=__nccwpck_require__(4751);var v=__nccwpck_require__(8237);const N=require("child_process");var U=__nccwpck_require__(9819);var _=Object.defineProperty;var L=Object.defineProperties;var G=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertyNames;var O=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty;var Y=Object.prototype.propertyIsEnumerable;var __defNormalProp=(t,r,A)=>r in t?_(t,r,{enumerable:true,configurable:true,writable:true,value:A}):t[r]=A;var __spreadValues=(t,r)=>{for(var A in r||(r={}))if(H.call(r,A))__defNormalProp(t,A,r[A]);if(O)for(var A of O(r)){if(Y.call(r,A))__defNormalProp(t,A,r[A])}return t};var __spreadProps=(t,r)=>L(t,M(r));var __markAsModule=t=>_(t,"__esModule",{value:true});var __esm=(t,r)=>function __init(){return t&&(r=(0,t[P(t)[0]])(t=0)),r};var __commonJS=(t,r)=>function __require(){return r||(0,t[P(t)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(t,r)=>{for(var A in r)_(t,A,{get:r[A],enumerable:true})};var __reExport=(t,r,A,s)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let o of P(r))if(!H.call(t,o)&&(A||o!=="default"))_(t,o,{get:()=>r[o],enumerable:!(s=G(r,o))||s.enumerable})}return t};var W=(t=>(r,A)=>t&&t.get(r)||(A=__reExport(__markAsModule({}),r,1),t&&t.set(r,A),A))(typeof WeakMap!=="undefined"?new WeakMap:0);var __async=(t,r,A)=>new Promise(((s,o)=>{var fulfilled=t=>{try{step(A.next(t))}catch(t){o(t)}};var rejected=t=>{try{step(A.throw(t))}catch(t){o(t)}};var step=t=>t.done?s(t.value):Promise.resolve(t.value).then(fulfilled,rejected);step((A=A.apply(t,r)).next())}));function pathspec(...t){const r=new String(t);J.set(r,t);return r}function isPathSpec(t){return t instanceof String&&J.has(t)}function toPaths(t){return J.get(t)||[]}var J;var q=__esm({"src/lib/args/pathspec.ts"(){J=new WeakMap}});var V;var j=__esm({"src/lib/errors/git-error.ts"(){V=class extends Error{constructor(t,r){super(r);this.task=t;Object.setPrototypeOf(this,new.target.prototype)}}}});var z;var Z=__esm({"src/lib/errors/git-response-error.ts"(){j();z=class extends V{constructor(t,r){super(void 0,r||String(t));this.git=t}}}});var X;var K=__esm({"src/lib/errors/task-configuration-error.ts"(){j();X=class extends V{constructor(t){super(void 0,t)}}}});function asFunction(t){return typeof t==="function"?t:ee}function isUserFunction(t){return typeof t==="function"&&t!==ee}function splitOn(t,r){const A=t.indexOf(r);if(A<=0){return[t,""]}return[t.substr(0,A),t.substr(A+1)]}function first(t,r=0){return isArrayLike(t)&&t.length>r?t[r]:void 0}function last(t,r=0){if(isArrayLike(t)&&t.length>r){return t[t.length-1-r]}}function isArrayLike(t){return!!(t&&typeof t.length==="number")}function toLinesWithContent(t="",r=true,A="\n"){return t.split(A).reduce(((t,A)=>{const s=r?A.trim():A;if(s){t.push(s)}return t}),[])}function forEachLineWithContent(t,r){return toLinesWithContent(t,true).map((t=>r(t)))}function folderExists(t){return(0,F.exists)(t,F.FOLDER)}function append(t,r){if(Array.isArray(t)){if(!t.includes(r)){t.push(r)}}else{t.add(r)}return r}function including(t,r){if(Array.isArray(t)&&!t.includes(r)){t.push(r)}return t}function remove(t,r){if(Array.isArray(t)){const A=t.indexOf(r);if(A>=0){t.splice(A,1)}}else{t.delete(r)}return r}function asArray(t){return Array.isArray(t)?t:[t]}function asStringArray(t){return asArray(t).map(String)}function asNumber(t,r=0){if(t==null){return r}const A=parseInt(t,10);return isNaN(A)?r:A}function prefixedArray(t,r){const A=[];for(let s=0,o=t.length;sr in t?{[r]:t[r]}:{})))}function delay(t=0){return new Promise((r=>setTimeout(r,t)))}function orVoid(t){if(t===false){return void 0}return t}var $,ee,te;var re=__esm({"src/lib/utils/util.ts"(){$="\0";ee=()=>{};te=Object.prototype.toString.call.bind(Object.prototype.toString)}});function filterType(t,r,A){if(r(t)){return t}return arguments.length>2?A:void 0}function filterPrimitives(t,r){const A=isPathSpec(t)?"string":typeof t;return/number|string|boolean/.test(A)&&(!r||!r.includes(A))}function filterPlainObject(t){return!!t&&te(t)==="[object Object]"}function filterFunction(t){return typeof t==="function"}var Ae,se,oe,ne,ie;var ae=__esm({"src/lib/utils/argument-filters.ts"(){re();q();Ae=t=>Array.isArray(t);se=t=>typeof t==="string";oe=t=>Array.isArray(t)&&t.every(se);ne=t=>se(t)||Array.isArray(t)&&t.every(se);ie=t=>{if(t==null||"number|boolean|function".includes(typeof t)){return false}return Array.isArray(t)||typeof t==="string"||typeof t.length==="number"}}});var ce;var le=__esm({"src/lib/utils/exit-codes.ts"(){ce=(t=>{t[t["SUCCESS"]=0]="SUCCESS";t[t["ERROR"]=1]="ERROR";t[t["NOT_FOUND"]=-2]="NOT_FOUND";t[t["UNCLEAN"]=128]="UNCLEAN";return t})(ce||{})}});var ue;var ge=__esm({"src/lib/utils/git-output-streams.ts"(){ue=class{constructor(t,r){this.stdOut=t;this.stdErr=r}asStrings(){return new ue(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});var de,Ee;var he=__esm({"src/lib/utils/line-parser.ts"(){de=class{constructor(t,r){this.matches=[];this.parse=(t,r)=>{this.resetMatches();if(!this._regExp.every(((r,A)=>this.addMatch(r,A,t(A))))){return false}return this.useMatches(r,this.prepareMatches())!==false};this._regExp=Array.isArray(t)?t:[t];if(r){this.useMatches=r}}useMatches(t,r){throw new Error(`LineParser:useMatches not implemented`)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,r,A){const s=A&&t.exec(A);if(s){this.pushMatch(r,s)}return!!s}pushMatch(t,r){this.matches.push(...r.slice(1))}};Ee=class extends de{addMatch(t,r,A){return/^remote:\s/.test(String(A))&&super.addMatch(t,r,A)}pushMatch(t,r){if(t>0||r.length>1){super.pushMatch(t,r)}}}}});function createInstanceConfig(...t){const r=process.cwd();const A=Object.assign(__spreadValues({baseDir:r},Ce),...t.filter((t=>typeof t==="object"&&t)));A.baseDir=A.baseDir||r;A.trimmed=A.trimmed===true;return A}var Ce;var fe=__esm({"src/lib/utils/simple-git-options.ts"(){Ce={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:false}}});function appendTaskOptions(t,r=[]){if(!filterPlainObject(t)){return r}return Object.keys(t).reduce(((r,A)=>{const s=t[A];if(isPathSpec(s)){r.push(s)}else if(filterPrimitives(s,["boolean"])){r.push(A+"="+s)}else{r.push(A)}return r}),r)}function getTrailingOptions(t,r=0,A=false){const s=[];for(let A=0,o=r<0?t.length:r;A{for(let o=toLinesWithContent(A,s),n=0,i=o.length;n{if(n+t>=i){return}return o[n+t]};r.some((({parse:r})=>r(line,t)))}}));return t}var pe=__esm({"src/lib/utils/task-parser.ts"(){re()}});var Be={};__export(Be,{ExitCodes:()=>ce,GitOutputStreams:()=>ue,LineParser:()=>de,NOOP:()=>ee,NULL:()=>$,RemoteLineParser:()=>Ee,append:()=>append,appendTaskOptions:()=>appendTaskOptions,asArray:()=>asArray,asFunction:()=>asFunction,asNumber:()=>asNumber,asStringArray:()=>asStringArray,bufferToString:()=>bufferToString,callTaskParser:()=>callTaskParser,createInstanceConfig:()=>createInstanceConfig,delay:()=>delay,filterArray:()=>Ae,filterFunction:()=>filterFunction,filterHasLength:()=>ie,filterPlainObject:()=>filterPlainObject,filterPrimitives:()=>filterPrimitives,filterString:()=>se,filterStringArray:()=>oe,filterStringOrStringArray:()=>ne,filterType:()=>filterType,first:()=>first,folderExists:()=>folderExists,forEachLineWithContent:()=>forEachLineWithContent,getTrailingOptions:()=>getTrailingOptions,including:()=>including,isUserFunction:()=>isUserFunction,last:()=>last,objectToString:()=>te,orVoid:()=>orVoid,parseStringResponse:()=>parseStringResponse,pick:()=>pick,prefixedArray:()=>prefixedArray,remove:()=>remove,splitOn:()=>splitOn,toLinesWithContent:()=>toLinesWithContent,trailingFunctionArgument:()=>trailingFunctionArgument,trailingOptionsArgument:()=>trailingOptionsArgument});var Ie=__esm({"src/lib/utils/index.ts"(){ae();le();ge();he();fe();Qe();pe();re()}});var me={};__export(me,{CheckRepoActions:()=>ye,checkIsBareRepoTask:()=>checkIsBareRepoTask,checkIsRepoRootTask:()=>checkIsRepoRootTask,checkIsRepoTask:()=>checkIsRepoTask});function checkIsRepoTask(t){switch(t){case"bare":return checkIsBareRepoTask();case"root":return checkIsRepoRootTask()}const r=["rev-parse","--is-inside-work-tree"];return{commands:r,format:"utf-8",onError:be,parser:Re}}function checkIsRepoRootTask(){const t=["rev-parse","--git-dir"];return{commands:t,format:"utf-8",onError:be,parser(t){return/^\.(git)?$/.test(t.trim())}}}function checkIsBareRepoTask(){const t=["rev-parse","--is-bare-repository"];return{commands:t,format:"utf-8",onError:be,parser:Re}}function isNotRepoMessage(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var ye,be,Re;var we=__esm({"src/lib/tasks/check-is-repo.ts"(){Ie();ye=(t=>{t["BARE"]="bare";t["IN_TREE"]="tree";t["IS_REPO_ROOT"]="root";return t})(ye||{});be=({exitCode:t},r,A,s)=>{if(t===128&&isNotRepoMessage(r)){return A(Buffer.from("false"))}s(r)};Re=t=>t.trim()==="true"}});function cleanSummaryParser(t,r){const A=new ke(t);const s=t?De:Se;toLinesWithContent(r).forEach((t=>{const r=t.replace(s,"");A.paths.push(r);(Te.test(r)?A.folders:A.files).push(r)}));return A}var ke,Se,De,Te;var Fe=__esm({"src/lib/responses/CleanSummary.ts"(){Ie();ke=class{constructor(t){this.dryRun=t;this.paths=[];this.files=[];this.folders=[]}};Se=/^[a-z]+\s*/i;De=/^[a-z]+\s+[a-z]+\s*/i;Te=/\/$/}});var ve={};__export(ve,{EMPTY_COMMANDS:()=>Ne,adhocExecTask:()=>adhocExecTask,configurationErrorTask:()=>configurationErrorTask,isBufferTask:()=>isBufferTask,isEmptyTask:()=>isEmptyTask,straightThroughBufferTask:()=>straightThroughBufferTask,straightThroughStringTask:()=>straightThroughStringTask});function adhocExecTask(t){return{commands:Ne,format:"empty",parser:t}}function configurationErrorTask(t){return{commands:Ne,format:"empty",parser(){throw typeof t==="string"?new X(t):t}}}function straightThroughStringTask(t,r=false){return{commands:t,format:"utf-8",parser(t){return r?String(t).trim():t}}}function straightThroughBufferTask(t){return{commands:t,format:"buffer",parser(t){return t}}}function isBufferTask(t){return t.format==="buffer"}function isEmptyTask(t){return t.format==="empty"||!t.commands.length}var Ne;var Ue=__esm({"src/lib/tasks/task.ts"(){K();Ne=[]}});var _e={};__export(_e,{CONFIG_ERROR_INTERACTIVE_MODE:()=>Le,CONFIG_ERROR_MODE_REQUIRED:()=>Ge,CONFIG_ERROR_UNKNOWN_OPTION:()=>Me,CleanOptions:()=>Pe,cleanTask:()=>cleanTask,cleanWithOptionsTask:()=>cleanWithOptionsTask,isCleanOptionsArray:()=>isCleanOptionsArray});function cleanWithOptionsTask(t,r){const{cleanMode:A,options:s,valid:o}=getCleanOptions(t);if(!A){return configurationErrorTask(Ge)}if(!o.options){return configurationErrorTask(Me+JSON.stringify(t))}s.push(...r);if(s.some(isInteractiveMode)){return configurationErrorTask(Le)}return cleanTask(A,s)}function cleanTask(t,r){const A=["clean",`-${t}`,...r];return{commands:A,format:"utf-8",parser(r){return cleanSummaryParser(t==="n",r)}}}function isCleanOptionsArray(t){return Array.isArray(t)&&t.every((t=>Oe.has(t)))}function getCleanOptions(t){let r;let A=[];let s={cleanMode:false,options:true};t.replace(/[^a-z]i/g,"").split("").forEach((t=>{if(isCleanMode(t)){r=t;s.cleanMode=true}else{s.options=s.options&&isKnownOption(A[A.length]=`-${t}`)}}));return{cleanMode:r,options:A,valid:s}}function isCleanMode(t){return t==="f"||t==="n"}function isKnownOption(t){return/^-[a-z]$/i.test(t)&&Oe.has(t.charAt(1))}function isInteractiveMode(t){if(/^-[^\-]/.test(t)){return t.indexOf("i")>0}return t==="--interactive"}var Le,Ge,Me,Pe,Oe;var He=__esm({"src/lib/tasks/clean.ts"(){Fe();Ie();Ue();Le="Git clean interactive mode is not supported";Ge='Git clean mode parameter ("n" or "f") is required';Me="Git clean unknown option found in: ";Pe=(t=>{t["DRY_RUN"]="n";t["FORCE"]="f";t["IGNORED_INCLUDED"]="x";t["IGNORED_ONLY"]="X";t["EXCLUDING"]="e";t["QUIET"]="q";t["RECURSIVE"]="d";return t})(Pe||{});Oe=new Set(["i",...asStringArray(Object.values(Pe))])}});function configListParser(t){const r=new Ye;for(const A of configParser(t)){r.addValue(A.file,String(A.key),A.value)}return r}function configGetParser(t,r){let A=null;const s=[];const o=new Map;for(const n of configParser(t,r)){if(n.key!==r){continue}s.push(A=n.value);if(!o.has(n.file)){o.set(n.file,[])}o.get(n.file).push(A)}return{key:r,paths:Array.from(o.keys()),scopes:o,value:A,values:s}}function configFilePath(t){return t.replace(/^(file):/,"")}function*configParser(t,r=null){const A=t.split("\0");for(let t=0,s=A.length-1;tObject.assign(t,this.values[r])),{})}return this._all}addFile(t){if(!(t in this.values)){const r=last(this.files);this.values[t]=r?Object.create(this.values[r]):{};this.files.push(t)}return this.values[t]}addValue(t,r,A){const s=this.addFile(t);if(!s.hasOwnProperty(r)){s[r]=A}else if(Array.isArray(s[r])){s[r].push(A)}else{s[r]=[s[r],A]}this._all=void 0}}}});function asConfigScope(t,r){if(typeof t==="string"&&Je.hasOwnProperty(t)){return t}return r}function addConfigTask(t,r,A,s){const o=["config",`--${s}`];if(A){o.push("--add")}o.push(t,r);return{commands:o,format:"utf-8",parser(t){return t}}}function getConfigTask(t,r){const A=["config","--null","--show-origin","--get-all",t];if(r){A.splice(1,0,`--${r}`)}return{commands:A,format:"utf-8",parser(r){return configGetParser(r,t)}}}function listConfigTask(t){const r=["config","--list","--show-origin","--null"];if(t){r.push(`--${t}`)}return{commands:r,format:"utf-8",parser(t){return configListParser(t)}}}function config_default(){return{addConfig(t,r,...A){return this._runTask(addConfigTask(t,r,A[0]===true,asConfigScope(A[1],"local")),trailingFunctionArgument(arguments))},getConfig(t,r){return this._runTask(getConfigTask(t,asConfigScope(r,void 0)),trailingFunctionArgument(arguments))},listConfig(...t){return this._runTask(listConfigTask(asConfigScope(t[0],void 0)),trailingFunctionArgument(arguments))}}}var Je;var xe=__esm({"src/lib/tasks/config.ts"(){We();Ie();Je=(t=>{t["system"]="system";t["global"]="global";t["local"]="local";t["worktree"]="worktree";return t})(Je||{})}});function isDiffNameStatus(t){return Ve.has(t)}var qe,Ve;var je=__esm({"src/lib/tasks/diff-name-status.ts"(){qe=(t=>{t["ADDED"]="A";t["COPIED"]="C";t["DELETED"]="D";t["MODIFIED"]="M";t["RENAMED"]="R";t["CHANGED"]="T";t["UNMERGED"]="U";t["UNKNOWN"]="X";t["BROKEN"]="B";return t})(qe||{});Ve=new Set(Object.values(qe))}});function grepQueryBuilder(...t){return(new Ke).param(...t)}function parseGrep(t){const r=new Set;const A={};forEachLineWithContent(t,(t=>{const[s,o,n]=t.split($);r.add(s);(A[s]=A[s]||[]).push({line:asNumber(o),path:s,preview:n})}));return{paths:r,results:A}}function grep_default(){return{grep(t){const r=trailingFunctionArgument(arguments);const A=getTrailingOptions(arguments);for(const t of ze){if(A.includes(t)){return this._runTask(configurationErrorTask(`git.grep: use of "${t}" is not supported.`),r)}}if(typeof t==="string"){t=grepQueryBuilder().param(t)}const s=["grep","--null","-n","--full-name",...A,...t];return this._runTask({commands:s,format:"utf-8",parser(t){return parseGrep(t)}},r)}}}var ze,Ze,Xe,Ke;var $e=__esm({"src/lib/tasks/grep.ts"(){Ie();Ue();ze=["-h"];Ze=Symbol("grepQuery");Ke=class{constructor(){this[Xe]=[]}*[(Xe=Ze,Symbol.iterator)](){for(const t of this[Ze]){yield t}}and(...t){t.length&&this[Ze].push("--and","(",...prefixedArray(t,"-e"),")");return this}param(...t){this[Ze].push(...prefixedArray(t,"-e"));return this}}}});var et={};__export(et,{ResetMode:()=>tt,getResetMode:()=>getResetMode,resetTask:()=>resetTask});function resetTask(t,r){const A=["reset"];if(isValidResetMode(t)){A.push(`--${t}`)}A.push(...r);return straightThroughStringTask(A)}function getResetMode(t){if(isValidResetMode(t)){return t}switch(typeof t){case"string":case"undefined":return"soft"}return}function isValidResetMode(t){return rt.includes(t)}var tt,rt;var At=__esm({"src/lib/tasks/reset.ts"(){Ue();tt=(t=>{t["MIXED"]="mixed";t["SOFT"]="soft";t["HARD"]="hard";t["MERGE"]="merge";t["KEEP"]="keep";return t})(tt||{});rt=Array.from(Object.values(tt))}});function createLog(){return v("simple-git")}function prefixedLogger(t,r,A){if(!r||!String(r).replace(/\s*/,"")){return!A?t:(r,...s)=>{t(r,...s);A(r,...s)}}return(s,...o)=>{t(`%s ${s}`,r,...o);if(A){A(s,...o)}}}function childLoggerName(t,r,{namespace:A}){if(typeof t==="string"){return t}const s=r&&r.namespace||"";if(s.startsWith(A)){return s.substr(A.length+1)}return s||A}function createLogger(t,r,A,s=createLog()){const o=t&&`[${t}]`||"";const n=[];const i=typeof r==="string"?s.extend(r):r;const a=childLoggerName(filterType(r,se),i,s);return step(A);function sibling(r,A){return append(n,createLogger(t,a.replace(/^[^:]+/,r),A,s))}function step(r){const A=r&&`[${r}]`||"";const n=i&&prefixedLogger(i,A)||ee;const a=prefixedLogger(s,`${o} ${A}`,n);return Object.assign(i?n:a,{label:t,sibling:sibling,info:a,step:step})}}var st=__esm({"src/lib/git-logger.ts"(){Ie();v.formatters.L=t=>String(ie(t)?t.length:"-");v.formatters.B=t=>{if(Buffer.isBuffer(t)){return t.toString("utf8")}return te(t)}}});var ot,nt;var it=__esm({"src/lib/runners/tasks-pending-queue.ts"(){j();st();ot=class{constructor(t="GitExecutor"){this.logLabel=t;this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){const r=ot.getName(t.commands[0]);const A=createLogger(this.logLabel,r);return{task:t,logger:A,name:r}}push(t){const r=this.createProgress(t);r.logger("Adding task to the queue, commands = %o",t.commands);this._queue.set(t,r);return r}fatal(t){for(const[r,{logger:A}]of Array.from(this._queue.entries())){if(r===t.task){A.info(`Failed %o`,t);A(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)}else{A.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,t.message)}this.complete(r)}if(this._queue.size!==0){throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}}complete(t){const r=this.withProgress(t);if(r){this._queue.delete(t)}}attempt(t){const r=this.withProgress(t);if(!r){throw new V(void 0,"TasksPendingQueue: attempt called for an unknown task")}r.logger("Starting task");return r}static getName(t="empty"){return`task:${t}:${++ot.counter}`}};nt=ot;nt.counter=0}});function pluginContext(t,r){return{method:first(t.commands)||"",commands:r}}function onErrorReceived(t,r){return A=>{r(`[ERROR] child process exception %o`,A);t.push(Buffer.from(String(A.stack),"ascii"))}}function onDataReceived(t,r,A,s){return o=>{A(`%s received %L bytes`,r,o);s(`%B`,o);t.push(o)}}var at;var ct=__esm({"src/lib/runners/git-executor-chain.ts"(){j();Ue();Ie();it();at=class{constructor(t,r,A){this._executor=t;this._scheduler=r;this._plugins=A;this._chain=Promise.resolve();this._queue=new nt}get binary(){return this._executor.binary}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){this._queue.push(t);return this._chain=this._chain.then((()=>this.attemptTask(t)))}attemptTask(t){return __async(this,null,(function*(){const r=yield this._scheduler.next();const onQueueComplete=()=>this._queue.complete(t);try{const{logger:r}=this._queue.attempt(t);return yield isEmptyTask(t)?this.attemptEmptyTask(t,r):this.attemptRemoteTask(t,r)}catch(r){throw this.onFatalException(t,r)}finally{onQueueComplete();r()}}))}onFatalException(t,r){const A=r instanceof V?Object.assign(r,{task:t}):new V(t,r&&String(r));this._chain=Promise.resolve();this._queue.fatal(A);return A}attemptRemoteTask(t,r){return __async(this,null,(function*(){const A=this._plugins.exec("spawn.args",[...t.commands],pluginContext(t,t.commands));const s=yield this.gitResponse(t,this.binary,A,this.outputHandler,r.step("SPAWN"));const o=yield this.handleTaskData(t,A,s,r.step("HANDLE"));r(`passing response to task's parser as a %s`,t.format);if(isBufferTask(t)){return callTaskParser(t.parser,o)}return callTaskParser(t.parser,o.asStrings())}))}attemptEmptyTask(t,r){return __async(this,null,(function*(){r(`empty task bypassing child process to call to task's parser`);return t.parser(this)}))}handleTaskData(t,r,A,s){const{exitCode:o,rejection:n,stdOut:i,stdErr:a}=A;return new Promise(((c,l)=>{s(`Preparing to handle process response exitCode=%d stdOut=`,o);const{error:u}=this._plugins.exec("task.error",{error:n},__spreadValues(__spreadValues({},pluginContext(t,r)),A));if(u&&t.onError){s.info(`exitCode=%s handling with custom error handler`);return t.onError(A,u,(t=>{s.info(`custom error handler treated as success`);s(`custom error returned a %s`,te(t));c(new ue(Array.isArray(t)?Buffer.concat(t):t,Buffer.concat(a)))}),l)}if(u){s.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,o,a.length,n);return l(u)}s.info(`retrieving task output complete`);c(new ue(Buffer.concat(i),Buffer.concat(a)))}))}gitResponse(t,r,A,s,o){return __async(this,null,(function*(){const n=o.sibling("output");const i=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:true},pluginContext(t,t.commands));return new Promise((a=>{const c=[];const l=[];o.info(`%s %o`,r,A);o("%O",i);let u=this._beforeSpawn(t,A);if(u){return a({stdOut:c,stdErr:l,exitCode:9901,rejection:u})}this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(t,A)),{kill(t){u=t||u}}));const g=(0,N.spawn)(r,A,i);g.stdout.on("data",onDataReceived(c,"stdOut",o,n.step("stdOut")));g.stderr.on("data",onDataReceived(l,"stdErr",o,n.step("stdErr")));g.on("error",onErrorReceived(l,o));if(s){o(`Passing child process stdOut/stdErr to custom outputHandler`);s(r,g.stdout,g.stderr,[...A])}this._plugins.exec("spawn.after",void 0,__spreadProps(__spreadValues({},pluginContext(t,A)),{spawned:g,close(t,r){a({stdOut:c,stdErr:l,exitCode:t,rejection:u||r})},kill(t){if(g.killed){return}u=t;g.kill("SIGINT")}}))}))}))}_beforeSpawn(t,r){let A;this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(t,r)),{kill(t){A=t||A}}));return A}}}});var lt={};__export(lt,{GitExecutor:()=>ut});var ut;var gt=__esm({"src/lib/runners/git-executor.ts"(){ct();ut=class{constructor(t="git",r,A,s){this.binary=t;this.cwd=r;this._scheduler=A;this._plugins=s;this._chain=new at(this,this._scheduler,this._plugins)}chain(){return new at(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function taskCallback(t,r,A=ee){const onSuccess=t=>{A(null,t)};const onError2=r=>{if((r==null?void 0:r.task)===t){A(r instanceof z?addDeprecationNoticeToError(r):r,void 0)}};r.then(onSuccess,onError2)}function addDeprecationNoticeToError(t){let log=t=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${t} should be GitResponseError.git.${t}, this will no longer be available in version 3`);log=ee};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(descriptorReducer,{}));function descriptorReducer(r,A){if(A in t){return r}r[A]={enumerable:false,configurable:false,get(){log(A);return t.git[A]}};return r}}var dt=__esm({"src/lib/task-callback.ts"(){Z();Ie()}});function changeWorkingDirectoryTask(t,r){return adhocExecTask((A=>{if(!folderExists(t)){throw new Error(`Git.cwd: cannot change to non-directory "${t}"`)}return(r||A).cwd=t}))}var Et=__esm({"src/lib/tasks/change-working-directory.ts"(){Ie();Ue()}});function checkoutTask(t){const r=["checkout",...t];if(r[1]==="-b"&&r.includes("-B")){r[1]=remove(r,"-B")}return straightThroughStringTask(r)}function checkout_default(){return{checkout(){return this._runTask(checkoutTask(getTrailingOptions(arguments,1)),trailingFunctionArgument(arguments))},checkoutBranch(t,r){return this._runTask(checkoutTask(["-b",t,r,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))},checkoutLocalBranch(t){return this._runTask(checkoutTask(["-b",t,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}}}var ht=__esm({"src/lib/tasks/checkout.ts"(){Ie();Ue()}});function parseCommitResult(t){const r={author:null,branch:"",commit:"",root:false,summary:{changes:0,insertions:0,deletions:0}};return parseStringResponse(r,Ct,t)}var Ct;var ft=__esm({"src/lib/parsers/parse-commit.ts"(){Ie();Ct=[new de(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,((t,[r,A,s])=>{t.branch=r;t.commit=s;t.root=!!A})),new de(/\s*Author:\s(.+)/i,((t,[r])=>{const A=r.split("<");const s=A.pop();if(!s||!s.includes("@")){return}t.author={email:s.substr(0,s.length-1),name:A.join("<").trim()}})),new de(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,((t,[r,A,s])=>{t.summary.changes=parseInt(r,10)||0;t.summary.insertions=parseInt(A,10)||0;t.summary.deletions=parseInt(s,10)||0})),new de(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,((t,[r,A,s])=>{t.summary.changes=parseInt(r,10)||0;const o=parseInt(A,10)||0;if(s==="-"){t.summary.deletions=o}else if(s==="+"){t.summary.insertions=o}}))]}});function commitTask(t,r,A){const s=["-c","core.abbrev=40","commit",...prefixedArray(t,"-m"),...r,...A];return{commands:s,format:"utf-8",parser:parseCommitResult}}function commit_default(){return{commit(t,...r){const A=trailingFunctionArgument(arguments);const s=rejectDeprecatedSignatures(t)||commitTask(asArray(t),asArray(filterType(r[0],ne,[])),[...filterType(r[1],Ae,[]),...getTrailingOptions(arguments,0,true)]);return this._runTask(s,A)}};function rejectDeprecatedSignatures(t){return!ne(t)&&configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Qt=__esm({"src/lib/tasks/commit.ts"(){ft();Ie();Ue()}});function first_commit_default(){return{firstCommit(){return this._runTask(straightThroughStringTask(["rev-list","--max-parents=0","HEAD"],true),trailingFunctionArgument(arguments))}}}var pt=__esm({"src/lib/tasks/first-commit.ts"(){Ie();Ue()}});function hashObjectTask(t,r){const A=["hash-object",t];if(r){A.push("-w")}return straightThroughStringTask(A,true)}var Bt=__esm({"src/lib/tasks/hash-object.ts"(){Ue()}});function parseInit(t,r,A){const s=String(A).trim();let o;if(o=mt.exec(s)){return new It(t,r,false,o[1])}if(o=yt.exec(s)){return new It(t,r,true,o[1])}let n="";const i=s.split(" ");while(i.length){const t=i.shift();if(t==="in"){n=i.join(" ");break}}return new It(t,r,/^re/i.test(s),n)}var It,mt,yt;var bt=__esm({"src/lib/responses/InitSummary.ts"(){It=class{constructor(t,r,A,s){this.bare=t;this.path=r;this.existing=A;this.gitDir=s}};mt=/^Init.+ repository in (.+)$/;yt=/^Rein.+ in (.+)$/}});function hasBareCommand(t){return t.includes(Rt)}function initTask(t=false,r,A){const s=["init",...A];if(t&&!hasBareCommand(s)){s.splice(1,0,Rt)}return{commands:s,format:"utf-8",parser(t){return parseInit(s.includes("--bare"),r,t)}}}var Rt;var wt=__esm({"src/lib/tasks/init.ts"(){bt();Rt="--bare"}});function logFormatFromCommand(t){for(let r=0;rparseStringResponse(new Dt,r,t,false)}var Ft,vt,Nt,Ut,_t;var Lt=__esm({"src/lib/parsers/parse-diff-summary.ts"(){St();Tt();je();Ie();Ft=[new de(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,((t,[r,A,s=""])=>{t.files.push({file:r.trim(),changes:asNumber(A),insertions:s.replace(/[^+]/g,"").length,deletions:s.replace(/[^-]/g,"").length,binary:false})})),new de(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,((t,[r,A,s])=>{t.files.push({file:r.trim(),before:asNumber(A),after:asNumber(s),binary:true})})),new de(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,((t,[r,A])=>{const s=/(\d+) i/.exec(A);const o=/(\d+) d/.exec(A);t.changed=asNumber(r);t.insertions=asNumber(s==null?void 0:s[1]);t.deletions=asNumber(o==null?void 0:o[1])}))];vt=[new de(/(\d+)\t(\d+)\t(.+)$/,((t,[r,A,s])=>{const o=asNumber(r);const n=asNumber(A);t.changed++;t.insertions+=o;t.deletions+=n;t.files.push({file:s,changes:o+n,insertions:o,deletions:n,binary:false})})),new de(/-\t-\t(.+)$/,((t,[r])=>{t.changed++;t.files.push({file:r,after:0,before:0,binary:true})}))];Nt=[new de(/(.+)$/,((t,[r])=>{t.changed++;t.files.push({file:r,changes:0,insertions:0,deletions:0,binary:false})}))];Ut=[new de(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,((t,[r,A,s,o,n])=>{t.changed++;t.files.push({file:n!=null?n:s,changes:0,status:orVoid(isDiffNameStatus(r)&&r),insertions:0,deletions:0,binary:false})}))];_t={[""]:Ft,["--stat"]:Ft,["--numstat"]:vt,["--name-status"]:Ut,["--name-only"]:Nt}}});function lineBuilder(t,r){return r.reduce(((r,A,s)=>{r[A]=t[s]||"";return r}),Object.create({diff:null}))}function createListLogSummaryParser(t=Pt,r=Ot,A=""){const s=getDiffParser(A);return function(A){const o=toLinesWithContent(A,true,Gt).map((function(A){const o=A.trim().split(Mt);const n=lineBuilder(o[0].trim().split(t),r);if(o.length>1&&!!o[1].trim()){n.diff=s(o[1])}return n}));return{all:o,latest:o.length&&o[0]||null,total:o.length}}}var Gt,Mt,Pt,Ot;var Ht=__esm({"src/lib/parsers/parse-list-log-summary.ts"(){Ie();Lt();St();Gt="òòòòòò ";Mt=" òò";Pt=" ò ";Ot=["hash","date","message","refs","author_name","author_email"]}});var Yt={};__export(Yt,{diffSummaryTask:()=>diffSummaryTask,validateLogFormatConfig:()=>validateLogFormatConfig});function diffSummaryTask(t){let r=logFormatFromCommand(t);const A=["diff"];if(r===""){r="--stat";A.push("--stat=4096")}A.push(...t);return validateLogFormatConfig(A)||{commands:A,format:"utf-8",parser:getDiffParser(r)}}function validateLogFormatConfig(t){const r=t.filter(isLogFormat);if(r.length>1){return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${r.join(",")}`)}if(r.length&&t.includes("-z")){return configurationErrorTask(`Summary flag ${r} parsing is not compatible with null termination option '-z'`)}}var Wt=__esm({"src/lib/tasks/diff.ts"(){St();Lt();Ue()}});function prettyFormat(t,r){const A=[];const s=[];Object.keys(t).forEach((r=>{A.push(r);s.push(String(t[r]))}));return[A,s.join(r)]}function userOptions(t){return Object.keys(t).reduce(((r,A)=>{if(!(A in Jt)){r[A]=t[A]}return r}),{})}function parseLogOptions(t={},r=[]){const A=filterType(t.splitter,se,Pt);const s=!filterPrimitives(t.format)&&t.format?t.format:{hash:"%H",date:t.strictDate===false?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==false?"%aN":"%an",author_email:t.mailMap!==false?"%aE":"%ae"};const[o,n]=prettyFormat(s,A);const i=[];const a=[`--pretty=format:${Gt}${n}${Mt}`,...r];const c=t.n||t["max-count"]||t.maxCount;if(c){a.push(`--max-count=${c}`)}if(t.from||t.to){const r=t.symmetric!==false?"...":"..";i.push(`${t.from||""}${r}${t.to||""}`)}if(se(t.file)){a.push("--follow",pathspec(t.file))}appendTaskOptions(userOptions(t),a);return{fields:o,splitter:A,commands:[...a,...i]}}function logTask(t,r,A){const s=createListLogSummaryParser(t,r,logFormatFromCommand(A));return{commands:["log",...A],format:"utf-8",parser:s}}function log_default(){return{log(...t){const r=trailingFunctionArgument(arguments);const A=parseLogOptions(trailingOptionsArgument(arguments),filterType(arguments[0],Ae));const s=rejectDeprecatedSignatures(...t)||validateLogFormatConfig(A.commands)||createLogTask(A);return this._runTask(s,r)}};function createLogTask(t){return logTask(t.splitter,t.fields,t.commands)}function rejectDeprecatedSignatures(t,r){return se(t)&&se(r)&&configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var Jt;var xt=__esm({"src/lib/tasks/log.ts"(){St();q();Ht();Ie();Ue();Wt();Jt=(t=>{t[t["--pretty"]=0]="--pretty";t[t["max-count"]=1]="max-count";t[t["maxCount"]=2]="maxCount";t[t["n"]=3]="n";t[t["file"]=4]="file";t[t["format"]=5]="format";t[t["from"]=6]="from";t[t["to"]=7]="to";t[t["splitter"]=8]="splitter";t[t["symmetric"]=9]="symmetric";t[t["mailMap"]=10]="mailMap";t[t["multiLine"]=11]="multiLine";t[t["strictDate"]=12]="strictDate";return t})(Jt||{})}});var qt,Vt;var jt=__esm({"src/lib/responses/MergeSummary.ts"(){qt=class{constructor(t,r=null,A){this.reason=t;this.file=r;this.meta=A}toString(){return`${this.file}:${this.reason}`}};Vt=class{constructor(){this.conflicts=[];this.merges=[];this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){if(this.conflicts.length){return`CONFLICTS: ${this.conflicts.join(", ")}`}return"OK"}}}});var zt,Zt;var Xt=__esm({"src/lib/responses/PullSummary.ts"(){zt=class{constructor(){this.remoteMessages={all:[]};this.created=[];this.deleted=[];this.files=[];this.deletions={};this.insertions={};this.summary={changes:0,deletions:0,insertions:0}}};Zt=class{constructor(){this.remote="";this.hash={local:"",remote:""};this.branch={local:"",remote:""};this.message=""}toString(){return this.message}}}});function objectEnumerationResult(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function asObjectCount(t){const r=/^\s*(\d+)/.exec(t);const A=/delta (\d+)/i.exec(t);return{count:asNumber(r&&r[1]||"0"),delta:asNumber(A&&A[1]||"0")}}var Kt;var $t=__esm({"src/lib/parsers/parse-remote-objects.ts"(){Ie();Kt=[new Ee(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,((t,[r,A])=>{const s=r.toLowerCase();const o=objectEnumerationResult(t.remoteMessages);Object.assign(o,{[s]:asNumber(A)})})),new Ee(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,((t,[r,A])=>{const s=r.toLowerCase();const o=objectEnumerationResult(t.remoteMessages);Object.assign(o,{[s]:asNumber(A)})})),new Ee(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,((t,[r,A,s])=>{const o=objectEnumerationResult(t.remoteMessages);o.total=asObjectCount(r);o.reused=asObjectCount(A);o.packReused=asNumber(s)}))]}});function parseRemoteMessages(t,r){return parseStringResponse({remoteMessages:new tr},er,r)}var er,tr;var rr=__esm({"src/lib/parsers/parse-remote-messages.ts"(){Ie();$t();er=[new Ee(/^remote:\s*(.+)$/,((t,[r])=>{t.remoteMessages.all.push(r.trim());return false})),...Kt,new Ee([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],((t,[r])=>{t.remoteMessages.pullRequestUrl=r})),new Ee([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],((t,[r,A,s])=>{t.remoteMessages.vulnerabilities={count:asNumber(r),summary:A,url:s}}))];tr=class{constructor(){this.all=[]}}}});function parsePullErrorResult(t,r){const A=parseStringResponse(new Zt,ir,[t,r]);return A.message&&A}var Ar,sr,or,nr,ir,ar,cr;var lr=__esm({"src/lib/parsers/parse-pull.ts"(){Xt();Ie();rr();Ar=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;sr=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;or=/^(create|delete) mode \d+ (.+)/;nr=[new de(Ar,((t,[r,A,s])=>{t.files.push(r);if(A){t.insertions[r]=A.length}if(s){t.deletions[r]=s.length}})),new de(sr,((t,[r,,A,,s])=>{if(A!==void 0||s!==void 0){t.summary.changes=+r||0;t.summary.insertions=+A||0;t.summary.deletions=+s||0;return true}return false})),new de(or,((t,[r,A])=>{append(t.files,A);append(r==="create"?t.created:t.deleted,A)}))];ir=[new de(/^from\s(.+)$/i,((t,[r])=>void(t.remote=r))),new de(/^fatal:\s(.+)$/,((t,[r])=>void(t.message=r))),new de(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,((t,[r,A,s,o])=>{t.branch.local=s;t.hash.local=r;t.branch.remote=o;t.hash.remote=A}))];ar=(t,r)=>parseStringResponse(new zt,nr,[t,r]);cr=(t,r)=>Object.assign(new zt,ar(t,r),parseRemoteMessages(t,r))}});var ur,gr,dr;var Er=__esm({"src/lib/parsers/parse-merge.ts"(){jt();Ie();lr();ur=[new de(/^Auto-merging\s+(.+)$/,((t,[r])=>{t.merges.push(r)})),new de(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,((t,[r,A])=>{t.conflicts.push(new qt(r,A))})),new de(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,((t,[r,A,s])=>{t.conflicts.push(new qt(r,A,{deleteRef:s}))})),new de(/^CONFLICT\s+\((.+)\):/,((t,[r])=>{t.conflicts.push(new qt(r,null))})),new de(/^Automatic merge failed;\s+(.+)$/,((t,[r])=>{t.result=r}))];gr=(t,r)=>Object.assign(dr(t,r),cr(t,r));dr=t=>parseStringResponse(new Vt,ur,t)}});function mergeTask(t){if(!t.length){return configurationErrorTask("Git.merge requires at least one option")}return{commands:["merge",...t],format:"utf-8",parser(t,r){const A=gr(t,r);if(A.failed){throw new z(A)}return A}}}var hr=__esm({"src/lib/tasks/merge.ts"(){Z();Er();Ue()}});function pushResultPushedItem(t,r,A){const s=A.includes("deleted");const o=A.includes("tag")||/^refs\/tags/.test(t);const n=!A.includes("new");return{deleted:s,tag:o,branch:!o,new:!n,alreadyUpdated:n,local:t,remote:r}}var Cr,fr,Qr;var pr=__esm({"src/lib/parsers/parse-push.ts"(){Ie();rr();Cr=[new de(/^Pushing to (.+)$/,((t,[r])=>{t.repo=r})),new de(/^updating local tracking ref '(.+)'/,((t,[r])=>{t.ref=__spreadProps(__spreadValues({},t.ref||{}),{local:r})})),new de(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,((t,[r,A,s])=>{t.pushed.push(pushResultPushedItem(r,A,s))})),new de(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,((t,[r,A,s])=>{t.branch=__spreadProps(__spreadValues({},t.branch||{}),{local:r,remote:A,remoteName:s})})),new de(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,((t,[r,A,s,o])=>{t.update={head:{local:r,remote:A},hash:{from:s,to:o}}}))];fr=(t,r)=>{const A=Qr(t,r);const s=parseRemoteMessages(t,r);return __spreadValues(__spreadValues({},A),s)};Qr=(t,r)=>parseStringResponse({pushed:[]},Cr,[t,r])}});var Br={};__export(Br,{pushTagsTask:()=>pushTagsTask,pushTask:()=>pushTask});function pushTagsTask(t={},r){append(r,"--tags");return pushTask(t,r)}function pushTask(t={},r){const A=["push",...r];if(t.branch){A.splice(1,0,t.branch)}if(t.remote){A.splice(1,0,t.remote)}remove(A,"-v");append(A,"--verbose");append(A,"--porcelain");return{commands:A,format:"utf-8",parser:fr}}var Ir=__esm({"src/lib/tasks/push.ts"(){pr();Ie()}});function show_default(){return{showBuffer(){const t=["show",...getTrailingOptions(arguments,1)];if(!t.includes("--binary")){t.splice(1,0,"--binary")}return this._runTask(straightThroughBufferTask(t),trailingFunctionArgument(arguments))},show(){const t=["show",...getTrailingOptions(arguments,1)];return this._runTask(straightThroughStringTask(t),trailingFunctionArgument(arguments))}}}var mr=__esm({"src/lib/tasks/show.ts"(){Ie();Ue()}});var yr,br;var Rr=__esm({"src/lib/responses/FileStatusSummary.ts"(){yr=/^(.+) -> (.+)$/;br=class{constructor(t,r,A){this.path=t;this.index=r;this.working_dir=A;if(r+A==="R"){const r=yr.exec(t)||[null,t,t];this.from=r[1]||"";this.path=r[2]||""}}}}});function renamedFile(t){const[r,A]=t.split($);return{from:A||r,to:r}}function parser2(t,r,A){return[`${t}${r}`,A]}function conflicts(t,...r){return r.map((r=>parser2(t,r,((t,r)=>append(t.conflicted,r)))))}function splitLine(t,r){const A=r.trim();switch(" "){case A.charAt(2):return data(A.charAt(0),A.charAt(1),A.substr(3));case A.charAt(1):return data(" ",A.charAt(0),A.substr(2));default:return}function data(r,A,s){const o=`${r}${A}`;const n=kr.get(o);if(n){n(t,s)}if(o!=="##"&&o!=="!!"){t.files.push(new br(s.replace(/\0.+$/,""),r,A))}}}var wr,kr,Sr;var Dr=__esm({"src/lib/responses/StatusSummary.ts"(){Ie();Rr();wr=class{constructor(){this.not_added=[];this.conflicted=[];this.created=[];this.deleted=[];this.ignored=void 0;this.modified=[];this.renamed=[];this.files=[];this.staged=[];this.ahead=0;this.behind=0;this.current=null;this.tracking=null;this.detached=false;this.isClean=()=>!this.files.length}};kr=new Map([parser2(" ","A",((t,r)=>append(t.created,r))),parser2(" ","D",((t,r)=>append(t.deleted,r))),parser2(" ","M",((t,r)=>append(t.modified,r))),parser2("A"," ",((t,r)=>append(t.created,r)&&append(t.staged,r))),parser2("A","M",((t,r)=>append(t.created,r)&&append(t.staged,r)&&append(t.modified,r))),parser2("D"," ",((t,r)=>append(t.deleted,r)&&append(t.staged,r))),parser2("M"," ",((t,r)=>append(t.modified,r)&&append(t.staged,r))),parser2("M","M",((t,r)=>append(t.modified,r)&&append(t.staged,r))),parser2("R"," ",((t,r)=>{append(t.renamed,renamedFile(r))})),parser2("R","M",((t,r)=>{const A=renamedFile(r);append(t.renamed,A);append(t.modified,A.to)})),parser2("!","!",((t,r)=>{append(t.ignored=t.ignored||[],r)})),parser2("?","?",((t,r)=>append(t.not_added,r))),...conflicts("A","A","U"),...conflicts("D","D","U"),...conflicts("U","A","D","U"),["##",(t,r)=>{const A=/ahead (\d+)/;const s=/behind (\d+)/;const o=/^(.+?(?=(?:\.{3}|\s|$)))/;const n=/\.{3}(\S*)/;const i=/\son\s([\S]+)$/;let a;a=A.exec(r);t.ahead=a&&+a[1]||0;a=s.exec(r);t.behind=a&&+a[1]||0;a=o.exec(r);t.current=a&&a[1];a=n.exec(r);t.tracking=a&&a[1];a=i.exec(r);t.current=a&&a[1]||t.current;t.detached=/\(no branch\)/.test(r)}]]);Sr=function(t){const r=t.split($);const A=new wr;for(let t=0,s=r.length;t!Tr.includes(t)))];return{format:"utf-8",commands:r,parser(t){return Sr(t)}}}var Tr;var Fr=__esm({"src/lib/tasks/status.ts"(){Dr();Tr=["--null","-z"]}});function versionResponse(t=0,r=0,A=0,s="",o=true){return Object.defineProperty({major:t,minor:r,patch:A,agent:s,installed:o},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:false,enumerable:false})}function notInstalledResponse(){return versionResponse(0,0,0,"",false)}function version_default(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:versionParser,onError(t,r,A,s){if(t.exitCode===-2){return A(Buffer.from(vr))}s(r)}})}}}function versionParser(t){if(t===vr){return notInstalledResponse()}return parseStringResponse(versionResponse(0,0,0,t),Nr,t)}var vr,Nr;var Ur=__esm({"src/lib/tasks/version.ts"(){Ie();vr="installed=false";Nr=[new de(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,((t,[r,A,s,o=""])=>{Object.assign(t,versionResponse(asNumber(r),asNumber(A),asNumber(s),o))})),new de(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,((t,[r,A,s,o=""])=>{Object.assign(t,versionResponse(asNumber(r),asNumber(A),s,o))}))]}});var _r={};__export(_r,{SimpleGitApi:()=>Lr});var Lr;var Gr=__esm({"src/lib/simple-git-api.ts"(){dt();Et();ht();Qt();xe();pt();$e();Bt();wt();xt();hr();Ir();mr();Fr();Ue();Ur();Ie();Lr=class{constructor(t){this._executor=t}_runTask(t,r){const A=this._executor.chain();const s=A.push(t);if(r){taskCallback(t,s,r)}return Object.create(this,{then:{value:s.then.bind(s)},catch:{value:s.catch.bind(s)},_executor:{value:A}})}add(t){return this._runTask(straightThroughStringTask(["add",...asArray(t)]),trailingFunctionArgument(arguments))}cwd(t){const r=trailingFunctionArgument(arguments);if(typeof t==="string"){return this._runTask(changeWorkingDirectoryTask(t,this._executor),r)}if(typeof(t==null?void 0:t.path)==="string"){return this._runTask(changeWorkingDirectoryTask(t.path,t.root&&this._executor||void 0),r)}return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),r)}hashObject(t,r){return this._runTask(hashObjectTask(t,r===true),trailingFunctionArgument(arguments))}init(t){return this._runTask(initTask(t===true,this._executor.cwd,getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}merge(){return this._runTask(mergeTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}mergeFromTo(t,r){if(!(se(t)&&se(r))){return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}return this._runTask(mergeTask([t,r,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments,false))}outputHandler(t){this._executor.outputHandler=t;return this}push(){const t=pushTask({remote:filterType(arguments[0],se),branch:filterType(arguments[1],se)},getTrailingOptions(arguments));return this._runTask(t,trailingFunctionArgument(arguments))}stash(){return this._runTask(straightThroughStringTask(["stash",...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}status(){return this._runTask(statusTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}};Object.assign(Lr.prototype,checkout_default(),commit_default(),config_default(),first_commit_default(),grep_default(),log_default(),show_default(),version_default())}});var Mr={};__export(Mr,{Scheduler:()=>Or});var Pr,Or;var Hr=__esm({"src/lib/runners/scheduler.ts"(){Ie();st();Pr=(()=>{let t=0;return()=>{t++;const{promise:r,done:A}=(0,U.dD)();return{promise:r,done:A,id:t}}})();Or=class{constructor(t=2){this.concurrency=t;this.logger=createLogger("","scheduler");this.pending=[];this.running=[];this.logger(`Constructed, concurrency=%s`,t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}const t=append(this.running,this.pending.shift());this.logger(`Attempting id=%s`,t.id);t.done((()=>{this.logger(`Completing id=`,t.id);remove(this.running,t);this.schedule()}))}next(){const{promise:t,id:r}=append(this.pending,Pr());this.logger(`Scheduling id=%s`,r);this.schedule();return t}}}});var Yr={};__export(Yr,{applyPatchTask:()=>applyPatchTask});function applyPatchTask(t,r){return straightThroughStringTask(["apply",...r,...t])}var Wr=__esm({"src/lib/tasks/apply-patch.ts"(){Ue()}});function branchDeletionSuccess(t,r){return{branch:t,hash:r,success:true}}function branchDeletionFailure(t){return{branch:t,hash:null,success:false}}var Jr;var xr=__esm({"src/lib/responses/BranchDeleteSummary.ts"(){Jr=class{constructor(){this.all=[];this.branches={};this.errors=[]}get success(){return!this.errors.length}}}});function hasBranchDeletionError(t,r){return r===1&&Vr.test(t)}var qr,Vr,jr,zr;var Zr=__esm({"src/lib/parsers/parse-branch-delete.ts"(){xr();Ie();qr=/(\S+)\s+\(\S+\s([^)]+)\)/;Vr=/^error[^']+'([^']+)'/m;jr=[new de(qr,((t,[r,A])=>{const s=branchDeletionSuccess(r,A);t.all.push(s);t.branches[r]=s})),new de(Vr,((t,[r])=>{const A=branchDeletionFailure(r);t.errors.push(A);t.all.push(A);t.branches[r]=A}))];zr=(t,r)=>parseStringResponse(new Jr,jr,[t,r])}});var Xr;var Kr=__esm({"src/lib/responses/BranchSummary.ts"(){Xr=class{constructor(){this.all=[];this.branches={};this.current="";this.detached=false}push(t,r,A,s,o){if(t==="*"){this.detached=r;this.current=A}this.all.push(A);this.branches[A]={current:t==="*",linkedWorkTree:t==="+",name:A,commit:s,label:o}}}}});function branchStatus(t){return t?t.charAt(0):""}function parseBranchSummary(t){return parseStringResponse(new Xr,$r,t)}var $r;var eA=__esm({"src/lib/parsers/parse-branch.ts"(){Kr();Ie();$r=[new de(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,((t,[r,A,s,o])=>{t.push(branchStatus(r),true,A,s,o)})),new de(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,((t,[r,A,s,o])=>{t.push(branchStatus(r),false,A,s,o)}))]}});var tA={};__export(tA,{branchLocalTask:()=>branchLocalTask,branchTask:()=>branchTask,containsDeleteBranchCommand:()=>containsDeleteBranchCommand,deleteBranchTask:()=>deleteBranchTask,deleteBranchesTask:()=>deleteBranchesTask});function containsDeleteBranchCommand(t){const r=["-d","-D","--delete"];return t.some((t=>r.includes(t)))}function branchTask(t){const r=containsDeleteBranchCommand(t);const A=["branch",...t];if(A.length===1){A.push("-a")}if(!A.includes("-v")){A.splice(1,0,"-v")}return{format:"utf-8",commands:A,parser(t,A){if(r){return zr(t,A).all[0]}return parseBranchSummary(t)}}}function branchLocalTask(){const t=parseBranchSummary;return{format:"utf-8",commands:["branch","-v"],parser:t}}function deleteBranchesTask(t,r=false){return{format:"utf-8",commands:["branch","-v",r?"-D":"-d",...t],parser(t,r){return zr(t,r)},onError({exitCode:t,stdOut:r},A,s,o){if(!hasBranchDeletionError(String(A),t)){return o(A)}s(r)}}}function deleteBranchTask(t,r=false){const A={format:"utf-8",commands:["branch","-v",r?"-D":"-d",t],parser(r,A){return zr(r,A).branches[t]},onError({exitCode:t,stdErr:r,stdOut:s},o,n,i){if(!hasBranchDeletionError(String(o),t)){return i(o)}throw new z(A.parser(bufferToString(s),bufferToString(r)),String(o))}};return A}var rA=__esm({"src/lib/tasks/branch.ts"(){Z();Zr();eA();Ie()}});var AA;var sA=__esm({"src/lib/responses/CheckIgnore.ts"(){AA=t=>t.split(/\n/g).map((t=>t.trim())).filter((t=>!!t))}});var oA={};__export(oA,{checkIgnoreTask:()=>checkIgnoreTask});function checkIgnoreTask(t){return{commands:["check-ignore",...t],format:"utf-8",parser:AA}}var nA=__esm({"src/lib/tasks/check-ignore.ts"(){sA()}});var iA={};__export(iA,{cloneMirrorTask:()=>cloneMirrorTask,cloneTask:()=>cloneTask});function disallowedCommand(t){return/^--upload-pack(=|$)/.test(t)}function cloneTask(t,r,A){const s=["clone",...A];se(t)&&s.push(t);se(r)&&s.push(r);const o=s.find(disallowedCommand);if(o){return configurationErrorTask(`git.fetch: potential exploit argument blocked.`)}return straightThroughStringTask(s)}function cloneMirrorTask(t,r,A){append(A,"--mirror");return cloneTask(t,r,A)}var aA=__esm({"src/lib/tasks/clone.ts"(){Ue();Ie()}});function parseFetchResult(t,r){const A={raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]};return parseStringResponse(A,cA,[t,r])}var cA;var lA=__esm({"src/lib/parsers/parse-fetch.ts"(){Ie();cA=[new de(/From (.+)$/,((t,[r])=>{t.remote=r})),new de(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,((t,[r,A])=>{t.branches.push({name:r,tracking:A})})),new de(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,((t,[r,A])=>{t.tags.push({name:r,tracking:A})})),new de(/- \[deleted]\s+\S+\s*-> (.+)$/,((t,[r])=>{t.deleted.push({tracking:r})})),new de(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,((t,[r,A,s,o])=>{t.updated.push({name:s,tracking:o,to:A,from:r})}))]}});var uA={};__export(uA,{fetchTask:()=>fetchTask});function disallowedCommand2(t){return/^--upload-pack(=|$)/.test(t)}function fetchTask(t,r,A){const s=["fetch",...A];if(t&&r){s.push(t,r)}const o=s.find(disallowedCommand2);if(o){return configurationErrorTask(`git.fetch: potential exploit argument blocked.`)}return{commands:s,format:"utf-8",parser:parseFetchResult}}var gA=__esm({"src/lib/tasks/fetch.ts"(){lA();Ue()}});function parseMoveResult(t){return parseStringResponse({moves:[]},dA,t)}var dA;var EA=__esm({"src/lib/parsers/parse-move.ts"(){Ie();dA=[new de(/^Renaming (.+) to (.+)$/,((t,[r,A])=>{t.moves.push({from:r,to:A})}))]}});var hA={};__export(hA,{moveTask:()=>moveTask});function moveTask(t,r){return{commands:["mv","-v",...asArray(t),r],format:"utf-8",parser:parseMoveResult}}var CA=__esm({"src/lib/tasks/move.ts"(){EA();Ie()}});var fA={};__export(fA,{pullTask:()=>pullTask});function pullTask(t,r,A){const s=["pull",...A];if(t&&r){s.splice(1,0,t,r)}return{commands:s,format:"utf-8",parser(t,r){return cr(t,r)},onError(t,r,A,s){const o=parsePullErrorResult(bufferToString(t.stdOut),bufferToString(t.stdErr));if(o){return s(new z(o))}s(r)}}}var QA=__esm({"src/lib/tasks/pull.ts"(){Z();lr();Ie()}});function parseGetRemotes(t){const r={};forEach(t,(([t])=>r[t]={name:t}));return Object.values(r)}function parseGetRemotesVerbose(t){const r={};forEach(t,(([t,A,s])=>{if(!r.hasOwnProperty(t)){r[t]={name:t,refs:{fetch:"",push:""}}}if(s&&A){r[t].refs[s.replace(/[^a-z]/g,"")]=A}}));return Object.values(r)}function forEach(t,r){forEachLineWithContent(t,(t=>r(t.split(/\s+/))))}var pA=__esm({"src/lib/responses/GetRemoteSummary.ts"(){Ie()}});var BA={};__export(BA,{addRemoteTask:()=>addRemoteTask,getRemotesTask:()=>getRemotesTask,listRemotesTask:()=>listRemotesTask,remoteTask:()=>remoteTask,removeRemoteTask:()=>removeRemoteTask});function addRemoteTask(t,r,A=[]){return straightThroughStringTask(["remote","add",...A,t,r])}function getRemotesTask(t){const r=["remote"];if(t){r.push("-v")}return{commands:r,format:"utf-8",parser:t?parseGetRemotesVerbose:parseGetRemotes}}function listRemotesTask(t=[]){const r=[...t];if(r[0]!=="ls-remote"){r.unshift("ls-remote")}return straightThroughStringTask(r)}function remoteTask(t=[]){const r=[...t];if(r[0]!=="remote"){r.unshift("remote")}return straightThroughStringTask(r)}function removeRemoteTask(t){return straightThroughStringTask(["remote","remove",t])}var IA=__esm({"src/lib/tasks/remote.ts"(){pA();Ue()}});var mA={};__export(mA,{stashListTask:()=>stashListTask});function stashListTask(t={},r){const A=parseLogOptions(t);const s=["stash","list",...A.commands,...r];const o=createListLogSummaryParser(A.splitter,A.fields,logFormatFromCommand(s));return validateLogFormatConfig(s)||{commands:s,format:"utf-8",parser:o}}var yA=__esm({"src/lib/tasks/stash-list.ts"(){St();Ht();Wt();xt()}});var bA={};__export(bA,{addSubModuleTask:()=>addSubModuleTask,initSubModuleTask:()=>initSubModuleTask,subModuleTask:()=>subModuleTask,updateSubModuleTask:()=>updateSubModuleTask});function addSubModuleTask(t,r){return subModuleTask(["add",t,r])}function initSubModuleTask(t){return subModuleTask(["init",...t])}function subModuleTask(t){const r=[...t];if(r[0]!=="submodule"){r.unshift("submodule")}return straightThroughStringTask(r)}function updateSubModuleTask(t){return subModuleTask(["update",...t])}var RA=__esm({"src/lib/tasks/sub-module.ts"(){Ue()}});function singleSorted(t,r){const A=isNaN(t);const s=isNaN(r);if(A!==s){return A?1:-1}return A?sorted(t,r):0}function sorted(t,r){return t===r?0:t>r?1:-1}function trimmed(t){return t.trim()}function toNumber(t){if(typeof t==="string"){return parseInt(t.replace(/^\D+/g,""),10)||0}return 0}var wA,kA;var SA=__esm({"src/lib/responses/TagList.ts"(){wA=class{constructor(t,r){this.all=t;this.latest=r}};kA=function(t,r=false){const A=t.split("\n").map(trimmed).filter(Boolean);if(!r){A.sort((function(t,r){const A=t.split(".");const s=r.split(".");if(A.length===1||s.length===1){return singleSorted(toNumber(A[0]),toNumber(s[0]))}for(let t=0,r=Math.max(A.length,s.length);tt.indexOf(".")>=0));return new wA(A,s)}}});var DA={};__export(DA,{addAnnotatedTagTask:()=>addAnnotatedTagTask,addTagTask:()=>addTagTask,tagListTask:()=>tagListTask});function tagListTask(t=[]){const r=t.some((t=>/^--sort=/.test(t)));return{format:"utf-8",commands:["tag","-l",...t],parser(t){return kA(t,r)}}}function addTagTask(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function addAnnotatedTagTask(t,r){return{format:"utf-8",commands:["tag","-a","-m",r,t],parser(){return{name:t}}}}var TA=__esm({"src/lib/tasks/tag.ts"(){SA()}});var FA=__commonJS({"src/git.js"(t,r){var{GitExecutor:A}=(gt(),W(lt));var{SimpleGitApi:s}=(Gr(),W(_r));var{Scheduler:o}=(Hr(),W(Mr));var{configurationErrorTask:n}=(Ue(),W(ve));var{asArray:i,filterArray:a,filterPrimitives:c,filterString:l,filterStringOrStringArray:u,filterType:g,getTrailingOptions:d,trailingFunctionArgument:E,trailingOptionsArgument:h}=(Ie(),W(Be));var{applyPatchTask:C}=(Wr(),W(Yr));var{branchTask:Q,branchLocalTask:p,deleteBranchesTask:B,deleteBranchTask:I}=(rA(),W(tA));var{checkIgnoreTask:m}=(nA(),W(oA));var{checkIsRepoTask:y}=(we(),W(me));var{cloneTask:b,cloneMirrorTask:R}=(aA(),W(iA));var{cleanWithOptionsTask:w,isCleanOptionsArray:k}=(He(),W(_e));var{diffSummaryTask:S}=(Wt(),W(Yt));var{fetchTask:D}=(gA(),W(uA));var{moveTask:T}=(CA(),W(hA));var{pullTask:F}=(QA(),W(fA));var{pushTagsTask:v}=(Ir(),W(Br));var{addRemoteTask:N,getRemotesTask:U,listRemotesTask:_,remoteTask:L,removeRemoteTask:G}=(IA(),W(BA));var{getResetMode:M,resetTask:P}=(At(),W(et));var{stashListTask:O}=(yA(),W(mA));var{addSubModuleTask:H,initSubModuleTask:Y,subModuleTask:J,updateSubModuleTask:q}=(RA(),W(bA));var{addAnnotatedTagTask:V,addTagTask:j,tagListTask:z}=(TA(),W(DA));var{straightThroughBufferTask:Z,straightThroughStringTask:X}=(Ue(),W(ve));function Git2(t,r){this._executor=new A(t.binary,t.baseDir,new o(t.maxConcurrentProcesses),r);this._trimmed=t.trimmed}(Git2.prototype=Object.create(s.prototype)).constructor=Git2;Git2.prototype.customBinary=function(t){this._executor.binary=t;return this};Git2.prototype.env=function(t,r){if(arguments.length===1&&typeof t==="object"){this._executor.env=t}else{(this._executor.env=this._executor.env||{})[t]=r}return this};Git2.prototype.stashList=function(t){return this._runTask(O(h(arguments)||{},a(t)&&t||[]),E(arguments))};function createCloneTask(t,r,A,s){if(typeof A!=="string"){return n(`git.${t}() requires a string 'repoPath'`)}return r(A,g(s,l),d(arguments))}Git2.prototype.clone=function(){return this._runTask(createCloneTask("clone",b,...arguments),E(arguments))};Git2.prototype.mirror=function(){return this._runTask(createCloneTask("mirror",R,...arguments),E(arguments))};Git2.prototype.mv=function(t,r){return this._runTask(T(t,r),E(arguments))};Git2.prototype.checkoutLatestTag=function(t){var r=this;return this.pull((function(){r.tags((function(A,s){r.checkout(s.latest,t)}))}))};Git2.prototype.pull=function(t,r,A,s){return this._runTask(F(g(t,l),g(r,l),d(arguments)),E(arguments))};Git2.prototype.fetch=function(t,r){return this._runTask(D(g(t,l),g(r,l),d(arguments)),E(arguments))};Git2.prototype.silent=function(t){console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3");return this};Git2.prototype.tags=function(t,r){return this._runTask(z(d(arguments)),E(arguments))};Git2.prototype.rebase=function(){return this._runTask(X(["rebase",...d(arguments)]),E(arguments))};Git2.prototype.reset=function(t){return this._runTask(P(M(t),d(arguments)),E(arguments))};Git2.prototype.revert=function(t){const r=E(arguments);if(typeof t!=="string"){return this._runTask(n("Commit must be a string"),r)}return this._runTask(X(["revert",...d(arguments,0,true),t]),r)};Git2.prototype.addTag=function(t){const r=typeof t==="string"?j(t):n("Git.addTag requires a tag name");return this._runTask(r,E(arguments))};Git2.prototype.addAnnotatedTag=function(t,r){return this._runTask(V(t,r),E(arguments))};Git2.prototype.deleteLocalBranch=function(t,r,A){return this._runTask(I(t,typeof r==="boolean"?r:false),E(arguments))};Git2.prototype.deleteLocalBranches=function(t,r,A){return this._runTask(B(t,typeof r==="boolean"?r:false),E(arguments))};Git2.prototype.branch=function(t,r){return this._runTask(Q(d(arguments)),E(arguments))};Git2.prototype.branchLocal=function(t){return this._runTask(p(),E(arguments))};Git2.prototype.raw=function(t){const r=!Array.isArray(t);const A=[].slice.call(r?arguments:t,0);for(let t=0;tt.removeEventListener("abort",kill)))}};const A={type:"spawn.before",action(r,A){if(t.aborted){A.kill(new NA(void 0,"abort","Abort already signaled"))}}};return[A,r]}function isConfigSwitch(t){return typeof t==="string"&&t.trim().toLowerCase()==="-c"}function preventProtocolOverride(t,r){if(!isConfigSwitch(t)){return}if(!/^\s*protocol(.[a-z]+)?.allow/.test(r)){return}throw new NA(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function preventUploadPack(t,r){if(/^\s*--(upload|receive)-pack/.test(t)){throw new NA(void 0,"unsafe",`Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`)}if(r==="clone"&&/^\s*-u\b/.test(t)){throw new NA(void 0,"unsafe",`Use of clone with option -u is not permitted without enabling allowUnsafePack`)}if(r==="push"&&/^\s*--exec\b/.test(t)){throw new NA(void 0,"unsafe",`Use of push with option --exec is not permitted without enabling allowUnsafePack`)}}function blockUnsafeOperationsPlugin({allowUnsafeProtocolOverride:t=false,allowUnsafePack:r=false}={}){return{type:"spawn.args",action(A,s){A.forEach(((o,n)=>{const i=ndelay(t)))).then(A.done)}return{type:"spawn.after",action(t,r){return __async(this,arguments,(function*(t,{spawned:r,close:A}){var s,o;const n=createEvents();let i=true;let quickClose=()=>void(i=false);(s=r.stdout)==null?void 0:s.on("data",quickClose);(o=r.stderr)==null?void 0:o.on("data",quickClose);r.on("error",quickClose);r.on("close",(t=>n.close(t)));r.on("exit",(t=>n.exit(t)));try{yield n.result;if(i){yield delay(50)}A(n.exitCode)}catch(t){A(n.exitCode,t)}}))}}}j();function isTaskError(t){return!!(t.exitCode&&t.stdErr.length)}function getErrorMessage(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function errorDetectionHandler(t=false,r=isTaskError,A=getErrorMessage){return(s,o)=>{if(!t&&s||!r(o)){return s}return A(o)}}function errorDetectionPlugin(t){return{type:"task.error",action(r,A){const s=t(r.error,{stdErr:A.stdErr,stdOut:A.stdOut,exitCode:A.exitCode});if(Buffer.isBuffer(s)){return{error:new V(void 0,s.toString("utf-8"))}}return{error:s}}}}Ie();var _A=class{constructor(){this.plugins=new Set}add(t){const r=[];asArray(t).forEach((t=>t&&this.plugins.add(append(r,t))));return()=>{r.forEach((t=>this.plugins.delete(t)))}}exec(t,r,A){let s=r;const o=Object.freeze(Object.create(A));for(const r of this.plugins){if(r.type===t){s=r.action(s,o)}}return s}};Ie();function progressMonitorPlugin(t){const r="--progress";const A=["checkout","clone","fetch","pull","push"];const s={type:"spawn.after",action(A,s){var o;if(!s.commands.includes(r)){return}(o=s.spawned.stderr)==null?void 0:o.on("data",(r=>{const A=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(r.toString("utf8"));if(!A){return}t({method:s.method,stage:progressEventStage(A[1]),progress:asNumber(A[2]),processed:asNumber(A[3]),total:asNumber(A[4])})}))}};const o={type:"spawn.args",action(t,s){if(!A.includes(s.method)){return t}return including(t,r)}};return[o,s]}function progressEventStage(t){return String(t.toLowerCase().split(" ",1))||"unknown"}Ie();function spawnOptionsPlugin(t){const r=pick(t,["uid","gid"]);return{type:"spawn.options",action(t){return __spreadValues(__spreadValues({},r),t)}}}function timeoutPlugin({block:t,stdErr:r=true,stdOut:A=true}){if(t>0){return{type:"spawn.after",action(s,o){var n,i;let a;function wait(){a&&clearTimeout(a);a=setTimeout(kill,t)}function stop(){var t,r;(t=o.spawned.stdout)==null?void 0:t.off("data",wait);(r=o.spawned.stderr)==null?void 0:r.off("data",wait);o.spawned.off("exit",stop);o.spawned.off("close",stop);a&&clearTimeout(a)}function kill(){stop();o.kill(new NA(void 0,"timeout",`block timeout reached`))}A&&((n=o.spawned.stdout)==null?void 0:n.on("data",wait));r&&((i=o.spawned.stderr)==null?void 0:i.on("data",wait));o.spawned.on("exit",stop);o.spawned.on("close",stop);wait()}}}}q();function suffixPathsPlugin(){return{type:"spawn.args",action(t){const r=[];let A;function append2(t){(A=A||[]).push(...t)}for(let A=0;AisPathSpec(t)&&toPaths(t)||t)));break}r.push(s)}return!A?r:[...r,"--",...A.map(String)]}}}Ie();var LA=FA();function gitInstanceFactory(t,r){const A=new _A;const s=createInstanceConfig(t&&(typeof t==="string"?{baseDir:t}:t)||{},r);if(!folderExists(s.baseDir)){throw new vA(s,`Cannot use simple-git on a directory that does not exist`)}if(Array.isArray(s.config)){A.add(commandConfigPrefixingPlugin(s.config))}A.add(blockUnsafeOperationsPlugin(s.unsafe));A.add(suffixPathsPlugin());A.add(completionDetectionPlugin(s.completion));s.abort&&A.add(abortPlugin(s.abort));s.progress&&A.add(progressMonitorPlugin(s.progress));s.timeout&&A.add(timeoutPlugin(s.timeout));s.spawnOptions&&A.add(spawnOptionsPlugin(s.spawnOptions));A.add(errorDetectionPlugin(errorDetectionHandler(true)));s.errors&&A.add(errorDetectionPlugin(s.errors));return new LA(s,A)}Z();var GA=null&&["customBinary","env","outputHandler","silent"];var MA=null&&["add","addAnnotatedTag","addConfig","addRemote","addTag","applyPatch","binaryCatFile","branch","branchLocal","catFile","checkIgnore","checkIsRepo","checkout","checkoutBranch","checkoutLatestTag","checkoutLocalBranch","clean","clone","commit","cwd","deleteLocalBranch","deleteLocalBranches","diff","diffSummary","exec","fetch","getRemotes","init","listConfig","listRemote","log","merge","mergeFromTo","mirror","mv","pull","push","pushTags","raw","rebase","remote","removeRemote","reset","revert","revparse","rm","rmKeepLocal","show","stash","stashList","status","subModule","submoduleAdd","submoduleInit","submoduleUpdate","tag","tags","updateServerInfo"];function gitP(...t){let r;let A=Promise.resolve();try{r=gitInstanceFactory(...t)}catch(t){A=Promise.reject(t)}function builderReturn(){return s}function chainReturn(){return A}const s=[...GA,...MA].reduce(((t,A)=>{const s=MA.includes(A);const o=s?asyncWrapper(A,r):syncWrapper(A,r,t);const n=s?chainReturn:builderReturn;Object.defineProperty(t,A,{enumerable:false,configurable:false,value:r?o:n});return t}),{});return s;function asyncWrapper(t,r){return function(...s){if(typeof s[s.length]==="function"){throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to "+t)}return A.then((function(){return new Promise((function(A,o){const callback=(t,r)=>{if(t){return o(toError(t))}A(r)};s.push(callback);r[t].apply(r,s)}))}))}}function syncWrapper(t,r,A){return(...s)=>{r[t](...s);return A}}}function toError(t){if(t instanceof Error){return t}if(typeof t==="string"){return new Error(t)}return new z(t)}var PA=null&&gitInstanceFactory;var OA=gitInstanceFactory;const HA=require("fs/promises");var YA=__nccwpck_require__.n(HA);var WA=__nccwpck_require__(1017);var JA=__nccwpck_require__.n(WA);process.on("unhandledRejection",(t=>{throw t}));const devcardURL=t=>`https://api.daily.dev/devcards/v2/${t}.png?r=${(new Date).valueOf()}&ref=action`;(async function(){try{const A=t.getInput("user_id");const s=t.getInput("token");const o=t.getInput("commit_branch");const n=t.getInput("commit_message");const i=t.getInput("commit_filename");const a=t.getInput("committer_email");const c=t.getInput("committer_name");const l=t.getBooleanInput("dryrun");if(!i||i.length===0){throw new Error("Filename is required")}console.log(`Dryrun`,l);try{const{body:r}=await fetch(devcardURL(A));if(r===null){const r=`Empty response from devcard URL: ${devcardURL(A)}`;t.setFailed(r);console.debug(r);process.exit(1)}await YA().mkdir(JA().dirname(JA().join(`/tmp`,i)),{recursive:true});const s=await YA().open(JA().join(`/tmp`,i),"w");const o=s.createWriteStream();await(0,T.finished)(r.pipe(o));await s.close();console.log(`Saved to ${JA().join(`/tmp`,i)}`,"ok")}catch(t){console.debug(t)}const u={commit:true,message:n.replace(/[$][{]filename[}]/g,i),branch:o||r.context.ref.replace(/^refs[/]heads[/]/,""),sha:undefined,email:a,name:c};const g=r.getOctokit(s);console.log("Committer REST API","ok");try{console.log("Committer account",(await g.rest.users.getAuthenticated()).data.login)}catch{console.log("Committer account","(github-actions)")}console.log("Using branch",u.branch);try{await g.rest.git.getRef({...r.context.repo,ref:`heads/${u.branch}`});console.log("Committer head branch status","ok")}catch(t){if(/not found/i.test(`${t}`)){const{data:{object:t}}=await g.rest.git.getRef({...r.context.repo,ref:r.context.ref.replace(/^refs[/]/,"")});console.log("Committer branch current sha",t.sha);await g.rest.git.createRef({...r.context.repo,ref:`refs/heads/${u.branch}`,sha:t.sha});console.log("Committer head branch status","(created)")}else throw t}try{const{repository:{object:{oid:t}}}=await g.graphql(`\n\t\t\t\tquery Sha {\n\t\t\t\t\trepository(owner: "${r.context.repo.owner}", name: "${r.context.repo.repo}") {\n\t\t\t\t\t\tobject(expression: "${u.branch}:${i}") { ... on Blob { oid } }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t`,{headers:{authorization:`token ${s}`}});u.sha=t}catch(t){console.debug(t)}console.log("Previous render sha",u.sha??"(none)");const d=OA();const E=await d.hashObject(JA().join(`/tmp`,i));console.log("Current devcard sha",E);if(u.sha===E){console.log(`Commit to branch ${u.branch}`,"(no changes)");u.commit=false}if(u.commit&&!l){const t=await YA().readFile(JA().join(`/tmp`,i));await g.rest.repos.createOrUpdateFileContents({...r.context.repo,path:i,message:u.message,content:t.toString("base64"),branch:u.branch,committer:{name:u.name,email:u.email},...u.sha?{sha:u.sha}:{}})}}catch(r){if(r instanceof Error){t.setFailed(r.message);console.debug(r);process.exit(1)}}})()})();module.exports=A})(); \ No newline at end of file +/*! formdata-polyfill. MIT License. Jimmy Wärting */var{toStringTag:n,iterator:i,hasInstance:a}=Symbol,c=Math.random,l="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),f=(t,r,A)=>(t+="",/^(Blob|File)$/.test(r&&r[n])?[(A=A!==void 0?A+"":r[n]=="File"?r.name:"blob",t),r.name!==A||r[n]=="blob"?new o.Z([r],A,r):r]:[t,r+""]),e=(t,r)=>(r?t:t.replace(/\r?\n|\r/g,"\r\n")).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),x=(t,r,A)=>{if(r.lengthtypeof t[r]!="function"))}append(...t){x("append",arguments,2);this.#b.push(f(...t))}delete(t){x("delete",arguments,1);t+="";this.#b=this.#b.filter((([r])=>r!==t))}get(t){x("get",arguments,1);t+="";for(var r=this.#b,A=r.length,s=0;sA[0]===t&&r.push(A[1])));return r}has(t){x("has",arguments,1);t+="";return this.#b.some((r=>r[0]===t))}forEach(t,r){x("forEach",arguments,1);for(var[A,s]of this)t.call(r,s,A,this)}set(...t){x("set",arguments,2);var r=[],A=!0;t=f(...t);this.#b.forEach((s=>{s[0]===t[0]?A&&(A=!r.push(t)):r.push(s)}));A&&r.push(t);this.#b=r}*entries(){yield*this.#b}*keys(){for(var[t]of this)yield t}*values(){for(var[,t]of this)yield t}};function formDataToBlob(t,r=s.Z){var A=`${c()}${c()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),o=[],n=`--${A}\r\nContent-Disposition: form-data; name="`;t.forEach(((t,r)=>typeof t=="string"?o.push(n+e(r)+`"\r\n\r\n${t.replace(/\r(?!\n)|(?{__nccwpck_require__.n=t=>{var r=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(t,r)=>{for(var A in r){if(__nccwpck_require__.o(r,A)&&!__nccwpck_require__.o(t,A)){Object.defineProperty(t,A,{enumerable:true,get:r[A]})}}}})();(()=>{__nccwpck_require__.f={};__nccwpck_require__.e=t=>Promise.all(Object.keys(__nccwpck_require__.f).reduce(((r,A)=>{__nccwpck_require__.f[A](t,r);return r}),[]))})();(()=>{__nccwpck_require__.u=t=>""+t+".index.js"})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";(()=>{var t={179:1};var installChunk=r=>{var A=r.modules,s=r.ids,o=r.runtime;for(var n in A){if(__nccwpck_require__.o(A,n)){__nccwpck_require__.m[n]=A[n]}}if(o)o(__nccwpck_require__);for(var i=0;i{if(!t[r]){if(true){installChunk(require("./"+__nccwpck_require__.u(r)))}else t[r]=1}}})();var A={};(()=>{"use strict";__nccwpck_require__.r(A);var t=__nccwpck_require__(2186);var r=__nccwpck_require__(5438);const s=require("node:http");const o=require("node:https");const n=require("node:zlib");var i=__nccwpck_require__(4492);const a=require("node:buffer");function dataUriToBuffer(t){if(!/^data:/i.test(t)){throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")')}t=t.replace(/\r?\n/g,"");const r=t.indexOf(",");if(r===-1||r<=4){throw new TypeError("malformed data: URI")}const A=t.substring(5,r).split(";");let s="";let o=false;const n=A[0]||"text/plain";let i=n;for(let t=1;ttypeof t==="object"&&typeof t.append==="function"&&typeof t.delete==="function"&&typeof t.get==="function"&&typeof t.getAll==="function"&&typeof t.has==="function"&&typeof t.set==="function"&&typeof t.sort==="function"&&t[d]==="URLSearchParams";const isBlob=t=>t&&typeof t==="object"&&typeof t.arrayBuffer==="function"&&typeof t.type==="string"&&typeof t.stream==="function"&&typeof t.constructor==="function"&&/^(Blob|File)$/.test(t[d]);const isAbortSignal=t=>typeof t==="object"&&(t[d]==="AbortSignal"||t[d]==="EventTarget");const isDomainOrSubdomain=(t,r)=>{const A=new URL(r).hostname;const s=new URL(t).hostname;return A===s||A.endsWith(`.${s}`)};const isSameProtocol=(t,r)=>{const A=new URL(r).protocol;const s=new URL(t).protocol;return A===s};const E=(0,l.promisify)(i.pipeline);const h=Symbol("Body internals");class Body{constructor(t,{size:r=0}={}){let A=null;if(t===null){t=null}else if(isURLSearchParameters(t)){t=a.Buffer.from(t.toString())}else if(isBlob(t)){}else if(a.Buffer.isBuffer(t)){}else if(l.types.isAnyArrayBuffer(t)){t=a.Buffer.from(t)}else if(ArrayBuffer.isView(t)){t=a.Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(t instanceof i){}else if(t instanceof g.Ct){t=(0,g.au)(t);A=t.type.split("=")[1]}else{t=a.Buffer.from(String(t))}let s=t;if(a.Buffer.isBuffer(t)){s=i.Readable.from(t)}else if(isBlob(t)){s=i.Readable.from(t.stream())}this[h]={body:t,stream:s,boundary:A,disturbed:false,error:null};this.size=r;if(t instanceof i){t.on("error",(t=>{const r=t instanceof FetchBaseError?t:new FetchError(`Invalid response body while trying to fetch ${this.url}: ${t.message}`,"system",t);this[h].error=r}))}}get body(){return this[h].stream}get bodyUsed(){return this[h].disturbed}async arrayBuffer(){const{buffer:t,byteOffset:r,byteLength:A}=await consumeBody(this);return t.slice(r,r+A)}async formData(){const t=this.headers.get("content-type");if(t.startsWith("application/x-www-form-urlencoded")){const t=new g.Ct;const r=new URLSearchParams(await this.text());for(const[A,s]of r){t.append(A,s)}return t}const{toFormData:r}=await __nccwpck_require__.e(37).then(__nccwpck_require__.bind(__nccwpck_require__,4037));return r(this.body,t)}async blob(){const t=this.headers&&this.headers.get("content-type")||this[h].body&&this[h].body.type||"";const r=await this.arrayBuffer();return new u.Z([r],{type:t})}async json(){const t=await this.text();return JSON.parse(t)}async text(){const t=await consumeBody(this);return(new TextDecoder).decode(t)}buffer(){return consumeBody(this)}}Body.prototype.buffer=(0,l.deprecate)(Body.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Body.prototype,{body:{enumerable:true},bodyUsed:{enumerable:true},arrayBuffer:{enumerable:true},blob:{enumerable:true},json:{enumerable:true},text:{enumerable:true},data:{get:(0,l.deprecate)((()=>{}),"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function consumeBody(t){if(t[h].disturbed){throw new TypeError(`body used already for: ${t.url}`)}t[h].disturbed=true;if(t[h].error){throw t[h].error}const{body:r}=t;if(r===null){return a.Buffer.alloc(0)}if(!(r instanceof i)){return a.Buffer.alloc(0)}const A=[];let s=0;try{for await(const o of r){if(t.size>0&&s+o.length>t.size){const A=new FetchError(`content size at ${t.url} over limit: ${t.size}`,"max-size");r.destroy(A);throw A}s+=o.length;A.push(o)}}catch(r){const A=r instanceof FetchBaseError?r:new FetchError(`Invalid response body while trying to fetch ${t.url}: ${r.message}`,"system",r);throw A}if(r.readableEnded===true||r._readableState.ended===true){try{if(A.every((t=>typeof t==="string"))){return a.Buffer.from(A.join(""))}return a.Buffer.concat(A,s)}catch(r){throw new FetchError(`Could not create Buffer from response body for ${t.url}: ${r.message}`,"system",r)}}else{throw new FetchError(`Premature close of server response while trying to fetch ${t.url}`)}}const clone=(t,r)=>{let A;let s;let{body:o}=t[h];if(t.bodyUsed){throw new Error("cannot clone body after it is used")}if(o instanceof i&&typeof o.getBoundary!=="function"){A=new i.PassThrough({highWaterMark:r});s=new i.PassThrough({highWaterMark:r});o.pipe(A);o.pipe(s);t[h].stream=A;o=s}return o};const C=(0,l.deprecate)((t=>t.getBoundary()),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167");const extractContentType=(t,r)=>{if(t===null){return null}if(typeof t==="string"){return"text/plain;charset=UTF-8"}if(isURLSearchParameters(t)){return"application/x-www-form-urlencoded;charset=UTF-8"}if(isBlob(t)){return t.type||null}if(a.Buffer.isBuffer(t)||l.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)){return null}if(t instanceof g.Ct){return`multipart/form-data; boundary=${r[h].boundary}`}if(t&&typeof t.getBoundary==="function"){return`multipart/form-data;boundary=${C(t)}`}if(t instanceof i){return null}return"text/plain;charset=UTF-8"};const getTotalBytes=t=>{const{body:r}=t[h];if(r===null){return 0}if(isBlob(r)){return r.size}if(a.Buffer.isBuffer(r)){return r.length}if(r&&typeof r.getLengthSync==="function"){return r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null}return null};const writeToStream=async(t,{body:r})=>{if(r===null){t.end()}else{await E(r,t)}};const Q=typeof s.validateHeaderName==="function"?s.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){const r=new TypeError(`Header name must be a valid HTTP token [${t}]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_HTTP_TOKEN"});throw r}};const p=typeof s.validateHeaderValue==="function"?s.validateHeaderValue:(t,r)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(r)){const r=new TypeError(`Invalid character in header content ["${t}"]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"});throw r}};class Headers extends URLSearchParams{constructor(t){let r=[];if(t instanceof Headers){const A=t.raw();for(const[t,s]of Object.entries(A)){r.push(...s.map((r=>[t,r])))}}else if(t==null){}else if(typeof t==="object"&&!l.types.isBoxedPrimitive(t)){const A=t[Symbol.iterator];if(A==null){r.push(...Object.entries(t))}else{if(typeof A!=="function"){throw new TypeError("Header pairs must be iterable")}r=[...t].map((t=>{if(typeof t!=="object"||l.types.isBoxedPrimitive(t)){throw new TypeError("Each header pair must be an iterable object")}return[...t]})).map((t=>{if(t.length!==2){throw new TypeError("Each header pair must be a name/value tuple")}return[...t]}))}}else{throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence> or record)")}r=r.length>0?r.map((([t,r])=>{Q(t);p(t,String(r));return[String(t).toLowerCase(),String(r)]})):undefined;super(r);return new Proxy(this,{get(t,r,A){switch(r){case"append":case"set":return(A,s)=>{Q(A);p(A,String(s));return URLSearchParams.prototype[r].call(t,String(A).toLowerCase(),String(s))};case"delete":case"has":case"getAll":return A=>{Q(A);return URLSearchParams.prototype[r].call(t,String(A).toLowerCase())};case"keys":return()=>{t.sort();return new Set(URLSearchParams.prototype.keys.call(t)).keys()};default:return Reflect.get(t,r,A)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){const r=this.getAll(t);if(r.length===0){return null}let A=r.join(", ");if(/^content-encoding$/i.test(t)){A=A.toLowerCase()}return A}forEach(t,r=undefined){for(const A of this.keys()){Reflect.apply(t,r,[this.get(A),A,this])}}*values(){for(const t of this.keys()){yield this.get(t)}}*entries(){for(const t of this.keys()){yield[t,this.get(t)]}}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(((t,r)=>{t[r]=this.getAll(r);return t}),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(((t,r)=>{const A=this.getAll(r);if(r==="host"){t[r]=A[0]}else{t[r]=A.length>1?A:A[0]}return t}),{})}}Object.defineProperties(Headers.prototype,["get","entries","forEach","values"].reduce(((t,r)=>{t[r]={enumerable:true};return t}),{}));function fromRawHeaders(t=[]){return new Headers(t.reduce(((t,r,A,s)=>{if(A%2===0){t.push(s.slice(A,A+2))}return t}),[]).filter((([t,r])=>{try{Q(t);p(t,String(r));return true}catch{return false}})))}const B=new Set([301,302,303,307,308]);const isRedirect=t=>B.has(t);const I=Symbol("Response internals");class Response extends Body{constructor(t=null,r={}){super(t,r);const A=r.status!=null?r.status:200;const s=new Headers(r.headers);if(t!==null&&!s.has("Content-Type")){const r=extractContentType(t,this);if(r){s.append("Content-Type",r)}}this[I]={type:"default",url:r.url,status:A,statusText:r.statusText||"",headers:s,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[I].type}get url(){return this[I].url||""}get status(){return this[I].status}get ok(){return this[I].status>=200&&this[I].status<300}get redirected(){return this[I].counter>0}get statusText(){return this[I].statusText}get headers(){return this[I].headers}get highWaterMark(){return this[I].highWaterMark}clone(){return new Response(clone(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,r=302){if(!isRedirect(r)){throw new RangeError('Failed to execute "redirect" on "response": Invalid status code')}return new Response(null,{headers:{location:new URL(t).toString()},status:r})}static error(){const t=new Response(null,{status:0,statusText:""});t[I].type="error";return t}static json(t=undefined,r={}){const A=JSON.stringify(t);if(A===undefined){throw new TypeError("data is not JSON serializable")}const s=new Headers(r&&r.headers);if(!s.has("content-type")){s.set("content-type","application/json")}return new Response(A,{...r,headers:s})}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(Response.prototype,{type:{enumerable:true},url:{enumerable:true},status:{enumerable:true},ok:{enumerable:true},redirected:{enumerable:true},statusText:{enumerable:true},headers:{enumerable:true},clone:{enumerable:true}});const m=require("node:url");const getSearch=t=>{if(t.search){return t.search}const r=t.href.length-1;const A=t.hash||(t.href[r]==="#"?"#":"");return t.href[r-A.length]==="?"?"?":""};const y=require("node:net");function stripURLForUseAsAReferrer(t,r=false){if(t==null){return"no-referrer"}t=new URL(t);if(/^(about|blob|data):$/.test(t.protocol)){return"no-referrer"}t.username="";t.password="";t.hash="";if(r){t.pathname="";t.search=""}return t}const b=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);const R="strict-origin-when-cross-origin";function validateReferrerPolicy(t){if(!b.has(t)){throw new TypeError(`Invalid referrerPolicy: ${t}`)}return t}function isOriginPotentiallyTrustworthy(t){if(/^(http|ws)s:$/.test(t.protocol)){return true}const r=t.host.replace(/(^\[)|(]$)/g,"");const A=(0,y.isIP)(r);if(A===4&&/^127\./.test(r)){return true}if(A===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(r)){return true}if(t.host==="localhost"||t.host.endsWith(".localhost")){return false}if(t.protocol==="file:"){return true}return false}function isUrlPotentiallyTrustworthy(t){if(/^about:(blank|srcdoc)$/.test(t)){return true}if(t.protocol==="data:"){return true}if(/^(blob|filesystem):$/.test(t.protocol)){return true}return isOriginPotentiallyTrustworthy(t)}function determineRequestsReferrer(t,{referrerURLCallback:r,referrerOriginCallback:A}={}){if(t.referrer==="no-referrer"||t.referrerPolicy===""){return null}const s=t.referrerPolicy;if(t.referrer==="about:client"){return"no-referrer"}const o=t.referrer;let n=stripURLForUseAsAReferrer(o);let i=stripURLForUseAsAReferrer(o,true);if(n.toString().length>4096){n=i}if(r){n=r(n)}if(A){i=A(i)}const a=new URL(t.url);switch(s){case"no-referrer":return"no-referrer";case"origin":return i;case"unsafe-url":return n;case"strict-origin":if(isUrlPotentiallyTrustworthy(n)&&!isUrlPotentiallyTrustworthy(a)){return"no-referrer"}return i.toString();case"strict-origin-when-cross-origin":if(n.origin===a.origin){return n}if(isUrlPotentiallyTrustworthy(n)&&!isUrlPotentiallyTrustworthy(a)){return"no-referrer"}return i;case"same-origin":if(n.origin===a.origin){return n}return"no-referrer";case"origin-when-cross-origin":if(n.origin===a.origin){return n}return i;case"no-referrer-when-downgrade":if(isUrlPotentiallyTrustworthy(n)&&!isUrlPotentiallyTrustworthy(a)){return"no-referrer"}return n;default:throw new TypeError(`Invalid referrerPolicy: ${s}`)}}function parseReferrerPolicyFromHeader(t){const r=(t.get("referrer-policy")||"").split(/[,\s]+/);let A="";for(const t of r){if(t&&b.has(t)){A=t}}return A}const w=Symbol("Request internals");const isRequest=t=>typeof t==="object"&&typeof t[w]==="object";const k=(0,l.deprecate)((()=>{}),".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");class Request extends Body{constructor(t,r={}){let A;if(isRequest(t)){A=new URL(t.url)}else{A=new URL(t);t={}}if(A.username!==""||A.password!==""){throw new TypeError(`${A} is an url with embedded credentials.`)}let s=r.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(s)){s=s.toUpperCase()}if(!isRequest(r)&&"data"in r){k()}if((r.body!=null||isRequest(t)&&t.body!==null)&&(s==="GET"||s==="HEAD")){throw new TypeError("Request with GET/HEAD method cannot have body")}const o=r.body?r.body:isRequest(t)&&t.body!==null?clone(t):null;super(o,{size:r.size||t.size||0});const n=new Headers(r.headers||t.headers||{});if(o!==null&&!n.has("Content-Type")){const t=extractContentType(o,this);if(t){n.set("Content-Type",t)}}let i=isRequest(t)?t.signal:null;if("signal"in r){i=r.signal}if(i!=null&&!isAbortSignal(i)){throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget")}let a=r.referrer==null?t.referrer:r.referrer;if(a===""){a="no-referrer"}else if(a){const t=new URL(a);a=/^about:(\/\/)?client$/.test(t)?"client":t}else{a=undefined}this[w]={method:s,redirect:r.redirect||t.redirect||"follow",headers:n,parsedURL:A,signal:i,referrer:a};this.follow=r.follow===undefined?t.follow===undefined?20:t.follow:r.follow;this.compress=r.compress===undefined?t.compress===undefined?true:t.compress:r.compress;this.counter=r.counter||t.counter||0;this.agent=r.agent||t.agent;this.highWaterMark=r.highWaterMark||t.highWaterMark||16384;this.insecureHTTPParser=r.insecureHTTPParser||t.insecureHTTPParser||false;this.referrerPolicy=r.referrerPolicy||t.referrerPolicy||""}get method(){return this[w].method}get url(){return(0,m.format)(this[w].parsedURL)}get headers(){return this[w].headers}get redirect(){return this[w].redirect}get signal(){return this[w].signal}get referrer(){if(this[w].referrer==="no-referrer"){return""}if(this[w].referrer==="client"){return"about:client"}if(this[w].referrer){return this[w].referrer.toString()}return undefined}get referrerPolicy(){return this[w].referrerPolicy}set referrerPolicy(t){this[w].referrerPolicy=validateReferrerPolicy(t)}clone(){return new Request(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(Request.prototype,{method:{enumerable:true},url:{enumerable:true},headers:{enumerable:true},redirect:{enumerable:true},clone:{enumerable:true},signal:{enumerable:true},referrer:{enumerable:true},referrerPolicy:{enumerable:true}});const getNodeRequestOptions=t=>{const{parsedURL:r}=t[w];const A=new Headers(t[w].headers);if(!A.has("Accept")){A.set("Accept","*/*")}let s=null;if(t.body===null&&/^(post|put)$/i.test(t.method)){s="0"}if(t.body!==null){const r=getTotalBytes(t);if(typeof r==="number"&&!Number.isNaN(r)){s=String(r)}}if(s){A.set("Content-Length",s)}if(t.referrerPolicy===""){t.referrerPolicy=R}if(t.referrer&&t.referrer!=="no-referrer"){t[w].referrer=determineRequestsReferrer(t)}else{t[w].referrer="no-referrer"}if(t[w].referrer instanceof URL){A.set("Referer",t.referrer)}if(!A.has("User-Agent")){A.set("User-Agent","node-fetch")}if(t.compress&&!A.has("Accept-Encoding")){A.set("Accept-Encoding","gzip, deflate, br")}let{agent:o}=t;if(typeof o==="function"){o=o(r)}const n=getSearch(r);const i={path:r.pathname+n,method:t.method,headers:A[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:o};return{parsedURL:r,options:i}};class AbortError extends FetchBaseError{constructor(t,r="aborted"){super(t,r)}}var S=__nccwpck_require__(2777);const D=new Set(["data:","http:","https:"]);async function fetch(t,r){return new Promise(((A,a)=>{const l=new Request(t,r);const{parsedURL:u,options:g}=getNodeRequestOptions(l);if(!D.has(u.protocol)){throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${u.protocol.replace(/:$/,"")}" is not supported.`)}if(u.protocol==="data:"){const t=c(l.url);const r=new Response(t,{headers:{"Content-Type":t.typeFull}});A(r);return}const d=(u.protocol==="https:"?o:s).request;const{signal:E}=l;let h=null;const abort=()=>{const t=new AbortError("The operation was aborted.");a(t);if(l.body&&l.body instanceof i.Readable){l.body.destroy(t)}if(!h||!h.body){return}h.body.emit("error",t)};if(E&&E.aborted){abort();return}const abortAndFinalize=()=>{abort();finalize()};const C=d(u.toString(),g);if(E){E.addEventListener("abort",abortAndFinalize)}const finalize=()=>{C.abort();if(E){E.removeEventListener("abort",abortAndFinalize)}};C.on("error",(t=>{a(new FetchError(`request to ${l.url} failed, reason: ${t.message}`,"system",t));finalize()}));fixResponseChunkedTransferBadEnding(C,(t=>{if(h&&h.body){h.body.destroy(t)}}));if(process.version<"v14"){C.on("socket",(t=>{let r;t.prependListener("end",(()=>{r=t._eventsCount}));t.prependListener("close",(A=>{if(h&&r{C.setTimeout(0);const s=fromRawHeaders(t.rawHeaders);if(isRedirect(t.statusCode)){const o=s.get("Location");let n=null;try{n=o===null?null:new URL(o,l.url)}catch{if(l.redirect!=="manual"){a(new FetchError(`uri requested responds with an invalid redirect URL: ${o}`,"invalid-redirect"));finalize();return}}switch(l.redirect){case"error":a(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${l.url}`,"no-redirect"));finalize();return;case"manual":break;case"follow":{if(n===null){break}if(l.counter>=l.follow){a(new FetchError(`maximum redirect reached at: ${l.url}`,"max-redirect"));finalize();return}const o={headers:new Headers(l.headers),follow:l.follow,counter:l.counter+1,agent:l.agent,compress:l.compress,method:l.method,body:clone(l),signal:l.signal,size:l.size,referrer:l.referrer,referrerPolicy:l.referrerPolicy};if(!isDomainOrSubdomain(l.url,n)||!isSameProtocol(l.url,n)){for(const t of["authorization","www-authenticate","cookie","cookie2"]){o.headers.delete(t)}}if(t.statusCode!==303&&l.body&&r.body instanceof i.Readable){a(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect"));finalize();return}if(t.statusCode===303||(t.statusCode===301||t.statusCode===302)&&l.method==="POST"){o.method="GET";o.body=undefined;o.headers.delete("content-length")}const c=parseReferrerPolicyFromHeader(s);if(c){o.referrerPolicy=c}A(fetch(new Request(n,o)));finalize();return}default:return a(new TypeError(`Redirect option '${l.redirect}' is not a valid value of RequestRedirect`))}}if(E){t.once("end",(()=>{E.removeEventListener("abort",abortAndFinalize)}))}let o=(0,i.pipeline)(t,new i.PassThrough,(t=>{if(t){a(t)}}));if(process.version<"v12.10"){t.on("aborted",abortAndFinalize)}const c={url:l.url,status:t.statusCode,statusText:t.statusMessage,headers:s,size:l.size,counter:l.counter,highWaterMark:l.highWaterMark};const u=s.get("Content-Encoding");if(!l.compress||l.method==="HEAD"||u===null||t.statusCode===204||t.statusCode===304){h=new Response(o,c);A(h);return}const g={flush:n.Z_SYNC_FLUSH,finishFlush:n.Z_SYNC_FLUSH};if(u==="gzip"||u==="x-gzip"){o=(0,i.pipeline)(o,n.createGunzip(g),(t=>{if(t){a(t)}}));h=new Response(o,c);A(h);return}if(u==="deflate"||u==="x-deflate"){const r=(0,i.pipeline)(t,new i.PassThrough,(t=>{if(t){a(t)}}));r.once("data",(t=>{if((t[0]&15)===8){o=(0,i.pipeline)(o,n.createInflate(),(t=>{if(t){a(t)}}))}else{o=(0,i.pipeline)(o,n.createInflateRaw(),(t=>{if(t){a(t)}}))}h=new Response(o,c);A(h)}));r.once("end",(()=>{if(!h){h=new Response(o,c);A(h)}}));return}if(u==="br"){o=(0,i.pipeline)(o,n.createBrotliDecompress(),(t=>{if(t){a(t)}}));h=new Response(o,c);A(h);return}h=new Response(o,c);A(h)}));writeToStream(C,l).catch(a)}))}function fixResponseChunkedTransferBadEnding(t,r){const A=a.Buffer.from("0\r\n\r\n");let s=false;let o=false;let n;t.on("response",(t=>{const{headers:r}=t;s=r["transfer-encoding"]==="chunked"&&!r["content-length"]}));t.on("socket",(i=>{const onSocketClose=()=>{if(s&&!o){const t=new Error("Premature close");t.code="ERR_STREAM_PREMATURE_CLOSE";r(t)}};const onData=t=>{o=a.Buffer.compare(t.slice(-5),A)===0;if(!o&&n){o=a.Buffer.compare(n.slice(-3),A.slice(0,3))===0&&a.Buffer.compare(t.slice(-2),A.slice(3))===0}n=t};i.prependListener("close",onSocketClose);i.on("data",onData);t.on("close",(()=>{i.removeListener("close",onSocketClose);i.removeListener("data",onData)}))}))}const T=require("stream/promises");var F=__nccwpck_require__(4751);var v=__nccwpck_require__(8237);const N=require("child_process");var U=__nccwpck_require__(9819);var _=Object.defineProperty;var L=Object.defineProperties;var G=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertyNames;var O=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty;var Y=Object.prototype.propertyIsEnumerable;var __defNormalProp=(t,r,A)=>r in t?_(t,r,{enumerable:true,configurable:true,writable:true,value:A}):t[r]=A;var __spreadValues=(t,r)=>{for(var A in r||(r={}))if(H.call(r,A))__defNormalProp(t,A,r[A]);if(O)for(var A of O(r)){if(Y.call(r,A))__defNormalProp(t,A,r[A])}return t};var __spreadProps=(t,r)=>L(t,M(r));var __markAsModule=t=>_(t,"__esModule",{value:true});var __esm=(t,r)=>function __init(){return t&&(r=(0,t[P(t)[0]])(t=0)),r};var __commonJS=(t,r)=>function __require(){return r||(0,t[P(t)[0]])((r={exports:{}}).exports,r),r.exports};var __export=(t,r)=>{for(var A in r)_(t,A,{get:r[A],enumerable:true})};var __reExport=(t,r,A,s)=>{if(r&&typeof r==="object"||typeof r==="function"){for(let o of P(r))if(!H.call(t,o)&&(A||o!=="default"))_(t,o,{get:()=>r[o],enumerable:!(s=G(r,o))||s.enumerable})}return t};var W=(t=>(r,A)=>t&&t.get(r)||(A=__reExport(__markAsModule({}),r,1),t&&t.set(r,A),A))(typeof WeakMap!=="undefined"?new WeakMap:0);var __async=(t,r,A)=>new Promise(((s,o)=>{var fulfilled=t=>{try{step(A.next(t))}catch(t){o(t)}};var rejected=t=>{try{step(A.throw(t))}catch(t){o(t)}};var step=t=>t.done?s(t.value):Promise.resolve(t.value).then(fulfilled,rejected);step((A=A.apply(t,r)).next())}));function pathspec(...t){const r=new String(t);J.set(r,t);return r}function isPathSpec(t){return t instanceof String&&J.has(t)}function toPaths(t){return J.get(t)||[]}var J;var q=__esm({"src/lib/args/pathspec.ts"(){J=new WeakMap}});var V;var j=__esm({"src/lib/errors/git-error.ts"(){V=class extends Error{constructor(t,r){super(r);this.task=t;Object.setPrototypeOf(this,new.target.prototype)}}}});var z;var Z=__esm({"src/lib/errors/git-response-error.ts"(){j();z=class extends V{constructor(t,r){super(void 0,r||String(t));this.git=t}}}});var X;var K=__esm({"src/lib/errors/task-configuration-error.ts"(){j();X=class extends V{constructor(t){super(void 0,t)}}}});function asFunction(t){return typeof t==="function"?t:ee}function isUserFunction(t){return typeof t==="function"&&t!==ee}function splitOn(t,r){const A=t.indexOf(r);if(A<=0){return[t,""]}return[t.substr(0,A),t.substr(A+1)]}function first(t,r=0){return isArrayLike(t)&&t.length>r?t[r]:void 0}function last(t,r=0){if(isArrayLike(t)&&t.length>r){return t[t.length-1-r]}}function isArrayLike(t){return!!(t&&typeof t.length==="number")}function toLinesWithContent(t="",r=true,A="\n"){return t.split(A).reduce(((t,A)=>{const s=r?A.trim():A;if(s){t.push(s)}return t}),[])}function forEachLineWithContent(t,r){return toLinesWithContent(t,true).map((t=>r(t)))}function folderExists(t){return(0,F.exists)(t,F.FOLDER)}function append(t,r){if(Array.isArray(t)){if(!t.includes(r)){t.push(r)}}else{t.add(r)}return r}function including(t,r){if(Array.isArray(t)&&!t.includes(r)){t.push(r)}return t}function remove(t,r){if(Array.isArray(t)){const A=t.indexOf(r);if(A>=0){t.splice(A,1)}}else{t.delete(r)}return r}function asArray(t){return Array.isArray(t)?t:[t]}function asStringArray(t){return asArray(t).map(String)}function asNumber(t,r=0){if(t==null){return r}const A=parseInt(t,10);return isNaN(A)?r:A}function prefixedArray(t,r){const A=[];for(let s=0,o=t.length;sr in t?{[r]:t[r]}:{})))}function delay(t=0){return new Promise((r=>setTimeout(r,t)))}function orVoid(t){if(t===false){return void 0}return t}var $,ee,te;var re=__esm({"src/lib/utils/util.ts"(){$="\0";ee=()=>{};te=Object.prototype.toString.call.bind(Object.prototype.toString)}});function filterType(t,r,A){if(r(t)){return t}return arguments.length>2?A:void 0}function filterPrimitives(t,r){const A=isPathSpec(t)?"string":typeof t;return/number|string|boolean/.test(A)&&(!r||!r.includes(A))}function filterPlainObject(t){return!!t&&te(t)==="[object Object]"}function filterFunction(t){return typeof t==="function"}var Ae,se,oe,ne,ie;var ae=__esm({"src/lib/utils/argument-filters.ts"(){re();q();Ae=t=>Array.isArray(t);se=t=>typeof t==="string";oe=t=>Array.isArray(t)&&t.every(se);ne=t=>se(t)||Array.isArray(t)&&t.every(se);ie=t=>{if(t==null||"number|boolean|function".includes(typeof t)){return false}return Array.isArray(t)||typeof t==="string"||typeof t.length==="number"}}});var ce;var le=__esm({"src/lib/utils/exit-codes.ts"(){ce=(t=>{t[t["SUCCESS"]=0]="SUCCESS";t[t["ERROR"]=1]="ERROR";t[t["NOT_FOUND"]=-2]="NOT_FOUND";t[t["UNCLEAN"]=128]="UNCLEAN";return t})(ce||{})}});var ue;var ge=__esm({"src/lib/utils/git-output-streams.ts"(){ue=class{constructor(t,r){this.stdOut=t;this.stdErr=r}asStrings(){return new ue(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});var de,Ee;var he=__esm({"src/lib/utils/line-parser.ts"(){de=class{constructor(t,r){this.matches=[];this.parse=(t,r)=>{this.resetMatches();if(!this._regExp.every(((r,A)=>this.addMatch(r,A,t(A))))){return false}return this.useMatches(r,this.prepareMatches())!==false};this._regExp=Array.isArray(t)?t:[t];if(r){this.useMatches=r}}useMatches(t,r){throw new Error(`LineParser:useMatches not implemented`)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,r,A){const s=A&&t.exec(A);if(s){this.pushMatch(r,s)}return!!s}pushMatch(t,r){this.matches.push(...r.slice(1))}};Ee=class extends de{addMatch(t,r,A){return/^remote:\s/.test(String(A))&&super.addMatch(t,r,A)}pushMatch(t,r){if(t>0||r.length>1){super.pushMatch(t,r)}}}}});function createInstanceConfig(...t){const r=process.cwd();const A=Object.assign(__spreadValues({baseDir:r},Ce),...t.filter((t=>typeof t==="object"&&t)));A.baseDir=A.baseDir||r;A.trimmed=A.trimmed===true;return A}var Ce;var fe=__esm({"src/lib/utils/simple-git-options.ts"(){Ce={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:false}}});function appendTaskOptions(t,r=[]){if(!filterPlainObject(t)){return r}return Object.keys(t).reduce(((r,A)=>{const s=t[A];if(isPathSpec(s)){r.push(s)}else if(filterPrimitives(s,["boolean"])){r.push(A+"="+s)}else{r.push(A)}return r}),r)}function getTrailingOptions(t,r=0,A=false){const s=[];for(let A=0,o=r<0?t.length:r;A{for(let o=toLinesWithContent(A,s),n=0,i=o.length;n{if(n+t>=i){return}return o[n+t]};r.some((({parse:r})=>r(line,t)))}}));return t}var pe=__esm({"src/lib/utils/task-parser.ts"(){re()}});var Be={};__export(Be,{ExitCodes:()=>ce,GitOutputStreams:()=>ue,LineParser:()=>de,NOOP:()=>ee,NULL:()=>$,RemoteLineParser:()=>Ee,append:()=>append,appendTaskOptions:()=>appendTaskOptions,asArray:()=>asArray,asFunction:()=>asFunction,asNumber:()=>asNumber,asStringArray:()=>asStringArray,bufferToString:()=>bufferToString,callTaskParser:()=>callTaskParser,createInstanceConfig:()=>createInstanceConfig,delay:()=>delay,filterArray:()=>Ae,filterFunction:()=>filterFunction,filterHasLength:()=>ie,filterPlainObject:()=>filterPlainObject,filterPrimitives:()=>filterPrimitives,filterString:()=>se,filterStringArray:()=>oe,filterStringOrStringArray:()=>ne,filterType:()=>filterType,first:()=>first,folderExists:()=>folderExists,forEachLineWithContent:()=>forEachLineWithContent,getTrailingOptions:()=>getTrailingOptions,including:()=>including,isUserFunction:()=>isUserFunction,last:()=>last,objectToString:()=>te,orVoid:()=>orVoid,parseStringResponse:()=>parseStringResponse,pick:()=>pick,prefixedArray:()=>prefixedArray,remove:()=>remove,splitOn:()=>splitOn,toLinesWithContent:()=>toLinesWithContent,trailingFunctionArgument:()=>trailingFunctionArgument,trailingOptionsArgument:()=>trailingOptionsArgument});var Ie=__esm({"src/lib/utils/index.ts"(){ae();le();ge();he();fe();Qe();pe();re()}});var me={};__export(me,{CheckRepoActions:()=>ye,checkIsBareRepoTask:()=>checkIsBareRepoTask,checkIsRepoRootTask:()=>checkIsRepoRootTask,checkIsRepoTask:()=>checkIsRepoTask});function checkIsRepoTask(t){switch(t){case"bare":return checkIsBareRepoTask();case"root":return checkIsRepoRootTask()}const r=["rev-parse","--is-inside-work-tree"];return{commands:r,format:"utf-8",onError:be,parser:Re}}function checkIsRepoRootTask(){const t=["rev-parse","--git-dir"];return{commands:t,format:"utf-8",onError:be,parser(t){return/^\.(git)?$/.test(t.trim())}}}function checkIsBareRepoTask(){const t=["rev-parse","--is-bare-repository"];return{commands:t,format:"utf-8",onError:be,parser:Re}}function isNotRepoMessage(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var ye,be,Re;var we=__esm({"src/lib/tasks/check-is-repo.ts"(){Ie();ye=(t=>{t["BARE"]="bare";t["IN_TREE"]="tree";t["IS_REPO_ROOT"]="root";return t})(ye||{});be=({exitCode:t},r,A,s)=>{if(t===128&&isNotRepoMessage(r)){return A(Buffer.from("false"))}s(r)};Re=t=>t.trim()==="true"}});function cleanSummaryParser(t,r){const A=new ke(t);const s=t?De:Se;toLinesWithContent(r).forEach((t=>{const r=t.replace(s,"");A.paths.push(r);(Te.test(r)?A.folders:A.files).push(r)}));return A}var ke,Se,De,Te;var Fe=__esm({"src/lib/responses/CleanSummary.ts"(){Ie();ke=class{constructor(t){this.dryRun=t;this.paths=[];this.files=[];this.folders=[]}};Se=/^[a-z]+\s*/i;De=/^[a-z]+\s+[a-z]+\s*/i;Te=/\/$/}});var ve={};__export(ve,{EMPTY_COMMANDS:()=>Ne,adhocExecTask:()=>adhocExecTask,configurationErrorTask:()=>configurationErrorTask,isBufferTask:()=>isBufferTask,isEmptyTask:()=>isEmptyTask,straightThroughBufferTask:()=>straightThroughBufferTask,straightThroughStringTask:()=>straightThroughStringTask});function adhocExecTask(t){return{commands:Ne,format:"empty",parser:t}}function configurationErrorTask(t){return{commands:Ne,format:"empty",parser(){throw typeof t==="string"?new X(t):t}}}function straightThroughStringTask(t,r=false){return{commands:t,format:"utf-8",parser(t){return r?String(t).trim():t}}}function straightThroughBufferTask(t){return{commands:t,format:"buffer",parser(t){return t}}}function isBufferTask(t){return t.format==="buffer"}function isEmptyTask(t){return t.format==="empty"||!t.commands.length}var Ne;var Ue=__esm({"src/lib/tasks/task.ts"(){K();Ne=[]}});var _e={};__export(_e,{CONFIG_ERROR_INTERACTIVE_MODE:()=>Le,CONFIG_ERROR_MODE_REQUIRED:()=>Ge,CONFIG_ERROR_UNKNOWN_OPTION:()=>Me,CleanOptions:()=>Pe,cleanTask:()=>cleanTask,cleanWithOptionsTask:()=>cleanWithOptionsTask,isCleanOptionsArray:()=>isCleanOptionsArray});function cleanWithOptionsTask(t,r){const{cleanMode:A,options:s,valid:o}=getCleanOptions(t);if(!A){return configurationErrorTask(Ge)}if(!o.options){return configurationErrorTask(Me+JSON.stringify(t))}s.push(...r);if(s.some(isInteractiveMode)){return configurationErrorTask(Le)}return cleanTask(A,s)}function cleanTask(t,r){const A=["clean",`-${t}`,...r];return{commands:A,format:"utf-8",parser(r){return cleanSummaryParser(t==="n",r)}}}function isCleanOptionsArray(t){return Array.isArray(t)&&t.every((t=>Oe.has(t)))}function getCleanOptions(t){let r;let A=[];let s={cleanMode:false,options:true};t.replace(/[^a-z]i/g,"").split("").forEach((t=>{if(isCleanMode(t)){r=t;s.cleanMode=true}else{s.options=s.options&&isKnownOption(A[A.length]=`-${t}`)}}));return{cleanMode:r,options:A,valid:s}}function isCleanMode(t){return t==="f"||t==="n"}function isKnownOption(t){return/^-[a-z]$/i.test(t)&&Oe.has(t.charAt(1))}function isInteractiveMode(t){if(/^-[^\-]/.test(t)){return t.indexOf("i")>0}return t==="--interactive"}var Le,Ge,Me,Pe,Oe;var He=__esm({"src/lib/tasks/clean.ts"(){Fe();Ie();Ue();Le="Git clean interactive mode is not supported";Ge='Git clean mode parameter ("n" or "f") is required';Me="Git clean unknown option found in: ";Pe=(t=>{t["DRY_RUN"]="n";t["FORCE"]="f";t["IGNORED_INCLUDED"]="x";t["IGNORED_ONLY"]="X";t["EXCLUDING"]="e";t["QUIET"]="q";t["RECURSIVE"]="d";return t})(Pe||{});Oe=new Set(["i",...asStringArray(Object.values(Pe))])}});function configListParser(t){const r=new Ye;for(const A of configParser(t)){r.addValue(A.file,String(A.key),A.value)}return r}function configGetParser(t,r){let A=null;const s=[];const o=new Map;for(const n of configParser(t,r)){if(n.key!==r){continue}s.push(A=n.value);if(!o.has(n.file)){o.set(n.file,[])}o.get(n.file).push(A)}return{key:r,paths:Array.from(o.keys()),scopes:o,value:A,values:s}}function configFilePath(t){return t.replace(/^(file):/,"")}function*configParser(t,r=null){const A=t.split("\0");for(let t=0,s=A.length-1;tObject.assign(t,this.values[r])),{})}return this._all}addFile(t){if(!(t in this.values)){const r=last(this.files);this.values[t]=r?Object.create(this.values[r]):{};this.files.push(t)}return this.values[t]}addValue(t,r,A){const s=this.addFile(t);if(!s.hasOwnProperty(r)){s[r]=A}else if(Array.isArray(s[r])){s[r].push(A)}else{s[r]=[s[r],A]}this._all=void 0}}}});function asConfigScope(t,r){if(typeof t==="string"&&Je.hasOwnProperty(t)){return t}return r}function addConfigTask(t,r,A,s){const o=["config",`--${s}`];if(A){o.push("--add")}o.push(t,r);return{commands:o,format:"utf-8",parser(t){return t}}}function getConfigTask(t,r){const A=["config","--null","--show-origin","--get-all",t];if(r){A.splice(1,0,`--${r}`)}return{commands:A,format:"utf-8",parser(r){return configGetParser(r,t)}}}function listConfigTask(t){const r=["config","--list","--show-origin","--null"];if(t){r.push(`--${t}`)}return{commands:r,format:"utf-8",parser(t){return configListParser(t)}}}function config_default(){return{addConfig(t,r,...A){return this._runTask(addConfigTask(t,r,A[0]===true,asConfigScope(A[1],"local")),trailingFunctionArgument(arguments))},getConfig(t,r){return this._runTask(getConfigTask(t,asConfigScope(r,void 0)),trailingFunctionArgument(arguments))},listConfig(...t){return this._runTask(listConfigTask(asConfigScope(t[0],void 0)),trailingFunctionArgument(arguments))}}}var Je;var xe=__esm({"src/lib/tasks/config.ts"(){We();Ie();Je=(t=>{t["system"]="system";t["global"]="global";t["local"]="local";t["worktree"]="worktree";return t})(Je||{})}});function isDiffNameStatus(t){return Ve.has(t)}var qe,Ve;var je=__esm({"src/lib/tasks/diff-name-status.ts"(){qe=(t=>{t["ADDED"]="A";t["COPIED"]="C";t["DELETED"]="D";t["MODIFIED"]="M";t["RENAMED"]="R";t["CHANGED"]="T";t["UNMERGED"]="U";t["UNKNOWN"]="X";t["BROKEN"]="B";return t})(qe||{});Ve=new Set(Object.values(qe))}});function grepQueryBuilder(...t){return(new Ke).param(...t)}function parseGrep(t){const r=new Set;const A={};forEachLineWithContent(t,(t=>{const[s,o,n]=t.split($);r.add(s);(A[s]=A[s]||[]).push({line:asNumber(o),path:s,preview:n})}));return{paths:r,results:A}}function grep_default(){return{grep(t){const r=trailingFunctionArgument(arguments);const A=getTrailingOptions(arguments);for(const t of ze){if(A.includes(t)){return this._runTask(configurationErrorTask(`git.grep: use of "${t}" is not supported.`),r)}}if(typeof t==="string"){t=grepQueryBuilder().param(t)}const s=["grep","--null","-n","--full-name",...A,...t];return this._runTask({commands:s,format:"utf-8",parser(t){return parseGrep(t)}},r)}}}var ze,Ze,Xe,Ke;var $e=__esm({"src/lib/tasks/grep.ts"(){Ie();Ue();ze=["-h"];Ze=Symbol("grepQuery");Ke=class{constructor(){this[Xe]=[]}*[(Xe=Ze,Symbol.iterator)](){for(const t of this[Ze]){yield t}}and(...t){t.length&&this[Ze].push("--and","(",...prefixedArray(t,"-e"),")");return this}param(...t){this[Ze].push(...prefixedArray(t,"-e"));return this}}}});var et={};__export(et,{ResetMode:()=>tt,getResetMode:()=>getResetMode,resetTask:()=>resetTask});function resetTask(t,r){const A=["reset"];if(isValidResetMode(t)){A.push(`--${t}`)}A.push(...r);return straightThroughStringTask(A)}function getResetMode(t){if(isValidResetMode(t)){return t}switch(typeof t){case"string":case"undefined":return"soft"}return}function isValidResetMode(t){return rt.includes(t)}var tt,rt;var At=__esm({"src/lib/tasks/reset.ts"(){Ue();tt=(t=>{t["MIXED"]="mixed";t["SOFT"]="soft";t["HARD"]="hard";t["MERGE"]="merge";t["KEEP"]="keep";return t})(tt||{});rt=Array.from(Object.values(tt))}});function createLog(){return v("simple-git")}function prefixedLogger(t,r,A){if(!r||!String(r).replace(/\s*/,"")){return!A?t:(r,...s)=>{t(r,...s);A(r,...s)}}return(s,...o)=>{t(`%s ${s}`,r,...o);if(A){A(s,...o)}}}function childLoggerName(t,r,{namespace:A}){if(typeof t==="string"){return t}const s=r&&r.namespace||"";if(s.startsWith(A)){return s.substr(A.length+1)}return s||A}function createLogger(t,r,A,s=createLog()){const o=t&&`[${t}]`||"";const n=[];const i=typeof r==="string"?s.extend(r):r;const a=childLoggerName(filterType(r,se),i,s);return step(A);function sibling(r,A){return append(n,createLogger(t,a.replace(/^[^:]+/,r),A,s))}function step(r){const A=r&&`[${r}]`||"";const n=i&&prefixedLogger(i,A)||ee;const a=prefixedLogger(s,`${o} ${A}`,n);return Object.assign(i?n:a,{label:t,sibling:sibling,info:a,step:step})}}var st=__esm({"src/lib/git-logger.ts"(){Ie();v.formatters.L=t=>String(ie(t)?t.length:"-");v.formatters.B=t=>{if(Buffer.isBuffer(t)){return t.toString("utf8")}return te(t)}}});var ot,nt;var it=__esm({"src/lib/runners/tasks-pending-queue.ts"(){j();st();ot=class{constructor(t="GitExecutor"){this.logLabel=t;this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){const r=ot.getName(t.commands[0]);const A=createLogger(this.logLabel,r);return{task:t,logger:A,name:r}}push(t){const r=this.createProgress(t);r.logger("Adding task to the queue, commands = %o",t.commands);this._queue.set(t,r);return r}fatal(t){for(const[r,{logger:A}]of Array.from(this._queue.entries())){if(r===t.task){A.info(`Failed %o`,t);A(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)}else{A.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,t.message)}this.complete(r)}if(this._queue.size!==0){throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}}complete(t){const r=this.withProgress(t);if(r){this._queue.delete(t)}}attempt(t){const r=this.withProgress(t);if(!r){throw new V(void 0,"TasksPendingQueue: attempt called for an unknown task")}r.logger("Starting task");return r}static getName(t="empty"){return`task:${t}:${++ot.counter}`}};nt=ot;nt.counter=0}});function pluginContext(t,r){return{method:first(t.commands)||"",commands:r}}function onErrorReceived(t,r){return A=>{r(`[ERROR] child process exception %o`,A);t.push(Buffer.from(String(A.stack),"ascii"))}}function onDataReceived(t,r,A,s){return o=>{A(`%s received %L bytes`,r,o);s(`%B`,o);t.push(o)}}var at;var ct=__esm({"src/lib/runners/git-executor-chain.ts"(){j();Ue();Ie();it();at=class{constructor(t,r,A){this._executor=t;this._scheduler=r;this._plugins=A;this._chain=Promise.resolve();this._queue=new nt}get binary(){return this._executor.binary}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){this._queue.push(t);return this._chain=this._chain.then((()=>this.attemptTask(t)))}attemptTask(t){return __async(this,null,(function*(){const r=yield this._scheduler.next();const onQueueComplete=()=>this._queue.complete(t);try{const{logger:r}=this._queue.attempt(t);return yield isEmptyTask(t)?this.attemptEmptyTask(t,r):this.attemptRemoteTask(t,r)}catch(r){throw this.onFatalException(t,r)}finally{onQueueComplete();r()}}))}onFatalException(t,r){const A=r instanceof V?Object.assign(r,{task:t}):new V(t,r&&String(r));this._chain=Promise.resolve();this._queue.fatal(A);return A}attemptRemoteTask(t,r){return __async(this,null,(function*(){const A=this._plugins.exec("spawn.args",[...t.commands],pluginContext(t,t.commands));const s=yield this.gitResponse(t,this.binary,A,this.outputHandler,r.step("SPAWN"));const o=yield this.handleTaskData(t,A,s,r.step("HANDLE"));r(`passing response to task's parser as a %s`,t.format);if(isBufferTask(t)){return callTaskParser(t.parser,o)}return callTaskParser(t.parser,o.asStrings())}))}attemptEmptyTask(t,r){return __async(this,null,(function*(){r(`empty task bypassing child process to call to task's parser`);return t.parser(this)}))}handleTaskData(t,r,A,s){const{exitCode:o,rejection:n,stdOut:i,stdErr:a}=A;return new Promise(((c,l)=>{s(`Preparing to handle process response exitCode=%d stdOut=`,o);const{error:u}=this._plugins.exec("task.error",{error:n},__spreadValues(__spreadValues({},pluginContext(t,r)),A));if(u&&t.onError){s.info(`exitCode=%s handling with custom error handler`);return t.onError(A,u,(t=>{s.info(`custom error handler treated as success`);s(`custom error returned a %s`,te(t));c(new ue(Array.isArray(t)?Buffer.concat(t):t,Buffer.concat(a)))}),l)}if(u){s.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,o,a.length,n);return l(u)}s.info(`retrieving task output complete`);c(new ue(Buffer.concat(i),Buffer.concat(a)))}))}gitResponse(t,r,A,s,o){return __async(this,null,(function*(){const n=o.sibling("output");const i=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:true},pluginContext(t,t.commands));return new Promise((a=>{const c=[];const l=[];o.info(`%s %o`,r,A);o("%O",i);let u=this._beforeSpawn(t,A);if(u){return a({stdOut:c,stdErr:l,exitCode:9901,rejection:u})}this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(t,A)),{kill(t){u=t||u}}));const g=(0,N.spawn)(r,A,i);g.stdout.on("data",onDataReceived(c,"stdOut",o,n.step("stdOut")));g.stderr.on("data",onDataReceived(l,"stdErr",o,n.step("stdErr")));g.on("error",onErrorReceived(l,o));if(s){o(`Passing child process stdOut/stdErr to custom outputHandler`);s(r,g.stdout,g.stderr,[...A])}this._plugins.exec("spawn.after",void 0,__spreadProps(__spreadValues({},pluginContext(t,A)),{spawned:g,close(t,r){a({stdOut:c,stdErr:l,exitCode:t,rejection:u||r})},kill(t){if(g.killed){return}u=t;g.kill("SIGINT")}}))}))}))}_beforeSpawn(t,r){let A;this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(t,r)),{kill(t){A=t||A}}));return A}}}});var lt={};__export(lt,{GitExecutor:()=>ut});var ut;var gt=__esm({"src/lib/runners/git-executor.ts"(){ct();ut=class{constructor(t="git",r,A,s){this.binary=t;this.cwd=r;this._scheduler=A;this._plugins=s;this._chain=new at(this,this._scheduler,this._plugins)}chain(){return new at(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function taskCallback(t,r,A=ee){const onSuccess=t=>{A(null,t)};const onError2=r=>{if((r==null?void 0:r.task)===t){A(r instanceof z?addDeprecationNoticeToError(r):r,void 0)}};r.then(onSuccess,onError2)}function addDeprecationNoticeToError(t){let log=t=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${t} should be GitResponseError.git.${t}, this will no longer be available in version 3`);log=ee};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(descriptorReducer,{}));function descriptorReducer(r,A){if(A in t){return r}r[A]={enumerable:false,configurable:false,get(){log(A);return t.git[A]}};return r}}var dt=__esm({"src/lib/task-callback.ts"(){Z();Ie()}});function changeWorkingDirectoryTask(t,r){return adhocExecTask((A=>{if(!folderExists(t)){throw new Error(`Git.cwd: cannot change to non-directory "${t}"`)}return(r||A).cwd=t}))}var Et=__esm({"src/lib/tasks/change-working-directory.ts"(){Ie();Ue()}});function checkoutTask(t){const r=["checkout",...t];if(r[1]==="-b"&&r.includes("-B")){r[1]=remove(r,"-B")}return straightThroughStringTask(r)}function checkout_default(){return{checkout(){return this._runTask(checkoutTask(getTrailingOptions(arguments,1)),trailingFunctionArgument(arguments))},checkoutBranch(t,r){return this._runTask(checkoutTask(["-b",t,r,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))},checkoutLocalBranch(t){return this._runTask(checkoutTask(["-b",t,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}}}var ht=__esm({"src/lib/tasks/checkout.ts"(){Ie();Ue()}});function parseCommitResult(t){const r={author:null,branch:"",commit:"",root:false,summary:{changes:0,insertions:0,deletions:0}};return parseStringResponse(r,Ct,t)}var Ct;var ft=__esm({"src/lib/parsers/parse-commit.ts"(){Ie();Ct=[new de(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,((t,[r,A,s])=>{t.branch=r;t.commit=s;t.root=!!A})),new de(/\s*Author:\s(.+)/i,((t,[r])=>{const A=r.split("<");const s=A.pop();if(!s||!s.includes("@")){return}t.author={email:s.substr(0,s.length-1),name:A.join("<").trim()}})),new de(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,((t,[r,A,s])=>{t.summary.changes=parseInt(r,10)||0;t.summary.insertions=parseInt(A,10)||0;t.summary.deletions=parseInt(s,10)||0})),new de(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,((t,[r,A,s])=>{t.summary.changes=parseInt(r,10)||0;const o=parseInt(A,10)||0;if(s==="-"){t.summary.deletions=o}else if(s==="+"){t.summary.insertions=o}}))]}});function commitTask(t,r,A){const s=["-c","core.abbrev=40","commit",...prefixedArray(t,"-m"),...r,...A];return{commands:s,format:"utf-8",parser:parseCommitResult}}function commit_default(){return{commit(t,...r){const A=trailingFunctionArgument(arguments);const s=rejectDeprecatedSignatures(t)||commitTask(asArray(t),asArray(filterType(r[0],ne,[])),[...filterType(r[1],Ae,[]),...getTrailingOptions(arguments,0,true)]);return this._runTask(s,A)}};function rejectDeprecatedSignatures(t){return!ne(t)&&configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Qt=__esm({"src/lib/tasks/commit.ts"(){ft();Ie();Ue()}});function first_commit_default(){return{firstCommit(){return this._runTask(straightThroughStringTask(["rev-list","--max-parents=0","HEAD"],true),trailingFunctionArgument(arguments))}}}var pt=__esm({"src/lib/tasks/first-commit.ts"(){Ie();Ue()}});function hashObjectTask(t,r){const A=["hash-object",t];if(r){A.push("-w")}return straightThroughStringTask(A,true)}var Bt=__esm({"src/lib/tasks/hash-object.ts"(){Ue()}});function parseInit(t,r,A){const s=String(A).trim();let o;if(o=mt.exec(s)){return new It(t,r,false,o[1])}if(o=yt.exec(s)){return new It(t,r,true,o[1])}let n="";const i=s.split(" ");while(i.length){const t=i.shift();if(t==="in"){n=i.join(" ");break}}return new It(t,r,/^re/i.test(s),n)}var It,mt,yt;var bt=__esm({"src/lib/responses/InitSummary.ts"(){It=class{constructor(t,r,A,s){this.bare=t;this.path=r;this.existing=A;this.gitDir=s}};mt=/^Init.+ repository in (.+)$/;yt=/^Rein.+ in (.+)$/}});function hasBareCommand(t){return t.includes(Rt)}function initTask(t=false,r,A){const s=["init",...A];if(t&&!hasBareCommand(s)){s.splice(1,0,Rt)}return{commands:s,format:"utf-8",parser(t){return parseInit(s.includes("--bare"),r,t)}}}var Rt;var wt=__esm({"src/lib/tasks/init.ts"(){bt();Rt="--bare"}});function logFormatFromCommand(t){for(let r=0;rparseStringResponse(new Dt,r,t,false)}var Ft,vt,Nt,Ut,_t;var Lt=__esm({"src/lib/parsers/parse-diff-summary.ts"(){St();Tt();je();Ie();Ft=[new de(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,((t,[r,A,s=""])=>{t.files.push({file:r.trim(),changes:asNumber(A),insertions:s.replace(/[^+]/g,"").length,deletions:s.replace(/[^-]/g,"").length,binary:false})})),new de(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,((t,[r,A,s])=>{t.files.push({file:r.trim(),before:asNumber(A),after:asNumber(s),binary:true})})),new de(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,((t,[r,A])=>{const s=/(\d+) i/.exec(A);const o=/(\d+) d/.exec(A);t.changed=asNumber(r);t.insertions=asNumber(s==null?void 0:s[1]);t.deletions=asNumber(o==null?void 0:o[1])}))];vt=[new de(/(\d+)\t(\d+)\t(.+)$/,((t,[r,A,s])=>{const o=asNumber(r);const n=asNumber(A);t.changed++;t.insertions+=o;t.deletions+=n;t.files.push({file:s,changes:o+n,insertions:o,deletions:n,binary:false})})),new de(/-\t-\t(.+)$/,((t,[r])=>{t.changed++;t.files.push({file:r,after:0,before:0,binary:true})}))];Nt=[new de(/(.+)$/,((t,[r])=>{t.changed++;t.files.push({file:r,changes:0,insertions:0,deletions:0,binary:false})}))];Ut=[new de(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,((t,[r,A,s,o,n])=>{t.changed++;t.files.push({file:n!=null?n:s,changes:0,status:orVoid(isDiffNameStatus(r)&&r),insertions:0,deletions:0,binary:false})}))];_t={[""]:Ft,["--stat"]:Ft,["--numstat"]:vt,["--name-status"]:Ut,["--name-only"]:Nt}}});function lineBuilder(t,r){return r.reduce(((r,A,s)=>{r[A]=t[s]||"";return r}),Object.create({diff:null}))}function createListLogSummaryParser(t=Pt,r=Ot,A=""){const s=getDiffParser(A);return function(A){const o=toLinesWithContent(A,true,Gt).map((function(A){const o=A.trim().split(Mt);const n=lineBuilder(o[0].trim().split(t),r);if(o.length>1&&!!o[1].trim()){n.diff=s(o[1])}return n}));return{all:o,latest:o.length&&o[0]||null,total:o.length}}}var Gt,Mt,Pt,Ot;var Ht=__esm({"src/lib/parsers/parse-list-log-summary.ts"(){Ie();Lt();St();Gt="òòòòòò ";Mt=" òò";Pt=" ò ";Ot=["hash","date","message","refs","author_name","author_email"]}});var Yt={};__export(Yt,{diffSummaryTask:()=>diffSummaryTask,validateLogFormatConfig:()=>validateLogFormatConfig});function diffSummaryTask(t){let r=logFormatFromCommand(t);const A=["diff"];if(r===""){r="--stat";A.push("--stat=4096")}A.push(...t);return validateLogFormatConfig(A)||{commands:A,format:"utf-8",parser:getDiffParser(r)}}function validateLogFormatConfig(t){const r=t.filter(isLogFormat);if(r.length>1){return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${r.join(",")}`)}if(r.length&&t.includes("-z")){return configurationErrorTask(`Summary flag ${r} parsing is not compatible with null termination option '-z'`)}}var Wt=__esm({"src/lib/tasks/diff.ts"(){St();Lt();Ue()}});function prettyFormat(t,r){const A=[];const s=[];Object.keys(t).forEach((r=>{A.push(r);s.push(String(t[r]))}));return[A,s.join(r)]}function userOptions(t){return Object.keys(t).reduce(((r,A)=>{if(!(A in Jt)){r[A]=t[A]}return r}),{})}function parseLogOptions(t={},r=[]){const A=filterType(t.splitter,se,Pt);const s=!filterPrimitives(t.format)&&t.format?t.format:{hash:"%H",date:t.strictDate===false?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==false?"%aN":"%an",author_email:t.mailMap!==false?"%aE":"%ae"};const[o,n]=prettyFormat(s,A);const i=[];const a=[`--pretty=format:${Gt}${n}${Mt}`,...r];const c=t.n||t["max-count"]||t.maxCount;if(c){a.push(`--max-count=${c}`)}if(t.from||t.to){const r=t.symmetric!==false?"...":"..";i.push(`${t.from||""}${r}${t.to||""}`)}if(se(t.file)){a.push("--follow",pathspec(t.file))}appendTaskOptions(userOptions(t),a);return{fields:o,splitter:A,commands:[...a,...i]}}function logTask(t,r,A){const s=createListLogSummaryParser(t,r,logFormatFromCommand(A));return{commands:["log",...A],format:"utf-8",parser:s}}function log_default(){return{log(...t){const r=trailingFunctionArgument(arguments);const A=parseLogOptions(trailingOptionsArgument(arguments),filterType(arguments[0],Ae));const s=rejectDeprecatedSignatures(...t)||validateLogFormatConfig(A.commands)||createLogTask(A);return this._runTask(s,r)}};function createLogTask(t){return logTask(t.splitter,t.fields,t.commands)}function rejectDeprecatedSignatures(t,r){return se(t)&&se(r)&&configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var Jt;var xt=__esm({"src/lib/tasks/log.ts"(){St();q();Ht();Ie();Ue();Wt();Jt=(t=>{t[t["--pretty"]=0]="--pretty";t[t["max-count"]=1]="max-count";t[t["maxCount"]=2]="maxCount";t[t["n"]=3]="n";t[t["file"]=4]="file";t[t["format"]=5]="format";t[t["from"]=6]="from";t[t["to"]=7]="to";t[t["splitter"]=8]="splitter";t[t["symmetric"]=9]="symmetric";t[t["mailMap"]=10]="mailMap";t[t["multiLine"]=11]="multiLine";t[t["strictDate"]=12]="strictDate";return t})(Jt||{})}});var qt,Vt;var jt=__esm({"src/lib/responses/MergeSummary.ts"(){qt=class{constructor(t,r=null,A){this.reason=t;this.file=r;this.meta=A}toString(){return`${this.file}:${this.reason}`}};Vt=class{constructor(){this.conflicts=[];this.merges=[];this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){if(this.conflicts.length){return`CONFLICTS: ${this.conflicts.join(", ")}`}return"OK"}}}});var zt,Zt;var Xt=__esm({"src/lib/responses/PullSummary.ts"(){zt=class{constructor(){this.remoteMessages={all:[]};this.created=[];this.deleted=[];this.files=[];this.deletions={};this.insertions={};this.summary={changes:0,deletions:0,insertions:0}}};Zt=class{constructor(){this.remote="";this.hash={local:"",remote:""};this.branch={local:"",remote:""};this.message=""}toString(){return this.message}}}});function objectEnumerationResult(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function asObjectCount(t){const r=/^\s*(\d+)/.exec(t);const A=/delta (\d+)/i.exec(t);return{count:asNumber(r&&r[1]||"0"),delta:asNumber(A&&A[1]||"0")}}var Kt;var $t=__esm({"src/lib/parsers/parse-remote-objects.ts"(){Ie();Kt=[new Ee(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,((t,[r,A])=>{const s=r.toLowerCase();const o=objectEnumerationResult(t.remoteMessages);Object.assign(o,{[s]:asNumber(A)})})),new Ee(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,((t,[r,A])=>{const s=r.toLowerCase();const o=objectEnumerationResult(t.remoteMessages);Object.assign(o,{[s]:asNumber(A)})})),new Ee(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,((t,[r,A,s])=>{const o=objectEnumerationResult(t.remoteMessages);o.total=asObjectCount(r);o.reused=asObjectCount(A);o.packReused=asNumber(s)}))]}});function parseRemoteMessages(t,r){return parseStringResponse({remoteMessages:new tr},er,r)}var er,tr;var rr=__esm({"src/lib/parsers/parse-remote-messages.ts"(){Ie();$t();er=[new Ee(/^remote:\s*(.+)$/,((t,[r])=>{t.remoteMessages.all.push(r.trim());return false})),...Kt,new Ee([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],((t,[r])=>{t.remoteMessages.pullRequestUrl=r})),new Ee([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],((t,[r,A,s])=>{t.remoteMessages.vulnerabilities={count:asNumber(r),summary:A,url:s}}))];tr=class{constructor(){this.all=[]}}}});function parsePullErrorResult(t,r){const A=parseStringResponse(new Zt,ir,[t,r]);return A.message&&A}var Ar,sr,or,nr,ir,ar,cr;var lr=__esm({"src/lib/parsers/parse-pull.ts"(){Xt();Ie();rr();Ar=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;sr=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;or=/^(create|delete) mode \d+ (.+)/;nr=[new de(Ar,((t,[r,A,s])=>{t.files.push(r);if(A){t.insertions[r]=A.length}if(s){t.deletions[r]=s.length}})),new de(sr,((t,[r,,A,,s])=>{if(A!==void 0||s!==void 0){t.summary.changes=+r||0;t.summary.insertions=+A||0;t.summary.deletions=+s||0;return true}return false})),new de(or,((t,[r,A])=>{append(t.files,A);append(r==="create"?t.created:t.deleted,A)}))];ir=[new de(/^from\s(.+)$/i,((t,[r])=>void(t.remote=r))),new de(/^fatal:\s(.+)$/,((t,[r])=>void(t.message=r))),new de(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,((t,[r,A,s,o])=>{t.branch.local=s;t.hash.local=r;t.branch.remote=o;t.hash.remote=A}))];ar=(t,r)=>parseStringResponse(new zt,nr,[t,r]);cr=(t,r)=>Object.assign(new zt,ar(t,r),parseRemoteMessages(t,r))}});var ur,gr,dr;var Er=__esm({"src/lib/parsers/parse-merge.ts"(){jt();Ie();lr();ur=[new de(/^Auto-merging\s+(.+)$/,((t,[r])=>{t.merges.push(r)})),new de(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,((t,[r,A])=>{t.conflicts.push(new qt(r,A))})),new de(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,((t,[r,A,s])=>{t.conflicts.push(new qt(r,A,{deleteRef:s}))})),new de(/^CONFLICT\s+\((.+)\):/,((t,[r])=>{t.conflicts.push(new qt(r,null))})),new de(/^Automatic merge failed;\s+(.+)$/,((t,[r])=>{t.result=r}))];gr=(t,r)=>Object.assign(dr(t,r),cr(t,r));dr=t=>parseStringResponse(new Vt,ur,t)}});function mergeTask(t){if(!t.length){return configurationErrorTask("Git.merge requires at least one option")}return{commands:["merge",...t],format:"utf-8",parser(t,r){const A=gr(t,r);if(A.failed){throw new z(A)}return A}}}var hr=__esm({"src/lib/tasks/merge.ts"(){Z();Er();Ue()}});function pushResultPushedItem(t,r,A){const s=A.includes("deleted");const o=A.includes("tag")||/^refs\/tags/.test(t);const n=!A.includes("new");return{deleted:s,tag:o,branch:!o,new:!n,alreadyUpdated:n,local:t,remote:r}}var Cr,fr,Qr;var pr=__esm({"src/lib/parsers/parse-push.ts"(){Ie();rr();Cr=[new de(/^Pushing to (.+)$/,((t,[r])=>{t.repo=r})),new de(/^updating local tracking ref '(.+)'/,((t,[r])=>{t.ref=__spreadProps(__spreadValues({},t.ref||{}),{local:r})})),new de(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,((t,[r,A,s])=>{t.pushed.push(pushResultPushedItem(r,A,s))})),new de(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,((t,[r,A,s])=>{t.branch=__spreadProps(__spreadValues({},t.branch||{}),{local:r,remote:A,remoteName:s})})),new de(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,((t,[r,A,s,o])=>{t.update={head:{local:r,remote:A},hash:{from:s,to:o}}}))];fr=(t,r)=>{const A=Qr(t,r);const s=parseRemoteMessages(t,r);return __spreadValues(__spreadValues({},A),s)};Qr=(t,r)=>parseStringResponse({pushed:[]},Cr,[t,r])}});var Br={};__export(Br,{pushTagsTask:()=>pushTagsTask,pushTask:()=>pushTask});function pushTagsTask(t={},r){append(r,"--tags");return pushTask(t,r)}function pushTask(t={},r){const A=["push",...r];if(t.branch){A.splice(1,0,t.branch)}if(t.remote){A.splice(1,0,t.remote)}remove(A,"-v");append(A,"--verbose");append(A,"--porcelain");return{commands:A,format:"utf-8",parser:fr}}var Ir=__esm({"src/lib/tasks/push.ts"(){pr();Ie()}});function show_default(){return{showBuffer(){const t=["show",...getTrailingOptions(arguments,1)];if(!t.includes("--binary")){t.splice(1,0,"--binary")}return this._runTask(straightThroughBufferTask(t),trailingFunctionArgument(arguments))},show(){const t=["show",...getTrailingOptions(arguments,1)];return this._runTask(straightThroughStringTask(t),trailingFunctionArgument(arguments))}}}var mr=__esm({"src/lib/tasks/show.ts"(){Ie();Ue()}});var yr,br;var Rr=__esm({"src/lib/responses/FileStatusSummary.ts"(){yr=/^(.+) -> (.+)$/;br=class{constructor(t,r,A){this.path=t;this.index=r;this.working_dir=A;if(r+A==="R"){const r=yr.exec(t)||[null,t,t];this.from=r[1]||"";this.path=r[2]||""}}}}});function renamedFile(t){const[r,A]=t.split($);return{from:A||r,to:r}}function parser2(t,r,A){return[`${t}${r}`,A]}function conflicts(t,...r){return r.map((r=>parser2(t,r,((t,r)=>append(t.conflicted,r)))))}function splitLine(t,r){const A=r.trim();switch(" "){case A.charAt(2):return data(A.charAt(0),A.charAt(1),A.substr(3));case A.charAt(1):return data(" ",A.charAt(0),A.substr(2));default:return}function data(r,A,s){const o=`${r}${A}`;const n=kr.get(o);if(n){n(t,s)}if(o!=="##"&&o!=="!!"){t.files.push(new br(s.replace(/\0.+$/,""),r,A))}}}var wr,kr,Sr;var Dr=__esm({"src/lib/responses/StatusSummary.ts"(){Ie();Rr();wr=class{constructor(){this.not_added=[];this.conflicted=[];this.created=[];this.deleted=[];this.ignored=void 0;this.modified=[];this.renamed=[];this.files=[];this.staged=[];this.ahead=0;this.behind=0;this.current=null;this.tracking=null;this.detached=false;this.isClean=()=>!this.files.length}};kr=new Map([parser2(" ","A",((t,r)=>append(t.created,r))),parser2(" ","D",((t,r)=>append(t.deleted,r))),parser2(" ","M",((t,r)=>append(t.modified,r))),parser2("A"," ",((t,r)=>append(t.created,r)&&append(t.staged,r))),parser2("A","M",((t,r)=>append(t.created,r)&&append(t.staged,r)&&append(t.modified,r))),parser2("D"," ",((t,r)=>append(t.deleted,r)&&append(t.staged,r))),parser2("M"," ",((t,r)=>append(t.modified,r)&&append(t.staged,r))),parser2("M","M",((t,r)=>append(t.modified,r)&&append(t.staged,r))),parser2("R"," ",((t,r)=>{append(t.renamed,renamedFile(r))})),parser2("R","M",((t,r)=>{const A=renamedFile(r);append(t.renamed,A);append(t.modified,A.to)})),parser2("!","!",((t,r)=>{append(t.ignored=t.ignored||[],r)})),parser2("?","?",((t,r)=>append(t.not_added,r))),...conflicts("A","A","U"),...conflicts("D","D","U"),...conflicts("U","A","D","U"),["##",(t,r)=>{const A=/ahead (\d+)/;const s=/behind (\d+)/;const o=/^(.+?(?=(?:\.{3}|\s|$)))/;const n=/\.{3}(\S*)/;const i=/\son\s([\S]+)$/;let a;a=A.exec(r);t.ahead=a&&+a[1]||0;a=s.exec(r);t.behind=a&&+a[1]||0;a=o.exec(r);t.current=a&&a[1];a=n.exec(r);t.tracking=a&&a[1];a=i.exec(r);t.current=a&&a[1]||t.current;t.detached=/\(no branch\)/.test(r)}]]);Sr=function(t){const r=t.split($);const A=new wr;for(let t=0,s=r.length;t!Tr.includes(t)))];return{format:"utf-8",commands:r,parser(t){return Sr(t)}}}var Tr;var Fr=__esm({"src/lib/tasks/status.ts"(){Dr();Tr=["--null","-z"]}});function versionResponse(t=0,r=0,A=0,s="",o=true){return Object.defineProperty({major:t,minor:r,patch:A,agent:s,installed:o},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:false,enumerable:false})}function notInstalledResponse(){return versionResponse(0,0,0,"",false)}function version_default(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:versionParser,onError(t,r,A,s){if(t.exitCode===-2){return A(Buffer.from(vr))}s(r)}})}}}function versionParser(t){if(t===vr){return notInstalledResponse()}return parseStringResponse(versionResponse(0,0,0,t),Nr,t)}var vr,Nr;var Ur=__esm({"src/lib/tasks/version.ts"(){Ie();vr="installed=false";Nr=[new de(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,((t,[r,A,s,o=""])=>{Object.assign(t,versionResponse(asNumber(r),asNumber(A),asNumber(s),o))})),new de(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,((t,[r,A,s,o=""])=>{Object.assign(t,versionResponse(asNumber(r),asNumber(A),s,o))}))]}});var _r={};__export(_r,{SimpleGitApi:()=>Lr});var Lr;var Gr=__esm({"src/lib/simple-git-api.ts"(){dt();Et();ht();Qt();xe();pt();$e();Bt();wt();xt();hr();Ir();mr();Fr();Ue();Ur();Ie();Lr=class{constructor(t){this._executor=t}_runTask(t,r){const A=this._executor.chain();const s=A.push(t);if(r){taskCallback(t,s,r)}return Object.create(this,{then:{value:s.then.bind(s)},catch:{value:s.catch.bind(s)},_executor:{value:A}})}add(t){return this._runTask(straightThroughStringTask(["add",...asArray(t)]),trailingFunctionArgument(arguments))}cwd(t){const r=trailingFunctionArgument(arguments);if(typeof t==="string"){return this._runTask(changeWorkingDirectoryTask(t,this._executor),r)}if(typeof(t==null?void 0:t.path)==="string"){return this._runTask(changeWorkingDirectoryTask(t.path,t.root&&this._executor||void 0),r)}return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),r)}hashObject(t,r){return this._runTask(hashObjectTask(t,r===true),trailingFunctionArgument(arguments))}init(t){return this._runTask(initTask(t===true,this._executor.cwd,getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}merge(){return this._runTask(mergeTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}mergeFromTo(t,r){if(!(se(t)&&se(r))){return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}return this._runTask(mergeTask([t,r,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments,false))}outputHandler(t){this._executor.outputHandler=t;return this}push(){const t=pushTask({remote:filterType(arguments[0],se),branch:filterType(arguments[1],se)},getTrailingOptions(arguments));return this._runTask(t,trailingFunctionArgument(arguments))}stash(){return this._runTask(straightThroughStringTask(["stash",...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}status(){return this._runTask(statusTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}};Object.assign(Lr.prototype,checkout_default(),commit_default(),config_default(),first_commit_default(),grep_default(),log_default(),show_default(),version_default())}});var Mr={};__export(Mr,{Scheduler:()=>Or});var Pr,Or;var Hr=__esm({"src/lib/runners/scheduler.ts"(){Ie();st();Pr=(()=>{let t=0;return()=>{t++;const{promise:r,done:A}=(0,U.dD)();return{promise:r,done:A,id:t}}})();Or=class{constructor(t=2){this.concurrency=t;this.logger=createLogger("","scheduler");this.pending=[];this.running=[];this.logger(`Constructed, concurrency=%s`,t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}const t=append(this.running,this.pending.shift());this.logger(`Attempting id=%s`,t.id);t.done((()=>{this.logger(`Completing id=`,t.id);remove(this.running,t);this.schedule()}))}next(){const{promise:t,id:r}=append(this.pending,Pr());this.logger(`Scheduling id=%s`,r);this.schedule();return t}}}});var Yr={};__export(Yr,{applyPatchTask:()=>applyPatchTask});function applyPatchTask(t,r){return straightThroughStringTask(["apply",...r,...t])}var Wr=__esm({"src/lib/tasks/apply-patch.ts"(){Ue()}});function branchDeletionSuccess(t,r){return{branch:t,hash:r,success:true}}function branchDeletionFailure(t){return{branch:t,hash:null,success:false}}var Jr;var xr=__esm({"src/lib/responses/BranchDeleteSummary.ts"(){Jr=class{constructor(){this.all=[];this.branches={};this.errors=[]}get success(){return!this.errors.length}}}});function hasBranchDeletionError(t,r){return r===1&&Vr.test(t)}var qr,Vr,jr,zr;var Zr=__esm({"src/lib/parsers/parse-branch-delete.ts"(){xr();Ie();qr=/(\S+)\s+\(\S+\s([^)]+)\)/;Vr=/^error[^']+'([^']+)'/m;jr=[new de(qr,((t,[r,A])=>{const s=branchDeletionSuccess(r,A);t.all.push(s);t.branches[r]=s})),new de(Vr,((t,[r])=>{const A=branchDeletionFailure(r);t.errors.push(A);t.all.push(A);t.branches[r]=A}))];zr=(t,r)=>parseStringResponse(new Jr,jr,[t,r])}});var Xr;var Kr=__esm({"src/lib/responses/BranchSummary.ts"(){Xr=class{constructor(){this.all=[];this.branches={};this.current="";this.detached=false}push(t,r,A,s,o){if(t==="*"){this.detached=r;this.current=A}this.all.push(A);this.branches[A]={current:t==="*",linkedWorkTree:t==="+",name:A,commit:s,label:o}}}}});function branchStatus(t){return t?t.charAt(0):""}function parseBranchSummary(t){return parseStringResponse(new Xr,$r,t)}var $r;var eA=__esm({"src/lib/parsers/parse-branch.ts"(){Kr();Ie();$r=[new de(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,((t,[r,A,s,o])=>{t.push(branchStatus(r),true,A,s,o)})),new de(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,((t,[r,A,s,o])=>{t.push(branchStatus(r),false,A,s,o)}))]}});var tA={};__export(tA,{branchLocalTask:()=>branchLocalTask,branchTask:()=>branchTask,containsDeleteBranchCommand:()=>containsDeleteBranchCommand,deleteBranchTask:()=>deleteBranchTask,deleteBranchesTask:()=>deleteBranchesTask});function containsDeleteBranchCommand(t){const r=["-d","-D","--delete"];return t.some((t=>r.includes(t)))}function branchTask(t){const r=containsDeleteBranchCommand(t);const A=["branch",...t];if(A.length===1){A.push("-a")}if(!A.includes("-v")){A.splice(1,0,"-v")}return{format:"utf-8",commands:A,parser(t,A){if(r){return zr(t,A).all[0]}return parseBranchSummary(t)}}}function branchLocalTask(){const t=parseBranchSummary;return{format:"utf-8",commands:["branch","-v"],parser:t}}function deleteBranchesTask(t,r=false){return{format:"utf-8",commands:["branch","-v",r?"-D":"-d",...t],parser(t,r){return zr(t,r)},onError({exitCode:t,stdOut:r},A,s,o){if(!hasBranchDeletionError(String(A),t)){return o(A)}s(r)}}}function deleteBranchTask(t,r=false){const A={format:"utf-8",commands:["branch","-v",r?"-D":"-d",t],parser(r,A){return zr(r,A).branches[t]},onError({exitCode:t,stdErr:r,stdOut:s},o,n,i){if(!hasBranchDeletionError(String(o),t)){return i(o)}throw new z(A.parser(bufferToString(s),bufferToString(r)),String(o))}};return A}var rA=__esm({"src/lib/tasks/branch.ts"(){Z();Zr();eA();Ie()}});var AA;var sA=__esm({"src/lib/responses/CheckIgnore.ts"(){AA=t=>t.split(/\n/g).map((t=>t.trim())).filter((t=>!!t))}});var oA={};__export(oA,{checkIgnoreTask:()=>checkIgnoreTask});function checkIgnoreTask(t){return{commands:["check-ignore",...t],format:"utf-8",parser:AA}}var nA=__esm({"src/lib/tasks/check-ignore.ts"(){sA()}});var iA={};__export(iA,{cloneMirrorTask:()=>cloneMirrorTask,cloneTask:()=>cloneTask});function disallowedCommand(t){return/^--upload-pack(=|$)/.test(t)}function cloneTask(t,r,A){const s=["clone",...A];se(t)&&s.push(t);se(r)&&s.push(r);const o=s.find(disallowedCommand);if(o){return configurationErrorTask(`git.fetch: potential exploit argument blocked.`)}return straightThroughStringTask(s)}function cloneMirrorTask(t,r,A){append(A,"--mirror");return cloneTask(t,r,A)}var aA=__esm({"src/lib/tasks/clone.ts"(){Ue();Ie()}});function parseFetchResult(t,r){const A={raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]};return parseStringResponse(A,cA,[t,r])}var cA;var lA=__esm({"src/lib/parsers/parse-fetch.ts"(){Ie();cA=[new de(/From (.+)$/,((t,[r])=>{t.remote=r})),new de(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,((t,[r,A])=>{t.branches.push({name:r,tracking:A})})),new de(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,((t,[r,A])=>{t.tags.push({name:r,tracking:A})})),new de(/- \[deleted]\s+\S+\s*-> (.+)$/,((t,[r])=>{t.deleted.push({tracking:r})})),new de(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,((t,[r,A,s,o])=>{t.updated.push({name:s,tracking:o,to:A,from:r})}))]}});var uA={};__export(uA,{fetchTask:()=>fetchTask});function disallowedCommand2(t){return/^--upload-pack(=|$)/.test(t)}function fetchTask(t,r,A){const s=["fetch",...A];if(t&&r){s.push(t,r)}const o=s.find(disallowedCommand2);if(o){return configurationErrorTask(`git.fetch: potential exploit argument blocked.`)}return{commands:s,format:"utf-8",parser:parseFetchResult}}var gA=__esm({"src/lib/tasks/fetch.ts"(){lA();Ue()}});function parseMoveResult(t){return parseStringResponse({moves:[]},dA,t)}var dA;var EA=__esm({"src/lib/parsers/parse-move.ts"(){Ie();dA=[new de(/^Renaming (.+) to (.+)$/,((t,[r,A])=>{t.moves.push({from:r,to:A})}))]}});var hA={};__export(hA,{moveTask:()=>moveTask});function moveTask(t,r){return{commands:["mv","-v",...asArray(t),r],format:"utf-8",parser:parseMoveResult}}var CA=__esm({"src/lib/tasks/move.ts"(){EA();Ie()}});var fA={};__export(fA,{pullTask:()=>pullTask});function pullTask(t,r,A){const s=["pull",...A];if(t&&r){s.splice(1,0,t,r)}return{commands:s,format:"utf-8",parser(t,r){return cr(t,r)},onError(t,r,A,s){const o=parsePullErrorResult(bufferToString(t.stdOut),bufferToString(t.stdErr));if(o){return s(new z(o))}s(r)}}}var QA=__esm({"src/lib/tasks/pull.ts"(){Z();lr();Ie()}});function parseGetRemotes(t){const r={};forEach(t,(([t])=>r[t]={name:t}));return Object.values(r)}function parseGetRemotesVerbose(t){const r={};forEach(t,(([t,A,s])=>{if(!r.hasOwnProperty(t)){r[t]={name:t,refs:{fetch:"",push:""}}}if(s&&A){r[t].refs[s.replace(/[^a-z]/g,"")]=A}}));return Object.values(r)}function forEach(t,r){forEachLineWithContent(t,(t=>r(t.split(/\s+/))))}var pA=__esm({"src/lib/responses/GetRemoteSummary.ts"(){Ie()}});var BA={};__export(BA,{addRemoteTask:()=>addRemoteTask,getRemotesTask:()=>getRemotesTask,listRemotesTask:()=>listRemotesTask,remoteTask:()=>remoteTask,removeRemoteTask:()=>removeRemoteTask});function addRemoteTask(t,r,A=[]){return straightThroughStringTask(["remote","add",...A,t,r])}function getRemotesTask(t){const r=["remote"];if(t){r.push("-v")}return{commands:r,format:"utf-8",parser:t?parseGetRemotesVerbose:parseGetRemotes}}function listRemotesTask(t=[]){const r=[...t];if(r[0]!=="ls-remote"){r.unshift("ls-remote")}return straightThroughStringTask(r)}function remoteTask(t=[]){const r=[...t];if(r[0]!=="remote"){r.unshift("remote")}return straightThroughStringTask(r)}function removeRemoteTask(t){return straightThroughStringTask(["remote","remove",t])}var IA=__esm({"src/lib/tasks/remote.ts"(){pA();Ue()}});var mA={};__export(mA,{stashListTask:()=>stashListTask});function stashListTask(t={},r){const A=parseLogOptions(t);const s=["stash","list",...A.commands,...r];const o=createListLogSummaryParser(A.splitter,A.fields,logFormatFromCommand(s));return validateLogFormatConfig(s)||{commands:s,format:"utf-8",parser:o}}var yA=__esm({"src/lib/tasks/stash-list.ts"(){St();Ht();Wt();xt()}});var bA={};__export(bA,{addSubModuleTask:()=>addSubModuleTask,initSubModuleTask:()=>initSubModuleTask,subModuleTask:()=>subModuleTask,updateSubModuleTask:()=>updateSubModuleTask});function addSubModuleTask(t,r){return subModuleTask(["add",t,r])}function initSubModuleTask(t){return subModuleTask(["init",...t])}function subModuleTask(t){const r=[...t];if(r[0]!=="submodule"){r.unshift("submodule")}return straightThroughStringTask(r)}function updateSubModuleTask(t){return subModuleTask(["update",...t])}var RA=__esm({"src/lib/tasks/sub-module.ts"(){Ue()}});function singleSorted(t,r){const A=isNaN(t);const s=isNaN(r);if(A!==s){return A?1:-1}return A?sorted(t,r):0}function sorted(t,r){return t===r?0:t>r?1:-1}function trimmed(t){return t.trim()}function toNumber(t){if(typeof t==="string"){return parseInt(t.replace(/^\D+/g,""),10)||0}return 0}var wA,kA;var SA=__esm({"src/lib/responses/TagList.ts"(){wA=class{constructor(t,r){this.all=t;this.latest=r}};kA=function(t,r=false){const A=t.split("\n").map(trimmed).filter(Boolean);if(!r){A.sort((function(t,r){const A=t.split(".");const s=r.split(".");if(A.length===1||s.length===1){return singleSorted(toNumber(A[0]),toNumber(s[0]))}for(let t=0,r=Math.max(A.length,s.length);tt.indexOf(".")>=0));return new wA(A,s)}}});var DA={};__export(DA,{addAnnotatedTagTask:()=>addAnnotatedTagTask,addTagTask:()=>addTagTask,tagListTask:()=>tagListTask});function tagListTask(t=[]){const r=t.some((t=>/^--sort=/.test(t)));return{format:"utf-8",commands:["tag","-l",...t],parser(t){return kA(t,r)}}}function addTagTask(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function addAnnotatedTagTask(t,r){return{format:"utf-8",commands:["tag","-a","-m",r,t],parser(){return{name:t}}}}var TA=__esm({"src/lib/tasks/tag.ts"(){SA()}});var FA=__commonJS({"src/git.js"(t,r){var{GitExecutor:A}=(gt(),W(lt));var{SimpleGitApi:s}=(Gr(),W(_r));var{Scheduler:o}=(Hr(),W(Mr));var{configurationErrorTask:n}=(Ue(),W(ve));var{asArray:i,filterArray:a,filterPrimitives:c,filterString:l,filterStringOrStringArray:u,filterType:g,getTrailingOptions:d,trailingFunctionArgument:E,trailingOptionsArgument:h}=(Ie(),W(Be));var{applyPatchTask:C}=(Wr(),W(Yr));var{branchTask:Q,branchLocalTask:p,deleteBranchesTask:B,deleteBranchTask:I}=(rA(),W(tA));var{checkIgnoreTask:m}=(nA(),W(oA));var{checkIsRepoTask:y}=(we(),W(me));var{cloneTask:b,cloneMirrorTask:R}=(aA(),W(iA));var{cleanWithOptionsTask:w,isCleanOptionsArray:k}=(He(),W(_e));var{diffSummaryTask:S}=(Wt(),W(Yt));var{fetchTask:D}=(gA(),W(uA));var{moveTask:T}=(CA(),W(hA));var{pullTask:F}=(QA(),W(fA));var{pushTagsTask:v}=(Ir(),W(Br));var{addRemoteTask:N,getRemotesTask:U,listRemotesTask:_,remoteTask:L,removeRemoteTask:G}=(IA(),W(BA));var{getResetMode:M,resetTask:P}=(At(),W(et));var{stashListTask:O}=(yA(),W(mA));var{addSubModuleTask:H,initSubModuleTask:Y,subModuleTask:J,updateSubModuleTask:q}=(RA(),W(bA));var{addAnnotatedTagTask:V,addTagTask:j,tagListTask:z}=(TA(),W(DA));var{straightThroughBufferTask:Z,straightThroughStringTask:X}=(Ue(),W(ve));function Git2(t,r){this._executor=new A(t.binary,t.baseDir,new o(t.maxConcurrentProcesses),r);this._trimmed=t.trimmed}(Git2.prototype=Object.create(s.prototype)).constructor=Git2;Git2.prototype.customBinary=function(t){this._executor.binary=t;return this};Git2.prototype.env=function(t,r){if(arguments.length===1&&typeof t==="object"){this._executor.env=t}else{(this._executor.env=this._executor.env||{})[t]=r}return this};Git2.prototype.stashList=function(t){return this._runTask(O(h(arguments)||{},a(t)&&t||[]),E(arguments))};function createCloneTask(t,r,A,s){if(typeof A!=="string"){return n(`git.${t}() requires a string 'repoPath'`)}return r(A,g(s,l),d(arguments))}Git2.prototype.clone=function(){return this._runTask(createCloneTask("clone",b,...arguments),E(arguments))};Git2.prototype.mirror=function(){return this._runTask(createCloneTask("mirror",R,...arguments),E(arguments))};Git2.prototype.mv=function(t,r){return this._runTask(T(t,r),E(arguments))};Git2.prototype.checkoutLatestTag=function(t){var r=this;return this.pull((function(){r.tags((function(A,s){r.checkout(s.latest,t)}))}))};Git2.prototype.pull=function(t,r,A,s){return this._runTask(F(g(t,l),g(r,l),d(arguments)),E(arguments))};Git2.prototype.fetch=function(t,r){return this._runTask(D(g(t,l),g(r,l),d(arguments)),E(arguments))};Git2.prototype.silent=function(t){console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3");return this};Git2.prototype.tags=function(t,r){return this._runTask(z(d(arguments)),E(arguments))};Git2.prototype.rebase=function(){return this._runTask(X(["rebase",...d(arguments)]),E(arguments))};Git2.prototype.reset=function(t){return this._runTask(P(M(t),d(arguments)),E(arguments))};Git2.prototype.revert=function(t){const r=E(arguments);if(typeof t!=="string"){return this._runTask(n("Commit must be a string"),r)}return this._runTask(X(["revert",...d(arguments,0,true),t]),r)};Git2.prototype.addTag=function(t){const r=typeof t==="string"?j(t):n("Git.addTag requires a tag name");return this._runTask(r,E(arguments))};Git2.prototype.addAnnotatedTag=function(t,r){return this._runTask(V(t,r),E(arguments))};Git2.prototype.deleteLocalBranch=function(t,r,A){return this._runTask(I(t,typeof r==="boolean"?r:false),E(arguments))};Git2.prototype.deleteLocalBranches=function(t,r,A){return this._runTask(B(t,typeof r==="boolean"?r:false),E(arguments))};Git2.prototype.branch=function(t,r){return this._runTask(Q(d(arguments)),E(arguments))};Git2.prototype.branchLocal=function(t){return this._runTask(p(),E(arguments))};Git2.prototype.raw=function(t){const r=!Array.isArray(t);const A=[].slice.call(r?arguments:t,0);for(let t=0;tt.removeEventListener("abort",kill)))}};const A={type:"spawn.before",action(r,A){if(t.aborted){A.kill(new NA(void 0,"abort","Abort already signaled"))}}};return[A,r]}function isConfigSwitch(t){return typeof t==="string"&&t.trim().toLowerCase()==="-c"}function preventProtocolOverride(t,r){if(!isConfigSwitch(t)){return}if(!/^\s*protocol(.[a-z]+)?.allow/.test(r)){return}throw new NA(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function preventUploadPack(t,r){if(/^\s*--(upload|receive)-pack/.test(t)){throw new NA(void 0,"unsafe",`Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`)}if(r==="clone"&&/^\s*-u\b/.test(t)){throw new NA(void 0,"unsafe",`Use of clone with option -u is not permitted without enabling allowUnsafePack`)}if(r==="push"&&/^\s*--exec\b/.test(t)){throw new NA(void 0,"unsafe",`Use of push with option --exec is not permitted without enabling allowUnsafePack`)}}function blockUnsafeOperationsPlugin({allowUnsafeProtocolOverride:t=false,allowUnsafePack:r=false}={}){return{type:"spawn.args",action(A,s){A.forEach(((o,n)=>{const i=ndelay(t)))).then(A.done)}return{type:"spawn.after",action(t,r){return __async(this,arguments,(function*(t,{spawned:r,close:A}){var s,o;const n=createEvents();let i=true;let quickClose=()=>void(i=false);(s=r.stdout)==null?void 0:s.on("data",quickClose);(o=r.stderr)==null?void 0:o.on("data",quickClose);r.on("error",quickClose);r.on("close",(t=>n.close(t)));r.on("exit",(t=>n.exit(t)));try{yield n.result;if(i){yield delay(50)}A(n.exitCode)}catch(t){A(n.exitCode,t)}}))}}}j();function isTaskError(t){return!!(t.exitCode&&t.stdErr.length)}function getErrorMessage(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function errorDetectionHandler(t=false,r=isTaskError,A=getErrorMessage){return(s,o)=>{if(!t&&s||!r(o)){return s}return A(o)}}function errorDetectionPlugin(t){return{type:"task.error",action(r,A){const s=t(r.error,{stdErr:A.stdErr,stdOut:A.stdOut,exitCode:A.exitCode});if(Buffer.isBuffer(s)){return{error:new V(void 0,s.toString("utf-8"))}}return{error:s}}}}Ie();var _A=class{constructor(){this.plugins=new Set}add(t){const r=[];asArray(t).forEach((t=>t&&this.plugins.add(append(r,t))));return()=>{r.forEach((t=>this.plugins.delete(t)))}}exec(t,r,A){let s=r;const o=Object.freeze(Object.create(A));for(const r of this.plugins){if(r.type===t){s=r.action(s,o)}}return s}};Ie();function progressMonitorPlugin(t){const r="--progress";const A=["checkout","clone","fetch","pull","push"];const s={type:"spawn.after",action(A,s){var o;if(!s.commands.includes(r)){return}(o=s.spawned.stderr)==null?void 0:o.on("data",(r=>{const A=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(r.toString("utf8"));if(!A){return}t({method:s.method,stage:progressEventStage(A[1]),progress:asNumber(A[2]),processed:asNumber(A[3]),total:asNumber(A[4])})}))}};const o={type:"spawn.args",action(t,s){if(!A.includes(s.method)){return t}return including(t,r)}};return[o,s]}function progressEventStage(t){return String(t.toLowerCase().split(" ",1))||"unknown"}Ie();function spawnOptionsPlugin(t){const r=pick(t,["uid","gid"]);return{type:"spawn.options",action(t){return __spreadValues(__spreadValues({},r),t)}}}function timeoutPlugin({block:t,stdErr:r=true,stdOut:A=true}){if(t>0){return{type:"spawn.after",action(s,o){var n,i;let a;function wait(){a&&clearTimeout(a);a=setTimeout(kill,t)}function stop(){var t,r;(t=o.spawned.stdout)==null?void 0:t.off("data",wait);(r=o.spawned.stderr)==null?void 0:r.off("data",wait);o.spawned.off("exit",stop);o.spawned.off("close",stop);a&&clearTimeout(a)}function kill(){stop();o.kill(new NA(void 0,"timeout",`block timeout reached`))}A&&((n=o.spawned.stdout)==null?void 0:n.on("data",wait));r&&((i=o.spawned.stderr)==null?void 0:i.on("data",wait));o.spawned.on("exit",stop);o.spawned.on("close",stop);wait()}}}}q();function suffixPathsPlugin(){return{type:"spawn.args",action(t){const r=[];let A;function append2(t){(A=A||[]).push(...t)}for(let A=0;AisPathSpec(t)&&toPaths(t)||t)));break}r.push(s)}return!A?r:[...r,"--",...A.map(String)]}}}Ie();var LA=FA();function gitInstanceFactory(t,r){const A=new _A;const s=createInstanceConfig(t&&(typeof t==="string"?{baseDir:t}:t)||{},r);if(!folderExists(s.baseDir)){throw new vA(s,`Cannot use simple-git on a directory that does not exist`)}if(Array.isArray(s.config)){A.add(commandConfigPrefixingPlugin(s.config))}A.add(blockUnsafeOperationsPlugin(s.unsafe));A.add(suffixPathsPlugin());A.add(completionDetectionPlugin(s.completion));s.abort&&A.add(abortPlugin(s.abort));s.progress&&A.add(progressMonitorPlugin(s.progress));s.timeout&&A.add(timeoutPlugin(s.timeout));s.spawnOptions&&A.add(spawnOptionsPlugin(s.spawnOptions));A.add(errorDetectionPlugin(errorDetectionHandler(true)));s.errors&&A.add(errorDetectionPlugin(s.errors));return new LA(s,A)}Z();var GA=null&&["customBinary","env","outputHandler","silent"];var MA=null&&["add","addAnnotatedTag","addConfig","addRemote","addTag","applyPatch","binaryCatFile","branch","branchLocal","catFile","checkIgnore","checkIsRepo","checkout","checkoutBranch","checkoutLatestTag","checkoutLocalBranch","clean","clone","commit","cwd","deleteLocalBranch","deleteLocalBranches","diff","diffSummary","exec","fetch","getRemotes","init","listConfig","listRemote","log","merge","mergeFromTo","mirror","mv","pull","push","pushTags","raw","rebase","remote","removeRemote","reset","revert","revparse","rm","rmKeepLocal","show","stash","stashList","status","subModule","submoduleAdd","submoduleInit","submoduleUpdate","tag","tags","updateServerInfo"];function gitP(...t){let r;let A=Promise.resolve();try{r=gitInstanceFactory(...t)}catch(t){A=Promise.reject(t)}function builderReturn(){return s}function chainReturn(){return A}const s=[...GA,...MA].reduce(((t,A)=>{const s=MA.includes(A);const o=s?asyncWrapper(A,r):syncWrapper(A,r,t);const n=s?chainReturn:builderReturn;Object.defineProperty(t,A,{enumerable:false,configurable:false,value:r?o:n});return t}),{});return s;function asyncWrapper(t,r){return function(...s){if(typeof s[s.length]==="function"){throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to "+t)}return A.then((function(){return new Promise((function(A,o){const callback=(t,r)=>{if(t){return o(toError(t))}A(r)};s.push(callback);r[t].apply(r,s)}))}))}}function syncWrapper(t,r,A){return(...s)=>{r[t](...s);return A}}}function toError(t){if(t instanceof Error){return t}if(typeof t==="string"){return new Error(t)}return new z(t)}var PA=null&&gitInstanceFactory;var OA=gitInstanceFactory;const HA=require("fs/promises");var YA=__nccwpck_require__.n(HA);var WA=__nccwpck_require__(1017);var JA=__nccwpck_require__.n(WA);process.on("unhandledRejection",(t=>{throw t}));var xA;(function(t){t["Vertical"]="default";t["Horizontal"]="wide"})(xA||(xA={}));const devcardURL=(t,r=xA.Vertical)=>`https://api.daily.dev/devcards/v2/${t}.png?type=${r}&r=${(new Date).valueOf()}&ref=action`;(async function(){try{const A=t.getInput("user_id");const s=t.getInput("type");const o=t.getInput("token");const n=t.getInput("commit_branch");const i=t.getInput("commit_message");const a=t.getInput("commit_filename");const c=t.getInput("committer_email");const l=t.getInput("committer_name");const u=t.getBooleanInput("dryrun");if(!a||a.length===0){throw new Error("Filename is required")}if(s&&!Object.values(xA).includes(s)){throw new Error("Invalid type")}console.log(`Dryrun`,u);try{const{body:r}=await fetch(devcardURL(A,s));if(r===null){const r=`Empty response from devcard URL: ${devcardURL(A,s)}`;t.setFailed(r);console.debug(r);process.exit(1)}await YA().mkdir(JA().dirname(JA().join(`/tmp`,a)),{recursive:true});const o=await YA().open(JA().join(`/tmp`,a),"w");const n=o.createWriteStream();await(0,T.finished)(r.pipe(n));await o.close();console.log(`Saved to ${JA().join(`/tmp`,a)}`,"ok")}catch(t){console.debug(t)}const g={commit:true,message:i.replace(/[$][{]filename[}]/g,a),branch:n||r.context.ref.replace(/^refs[/]heads[/]/,""),sha:undefined,email:c,name:l};const d=r.getOctokit(o);console.log("Committer REST API","ok");try{console.log("Committer account",(await d.rest.users.getAuthenticated()).data.login)}catch{console.log("Committer account","(github-actions)")}console.log("Using branch",g.branch);try{await d.rest.git.getRef({...r.context.repo,ref:`heads/${g.branch}`});console.log("Committer head branch status","ok")}catch(t){if(/not found/i.test(`${t}`)){const{data:{object:t}}=await d.rest.git.getRef({...r.context.repo,ref:r.context.ref.replace(/^refs[/]/,"")});console.log("Committer branch current sha",t.sha);await d.rest.git.createRef({...r.context.repo,ref:`refs/heads/${g.branch}`,sha:t.sha});console.log("Committer head branch status","(created)")}else throw t}try{const{repository:{object:{oid:t}}}=await d.graphql(`\n\t\t\t\tquery Sha {\n\t\t\t\t\trepository(owner: "${r.context.repo.owner}", name: "${r.context.repo.repo}") {\n\t\t\t\t\t\tobject(expression: "${g.branch}:${a}") { ... on Blob { oid } }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t`,{headers:{authorization:`token ${o}`}});g.sha=t}catch(t){console.debug(t)}console.log("Previous render sha",g.sha??"(none)");const E=OA();const h=await E.hashObject(JA().join(`/tmp`,a));console.log("Current devcard sha",h);if(g.sha===h){console.log(`Commit to branch ${g.branch}`,"(no changes)");g.commit=false}if(g.commit&&!u){const t=await YA().readFile(JA().join(`/tmp`,a));await d.rest.repos.createOrUpdateFileContents({...r.context.repo,path:a,message:g.message,content:t.toString("base64"),branch:g.branch,committer:{name:g.name,email:g.email},...g.sha?{sha:g.sha}:{}})}}catch(r){if(r instanceof Error){t.setFailed(r.message);console.debug(r);process.exit(1)}}})()})();module.exports=A})(); \ No newline at end of file diff --git a/package.json b/package.json index e641339..c23d0f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "action-devcard", - "version": "3.0.0", + "version": "3.1.0", "description": "GitHub Action to download the devcard from daily.dev", "private": true, "author": {