@storybook/addon-a11y 8.5.0-beta.9 → 8.6.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,6 +64,6 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
64
64
  `,LF:`
65
65
  `,concatBytes:concatString},concatUint8Array=(firstChunk,secondChunk)=>{let chunk=new Uint8Array(firstChunk.length+secondChunk.length);return chunk.set(firstChunk,0),chunk.set(secondChunk,firstChunk.length),chunk},linesUint8ArrayInfo={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:concatUint8Array};var getValidateTransformInput=(writableObjectMode,optionName)=>writableObjectMode?void 0:validateStringTransformInput.bind(void 0,optionName),validateStringTransformInput=function*(optionName,chunk){if(typeof chunk!="string"&&!isUint8Array(chunk)&&!buffer.Buffer.isBuffer(chunk))throw new TypeError(`The \`${optionName}\` option's transform must use "objectMode: true" to receive as input: ${typeof chunk}.`);yield chunk;},getValidateTransformReturn=(readableObjectMode,optionName)=>readableObjectMode?validateObjectTransformReturn.bind(void 0,optionName):validateStringTransformReturn.bind(void 0,optionName),validateObjectTransformReturn=function*(optionName,chunk){validateEmptyReturn(optionName,chunk),yield chunk;},validateStringTransformReturn=function*(optionName,chunk){if(validateEmptyReturn(optionName,chunk),typeof chunk!="string"&&!isUint8Array(chunk))throw new TypeError(`The \`${optionName}\` option's function must yield a string or an Uint8Array, not ${typeof chunk}.`);yield chunk;},validateEmptyReturn=(optionName,chunk)=>{if(chunk==null)throw new TypeError(`The \`${optionName}\` option's function must not call \`yield ${chunk}\`.
66
66
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
67
- if (condition) { yield value; }`)};var getEncodingTransformGenerator=(binary,encoding,skipped)=>{if(skipped)return;if(binary)return {transform:encodingUint8ArrayGenerator.bind(void 0,new TextEncoder)};let stringDecoder=new string_decoder.StringDecoder(encoding);return {transform:encodingStringGenerator.bind(void 0,stringDecoder),final:encodingStringFinal.bind(void 0,stringDecoder)}},encodingUint8ArrayGenerator=function*(textEncoder3,chunk){buffer.Buffer.isBuffer(chunk)?yield bufferToUint8Array(chunk):typeof chunk=="string"?yield textEncoder3.encode(chunk):yield chunk;},encodingStringGenerator=function*(stringDecoder,chunk){yield isUint8Array(chunk)?stringDecoder.write(chunk):chunk;},encodingStringFinal=function*(stringDecoder){let lastChunk=stringDecoder.end();lastChunk!==""&&(yield lastChunk);};var pushChunks=util.callbackify(async(getChunks,state,getChunksArguments,transformStream)=>{state.currentIterable=getChunks(...getChunksArguments);try{for await(let chunk of state.currentIterable)transformStream.push(chunk);}finally{delete state.currentIterable;}}),transformChunk=async function*(chunk,generators,index){if(index===generators.length){yield chunk;return}let{transform=identityGenerator}=generators[index];for await(let transformedChunk of transform(chunk))yield*transformChunk(transformedChunk,generators,index+1);},finalChunks=async function*(generators){for(let[index,{final}]of Object.entries(generators))yield*generatorFinalChunks(final,Number(index),generators);},generatorFinalChunks=async function*(final,index,generators){if(final!==void 0)for await(let finalChunk of final())yield*transformChunk(finalChunk,generators,index+1);},destroyTransform=util.callbackify(async({currentIterable},error)=>{if(currentIterable!==void 0){await(error?currentIterable.throw(error):currentIterable.return());return}if(error)throw error}),identityGenerator=function*(chunk){yield chunk;};var pushChunksSync=(getChunksSync,getChunksArguments,transformStream,done)=>{try{for(let chunk of getChunksSync(...getChunksArguments))transformStream.push(chunk);done();}catch(error){done(error);}},runTransformSync=(generators,chunks)=>[...chunks.flatMap(chunk=>[...transformChunkSync(chunk,generators,0)]),...finalChunksSync(generators)],transformChunkSync=function*(chunk,generators,index){if(index===generators.length){yield chunk;return}let{transform=identityGenerator2}=generators[index];for(let transformedChunk of transform(chunk))yield*transformChunkSync(transformedChunk,generators,index+1);},finalChunksSync=function*(generators){for(let[index,{final}]of Object.entries(generators))yield*generatorFinalChunksSync(final,Number(index),generators);},generatorFinalChunksSync=function*(final,index,generators){if(final!==void 0)for(let finalChunk of final())yield*transformChunkSync(finalChunk,generators,index+1);},identityGenerator2=function*(chunk){yield chunk;};var generatorToStream=({value,value:{transform,final,writableObjectMode,readableObjectMode},optionName},{encoding})=>{let state={},generators=addInternalGenerators(value,encoding,optionName),transformAsync=isAsyncGenerator(transform),finalAsync=isAsyncGenerator(final),transformMethod=transformAsync?pushChunks.bind(void 0,transformChunk,state):pushChunksSync.bind(void 0,transformChunkSync),finalMethod=transformAsync||finalAsync?pushChunks.bind(void 0,finalChunks,state):pushChunksSync.bind(void 0,finalChunksSync),destroyMethod=transformAsync||finalAsync?destroyTransform.bind(void 0,state):void 0;return {stream:new stream.Transform({writableObjectMode,writableHighWaterMark:stream.getDefaultHighWaterMark(writableObjectMode),readableObjectMode,readableHighWaterMark:stream.getDefaultHighWaterMark(readableObjectMode),transform(chunk,encoding2,done){transformMethod([chunk,generators,0],this,done);},flush(done){finalMethod([generators],this,done);},destroy:destroyMethod})}},runGeneratorsSync=(chunks,stdioItems,encoding,isInput)=>{let generators=stdioItems.filter(({type})=>type==="generator"),reversedGenerators=isInput?generators.reverse():generators;for(let{value,optionName}of reversedGenerators){let generators2=addInternalGenerators(value,encoding,optionName);chunks=runTransformSync(generators2,chunks);}return chunks},addInternalGenerators=({transform,final,binary,writableObjectMode,readableObjectMode,preserveNewlines},encoding,optionName)=>{let state={};return [{transform:getValidateTransformInput(writableObjectMode,optionName)},getEncodingTransformGenerator(binary,encoding,writableObjectMode),getSplitLinesGenerator(binary,preserveNewlines,writableObjectMode,state),{transform,final},{transform:getValidateTransformReturn(readableObjectMode,optionName)},getAppendNewlineGenerator({binary,preserveNewlines,readableObjectMode,state})].filter(Boolean)};var addInputOptionsSync=(fileDescriptors,options)=>{for(let fdNumber of getInputFdNumbers(fileDescriptors))addInputOptionSync(fileDescriptors,fdNumber,options);},getInputFdNumbers=fileDescriptors=>new Set(Object.entries(fileDescriptors).filter(([,{direction}])=>direction==="input").map(([fdNumber])=>Number(fdNumber))),addInputOptionSync=(fileDescriptors,fdNumber,options)=>{let{stdioItems}=fileDescriptors[fdNumber],allStdioItems=stdioItems.filter(({contents})=>contents!==void 0);if(allStdioItems.length===0)return;if(fdNumber!==0){let[{type,optionName}]=allStdioItems;throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`)}let transformedContents=allStdioItems.map(({contents})=>contents).map(contents=>applySingleInputGeneratorsSync(contents,stdioItems));options.input=joinToUint8Array(transformedContents);},applySingleInputGeneratorsSync=(contents,stdioItems)=>{let newContents=runGeneratorsSync(contents,stdioItems,"utf8",!0);return validateSerializable(newContents),joinToUint8Array(newContents)},validateSerializable=newContents=>{let invalidItem=newContents.find(item=>typeof item!="string"&&!isUint8Array(item));if(invalidItem!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${invalidItem}.`)};var shouldLogOutput=({stdioItems,encoding,verboseInfo,fdNumber})=>fdNumber!=="all"&&isFullVerbose(verboseInfo,fdNumber)&&!BINARY_ENCODINGS.has(encoding)&&fdUsesVerbose(fdNumber)&&(stdioItems.some(({type,value})=>type==="native"&&PIPED_STDIO_VALUES.has(value))||stdioItems.every(({type})=>TRANSFORM_TYPES.has(type))),fdUsesVerbose=fdNumber=>fdNumber===1||fdNumber===2,PIPED_STDIO_VALUES=new Set(["pipe","overlapped"]),logLines=async(linesIterable,stream,fdNumber,verboseInfo)=>{for await(let line of linesIterable)isPipingStream(stream)||logLine(line,fdNumber,verboseInfo);},logLinesSync=(linesArray,fdNumber,verboseInfo)=>{for(let line of linesArray)logLine(line,fdNumber,verboseInfo);},isPipingStream=stream=>stream._readableState.pipes.length>0,logLine=(line,fdNumber,verboseInfo)=>{let verboseMessage=serializeVerboseMessage(line);verboseLog({type:"output",verboseMessage,fdNumber,verboseInfo});};var transformOutputSync=({fileDescriptors,syncResult:{output},options,isMaxBuffer,verboseInfo})=>{if(output===null)return {output:Array.from({length:3})};let state={},outputFiles=new Set([]);return {output:output.map((result,fdNumber)=>transformOutputResultSync({result,fileDescriptors,fdNumber,state,outputFiles,isMaxBuffer,verboseInfo},options)),...state}},transformOutputResultSync=({result,fileDescriptors,fdNumber,state,outputFiles,isMaxBuffer,verboseInfo},{buffer,encoding,lines,stripFinalNewline:stripFinalNewline2,maxBuffer})=>{if(result===null)return;let truncatedResult=truncateMaxBufferSync(result,isMaxBuffer,maxBuffer),uint8ArrayResult=bufferToUint8Array(truncatedResult),{stdioItems,objectMode}=fileDescriptors[fdNumber],chunks=runOutputGeneratorsSync([uint8ArrayResult],stdioItems,encoding,state),{serializedResult,finalResult=serializedResult}=serializeChunks({chunks,objectMode,encoding,lines,stripFinalNewline:stripFinalNewline2,fdNumber});logOutputSync({serializedResult,fdNumber,state,verboseInfo,encoding,stdioItems,objectMode});let returnedResult=buffer[fdNumber]?finalResult:void 0;try{return state.error===void 0&&writeToFiles(serializedResult,stdioItems,outputFiles),returnedResult}catch(error){return state.error=error,returnedResult}},runOutputGeneratorsSync=(chunks,stdioItems,encoding,state)=>{try{return runGeneratorsSync(chunks,stdioItems,encoding,!1)}catch(error){return state.error=error,chunks}},serializeChunks=({chunks,objectMode,encoding,lines,stripFinalNewline:stripFinalNewline2,fdNumber})=>{if(objectMode)return {serializedResult:chunks};if(encoding==="buffer")return {serializedResult:joinToUint8Array(chunks)};let serializedResult=joinToString(chunks,encoding);return lines[fdNumber]?{serializedResult,finalResult:splitLinesSync(serializedResult,!stripFinalNewline2[fdNumber],objectMode)}:{serializedResult}},logOutputSync=({serializedResult,fdNumber,state,verboseInfo,encoding,stdioItems,objectMode})=>{if(!shouldLogOutput({stdioItems,encoding,verboseInfo,fdNumber}))return;let linesArray=splitLinesSync(serializedResult,!1,objectMode);try{logLinesSync(linesArray,fdNumber,verboseInfo);}catch(error){state.error??=error;}},writeToFiles=(serializedResult,stdioItems,outputFiles)=>{for(let{path:path6,append}of stdioItems.filter(({type})=>FILE_TYPES.has(type))){let pathString=typeof path6=="string"?path6:path6.toString();append||outputFiles.has(pathString)?fs.appendFileSync(path6,serializedResult):(outputFiles.add(pathString),fs.writeFileSync(path6,serializedResult));}};var getAllSync=([,stdout,stderr],options)=>{if(options.all)return stdout===void 0?stderr:stderr===void 0?stdout:Array.isArray(stdout)?Array.isArray(stderr)?[...stdout,...stderr]:[...stdout,stripNewline(stderr,options,"all")]:Array.isArray(stderr)?[stripNewline(stdout,options,"all"),...stderr]:isUint8Array(stdout)&&isUint8Array(stderr)?concatUint8Arrays([stdout,stderr]):`${stdout}${stderr}`};var waitForExit=async(subprocess,context)=>{let[exitCode,signal]=await waitForExitOrError(subprocess);return context.isForcefullyTerminated??=!1,[exitCode,signal]},waitForExitOrError=async subprocess=>{let[spawnPayload,exitPayload]=await Promise.allSettled([events.once(subprocess,"spawn"),events.once(subprocess,"exit")]);return spawnPayload.status==="rejected"?[]:exitPayload.status==="rejected"?waitForSubprocessExit(subprocess):exitPayload.value},waitForSubprocessExit=async subprocess=>{try{return await events.once(subprocess,"exit")}catch{return waitForSubprocessExit(subprocess)}},waitForSuccessfulExit=async exitPromise=>{let[exitCode,signal]=await exitPromise;if(!isSubprocessErrorExit(exitCode,signal)&&isFailedExit(exitCode,signal))throw new DiscardedError;return [exitCode,signal]},isSubprocessErrorExit=(exitCode,signal)=>exitCode===void 0&&signal===void 0,isFailedExit=(exitCode,signal)=>exitCode!==0||signal!==null;var getExitResultSync=({error,status:exitCode,signal,output},{maxBuffer})=>{let resultError=getResultError(error,exitCode,signal),timedOut=resultError?.code==="ETIMEDOUT",isMaxBuffer=isMaxBufferSync(resultError,output,maxBuffer);return {resultError,exitCode,signal,timedOut,isMaxBuffer}},getResultError=(error,exitCode,signal)=>error!==void 0?error:isFailedExit(exitCode,signal)?new DiscardedError:void 0;var execaCoreSync=(rawFile,rawArguments,rawOptions)=>{let{file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}=handleSyncArguments(rawFile,rawArguments,rawOptions),result=spawnSubprocessSync({file,commandArguments,options,command,escapedCommand,verboseInfo,fileDescriptors,startTime});return handleResult(result,verboseInfo,options)},handleSyncArguments=(rawFile,rawArguments,rawOptions)=>{let{command,escapedCommand,startTime,verboseInfo}=handleCommand(rawFile,rawArguments,rawOptions),syncOptions=normalizeSyncOptions(rawOptions),{file,commandArguments,options}=normalizeOptions(rawFile,rawArguments,syncOptions);validateSyncOptions(options);let fileDescriptors=handleStdioSync(options,verboseInfo);return {file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}},normalizeSyncOptions=options=>options.node&&!options.ipc?{...options,ipc:!1}:options,validateSyncOptions=({ipc,ipcInput,detached,cancelSignal})=>{ipcInput&&throwInvalidSyncOption("ipcInput"),ipc&&throwInvalidSyncOption("ipc: true"),detached&&throwInvalidSyncOption("detached: true"),cancelSignal&&throwInvalidSyncOption("cancelSignal");},throwInvalidSyncOption=value=>{throw new TypeError(`The "${value}" option cannot be used with synchronous methods.`)},spawnSubprocessSync=({file,commandArguments,options,command,escapedCommand,verboseInfo,fileDescriptors,startTime})=>{let syncResult=runSubprocessSync({file,commandArguments,options,command,escapedCommand,fileDescriptors,startTime});if(syncResult.failed)return syncResult;let{resultError,exitCode,signal,timedOut,isMaxBuffer}=getExitResultSync(syncResult,options),{output,error=resultError}=transformOutputSync({fileDescriptors,syncResult,options,isMaxBuffer,verboseInfo}),stdio=output.map((stdioOutput,fdNumber)=>stripNewline(stdioOutput,options,fdNumber)),all=stripNewline(getAllSync(output,options),options,"all");return getSyncResult({error,exitCode,signal,timedOut,isMaxBuffer,stdio,all,options,command,escapedCommand,startTime})},runSubprocessSync=({file,commandArguments,options,command,escapedCommand,fileDescriptors,startTime})=>{try{addInputOptionsSync(fileDescriptors,options);let normalizedOptions=normalizeSpawnSyncOptions(options);return child_process.spawnSync(file,commandArguments,normalizedOptions)}catch(error){return makeEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,isSync:!0})}},normalizeSpawnSyncOptions=({encoding,maxBuffer,...options})=>({...options,encoding:"buffer",maxBuffer:getMaxBufferSync(maxBuffer)}),getSyncResult=({error,exitCode,signal,timedOut,isMaxBuffer,stdio,all,options,command,escapedCommand,startTime})=>error===void 0?makeSuccessResult({command,escapedCommand,stdio,all,ipcOutput:[],options,startTime}):makeError({error,command,escapedCommand,timedOut,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer,isForcefullyTerminated:!1,exitCode,signal,stdio,all,ipcOutput:[],options,startTime,isSync:!0});var getOneMessage=({anyProcess,channel,isSubprocess,ipc},{reference=!0,filter}={})=>(validateIpcMethod({methodName:"getOneMessage",isSubprocess,ipc,isConnected:isConnected(anyProcess)}),getOneMessageAsync({anyProcess,channel,isSubprocess,filter,reference})),getOneMessageAsync=async({anyProcess,channel,isSubprocess,filter,reference})=>{addReference(channel,reference);let ipcEmitter=getIpcEmitter(anyProcess,channel,isSubprocess),controller=new AbortController;try{return await Promise.race([getMessage(ipcEmitter,filter,controller),throwOnDisconnect2(ipcEmitter,isSubprocess,controller),throwOnStrictError(ipcEmitter,isSubprocess,controller)])}catch(error){throw disconnect(anyProcess),error}finally{controller.abort(),removeReference(channel,reference);}},getMessage=async(ipcEmitter,filter,{signal})=>{if(filter===void 0){let[message]=await events.once(ipcEmitter,"message",{signal});return message}for await(let[message]of events.on(ipcEmitter,"message",{signal}))if(filter(message))return message},throwOnDisconnect2=async(ipcEmitter,isSubprocess,{signal})=>{await events.once(ipcEmitter,"disconnect",{signal}),throwOnEarlyDisconnect(isSubprocess);},throwOnStrictError=async(ipcEmitter,isSubprocess,{signal})=>{let[error]=await events.once(ipcEmitter,"strict:error",{signal});throw getStrictResponseError(error,isSubprocess)};var getEachMessage=({anyProcess,channel,isSubprocess,ipc},{reference=!0}={})=>loopOnMessages({anyProcess,channel,isSubprocess,ipc,shouldAwait:!isSubprocess,reference}),loopOnMessages=({anyProcess,channel,isSubprocess,ipc,shouldAwait,reference})=>{validateIpcMethod({methodName:"getEachMessage",isSubprocess,ipc,isConnected:isConnected(anyProcess)}),addReference(channel,reference);let ipcEmitter=getIpcEmitter(anyProcess,channel,isSubprocess),controller=new AbortController,state={};return stopOnDisconnect(anyProcess,ipcEmitter,controller),abortOnStrictError({ipcEmitter,isSubprocess,controller,state}),iterateOnMessages({anyProcess,channel,ipcEmitter,isSubprocess,shouldAwait,controller,state,reference})},stopOnDisconnect=async(anyProcess,ipcEmitter,controller)=>{try{await events.once(ipcEmitter,"disconnect",{signal:controller.signal}),controller.abort();}catch{}},abortOnStrictError=async({ipcEmitter,isSubprocess,controller,state})=>{try{let[error]=await events.once(ipcEmitter,"strict:error",{signal:controller.signal});state.error=getStrictResponseError(error,isSubprocess),controller.abort();}catch{}},iterateOnMessages=async function*({anyProcess,channel,ipcEmitter,isSubprocess,shouldAwait,controller,state,reference}){try{for await(let[message]of events.on(ipcEmitter,"message",{signal:controller.signal}))throwIfStrictError(state),yield message;}catch{throwIfStrictError(state);}finally{controller.abort(),removeReference(channel,reference),isSubprocess||disconnect(anyProcess),shouldAwait&&await anyProcess;}},throwIfStrictError=({error})=>{if(error)throw error};var addIpcMethods=(subprocess,{ipc})=>{Object.assign(subprocess,getIpcMethods(subprocess,!1,ipc));},getIpcExport=()=>{let anyProcess=process4__default.default,isSubprocess=!0,ipc=process4__default.default.channel!==void 0;return {...getIpcMethods(anyProcess,isSubprocess,ipc),getCancelSignal:getCancelSignal.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc})}},getIpcMethods=(anyProcess,isSubprocess,ipc)=>({sendMessage:sendMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc}),getOneMessage:getOneMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc}),getEachMessage:getEachMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc})});var handleEarlyError=({error,command,escapedCommand,fileDescriptors,options,startTime,verboseInfo})=>{cleanupCustomStreams(fileDescriptors);let subprocess=new child_process.ChildProcess;createDummyStreams(subprocess,fileDescriptors),Object.assign(subprocess,{readable,writable,duplex});let earlyError=makeEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,isSync:!1}),promise=handleDummyPromise(earlyError,verboseInfo,options);return {subprocess,promise}},createDummyStreams=(subprocess,fileDescriptors)=>{let stdin=createDummyStream(),stdout=createDummyStream(),stderr=createDummyStream(),extraStdio=Array.from({length:fileDescriptors.length-3},createDummyStream),all=createDummyStream(),stdio=[stdin,stdout,stderr,...extraStdio];Object.assign(subprocess,{stdin,stdout,stderr,all,stdio});},createDummyStream=()=>{let stream$1=new stream.PassThrough;return stream$1.end(),stream$1},readable=()=>new stream.Readable({read(){}}),writable=()=>new stream.Writable({write(){}}),duplex=()=>new stream.Duplex({read(){},write(){}}),handleDummyPromise=async(error,verboseInfo,options)=>handleResult(error,verboseInfo,options);var handleStdioAsync=(options,verboseInfo)=>handleStdio(addPropertiesAsync,options,verboseInfo,!1),forbiddenIfAsync=({type,optionName})=>{throw new TypeError(`The \`${optionName}\` option cannot be ${TYPE_TO_MESSAGE[type]}.`)},addProperties2={fileNumber:forbiddenIfAsync,generator:generatorToStream,asyncGenerator:generatorToStream,nodeStream:({value})=>({stream:value}),webTransform({value:{transform,writableObjectMode,readableObjectMode}}){let objectMode=writableObjectMode||readableObjectMode;return {stream:stream.Duplex.fromWeb(transform,{objectMode})}},duplex:({value:{transform}})=>({stream:transform}),native(){}},addPropertiesAsync={input:{...addProperties2,fileUrl:({value})=>({stream:fs.createReadStream(value)}),filePath:({value:{file}})=>({stream:fs.createReadStream(file)}),webStream:({value})=>({stream:stream.Readable.fromWeb(value)}),iterable:({value})=>({stream:stream.Readable.from(value)}),asyncIterable:({value})=>({stream:stream.Readable.from(value)}),string:({value})=>({stream:stream.Readable.from(value)}),uint8Array:({value})=>({stream:stream.Readable.from(buffer.Buffer.from(value))})},output:{...addProperties2,fileUrl:({value})=>({stream:fs.createWriteStream(value)}),filePath:({value:{file,append}})=>({stream:fs.createWriteStream(file,append?{flags:"a"}:{})}),webStream:({value})=>({stream:stream.Writable.fromWeb(value)}),iterable:forbiddenIfAsync,asyncIterable:forbiddenIfAsync,string:forbiddenIfAsync,uint8Array:forbiddenIfAsync}};function mergeStreams(streams){if(!Array.isArray(streams))throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);for(let stream of streams)validateStream(stream);let objectMode=streams.some(({readableObjectMode})=>readableObjectMode),highWaterMark=getHighWaterMark(streams,objectMode),passThroughStream=new MergedStream({objectMode,writableHighWaterMark:highWaterMark,readableHighWaterMark:highWaterMark});for(let stream of streams)passThroughStream.add(stream);return passThroughStream}var getHighWaterMark=(streams,objectMode)=>{if(streams.length===0)return stream.getDefaultHighWaterMark(objectMode);let highWaterMarks=streams.filter(({readableObjectMode})=>readableObjectMode===objectMode).map(({readableHighWaterMark})=>readableHighWaterMark);return Math.max(...highWaterMarks)},MergedStream=class extends stream.PassThrough{#streams=new Set([]);#ended=new Set([]);#aborted=new Set([]);#onFinished;#unpipeEvent=Symbol("unpipe");#streamPromises=new WeakMap;add(stream){if(validateStream(stream),this.#streams.has(stream))return;this.#streams.add(stream),this.#onFinished??=onMergedStreamFinished(this,this.#streams,this.#unpipeEvent);let streamPromise=endWhenStreamsDone({passThroughStream:this,stream,streams:this.#streams,ended:this.#ended,aborted:this.#aborted,onFinished:this.#onFinished,unpipeEvent:this.#unpipeEvent});this.#streamPromises.set(stream,streamPromise),stream.pipe(this,{end:!1});}async remove(stream){if(validateStream(stream),!this.#streams.has(stream))return !1;let streamPromise=this.#streamPromises.get(stream);return streamPromise===void 0?!1:(this.#streamPromises.delete(stream),stream.unpipe(this),await streamPromise,!0)}},onMergedStreamFinished=async(passThroughStream,streams,unpipeEvent)=>{updateMaxListeners(passThroughStream,PASSTHROUGH_LISTENERS_COUNT);let controller=new AbortController;try{await Promise.race([onMergedStreamEnd(passThroughStream,controller),onInputStreamsUnpipe(passThroughStream,streams,unpipeEvent,controller)]);}finally{controller.abort(),updateMaxListeners(passThroughStream,-PASSTHROUGH_LISTENERS_COUNT);}},onMergedStreamEnd=async(passThroughStream,{signal})=>{try{await promises.finished(passThroughStream,{signal,cleanup:!0});}catch(error){throw errorOrAbortStream(passThroughStream,error),error}},onInputStreamsUnpipe=async(passThroughStream,streams,unpipeEvent,{signal})=>{for await(let[unpipedStream]of events.on(passThroughStream,"unpipe",{signal}))streams.has(unpipedStream)&&unpipedStream.emit(unpipeEvent);},validateStream=stream=>{if(typeof stream?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`)},endWhenStreamsDone=async({passThroughStream,stream,streams,ended,aborted:aborted2,onFinished,unpipeEvent})=>{updateMaxListeners(passThroughStream,PASSTHROUGH_LISTENERS_PER_STREAM);let controller=new AbortController;try{await Promise.race([afterMergedStreamFinished(onFinished,stream,controller),onInputStreamEnd({passThroughStream,stream,streams,ended,aborted:aborted2,controller}),onInputStreamUnpipe({stream,streams,ended,aborted:aborted2,unpipeEvent,controller})]);}finally{controller.abort(),updateMaxListeners(passThroughStream,-PASSTHROUGH_LISTENERS_PER_STREAM);}streams.size>0&&streams.size===ended.size+aborted2.size&&(ended.size===0&&aborted2.size>0?abortStream(passThroughStream):endStream(passThroughStream));},afterMergedStreamFinished=async(onFinished,stream,{signal})=>{try{await onFinished,signal.aborted||abortStream(stream);}catch(error){signal.aborted||errorOrAbortStream(stream,error);}},onInputStreamEnd=async({passThroughStream,stream,streams,ended,aborted:aborted2,controller:{signal}})=>{try{await promises.finished(stream,{signal,cleanup:!0,readable:!0,writable:!1}),streams.has(stream)&&ended.add(stream);}catch(error){if(signal.aborted||!streams.has(stream))return;isAbortError(error)?aborted2.add(stream):errorStream(passThroughStream,error);}},onInputStreamUnpipe=async({stream,streams,ended,aborted:aborted2,unpipeEvent,controller:{signal}})=>{if(await events.once(stream,unpipeEvent,{signal}),!stream.readable)return events.once(signal,"abort",{signal});streams.delete(stream),ended.delete(stream),aborted2.delete(stream);},endStream=stream=>{stream.writable&&stream.end();},errorOrAbortStream=(stream,error)=>{isAbortError(error)?abortStream(stream):errorStream(stream,error);},isAbortError=error=>error?.code==="ERR_STREAM_PREMATURE_CLOSE",abortStream=stream=>{(stream.readable||stream.writable)&&stream.destroy();},errorStream=(stream,error)=>{stream.destroyed||(stream.once("error",noop2),stream.destroy(error));},noop2=()=>{},updateMaxListeners=(passThroughStream,increment2)=>{let maxListeners=passThroughStream.getMaxListeners();maxListeners!==0&&maxListeners!==Number.POSITIVE_INFINITY&&passThroughStream.setMaxListeners(maxListeners+increment2);},PASSTHROUGH_LISTENERS_COUNT=2,PASSTHROUGH_LISTENERS_PER_STREAM=1;var pipeStreams=(source,destination)=>{source.pipe(destination),onSourceFinish(source,destination),onDestinationFinish(source,destination);},onSourceFinish=async(source,destination)=>{if(!(isStandardStream(source)||isStandardStream(destination))){try{await promises.finished(source,{cleanup:!0,readable:!0,writable:!1});}catch{}endDestinationStream(destination);}},endDestinationStream=destination=>{destination.writable&&destination.end();},onDestinationFinish=async(source,destination)=>{if(!(isStandardStream(source)||isStandardStream(destination))){try{await promises.finished(destination,{cleanup:!0,readable:!1,writable:!0});}catch{}abortSourceStream(source);}},abortSourceStream=source=>{source.readable&&source.destroy();};var pipeOutputAsync=(subprocess,fileDescriptors,controller)=>{let pipeGroups=new Map;for(let[fdNumber,{stdioItems,direction}]of Object.entries(fileDescriptors)){for(let{stream}of stdioItems.filter(({type})=>TRANSFORM_TYPES.has(type)))pipeTransform(subprocess,stream,direction,fdNumber);for(let{stream}of stdioItems.filter(({type})=>!TRANSFORM_TYPES.has(type)))pipeStdioItem({subprocess,stream,direction,fdNumber,pipeGroups,controller});}for(let[outputStream,inputStreams]of pipeGroups.entries()){let inputStream=inputStreams.length===1?inputStreams[0]:mergeStreams(inputStreams);pipeStreams(inputStream,outputStream);}},pipeTransform=(subprocess,stream,direction,fdNumber)=>{direction==="output"?pipeStreams(subprocess.stdio[fdNumber],stream):pipeStreams(stream,subprocess.stdio[fdNumber]);let streamProperty=SUBPROCESS_STREAM_PROPERTIES[fdNumber];streamProperty!==void 0&&(subprocess[streamProperty]=stream),subprocess.stdio[fdNumber]=stream;},SUBPROCESS_STREAM_PROPERTIES=["stdin","stdout","stderr"],pipeStdioItem=({subprocess,stream,direction,fdNumber,pipeGroups,controller})=>{if(stream===void 0)return;setStandardStreamMaxListeners(stream,controller);let[inputStream,outputStream]=direction==="output"?[stream,subprocess.stdio[fdNumber]]:[subprocess.stdio[fdNumber],stream],outputStreams=pipeGroups.get(inputStream)??[];pipeGroups.set(inputStream,[...outputStreams,outputStream]);},setStandardStreamMaxListeners=(stream,{signal})=>{isStandardStream(stream)&&incrementMaxListeners(stream,MAX_LISTENERS_INCREMENT,signal);},MAX_LISTENERS_INCREMENT=2;var signals=[];signals.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&signals.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var processOk=process10=>!!process10&&typeof process10=="object"&&typeof process10.removeListener=="function"&&typeof process10.emit=="function"&&typeof process10.reallyExit=="function"&&typeof process10.listeners=="function"&&typeof process10.kill=="function"&&typeof process10.pid=="number"&&typeof process10.on=="function",kExitEmitter=Symbol.for("signal-exit emitter"),global2=globalThis,ObjectDefineProperty=Object.defineProperty.bind(Object),Emitter=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(global2[kExitEmitter])return global2[kExitEmitter];ObjectDefineProperty(global2,kExitEmitter,{value:this,writable:!1,enumerable:!1,configurable:!1});}on(ev,fn){this.listeners[ev].push(fn);}removeListener(ev,fn){let list=this.listeners[ev],i2=list.indexOf(fn);i2!==-1&&(i2===0&&list.length===1?list.length=0:list.splice(i2,1));}emit(ev,code,signal){if(this.emitted[ev])return !1;this.emitted[ev]=!0;let ret=!1;for(let fn of this.listeners[ev])ret=fn(code,signal)===!0||ret;return ev==="exit"&&(ret=this.emit("afterExit",code,signal)||ret),ret}},SignalExitBase=class{},signalExitWrap=handler=>({onExit(cb,opts){return handler.onExit(cb,opts)},load(){return handler.load()},unload(){return handler.unload()}}),SignalExitFallback=class extends SignalExitBase{onExit(){return ()=>{}}load(){}unload(){}},SignalExit=class extends SignalExitBase{#hupSig=process9.platform==="win32"?"SIGINT":"SIGHUP";#emitter=new Emitter;#process;#originalProcessEmit;#originalProcessReallyExit;#sigListeners={};#loaded=!1;constructor(process10){super(),this.#process=process10,this.#sigListeners={};for(let sig of signals)this.#sigListeners[sig]=()=>{let listeners=this.#process.listeners(sig),{count:count2}=this.#emitter,p=process10;if(typeof p.__signal_exit_emitter__=="object"&&typeof p.__signal_exit_emitter__.count=="number"&&(count2+=p.__signal_exit_emitter__.count),listeners.length===count2){this.unload();let ret=this.#emitter.emit("exit",null,sig),s=sig==="SIGHUP"?this.#hupSig:sig;ret||process10.kill(process10.pid,s);}};this.#originalProcessReallyExit=process10.reallyExit,this.#originalProcessEmit=process10.emit;}onExit(cb,opts){if(!processOk(this.#process))return ()=>{};this.#loaded===!1&&this.load();let ev=opts?.alwaysLast?"afterExit":"exit";return this.#emitter.on(ev,cb),()=>{this.#emitter.removeListener(ev,cb),this.#emitter.listeners.exit.length===0&&this.#emitter.listeners.afterExit.length===0&&this.unload();}}load(){if(!this.#loaded){this.#loaded=!0,this.#emitter.count+=1;for(let sig of signals)try{let fn=this.#sigListeners[sig];fn&&this.#process.on(sig,fn);}catch{}this.#process.emit=(ev,...a2)=>this.#processEmit(ev,...a2),this.#process.reallyExit=code=>this.#processReallyExit(code);}}unload(){this.#loaded&&(this.#loaded=!1,signals.forEach(sig=>{let listener=this.#sigListeners[sig];if(!listener)throw new Error("Listener not defined for signal: "+sig);try{this.#process.removeListener(sig,listener);}catch{}}),this.#process.emit=this.#originalProcessEmit,this.#process.reallyExit=this.#originalProcessReallyExit,this.#emitter.count-=1);}#processReallyExit(code){return processOk(this.#process)?(this.#process.exitCode=code||0,this.#emitter.emit("exit",this.#process.exitCode,null),this.#originalProcessReallyExit.call(this.#process,this.#process.exitCode)):0}#processEmit(ev,...args){let og=this.#originalProcessEmit;if(ev==="exit"&&processOk(this.#process)){typeof args[0]=="number"&&(this.#process.exitCode=args[0]);let ret=og.call(this.#process,ev,...args);return this.#emitter.emit("exit",this.#process.exitCode,null),ret}else return og.call(this.#process,ev,...args)}},process9=globalThis.process,{onExit,load,unload}=signalExitWrap(processOk(process9)?new SignalExit(process9):new SignalExitFallback);var cleanupOnExit=(subprocess,{cleanup,detached},{signal})=>{if(!cleanup||detached)return;let removeExitHandler=onExit(()=>{subprocess.kill();});events.addAbortListener(signal,()=>{removeExitHandler();});};var normalizePipeArguments=({source,sourcePromise,boundOptions,createNested},...pipeArguments)=>{let startTime=getStartTime(),{destination,destinationStream,destinationError,from,unpipeSignal}=getDestinationStream(boundOptions,createNested,pipeArguments),{sourceStream,sourceError}=getSourceStream(source,from),{options:sourceOptions,fileDescriptors}=SUBPROCESS_OPTIONS.get(source);return {sourcePromise,sourceStream,sourceOptions,sourceError,destination,destinationStream,destinationError,unpipeSignal,fileDescriptors,startTime}},getDestinationStream=(boundOptions,createNested,pipeArguments)=>{try{let{destination,pipeOptions:{from,to,unpipeSignal}={}}=getDestination(boundOptions,createNested,...pipeArguments),destinationStream=getToStream(destination,to);return {destination,destinationStream,from,unpipeSignal}}catch(error){return {destinationError:error}}},getDestination=(boundOptions,createNested,firstArgument,...pipeArguments)=>{if(Array.isArray(firstArgument))return {destination:createNested(mapDestinationArguments,boundOptions)(firstArgument,...pipeArguments),pipeOptions:boundOptions};if(typeof firstArgument=="string"||firstArgument instanceof URL||isDenoExecPath(firstArgument)){if(Object.keys(boundOptions).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[rawFile,rawArguments,rawOptions]=normalizeParameters(firstArgument,...pipeArguments);return {destination:createNested(mapDestinationArguments)(rawFile,rawArguments,rawOptions),pipeOptions:rawOptions}}if(SUBPROCESS_OPTIONS.has(firstArgument)){if(Object.keys(boundOptions).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return {destination:firstArgument,pipeOptions:pipeArguments[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${firstArgument}`)},mapDestinationArguments=({options})=>({options:{...options,stdin:"pipe",piped:!0}}),getSourceStream=(source,from)=>{try{return {sourceStream:getFromStream(source,from)}}catch(error){return {sourceError:error}}};var handlePipeArgumentsError=({sourceStream,sourceError,destinationStream,destinationError,fileDescriptors,sourceOptions,startTime})=>{let error=getPipeArgumentsError({sourceStream,sourceError,destinationStream,destinationError});if(error!==void 0)throw createNonCommandError({error,fileDescriptors,sourceOptions,startTime})},getPipeArgumentsError=({sourceStream,sourceError,destinationStream,destinationError})=>{if(sourceError!==void 0&&destinationError!==void 0)return destinationError;if(destinationError!==void 0)return abortSourceStream(sourceStream),destinationError;if(sourceError!==void 0)return endDestinationStream(destinationStream),sourceError},createNonCommandError=({error,fileDescriptors,sourceOptions,startTime})=>makeEarlyError({error,command:PIPE_COMMAND_MESSAGE,escapedCommand:PIPE_COMMAND_MESSAGE,fileDescriptors,options:sourceOptions,startTime,isSync:!1}),PIPE_COMMAND_MESSAGE="source.pipe(destination)";var waitForBothSubprocesses=async subprocessPromises=>{let[{status:sourceStatus,reason:sourceReason,value:sourceResult=sourceReason},{status:destinationStatus,reason:destinationReason,value:destinationResult=destinationReason}]=await subprocessPromises;if(destinationResult.pipedFrom.includes(sourceResult)||destinationResult.pipedFrom.push(sourceResult),destinationStatus==="rejected")throw destinationResult;if(sourceStatus==="rejected")throw sourceResult;return destinationResult};var pipeSubprocessStream=(sourceStream,destinationStream,maxListenersController)=>{let mergedStream=MERGED_STREAMS.has(destinationStream)?pipeMoreSubprocessStream(sourceStream,destinationStream):pipeFirstSubprocessStream(sourceStream,destinationStream);return incrementMaxListeners(sourceStream,SOURCE_LISTENERS_PER_PIPE,maxListenersController.signal),incrementMaxListeners(destinationStream,DESTINATION_LISTENERS_PER_PIPE,maxListenersController.signal),cleanupMergedStreamsMap(destinationStream),mergedStream},pipeFirstSubprocessStream=(sourceStream,destinationStream)=>{let mergedStream=mergeStreams([sourceStream]);return pipeStreams(mergedStream,destinationStream),MERGED_STREAMS.set(destinationStream,mergedStream),mergedStream},pipeMoreSubprocessStream=(sourceStream,destinationStream)=>{let mergedStream=MERGED_STREAMS.get(destinationStream);return mergedStream.add(sourceStream),mergedStream},cleanupMergedStreamsMap=async destinationStream=>{try{await promises.finished(destinationStream,{cleanup:!0,readable:!1,writable:!0});}catch{}MERGED_STREAMS.delete(destinationStream);},MERGED_STREAMS=new WeakMap,SOURCE_LISTENERS_PER_PIPE=2,DESTINATION_LISTENERS_PER_PIPE=1;var unpipeOnAbort=(unpipeSignal,unpipeContext)=>unpipeSignal===void 0?[]:[unpipeOnSignalAbort(unpipeSignal,unpipeContext)],unpipeOnSignalAbort=async(unpipeSignal,{sourceStream,mergedStream,fileDescriptors,sourceOptions,startTime})=>{await util.aborted(unpipeSignal,sourceStream),await mergedStream.remove(sourceStream);let error=new Error("Pipe canceled by `unpipeSignal` option.");throw createNonCommandError({error,fileDescriptors,sourceOptions,startTime})};var pipeToSubprocess=(sourceInfo,...pipeArguments)=>{if(isPlainObject(pipeArguments[0]))return pipeToSubprocess.bind(void 0,{...sourceInfo,boundOptions:{...sourceInfo.boundOptions,...pipeArguments[0]}});let{destination,...normalizedInfo}=normalizePipeArguments(sourceInfo,...pipeArguments),promise=handlePipePromise({...normalizedInfo,destination});return promise.pipe=pipeToSubprocess.bind(void 0,{...sourceInfo,source:destination,sourcePromise:promise,boundOptions:{}}),promise},handlePipePromise=async({sourcePromise,sourceStream,sourceOptions,sourceError,destination,destinationStream,destinationError,unpipeSignal,fileDescriptors,startTime})=>{let subprocessPromises=getSubprocessPromises(sourcePromise,destination);handlePipeArgumentsError({sourceStream,sourceError,destinationStream,destinationError,fileDescriptors,sourceOptions,startTime});let maxListenersController=new AbortController;try{let mergedStream=pipeSubprocessStream(sourceStream,destinationStream,maxListenersController);return await Promise.race([waitForBothSubprocesses(subprocessPromises),...unpipeOnAbort(unpipeSignal,{sourceStream,mergedStream,sourceOptions,fileDescriptors,startTime})])}finally{maxListenersController.abort();}},getSubprocessPromises=(sourcePromise,destination)=>Promise.allSettled([sourcePromise,destination]);var iterateOnSubprocessStream=({subprocessStdout,subprocess,binary,shouldEncode,encoding,preserveNewlines})=>{let controller=new AbortController;return stopReadingOnExit(subprocess,controller),iterateOnStream({stream:subprocessStdout,controller,binary,shouldEncode:!subprocessStdout.readableObjectMode&&shouldEncode,encoding,shouldSplit:!subprocessStdout.readableObjectMode,preserveNewlines})},stopReadingOnExit=async(subprocess,controller)=>{try{await subprocess;}catch{}finally{controller.abort();}},iterateForResult=({stream,onStreamEnd,lines,encoding,stripFinalNewline:stripFinalNewline2,allMixed})=>{let controller=new AbortController;stopReadingOnStreamEnd(onStreamEnd,controller,stream);let objectMode=stream.readableObjectMode&&!allMixed;return iterateOnStream({stream,controller,binary:encoding==="buffer",shouldEncode:!objectMode,encoding,shouldSplit:!objectMode&&lines,preserveNewlines:!stripFinalNewline2})},stopReadingOnStreamEnd=async(onStreamEnd,controller,stream)=>{try{await onStreamEnd;}catch{stream.destroy();}finally{controller.abort();}},iterateOnStream=({stream,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines})=>{let onStdoutChunk=events.on(stream,"data",{signal:controller.signal,highWaterMark:HIGH_WATER_MARK,highWatermark:HIGH_WATER_MARK});return iterateOnData({onStdoutChunk,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines})},DEFAULT_OBJECT_HIGH_WATER_MARK=stream.getDefaultHighWaterMark(!0),HIGH_WATER_MARK=DEFAULT_OBJECT_HIGH_WATER_MARK,iterateOnData=async function*({onStdoutChunk,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines}){let generators=getGenerators({binary,shouldEncode,encoding,shouldSplit,preserveNewlines});try{for await(let[chunk]of onStdoutChunk)yield*transformChunkSync(chunk,generators,0);}catch(error){if(!controller.signal.aborted)throw error}finally{yield*finalChunksSync(generators);}},getGenerators=({binary,shouldEncode,encoding,shouldSplit,preserveNewlines})=>[getEncodingTransformGenerator(binary,encoding,!shouldEncode),getSplitLinesGenerator(binary,preserveNewlines,!shouldSplit,{})].filter(Boolean);var getStreamOutput=async({stream,onStreamEnd,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>{let logPromise=logOutputAsync({stream,onStreamEnd,fdNumber,encoding,allMixed,verboseInfo,streamInfo});if(!buffer){await Promise.all([resumeStream(stream),logPromise]);return}let stripFinalNewlineValue=getStripFinalNewline(stripFinalNewline2,fdNumber),iterable=iterateForResult({stream,onStreamEnd,lines,encoding,stripFinalNewline:stripFinalNewlineValue,allMixed}),[output]=await Promise.all([getStreamContents2({stream,iterable,fdNumber,encoding,maxBuffer,lines}),logPromise]);return output},logOutputAsync=async({stream,onStreamEnd,fdNumber,encoding,allMixed,verboseInfo,streamInfo:{fileDescriptors}})=>{if(!shouldLogOutput({stdioItems:fileDescriptors[fdNumber]?.stdioItems,encoding,verboseInfo,fdNumber}))return;let linesIterable=iterateForResult({stream,onStreamEnd,lines:!0,encoding,stripFinalNewline:!0,allMixed});await logLines(linesIterable,stream,fdNumber,verboseInfo);},resumeStream=async stream=>{await promises$1.setImmediate(),stream.readableFlowing===null&&stream.resume();},getStreamContents2=async({stream,stream:{readableObjectMode},iterable,fdNumber,encoding,maxBuffer,lines})=>{try{return readableObjectMode||lines?await getStreamAsArray(iterable,{maxBuffer}):encoding==="buffer"?new Uint8Array(await getStreamAsArrayBuffer(iterable,{maxBuffer})):await getStreamAsString(iterable,{maxBuffer})}catch(error){return handleBufferedData(handleMaxBuffer({error,stream,readableObjectMode,lines,encoding,fdNumber}))}},getBufferedData=async streamPromise=>{try{return await streamPromise}catch(error){return handleBufferedData(error)}},handleBufferedData=({bufferedData})=>isArrayBuffer(bufferedData)?new Uint8Array(bufferedData):bufferedData;var waitForStream=async(stream,fdNumber,streamInfo,{isSameDirection,stopOnExit=!1}={})=>{let state=handleStdinDestroy(stream,streamInfo),abortController=new AbortController;try{await Promise.race([...stopOnExit?[streamInfo.exitPromise]:[],promises.finished(stream,{cleanup:!0,signal:abortController.signal})]);}catch(error){state.stdinCleanedUp||handleStreamError(error,fdNumber,streamInfo,isSameDirection);}finally{abortController.abort();}},handleStdinDestroy=(stream,{originalStreams:[originalStdin],subprocess})=>{let state={stdinCleanedUp:!1};return stream===originalStdin&&spyOnStdinDestroy(stream,subprocess,state),state},spyOnStdinDestroy=(subprocessStdin,subprocess,state)=>{let{_destroy}=subprocessStdin;subprocessStdin._destroy=(...destroyArguments)=>{setStdinCleanedUp(subprocess,state),_destroy.call(subprocessStdin,...destroyArguments);};},setStdinCleanedUp=({exitCode,signalCode},state)=>{(exitCode!==null||signalCode!==null)&&(state.stdinCleanedUp=!0);},handleStreamError=(error,fdNumber,streamInfo,isSameDirection)=>{if(!shouldIgnoreStreamError(error,fdNumber,streamInfo,isSameDirection))throw error},shouldIgnoreStreamError=(error,fdNumber,streamInfo,isSameDirection=!0)=>streamInfo.propagating?isStreamEpipe(error)||isStreamAbort(error):(streamInfo.propagating=!0,isInputFileDescriptor(streamInfo,fdNumber)===isSameDirection?isStreamEpipe(error):isStreamAbort(error)),isInputFileDescriptor=({fileDescriptors},fdNumber)=>fdNumber!=="all"&&fileDescriptors[fdNumber].direction==="input",isStreamAbort=error=>error?.code==="ERR_STREAM_PREMATURE_CLOSE",isStreamEpipe=error=>error?.code==="EPIPE";var waitForStdioStreams=({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>subprocess.stdio.map((stream,fdNumber)=>waitForSubprocessStream({stream,fdNumber,encoding,buffer:buffer[fdNumber],maxBuffer:maxBuffer[fdNumber],lines:lines[fdNumber],allMixed:!1,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})),waitForSubprocessStream=async({stream,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>{if(!stream)return;let onStreamEnd=waitForStream(stream,fdNumber,streamInfo);if(isInputFileDescriptor(streamInfo,fdNumber)){await onStreamEnd;return}let[output]=await Promise.all([getStreamOutput({stream,onStreamEnd,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),onStreamEnd]);return output};var makeAllStream=({stdout,stderr},{all})=>all&&(stdout||stderr)?mergeStreams([stdout,stderr].filter(Boolean)):void 0,waitForAllStream=({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>waitForSubprocessStream({...getAllStream(subprocess,buffer),fdNumber:"all",encoding,maxBuffer:maxBuffer[1]+maxBuffer[2],lines:lines[1]||lines[2],allMixed:getAllMixed(subprocess),stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),getAllStream=({stdout,stderr,all},[,bufferStdout,bufferStderr])=>{let buffer=bufferStdout||bufferStderr;return buffer?bufferStdout?bufferStderr?{stream:all,buffer}:{stream:stdout,buffer}:{stream:stderr,buffer}:{stream:all,buffer}},getAllMixed=({all,stdout,stderr})=>all&&stdout&&stderr&&stdout.readableObjectMode!==stderr.readableObjectMode;var shouldLogIpc=verboseInfo=>isFullVerbose(verboseInfo,"ipc"),logIpcOutput=(message,verboseInfo)=>{let verboseMessage=serializeVerboseMessage(message);verboseLog({type:"ipc",verboseMessage,fdNumber:"ipc",verboseInfo});};var waitForIpcOutput=async({subprocess,buffer:bufferArray,maxBuffer:maxBufferArray,ipc,ipcOutput,verboseInfo})=>{if(!ipc)return ipcOutput;let isVerbose2=shouldLogIpc(verboseInfo),buffer=getFdSpecificValue(bufferArray,"ipc"),maxBuffer=getFdSpecificValue(maxBufferArray,"ipc");for await(let message of loopOnMessages({anyProcess:subprocess,channel:subprocess.channel,isSubprocess:!1,ipc,shouldAwait:!1,reference:!0}))buffer&&(checkIpcMaxBuffer(subprocess,ipcOutput,maxBuffer),ipcOutput.push(message)),isVerbose2&&logIpcOutput(message,verboseInfo);return ipcOutput},getBufferedIpcOutput=async(ipcOutputPromise,ipcOutput)=>(await Promise.allSettled([ipcOutputPromise]),ipcOutput);var waitForSubprocessResult=async({subprocess,options:{encoding,buffer,maxBuffer,lines,timeoutDuration:timeout,cancelSignal,gracefulCancel,forceKillAfterDelay,stripFinalNewline:stripFinalNewline2,ipc,ipcInput},context,verboseInfo,fileDescriptors,originalStreams,onInternalError,controller})=>{let exitPromise=waitForExit(subprocess,context),streamInfo={originalStreams,fileDescriptors,subprocess,exitPromise,propagating:!1},stdioPromises=waitForStdioStreams({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),allPromise=waitForAllStream({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),ipcOutput=[],ipcOutputPromise=waitForIpcOutput({subprocess,buffer,maxBuffer,ipc,ipcOutput,verboseInfo}),originalPromises=waitForOriginalStreams(originalStreams,subprocess,streamInfo),customStreamsEndPromises=waitForCustomStreamsEnd(fileDescriptors,streamInfo);try{return await Promise.race([Promise.all([{},waitForSuccessfulExit(exitPromise),Promise.all(stdioPromises),allPromise,ipcOutputPromise,sendIpcInput(subprocess,ipcInput),...originalPromises,...customStreamsEndPromises]),onInternalError,throwOnSubprocessError(subprocess,controller),...throwOnTimeout(subprocess,timeout,context,controller),...throwOnCancel({subprocess,cancelSignal,gracefulCancel,context,controller}),...throwOnGracefulCancel({subprocess,cancelSignal,gracefulCancel,forceKillAfterDelay,context,controller})])}catch(error){return context.terminationReason??="other",Promise.all([{error},exitPromise,Promise.all(stdioPromises.map(stdioPromise=>getBufferedData(stdioPromise))),getBufferedData(allPromise),getBufferedIpcOutput(ipcOutputPromise,ipcOutput),Promise.allSettled(originalPromises),Promise.allSettled(customStreamsEndPromises)])}},waitForOriginalStreams=(originalStreams,subprocess,streamInfo)=>originalStreams.map((stream,fdNumber)=>stream===subprocess.stdio[fdNumber]?void 0:waitForStream(stream,fdNumber,streamInfo)),waitForCustomStreamsEnd=(fileDescriptors,streamInfo)=>fileDescriptors.flatMap(({stdioItems},fdNumber)=>stdioItems.filter(({value,stream=value})=>isStream(stream,{checkOpen:!1})&&!isStandardStream(stream)).map(({type,value,stream=value})=>waitForStream(stream,fdNumber,streamInfo,{isSameDirection:TRANSFORM_TYPES.has(type),stopOnExit:type==="native"}))),throwOnSubprocessError=async(subprocess,{signal})=>{let[error]=await events.once(subprocess,"error",{signal});throw error};var initializeConcurrentStreams=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),addConcurrentStream=(concurrentStreams,stream,waitName)=>{let weakMap=concurrentStreams[waitName];weakMap.has(stream)||weakMap.set(stream,[]);let promises=weakMap.get(stream),promise=createDeferred();return promises.push(promise),{resolve:promise.resolve.bind(promise),promises}},waitForConcurrentStreams=async({resolve,promises},subprocess)=>{resolve();let[isSubprocessExit]=await Promise.race([Promise.allSettled([!0,subprocess]),Promise.all([!1,...promises])]);return !isSubprocessExit};var safeWaitForSubprocessStdin=async subprocessStdin=>{if(subprocessStdin!==void 0)try{await waitForSubprocessStdin(subprocessStdin);}catch{}},safeWaitForSubprocessStdout=async subprocessStdout=>{if(subprocessStdout!==void 0)try{await waitForSubprocessStdout(subprocessStdout);}catch{}},waitForSubprocessStdin=async subprocessStdin=>{await promises.finished(subprocessStdin,{cleanup:!0,readable:!1,writable:!0});},waitForSubprocessStdout=async subprocessStdout=>{await promises.finished(subprocessStdout,{cleanup:!0,readable:!0,writable:!1});},waitForSubprocess=async(subprocess,error)=>{if(await subprocess,error)throw error},destroyOtherStream=(stream,isOpen,error)=>{error&&!isStreamAbort(error)?stream.destroy(error):isOpen&&stream.destroy();};var createReadable=({subprocess,concurrentStreams,encoding},{from,binary:binaryOption=!0,preserveNewlines=!0}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),{subprocessStdout,waitReadableDestroy}=getSubprocessStdout(subprocess,from,concurrentStreams),{readableEncoding,readableObjectMode,readableHighWaterMark}=getReadableOptions(subprocessStdout,binary),{read,onStdoutDataDone}=getReadableMethods({subprocessStdout,subprocess,binary,encoding,preserveNewlines}),readable2=new stream.Readable({read,destroy:util.callbackify(onReadableDestroy.bind(void 0,{subprocessStdout,subprocess,waitReadableDestroy})),highWaterMark:readableHighWaterMark,objectMode:readableObjectMode,encoding:readableEncoding});return onStdoutFinished({subprocessStdout,onStdoutDataDone,readable:readable2,subprocess}),readable2},getSubprocessStdout=(subprocess,from,concurrentStreams)=>{let subprocessStdout=getFromStream(subprocess,from),waitReadableDestroy=addConcurrentStream(concurrentStreams,subprocessStdout,"readableDestroy");return {subprocessStdout,waitReadableDestroy}},getReadableOptions=({readableEncoding,readableObjectMode,readableHighWaterMark},binary)=>binary?{readableEncoding,readableObjectMode,readableHighWaterMark}:{readableEncoding,readableObjectMode:!0,readableHighWaterMark:DEFAULT_OBJECT_HIGH_WATER_MARK},getReadableMethods=({subprocessStdout,subprocess,binary,encoding,preserveNewlines})=>{let onStdoutDataDone=createDeferred(),onStdoutData=iterateOnSubprocessStream({subprocessStdout,subprocess,binary,shouldEncode:!binary,encoding,preserveNewlines});return {read(){onRead(this,onStdoutData,onStdoutDataDone);},onStdoutDataDone}},onRead=async(readable2,onStdoutData,onStdoutDataDone)=>{try{let{value,done}=await onStdoutData.next();done?onStdoutDataDone.resolve():readable2.push(value);}catch{}},onStdoutFinished=async({subprocessStdout,onStdoutDataDone,readable:readable2,subprocess,subprocessStdin})=>{try{await waitForSubprocessStdout(subprocessStdout),await subprocess,await safeWaitForSubprocessStdin(subprocessStdin),await onStdoutDataDone,readable2.readable&&readable2.push(null);}catch(error){await safeWaitForSubprocessStdin(subprocessStdin),destroyOtherReadable(readable2,error);}},onReadableDestroy=async({subprocessStdout,subprocess,waitReadableDestroy},error)=>{await waitForConcurrentStreams(waitReadableDestroy,subprocess)&&(destroyOtherReadable(subprocessStdout,error),await waitForSubprocess(subprocess,error));},destroyOtherReadable=(stream,error)=>{destroyOtherStream(stream,stream.readable,error);};var createWritable=({subprocess,concurrentStreams},{to}={})=>{let{subprocessStdin,waitWritableFinal,waitWritableDestroy}=getSubprocessStdin(subprocess,to,concurrentStreams),writable2=new stream.Writable({...getWritableMethods(subprocessStdin,subprocess,waitWritableFinal),destroy:util.callbackify(onWritableDestroy.bind(void 0,{subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy})),highWaterMark:subprocessStdin.writableHighWaterMark,objectMode:subprocessStdin.writableObjectMode});return onStdinFinished(subprocessStdin,writable2),writable2},getSubprocessStdin=(subprocess,to,concurrentStreams)=>{let subprocessStdin=getToStream(subprocess,to),waitWritableFinal=addConcurrentStream(concurrentStreams,subprocessStdin,"writableFinal"),waitWritableDestroy=addConcurrentStream(concurrentStreams,subprocessStdin,"writableDestroy");return {subprocessStdin,waitWritableFinal,waitWritableDestroy}},getWritableMethods=(subprocessStdin,subprocess,waitWritableFinal)=>({write:onWrite.bind(void 0,subprocessStdin),final:util.callbackify(onWritableFinal.bind(void 0,subprocessStdin,subprocess,waitWritableFinal))}),onWrite=(subprocessStdin,chunk,encoding,done)=>{subprocessStdin.write(chunk,encoding)?done():subprocessStdin.once("drain",done);},onWritableFinal=async(subprocessStdin,subprocess,waitWritableFinal)=>{await waitForConcurrentStreams(waitWritableFinal,subprocess)&&(subprocessStdin.writable&&subprocessStdin.end(),await subprocess);},onStdinFinished=async(subprocessStdin,writable2,subprocessStdout)=>{try{await waitForSubprocessStdin(subprocessStdin),writable2.writable&&writable2.end();}catch(error){await safeWaitForSubprocessStdout(subprocessStdout),destroyOtherWritable(writable2,error);}},onWritableDestroy=async({subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy},error)=>{await waitForConcurrentStreams(waitWritableFinal,subprocess),await waitForConcurrentStreams(waitWritableDestroy,subprocess)&&(destroyOtherWritable(subprocessStdin,error),await waitForSubprocess(subprocess,error));},destroyOtherWritable=(stream,error)=>{destroyOtherStream(stream,stream.writable,error);};var createDuplex=({subprocess,concurrentStreams,encoding},{from,to,binary:binaryOption=!0,preserveNewlines=!0}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),{subprocessStdout,waitReadableDestroy}=getSubprocessStdout(subprocess,from,concurrentStreams),{subprocessStdin,waitWritableFinal,waitWritableDestroy}=getSubprocessStdin(subprocess,to,concurrentStreams),{readableEncoding,readableObjectMode,readableHighWaterMark}=getReadableOptions(subprocessStdout,binary),{read,onStdoutDataDone}=getReadableMethods({subprocessStdout,subprocess,binary,encoding,preserveNewlines}),duplex2=new stream.Duplex({read,...getWritableMethods(subprocessStdin,subprocess,waitWritableFinal),destroy:util.callbackify(onDuplexDestroy.bind(void 0,{subprocessStdout,subprocessStdin,subprocess,waitReadableDestroy,waitWritableFinal,waitWritableDestroy})),readableHighWaterMark,writableHighWaterMark:subprocessStdin.writableHighWaterMark,readableObjectMode,writableObjectMode:subprocessStdin.writableObjectMode,encoding:readableEncoding});return onStdoutFinished({subprocessStdout,onStdoutDataDone,readable:duplex2,subprocess,subprocessStdin}),onStdinFinished(subprocessStdin,duplex2,subprocessStdout),duplex2},onDuplexDestroy=async({subprocessStdout,subprocessStdin,subprocess,waitReadableDestroy,waitWritableFinal,waitWritableDestroy},error)=>{await Promise.all([onReadableDestroy({subprocessStdout,subprocess,waitReadableDestroy},error),onWritableDestroy({subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy},error)]);};var createIterable=(subprocess,encoding,{from,binary:binaryOption=!1,preserveNewlines=!1}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),subprocessStdout=getFromStream(subprocess,from),onStdoutData=iterateOnSubprocessStream({subprocessStdout,subprocess,binary,shouldEncode:!0,encoding,preserveNewlines});return iterateOnStdoutData(onStdoutData,subprocessStdout,subprocess)},iterateOnStdoutData=async function*(onStdoutData,subprocessStdout,subprocess){try{yield*onStdoutData;}finally{subprocessStdout.readable&&subprocessStdout.destroy(),await subprocess;}};var addConvertedStreams=(subprocess,{encoding})=>{let concurrentStreams=initializeConcurrentStreams();subprocess.readable=createReadable.bind(void 0,{subprocess,concurrentStreams,encoding}),subprocess.writable=createWritable.bind(void 0,{subprocess,concurrentStreams}),subprocess.duplex=createDuplex.bind(void 0,{subprocess,concurrentStreams,encoding}),subprocess.iterable=createIterable.bind(void 0,subprocess,encoding),subprocess[Symbol.asyncIterator]=createIterable.bind(void 0,subprocess,encoding,{});};var mergePromise=(subprocess,promise)=>{for(let[property,descriptor]of descriptors){let value=descriptor.value.bind(promise);Reflect.defineProperty(subprocess,property,{...descriptor,value});}},nativePromisePrototype=(async()=>{})().constructor.prototype,descriptors=["then","catch","finally"].map(property=>[property,Reflect.getOwnPropertyDescriptor(nativePromisePrototype,property)]);var execaCoreAsync=(rawFile,rawArguments,rawOptions,createNested)=>{let{file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}=handleAsyncArguments(rawFile,rawArguments,rawOptions),{subprocess,promise}=spawnSubprocessAsync({file,commandArguments,options,startTime,verboseInfo,command,escapedCommand,fileDescriptors});return subprocess.pipe=pipeToSubprocess.bind(void 0,{source:subprocess,sourcePromise:promise,boundOptions:{},createNested}),mergePromise(subprocess,promise),SUBPROCESS_OPTIONS.set(subprocess,{options,fileDescriptors}),subprocess},handleAsyncArguments=(rawFile,rawArguments,rawOptions)=>{let{command,escapedCommand,startTime,verboseInfo}=handleCommand(rawFile,rawArguments,rawOptions),{file,commandArguments,options:normalizedOptions}=normalizeOptions(rawFile,rawArguments,rawOptions),options=handleAsyncOptions(normalizedOptions),fileDescriptors=handleStdioAsync(options,verboseInfo);return {file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}},handleAsyncOptions=({timeout,signal,...options})=>{if(signal!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return {...options,timeoutDuration:timeout}},spawnSubprocessAsync=({file,commandArguments,options,startTime,verboseInfo,command,escapedCommand,fileDescriptors})=>{let subprocess;try{subprocess=child_process.spawn(file,commandArguments,options);}catch(error){return handleEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,verboseInfo})}let controller=new AbortController;events.setMaxListeners(Number.POSITIVE_INFINITY,controller.signal);let originalStreams=[...subprocess.stdio];pipeOutputAsync(subprocess,fileDescriptors,controller),cleanupOnExit(subprocess,options,controller);let context={},onInternalError=createDeferred();subprocess.kill=subprocessKill.bind(void 0,{kill:subprocess.kill.bind(subprocess),options,onInternalError,context,controller}),subprocess.all=makeAllStream(subprocess,options),addConvertedStreams(subprocess,options),addIpcMethods(subprocess,options);let promise=handlePromise({subprocess,options,startTime,verboseInfo,fileDescriptors,originalStreams,command,escapedCommand,context,onInternalError,controller});return {subprocess,promise}},handlePromise=async({subprocess,options,startTime,verboseInfo,fileDescriptors,originalStreams,command,escapedCommand,context,onInternalError,controller})=>{let[errorInfo,[exitCode,signal],stdioResults,allResult,ipcOutput]=await waitForSubprocessResult({subprocess,options,context,verboseInfo,fileDescriptors,originalStreams,onInternalError,controller});controller.abort(),onInternalError.resolve();let stdio=stdioResults.map((stdioResult,fdNumber)=>stripNewline(stdioResult,options,fdNumber)),all=stripNewline(allResult,options,"all"),result=getAsyncResult({errorInfo,exitCode,signal,stdio,all,ipcOutput,context,options,command,escapedCommand,startTime});return handleResult(result,verboseInfo,options)},getAsyncResult=({errorInfo,exitCode,signal,stdio,all,ipcOutput,context,options,command,escapedCommand,startTime})=>"error"in errorInfo?makeError({error:errorInfo.error,command,escapedCommand,timedOut:context.terminationReason==="timeout",isCanceled:context.terminationReason==="cancel"||context.terminationReason==="gracefulCancel",isGracefullyCanceled:context.terminationReason==="gracefulCancel",isMaxBuffer:errorInfo.error instanceof MaxBufferError,isForcefullyTerminated:context.isForcefullyTerminated,exitCode,signal,stdio,all,ipcOutput,options,startTime,isSync:!1}):makeSuccessResult({command,escapedCommand,stdio,all,ipcOutput,options,startTime});var mergeOptions=(boundOptions,options)=>{let newOptions=Object.fromEntries(Object.entries(options).map(([optionName,optionValue])=>[optionName,mergeOption(optionName,boundOptions[optionName],optionValue)]));return {...boundOptions,...newOptions}},mergeOption=(optionName,boundOptionValue,optionValue)=>DEEP_OPTIONS.has(optionName)&&isPlainObject(boundOptionValue)&&isPlainObject(optionValue)?{...boundOptionValue,...optionValue}:optionValue,DEEP_OPTIONS=new Set(["env",...FD_SPECIFIC_OPTIONS]);var createExeca=(mapArguments,boundOptions,deepOptions,setBoundExeca)=>{let createNested=(mapArguments2,boundOptions2,setBoundExeca2)=>createExeca(mapArguments2,boundOptions2,deepOptions,setBoundExeca2),boundExeca=(...execaArguments)=>callBoundExeca({mapArguments,deepOptions,boundOptions,setBoundExeca,createNested},...execaArguments);return setBoundExeca!==void 0&&setBoundExeca(boundExeca,createNested,boundOptions),boundExeca},callBoundExeca=({mapArguments,deepOptions={},boundOptions={},setBoundExeca,createNested},firstArgument,...nextArguments)=>{if(isPlainObject(firstArgument))return createNested(mapArguments,mergeOptions(boundOptions,firstArgument),setBoundExeca);let{file,commandArguments,options,isSync}=parseArguments({mapArguments,firstArgument,nextArguments,deepOptions,boundOptions});return isSync?execaCoreSync(file,commandArguments,options):execaCoreAsync(file,commandArguments,options,createNested)},parseArguments=({mapArguments,firstArgument,nextArguments,deepOptions,boundOptions})=>{let callArguments=isTemplateString(firstArgument)?parseTemplates(firstArgument,nextArguments):[firstArgument,...nextArguments],[initialFile,initialArguments,initialOptions]=normalizeParameters(...callArguments),mergedOptions=mergeOptions(mergeOptions(deepOptions,boundOptions),initialOptions),{file=initialFile,commandArguments=initialArguments,options=mergedOptions,isSync=!1}=mapArguments({file:initialFile,commandArguments:initialArguments,options:mergedOptions});return {file,commandArguments,options,isSync}};var mapCommandAsync=({file,commandArguments})=>parseCommand(file,commandArguments),mapCommandSync=({file,commandArguments})=>({...parseCommand(file,commandArguments),isSync:!0}),parseCommand=(command,unusedArguments)=>{if(unusedArguments.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${command} ${unusedArguments}.`);let[file,...commandArguments]=parseCommandString(command);return {file,commandArguments}},parseCommandString=command=>{if(typeof command!="string")throw new TypeError(`The command must be a string: ${String(command)}.`);let trimmedCommand=command.trim();if(trimmedCommand==="")return [];let tokens=[];for(let token of trimmedCommand.split(SPACES_REGEXP)){let previousToken=tokens.at(-1);previousToken&&previousToken.endsWith("\\")?tokens[tokens.length-1]=`${previousToken.slice(0,-1)} ${token}`:tokens.push(token);}return tokens},SPACES_REGEXP=/ +/g;var setScriptSync=(boundExeca,createNested,boundOptions)=>{boundExeca.sync=createNested(mapScriptSync,boundOptions),boundExeca.s=boundExeca.sync;},mapScriptAsync=({options})=>getScriptOptions(options),mapScriptSync=({options})=>({...getScriptOptions(options),isSync:!0}),getScriptOptions=options=>({options:{...getScriptStdinOption(options),...options}}),getScriptStdinOption=({input,inputFile,stdio})=>input===void 0&&inputFile===void 0&&stdio===void 0?{stdin:"inherit"}:{},deepScriptOptions={preferLocal:!0};var execa=createExeca(()=>({}));createExeca(()=>({isSync:!0}));createExeca(mapCommandAsync);createExeca(mapCommandSync);createExeca(mapNode);createExeca(mapScriptAsync,{},deepScriptOptions,setScriptSync);getIpcExport();var $2=execa({preferLocal:!0,stdio:"inherit",reject:!1});async function postinstall(options){await $2`storybook automigrate addonA11yAddonTest ${options.yes?"--yes":""}`;}
67
+ if (condition) { yield value; }`)};var getEncodingTransformGenerator=(binary,encoding,skipped)=>{if(skipped)return;if(binary)return {transform:encodingUint8ArrayGenerator.bind(void 0,new TextEncoder)};let stringDecoder=new string_decoder.StringDecoder(encoding);return {transform:encodingStringGenerator.bind(void 0,stringDecoder),final:encodingStringFinal.bind(void 0,stringDecoder)}},encodingUint8ArrayGenerator=function*(textEncoder3,chunk){buffer.Buffer.isBuffer(chunk)?yield bufferToUint8Array(chunk):typeof chunk=="string"?yield textEncoder3.encode(chunk):yield chunk;},encodingStringGenerator=function*(stringDecoder,chunk){yield isUint8Array(chunk)?stringDecoder.write(chunk):chunk;},encodingStringFinal=function*(stringDecoder){let lastChunk=stringDecoder.end();lastChunk!==""&&(yield lastChunk);};var pushChunks=util.callbackify(async(getChunks,state,getChunksArguments,transformStream)=>{state.currentIterable=getChunks(...getChunksArguments);try{for await(let chunk of state.currentIterable)transformStream.push(chunk);}finally{delete state.currentIterable;}}),transformChunk=async function*(chunk,generators,index){if(index===generators.length){yield chunk;return}let{transform=identityGenerator}=generators[index];for await(let transformedChunk of transform(chunk))yield*transformChunk(transformedChunk,generators,index+1);},finalChunks=async function*(generators){for(let[index,{final}]of Object.entries(generators))yield*generatorFinalChunks(final,Number(index),generators);},generatorFinalChunks=async function*(final,index,generators){if(final!==void 0)for await(let finalChunk of final())yield*transformChunk(finalChunk,generators,index+1);},destroyTransform=util.callbackify(async({currentIterable},error)=>{if(currentIterable!==void 0){await(error?currentIterable.throw(error):currentIterable.return());return}if(error)throw error}),identityGenerator=function*(chunk){yield chunk;};var pushChunksSync=(getChunksSync,getChunksArguments,transformStream,done)=>{try{for(let chunk of getChunksSync(...getChunksArguments))transformStream.push(chunk);done();}catch(error){done(error);}},runTransformSync=(generators,chunks)=>[...chunks.flatMap(chunk=>[...transformChunkSync(chunk,generators,0)]),...finalChunksSync(generators)],transformChunkSync=function*(chunk,generators,index){if(index===generators.length){yield chunk;return}let{transform=identityGenerator2}=generators[index];for(let transformedChunk of transform(chunk))yield*transformChunkSync(transformedChunk,generators,index+1);},finalChunksSync=function*(generators){for(let[index,{final}]of Object.entries(generators))yield*generatorFinalChunksSync(final,Number(index),generators);},generatorFinalChunksSync=function*(final,index,generators){if(final!==void 0)for(let finalChunk of final())yield*transformChunkSync(finalChunk,generators,index+1);},identityGenerator2=function*(chunk){yield chunk;};var generatorToStream=({value,value:{transform,final,writableObjectMode,readableObjectMode},optionName},{encoding})=>{let state={},generators=addInternalGenerators(value,encoding,optionName),transformAsync=isAsyncGenerator(transform),finalAsync=isAsyncGenerator(final),transformMethod=transformAsync?pushChunks.bind(void 0,transformChunk,state):pushChunksSync.bind(void 0,transformChunkSync),finalMethod=transformAsync||finalAsync?pushChunks.bind(void 0,finalChunks,state):pushChunksSync.bind(void 0,finalChunksSync),destroyMethod=transformAsync||finalAsync?destroyTransform.bind(void 0,state):void 0;return {stream:new stream.Transform({writableObjectMode,writableHighWaterMark:stream.getDefaultHighWaterMark(writableObjectMode),readableObjectMode,readableHighWaterMark:stream.getDefaultHighWaterMark(readableObjectMode),transform(chunk,encoding2,done){transformMethod([chunk,generators,0],this,done);},flush(done){finalMethod([generators],this,done);},destroy:destroyMethod})}},runGeneratorsSync=(chunks,stdioItems,encoding,isInput)=>{let generators=stdioItems.filter(({type})=>type==="generator"),reversedGenerators=isInput?generators.reverse():generators;for(let{value,optionName}of reversedGenerators){let generators2=addInternalGenerators(value,encoding,optionName);chunks=runTransformSync(generators2,chunks);}return chunks},addInternalGenerators=({transform,final,binary,writableObjectMode,readableObjectMode,preserveNewlines},encoding,optionName)=>{let state={};return [{transform:getValidateTransformInput(writableObjectMode,optionName)},getEncodingTransformGenerator(binary,encoding,writableObjectMode),getSplitLinesGenerator(binary,preserveNewlines,writableObjectMode,state),{transform,final},{transform:getValidateTransformReturn(readableObjectMode,optionName)},getAppendNewlineGenerator({binary,preserveNewlines,readableObjectMode,state})].filter(Boolean)};var addInputOptionsSync=(fileDescriptors,options)=>{for(let fdNumber of getInputFdNumbers(fileDescriptors))addInputOptionSync(fileDescriptors,fdNumber,options);},getInputFdNumbers=fileDescriptors=>new Set(Object.entries(fileDescriptors).filter(([,{direction}])=>direction==="input").map(([fdNumber])=>Number(fdNumber))),addInputOptionSync=(fileDescriptors,fdNumber,options)=>{let{stdioItems}=fileDescriptors[fdNumber],allStdioItems=stdioItems.filter(({contents})=>contents!==void 0);if(allStdioItems.length===0)return;if(fdNumber!==0){let[{type,optionName}]=allStdioItems;throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`)}let transformedContents=allStdioItems.map(({contents})=>contents).map(contents=>applySingleInputGeneratorsSync(contents,stdioItems));options.input=joinToUint8Array(transformedContents);},applySingleInputGeneratorsSync=(contents,stdioItems)=>{let newContents=runGeneratorsSync(contents,stdioItems,"utf8",!0);return validateSerializable(newContents),joinToUint8Array(newContents)},validateSerializable=newContents=>{let invalidItem=newContents.find(item=>typeof item!="string"&&!isUint8Array(item));if(invalidItem!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${invalidItem}.`)};var shouldLogOutput=({stdioItems,encoding,verboseInfo,fdNumber})=>fdNumber!=="all"&&isFullVerbose(verboseInfo,fdNumber)&&!BINARY_ENCODINGS.has(encoding)&&fdUsesVerbose(fdNumber)&&(stdioItems.some(({type,value})=>type==="native"&&PIPED_STDIO_VALUES.has(value))||stdioItems.every(({type})=>TRANSFORM_TYPES.has(type))),fdUsesVerbose=fdNumber=>fdNumber===1||fdNumber===2,PIPED_STDIO_VALUES=new Set(["pipe","overlapped"]),logLines=async(linesIterable,stream,fdNumber,verboseInfo)=>{for await(let line of linesIterable)isPipingStream(stream)||logLine(line,fdNumber,verboseInfo);},logLinesSync=(linesArray,fdNumber,verboseInfo)=>{for(let line of linesArray)logLine(line,fdNumber,verboseInfo);},isPipingStream=stream=>stream._readableState.pipes.length>0,logLine=(line,fdNumber,verboseInfo)=>{let verboseMessage=serializeVerboseMessage(line);verboseLog({type:"output",verboseMessage,fdNumber,verboseInfo});};var transformOutputSync=({fileDescriptors,syncResult:{output},options,isMaxBuffer,verboseInfo})=>{if(output===null)return {output:Array.from({length:3})};let state={},outputFiles=new Set([]);return {output:output.map((result,fdNumber)=>transformOutputResultSync({result,fileDescriptors,fdNumber,state,outputFiles,isMaxBuffer,verboseInfo},options)),...state}},transformOutputResultSync=({result,fileDescriptors,fdNumber,state,outputFiles,isMaxBuffer,verboseInfo},{buffer,encoding,lines,stripFinalNewline:stripFinalNewline2,maxBuffer})=>{if(result===null)return;let truncatedResult=truncateMaxBufferSync(result,isMaxBuffer,maxBuffer),uint8ArrayResult=bufferToUint8Array(truncatedResult),{stdioItems,objectMode}=fileDescriptors[fdNumber],chunks=runOutputGeneratorsSync([uint8ArrayResult],stdioItems,encoding,state),{serializedResult,finalResult=serializedResult}=serializeChunks({chunks,objectMode,encoding,lines,stripFinalNewline:stripFinalNewline2,fdNumber});logOutputSync({serializedResult,fdNumber,state,verboseInfo,encoding,stdioItems,objectMode});let returnedResult=buffer[fdNumber]?finalResult:void 0;try{return state.error===void 0&&writeToFiles(serializedResult,stdioItems,outputFiles),returnedResult}catch(error){return state.error=error,returnedResult}},runOutputGeneratorsSync=(chunks,stdioItems,encoding,state)=>{try{return runGeneratorsSync(chunks,stdioItems,encoding,!1)}catch(error){return state.error=error,chunks}},serializeChunks=({chunks,objectMode,encoding,lines,stripFinalNewline:stripFinalNewline2,fdNumber})=>{if(objectMode)return {serializedResult:chunks};if(encoding==="buffer")return {serializedResult:joinToUint8Array(chunks)};let serializedResult=joinToString(chunks,encoding);return lines[fdNumber]?{serializedResult,finalResult:splitLinesSync(serializedResult,!stripFinalNewline2[fdNumber],objectMode)}:{serializedResult}},logOutputSync=({serializedResult,fdNumber,state,verboseInfo,encoding,stdioItems,objectMode})=>{if(!shouldLogOutput({stdioItems,encoding,verboseInfo,fdNumber}))return;let linesArray=splitLinesSync(serializedResult,!1,objectMode);try{logLinesSync(linesArray,fdNumber,verboseInfo);}catch(error){state.error??=error;}},writeToFiles=(serializedResult,stdioItems,outputFiles)=>{for(let{path:path6,append}of stdioItems.filter(({type})=>FILE_TYPES.has(type))){let pathString=typeof path6=="string"?path6:path6.toString();append||outputFiles.has(pathString)?fs.appendFileSync(path6,serializedResult):(outputFiles.add(pathString),fs.writeFileSync(path6,serializedResult));}};var getAllSync=([,stdout,stderr],options)=>{if(options.all)return stdout===void 0?stderr:stderr===void 0?stdout:Array.isArray(stdout)?Array.isArray(stderr)?[...stdout,...stderr]:[...stdout,stripNewline(stderr,options,"all")]:Array.isArray(stderr)?[stripNewline(stdout,options,"all"),...stderr]:isUint8Array(stdout)&&isUint8Array(stderr)?concatUint8Arrays([stdout,stderr]):`${stdout}${stderr}`};var waitForExit=async(subprocess,context)=>{let[exitCode,signal]=await waitForExitOrError(subprocess);return context.isForcefullyTerminated??=!1,[exitCode,signal]},waitForExitOrError=async subprocess=>{let[spawnPayload,exitPayload]=await Promise.allSettled([events.once(subprocess,"spawn"),events.once(subprocess,"exit")]);return spawnPayload.status==="rejected"?[]:exitPayload.status==="rejected"?waitForSubprocessExit(subprocess):exitPayload.value},waitForSubprocessExit=async subprocess=>{try{return await events.once(subprocess,"exit")}catch{return waitForSubprocessExit(subprocess)}},waitForSuccessfulExit=async exitPromise=>{let[exitCode,signal]=await exitPromise;if(!isSubprocessErrorExit(exitCode,signal)&&isFailedExit(exitCode,signal))throw new DiscardedError;return [exitCode,signal]},isSubprocessErrorExit=(exitCode,signal)=>exitCode===void 0&&signal===void 0,isFailedExit=(exitCode,signal)=>exitCode!==0||signal!==null;var getExitResultSync=({error,status:exitCode,signal,output},{maxBuffer})=>{let resultError=getResultError(error,exitCode,signal),timedOut=resultError?.code==="ETIMEDOUT",isMaxBuffer=isMaxBufferSync(resultError,output,maxBuffer);return {resultError,exitCode,signal,timedOut,isMaxBuffer}},getResultError=(error,exitCode,signal)=>error!==void 0?error:isFailedExit(exitCode,signal)?new DiscardedError:void 0;var execaCoreSync=(rawFile,rawArguments,rawOptions)=>{let{file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}=handleSyncArguments(rawFile,rawArguments,rawOptions),result=spawnSubprocessSync({file,commandArguments,options,command,escapedCommand,verboseInfo,fileDescriptors,startTime});return handleResult(result,verboseInfo,options)},handleSyncArguments=(rawFile,rawArguments,rawOptions)=>{let{command,escapedCommand,startTime,verboseInfo}=handleCommand(rawFile,rawArguments,rawOptions),syncOptions=normalizeSyncOptions(rawOptions),{file,commandArguments,options}=normalizeOptions(rawFile,rawArguments,syncOptions);validateSyncOptions(options);let fileDescriptors=handleStdioSync(options,verboseInfo);return {file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}},normalizeSyncOptions=options=>options.node&&!options.ipc?{...options,ipc:!1}:options,validateSyncOptions=({ipc,ipcInput,detached,cancelSignal})=>{ipcInput&&throwInvalidSyncOption("ipcInput"),ipc&&throwInvalidSyncOption("ipc: true"),detached&&throwInvalidSyncOption("detached: true"),cancelSignal&&throwInvalidSyncOption("cancelSignal");},throwInvalidSyncOption=value=>{throw new TypeError(`The "${value}" option cannot be used with synchronous methods.`)},spawnSubprocessSync=({file,commandArguments,options,command,escapedCommand,verboseInfo,fileDescriptors,startTime})=>{let syncResult=runSubprocessSync({file,commandArguments,options,command,escapedCommand,fileDescriptors,startTime});if(syncResult.failed)return syncResult;let{resultError,exitCode,signal,timedOut,isMaxBuffer}=getExitResultSync(syncResult,options),{output,error=resultError}=transformOutputSync({fileDescriptors,syncResult,options,isMaxBuffer,verboseInfo}),stdio=output.map((stdioOutput,fdNumber)=>stripNewline(stdioOutput,options,fdNumber)),all=stripNewline(getAllSync(output,options),options,"all");return getSyncResult({error,exitCode,signal,timedOut,isMaxBuffer,stdio,all,options,command,escapedCommand,startTime})},runSubprocessSync=({file,commandArguments,options,command,escapedCommand,fileDescriptors,startTime})=>{try{addInputOptionsSync(fileDescriptors,options);let normalizedOptions=normalizeSpawnSyncOptions(options);return child_process.spawnSync(file,commandArguments,normalizedOptions)}catch(error){return makeEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,isSync:!0})}},normalizeSpawnSyncOptions=({encoding,maxBuffer,...options})=>({...options,encoding:"buffer",maxBuffer:getMaxBufferSync(maxBuffer)}),getSyncResult=({error,exitCode,signal,timedOut,isMaxBuffer,stdio,all,options,command,escapedCommand,startTime})=>error===void 0?makeSuccessResult({command,escapedCommand,stdio,all,ipcOutput:[],options,startTime}):makeError({error,command,escapedCommand,timedOut,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer,isForcefullyTerminated:!1,exitCode,signal,stdio,all,ipcOutput:[],options,startTime,isSync:!0});var getOneMessage=({anyProcess,channel,isSubprocess,ipc},{reference=!0,filter}={})=>(validateIpcMethod({methodName:"getOneMessage",isSubprocess,ipc,isConnected:isConnected(anyProcess)}),getOneMessageAsync({anyProcess,channel,isSubprocess,filter,reference})),getOneMessageAsync=async({anyProcess,channel,isSubprocess,filter,reference})=>{addReference(channel,reference);let ipcEmitter=getIpcEmitter(anyProcess,channel,isSubprocess),controller=new AbortController;try{return await Promise.race([getMessage(ipcEmitter,filter,controller),throwOnDisconnect2(ipcEmitter,isSubprocess,controller),throwOnStrictError(ipcEmitter,isSubprocess,controller)])}catch(error){throw disconnect(anyProcess),error}finally{controller.abort(),removeReference(channel,reference);}},getMessage=async(ipcEmitter,filter,{signal})=>{if(filter===void 0){let[message]=await events.once(ipcEmitter,"message",{signal});return message}for await(let[message]of events.on(ipcEmitter,"message",{signal}))if(filter(message))return message},throwOnDisconnect2=async(ipcEmitter,isSubprocess,{signal})=>{await events.once(ipcEmitter,"disconnect",{signal}),throwOnEarlyDisconnect(isSubprocess);},throwOnStrictError=async(ipcEmitter,isSubprocess,{signal})=>{let[error]=await events.once(ipcEmitter,"strict:error",{signal});throw getStrictResponseError(error,isSubprocess)};var getEachMessage=({anyProcess,channel,isSubprocess,ipc},{reference=!0}={})=>loopOnMessages({anyProcess,channel,isSubprocess,ipc,shouldAwait:!isSubprocess,reference}),loopOnMessages=({anyProcess,channel,isSubprocess,ipc,shouldAwait,reference})=>{validateIpcMethod({methodName:"getEachMessage",isSubprocess,ipc,isConnected:isConnected(anyProcess)}),addReference(channel,reference);let ipcEmitter=getIpcEmitter(anyProcess,channel,isSubprocess),controller=new AbortController,state={};return stopOnDisconnect(anyProcess,ipcEmitter,controller),abortOnStrictError({ipcEmitter,isSubprocess,controller,state}),iterateOnMessages({anyProcess,channel,ipcEmitter,isSubprocess,shouldAwait,controller,state,reference})},stopOnDisconnect=async(anyProcess,ipcEmitter,controller)=>{try{await events.once(ipcEmitter,"disconnect",{signal:controller.signal}),controller.abort();}catch{}},abortOnStrictError=async({ipcEmitter,isSubprocess,controller,state})=>{try{let[error]=await events.once(ipcEmitter,"strict:error",{signal:controller.signal});state.error=getStrictResponseError(error,isSubprocess),controller.abort();}catch{}},iterateOnMessages=async function*({anyProcess,channel,ipcEmitter,isSubprocess,shouldAwait,controller,state,reference}){try{for await(let[message]of events.on(ipcEmitter,"message",{signal:controller.signal}))throwIfStrictError(state),yield message;}catch{throwIfStrictError(state);}finally{controller.abort(),removeReference(channel,reference),isSubprocess||disconnect(anyProcess),shouldAwait&&await anyProcess;}},throwIfStrictError=({error})=>{if(error)throw error};var addIpcMethods=(subprocess,{ipc})=>{Object.assign(subprocess,getIpcMethods(subprocess,!1,ipc));},getIpcExport=()=>{let anyProcess=process4__default.default,isSubprocess=!0,ipc=process4__default.default.channel!==void 0;return {...getIpcMethods(anyProcess,isSubprocess,ipc),getCancelSignal:getCancelSignal.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc})}},getIpcMethods=(anyProcess,isSubprocess,ipc)=>({sendMessage:sendMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc}),getOneMessage:getOneMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc}),getEachMessage:getEachMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc})});var handleEarlyError=({error,command,escapedCommand,fileDescriptors,options,startTime,verboseInfo})=>{cleanupCustomStreams(fileDescriptors);let subprocess=new child_process.ChildProcess;createDummyStreams(subprocess,fileDescriptors),Object.assign(subprocess,{readable,writable,duplex});let earlyError=makeEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,isSync:!1}),promise=handleDummyPromise(earlyError,verboseInfo,options);return {subprocess,promise}},createDummyStreams=(subprocess,fileDescriptors)=>{let stdin=createDummyStream(),stdout=createDummyStream(),stderr=createDummyStream(),extraStdio=Array.from({length:fileDescriptors.length-3},createDummyStream),all=createDummyStream(),stdio=[stdin,stdout,stderr,...extraStdio];Object.assign(subprocess,{stdin,stdout,stderr,all,stdio});},createDummyStream=()=>{let stream$1=new stream.PassThrough;return stream$1.end(),stream$1},readable=()=>new stream.Readable({read(){}}),writable=()=>new stream.Writable({write(){}}),duplex=()=>new stream.Duplex({read(){},write(){}}),handleDummyPromise=async(error,verboseInfo,options)=>handleResult(error,verboseInfo,options);var handleStdioAsync=(options,verboseInfo)=>handleStdio(addPropertiesAsync,options,verboseInfo,!1),forbiddenIfAsync=({type,optionName})=>{throw new TypeError(`The \`${optionName}\` option cannot be ${TYPE_TO_MESSAGE[type]}.`)},addProperties2={fileNumber:forbiddenIfAsync,generator:generatorToStream,asyncGenerator:generatorToStream,nodeStream:({value})=>({stream:value}),webTransform({value:{transform,writableObjectMode,readableObjectMode}}){let objectMode=writableObjectMode||readableObjectMode;return {stream:stream.Duplex.fromWeb(transform,{objectMode})}},duplex:({value:{transform}})=>({stream:transform}),native(){}},addPropertiesAsync={input:{...addProperties2,fileUrl:({value})=>({stream:fs.createReadStream(value)}),filePath:({value:{file}})=>({stream:fs.createReadStream(file)}),webStream:({value})=>({stream:stream.Readable.fromWeb(value)}),iterable:({value})=>({stream:stream.Readable.from(value)}),asyncIterable:({value})=>({stream:stream.Readable.from(value)}),string:({value})=>({stream:stream.Readable.from(value)}),uint8Array:({value})=>({stream:stream.Readable.from(buffer.Buffer.from(value))})},output:{...addProperties2,fileUrl:({value})=>({stream:fs.createWriteStream(value)}),filePath:({value:{file,append}})=>({stream:fs.createWriteStream(file,append?{flags:"a"}:{})}),webStream:({value})=>({stream:stream.Writable.fromWeb(value)}),iterable:forbiddenIfAsync,asyncIterable:forbiddenIfAsync,string:forbiddenIfAsync,uint8Array:forbiddenIfAsync}};function mergeStreams(streams){if(!Array.isArray(streams))throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);for(let stream of streams)validateStream(stream);let objectMode=streams.some(({readableObjectMode})=>readableObjectMode),highWaterMark=getHighWaterMark(streams,objectMode),passThroughStream=new MergedStream({objectMode,writableHighWaterMark:highWaterMark,readableHighWaterMark:highWaterMark});for(let stream of streams)passThroughStream.add(stream);return passThroughStream}var getHighWaterMark=(streams,objectMode)=>{if(streams.length===0)return stream.getDefaultHighWaterMark(objectMode);let highWaterMarks=streams.filter(({readableObjectMode})=>readableObjectMode===objectMode).map(({readableHighWaterMark})=>readableHighWaterMark);return Math.max(...highWaterMarks)},MergedStream=class extends stream.PassThrough{#streams=new Set([]);#ended=new Set([]);#aborted=new Set([]);#onFinished;#unpipeEvent=Symbol("unpipe");#streamPromises=new WeakMap;add(stream){if(validateStream(stream),this.#streams.has(stream))return;this.#streams.add(stream),this.#onFinished??=onMergedStreamFinished(this,this.#streams,this.#unpipeEvent);let streamPromise=endWhenStreamsDone({passThroughStream:this,stream,streams:this.#streams,ended:this.#ended,aborted:this.#aborted,onFinished:this.#onFinished,unpipeEvent:this.#unpipeEvent});this.#streamPromises.set(stream,streamPromise),stream.pipe(this,{end:!1});}async remove(stream){if(validateStream(stream),!this.#streams.has(stream))return !1;let streamPromise=this.#streamPromises.get(stream);return streamPromise===void 0?!1:(this.#streamPromises.delete(stream),stream.unpipe(this),await streamPromise,!0)}},onMergedStreamFinished=async(passThroughStream,streams,unpipeEvent)=>{updateMaxListeners(passThroughStream,PASSTHROUGH_LISTENERS_COUNT);let controller=new AbortController;try{await Promise.race([onMergedStreamEnd(passThroughStream,controller),onInputStreamsUnpipe(passThroughStream,streams,unpipeEvent,controller)]);}finally{controller.abort(),updateMaxListeners(passThroughStream,-PASSTHROUGH_LISTENERS_COUNT);}},onMergedStreamEnd=async(passThroughStream,{signal})=>{try{await promises.finished(passThroughStream,{signal,cleanup:!0});}catch(error){throw errorOrAbortStream(passThroughStream,error),error}},onInputStreamsUnpipe=async(passThroughStream,streams,unpipeEvent,{signal})=>{for await(let[unpipedStream]of events.on(passThroughStream,"unpipe",{signal}))streams.has(unpipedStream)&&unpipedStream.emit(unpipeEvent);},validateStream=stream=>{if(typeof stream?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`)},endWhenStreamsDone=async({passThroughStream,stream,streams,ended,aborted:aborted2,onFinished,unpipeEvent})=>{updateMaxListeners(passThroughStream,PASSTHROUGH_LISTENERS_PER_STREAM);let controller=new AbortController;try{await Promise.race([afterMergedStreamFinished(onFinished,stream,controller),onInputStreamEnd({passThroughStream,stream,streams,ended,aborted:aborted2,controller}),onInputStreamUnpipe({stream,streams,ended,aborted:aborted2,unpipeEvent,controller})]);}finally{controller.abort(),updateMaxListeners(passThroughStream,-PASSTHROUGH_LISTENERS_PER_STREAM);}streams.size>0&&streams.size===ended.size+aborted2.size&&(ended.size===0&&aborted2.size>0?abortStream(passThroughStream):endStream(passThroughStream));},afterMergedStreamFinished=async(onFinished,stream,{signal})=>{try{await onFinished,signal.aborted||abortStream(stream);}catch(error){signal.aborted||errorOrAbortStream(stream,error);}},onInputStreamEnd=async({passThroughStream,stream,streams,ended,aborted:aborted2,controller:{signal}})=>{try{await promises.finished(stream,{signal,cleanup:!0,readable:!0,writable:!1}),streams.has(stream)&&ended.add(stream);}catch(error){if(signal.aborted||!streams.has(stream))return;isAbortError(error)?aborted2.add(stream):errorStream(passThroughStream,error);}},onInputStreamUnpipe=async({stream,streams,ended,aborted:aborted2,unpipeEvent,controller:{signal}})=>{if(await events.once(stream,unpipeEvent,{signal}),!stream.readable)return events.once(signal,"abort",{signal});streams.delete(stream),ended.delete(stream),aborted2.delete(stream);},endStream=stream=>{stream.writable&&stream.end();},errorOrAbortStream=(stream,error)=>{isAbortError(error)?abortStream(stream):errorStream(stream,error);},isAbortError=error=>error?.code==="ERR_STREAM_PREMATURE_CLOSE",abortStream=stream=>{(stream.readable||stream.writable)&&stream.destroy();},errorStream=(stream,error)=>{stream.destroyed||(stream.once("error",noop2),stream.destroy(error));},noop2=()=>{},updateMaxListeners=(passThroughStream,increment2)=>{let maxListeners=passThroughStream.getMaxListeners();maxListeners!==0&&maxListeners!==Number.POSITIVE_INFINITY&&passThroughStream.setMaxListeners(maxListeners+increment2);},PASSTHROUGH_LISTENERS_COUNT=2,PASSTHROUGH_LISTENERS_PER_STREAM=1;var pipeStreams=(source,destination)=>{source.pipe(destination),onSourceFinish(source,destination),onDestinationFinish(source,destination);},onSourceFinish=async(source,destination)=>{if(!(isStandardStream(source)||isStandardStream(destination))){try{await promises.finished(source,{cleanup:!0,readable:!0,writable:!1});}catch{}endDestinationStream(destination);}},endDestinationStream=destination=>{destination.writable&&destination.end();},onDestinationFinish=async(source,destination)=>{if(!(isStandardStream(source)||isStandardStream(destination))){try{await promises.finished(destination,{cleanup:!0,readable:!1,writable:!0});}catch{}abortSourceStream(source);}},abortSourceStream=source=>{source.readable&&source.destroy();};var pipeOutputAsync=(subprocess,fileDescriptors,controller)=>{let pipeGroups=new Map;for(let[fdNumber,{stdioItems,direction}]of Object.entries(fileDescriptors)){for(let{stream}of stdioItems.filter(({type})=>TRANSFORM_TYPES.has(type)))pipeTransform(subprocess,stream,direction,fdNumber);for(let{stream}of stdioItems.filter(({type})=>!TRANSFORM_TYPES.has(type)))pipeStdioItem({subprocess,stream,direction,fdNumber,pipeGroups,controller});}for(let[outputStream,inputStreams]of pipeGroups.entries()){let inputStream=inputStreams.length===1?inputStreams[0]:mergeStreams(inputStreams);pipeStreams(inputStream,outputStream);}},pipeTransform=(subprocess,stream,direction,fdNumber)=>{direction==="output"?pipeStreams(subprocess.stdio[fdNumber],stream):pipeStreams(stream,subprocess.stdio[fdNumber]);let streamProperty=SUBPROCESS_STREAM_PROPERTIES[fdNumber];streamProperty!==void 0&&(subprocess[streamProperty]=stream),subprocess.stdio[fdNumber]=stream;},SUBPROCESS_STREAM_PROPERTIES=["stdin","stdout","stderr"],pipeStdioItem=({subprocess,stream,direction,fdNumber,pipeGroups,controller})=>{if(stream===void 0)return;setStandardStreamMaxListeners(stream,controller);let[inputStream,outputStream]=direction==="output"?[stream,subprocess.stdio[fdNumber]]:[subprocess.stdio[fdNumber],stream],outputStreams=pipeGroups.get(inputStream)??[];pipeGroups.set(inputStream,[...outputStreams,outputStream]);},setStandardStreamMaxListeners=(stream,{signal})=>{isStandardStream(stream)&&incrementMaxListeners(stream,MAX_LISTENERS_INCREMENT,signal);},MAX_LISTENERS_INCREMENT=2;var signals=[];signals.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&signals.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var processOk=process10=>!!process10&&typeof process10=="object"&&typeof process10.removeListener=="function"&&typeof process10.emit=="function"&&typeof process10.reallyExit=="function"&&typeof process10.listeners=="function"&&typeof process10.kill=="function"&&typeof process10.pid=="number"&&typeof process10.on=="function",kExitEmitter=Symbol.for("signal-exit emitter"),global2=globalThis,ObjectDefineProperty=Object.defineProperty.bind(Object),Emitter=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(global2[kExitEmitter])return global2[kExitEmitter];ObjectDefineProperty(global2,kExitEmitter,{value:this,writable:!1,enumerable:!1,configurable:!1});}on(ev,fn){this.listeners[ev].push(fn);}removeListener(ev,fn){let list=this.listeners[ev],i2=list.indexOf(fn);i2!==-1&&(i2===0&&list.length===1?list.length=0:list.splice(i2,1));}emit(ev,code,signal){if(this.emitted[ev])return !1;this.emitted[ev]=!0;let ret=!1;for(let fn of this.listeners[ev])ret=fn(code,signal)===!0||ret;return ev==="exit"&&(ret=this.emit("afterExit",code,signal)||ret),ret}},SignalExitBase=class{},signalExitWrap=handler=>({onExit(cb,opts){return handler.onExit(cb,opts)},load(){return handler.load()},unload(){return handler.unload()}}),SignalExitFallback=class extends SignalExitBase{onExit(){return ()=>{}}load(){}unload(){}},SignalExit=class extends SignalExitBase{#hupSig=process9.platform==="win32"?"SIGINT":"SIGHUP";#emitter=new Emitter;#process;#originalProcessEmit;#originalProcessReallyExit;#sigListeners={};#loaded=!1;constructor(process10){super(),this.#process=process10,this.#sigListeners={};for(let sig of signals)this.#sigListeners[sig]=()=>{let listeners=this.#process.listeners(sig),{count:count2}=this.#emitter,p=process10;if(typeof p.__signal_exit_emitter__=="object"&&typeof p.__signal_exit_emitter__.count=="number"&&(count2+=p.__signal_exit_emitter__.count),listeners.length===count2){this.unload();let ret=this.#emitter.emit("exit",null,sig),s=sig==="SIGHUP"?this.#hupSig:sig;ret||process10.kill(process10.pid,s);}};this.#originalProcessReallyExit=process10.reallyExit,this.#originalProcessEmit=process10.emit;}onExit(cb,opts){if(!processOk(this.#process))return ()=>{};this.#loaded===!1&&this.load();let ev=opts?.alwaysLast?"afterExit":"exit";return this.#emitter.on(ev,cb),()=>{this.#emitter.removeListener(ev,cb),this.#emitter.listeners.exit.length===0&&this.#emitter.listeners.afterExit.length===0&&this.unload();}}load(){if(!this.#loaded){this.#loaded=!0,this.#emitter.count+=1;for(let sig of signals)try{let fn=this.#sigListeners[sig];fn&&this.#process.on(sig,fn);}catch{}this.#process.emit=(ev,...a2)=>this.#processEmit(ev,...a2),this.#process.reallyExit=code=>this.#processReallyExit(code);}}unload(){this.#loaded&&(this.#loaded=!1,signals.forEach(sig=>{let listener=this.#sigListeners[sig];if(!listener)throw new Error("Listener not defined for signal: "+sig);try{this.#process.removeListener(sig,listener);}catch{}}),this.#process.emit=this.#originalProcessEmit,this.#process.reallyExit=this.#originalProcessReallyExit,this.#emitter.count-=1);}#processReallyExit(code){return processOk(this.#process)?(this.#process.exitCode=code||0,this.#emitter.emit("exit",this.#process.exitCode,null),this.#originalProcessReallyExit.call(this.#process,this.#process.exitCode)):0}#processEmit(ev,...args){let og=this.#originalProcessEmit;if(ev==="exit"&&processOk(this.#process)){typeof args[0]=="number"&&(this.#process.exitCode=args[0]);let ret=og.call(this.#process,ev,...args);return this.#emitter.emit("exit",this.#process.exitCode,null),ret}else return og.call(this.#process,ev,...args)}},process9=globalThis.process,{onExit,load,unload}=signalExitWrap(processOk(process9)?new SignalExit(process9):new SignalExitFallback);var cleanupOnExit=(subprocess,{cleanup,detached},{signal})=>{if(!cleanup||detached)return;let removeExitHandler=onExit(()=>{subprocess.kill();});events.addAbortListener(signal,()=>{removeExitHandler();});};var normalizePipeArguments=({source,sourcePromise,boundOptions,createNested},...pipeArguments)=>{let startTime=getStartTime(),{destination,destinationStream,destinationError,from,unpipeSignal}=getDestinationStream(boundOptions,createNested,pipeArguments),{sourceStream,sourceError}=getSourceStream(source,from),{options:sourceOptions,fileDescriptors}=SUBPROCESS_OPTIONS.get(source);return {sourcePromise,sourceStream,sourceOptions,sourceError,destination,destinationStream,destinationError,unpipeSignal,fileDescriptors,startTime}},getDestinationStream=(boundOptions,createNested,pipeArguments)=>{try{let{destination,pipeOptions:{from,to,unpipeSignal}={}}=getDestination(boundOptions,createNested,...pipeArguments),destinationStream=getToStream(destination,to);return {destination,destinationStream,from,unpipeSignal}}catch(error){return {destinationError:error}}},getDestination=(boundOptions,createNested,firstArgument,...pipeArguments)=>{if(Array.isArray(firstArgument))return {destination:createNested(mapDestinationArguments,boundOptions)(firstArgument,...pipeArguments),pipeOptions:boundOptions};if(typeof firstArgument=="string"||firstArgument instanceof URL||isDenoExecPath(firstArgument)){if(Object.keys(boundOptions).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[rawFile,rawArguments,rawOptions]=normalizeParameters(firstArgument,...pipeArguments);return {destination:createNested(mapDestinationArguments)(rawFile,rawArguments,rawOptions),pipeOptions:rawOptions}}if(SUBPROCESS_OPTIONS.has(firstArgument)){if(Object.keys(boundOptions).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return {destination:firstArgument,pipeOptions:pipeArguments[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${firstArgument}`)},mapDestinationArguments=({options})=>({options:{...options,stdin:"pipe",piped:!0}}),getSourceStream=(source,from)=>{try{return {sourceStream:getFromStream(source,from)}}catch(error){return {sourceError:error}}};var handlePipeArgumentsError=({sourceStream,sourceError,destinationStream,destinationError,fileDescriptors,sourceOptions,startTime})=>{let error=getPipeArgumentsError({sourceStream,sourceError,destinationStream,destinationError});if(error!==void 0)throw createNonCommandError({error,fileDescriptors,sourceOptions,startTime})},getPipeArgumentsError=({sourceStream,sourceError,destinationStream,destinationError})=>{if(sourceError!==void 0&&destinationError!==void 0)return destinationError;if(destinationError!==void 0)return abortSourceStream(sourceStream),destinationError;if(sourceError!==void 0)return endDestinationStream(destinationStream),sourceError},createNonCommandError=({error,fileDescriptors,sourceOptions,startTime})=>makeEarlyError({error,command:PIPE_COMMAND_MESSAGE,escapedCommand:PIPE_COMMAND_MESSAGE,fileDescriptors,options:sourceOptions,startTime,isSync:!1}),PIPE_COMMAND_MESSAGE="source.pipe(destination)";var waitForBothSubprocesses=async subprocessPromises=>{let[{status:sourceStatus,reason:sourceReason,value:sourceResult=sourceReason},{status:destinationStatus,reason:destinationReason,value:destinationResult=destinationReason}]=await subprocessPromises;if(destinationResult.pipedFrom.includes(sourceResult)||destinationResult.pipedFrom.push(sourceResult),destinationStatus==="rejected")throw destinationResult;if(sourceStatus==="rejected")throw sourceResult;return destinationResult};var pipeSubprocessStream=(sourceStream,destinationStream,maxListenersController)=>{let mergedStream=MERGED_STREAMS.has(destinationStream)?pipeMoreSubprocessStream(sourceStream,destinationStream):pipeFirstSubprocessStream(sourceStream,destinationStream);return incrementMaxListeners(sourceStream,SOURCE_LISTENERS_PER_PIPE,maxListenersController.signal),incrementMaxListeners(destinationStream,DESTINATION_LISTENERS_PER_PIPE,maxListenersController.signal),cleanupMergedStreamsMap(destinationStream),mergedStream},pipeFirstSubprocessStream=(sourceStream,destinationStream)=>{let mergedStream=mergeStreams([sourceStream]);return pipeStreams(mergedStream,destinationStream),MERGED_STREAMS.set(destinationStream,mergedStream),mergedStream},pipeMoreSubprocessStream=(sourceStream,destinationStream)=>{let mergedStream=MERGED_STREAMS.get(destinationStream);return mergedStream.add(sourceStream),mergedStream},cleanupMergedStreamsMap=async destinationStream=>{try{await promises.finished(destinationStream,{cleanup:!0,readable:!1,writable:!0});}catch{}MERGED_STREAMS.delete(destinationStream);},MERGED_STREAMS=new WeakMap,SOURCE_LISTENERS_PER_PIPE=2,DESTINATION_LISTENERS_PER_PIPE=1;var unpipeOnAbort=(unpipeSignal,unpipeContext)=>unpipeSignal===void 0?[]:[unpipeOnSignalAbort(unpipeSignal,unpipeContext)],unpipeOnSignalAbort=async(unpipeSignal,{sourceStream,mergedStream,fileDescriptors,sourceOptions,startTime})=>{await util.aborted(unpipeSignal,sourceStream),await mergedStream.remove(sourceStream);let error=new Error("Pipe canceled by `unpipeSignal` option.");throw createNonCommandError({error,fileDescriptors,sourceOptions,startTime})};var pipeToSubprocess=(sourceInfo,...pipeArguments)=>{if(isPlainObject(pipeArguments[0]))return pipeToSubprocess.bind(void 0,{...sourceInfo,boundOptions:{...sourceInfo.boundOptions,...pipeArguments[0]}});let{destination,...normalizedInfo}=normalizePipeArguments(sourceInfo,...pipeArguments),promise=handlePipePromise({...normalizedInfo,destination});return promise.pipe=pipeToSubprocess.bind(void 0,{...sourceInfo,source:destination,sourcePromise:promise,boundOptions:{}}),promise},handlePipePromise=async({sourcePromise,sourceStream,sourceOptions,sourceError,destination,destinationStream,destinationError,unpipeSignal,fileDescriptors,startTime})=>{let subprocessPromises=getSubprocessPromises(sourcePromise,destination);handlePipeArgumentsError({sourceStream,sourceError,destinationStream,destinationError,fileDescriptors,sourceOptions,startTime});let maxListenersController=new AbortController;try{let mergedStream=pipeSubprocessStream(sourceStream,destinationStream,maxListenersController);return await Promise.race([waitForBothSubprocesses(subprocessPromises),...unpipeOnAbort(unpipeSignal,{sourceStream,mergedStream,sourceOptions,fileDescriptors,startTime})])}finally{maxListenersController.abort();}},getSubprocessPromises=(sourcePromise,destination)=>Promise.allSettled([sourcePromise,destination]);var iterateOnSubprocessStream=({subprocessStdout,subprocess,binary,shouldEncode,encoding,preserveNewlines})=>{let controller=new AbortController;return stopReadingOnExit(subprocess,controller),iterateOnStream({stream:subprocessStdout,controller,binary,shouldEncode:!subprocessStdout.readableObjectMode&&shouldEncode,encoding,shouldSplit:!subprocessStdout.readableObjectMode,preserveNewlines})},stopReadingOnExit=async(subprocess,controller)=>{try{await subprocess;}catch{}finally{controller.abort();}},iterateForResult=({stream,onStreamEnd,lines,encoding,stripFinalNewline:stripFinalNewline2,allMixed})=>{let controller=new AbortController;stopReadingOnStreamEnd(onStreamEnd,controller,stream);let objectMode=stream.readableObjectMode&&!allMixed;return iterateOnStream({stream,controller,binary:encoding==="buffer",shouldEncode:!objectMode,encoding,shouldSplit:!objectMode&&lines,preserveNewlines:!stripFinalNewline2})},stopReadingOnStreamEnd=async(onStreamEnd,controller,stream)=>{try{await onStreamEnd;}catch{stream.destroy();}finally{controller.abort();}},iterateOnStream=({stream,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines})=>{let onStdoutChunk=events.on(stream,"data",{signal:controller.signal,highWaterMark:HIGH_WATER_MARK,highWatermark:HIGH_WATER_MARK});return iterateOnData({onStdoutChunk,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines})},DEFAULT_OBJECT_HIGH_WATER_MARK=stream.getDefaultHighWaterMark(!0),HIGH_WATER_MARK=DEFAULT_OBJECT_HIGH_WATER_MARK,iterateOnData=async function*({onStdoutChunk,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines}){let generators=getGenerators({binary,shouldEncode,encoding,shouldSplit,preserveNewlines});try{for await(let[chunk]of onStdoutChunk)yield*transformChunkSync(chunk,generators,0);}catch(error){if(!controller.signal.aborted)throw error}finally{yield*finalChunksSync(generators);}},getGenerators=({binary,shouldEncode,encoding,shouldSplit,preserveNewlines})=>[getEncodingTransformGenerator(binary,encoding,!shouldEncode),getSplitLinesGenerator(binary,preserveNewlines,!shouldSplit,{})].filter(Boolean);var getStreamOutput=async({stream,onStreamEnd,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>{let logPromise=logOutputAsync({stream,onStreamEnd,fdNumber,encoding,allMixed,verboseInfo,streamInfo});if(!buffer){await Promise.all([resumeStream(stream),logPromise]);return}let stripFinalNewlineValue=getStripFinalNewline(stripFinalNewline2,fdNumber),iterable=iterateForResult({stream,onStreamEnd,lines,encoding,stripFinalNewline:stripFinalNewlineValue,allMixed}),[output]=await Promise.all([getStreamContents2({stream,iterable,fdNumber,encoding,maxBuffer,lines}),logPromise]);return output},logOutputAsync=async({stream,onStreamEnd,fdNumber,encoding,allMixed,verboseInfo,streamInfo:{fileDescriptors}})=>{if(!shouldLogOutput({stdioItems:fileDescriptors[fdNumber]?.stdioItems,encoding,verboseInfo,fdNumber}))return;let linesIterable=iterateForResult({stream,onStreamEnd,lines:!0,encoding,stripFinalNewline:!0,allMixed});await logLines(linesIterable,stream,fdNumber,verboseInfo);},resumeStream=async stream=>{await promises$1.setImmediate(),stream.readableFlowing===null&&stream.resume();},getStreamContents2=async({stream,stream:{readableObjectMode},iterable,fdNumber,encoding,maxBuffer,lines})=>{try{return readableObjectMode||lines?await getStreamAsArray(iterable,{maxBuffer}):encoding==="buffer"?new Uint8Array(await getStreamAsArrayBuffer(iterable,{maxBuffer})):await getStreamAsString(iterable,{maxBuffer})}catch(error){return handleBufferedData(handleMaxBuffer({error,stream,readableObjectMode,lines,encoding,fdNumber}))}},getBufferedData=async streamPromise=>{try{return await streamPromise}catch(error){return handleBufferedData(error)}},handleBufferedData=({bufferedData})=>isArrayBuffer(bufferedData)?new Uint8Array(bufferedData):bufferedData;var waitForStream=async(stream,fdNumber,streamInfo,{isSameDirection,stopOnExit=!1}={})=>{let state=handleStdinDestroy(stream,streamInfo),abortController=new AbortController;try{await Promise.race([...stopOnExit?[streamInfo.exitPromise]:[],promises.finished(stream,{cleanup:!0,signal:abortController.signal})]);}catch(error){state.stdinCleanedUp||handleStreamError(error,fdNumber,streamInfo,isSameDirection);}finally{abortController.abort();}},handleStdinDestroy=(stream,{originalStreams:[originalStdin],subprocess})=>{let state={stdinCleanedUp:!1};return stream===originalStdin&&spyOnStdinDestroy(stream,subprocess,state),state},spyOnStdinDestroy=(subprocessStdin,subprocess,state)=>{let{_destroy}=subprocessStdin;subprocessStdin._destroy=(...destroyArguments)=>{setStdinCleanedUp(subprocess,state),_destroy.call(subprocessStdin,...destroyArguments);};},setStdinCleanedUp=({exitCode,signalCode},state)=>{(exitCode!==null||signalCode!==null)&&(state.stdinCleanedUp=!0);},handleStreamError=(error,fdNumber,streamInfo,isSameDirection)=>{if(!shouldIgnoreStreamError(error,fdNumber,streamInfo,isSameDirection))throw error},shouldIgnoreStreamError=(error,fdNumber,streamInfo,isSameDirection=!0)=>streamInfo.propagating?isStreamEpipe(error)||isStreamAbort(error):(streamInfo.propagating=!0,isInputFileDescriptor(streamInfo,fdNumber)===isSameDirection?isStreamEpipe(error):isStreamAbort(error)),isInputFileDescriptor=({fileDescriptors},fdNumber)=>fdNumber!=="all"&&fileDescriptors[fdNumber].direction==="input",isStreamAbort=error=>error?.code==="ERR_STREAM_PREMATURE_CLOSE",isStreamEpipe=error=>error?.code==="EPIPE";var waitForStdioStreams=({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>subprocess.stdio.map((stream,fdNumber)=>waitForSubprocessStream({stream,fdNumber,encoding,buffer:buffer[fdNumber],maxBuffer:maxBuffer[fdNumber],lines:lines[fdNumber],allMixed:!1,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})),waitForSubprocessStream=async({stream,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>{if(!stream)return;let onStreamEnd=waitForStream(stream,fdNumber,streamInfo);if(isInputFileDescriptor(streamInfo,fdNumber)){await onStreamEnd;return}let[output]=await Promise.all([getStreamOutput({stream,onStreamEnd,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),onStreamEnd]);return output};var makeAllStream=({stdout,stderr},{all})=>all&&(stdout||stderr)?mergeStreams([stdout,stderr].filter(Boolean)):void 0,waitForAllStream=({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>waitForSubprocessStream({...getAllStream(subprocess,buffer),fdNumber:"all",encoding,maxBuffer:maxBuffer[1]+maxBuffer[2],lines:lines[1]||lines[2],allMixed:getAllMixed(subprocess),stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),getAllStream=({stdout,stderr,all},[,bufferStdout,bufferStderr])=>{let buffer=bufferStdout||bufferStderr;return buffer?bufferStdout?bufferStderr?{stream:all,buffer}:{stream:stdout,buffer}:{stream:stderr,buffer}:{stream:all,buffer}},getAllMixed=({all,stdout,stderr})=>all&&stdout&&stderr&&stdout.readableObjectMode!==stderr.readableObjectMode;var shouldLogIpc=verboseInfo=>isFullVerbose(verboseInfo,"ipc"),logIpcOutput=(message,verboseInfo)=>{let verboseMessage=serializeVerboseMessage(message);verboseLog({type:"ipc",verboseMessage,fdNumber:"ipc",verboseInfo});};var waitForIpcOutput=async({subprocess,buffer:bufferArray,maxBuffer:maxBufferArray,ipc,ipcOutput,verboseInfo})=>{if(!ipc)return ipcOutput;let isVerbose2=shouldLogIpc(verboseInfo),buffer=getFdSpecificValue(bufferArray,"ipc"),maxBuffer=getFdSpecificValue(maxBufferArray,"ipc");for await(let message of loopOnMessages({anyProcess:subprocess,channel:subprocess.channel,isSubprocess:!1,ipc,shouldAwait:!1,reference:!0}))buffer&&(checkIpcMaxBuffer(subprocess,ipcOutput,maxBuffer),ipcOutput.push(message)),isVerbose2&&logIpcOutput(message,verboseInfo);return ipcOutput},getBufferedIpcOutput=async(ipcOutputPromise,ipcOutput)=>(await Promise.allSettled([ipcOutputPromise]),ipcOutput);var waitForSubprocessResult=async({subprocess,options:{encoding,buffer,maxBuffer,lines,timeoutDuration:timeout,cancelSignal,gracefulCancel,forceKillAfterDelay,stripFinalNewline:stripFinalNewline2,ipc,ipcInput},context,verboseInfo,fileDescriptors,originalStreams,onInternalError,controller})=>{let exitPromise=waitForExit(subprocess,context),streamInfo={originalStreams,fileDescriptors,subprocess,exitPromise,propagating:!1},stdioPromises=waitForStdioStreams({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),allPromise=waitForAllStream({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),ipcOutput=[],ipcOutputPromise=waitForIpcOutput({subprocess,buffer,maxBuffer,ipc,ipcOutput,verboseInfo}),originalPromises=waitForOriginalStreams(originalStreams,subprocess,streamInfo),customStreamsEndPromises=waitForCustomStreamsEnd(fileDescriptors,streamInfo);try{return await Promise.race([Promise.all([{},waitForSuccessfulExit(exitPromise),Promise.all(stdioPromises),allPromise,ipcOutputPromise,sendIpcInput(subprocess,ipcInput),...originalPromises,...customStreamsEndPromises]),onInternalError,throwOnSubprocessError(subprocess,controller),...throwOnTimeout(subprocess,timeout,context,controller),...throwOnCancel({subprocess,cancelSignal,gracefulCancel,context,controller}),...throwOnGracefulCancel({subprocess,cancelSignal,gracefulCancel,forceKillAfterDelay,context,controller})])}catch(error){return context.terminationReason??="other",Promise.all([{error},exitPromise,Promise.all(stdioPromises.map(stdioPromise=>getBufferedData(stdioPromise))),getBufferedData(allPromise),getBufferedIpcOutput(ipcOutputPromise,ipcOutput),Promise.allSettled(originalPromises),Promise.allSettled(customStreamsEndPromises)])}},waitForOriginalStreams=(originalStreams,subprocess,streamInfo)=>originalStreams.map((stream,fdNumber)=>stream===subprocess.stdio[fdNumber]?void 0:waitForStream(stream,fdNumber,streamInfo)),waitForCustomStreamsEnd=(fileDescriptors,streamInfo)=>fileDescriptors.flatMap(({stdioItems},fdNumber)=>stdioItems.filter(({value,stream=value})=>isStream(stream,{checkOpen:!1})&&!isStandardStream(stream)).map(({type,value,stream=value})=>waitForStream(stream,fdNumber,streamInfo,{isSameDirection:TRANSFORM_TYPES.has(type),stopOnExit:type==="native"}))),throwOnSubprocessError=async(subprocess,{signal})=>{let[error]=await events.once(subprocess,"error",{signal});throw error};var initializeConcurrentStreams=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),addConcurrentStream=(concurrentStreams,stream,waitName)=>{let weakMap=concurrentStreams[waitName];weakMap.has(stream)||weakMap.set(stream,[]);let promises=weakMap.get(stream),promise=createDeferred();return promises.push(promise),{resolve:promise.resolve.bind(promise),promises}},waitForConcurrentStreams=async({resolve,promises},subprocess)=>{resolve();let[isSubprocessExit]=await Promise.race([Promise.allSettled([!0,subprocess]),Promise.all([!1,...promises])]);return !isSubprocessExit};var safeWaitForSubprocessStdin=async subprocessStdin=>{if(subprocessStdin!==void 0)try{await waitForSubprocessStdin(subprocessStdin);}catch{}},safeWaitForSubprocessStdout=async subprocessStdout=>{if(subprocessStdout!==void 0)try{await waitForSubprocessStdout(subprocessStdout);}catch{}},waitForSubprocessStdin=async subprocessStdin=>{await promises.finished(subprocessStdin,{cleanup:!0,readable:!1,writable:!0});},waitForSubprocessStdout=async subprocessStdout=>{await promises.finished(subprocessStdout,{cleanup:!0,readable:!0,writable:!1});},waitForSubprocess=async(subprocess,error)=>{if(await subprocess,error)throw error},destroyOtherStream=(stream,isOpen,error)=>{error&&!isStreamAbort(error)?stream.destroy(error):isOpen&&stream.destroy();};var createReadable=({subprocess,concurrentStreams,encoding},{from,binary:binaryOption=!0,preserveNewlines=!0}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),{subprocessStdout,waitReadableDestroy}=getSubprocessStdout(subprocess,from,concurrentStreams),{readableEncoding,readableObjectMode,readableHighWaterMark}=getReadableOptions(subprocessStdout,binary),{read,onStdoutDataDone}=getReadableMethods({subprocessStdout,subprocess,binary,encoding,preserveNewlines}),readable2=new stream.Readable({read,destroy:util.callbackify(onReadableDestroy.bind(void 0,{subprocessStdout,subprocess,waitReadableDestroy})),highWaterMark:readableHighWaterMark,objectMode:readableObjectMode,encoding:readableEncoding});return onStdoutFinished({subprocessStdout,onStdoutDataDone,readable:readable2,subprocess}),readable2},getSubprocessStdout=(subprocess,from,concurrentStreams)=>{let subprocessStdout=getFromStream(subprocess,from),waitReadableDestroy=addConcurrentStream(concurrentStreams,subprocessStdout,"readableDestroy");return {subprocessStdout,waitReadableDestroy}},getReadableOptions=({readableEncoding,readableObjectMode,readableHighWaterMark},binary)=>binary?{readableEncoding,readableObjectMode,readableHighWaterMark}:{readableEncoding,readableObjectMode:!0,readableHighWaterMark:DEFAULT_OBJECT_HIGH_WATER_MARK},getReadableMethods=({subprocessStdout,subprocess,binary,encoding,preserveNewlines})=>{let onStdoutDataDone=createDeferred(),onStdoutData=iterateOnSubprocessStream({subprocessStdout,subprocess,binary,shouldEncode:!binary,encoding,preserveNewlines});return {read(){onRead(this,onStdoutData,onStdoutDataDone);},onStdoutDataDone}},onRead=async(readable2,onStdoutData,onStdoutDataDone)=>{try{let{value,done}=await onStdoutData.next();done?onStdoutDataDone.resolve():readable2.push(value);}catch{}},onStdoutFinished=async({subprocessStdout,onStdoutDataDone,readable:readable2,subprocess,subprocessStdin})=>{try{await waitForSubprocessStdout(subprocessStdout),await subprocess,await safeWaitForSubprocessStdin(subprocessStdin),await onStdoutDataDone,readable2.readable&&readable2.push(null);}catch(error){await safeWaitForSubprocessStdin(subprocessStdin),destroyOtherReadable(readable2,error);}},onReadableDestroy=async({subprocessStdout,subprocess,waitReadableDestroy},error)=>{await waitForConcurrentStreams(waitReadableDestroy,subprocess)&&(destroyOtherReadable(subprocessStdout,error),await waitForSubprocess(subprocess,error));},destroyOtherReadable=(stream,error)=>{destroyOtherStream(stream,stream.readable,error);};var createWritable=({subprocess,concurrentStreams},{to}={})=>{let{subprocessStdin,waitWritableFinal,waitWritableDestroy}=getSubprocessStdin(subprocess,to,concurrentStreams),writable2=new stream.Writable({...getWritableMethods(subprocessStdin,subprocess,waitWritableFinal),destroy:util.callbackify(onWritableDestroy.bind(void 0,{subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy})),highWaterMark:subprocessStdin.writableHighWaterMark,objectMode:subprocessStdin.writableObjectMode});return onStdinFinished(subprocessStdin,writable2),writable2},getSubprocessStdin=(subprocess,to,concurrentStreams)=>{let subprocessStdin=getToStream(subprocess,to),waitWritableFinal=addConcurrentStream(concurrentStreams,subprocessStdin,"writableFinal"),waitWritableDestroy=addConcurrentStream(concurrentStreams,subprocessStdin,"writableDestroy");return {subprocessStdin,waitWritableFinal,waitWritableDestroy}},getWritableMethods=(subprocessStdin,subprocess,waitWritableFinal)=>({write:onWrite.bind(void 0,subprocessStdin),final:util.callbackify(onWritableFinal.bind(void 0,subprocessStdin,subprocess,waitWritableFinal))}),onWrite=(subprocessStdin,chunk,encoding,done)=>{subprocessStdin.write(chunk,encoding)?done():subprocessStdin.once("drain",done);},onWritableFinal=async(subprocessStdin,subprocess,waitWritableFinal)=>{await waitForConcurrentStreams(waitWritableFinal,subprocess)&&(subprocessStdin.writable&&subprocessStdin.end(),await subprocess);},onStdinFinished=async(subprocessStdin,writable2,subprocessStdout)=>{try{await waitForSubprocessStdin(subprocessStdin),writable2.writable&&writable2.end();}catch(error){await safeWaitForSubprocessStdout(subprocessStdout),destroyOtherWritable(writable2,error);}},onWritableDestroy=async({subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy},error)=>{await waitForConcurrentStreams(waitWritableFinal,subprocess),await waitForConcurrentStreams(waitWritableDestroy,subprocess)&&(destroyOtherWritable(subprocessStdin,error),await waitForSubprocess(subprocess,error));},destroyOtherWritable=(stream,error)=>{destroyOtherStream(stream,stream.writable,error);};var createDuplex=({subprocess,concurrentStreams,encoding},{from,to,binary:binaryOption=!0,preserveNewlines=!0}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),{subprocessStdout,waitReadableDestroy}=getSubprocessStdout(subprocess,from,concurrentStreams),{subprocessStdin,waitWritableFinal,waitWritableDestroy}=getSubprocessStdin(subprocess,to,concurrentStreams),{readableEncoding,readableObjectMode,readableHighWaterMark}=getReadableOptions(subprocessStdout,binary),{read,onStdoutDataDone}=getReadableMethods({subprocessStdout,subprocess,binary,encoding,preserveNewlines}),duplex2=new stream.Duplex({read,...getWritableMethods(subprocessStdin,subprocess,waitWritableFinal),destroy:util.callbackify(onDuplexDestroy.bind(void 0,{subprocessStdout,subprocessStdin,subprocess,waitReadableDestroy,waitWritableFinal,waitWritableDestroy})),readableHighWaterMark,writableHighWaterMark:subprocessStdin.writableHighWaterMark,readableObjectMode,writableObjectMode:subprocessStdin.writableObjectMode,encoding:readableEncoding});return onStdoutFinished({subprocessStdout,onStdoutDataDone,readable:duplex2,subprocess,subprocessStdin}),onStdinFinished(subprocessStdin,duplex2,subprocessStdout),duplex2},onDuplexDestroy=async({subprocessStdout,subprocessStdin,subprocess,waitReadableDestroy,waitWritableFinal,waitWritableDestroy},error)=>{await Promise.all([onReadableDestroy({subprocessStdout,subprocess,waitReadableDestroy},error),onWritableDestroy({subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy},error)]);};var createIterable=(subprocess,encoding,{from,binary:binaryOption=!1,preserveNewlines=!1}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),subprocessStdout=getFromStream(subprocess,from),onStdoutData=iterateOnSubprocessStream({subprocessStdout,subprocess,binary,shouldEncode:!0,encoding,preserveNewlines});return iterateOnStdoutData(onStdoutData,subprocessStdout,subprocess)},iterateOnStdoutData=async function*(onStdoutData,subprocessStdout,subprocess){try{yield*onStdoutData;}finally{subprocessStdout.readable&&subprocessStdout.destroy(),await subprocess;}};var addConvertedStreams=(subprocess,{encoding})=>{let concurrentStreams=initializeConcurrentStreams();subprocess.readable=createReadable.bind(void 0,{subprocess,concurrentStreams,encoding}),subprocess.writable=createWritable.bind(void 0,{subprocess,concurrentStreams}),subprocess.duplex=createDuplex.bind(void 0,{subprocess,concurrentStreams,encoding}),subprocess.iterable=createIterable.bind(void 0,subprocess,encoding),subprocess[Symbol.asyncIterator]=createIterable.bind(void 0,subprocess,encoding,{});};var mergePromise=(subprocess,promise)=>{for(let[property,descriptor]of descriptors){let value=descriptor.value.bind(promise);Reflect.defineProperty(subprocess,property,{...descriptor,value});}},nativePromisePrototype=(async()=>{})().constructor.prototype,descriptors=["then","catch","finally"].map(property=>[property,Reflect.getOwnPropertyDescriptor(nativePromisePrototype,property)]);var execaCoreAsync=(rawFile,rawArguments,rawOptions,createNested)=>{let{file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}=handleAsyncArguments(rawFile,rawArguments,rawOptions),{subprocess,promise}=spawnSubprocessAsync({file,commandArguments,options,startTime,verboseInfo,command,escapedCommand,fileDescriptors});return subprocess.pipe=pipeToSubprocess.bind(void 0,{source:subprocess,sourcePromise:promise,boundOptions:{},createNested}),mergePromise(subprocess,promise),SUBPROCESS_OPTIONS.set(subprocess,{options,fileDescriptors}),subprocess},handleAsyncArguments=(rawFile,rawArguments,rawOptions)=>{let{command,escapedCommand,startTime,verboseInfo}=handleCommand(rawFile,rawArguments,rawOptions),{file,commandArguments,options:normalizedOptions}=normalizeOptions(rawFile,rawArguments,rawOptions),options=handleAsyncOptions(normalizedOptions),fileDescriptors=handleStdioAsync(options,verboseInfo);return {file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}},handleAsyncOptions=({timeout,signal,...options})=>{if(signal!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return {...options,timeoutDuration:timeout}},spawnSubprocessAsync=({file,commandArguments,options,startTime,verboseInfo,command,escapedCommand,fileDescriptors})=>{let subprocess;try{subprocess=child_process.spawn(file,commandArguments,options);}catch(error){return handleEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,verboseInfo})}let controller=new AbortController;events.setMaxListeners(Number.POSITIVE_INFINITY,controller.signal);let originalStreams=[...subprocess.stdio];pipeOutputAsync(subprocess,fileDescriptors,controller),cleanupOnExit(subprocess,options,controller);let context={},onInternalError=createDeferred();subprocess.kill=subprocessKill.bind(void 0,{kill:subprocess.kill.bind(subprocess),options,onInternalError,context,controller}),subprocess.all=makeAllStream(subprocess,options),addConvertedStreams(subprocess,options),addIpcMethods(subprocess,options);let promise=handlePromise({subprocess,options,startTime,verboseInfo,fileDescriptors,originalStreams,command,escapedCommand,context,onInternalError,controller});return {subprocess,promise}},handlePromise=async({subprocess,options,startTime,verboseInfo,fileDescriptors,originalStreams,command,escapedCommand,context,onInternalError,controller})=>{let[errorInfo,[exitCode,signal],stdioResults,allResult,ipcOutput]=await waitForSubprocessResult({subprocess,options,context,verboseInfo,fileDescriptors,originalStreams,onInternalError,controller});controller.abort(),onInternalError.resolve();let stdio=stdioResults.map((stdioResult,fdNumber)=>stripNewline(stdioResult,options,fdNumber)),all=stripNewline(allResult,options,"all"),result=getAsyncResult({errorInfo,exitCode,signal,stdio,all,ipcOutput,context,options,command,escapedCommand,startTime});return handleResult(result,verboseInfo,options)},getAsyncResult=({errorInfo,exitCode,signal,stdio,all,ipcOutput,context,options,command,escapedCommand,startTime})=>"error"in errorInfo?makeError({error:errorInfo.error,command,escapedCommand,timedOut:context.terminationReason==="timeout",isCanceled:context.terminationReason==="cancel"||context.terminationReason==="gracefulCancel",isGracefullyCanceled:context.terminationReason==="gracefulCancel",isMaxBuffer:errorInfo.error instanceof MaxBufferError,isForcefullyTerminated:context.isForcefullyTerminated,exitCode,signal,stdio,all,ipcOutput,options,startTime,isSync:!1}):makeSuccessResult({command,escapedCommand,stdio,all,ipcOutput,options,startTime});var mergeOptions=(boundOptions,options)=>{let newOptions=Object.fromEntries(Object.entries(options).map(([optionName,optionValue])=>[optionName,mergeOption(optionName,boundOptions[optionName],optionValue)]));return {...boundOptions,...newOptions}},mergeOption=(optionName,boundOptionValue,optionValue)=>DEEP_OPTIONS.has(optionName)&&isPlainObject(boundOptionValue)&&isPlainObject(optionValue)?{...boundOptionValue,...optionValue}:optionValue,DEEP_OPTIONS=new Set(["env",...FD_SPECIFIC_OPTIONS]);var createExeca=(mapArguments,boundOptions,deepOptions,setBoundExeca)=>{let createNested=(mapArguments2,boundOptions2,setBoundExeca2)=>createExeca(mapArguments2,boundOptions2,deepOptions,setBoundExeca2),boundExeca=(...execaArguments)=>callBoundExeca({mapArguments,deepOptions,boundOptions,setBoundExeca,createNested},...execaArguments);return setBoundExeca!==void 0&&setBoundExeca(boundExeca,createNested,boundOptions),boundExeca},callBoundExeca=({mapArguments,deepOptions={},boundOptions={},setBoundExeca,createNested},firstArgument,...nextArguments)=>{if(isPlainObject(firstArgument))return createNested(mapArguments,mergeOptions(boundOptions,firstArgument),setBoundExeca);let{file,commandArguments,options,isSync}=parseArguments({mapArguments,firstArgument,nextArguments,deepOptions,boundOptions});return isSync?execaCoreSync(file,commandArguments,options):execaCoreAsync(file,commandArguments,options,createNested)},parseArguments=({mapArguments,firstArgument,nextArguments,deepOptions,boundOptions})=>{let callArguments=isTemplateString(firstArgument)?parseTemplates(firstArgument,nextArguments):[firstArgument,...nextArguments],[initialFile,initialArguments,initialOptions]=normalizeParameters(...callArguments),mergedOptions=mergeOptions(mergeOptions(deepOptions,boundOptions),initialOptions),{file=initialFile,commandArguments=initialArguments,options=mergedOptions,isSync=!1}=mapArguments({file:initialFile,commandArguments:initialArguments,options:mergedOptions});return {file,commandArguments,options,isSync}};var mapCommandAsync=({file,commandArguments})=>parseCommand(file,commandArguments),mapCommandSync=({file,commandArguments})=>({...parseCommand(file,commandArguments),isSync:!0}),parseCommand=(command,unusedArguments)=>{if(unusedArguments.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${command} ${unusedArguments}.`);let[file,...commandArguments]=parseCommandString(command);return {file,commandArguments}},parseCommandString=command=>{if(typeof command!="string")throw new TypeError(`The command must be a string: ${String(command)}.`);let trimmedCommand=command.trim();if(trimmedCommand==="")return [];let tokens=[];for(let token of trimmedCommand.split(SPACES_REGEXP)){let previousToken=tokens.at(-1);previousToken&&previousToken.endsWith("\\")?tokens[tokens.length-1]=`${previousToken.slice(0,-1)} ${token}`:tokens.push(token);}return tokens},SPACES_REGEXP=/ +/g;var setScriptSync=(boundExeca,createNested,boundOptions)=>{boundExeca.sync=createNested(mapScriptSync,boundOptions),boundExeca.s=boundExeca.sync;},mapScriptAsync=({options})=>getScriptOptions(options),mapScriptSync=({options})=>({...getScriptOptions(options),isSync:!0}),getScriptOptions=options=>({options:{...getScriptStdinOption(options),...options}}),getScriptStdinOption=({input,inputFile,stdio})=>input===void 0&&inputFile===void 0&&stdio===void 0?{stdin:"inherit"}:{},deepScriptOptions={preferLocal:!0};var execa=createExeca(()=>({}));createExeca(()=>({isSync:!0}));createExeca(mapCommandAsync);createExeca(mapCommandSync);createExeca(mapNode);createExeca(mapScriptAsync,{},deepScriptOptions,setScriptSync);getIpcExport();var $2=execa({preferLocal:!0,stdio:"inherit",reject:!1});async function postinstall(options){await $2({stdio:"inherit"})`storybook automigrate addonA11yAddonTest ${options.yes?"--yes":""}`;}
68
68
 
69
69
  module.exports = postinstall;
package/dist/preview.d.ts CHANGED
@@ -6,6 +6,5 @@ declare const initialGlobals: {
6
6
  manual: boolean;
7
7
  };
8
8
  };
9
- declare const tags: string[];
10
9
 
11
- export { experimental_afterEach, initialGlobals, tags };
10
+ export { experimental_afterEach, initialGlobals };
package/dist/preview.js CHANGED
@@ -25,8 +25,7 @@ function _interopNamespace(e) {
25
25
 
26
26
  var matchers__namespace = /*#__PURE__*/_interopNamespace(matchers);
27
27
 
28
- var ADDON_ID="storybook/a11y";var RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL},A11Y_TEST_TAG="a11ytest";var{document: document$1}=global.global,channel=previewApi.addons.getChannel(),defaultParameters={config:{},options:{}},disabledRules=["region"],queue=[],isRunning=!1,runNext=async()=>{if(queue.length===0){isRunning=!1;return}isRunning=!0;let next=queue.shift();next&&await next(),runNext();},run=async(input=defaultParameters)=>{let{default:axe}=await import('axe-core'),{element="#storybook-root",config={},options={}}=input,htmlElement=document$1.querySelector(element)??document$1.body;if(!htmlElement)return;axe.reset();let configWithDefault={...config,rules:[...disabledRules.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(htmlElement,options);resolve(result);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=defaultParameters)=>{try{let result=await run(input),resultJson=JSON.parse(JSON.stringify(result));channel.emit(EVENTS.RESULT,resultJson,storyId);}catch(error){channel.emit(EVENTS.ERROR,error);}});function getIsVitestStandaloneRun(){try{return undefined.VITEST_STORYBOOK==="false"}catch{return !1}}function getIsVitestRunning(){try{return undefined.MODE==="test"}catch{return !1}}test.expect.extend(matchers__namespace);var experimental_afterEach=async({reporting,parameters,globals,tags:tags2})=>{let a11yParameter=parameters.a11y,a11yGlobals=globals.a11y;if(a11yParameter?.manual!==!0&&a11yParameter?.disable!==!0&&a11yGlobals?.manual!==!0){if(getIsVitestRunning()&&!tags2.includes(A11Y_TEST_TAG))return;try{let result=await run(a11yParameter);if(result){let hasViolations=(result?.violations.length??0)>0;reporting.addReport({type:"a11y",version:1,result,status:hasViolations?"failed":"passed"}),getIsVitestStandaloneRun()&&hasViolations&&test.expect(result).toHaveNoViolations();}}catch(e){if(reporting.addReport({type:"a11y",version:1,result:{error:e},status:"failed"}),getIsVitestStandaloneRun())throw e}}},initialGlobals={a11y:{manual:!1}},tags=["a11ytest"];
28
+ var ADDON_ID="storybook/a11y";var RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL},A11Y_TEST_TAG="a11y-test";var{document: document$1}=global.global,channel=previewApi.addons.getChannel(),defaultParameters={config:{},options:{}},disabledRules=["region"],queue=[],isRunning=!1,runNext=async()=>{if(queue.length===0){isRunning=!1;return}isRunning=!0;let next=queue.shift();next&&await next(),runNext();},run=async(input=defaultParameters)=>{let{default:axe}=await import('axe-core'),{element="body",config={},options={}}=input,htmlElement=document$1.querySelector(element)??document$1.body;if(!htmlElement)return;axe.reset();let configWithDefault={...config,rules:[...disabledRules.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(htmlElement,options);resolve(result);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=defaultParameters)=>{try{let result=await run(input),resultJson=JSON.parse(JSON.stringify(result));channel.emit(EVENTS.RESULT,resultJson,storyId);}catch(error){channel.emit(EVENTS.ERROR,error);}});function getIsVitestStandaloneRun(){try{return undefined.VITEST_STORYBOOK==="false"}catch{return !1}}function getIsVitestRunning(){try{return undefined.MODE==="test"}catch{return !1}}test.expect.extend(matchers__namespace);var experimental_afterEach=async({reporting,parameters,globals,tags})=>{let a11yParameter=parameters.a11y,a11yGlobals=globals.a11y;if(a11yParameter?.manual!==!0&&a11yParameter?.disable!==!0&&a11yGlobals?.manual!==!0){if(getIsVitestRunning()&&!tags.includes(A11Y_TEST_TAG))return;try{let result=await run(a11yParameter);if(result){let hasViolations=(result?.violations.length??0)>0;reporting.addReport({type:"a11y",version:1,result,status:hasViolations?"failed":"passed"}),getIsVitestStandaloneRun()&&hasViolations&&test.expect(result).toHaveNoViolations();}}catch(e){if(reporting.addReport({type:"a11y",version:1,result:{error:e},status:"failed"}),getIsVitestStandaloneRun())throw e}}},initialGlobals={a11y:{manual:!1}};
29
29
 
30
30
  exports.experimental_afterEach = experimental_afterEach;
31
31
  exports.initialGlobals = initialGlobals;
32
- exports.tags = tags;
package/dist/preview.mjs CHANGED
@@ -3,6 +3,6 @@ import { expect } from '@storybook/test';
3
3
  import { addons } from 'storybook/internal/preview-api';
4
4
  import { global } from '@storybook/global';
5
5
 
6
- var ADDON_ID="storybook/a11y";var RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL},A11Y_TEST_TAG="a11ytest";var{document}=global,channel=addons.getChannel(),defaultParameters={config:{},options:{}},disabledRules=["region"],queue=[],isRunning=!1,runNext=async()=>{if(queue.length===0){isRunning=!1;return}isRunning=!0;let next=queue.shift();next&&await next(),runNext();},run=async(input=defaultParameters)=>{let{default:axe}=await import('axe-core'),{element="#storybook-root",config={},options={}}=input,htmlElement=document.querySelector(element)??document.body;if(!htmlElement)return;axe.reset();let configWithDefault={...config,rules:[...disabledRules.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(htmlElement,options);resolve(result);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=defaultParameters)=>{try{let result=await run(input),resultJson=JSON.parse(JSON.stringify(result));channel.emit(EVENTS.RESULT,resultJson,storyId);}catch(error){channel.emit(EVENTS.ERROR,error);}});function getIsVitestStandaloneRun(){try{return import.meta.env.VITEST_STORYBOOK==="false"}catch{return !1}}function getIsVitestRunning(){try{return import.meta.env.MODE==="test"}catch{return !1}}expect.extend(matchers);var experimental_afterEach=async({reporting,parameters,globals,tags:tags2})=>{let a11yParameter=parameters.a11y,a11yGlobals=globals.a11y;if(a11yParameter?.manual!==!0&&a11yParameter?.disable!==!0&&a11yGlobals?.manual!==!0){if(getIsVitestRunning()&&!tags2.includes(A11Y_TEST_TAG))return;try{let result=await run(a11yParameter);if(result){let hasViolations=(result?.violations.length??0)>0;reporting.addReport({type:"a11y",version:1,result,status:hasViolations?"failed":"passed"}),getIsVitestStandaloneRun()&&hasViolations&&expect(result).toHaveNoViolations();}}catch(e){if(reporting.addReport({type:"a11y",version:1,result:{error:e},status:"failed"}),getIsVitestStandaloneRun())throw e}}},initialGlobals={a11y:{manual:!1}},tags=["a11ytest"];
6
+ var ADDON_ID="storybook/a11y";var RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL},A11Y_TEST_TAG="a11y-test";var{document}=global,channel=addons.getChannel(),defaultParameters={config:{},options:{}},disabledRules=["region"],queue=[],isRunning=!1,runNext=async()=>{if(queue.length===0){isRunning=!1;return}isRunning=!0;let next=queue.shift();next&&await next(),runNext();},run=async(input=defaultParameters)=>{let{default:axe}=await import('axe-core'),{element="body",config={},options={}}=input,htmlElement=document.querySelector(element)??document.body;if(!htmlElement)return;axe.reset();let configWithDefault={...config,rules:[...disabledRules.map(id=>({id,enabled:!1})),...config?.rules??[]]};return axe.configure(configWithDefault),new Promise((resolve,reject)=>{let task=async()=>{try{let result=await axe.run(htmlElement,options);resolve(result);}catch(error){reject(error);}};queue.push(task),isRunning||runNext();})};channel.on(EVENTS.MANUAL,async(storyId,input=defaultParameters)=>{try{let result=await run(input),resultJson=JSON.parse(JSON.stringify(result));channel.emit(EVENTS.RESULT,resultJson,storyId);}catch(error){channel.emit(EVENTS.ERROR,error);}});function getIsVitestStandaloneRun(){try{return import.meta.env.VITEST_STORYBOOK==="false"}catch{return !1}}function getIsVitestRunning(){try{return import.meta.env.MODE==="test"}catch{return !1}}expect.extend(matchers);var experimental_afterEach=async({reporting,parameters,globals,tags})=>{let a11yParameter=parameters.a11y,a11yGlobals=globals.a11y;if(a11yParameter?.manual!==!0&&a11yParameter?.disable!==!0&&a11yGlobals?.manual!==!0){if(getIsVitestRunning()&&!tags.includes(A11Y_TEST_TAG))return;try{let result=await run(a11yParameter);if(result){let hasViolations=(result?.violations.length??0)>0;reporting.addReport({type:"a11y",version:1,result,status:hasViolations?"failed":"passed"}),getIsVitestStandaloneRun()&&hasViolations&&expect(result).toHaveNoViolations();}}catch(e){if(reporting.addReport({type:"a11y",version:1,result:{error:e},status:"failed"}),getIsVitestStandaloneRun())throw e}}},initialGlobals={a11y:{manual:!1}};
7
7
 
8
- export { experimental_afterEach, initialGlobals, tags };
8
+ export { experimental_afterEach, initialGlobals };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-a11y",
3
- "version": "8.5.0-beta.9",
3
+ "version": "8.6.0-alpha.0",
4
4
  "description": "Test component compliance with web accessibility standards",
5
5
  "keywords": [
6
6
  "a11y",
@@ -66,8 +66,8 @@
66
66
  "prep": "jiti ../../../scripts/prepare/addon-bundle.ts"
67
67
  },
68
68
  "dependencies": {
69
- "@storybook/addon-highlight": "8.5.0-beta.9",
70
- "@storybook/test": "8.5.0-beta.9",
69
+ "@storybook/addon-highlight": "8.6.0-alpha.0",
70
+ "@storybook/test": "8.6.0-alpha.0",
71
71
  "axe-core": "^4.2.0",
72
72
  "vitest-axe": "^0.1.0"
73
73
  },
@@ -85,7 +85,7 @@
85
85
  "typescript": "^5.3.2"
86
86
  },
87
87
  "peerDependencies": {
88
- "storybook": "^8.5.0-beta.9"
88
+ "storybook": "^8.6.0-alpha.0"
89
89
  },
90
90
  "publishConfig": {
91
91
  "access": "public"