@netlify/agent-runner-cli 1.155.0-EX-2697.3 → 1.155.0-EX-2697.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin-local.js CHANGED
@@ -99,7 +99,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
99
99
  `,LF:`
100
100
  `,concatBytes:qL},S$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},E$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:S$e};import{Buffer as v$e}from"buffer";var hre=(t,e)=>t?void 0:T$e.bind(void 0,e),T$e=function*(t,e){if(typeof e!="string"&&!jt(e)&&!v$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},mre=(t,e)=>t?b$e.bind(void 0,e):A$e.bind(void 0,e),b$e=function*(t,e){gre(t,e),yield e},A$e=function*(t,e){if(gre(t,e),typeof e!="string"&&!jt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},gre=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
101
101
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
102
- if (condition) { yield value; }`)};import{Buffer as x$e}from"buffer";import{StringDecoder as w$e}from"string_decoder";var vx=(t,e,r)=>{if(r)return;if(t)return{transform:R$e.bind(void 0,new TextEncoder)};let n=new w$e(e);return{transform:I$e.bind(void 0,n),final:C$e.bind(void 0,n)}},R$e=function*(t,e){x$e.isBuffer(e)?yield fs(e):typeof e=="string"?yield t.encode(e):yield e},I$e=function*(t,e){yield jt(e)?t.write(e):e},C$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as _re}from"util";var WL=_re(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Tx=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=O$e}=e[r];for await(let i of n(t))yield*Tx(i,e,r+1)},yre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*P$e(r,Number(e),t)},P$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Tx(n,r,e+1)},Sre=_re(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),O$e=function*(t){yield t};var YL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Ere=(t,e)=>[...e.flatMap(r=>[...Nl(r,t,0)]),...P_(t)],Nl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=k$e}=e[r];for(let i of n(t))yield*Nl(i,e,r+1)},P_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N$e(r,Number(e),t)},N$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Nl(n,r,e+1)},k$e=function*(t){yield t};var KL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Tre(t,s,o),l=Ol(e),u=Ol(r),d=l?WL.bind(void 0,Tx,a):YL.bind(void 0,Nl),f=l||u?WL.bind(void 0,yre,a):YL.bind(void 0,P_),p=l||u?Sre.bind(void 0,a):void 0;return{stream:new M$e({writableObjectMode:n,writableHighWaterMark:vre(n),readableObjectMode:i,readableHighWaterMark:vre(i),transform(m,S,E){d([m,c,0],this,E)},flush(m){f([c],this,m)},destroy:p})}},bx=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=Tre(s,r,a);t=Ere(c,t)}return t},Tre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:hre(n,a)},vx(r,s,n),Ex(r,o,n,c),{transform:t,final:e},{transform:mre(i,a)},pre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var bre=(t,e)=>{for(let r of D$e(t))L$e(t,r,e)},D$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),L$e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ma[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>$$e(a,n));r.input=E_(s)},$$e=(t,e)=>{let r=bx(t,e,"utf8",!0);return U$e(r),E_(r)},U$e=t=>{let e=t.find(r=>typeof r!="string"&&!jt(r));if(e!==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: ${e}.`)};import{writeFileSync as z$e,appendFileSync as G$e}from"fs";var Ax=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&uf(r,n)&&!_n.has(e)&&F$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&B$e.has(o))||t.every(({type:i})=>Wn.has(i))),F$e=t=>t===1||t===2,B$e=new Set(["pipe","overlapped"]),Are=async(t,e,r,n)=>{for await(let i of t)j$e(e)||wre(i,r,n)},xre=(t,e,r)=>{for(let n of t)wre(n,e,r)},j$e=t=>t._readableState.pipes.length>0,wre=(t,e,r)=>{let n=UA(t);uo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Rre=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>V$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},V$e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Ite(t,o,d),p=fs(f),{stdioItems:h,objectMode:m}=e[r],S=q$e([p],h,c,n),{serializedResult:E,finalResult:b=E}=H$e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});W$e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&Y$e(E,h,i),A}catch(y){return n.error=y,A}},q$e=(t,e,r,n)=>{try{return bx(t,e,r,!1)}catch(i){return n.error=i,t}},H$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:E_(t)};let s=zQ(t,r);return n[o]?{serializedResult:s,finalResult:HL(s,!i[o],e)}:{serializedResult:s}},W$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Ax({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=HL(t,!1,s);try{xre(a,e,n)}catch(c){r.error??=c}},Y$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>yx.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?G$e(n,t):(r.add(o),z$e(n,t))}};var Ire=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ms(e,r,"all")]:Array.isArray(e)?[ms(t,r,"all"),...e]:jt(t)&&jt(e)?tL([t,e]):`${t}${e}`};import{once as ZL}from"events";var Cre=async(t,e)=>{let[r,n]=await K$e(t);return e.isForcefullyTerminated??=!1,[r,n]},K$e=async t=>{let[e,r]=await Promise.allSettled([ZL(t,"spawn"),ZL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Pre(t):r.value},Pre=async t=>{try{return await ZL(t,"exit")}catch{return Pre(t)}},Ore=async t=>{let[e,r]=await t;if(!Z$e(e,r)&&JL(e,r))throw new wi;return[e,r]},Z$e=(t,e)=>t===void 0&&e===void 0,JL=(t,e)=>t!==0||e!==null;var Nre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=J$e(t,e,r),s=o?.code==="ETIMEDOUT",a=Rte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},J$e=(t,e,r)=>t!==void 0?t:JL(e,r)?new wi:void 0;var kre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Q$e(t,e,r),d=r1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ef(d,c,l)},Q$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),a=e1e(r),{file:c,commandArguments:l,options:u}=sx(t,e,a);t1e(u);let d=lre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},e1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,t1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&xx("ipcInput"),t&&xx("ipc: true"),r&&xx("detached: true"),n&&xx("cancelSignal")},xx=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},r1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=n1e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Nre(c,r),{output:h,error:m=l}=Rre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ms(b,r,A)),E=ms(Ire(h,r),r,"all");return o1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},n1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{bre(o,r);let a=i1e(r);return X$e(...ax(t,e,a))}catch(a){return Sf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},i1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:hx(e)}),o1e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?mx({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):C_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as HUe}from"events";import{spawn as WUe}from"child_process";import Ure from"process";import{once as XL,on as s1e}from"events";var Mre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(pf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),a1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),a1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ZA(e,i);let o=ka(t,e,r),s=new AbortController;try{return await Promise.race([c1e(o,n,s),l1e(o,r,s),u1e(o,r,s)])}catch(a){throw hf(t),a}finally{s.abort(),JA(e,i)}},c1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await XL(t,"message",{signal:r});return n}for await(let[n]of s1e(t,"message",{signal:r}))if(e(n))return n},l1e=async(t,e,{signal:r})=>{await XL(t,"disconnect",{signal:r}),Eee(e)},u1e=async(t,e,{signal:r})=>{let[n]=await XL(t,"strict:error",{signal:r});throw WA(n,e)};import{once as Lre,on as d1e}from"events";var $re=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>QL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),QL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{pf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),ZA(e,o);let s=ka(t,e,r),a=new AbortController,c={};return f1e(t,s,a),p1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),h1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},f1e=async(t,e,r)=>{try{await Lre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},p1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Lre(t,"strict:error",{signal:r.signal});n.error=WA(i,e),r.abort()}catch{}},h1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of d1e(r,"message",{signal:o.signal}))Dre(s),yield c}catch{Dre(s)}finally{o.abort(),JA(e,a),n||hf(t),i&&await t}},Dre=({error:t})=>{if(t)throw t};var Fre=(t,{ipc:e})=>{Object.assign(t,jre(t,!1,e))},Bre=()=>{let t=Ure,e=!0,r=Ure.channel!==void 0;return{...jre(t,e,r),getCancelSignal:Wee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},jre=(t,e,r)=>({sendMessage:ix.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Mre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:$re.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as m1e}from"child_process";import{PassThrough as g1e,Readable as _1e,Writable as y1e,Duplex as S1e}from"stream";var zre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{GL(n);let a=new m1e;E1e(a,n),Object.assign(a,{readable:v1e,writable:T1e,duplex:b1e});let c=Sf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=A1e(c,s,i);return{subprocess:a,promise:l}},E1e=(t,e)=>{let r=O_(),n=O_(),i=O_(),o=Array.from({length:e.length-3},O_),s=O_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},O_=()=>{let t=new g1e;return t.end(),t},v1e=()=>new _1e({read(){}}),T1e=()=>new y1e({write(){}}),b1e=()=>new S1e({read(){},write(){}}),A1e=async(t,e,r)=>Ef(t,e,r);import{createReadStream as Gre,createWriteStream as Vre}from"fs";import{Buffer as x1e}from"buffer";import{Readable as N_,Writable as w1e,Duplex as R1e}from"stream";var Hre=(t,e)=>Sx(I1e,t,e,!1),k_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},qre={fileNumber:k_,generator:KL,asyncGenerator:KL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:R1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},I1e={input:{...qre,fileUrl:({value:t})=>({stream:Gre(t)}),filePath:({value:{file:t}})=>({stream:Gre(t)}),webStream:({value:t})=>({stream:N_.fromWeb(t)}),iterable:({value:t})=>({stream:N_.from(t)}),asyncIterable:({value:t})=>({stream:N_.from(t)}),string:({value:t})=>({stream:N_.from(t)}),uint8Array:({value:t})=>({stream:N_.from(x1e.from(t))})},output:{...qre,fileUrl:({value:t})=>({stream:Vre(t)}),filePath:({value:{file:t,append:e}})=>({stream:Vre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:w1e.fromWeb(t)}),iterable:k_,asyncIterable:k_,string:k_,uint8Array:k_}};import{on as C1e,once as Wre}from"events";import{PassThrough as P1e,getDefaultHighWaterMark as O1e}from"stream";import{finished as Zre}from"stream/promises";function kl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)t$(i);let e=t.some(({readableObjectMode:i})=>i),r=N1e(t,e),n=new e$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var N1e=(t,e)=>{if(t.length===0)return O1e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},e$=class extends P1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(t$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=k1e(this,this.#e,this.#o);let r=L1e({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(t$(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},k1e=async(t,e,r)=>{wx(t,Yre);let n=new AbortController;try{await Promise.race([M1e(t,n),D1e(t,e,r,n)])}finally{n.abort(),wx(t,-Yre)}},M1e=async(t,{signal:e})=>{try{await Zre(t,{signal:e,cleanup:!0})}catch(r){throw Jre(t,r),r}},D1e=async(t,e,r,{signal:n})=>{for await(let[i]of C1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},t$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},L1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{wx(t,Kre);let a=new AbortController;try{await Promise.race([$1e(o,e,a),U1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),F1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),wx(t,-Kre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?r$(t):B1e(t))},$1e=async(t,e,{signal:r})=>{try{await t,r.aborted||r$(e)}catch(n){r.aborted||Jre(e,n)}},U1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Zre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;Xre(s)?i.add(e):Qre(t,s)}},F1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Wre(t,i,{signal:o}),!t.readable)return Wre(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},B1e=t=>{t.writable&&t.end()},Jre=(t,e)=>{Xre(e)?r$(t):Qre(t,e)},Xre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",r$=t=>{(t.readable||t.writable)&&t.destroy()},Qre=(t,e)=>{t.destroyed||(t.once("error",j1e),t.destroy(e))},j1e=()=>{},wx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Yre=2,Kre=1;import{finished as ene}from"stream/promises";var Tf=(t,e)=>{t.pipe(e),z1e(t,e),G1e(t,e)},z1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await ene(t,{cleanup:!0,readable:!0,writable:!1})}catch{}n$(e)}},n$=t=>{t.writable&&t.end()},G1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await ene(e,{cleanup:!0,readable:!1,writable:!0})}catch{}i$(t)}},i$=t=>{t.readable&&t.destroy()};var tne=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Wn.has(c)))V1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Wn.has(c)))H1e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:kl(o);Tf(s,i)}},V1e=(t,e,r,n)=>{r==="output"?Tf(t.stdio[n],e):Tf(e,t.stdio[n]);let i=q1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},q1e=["stdin","stdout","stderr"],H1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;W1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},W1e=(t,{signal:e})=>{xi(t)&&Cl(t,Y1e,e)},Y1e=2;import{addAbortListener as J1e}from"events";var Ml=[];Ml.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ml.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ml.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Rx=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",o$=Symbol.for("signal-exit emitter"),s$=globalThis,K1e=Object.defineProperty.bind(Object),a$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(s$[o$])return s$[o$];K1e(s$,o$,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},Ix=class{},Z1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),c$=class extends Ix{onExit(){return()=>{}}load(){}unload(){}},l$=class extends Ix{#e=u$.platform==="win32"?"SIGINT":"SIGHUP";#r=new a$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ml)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Rx(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ml)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ml.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Rx(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Rx(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},u$=globalThis.process,{onExit:rne,load:QEt,unload:evt}=Z1e(Rx(u$)?new l$(u$):new c$);var nne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=rne(()=>{t.kill()});J1e(n,()=>{i()})};var one=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=FA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=X1e(r,n,i),{sourceStream:d,sourceError:f}=eUe(t,l),{options:p,fileDescriptors:h}=po.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},X1e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=Q1e(t,e,...r),a=KA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},Q1e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(ine,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||QD(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=CA(r,...n);return{destination:e(ine)(i,o,s),pipeOptions:s}}if(po.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},ine=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),eUe=(t,e)=>{try{return{sourceStream:mf(t,e)}}catch(r){return{sourceError:r}}};var ane=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=tUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw d$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},tUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return i$(t),n;if(e!==void 0)return n$(r),e},d$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Sf({error:t,command:sne,escapedCommand:sne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),sne="source.pipe(destination)";var cne=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as rUe}from"stream/promises";var lne=(t,e,r)=>{let n=Cx.has(e)?iUe(t,e):nUe(t,e);return Cl(t,sUe,r.signal),Cl(e,aUe,r.signal),oUe(e),n},nUe=(t,e)=>{let r=kl([t]);return Tf(r,e),Cx.set(e,r),r},iUe=(t,e)=>{let r=Cx.get(e);return r.add(t),r},oUe=async t=>{try{await rUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Cx.delete(t)},Cx=new WeakMap,sUe=2,aUe=1;import{aborted as cUe}from"util";var une=(t,e)=>t===void 0?[]:[lUe(t,e)],lUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await cUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw d$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Px=(t,...e)=>{if(Ot(e[0]))return Px.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=one(t,...e),i=uUe({...n,destination:r});return i.pipe=Px.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},uUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=dUe(t,i);ane({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=lne(e,o,d);return await Promise.race([cne(u),...une(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},dUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as yUe}from"timers/promises";import{on as fUe}from"events";import{getDefaultHighWaterMark as pUe}from"stream";var Ox=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return hUe(e,s),fne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},hUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},f$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;mUe(e,s,t);let a=t.readableObjectMode&&!o;return fne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},mUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},fne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=fUe(t,"data",{signal:e.signal,highWaterMark:dne,highWatermark:dne});return gUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},p$=pUe(!0),dne=p$,gUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=_Ue({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Nl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*P_(a)}},_Ue=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[vx(t,r,!e),Ex(t,i,!n,{})].filter(Boolean);var pne=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=SUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([EUe(t),d]);return}let f=VL(c,r),p=f$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([vUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},SUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Ax({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=f$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Are(a,t,r,o)},EUe=async t=>{await yUe(),t.readableFlowing===null&&t.resume()},vUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await dx(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await fx(r,{maxBuffer:o})):await yf(r,{maxBuffer:o})}catch(a){return hne(Ate({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},h$=async t=>{try{return await t}catch(e){return hne(e)}},hne=({bufferedData:t})=>BQ(t)?new Uint8Array(t):t;import{finished as TUe}from"stream/promises";var M_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=bUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],TUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||wUe(a,e,r,n)}finally{s.abort()}},bUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&AUe(t,r,n),n},AUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{xUe(e,r),n.call(t,...i)}},xUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},wUe=(t,e,r,n)=>{if(!RUe(t,e,r,n))throw t},RUe=(t,e,r,n=!0)=>r.propagating?mne(t)||Nx(t):(r.propagating=!0,m$(r,e)===n?mne(t):Nx(t)),m$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Nx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",mne=t=>t?.code==="EPIPE";var gne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>g$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),g$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=M_(t,e,l);if(m$(l,e)){await u;return}let[d]=await Promise.all([pne({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var _ne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?kl([t,e].filter(Boolean)):void 0,yne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>g$({...IUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:CUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),IUe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},CUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as PUe}from"events";var Sne=t=>uf(t,"ipc"),Ene=(t,e)=>{let r=UA(t);uo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var vne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Sne(o),a=ps(e,"ipc"),c=ps(r,"ipc");for await(let l of QL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(xte(t,i,c),i.push(l)),s&&Ene(l,o);return i},Tne=async(t,e)=>(await Promise.allSettled([t]),e);var bne=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:S,controller:E})=>{let b=Cre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=gne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=yne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=[],I=vne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),O=OUe(m,t,A),N=NUe(h,A);try{return await Promise.race([Promise.all([{},Ore(b),Promise.all(y),x,I,nte(t,d),...O,...N]),S,kUe(t,E),...Xee(t,o,f,E),...See({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...Zee({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch(F){return f.terminationReason??="other",Promise.all([{error:F},b,Promise.all(y.map(_=>h$(_))),h$(x),Tne(I,R),Promise.allSettled(O),Promise.allSettled(N)])}},OUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:M_(n,i,r)),NUe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ii(o,{checkOpen:!1})&&!xi(o)).map(({type:i,value:o,stream:s=o})=>M_(s,n,e,{isSameDirection:Wn.has(i),stopOnExit:i==="native"}))),kUe=async(t,{signal:e})=>{let[r]=await PUe(t,"error",{signal:e});throw r};var Ane=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),D_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=fo();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},bf=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as MUe}from"stream";import{callbackify as DUe}from"util";import{finished as xne}from"stream/promises";var _$=async t=>{if(t!==void 0)try{await y$(t)}catch{}},wne=async t=>{if(t!==void 0)try{await S$(t)}catch{}},y$=async t=>{await xne(t,{cleanup:!0,readable:!1,writable:!0})},S$=async t=>{await xne(t,{cleanup:!0,readable:!0,writable:!1})},kx=async(t,e)=>{if(await t,e)throw e},Mx=(t,e,r)=>{r&&!Nx(r)?t.destroy(r):e&&t.destroy()};var Rne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||_n.has(r),{subprocessStdout:a,waitReadableDestroy:c}=E$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=v$(a,s),{read:f,onStdoutDataDone:p}=T$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new MUe({read:f,destroy:DUe(A$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return b$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},E$=(t,e,r)=>{let n=mf(t,e),i=D_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},v$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:p$},T$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=fo(),s=Ox({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){LUe(this,s,o)},onStdoutDataDone:o}},LUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},b$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await S$(t),await n,await _$(i),await e,r.readable&&r.push(null)}catch(o){await _$(i),Ine(r,o)}},A$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await bf(r,e)&&(Ine(t,n),await kx(e,n))},Ine=(t,e)=>{Mx(t,t.readable,e)};import{Writable as $Ue}from"stream";import{callbackify as Cne}from"util";var Pne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=x$(t,r,e),s=new $Ue({...w$(n,t,i),destroy:Cne(I$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return R$(n,s),s},x$=(t,e,r)=>{let n=KA(t,e),i=D_(r,n,"writableFinal"),o=D_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},w$=(t,e,r)=>({write:UUe.bind(void 0,t),final:Cne(FUe.bind(void 0,t,e,r))}),UUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},FUe=async(t,e,r)=>{await bf(r,e)&&(t.writable&&t.end(),await e)},R$=async(t,e,r)=>{try{await y$(t),e.writable&&e.end()}catch(n){await wne(r),One(e,n)}},I$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await bf(r,e),await bf(n,e)&&(One(t,i),await kx(e,i))},One=(t,e)=>{Mx(t,t.writable,e)};import{Duplex as BUe}from"stream";import{callbackify as jUe}from"util";var Nne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||_n.has(r),{subprocessStdout:c,waitReadableDestroy:l}=E$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=x$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=v$(c,a),{read:S,onStdoutDataDone:E}=T$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new BUe({read:S,...w$(u,t,d),destroy:jUe(zUe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return b$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),R$(u,b,c),b},zUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([A$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),I$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var C$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||_n.has(e),s=mf(t,r),a=Ox({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return GUe(a,s,t)},GUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var kne=(t,{encoding:e})=>{let r=Ane();t.readable=Rne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Pne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Nne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=C$.bind(void 0,t,e),t[Symbol.asyncIterator]=C$.bind(void 0,t,e,{})};var Mne=(t,e)=>{for(let[r,n]of qUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},VUe=(async()=>{})().constructor.prototype,qUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(VUe,t)]);var Dne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=YUe(t,e,r),{subprocess:f,promise:p}=ZUe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Px.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Mne(f,p),po.set(f,{options:u,fileDescriptors:d}),f},YUe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),{file:a,commandArguments:c,options:l}=sx(t,e,r),u=KUe(l),d=Hre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},KUe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},ZUe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=WUe(...ax(t,e,r))}catch(h){return zre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;HUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];tne(c,a,l),nne(c,r,l);let d={},f=fo();c.kill=_ee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=_ne(c,r),kne(c,r),Fre(c,r);let p=JUe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},JUe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,S]=await bne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let E=h.map((y,x)=>ms(y,e,x)),b=ms(m,e,"all"),A=XUe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:S,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ef(A,n,e)},XUe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?C_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ho,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):mx({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Dx=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,QUe(n,t[n],i)]));return{...t,...r}},QUe=(t,e,r)=>eFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,eFe=new Set(["env",...oL]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>tFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},tFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Dx(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=rFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?kre(a,c,l):Dne(a,c,l,i)},rFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=HQ(e)?WQ(e,r):[e,...r],[s,a,c]=CA(...o),l=Dx(Dx(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Lne=({file:t,commandArguments:e})=>Une(t,e),$ne=({file:t,commandArguments:e})=>({...Une(t,e),isSync:!0}),Une=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=nFe(t);return{file:r,commandArguments:n}},nFe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(iFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},iFe=/ +/g;var Fne=(t,e,r)=>{t.sync=e(oFe,r),t.s=t.sync},Bne=({options:t})=>jne(t),oFe=({options:t})=>({...jne(t),isSync:!0}),jne=t=>({options:{...sFe(t),...t}}),sFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},zne={preferLocal:!0};var Gne=Da(()=>({})),Gbt=Da(()=>({isSync:!0})),Vne=Da(Lne),Vbt=Da($ne),qbt=Da(ete),Hbt=Da(Bne,{},zne,Fne),{sendMessage:Wbt,getOneMessage:Ybt,getEachMessage:Kbt,getCancelSignal:Zbt}=Bre();var qne=!1,Hne=()=>{qne=!0},go=()=>qne;var L_=null,Wne=t=>(L_&&L_.destroy(),L_=new gs({totalAllowedTime:t}),L_),Yne=()=>L_;var gs=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&go())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await TA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ue.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var Kne={name:"@netlify/agent-runner-cli",type:"module",version:"1.155.0-EX-2697.3",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.5","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var uFe=cFe(import.meta.url),dFe=_s.dirname(uFe),fFe=lFe(import.meta.url),Af=fe("shell"),P$=new Set,Zne={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=pFe(e,r),o={...Zne,...i},s=Gne(t,n,o);Xne(s,o),tie(s);let a=r?.idleTimeout;return a&&a>0&&eie(s,a),s},Jne=(t,e)=>{let r={...Zne,...e},n=Vne(t,r);return Xne(n,r),tie(n),e?.idleTimeout&&e.idleTimeout>0&&eie(n,e.idleTimeout),n},pFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},Xne=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(ys.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new u_).pipe(ys.stdout),t.stderr?.pipe(new u_).pipe(ys.stderr);return}t.stdout?.pipe(ys.stdout),t.stderr?.pipe(ys.stderr)},O$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(ys.kill(-t.pid,e),Af.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Af.error("Error killing process:",r),!1}},Qne=t=>O$(t,"SIGKILL"),eie=(t,e)=>{let r=null,n=()=>{Af.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),O$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing idle process ${t.pid}`),Qne(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},tie=t=>{P$.add(t);let e=Yne();if(e){let r=e.onTimesUp(()=>{Af.log(`Global timer expired, killing process ${t.pid}`),O$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing process ${t.pid} after timeout`),Qne(t))},5e3)});t.on("exit",()=>{P$.delete(t),r()}),t.on("error",()=>{P$.delete(t),r()})}};function $x(t,e){return!!Ci(t,e)}function Ci(t,e){if(!ys.env.NETLIFY_LOCAL_MODE)try{let i=fFe.resolve(Kne.name),o=_s.dirname(i);for(;o!==_s.dirname(o);){let s=_s.dirname(o);if(_s.basename(s)==="node_modules"){let a=_s.join(s,".bin",e);if(Lx.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(ys.env.NODE_PATH){let i=_s.join(ys.env.NODE_PATH,".bin",e);if(Lx.existsSync(i))return i}let r=_s.join(t,"node_modules",".bin",e);if(Lx.existsSync(r))return r;let n=_s.join(dFe,"..","node_modules",".bin",e);if(Lx.existsSync(n))return n}var hFe=fe("utils"),mFe=t=>new Promise(e=>{setTimeout(e,t)});var N$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ux=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await mFe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},La=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},rie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):hFe.error("Could not parse JSON",n))}},gFe=t=>t.charAt(0).toUpperCase()+t.slice(1),_o=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():gFe(e)).join(" ");function Ss(t,e){e&&t.log(`Skill invoked: ${e}`)}var Fx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),nie=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var k$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},_Fe=1e4,M$=(t,e=_Fe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as yFe}from"crypto";import{createReadStream as SFe}from"fs";import Bx from"fs/promises";import cie from"os";import jx from"path";var iie=fe("repo"),lie="runner-diffs-",uie=t=>`${lie}${t}-`,die=async t=>{let e=cie.tmpdir(),r;try{r=await Bx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(lie)&&!n.startsWith(uie(t))).map(n=>Bx.rm(jx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Xr=(t,e={})=>zt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),zx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{iie.info("Getting runner diffs");let n=await vFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=bFe(o);await AFe(h,r)}iie.info("Changes after processing"),await L$(r);let s=await $$(o,r);if(await D$(s,r),i=await TFe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Bx.mkdtemp(jx.join(cie.tmpdir(),uie(t.sessionId))),c=async({from:h,to:m,fileName:S,binary:E})=>{let b=jx.join(a,S);await Xr([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:y}=await Bx.stat(b);return{path:b,size:y}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await aie(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await sie(d,h)||(f=h)}await aie(r),ue.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await sie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},oie=async t=>{let e=yFe("sha256");for await(let r of SFe(t))e.update(r);return e.digest("hex")},sie=async(t,e)=>t.size===e.size&&await oie(t.path)===await oie(e.path),aie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},D$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},L$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},fie=/.. (.+)?\.log$/,EFe=[fie],vFe=async(t=process.cwd())=>{let e=await L$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
102
+ if (condition) { yield value; }`)};import{Buffer as x$e}from"buffer";import{StringDecoder as w$e}from"string_decoder";var vx=(t,e,r)=>{if(r)return;if(t)return{transform:R$e.bind(void 0,new TextEncoder)};let n=new w$e(e);return{transform:I$e.bind(void 0,n),final:C$e.bind(void 0,n)}},R$e=function*(t,e){x$e.isBuffer(e)?yield fs(e):typeof e=="string"?yield t.encode(e):yield e},I$e=function*(t,e){yield jt(e)?t.write(e):e},C$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as _re}from"util";var WL=_re(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Tx=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=O$e}=e[r];for await(let i of n(t))yield*Tx(i,e,r+1)},yre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*P$e(r,Number(e),t)},P$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Tx(n,r,e+1)},Sre=_re(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),O$e=function*(t){yield t};var YL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Ere=(t,e)=>[...e.flatMap(r=>[...Nl(r,t,0)]),...P_(t)],Nl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=k$e}=e[r];for(let i of n(t))yield*Nl(i,e,r+1)},P_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N$e(r,Number(e),t)},N$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Nl(n,r,e+1)},k$e=function*(t){yield t};var KL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Tre(t,s,o),l=Ol(e),u=Ol(r),d=l?WL.bind(void 0,Tx,a):YL.bind(void 0,Nl),f=l||u?WL.bind(void 0,yre,a):YL.bind(void 0,P_),p=l||u?Sre.bind(void 0,a):void 0;return{stream:new M$e({writableObjectMode:n,writableHighWaterMark:vre(n),readableObjectMode:i,readableHighWaterMark:vre(i),transform(m,S,E){d([m,c,0],this,E)},flush(m){f([c],this,m)},destroy:p})}},bx=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=Tre(s,r,a);t=Ere(c,t)}return t},Tre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:hre(n,a)},vx(r,s,n),Ex(r,o,n,c),{transform:t,final:e},{transform:mre(i,a)},pre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var bre=(t,e)=>{for(let r of D$e(t))L$e(t,r,e)},D$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),L$e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ma[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>$$e(a,n));r.input=E_(s)},$$e=(t,e)=>{let r=bx(t,e,"utf8",!0);return U$e(r),E_(r)},U$e=t=>{let e=t.find(r=>typeof r!="string"&&!jt(r));if(e!==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: ${e}.`)};import{writeFileSync as z$e,appendFileSync as G$e}from"fs";var Ax=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&uf(r,n)&&!_n.has(e)&&F$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&B$e.has(o))||t.every(({type:i})=>Wn.has(i))),F$e=t=>t===1||t===2,B$e=new Set(["pipe","overlapped"]),Are=async(t,e,r,n)=>{for await(let i of t)j$e(e)||wre(i,r,n)},xre=(t,e,r)=>{for(let n of t)wre(n,e,r)},j$e=t=>t._readableState.pipes.length>0,wre=(t,e,r)=>{let n=UA(t);uo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Rre=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>V$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},V$e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Ite(t,o,d),p=fs(f),{stdioItems:h,objectMode:m}=e[r],S=q$e([p],h,c,n),{serializedResult:E,finalResult:b=E}=H$e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});W$e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&Y$e(E,h,i),A}catch(y){return n.error=y,A}},q$e=(t,e,r,n)=>{try{return bx(t,e,r,!1)}catch(i){return n.error=i,t}},H$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:E_(t)};let s=zQ(t,r);return n[o]?{serializedResult:s,finalResult:HL(s,!i[o],e)}:{serializedResult:s}},W$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Ax({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=HL(t,!1,s);try{xre(a,e,n)}catch(c){r.error??=c}},Y$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>yx.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?G$e(n,t):(r.add(o),z$e(n,t))}};var Ire=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ms(e,r,"all")]:Array.isArray(e)?[ms(t,r,"all"),...e]:jt(t)&&jt(e)?tL([t,e]):`${t}${e}`};import{once as ZL}from"events";var Cre=async(t,e)=>{let[r,n]=await K$e(t);return e.isForcefullyTerminated??=!1,[r,n]},K$e=async t=>{let[e,r]=await Promise.allSettled([ZL(t,"spawn"),ZL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Pre(t):r.value},Pre=async t=>{try{return await ZL(t,"exit")}catch{return Pre(t)}},Ore=async t=>{let[e,r]=await t;if(!Z$e(e,r)&&JL(e,r))throw new wi;return[e,r]},Z$e=(t,e)=>t===void 0&&e===void 0,JL=(t,e)=>t!==0||e!==null;var Nre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=J$e(t,e,r),s=o?.code==="ETIMEDOUT",a=Rte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},J$e=(t,e,r)=>t!==void 0?t:JL(e,r)?new wi:void 0;var kre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Q$e(t,e,r),d=r1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ef(d,c,l)},Q$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),a=e1e(r),{file:c,commandArguments:l,options:u}=sx(t,e,a);t1e(u);let d=lre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},e1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,t1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&xx("ipcInput"),t&&xx("ipc: true"),r&&xx("detached: true"),n&&xx("cancelSignal")},xx=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},r1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=n1e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Nre(c,r),{output:h,error:m=l}=Rre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ms(b,r,A)),E=ms(Ire(h,r),r,"all");return o1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},n1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{bre(o,r);let a=i1e(r);return X$e(...ax(t,e,a))}catch(a){return Sf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},i1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:hx(e)}),o1e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?mx({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):C_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as HUe}from"events";import{spawn as WUe}from"child_process";import Ure from"process";import{once as XL,on as s1e}from"events";var Mre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(pf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),a1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),a1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ZA(e,i);let o=ka(t,e,r),s=new AbortController;try{return await Promise.race([c1e(o,n,s),l1e(o,r,s),u1e(o,r,s)])}catch(a){throw hf(t),a}finally{s.abort(),JA(e,i)}},c1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await XL(t,"message",{signal:r});return n}for await(let[n]of s1e(t,"message",{signal:r}))if(e(n))return n},l1e=async(t,e,{signal:r})=>{await XL(t,"disconnect",{signal:r}),Eee(e)},u1e=async(t,e,{signal:r})=>{let[n]=await XL(t,"strict:error",{signal:r});throw WA(n,e)};import{once as Lre,on as d1e}from"events";var $re=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>QL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),QL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{pf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),ZA(e,o);let s=ka(t,e,r),a=new AbortController,c={};return f1e(t,s,a),p1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),h1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},f1e=async(t,e,r)=>{try{await Lre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},p1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Lre(t,"strict:error",{signal:r.signal});n.error=WA(i,e),r.abort()}catch{}},h1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of d1e(r,"message",{signal:o.signal}))Dre(s),yield c}catch{Dre(s)}finally{o.abort(),JA(e,a),n||hf(t),i&&await t}},Dre=({error:t})=>{if(t)throw t};var Fre=(t,{ipc:e})=>{Object.assign(t,jre(t,!1,e))},Bre=()=>{let t=Ure,e=!0,r=Ure.channel!==void 0;return{...jre(t,e,r),getCancelSignal:Wee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},jre=(t,e,r)=>({sendMessage:ix.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Mre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:$re.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as m1e}from"child_process";import{PassThrough as g1e,Readable as _1e,Writable as y1e,Duplex as S1e}from"stream";var zre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{GL(n);let a=new m1e;E1e(a,n),Object.assign(a,{readable:v1e,writable:T1e,duplex:b1e});let c=Sf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=A1e(c,s,i);return{subprocess:a,promise:l}},E1e=(t,e)=>{let r=O_(),n=O_(),i=O_(),o=Array.from({length:e.length-3},O_),s=O_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},O_=()=>{let t=new g1e;return t.end(),t},v1e=()=>new _1e({read(){}}),T1e=()=>new y1e({write(){}}),b1e=()=>new S1e({read(){},write(){}}),A1e=async(t,e,r)=>Ef(t,e,r);import{createReadStream as Gre,createWriteStream as Vre}from"fs";import{Buffer as x1e}from"buffer";import{Readable as N_,Writable as w1e,Duplex as R1e}from"stream";var Hre=(t,e)=>Sx(I1e,t,e,!1),k_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},qre={fileNumber:k_,generator:KL,asyncGenerator:KL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:R1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},I1e={input:{...qre,fileUrl:({value:t})=>({stream:Gre(t)}),filePath:({value:{file:t}})=>({stream:Gre(t)}),webStream:({value:t})=>({stream:N_.fromWeb(t)}),iterable:({value:t})=>({stream:N_.from(t)}),asyncIterable:({value:t})=>({stream:N_.from(t)}),string:({value:t})=>({stream:N_.from(t)}),uint8Array:({value:t})=>({stream:N_.from(x1e.from(t))})},output:{...qre,fileUrl:({value:t})=>({stream:Vre(t)}),filePath:({value:{file:t,append:e}})=>({stream:Vre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:w1e.fromWeb(t)}),iterable:k_,asyncIterable:k_,string:k_,uint8Array:k_}};import{on as C1e,once as Wre}from"events";import{PassThrough as P1e,getDefaultHighWaterMark as O1e}from"stream";import{finished as Zre}from"stream/promises";function kl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)t$(i);let e=t.some(({readableObjectMode:i})=>i),r=N1e(t,e),n=new e$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var N1e=(t,e)=>{if(t.length===0)return O1e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},e$=class extends P1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(t$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=k1e(this,this.#e,this.#o);let r=L1e({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(t$(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},k1e=async(t,e,r)=>{wx(t,Yre);let n=new AbortController;try{await Promise.race([M1e(t,n),D1e(t,e,r,n)])}finally{n.abort(),wx(t,-Yre)}},M1e=async(t,{signal:e})=>{try{await Zre(t,{signal:e,cleanup:!0})}catch(r){throw Jre(t,r),r}},D1e=async(t,e,r,{signal:n})=>{for await(let[i]of C1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},t$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},L1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{wx(t,Kre);let a=new AbortController;try{await Promise.race([$1e(o,e,a),U1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),F1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),wx(t,-Kre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?r$(t):B1e(t))},$1e=async(t,e,{signal:r})=>{try{await t,r.aborted||r$(e)}catch(n){r.aborted||Jre(e,n)}},U1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Zre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;Xre(s)?i.add(e):Qre(t,s)}},F1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Wre(t,i,{signal:o}),!t.readable)return Wre(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},B1e=t=>{t.writable&&t.end()},Jre=(t,e)=>{Xre(e)?r$(t):Qre(t,e)},Xre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",r$=t=>{(t.readable||t.writable)&&t.destroy()},Qre=(t,e)=>{t.destroyed||(t.once("error",j1e),t.destroy(e))},j1e=()=>{},wx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Yre=2,Kre=1;import{finished as ene}from"stream/promises";var Tf=(t,e)=>{t.pipe(e),z1e(t,e),G1e(t,e)},z1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await ene(t,{cleanup:!0,readable:!0,writable:!1})}catch{}n$(e)}},n$=t=>{t.writable&&t.end()},G1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await ene(e,{cleanup:!0,readable:!1,writable:!0})}catch{}i$(t)}},i$=t=>{t.readable&&t.destroy()};var tne=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Wn.has(c)))V1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Wn.has(c)))H1e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:kl(o);Tf(s,i)}},V1e=(t,e,r,n)=>{r==="output"?Tf(t.stdio[n],e):Tf(e,t.stdio[n]);let i=q1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},q1e=["stdin","stdout","stderr"],H1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;W1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},W1e=(t,{signal:e})=>{xi(t)&&Cl(t,Y1e,e)},Y1e=2;import{addAbortListener as J1e}from"events";var Ml=[];Ml.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ml.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ml.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Rx=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",o$=Symbol.for("signal-exit emitter"),s$=globalThis,K1e=Object.defineProperty.bind(Object),a$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(s$[o$])return s$[o$];K1e(s$,o$,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},Ix=class{},Z1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),c$=class extends Ix{onExit(){return()=>{}}load(){}unload(){}},l$=class extends Ix{#e=u$.platform==="win32"?"SIGINT":"SIGHUP";#r=new a$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ml)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Rx(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ml)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ml.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Rx(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Rx(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},u$=globalThis.process,{onExit:rne,load:QEt,unload:evt}=Z1e(Rx(u$)?new l$(u$):new c$);var nne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=rne(()=>{t.kill()});J1e(n,()=>{i()})};var one=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=FA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=X1e(r,n,i),{sourceStream:d,sourceError:f}=eUe(t,l),{options:p,fileDescriptors:h}=po.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},X1e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=Q1e(t,e,...r),a=KA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},Q1e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(ine,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||QD(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=CA(r,...n);return{destination:e(ine)(i,o,s),pipeOptions:s}}if(po.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},ine=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),eUe=(t,e)=>{try{return{sourceStream:mf(t,e)}}catch(r){return{sourceError:r}}};var ane=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=tUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw d$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},tUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return i$(t),n;if(e!==void 0)return n$(r),e},d$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Sf({error:t,command:sne,escapedCommand:sne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),sne="source.pipe(destination)";var cne=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as rUe}from"stream/promises";var lne=(t,e,r)=>{let n=Cx.has(e)?iUe(t,e):nUe(t,e);return Cl(t,sUe,r.signal),Cl(e,aUe,r.signal),oUe(e),n},nUe=(t,e)=>{let r=kl([t]);return Tf(r,e),Cx.set(e,r),r},iUe=(t,e)=>{let r=Cx.get(e);return r.add(t),r},oUe=async t=>{try{await rUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Cx.delete(t)},Cx=new WeakMap,sUe=2,aUe=1;import{aborted as cUe}from"util";var une=(t,e)=>t===void 0?[]:[lUe(t,e)],lUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await cUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw d$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Px=(t,...e)=>{if(Ot(e[0]))return Px.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=one(t,...e),i=uUe({...n,destination:r});return i.pipe=Px.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},uUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=dUe(t,i);ane({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=lne(e,o,d);return await Promise.race([cne(u),...une(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},dUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as yUe}from"timers/promises";import{on as fUe}from"events";import{getDefaultHighWaterMark as pUe}from"stream";var Ox=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return hUe(e,s),fne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},hUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},f$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;mUe(e,s,t);let a=t.readableObjectMode&&!o;return fne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},mUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},fne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=fUe(t,"data",{signal:e.signal,highWaterMark:dne,highWatermark:dne});return gUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},p$=pUe(!0),dne=p$,gUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=_Ue({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Nl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*P_(a)}},_Ue=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[vx(t,r,!e),Ex(t,i,!n,{})].filter(Boolean);var pne=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=SUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([EUe(t),d]);return}let f=VL(c,r),p=f$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([vUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},SUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Ax({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=f$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Are(a,t,r,o)},EUe=async t=>{await yUe(),t.readableFlowing===null&&t.resume()},vUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await dx(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await fx(r,{maxBuffer:o})):await yf(r,{maxBuffer:o})}catch(a){return hne(Ate({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},h$=async t=>{try{return await t}catch(e){return hne(e)}},hne=({bufferedData:t})=>BQ(t)?new Uint8Array(t):t;import{finished as TUe}from"stream/promises";var M_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=bUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],TUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||wUe(a,e,r,n)}finally{s.abort()}},bUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&AUe(t,r,n),n},AUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{xUe(e,r),n.call(t,...i)}},xUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},wUe=(t,e,r,n)=>{if(!RUe(t,e,r,n))throw t},RUe=(t,e,r,n=!0)=>r.propagating?mne(t)||Nx(t):(r.propagating=!0,m$(r,e)===n?mne(t):Nx(t)),m$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Nx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",mne=t=>t?.code==="EPIPE";var gne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>g$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),g$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=M_(t,e,l);if(m$(l,e)){await u;return}let[d]=await Promise.all([pne({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var _ne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?kl([t,e].filter(Boolean)):void 0,yne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>g$({...IUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:CUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),IUe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},CUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as PUe}from"events";var Sne=t=>uf(t,"ipc"),Ene=(t,e)=>{let r=UA(t);uo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var vne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Sne(o),a=ps(e,"ipc"),c=ps(r,"ipc");for await(let l of QL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(xte(t,i,c),i.push(l)),s&&Ene(l,o);return i},Tne=async(t,e)=>(await Promise.allSettled([t]),e);var bne=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:S,controller:E})=>{let b=Cre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=gne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=yne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=[],I=vne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),O=OUe(m,t,A),N=NUe(h,A);try{return await Promise.race([Promise.all([{},Ore(b),Promise.all(y),x,I,nte(t,d),...O,...N]),S,kUe(t,E),...Xee(t,o,f,E),...See({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...Zee({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch(F){return f.terminationReason??="other",Promise.all([{error:F},b,Promise.all(y.map(_=>h$(_))),h$(x),Tne(I,R),Promise.allSettled(O),Promise.allSettled(N)])}},OUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:M_(n,i,r)),NUe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ii(o,{checkOpen:!1})&&!xi(o)).map(({type:i,value:o,stream:s=o})=>M_(s,n,e,{isSameDirection:Wn.has(i),stopOnExit:i==="native"}))),kUe=async(t,{signal:e})=>{let[r]=await PUe(t,"error",{signal:e});throw r};var Ane=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),D_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=fo();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},bf=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as MUe}from"stream";import{callbackify as DUe}from"util";import{finished as xne}from"stream/promises";var _$=async t=>{if(t!==void 0)try{await y$(t)}catch{}},wne=async t=>{if(t!==void 0)try{await S$(t)}catch{}},y$=async t=>{await xne(t,{cleanup:!0,readable:!1,writable:!0})},S$=async t=>{await xne(t,{cleanup:!0,readable:!0,writable:!1})},kx=async(t,e)=>{if(await t,e)throw e},Mx=(t,e,r)=>{r&&!Nx(r)?t.destroy(r):e&&t.destroy()};var Rne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||_n.has(r),{subprocessStdout:a,waitReadableDestroy:c}=E$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=v$(a,s),{read:f,onStdoutDataDone:p}=T$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new MUe({read:f,destroy:DUe(A$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return b$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},E$=(t,e,r)=>{let n=mf(t,e),i=D_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},v$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:p$},T$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=fo(),s=Ox({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){LUe(this,s,o)},onStdoutDataDone:o}},LUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},b$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await S$(t),await n,await _$(i),await e,r.readable&&r.push(null)}catch(o){await _$(i),Ine(r,o)}},A$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await bf(r,e)&&(Ine(t,n),await kx(e,n))},Ine=(t,e)=>{Mx(t,t.readable,e)};import{Writable as $Ue}from"stream";import{callbackify as Cne}from"util";var Pne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=x$(t,r,e),s=new $Ue({...w$(n,t,i),destroy:Cne(I$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return R$(n,s),s},x$=(t,e,r)=>{let n=KA(t,e),i=D_(r,n,"writableFinal"),o=D_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},w$=(t,e,r)=>({write:UUe.bind(void 0,t),final:Cne(FUe.bind(void 0,t,e,r))}),UUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},FUe=async(t,e,r)=>{await bf(r,e)&&(t.writable&&t.end(),await e)},R$=async(t,e,r)=>{try{await y$(t),e.writable&&e.end()}catch(n){await wne(r),One(e,n)}},I$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await bf(r,e),await bf(n,e)&&(One(t,i),await kx(e,i))},One=(t,e)=>{Mx(t,t.writable,e)};import{Duplex as BUe}from"stream";import{callbackify as jUe}from"util";var Nne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||_n.has(r),{subprocessStdout:c,waitReadableDestroy:l}=E$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=x$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=v$(c,a),{read:S,onStdoutDataDone:E}=T$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new BUe({read:S,...w$(u,t,d),destroy:jUe(zUe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return b$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),R$(u,b,c),b},zUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([A$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),I$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var C$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||_n.has(e),s=mf(t,r),a=Ox({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return GUe(a,s,t)},GUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var kne=(t,{encoding:e})=>{let r=Ane();t.readable=Rne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Pne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Nne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=C$.bind(void 0,t,e),t[Symbol.asyncIterator]=C$.bind(void 0,t,e,{})};var Mne=(t,e)=>{for(let[r,n]of qUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},VUe=(async()=>{})().constructor.prototype,qUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(VUe,t)]);var Dne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=YUe(t,e,r),{subprocess:f,promise:p}=ZUe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Px.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Mne(f,p),po.set(f,{options:u,fileDescriptors:d}),f},YUe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),{file:a,commandArguments:c,options:l}=sx(t,e,r),u=KUe(l),d=Hre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},KUe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},ZUe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=WUe(...ax(t,e,r))}catch(h){return zre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;HUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];tne(c,a,l),nne(c,r,l);let d={},f=fo();c.kill=_ee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=_ne(c,r),kne(c,r),Fre(c,r);let p=JUe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},JUe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,S]=await bne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let E=h.map((y,x)=>ms(y,e,x)),b=ms(m,e,"all"),A=XUe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:S,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ef(A,n,e)},XUe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?C_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ho,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):mx({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Dx=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,QUe(n,t[n],i)]));return{...t,...r}},QUe=(t,e,r)=>eFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,eFe=new Set(["env",...oL]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>tFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},tFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Dx(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=rFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?kre(a,c,l):Dne(a,c,l,i)},rFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=HQ(e)?WQ(e,r):[e,...r],[s,a,c]=CA(...o),l=Dx(Dx(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Lne=({file:t,commandArguments:e})=>Une(t,e),$ne=({file:t,commandArguments:e})=>({...Une(t,e),isSync:!0}),Une=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=nFe(t);return{file:r,commandArguments:n}},nFe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(iFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},iFe=/ +/g;var Fne=(t,e,r)=>{t.sync=e(oFe,r),t.s=t.sync},Bne=({options:t})=>jne(t),oFe=({options:t})=>({...jne(t),isSync:!0}),jne=t=>({options:{...sFe(t),...t}}),sFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},zne={preferLocal:!0};var Gne=Da(()=>({})),Gbt=Da(()=>({isSync:!0})),Vne=Da(Lne),Vbt=Da($ne),qbt=Da(ete),Hbt=Da(Bne,{},zne,Fne),{sendMessage:Wbt,getOneMessage:Ybt,getEachMessage:Kbt,getCancelSignal:Zbt}=Bre();var qne=!1,Hne=()=>{qne=!0},go=()=>qne;var L_=null,Wne=t=>(L_&&L_.destroy(),L_=new gs({totalAllowedTime:t}),L_),Yne=()=>L_;var gs=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&go())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await TA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ue.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var Kne={name:"@netlify/agent-runner-cli",type:"module",version:"1.155.0-EX-2697.4",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.5","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var uFe=cFe(import.meta.url),dFe=_s.dirname(uFe),fFe=lFe(import.meta.url),Af=fe("shell"),P$=new Set,Zne={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=pFe(e,r),o={...Zne,...i},s=Gne(t,n,o);Xne(s,o),tie(s);let a=r?.idleTimeout;return a&&a>0&&eie(s,a),s},Jne=(t,e)=>{let r={...Zne,...e},n=Vne(t,r);return Xne(n,r),tie(n),e?.idleTimeout&&e.idleTimeout>0&&eie(n,e.idleTimeout),n},pFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},Xne=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(ys.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new u_).pipe(ys.stdout),t.stderr?.pipe(new u_).pipe(ys.stderr);return}t.stdout?.pipe(ys.stdout),t.stderr?.pipe(ys.stderr)},O$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(ys.kill(-t.pid,e),Af.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Af.error("Error killing process:",r),!1}},Qne=t=>O$(t,"SIGKILL"),eie=(t,e)=>{let r=null,n=()=>{Af.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),O$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing idle process ${t.pid}`),Qne(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},tie=t=>{P$.add(t);let e=Yne();if(e){let r=e.onTimesUp(()=>{Af.log(`Global timer expired, killing process ${t.pid}`),O$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing process ${t.pid} after timeout`),Qne(t))},5e3)});t.on("exit",()=>{P$.delete(t),r()}),t.on("error",()=>{P$.delete(t),r()})}};function $x(t,e){return!!Ci(t,e)}function Ci(t,e){if(!ys.env.NETLIFY_LOCAL_MODE)try{let i=fFe.resolve(Kne.name),o=_s.dirname(i);for(;o!==_s.dirname(o);){let s=_s.dirname(o);if(_s.basename(s)==="node_modules"){let a=_s.join(s,".bin",e);if(Lx.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(ys.env.NODE_PATH){let i=_s.join(ys.env.NODE_PATH,".bin",e);if(Lx.existsSync(i))return i}let r=_s.join(t,"node_modules",".bin",e);if(Lx.existsSync(r))return r;let n=_s.join(dFe,"..","node_modules",".bin",e);if(Lx.existsSync(n))return n}var hFe=fe("utils"),mFe=t=>new Promise(e=>{setTimeout(e,t)});var N$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ux=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await mFe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},La=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},rie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):hFe.error("Could not parse JSON",n))}},gFe=t=>t.charAt(0).toUpperCase()+t.slice(1),_o=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():gFe(e)).join(" ");function Ss(t,e){e&&t.log(`Skill invoked: ${e}`)}var Fx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),nie=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var k$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},_Fe=1e4,M$=(t,e=_Fe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as yFe}from"crypto";import{createReadStream as SFe}from"fs";import Bx from"fs/promises";import cie from"os";import jx from"path";var iie=fe("repo"),lie="runner-diffs-",uie=t=>`${lie}${t}-`,die=async t=>{let e=cie.tmpdir(),r;try{r=await Bx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(lie)&&!n.startsWith(uie(t))).map(n=>Bx.rm(jx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Xr=(t,e={})=>zt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),zx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{iie.info("Getting runner diffs");let n=await vFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=bFe(o);await AFe(h,r)}iie.info("Changes after processing"),await L$(r);let s=await $$(o,r);if(await D$(s,r),i=await TFe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Bx.mkdtemp(jx.join(cie.tmpdir(),uie(t.sessionId))),c=async({from:h,to:m,fileName:S,binary:E})=>{let b=jx.join(a,S);await Xr([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:y}=await Bx.stat(b);return{path:b,size:y}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await aie(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await sie(d,h)||(f=h)}await aie(r),ue.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await sie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},oie=async t=>{let e=yFe("sha256");for await(let r of SFe(t))e.update(r);return e.digest("hex")},sie=async(t,e)=>t.size===e.size&&await oie(t.path)===await oie(e.path),aie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},D$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},L$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},fie=/.. (.+)?\.log$/,EFe=[fie],vFe=async(t=process.cwd())=>{let e=await L$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
103
103
  `).filter(i=>EFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},TFe=async(t=process.cwd())=>{try{return await Xr(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},$_=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},pie=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},$$=async(t,e=process.cwd())=>{t||=await L$(e);let r=[".netlify","node_modules","dist",".next","out",".nuxt",".output",".cache",".turbo",".parcel-cache","coverage",".nyc_output","storybook-static","public/build","CLAUDE.local.md"],n=[];return t.split(`
104
104
  `).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${jx.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match(fie)?.[1];o&&n.push(`:!${o}.log`)}),n},hie=async(t=process.cwd())=>{await Xr(["reset","--hard","HEAD"],{cwd:t})},mie=async(t=process.cwd())=>{let e=await Xr(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
105
105
  `).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},bFe=t=>{let e=t.split(`
package/dist/bin.js CHANGED
@@ -587,7 +587,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
587
587
  `,LF:`
588
588
  `,concatBytes:A3},_St=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},ySt={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:_St};import{Buffer as SSt}from"buffer";var bTe=(t,e)=>t?void 0:ESt.bind(void 0,e),ESt=function*(t,e){if(typeof e!="string"&&!Cr(e)&&!SSt.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},TTe=(t,e)=>t?vSt.bind(void 0,e):bSt.bind(void 0,e),vSt=function*(t,e){wTe(t,e),yield e},bSt=function*(t,e){if(wTe(t,e),typeof e!="string"&&!Cr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},wTe=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
589
589
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
590
- if (condition) { yield value; }`)};import{Buffer as TSt}from"buffer";import{StringDecoder as wSt}from"string_decoder";var AC=(t,e,r)=>{if(r)return;if(t)return{transform:ASt.bind(void 0,new TextEncoder)};let n=new wSt(e);return{transform:RSt.bind(void 0,n),final:xSt.bind(void 0,n)}},ASt=function*(t,e){TSt.isBuffer(e)?yield bc(e):typeof e=="string"?yield t.encode(e):yield e},RSt=function*(t,e){yield Cr(e)?t.write(e):e},xSt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as ATe}from"util";var x3=ATe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),RC=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=OSt}=e[r];for await(let i of n(t))yield*RC(i,e,r+1)},RTe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*ISt(r,Number(e),t)},ISt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*RC(n,r,e+1)},xTe=ATe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),OSt=function*(t){yield t};var I3=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},ITe=(t,e)=>[...e.flatMap(r=>[...zf(r,t,0)]),...Kb(t)],zf=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=CSt}=e[r];for(let i of n(t))yield*zf(i,e,r+1)},Kb=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*PSt(r,Number(e),t)},PSt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*zf(n,r,e+1)},CSt=function*(t){yield t};var O3=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=PTe(t,o,s),l=Bf(e),u=Bf(r),d=l?x3.bind(void 0,RC,a):I3.bind(void 0,zf),f=l||u?x3.bind(void 0,RTe,a):I3.bind(void 0,Kb),p=l||u?xTe.bind(void 0,a):void 0;return{stream:new NSt({writableObjectMode:n,writableHighWaterMark:OTe(n),readableObjectMode:i,readableHighWaterMark:OTe(i),transform(m,_,y){d([m,c,0],this,y)},flush(m){f([c],this,m)},destroy:p})}},xC=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=PTe(o,r,a);t=ITe(c,t)}return t},PTe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:bTe(n,a)},AC(r,o,n),wC(r,s,n,c),{transform:t,final:e},{transform:TTe(i,a)},vTe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var CTe=(t,e)=>{for(let r of kSt(t))$St(t,r,e)},kSt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),$St=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Au[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>LSt(a,n));r.input=Fb(o)},LSt=(t,e)=>{let r=xC(t,e,"utf8",!0);return DSt(r),Fb(r)},DSt=t=>{let e=t.find(r=>typeof r!="string"&&!Cr(r));if(e!==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: ${e}.`)};import{writeFileSync as jSt,appendFileSync as qSt}from"fs";var IC=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&$g(r,n)&&!Ui.has(e)&&MSt(n)&&(t.some(({type:i,value:s})=>i==="native"&&USt.has(s))||t.every(({type:i})=>bs.has(i))),MSt=t=>t===1||t===2,USt=new Set(["pipe","overlapped"]),NTe=async(t,e,r,n)=>{for await(let i of t)FSt(e)||$Te(i,r,n)},kTe=(t,e,r)=>{for(let n of t)$Te(n,e,r)},FSt=t=>t._readableState.pipes.length>0,$Te=(t,e,r)=>{let n=BP(t);na({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var LTe=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>BSt({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},BSt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Dbe(t,s,d),p=bc(f),{stdioItems:h,objectMode:m}=e[r],_=zSt([p],h,c,n),{serializedResult:y,finalResult:v=y}=VSt({chunks:_,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});HSt({serializedResult:y,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let S=a[r]?v:void 0;try{return n.error===void 0&&GSt(y,h,i),S}catch(g){return n.error=g,S}},zSt=(t,e,r,n)=>{try{return xC(t,e,r,!1)}catch(i){return n.error=i,t}},VSt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Fb(t)};let o=JSe(t,r);return n[s]?{serializedResult:o,finalResult:R3(o,!i[s],e)}:{serializedResult:o}},HSt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!IC({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=R3(t,!1,o);try{kTe(a,e,n)}catch(c){r.error??=c}},GSt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>bC.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?qSt(n,t):(r.add(s),jSt(n,t))}};var DTe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Ac(e,r,"all")]:Array.isArray(e)?[Ac(t,r,"all"),...e]:Cr(t)&&Cr(e)?L6([t,e]):`${t}${e}`};import{once as P3}from"events";var MTe=async(t,e)=>{let[r,n]=await WSt(t);return e.isForcefullyTerminated??=!1,[r,n]},WSt=async t=>{let[e,r]=await Promise.allSettled([P3(t,"spawn"),P3(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?UTe(t):r.value},UTe=async t=>{try{return await P3(t,"exit")}catch{return UTe(t)}},FTe=async t=>{let[e,r]=await t;if(!YSt(e,r)&&C3(e,r))throw new no;return[e,r]},YSt=(t,e)=>t===void 0&&e===void 0,C3=(t,e)=>t!==0||e!==null;var jTe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=KSt(t,e,r),o=s?.code==="ETIMEDOUT",a=Lbe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},KSt=(t,e,r)=>t!==void 0?t:C3(e,r)?new no:void 0;var qTe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=ZSt(t,e,r),d=eEt({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return Vg(d,c,l)},ZSt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=VP(t,e,r),a=XSt(r),{file:c,commandArguments:l,options:u}=uC(t,e,a);QSt(u);let d=_Te(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},XSt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,QSt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&OC("ipcInput"),t&&OC("ipc: true"),r&&OC("detached: true"),n&&OC("cancelSignal")},OC=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},eEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=tEt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=jTe(c,r),{output:h,error:m=l}=LTe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((v,S)=>Ac(v,r,S)),y=Ac(DTe(h,r),r,"all");return nEt({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},tEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{CTe(s,r);let a=rEt(r);return JSt(...dC(t,e,a))}catch(a){return zg({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},rEt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:yC(e)}),nEt=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?SC({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):Yb({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as Vvt}from"events";import{spawn as Hvt}from"child_process";import GTe from"process";import{once as N3,on as iEt}from"events";var BTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(Mg({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:iC(t)}),sEt({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),sEt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{eC(e,i);let s=wu(t,e,r),o=new AbortController;try{return await Promise.race([oEt(s,n,o),aEt(s,r,o),cEt(s,r,o)])}catch(a){throw Ug(t),a}finally{o.abort(),tC(e,i)}},oEt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await N3(t,"message",{signal:r});return n}for await(let[n]of iEt(t,"message",{signal:r}))if(e(n))return n},aEt=async(t,e,{signal:r})=>{await N3(t,"disconnect",{signal:r}),Ive(e)},cEt=async(t,e,{signal:r})=>{let[n]=await N3(t,"strict:error",{signal:r});throw ZP(n,e)};import{once as VTe,on as lEt}from"events";var HTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>k3({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),k3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{Mg({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:iC(t)}),eC(e,s);let o=wu(t,e,r),a=new AbortController,c={};return uEt(t,o,a),dEt({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),fEt({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},uEt=async(t,e,r)=>{try{await VTe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},dEt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await VTe(t,"strict:error",{signal:r.signal});n.error=ZP(i,e),r.abort()}catch{}},fEt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of lEt(r,"message",{signal:s.signal}))zTe(o),yield c}catch{zTe(o)}finally{s.abort(),tC(e,a),n||Ug(t),i&&await t}},zTe=({error:t})=>{if(t)throw t};var WTe=(t,{ipc:e})=>{Object.assign(t,KTe(t,!1,e))},YTe=()=>{let t=GTe,e=!0,r=GTe.channel!==void 0;return{...KTe(t,e,r),getCancelSignal:tbe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},KTe=(t,e,r)=>({sendMessage:cC.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:BTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:HTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as pEt}from"child_process";import{PassThrough as hEt,Readable as mEt,Writable as gEt,Duplex as _Et}from"stream";var JTe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{T3(n);let a=new pEt;yEt(a,n),Object.assign(a,{readable:SEt,writable:EEt,duplex:vEt});let c=zg({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=bEt(c,o,i);return{subprocess:a,promise:l}},yEt=(t,e)=>{let r=Jb(),n=Jb(),i=Jb(),s=Array.from({length:e.length-3},Jb),o=Jb(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},Jb=()=>{let t=new hEt;return t.end(),t},SEt=()=>new mEt({read(){}}),EEt=()=>new gEt({write(){}}),vEt=()=>new _Et({read(){},write(){}}),bEt=async(t,e,r)=>Vg(t,e,r);import{createReadStream as ZTe,createWriteStream as XTe}from"fs";import{Buffer as TEt}from"buffer";import{Readable as Zb,Writable as wEt,Duplex as AEt}from"stream";var ewe=(t,e)=>TC(REt,t,e,!1),Xb=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Au[t]}.`)},QTe={fileNumber:Xb,generator:O3,asyncGenerator:O3,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:AEt.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},REt={input:{...QTe,fileUrl:({value:t})=>({stream:ZTe(t)}),filePath:({value:{file:t}})=>({stream:ZTe(t)}),webStream:({value:t})=>({stream:Zb.fromWeb(t)}),iterable:({value:t})=>({stream:Zb.from(t)}),asyncIterable:({value:t})=>({stream:Zb.from(t)}),string:({value:t})=>({stream:Zb.from(t)}),uint8Array:({value:t})=>({stream:Zb.from(TEt.from(t))})},output:{...QTe,fileUrl:({value:t})=>({stream:XTe(t)}),filePath:({value:{file:t,append:e}})=>({stream:XTe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:wEt.fromWeb(t)}),iterable:Xb,asyncIterable:Xb,string:Xb,uint8Array:Xb}};import{on as xEt,once as twe}from"events";import{PassThrough as IEt,getDefaultHighWaterMark as OEt}from"stream";import{finished as iwe}from"stream/promises";function Vf(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)L3(i);let e=t.some(({readableObjectMode:i})=>i),r=PEt(t,e),n=new $3({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var PEt=(t,e)=>{if(t.length===0)return OEt(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},$3=class extends IEt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(L3(e),this.#e.has(e))return;this.#e.add(e),this.#n??=CEt(this,this.#e,this.#s);let r=$Et({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(L3(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},CEt=async(t,e,r)=>{PC(t,rwe);let n=new AbortController;try{await Promise.race([NEt(t,n),kEt(t,e,r,n)])}finally{n.abort(),PC(t,-rwe)}},NEt=async(t,{signal:e})=>{try{await iwe(t,{signal:e,cleanup:!0})}catch(r){throw swe(t,r),r}},kEt=async(t,e,r,{signal:n})=>{for await(let[i]of xEt(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},L3=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},$Et=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{PC(t,nwe);let a=new AbortController;try{await Promise.race([LEt(s,e,a),DEt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),MEt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),PC(t,-nwe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?D3(t):UEt(t))},LEt=async(t,e,{signal:r})=>{try{await t,r.aborted||D3(e)}catch(n){r.aborted||swe(e,n)}},DEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await iwe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;owe(o)?i.add(e):awe(t,o)}},MEt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await twe(t,i,{signal:s}),!t.readable)return twe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},UEt=t=>{t.writable&&t.end()},swe=(t,e)=>{owe(e)?D3(t):awe(t,e)},owe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",D3=t=>{(t.readable||t.writable)&&t.destroy()},awe=(t,e)=>{t.destroyed||(t.once("error",FEt),t.destroy(e))},FEt=()=>{},PC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},rwe=2,nwe=1;import{finished as cwe}from"stream/promises";var Gg=(t,e)=>{t.pipe(e),jEt(t,e),qEt(t,e)},jEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await cwe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}M3(e)}},M3=t=>{t.writable&&t.end()},qEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await cwe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}U3(t)}},U3=t=>{t.readable&&t.destroy()};var lwe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>bs.has(c)))BEt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!bs.has(c)))VEt({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Vf(s);Gg(o,i)}},BEt=(t,e,r,n)=>{r==="output"?Gg(t.stdio[n],e):Gg(e,t.stdio[n]);let i=zEt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},zEt=["stdin","stdout","stderr"],VEt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;HEt(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},HEt=(t,{signal:e})=>{ro(t)&&jf(t,GEt,e)},GEt=2;import{addAbortListener as KEt}from"events";var Hf=[];Hf.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Hf.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Hf.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var CC=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",F3=Symbol.for("signal-exit emitter"),j3=globalThis,WEt=Object.defineProperty.bind(Object),q3=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(j3[F3])return j3[F3];WEt(j3,F3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},NC=class{},YEt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),B3=class extends NC{onExit(){return()=>{}}load(){}unload(){}},z3=class extends NC{#e=V3.platform==="win32"?"SIGINT":"SIGHUP";#r=new q3;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Hf)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!CC(this.#t))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of Hf)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Hf.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#s,this.#r.count-=1)}#a(e){return CC(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&CC(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},V3=globalThis.process,{onExit:uwe,load:Jlr,unload:Zlr}=YEt(CC(V3)?new z3(V3):new B3);var dwe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=uwe(()=>{t.kill()});KEt(n,()=>{i()})};var pwe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=zP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=JEt(r,n,i),{sourceStream:d,sourceError:f}=XEt(t,l),{options:p,fileDescriptors:h}=sa.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},JEt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=ZEt(t,e,...r),a=QP(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},ZEt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(fwe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||k6(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,s,o]=kP(r,...n);return{destination:e(fwe)(i,s,o),pipeOptions:o}}if(sa.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},fwe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),XEt=(t,e)=>{try{return{sourceStream:Fg(t,e)}}catch(r){return{sourceError:r}}};var mwe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=QEt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw H3({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},QEt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return U3(t),n;if(e!==void 0)return M3(r),e},H3=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>zg({error:t,command:hwe,escapedCommand:hwe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),hwe="source.pipe(destination)";var gwe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o};import{finished as evt}from"stream/promises";var _we=(t,e,r)=>{let n=kC.has(e)?rvt(t,e):tvt(t,e);return jf(t,ivt,r.signal),jf(e,svt,r.signal),nvt(e),n},tvt=(t,e)=>{let r=Vf([t]);return Gg(r,e),kC.set(e,r),r},rvt=(t,e)=>{let r=kC.get(e);return r.add(t),r},nvt=async t=>{try{await evt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}kC.delete(t)},kC=new WeakMap,ivt=2,svt=1;import{aborted as ovt}from"util";var ywe=(t,e)=>t===void 0?[]:[avt(t,e)],avt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await ovt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw H3({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var $C=(t,...e)=>{if(gr(e[0]))return $C.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=pwe(t,...e),i=cvt({...n,destination:r});return i.pipe=$C.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},cvt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=lvt(t,i);mwe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=_we(e,s,d);return await Promise.race([gwe(u),...ywe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},lvt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as gvt}from"timers/promises";import{on as uvt}from"events";import{getDefaultHighWaterMark as dvt}from"stream";var LC=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return fvt(e,o),Ewe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},fvt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},G3=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;pvt(e,o,t);let a=t.readableObjectMode&&!s;return Ewe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},pvt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Ewe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=uvt(t,"data",{signal:e.signal,highWaterMark:Swe,highWatermark:Swe});return hvt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},W3=dvt(!0),Swe=W3,hvt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=mvt({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*zf(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Kb(a)}},mvt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[AC(t,r,!e),wC(t,i,!n,{})].filter(Boolean);var vwe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=_vt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([yvt(t),d]);return}let f=w3(c,r),p=G3({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([Svt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},_vt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!IC({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=G3({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await NTe(a,t,r,s)},yvt=async t=>{await gvt(),t.readableFlowing===null&&t.resume()},Svt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await mC(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await gC(r,{maxBuffer:s})):await Bg(r,{maxBuffer:s})}catch(a){return bwe(Nbe({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},Y3=async t=>{try{return await t}catch(e){return bwe(e)}},bwe=({bufferedData:t})=>YSe(t)?new Uint8Array(t):t;import{finished as Evt}from"stream/promises";var Qb=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=vvt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Evt(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||wvt(a,e,r,n)}finally{o.abort()}},vvt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&bvt(t,r,n),n},bvt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Tvt(e,r),n.call(t,...i)}},Tvt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},wvt=(t,e,r,n)=>{if(!Avt(t,e,r,n))throw t},Avt=(t,e,r,n=!0)=>r.propagating?Twe(t)||DC(t):(r.propagating=!0,K3(r,e)===n?Twe(t):DC(t)),K3=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",DC=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Twe=t=>t?.code==="EPIPE";var wwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>J3({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),J3=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=Qb(t,e,l);if(K3(l,e)){await u;return}let[d]=await Promise.all([vwe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var Awe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Vf([t,e].filter(Boolean)):void 0,Rwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>J3({...Rvt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:xvt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Rvt=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},xvt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as Ivt}from"events";var xwe=t=>$g(t,"ipc"),Iwe=(t,e)=>{let r=BP(t);na({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Owe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=xwe(s),a=Tc(e,"ipc"),c=Tc(r,"ipc");for await(let l of k3({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(kbe(t,i,c),i.push(l)),o&&Iwe(l,s);return i},Pwe=async(t,e)=>(await Promise.allSettled([t]),e);var Cwe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:_,controller:y})=>{let v=MTe(t,f),S={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},g=wwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),T=Rwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),I=[],x=Owe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),A=Ovt(m,t,S),O=Pvt(h,S);try{return await Promise.race([Promise.all([{},FTe(v),Promise.all(g),T,x,dbe(t,d),...A,...O]),_,Cvt(t,y),...obe(t,s,f,y),...xve({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:y}),...ibe({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(R){return f.terminationReason??="other",Promise.all([{error:R},v,Promise.all(g.map(b=>Y3(b))),Y3(T),Pwe(x,I),Promise.allSettled(A),Promise.allSettled(O)])}},Ovt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Qb(n,i,r)),Pvt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>so(s,{checkOpen:!1})&&!ro(s)).map(({type:i,value:s,stream:o=s})=>Qb(o,n,e,{isSameDirection:bs.has(i),stopOnExit:i==="native"}))),Cvt=async(t,{signal:e})=>{let[r]=await Ivt(t,"error",{signal:e});throw r};var Nwe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),eT=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=ia();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Wg=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as Nvt}from"stream";import{callbackify as kvt}from"util";import{finished as kwe}from"stream/promises";var Z3=async t=>{if(t!==void 0)try{await X3(t)}catch{}},$we=async t=>{if(t!==void 0)try{await Q3(t)}catch{}},X3=async t=>{await kwe(t,{cleanup:!0,readable:!1,writable:!0})},Q3=async t=>{await kwe(t,{cleanup:!0,readable:!0,writable:!1})},MC=async(t,e)=>{if(await t,e)throw e},UC=(t,e,r)=>{r&&!DC(r)?t.destroy(r):e&&t.destroy()};var Lwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||Ui.has(r),{subprocessStdout:a,waitReadableDestroy:c}=eW(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=tW(a,o),{read:f,onStdoutDataDone:p}=rW({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new Nvt({read:f,destroy:kvt(iW.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return nW({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},eW=(t,e,r)=>{let n=Fg(t,e),i=eT(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},tW=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:W3},rW=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=ia(),o=LC({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){$vt(this,o,s)},onStdoutDataDone:s}},$vt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},nW=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await Q3(t),await n,await Z3(i),await e,r.readable&&r.push(null)}catch(s){await Z3(i),Dwe(r,s)}},iW=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Wg(r,e)&&(Dwe(t,n),await MC(e,n))},Dwe=(t,e)=>{UC(t,t.readable,e)};import{Writable as Lvt}from"stream";import{callbackify as Mwe}from"util";var Uwe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=sW(t,r,e),o=new Lvt({...oW(n,t,i),destroy:Mwe(cW.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return aW(n,o),o},sW=(t,e,r)=>{let n=QP(t,e),i=eT(r,n,"writableFinal"),s=eT(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},oW=(t,e,r)=>({write:Dvt.bind(void 0,t),final:Mwe(Mvt.bind(void 0,t,e,r))}),Dvt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Mvt=async(t,e,r)=>{await Wg(r,e)&&(t.writable&&t.end(),await e)},aW=async(t,e,r)=>{try{await X3(t),e.writable&&e.end()}catch(n){await $we(r),Fwe(e,n)}},cW=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Wg(r,e),await Wg(n,e)&&(Fwe(t,i),await MC(e,i))},Fwe=(t,e)=>{UC(t,t.writable,e)};import{Duplex as Uvt}from"stream";import{callbackify as Fvt}from"util";var jwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||Ui.has(r),{subprocessStdout:c,waitReadableDestroy:l}=eW(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=sW(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=tW(c,a),{read:_,onStdoutDataDone:y}=rW({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),v=new Uvt({read:_,...oW(u,t,d),destroy:Fvt(jvt.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return nW({subprocessStdout:c,onStdoutDataDone:y,readable:v,subprocess:t,subprocessStdin:u}),aW(u,v,c),v},jvt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([iW({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),cW({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var lW=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||Ui.has(e),o=Fg(t,r),a=LC({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return qvt(a,o,t)},qvt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var qwe=(t,{encoding:e})=>{let r=Nwe();t.readable=Lwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Uwe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=jwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lW.bind(void 0,t,e),t[Symbol.asyncIterator]=lW.bind(void 0,t,e,{})};var Bwe=(t,e)=>{for(let[r,n]of zvt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Bvt=(async()=>{})().constructor.prototype,zvt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Bvt,t)]);var zwe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Gvt(t,e,r),{subprocess:f,promise:p}=Yvt({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=$C.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Bwe(f,p),sa.set(f,{options:u,fileDescriptors:d}),f},Gvt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=VP(t,e,r),{file:a,commandArguments:c,options:l}=uC(t,e,r),u=Wvt(l),d=ewe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},Wvt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Yvt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=Hvt(...dC(t,e,r))}catch(h){return JTe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Vvt(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];lwe(c,a,l),dwe(c,r,l);let d={},f=ia();c.kill=Ave.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=Awe(c,r),qwe(c,r),WTe(c,r);let p=Kvt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Kvt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,_]=await Cwe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let y=h.map((g,T)=>Ac(g,e,T)),v=Ac(m,e,"all"),S=Jvt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:v,ipcOutput:_,context:c,options:e,command:o,escapedCommand:a,startTime:r});return Vg(S,n,e)},Jvt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Yb({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof oa,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):SC({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u});var FC=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Zvt(n,t[n],i)]));return{...t,...r}},Zvt=(t,e,r)=>Xvt.has(t)&&gr(e)&&gr(r)?{...e,...r}:r,Xvt=new Set(["env",...F6]);var Ru=(t,e,r,n)=>{let i=(o,a,c)=>Ru(o,a,r,c),s=(...o)=>Qvt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},Qvt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(gr(s))return i(t,FC(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=ebt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?qTe(a,c,l):zwe(a,c,l,i)},ebt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=eEe(e)?tEe(e,r):[e,...r],[o,a,c]=kP(...s),l=FC(FC(n,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Vwe=({file:t,commandArguments:e})=>Gwe(t,e),Hwe=({file:t,commandArguments:e})=>({...Gwe(t,e),isSync:!0}),Gwe=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=tbt(t);return{file:r,commandArguments:n}},tbt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(rbt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},rbt=/ +/g;var Wwe=(t,e,r)=>{t.sync=e(nbt,r),t.s=t.sync},Ywe=({options:t})=>Kwe(t),nbt=({options:t})=>({...Kwe(t),isSync:!0}),Kwe=t=>({options:{...ibt(t),...t}}),ibt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},Jwe={preferLocal:!0};var Zwe=Ru(()=>({})),jfr=Ru(()=>({isSync:!0})),Xwe=Ru(Vwe),qfr=Ru(Hwe),Bfr=Ru(cbe),zfr=Ru(Ywe,{},Jwe,Wwe),{sendMessage:Vfr,getOneMessage:Hfr,getEachMessage:Gfr,getCancelSignal:Wfr}=YTe();import{Transform as sbt}from"stream";var obt=["NETLIFY_AI_GATEWAY_KEY"];function abt(){let t=(process.env.NETLIFY_SENSITIVE_ENV_KEYS||"").split(",").map(e=>e.trim()).filter(Boolean);return[...new Set([...t,...obt])]}function cbt(t){let e=t.toLowerCase();return e==="true"||e==="false"?!0:t.trim().length<4}function lbt(){let e=abt().map(r=>process.env[r]).filter(r=>!(!r||cbt(r)));return[...new Set(e)].sort((r,n)=>n.length-r.length)}function Ts(t){if(typeof t!="string")return t;let e=lbt();if(e.length===0)return t;let r=t;return e.forEach(n=>{let i=new RegExp(ubt(n),"g");r=r.replace(i,"******")}),r}function ubt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var tT=class extends sbt{constructor(e={}){super({...e,objectMode:!1})}_transform(e,r,n){let i=e.toString(),s=Ts(i);n(null,s)}},jC=Symbol("maskedWrite");function Qwe(){if(process.env.NETLIFY_MASK_LOGS!=="false"){if(!process.stdout.write[jC]){let e=process.stdout.write.bind(process.stdout),r=function(n,i,s){let o=typeof n=="string"?Ts(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[jC]=!0,process.stdout.write=r}if(!process.stderr.write[jC]){let e=process.stderr.write.bind(process.stderr),r=function(n,i,s){let o=typeof n=="string"?Ts(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[jC]=!0,process.stderr.write=r}}}var e0e=!1,t0e=()=>{e0e=!0},_i=()=>e0e;var rT=null,r0e=t=>(rT&&rT.destroy(),rT=new Rc({totalAllowedTime:t}),rT),n0e=()=>rT;var Rc=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&_i())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let s=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),o=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await CP({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ye.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),s(),o&&clearTimeout(o)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var i0e={name:"@netlify/agent-runner-cli",type:"module",version:"1.155.0-EX-2697.3",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.5","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var hbt=fbt(import.meta.url),mbt=xc.dirname(hbt),gbt=pbt(import.meta.url),Yg=Se("shell"),uW=new Set,s0e={preferLocal:!0},fn=(t,e,r)=>{let[n,i]=_bt(e,r),s={...s0e,...i},o=Zwe(t,n,s);a0e(o,s),u0e(o);let a=r?.idleTimeout;return a&&a>0&&l0e(o,a),o},o0e=(t,e)=>{let r={...s0e,...e},n=Xwe(t,r);return a0e(n,r),u0e(n),e?.idleTimeout&&e.idleTimeout>0&&l0e(n,e.idleTimeout),n},_bt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},a0e=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Ic.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new tT).pipe(Ic.stdout),t.stderr?.pipe(new tT).pipe(Ic.stderr);return}t.stdout?.pipe(Ic.stdout),t.stderr?.pipe(Ic.stderr)},dW=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Ic.kill(-t.pid,e),Yg.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Yg.error("Error killing process:",r),!1}},c0e=t=>dW(t,"SIGKILL"),l0e=(t,e)=>{let r=null,n=()=>{Yg.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),dW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Yg.log(`Force killing idle process ${t.pid}`),c0e(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let s=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",s),t.on("error",s)},u0e=t=>{uW.add(t);let e=n0e();if(e){let r=e.onTimesUp(()=>{Yg.log(`Global timer expired, killing process ${t.pid}`),dW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Yg.log(`Force killing process ${t.pid} after timeout`),c0e(t))},5e3)});t.on("exit",()=>{uW.delete(t),r()}),t.on("error",()=>{uW.delete(t),r()})}};function ca(t,e){if(!Ic.env.NETLIFY_LOCAL_MODE)try{let i=gbt.resolve(i0e.name),s=xc.dirname(i);for(;s!==xc.dirname(s);){let o=xc.dirname(s);if(xc.basename(o)==="node_modules"){let a=xc.join(o,".bin",e);if(qC.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(Ic.env.NODE_PATH){let i=xc.join(Ic.env.NODE_PATH,".bin",e);if(qC.existsSync(i))return i}let r=xc.join(t,"node_modules",".bin",e);if(qC.existsSync(r))return r;let n=xc.join(mbt,"..","node_modules",".bin",e);if(qC.existsSync(n))return n}import uD from"process";import{fileURLToPath as GLt}from"url";import{createRequire as WLt}from"module";import dD from"path";var ybt="__netlify__getTracer",Sbt="__netlify__shutdownTracers",gt=(t,e)=>globalThis[ybt]?.(t,e),d0e=async()=>globalThis[Sbt]?.();function Gf(t,e,r,n,i){let s=typeof n=="function"?n:typeof r=="function"?r:i;if(!s)throw new Error("function to execute with active span is missing");return t?t.withActiveSpan(e,r,n,s):s()}import{setTimeout as FLt}from"timers/promises";Ne();import Ewt from"process";Ne();var zbt=(t,e)=>{e.recordException(t),e.setStatus({code:In.ERROR})};var Cc=class{constructor(e){this._tracer=e,this.startSpan=e.startSpan.bind(this._tracer),this.startActiveSpan=e.startActiveSpan.bind(this._tracer)}withActiveSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=iAe(r,n,i);return this._tracer.startActiveSpan(e,s,o,c=>sAe(c,s,a))}withSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=iAe(r,n,i),c=this._tracer.startSpan(e,s,o);return sAe(c,s,a)}};function iAe(t,e,r){let n,i,s;return!e&&!r?s=t:r?(n=t,i=e,s=r):(n=t,s=e),n=n??{},i=i??Ft.active(),{opts:n,ctx:i,fn:s}}function sAe(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:zbt,s=o=>{throw i(o,t),t.end(),o};try{let o=r(t);return typeof o?.then=="function"?o.then(a=>(t.end(),a),s):(t.end(),o)}catch(o){throw s(o)}}Ne();var t_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var HW=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=mAe(e),n._asyncAttributesPending=e.filter(([i,s])=>t_(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,s])=>(t_(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=mAe(this._rawAttributes),this._schemaUrl=Vbt(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,t_(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&le.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(t_(n)){le.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=Hbt(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function GW(t,e){return HW.FromAttributeList(Object.entries(t),e)}function mAe(t){return t.map(([e,r])=>t_(r)?[e,r.catch(n=>{le.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function Vbt(t){if(typeof t=="string"||t===void 0)return t;le.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function Hbt(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",s=n===void 0||n==="";if(i)return n;if(s||r===n)return r;le.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}Ne();var hT=class{emit(e){}enabled(){return!1}},gAe=new hT;var mT=Symbol.for("io.opentelemetry.js.api.logs"),r_=globalThis;function _Ae(t,e,r){return n=>n===t?e:r}var WW=1;var YW=class{getLogger(e,r,n){return new hT}},uN=new YW;var dN=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):gAe}};var gT=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new dN(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:uN}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};var fN=class t{constructor(){this._proxyLoggerProvider=new gT}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return r_[mT]?this.getLoggerProvider():(r_[mT]=_Ae(WW,e,uN),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=r_[mT])===null||e===void 0?void 0:e.call(r_,WW))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete r_[mT],this._proxyLoggerProvider=new gT}};var yAe=fN.getInstance();function SAe(t,e,r,n){for(let i=0,s=t.length;i<s;i++){let o=t[i];e&&o.setTracerProvider(e),r&&o.setMeterProvider(r),n&&o.setLoggerProvider&&o.setLoggerProvider(n),o.getConfig().enabled||o.enable()}}function EAe(t){t.forEach(e=>e.disable())}function KW(t){let e=t.tracerProvider||Rt.getTracerProvider(),r=t.meterProvider||pT.getMeterProvider(),n=t.loggerProvider||yAe.getLoggerProvider(),i=t.instrumentations?.flat()??[];return SAe(i,e,r,n),()=>{EAe(i)}}Ne();var Gbt=qr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function vAe(t){return t.getValue(Gbt)===!0}var n_;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(n_||(n_={}));Ne();var JW="[_0-9a-z-*/]",Wbt=`[a-z]${JW}{0,255}`,Ybt=`[a-z0-9]${JW}{0,240}@[a-z]${JW}{0,13}`,Kbt=new RegExp(`^(?:${Wbt}|${Ybt})$`),Jbt=/^[ -~]{0,255}[!-~]$/,Zbt=/,|=/;function ZW(t){return Kbt.test(t)}function XW(t){return Jbt.test(t)&&!Zbt.test(t)}var Xbt=32,bAe=512,TAe=",",wAe="=",pN=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!ZW(e)||!XW(r))return this;let n=this._getState(),i=n.get(e),s=this._length;if(typeof i=="string"?s+=r.length-i.length:s+=e.length+r.length+(n.size>0?2:1),s>bAe)return this;let o=new Map(n);return o.delete(e),o.set(e,r),this._fromState(o,s)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let s=new Map(r);return s.delete(e),this._fromState(s,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=TAe+e),e=`${n[0]}${wAe}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(TAe),r=new Map,n=0;for(let i of e){let s=i.trim(),o=s.indexOf(wAe);if(o===-1)continue;let a=s.slice(0,o),c=s.slice(o+1);if(!ZW(a)||!XW(c))continue;let l=n+s.length+(r.size>0?1:0);if(!(l>bAe)&&(r.set(a,c),n=l,r.size>=Xbt))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}};var hN="traceparent",mN="tracestate",Qbt="00",eTt="(?!ff)[\\da-f]{2}",tTt="(?![0]{32})[\\da-f]{32}",rTt="(?![0]{16})[\\da-f]{16}",nTt="[\\da-f]{2}",iTt=new RegExp(`^\\s?(${eTt})-(${tTt})-(${rTt})-(${nTt})(-.*)?\\s?$`);function AAe(t){let e=iTt.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var Ou=class{inject(e,r,n){let i=Rt.getSpanContext(e);if(!i||vAe(e)||!yi(i))return;let s=`${Qbt}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||ur.NONE).toString(16)}`;n.set(r,hN,s),i.traceState&&n.set(r,mN,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,hN);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=AAe(s);if(!o)return e;o.isRemote=!0;let a=n.get(r,mN);if(a){let c=Array.isArray(a)?a.join(","):a;o.traceState=new pN(typeof c=="string"?c:void 0)}return Rt.setSpanContext(e,o)}fields(){return[hN,mN]}};var gN=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};var _T=class{_isCalled=!1;_deferred=new gN;_callback;_that;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};var ak=Mn(MY(),1);Ne();var aIe=t=>{throw TypeError(t)},qY=(t,e,r)=>e.has(t)||aIe("Cannot "+r),ok=(t,e,r)=>(qY(t,e,"read from private field"),r?r.call(t):e.get(t)),UY=(t,e,r)=>e.has(t)?aIe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),iIe=(t,e,r,n)=>(qY(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Swt=(t,e,r)=>(qY(t,e,"access private method"),r),sIe="__netlify__getTracer",vwt="__netlify__shutdownTracers",bwt="__nfOTLPTrace",NT,kT,jY,cIe,Twt=class{constructor(){UY(this,jY),UY(this,NT),UY(this,kT),iIe(this,NT,new _T(Swt(this,jY,cIe),this)),iIe(this,kT,le.createComponentLogger({namespace:"netlify-span-exporter"}))}export(t,e){if(ok(this,kT).debug(`export ${t.length.toString()} spans`),ok(this,NT).isCalled){e({code:n_.FAILED,error:new Error("Exporter has been shutdown")});return}console.log(bwt,JSON.stringify(wwt(t))),e({code:n_.SUCCESS})}shutdown(){return ok(this,NT).call()}};NT=new WeakMap;kT=new WeakMap;jY=new WeakSet;cIe=function(){return ok(this,kT).debug("Shutting down"),Promise.resolve()};function wwt(t){return{resourceSpans:t.map(e=>{let r=e.spanContext();return{resource:{attributes:sk(e.resource.attributes),droppedAttributesCount:e.droppedAttributesCount},scopeSpans:[{scope:{name:e.instrumentationScope.name,version:e.instrumentationScope.version},spans:[{traceId:r.traceId,spanId:r.spanId,parentSpanId:e.parentSpanContext?.spanId,name:e.name,kind:e.kind||oo.SERVER,startTimeUnixNano:FY(e.startTime),endTimeUnixNano:FY(e.endTime),attributes:sk(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:FY(n.time),attributes:sk(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedEventsCount:e.droppedEventsCount,status:{code:e.status.code,message:e.status.message},links:e.links.map(n=>({spanId:n.context.spanId,traceId:n.context.traceId,attributes:sk(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedLinksCount:e.droppedLinksCount}]}]}})}}function sk(t){return Object.keys(t).map(e=>lIe(e,t[e]))}function lIe(t,e){return{key:t,value:uIe(e)}}function uIe(t){let e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(uIe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>lIe(r,n))}}:{}}function FY(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var oIe={name:"@netlify/otel",version:"6.0.5",type:"module",engines:{node:"^18.14.0 || >=20.6.1"},main:"./dist/main.cjs",module:"./dist/main.js",types:"./dist/main.d.ts",exports:{".":{require:{types:"./dist/main.d.cts",default:"./dist/main.cjs"},import:{types:"./dist/main.d.ts",default:"./dist/main.js"},default:{types:"./dist/main.d.ts",default:"./dist/main.js"}},"./package.json":"./package.json","./bootstrap":{require:{types:"./dist/bootstrap/main.d.cts",default:"./dist/bootstrap/main.cjs"},import:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"},default:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"}},"./exporter-netlify":{require:{types:"./dist/exporters/netlify.d.cts",default:"./dist/exporters/netlify.cjs"},import:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"},default:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"}},"./instrumentation-fetch":{require:{types:"./dist/instrumentations/fetch.d.cts",default:"./dist/instrumentations/fetch.cjs"},import:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"},default:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"}},"./instrumentation-http":{require:{types:"./dist/instrumentations/http.d.cts",default:"./dist/instrumentations/http.cjs"},import:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"},default:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"}},"./opentelemetry":{require:{types:"./dist/opentelemetry.d.cts",default:"./dist/opentelemetry.cjs"},import:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"},default:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"}}},files:["dist/**/*"],scripts:{build:"tsup-node",dev:"tsup-node --watch",prepack:"npm run build",test:"run-s build test:ci","test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"vitest","test:dev:vitest:watch":"vitest watch","test:ci:vitest":"vitest run",publint:"npx -y publint --strict"},keywords:["netlify","cdn"],license:"MIT",repository:{type:"git",url:"https://github.com/netlify/primitives.git",directory:"packages/otel"},bugs:{url:"https://github.com/netlify/primitives/issues"},author:"Netlify Inc.",devDependencies:{"@netlify/dev-utils":"^4.4.7",msw:"^2.10.5","npm-run-all2":"^7.0.2",tsup:"^8.0.0",vitest:"^3.0.0"},dependencies:{"@opentelemetry/api":"1.9.1","@opentelemetry/core":"2.8.0","@opentelemetry/instrumentation":"^0.220.0","@opentelemetry/resources":"2.9.0","@opentelemetry/sdk-trace-node":"2.9.0"}},dIe=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,sIe))return;let e=Ewt.version.slice(1),r=GW({"service.name":t.serviceName,"service.version":t.serviceVersion,"process.runtime.name":"nodejs","process.runtime.version":e,"deployment.environment":t.deploymentEnvironment,"http.url":t.siteUrl,"netlify.site.id":t.siteId,"netlify.site.name":t.siteName}),n=t.spanProcessors??[Awt()],i=new ak.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new Ou});let s=t.instrumentations??[];KW({instrumentations:s,tracerProvider:i}),Object.defineProperty(globalThis,sIe,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new Cc(Rt.getTracer(a,c)):new Cc(Rt.getTracer(oIe.name,oIe.version))}}),Object.defineProperty(globalThis,vwt,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},Awt=()=>new ak.SimpleSpanProcessor(new Twt);Ne();var $T=Mn(MY(),1);Ne();import*as ck from"diagnostics_channel";var fIe=class{constructor(t={}){this.instrumentationName="@netlify/otel/instrumentation-fetch",this.instrumentationVersion="1.0.0",this._recordFromReq=new WeakMap,this.config=t,this._channelSubs=[]}getConfig(){return this.config}setConfig(){}setMeterProvider(){}setTracerProvider(t){this.provider=t}getTracerProvider(){return this.provider}annotateFromRequest(t,e){let r=this.config.getRequestAttributes?.(e)??{},n=new URL(e.path,e.origin);t.setAttributes({...r,"http.request.method":e.method,"url.full":n.href,"url.host":n.host,"url.scheme":n.protocol.slice(0,-1),"server.address":n.hostname,"server.port":n.port,...this.prepareHeaders("request",e.headers)})}annotateFromResponse(t,e){let r=this.config.getResponseAttributes?.(e)??{};t.setAttributes({...r,"http.response.status_code":e.statusCode,...this.prepareHeaders("response",e.headers)}),t.setStatus({code:e.statusCode>=400?In.ERROR:In.UNSET})}prepareHeaders(t,e){if(!Array.isArray(e))return{};if(this.config.skipHeaders===!0)return{};let r=["*","/.*/"],n=this.config.skipHeaders??[],i=this.config.redactHeaders??[],s=n.some(a=>r.includes(a.toString())),o={};if(s)return o;for(let a=0;a+1<e.length;a=a+2){let c=e[a],l=e[a+1];if(typeof c!="string"&&!Buffer.isBuffer(c)||typeof l!="string"&&!Buffer.isBuffer(l))continue;let u=c.toString().toLowerCase();if(n.some(f=>typeof f=="string"?f==u:f.test(u)))continue;let d=`http.${t}.header.${u}`;i===!0||i.some(f=>typeof f=="string"?f==u:f.test(u))?o[d]="REDACTED":o[d]=l.toString()}return o}getRequestMethod(t){return["HEAD","GET","POST","PUT","PATCH","DELETE"].includes(t.toUpperCase())?t.toUpperCase():"_OTHER"}getTracer(){if(!this.provider)return;let t=this.provider.getTracer(this.instrumentationName,this.instrumentationVersion);return t instanceof Cc?t:new Cc(t)}enable(){this._channelSubs.length>0||(this.subscribe("undici:request:create",this.onRequestCreate.bind(this)),this.subscribe("undici:request:headers",this.onRequestHeaders.bind(this)),this.subscribe("undici:request:trailers",this.onRequestEnd.bind(this)),this.subscribe("undici:request:error",this.onRequestError.bind(this)))}subscribe(t,e){ck.subscribe(t,e);let r=()=>ck.unsubscribe(t,e);this._channelSubs.push({name:t,unsubscribe:r})}disable(){this._channelSubs.forEach(t=>{t.unsubscribe()}),this._channelSubs.length=0}onRequestCreate({request:t}){try{let e=this.getTracer(),r=new URL(t.path,t.origin);if(!e||t.method==="CONNECT"||this.config.skipURLs?.some(i=>typeof i=="string"?r.href.startsWith(i):i.test(r.href)))return;let n=e.startSpan(this.getRequestMethod(t.method),{kind:oo.CLIENT},Ft.active());this.annotateFromRequest(n,t),this._recordFromReq.set(t,n)}catch{}}onRequestHeaders({request:t,response:e}){try{let r=this._recordFromReq.get(t);if(!r)return;this.annotateFromResponse(r,e)}catch{}}onRequestError({request:t,error:e}){try{let r=this._recordFromReq.get(t);if(!r)return;r.recordException(e),r.setStatus({code:In.ERROR,message:e.message}),r.end(),this._recordFromReq.delete(t)}catch{}}onRequestEnd({request:t}){try{let e=this._recordFromReq.get(t);if(!e)return;e.end(),this._recordFromReq.delete(t)}catch{}}};var DDe=Mn($De(),1);var cD=Se("tracing"),LDe=8e3,jLt=5e3,Xw=async(t=jLt)=>{try{await Promise.race([d0e(),FLt(t)])}catch(e){cD.warn("Failed to flush tracers on shutdown",e)}},MDe=async(t,e,r)=>{if(!gt()){let n=[new $T.SimpleSpanProcessor(new BJ),new $T.SimpleSpanProcessor(new DDe.OTLPTraceExporter({url:r.exporterUrl}))];await dIe({serviceName:"@netlify/agent-runner-cli",serviceVersion:t,deploymentEnvironment:"production",siteUrl:"",siteId:process.env.SITE_ID??"",siteName:e,spanProcessors:n,instrumentations:[new fIe({skipHeaders:!0})]})}return r.traceparent?(Yn.setGlobalPropagator(new Ou),Yn.extract(Ft.active(),{traceparent:r.traceparent,isRemote:!0})):Ft.active()};function Vt(t,e,r){return cD.log(`\u23F3 TRACE: ${e} starting...`),Gf(t,e,r)}var BJ=class{export(e,r){for(let n of e)this.logSpan(n);r({code:1})}async shutdown(){}forceFlush(){return Promise.resolve()}logSpan(e){let r=(e.endTime[0]-e.startTime[0])*1e3+(e.endTime[1]-e.startTime[1])/1e6,n=e.attributes,i=[];for(let[a,c]of Object.entries(n))a.includes("duration")&&typeof c=="number"?i.push(`${a}=${c.toFixed(2)}ms`):i.push(`${a}=${c}`);let s=e.status?.code===2?"\u274C":"\u2705",o=i.length>0?` [${i.join(", ")}]`:"";cD.log(`${s} TRACE: ${e.name} completed in ${r.toFixed(2)}ms${o}`),e.status?.code===2&&e.status.message&&cD.log(` \u274C Error: ${e.status.message}`)}};function zJ(){return rt().captureLlmContentEnabled}function UDe(t){return t.includes("claude")?"anthropic":t.includes("codex")?"openai":t.includes("gemini")?"google":t.includes("opencode")?"opencode":t}function lD(t,e,r){let n={role:t,parts:[{type:"text",content:Ts(e)}]};return r&&(n.finish_reason=r),JSON.stringify([n])}var qLt=new Set([ee.Task,ee.RunCommand,ee.Explore,ee.FileRead,ee.FileWrite,ee.Notebook,ee.Web,ee.Todo,ee.Skill,ee.Tool,ee.Memorize,ee.Deployment,ee.SiteGeneration]);function FDe(t,e,r,n){if(!t.length)return;let i=gt();if(!i)return;let s=zJ(),o=Math.max(1,(n-r)/t.length);t.forEach((a,c)=>{let l=Math.min(n,r+c*o),u=Math.min(n,l+o),d=a.type==="tool_use"||a.type==="tool_result"||a.category!=null&&qLt.has(a.category),f=d?"execute_tool":"chat",p=a.title||a.type||`step-${a.id??c}`,h=a.category||"unknown",m=d?`${f} ${h}`:f,_=a.message?a.message.length>LDe?`${a.message.slice(0,LDe)}\u2026`:a.message:void 0;i.startSpan(m,{startTime:l,attributes:{"gen_ai.capability.name":e,"gen_ai.step.name":p,"gen_ai.operation.name":f,...d?{"gen_ai.tool.name":h}:{},"spark.step.id":a.id??-1,...a.type?{"spark.step.type":a.type}:{},...a.category?{"spark.step.category":a.category}:{},...a.groupId?{"spark.step.group_id":a.groupId}:{},...a.parentGroupId?{"spark.step.parent_group_id":a.parentGroupId}:{},...s&&_?d?{"gen_ai.tool.call.result":Ts(_)}:{"gen_ai.output.messages":lD("assistant",_)}:{}}}).end(u)})}import{readdir as BLt,rm as zLt}from"fs/promises";import{join as VLt}from"path";async function jDe(t,e=[]){let n=(await BLt(t)).filter(i=>!e.includes(i));await Promise.all(n.map(i=>zLt(VLt(t,i),{recursive:!0,force:!0})))}var HLt=700,qDe=t=>t.mode==="create"&&(t.accountType===wl||t.enforcedAICreditsRemaining!=null&&t.enforcedAICreditsRemaining<=HLt);var YLt=dD.dirname(GLt(import.meta.url)),BDe=WLt(import.meta.url),KLt=dD.resolve(YLt,"scripts/scaffold.js"),JLt="scripts/scaffold.js",ZLt=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+/g,VJ=t=>{if(t.length>=2){let e=t[0],r=t[t.length-1];if(e==='"'&&r==='"'||e==="'"&&r==="'")return t.slice(1,-1)}return t},XLt=t=>/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(t),QLt=t=>{let e=VJ(t);return e==="node"||e.endsWith("/node")},tl=t=>{if(typeof t!="string")return!1;let e=t.match(ZLt)||[];if(e.length<2)return!1;let r=0;for(;r<e.length&&XLt(VJ(e[r]));)r+=1;if(r>=e.length||!QLt(e[r]))return!1;let n=e[r+1];return n?VJ(n).includes(JLt):!1},hy=Se("create_stage"),zDe="Do not run local validation or dev-server commands to check your work \u2014 specifically `tsc`, `npx tsc`, `vite build`, `vite dev`, or any equivalent build/start/test command. The build pipeline installs and validates the project automatically after your edits. Verify your changes by reading the files you edited.",eDt=`${zDe}
590
+ if (condition) { yield value; }`)};import{Buffer as TSt}from"buffer";import{StringDecoder as wSt}from"string_decoder";var AC=(t,e,r)=>{if(r)return;if(t)return{transform:ASt.bind(void 0,new TextEncoder)};let n=new wSt(e);return{transform:RSt.bind(void 0,n),final:xSt.bind(void 0,n)}},ASt=function*(t,e){TSt.isBuffer(e)?yield bc(e):typeof e=="string"?yield t.encode(e):yield e},RSt=function*(t,e){yield Cr(e)?t.write(e):e},xSt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as ATe}from"util";var x3=ATe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),RC=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=OSt}=e[r];for await(let i of n(t))yield*RC(i,e,r+1)},RTe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*ISt(r,Number(e),t)},ISt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*RC(n,r,e+1)},xTe=ATe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),OSt=function*(t){yield t};var I3=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},ITe=(t,e)=>[...e.flatMap(r=>[...zf(r,t,0)]),...Kb(t)],zf=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=CSt}=e[r];for(let i of n(t))yield*zf(i,e,r+1)},Kb=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*PSt(r,Number(e),t)},PSt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*zf(n,r,e+1)},CSt=function*(t){yield t};var O3=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=PTe(t,o,s),l=Bf(e),u=Bf(r),d=l?x3.bind(void 0,RC,a):I3.bind(void 0,zf),f=l||u?x3.bind(void 0,RTe,a):I3.bind(void 0,Kb),p=l||u?xTe.bind(void 0,a):void 0;return{stream:new NSt({writableObjectMode:n,writableHighWaterMark:OTe(n),readableObjectMode:i,readableHighWaterMark:OTe(i),transform(m,_,y){d([m,c,0],this,y)},flush(m){f([c],this,m)},destroy:p})}},xC=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=PTe(o,r,a);t=ITe(c,t)}return t},PTe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:bTe(n,a)},AC(r,o,n),wC(r,s,n,c),{transform:t,final:e},{transform:TTe(i,a)},vTe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var CTe=(t,e)=>{for(let r of kSt(t))$St(t,r,e)},kSt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),$St=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Au[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>LSt(a,n));r.input=Fb(o)},LSt=(t,e)=>{let r=xC(t,e,"utf8",!0);return DSt(r),Fb(r)},DSt=t=>{let e=t.find(r=>typeof r!="string"&&!Cr(r));if(e!==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: ${e}.`)};import{writeFileSync as jSt,appendFileSync as qSt}from"fs";var IC=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&$g(r,n)&&!Ui.has(e)&&MSt(n)&&(t.some(({type:i,value:s})=>i==="native"&&USt.has(s))||t.every(({type:i})=>bs.has(i))),MSt=t=>t===1||t===2,USt=new Set(["pipe","overlapped"]),NTe=async(t,e,r,n)=>{for await(let i of t)FSt(e)||$Te(i,r,n)},kTe=(t,e,r)=>{for(let n of t)$Te(n,e,r)},FSt=t=>t._readableState.pipes.length>0,$Te=(t,e,r)=>{let n=BP(t);na({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var LTe=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>BSt({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},BSt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Dbe(t,s,d),p=bc(f),{stdioItems:h,objectMode:m}=e[r],_=zSt([p],h,c,n),{serializedResult:y,finalResult:v=y}=VSt({chunks:_,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});HSt({serializedResult:y,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let S=a[r]?v:void 0;try{return n.error===void 0&&GSt(y,h,i),S}catch(g){return n.error=g,S}},zSt=(t,e,r,n)=>{try{return xC(t,e,r,!1)}catch(i){return n.error=i,t}},VSt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Fb(t)};let o=JSe(t,r);return n[s]?{serializedResult:o,finalResult:R3(o,!i[s],e)}:{serializedResult:o}},HSt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!IC({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=R3(t,!1,o);try{kTe(a,e,n)}catch(c){r.error??=c}},GSt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>bC.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?qSt(n,t):(r.add(s),jSt(n,t))}};var DTe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Ac(e,r,"all")]:Array.isArray(e)?[Ac(t,r,"all"),...e]:Cr(t)&&Cr(e)?L6([t,e]):`${t}${e}`};import{once as P3}from"events";var MTe=async(t,e)=>{let[r,n]=await WSt(t);return e.isForcefullyTerminated??=!1,[r,n]},WSt=async t=>{let[e,r]=await Promise.allSettled([P3(t,"spawn"),P3(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?UTe(t):r.value},UTe=async t=>{try{return await P3(t,"exit")}catch{return UTe(t)}},FTe=async t=>{let[e,r]=await t;if(!YSt(e,r)&&C3(e,r))throw new no;return[e,r]},YSt=(t,e)=>t===void 0&&e===void 0,C3=(t,e)=>t!==0||e!==null;var jTe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=KSt(t,e,r),o=s?.code==="ETIMEDOUT",a=Lbe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},KSt=(t,e,r)=>t!==void 0?t:C3(e,r)?new no:void 0;var qTe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=ZSt(t,e,r),d=eEt({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return Vg(d,c,l)},ZSt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=VP(t,e,r),a=XSt(r),{file:c,commandArguments:l,options:u}=uC(t,e,a);QSt(u);let d=_Te(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},XSt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,QSt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&OC("ipcInput"),t&&OC("ipc: true"),r&&OC("detached: true"),n&&OC("cancelSignal")},OC=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},eEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=tEt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=jTe(c,r),{output:h,error:m=l}=LTe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((v,S)=>Ac(v,r,S)),y=Ac(DTe(h,r),r,"all");return nEt({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},tEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{CTe(s,r);let a=rEt(r);return JSt(...dC(t,e,a))}catch(a){return zg({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},rEt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:yC(e)}),nEt=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?SC({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):Yb({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as Vvt}from"events";import{spawn as Hvt}from"child_process";import GTe from"process";import{once as N3,on as iEt}from"events";var BTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(Mg({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:iC(t)}),sEt({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),sEt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{eC(e,i);let s=wu(t,e,r),o=new AbortController;try{return await Promise.race([oEt(s,n,o),aEt(s,r,o),cEt(s,r,o)])}catch(a){throw Ug(t),a}finally{o.abort(),tC(e,i)}},oEt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await N3(t,"message",{signal:r});return n}for await(let[n]of iEt(t,"message",{signal:r}))if(e(n))return n},aEt=async(t,e,{signal:r})=>{await N3(t,"disconnect",{signal:r}),Ive(e)},cEt=async(t,e,{signal:r})=>{let[n]=await N3(t,"strict:error",{signal:r});throw ZP(n,e)};import{once as VTe,on as lEt}from"events";var HTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>k3({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),k3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{Mg({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:iC(t)}),eC(e,s);let o=wu(t,e,r),a=new AbortController,c={};return uEt(t,o,a),dEt({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),fEt({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},uEt=async(t,e,r)=>{try{await VTe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},dEt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await VTe(t,"strict:error",{signal:r.signal});n.error=ZP(i,e),r.abort()}catch{}},fEt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of lEt(r,"message",{signal:s.signal}))zTe(o),yield c}catch{zTe(o)}finally{s.abort(),tC(e,a),n||Ug(t),i&&await t}},zTe=({error:t})=>{if(t)throw t};var WTe=(t,{ipc:e})=>{Object.assign(t,KTe(t,!1,e))},YTe=()=>{let t=GTe,e=!0,r=GTe.channel!==void 0;return{...KTe(t,e,r),getCancelSignal:tbe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},KTe=(t,e,r)=>({sendMessage:cC.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:BTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:HTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as pEt}from"child_process";import{PassThrough as hEt,Readable as mEt,Writable as gEt,Duplex as _Et}from"stream";var JTe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{T3(n);let a=new pEt;yEt(a,n),Object.assign(a,{readable:SEt,writable:EEt,duplex:vEt});let c=zg({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=bEt(c,o,i);return{subprocess:a,promise:l}},yEt=(t,e)=>{let r=Jb(),n=Jb(),i=Jb(),s=Array.from({length:e.length-3},Jb),o=Jb(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},Jb=()=>{let t=new hEt;return t.end(),t},SEt=()=>new mEt({read(){}}),EEt=()=>new gEt({write(){}}),vEt=()=>new _Et({read(){},write(){}}),bEt=async(t,e,r)=>Vg(t,e,r);import{createReadStream as ZTe,createWriteStream as XTe}from"fs";import{Buffer as TEt}from"buffer";import{Readable as Zb,Writable as wEt,Duplex as AEt}from"stream";var ewe=(t,e)=>TC(REt,t,e,!1),Xb=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Au[t]}.`)},QTe={fileNumber:Xb,generator:O3,asyncGenerator:O3,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:AEt.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},REt={input:{...QTe,fileUrl:({value:t})=>({stream:ZTe(t)}),filePath:({value:{file:t}})=>({stream:ZTe(t)}),webStream:({value:t})=>({stream:Zb.fromWeb(t)}),iterable:({value:t})=>({stream:Zb.from(t)}),asyncIterable:({value:t})=>({stream:Zb.from(t)}),string:({value:t})=>({stream:Zb.from(t)}),uint8Array:({value:t})=>({stream:Zb.from(TEt.from(t))})},output:{...QTe,fileUrl:({value:t})=>({stream:XTe(t)}),filePath:({value:{file:t,append:e}})=>({stream:XTe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:wEt.fromWeb(t)}),iterable:Xb,asyncIterable:Xb,string:Xb,uint8Array:Xb}};import{on as xEt,once as twe}from"events";import{PassThrough as IEt,getDefaultHighWaterMark as OEt}from"stream";import{finished as iwe}from"stream/promises";function Vf(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)L3(i);let e=t.some(({readableObjectMode:i})=>i),r=PEt(t,e),n=new $3({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var PEt=(t,e)=>{if(t.length===0)return OEt(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},$3=class extends IEt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(L3(e),this.#e.has(e))return;this.#e.add(e),this.#n??=CEt(this,this.#e,this.#s);let r=$Et({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(L3(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},CEt=async(t,e,r)=>{PC(t,rwe);let n=new AbortController;try{await Promise.race([NEt(t,n),kEt(t,e,r,n)])}finally{n.abort(),PC(t,-rwe)}},NEt=async(t,{signal:e})=>{try{await iwe(t,{signal:e,cleanup:!0})}catch(r){throw swe(t,r),r}},kEt=async(t,e,r,{signal:n})=>{for await(let[i]of xEt(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},L3=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},$Et=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{PC(t,nwe);let a=new AbortController;try{await Promise.race([LEt(s,e,a),DEt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),MEt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),PC(t,-nwe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?D3(t):UEt(t))},LEt=async(t,e,{signal:r})=>{try{await t,r.aborted||D3(e)}catch(n){r.aborted||swe(e,n)}},DEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await iwe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;owe(o)?i.add(e):awe(t,o)}},MEt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await twe(t,i,{signal:s}),!t.readable)return twe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},UEt=t=>{t.writable&&t.end()},swe=(t,e)=>{owe(e)?D3(t):awe(t,e)},owe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",D3=t=>{(t.readable||t.writable)&&t.destroy()},awe=(t,e)=>{t.destroyed||(t.once("error",FEt),t.destroy(e))},FEt=()=>{},PC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},rwe=2,nwe=1;import{finished as cwe}from"stream/promises";var Gg=(t,e)=>{t.pipe(e),jEt(t,e),qEt(t,e)},jEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await cwe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}M3(e)}},M3=t=>{t.writable&&t.end()},qEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await cwe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}U3(t)}},U3=t=>{t.readable&&t.destroy()};var lwe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>bs.has(c)))BEt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!bs.has(c)))VEt({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Vf(s);Gg(o,i)}},BEt=(t,e,r,n)=>{r==="output"?Gg(t.stdio[n],e):Gg(e,t.stdio[n]);let i=zEt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},zEt=["stdin","stdout","stderr"],VEt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;HEt(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},HEt=(t,{signal:e})=>{ro(t)&&jf(t,GEt,e)},GEt=2;import{addAbortListener as KEt}from"events";var Hf=[];Hf.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Hf.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Hf.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var CC=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",F3=Symbol.for("signal-exit emitter"),j3=globalThis,WEt=Object.defineProperty.bind(Object),q3=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(j3[F3])return j3[F3];WEt(j3,F3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},NC=class{},YEt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),B3=class extends NC{onExit(){return()=>{}}load(){}unload(){}},z3=class extends NC{#e=V3.platform==="win32"?"SIGINT":"SIGHUP";#r=new q3;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Hf)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!CC(this.#t))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of Hf)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Hf.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#s,this.#r.count-=1)}#a(e){return CC(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&CC(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},V3=globalThis.process,{onExit:uwe,load:Jlr,unload:Zlr}=YEt(CC(V3)?new z3(V3):new B3);var dwe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=uwe(()=>{t.kill()});KEt(n,()=>{i()})};var pwe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=zP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=JEt(r,n,i),{sourceStream:d,sourceError:f}=XEt(t,l),{options:p,fileDescriptors:h}=sa.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},JEt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=ZEt(t,e,...r),a=QP(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},ZEt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(fwe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||k6(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,s,o]=kP(r,...n);return{destination:e(fwe)(i,s,o),pipeOptions:o}}if(sa.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},fwe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),XEt=(t,e)=>{try{return{sourceStream:Fg(t,e)}}catch(r){return{sourceError:r}}};var mwe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=QEt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw H3({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},QEt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return U3(t),n;if(e!==void 0)return M3(r),e},H3=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>zg({error:t,command:hwe,escapedCommand:hwe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),hwe="source.pipe(destination)";var gwe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o};import{finished as evt}from"stream/promises";var _we=(t,e,r)=>{let n=kC.has(e)?rvt(t,e):tvt(t,e);return jf(t,ivt,r.signal),jf(e,svt,r.signal),nvt(e),n},tvt=(t,e)=>{let r=Vf([t]);return Gg(r,e),kC.set(e,r),r},rvt=(t,e)=>{let r=kC.get(e);return r.add(t),r},nvt=async t=>{try{await evt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}kC.delete(t)},kC=new WeakMap,ivt=2,svt=1;import{aborted as ovt}from"util";var ywe=(t,e)=>t===void 0?[]:[avt(t,e)],avt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await ovt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw H3({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var $C=(t,...e)=>{if(gr(e[0]))return $C.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=pwe(t,...e),i=cvt({...n,destination:r});return i.pipe=$C.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},cvt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=lvt(t,i);mwe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=_we(e,s,d);return await Promise.race([gwe(u),...ywe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},lvt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as gvt}from"timers/promises";import{on as uvt}from"events";import{getDefaultHighWaterMark as dvt}from"stream";var LC=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return fvt(e,o),Ewe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},fvt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},G3=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;pvt(e,o,t);let a=t.readableObjectMode&&!s;return Ewe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},pvt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Ewe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=uvt(t,"data",{signal:e.signal,highWaterMark:Swe,highWatermark:Swe});return hvt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},W3=dvt(!0),Swe=W3,hvt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=mvt({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*zf(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Kb(a)}},mvt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[AC(t,r,!e),wC(t,i,!n,{})].filter(Boolean);var vwe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=_vt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([yvt(t),d]);return}let f=w3(c,r),p=G3({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([Svt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},_vt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!IC({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=G3({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await NTe(a,t,r,s)},yvt=async t=>{await gvt(),t.readableFlowing===null&&t.resume()},Svt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await mC(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await gC(r,{maxBuffer:s})):await Bg(r,{maxBuffer:s})}catch(a){return bwe(Nbe({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},Y3=async t=>{try{return await t}catch(e){return bwe(e)}},bwe=({bufferedData:t})=>YSe(t)?new Uint8Array(t):t;import{finished as Evt}from"stream/promises";var Qb=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=vvt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Evt(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||wvt(a,e,r,n)}finally{o.abort()}},vvt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&bvt(t,r,n),n},bvt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Tvt(e,r),n.call(t,...i)}},Tvt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},wvt=(t,e,r,n)=>{if(!Avt(t,e,r,n))throw t},Avt=(t,e,r,n=!0)=>r.propagating?Twe(t)||DC(t):(r.propagating=!0,K3(r,e)===n?Twe(t):DC(t)),K3=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",DC=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Twe=t=>t?.code==="EPIPE";var wwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>J3({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),J3=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=Qb(t,e,l);if(K3(l,e)){await u;return}let[d]=await Promise.all([vwe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var Awe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Vf([t,e].filter(Boolean)):void 0,Rwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>J3({...Rvt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:xvt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Rvt=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},xvt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as Ivt}from"events";var xwe=t=>$g(t,"ipc"),Iwe=(t,e)=>{let r=BP(t);na({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Owe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=xwe(s),a=Tc(e,"ipc"),c=Tc(r,"ipc");for await(let l of k3({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(kbe(t,i,c),i.push(l)),o&&Iwe(l,s);return i},Pwe=async(t,e)=>(await Promise.allSettled([t]),e);var Cwe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:_,controller:y})=>{let v=MTe(t,f),S={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},g=wwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),T=Rwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),I=[],x=Owe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),A=Ovt(m,t,S),O=Pvt(h,S);try{return await Promise.race([Promise.all([{},FTe(v),Promise.all(g),T,x,dbe(t,d),...A,...O]),_,Cvt(t,y),...obe(t,s,f,y),...xve({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:y}),...ibe({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(R){return f.terminationReason??="other",Promise.all([{error:R},v,Promise.all(g.map(b=>Y3(b))),Y3(T),Pwe(x,I),Promise.allSettled(A),Promise.allSettled(O)])}},Ovt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Qb(n,i,r)),Pvt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>so(s,{checkOpen:!1})&&!ro(s)).map(({type:i,value:s,stream:o=s})=>Qb(o,n,e,{isSameDirection:bs.has(i),stopOnExit:i==="native"}))),Cvt=async(t,{signal:e})=>{let[r]=await Ivt(t,"error",{signal:e});throw r};var Nwe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),eT=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=ia();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Wg=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as Nvt}from"stream";import{callbackify as kvt}from"util";import{finished as kwe}from"stream/promises";var Z3=async t=>{if(t!==void 0)try{await X3(t)}catch{}},$we=async t=>{if(t!==void 0)try{await Q3(t)}catch{}},X3=async t=>{await kwe(t,{cleanup:!0,readable:!1,writable:!0})},Q3=async t=>{await kwe(t,{cleanup:!0,readable:!0,writable:!1})},MC=async(t,e)=>{if(await t,e)throw e},UC=(t,e,r)=>{r&&!DC(r)?t.destroy(r):e&&t.destroy()};var Lwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||Ui.has(r),{subprocessStdout:a,waitReadableDestroy:c}=eW(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=tW(a,o),{read:f,onStdoutDataDone:p}=rW({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new Nvt({read:f,destroy:kvt(iW.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return nW({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},eW=(t,e,r)=>{let n=Fg(t,e),i=eT(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},tW=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:W3},rW=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=ia(),o=LC({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){$vt(this,o,s)},onStdoutDataDone:s}},$vt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},nW=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await Q3(t),await n,await Z3(i),await e,r.readable&&r.push(null)}catch(s){await Z3(i),Dwe(r,s)}},iW=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Wg(r,e)&&(Dwe(t,n),await MC(e,n))},Dwe=(t,e)=>{UC(t,t.readable,e)};import{Writable as Lvt}from"stream";import{callbackify as Mwe}from"util";var Uwe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=sW(t,r,e),o=new Lvt({...oW(n,t,i),destroy:Mwe(cW.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return aW(n,o),o},sW=(t,e,r)=>{let n=QP(t,e),i=eT(r,n,"writableFinal"),s=eT(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},oW=(t,e,r)=>({write:Dvt.bind(void 0,t),final:Mwe(Mvt.bind(void 0,t,e,r))}),Dvt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Mvt=async(t,e,r)=>{await Wg(r,e)&&(t.writable&&t.end(),await e)},aW=async(t,e,r)=>{try{await X3(t),e.writable&&e.end()}catch(n){await $we(r),Fwe(e,n)}},cW=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Wg(r,e),await Wg(n,e)&&(Fwe(t,i),await MC(e,i))},Fwe=(t,e)=>{UC(t,t.writable,e)};import{Duplex as Uvt}from"stream";import{callbackify as Fvt}from"util";var jwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||Ui.has(r),{subprocessStdout:c,waitReadableDestroy:l}=eW(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=sW(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=tW(c,a),{read:_,onStdoutDataDone:y}=rW({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),v=new Uvt({read:_,...oW(u,t,d),destroy:Fvt(jvt.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return nW({subprocessStdout:c,onStdoutDataDone:y,readable:v,subprocess:t,subprocessStdin:u}),aW(u,v,c),v},jvt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([iW({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),cW({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var lW=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||Ui.has(e),o=Fg(t,r),a=LC({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return qvt(a,o,t)},qvt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var qwe=(t,{encoding:e})=>{let r=Nwe();t.readable=Lwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Uwe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=jwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lW.bind(void 0,t,e),t[Symbol.asyncIterator]=lW.bind(void 0,t,e,{})};var Bwe=(t,e)=>{for(let[r,n]of zvt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Bvt=(async()=>{})().constructor.prototype,zvt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Bvt,t)]);var zwe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Gvt(t,e,r),{subprocess:f,promise:p}=Yvt({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=$C.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Bwe(f,p),sa.set(f,{options:u,fileDescriptors:d}),f},Gvt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=VP(t,e,r),{file:a,commandArguments:c,options:l}=uC(t,e,r),u=Wvt(l),d=ewe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},Wvt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Yvt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=Hvt(...dC(t,e,r))}catch(h){return JTe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Vvt(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];lwe(c,a,l),dwe(c,r,l);let d={},f=ia();c.kill=Ave.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=Awe(c,r),qwe(c,r),WTe(c,r);let p=Kvt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Kvt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,_]=await Cwe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let y=h.map((g,T)=>Ac(g,e,T)),v=Ac(m,e,"all"),S=Jvt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:v,ipcOutput:_,context:c,options:e,command:o,escapedCommand:a,startTime:r});return Vg(S,n,e)},Jvt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Yb({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof oa,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):SC({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u});var FC=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Zvt(n,t[n],i)]));return{...t,...r}},Zvt=(t,e,r)=>Xvt.has(t)&&gr(e)&&gr(r)?{...e,...r}:r,Xvt=new Set(["env",...F6]);var Ru=(t,e,r,n)=>{let i=(o,a,c)=>Ru(o,a,r,c),s=(...o)=>Qvt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},Qvt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(gr(s))return i(t,FC(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=ebt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?qTe(a,c,l):zwe(a,c,l,i)},ebt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=eEe(e)?tEe(e,r):[e,...r],[o,a,c]=kP(...s),l=FC(FC(n,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Vwe=({file:t,commandArguments:e})=>Gwe(t,e),Hwe=({file:t,commandArguments:e})=>({...Gwe(t,e),isSync:!0}),Gwe=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=tbt(t);return{file:r,commandArguments:n}},tbt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(rbt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},rbt=/ +/g;var Wwe=(t,e,r)=>{t.sync=e(nbt,r),t.s=t.sync},Ywe=({options:t})=>Kwe(t),nbt=({options:t})=>({...Kwe(t),isSync:!0}),Kwe=t=>({options:{...ibt(t),...t}}),ibt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},Jwe={preferLocal:!0};var Zwe=Ru(()=>({})),jfr=Ru(()=>({isSync:!0})),Xwe=Ru(Vwe),qfr=Ru(Hwe),Bfr=Ru(cbe),zfr=Ru(Ywe,{},Jwe,Wwe),{sendMessage:Vfr,getOneMessage:Hfr,getEachMessage:Gfr,getCancelSignal:Wfr}=YTe();import{Transform as sbt}from"stream";var obt=["NETLIFY_AI_GATEWAY_KEY"];function abt(){let t=(process.env.NETLIFY_SENSITIVE_ENV_KEYS||"").split(",").map(e=>e.trim()).filter(Boolean);return[...new Set([...t,...obt])]}function cbt(t){let e=t.toLowerCase();return e==="true"||e==="false"?!0:t.trim().length<4}function lbt(){let e=abt().map(r=>process.env[r]).filter(r=>!(!r||cbt(r)));return[...new Set(e)].sort((r,n)=>n.length-r.length)}function Ts(t){if(typeof t!="string")return t;let e=lbt();if(e.length===0)return t;let r=t;return e.forEach(n=>{let i=new RegExp(ubt(n),"g");r=r.replace(i,"******")}),r}function ubt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var tT=class extends sbt{constructor(e={}){super({...e,objectMode:!1})}_transform(e,r,n){let i=e.toString(),s=Ts(i);n(null,s)}},jC=Symbol("maskedWrite");function Qwe(){if(process.env.NETLIFY_MASK_LOGS!=="false"){if(!process.stdout.write[jC]){let e=process.stdout.write.bind(process.stdout),r=function(n,i,s){let o=typeof n=="string"?Ts(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[jC]=!0,process.stdout.write=r}if(!process.stderr.write[jC]){let e=process.stderr.write.bind(process.stderr),r=function(n,i,s){let o=typeof n=="string"?Ts(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[jC]=!0,process.stderr.write=r}}}var e0e=!1,t0e=()=>{e0e=!0},_i=()=>e0e;var rT=null,r0e=t=>(rT&&rT.destroy(),rT=new Rc({totalAllowedTime:t}),rT),n0e=()=>rT;var Rc=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&_i())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let s=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),o=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await CP({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ye.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),s(),o&&clearTimeout(o)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var i0e={name:"@netlify/agent-runner-cli",type:"module",version:"1.155.0-EX-2697.4",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.5","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var hbt=fbt(import.meta.url),mbt=xc.dirname(hbt),gbt=pbt(import.meta.url),Yg=Se("shell"),uW=new Set,s0e={preferLocal:!0},fn=(t,e,r)=>{let[n,i]=_bt(e,r),s={...s0e,...i},o=Zwe(t,n,s);a0e(o,s),u0e(o);let a=r?.idleTimeout;return a&&a>0&&l0e(o,a),o},o0e=(t,e)=>{let r={...s0e,...e},n=Xwe(t,r);return a0e(n,r),u0e(n),e?.idleTimeout&&e.idleTimeout>0&&l0e(n,e.idleTimeout),n},_bt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},a0e=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Ic.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new tT).pipe(Ic.stdout),t.stderr?.pipe(new tT).pipe(Ic.stderr);return}t.stdout?.pipe(Ic.stdout),t.stderr?.pipe(Ic.stderr)},dW=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Ic.kill(-t.pid,e),Yg.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Yg.error("Error killing process:",r),!1}},c0e=t=>dW(t,"SIGKILL"),l0e=(t,e)=>{let r=null,n=()=>{Yg.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),dW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Yg.log(`Force killing idle process ${t.pid}`),c0e(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let s=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",s),t.on("error",s)},u0e=t=>{uW.add(t);let e=n0e();if(e){let r=e.onTimesUp(()=>{Yg.log(`Global timer expired, killing process ${t.pid}`),dW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Yg.log(`Force killing process ${t.pid} after timeout`),c0e(t))},5e3)});t.on("exit",()=>{uW.delete(t),r()}),t.on("error",()=>{uW.delete(t),r()})}};function ca(t,e){if(!Ic.env.NETLIFY_LOCAL_MODE)try{let i=gbt.resolve(i0e.name),s=xc.dirname(i);for(;s!==xc.dirname(s);){let o=xc.dirname(s);if(xc.basename(o)==="node_modules"){let a=xc.join(o,".bin",e);if(qC.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(Ic.env.NODE_PATH){let i=xc.join(Ic.env.NODE_PATH,".bin",e);if(qC.existsSync(i))return i}let r=xc.join(t,"node_modules",".bin",e);if(qC.existsSync(r))return r;let n=xc.join(mbt,"..","node_modules",".bin",e);if(qC.existsSync(n))return n}import uD from"process";import{fileURLToPath as GLt}from"url";import{createRequire as WLt}from"module";import dD from"path";var ybt="__netlify__getTracer",Sbt="__netlify__shutdownTracers",gt=(t,e)=>globalThis[ybt]?.(t,e),d0e=async()=>globalThis[Sbt]?.();function Gf(t,e,r,n,i){let s=typeof n=="function"?n:typeof r=="function"?r:i;if(!s)throw new Error("function to execute with active span is missing");return t?t.withActiveSpan(e,r,n,s):s()}import{setTimeout as FLt}from"timers/promises";Ne();import Ewt from"process";Ne();var zbt=(t,e)=>{e.recordException(t),e.setStatus({code:In.ERROR})};var Cc=class{constructor(e){this._tracer=e,this.startSpan=e.startSpan.bind(this._tracer),this.startActiveSpan=e.startActiveSpan.bind(this._tracer)}withActiveSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=iAe(r,n,i);return this._tracer.startActiveSpan(e,s,o,c=>sAe(c,s,a))}withSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=iAe(r,n,i),c=this._tracer.startSpan(e,s,o);return sAe(c,s,a)}};function iAe(t,e,r){let n,i,s;return!e&&!r?s=t:r?(n=t,i=e,s=r):(n=t,s=e),n=n??{},i=i??Ft.active(),{opts:n,ctx:i,fn:s}}function sAe(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:zbt,s=o=>{throw i(o,t),t.end(),o};try{let o=r(t);return typeof o?.then=="function"?o.then(a=>(t.end(),a),s):(t.end(),o)}catch(o){throw s(o)}}Ne();var t_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var HW=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=mAe(e),n._asyncAttributesPending=e.filter(([i,s])=>t_(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,s])=>(t_(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=mAe(this._rawAttributes),this._schemaUrl=Vbt(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,t_(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&le.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(t_(n)){le.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=Hbt(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function GW(t,e){return HW.FromAttributeList(Object.entries(t),e)}function mAe(t){return t.map(([e,r])=>t_(r)?[e,r.catch(n=>{le.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function Vbt(t){if(typeof t=="string"||t===void 0)return t;le.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function Hbt(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",s=n===void 0||n==="";if(i)return n;if(s||r===n)return r;le.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}Ne();var hT=class{emit(e){}enabled(){return!1}},gAe=new hT;var mT=Symbol.for("io.opentelemetry.js.api.logs"),r_=globalThis;function _Ae(t,e,r){return n=>n===t?e:r}var WW=1;var YW=class{getLogger(e,r,n){return new hT}},uN=new YW;var dN=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):gAe}};var gT=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new dN(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:uN}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};var fN=class t{constructor(){this._proxyLoggerProvider=new gT}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return r_[mT]?this.getLoggerProvider():(r_[mT]=_Ae(WW,e,uN),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=r_[mT])===null||e===void 0?void 0:e.call(r_,WW))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete r_[mT],this._proxyLoggerProvider=new gT}};var yAe=fN.getInstance();function SAe(t,e,r,n){for(let i=0,s=t.length;i<s;i++){let o=t[i];e&&o.setTracerProvider(e),r&&o.setMeterProvider(r),n&&o.setLoggerProvider&&o.setLoggerProvider(n),o.getConfig().enabled||o.enable()}}function EAe(t){t.forEach(e=>e.disable())}function KW(t){let e=t.tracerProvider||Rt.getTracerProvider(),r=t.meterProvider||pT.getMeterProvider(),n=t.loggerProvider||yAe.getLoggerProvider(),i=t.instrumentations?.flat()??[];return SAe(i,e,r,n),()=>{EAe(i)}}Ne();var Gbt=qr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function vAe(t){return t.getValue(Gbt)===!0}var n_;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(n_||(n_={}));Ne();var JW="[_0-9a-z-*/]",Wbt=`[a-z]${JW}{0,255}`,Ybt=`[a-z0-9]${JW}{0,240}@[a-z]${JW}{0,13}`,Kbt=new RegExp(`^(?:${Wbt}|${Ybt})$`),Jbt=/^[ -~]{0,255}[!-~]$/,Zbt=/,|=/;function ZW(t){return Kbt.test(t)}function XW(t){return Jbt.test(t)&&!Zbt.test(t)}var Xbt=32,bAe=512,TAe=",",wAe="=",pN=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!ZW(e)||!XW(r))return this;let n=this._getState(),i=n.get(e),s=this._length;if(typeof i=="string"?s+=r.length-i.length:s+=e.length+r.length+(n.size>0?2:1),s>bAe)return this;let o=new Map(n);return o.delete(e),o.set(e,r),this._fromState(o,s)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let s=new Map(r);return s.delete(e),this._fromState(s,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=TAe+e),e=`${n[0]}${wAe}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(TAe),r=new Map,n=0;for(let i of e){let s=i.trim(),o=s.indexOf(wAe);if(o===-1)continue;let a=s.slice(0,o),c=s.slice(o+1);if(!ZW(a)||!XW(c))continue;let l=n+s.length+(r.size>0?1:0);if(!(l>bAe)&&(r.set(a,c),n=l,r.size>=Xbt))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}};var hN="traceparent",mN="tracestate",Qbt="00",eTt="(?!ff)[\\da-f]{2}",tTt="(?![0]{32})[\\da-f]{32}",rTt="(?![0]{16})[\\da-f]{16}",nTt="[\\da-f]{2}",iTt=new RegExp(`^\\s?(${eTt})-(${tTt})-(${rTt})-(${nTt})(-.*)?\\s?$`);function AAe(t){let e=iTt.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var Ou=class{inject(e,r,n){let i=Rt.getSpanContext(e);if(!i||vAe(e)||!yi(i))return;let s=`${Qbt}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||ur.NONE).toString(16)}`;n.set(r,hN,s),i.traceState&&n.set(r,mN,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,hN);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=AAe(s);if(!o)return e;o.isRemote=!0;let a=n.get(r,mN);if(a){let c=Array.isArray(a)?a.join(","):a;o.traceState=new pN(typeof c=="string"?c:void 0)}return Rt.setSpanContext(e,o)}fields(){return[hN,mN]}};var gN=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};var _T=class{_isCalled=!1;_deferred=new gN;_callback;_that;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};var ak=Mn(MY(),1);Ne();var aIe=t=>{throw TypeError(t)},qY=(t,e,r)=>e.has(t)||aIe("Cannot "+r),ok=(t,e,r)=>(qY(t,e,"read from private field"),r?r.call(t):e.get(t)),UY=(t,e,r)=>e.has(t)?aIe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),iIe=(t,e,r,n)=>(qY(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Swt=(t,e,r)=>(qY(t,e,"access private method"),r),sIe="__netlify__getTracer",vwt="__netlify__shutdownTracers",bwt="__nfOTLPTrace",NT,kT,jY,cIe,Twt=class{constructor(){UY(this,jY),UY(this,NT),UY(this,kT),iIe(this,NT,new _T(Swt(this,jY,cIe),this)),iIe(this,kT,le.createComponentLogger({namespace:"netlify-span-exporter"}))}export(t,e){if(ok(this,kT).debug(`export ${t.length.toString()} spans`),ok(this,NT).isCalled){e({code:n_.FAILED,error:new Error("Exporter has been shutdown")});return}console.log(bwt,JSON.stringify(wwt(t))),e({code:n_.SUCCESS})}shutdown(){return ok(this,NT).call()}};NT=new WeakMap;kT=new WeakMap;jY=new WeakSet;cIe=function(){return ok(this,kT).debug("Shutting down"),Promise.resolve()};function wwt(t){return{resourceSpans:t.map(e=>{let r=e.spanContext();return{resource:{attributes:sk(e.resource.attributes),droppedAttributesCount:e.droppedAttributesCount},scopeSpans:[{scope:{name:e.instrumentationScope.name,version:e.instrumentationScope.version},spans:[{traceId:r.traceId,spanId:r.spanId,parentSpanId:e.parentSpanContext?.spanId,name:e.name,kind:e.kind||oo.SERVER,startTimeUnixNano:FY(e.startTime),endTimeUnixNano:FY(e.endTime),attributes:sk(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:FY(n.time),attributes:sk(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedEventsCount:e.droppedEventsCount,status:{code:e.status.code,message:e.status.message},links:e.links.map(n=>({spanId:n.context.spanId,traceId:n.context.traceId,attributes:sk(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedLinksCount:e.droppedLinksCount}]}]}})}}function sk(t){return Object.keys(t).map(e=>lIe(e,t[e]))}function lIe(t,e){return{key:t,value:uIe(e)}}function uIe(t){let e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(uIe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>lIe(r,n))}}:{}}function FY(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var oIe={name:"@netlify/otel",version:"6.0.5",type:"module",engines:{node:"^18.14.0 || >=20.6.1"},main:"./dist/main.cjs",module:"./dist/main.js",types:"./dist/main.d.ts",exports:{".":{require:{types:"./dist/main.d.cts",default:"./dist/main.cjs"},import:{types:"./dist/main.d.ts",default:"./dist/main.js"},default:{types:"./dist/main.d.ts",default:"./dist/main.js"}},"./package.json":"./package.json","./bootstrap":{require:{types:"./dist/bootstrap/main.d.cts",default:"./dist/bootstrap/main.cjs"},import:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"},default:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"}},"./exporter-netlify":{require:{types:"./dist/exporters/netlify.d.cts",default:"./dist/exporters/netlify.cjs"},import:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"},default:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"}},"./instrumentation-fetch":{require:{types:"./dist/instrumentations/fetch.d.cts",default:"./dist/instrumentations/fetch.cjs"},import:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"},default:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"}},"./instrumentation-http":{require:{types:"./dist/instrumentations/http.d.cts",default:"./dist/instrumentations/http.cjs"},import:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"},default:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"}},"./opentelemetry":{require:{types:"./dist/opentelemetry.d.cts",default:"./dist/opentelemetry.cjs"},import:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"},default:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"}}},files:["dist/**/*"],scripts:{build:"tsup-node",dev:"tsup-node --watch",prepack:"npm run build",test:"run-s build test:ci","test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"vitest","test:dev:vitest:watch":"vitest watch","test:ci:vitest":"vitest run",publint:"npx -y publint --strict"},keywords:["netlify","cdn"],license:"MIT",repository:{type:"git",url:"https://github.com/netlify/primitives.git",directory:"packages/otel"},bugs:{url:"https://github.com/netlify/primitives/issues"},author:"Netlify Inc.",devDependencies:{"@netlify/dev-utils":"^4.4.7",msw:"^2.10.5","npm-run-all2":"^7.0.2",tsup:"^8.0.0",vitest:"^3.0.0"},dependencies:{"@opentelemetry/api":"1.9.1","@opentelemetry/core":"2.8.0","@opentelemetry/instrumentation":"^0.220.0","@opentelemetry/resources":"2.9.0","@opentelemetry/sdk-trace-node":"2.9.0"}},dIe=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,sIe))return;let e=Ewt.version.slice(1),r=GW({"service.name":t.serviceName,"service.version":t.serviceVersion,"process.runtime.name":"nodejs","process.runtime.version":e,"deployment.environment":t.deploymentEnvironment,"http.url":t.siteUrl,"netlify.site.id":t.siteId,"netlify.site.name":t.siteName}),n=t.spanProcessors??[Awt()],i=new ak.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new Ou});let s=t.instrumentations??[];KW({instrumentations:s,tracerProvider:i}),Object.defineProperty(globalThis,sIe,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new Cc(Rt.getTracer(a,c)):new Cc(Rt.getTracer(oIe.name,oIe.version))}}),Object.defineProperty(globalThis,vwt,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},Awt=()=>new ak.SimpleSpanProcessor(new Twt);Ne();var $T=Mn(MY(),1);Ne();import*as ck from"diagnostics_channel";var fIe=class{constructor(t={}){this.instrumentationName="@netlify/otel/instrumentation-fetch",this.instrumentationVersion="1.0.0",this._recordFromReq=new WeakMap,this.config=t,this._channelSubs=[]}getConfig(){return this.config}setConfig(){}setMeterProvider(){}setTracerProvider(t){this.provider=t}getTracerProvider(){return this.provider}annotateFromRequest(t,e){let r=this.config.getRequestAttributes?.(e)??{},n=new URL(e.path,e.origin);t.setAttributes({...r,"http.request.method":e.method,"url.full":n.href,"url.host":n.host,"url.scheme":n.protocol.slice(0,-1),"server.address":n.hostname,"server.port":n.port,...this.prepareHeaders("request",e.headers)})}annotateFromResponse(t,e){let r=this.config.getResponseAttributes?.(e)??{};t.setAttributes({...r,"http.response.status_code":e.statusCode,...this.prepareHeaders("response",e.headers)}),t.setStatus({code:e.statusCode>=400?In.ERROR:In.UNSET})}prepareHeaders(t,e){if(!Array.isArray(e))return{};if(this.config.skipHeaders===!0)return{};let r=["*","/.*/"],n=this.config.skipHeaders??[],i=this.config.redactHeaders??[],s=n.some(a=>r.includes(a.toString())),o={};if(s)return o;for(let a=0;a+1<e.length;a=a+2){let c=e[a],l=e[a+1];if(typeof c!="string"&&!Buffer.isBuffer(c)||typeof l!="string"&&!Buffer.isBuffer(l))continue;let u=c.toString().toLowerCase();if(n.some(f=>typeof f=="string"?f==u:f.test(u)))continue;let d=`http.${t}.header.${u}`;i===!0||i.some(f=>typeof f=="string"?f==u:f.test(u))?o[d]="REDACTED":o[d]=l.toString()}return o}getRequestMethod(t){return["HEAD","GET","POST","PUT","PATCH","DELETE"].includes(t.toUpperCase())?t.toUpperCase():"_OTHER"}getTracer(){if(!this.provider)return;let t=this.provider.getTracer(this.instrumentationName,this.instrumentationVersion);return t instanceof Cc?t:new Cc(t)}enable(){this._channelSubs.length>0||(this.subscribe("undici:request:create",this.onRequestCreate.bind(this)),this.subscribe("undici:request:headers",this.onRequestHeaders.bind(this)),this.subscribe("undici:request:trailers",this.onRequestEnd.bind(this)),this.subscribe("undici:request:error",this.onRequestError.bind(this)))}subscribe(t,e){ck.subscribe(t,e);let r=()=>ck.unsubscribe(t,e);this._channelSubs.push({name:t,unsubscribe:r})}disable(){this._channelSubs.forEach(t=>{t.unsubscribe()}),this._channelSubs.length=0}onRequestCreate({request:t}){try{let e=this.getTracer(),r=new URL(t.path,t.origin);if(!e||t.method==="CONNECT"||this.config.skipURLs?.some(i=>typeof i=="string"?r.href.startsWith(i):i.test(r.href)))return;let n=e.startSpan(this.getRequestMethod(t.method),{kind:oo.CLIENT},Ft.active());this.annotateFromRequest(n,t),this._recordFromReq.set(t,n)}catch{}}onRequestHeaders({request:t,response:e}){try{let r=this._recordFromReq.get(t);if(!r)return;this.annotateFromResponse(r,e)}catch{}}onRequestError({request:t,error:e}){try{let r=this._recordFromReq.get(t);if(!r)return;r.recordException(e),r.setStatus({code:In.ERROR,message:e.message}),r.end(),this._recordFromReq.delete(t)}catch{}}onRequestEnd({request:t}){try{let e=this._recordFromReq.get(t);if(!e)return;e.end(),this._recordFromReq.delete(t)}catch{}}};var DDe=Mn($De(),1);var cD=Se("tracing"),LDe=8e3,jLt=5e3,Xw=async(t=jLt)=>{try{await Promise.race([d0e(),FLt(t)])}catch(e){cD.warn("Failed to flush tracers on shutdown",e)}},MDe=async(t,e,r)=>{if(!gt()){let n=[new $T.SimpleSpanProcessor(new BJ),new $T.SimpleSpanProcessor(new DDe.OTLPTraceExporter({url:r.exporterUrl}))];await dIe({serviceName:"@netlify/agent-runner-cli",serviceVersion:t,deploymentEnvironment:"production",siteUrl:"",siteId:process.env.SITE_ID??"",siteName:e,spanProcessors:n,instrumentations:[new fIe({skipHeaders:!0})]})}return r.traceparent?(Yn.setGlobalPropagator(new Ou),Yn.extract(Ft.active(),{traceparent:r.traceparent,isRemote:!0})):Ft.active()};function Vt(t,e,r){return cD.log(`\u23F3 TRACE: ${e} starting...`),Gf(t,e,r)}var BJ=class{export(e,r){for(let n of e)this.logSpan(n);r({code:1})}async shutdown(){}forceFlush(){return Promise.resolve()}logSpan(e){let r=(e.endTime[0]-e.startTime[0])*1e3+(e.endTime[1]-e.startTime[1])/1e6,n=e.attributes,i=[];for(let[a,c]of Object.entries(n))a.includes("duration")&&typeof c=="number"?i.push(`${a}=${c.toFixed(2)}ms`):i.push(`${a}=${c}`);let s=e.status?.code===2?"\u274C":"\u2705",o=i.length>0?` [${i.join(", ")}]`:"";cD.log(`${s} TRACE: ${e.name} completed in ${r.toFixed(2)}ms${o}`),e.status?.code===2&&e.status.message&&cD.log(` \u274C Error: ${e.status.message}`)}};function zJ(){return rt().captureLlmContentEnabled}function UDe(t){return t.includes("claude")?"anthropic":t.includes("codex")?"openai":t.includes("gemini")?"google":t.includes("opencode")?"opencode":t}function lD(t,e,r){let n={role:t,parts:[{type:"text",content:Ts(e)}]};return r&&(n.finish_reason=r),JSON.stringify([n])}var qLt=new Set([ee.Task,ee.RunCommand,ee.Explore,ee.FileRead,ee.FileWrite,ee.Notebook,ee.Web,ee.Todo,ee.Skill,ee.Tool,ee.Memorize,ee.Deployment,ee.SiteGeneration]);function FDe(t,e,r,n){if(!t.length)return;let i=gt();if(!i)return;let s=zJ(),o=Math.max(1,(n-r)/t.length);t.forEach((a,c)=>{let l=Math.min(n,r+c*o),u=Math.min(n,l+o),d=a.type==="tool_use"||a.type==="tool_result"||a.category!=null&&qLt.has(a.category),f=d?"execute_tool":"chat",p=a.title||a.type||`step-${a.id??c}`,h=a.category||"unknown",m=d?`${f} ${h}`:f,_=a.message?a.message.length>LDe?`${a.message.slice(0,LDe)}\u2026`:a.message:void 0;i.startSpan(m,{startTime:l,attributes:{"gen_ai.capability.name":e,"gen_ai.step.name":p,"gen_ai.operation.name":f,...d?{"gen_ai.tool.name":h}:{},"spark.step.id":a.id??-1,...a.type?{"spark.step.type":a.type}:{},...a.category?{"spark.step.category":a.category}:{},...a.groupId?{"spark.step.group_id":a.groupId}:{},...a.parentGroupId?{"spark.step.parent_group_id":a.parentGroupId}:{},...s&&_?d?{"gen_ai.tool.call.result":Ts(_)}:{"gen_ai.output.messages":lD("assistant",_)}:{}}}).end(u)})}import{readdir as BLt,rm as zLt}from"fs/promises";import{join as VLt}from"path";async function jDe(t,e=[]){let n=(await BLt(t)).filter(i=>!e.includes(i));await Promise.all(n.map(i=>zLt(VLt(t,i),{recursive:!0,force:!0})))}var HLt=700,qDe=t=>t.mode==="create"&&(t.accountType===wl||t.enforcedAICreditsRemaining!=null&&t.enforcedAICreditsRemaining<=HLt);var YLt=dD.dirname(GLt(import.meta.url)),BDe=WLt(import.meta.url),KLt=dD.resolve(YLt,"scripts/scaffold.js"),JLt="scripts/scaffold.js",ZLt=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+/g,VJ=t=>{if(t.length>=2){let e=t[0],r=t[t.length-1];if(e==='"'&&r==='"'||e==="'"&&r==="'")return t.slice(1,-1)}return t},XLt=t=>/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(t),QLt=t=>{let e=VJ(t);return e==="node"||e.endsWith("/node")},tl=t=>{if(typeof t!="string")return!1;let e=t.match(ZLt)||[];if(e.length<2)return!1;let r=0;for(;r<e.length&&XLt(VJ(e[r]));)r+=1;if(r>=e.length||!QLt(e[r]))return!1;let n=e[r+1];return n?VJ(n).includes(JLt):!1},hy=Se("create_stage"),zDe="Do not run local validation or dev-server commands to check your work \u2014 specifically `tsc`, `npx tsc`, `vite build`, `vite dev`, or any equivalent build/start/test command. The build pipeline installs and validates the project automatically after your edits. Verify your changes by reading the files you edited.",eDt=`${zDe}
591
591
 
592
592
  Commands that generate or modify project files are fine to run when the task requires them \u2014 for example \`drizzle-kit generate\` to write a database migration after a schema change, or other code-generation utilities documented in the skills.`,tDt=`${zDe}
593
593
 
package/dist/index.js CHANGED
@@ -98,7 +98,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
98
98
  `,LF:`
99
99
  `,concatBytes:FL},n$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},i$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:n$e};import{Buffer as o$e}from"buffer";var nre=(t,e)=>t?void 0:s$e.bind(void 0,e),s$e=function*(t,e){if(typeof e!="string"&&!jt(e)&&!o$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},ire=(t,e)=>t?a$e.bind(void 0,e):c$e.bind(void 0,e),a$e=function*(t,e){ore(t,e),yield e},c$e=function*(t,e){if(ore(t,e),typeof e!="string"&&!jt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},ore=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
100
100
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
101
- if (condition) { yield value; }`)};import{Buffer as l$e}from"buffer";import{StringDecoder as u$e}from"string_decoder";var gx=(t,e,r)=>{if(r)return;if(t)return{transform:d$e.bind(void 0,new TextEncoder)};let n=new u$e(e);return{transform:f$e.bind(void 0,n),final:p$e.bind(void 0,n)}},d$e=function*(t,e){l$e.isBuffer(e)?yield ls(e):typeof e=="string"?yield t.encode(e):yield e},f$e=function*(t,e){yield jt(e)?t.write(e):e},p$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as sre}from"util";var jL=sre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),_x=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=m$e}=e[r];for await(let i of n(t))yield*_x(i,e,r+1)},are=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*h$e(r,Number(e),t)},h$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*_x(n,r,e+1)},cre=sre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),m$e=function*(t){yield t};var zL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},lre=(t,e)=>[...e.flatMap(r=>[...Cl(r,t,0)]),...R_(t)],Cl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=_$e}=e[r];for(let i of n(t))yield*Cl(i,e,r+1)},R_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*g$e(r,Number(e),t)},g$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Cl(n,r,e+1)},_$e=function*(t){yield t};var GL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=dre(t,s,o),l=Il(e),u=Il(r),d=l?jL.bind(void 0,_x,a):zL.bind(void 0,Cl),f=l||u?jL.bind(void 0,are,a):zL.bind(void 0,R_),p=l||u?cre.bind(void 0,a):void 0;return{stream:new y$e({writableObjectMode:n,writableHighWaterMark:ure(n),readableObjectMode:i,readableHighWaterMark:ure(i),transform(m,y,T){d([m,c,0],this,T)},flush(m){f([c],this,m)},destroy:p})}},yx=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=dre(s,r,a);t=lre(c,t)}return t},dre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:nre(n,a)},gx(r,s,n),mx(r,o,n,c),{transform:t,final:e},{transform:ire(i,a)},rre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var fre=(t,e)=>{for(let r of S$e(t))E$e(t,r,e)},S$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),E$e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Oa[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>v$e(a,n));r.input=__(s)},v$e=(t,e)=>{let r=yx(t,e,"utf8",!0);return T$e(r),__(r)},T$e=t=>{let e=t.find(r=>typeof r!="string"&&!jt(r));if(e!==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: ${e}.`)};import{writeFileSync as w$e,appendFileSync as R$e}from"fs";var Sx=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&af(r,n)&&!mn.has(e)&&b$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&A$e.has(o))||t.every(({type:i})=>Vn.has(i))),b$e=t=>t===1||t===2,A$e=new Set(["pipe","overlapped"]),pre=async(t,e,r,n)=>{for await(let i of t)x$e(e)||mre(i,r,n)},hre=(t,e,r)=>{for(let n of t)mre(n,e,r)},x$e=t=>t._readableState.pipes.length>0,mre=(t,e,r)=>{let n=kA(t);so({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var gre=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>I$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},I$e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=_te(t,o,d),p=ls(f),{stdioItems:h,objectMode:m}=e[r],y=C$e([p],h,c,n),{serializedResult:T,finalResult:b=T}=P$e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});O$e({serializedResult:T,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&N$e(T,h,i),A}catch(S){return n.error=S,A}},C$e=(t,e,r,n)=>{try{return yx(t,e,r,!1)}catch(i){return n.error=i,t}},P$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:__(t)};let s=OQ(t,r);return n[o]?{serializedResult:s,finalResult:BL(s,!i[o],e)}:{serializedResult:s}},O$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Sx({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=BL(t,!1,s);try{hre(a,e,n)}catch(c){r.error??=c}},N$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>px.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?R$e(n,t):(r.add(o),w$e(n,t))}};var _re=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,fs(e,r,"all")]:Array.isArray(e)?[fs(t,r,"all"),...e]:jt(t)&&jt(e)?KD([t,e]):`${t}${e}`};import{once as VL}from"events";var yre=async(t,e)=>{let[r,n]=await k$e(t);return e.isForcefullyTerminated??=!1,[r,n]},k$e=async t=>{let[e,r]=await Promise.allSettled([VL(t,"spawn"),VL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Sre(t):r.value},Sre=async t=>{try{return await VL(t,"exit")}catch{return Sre(t)}},Ere=async t=>{let[e,r]=await t;if(!M$e(e,r)&&qL(e,r))throw new bi;return[e,r]},M$e=(t,e)=>t===void 0&&e===void 0,qL=(t,e)=>t!==0||e!==null;var vre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=D$e(t,e,r),s=o?.code==="ETIMEDOUT",a=gte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},D$e=(t,e,r)=>t!==void 0?t:qL(e,r)?new bi:void 0;var Tre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=$$e(t,e,r),d=B$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return _f(d,c,l)},$$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=DA(t,e,r),a=U$e(r),{file:c,commandArguments:l,options:u}=tx(t,e,a);F$e(u);let d=Xte(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},U$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,F$e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Ex("ipcInput"),t&&Ex("ipc: true"),r&&Ex("detached: true"),n&&Ex("cancelSignal")},Ex=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},B$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=j$e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=vre(c,r),{output:h,error:m=l}=gre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,A)=>fs(b,r,A)),T=fs(_re(h,r),r,"all");return G$e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:T,options:r,command:n,escapedCommand:i,startTime:a})},j$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{fre(o,r);let a=z$e(r);return L$e(...rx(t,e,a))}catch(a){return gf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},z$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:lx(e)}),G$e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?ux({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):w_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as PUe}from"events";import{spawn as OUe}from"child_process";import Rre from"process";import{once as HL,on as V$e}from"events";var bre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(uf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:KA(t)}),q$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),q$e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{qA(e,i);let o=Pa(t,e,r),s=new AbortController;try{return await Promise.race([H$e(o,n,s),W$e(o,r,s),Y$e(o,r,s)])}catch(a){throw df(t),a}finally{s.abort(),HA(e,i)}},H$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await HL(t,"message",{signal:r});return n}for await(let[n]of V$e(t,"message",{signal:r}))if(e(n))return n},W$e=async(t,e,{signal:r})=>{await HL(t,"disconnect",{signal:r}),lee(e)},Y$e=async(t,e,{signal:r})=>{let[n]=await HL(t,"strict:error",{signal:r});throw zA(n,e)};import{once as xre,on as K$e}from"events";var wre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>WL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),WL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{uf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:KA(t)}),qA(e,o);let s=Pa(t,e,r),a=new AbortController,c={};return Z$e(t,s,a),J$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),X$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Z$e=async(t,e,r)=>{try{await xre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},J$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await xre(t,"strict:error",{signal:r.signal});n.error=zA(i,e),r.abort()}catch{}},X$e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of K$e(r,"message",{signal:o.signal}))Are(s),yield c}catch{Are(s)}finally{o.abort(),HA(e,a),n||df(t),i&&await t}},Are=({error:t})=>{if(t)throw t};var Ire=(t,{ipc:e})=>{Object.assign(t,Pre(t,!1,e))},Cre=()=>{let t=Rre,e=!0,r=Rre.channel!==void 0;return{...Pre(t,e,r),getCancelSignal:Lee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},Pre=(t,e,r)=>({sendMessage:QA.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:bre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:wre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as Q$e}from"child_process";import{PassThrough as e1e,Readable as t1e,Writable as r1e,Duplex as n1e}from"stream";var Ore=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{$L(n);let a=new Q$e;i1e(a,n),Object.assign(a,{readable:o1e,writable:s1e,duplex:a1e});let c=gf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=c1e(c,s,i);return{subprocess:a,promise:l}},i1e=(t,e)=>{let r=I_(),n=I_(),i=I_(),o=Array.from({length:e.length-3},I_),s=I_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},I_=()=>{let t=new e1e;return t.end(),t},o1e=()=>new t1e({read(){}}),s1e=()=>new r1e({write(){}}),a1e=()=>new n1e({read(){},write(){}}),c1e=async(t,e,r)=>_f(t,e,r);import{createReadStream as Nre,createWriteStream as kre}from"fs";import{Buffer as l1e}from"buffer";import{Readable as C_,Writable as u1e,Duplex as d1e}from"stream";var Dre=(t,e)=>hx(f1e,t,e,!1),P_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Oa[t]}.`)},Mre={fileNumber:P_,generator:GL,asyncGenerator:GL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:d1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},f1e={input:{...Mre,fileUrl:({value:t})=>({stream:Nre(t)}),filePath:({value:{file:t}})=>({stream:Nre(t)}),webStream:({value:t})=>({stream:C_.fromWeb(t)}),iterable:({value:t})=>({stream:C_.from(t)}),asyncIterable:({value:t})=>({stream:C_.from(t)}),string:({value:t})=>({stream:C_.from(t)}),uint8Array:({value:t})=>({stream:C_.from(l1e.from(t))})},output:{...Mre,fileUrl:({value:t})=>({stream:kre(t)}),filePath:({value:{file:t,append:e}})=>({stream:kre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:u1e.fromWeb(t)}),iterable:P_,asyncIterable:P_,string:P_,uint8Array:P_}};import{on as p1e,once as Lre}from"events";import{PassThrough as h1e,getDefaultHighWaterMark as m1e}from"stream";import{finished as Fre}from"stream/promises";function Pl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)KL(i);let e=t.some(({readableObjectMode:i})=>i),r=g1e(t,e),n=new YL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var g1e=(t,e)=>{if(t.length===0)return m1e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},YL=class extends h1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(KL(e),this.#e.has(e))return;this.#e.add(e),this.#n??=_1e(this,this.#e,this.#o);let r=E1e({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(KL(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},_1e=async(t,e,r)=>{vx(t,$re);let n=new AbortController;try{await Promise.race([y1e(t,n),S1e(t,e,r,n)])}finally{n.abort(),vx(t,-$re)}},y1e=async(t,{signal:e})=>{try{await Fre(t,{signal:e,cleanup:!0})}catch(r){throw Bre(t,r),r}},S1e=async(t,e,r,{signal:n})=>{for await(let[i]of p1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},KL=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},E1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{vx(t,Ure);let a=new AbortController;try{await Promise.race([v1e(o,e,a),T1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),b1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),vx(t,-Ure)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?ZL(t):A1e(t))},v1e=async(t,e,{signal:r})=>{try{await t,r.aborted||ZL(e)}catch(n){r.aborted||Bre(e,n)}},T1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Fre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;jre(s)?i.add(e):zre(t,s)}},b1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Lre(t,i,{signal:o}),!t.readable)return Lre(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},A1e=t=>{t.writable&&t.end()},Bre=(t,e)=>{jre(e)?ZL(t):zre(t,e)},jre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ZL=t=>{(t.readable||t.writable)&&t.destroy()},zre=(t,e)=>{t.destroyed||(t.once("error",x1e),t.destroy(e))},x1e=()=>{},vx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},$re=2,Ure=1;import{finished as Gre}from"stream/promises";var Sf=(t,e)=>{t.pipe(e),w1e(t,e),R1e(t,e)},w1e=async(t,e)=>{if(!(Ti(t)||Ti(e))){try{await Gre(t,{cleanup:!0,readable:!0,writable:!1})}catch{}JL(e)}},JL=t=>{t.writable&&t.end()},R1e=async(t,e)=>{if(!(Ti(t)||Ti(e))){try{await Gre(e,{cleanup:!0,readable:!1,writable:!0})}catch{}XL(t)}},XL=t=>{t.readable&&t.destroy()};var Vre=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Vn.has(c)))I1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Vn.has(c)))P1e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Pl(o);Sf(s,i)}},I1e=(t,e,r,n)=>{r==="output"?Sf(t.stdio[n],e):Sf(e,t.stdio[n]);let i=C1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},C1e=["stdin","stdout","stderr"],P1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;O1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},O1e=(t,{signal:e})=>{Ti(t)&&wl(t,N1e,e)},N1e=2;import{addAbortListener as D1e}from"events";var Ol=[];Ol.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ol.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ol.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Tx=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",QL=Symbol.for("signal-exit emitter"),e$=globalThis,k1e=Object.defineProperty.bind(Object),t$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(e$[QL])return e$[QL];k1e(e$,QL,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},bx=class{},M1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),r$=class extends bx{onExit(){return()=>{}}load(){}unload(){}},n$=class extends bx{#e=i$.platform==="win32"?"SIGINT":"SIGHUP";#r=new t$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ol)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Tx(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ol)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ol.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Tx(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Tx(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},i$=globalThis.process,{onExit:qre,load:LEt,unload:$Et}=M1e(Tx(i$)?new n$(i$):new r$);var Hre=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=qre(()=>{t.kill()});D1e(n,()=>{i()})};var Yre=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=MA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=L1e(r,n,i),{sourceStream:d,sourceError:f}=U1e(t,l),{options:p,fileDescriptors:h}=co.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},L1e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=$1e(t,e,...r),a=VA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},$1e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Wre,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||WD(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=AA(r,...n);return{destination:e(Wre)(i,o,s),pipeOptions:s}}if(co.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Wre=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),U1e=(t,e)=>{try{return{sourceStream:ff(t,e)}}catch(r){return{sourceError:r}}};var Zre=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=F1e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw o$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},F1e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return XL(t),n;if(e!==void 0)return JL(r),e},o$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>gf({error:t,command:Kre,escapedCommand:Kre,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Kre="source.pipe(destination)";var Jre=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as B1e}from"stream/promises";var Xre=(t,e,r)=>{let n=Ax.has(e)?z1e(t,e):j1e(t,e);return wl(t,V1e,r.signal),wl(e,q1e,r.signal),G1e(e),n},j1e=(t,e)=>{let r=Pl([t]);return Sf(r,e),Ax.set(e,r),r},z1e=(t,e)=>{let r=Ax.get(e);return r.add(t),r},G1e=async t=>{try{await B1e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Ax.delete(t)},Ax=new WeakMap,V1e=2,q1e=1;import{aborted as H1e}from"util";var Qre=(t,e)=>t===void 0?[]:[W1e(t,e)],W1e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await H1e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw o$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var xx=(t,...e)=>{if(Ot(e[0]))return xx.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Yre(t,...e),i=Y1e({...n,destination:r});return i.pipe=xx.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Y1e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=K1e(t,i);Zre({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Xre(e,o,d);return await Promise.race([Jre(u),...Qre(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},K1e=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as rUe}from"timers/promises";import{on as Z1e}from"events";import{getDefaultHighWaterMark as J1e}from"stream";var wx=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return X1e(e,s),tne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},X1e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},s$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Q1e(e,s,t);let a=t.readableObjectMode&&!o;return tne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Q1e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},tne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Z1e(t,"data",{signal:e.signal,highWaterMark:ene,highWatermark:ene});return eUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},a$=J1e(!0),ene=a$,eUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=tUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Cl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*R_(a)}},tUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[gx(t,r,!e),mx(t,i,!n,{})].filter(Boolean);var rne=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=nUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([iUe(t),d]);return}let f=UL(c,r),p=s$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([oUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},nUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Sx({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=s$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await pre(a,t,r,o)},iUe=async t=>{await rUe(),t.readableFlowing===null&&t.resume()},oUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await sx(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ax(r,{maxBuffer:o})):await mf(r,{maxBuffer:o})}catch(a){return nne(pte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},c$=async t=>{try{return await t}catch(e){return nne(e)}},nne=({bufferedData:t})=>CQ(t)?new Uint8Array(t):t;import{finished as sUe}from"stream/promises";var O_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=aUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],sUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||uUe(a,e,r,n)}finally{s.abort()}},aUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&cUe(t,r,n),n},cUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{lUe(e,r),n.call(t,...i)}},lUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},uUe=(t,e,r,n)=>{if(!dUe(t,e,r,n))throw t},dUe=(t,e,r,n=!0)=>r.propagating?ine(t)||Rx(t):(r.propagating=!0,l$(r,e)===n?ine(t):Rx(t)),l$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Rx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ine=t=>t?.code==="EPIPE";var one=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>u$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),u$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=O_(t,e,l);if(l$(l,e)){await u;return}let[d]=await Promise.all([rne({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var sne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Pl([t,e].filter(Boolean)):void 0,ane=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>u$({...fUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:pUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),fUe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},pUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as hUe}from"events";var cne=t=>af(t,"ipc"),lne=(t,e)=>{let r=kA(t);so({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var une=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=cne(o),a=us(e,"ipc"),c=us(r,"ipc");for await(let l of WL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(hte(t,i,c),i.push(l)),s&&lne(l,o);return i},dne=async(t,e)=>(await Promise.allSettled([t]),e);var fne=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:y,controller:T})=>{let b=yre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},S=one({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),w=ane({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),I=[],D=une({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),P=mUe(m,t,A),M=gUe(h,A);try{return await Promise.race([Promise.all([{},Ere(b),Promise.all(S),w,D,Hee(t,d),...P,...M]),y,_Ue(t,T),...jee(t,o,f,T),...cee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:T}),...Fee({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:T})])}catch(G){return f.terminationReason??="other",Promise.all([{error:G},b,Promise.all(S.map(_=>c$(_))),c$(w),dne(D,I),Promise.allSettled(P),Promise.allSettled(M)])}},mUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:O_(n,i,r)),gUe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>xi(o,{checkOpen:!1})&&!Ti(o)).map(({type:i,value:o,stream:s=o})=>O_(s,n,e,{isSameDirection:Vn.has(i),stopOnExit:i==="native"}))),_Ue=async(t,{signal:e})=>{let[r]=await hUe(t,"error",{signal:e});throw r};var pne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),N_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ao();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Ef=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as yUe}from"stream";import{callbackify as SUe}from"util";import{finished as hne}from"stream/promises";var d$=async t=>{if(t!==void 0)try{await f$(t)}catch{}},mne=async t=>{if(t!==void 0)try{await p$(t)}catch{}},f$=async t=>{await hne(t,{cleanup:!0,readable:!1,writable:!0})},p$=async t=>{await hne(t,{cleanup:!0,readable:!0,writable:!1})},Ix=async(t,e)=>{if(await t,e)throw e},Cx=(t,e,r)=>{r&&!Rx(r)?t.destroy(r):e&&t.destroy()};var gne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||mn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=h$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=m$(a,s),{read:f,onStdoutDataDone:p}=g$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new yUe({read:f,destroy:SUe(y$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return _$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},h$=(t,e,r)=>{let n=ff(t,e),i=N_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},m$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:a$},g$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ao(),s=wx({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){EUe(this,s,o)},onStdoutDataDone:o}},EUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},_$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await p$(t),await n,await d$(i),await e,r.readable&&r.push(null)}catch(o){await d$(i),_ne(r,o)}},y$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Ef(r,e)&&(_ne(t,n),await Ix(e,n))},_ne=(t,e)=>{Cx(t,t.readable,e)};import{Writable as vUe}from"stream";import{callbackify as yne}from"util";var Sne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=S$(t,r,e),s=new vUe({...E$(n,t,i),destroy:yne(T$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return v$(n,s),s},S$=(t,e,r)=>{let n=VA(t,e),i=N_(r,n,"writableFinal"),o=N_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},E$=(t,e,r)=>({write:TUe.bind(void 0,t),final:yne(bUe.bind(void 0,t,e,r))}),TUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},bUe=async(t,e,r)=>{await Ef(r,e)&&(t.writable&&t.end(),await e)},v$=async(t,e,r)=>{try{await f$(t),e.writable&&e.end()}catch(n){await mne(r),Ene(e,n)}},T$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Ef(r,e),await Ef(n,e)&&(Ene(t,i),await Ix(e,i))},Ene=(t,e)=>{Cx(t,t.writable,e)};import{Duplex as AUe}from"stream";import{callbackify as xUe}from"util";var vne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||mn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=h$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=S$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=m$(c,a),{read:y,onStdoutDataDone:T}=g$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new AUe({read:y,...E$(u,t,d),destroy:xUe(wUe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return _$({subprocessStdout:c,onStdoutDataDone:T,readable:b,subprocess:t,subprocessStdin:u}),v$(u,b,c),b},wUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([y$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),T$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var b$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||mn.has(e),s=ff(t,r),a=wx({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return RUe(a,s,t)},RUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Tne=(t,{encoding:e})=>{let r=pne();t.readable=gne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Sne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=vne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=b$.bind(void 0,t,e),t[Symbol.asyncIterator]=b$.bind(void 0,t,e,{})};var bne=(t,e)=>{for(let[r,n]of CUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},IUe=(async()=>{})().constructor.prototype,CUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(IUe,t)]);var Ane=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=NUe(t,e,r),{subprocess:f,promise:p}=MUe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=xx.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),bne(f,p),co.set(f,{options:u,fileDescriptors:d}),f},NUe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=DA(t,e,r),{file:a,commandArguments:c,options:l}=tx(t,e,r),u=kUe(l),d=Dre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},kUe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},MUe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=OUe(...rx(t,e,r))}catch(h){return Ore({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;PUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Vre(c,a,l),Hre(c,r,l);let d={},f=ao();c.kill=see.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=sne(c,r),Tne(c,r),Ire(c,r);let p=DUe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},DUe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,y]=await fne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let T=h.map((S,w)=>fs(S,e,w)),b=fs(m,e,"all"),A=LUe({errorInfo:d,exitCode:f,signal:p,stdio:T,all:b,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return _f(A,n,e)},LUe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?w_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof lo,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):ux({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Px=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,$Ue(n,t[n],i)]));return{...t,...r}},$Ue=(t,e,r)=>UUe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,UUe=new Set(["env",...QD]);var Na=(t,e,r,n)=>{let i=(s,a,c)=>Na(s,a,r,c),o=(...s)=>FUe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},FUe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Px(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=BUe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Tre(a,c,l):Ane(a,c,l,i)},BUe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=DQ(e)?LQ(e,r):[e,...r],[s,a,c]=AA(...o),l=Px(Px(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var xne=({file:t,commandArguments:e})=>Rne(t,e),wne=({file:t,commandArguments:e})=>({...Rne(t,e),isSync:!0}),Rne=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=jUe(t);return{file:r,commandArguments:n}},jUe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(zUe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},zUe=/ +/g;var Ine=(t,e,r)=>{t.sync=e(GUe,r),t.s=t.sync},Cne=({options:t})=>Pne(t),GUe=({options:t})=>({...Pne(t),isSync:!0}),Pne=t=>({options:{...VUe(t),...t}}),VUe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},One={preferLocal:!0};var Nne=Na(()=>({})),wbt=Na(()=>({isSync:!0})),kne=Na(xne),Rbt=Na(wne),Ibt=Na(Gee),Cbt=Na(Cne,{},One,Ine),{sendMessage:Pbt,getOneMessage:Obt,getEachMessage:Nbt,getCancelSignal:kbt}=Cre();var Mne=!1,Dne=()=>{Mne=!0},fo=()=>Mne;var k_=null,Lne=t=>(k_&&k_.destroy(),k_=new ps({totalAllowedTime:t}),k_),$ne=()=>k_;var ps=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&fo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await _A({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ue.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var Une={name:"@netlify/agent-runner-cli",type:"module",version:"1.155.0-EX-2697.3",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.5","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var YUe=HUe(import.meta.url),KUe=hs.dirname(YUe),ZUe=WUe(import.meta.url),vf=he("shell"),A$=new Set,Fne={preferLocal:!0},ur=(t,e,r)=>{let[n,i]=JUe(e,r),o={...Fne,...i},s=Nne(t,n,o);jne(s,o),Vne(s);let a=r?.idleTimeout;return a&&a>0&&Gne(s,a),s},Bne=(t,e)=>{let r={...Fne,...e},n=kne(t,r);return jne(n,r),Vne(n),e?.idleTimeout&&e.idleTimeout>0&&Gne(n,e.idleTimeout),n},JUe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},jne=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(ms.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new a_).pipe(ms.stdout),t.stderr?.pipe(new a_).pipe(ms.stderr);return}t.stdout?.pipe(ms.stdout),t.stderr?.pipe(ms.stderr)},x$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(ms.kill(-t.pid,e),vf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return vf.error("Error killing process:",r),!1}},zne=t=>x$(t,"SIGKILL"),Gne=(t,e)=>{let r=null,n=()=>{vf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),x$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(vf.log(`Force killing idle process ${t.pid}`),zne(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},Vne=t=>{A$.add(t);let e=$ne();if(e){let r=e.onTimesUp(()=>{vf.log(`Global timer expired, killing process ${t.pid}`),x$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(vf.log(`Force killing process ${t.pid} after timeout`),zne(t))},5e3)});t.on("exit",()=>{A$.delete(t),r()}),t.on("error",()=>{A$.delete(t),r()})}};function po(t,e){if(!ms.env.NETLIFY_LOCAL_MODE)try{let i=ZUe.resolve(Une.name),o=hs.dirname(i);for(;o!==hs.dirname(o);){let s=hs.dirname(o);if(hs.basename(s)==="node_modules"){let a=hs.join(s,".bin",e);if(Ox.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(ms.env.NODE_PATH){let i=hs.join(ms.env.NODE_PATH,".bin",e);if(Ox.existsSync(i))return i}let r=hs.join(t,"node_modules",".bin",e);if(Ox.existsSync(r))return r;let n=hs.join(KUe,"..","node_modules",".bin",e);if(Ox.existsSync(n))return n}var XUe=he("utils"),QUe=t=>new Promise(e=>{setTimeout(e,t)});var w$=t=>{try{return new URL(t).hostname||null}catch{return null}},Nx=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await QUe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},ka=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},qne=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):XUe.error("Could not parse JSON",n))}},eFe=t=>t.charAt(0).toUpperCase()+t.slice(1),ho=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():eFe(e)).join(" ");function gs(t,e){e&&t.log(`Skill invoked: ${e}`)}var kx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Hne=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var R$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},tFe=1e4,I$=(t,e=tFe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as rFe}from"crypto";import{createReadStream as nFe}from"fs";import Mx from"fs/promises";import Jne from"os";import Dx from"path";var Wne=he("repo"),Xne="runner-diffs-",Qne=t=>`${Xne}${t}-`,eie=async t=>{let e=Jne.tmpdir(),r;try{r=await Mx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Xne)&&!n.startsWith(Qne(t))).map(n=>Mx.rm(Dx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Kr=(t,e={})=>ur("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Lx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Wne.info("Getting runner diffs");let n=await oFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=aFe(o);await cFe(h,r)}Wne.info("Changes after processing"),await P$(r);let s=await N$(o,r);if(await C$(s,r),i=await sFe(r),!i)return{hasChanges:!1,ignored:s};await Kr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Mx.mkdtemp(Dx.join(Jne.tmpdir(),Qne(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:T})=>{let b=Dx.join(a,y);await Kr([...T?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await Mx.stat(b);return{path:b,size:S}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Zne(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await Kne(d,h)||(f=h)}await Zne(r),ue.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Kne(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Yne=async t=>{let e=rFe("sha256");for await(let r of nFe(t))e.update(r);return e.digest("hex")},Kne=async(t,e)=>t.size===e.size&&await Yne(t.path)===await Yne(e.path),Zne=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Kr(["reset","--soft","HEAD~1"],{cwd:t})},C$=async(t=[],e=process.cwd())=>{await Kr(["add",".",...t],{cwd:e})},P$=async(t=process.cwd())=>{let e=await Kr(["status","-s"],{cwd:t});return String(e.stdout??"")},tie=/.. (.+)?\.log$/,iFe=[tie],oFe=async(t=process.cwd())=>{let e=await P$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
101
+ if (condition) { yield value; }`)};import{Buffer as l$e}from"buffer";import{StringDecoder as u$e}from"string_decoder";var gx=(t,e,r)=>{if(r)return;if(t)return{transform:d$e.bind(void 0,new TextEncoder)};let n=new u$e(e);return{transform:f$e.bind(void 0,n),final:p$e.bind(void 0,n)}},d$e=function*(t,e){l$e.isBuffer(e)?yield ls(e):typeof e=="string"?yield t.encode(e):yield e},f$e=function*(t,e){yield jt(e)?t.write(e):e},p$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as sre}from"util";var jL=sre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),_x=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=m$e}=e[r];for await(let i of n(t))yield*_x(i,e,r+1)},are=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*h$e(r,Number(e),t)},h$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*_x(n,r,e+1)},cre=sre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),m$e=function*(t){yield t};var zL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},lre=(t,e)=>[...e.flatMap(r=>[...Cl(r,t,0)]),...R_(t)],Cl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=_$e}=e[r];for(let i of n(t))yield*Cl(i,e,r+1)},R_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*g$e(r,Number(e),t)},g$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Cl(n,r,e+1)},_$e=function*(t){yield t};var GL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=dre(t,s,o),l=Il(e),u=Il(r),d=l?jL.bind(void 0,_x,a):zL.bind(void 0,Cl),f=l||u?jL.bind(void 0,are,a):zL.bind(void 0,R_),p=l||u?cre.bind(void 0,a):void 0;return{stream:new y$e({writableObjectMode:n,writableHighWaterMark:ure(n),readableObjectMode:i,readableHighWaterMark:ure(i),transform(m,y,T){d([m,c,0],this,T)},flush(m){f([c],this,m)},destroy:p})}},yx=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=dre(s,r,a);t=lre(c,t)}return t},dre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:nre(n,a)},gx(r,s,n),mx(r,o,n,c),{transform:t,final:e},{transform:ire(i,a)},rre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var fre=(t,e)=>{for(let r of S$e(t))E$e(t,r,e)},S$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),E$e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Oa[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>v$e(a,n));r.input=__(s)},v$e=(t,e)=>{let r=yx(t,e,"utf8",!0);return T$e(r),__(r)},T$e=t=>{let e=t.find(r=>typeof r!="string"&&!jt(r));if(e!==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: ${e}.`)};import{writeFileSync as w$e,appendFileSync as R$e}from"fs";var Sx=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&af(r,n)&&!mn.has(e)&&b$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&A$e.has(o))||t.every(({type:i})=>Vn.has(i))),b$e=t=>t===1||t===2,A$e=new Set(["pipe","overlapped"]),pre=async(t,e,r,n)=>{for await(let i of t)x$e(e)||mre(i,r,n)},hre=(t,e,r)=>{for(let n of t)mre(n,e,r)},x$e=t=>t._readableState.pipes.length>0,mre=(t,e,r)=>{let n=kA(t);so({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var gre=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>I$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},I$e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=_te(t,o,d),p=ls(f),{stdioItems:h,objectMode:m}=e[r],y=C$e([p],h,c,n),{serializedResult:T,finalResult:b=T}=P$e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});O$e({serializedResult:T,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&N$e(T,h,i),A}catch(S){return n.error=S,A}},C$e=(t,e,r,n)=>{try{return yx(t,e,r,!1)}catch(i){return n.error=i,t}},P$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:__(t)};let s=OQ(t,r);return n[o]?{serializedResult:s,finalResult:BL(s,!i[o],e)}:{serializedResult:s}},O$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Sx({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=BL(t,!1,s);try{hre(a,e,n)}catch(c){r.error??=c}},N$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>px.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?R$e(n,t):(r.add(o),w$e(n,t))}};var _re=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,fs(e,r,"all")]:Array.isArray(e)?[fs(t,r,"all"),...e]:jt(t)&&jt(e)?KD([t,e]):`${t}${e}`};import{once as VL}from"events";var yre=async(t,e)=>{let[r,n]=await k$e(t);return e.isForcefullyTerminated??=!1,[r,n]},k$e=async t=>{let[e,r]=await Promise.allSettled([VL(t,"spawn"),VL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Sre(t):r.value},Sre=async t=>{try{return await VL(t,"exit")}catch{return Sre(t)}},Ere=async t=>{let[e,r]=await t;if(!M$e(e,r)&&qL(e,r))throw new bi;return[e,r]},M$e=(t,e)=>t===void 0&&e===void 0,qL=(t,e)=>t!==0||e!==null;var vre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=D$e(t,e,r),s=o?.code==="ETIMEDOUT",a=gte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},D$e=(t,e,r)=>t!==void 0?t:qL(e,r)?new bi:void 0;var Tre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=$$e(t,e,r),d=B$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return _f(d,c,l)},$$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=DA(t,e,r),a=U$e(r),{file:c,commandArguments:l,options:u}=tx(t,e,a);F$e(u);let d=Xte(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},U$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,F$e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Ex("ipcInput"),t&&Ex("ipc: true"),r&&Ex("detached: true"),n&&Ex("cancelSignal")},Ex=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},B$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=j$e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=vre(c,r),{output:h,error:m=l}=gre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,A)=>fs(b,r,A)),T=fs(_re(h,r),r,"all");return G$e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:T,options:r,command:n,escapedCommand:i,startTime:a})},j$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{fre(o,r);let a=z$e(r);return L$e(...rx(t,e,a))}catch(a){return gf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},z$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:lx(e)}),G$e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?ux({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):w_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as PUe}from"events";import{spawn as OUe}from"child_process";import Rre from"process";import{once as HL,on as V$e}from"events";var bre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(uf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:KA(t)}),q$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),q$e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{qA(e,i);let o=Pa(t,e,r),s=new AbortController;try{return await Promise.race([H$e(o,n,s),W$e(o,r,s),Y$e(o,r,s)])}catch(a){throw df(t),a}finally{s.abort(),HA(e,i)}},H$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await HL(t,"message",{signal:r});return n}for await(let[n]of V$e(t,"message",{signal:r}))if(e(n))return n},W$e=async(t,e,{signal:r})=>{await HL(t,"disconnect",{signal:r}),lee(e)},Y$e=async(t,e,{signal:r})=>{let[n]=await HL(t,"strict:error",{signal:r});throw zA(n,e)};import{once as xre,on as K$e}from"events";var wre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>WL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),WL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{uf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:KA(t)}),qA(e,o);let s=Pa(t,e,r),a=new AbortController,c={};return Z$e(t,s,a),J$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),X$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Z$e=async(t,e,r)=>{try{await xre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},J$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await xre(t,"strict:error",{signal:r.signal});n.error=zA(i,e),r.abort()}catch{}},X$e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of K$e(r,"message",{signal:o.signal}))Are(s),yield c}catch{Are(s)}finally{o.abort(),HA(e,a),n||df(t),i&&await t}},Are=({error:t})=>{if(t)throw t};var Ire=(t,{ipc:e})=>{Object.assign(t,Pre(t,!1,e))},Cre=()=>{let t=Rre,e=!0,r=Rre.channel!==void 0;return{...Pre(t,e,r),getCancelSignal:Lee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},Pre=(t,e,r)=>({sendMessage:QA.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:bre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:wre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as Q$e}from"child_process";import{PassThrough as e1e,Readable as t1e,Writable as r1e,Duplex as n1e}from"stream";var Ore=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{$L(n);let a=new Q$e;i1e(a,n),Object.assign(a,{readable:o1e,writable:s1e,duplex:a1e});let c=gf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=c1e(c,s,i);return{subprocess:a,promise:l}},i1e=(t,e)=>{let r=I_(),n=I_(),i=I_(),o=Array.from({length:e.length-3},I_),s=I_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},I_=()=>{let t=new e1e;return t.end(),t},o1e=()=>new t1e({read(){}}),s1e=()=>new r1e({write(){}}),a1e=()=>new n1e({read(){},write(){}}),c1e=async(t,e,r)=>_f(t,e,r);import{createReadStream as Nre,createWriteStream as kre}from"fs";import{Buffer as l1e}from"buffer";import{Readable as C_,Writable as u1e,Duplex as d1e}from"stream";var Dre=(t,e)=>hx(f1e,t,e,!1),P_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Oa[t]}.`)},Mre={fileNumber:P_,generator:GL,asyncGenerator:GL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:d1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},f1e={input:{...Mre,fileUrl:({value:t})=>({stream:Nre(t)}),filePath:({value:{file:t}})=>({stream:Nre(t)}),webStream:({value:t})=>({stream:C_.fromWeb(t)}),iterable:({value:t})=>({stream:C_.from(t)}),asyncIterable:({value:t})=>({stream:C_.from(t)}),string:({value:t})=>({stream:C_.from(t)}),uint8Array:({value:t})=>({stream:C_.from(l1e.from(t))})},output:{...Mre,fileUrl:({value:t})=>({stream:kre(t)}),filePath:({value:{file:t,append:e}})=>({stream:kre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:u1e.fromWeb(t)}),iterable:P_,asyncIterable:P_,string:P_,uint8Array:P_}};import{on as p1e,once as Lre}from"events";import{PassThrough as h1e,getDefaultHighWaterMark as m1e}from"stream";import{finished as Fre}from"stream/promises";function Pl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)KL(i);let e=t.some(({readableObjectMode:i})=>i),r=g1e(t,e),n=new YL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var g1e=(t,e)=>{if(t.length===0)return m1e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},YL=class extends h1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(KL(e),this.#e.has(e))return;this.#e.add(e),this.#n??=_1e(this,this.#e,this.#o);let r=E1e({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(KL(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},_1e=async(t,e,r)=>{vx(t,$re);let n=new AbortController;try{await Promise.race([y1e(t,n),S1e(t,e,r,n)])}finally{n.abort(),vx(t,-$re)}},y1e=async(t,{signal:e})=>{try{await Fre(t,{signal:e,cleanup:!0})}catch(r){throw Bre(t,r),r}},S1e=async(t,e,r,{signal:n})=>{for await(let[i]of p1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},KL=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},E1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{vx(t,Ure);let a=new AbortController;try{await Promise.race([v1e(o,e,a),T1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),b1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),vx(t,-Ure)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?ZL(t):A1e(t))},v1e=async(t,e,{signal:r})=>{try{await t,r.aborted||ZL(e)}catch(n){r.aborted||Bre(e,n)}},T1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Fre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;jre(s)?i.add(e):zre(t,s)}},b1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Lre(t,i,{signal:o}),!t.readable)return Lre(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},A1e=t=>{t.writable&&t.end()},Bre=(t,e)=>{jre(e)?ZL(t):zre(t,e)},jre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ZL=t=>{(t.readable||t.writable)&&t.destroy()},zre=(t,e)=>{t.destroyed||(t.once("error",x1e),t.destroy(e))},x1e=()=>{},vx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},$re=2,Ure=1;import{finished as Gre}from"stream/promises";var Sf=(t,e)=>{t.pipe(e),w1e(t,e),R1e(t,e)},w1e=async(t,e)=>{if(!(Ti(t)||Ti(e))){try{await Gre(t,{cleanup:!0,readable:!0,writable:!1})}catch{}JL(e)}},JL=t=>{t.writable&&t.end()},R1e=async(t,e)=>{if(!(Ti(t)||Ti(e))){try{await Gre(e,{cleanup:!0,readable:!1,writable:!0})}catch{}XL(t)}},XL=t=>{t.readable&&t.destroy()};var Vre=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Vn.has(c)))I1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Vn.has(c)))P1e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Pl(o);Sf(s,i)}},I1e=(t,e,r,n)=>{r==="output"?Sf(t.stdio[n],e):Sf(e,t.stdio[n]);let i=C1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},C1e=["stdin","stdout","stderr"],P1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;O1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},O1e=(t,{signal:e})=>{Ti(t)&&wl(t,N1e,e)},N1e=2;import{addAbortListener as D1e}from"events";var Ol=[];Ol.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ol.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ol.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Tx=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",QL=Symbol.for("signal-exit emitter"),e$=globalThis,k1e=Object.defineProperty.bind(Object),t$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(e$[QL])return e$[QL];k1e(e$,QL,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},bx=class{},M1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),r$=class extends bx{onExit(){return()=>{}}load(){}unload(){}},n$=class extends bx{#e=i$.platform==="win32"?"SIGINT":"SIGHUP";#r=new t$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ol)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Tx(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ol)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ol.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Tx(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Tx(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},i$=globalThis.process,{onExit:qre,load:LEt,unload:$Et}=M1e(Tx(i$)?new n$(i$):new r$);var Hre=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=qre(()=>{t.kill()});D1e(n,()=>{i()})};var Yre=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=MA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=L1e(r,n,i),{sourceStream:d,sourceError:f}=U1e(t,l),{options:p,fileDescriptors:h}=co.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},L1e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=$1e(t,e,...r),a=VA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},$1e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Wre,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||WD(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=AA(r,...n);return{destination:e(Wre)(i,o,s),pipeOptions:s}}if(co.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Wre=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),U1e=(t,e)=>{try{return{sourceStream:ff(t,e)}}catch(r){return{sourceError:r}}};var Zre=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=F1e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw o$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},F1e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return XL(t),n;if(e!==void 0)return JL(r),e},o$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>gf({error:t,command:Kre,escapedCommand:Kre,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Kre="source.pipe(destination)";var Jre=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as B1e}from"stream/promises";var Xre=(t,e,r)=>{let n=Ax.has(e)?z1e(t,e):j1e(t,e);return wl(t,V1e,r.signal),wl(e,q1e,r.signal),G1e(e),n},j1e=(t,e)=>{let r=Pl([t]);return Sf(r,e),Ax.set(e,r),r},z1e=(t,e)=>{let r=Ax.get(e);return r.add(t),r},G1e=async t=>{try{await B1e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Ax.delete(t)},Ax=new WeakMap,V1e=2,q1e=1;import{aborted as H1e}from"util";var Qre=(t,e)=>t===void 0?[]:[W1e(t,e)],W1e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await H1e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw o$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var xx=(t,...e)=>{if(Ot(e[0]))return xx.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Yre(t,...e),i=Y1e({...n,destination:r});return i.pipe=xx.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Y1e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=K1e(t,i);Zre({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Xre(e,o,d);return await Promise.race([Jre(u),...Qre(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},K1e=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as rUe}from"timers/promises";import{on as Z1e}from"events";import{getDefaultHighWaterMark as J1e}from"stream";var wx=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return X1e(e,s),tne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},X1e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},s$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Q1e(e,s,t);let a=t.readableObjectMode&&!o;return tne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Q1e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},tne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Z1e(t,"data",{signal:e.signal,highWaterMark:ene,highWatermark:ene});return eUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},a$=J1e(!0),ene=a$,eUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=tUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Cl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*R_(a)}},tUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[gx(t,r,!e),mx(t,i,!n,{})].filter(Boolean);var rne=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=nUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([iUe(t),d]);return}let f=UL(c,r),p=s$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([oUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},nUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Sx({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=s$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await pre(a,t,r,o)},iUe=async t=>{await rUe(),t.readableFlowing===null&&t.resume()},oUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await sx(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ax(r,{maxBuffer:o})):await mf(r,{maxBuffer:o})}catch(a){return nne(pte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},c$=async t=>{try{return await t}catch(e){return nne(e)}},nne=({bufferedData:t})=>CQ(t)?new Uint8Array(t):t;import{finished as sUe}from"stream/promises";var O_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=aUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],sUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||uUe(a,e,r,n)}finally{s.abort()}},aUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&cUe(t,r,n),n},cUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{lUe(e,r),n.call(t,...i)}},lUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},uUe=(t,e,r,n)=>{if(!dUe(t,e,r,n))throw t},dUe=(t,e,r,n=!0)=>r.propagating?ine(t)||Rx(t):(r.propagating=!0,l$(r,e)===n?ine(t):Rx(t)),l$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Rx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ine=t=>t?.code==="EPIPE";var one=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>u$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),u$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=O_(t,e,l);if(l$(l,e)){await u;return}let[d]=await Promise.all([rne({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var sne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Pl([t,e].filter(Boolean)):void 0,ane=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>u$({...fUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:pUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),fUe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},pUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as hUe}from"events";var cne=t=>af(t,"ipc"),lne=(t,e)=>{let r=kA(t);so({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var une=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=cne(o),a=us(e,"ipc"),c=us(r,"ipc");for await(let l of WL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(hte(t,i,c),i.push(l)),s&&lne(l,o);return i},dne=async(t,e)=>(await Promise.allSettled([t]),e);var fne=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:y,controller:T})=>{let b=yre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},S=one({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),w=ane({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),I=[],D=une({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),P=mUe(m,t,A),M=gUe(h,A);try{return await Promise.race([Promise.all([{},Ere(b),Promise.all(S),w,D,Hee(t,d),...P,...M]),y,_Ue(t,T),...jee(t,o,f,T),...cee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:T}),...Fee({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:T})])}catch(G){return f.terminationReason??="other",Promise.all([{error:G},b,Promise.all(S.map(_=>c$(_))),c$(w),dne(D,I),Promise.allSettled(P),Promise.allSettled(M)])}},mUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:O_(n,i,r)),gUe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>xi(o,{checkOpen:!1})&&!Ti(o)).map(({type:i,value:o,stream:s=o})=>O_(s,n,e,{isSameDirection:Vn.has(i),stopOnExit:i==="native"}))),_Ue=async(t,{signal:e})=>{let[r]=await hUe(t,"error",{signal:e});throw r};var pne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),N_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ao();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Ef=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as yUe}from"stream";import{callbackify as SUe}from"util";import{finished as hne}from"stream/promises";var d$=async t=>{if(t!==void 0)try{await f$(t)}catch{}},mne=async t=>{if(t!==void 0)try{await p$(t)}catch{}},f$=async t=>{await hne(t,{cleanup:!0,readable:!1,writable:!0})},p$=async t=>{await hne(t,{cleanup:!0,readable:!0,writable:!1})},Ix=async(t,e)=>{if(await t,e)throw e},Cx=(t,e,r)=>{r&&!Rx(r)?t.destroy(r):e&&t.destroy()};var gne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||mn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=h$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=m$(a,s),{read:f,onStdoutDataDone:p}=g$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new yUe({read:f,destroy:SUe(y$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return _$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},h$=(t,e,r)=>{let n=ff(t,e),i=N_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},m$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:a$},g$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ao(),s=wx({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){EUe(this,s,o)},onStdoutDataDone:o}},EUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},_$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await p$(t),await n,await d$(i),await e,r.readable&&r.push(null)}catch(o){await d$(i),_ne(r,o)}},y$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Ef(r,e)&&(_ne(t,n),await Ix(e,n))},_ne=(t,e)=>{Cx(t,t.readable,e)};import{Writable as vUe}from"stream";import{callbackify as yne}from"util";var Sne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=S$(t,r,e),s=new vUe({...E$(n,t,i),destroy:yne(T$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return v$(n,s),s},S$=(t,e,r)=>{let n=VA(t,e),i=N_(r,n,"writableFinal"),o=N_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},E$=(t,e,r)=>({write:TUe.bind(void 0,t),final:yne(bUe.bind(void 0,t,e,r))}),TUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},bUe=async(t,e,r)=>{await Ef(r,e)&&(t.writable&&t.end(),await e)},v$=async(t,e,r)=>{try{await f$(t),e.writable&&e.end()}catch(n){await mne(r),Ene(e,n)}},T$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Ef(r,e),await Ef(n,e)&&(Ene(t,i),await Ix(e,i))},Ene=(t,e)=>{Cx(t,t.writable,e)};import{Duplex as AUe}from"stream";import{callbackify as xUe}from"util";var vne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||mn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=h$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=S$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=m$(c,a),{read:y,onStdoutDataDone:T}=g$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new AUe({read:y,...E$(u,t,d),destroy:xUe(wUe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return _$({subprocessStdout:c,onStdoutDataDone:T,readable:b,subprocess:t,subprocessStdin:u}),v$(u,b,c),b},wUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([y$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),T$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var b$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||mn.has(e),s=ff(t,r),a=wx({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return RUe(a,s,t)},RUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Tne=(t,{encoding:e})=>{let r=pne();t.readable=gne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Sne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=vne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=b$.bind(void 0,t,e),t[Symbol.asyncIterator]=b$.bind(void 0,t,e,{})};var bne=(t,e)=>{for(let[r,n]of CUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},IUe=(async()=>{})().constructor.prototype,CUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(IUe,t)]);var Ane=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=NUe(t,e,r),{subprocess:f,promise:p}=MUe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=xx.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),bne(f,p),co.set(f,{options:u,fileDescriptors:d}),f},NUe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=DA(t,e,r),{file:a,commandArguments:c,options:l}=tx(t,e,r),u=kUe(l),d=Dre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},kUe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},MUe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=OUe(...rx(t,e,r))}catch(h){return Ore({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;PUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Vre(c,a,l),Hre(c,r,l);let d={},f=ao();c.kill=see.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=sne(c,r),Tne(c,r),Ire(c,r);let p=DUe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},DUe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,y]=await fne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let T=h.map((S,w)=>fs(S,e,w)),b=fs(m,e,"all"),A=LUe({errorInfo:d,exitCode:f,signal:p,stdio:T,all:b,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return _f(A,n,e)},LUe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?w_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof lo,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):ux({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Px=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,$Ue(n,t[n],i)]));return{...t,...r}},$Ue=(t,e,r)=>UUe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,UUe=new Set(["env",...QD]);var Na=(t,e,r,n)=>{let i=(s,a,c)=>Na(s,a,r,c),o=(...s)=>FUe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},FUe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Px(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=BUe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Tre(a,c,l):Ane(a,c,l,i)},BUe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=DQ(e)?LQ(e,r):[e,...r],[s,a,c]=AA(...o),l=Px(Px(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var xne=({file:t,commandArguments:e})=>Rne(t,e),wne=({file:t,commandArguments:e})=>({...Rne(t,e),isSync:!0}),Rne=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=jUe(t);return{file:r,commandArguments:n}},jUe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(zUe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},zUe=/ +/g;var Ine=(t,e,r)=>{t.sync=e(GUe,r),t.s=t.sync},Cne=({options:t})=>Pne(t),GUe=({options:t})=>({...Pne(t),isSync:!0}),Pne=t=>({options:{...VUe(t),...t}}),VUe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},One={preferLocal:!0};var Nne=Na(()=>({})),wbt=Na(()=>({isSync:!0})),kne=Na(xne),Rbt=Na(wne),Ibt=Na(Gee),Cbt=Na(Cne,{},One,Ine),{sendMessage:Pbt,getOneMessage:Obt,getEachMessage:Nbt,getCancelSignal:kbt}=Cre();var Mne=!1,Dne=()=>{Mne=!0},fo=()=>Mne;var k_=null,Lne=t=>(k_&&k_.destroy(),k_=new ps({totalAllowedTime:t}),k_),$ne=()=>k_;var ps=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&fo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await _A({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ue.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var Une={name:"@netlify/agent-runner-cli",type:"module",version:"1.155.0-EX-2697.4",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.2","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.5","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var YUe=HUe(import.meta.url),KUe=hs.dirname(YUe),ZUe=WUe(import.meta.url),vf=he("shell"),A$=new Set,Fne={preferLocal:!0},ur=(t,e,r)=>{let[n,i]=JUe(e,r),o={...Fne,...i},s=Nne(t,n,o);jne(s,o),Vne(s);let a=r?.idleTimeout;return a&&a>0&&Gne(s,a),s},Bne=(t,e)=>{let r={...Fne,...e},n=kne(t,r);return jne(n,r),Vne(n),e?.idleTimeout&&e.idleTimeout>0&&Gne(n,e.idleTimeout),n},JUe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},jne=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(ms.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new a_).pipe(ms.stdout),t.stderr?.pipe(new a_).pipe(ms.stderr);return}t.stdout?.pipe(ms.stdout),t.stderr?.pipe(ms.stderr)},x$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(ms.kill(-t.pid,e),vf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return vf.error("Error killing process:",r),!1}},zne=t=>x$(t,"SIGKILL"),Gne=(t,e)=>{let r=null,n=()=>{vf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),x$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(vf.log(`Force killing idle process ${t.pid}`),zne(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},Vne=t=>{A$.add(t);let e=$ne();if(e){let r=e.onTimesUp(()=>{vf.log(`Global timer expired, killing process ${t.pid}`),x$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(vf.log(`Force killing process ${t.pid} after timeout`),zne(t))},5e3)});t.on("exit",()=>{A$.delete(t),r()}),t.on("error",()=>{A$.delete(t),r()})}};function po(t,e){if(!ms.env.NETLIFY_LOCAL_MODE)try{let i=ZUe.resolve(Une.name),o=hs.dirname(i);for(;o!==hs.dirname(o);){let s=hs.dirname(o);if(hs.basename(s)==="node_modules"){let a=hs.join(s,".bin",e);if(Ox.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(ms.env.NODE_PATH){let i=hs.join(ms.env.NODE_PATH,".bin",e);if(Ox.existsSync(i))return i}let r=hs.join(t,"node_modules",".bin",e);if(Ox.existsSync(r))return r;let n=hs.join(KUe,"..","node_modules",".bin",e);if(Ox.existsSync(n))return n}var XUe=he("utils"),QUe=t=>new Promise(e=>{setTimeout(e,t)});var w$=t=>{try{return new URL(t).hostname||null}catch{return null}},Nx=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await QUe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},ka=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},qne=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):XUe.error("Could not parse JSON",n))}},eFe=t=>t.charAt(0).toUpperCase()+t.slice(1),ho=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():eFe(e)).join(" ");function gs(t,e){e&&t.log(`Skill invoked: ${e}`)}var kx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Hne=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var R$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},tFe=1e4,I$=(t,e=tFe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as rFe}from"crypto";import{createReadStream as nFe}from"fs";import Mx from"fs/promises";import Jne from"os";import Dx from"path";var Wne=he("repo"),Xne="runner-diffs-",Qne=t=>`${Xne}${t}-`,eie=async t=>{let e=Jne.tmpdir(),r;try{r=await Mx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Xne)&&!n.startsWith(Qne(t))).map(n=>Mx.rm(Dx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Kr=(t,e={})=>ur("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Lx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Wne.info("Getting runner diffs");let n=await oFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=aFe(o);await cFe(h,r)}Wne.info("Changes after processing"),await P$(r);let s=await N$(o,r);if(await C$(s,r),i=await sFe(r),!i)return{hasChanges:!1,ignored:s};await Kr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Mx.mkdtemp(Dx.join(Jne.tmpdir(),Qne(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:T})=>{let b=Dx.join(a,y);await Kr([...T?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await Mx.stat(b);return{path:b,size:S}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Zne(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await Kne(d,h)||(f=h)}await Zne(r),ue.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Kne(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Yne=async t=>{let e=rFe("sha256");for await(let r of nFe(t))e.update(r);return e.digest("hex")},Kne=async(t,e)=>t.size===e.size&&await Yne(t.path)===await Yne(e.path),Zne=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Kr(["reset","--soft","HEAD~1"],{cwd:t})},C$=async(t=[],e=process.cwd())=>{await Kr(["add",".",...t],{cwd:e})},P$=async(t=process.cwd())=>{let e=await Kr(["status","-s"],{cwd:t});return String(e.stdout??"")},tie=/.. (.+)?\.log$/,iFe=[tie],oFe=async(t=process.cwd())=>{let e=await P$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
102
102
  `).filter(i=>iFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},sFe=async(t=process.cwd())=>{try{return await Kr(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},O$=async(t=process.cwd())=>{let{stdout:e}=await Kr(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},rie=async(t=process.cwd())=>{let{stdout:e}=await Kr(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},N$=async(t,e=process.cwd())=>{t||=await P$(e);let r=[".netlify","node_modules","dist",".next","out",".nuxt",".output",".cache",".turbo",".parcel-cache","coverage",".nyc_output","storybook-static","public/build","CLAUDE.local.md"],n=[];return t.split(`
103
103
  `).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${Dx.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match(tie)?.[1];o&&n.push(`:!${o}.log`)}),n},nie=async(t=process.cwd())=>{await Kr(["reset","--hard","HEAD"],{cwd:t})},iie=async(t=process.cwd())=>{let e=await Kr(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
104
104
  `).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},aFe=t=>{let e=t.split(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/agent-runner-cli",
3
3
  "type": "module",
4
- "version": "1.155.0-EX-2697.3",
4
+ "version": "1.155.0-EX-2697.4",
5
5
  "description": "CLI tool for running Netlify agents",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",