@netlify/agent-runner-cli 1.156.0-image-prompt.2 → 1.156.0-image-prompt.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 +1 -1
- package/dist/bin.js +1 -1
- package/dist/index.js +1 -1
- package/dist/skills/netlify-ai-gateway/SKILL.md +20 -1
- package/package.json +1 -1
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},T$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},b$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:T$e};import{Buffer as A$e}from"buffer";var gre=(t,e)=>t?void 0:x$e.bind(void 0,e),x$e=function*(t,e){if(typeof e!="string"&&!jt(e)&&!A$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},_re=(t,e)=>t?w$e.bind(void 0,e):R$e.bind(void 0,e),w$e=function*(t,e){yre(t,e),yield e},R$e=function*(t,e){if(yre(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},yre=(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 I$e}from"buffer";import{StringDecoder as C$e}from"string_decoder";var vx=(t,e,r)=>{if(r)return;if(t)return{transform:P$e.bind(void 0,new TextEncoder)};let n=new C$e(e);return{transform:O$e.bind(void 0,n),final:N$e.bind(void 0,n)}},P$e=function*(t,e){I$e.isBuffer(e)?yield fs(e):typeof e=="string"?yield t.encode(e):yield e},O$e=function*(t,e){yield jt(e)?t.write(e):e},N$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as Sre}from"util";var HL=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}}),Tx=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*Tx(i,e,r+1)},Ere=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*k$e(r,Number(e),t)},k$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Tx(n,r,e+1)},vre=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 WL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Tre=(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=L$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*D$e(r,Number(e),t)},D$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Nl(n,r,e+1)},L$e=function*(t){yield t};var YL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Are(t,s,o),l=Ol(e),u=Ol(r),d=l?HL.bind(void 0,Tx,a):WL.bind(void 0,Nl),f=l||u?HL.bind(void 0,Ere,a):WL.bind(void 0,P_),p=l||u?vre.bind(void 0,a):void 0;return{stream:new $$e({writableObjectMode:n,writableHighWaterMark:bre(n),readableObjectMode:i,readableHighWaterMark:bre(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=Are(s,r,a);t=Tre(c,t)}return t},Are=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:gre(n,a)},vx(r,s,n),Ex(r,o,n,c),{transform:t,final:e},{transform:_re(i,a)},mre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var xre=(t,e)=>{for(let r of U$e(t))F$e(t,r,e)},U$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),F$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=>B$e(a,n));r.input=E_(s)},B$e=(t,e)=>{let r=bx(t,e,"utf8",!0);return j$e(r),E_(r)},j$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 V$e,appendFileSync as H$e}from"fs";var Ax=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&uf(r,n)&&!_n.has(e)&&z$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&G$e.has(o))||t.every(({type:i})=>Wn.has(i))),z$e=t=>t===1||t===2,G$e=new Set(["pipe","overlapped"]),wre=async(t,e,r,n)=>{for await(let i of t)q$e(e)||Ire(i,r,n)},Rre=(t,e,r)=>{for(let n of t)Ire(n,e,r)},q$e=t=>t._readableState.pipes.length>0,Ire=(t,e,r)=>{let n=UA(t);uo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Cre=({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)=>W$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},W$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=Pte(t,o,d),p=fs(f),{stdioItems:h,objectMode:m}=e[r],S=Y$e([p],h,c,n),{serializedResult:E,finalResult:b=E}=K$e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Z$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&&J$e(E,h,i),A}catch(y){return n.error=y,A}},Y$e=(t,e,r,n)=>{try{return bx(t,e,r,!1)}catch(i){return n.error=i,t}},K$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=qQ(t,r);return n[o]?{serializedResult:s,finalResult:VL(s,!i[o],e)}:{serializedResult:s}},Z$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=VL(t,!1,s);try{Rre(a,e,n)}catch(c){r.error??=c}},J$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)?H$e(n,t):(r.add(o),V$e(n,t))}};var Pre=([,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)?eL([t,e]):`${t}${e}`};import{once as KL}from"events";var Ore=async(t,e)=>{let[r,n]=await X$e(t);return e.isForcefullyTerminated??=!1,[r,n]},X$e=async t=>{let[e,r]=await Promise.allSettled([KL(t,"spawn"),KL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Nre(t):r.value},Nre=async t=>{try{return await KL(t,"exit")}catch{return Nre(t)}},kre=async t=>{let[e,r]=await t;if(!Q$e(e,r)&&ZL(e,r))throw new wi;return[e,r]},Q$e=(t,e)=>t===void 0&&e===void 0,ZL=(t,e)=>t!==0||e!==null;var Mre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=e1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Cte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},e1e=(t,e,r)=>t!==void 0?t:ZL(e,r)?new wi:void 0;var Dre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=r1e(t,e,r),d=o1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ef(d,c,l)},r1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),a=n1e(r),{file:c,commandArguments:l,options:u}=sx(t,e,a);i1e(u);let d=dre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},n1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,i1e=({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.`)},o1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=s1e({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}=Mre(c,r),{output:h,error:m=l}=Cre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ms(b,r,A)),E=ms(Pre(h,r),r,"all");return c1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},s1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{xre(o,r);let a=a1e(r);return t1e(...ax(t,e,a))}catch(a){return Sf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},a1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:hx(e)}),c1e=({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 KUe}from"events";import{spawn as ZUe}from"child_process";import Bre from"process";import{once as JL,on as l1e}from"events";var Lre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(pf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),u1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),u1e=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([d1e(o,n,s),f1e(o,r,s),p1e(o,r,s)])}catch(a){throw hf(t),a}finally{s.abort(),JA(e,i)}},d1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await JL(t,"message",{signal:r});return n}for await(let[n]of l1e(t,"message",{signal:r}))if(e(n))return n},f1e=async(t,e,{signal:r})=>{await JL(t,"disconnect",{signal:r}),Tee(e)},p1e=async(t,e,{signal:r})=>{let[n]=await JL(t,"strict:error",{signal:r});throw WA(n,e)};import{once as Ure,on as h1e}from"events";var Fre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>XL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),XL=({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 m1e(t,s,a),g1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),_1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},m1e=async(t,e,r)=>{try{await Ure(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},g1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Ure(t,"strict:error",{signal:r.signal});n.error=WA(i,e),r.abort()}catch{}},_1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of h1e(r,"message",{signal:o.signal}))$re(s),yield c}catch{$re(s)}finally{o.abort(),JA(e,a),n||hf(t),i&&await t}},$re=({error:t})=>{if(t)throw t};var jre=(t,{ipc:e})=>{Object.assign(t,Gre(t,!1,e))},zre=()=>{let t=Bre,e=!0,r=Bre.channel!==void 0;return{...Gre(t,e,r),getCancelSignal:Kee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},Gre=(t,e,r)=>({sendMessage:ix.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Lre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Fre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as y1e}from"child_process";import{PassThrough as S1e,Readable as E1e,Writable as v1e,Duplex as T1e}from"stream";var qre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{zL(n);let a=new y1e;b1e(a,n),Object.assign(a,{readable:A1e,writable:x1e,duplex:w1e});let c=Sf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=R1e(c,s,i);return{subprocess:a,promise:l}},b1e=(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 S1e;return t.end(),t},A1e=()=>new E1e({read(){}}),x1e=()=>new v1e({write(){}}),w1e=()=>new T1e({read(){},write(){}}),R1e=async(t,e,r)=>Ef(t,e,r);import{createReadStream as Vre,createWriteStream as Hre}from"fs";import{Buffer as I1e}from"buffer";import{Readable as N_,Writable as C1e,Duplex as P1e}from"stream";var Yre=(t,e)=>Sx(O1e,t,e,!1),k_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},Wre={fileNumber:k_,generator:YL,asyncGenerator:YL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:P1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},O1e={input:{...Wre,fileUrl:({value:t})=>({stream:Vre(t)}),filePath:({value:{file:t}})=>({stream:Vre(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(I1e.from(t))})},output:{...Wre,fileUrl:({value:t})=>({stream:Hre(t)}),filePath:({value:{file:t,append:e}})=>({stream:Hre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C1e.fromWeb(t)}),iterable:k_,asyncIterable:k_,string:k_,uint8Array:k_}};import{on as N1e,once as Kre}from"events";import{PassThrough as k1e,getDefaultHighWaterMark as M1e}from"stream";import{finished as Xre}from"stream/promises";function kl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)e$(i);let e=t.some(({readableObjectMode:i})=>i),r=D1e(t,e),n=new QL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var D1e=(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)},QL=class extends k1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(e$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=L1e(this,this.#e,this.#o);let r=F1e({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(e$(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)}},L1e=async(t,e,r)=>{wx(t,Zre);let n=new AbortController;try{await Promise.race([$1e(t,n),U1e(t,e,r,n)])}finally{n.abort(),wx(t,-Zre)}},$1e=async(t,{signal:e})=>{try{await Xre(t,{signal:e,cleanup:!0})}catch(r){throw Qre(t,r),r}},U1e=async(t,e,r,{signal:n})=>{for await(let[i]of N1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},e$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},F1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{wx(t,Jre);let a=new AbortController;try{await Promise.race([B1e(o,e,a),j1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),z1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),wx(t,-Jre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?t$(t):G1e(t))},B1e=async(t,e,{signal:r})=>{try{await t,r.aborted||t$(e)}catch(n){r.aborted||Qre(e,n)}},j1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Xre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;ene(s)?i.add(e):tne(t,s)}},z1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Kre(t,i,{signal:o}),!t.readable)return Kre(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},G1e=t=>{t.writable&&t.end()},Qre=(t,e)=>{ene(e)?t$(t):tne(t,e)},ene=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",t$=t=>{(t.readable||t.writable)&&t.destroy()},tne=(t,e)=>{t.destroyed||(t.once("error",q1e),t.destroy(e))},q1e=()=>{},wx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Zre=2,Jre=1;import{finished as rne}from"stream/promises";var Tf=(t,e)=>{t.pipe(e),V1e(t,e),H1e(t,e)},V1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await rne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}r$(e)}},r$=t=>{t.writable&&t.end()},H1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await rne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}n$(t)}},n$=t=>{t.readable&&t.destroy()};var nne=(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)))W1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Wn.has(c)))K1e({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)}},W1e=(t,e,r,n)=>{r==="output"?Tf(t.stdio[n],e):Tf(e,t.stdio[n]);let i=Y1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Y1e=["stdin","stdout","stderr"],K1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Z1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Z1e=(t,{signal:e})=>{xi(t)&&Cl(t,J1e,e)},J1e=2;import{addAbortListener as eUe}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",i$=Symbol.for("signal-exit emitter"),o$=globalThis,X1e=Object.defineProperty.bind(Object),s$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(o$[i$])return o$[i$];X1e(o$,i$,{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{},Q1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),a$=class extends Ix{onExit(){return()=>{}}load(){}unload(){}},c$=class extends Ix{#e=l$.platform==="win32"?"SIGINT":"SIGHUP";#r=new s$;#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)}},l$=globalThis.process,{onExit:ine,load:ivt,unload:ovt}=Q1e(Rx(l$)?new c$(l$):new a$);var one=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=ine(()=>{t.kill()});eUe(n,()=>{i()})};var ane=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=FA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=tUe(r,n,i),{sourceStream:d,sourceError:f}=nUe(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}},tUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=rUe(t,e,...r),a=KA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},rUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(sne,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||XD(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(sne)(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}`)},sne=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),nUe=(t,e)=>{try{return{sourceStream:mf(t,e)}}catch(r){return{sourceError:r}}};var lne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=iUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw u$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},iUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return n$(t),n;if(e!==void 0)return r$(r),e},u$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Sf({error:t,command:cne,escapedCommand:cne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),cne="source.pipe(destination)";var une=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 oUe}from"stream/promises";var dne=(t,e,r)=>{let n=Cx.has(e)?aUe(t,e):sUe(t,e);return Cl(t,lUe,r.signal),Cl(e,uUe,r.signal),cUe(e),n},sUe=(t,e)=>{let r=kl([t]);return Tf(r,e),Cx.set(e,r),r},aUe=(t,e)=>{let r=Cx.get(e);return r.add(t),r},cUe=async t=>{try{await oUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Cx.delete(t)},Cx=new WeakMap,lUe=2,uUe=1;import{aborted as dUe}from"util";var fne=(t,e)=>t===void 0?[]:[fUe(t,e)],fUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await dUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw u$({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}=ane(t,...e),i=pUe({...n,destination:r});return i.pipe=Px.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},pUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=hUe(t,i);lne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=dne(e,o,d);return await Promise.race([une(u),...fne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},hUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as vUe}from"timers/promises";import{on as mUe}from"events";import{getDefaultHighWaterMark as gUe}from"stream";var Ox=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return _Ue(e,s),hne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},_Ue=async(t,e)=>{try{await t}catch{}finally{e.abort()}},d$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;yUe(e,s,t);let a=t.readableObjectMode&&!o;return hne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},yUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},hne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=mUe(t,"data",{signal:e.signal,highWaterMark:pne,highWatermark:pne});return SUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},f$=gUe(!0),pne=f$,SUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=EUe({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)}},EUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[vx(t,r,!e),Ex(t,i,!n,{})].filter(Boolean);var mne=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=TUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([bUe(t),d]);return}let f=GL(c,r),p=d$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([AUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},TUe=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=d$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await wre(a,t,r,o)},bUe=async t=>{await vUe(),t.readableFlowing===null&&t.resume()},AUe=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 gne(wte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},p$=async t=>{try{return await t}catch(e){return gne(e)}},gne=({bufferedData:t})=>zQ(t)?new Uint8Array(t):t;import{finished as xUe}from"stream/promises";var M_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=wUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],xUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||CUe(a,e,r,n)}finally{s.abort()}},wUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&RUe(t,r,n),n},RUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{IUe(e,r),n.call(t,...i)}},IUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},CUe=(t,e,r,n)=>{if(!PUe(t,e,r,n))throw t},PUe=(t,e,r,n=!0)=>r.propagating?_ne(t)||Nx(t):(r.propagating=!0,h$(r,e)===n?_ne(t):Nx(t)),h$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Nx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_ne=t=>t?.code==="EPIPE";var yne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>m$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),m$=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(h$(l,e)){await u;return}let[d]=await Promise.all([mne({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)?kl([t,e].filter(Boolean)):void 0,Ene=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>m$({...OUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:NUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),OUe=({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}},NUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as kUe}from"events";var vne=t=>uf(t,"ipc"),Tne=(t,e)=>{let r=UA(t);uo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var bne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=vne(o),a=ps(e,"ipc"),c=ps(r,"ipc");for await(let l of XL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Rte(t,i,c),i.push(l)),s&&Tne(l,o);return i},Ane=async(t,e)=>(await Promise.allSettled([t]),e);var xne=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=Ore(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=yne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Ene({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=[],C=bne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),O=MUe(m,t,A),k=DUe(h,A);try{return await Promise.race([Promise.all([{},kre(b),Promise.all(y),x,C,ote(t,d),...O,...k]),S,LUe(t,E),...ete(t,o,f,E),...vee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...Xee({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(_=>p$(_))),p$(x),Ane(C,R),Promise.allSettled(O),Promise.allSettled(k)])}},MUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:M_(n,i,r)),DUe=(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"}))),LUe=async(t,{signal:e})=>{let[r]=await kUe(t,"error",{signal:e});throw r};var wne=()=>({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 $Ue}from"stream";import{callbackify as UUe}from"util";import{finished as Rne}from"stream/promises";var g$=async t=>{if(t!==void 0)try{await _$(t)}catch{}},Ine=async t=>{if(t!==void 0)try{await y$(t)}catch{}},_$=async t=>{await Rne(t,{cleanup:!0,readable:!1,writable:!0})},y$=async t=>{await Rne(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 Cne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||_n.has(r),{subprocessStdout:a,waitReadableDestroy:c}=S$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=E$(a,s),{read:f,onStdoutDataDone:p}=v$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new $Ue({read:f,destroy:UUe(b$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return T$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},S$=(t,e,r)=>{let n=mf(t,e),i=D_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},E$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:f$},v$=({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(){FUe(this,s,o)},onStdoutDataDone:o}},FUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},T$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await y$(t),await n,await g$(i),await e,r.readable&&r.push(null)}catch(o){await g$(i),Pne(r,o)}},b$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await bf(r,e)&&(Pne(t,n),await kx(e,n))},Pne=(t,e)=>{Mx(t,t.readable,e)};import{Writable as BUe}from"stream";import{callbackify as One}from"util";var Nne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=A$(t,r,e),s=new BUe({...x$(n,t,i),destroy:One(R$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return w$(n,s),s},A$=(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}},x$=(t,e,r)=>({write:jUe.bind(void 0,t),final:One(zUe.bind(void 0,t,e,r))}),jUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},zUe=async(t,e,r)=>{await bf(r,e)&&(t.writable&&t.end(),await e)},w$=async(t,e,r)=>{try{await _$(t),e.writable&&e.end()}catch(n){await Ine(r),kne(e,n)}},R$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await bf(r,e),await bf(n,e)&&(kne(t,i),await kx(e,i))},kne=(t,e)=>{Mx(t,t.writable,e)};import{Duplex as GUe}from"stream";import{callbackify as qUe}from"util";var Mne=({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}=S$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=A$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=E$(c,a),{read:S,onStdoutDataDone:E}=v$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new GUe({read:S,...x$(u,t,d),destroy:qUe(VUe.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 T$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),w$(u,b,c),b},VUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([b$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),R$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var I$=(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 HUe(a,s,t)},HUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Dne=(t,{encoding:e})=>{let r=wne();t.readable=Cne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Nne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Mne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=I$.bind(void 0,t,e),t[Symbol.asyncIterator]=I$.bind(void 0,t,e,{})};var Lne=(t,e)=>{for(let[r,n]of YUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},WUe=(async()=>{})().constructor.prototype,YUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(WUe,t)]);var $ne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=JUe(t,e,r),{subprocess:f,promise:p}=QUe({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}),Lne(f,p),po.set(f,{options:u,fileDescriptors:d}),f},JUe=(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=XUe(l),d=Yre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},XUe=({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}},QUe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=ZUe(...ax(t,e,r))}catch(h){return qre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;KUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];nne(c,a,l),one(c,r,l);let d={},f=fo();c.kill=See.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=Sne(c,r),Dne(c,r),jre(c,r);let p=eFe({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}},eFe=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 xne({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=tFe({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)},tFe=({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,rFe(n,t[n],i)]));return{...t,...r}},rFe=(t,e,r)=>nFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,nFe=new Set(["env",...iL]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>iFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},iFe=({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}=oFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Dre(a,c,l):$ne(a,c,l,i)},oFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=YQ(e)?KQ(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 Une=({file:t,commandArguments:e})=>Bne(t,e),Fne=({file:t,commandArguments:e})=>({...Bne(t,e),isSync:!0}),Bne=(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]=sFe(t);return{file:r,commandArguments:n}},sFe=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(aFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},aFe=/ +/g;var jne=(t,e,r)=>{t.sync=e(cFe,r),t.s=t.sync},zne=({options:t})=>Gne(t),cFe=({options:t})=>({...Gne(t),isSync:!0}),Gne=t=>({options:{...lFe(t),...t}}),lFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},qne={preferLocal:!0};var Vne=Da(()=>({})),Ybt=Da(()=>({isSync:!0})),Hne=Da(Une),Kbt=Da(Fne),Zbt=Da(rte),Jbt=Da(zne,{},qne,jne),{sendMessage:Xbt,getOneMessage:Qbt,getEachMessage:eAt,getCancelSignal:tAt}=zre();var Wne=!1,Yne=()=>{Wne=!0},go=()=>Wne;var L_=null,Kne=t=>(L_&&L_.destroy(),L_=new gs({totalAllowedTime:t}),L_),Zne=()=>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{de.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 Jne={name:"@netlify/agent-runner-cli",type:"module",version:"1.156.0-image-prompt.2",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 pFe=dFe(import.meta.url),hFe=_s.dirname(pFe),mFe=fFe(import.meta.url),Af=pe("shell"),C$=new Set,Xne={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=gFe(e,r),o={...Xne,...i},s=Vne(t,n,o);eie(s,o),nie(s);let a=r?.idleTimeout;return a&&a>0&&rie(s,a),s},Qne=(t,e)=>{let r={...Xne,...e},n=Hne(t,r);return eie(n,r),nie(n),e?.idleTimeout&&e.idleTimeout>0&&rie(n,e.idleTimeout),n},gFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},eie=(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)},P$=(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}},tie=t=>P$(t,"SIGKILL"),rie=(t,e)=>{let r=null,n=()=>{Af.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),P$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing idle process ${t.pid}`),tie(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)},nie=t=>{C$.add(t);let e=Zne();if(e){let r=e.onTimesUp(()=>{Af.log(`Global timer expired, killing process ${t.pid}`),P$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing process ${t.pid} after timeout`),tie(t))},5e3)});t.on("exit",()=>{C$.delete(t),r()}),t.on("error",()=>{C$.delete(t),r()})}};function $x(t,e){return!!Ci(t,e)}function Ci(t,e){if(!ys.env.NETLIFY_LOCAL_MODE)try{let i=mFe.resolve(Jne.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(hFe,"..","node_modules",".bin",e);if(Lx.existsSync(n))return n}var _Fe=pe("utils"),yFe=t=>new Promise(e=>{setTimeout(e,t)});var O$=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 yFe(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},iie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):_Fe.error("Could not parse JSON",n))}},SFe=t=>t.charAt(0).toUpperCase()+t.slice(1),_o=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():SFe(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)),oie=(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 N$=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}},EFe=1e4,k$=(t,e=EFe)=>{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 vFe}from"crypto";import{createReadStream as TFe}from"fs";import Bx from"fs/promises";import uie from"os";import jx from"path";var sie=pe("repo"),die="runner-diffs-",fie=t=>`${die}${t}-`,pie=async t=>{let e=uie.tmpdir(),r;try{r=await Bx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(die)&&!n.startsWith(fie(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()})=>{sie.info("Getting runner diffs");let n=await AFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=wFe(o);await RFe(h,r)}sie.info("Changes after processing"),await D$(r);let s=await L$(o,r);if(await M$(s,r),i=await xFe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Bx.mkdtemp(jx.join(uie.tmpdir(),fie(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 lie(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 cie(d,h)||(f=h)}await lie(r),de.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await cie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},aie=async t=>{let e=vFe("sha256");for await(let r of TFe(t))e.update(r);return e.digest("hex")},cie=async(t,e)=>t.size===e.size&&await aie(t.path)===await aie(e.path),lie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},M$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},D$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},hie=/.. (.+)?\.log$/,bFe=[hie],AFe=async(t=process.cwd())=>{let e=await D$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
102
|
+
if (condition) { yield value; }`)};import{Buffer as I$e}from"buffer";import{StringDecoder as C$e}from"string_decoder";var vx=(t,e,r)=>{if(r)return;if(t)return{transform:P$e.bind(void 0,new TextEncoder)};let n=new C$e(e);return{transform:O$e.bind(void 0,n),final:N$e.bind(void 0,n)}},P$e=function*(t,e){I$e.isBuffer(e)?yield fs(e):typeof e=="string"?yield t.encode(e):yield e},O$e=function*(t,e){yield jt(e)?t.write(e):e},N$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as Sre}from"util";var HL=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}}),Tx=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*Tx(i,e,r+1)},Ere=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*k$e(r,Number(e),t)},k$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Tx(n,r,e+1)},vre=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 WL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Tre=(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=L$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*D$e(r,Number(e),t)},D$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Nl(n,r,e+1)},L$e=function*(t){yield t};var YL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Are(t,s,o),l=Ol(e),u=Ol(r),d=l?HL.bind(void 0,Tx,a):WL.bind(void 0,Nl),f=l||u?HL.bind(void 0,Ere,a):WL.bind(void 0,P_),p=l||u?vre.bind(void 0,a):void 0;return{stream:new $$e({writableObjectMode:n,writableHighWaterMark:bre(n),readableObjectMode:i,readableHighWaterMark:bre(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=Are(s,r,a);t=Tre(c,t)}return t},Are=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:gre(n,a)},vx(r,s,n),Ex(r,o,n,c),{transform:t,final:e},{transform:_re(i,a)},mre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var xre=(t,e)=>{for(let r of U$e(t))F$e(t,r,e)},U$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),F$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=>B$e(a,n));r.input=E_(s)},B$e=(t,e)=>{let r=bx(t,e,"utf8",!0);return j$e(r),E_(r)},j$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 V$e,appendFileSync as H$e}from"fs";var Ax=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&uf(r,n)&&!_n.has(e)&&z$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&G$e.has(o))||t.every(({type:i})=>Wn.has(i))),z$e=t=>t===1||t===2,G$e=new Set(["pipe","overlapped"]),wre=async(t,e,r,n)=>{for await(let i of t)q$e(e)||Ire(i,r,n)},Rre=(t,e,r)=>{for(let n of t)Ire(n,e,r)},q$e=t=>t._readableState.pipes.length>0,Ire=(t,e,r)=>{let n=UA(t);uo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Cre=({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)=>W$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},W$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=Pte(t,o,d),p=fs(f),{stdioItems:h,objectMode:m}=e[r],S=Y$e([p],h,c,n),{serializedResult:E,finalResult:b=E}=K$e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Z$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&&J$e(E,h,i),A}catch(y){return n.error=y,A}},Y$e=(t,e,r,n)=>{try{return bx(t,e,r,!1)}catch(i){return n.error=i,t}},K$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=qQ(t,r);return n[o]?{serializedResult:s,finalResult:VL(s,!i[o],e)}:{serializedResult:s}},Z$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=VL(t,!1,s);try{Rre(a,e,n)}catch(c){r.error??=c}},J$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)?H$e(n,t):(r.add(o),V$e(n,t))}};var Pre=([,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)?eL([t,e]):`${t}${e}`};import{once as KL}from"events";var Ore=async(t,e)=>{let[r,n]=await X$e(t);return e.isForcefullyTerminated??=!1,[r,n]},X$e=async t=>{let[e,r]=await Promise.allSettled([KL(t,"spawn"),KL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Nre(t):r.value},Nre=async t=>{try{return await KL(t,"exit")}catch{return Nre(t)}},kre=async t=>{let[e,r]=await t;if(!Q$e(e,r)&&ZL(e,r))throw new wi;return[e,r]},Q$e=(t,e)=>t===void 0&&e===void 0,ZL=(t,e)=>t!==0||e!==null;var Mre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=e1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Cte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},e1e=(t,e,r)=>t!==void 0?t:ZL(e,r)?new wi:void 0;var Dre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=r1e(t,e,r),d=o1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ef(d,c,l)},r1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),a=n1e(r),{file:c,commandArguments:l,options:u}=sx(t,e,a);i1e(u);let d=dre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},n1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,i1e=({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.`)},o1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=s1e({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}=Mre(c,r),{output:h,error:m=l}=Cre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ms(b,r,A)),E=ms(Pre(h,r),r,"all");return c1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},s1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{xre(o,r);let a=a1e(r);return t1e(...ax(t,e,a))}catch(a){return Sf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},a1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:hx(e)}),c1e=({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 KUe}from"events";import{spawn as ZUe}from"child_process";import Bre from"process";import{once as JL,on as l1e}from"events";var Lre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(pf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),u1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),u1e=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([d1e(o,n,s),f1e(o,r,s),p1e(o,r,s)])}catch(a){throw hf(t),a}finally{s.abort(),JA(e,i)}},d1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await JL(t,"message",{signal:r});return n}for await(let[n]of l1e(t,"message",{signal:r}))if(e(n))return n},f1e=async(t,e,{signal:r})=>{await JL(t,"disconnect",{signal:r}),Tee(e)},p1e=async(t,e,{signal:r})=>{let[n]=await JL(t,"strict:error",{signal:r});throw WA(n,e)};import{once as Ure,on as h1e}from"events";var Fre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>XL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),XL=({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 m1e(t,s,a),g1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),_1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},m1e=async(t,e,r)=>{try{await Ure(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},g1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Ure(t,"strict:error",{signal:r.signal});n.error=WA(i,e),r.abort()}catch{}},_1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of h1e(r,"message",{signal:o.signal}))$re(s),yield c}catch{$re(s)}finally{o.abort(),JA(e,a),n||hf(t),i&&await t}},$re=({error:t})=>{if(t)throw t};var jre=(t,{ipc:e})=>{Object.assign(t,Gre(t,!1,e))},zre=()=>{let t=Bre,e=!0,r=Bre.channel!==void 0;return{...Gre(t,e,r),getCancelSignal:Kee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},Gre=(t,e,r)=>({sendMessage:ix.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Lre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Fre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as y1e}from"child_process";import{PassThrough as S1e,Readable as E1e,Writable as v1e,Duplex as T1e}from"stream";var qre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{zL(n);let a=new y1e;b1e(a,n),Object.assign(a,{readable:A1e,writable:x1e,duplex:w1e});let c=Sf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=R1e(c,s,i);return{subprocess:a,promise:l}},b1e=(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 S1e;return t.end(),t},A1e=()=>new E1e({read(){}}),x1e=()=>new v1e({write(){}}),w1e=()=>new T1e({read(){},write(){}}),R1e=async(t,e,r)=>Ef(t,e,r);import{createReadStream as Vre,createWriteStream as Hre}from"fs";import{Buffer as I1e}from"buffer";import{Readable as N_,Writable as C1e,Duplex as P1e}from"stream";var Yre=(t,e)=>Sx(O1e,t,e,!1),k_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},Wre={fileNumber:k_,generator:YL,asyncGenerator:YL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:P1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},O1e={input:{...Wre,fileUrl:({value:t})=>({stream:Vre(t)}),filePath:({value:{file:t}})=>({stream:Vre(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(I1e.from(t))})},output:{...Wre,fileUrl:({value:t})=>({stream:Hre(t)}),filePath:({value:{file:t,append:e}})=>({stream:Hre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C1e.fromWeb(t)}),iterable:k_,asyncIterable:k_,string:k_,uint8Array:k_}};import{on as N1e,once as Kre}from"events";import{PassThrough as k1e,getDefaultHighWaterMark as M1e}from"stream";import{finished as Xre}from"stream/promises";function kl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)e$(i);let e=t.some(({readableObjectMode:i})=>i),r=D1e(t,e),n=new QL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var D1e=(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)},QL=class extends k1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(e$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=L1e(this,this.#e,this.#o);let r=F1e({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(e$(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)}},L1e=async(t,e,r)=>{wx(t,Zre);let n=new AbortController;try{await Promise.race([$1e(t,n),U1e(t,e,r,n)])}finally{n.abort(),wx(t,-Zre)}},$1e=async(t,{signal:e})=>{try{await Xre(t,{signal:e,cleanup:!0})}catch(r){throw Qre(t,r),r}},U1e=async(t,e,r,{signal:n})=>{for await(let[i]of N1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},e$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},F1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{wx(t,Jre);let a=new AbortController;try{await Promise.race([B1e(o,e,a),j1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),z1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),wx(t,-Jre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?t$(t):G1e(t))},B1e=async(t,e,{signal:r})=>{try{await t,r.aborted||t$(e)}catch(n){r.aborted||Qre(e,n)}},j1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Xre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;ene(s)?i.add(e):tne(t,s)}},z1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Kre(t,i,{signal:o}),!t.readable)return Kre(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},G1e=t=>{t.writable&&t.end()},Qre=(t,e)=>{ene(e)?t$(t):tne(t,e)},ene=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",t$=t=>{(t.readable||t.writable)&&t.destroy()},tne=(t,e)=>{t.destroyed||(t.once("error",q1e),t.destroy(e))},q1e=()=>{},wx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Zre=2,Jre=1;import{finished as rne}from"stream/promises";var Tf=(t,e)=>{t.pipe(e),V1e(t,e),H1e(t,e)},V1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await rne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}r$(e)}},r$=t=>{t.writable&&t.end()},H1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await rne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}n$(t)}},n$=t=>{t.readable&&t.destroy()};var nne=(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)))W1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Wn.has(c)))K1e({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)}},W1e=(t,e,r,n)=>{r==="output"?Tf(t.stdio[n],e):Tf(e,t.stdio[n]);let i=Y1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Y1e=["stdin","stdout","stderr"],K1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Z1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Z1e=(t,{signal:e})=>{xi(t)&&Cl(t,J1e,e)},J1e=2;import{addAbortListener as eUe}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",i$=Symbol.for("signal-exit emitter"),o$=globalThis,X1e=Object.defineProperty.bind(Object),s$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(o$[i$])return o$[i$];X1e(o$,i$,{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{},Q1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),a$=class extends Ix{onExit(){return()=>{}}load(){}unload(){}},c$=class extends Ix{#e=l$.platform==="win32"?"SIGINT":"SIGHUP";#r=new s$;#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)}},l$=globalThis.process,{onExit:ine,load:ivt,unload:ovt}=Q1e(Rx(l$)?new c$(l$):new a$);var one=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=ine(()=>{t.kill()});eUe(n,()=>{i()})};var ane=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=FA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=tUe(r,n,i),{sourceStream:d,sourceError:f}=nUe(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}},tUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=rUe(t,e,...r),a=KA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},rUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(sne,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||XD(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(sne)(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}`)},sne=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),nUe=(t,e)=>{try{return{sourceStream:mf(t,e)}}catch(r){return{sourceError:r}}};var lne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=iUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw u$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},iUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return n$(t),n;if(e!==void 0)return r$(r),e},u$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Sf({error:t,command:cne,escapedCommand:cne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),cne="source.pipe(destination)";var une=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 oUe}from"stream/promises";var dne=(t,e,r)=>{let n=Cx.has(e)?aUe(t,e):sUe(t,e);return Cl(t,lUe,r.signal),Cl(e,uUe,r.signal),cUe(e),n},sUe=(t,e)=>{let r=kl([t]);return Tf(r,e),Cx.set(e,r),r},aUe=(t,e)=>{let r=Cx.get(e);return r.add(t),r},cUe=async t=>{try{await oUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Cx.delete(t)},Cx=new WeakMap,lUe=2,uUe=1;import{aborted as dUe}from"util";var fne=(t,e)=>t===void 0?[]:[fUe(t,e)],fUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await dUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw u$({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}=ane(t,...e),i=pUe({...n,destination:r});return i.pipe=Px.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},pUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=hUe(t,i);lne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=dne(e,o,d);return await Promise.race([une(u),...fne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},hUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as vUe}from"timers/promises";import{on as mUe}from"events";import{getDefaultHighWaterMark as gUe}from"stream";var Ox=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return _Ue(e,s),hne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},_Ue=async(t,e)=>{try{await t}catch{}finally{e.abort()}},d$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;yUe(e,s,t);let a=t.readableObjectMode&&!o;return hne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},yUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},hne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=mUe(t,"data",{signal:e.signal,highWaterMark:pne,highWatermark:pne});return SUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},f$=gUe(!0),pne=f$,SUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=EUe({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)}},EUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[vx(t,r,!e),Ex(t,i,!n,{})].filter(Boolean);var mne=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=TUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([bUe(t),d]);return}let f=GL(c,r),p=d$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([AUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},TUe=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=d$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await wre(a,t,r,o)},bUe=async t=>{await vUe(),t.readableFlowing===null&&t.resume()},AUe=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 gne(wte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},p$=async t=>{try{return await t}catch(e){return gne(e)}},gne=({bufferedData:t})=>zQ(t)?new Uint8Array(t):t;import{finished as xUe}from"stream/promises";var M_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=wUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],xUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||CUe(a,e,r,n)}finally{s.abort()}},wUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&RUe(t,r,n),n},RUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{IUe(e,r),n.call(t,...i)}},IUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},CUe=(t,e,r,n)=>{if(!PUe(t,e,r,n))throw t},PUe=(t,e,r,n=!0)=>r.propagating?_ne(t)||Nx(t):(r.propagating=!0,h$(r,e)===n?_ne(t):Nx(t)),h$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Nx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_ne=t=>t?.code==="EPIPE";var yne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>m$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),m$=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(h$(l,e)){await u;return}let[d]=await Promise.all([mne({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)?kl([t,e].filter(Boolean)):void 0,Ene=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>m$({...OUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:NUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),OUe=({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}},NUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as kUe}from"events";var vne=t=>uf(t,"ipc"),Tne=(t,e)=>{let r=UA(t);uo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var bne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=vne(o),a=ps(e,"ipc"),c=ps(r,"ipc");for await(let l of XL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Rte(t,i,c),i.push(l)),s&&Tne(l,o);return i},Ane=async(t,e)=>(await Promise.allSettled([t]),e);var xne=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=Ore(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=yne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Ene({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=[],C=bne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),O=MUe(m,t,A),k=DUe(h,A);try{return await Promise.race([Promise.all([{},kre(b),Promise.all(y),x,C,ote(t,d),...O,...k]),S,LUe(t,E),...ete(t,o,f,E),...vee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...Xee({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(_=>p$(_))),p$(x),Ane(C,R),Promise.allSettled(O),Promise.allSettled(k)])}},MUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:M_(n,i,r)),DUe=(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"}))),LUe=async(t,{signal:e})=>{let[r]=await kUe(t,"error",{signal:e});throw r};var wne=()=>({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 $Ue}from"stream";import{callbackify as UUe}from"util";import{finished as Rne}from"stream/promises";var g$=async t=>{if(t!==void 0)try{await _$(t)}catch{}},Ine=async t=>{if(t!==void 0)try{await y$(t)}catch{}},_$=async t=>{await Rne(t,{cleanup:!0,readable:!1,writable:!0})},y$=async t=>{await Rne(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 Cne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||_n.has(r),{subprocessStdout:a,waitReadableDestroy:c}=S$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=E$(a,s),{read:f,onStdoutDataDone:p}=v$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new $Ue({read:f,destroy:UUe(b$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return T$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},S$=(t,e,r)=>{let n=mf(t,e),i=D_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},E$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:f$},v$=({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(){FUe(this,s,o)},onStdoutDataDone:o}},FUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},T$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await y$(t),await n,await g$(i),await e,r.readable&&r.push(null)}catch(o){await g$(i),Pne(r,o)}},b$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await bf(r,e)&&(Pne(t,n),await kx(e,n))},Pne=(t,e)=>{Mx(t,t.readable,e)};import{Writable as BUe}from"stream";import{callbackify as One}from"util";var Nne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=A$(t,r,e),s=new BUe({...x$(n,t,i),destroy:One(R$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return w$(n,s),s},A$=(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}},x$=(t,e,r)=>({write:jUe.bind(void 0,t),final:One(zUe.bind(void 0,t,e,r))}),jUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},zUe=async(t,e,r)=>{await bf(r,e)&&(t.writable&&t.end(),await e)},w$=async(t,e,r)=>{try{await _$(t),e.writable&&e.end()}catch(n){await Ine(r),kne(e,n)}},R$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await bf(r,e),await bf(n,e)&&(kne(t,i),await kx(e,i))},kne=(t,e)=>{Mx(t,t.writable,e)};import{Duplex as GUe}from"stream";import{callbackify as qUe}from"util";var Mne=({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}=S$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=A$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=E$(c,a),{read:S,onStdoutDataDone:E}=v$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new GUe({read:S,...x$(u,t,d),destroy:qUe(VUe.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 T$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),w$(u,b,c),b},VUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([b$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),R$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var I$=(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 HUe(a,s,t)},HUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Dne=(t,{encoding:e})=>{let r=wne();t.readable=Cne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Nne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Mne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=I$.bind(void 0,t,e),t[Symbol.asyncIterator]=I$.bind(void 0,t,e,{})};var Lne=(t,e)=>{for(let[r,n]of YUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},WUe=(async()=>{})().constructor.prototype,YUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(WUe,t)]);var $ne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=JUe(t,e,r),{subprocess:f,promise:p}=QUe({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}),Lne(f,p),po.set(f,{options:u,fileDescriptors:d}),f},JUe=(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=XUe(l),d=Yre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},XUe=({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}},QUe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=ZUe(...ax(t,e,r))}catch(h){return qre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;KUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];nne(c,a,l),one(c,r,l);let d={},f=fo();c.kill=See.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=Sne(c,r),Dne(c,r),jre(c,r);let p=eFe({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}},eFe=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 xne({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=tFe({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)},tFe=({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,rFe(n,t[n],i)]));return{...t,...r}},rFe=(t,e,r)=>nFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,nFe=new Set(["env",...iL]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>iFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},iFe=({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}=oFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Dre(a,c,l):$ne(a,c,l,i)},oFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=YQ(e)?KQ(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 Une=({file:t,commandArguments:e})=>Bne(t,e),Fne=({file:t,commandArguments:e})=>({...Bne(t,e),isSync:!0}),Bne=(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]=sFe(t);return{file:r,commandArguments:n}},sFe=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(aFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},aFe=/ +/g;var jne=(t,e,r)=>{t.sync=e(cFe,r),t.s=t.sync},zne=({options:t})=>Gne(t),cFe=({options:t})=>({...Gne(t),isSync:!0}),Gne=t=>({options:{...lFe(t),...t}}),lFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},qne={preferLocal:!0};var Vne=Da(()=>({})),Ybt=Da(()=>({isSync:!0})),Hne=Da(Une),Kbt=Da(Fne),Zbt=Da(rte),Jbt=Da(zne,{},qne,jne),{sendMessage:Xbt,getOneMessage:Qbt,getEachMessage:eAt,getCancelSignal:tAt}=zre();var Wne=!1,Yne=()=>{Wne=!0},go=()=>Wne;var L_=null,Kne=t=>(L_&&L_.destroy(),L_=new gs({totalAllowedTime:t}),L_),Zne=()=>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{de.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 Jne={name:"@netlify/agent-runner-cli",type:"module",version:"1.156.0-image-prompt.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 pFe=dFe(import.meta.url),hFe=_s.dirname(pFe),mFe=fFe(import.meta.url),Af=pe("shell"),C$=new Set,Xne={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=gFe(e,r),o={...Xne,...i},s=Vne(t,n,o);eie(s,o),nie(s);let a=r?.idleTimeout;return a&&a>0&&rie(s,a),s},Qne=(t,e)=>{let r={...Xne,...e},n=Hne(t,r);return eie(n,r),nie(n),e?.idleTimeout&&e.idleTimeout>0&&rie(n,e.idleTimeout),n},gFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},eie=(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)},P$=(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}},tie=t=>P$(t,"SIGKILL"),rie=(t,e)=>{let r=null,n=()=>{Af.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),P$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing idle process ${t.pid}`),tie(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)},nie=t=>{C$.add(t);let e=Zne();if(e){let r=e.onTimesUp(()=>{Af.log(`Global timer expired, killing process ${t.pid}`),P$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing process ${t.pid} after timeout`),tie(t))},5e3)});t.on("exit",()=>{C$.delete(t),r()}),t.on("error",()=>{C$.delete(t),r()})}};function $x(t,e){return!!Ci(t,e)}function Ci(t,e){if(!ys.env.NETLIFY_LOCAL_MODE)try{let i=mFe.resolve(Jne.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(hFe,"..","node_modules",".bin",e);if(Lx.existsSync(n))return n}var _Fe=pe("utils"),yFe=t=>new Promise(e=>{setTimeout(e,t)});var O$=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 yFe(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},iie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):_Fe.error("Could not parse JSON",n))}},SFe=t=>t.charAt(0).toUpperCase()+t.slice(1),_o=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():SFe(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)),oie=(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 N$=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}},EFe=1e4,k$=(t,e=EFe)=>{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 vFe}from"crypto";import{createReadStream as TFe}from"fs";import Bx from"fs/promises";import uie from"os";import jx from"path";var sie=pe("repo"),die="runner-diffs-",fie=t=>`${die}${t}-`,pie=async t=>{let e=uie.tmpdir(),r;try{r=await Bx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(die)&&!n.startsWith(fie(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()})=>{sie.info("Getting runner diffs");let n=await AFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=wFe(o);await RFe(h,r)}sie.info("Changes after processing"),await D$(r);let s=await L$(o,r);if(await M$(s,r),i=await xFe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Bx.mkdtemp(jx.join(uie.tmpdir(),fie(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 lie(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 cie(d,h)||(f=h)}await lie(r),de.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await cie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},aie=async t=>{let e=vFe("sha256");for await(let r of TFe(t))e.update(r);return e.digest("hex")},cie=async(t,e)=>t.size===e.size&&await aie(t.path)===await aie(e.path),lie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},M$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},D$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},hie=/.. (.+)?\.log$/,bFe=[hie],AFe=async(t=process.cwd())=>{let e=await D$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
103
103
|
`).filter(i=>bFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},xFe=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()},mie=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},L$=async(t,e=process.cwd())=>{t||=await D$(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(hie)?.[1];o&&n.push(`:!${o}.log`)}),n},gie=async(t=process.cwd())=>{await Xr(["reset","--hard","HEAD"],{cwd:t})},_ie=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))},wFe=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:w3},ESt=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},vSt={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:ESt};import{Buffer as bSt}from"buffer";var wTe=(t,e)=>t?void 0:TSt.bind(void 0,e),TSt=function*(t,e){if(typeof e!="string"&&!Cr(e)&&!bSt.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},ATe=(t,e)=>t?wSt.bind(void 0,e):ASt.bind(void 0,e),wSt=function*(t,e){RTe(t,e),yield e},ASt=function*(t,e){if(RTe(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},RTe=(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 RSt}from"buffer";import{StringDecoder as xSt}from"string_decoder";var AC=(t,e,r)=>{if(r)return;if(t)return{transform:ISt.bind(void 0,new TextEncoder)};let n=new xSt(e);return{transform:OSt.bind(void 0,n),final:PSt.bind(void 0,n)}},ISt=function*(t,e){RSt.isBuffer(e)?yield bc(e):typeof e=="string"?yield t.encode(e):yield e},OSt=function*(t,e){yield Cr(e)?t.write(e):e},PSt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as xTe}from"util";var R3=xTe(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=NSt}=e[r];for await(let i of n(t))yield*RC(i,e,r+1)},ITe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*CSt(r,Number(e),t)},CSt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*RC(n,r,e+1)},OTe=xTe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),NSt=function*(t){yield t};var x3=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},PTe=(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=$St}=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*kSt(r,Number(e),t)},kSt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*zf(n,r,e+1)},$St=function*(t){yield t};var I3=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=NTe(t,o,s),l=Bf(e),u=Bf(r),d=l?R3.bind(void 0,RC,a):x3.bind(void 0,zf),f=l||u?R3.bind(void 0,ITe,a):x3.bind(void 0,Kb),p=l||u?OTe.bind(void 0,a):void 0;return{stream:new LSt({writableObjectMode:n,writableHighWaterMark:CTe(n),readableObjectMode:i,readableHighWaterMark:CTe(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=NTe(o,r,a);t=PTe(c,t)}return t},NTe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:wTe(n,a)},AC(r,o,n),wC(r,s,n,c),{transform:t,final:e},{transform:ATe(i,a)},TTe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var kTe=(t,e)=>{for(let r of DSt(t))MSt(t,r,e)},DSt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),MSt=(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=>USt(a,n));r.input=Fb(o)},USt=(t,e)=>{let r=xC(t,e,"utf8",!0);return FSt(r),Fb(r)},FSt=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 zSt,appendFileSync as VSt}from"fs";var IC=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&$g(r,n)&&!Ui.has(e)&&jSt(n)&&(t.some(({type:i,value:s})=>i==="native"&&qSt.has(s))||t.every(({type:i})=>bs.has(i))),jSt=t=>t===1||t===2,qSt=new Set(["pipe","overlapped"]),$Te=async(t,e,r,n)=>{for await(let i of t)BSt(e)||DTe(i,r,n)},LTe=(t,e,r)=>{for(let n of t)DTe(n,e,r)},BSt=t=>t._readableState.pipes.length>0,DTe=(t,e,r)=>{let n=BP(t);na({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var MTe=({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)=>HSt({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},HSt=({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=Ube(t,s,d),p=bc(f),{stdioItems:h,objectMode:m}=e[r],_=GSt([p],h,c,n),{serializedResult:y,finalResult:v=y}=WSt({chunks:_,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});YSt({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&&KSt(y,h,i),S}catch(g){return n.error=g,S}},GSt=(t,e,r,n)=>{try{return xC(t,e,r,!1)}catch(i){return n.error=i,t}},WSt=({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=XSe(t,r);return n[s]?{serializedResult:o,finalResult:A3(o,!i[s],e)}:{serializedResult:o}},YSt=({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=A3(t,!1,o);try{LTe(a,e,n)}catch(c){r.error??=c}},KSt=(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)?VSt(n,t):(r.add(s),zSt(n,t))}};var UTe=([,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)?$6([t,e]):`${t}${e}`};import{once as O3}from"events";var FTe=async(t,e)=>{let[r,n]=await JSt(t);return e.isForcefullyTerminated??=!1,[r,n]},JSt=async t=>{let[e,r]=await Promise.allSettled([O3(t,"spawn"),O3(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?jTe(t):r.value},jTe=async t=>{try{return await O3(t,"exit")}catch{return jTe(t)}},qTe=async t=>{let[e,r]=await t;if(!ZSt(e,r)&&P3(e,r))throw new no;return[e,r]},ZSt=(t,e)=>t===void 0&&e===void 0,P3=(t,e)=>t!==0||e!==null;var BTe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=XSt(t,e,r),o=s?.code==="ETIMEDOUT",a=Mbe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},XSt=(t,e,r)=>t!==void 0?t:P3(e,r)?new no:void 0;var zTe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=eEt(t,e,r),d=nEt({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return Vg(d,c,l)},eEt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=VP(t,e,r),a=tEt(r),{file:c,commandArguments:l,options:u}=uC(t,e,a);rEt(u);let d=STe(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},tEt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,rEt=({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.`)},nEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=iEt({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}=BTe(c,r),{output:h,error:m=l}=MTe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((v,S)=>Ac(v,r,S)),y=Ac(UTe(h,r),r,"all");return oEt({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},iEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{kTe(s,r);let a=sEt(r);return QSt(...dC(t,e,a))}catch(a){return zg({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},sEt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:yC(e)}),oEt=({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 Wvt}from"events";import{spawn as Yvt}from"child_process";import YTe from"process";import{once as C3,on as aEt}from"events";var VTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(Mg({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:iC(t)}),cEt({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),cEt=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([lEt(s,n,o),uEt(s,r,o),dEt(s,r,o)])}catch(a){throw Ug(t),a}finally{o.abort(),tC(e,i)}},lEt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await C3(t,"message",{signal:r});return n}for await(let[n]of aEt(t,"message",{signal:r}))if(e(n))return n},uEt=async(t,e,{signal:r})=>{await C3(t,"disconnect",{signal:r}),Pve(e)},dEt=async(t,e,{signal:r})=>{let[n]=await C3(t,"strict:error",{signal:r});throw ZP(n,e)};import{once as GTe,on as fEt}from"events";var WTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>N3({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),N3=({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 pEt(t,o,a),hEt({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),mEt({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},pEt=async(t,e,r)=>{try{await GTe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},hEt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await GTe(t,"strict:error",{signal:r.signal});n.error=ZP(i,e),r.abort()}catch{}},mEt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of fEt(r,"message",{signal:s.signal}))HTe(o),yield c}catch{HTe(o)}finally{s.abort(),tC(e,a),n||Ug(t),i&&await t}},HTe=({error:t})=>{if(t)throw t};var KTe=(t,{ipc:e})=>{Object.assign(t,ZTe(t,!1,e))},JTe=()=>{let t=YTe,e=!0,r=YTe.channel!==void 0;return{...ZTe(t,e,r),getCancelSignal:nbe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},ZTe=(t,e,r)=>({sendMessage:cC.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:VTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:WTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as gEt}from"child_process";import{PassThrough as _Et,Readable as yEt,Writable as SEt,Duplex as EEt}from"stream";var XTe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{b3(n);let a=new gEt;vEt(a,n),Object.assign(a,{readable:bEt,writable:TEt,duplex:wEt});let c=zg({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=AEt(c,o,i);return{subprocess:a,promise:l}},vEt=(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 _Et;return t.end(),t},bEt=()=>new yEt({read(){}}),TEt=()=>new SEt({write(){}}),wEt=()=>new EEt({read(){},write(){}}),AEt=async(t,e,r)=>Vg(t,e,r);import{createReadStream as QTe,createWriteStream as ewe}from"fs";import{Buffer as REt}from"buffer";import{Readable as Zb,Writable as xEt,Duplex as IEt}from"stream";var rwe=(t,e)=>TC(OEt,t,e,!1),Xb=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Au[t]}.`)},twe={fileNumber:Xb,generator:I3,asyncGenerator:I3,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:IEt.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},OEt={input:{...twe,fileUrl:({value:t})=>({stream:QTe(t)}),filePath:({value:{file:t}})=>({stream:QTe(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(REt.from(t))})},output:{...twe,fileUrl:({value:t})=>({stream:ewe(t)}),filePath:({value:{file:t,append:e}})=>({stream:ewe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:xEt.fromWeb(t)}),iterable:Xb,asyncIterable:Xb,string:Xb,uint8Array:Xb}};import{on as PEt,once as nwe}from"events";import{PassThrough as CEt,getDefaultHighWaterMark as NEt}from"stream";import{finished as owe}from"stream/promises";function Vf(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)$3(i);let e=t.some(({readableObjectMode:i})=>i),r=kEt(t,e),n=new k3({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var kEt=(t,e)=>{if(t.length===0)return NEt(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},k3=class extends CEt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if($3(e),this.#e.has(e))return;this.#e.add(e),this.#n??=$Et(this,this.#e,this.#s);let r=MEt({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($3(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)}},$Et=async(t,e,r)=>{PC(t,iwe);let n=new AbortController;try{await Promise.race([LEt(t,n),DEt(t,e,r,n)])}finally{n.abort(),PC(t,-iwe)}},LEt=async(t,{signal:e})=>{try{await owe(t,{signal:e,cleanup:!0})}catch(r){throw awe(t,r),r}},DEt=async(t,e,r,{signal:n})=>{for await(let[i]of PEt(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},$3=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},MEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{PC(t,swe);let a=new AbortController;try{await Promise.race([UEt(s,e,a),FEt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),jEt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),PC(t,-swe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?L3(t):qEt(t))},UEt=async(t,e,{signal:r})=>{try{await t,r.aborted||L3(e)}catch(n){r.aborted||awe(e,n)}},FEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await owe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;cwe(o)?i.add(e):lwe(t,o)}},jEt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await nwe(t,i,{signal:s}),!t.readable)return nwe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},qEt=t=>{t.writable&&t.end()},awe=(t,e)=>{cwe(e)?L3(t):lwe(t,e)},cwe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",L3=t=>{(t.readable||t.writable)&&t.destroy()},lwe=(t,e)=>{t.destroyed||(t.once("error",BEt),t.destroy(e))},BEt=()=>{},PC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},iwe=2,swe=1;import{finished as uwe}from"stream/promises";var Gg=(t,e)=>{t.pipe(e),zEt(t,e),VEt(t,e)},zEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await uwe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}D3(e)}},D3=t=>{t.writable&&t.end()},VEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await uwe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}M3(t)}},M3=t=>{t.readable&&t.destroy()};var dwe=(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)))HEt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!bs.has(c)))WEt({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)}},HEt=(t,e,r,n)=>{r==="output"?Gg(t.stdio[n],e):Gg(e,t.stdio[n]);let i=GEt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},GEt=["stdin","stdout","stderr"],WEt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;YEt(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},YEt=(t,{signal:e})=>{ro(t)&&jf(t,KEt,e)},KEt=2;import{addAbortListener as XEt}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",U3=Symbol.for("signal-exit emitter"),F3=globalThis,JEt=Object.defineProperty.bind(Object),j3=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(F3[U3])return F3[U3];JEt(F3,U3,{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{},ZEt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),q3=class extends NC{onExit(){return()=>{}}load(){}unload(){}},B3=class extends NC{#e=z3.platform==="win32"?"SIGINT":"SIGHUP";#r=new j3;#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)}},z3=globalThis.process,{onExit:fwe,load:tur,unload:rur}=ZEt(CC(z3)?new B3(z3):new q3);var pwe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=fwe(()=>{t.kill()});XEt(n,()=>{i()})};var mwe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=zP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=QEt(r,n,i),{sourceStream:d,sourceError:f}=tvt(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}},QEt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=evt(t,e,...r),a=QP(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},evt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(hwe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||N6(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(hwe)(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}`)},hwe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),tvt=(t,e)=>{try{return{sourceStream:Fg(t,e)}}catch(r){return{sourceError:r}}};var _we=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=rvt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw V3({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},rvt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return M3(t),n;if(e!==void 0)return D3(r),e},V3=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>zg({error:t,command:gwe,escapedCommand:gwe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),gwe="source.pipe(destination)";var ywe=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 nvt}from"stream/promises";var Swe=(t,e,r)=>{let n=kC.has(e)?svt(t,e):ivt(t,e);return jf(t,avt,r.signal),jf(e,cvt,r.signal),ovt(e),n},ivt=(t,e)=>{let r=Vf([t]);return Gg(r,e),kC.set(e,r),r},svt=(t,e)=>{let r=kC.get(e);return r.add(t),r},ovt=async t=>{try{await nvt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}kC.delete(t)},kC=new WeakMap,avt=2,cvt=1;import{aborted as lvt}from"util";var Ewe=(t,e)=>t===void 0?[]:[uvt(t,e)],uvt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await lvt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw V3({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}=mwe(t,...e),i=dvt({...n,destination:r});return i.pipe=$C.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},dvt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=fvt(t,i);_we({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Swe(e,s,d);return await Promise.race([ywe(u),...Ewe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},fvt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as Svt}from"timers/promises";import{on as pvt}from"events";import{getDefaultHighWaterMark as hvt}from"stream";var LC=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return mvt(e,o),bwe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},mvt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},H3=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;gvt(e,o,t);let a=t.readableObjectMode&&!s;return bwe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},gvt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},bwe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=pvt(t,"data",{signal:e.signal,highWaterMark:vwe,highWatermark:vwe});return _vt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},G3=hvt(!0),vwe=G3,_vt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=yvt({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)}},yvt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[AC(t,r,!e),wC(t,i,!n,{})].filter(Boolean);var Twe=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=Evt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([vvt(t),d]);return}let f=T3(c,r),p=H3({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([bvt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},Evt=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=H3({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await $Te(a,t,r,s)},vvt=async t=>{await Svt(),t.readableFlowing===null&&t.resume()},bvt=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 wwe($be({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},W3=async t=>{try{return await t}catch(e){return wwe(e)}},wwe=({bufferedData:t})=>JSe(t)?new Uint8Array(t):t;import{finished as Tvt}from"stream/promises";var Qb=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=wvt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Tvt(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||xvt(a,e,r,n)}finally{o.abort()}},wvt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Avt(t,r,n),n},Avt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Rvt(e,r),n.call(t,...i)}},Rvt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},xvt=(t,e,r,n)=>{if(!Ivt(t,e,r,n))throw t},Ivt=(t,e,r,n=!0)=>r.propagating?Awe(t)||DC(t):(r.propagating=!0,Y3(r,e)===n?Awe(t):DC(t)),Y3=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",DC=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Awe=t=>t?.code==="EPIPE";var Rwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>K3({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),K3=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(Y3(l,e)){await u;return}let[d]=await Promise.all([Twe({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 xwe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Vf([t,e].filter(Boolean)):void 0,Iwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>K3({...Ovt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Pvt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Ovt=({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}},Pvt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as Cvt}from"events";var Owe=t=>$g(t,"ipc"),Pwe=(t,e)=>{let r=BP(t);na({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Cwe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=Owe(s),a=Tc(e,"ipc"),c=Tc(r,"ipc");for await(let l of N3({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Lbe(t,i,c),i.push(l)),o&&Pwe(l,s);return i},Nwe=async(t,e)=>(await Promise.allSettled([t]),e);var kwe=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=FTe(t,f),S={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},g=Rwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),T=Iwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),I=[],x=Cwe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),A=Nvt(m,t,S),O=kvt(h,S);try{return await Promise.race([Promise.all([{},qTe(v),Promise.all(g),T,x,pbe(t,d),...A,...O]),_,$vt(t,y),...cbe(t,s,f,y),...Ove({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:y}),...obe({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=>W3(b))),W3(T),Nwe(x,I),Promise.allSettled(A),Promise.allSettled(O)])}},Nvt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Qb(n,i,r)),kvt=(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"}))),$vt=async(t,{signal:e})=>{let[r]=await Cvt(t,"error",{signal:e});throw r};var $we=()=>({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 Lvt}from"stream";import{callbackify as Dvt}from"util";import{finished as Lwe}from"stream/promises";var J3=async t=>{if(t!==void 0)try{await Z3(t)}catch{}},Dwe=async t=>{if(t!==void 0)try{await X3(t)}catch{}},Z3=async t=>{await Lwe(t,{cleanup:!0,readable:!1,writable:!0})},X3=async t=>{await Lwe(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 Mwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||Ui.has(r),{subprocessStdout:a,waitReadableDestroy:c}=Q3(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=eW(a,o),{read:f,onStdoutDataDone:p}=tW({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new Lvt({read:f,destroy:Dvt(nW.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return rW({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},Q3=(t,e,r)=>{let n=Fg(t,e),i=eT(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},eW=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:G3},tW=({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(){Mvt(this,o,s)},onStdoutDataDone:s}},Mvt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},rW=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await X3(t),await n,await J3(i),await e,r.readable&&r.push(null)}catch(s){await J3(i),Uwe(r,s)}},nW=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Wg(r,e)&&(Uwe(t,n),await MC(e,n))},Uwe=(t,e)=>{UC(t,t.readable,e)};import{Writable as Uvt}from"stream";import{callbackify as Fwe}from"util";var jwe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=iW(t,r,e),o=new Uvt({...sW(n,t,i),destroy:Fwe(aW.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return oW(n,o),o},iW=(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}},sW=(t,e,r)=>({write:Fvt.bind(void 0,t),final:Fwe(jvt.bind(void 0,t,e,r))}),Fvt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},jvt=async(t,e,r)=>{await Wg(r,e)&&(t.writable&&t.end(),await e)},oW=async(t,e,r)=>{try{await Z3(t),e.writable&&e.end()}catch(n){await Dwe(r),qwe(e,n)}},aW=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Wg(r,e),await Wg(n,e)&&(qwe(t,i),await MC(e,i))},qwe=(t,e)=>{UC(t,t.writable,e)};import{Duplex as qvt}from"stream";import{callbackify as Bvt}from"util";var Bwe=({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}=Q3(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=iW(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=eW(c,a),{read:_,onStdoutDataDone:y}=tW({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),v=new qvt({read:_,...sW(u,t,d),destroy:Bvt(zvt.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 rW({subprocessStdout:c,onStdoutDataDone:y,readable:v,subprocess:t,subprocessStdin:u}),oW(u,v,c),v},zvt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([nW({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),aW({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var cW=(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 Vvt(a,o,t)},Vvt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var zwe=(t,{encoding:e})=>{let r=$we();t.readable=Mwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=jwe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Bwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=cW.bind(void 0,t,e),t[Symbol.asyncIterator]=cW.bind(void 0,t,e,{})};var Vwe=(t,e)=>{for(let[r,n]of Gvt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Hvt=(async()=>{})().constructor.prototype,Gvt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Hvt,t)]);var Hwe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Kvt(t,e,r),{subprocess:f,promise:p}=Zvt({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}),Vwe(f,p),sa.set(f,{options:u,fileDescriptors:d}),f},Kvt=(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=Jvt(l),d=rwe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},Jvt=({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}},Zvt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=Yvt(...dC(t,e,r))}catch(h){return XTe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Wvt(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];dwe(c,a,l),pwe(c,r,l);let d={},f=ia();c.kill=xve.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=xwe(c,r),zwe(c,r),KTe(c,r);let p=Xvt({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}},Xvt=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 kwe({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=Qvt({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)},Qvt=({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,ebt(n,t[n],i)]));return{...t,...r}},ebt=(t,e,r)=>tbt.has(t)&&gr(e)&&gr(r)?{...e,...r}:r,tbt=new Set(["env",...U6]);var Ru=(t,e,r,n)=>{let i=(o,a,c)=>Ru(o,a,r,c),s=(...o)=>rbt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},rbt=({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}=nbt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?zTe(a,c,l):Hwe(a,c,l,i)},nbt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=rEe(e)?nEe(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 Gwe=({file:t,commandArguments:e})=>Ywe(t,e),Wwe=({file:t,commandArguments:e})=>({...Ywe(t,e),isSync:!0}),Ywe=(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]=ibt(t);return{file:r,commandArguments:n}},ibt=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(sbt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},sbt=/ +/g;var Kwe=(t,e,r)=>{t.sync=e(obt,r),t.s=t.sync},Jwe=({options:t})=>Zwe(t),obt=({options:t})=>({...Zwe(t),isSync:!0}),Zwe=t=>({options:{...abt(t),...t}}),abt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},Xwe={preferLocal:!0};var Qwe=Ru(()=>({})),Hfr=Ru(()=>({isSync:!0})),e0e=Ru(Gwe),Gfr=Ru(Wwe),Wfr=Ru(ube),Yfr=Ru(Jwe,{},Xwe,Kwe),{sendMessage:Kfr,getOneMessage:Jfr,getEachMessage:Zfr,getCancelSignal:Xfr}=JTe();import{Transform as cbt}from"stream";var lbt=["NETLIFY_AI_GATEWAY_KEY"];function ubt(){let t=(process.env.NETLIFY_SENSITIVE_ENV_KEYS||"").split(",").map(e=>e.trim()).filter(Boolean);return[...new Set([...t,...lbt])]}function dbt(t){let e=t.toLowerCase();return e==="true"||e==="false"?!0:t.trim().length<4}function fbt(){let e=ubt().map(r=>process.env[r]).filter(r=>!(!r||dbt(r)));return[...new Set(e)].sort((r,n)=>n.length-r.length)}function Ts(t){if(typeof t!="string")return t;let e=fbt();if(e.length===0)return t;let r=t;return e.forEach(n=>{let i=new RegExp(pbt(n),"g");r=r.replace(i,"******")}),r}function pbt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var tT=class extends cbt{constructor(e={}){super({...e,objectMode:!1})}_transform(e,r,n){let i=e.toString(),s=Ts(i);n(null,s)}},jC=Symbol("maskedWrite");function t0e(){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 r0e=!1,n0e=()=>{r0e=!0},_i=()=>r0e;var rT=null,i0e=t=>(rT&&rT.destroy(),rT=new Rc({totalAllowedTime:t}),rT),s0e=()=>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{_e.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 o0e={name:"@netlify/agent-runner-cli",type:"module",version:"1.156.0-image-prompt.2",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 _bt=mbt(import.meta.url),ybt=xc.dirname(_bt),Sbt=gbt(import.meta.url),Yg=Se("shell"),lW=new Set,a0e={preferLocal:!0},fn=(t,e,r)=>{let[n,i]=Ebt(e,r),s={...a0e,...i},o=Qwe(t,n,s);l0e(o,s),f0e(o);let a=r?.idleTimeout;return a&&a>0&&d0e(o,a),o},c0e=(t,e)=>{let r={...a0e,...e},n=e0e(t,r);return l0e(n,r),f0e(n),e?.idleTimeout&&e.idleTimeout>0&&d0e(n,e.idleTimeout),n},Ebt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},l0e=(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)},uW=(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}},u0e=t=>uW(t,"SIGKILL"),d0e=(t,e)=>{let r=null,n=()=>{Yg.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),uW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Yg.log(`Force killing idle process ${t.pid}`),u0e(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)},f0e=t=>{lW.add(t);let e=s0e();if(e){let r=e.onTimesUp(()=>{Yg.log(`Global timer expired, killing process ${t.pid}`),uW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Yg.log(`Force killing process ${t.pid} after timeout`),u0e(t))},5e3)});t.on("exit",()=>{lW.delete(t),r()}),t.on("error",()=>{lW.delete(t),r()})}};function ca(t,e){if(!Ic.env.NETLIFY_LOCAL_MODE)try{let i=Sbt.resolve(o0e.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(ybt,"..","node_modules",".bin",e);if(qC.existsSync(n))return n}import uD from"process";import{fileURLToPath as KLt}from"url";import{createRequire as JLt}from"module";import dD from"path";var vbt="__netlify__getTracer",bbt="__netlify__shutdownTracers",gt=(t,e)=>globalThis[vbt]?.(t,e),p0e=async()=>globalThis[bbt]?.();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 BLt}from"timers/promises";ke();import Twt from"process";ke();var Gbt=(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}=oAe(r,n,i);return this._tracer.startActiveSpan(e,s,o,c=>aAe(c,s,a))}withSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=oAe(r,n,i),c=this._tracer.startSpan(e,s,o);return aAe(c,s,a)}};function oAe(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 aAe(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:Gbt,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)}}ke();var t_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var VW=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=_Ae(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=_Ae(this._rawAttributes),this._schemaUrl=Wbt(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&&ce.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)){ce.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=Ybt(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function HW(t,e){return VW.FromAttributeList(Object.entries(t),e)}function _Ae(t){return t.map(([e,r])=>t_(r)?[e,r.catch(n=>{ce.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function Wbt(t){if(typeof t=="string"||t===void 0)return t;ce.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function Ybt(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;ce.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}ke();var hT=class{emit(e){}enabled(){return!1}},yAe=new hT;var mT=Symbol.for("io.opentelemetry.js.api.logs"),r_=globalThis;function SAe(t,e,r){return n=>n===t?e:r}var GW=1;var WW=class{getLogger(e,r,n){return new hT}},uN=new WW;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):yAe}};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]=SAe(GW,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_,GW))!==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 EAe=fN.getInstance();function vAe(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 bAe(t){t.forEach(e=>e.disable())}function YW(t){let e=t.tracerProvider||Rt.getTracerProvider(),r=t.meterProvider||pT.getMeterProvider(),n=t.loggerProvider||EAe.getLoggerProvider(),i=t.instrumentations?.flat()??[];return vAe(i,e,r,n),()=>{bAe(i)}}ke();var Kbt=qr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function TAe(t){return t.getValue(Kbt)===!0}var n_;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(n_||(n_={}));ke();var KW="[_0-9a-z-*/]",Jbt=`[a-z]${KW}{0,255}`,Zbt=`[a-z0-9]${KW}{0,240}@[a-z]${KW}{0,13}`,Xbt=new RegExp(`^(?:${Jbt}|${Zbt})$`),Qbt=/^[ -~]{0,255}[!-~]$/,eTt=/,|=/;function JW(t){return Xbt.test(t)}function ZW(t){return Qbt.test(t)&&!eTt.test(t)}var tTt=32,wAe=512,AAe=",",RAe="=",pN=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!JW(e)||!ZW(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>wAe)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=AAe+e),e=`${n[0]}${RAe}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(AAe),r=new Map,n=0;for(let i of e){let s=i.trim(),o=s.indexOf(RAe);if(o===-1)continue;let a=s.slice(0,o),c=s.slice(o+1);if(!JW(a)||!ZW(c))continue;let l=n+s.length+(r.size>0?1:0);if(!(l>wAe)&&(r.set(a,c),n=l,r.size>=tTt))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",rTt="00",nTt="(?!ff)[\\da-f]{2}",iTt="(?![0]{32})[\\da-f]{32}",sTt="(?![0]{16})[\\da-f]{16}",oTt="[\\da-f]{2}",aTt=new RegExp(`^\\s?(${nTt})-(${iTt})-(${sTt})-(${oTt})(-.*)?\\s?$`);function xAe(t){let e=aTt.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||TAe(e)||!yi(i))return;let s=`${rTt}-${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=xAe(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(DY(),1);ke();var lIe=t=>{throw TypeError(t)},jY=(t,e,r)=>e.has(t)||lIe("Cannot "+r),ok=(t,e,r)=>(jY(t,e,"read from private field"),r?r.call(t):e.get(t)),MY=(t,e,r)=>e.has(t)?lIe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),oIe=(t,e,r,n)=>(jY(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),bwt=(t,e,r)=>(jY(t,e,"access private method"),r),aIe="__netlify__getTracer",wwt="__netlify__shutdownTracers",Awt="__nfOTLPTrace",NT,kT,FY,uIe,Rwt=class{constructor(){MY(this,FY),MY(this,NT),MY(this,kT),oIe(this,NT,new _T(bwt(this,FY,uIe),this)),oIe(this,kT,ce.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(Awt,JSON.stringify(xwt(t))),e({code:n_.SUCCESS})}shutdown(){return ok(this,NT).call()}};NT=new WeakMap;kT=new WeakMap;FY=new WeakSet;uIe=function(){return ok(this,kT).debug("Shutting down"),Promise.resolve()};function xwt(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:UY(e.startTime),endTimeUnixNano:UY(e.endTime),attributes:sk(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:UY(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=>dIe(e,t[e]))}function dIe(t,e){return{key:t,value:fIe(e)}}function fIe(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(fIe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>dIe(r,n))}}:{}}function UY(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var cIe={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"}},pIe=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,aIe))return;let e=Twt.version.slice(1),r=HW({"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??[Iwt()],i=new ak.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new Ou});let s=t.instrumentations??[];YW({instrumentations:s,tracerProvider:i}),Object.defineProperty(globalThis,aIe,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new Cc(Rt.getTracer(a,c)):new Cc(Rt.getTracer(cIe.name,cIe.version))}}),Object.defineProperty(globalThis,wwt,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},Iwt=()=>new ak.SimpleSpanProcessor(new Rwt);ke();var $T=Mn(DY(),1);ke();import*as ck from"diagnostics_channel";var hIe=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 UDe=Mn(DDe(),1);var cD=Se("tracing"),MDe=8e3,zLt=5e3,Xw=async(t=zLt)=>{try{await Promise.race([p0e(),BLt(t)])}catch(e){cD.warn("Failed to flush tracers on shutdown",e)}},FDe=async(t,e,r)=>{if(!gt()){let n=[new $T.SimpleSpanProcessor(new qJ),new $T.SimpleSpanProcessor(new UDe.OTLPTraceExporter({url:r.exporterUrl}))];await pIe({serviceName:"@netlify/agent-runner-cli",serviceVersion:t,deploymentEnvironment:"production",siteUrl:"",siteId:process.env.SITE_ID??"",siteName:e,spanProcessors:n,instrumentations:[new hIe({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 qJ=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 BJ(){return Ze().captureLlmContentEnabled}function jDe(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 VLt=new Set([Q.Task,Q.RunCommand,Q.Explore,Q.FileRead,Q.FileWrite,Q.Notebook,Q.Web,Q.Todo,Q.Skill,Q.Tool,Q.Memorize,Q.Deployment,Q.SiteGeneration]);function qDe(t,e,r,n){if(!t.length)return;let i=gt();if(!i)return;let s=BJ(),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&&VLt.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>MDe?`${a.message.slice(0,MDe)}\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 HLt,rm as GLt}from"fs/promises";import{join as WLt}from"path";async function BDe(t,e=[]){let n=(await HLt(t)).filter(i=>!e.includes(i));await Promise.all(n.map(i=>GLt(WLt(t,i),{recursive:!0,force:!0})))}var YLt=700,zDe=t=>t.mode==="create"&&(t.accountType===wl||t.enforcedAICreditsRemaining!=null&&t.enforcedAICreditsRemaining<=YLt);var ZLt=dD.dirname(KLt(import.meta.url)),VDe=JLt(import.meta.url),XLt=dD.resolve(ZLt,"scripts/scaffold.js"),QLt="scripts/scaffold.js",eDt=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+/g,zJ=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},tDt=t=>/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(t),rDt=t=>{let e=zJ(t);return e==="node"||e.endsWith("/node")},tl=t=>{if(typeof t!="string")return!1;let e=t.match(eDt)||[];if(e.length<2)return!1;let r=0;for(;r<e.length&&tDt(zJ(e[r]));)r+=1;if(r>=e.length||!rDt(e[r]))return!1;let n=e[r+1];return n?zJ(n).includes(QLt):!1},hy=Se("create_stage"),HDe="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.",nDt=`${HDe}
|
|
590
|
+
if (condition) { yield value; }`)};import{Buffer as RSt}from"buffer";import{StringDecoder as xSt}from"string_decoder";var AC=(t,e,r)=>{if(r)return;if(t)return{transform:ISt.bind(void 0,new TextEncoder)};let n=new xSt(e);return{transform:OSt.bind(void 0,n),final:PSt.bind(void 0,n)}},ISt=function*(t,e){RSt.isBuffer(e)?yield bc(e):typeof e=="string"?yield t.encode(e):yield e},OSt=function*(t,e){yield Cr(e)?t.write(e):e},PSt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as xTe}from"util";var R3=xTe(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=NSt}=e[r];for await(let i of n(t))yield*RC(i,e,r+1)},ITe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*CSt(r,Number(e),t)},CSt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*RC(n,r,e+1)},OTe=xTe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),NSt=function*(t){yield t};var x3=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},PTe=(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=$St}=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*kSt(r,Number(e),t)},kSt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*zf(n,r,e+1)},$St=function*(t){yield t};var I3=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=NTe(t,o,s),l=Bf(e),u=Bf(r),d=l?R3.bind(void 0,RC,a):x3.bind(void 0,zf),f=l||u?R3.bind(void 0,ITe,a):x3.bind(void 0,Kb),p=l||u?OTe.bind(void 0,a):void 0;return{stream:new LSt({writableObjectMode:n,writableHighWaterMark:CTe(n),readableObjectMode:i,readableHighWaterMark:CTe(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=NTe(o,r,a);t=PTe(c,t)}return t},NTe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:wTe(n,a)},AC(r,o,n),wC(r,s,n,c),{transform:t,final:e},{transform:ATe(i,a)},TTe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var kTe=(t,e)=>{for(let r of DSt(t))MSt(t,r,e)},DSt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),MSt=(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=>USt(a,n));r.input=Fb(o)},USt=(t,e)=>{let r=xC(t,e,"utf8",!0);return FSt(r),Fb(r)},FSt=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 zSt,appendFileSync as VSt}from"fs";var IC=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&$g(r,n)&&!Ui.has(e)&&jSt(n)&&(t.some(({type:i,value:s})=>i==="native"&&qSt.has(s))||t.every(({type:i})=>bs.has(i))),jSt=t=>t===1||t===2,qSt=new Set(["pipe","overlapped"]),$Te=async(t,e,r,n)=>{for await(let i of t)BSt(e)||DTe(i,r,n)},LTe=(t,e,r)=>{for(let n of t)DTe(n,e,r)},BSt=t=>t._readableState.pipes.length>0,DTe=(t,e,r)=>{let n=BP(t);na({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var MTe=({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)=>HSt({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},HSt=({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=Ube(t,s,d),p=bc(f),{stdioItems:h,objectMode:m}=e[r],_=GSt([p],h,c,n),{serializedResult:y,finalResult:v=y}=WSt({chunks:_,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});YSt({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&&KSt(y,h,i),S}catch(g){return n.error=g,S}},GSt=(t,e,r,n)=>{try{return xC(t,e,r,!1)}catch(i){return n.error=i,t}},WSt=({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=XSe(t,r);return n[s]?{serializedResult:o,finalResult:A3(o,!i[s],e)}:{serializedResult:o}},YSt=({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=A3(t,!1,o);try{LTe(a,e,n)}catch(c){r.error??=c}},KSt=(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)?VSt(n,t):(r.add(s),zSt(n,t))}};var UTe=([,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)?$6([t,e]):`${t}${e}`};import{once as O3}from"events";var FTe=async(t,e)=>{let[r,n]=await JSt(t);return e.isForcefullyTerminated??=!1,[r,n]},JSt=async t=>{let[e,r]=await Promise.allSettled([O3(t,"spawn"),O3(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?jTe(t):r.value},jTe=async t=>{try{return await O3(t,"exit")}catch{return jTe(t)}},qTe=async t=>{let[e,r]=await t;if(!ZSt(e,r)&&P3(e,r))throw new no;return[e,r]},ZSt=(t,e)=>t===void 0&&e===void 0,P3=(t,e)=>t!==0||e!==null;var BTe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=XSt(t,e,r),o=s?.code==="ETIMEDOUT",a=Mbe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},XSt=(t,e,r)=>t!==void 0?t:P3(e,r)?new no:void 0;var zTe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=eEt(t,e,r),d=nEt({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return Vg(d,c,l)},eEt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=VP(t,e,r),a=tEt(r),{file:c,commandArguments:l,options:u}=uC(t,e,a);rEt(u);let d=STe(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},tEt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,rEt=({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.`)},nEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=iEt({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}=BTe(c,r),{output:h,error:m=l}=MTe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((v,S)=>Ac(v,r,S)),y=Ac(UTe(h,r),r,"all");return oEt({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},iEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{kTe(s,r);let a=sEt(r);return QSt(...dC(t,e,a))}catch(a){return zg({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},sEt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:yC(e)}),oEt=({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 Wvt}from"events";import{spawn as Yvt}from"child_process";import YTe from"process";import{once as C3,on as aEt}from"events";var VTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(Mg({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:iC(t)}),cEt({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),cEt=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([lEt(s,n,o),uEt(s,r,o),dEt(s,r,o)])}catch(a){throw Ug(t),a}finally{o.abort(),tC(e,i)}},lEt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await C3(t,"message",{signal:r});return n}for await(let[n]of aEt(t,"message",{signal:r}))if(e(n))return n},uEt=async(t,e,{signal:r})=>{await C3(t,"disconnect",{signal:r}),Pve(e)},dEt=async(t,e,{signal:r})=>{let[n]=await C3(t,"strict:error",{signal:r});throw ZP(n,e)};import{once as GTe,on as fEt}from"events";var WTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>N3({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),N3=({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 pEt(t,o,a),hEt({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),mEt({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},pEt=async(t,e,r)=>{try{await GTe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},hEt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await GTe(t,"strict:error",{signal:r.signal});n.error=ZP(i,e),r.abort()}catch{}},mEt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of fEt(r,"message",{signal:s.signal}))HTe(o),yield c}catch{HTe(o)}finally{s.abort(),tC(e,a),n||Ug(t),i&&await t}},HTe=({error:t})=>{if(t)throw t};var KTe=(t,{ipc:e})=>{Object.assign(t,ZTe(t,!1,e))},JTe=()=>{let t=YTe,e=!0,r=YTe.channel!==void 0;return{...ZTe(t,e,r),getCancelSignal:nbe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},ZTe=(t,e,r)=>({sendMessage:cC.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:VTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:WTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as gEt}from"child_process";import{PassThrough as _Et,Readable as yEt,Writable as SEt,Duplex as EEt}from"stream";var XTe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{b3(n);let a=new gEt;vEt(a,n),Object.assign(a,{readable:bEt,writable:TEt,duplex:wEt});let c=zg({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=AEt(c,o,i);return{subprocess:a,promise:l}},vEt=(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 _Et;return t.end(),t},bEt=()=>new yEt({read(){}}),TEt=()=>new SEt({write(){}}),wEt=()=>new EEt({read(){},write(){}}),AEt=async(t,e,r)=>Vg(t,e,r);import{createReadStream as QTe,createWriteStream as ewe}from"fs";import{Buffer as REt}from"buffer";import{Readable as Zb,Writable as xEt,Duplex as IEt}from"stream";var rwe=(t,e)=>TC(OEt,t,e,!1),Xb=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Au[t]}.`)},twe={fileNumber:Xb,generator:I3,asyncGenerator:I3,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:IEt.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},OEt={input:{...twe,fileUrl:({value:t})=>({stream:QTe(t)}),filePath:({value:{file:t}})=>({stream:QTe(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(REt.from(t))})},output:{...twe,fileUrl:({value:t})=>({stream:ewe(t)}),filePath:({value:{file:t,append:e}})=>({stream:ewe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:xEt.fromWeb(t)}),iterable:Xb,asyncIterable:Xb,string:Xb,uint8Array:Xb}};import{on as PEt,once as nwe}from"events";import{PassThrough as CEt,getDefaultHighWaterMark as NEt}from"stream";import{finished as owe}from"stream/promises";function Vf(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)$3(i);let e=t.some(({readableObjectMode:i})=>i),r=kEt(t,e),n=new k3({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var kEt=(t,e)=>{if(t.length===0)return NEt(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},k3=class extends CEt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if($3(e),this.#e.has(e))return;this.#e.add(e),this.#n??=$Et(this,this.#e,this.#s);let r=MEt({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($3(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)}},$Et=async(t,e,r)=>{PC(t,iwe);let n=new AbortController;try{await Promise.race([LEt(t,n),DEt(t,e,r,n)])}finally{n.abort(),PC(t,-iwe)}},LEt=async(t,{signal:e})=>{try{await owe(t,{signal:e,cleanup:!0})}catch(r){throw awe(t,r),r}},DEt=async(t,e,r,{signal:n})=>{for await(let[i]of PEt(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},$3=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},MEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{PC(t,swe);let a=new AbortController;try{await Promise.race([UEt(s,e,a),FEt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),jEt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),PC(t,-swe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?L3(t):qEt(t))},UEt=async(t,e,{signal:r})=>{try{await t,r.aborted||L3(e)}catch(n){r.aborted||awe(e,n)}},FEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await owe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;cwe(o)?i.add(e):lwe(t,o)}},jEt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await nwe(t,i,{signal:s}),!t.readable)return nwe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},qEt=t=>{t.writable&&t.end()},awe=(t,e)=>{cwe(e)?L3(t):lwe(t,e)},cwe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",L3=t=>{(t.readable||t.writable)&&t.destroy()},lwe=(t,e)=>{t.destroyed||(t.once("error",BEt),t.destroy(e))},BEt=()=>{},PC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},iwe=2,swe=1;import{finished as uwe}from"stream/promises";var Gg=(t,e)=>{t.pipe(e),zEt(t,e),VEt(t,e)},zEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await uwe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}D3(e)}},D3=t=>{t.writable&&t.end()},VEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await uwe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}M3(t)}},M3=t=>{t.readable&&t.destroy()};var dwe=(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)))HEt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!bs.has(c)))WEt({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)}},HEt=(t,e,r,n)=>{r==="output"?Gg(t.stdio[n],e):Gg(e,t.stdio[n]);let i=GEt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},GEt=["stdin","stdout","stderr"],WEt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;YEt(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},YEt=(t,{signal:e})=>{ro(t)&&jf(t,KEt,e)},KEt=2;import{addAbortListener as XEt}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",U3=Symbol.for("signal-exit emitter"),F3=globalThis,JEt=Object.defineProperty.bind(Object),j3=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(F3[U3])return F3[U3];JEt(F3,U3,{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{},ZEt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),q3=class extends NC{onExit(){return()=>{}}load(){}unload(){}},B3=class extends NC{#e=z3.platform==="win32"?"SIGINT":"SIGHUP";#r=new j3;#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)}},z3=globalThis.process,{onExit:fwe,load:tur,unload:rur}=ZEt(CC(z3)?new B3(z3):new q3);var pwe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=fwe(()=>{t.kill()});XEt(n,()=>{i()})};var mwe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=zP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=QEt(r,n,i),{sourceStream:d,sourceError:f}=tvt(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}},QEt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=evt(t,e,...r),a=QP(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},evt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(hwe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||N6(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(hwe)(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}`)},hwe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),tvt=(t,e)=>{try{return{sourceStream:Fg(t,e)}}catch(r){return{sourceError:r}}};var _we=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=rvt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw V3({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},rvt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return M3(t),n;if(e!==void 0)return D3(r),e},V3=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>zg({error:t,command:gwe,escapedCommand:gwe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),gwe="source.pipe(destination)";var ywe=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 nvt}from"stream/promises";var Swe=(t,e,r)=>{let n=kC.has(e)?svt(t,e):ivt(t,e);return jf(t,avt,r.signal),jf(e,cvt,r.signal),ovt(e),n},ivt=(t,e)=>{let r=Vf([t]);return Gg(r,e),kC.set(e,r),r},svt=(t,e)=>{let r=kC.get(e);return r.add(t),r},ovt=async t=>{try{await nvt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}kC.delete(t)},kC=new WeakMap,avt=2,cvt=1;import{aborted as lvt}from"util";var Ewe=(t,e)=>t===void 0?[]:[uvt(t,e)],uvt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await lvt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw V3({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}=mwe(t,...e),i=dvt({...n,destination:r});return i.pipe=$C.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},dvt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=fvt(t,i);_we({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Swe(e,s,d);return await Promise.race([ywe(u),...Ewe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},fvt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as Svt}from"timers/promises";import{on as pvt}from"events";import{getDefaultHighWaterMark as hvt}from"stream";var LC=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return mvt(e,o),bwe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},mvt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},H3=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;gvt(e,o,t);let a=t.readableObjectMode&&!s;return bwe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},gvt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},bwe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=pvt(t,"data",{signal:e.signal,highWaterMark:vwe,highWatermark:vwe});return _vt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},G3=hvt(!0),vwe=G3,_vt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=yvt({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)}},yvt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[AC(t,r,!e),wC(t,i,!n,{})].filter(Boolean);var Twe=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=Evt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([vvt(t),d]);return}let f=T3(c,r),p=H3({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([bvt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},Evt=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=H3({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await $Te(a,t,r,s)},vvt=async t=>{await Svt(),t.readableFlowing===null&&t.resume()},bvt=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 wwe($be({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},W3=async t=>{try{return await t}catch(e){return wwe(e)}},wwe=({bufferedData:t})=>JSe(t)?new Uint8Array(t):t;import{finished as Tvt}from"stream/promises";var Qb=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=wvt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Tvt(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||xvt(a,e,r,n)}finally{o.abort()}},wvt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Avt(t,r,n),n},Avt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Rvt(e,r),n.call(t,...i)}},Rvt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},xvt=(t,e,r,n)=>{if(!Ivt(t,e,r,n))throw t},Ivt=(t,e,r,n=!0)=>r.propagating?Awe(t)||DC(t):(r.propagating=!0,Y3(r,e)===n?Awe(t):DC(t)),Y3=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",DC=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Awe=t=>t?.code==="EPIPE";var Rwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>K3({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),K3=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(Y3(l,e)){await u;return}let[d]=await Promise.all([Twe({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 xwe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Vf([t,e].filter(Boolean)):void 0,Iwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>K3({...Ovt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Pvt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Ovt=({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}},Pvt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as Cvt}from"events";var Owe=t=>$g(t,"ipc"),Pwe=(t,e)=>{let r=BP(t);na({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Cwe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=Owe(s),a=Tc(e,"ipc"),c=Tc(r,"ipc");for await(let l of N3({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Lbe(t,i,c),i.push(l)),o&&Pwe(l,s);return i},Nwe=async(t,e)=>(await Promise.allSettled([t]),e);var kwe=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=FTe(t,f),S={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},g=Rwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),T=Iwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),I=[],x=Cwe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),A=Nvt(m,t,S),O=kvt(h,S);try{return await Promise.race([Promise.all([{},qTe(v),Promise.all(g),T,x,pbe(t,d),...A,...O]),_,$vt(t,y),...cbe(t,s,f,y),...Ove({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:y}),...obe({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=>W3(b))),W3(T),Nwe(x,I),Promise.allSettled(A),Promise.allSettled(O)])}},Nvt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Qb(n,i,r)),kvt=(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"}))),$vt=async(t,{signal:e})=>{let[r]=await Cvt(t,"error",{signal:e});throw r};var $we=()=>({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 Lvt}from"stream";import{callbackify as Dvt}from"util";import{finished as Lwe}from"stream/promises";var J3=async t=>{if(t!==void 0)try{await Z3(t)}catch{}},Dwe=async t=>{if(t!==void 0)try{await X3(t)}catch{}},Z3=async t=>{await Lwe(t,{cleanup:!0,readable:!1,writable:!0})},X3=async t=>{await Lwe(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 Mwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||Ui.has(r),{subprocessStdout:a,waitReadableDestroy:c}=Q3(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=eW(a,o),{read:f,onStdoutDataDone:p}=tW({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new Lvt({read:f,destroy:Dvt(nW.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return rW({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},Q3=(t,e,r)=>{let n=Fg(t,e),i=eT(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},eW=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:G3},tW=({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(){Mvt(this,o,s)},onStdoutDataDone:s}},Mvt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},rW=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await X3(t),await n,await J3(i),await e,r.readable&&r.push(null)}catch(s){await J3(i),Uwe(r,s)}},nW=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Wg(r,e)&&(Uwe(t,n),await MC(e,n))},Uwe=(t,e)=>{UC(t,t.readable,e)};import{Writable as Uvt}from"stream";import{callbackify as Fwe}from"util";var jwe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=iW(t,r,e),o=new Uvt({...sW(n,t,i),destroy:Fwe(aW.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return oW(n,o),o},iW=(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}},sW=(t,e,r)=>({write:Fvt.bind(void 0,t),final:Fwe(jvt.bind(void 0,t,e,r))}),Fvt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},jvt=async(t,e,r)=>{await Wg(r,e)&&(t.writable&&t.end(),await e)},oW=async(t,e,r)=>{try{await Z3(t),e.writable&&e.end()}catch(n){await Dwe(r),qwe(e,n)}},aW=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Wg(r,e),await Wg(n,e)&&(qwe(t,i),await MC(e,i))},qwe=(t,e)=>{UC(t,t.writable,e)};import{Duplex as qvt}from"stream";import{callbackify as Bvt}from"util";var Bwe=({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}=Q3(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=iW(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=eW(c,a),{read:_,onStdoutDataDone:y}=tW({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),v=new qvt({read:_,...sW(u,t,d),destroy:Bvt(zvt.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 rW({subprocessStdout:c,onStdoutDataDone:y,readable:v,subprocess:t,subprocessStdin:u}),oW(u,v,c),v},zvt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([nW({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),aW({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var cW=(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 Vvt(a,o,t)},Vvt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var zwe=(t,{encoding:e})=>{let r=$we();t.readable=Mwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=jwe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Bwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=cW.bind(void 0,t,e),t[Symbol.asyncIterator]=cW.bind(void 0,t,e,{})};var Vwe=(t,e)=>{for(let[r,n]of Gvt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Hvt=(async()=>{})().constructor.prototype,Gvt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Hvt,t)]);var Hwe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Kvt(t,e,r),{subprocess:f,promise:p}=Zvt({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}),Vwe(f,p),sa.set(f,{options:u,fileDescriptors:d}),f},Kvt=(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=Jvt(l),d=rwe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},Jvt=({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}},Zvt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=Yvt(...dC(t,e,r))}catch(h){return XTe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Wvt(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];dwe(c,a,l),pwe(c,r,l);let d={},f=ia();c.kill=xve.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=xwe(c,r),zwe(c,r),KTe(c,r);let p=Xvt({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}},Xvt=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 kwe({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=Qvt({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)},Qvt=({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,ebt(n,t[n],i)]));return{...t,...r}},ebt=(t,e,r)=>tbt.has(t)&&gr(e)&&gr(r)?{...e,...r}:r,tbt=new Set(["env",...U6]);var Ru=(t,e,r,n)=>{let i=(o,a,c)=>Ru(o,a,r,c),s=(...o)=>rbt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},rbt=({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}=nbt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?zTe(a,c,l):Hwe(a,c,l,i)},nbt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=rEe(e)?nEe(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 Gwe=({file:t,commandArguments:e})=>Ywe(t,e),Wwe=({file:t,commandArguments:e})=>({...Ywe(t,e),isSync:!0}),Ywe=(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]=ibt(t);return{file:r,commandArguments:n}},ibt=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(sbt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},sbt=/ +/g;var Kwe=(t,e,r)=>{t.sync=e(obt,r),t.s=t.sync},Jwe=({options:t})=>Zwe(t),obt=({options:t})=>({...Zwe(t),isSync:!0}),Zwe=t=>({options:{...abt(t),...t}}),abt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},Xwe={preferLocal:!0};var Qwe=Ru(()=>({})),Hfr=Ru(()=>({isSync:!0})),e0e=Ru(Gwe),Gfr=Ru(Wwe),Wfr=Ru(ube),Yfr=Ru(Jwe,{},Xwe,Kwe),{sendMessage:Kfr,getOneMessage:Jfr,getEachMessage:Zfr,getCancelSignal:Xfr}=JTe();import{Transform as cbt}from"stream";var lbt=["NETLIFY_AI_GATEWAY_KEY"];function ubt(){let t=(process.env.NETLIFY_SENSITIVE_ENV_KEYS||"").split(",").map(e=>e.trim()).filter(Boolean);return[...new Set([...t,...lbt])]}function dbt(t){let e=t.toLowerCase();return e==="true"||e==="false"?!0:t.trim().length<4}function fbt(){let e=ubt().map(r=>process.env[r]).filter(r=>!(!r||dbt(r)));return[...new Set(e)].sort((r,n)=>n.length-r.length)}function Ts(t){if(typeof t!="string")return t;let e=fbt();if(e.length===0)return t;let r=t;return e.forEach(n=>{let i=new RegExp(pbt(n),"g");r=r.replace(i,"******")}),r}function pbt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var tT=class extends cbt{constructor(e={}){super({...e,objectMode:!1})}_transform(e,r,n){let i=e.toString(),s=Ts(i);n(null,s)}},jC=Symbol("maskedWrite");function t0e(){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 r0e=!1,n0e=()=>{r0e=!0},_i=()=>r0e;var rT=null,i0e=t=>(rT&&rT.destroy(),rT=new Rc({totalAllowedTime:t}),rT),s0e=()=>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{_e.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 o0e={name:"@netlify/agent-runner-cli",type:"module",version:"1.156.0-image-prompt.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 _bt=mbt(import.meta.url),ybt=xc.dirname(_bt),Sbt=gbt(import.meta.url),Yg=Se("shell"),lW=new Set,a0e={preferLocal:!0},fn=(t,e,r)=>{let[n,i]=Ebt(e,r),s={...a0e,...i},o=Qwe(t,n,s);l0e(o,s),f0e(o);let a=r?.idleTimeout;return a&&a>0&&d0e(o,a),o},c0e=(t,e)=>{let r={...a0e,...e},n=e0e(t,r);return l0e(n,r),f0e(n),e?.idleTimeout&&e.idleTimeout>0&&d0e(n,e.idleTimeout),n},Ebt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},l0e=(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)},uW=(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}},u0e=t=>uW(t,"SIGKILL"),d0e=(t,e)=>{let r=null,n=()=>{Yg.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),uW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Yg.log(`Force killing idle process ${t.pid}`),u0e(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)},f0e=t=>{lW.add(t);let e=s0e();if(e){let r=e.onTimesUp(()=>{Yg.log(`Global timer expired, killing process ${t.pid}`),uW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Yg.log(`Force killing process ${t.pid} after timeout`),u0e(t))},5e3)});t.on("exit",()=>{lW.delete(t),r()}),t.on("error",()=>{lW.delete(t),r()})}};function ca(t,e){if(!Ic.env.NETLIFY_LOCAL_MODE)try{let i=Sbt.resolve(o0e.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(ybt,"..","node_modules",".bin",e);if(qC.existsSync(n))return n}import uD from"process";import{fileURLToPath as KLt}from"url";import{createRequire as JLt}from"module";import dD from"path";var vbt="__netlify__getTracer",bbt="__netlify__shutdownTracers",gt=(t,e)=>globalThis[vbt]?.(t,e),p0e=async()=>globalThis[bbt]?.();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 BLt}from"timers/promises";ke();import Twt from"process";ke();var Gbt=(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}=oAe(r,n,i);return this._tracer.startActiveSpan(e,s,o,c=>aAe(c,s,a))}withSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=oAe(r,n,i),c=this._tracer.startSpan(e,s,o);return aAe(c,s,a)}};function oAe(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 aAe(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:Gbt,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)}}ke();var t_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var VW=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=_Ae(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=_Ae(this._rawAttributes),this._schemaUrl=Wbt(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&&ce.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)){ce.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=Ybt(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function HW(t,e){return VW.FromAttributeList(Object.entries(t),e)}function _Ae(t){return t.map(([e,r])=>t_(r)?[e,r.catch(n=>{ce.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function Wbt(t){if(typeof t=="string"||t===void 0)return t;ce.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function Ybt(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;ce.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}ke();var hT=class{emit(e){}enabled(){return!1}},yAe=new hT;var mT=Symbol.for("io.opentelemetry.js.api.logs"),r_=globalThis;function SAe(t,e,r){return n=>n===t?e:r}var GW=1;var WW=class{getLogger(e,r,n){return new hT}},uN=new WW;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):yAe}};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]=SAe(GW,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_,GW))!==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 EAe=fN.getInstance();function vAe(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 bAe(t){t.forEach(e=>e.disable())}function YW(t){let e=t.tracerProvider||Rt.getTracerProvider(),r=t.meterProvider||pT.getMeterProvider(),n=t.loggerProvider||EAe.getLoggerProvider(),i=t.instrumentations?.flat()??[];return vAe(i,e,r,n),()=>{bAe(i)}}ke();var Kbt=qr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function TAe(t){return t.getValue(Kbt)===!0}var n_;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(n_||(n_={}));ke();var KW="[_0-9a-z-*/]",Jbt=`[a-z]${KW}{0,255}`,Zbt=`[a-z0-9]${KW}{0,240}@[a-z]${KW}{0,13}`,Xbt=new RegExp(`^(?:${Jbt}|${Zbt})$`),Qbt=/^[ -~]{0,255}[!-~]$/,eTt=/,|=/;function JW(t){return Xbt.test(t)}function ZW(t){return Qbt.test(t)&&!eTt.test(t)}var tTt=32,wAe=512,AAe=",",RAe="=",pN=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!JW(e)||!ZW(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>wAe)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=AAe+e),e=`${n[0]}${RAe}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(AAe),r=new Map,n=0;for(let i of e){let s=i.trim(),o=s.indexOf(RAe);if(o===-1)continue;let a=s.slice(0,o),c=s.slice(o+1);if(!JW(a)||!ZW(c))continue;let l=n+s.length+(r.size>0?1:0);if(!(l>wAe)&&(r.set(a,c),n=l,r.size>=tTt))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",rTt="00",nTt="(?!ff)[\\da-f]{2}",iTt="(?![0]{32})[\\da-f]{32}",sTt="(?![0]{16})[\\da-f]{16}",oTt="[\\da-f]{2}",aTt=new RegExp(`^\\s?(${nTt})-(${iTt})-(${sTt})-(${oTt})(-.*)?\\s?$`);function xAe(t){let e=aTt.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||TAe(e)||!yi(i))return;let s=`${rTt}-${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=xAe(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(DY(),1);ke();var lIe=t=>{throw TypeError(t)},jY=(t,e,r)=>e.has(t)||lIe("Cannot "+r),ok=(t,e,r)=>(jY(t,e,"read from private field"),r?r.call(t):e.get(t)),MY=(t,e,r)=>e.has(t)?lIe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),oIe=(t,e,r,n)=>(jY(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),bwt=(t,e,r)=>(jY(t,e,"access private method"),r),aIe="__netlify__getTracer",wwt="__netlify__shutdownTracers",Awt="__nfOTLPTrace",NT,kT,FY,uIe,Rwt=class{constructor(){MY(this,FY),MY(this,NT),MY(this,kT),oIe(this,NT,new _T(bwt(this,FY,uIe),this)),oIe(this,kT,ce.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(Awt,JSON.stringify(xwt(t))),e({code:n_.SUCCESS})}shutdown(){return ok(this,NT).call()}};NT=new WeakMap;kT=new WeakMap;FY=new WeakSet;uIe=function(){return ok(this,kT).debug("Shutting down"),Promise.resolve()};function xwt(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:UY(e.startTime),endTimeUnixNano:UY(e.endTime),attributes:sk(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:UY(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=>dIe(e,t[e]))}function dIe(t,e){return{key:t,value:fIe(e)}}function fIe(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(fIe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>dIe(r,n))}}:{}}function UY(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var cIe={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"}},pIe=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,aIe))return;let e=Twt.version.slice(1),r=HW({"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??[Iwt()],i=new ak.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new Ou});let s=t.instrumentations??[];YW({instrumentations:s,tracerProvider:i}),Object.defineProperty(globalThis,aIe,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new Cc(Rt.getTracer(a,c)):new Cc(Rt.getTracer(cIe.name,cIe.version))}}),Object.defineProperty(globalThis,wwt,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},Iwt=()=>new ak.SimpleSpanProcessor(new Rwt);ke();var $T=Mn(DY(),1);ke();import*as ck from"diagnostics_channel";var hIe=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 UDe=Mn(DDe(),1);var cD=Se("tracing"),MDe=8e3,zLt=5e3,Xw=async(t=zLt)=>{try{await Promise.race([p0e(),BLt(t)])}catch(e){cD.warn("Failed to flush tracers on shutdown",e)}},FDe=async(t,e,r)=>{if(!gt()){let n=[new $T.SimpleSpanProcessor(new qJ),new $T.SimpleSpanProcessor(new UDe.OTLPTraceExporter({url:r.exporterUrl}))];await pIe({serviceName:"@netlify/agent-runner-cli",serviceVersion:t,deploymentEnvironment:"production",siteUrl:"",siteId:process.env.SITE_ID??"",siteName:e,spanProcessors:n,instrumentations:[new hIe({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 qJ=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 BJ(){return Ze().captureLlmContentEnabled}function jDe(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 VLt=new Set([Q.Task,Q.RunCommand,Q.Explore,Q.FileRead,Q.FileWrite,Q.Notebook,Q.Web,Q.Todo,Q.Skill,Q.Tool,Q.Memorize,Q.Deployment,Q.SiteGeneration]);function qDe(t,e,r,n){if(!t.length)return;let i=gt();if(!i)return;let s=BJ(),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&&VLt.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>MDe?`${a.message.slice(0,MDe)}\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 HLt,rm as GLt}from"fs/promises";import{join as WLt}from"path";async function BDe(t,e=[]){let n=(await HLt(t)).filter(i=>!e.includes(i));await Promise.all(n.map(i=>GLt(WLt(t,i),{recursive:!0,force:!0})))}var YLt=700,zDe=t=>t.mode==="create"&&(t.accountType===wl||t.enforcedAICreditsRemaining!=null&&t.enforcedAICreditsRemaining<=YLt);var ZLt=dD.dirname(KLt(import.meta.url)),VDe=JLt(import.meta.url),XLt=dD.resolve(ZLt,"scripts/scaffold.js"),QLt="scripts/scaffold.js",eDt=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+/g,zJ=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},tDt=t=>/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(t),rDt=t=>{let e=zJ(t);return e==="node"||e.endsWith("/node")},tl=t=>{if(typeof t!="string")return!1;let e=t.match(eDt)||[];if(e.length<2)return!1;let r=0;for(;r<e.length&&tDt(zJ(e[r]));)r+=1;if(r>=e.length||!rDt(e[r]))return!1;let n=e[r+1];return n?zJ(n).includes(QLt):!1},hy=Se("create_stage"),HDe="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.",nDt=`${HDe}
|
|
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.`,iDt=`${HDe}
|
|
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:UL},s$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},a$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:s$e};import{Buffer as c$e}from"buffer";var ore=(t,e)=>t?void 0:l$e.bind(void 0,e),l$e=function*(t,e){if(typeof e!="string"&&!jt(e)&&!c$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},sre=(t,e)=>t?u$e.bind(void 0,e):d$e.bind(void 0,e),u$e=function*(t,e){are(t,e),yield e},d$e=function*(t,e){if(are(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},are=(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 f$e}from"buffer";import{StringDecoder as p$e}from"string_decoder";var gx=(t,e,r)=>{if(r)return;if(t)return{transform:h$e.bind(void 0,new TextEncoder)};let n=new p$e(e);return{transform:m$e.bind(void 0,n),final:g$e.bind(void 0,n)}},h$e=function*(t,e){f$e.isBuffer(e)?yield ls(e):typeof e=="string"?yield t.encode(e):yield e},m$e=function*(t,e){yield jt(e)?t.write(e):e},g$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as cre}from"util";var BL=cre(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=y$e}=e[r];for await(let i of n(t))yield*_x(i,e,r+1)},lre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*_$e(r,Number(e),t)},_$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*_x(n,r,e+1)},ure=cre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),y$e=function*(t){yield t};var jL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},dre=(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}=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*S$e(r,Number(e),t)},S$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Cl(n,r,e+1)},E$e=function*(t){yield t};var zL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=pre(t,s,o),l=Il(e),u=Il(r),d=l?BL.bind(void 0,_x,a):jL.bind(void 0,Cl),f=l||u?BL.bind(void 0,lre,a):jL.bind(void 0,R_),p=l||u?ure.bind(void 0,a):void 0;return{stream:new v$e({writableObjectMode:n,writableHighWaterMark:fre(n),readableObjectMode:i,readableHighWaterMark:fre(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=pre(s,r,a);t=dre(c,t)}return t},pre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:ore(n,a)},gx(r,s,n),mx(r,o,n,c),{transform:t,final:e},{transform:sre(i,a)},ire({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var hre=(t,e)=>{for(let r of T$e(t))b$e(t,r,e)},T$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),b$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=>A$e(a,n));r.input=__(s)},A$e=(t,e)=>{let r=yx(t,e,"utf8",!0);return x$e(r),__(r)},x$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 C$e,appendFileSync as P$e}from"fs";var Sx=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&af(r,n)&&!mn.has(e)&&w$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&R$e.has(o))||t.every(({type:i})=>qn.has(i))),w$e=t=>t===1||t===2,R$e=new Set(["pipe","overlapped"]),mre=async(t,e,r,n)=>{for await(let i of t)I$e(e)||_re(i,r,n)},gre=(t,e,r)=>{for(let n of t)_re(n,e,r)},I$e=t=>t._readableState.pipes.length>0,_re=(t,e,r)=>{let n=kA(t);so({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var yre=({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)=>O$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},O$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=Ste(t,o,d),p=ls(f),{stdioItems:h,objectMode:m}=e[r],y=N$e([p],h,c,n),{serializedResult:T,finalResult:b=T}=k$e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});M$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&&D$e(T,h,i),A}catch(S){return n.error=S,A}},N$e=(t,e,r,n)=>{try{return yx(t,e,r,!1)}catch(i){return n.error=i,t}},k$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=kQ(t,r);return n[o]?{serializedResult:s,finalResult:FL(s,!i[o],e)}:{serializedResult:s}},M$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=FL(t,!1,s);try{gre(a,e,n)}catch(c){r.error??=c}},D$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)?P$e(n,t):(r.add(o),C$e(n,t))}};var Sre=([,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)?YD([t,e]):`${t}${e}`};import{once as GL}from"events";var Ere=async(t,e)=>{let[r,n]=await L$e(t);return e.isForcefullyTerminated??=!1,[r,n]},L$e=async t=>{let[e,r]=await Promise.allSettled([GL(t,"spawn"),GL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?vre(t):r.value},vre=async t=>{try{return await GL(t,"exit")}catch{return vre(t)}},Tre=async t=>{let[e,r]=await t;if(!$$e(e,r)&&qL(e,r))throw new bi;return[e,r]},$$e=(t,e)=>t===void 0&&e===void 0,qL=(t,e)=>t!==0||e!==null;var bre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=U$e(t,e,r),s=o?.code==="ETIMEDOUT",a=yte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},U$e=(t,e,r)=>t!==void 0?t:qL(e,r)?new bi:void 0;var Are=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=B$e(t,e,r),d=G$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return _f(d,c,l)},B$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=DA(t,e,r),a=j$e(r),{file:c,commandArguments:l,options:u}=tx(t,e,a);z$e(u);let d=ere(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},j$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,z$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.`)},G$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=q$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}=bre(c,r),{output:h,error:m=l}=yre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,A)=>fs(b,r,A)),T=fs(Sre(h,r),r,"all");return H$e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:T,options:r,command:n,escapedCommand:i,startTime:a})},q$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{hre(o,r);let a=V$e(r);return F$e(...rx(t,e,a))}catch(a){return gf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},V$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:lx(e)}),H$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 kUe}from"events";import{spawn as MUe}from"child_process";import Cre from"process";import{once as VL,on as W$e}from"events";var xre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(uf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:KA(t)}),Y$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Y$e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{VA(e,i);let o=Pa(t,e,r),s=new AbortController;try{return await Promise.race([K$e(o,n,s),Z$e(o,r,s),J$e(o,r,s)])}catch(a){throw df(t),a}finally{s.abort(),HA(e,i)}},K$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await VL(t,"message",{signal:r});return n}for await(let[n]of W$e(t,"message",{signal:r}))if(e(n))return n},Z$e=async(t,e,{signal:r})=>{await VL(t,"disconnect",{signal:r}),dee(e)},J$e=async(t,e,{signal:r})=>{let[n]=await VL(t,"strict:error",{signal:r});throw zA(n,e)};import{once as Rre,on as X$e}from"events";var Ire=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>HL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),HL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{uf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:KA(t)}),VA(e,o);let s=Pa(t,e,r),a=new AbortController,c={};return Q$e(t,s,a),e1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),t1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Q$e=async(t,e,r)=>{try{await Rre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},e1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Rre(t,"strict:error",{signal:r.signal});n.error=zA(i,e),r.abort()}catch{}},t1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of X$e(r,"message",{signal:o.signal}))wre(s),yield c}catch{wre(s)}finally{o.abort(),HA(e,a),n||df(t),i&&await t}},wre=({error:t})=>{if(t)throw t};var Pre=(t,{ipc:e})=>{Object.assign(t,Nre(t,!1,e))},Ore=()=>{let t=Cre,e=!0,r=Cre.channel!==void 0;return{...Nre(t,e,r),getCancelSignal:Uee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},Nre=(t,e,r)=>({sendMessage:QA.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:xre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Ire.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as r1e}from"child_process";import{PassThrough as n1e,Readable as i1e,Writable as o1e,Duplex as s1e}from"stream";var kre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{LL(n);let a=new r1e;a1e(a,n),Object.assign(a,{readable:c1e,writable:l1e,duplex:u1e});let c=gf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=d1e(c,s,i);return{subprocess:a,promise:l}},a1e=(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 n1e;return t.end(),t},c1e=()=>new i1e({read(){}}),l1e=()=>new o1e({write(){}}),u1e=()=>new s1e({read(){},write(){}}),d1e=async(t,e,r)=>_f(t,e,r);import{createReadStream as Mre,createWriteStream as Dre}from"fs";import{Buffer as f1e}from"buffer";import{Readable as C_,Writable as p1e,Duplex as h1e}from"stream";var $re=(t,e)=>hx(m1e,t,e,!1),P_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Oa[t]}.`)},Lre={fileNumber:P_,generator:zL,asyncGenerator:zL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:h1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},m1e={input:{...Lre,fileUrl:({value:t})=>({stream:Mre(t)}),filePath:({value:{file:t}})=>({stream:Mre(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(f1e.from(t))})},output:{...Lre,fileUrl:({value:t})=>({stream:Dre(t)}),filePath:({value:{file:t,append:e}})=>({stream:Dre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:p1e.fromWeb(t)}),iterable:P_,asyncIterable:P_,string:P_,uint8Array:P_}};import{on as g1e,once as Ure}from"events";import{PassThrough as _1e,getDefaultHighWaterMark as y1e}from"stream";import{finished as jre}from"stream/promises";function Pl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)YL(i);let e=t.some(({readableObjectMode:i})=>i),r=S1e(t,e),n=new WL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var S1e=(t,e)=>{if(t.length===0)return y1e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},WL=class extends _1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(YL(e),this.#e.has(e))return;this.#e.add(e),this.#n??=E1e(this,this.#e,this.#o);let r=b1e({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(YL(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)}},E1e=async(t,e,r)=>{vx(t,Fre);let n=new AbortController;try{await Promise.race([v1e(t,n),T1e(t,e,r,n)])}finally{n.abort(),vx(t,-Fre)}},v1e=async(t,{signal:e})=>{try{await jre(t,{signal:e,cleanup:!0})}catch(r){throw zre(t,r),r}},T1e=async(t,e,r,{signal:n})=>{for await(let[i]of g1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},YL=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},b1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{vx(t,Bre);let a=new AbortController;try{await Promise.race([A1e(o,e,a),x1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),w1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),vx(t,-Bre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?KL(t):R1e(t))},A1e=async(t,e,{signal:r})=>{try{await t,r.aborted||KL(e)}catch(n){r.aborted||zre(e,n)}},x1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await jre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;Gre(s)?i.add(e):qre(t,s)}},w1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Ure(t,i,{signal:o}),!t.readable)return Ure(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},R1e=t=>{t.writable&&t.end()},zre=(t,e)=>{Gre(e)?KL(t):qre(t,e)},Gre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",KL=t=>{(t.readable||t.writable)&&t.destroy()},qre=(t,e)=>{t.destroyed||(t.once("error",I1e),t.destroy(e))},I1e=()=>{},vx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Fre=2,Bre=1;import{finished as Vre}from"stream/promises";var Sf=(t,e)=>{t.pipe(e),C1e(t,e),P1e(t,e)},C1e=async(t,e)=>{if(!(Ti(t)||Ti(e))){try{await Vre(t,{cleanup:!0,readable:!0,writable:!1})}catch{}ZL(e)}},ZL=t=>{t.writable&&t.end()},P1e=async(t,e)=>{if(!(Ti(t)||Ti(e))){try{await Vre(e,{cleanup:!0,readable:!1,writable:!0})}catch{}JL(t)}},JL=t=>{t.readable&&t.destroy()};var Hre=(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})=>qn.has(c)))O1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!qn.has(c)))k1e({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)}},O1e=(t,e,r,n)=>{r==="output"?Sf(t.stdio[n],e):Sf(e,t.stdio[n]);let i=N1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},N1e=["stdin","stdout","stderr"],k1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;M1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},M1e=(t,{signal:e})=>{Ti(t)&&wl(t,D1e,e)},D1e=2;import{addAbortListener as U1e}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",XL=Symbol.for("signal-exit emitter"),QL=globalThis,L1e=Object.defineProperty.bind(Object),e$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(QL[XL])return QL[XL];L1e(QL,XL,{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{},$1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),t$=class extends bx{onExit(){return()=>{}}load(){}unload(){}},r$=class extends bx{#e=n$.platform==="win32"?"SIGINT":"SIGHUP";#r=new e$;#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)}},n$=globalThis.process,{onExit:Wre,load:jEt,unload:zEt}=$1e(Tx(n$)?new r$(n$):new t$);var Yre=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Wre(()=>{t.kill()});U1e(n,()=>{i()})};var Zre=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=MA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=F1e(r,n,i),{sourceStream:d,sourceError:f}=j1e(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}},F1e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=B1e(t,e,...r),a=qA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},B1e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Kre,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||HD(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(Kre)(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}`)},Kre=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),j1e=(t,e)=>{try{return{sourceStream:ff(t,e)}}catch(r){return{sourceError:r}}};var Xre=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=z1e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw i$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},z1e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return JL(t),n;if(e!==void 0)return ZL(r),e},i$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>gf({error:t,command:Jre,escapedCommand:Jre,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Jre="source.pipe(destination)";var Qre=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 G1e}from"stream/promises";var ene=(t,e,r)=>{let n=Ax.has(e)?V1e(t,e):q1e(t,e);return wl(t,W1e,r.signal),wl(e,Y1e,r.signal),H1e(e),n},q1e=(t,e)=>{let r=Pl([t]);return Sf(r,e),Ax.set(e,r),r},V1e=(t,e)=>{let r=Ax.get(e);return r.add(t),r},H1e=async t=>{try{await G1e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Ax.delete(t)},Ax=new WeakMap,W1e=2,Y1e=1;import{aborted as K1e}from"util";var tne=(t,e)=>t===void 0?[]:[Z1e(t,e)],Z1e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await K1e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw i$({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}=Zre(t,...e),i=J1e({...n,destination:r});return i.pipe=xx.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},J1e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=X1e(t,i);Xre({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=ene(e,o,d);return await Promise.race([Qre(u),...tne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},X1e=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as oUe}from"timers/promises";import{on as Q1e}from"events";import{getDefaultHighWaterMark as eUe}from"stream";var wx=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return tUe(e,s),nne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},tUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},o$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;rUe(e,s,t);let a=t.readableObjectMode&&!o;return nne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},rUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Q1e(t,"data",{signal:e.signal,highWaterMark:rne,highWatermark:rne});return nUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},s$=eUe(!0),rne=s$,nUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=iUe({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)}},iUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[gx(t,r,!e),mx(t,i,!n,{})].filter(Boolean);var ine=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([aUe(t),d]);return}let f=$L(c,r),p=o$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([cUe({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(!Sx({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=o$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await mre(a,t,r,o)},aUe=async t=>{await oUe(),t.readableFlowing===null&&t.resume()},cUe=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 one(mte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},a$=async t=>{try{return await t}catch(e){return one(e)}},one=({bufferedData:t})=>OQ(t)?new Uint8Array(t):t;import{finished as lUe}from"stream/promises";var O_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=uUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],lUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||pUe(a,e,r,n)}finally{s.abort()}},uUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&dUe(t,r,n),n},dUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{fUe(e,r),n.call(t,...i)}},fUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},pUe=(t,e,r,n)=>{if(!hUe(t,e,r,n))throw t},hUe=(t,e,r,n=!0)=>r.propagating?sne(t)||Rx(t):(r.propagating=!0,c$(r,e)===n?sne(t):Rx(t)),c$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Rx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",sne=t=>t?.code==="EPIPE";var ane=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>l$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),l$=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(c$(l,e)){await u;return}let[d]=await Promise.all([ine({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 cne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Pl([t,e].filter(Boolean)):void 0,lne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>l$({...mUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:gUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),mUe=({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}},gUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as _Ue}from"events";var une=t=>af(t,"ipc"),dne=(t,e)=>{let r=kA(t);so({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var fne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=une(o),a=us(e,"ipc"),c=us(r,"ipc");for await(let l of HL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(gte(t,i,c),i.push(l)),s&&dne(l,o);return i},pne=async(t,e)=>(await Promise.allSettled([t]),e);var hne=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=Ere(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},S=ane({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),w=lne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),I=[],D=fne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),O=yUe(m,t,A),M=SUe(h,A);try{return await Promise.race([Promise.all([{},Tre(b),Promise.all(S),w,D,Yee(t,d),...O,...M]),y,EUe(t,T),...Gee(t,o,f,T),...uee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:T}),...jee({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(_=>a$(_))),a$(w),pne(D,I),Promise.allSettled(O),Promise.allSettled(M)])}},yUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:O_(n,i,r)),SUe=(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:qn.has(i),stopOnExit:i==="native"}))),EUe=async(t,{signal:e})=>{let[r]=await _Ue(t,"error",{signal:e});throw r};var mne=()=>({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 vUe}from"stream";import{callbackify as TUe}from"util";import{finished as gne}from"stream/promises";var u$=async t=>{if(t!==void 0)try{await d$(t)}catch{}},_ne=async t=>{if(t!==void 0)try{await f$(t)}catch{}},d$=async t=>{await gne(t,{cleanup:!0,readable:!1,writable:!0})},f$=async t=>{await gne(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 yne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||mn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=p$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=h$(a,s),{read:f,onStdoutDataDone:p}=m$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new vUe({read:f,destroy:TUe(_$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return g$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},p$=(t,e,r)=>{let n=ff(t,e),i=N_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},h$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:s$},m$=({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(){bUe(this,s,o)},onStdoutDataDone:o}},bUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},g$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await f$(t),await n,await u$(i),await e,r.readable&&r.push(null)}catch(o){await u$(i),Sne(r,o)}},_$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Ef(r,e)&&(Sne(t,n),await Ix(e,n))},Sne=(t,e)=>{Cx(t,t.readable,e)};import{Writable as AUe}from"stream";import{callbackify as Ene}from"util";var vne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=y$(t,r,e),s=new AUe({...S$(n,t,i),destroy:Ene(v$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return E$(n,s),s},y$=(t,e,r)=>{let n=qA(t,e),i=N_(r,n,"writableFinal"),o=N_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},S$=(t,e,r)=>({write:xUe.bind(void 0,t),final:Ene(wUe.bind(void 0,t,e,r))}),xUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},wUe=async(t,e,r)=>{await Ef(r,e)&&(t.writable&&t.end(),await e)},E$=async(t,e,r)=>{try{await d$(t),e.writable&&e.end()}catch(n){await _ne(r),Tne(e,n)}},v$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Ef(r,e),await Ef(n,e)&&(Tne(t,i),await Ix(e,i))},Tne=(t,e)=>{Cx(t,t.writable,e)};import{Duplex as RUe}from"stream";import{callbackify as IUe}from"util";var bne=({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}=p$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=y$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=h$(c,a),{read:y,onStdoutDataDone:T}=m$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new RUe({read:y,...S$(u,t,d),destroy:IUe(CUe.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 g$({subprocessStdout:c,onStdoutDataDone:T,readable:b,subprocess:t,subprocessStdin:u}),E$(u,b,c),b},CUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([_$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),v$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var T$=(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 PUe(a,s,t)},PUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Ane=(t,{encoding:e})=>{let r=mne();t.readable=yne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=vne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=bne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=T$.bind(void 0,t,e),t[Symbol.asyncIterator]=T$.bind(void 0,t,e,{})};var xne=(t,e)=>{for(let[r,n]of NUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},OUe=(async()=>{})().constructor.prototype,NUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(OUe,t)]);var wne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=DUe(t,e,r),{subprocess:f,promise:p}=$Ue({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}),xne(f,p),co.set(f,{options:u,fileDescriptors:d}),f},DUe=(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=LUe(l),d=$re(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},LUe=({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}},$Ue=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=MUe(...rx(t,e,r))}catch(h){return kre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;kUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Hre(c,a,l),Yre(c,r,l);let d={},f=ao();c.kill=cee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=cne(c,r),Ane(c,r),Pre(c,r);let p=UUe({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}},UUe=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 hne({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=FUe({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)},FUe=({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,BUe(n,t[n],i)]));return{...t,...r}},BUe=(t,e,r)=>jUe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,jUe=new Set(["env",...XD]);var Na=(t,e,r,n)=>{let i=(s,a,c)=>Na(s,a,r,c),o=(...s)=>zUe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},zUe=({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}=GUe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Are(a,c,l):wne(a,c,l,i)},GUe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=$Q(e)?UQ(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 Rne=({file:t,commandArguments:e})=>Cne(t,e),Ine=({file:t,commandArguments:e})=>({...Cne(t,e),isSync:!0}),Cne=(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]=qUe(t);return{file:r,commandArguments:n}},qUe=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(VUe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},VUe=/ +/g;var Pne=(t,e,r)=>{t.sync=e(HUe,r),t.s=t.sync},One=({options:t})=>Nne(t),HUe=({options:t})=>({...Nne(t),isSync:!0}),Nne=t=>({options:{...WUe(t),...t}}),WUe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},kne={preferLocal:!0};var Mne=Na(()=>({})),Obt=Na(()=>({isSync:!0})),Dne=Na(Rne),Nbt=Na(Ine),kbt=Na(Vee),Mbt=Na(One,{},kne,Pne),{sendMessage:Dbt,getOneMessage:Lbt,getEachMessage:$bt,getCancelSignal:Ubt}=Ore();var Lne=!1,$ne=()=>{Lne=!0},fo=()=>Lne;var k_=null,Une=t=>(k_&&k_.destroy(),k_=new ps({totalAllowedTime:t}),k_),Fne=()=>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{de.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 Bne={name:"@netlify/agent-runner-cli",type:"module",version:"1.156.0-image-prompt.2",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 JUe=KUe(import.meta.url),XUe=hs.dirname(JUe),QUe=ZUe(import.meta.url),vf=he("shell"),b$=new Set,jne={preferLocal:!0},ur=(t,e,r)=>{let[n,i]=eFe(e,r),o={...jne,...i},s=Mne(t,n,o);Gne(s,o),Hne(s);let a=r?.idleTimeout;return a&&a>0&&Vne(s,a),s},zne=(t,e)=>{let r={...jne,...e},n=Dne(t,r);return Gne(n,r),Hne(n),e?.idleTimeout&&e.idleTimeout>0&&Vne(n,e.idleTimeout),n},eFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},Gne=(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)},A$=(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}},qne=t=>A$(t,"SIGKILL"),Vne=(t,e)=>{let r=null,n=()=>{vf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),A$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(vf.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)},Hne=t=>{b$.add(t);let e=Fne();if(e){let r=e.onTimesUp(()=>{vf.log(`Global timer expired, killing process ${t.pid}`),A$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(vf.log(`Force killing process ${t.pid} after timeout`),qne(t))},5e3)});t.on("exit",()=>{b$.delete(t),r()}),t.on("error",()=>{b$.delete(t),r()})}};function po(t,e){if(!ms.env.NETLIFY_LOCAL_MODE)try{let i=QUe.resolve(Bne.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(XUe,"..","node_modules",".bin",e);if(Ox.existsSync(n))return n}var tFe=he("utils"),rFe=t=>new Promise(e=>{setTimeout(e,t)});var x$=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 rFe(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},Wne=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):tFe.error("Could not parse JSON",n))}},nFe=t=>t.charAt(0).toUpperCase()+t.slice(1),ho=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():nFe(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)),Yne=(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 w$=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}},iFe=1e4,R$=(t,e=iFe)=>{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 oFe}from"crypto";import{createReadStream as sFe}from"fs";import Mx from"fs/promises";import Qne from"os";import Dx from"path";var Kne=he("repo"),eie="runner-diffs-",tie=t=>`${eie}${t}-`,rie=async t=>{let e=Qne.tmpdir(),r;try{r=await Mx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(eie)&&!n.startsWith(tie(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()})=>{Kne.info("Getting runner diffs");let n=await cFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=uFe(o);await dFe(h,r)}Kne.info("Changes after processing"),await C$(r);let s=await O$(o,r);if(await I$(s,r),i=await lFe(r),!i)return{hasChanges:!1,ignored:s};await Kr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Mx.mkdtemp(Dx.join(Qne.tmpdir(),tie(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 Xne(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 Jne(d,h)||(f=h)}await Xne(r),de.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Jne(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Zne=async t=>{let e=oFe("sha256");for await(let r of sFe(t))e.update(r);return e.digest("hex")},Jne=async(t,e)=>t.size===e.size&&await Zne(t.path)===await Zne(e.path),Xne=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Kr(["reset","--soft","HEAD~1"],{cwd:t})},I$=async(t=[],e=process.cwd())=>{await Kr(["add",".",...t],{cwd:e})},C$=async(t=process.cwd())=>{let e=await Kr(["status","-s"],{cwd:t});return String(e.stdout??"")},nie=/.. (.+)?\.log$/,aFe=[nie],cFe=async(t=process.cwd())=>{let e=await C$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
101
|
+
if (condition) { yield value; }`)};import{Buffer as f$e}from"buffer";import{StringDecoder as p$e}from"string_decoder";var gx=(t,e,r)=>{if(r)return;if(t)return{transform:h$e.bind(void 0,new TextEncoder)};let n=new p$e(e);return{transform:m$e.bind(void 0,n),final:g$e.bind(void 0,n)}},h$e=function*(t,e){f$e.isBuffer(e)?yield ls(e):typeof e=="string"?yield t.encode(e):yield e},m$e=function*(t,e){yield jt(e)?t.write(e):e},g$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as cre}from"util";var BL=cre(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=y$e}=e[r];for await(let i of n(t))yield*_x(i,e,r+1)},lre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*_$e(r,Number(e),t)},_$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*_x(n,r,e+1)},ure=cre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),y$e=function*(t){yield t};var jL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},dre=(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}=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*S$e(r,Number(e),t)},S$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Cl(n,r,e+1)},E$e=function*(t){yield t};var zL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=pre(t,s,o),l=Il(e),u=Il(r),d=l?BL.bind(void 0,_x,a):jL.bind(void 0,Cl),f=l||u?BL.bind(void 0,lre,a):jL.bind(void 0,R_),p=l||u?ure.bind(void 0,a):void 0;return{stream:new v$e({writableObjectMode:n,writableHighWaterMark:fre(n),readableObjectMode:i,readableHighWaterMark:fre(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=pre(s,r,a);t=dre(c,t)}return t},pre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:ore(n,a)},gx(r,s,n),mx(r,o,n,c),{transform:t,final:e},{transform:sre(i,a)},ire({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var hre=(t,e)=>{for(let r of T$e(t))b$e(t,r,e)},T$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),b$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=>A$e(a,n));r.input=__(s)},A$e=(t,e)=>{let r=yx(t,e,"utf8",!0);return x$e(r),__(r)},x$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 C$e,appendFileSync as P$e}from"fs";var Sx=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&af(r,n)&&!mn.has(e)&&w$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&R$e.has(o))||t.every(({type:i})=>qn.has(i))),w$e=t=>t===1||t===2,R$e=new Set(["pipe","overlapped"]),mre=async(t,e,r,n)=>{for await(let i of t)I$e(e)||_re(i,r,n)},gre=(t,e,r)=>{for(let n of t)_re(n,e,r)},I$e=t=>t._readableState.pipes.length>0,_re=(t,e,r)=>{let n=kA(t);so({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var yre=({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)=>O$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},O$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=Ste(t,o,d),p=ls(f),{stdioItems:h,objectMode:m}=e[r],y=N$e([p],h,c,n),{serializedResult:T,finalResult:b=T}=k$e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});M$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&&D$e(T,h,i),A}catch(S){return n.error=S,A}},N$e=(t,e,r,n)=>{try{return yx(t,e,r,!1)}catch(i){return n.error=i,t}},k$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=kQ(t,r);return n[o]?{serializedResult:s,finalResult:FL(s,!i[o],e)}:{serializedResult:s}},M$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=FL(t,!1,s);try{gre(a,e,n)}catch(c){r.error??=c}},D$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)?P$e(n,t):(r.add(o),C$e(n,t))}};var Sre=([,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)?YD([t,e]):`${t}${e}`};import{once as GL}from"events";var Ere=async(t,e)=>{let[r,n]=await L$e(t);return e.isForcefullyTerminated??=!1,[r,n]},L$e=async t=>{let[e,r]=await Promise.allSettled([GL(t,"spawn"),GL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?vre(t):r.value},vre=async t=>{try{return await GL(t,"exit")}catch{return vre(t)}},Tre=async t=>{let[e,r]=await t;if(!$$e(e,r)&&qL(e,r))throw new bi;return[e,r]},$$e=(t,e)=>t===void 0&&e===void 0,qL=(t,e)=>t!==0||e!==null;var bre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=U$e(t,e,r),s=o?.code==="ETIMEDOUT",a=yte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},U$e=(t,e,r)=>t!==void 0?t:qL(e,r)?new bi:void 0;var Are=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=B$e(t,e,r),d=G$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return _f(d,c,l)},B$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=DA(t,e,r),a=j$e(r),{file:c,commandArguments:l,options:u}=tx(t,e,a);z$e(u);let d=ere(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},j$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,z$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.`)},G$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=q$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}=bre(c,r),{output:h,error:m=l}=yre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,A)=>fs(b,r,A)),T=fs(Sre(h,r),r,"all");return H$e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:T,options:r,command:n,escapedCommand:i,startTime:a})},q$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{hre(o,r);let a=V$e(r);return F$e(...rx(t,e,a))}catch(a){return gf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},V$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:lx(e)}),H$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 kUe}from"events";import{spawn as MUe}from"child_process";import Cre from"process";import{once as VL,on as W$e}from"events";var xre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(uf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:KA(t)}),Y$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Y$e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{VA(e,i);let o=Pa(t,e,r),s=new AbortController;try{return await Promise.race([K$e(o,n,s),Z$e(o,r,s),J$e(o,r,s)])}catch(a){throw df(t),a}finally{s.abort(),HA(e,i)}},K$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await VL(t,"message",{signal:r});return n}for await(let[n]of W$e(t,"message",{signal:r}))if(e(n))return n},Z$e=async(t,e,{signal:r})=>{await VL(t,"disconnect",{signal:r}),dee(e)},J$e=async(t,e,{signal:r})=>{let[n]=await VL(t,"strict:error",{signal:r});throw zA(n,e)};import{once as Rre,on as X$e}from"events";var Ire=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>HL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),HL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{uf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:KA(t)}),VA(e,o);let s=Pa(t,e,r),a=new AbortController,c={};return Q$e(t,s,a),e1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),t1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Q$e=async(t,e,r)=>{try{await Rre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},e1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Rre(t,"strict:error",{signal:r.signal});n.error=zA(i,e),r.abort()}catch{}},t1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of X$e(r,"message",{signal:o.signal}))wre(s),yield c}catch{wre(s)}finally{o.abort(),HA(e,a),n||df(t),i&&await t}},wre=({error:t})=>{if(t)throw t};var Pre=(t,{ipc:e})=>{Object.assign(t,Nre(t,!1,e))},Ore=()=>{let t=Cre,e=!0,r=Cre.channel!==void 0;return{...Nre(t,e,r),getCancelSignal:Uee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},Nre=(t,e,r)=>({sendMessage:QA.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:xre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Ire.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as r1e}from"child_process";import{PassThrough as n1e,Readable as i1e,Writable as o1e,Duplex as s1e}from"stream";var kre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{LL(n);let a=new r1e;a1e(a,n),Object.assign(a,{readable:c1e,writable:l1e,duplex:u1e});let c=gf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=d1e(c,s,i);return{subprocess:a,promise:l}},a1e=(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 n1e;return t.end(),t},c1e=()=>new i1e({read(){}}),l1e=()=>new o1e({write(){}}),u1e=()=>new s1e({read(){},write(){}}),d1e=async(t,e,r)=>_f(t,e,r);import{createReadStream as Mre,createWriteStream as Dre}from"fs";import{Buffer as f1e}from"buffer";import{Readable as C_,Writable as p1e,Duplex as h1e}from"stream";var $re=(t,e)=>hx(m1e,t,e,!1),P_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Oa[t]}.`)},Lre={fileNumber:P_,generator:zL,asyncGenerator:zL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:h1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},m1e={input:{...Lre,fileUrl:({value:t})=>({stream:Mre(t)}),filePath:({value:{file:t}})=>({stream:Mre(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(f1e.from(t))})},output:{...Lre,fileUrl:({value:t})=>({stream:Dre(t)}),filePath:({value:{file:t,append:e}})=>({stream:Dre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:p1e.fromWeb(t)}),iterable:P_,asyncIterable:P_,string:P_,uint8Array:P_}};import{on as g1e,once as Ure}from"events";import{PassThrough as _1e,getDefaultHighWaterMark as y1e}from"stream";import{finished as jre}from"stream/promises";function Pl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)YL(i);let e=t.some(({readableObjectMode:i})=>i),r=S1e(t,e),n=new WL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var S1e=(t,e)=>{if(t.length===0)return y1e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},WL=class extends _1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(YL(e),this.#e.has(e))return;this.#e.add(e),this.#n??=E1e(this,this.#e,this.#o);let r=b1e({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(YL(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)}},E1e=async(t,e,r)=>{vx(t,Fre);let n=new AbortController;try{await Promise.race([v1e(t,n),T1e(t,e,r,n)])}finally{n.abort(),vx(t,-Fre)}},v1e=async(t,{signal:e})=>{try{await jre(t,{signal:e,cleanup:!0})}catch(r){throw zre(t,r),r}},T1e=async(t,e,r,{signal:n})=>{for await(let[i]of g1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},YL=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},b1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{vx(t,Bre);let a=new AbortController;try{await Promise.race([A1e(o,e,a),x1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),w1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),vx(t,-Bre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?KL(t):R1e(t))},A1e=async(t,e,{signal:r})=>{try{await t,r.aborted||KL(e)}catch(n){r.aborted||zre(e,n)}},x1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await jre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;Gre(s)?i.add(e):qre(t,s)}},w1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Ure(t,i,{signal:o}),!t.readable)return Ure(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},R1e=t=>{t.writable&&t.end()},zre=(t,e)=>{Gre(e)?KL(t):qre(t,e)},Gre=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",KL=t=>{(t.readable||t.writable)&&t.destroy()},qre=(t,e)=>{t.destroyed||(t.once("error",I1e),t.destroy(e))},I1e=()=>{},vx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Fre=2,Bre=1;import{finished as Vre}from"stream/promises";var Sf=(t,e)=>{t.pipe(e),C1e(t,e),P1e(t,e)},C1e=async(t,e)=>{if(!(Ti(t)||Ti(e))){try{await Vre(t,{cleanup:!0,readable:!0,writable:!1})}catch{}ZL(e)}},ZL=t=>{t.writable&&t.end()},P1e=async(t,e)=>{if(!(Ti(t)||Ti(e))){try{await Vre(e,{cleanup:!0,readable:!1,writable:!0})}catch{}JL(t)}},JL=t=>{t.readable&&t.destroy()};var Hre=(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})=>qn.has(c)))O1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!qn.has(c)))k1e({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)}},O1e=(t,e,r,n)=>{r==="output"?Sf(t.stdio[n],e):Sf(e,t.stdio[n]);let i=N1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},N1e=["stdin","stdout","stderr"],k1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;M1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},M1e=(t,{signal:e})=>{Ti(t)&&wl(t,D1e,e)},D1e=2;import{addAbortListener as U1e}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",XL=Symbol.for("signal-exit emitter"),QL=globalThis,L1e=Object.defineProperty.bind(Object),e$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(QL[XL])return QL[XL];L1e(QL,XL,{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{},$1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),t$=class extends bx{onExit(){return()=>{}}load(){}unload(){}},r$=class extends bx{#e=n$.platform==="win32"?"SIGINT":"SIGHUP";#r=new e$;#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)}},n$=globalThis.process,{onExit:Wre,load:jEt,unload:zEt}=$1e(Tx(n$)?new r$(n$):new t$);var Yre=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Wre(()=>{t.kill()});U1e(n,()=>{i()})};var Zre=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=MA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=F1e(r,n,i),{sourceStream:d,sourceError:f}=j1e(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}},F1e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=B1e(t,e,...r),a=qA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},B1e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Kre,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||HD(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(Kre)(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}`)},Kre=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),j1e=(t,e)=>{try{return{sourceStream:ff(t,e)}}catch(r){return{sourceError:r}}};var Xre=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=z1e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw i$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},z1e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return JL(t),n;if(e!==void 0)return ZL(r),e},i$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>gf({error:t,command:Jre,escapedCommand:Jre,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Jre="source.pipe(destination)";var Qre=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 G1e}from"stream/promises";var ene=(t,e,r)=>{let n=Ax.has(e)?V1e(t,e):q1e(t,e);return wl(t,W1e,r.signal),wl(e,Y1e,r.signal),H1e(e),n},q1e=(t,e)=>{let r=Pl([t]);return Sf(r,e),Ax.set(e,r),r},V1e=(t,e)=>{let r=Ax.get(e);return r.add(t),r},H1e=async t=>{try{await G1e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Ax.delete(t)},Ax=new WeakMap,W1e=2,Y1e=1;import{aborted as K1e}from"util";var tne=(t,e)=>t===void 0?[]:[Z1e(t,e)],Z1e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await K1e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw i$({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}=Zre(t,...e),i=J1e({...n,destination:r});return i.pipe=xx.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},J1e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=X1e(t,i);Xre({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=ene(e,o,d);return await Promise.race([Qre(u),...tne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},X1e=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as oUe}from"timers/promises";import{on as Q1e}from"events";import{getDefaultHighWaterMark as eUe}from"stream";var wx=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return tUe(e,s),nne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},tUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},o$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;rUe(e,s,t);let a=t.readableObjectMode&&!o;return nne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},rUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Q1e(t,"data",{signal:e.signal,highWaterMark:rne,highWatermark:rne});return nUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},s$=eUe(!0),rne=s$,nUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=iUe({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)}},iUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[gx(t,r,!e),mx(t,i,!n,{})].filter(Boolean);var ine=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([aUe(t),d]);return}let f=$L(c,r),p=o$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([cUe({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(!Sx({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=o$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await mre(a,t,r,o)},aUe=async t=>{await oUe(),t.readableFlowing===null&&t.resume()},cUe=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 one(mte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},a$=async t=>{try{return await t}catch(e){return one(e)}},one=({bufferedData:t})=>OQ(t)?new Uint8Array(t):t;import{finished as lUe}from"stream/promises";var O_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=uUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],lUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||pUe(a,e,r,n)}finally{s.abort()}},uUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&dUe(t,r,n),n},dUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{fUe(e,r),n.call(t,...i)}},fUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},pUe=(t,e,r,n)=>{if(!hUe(t,e,r,n))throw t},hUe=(t,e,r,n=!0)=>r.propagating?sne(t)||Rx(t):(r.propagating=!0,c$(r,e)===n?sne(t):Rx(t)),c$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Rx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",sne=t=>t?.code==="EPIPE";var ane=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>l$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),l$=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(c$(l,e)){await u;return}let[d]=await Promise.all([ine({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 cne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Pl([t,e].filter(Boolean)):void 0,lne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>l$({...mUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:gUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),mUe=({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}},gUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as _Ue}from"events";var une=t=>af(t,"ipc"),dne=(t,e)=>{let r=kA(t);so({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var fne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=une(o),a=us(e,"ipc"),c=us(r,"ipc");for await(let l of HL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(gte(t,i,c),i.push(l)),s&&dne(l,o);return i},pne=async(t,e)=>(await Promise.allSettled([t]),e);var hne=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=Ere(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},S=ane({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),w=lne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),I=[],D=fne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),O=yUe(m,t,A),M=SUe(h,A);try{return await Promise.race([Promise.all([{},Tre(b),Promise.all(S),w,D,Yee(t,d),...O,...M]),y,EUe(t,T),...Gee(t,o,f,T),...uee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:T}),...jee({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(_=>a$(_))),a$(w),pne(D,I),Promise.allSettled(O),Promise.allSettled(M)])}},yUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:O_(n,i,r)),SUe=(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:qn.has(i),stopOnExit:i==="native"}))),EUe=async(t,{signal:e})=>{let[r]=await _Ue(t,"error",{signal:e});throw r};var mne=()=>({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 vUe}from"stream";import{callbackify as TUe}from"util";import{finished as gne}from"stream/promises";var u$=async t=>{if(t!==void 0)try{await d$(t)}catch{}},_ne=async t=>{if(t!==void 0)try{await f$(t)}catch{}},d$=async t=>{await gne(t,{cleanup:!0,readable:!1,writable:!0})},f$=async t=>{await gne(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 yne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||mn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=p$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=h$(a,s),{read:f,onStdoutDataDone:p}=m$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new vUe({read:f,destroy:TUe(_$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return g$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},p$=(t,e,r)=>{let n=ff(t,e),i=N_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},h$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:s$},m$=({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(){bUe(this,s,o)},onStdoutDataDone:o}},bUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},g$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await f$(t),await n,await u$(i),await e,r.readable&&r.push(null)}catch(o){await u$(i),Sne(r,o)}},_$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Ef(r,e)&&(Sne(t,n),await Ix(e,n))},Sne=(t,e)=>{Cx(t,t.readable,e)};import{Writable as AUe}from"stream";import{callbackify as Ene}from"util";var vne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=y$(t,r,e),s=new AUe({...S$(n,t,i),destroy:Ene(v$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return E$(n,s),s},y$=(t,e,r)=>{let n=qA(t,e),i=N_(r,n,"writableFinal"),o=N_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},S$=(t,e,r)=>({write:xUe.bind(void 0,t),final:Ene(wUe.bind(void 0,t,e,r))}),xUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},wUe=async(t,e,r)=>{await Ef(r,e)&&(t.writable&&t.end(),await e)},E$=async(t,e,r)=>{try{await d$(t),e.writable&&e.end()}catch(n){await _ne(r),Tne(e,n)}},v$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Ef(r,e),await Ef(n,e)&&(Tne(t,i),await Ix(e,i))},Tne=(t,e)=>{Cx(t,t.writable,e)};import{Duplex as RUe}from"stream";import{callbackify as IUe}from"util";var bne=({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}=p$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=y$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=h$(c,a),{read:y,onStdoutDataDone:T}=m$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new RUe({read:y,...S$(u,t,d),destroy:IUe(CUe.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 g$({subprocessStdout:c,onStdoutDataDone:T,readable:b,subprocess:t,subprocessStdin:u}),E$(u,b,c),b},CUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([_$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),v$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var T$=(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 PUe(a,s,t)},PUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Ane=(t,{encoding:e})=>{let r=mne();t.readable=yne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=vne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=bne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=T$.bind(void 0,t,e),t[Symbol.asyncIterator]=T$.bind(void 0,t,e,{})};var xne=(t,e)=>{for(let[r,n]of NUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},OUe=(async()=>{})().constructor.prototype,NUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(OUe,t)]);var wne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=DUe(t,e,r),{subprocess:f,promise:p}=$Ue({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}),xne(f,p),co.set(f,{options:u,fileDescriptors:d}),f},DUe=(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=LUe(l),d=$re(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},LUe=({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}},$Ue=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=MUe(...rx(t,e,r))}catch(h){return kre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;kUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Hre(c,a,l),Yre(c,r,l);let d={},f=ao();c.kill=cee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=cne(c,r),Ane(c,r),Pre(c,r);let p=UUe({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}},UUe=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 hne({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=FUe({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)},FUe=({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,BUe(n,t[n],i)]));return{...t,...r}},BUe=(t,e,r)=>jUe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,jUe=new Set(["env",...XD]);var Na=(t,e,r,n)=>{let i=(s,a,c)=>Na(s,a,r,c),o=(...s)=>zUe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},zUe=({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}=GUe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Are(a,c,l):wne(a,c,l,i)},GUe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=$Q(e)?UQ(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 Rne=({file:t,commandArguments:e})=>Cne(t,e),Ine=({file:t,commandArguments:e})=>({...Cne(t,e),isSync:!0}),Cne=(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]=qUe(t);return{file:r,commandArguments:n}},qUe=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(VUe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},VUe=/ +/g;var Pne=(t,e,r)=>{t.sync=e(HUe,r),t.s=t.sync},One=({options:t})=>Nne(t),HUe=({options:t})=>({...Nne(t),isSync:!0}),Nne=t=>({options:{...WUe(t),...t}}),WUe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},kne={preferLocal:!0};var Mne=Na(()=>({})),Obt=Na(()=>({isSync:!0})),Dne=Na(Rne),Nbt=Na(Ine),kbt=Na(Vee),Mbt=Na(One,{},kne,Pne),{sendMessage:Dbt,getOneMessage:Lbt,getEachMessage:$bt,getCancelSignal:Ubt}=Ore();var Lne=!1,$ne=()=>{Lne=!0},fo=()=>Lne;var k_=null,Une=t=>(k_&&k_.destroy(),k_=new ps({totalAllowedTime:t}),k_),Fne=()=>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{de.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 Bne={name:"@netlify/agent-runner-cli",type:"module",version:"1.156.0-image-prompt.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 JUe=KUe(import.meta.url),XUe=hs.dirname(JUe),QUe=ZUe(import.meta.url),vf=he("shell"),b$=new Set,jne={preferLocal:!0},ur=(t,e,r)=>{let[n,i]=eFe(e,r),o={...jne,...i},s=Mne(t,n,o);Gne(s,o),Hne(s);let a=r?.idleTimeout;return a&&a>0&&Vne(s,a),s},zne=(t,e)=>{let r={...jne,...e},n=Dne(t,r);return Gne(n,r),Hne(n),e?.idleTimeout&&e.idleTimeout>0&&Vne(n,e.idleTimeout),n},eFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},Gne=(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)},A$=(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}},qne=t=>A$(t,"SIGKILL"),Vne=(t,e)=>{let r=null,n=()=>{vf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),A$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(vf.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)},Hne=t=>{b$.add(t);let e=Fne();if(e){let r=e.onTimesUp(()=>{vf.log(`Global timer expired, killing process ${t.pid}`),A$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(vf.log(`Force killing process ${t.pid} after timeout`),qne(t))},5e3)});t.on("exit",()=>{b$.delete(t),r()}),t.on("error",()=>{b$.delete(t),r()})}};function po(t,e){if(!ms.env.NETLIFY_LOCAL_MODE)try{let i=QUe.resolve(Bne.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(XUe,"..","node_modules",".bin",e);if(Ox.existsSync(n))return n}var tFe=he("utils"),rFe=t=>new Promise(e=>{setTimeout(e,t)});var x$=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 rFe(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},Wne=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):tFe.error("Could not parse JSON",n))}},nFe=t=>t.charAt(0).toUpperCase()+t.slice(1),ho=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():nFe(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)),Yne=(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 w$=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}},iFe=1e4,R$=(t,e=iFe)=>{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 oFe}from"crypto";import{createReadStream as sFe}from"fs";import Mx from"fs/promises";import Qne from"os";import Dx from"path";var Kne=he("repo"),eie="runner-diffs-",tie=t=>`${eie}${t}-`,rie=async t=>{let e=Qne.tmpdir(),r;try{r=await Mx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(eie)&&!n.startsWith(tie(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()})=>{Kne.info("Getting runner diffs");let n=await cFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=uFe(o);await dFe(h,r)}Kne.info("Changes after processing"),await C$(r);let s=await O$(o,r);if(await I$(s,r),i=await lFe(r),!i)return{hasChanges:!1,ignored:s};await Kr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Mx.mkdtemp(Dx.join(Qne.tmpdir(),tie(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 Xne(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 Jne(d,h)||(f=h)}await Xne(r),de.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Jne(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Zne=async t=>{let e=oFe("sha256");for await(let r of sFe(t))e.update(r);return e.digest("hex")},Jne=async(t,e)=>t.size===e.size&&await Zne(t.path)===await Zne(e.path),Xne=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Kr(["reset","--soft","HEAD~1"],{cwd:t})},I$=async(t=[],e=process.cwd())=>{await Kr(["add",".",...t],{cwd:e})},C$=async(t=process.cwd())=>{let e=await Kr(["status","-s"],{cwd:t});return String(e.stdout??"")},nie=/.. (.+)?\.log$/,aFe=[nie],cFe=async(t=process.cwd())=>{let e=await C$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
102
102
|
`).filter(i=>aFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},lFe=async(t=process.cwd())=>{try{return await Kr(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},P$=async(t=process.cwd())=>{let{stdout:e}=await Kr(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},iie=async(t=process.cwd())=>{let{stdout:e}=await Kr(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},O$=async(t,e=process.cwd())=>{t||=await C$(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(nie)?.[1];o&&n.push(`:!${o}.log`)}),n},oie=async(t=process.cwd())=>{await Kr(["reset","--hard","HEAD"],{cwd:t})},sie=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))},uFe=t=>{let e=t.split(`
|
|
@@ -177,7 +177,7 @@ for await (const chunk of stream) {
|
|
|
177
177
|
|
|
178
178
|
## Image Generation
|
|
179
179
|
|
|
180
|
-
Use a Gemini image model, also known as "Nano Banana": pick a `gemini` model with `image` in its name from the Available Models list. Generated images come back as inline data parts:
|
|
180
|
+
Use a Gemini image model, also known as "Nano Banana": pick a `gemini` model with `image` in its name from the Available Models list. As with the other examples, AI Gateway injects the credentials — no explicit API key or base URL is needed. Generated images come back as inline data parts:
|
|
181
181
|
|
|
182
182
|
```typescript
|
|
183
183
|
import { GoogleGenAI } from '@google/genai'
|
|
@@ -196,6 +196,25 @@ for (const part of response.candidates[0].content.parts) {
|
|
|
196
196
|
}
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
+
Provider variables such as `GEMINI_API_KEY` are injected at runtime on deployed sites. In a build step or one-off
|
|
200
|
+
script (for example, generating static assets during this run) they may be absent and only the gateway variables are
|
|
201
|
+
set. In that case pass the gateway credentials explicitly — the gateway serves the Gemini REST API at its base URL,
|
|
202
|
+
with no provider path prefix:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import { GoogleGenAI } from '@google/genai'
|
|
206
|
+
|
|
207
|
+
// Zero-config on deployed sites; explicit gateway fallback for build-time scripts.
|
|
208
|
+
const ai = new GoogleGenAI(
|
|
209
|
+
process.env.GEMINI_API_KEY
|
|
210
|
+
? {}
|
|
211
|
+
: {
|
|
212
|
+
apiKey: process.env.NETLIFY_AI_GATEWAY_KEY,
|
|
213
|
+
httpOptions: { baseUrl: process.env.NETLIFY_AI_GATEWAY_BASE_URL?.replace(/\/$/, '') },
|
|
214
|
+
},
|
|
215
|
+
)
|
|
216
|
+
```
|
|
217
|
+
|
|
199
218
|
If the project already uses the OpenAI SDK, image generation is also available via the Responses API with the `image_generation` tool:
|
|
200
219
|
|
|
201
220
|
```typescript
|
package/package.json
CHANGED