@bonsai-ai/cli 0.1.7 → 0.1.8
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/cli.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -256,7 +256,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
|
|
|
256
256
|
`,LF:`
|
|
257
257
|
`,concatBytes:XV},JqD=(D,F)=>{let B=new Uint8Array(D.length+F.length);return B.set(D,0),B.set(F,D.length),B},YqD={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:JqD};import{Buffer as qqD}from"node:buffer";var bm=(D,F)=>D?void 0:UqD.bind(void 0,F),UqD=function*(D,F){if(typeof F!=="string"&&!B8(F)&&!qqD.isBuffer(F))throw new TypeError(`The \`${D}\` option's transform must use "objectMode: true" to receive as input: ${typeof F}.`);yield F},gm=(D,F)=>D?CqD.bind(void 0,F):HqD.bind(void 0,F),CqD=function*(D,F){lm(D,F),yield F},HqD=function*(D,F){if(lm(D,F),typeof F!=="string"&&!B8(F))throw new TypeError(`The \`${D}\` option's function must yield a string or an Uint8Array, not ${typeof F}.`);yield F},lm=(D,F)=>{if(F===null||F===void 0)throw new TypeError(`The \`${D}\` option's function must not call \`yield ${F}\`.
|
|
258
258
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
259
|
-
if (condition) { yield value; }`)};import{Buffer as WqD}from"node:buffer";import{StringDecoder as KqD}from"node:string_decoder";var fY=(D,F,B)=>{if(B)return;if(D)return{transform:EqD.bind(void 0,new TextEncoder)};let Q=new KqD(F);return{transform:VqD.bind(void 0,Q),final:RqD.bind(void 0,Q)}},EqD=function*(D,F){if(WqD.isBuffer(F))yield Q5(F);else if(typeof F==="string")yield D.encode(F);else yield F},VqD=function*(D,F){yield B8(F)?D.write(F):F},RqD=function*(D){let F=D.end();if(F!=="")yield F};import{callbackify as mm}from"node:util";var JV=mm(async(D,F,B,Q)=>{F.currentIterable=D(...B);try{for await(let L of F.currentIterable)Q.push(L)}finally{delete F.currentIterable}}),vY=async function*(D,F,B){if(B===F.length){yield D;return}let{transform:Q=uqD}=F[B];for await(let L of Q(D))yield*vY(L,F,B+1)},pm=async function*(D){for(let[F,{final:B}]of Object.entries(D))yield*IqD(B,Number(F),D)},IqD=async function*(D,F,B){if(D===void 0)return;for await(let Q of D())yield*vY(Q,B,F+1)},cm=mm(async({currentIterable:D},F)=>{if(D!==void 0){await(F?D.throw(F):D.return());return}if(F)throw F}),uqD=function*(D){yield D};var YV=(D,F,B,Q)=>{try{for(let L of D(...F))B.push(L);Q()}catch(L){Q(L)}},nm=(D,F)=>[...F.flatMap((B)=>[...c7(B,D,0)]),...XZ(D)],c7=function*(D,F,B){if(B===F.length){yield D;return}let{transform:Q=OqD}=F[B];for(let L of Q(D))yield*c7(L,F,B+1)},XZ=function*(D){for(let[F,{final:B}]of Object.entries(D))yield*AqD(B,Number(F),D)},AqD=function*(D,F,B){if(D===void 0)return;for(let Q of D())yield*c7(Q,B,F+1)},OqD=function*(D){yield D};var qV=({value:D,value:{transform:F,final:B,writableObjectMode:Q,readableObjectMode:L},optionName:Z},{encoding:G})=>{let J={},C=im(D,G,Z),K=p7(F),V=p7(B),R=K?JV.bind(void 0,vY,J):YV.bind(void 0,c7),I=K||V?JV.bind(void 0,pm,J):YV.bind(void 0,XZ),A=K||V?cm.bind(void 0,J):void 0;return{stream:new TqD({writableObjectMode:Q,writableHighWaterMark:dm(Q),readableObjectMode:L,readableHighWaterMark:dm(L),transform(T,k,p){R([T,C,0],this,p)},flush(T){I([C],this,T)},destroy:A})}},xY=(D,F,B,Q)=>{let L=F.filter(({type:G})=>G==="generator"),Z=Q?L.reverse():L;for(let{value:G,optionName:J}of Z){let C=im(G,B,J);D=nm(C,D)}return D},im=({transform:D,final:F,binary:B,writableObjectMode:Q,readableObjectMode:L,preserveNewlines:Z},G,J)=>{let C={};return[{transform:bm(Q,J)},fY(B,G,Q),SY(B,Z,Q,C),{transform:D,final:F},{transform:gm(L,J)},hm({binary:B,preserveNewlines:Z,readableObjectMode:L,state:C})].filter(Boolean)};var rm=(D,F)=>{for(let B of MqD(D))NqD(D,B,F)},MqD=(D)=>new Set(Object.entries(D).filter(([,{direction:F}])=>F==="input").map(([F])=>Number(F))),NqD=(D,F,B)=>{let{stdioItems:Q}=D[F],L=Q.filter(({contents:J})=>J!==void 0);if(L.length===0)return;if(F!==0){let[{type:J,optionName:C}]=L;throw new TypeError(`Only the \`stdin\` option, not \`${C}\`, can be ${UF[J]} with synchronous methods.`)}let G=L.map(({contents:J})=>J).map((J)=>PqD(J,Q));B.input=DZ(G)},PqD=(D,F)=>{let B=xY(D,F,"utf8",!0);return _qD(B),DZ(B)},_qD=(D)=>{let F=D.find((B)=>typeof B!=="string"&&!B8(B));if(F!==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: ${F}.`)};import{writeFileSync as fqD,appendFileSync as vqD}from"node:fs";var yY=({stdioItems:D,encoding:F,verboseInfo:B,fdNumber:Q})=>Q!=="all"&&cB(B,Q)&&!v6.has(F)&&jqD(Q)&&(D.some(({type:L,value:Z})=>L==="native"&&wqD.has(Z))||D.every(({type:L})=>J4.has(L))),jqD=(D)=>D===1||D===2,wqD=new Set(["pipe","overlapped"]),am=async(D,F,B,Q)=>{for await(let L of D)if(!SqD(F))om(L,B,Q)},tm=(D,F,B)=>{for(let Q of D)om(Q,F,B)},SqD=(D)=>D._readableState.pipes.length>0,om=(D,F,B)=>{let Q=dJ(D);U2({type:"output",verboseMessage:Q,fdNumber:F,verboseInfo:B})};var sm=({fileDescriptors:D,syncResult:{output:F},options:B,isMaxBuffer:Q,verboseInfo:L})=>{if(F===null)return{output:Array.from({length:3})};let Z={},G=new Set([]);return{output:F.map((C,K)=>xqD({result:C,fileDescriptors:D,fdNumber:K,state:Z,outputFiles:G,isMaxBuffer:Q,verboseInfo:L},B)),...Z}},xqD=({result:D,fileDescriptors:F,fdNumber:B,state:Q,outputFiles:L,isMaxBuffer:Z,verboseInfo:G},{buffer:J,encoding:C,lines:K,stripFinalNewline:V,maxBuffer:R})=>{if(D===null)return;let I=el(D,Z,R),A=Q5(I),{stdioItems:P,objectMode:T}=F[B],k=yqD([A],P,C,Q),{serializedResult:p,finalResult:LD=p}=kqD({chunks:k,objectMode:T,encoding:C,lines:K,stripFinalNewline:V,fdNumber:B});hqD({serializedResult:p,fdNumber:B,state:Q,verboseInfo:G,encoding:C,stdioItems:P,objectMode:T});let e=J[B]?LD:void 0;try{if(Q.error===void 0)bqD(p,P,L);return e}catch(s){return Q.error=s,e}},yqD=(D,F,B,Q)=>{try{return xY(D,F,B,!1)}catch(L){return Q.error=L,D}},kqD=({chunks:D,objectMode:F,encoding:B,lines:Q,stripFinalNewline:L,fdNumber:Z})=>{if(F)return{serializedResult:D};if(B==="buffer")return{serializedResult:DZ(D)};let G=Ub(D,B);if(Q[Z])return{serializedResult:G,finalResult:zV(G,!L[Z],F)};return{serializedResult:G}},hqD=({serializedResult:D,fdNumber:F,state:B,verboseInfo:Q,encoding:L,stdioItems:Z,objectMode:G})=>{if(!yY({stdioItems:Z,encoding:L,verboseInfo:Q,fdNumber:F}))return;let J=zV(D,!1,G);try{tm(J,F,Q)}catch(C){B.error??=C}},bqD=(D,F,B)=>{for(let{path:Q,append:L}of F.filter(({type:Z})=>jY.has(Z))){let Z=typeof Q==="string"?Q:Q.toString();if(L||B.has(Z))vqD(Q,D);else B.add(Z),fqD(Q,D)}};var em=([,D,F],B)=>{if(!B.all)return;if(D===void 0)return F;if(F===void 0)return D;if(Array.isArray(D))return Array.isArray(F)?[...D,...F]:[...D,G5(F,B,"all")];if(Array.isArray(F))return[G5(D,B,"all"),...F];if(B8(D)&&B8(F))return EE([D,F]);return`${D}${F}`};import{once as UV}from"node:events";var Dp=async(D,F)=>{let[B,Q]=await gqD(D);return F.isForcefullyTerminated??=!1,[B,Q]},gqD=async(D)=>{let[F,B]=await Promise.allSettled([UV(D,"spawn"),UV(D,"exit")]);if(F.status==="rejected")return[];return B.status==="rejected"?Fp(D):B.value},Fp=async(D)=>{try{return await UV(D,"exit")}catch{return Fp(D)}},Bp=async(D)=>{let[F,B]=await D;if(!lqD(F,B)&&CV(F,B))throw new C2;return[F,B]},lqD=(D,F)=>D===void 0&&F===void 0,CV=(D,F)=>D!==0||F!==null;var Qp=({error:D,status:F,signal:B,output:Q},{maxBuffer:L})=>{let Z=mqD(D,F,B),G=Z?.code==="ETIMEDOUT",J=sl(Z,Q,L);return{resultError:Z,exitCode:F,signal:B,timedOut:G,isMaxBuffer:J}},mqD=(D,F,B)=>{if(D!==void 0)return D;return CV(F,B)?new C2:void 0};var Lp=(D,F,B)=>{let{file:Q,commandArguments:L,command:Z,escapedCommand:G,startTime:J,verboseInfo:C,options:K,fileDescriptors:V}=cqD(D,F,B),R=iqD({file:Q,commandArguments:L,options:K,command:Z,escapedCommand:G,verboseInfo:C,fileDescriptors:V,startTime:J});return eB(R,C,K)},cqD=(D,F,B)=>{let{command:Q,escapedCommand:L,startTime:Z,verboseInfo:G}=rJ(D,F,B),J=nqD(B),{file:C,commandArguments:K,options:V}=KY(D,F,J);dqD(V);let R=vm(V,G);return{file:C,commandArguments:K,command:Q,escapedCommand:L,startTime:Z,verboseInfo:G,options:V,fileDescriptors:R}},nqD=(D)=>D.node&&!D.ipc?{...D,ipc:!1}:D,dqD=({ipc:D,ipcInput:F,detached:B,cancelSignal:Q})=>{if(F)kY("ipcInput");if(D)kY("ipc: true");if(B)kY("detached: true");if(Q)kY("cancelSignal")},kY=(D)=>{throw new TypeError(`The "${D}" option cannot be used with synchronous methods.`)},iqD=({file:D,commandArguments:F,options:B,command:Q,escapedCommand:L,verboseInfo:Z,fileDescriptors:G,startTime:J})=>{let C=rqD({file:D,commandArguments:F,options:B,command:Q,escapedCommand:L,fileDescriptors:G,startTime:J});if(C.failed)return C;let{resultError:K,exitCode:V,signal:R,timedOut:I,isMaxBuffer:A}=Qp(C,B),{output:P,error:T=K}=sm({fileDescriptors:G,syncResult:C,options:B,isMaxBuffer:A,verboseInfo:Z}),k=P.map((LD,e)=>G5(LD,B,e)),p=G5(em(P,B),B,"all");return tqD({error:T,exitCode:V,signal:R,timedOut:I,isMaxBuffer:A,stdio:k,all:p,options:B,command:Q,escapedCommand:L,startTime:J})},rqD=({file:D,commandArguments:F,options:B,command:Q,escapedCommand:L,fileDescriptors:Z,startTime:G})=>{try{rm(Z,B);let J=aqD(B);return pqD(...EY(D,F,J))}catch(J){return sB({error:J,command:Q,escapedCommand:L,fileDescriptors:Z,options:B,startTime:G,isSync:!0})}},aqD=({encoding:D,maxBuffer:F,...B})=>({...B,encoding:"buffer",maxBuffer:MY(F)}),tqD=({error:D,exitCode:F,signal:B,timedOut:Q,isMaxBuffer:L,stdio:Z,all:G,options:J,command:C,escapedCommand:K,startTime:V})=>D===void 0?NY({command:C,escapedCommand:K,stdio:Z,all:G,ipcOutput:[],options:J,startTime:V}):GZ({error:D,command:C,escapedCommand:K,timedOut:Q,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:L,isForcefullyTerminated:!1,exitCode:F,signal:B,stdio:Z,all:G,ipcOutput:[],options:J,startTime:V,isSync:!0});import{setMaxListeners as kCD}from"node:events";import{spawn as hCD}from"node:child_process";import zp from"node:process";import{once as HV,on as oqD}from"node:events";var $p=({anyProcess:D,channel:F,isSubprocess:B,ipc:Q},{reference:L=!0,filter:Z}={})=>{return iB({methodName:"getOneMessage",isSubprocess:B,ipc:Q,isConnected:YY(D)}),sqD({anyProcess:D,channel:F,isSubprocess:B,filter:Z,reference:L})},sqD=async({anyProcess:D,channel:F,isSubprocess:B,filter:Q,reference:L})=>{GY(F,L);let Z=qF(D,F,B),G=new AbortController;try{return await Promise.race([eqD(Z,Q,G),DUD(Z,B,G),FUD(Z,B,G)])}catch(J){throw rB(D),J}finally{G.abort(),XY(F,L)}},eqD=async(D,F,{signal:B})=>{if(F===void 0){let[Q]=await HV(D,"message",{signal:B});return Q}for await(let[Q]of oqD(D,"message",{signal:B}))if(F(Q))return Q},DUD=async(D,F,{signal:B})=>{await HV(D,"disconnect",{signal:B}),cg(F)},FUD=async(D,F,{signal:B})=>{let[Q]=await HV(D,"strict:error",{signal:B});throw LY(Q,F)};import{once as Gp,on as BUD}from"node:events";var Xp=({anyProcess:D,channel:F,isSubprocess:B,ipc:Q},{reference:L=!0}={})=>WV({anyProcess:D,channel:F,isSubprocess:B,ipc:Q,shouldAwait:!B,reference:L}),WV=({anyProcess:D,channel:F,isSubprocess:B,ipc:Q,shouldAwait:L,reference:Z})=>{iB({methodName:"getEachMessage",isSubprocess:B,ipc:Q,isConnected:YY(D)}),GY(F,Z);let G=qF(D,F,B),J=new AbortController,C={};return QUD(D,G,J),LUD({ipcEmitter:G,isSubprocess:B,controller:J,state:C}),$UD({anyProcess:D,channel:F,ipcEmitter:G,isSubprocess:B,shouldAwait:L,controller:J,state:C,reference:Z})},QUD=async(D,F,B)=>{try{await Gp(F,"disconnect",{signal:B.signal}),B.abort()}catch{}},LUD=async({ipcEmitter:D,isSubprocess:F,controller:B,state:Q})=>{try{let[L]=await Gp(D,"strict:error",{signal:B.signal});Q.error=LY(L,F),B.abort()}catch{}},$UD=async function*({anyProcess:D,channel:F,ipcEmitter:B,isSubprocess:Q,shouldAwait:L,controller:Z,state:G,reference:J}){try{for await(let[C]of BUD(B,"message",{signal:Z.signal}))Zp(G),yield C}catch{Zp(G)}finally{if(Z.abort(),XY(F,J),!Q)rB(D);if(L)await D}},Zp=({error:D})=>{if(D)throw D};var Jp=(D,{ipc:F})=>{Object.assign(D,qp(D,!1,F))},Yp=()=>{let D=zp,F=!0,B=zp.channel!==void 0;return{...qp(D,!0,B),getCancelSignal:Kl.bind(void 0,{anyProcess:D,channel:D.channel,isSubprocess:!0,ipc:B})}},qp=(D,F,B)=>({sendMessage:HY.bind(void 0,{anyProcess:D,channel:D.channel,isSubprocess:F,ipc:B}),getOneMessage:$p.bind(void 0,{anyProcess:D,channel:D.channel,isSubprocess:F,ipc:B}),getEachMessage:Xp.bind(void 0,{anyProcess:D,channel:D.channel,isSubprocess:F,ipc:B})});import{ChildProcess as ZUD}from"node:child_process";import{PassThrough as GUD,Readable as XUD,Writable as zUD,Duplex as JUD}from"node:stream";var Up=({error:D,command:F,escapedCommand:B,fileDescriptors:Q,options:L,startTime:Z,verboseInfo:G})=>{ZV(Q);let J=new ZUD;YUD(J,Q),Object.assign(J,{readable:qUD,writable:UUD,duplex:CUD});let C=sB({error:D,command:F,escapedCommand:B,fileDescriptors:Q,options:L,startTime:Z,isSync:!1}),K=HUD(C,G,L);return{subprocess:J,promise:K}},YUD=(D,F)=>{let B=zZ(),Q=zZ(),L=zZ(),Z=Array.from({length:F.length-3},zZ),G=zZ(),J=[B,Q,L,...Z];Object.assign(D,{stdin:B,stdout:Q,stderr:L,all:G,stdio:J})},zZ=()=>{let D=new GUD;return D.end(),D},qUD=()=>new XUD({read(){}}),UUD=()=>new zUD({write(){}}),CUD=()=>new JUD({read(){},write(){}}),HUD=async(D,F,B)=>eB(D,F,B);import{createReadStream as Cp,createWriteStream as Hp}from"node:fs";import{Buffer as WUD}from"node:buffer";import{Readable as JZ,Writable as KUD,Duplex as EUD}from"node:stream";var Kp=(D,F)=>wY(VUD,D,F,!1),YZ=({type:D,optionName:F})=>{throw new TypeError(`The \`${F}\` option cannot be ${UF[D]}.`)},Wp={fileNumber:YZ,generator:qV,asyncGenerator:qV,nodeStream:({value:D})=>({stream:D}),webTransform({value:{transform:D,writableObjectMode:F,readableObjectMode:B}}){let Q=F||B;return{stream:EUD.fromWeb(D,{objectMode:Q})}},duplex:({value:{transform:D}})=>({stream:D}),native(){}},VUD={input:{...Wp,fileUrl:({value:D})=>({stream:Cp(D)}),filePath:({value:{file:D}})=>({stream:Cp(D)}),webStream:({value:D})=>({stream:JZ.fromWeb(D)}),iterable:({value:D})=>({stream:JZ.from(D)}),asyncIterable:({value:D})=>({stream:JZ.from(D)}),string:({value:D})=>({stream:JZ.from(D)}),uint8Array:({value:D})=>({stream:JZ.from(WUD.from(D))})},output:{...Wp,fileUrl:({value:D})=>({stream:Hp(D)}),filePath:({value:{file:D,append:F}})=>({stream:Hp(D,F?{flags:"a"}:{})}),webStream:({value:D})=>({stream:KUD.fromWeb(D)}),iterable:YZ,asyncIterable:YZ,string:YZ,uint8Array:YZ}};import{on as RUD,once as Ep}from"node:events";import{PassThrough as IUD,getDefaultHighWaterMark as uUD}from"node:stream";import{finished as Ip}from"node:stream/promises";function n7(D){if(!Array.isArray(D))throw new TypeError(`Expected an array, got \`${typeof D}\`.`);for(let L of D)KV(L);let F=D.some(({readableObjectMode:L})=>L),B=AUD(D,F),Q=new up({objectMode:F,writableHighWaterMark:B,readableHighWaterMark:B});for(let L of D)Q.add(L);return Q}var AUD=(D,F)=>{if(D.length===0)return uUD(F);let B=D.filter(({readableObjectMode:Q})=>Q===F).map(({readableHighWaterMark:Q})=>Q);return Math.max(...B)};class up extends IUD{#F=new Set([]);#B=new Set([]);#D=new Set([]);#Q;#$=Symbol("unpipe");#L=new WeakMap;add(D){if(KV(D),this.#F.has(D))return;this.#F.add(D),this.#Q??=OUD(this,this.#F,this.#$);let F=NUD({passThroughStream:this,stream:D,streams:this.#F,ended:this.#B,aborted:this.#D,onFinished:this.#Q,unpipeEvent:this.#$});this.#L.set(D,F),D.pipe(this,{end:!1})}async remove(D){if(KV(D),!this.#F.has(D))return!1;let F=this.#L.get(D);if(F===void 0)return!1;return this.#L.delete(D),D.unpipe(this),await F,!0}}var OUD=async(D,F,B)=>{hY(D,Vp);let Q=new AbortController;try{await Promise.race([TUD(D,Q),MUD(D,F,B,Q)])}finally{Q.abort(),hY(D,-Vp)}},TUD=async(D,{signal:F})=>{try{await Ip(D,{signal:F,cleanup:!0})}catch(B){throw Ap(D,B),B}},MUD=async(D,F,B,{signal:Q})=>{for await(let[L]of RUD(D,"unpipe",{signal:Q}))if(F.has(L))L.emit(B)},KV=(D)=>{if(typeof D?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof D}\`.`)},NUD=async({passThroughStream:D,stream:F,streams:B,ended:Q,aborted:L,onFinished:Z,unpipeEvent:G})=>{hY(D,Rp);let J=new AbortController;try{await Promise.race([PUD(Z,F,J),_UD({passThroughStream:D,stream:F,streams:B,ended:Q,aborted:L,controller:J}),jUD({stream:F,streams:B,ended:Q,aborted:L,unpipeEvent:G,controller:J})])}finally{J.abort(),hY(D,-Rp)}if(B.size>0&&B.size===Q.size+L.size)if(Q.size===0&&L.size>0)EV(D);else wUD(D)},PUD=async(D,F,{signal:B})=>{try{if(await D,!B.aborted)EV(F)}catch(Q){if(!B.aborted)Ap(F,Q)}},_UD=async({passThroughStream:D,stream:F,streams:B,ended:Q,aborted:L,controller:{signal:Z}})=>{try{if(await Ip(F,{signal:Z,cleanup:!0,readable:!0,writable:!1}),B.has(F))Q.add(F)}catch(G){if(Z.aborted||!B.has(F))return;if(Op(G))L.add(F);else Tp(D,G)}},jUD=async({stream:D,streams:F,ended:B,aborted:Q,unpipeEvent:L,controller:{signal:Z}})=>{if(await Ep(D,L,{signal:Z}),!D.readable)return Ep(Z,"abort",{signal:Z});F.delete(D),B.delete(D),Q.delete(D)},wUD=(D)=>{if(D.writable)D.end()},Ap=(D,F)=>{if(Op(F))EV(D);else Tp(D,F)},Op=(D)=>D?.code==="ERR_STREAM_PREMATURE_CLOSE",EV=(D)=>{if(D.readable||D.writable)D.destroy()},Tp=(D,F)=>{if(!D.destroyed)D.once("error",SUD),D.destroy(F)},SUD=()=>{},hY=(D,F)=>{let B=D.getMaxListeners();if(B!==0&&B!==Number.POSITIVE_INFINITY)D.setMaxListeners(B+F)},Vp=2,Rp=1;import{finished as Mp}from"node:stream/promises";var FQ=(D,F)=>{D.pipe(F),fUD(D,F),vUD(D,F)},fUD=async(D,F)=>{if(x4(D)||x4(F))return;try{await Mp(D,{cleanup:!0,readable:!0,writable:!1})}catch{}VV(F)},VV=(D)=>{if(D.writable)D.end()},vUD=async(D,F)=>{if(x4(D)||x4(F))return;try{await Mp(F,{cleanup:!0,readable:!1,writable:!0})}catch{}RV(D)},RV=(D)=>{if(D.readable)D.destroy()};var Np=(D,F,B)=>{let Q=new Map;for(let[L,{stdioItems:Z,direction:G}]of Object.entries(F)){for(let{stream:J}of Z.filter(({type:C})=>J4.has(C)))xUD(D,J,G,L);for(let{stream:J}of Z.filter(({type:C})=>!J4.has(C)))kUD({subprocess:D,stream:J,direction:G,fdNumber:L,pipeGroups:Q,controller:B})}for(let[L,Z]of Q.entries()){let G=Z.length===1?Z[0]:n7(Z);FQ(G,L)}},xUD=(D,F,B,Q)=>{if(B==="output")FQ(D.stdio[Q],F);else FQ(F,D.stdio[Q]);let L=yUD[Q];if(L!==void 0)D[L]=F;D.stdio[Q]=F},yUD=["stdin","stdout","stderr"],kUD=({subprocess:D,stream:F,direction:B,fdNumber:Q,pipeGroups:L,controller:Z})=>{if(F===void 0)return;hUD(F,Z);let[G,J]=B==="output"?[F,D.stdio[Q]]:[D.stdio[Q],F],C=L.get(G)??[];L.set(G,[...C,J])},hUD=(D,{signal:F})=>{if(x4(D))l7(D,bUD,F)},bUD=2;import{addAbortListener as mUD}from"node:events";var d7=[];d7.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")d7.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")d7.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var bY=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",IV=Symbol.for("signal-exit emitter"),uV=globalThis,gUD=Object.defineProperty.bind(Object);class Pp{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(uV[IV])return uV[IV];gUD(uV,IV,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let B=this.listeners[D],Q=B.indexOf(F);if(Q===-1)return;if(Q===0&&B.length===1)B.length=0;else B.splice(Q,1)}emit(D,F,B){if(this.emitted[D])return!1;this.emitted[D]=!0;let Q=!1;for(let L of this.listeners[D])Q=L(F,B)===!0||Q;if(D==="exit")Q=this.emit("afterExit",F,B)||Q;return Q}}class OV{}var lUD=(D)=>{return{onExit(F,B){return D.onExit(F,B)},load(){return D.load()},unload(){return D.unload()}}};class _p extends OV{onExit(){return()=>{}}load(){}unload(){}}class jp extends OV{#F=AV.platform==="win32"?"SIGINT":"SIGHUP";#B=new Pp;#D;#Q;#$;#L={};#Z=!1;constructor(D){super();this.#D=D,this.#L={};for(let F of d7)this.#L[F]=()=>{let B=this.#D.listeners(F),{count:Q}=this.#B,L=D;if(typeof L.__signal_exit_emitter__==="object"&&typeof L.__signal_exit_emitter__.count==="number")Q+=L.__signal_exit_emitter__.count;if(B.length===Q){this.unload();let Z=this.#B.emit("exit",null,F),G=F==="SIGHUP"?this.#F:F;if(!Z)D.kill(D.pid,G)}};this.#$=D.reallyExit,this.#Q=D.emit}onExit(D,F){if(!bY(this.#D))return()=>{};if(this.#Z===!1)this.load();let B=F?.alwaysLast?"afterExit":"exit";return this.#B.on(B,D),()=>{if(this.#B.removeListener(B,D),this.#B.listeners.exit.length===0&&this.#B.listeners.afterExit.length===0)this.unload()}}load(){if(this.#Z)return;this.#Z=!0,this.#B.count+=1;for(let D of d7)try{let F=this.#L[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#X(D,...F)},this.#D.reallyExit=(D)=>{return this.#G(D)}}unload(){if(!this.#Z)return;this.#Z=!1,d7.forEach((D)=>{let F=this.#L[D];if(!F)throw new Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch(B){}}),this.#D.emit=this.#Q,this.#D.reallyExit=this.#$,this.#B.count-=1}#G(D){if(!bY(this.#D))return 0;return this.#D.exitCode=D||0,this.#B.emit("exit",this.#D.exitCode,null),this.#$.call(this.#D,this.#D.exitCode)}#X(D,...F){let B=this.#Q;if(D==="exit"&&bY(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let Q=B.call(this.#D,D,...F);return this.#B.emit("exit",this.#D.exitCode,null),Q}else return B.call(this.#D,D,...F)}}var AV=globalThis.process,{onExit:wp,load:BhD,unload:QhD}=lUD(bY(AV)?new jp(AV):new _p);var Sp=(D,{cleanup:F,detached:B},{signal:Q})=>{if(!F||B)return;let L=wp(()=>{D.kill()});mUD(Q,()=>{L()})};var vp=({source:D,sourcePromise:F,boundOptions:B,createNested:Q},...L)=>{let Z=iJ(),{destination:G,destinationStream:J,destinationError:C,from:K,unpipeSignal:V}=pUD(B,Q,L),{sourceStream:R,sourceError:I}=nUD(D,K),{options:A,fileDescriptors:P}=W2.get(D);return{sourcePromise:F,sourceStream:R,sourceOptions:A,sourceError:I,destination:G,destinationStream:J,destinationError:C,unpipeSignal:V,fileDescriptors:P,startTime:Z}},pUD=(D,F,B)=>{try{let{destination:Q,pipeOptions:{from:L,to:Z,unpipeSignal:G}={}}=cUD(D,F,...B),J=ZY(Q,Z);return{destination:Q,destinationStream:J,from:L,unpipeSignal:G}}catch(Q){return{destinationError:Q}}},cUD=(D,F,B,...Q)=>{if(Array.isArray(B))return{destination:F(fp,D)(B,...Q),pipeOptions:D};if(typeof B==="string"||B instanceof URL||WE(B)){if(Object.keys(D).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[L,Z,G]=kJ(B,...Q);return{destination:F(fp)(L,Z,G),pipeOptions:G}}if(W2.has(B)){if(Object.keys(D).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:B,pipeOptions:Q[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${B}`)},fp=({options:D})=>({options:{...D,stdin:"pipe",piped:!0}}),nUD=(D,F)=>{try{return{sourceStream:aB(D,F)}}catch(B){return{sourceError:B}}};var yp=({sourceStream:D,sourceError:F,destinationStream:B,destinationError:Q,fileDescriptors:L,sourceOptions:Z,startTime:G})=>{let J=dUD({sourceStream:D,sourceError:F,destinationStream:B,destinationError:Q});if(J!==void 0)throw TV({error:J,fileDescriptors:L,sourceOptions:Z,startTime:G})},dUD=({sourceStream:D,sourceError:F,destinationStream:B,destinationError:Q})=>{if(F!==void 0&&Q!==void 0)return Q;if(Q!==void 0)return RV(D),Q;if(F!==void 0)return VV(B),F},TV=({error:D,fileDescriptors:F,sourceOptions:B,startTime:Q})=>sB({error:D,command:xp,escapedCommand:xp,fileDescriptors:F,options:B,startTime:Q,isSync:!1}),xp="source.pipe(destination)";var kp=async(D)=>{let[{status:F,reason:B,value:Q=B},{status:L,reason:Z,value:G=Z}]=await D;if(!G.pipedFrom.includes(Q))G.pipedFrom.push(Q);if(L==="rejected")throw G;if(F==="rejected")throw Q;return G};import{finished as iUD}from"node:stream/promises";var hp=(D,F,B)=>{let Q=gY.has(F)?aUD(D,F):rUD(D,F);return l7(D,oUD,B.signal),l7(F,sUD,B.signal),tUD(F),Q},rUD=(D,F)=>{let B=n7([D]);return FQ(B,F),gY.set(F,B),B},aUD=(D,F)=>{let B=gY.get(F);return B.add(D),B},tUD=async(D)=>{try{await iUD(D,{cleanup:!0,readable:!1,writable:!0})}catch{}gY.delete(D)},gY=new WeakMap,oUD=2,sUD=1;import{aborted as eUD}from"node:util";var bp=(D,F)=>D===void 0?[]:[DCD(D,F)],DCD=async(D,{sourceStream:F,mergedStream:B,fileDescriptors:Q,sourceOptions:L,startTime:Z})=>{await eUD(D,F),await B.remove(F);let G=new Error("Pipe canceled by `unpipeSignal` option.");throw TV({error:G,fileDescriptors:Q,sourceOptions:L,startTime:Z})};var lY=(D,...F)=>{if(v3(F[0]))return lY.bind(void 0,{...D,boundOptions:{...D.boundOptions,...F[0]}});let{destination:B,...Q}=vp(D,...F),L=FCD({...Q,destination:B});return L.pipe=lY.bind(void 0,{...D,source:B,sourcePromise:L,boundOptions:{}}),L},FCD=async({sourcePromise:D,sourceStream:F,sourceOptions:B,sourceError:Q,destination:L,destinationStream:Z,destinationError:G,unpipeSignal:J,fileDescriptors:C,startTime:K})=>{let V=BCD(D,L);yp({sourceStream:F,sourceError:Q,destinationStream:Z,destinationError:G,fileDescriptors:C,sourceOptions:B,startTime:K});let R=new AbortController;try{let I=hp(F,Z,R);return await Promise.race([kp(V),...bp(J,{sourceStream:F,mergedStream:I,sourceOptions:B,fileDescriptors:C,startTime:K})])}finally{R.abort()}},BCD=(D,F)=>Promise.allSettled([D,F]);import{setImmediate as zCD}from"node:timers/promises";import{on as QCD}from"node:events";import{getDefaultHighWaterMark as LCD}from"node:stream";var mY=({subprocessStdout:D,subprocess:F,binary:B,shouldEncode:Q,encoding:L,preserveNewlines:Z})=>{let G=new AbortController;return $CD(F,G),lp({stream:D,controller:G,binary:B,shouldEncode:!D.readableObjectMode&&Q,encoding:L,shouldSplit:!D.readableObjectMode,preserveNewlines:Z})},$CD=async(D,F)=>{try{await D}catch{}finally{F.abort()}},MV=({stream:D,onStreamEnd:F,lines:B,encoding:Q,stripFinalNewline:L,allMixed:Z})=>{let G=new AbortController;ZCD(F,G,D);let J=D.readableObjectMode&&!Z;return lp({stream:D,controller:G,binary:Q==="buffer",shouldEncode:!J,encoding:Q,shouldSplit:!J&&B,preserveNewlines:!L})},ZCD=async(D,F,B)=>{try{await D}catch{B.destroy()}finally{F.abort()}},lp=({stream:D,controller:F,binary:B,shouldEncode:Q,encoding:L,shouldSplit:Z,preserveNewlines:G})=>{let J=QCD(D,"data",{signal:F.signal,highWaterMark:gp,highWatermark:gp});return GCD({onStdoutChunk:J,controller:F,binary:B,shouldEncode:Q,encoding:L,shouldSplit:Z,preserveNewlines:G})},NV=LCD(!0),gp=NV,GCD=async function*({onStdoutChunk:D,controller:F,binary:B,shouldEncode:Q,encoding:L,shouldSplit:Z,preserveNewlines:G}){let J=XCD({binary:B,shouldEncode:Q,encoding:L,shouldSplit:Z,preserveNewlines:G});try{for await(let[C]of D)yield*c7(C,J,0)}catch(C){if(!F.signal.aborted)throw C}finally{yield*XZ(J)}},XCD=({binary:D,shouldEncode:F,encoding:B,shouldSplit:Q,preserveNewlines:L})=>[fY(D,B,!F),SY(D,L,!Q,{})].filter(Boolean);var mp=async({stream:D,onStreamEnd:F,fdNumber:B,encoding:Q,buffer:L,maxBuffer:Z,lines:G,allMixed:J,stripFinalNewline:C,verboseInfo:K,streamInfo:V})=>{let R=JCD({stream:D,onStreamEnd:F,fdNumber:B,encoding:Q,allMixed:J,verboseInfo:K,streamInfo:V});if(!L){await Promise.all([YCD(D),R]);return}let I=GV(C,B),A=MV({stream:D,onStreamEnd:F,lines:G,encoding:Q,stripFinalNewline:I,allMixed:J}),[P]=await Promise.all([qCD({stream:D,iterable:A,fdNumber:B,encoding:Q,maxBuffer:Z,lines:G}),R]);return P},JCD=async({stream:D,onStreamEnd:F,fdNumber:B,encoding:Q,allMixed:L,verboseInfo:Z,streamInfo:{fileDescriptors:G}})=>{if(!yY({stdioItems:G[B]?.stdioItems,encoding:Q,verboseInfo:Z,fdNumber:B}))return;let J=MV({stream:D,onStreamEnd:F,lines:!0,encoding:Q,stripFinalNewline:!0,allMixed:L});await am(J,D,B,Z)},YCD=async(D)=>{if(await zCD(),D.readableFlowing===null)D.resume()},qCD=async({stream:D,stream:{readableObjectMode:F},iterable:B,fdNumber:Q,encoding:L,maxBuffer:Z,lines:G})=>{try{if(F||G)return await uY(B,{maxBuffer:Z});if(L==="buffer")return new Uint8Array(await AY(B,{maxBuffer:Z}));return await TY(B,{maxBuffer:Z})}catch(J){return pp(al({error:J,stream:D,readableObjectMode:F,lines:G,encoding:L,fdNumber:Q}))}},PV=async(D)=>{try{return await D}catch(F){return pp(F)}},pp=({bufferedData:D})=>Yb(D)?new Uint8Array(D):D;import{finished as UCD}from"node:stream/promises";var qZ=async(D,F,B,{isSameDirection:Q,stopOnExit:L=!1}={})=>{let Z=CCD(D,B),G=new AbortController;try{await Promise.race([...L?[B.exitPromise]:[],UCD(D,{cleanup:!0,signal:G.signal})])}catch(J){if(!Z.stdinCleanedUp)KCD(J,F,B,Q)}finally{G.abort()}},CCD=(D,{originalStreams:[F],subprocess:B})=>{let Q={stdinCleanedUp:!1};if(D===F)HCD(D,B,Q);return Q},HCD=(D,F,B)=>{let{_destroy:Q}=D;D._destroy=(...L)=>{WCD(F,B),Q.call(D,...L)}},WCD=({exitCode:D,signalCode:F},B)=>{if(D!==null||F!==null)B.stdinCleanedUp=!0},KCD=(D,F,B,Q)=>{if(!ECD(D,F,B,Q))throw D},ECD=(D,F,B,Q=!0)=>{if(B.propagating)return cp(D)||pY(D);return B.propagating=!0,_V(B,F)===Q?cp(D):pY(D)},_V=({fileDescriptors:D},F)=>F!=="all"&&D[F].direction==="input",pY=(D)=>D?.code==="ERR_STREAM_PREMATURE_CLOSE",cp=(D)=>D?.code==="EPIPE";var np=({subprocess:D,encoding:F,buffer:B,maxBuffer:Q,lines:L,stripFinalNewline:Z,verboseInfo:G,streamInfo:J})=>D.stdio.map((C,K)=>jV({stream:C,fdNumber:K,encoding:F,buffer:B[K],maxBuffer:Q[K],lines:L[K],allMixed:!1,stripFinalNewline:Z,verboseInfo:G,streamInfo:J})),jV=async({stream:D,fdNumber:F,encoding:B,buffer:Q,maxBuffer:L,lines:Z,allMixed:G,stripFinalNewline:J,verboseInfo:C,streamInfo:K})=>{if(!D)return;let V=qZ(D,F,K);if(_V(K,F)){await V;return}let[R]=await Promise.all([mp({stream:D,onStreamEnd:V,fdNumber:F,encoding:B,buffer:Q,maxBuffer:L,lines:Z,allMixed:G,stripFinalNewline:J,verboseInfo:C,streamInfo:K}),V]);return R};var dp=({stdout:D,stderr:F},{all:B})=>B&&(D||F)?n7([D,F].filter(Boolean)):void 0,ip=({subprocess:D,encoding:F,buffer:B,maxBuffer:Q,lines:L,stripFinalNewline:Z,verboseInfo:G,streamInfo:J})=>jV({...VCD(D,B),fdNumber:"all",encoding:F,maxBuffer:Q[1]+Q[2],lines:L[1]||L[2],allMixed:RCD(D),stripFinalNewline:Z,verboseInfo:G,streamInfo:J}),VCD=({stdout:D,stderr:F,all:B},[,Q,L])=>{let Z=Q||L;if(!Z)return{stream:B,buffer:Z};if(!Q)return{stream:F,buffer:Z};if(!L)return{stream:D,buffer:Z};return{stream:B,buffer:Z}},RCD=({all:D,stdout:F,stderr:B})=>D&&F&&B&&F.readableObjectMode!==B.readableObjectMode;import{once as ICD}from"node:events";var rp=(D)=>cB(D,"ipc"),ap=(D,F)=>{let B=dJ(D);U2({type:"ipc",verboseMessage:B,fdNumber:"ipc",verboseInfo:F})};var tp=async({subprocess:D,buffer:F,maxBuffer:B,ipc:Q,ipcOutput:L,verboseInfo:Z})=>{if(!Q)return L;let G=rp(Z),J=L5(F,"ipc"),C=L5(B,"ipc");for await(let K of WV({anyProcess:D,channel:D.channel,isSubprocess:!1,ipc:Q,shouldAwait:!1,reference:!0})){if(J)tl(D,L,C),L.push(K);if(G)ap(K,Z)}return L},op=async(D,F)=>{return await Promise.allSettled([D]),F};var sp=async({subprocess:D,options:{encoding:F,buffer:B,maxBuffer:Q,lines:L,timeoutDuration:Z,cancelSignal:G,gracefulCancel:J,forceKillAfterDelay:C,stripFinalNewline:K,ipc:V,ipcInput:R},context:I,verboseInfo:A,fileDescriptors:P,originalStreams:T,onInternalError:k,controller:p})=>{let LD=Dp(D,I),e={originalStreams:T,fileDescriptors:P,subprocess:D,exitPromise:LD,propagating:!1},s=np({subprocess:D,encoding:F,buffer:B,maxBuffer:Q,lines:L,stripFinalNewline:K,verboseInfo:A,streamInfo:e}),$D=ip({subprocess:D,encoding:F,buffer:B,maxBuffer:Q,lines:L,stripFinalNewline:K,verboseInfo:A,streamInfo:e}),XD=[],CD=tp({subprocess:D,buffer:B,maxBuffer:Q,ipc:V,ipcOutput:XD,verboseInfo:A}),dD=uCD(T,D,e),ID=ACD(P,e);try{return await Promise.race([Promise.all([{},Bp(LD),Promise.all(s),$D,CD,Nl(D,R),...dD,...ID]),k,OCD(D,p),...ul(D,Z,I,p),...pg({subprocess:D,cancelSignal:G,gracefulCancel:J,context:I,controller:p}),...Rl({subprocess:D,cancelSignal:G,gracefulCancel:J,forceKillAfterDelay:C,context:I,controller:p})])}catch(o0){return I.terminationReason??="other",Promise.all([{error:o0},LD,Promise.all(s.map((C1)=>PV(C1))),PV($D),op(CD,XD),Promise.allSettled(dD),Promise.allSettled(ID)])}},uCD=(D,F,B)=>D.map((Q,L)=>Q===F.stdio[L]?void 0:qZ(Q,L,B)),ACD=(D,F)=>D.flatMap(({stdioItems:B},Q)=>B.filter(({value:L,stream:Z=L})=>k4(Z,{checkOpen:!1})&&!x4(Z)).map(({type:L,value:Z,stream:G=Z})=>qZ(G,Q,F,{isSameDirection:J4.has(L),stopOnExit:L==="native"}))),OCD=async(D,{signal:F})=>{let[B]=await ICD(D,"error",{signal:F});throw B};var ep=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),UZ=(D,F,B)=>{let Q=D[B];if(!Q.has(F))Q.set(F,[]);let L=Q.get(F),Z=H2();return L.push(Z),{resolve:Z.resolve.bind(Z),promises:L}},BQ=async({resolve:D,promises:F},B)=>{D();let[Q]=await Promise.race([Promise.allSettled([!0,B]),Promise.all([!1,...F])]);return!Q};import{Readable as TCD}from"node:stream";import{callbackify as MCD}from"node:util";import{finished as Dc}from"node:stream/promises";var wV=async(D)=>{if(D===void 0)return;try{await SV(D)}catch{}},Fc=async(D)=>{if(D===void 0)return;try{await fV(D)}catch{}},SV=async(D)=>{await Dc(D,{cleanup:!0,readable:!1,writable:!0})},fV=async(D)=>{await Dc(D,{cleanup:!0,readable:!0,writable:!1})},cY=async(D,F)=>{if(await D,F)throw F},nY=(D,F,B)=>{if(B&&!pY(B))D.destroy(B);else if(F)D.destroy()};var Bc=({subprocess:D,concurrentStreams:F,encoding:B},{from:Q,binary:L=!0,preserveNewlines:Z=!0}={})=>{let G=L||v6.has(B),{subprocessStdout:J,waitReadableDestroy:C}=vV(D,Q,F),{readableEncoding:K,readableObjectMode:V,readableHighWaterMark:R}=xV(J,G),{read:I,onStdoutDataDone:A}=yV({subprocessStdout:J,subprocess:D,binary:G,encoding:B,preserveNewlines:Z}),P=new TCD({read:I,destroy:MCD(hV.bind(void 0,{subprocessStdout:J,subprocess:D,waitReadableDestroy:C})),highWaterMark:R,objectMode:V,encoding:K});return kV({subprocessStdout:J,onStdoutDataDone:A,readable:P,subprocess:D}),P},vV=(D,F,B)=>{let Q=aB(D,F),L=UZ(B,Q,"readableDestroy");return{subprocessStdout:Q,waitReadableDestroy:L}},xV=({readableEncoding:D,readableObjectMode:F,readableHighWaterMark:B},Q)=>Q?{readableEncoding:D,readableObjectMode:F,readableHighWaterMark:B}:{readableEncoding:D,readableObjectMode:!0,readableHighWaterMark:NV},yV=({subprocessStdout:D,subprocess:F,binary:B,encoding:Q,preserveNewlines:L})=>{let Z=H2(),G=mY({subprocessStdout:D,subprocess:F,binary:B,shouldEncode:!B,encoding:Q,preserveNewlines:L});return{read(){NCD(this,G,Z)},onStdoutDataDone:Z}},NCD=async(D,F,B)=>{try{let{value:Q,done:L}=await F.next();if(L)B.resolve();else D.push(Q)}catch{}},kV=async({subprocessStdout:D,onStdoutDataDone:F,readable:B,subprocess:Q,subprocessStdin:L})=>{try{if(await fV(D),await Q,await wV(L),await F,B.readable)B.push(null)}catch(Z){await wV(L),Qc(B,Z)}},hV=async({subprocessStdout:D,subprocess:F,waitReadableDestroy:B},Q)=>{if(await BQ(B,F))Qc(D,Q),await cY(F,Q)},Qc=(D,F)=>{nY(D,D.readable,F)};import{Writable as PCD}from"node:stream";import{callbackify as Lc}from"node:util";var $c=({subprocess:D,concurrentStreams:F},{to:B}={})=>{let{subprocessStdin:Q,waitWritableFinal:L,waitWritableDestroy:Z}=bV(D,B,F),G=new PCD({...gV(Q,D,L),destroy:Lc(mV.bind(void 0,{subprocessStdin:Q,subprocess:D,waitWritableFinal:L,waitWritableDestroy:Z})),highWaterMark:Q.writableHighWaterMark,objectMode:Q.writableObjectMode});return lV(Q,G),G},bV=(D,F,B)=>{let Q=ZY(D,F),L=UZ(B,Q,"writableFinal"),Z=UZ(B,Q,"writableDestroy");return{subprocessStdin:Q,waitWritableFinal:L,waitWritableDestroy:Z}},gV=(D,F,B)=>({write:_CD.bind(void 0,D),final:Lc(jCD.bind(void 0,D,F,B))}),_CD=(D,F,B,Q)=>{if(D.write(F,B))Q();else D.once("drain",Q)},jCD=async(D,F,B)=>{if(await BQ(B,F)){if(D.writable)D.end();await F}},lV=async(D,F,B)=>{try{if(await SV(D),F.writable)F.end()}catch(Q){await Fc(B),Zc(F,Q)}},mV=async({subprocessStdin:D,subprocess:F,waitWritableFinal:B,waitWritableDestroy:Q},L)=>{if(await BQ(B,F),await BQ(Q,F))Zc(D,L),await cY(F,L)},Zc=(D,F)=>{nY(D,D.writable,F)};import{Duplex as wCD}from"node:stream";import{callbackify as SCD}from"node:util";var Gc=({subprocess:D,concurrentStreams:F,encoding:B},{from:Q,to:L,binary:Z=!0,preserveNewlines:G=!0}={})=>{let J=Z||v6.has(B),{subprocessStdout:C,waitReadableDestroy:K}=vV(D,Q,F),{subprocessStdin:V,waitWritableFinal:R,waitWritableDestroy:I}=bV(D,L,F),{readableEncoding:A,readableObjectMode:P,readableHighWaterMark:T}=xV(C,J),{read:k,onStdoutDataDone:p}=yV({subprocessStdout:C,subprocess:D,binary:J,encoding:B,preserveNewlines:G}),LD=new wCD({read:k,...gV(V,D,R),destroy:SCD(fCD.bind(void 0,{subprocessStdout:C,subprocessStdin:V,subprocess:D,waitReadableDestroy:K,waitWritableFinal:R,waitWritableDestroy:I})),readableHighWaterMark:T,writableHighWaterMark:V.writableHighWaterMark,readableObjectMode:P,writableObjectMode:V.writableObjectMode,encoding:A});return kV({subprocessStdout:C,onStdoutDataDone:p,readable:LD,subprocess:D,subprocessStdin:V}),lV(V,LD,C),LD},fCD=async({subprocessStdout:D,subprocessStdin:F,subprocess:B,waitReadableDestroy:Q,waitWritableFinal:L,waitWritableDestroy:Z},G)=>{await Promise.all([hV({subprocessStdout:D,subprocess:B,waitReadableDestroy:Q},G),mV({subprocessStdin:F,subprocess:B,waitWritableFinal:L,waitWritableDestroy:Z},G)])};var pV=(D,F,{from:B,binary:Q=!1,preserveNewlines:L=!1}={})=>{let Z=Q||v6.has(F),G=aB(D,B),J=mY({subprocessStdout:G,subprocess:D,binary:Z,shouldEncode:!0,encoding:F,preserveNewlines:L});return vCD(J,G,D)},vCD=async function*(D,F,B){try{yield*D}finally{if(F.readable)F.destroy();await B}};var Xc=(D,{encoding:F})=>{let B=ep();D.readable=Bc.bind(void 0,{subprocess:D,concurrentStreams:B,encoding:F}),D.writable=$c.bind(void 0,{subprocess:D,concurrentStreams:B}),D.duplex=Gc.bind(void 0,{subprocess:D,concurrentStreams:B,encoding:F}),D.iterable=pV.bind(void 0,D,F),D[Symbol.asyncIterator]=pV.bind(void 0,D,F,{})};var zc=(D,F)=>{for(let[B,Q]of yCD){let L=Q.value.bind(F);Reflect.defineProperty(D,B,{...Q,value:L})}},xCD=(async()=>{})().constructor.prototype,yCD=["then","catch","finally"].map((D)=>[D,Reflect.getOwnPropertyDescriptor(xCD,D)]);var Jc=(D,F,B,Q)=>{let{file:L,commandArguments:Z,command:G,escapedCommand:J,startTime:C,verboseInfo:K,options:V,fileDescriptors:R}=bCD(D,F,B),{subprocess:I,promise:A}=lCD({file:L,commandArguments:Z,options:V,startTime:C,verboseInfo:K,command:G,escapedCommand:J,fileDescriptors:R});return I.pipe=lY.bind(void 0,{source:I,sourcePromise:A,boundOptions:{},createNested:Q}),zc(I,A),W2.set(I,{options:V,fileDescriptors:R}),I},bCD=(D,F,B)=>{let{command:Q,escapedCommand:L,startTime:Z,verboseInfo:G}=rJ(D,F,B),{file:J,commandArguments:C,options:K}=KY(D,F,B),V=gCD(K),R=Kp(V,G);return{file:J,commandArguments:C,command:Q,escapedCommand:L,startTime:Z,verboseInfo:G,options:V,fileDescriptors:R}},gCD=({timeout:D,signal:F,...B})=>{if(F!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...B,timeoutDuration:D}},lCD=({file:D,commandArguments:F,options:B,startTime:Q,verboseInfo:L,command:Z,escapedCommand:G,fileDescriptors:J})=>{let C;try{C=hCD(...EY(D,F,B))}catch(P){return Up({error:P,command:Z,escapedCommand:G,fileDescriptors:J,options:B,startTime:Q,verboseInfo:L})}let K=new AbortController;kCD(Number.POSITIVE_INFINITY,K.signal);let V=[...C.stdio];Np(C,J,K),Sp(C,B,K);let R={},I=H2();C.kill=lg.bind(void 0,{kill:C.kill.bind(C),options:B,onInternalError:I,context:R,controller:K}),C.all=dp(C,B),Xc(C,B),Jp(C,B);let A=mCD({subprocess:C,options:B,startTime:Q,verboseInfo:L,fileDescriptors:J,originalStreams:V,command:Z,escapedCommand:G,context:R,onInternalError:I,controller:K});return{subprocess:C,promise:A}},mCD=async({subprocess:D,options:F,startTime:B,verboseInfo:Q,fileDescriptors:L,originalStreams:Z,command:G,escapedCommand:J,context:C,onInternalError:K,controller:V})=>{let[R,[I,A],P,T,k]=await sp({subprocess:D,options:F,context:C,verboseInfo:Q,fileDescriptors:L,originalStreams:Z,onInternalError:K,controller:V});V.abort(),K.resolve();let p=P.map((s,$D)=>G5(s,F,$D)),LD=G5(T,F,"all"),e=pCD({errorInfo:R,exitCode:I,signal:A,stdio:p,all:LD,ipcOutput:k,context:C,options:F,command:G,escapedCommand:J,startTime:B});return eB(e,Q,F)},pCD=({errorInfo:D,exitCode:F,signal:B,stdio:Q,all:L,ipcOutput:Z,context:G,options:J,command:C,escapedCommand:K,startTime:V})=>("error"in D)?GZ({error:D.error,command:C,escapedCommand:K,timedOut:G.terminationReason==="timeout",isCanceled:G.terminationReason==="cancel"||G.terminationReason==="gracefulCancel",isGracefullyCanceled:G.terminationReason==="gracefulCancel",isMaxBuffer:D.error instanceof $5,isForcefullyTerminated:G.isForcefullyTerminated,exitCode:F,signal:B,stdio:Q,all:L,ipcOutput:Z,options:J,startTime:V,isSync:!1}):NY({command:C,escapedCommand:K,stdio:Q,all:L,ipcOutput:Z,options:J,startTime:V});var dY=(D,F)=>{let B=Object.fromEntries(Object.entries(F).map(([Q,L])=>[Q,cCD(Q,D[Q],L)]));return{...D,...B}},cCD=(D,F,B)=>{if(nCD.has(D)&&v3(F)&&v3(B))return{...F,...B};return B},nCD=new Set(["env",...uE]);var CF=(D,F,B,Q)=>{let L=(G,J,C)=>CF(G,J,B,C),Z=(...G)=>dCD({mapArguments:D,deepOptions:B,boundOptions:F,setBoundExeca:Q,createNested:L},...G);if(Q!==void 0)Q(Z,L,F);return Z},dCD=({mapArguments:D,deepOptions:F={},boundOptions:B={},setBoundExeca:Q,createNested:L},Z,...G)=>{if(v3(Z))return L(D,dY(B,Z),Q);let{file:J,commandArguments:C,options:K,isSync:V}=iCD({mapArguments:D,firstArgument:Z,nextArguments:G,deepOptions:F,boundOptions:B});return V?Lp(J,C,K):Jc(J,C,K,L)},iCD=({mapArguments:D,firstArgument:F,nextArguments:B,deepOptions:Q,boundOptions:L})=>{let Z=Kb(F)?Eb(F,B):[F,...B],[G,J,C]=kJ(...Z),K=dY(dY(Q,L),C),{file:V=G,commandArguments:R=J,options:I=K,isSync:A=!1}=D({file:G,commandArguments:J,options:K});return{file:V,commandArguments:R,options:I,isSync:A}};var Yc=({file:D,commandArguments:F})=>Uc(D,F),qc=({file:D,commandArguments:F})=>({...Uc(D,F),isSync:!0}),Uc=(D,F)=>{if(F.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${D} ${F}.`);let[B,...Q]=rCD(D);return{file:B,commandArguments:Q}},rCD=(D)=>{if(typeof D!=="string")throw new TypeError(`The command must be a string: ${String(D)}.`);let F=D.trim();if(F==="")return[];let B=[];for(let Q of F.split(aCD)){let L=B.at(-1);if(L&&L.endsWith("\\"))B[B.length-1]=`${L.slice(0,-1)} ${Q}`;else B.push(Q)}return B},aCD=/ +/g;var Cc=(D,F,B)=>{D.sync=F(tCD,B),D.s=D.sync},Hc=({options:D})=>Wc(D),tCD=({options:D})=>({...Wc(D),isSync:!0}),Wc=(D)=>({options:{...oCD(D),...D}}),oCD=({input:D,inputFile:F,stdio:B})=>D===void 0&&F===void 0&&B===void 0?{stdin:"inherit"}:{},Kc={preferLocal:!0};var Ec=CF(()=>({})),dgD=CF(()=>({isSync:!0})),igD=CF(Yc),rgD=CF(qc),agD=CF(Ol),tgD=CF(Hc,{},Kc,Cc),{sendMessage:ogD,getOneMessage:sgD,getEachMessage:egD,getCancelSignal:DlD}=Yp();var nc=Z0(cc(),1);async function cV(D){try{return await nc.default(D),!0}catch{return!1}}async function dc(D,F,B=[]){if(!await cV("claude"))throw new Error(nV());await Ec("claude",B,{stdio:"inherit",env:{...process.env,ANTHROPIC_BASE_URL:D,ANTHROPIC_AUTH_TOKEN:F},preferLocal:!0})}function nV(){return"Claude CLI not found. Install it with: npm install -g @anthropic-ai/claude-code"}function rc({args:D=[]}){return ic.useEffect(()=>{async function F(){if(s5("\uD83C\uDF31 Bonsai Start: Claude Code"),!await H6.isAuthenticated())w8("Not authenticated. Run `bonsai login` first."),process.exit(1);if(!await cV("claude"))w8(nV()),process.exit(1);let B=e5();try{let Q=o$.getStoredKey(),L="Bonsai CLI";if(!Q){let Z=await wj({message:"Name your Bonsai API key:",placeholder:L,defaultValue:L});if(i2(Z))w8("Operation cancelled"),process.exit(1);let G=Z.trim()||L;B.start("Creating API key");let J=await o$.createKey(G);o$.saveKey(J,G),B.stop("Created and stored API key"),Q=o$.getStoredKey()}if(!Q)throw new Error("Failed to get or create API key");a2("Starting Claude Code with Bonsai"),await dc("https://go.trybons.ai",Q.key,D)}catch(Q){B.stop("Failed to start Claude"),w8(Q.message||"Unknown error"),process.exit(1)}}F()},[]),null}function ac({subcommand:D,args:F=[]}){if(!D)return iY.default.createElement($1,{color:"red"},"Missing subcommand. Available subcommands: claude");switch(D){case"claude":return iY.default.createElement(rc,{args:F});default:return iY.default.createElement($1,{color:"red"},"Unknown subcommand: ",D,". Available subcommands: claude")}}var y8=Z0(K1(),1);var X5={title:"Welcome to Bonsai CLI \uD83C\uDF31",description:"The command line interface for Bonsai.",usage:"$ bonsai [command]",commands:[{name:"login",description:"Authenticate with Bonsai"},{name:"start claude",description:"Start Claude Code with Bonsai"},{name:"sub link",description:"Link a provider subscription"},{name:"sub unlink",description:"Unlink a provider subscription"},{name:"logout",description:"Sign out of your account"}],options:[{name:"--version",description:"Show version number"},{name:"--help",description:"Show help"}],examples:["$ bonsai login","$ bonsai start claude","$ bonsai sub link","$ bonsai sub unlink","$ bonsai --version"]};function tc(){let D=X5.commands.map((Q)=>` ${Q.name.padEnd(14)} ${Q.description}`).join(`
|
|
259
|
+
if (condition) { yield value; }`)};import{Buffer as WqD}from"node:buffer";import{StringDecoder as KqD}from"node:string_decoder";var fY=(D,F,B)=>{if(B)return;if(D)return{transform:EqD.bind(void 0,new TextEncoder)};let Q=new KqD(F);return{transform:VqD.bind(void 0,Q),final:RqD.bind(void 0,Q)}},EqD=function*(D,F){if(WqD.isBuffer(F))yield Q5(F);else if(typeof F==="string")yield D.encode(F);else yield F},VqD=function*(D,F){yield B8(F)?D.write(F):F},RqD=function*(D){let F=D.end();if(F!=="")yield F};import{callbackify as mm}from"node:util";var JV=mm(async(D,F,B,Q)=>{F.currentIterable=D(...B);try{for await(let L of F.currentIterable)Q.push(L)}finally{delete F.currentIterable}}),vY=async function*(D,F,B){if(B===F.length){yield D;return}let{transform:Q=uqD}=F[B];for await(let L of Q(D))yield*vY(L,F,B+1)},pm=async function*(D){for(let[F,{final:B}]of Object.entries(D))yield*IqD(B,Number(F),D)},IqD=async function*(D,F,B){if(D===void 0)return;for await(let Q of D())yield*vY(Q,B,F+1)},cm=mm(async({currentIterable:D},F)=>{if(D!==void 0){await(F?D.throw(F):D.return());return}if(F)throw F}),uqD=function*(D){yield D};var YV=(D,F,B,Q)=>{try{for(let L of D(...F))B.push(L);Q()}catch(L){Q(L)}},nm=(D,F)=>[...F.flatMap((B)=>[...c7(B,D,0)]),...XZ(D)],c7=function*(D,F,B){if(B===F.length){yield D;return}let{transform:Q=OqD}=F[B];for(let L of Q(D))yield*c7(L,F,B+1)},XZ=function*(D){for(let[F,{final:B}]of Object.entries(D))yield*AqD(B,Number(F),D)},AqD=function*(D,F,B){if(D===void 0)return;for(let Q of D())yield*c7(Q,B,F+1)},OqD=function*(D){yield D};var qV=({value:D,value:{transform:F,final:B,writableObjectMode:Q,readableObjectMode:L},optionName:Z},{encoding:G})=>{let J={},C=im(D,G,Z),K=p7(F),V=p7(B),R=K?JV.bind(void 0,vY,J):YV.bind(void 0,c7),I=K||V?JV.bind(void 0,pm,J):YV.bind(void 0,XZ),A=K||V?cm.bind(void 0,J):void 0;return{stream:new TqD({writableObjectMode:Q,writableHighWaterMark:dm(Q),readableObjectMode:L,readableHighWaterMark:dm(L),transform(T,k,p){R([T,C,0],this,p)},flush(T){I([C],this,T)},destroy:A})}},xY=(D,F,B,Q)=>{let L=F.filter(({type:G})=>G==="generator"),Z=Q?L.reverse():L;for(let{value:G,optionName:J}of Z){let C=im(G,B,J);D=nm(C,D)}return D},im=({transform:D,final:F,binary:B,writableObjectMode:Q,readableObjectMode:L,preserveNewlines:Z},G,J)=>{let C={};return[{transform:bm(Q,J)},fY(B,G,Q),SY(B,Z,Q,C),{transform:D,final:F},{transform:gm(L,J)},hm({binary:B,preserveNewlines:Z,readableObjectMode:L,state:C})].filter(Boolean)};var rm=(D,F)=>{for(let B of MqD(D))NqD(D,B,F)},MqD=(D)=>new Set(Object.entries(D).filter(([,{direction:F}])=>F==="input").map(([F])=>Number(F))),NqD=(D,F,B)=>{let{stdioItems:Q}=D[F],L=Q.filter(({contents:J})=>J!==void 0);if(L.length===0)return;if(F!==0){let[{type:J,optionName:C}]=L;throw new TypeError(`Only the \`stdin\` option, not \`${C}\`, can be ${UF[J]} with synchronous methods.`)}let G=L.map(({contents:J})=>J).map((J)=>PqD(J,Q));B.input=DZ(G)},PqD=(D,F)=>{let B=xY(D,F,"utf8",!0);return _qD(B),DZ(B)},_qD=(D)=>{let F=D.find((B)=>typeof B!=="string"&&!B8(B));if(F!==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: ${F}.`)};import{writeFileSync as fqD,appendFileSync as vqD}from"node:fs";var yY=({stdioItems:D,encoding:F,verboseInfo:B,fdNumber:Q})=>Q!=="all"&&cB(B,Q)&&!v6.has(F)&&jqD(Q)&&(D.some(({type:L,value:Z})=>L==="native"&&wqD.has(Z))||D.every(({type:L})=>J4.has(L))),jqD=(D)=>D===1||D===2,wqD=new Set(["pipe","overlapped"]),am=async(D,F,B,Q)=>{for await(let L of D)if(!SqD(F))om(L,B,Q)},tm=(D,F,B)=>{for(let Q of D)om(Q,F,B)},SqD=(D)=>D._readableState.pipes.length>0,om=(D,F,B)=>{let Q=dJ(D);U2({type:"output",verboseMessage:Q,fdNumber:F,verboseInfo:B})};var sm=({fileDescriptors:D,syncResult:{output:F},options:B,isMaxBuffer:Q,verboseInfo:L})=>{if(F===null)return{output:Array.from({length:3})};let Z={},G=new Set([]);return{output:F.map((C,K)=>xqD({result:C,fileDescriptors:D,fdNumber:K,state:Z,outputFiles:G,isMaxBuffer:Q,verboseInfo:L},B)),...Z}},xqD=({result:D,fileDescriptors:F,fdNumber:B,state:Q,outputFiles:L,isMaxBuffer:Z,verboseInfo:G},{buffer:J,encoding:C,lines:K,stripFinalNewline:V,maxBuffer:R})=>{if(D===null)return;let I=el(D,Z,R),A=Q5(I),{stdioItems:P,objectMode:T}=F[B],k=yqD([A],P,C,Q),{serializedResult:p,finalResult:LD=p}=kqD({chunks:k,objectMode:T,encoding:C,lines:K,stripFinalNewline:V,fdNumber:B});hqD({serializedResult:p,fdNumber:B,state:Q,verboseInfo:G,encoding:C,stdioItems:P,objectMode:T});let e=J[B]?LD:void 0;try{if(Q.error===void 0)bqD(p,P,L);return e}catch(s){return Q.error=s,e}},yqD=(D,F,B,Q)=>{try{return xY(D,F,B,!1)}catch(L){return Q.error=L,D}},kqD=({chunks:D,objectMode:F,encoding:B,lines:Q,stripFinalNewline:L,fdNumber:Z})=>{if(F)return{serializedResult:D};if(B==="buffer")return{serializedResult:DZ(D)};let G=Ub(D,B);if(Q[Z])return{serializedResult:G,finalResult:zV(G,!L[Z],F)};return{serializedResult:G}},hqD=({serializedResult:D,fdNumber:F,state:B,verboseInfo:Q,encoding:L,stdioItems:Z,objectMode:G})=>{if(!yY({stdioItems:Z,encoding:L,verboseInfo:Q,fdNumber:F}))return;let J=zV(D,!1,G);try{tm(J,F,Q)}catch(C){B.error??=C}},bqD=(D,F,B)=>{for(let{path:Q,append:L}of F.filter(({type:Z})=>jY.has(Z))){let Z=typeof Q==="string"?Q:Q.toString();if(L||B.has(Z))vqD(Q,D);else B.add(Z),fqD(Q,D)}};var em=([,D,F],B)=>{if(!B.all)return;if(D===void 0)return F;if(F===void 0)return D;if(Array.isArray(D))return Array.isArray(F)?[...D,...F]:[...D,G5(F,B,"all")];if(Array.isArray(F))return[G5(D,B,"all"),...F];if(B8(D)&&B8(F))return EE([D,F]);return`${D}${F}`};import{once as UV}from"node:events";var Dp=async(D,F)=>{let[B,Q]=await gqD(D);return F.isForcefullyTerminated??=!1,[B,Q]},gqD=async(D)=>{let[F,B]=await Promise.allSettled([UV(D,"spawn"),UV(D,"exit")]);if(F.status==="rejected")return[];return B.status==="rejected"?Fp(D):B.value},Fp=async(D)=>{try{return await UV(D,"exit")}catch{return Fp(D)}},Bp=async(D)=>{let[F,B]=await D;if(!lqD(F,B)&&CV(F,B))throw new C2;return[F,B]},lqD=(D,F)=>D===void 0&&F===void 0,CV=(D,F)=>D!==0||F!==null;var Qp=({error:D,status:F,signal:B,output:Q},{maxBuffer:L})=>{let Z=mqD(D,F,B),G=Z?.code==="ETIMEDOUT",J=sl(Z,Q,L);return{resultError:Z,exitCode:F,signal:B,timedOut:G,isMaxBuffer:J}},mqD=(D,F,B)=>{if(D!==void 0)return D;return CV(F,B)?new C2:void 0};var Lp=(D,F,B)=>{let{file:Q,commandArguments:L,command:Z,escapedCommand:G,startTime:J,verboseInfo:C,options:K,fileDescriptors:V}=cqD(D,F,B),R=iqD({file:Q,commandArguments:L,options:K,command:Z,escapedCommand:G,verboseInfo:C,fileDescriptors:V,startTime:J});return eB(R,C,K)},cqD=(D,F,B)=>{let{command:Q,escapedCommand:L,startTime:Z,verboseInfo:G}=rJ(D,F,B),J=nqD(B),{file:C,commandArguments:K,options:V}=KY(D,F,J);dqD(V);let R=vm(V,G);return{file:C,commandArguments:K,command:Q,escapedCommand:L,startTime:Z,verboseInfo:G,options:V,fileDescriptors:R}},nqD=(D)=>D.node&&!D.ipc?{...D,ipc:!1}:D,dqD=({ipc:D,ipcInput:F,detached:B,cancelSignal:Q})=>{if(F)kY("ipcInput");if(D)kY("ipc: true");if(B)kY("detached: true");if(Q)kY("cancelSignal")},kY=(D)=>{throw new TypeError(`The "${D}" option cannot be used with synchronous methods.`)},iqD=({file:D,commandArguments:F,options:B,command:Q,escapedCommand:L,verboseInfo:Z,fileDescriptors:G,startTime:J})=>{let C=rqD({file:D,commandArguments:F,options:B,command:Q,escapedCommand:L,fileDescriptors:G,startTime:J});if(C.failed)return C;let{resultError:K,exitCode:V,signal:R,timedOut:I,isMaxBuffer:A}=Qp(C,B),{output:P,error:T=K}=sm({fileDescriptors:G,syncResult:C,options:B,isMaxBuffer:A,verboseInfo:Z}),k=P.map((LD,e)=>G5(LD,B,e)),p=G5(em(P,B),B,"all");return tqD({error:T,exitCode:V,signal:R,timedOut:I,isMaxBuffer:A,stdio:k,all:p,options:B,command:Q,escapedCommand:L,startTime:J})},rqD=({file:D,commandArguments:F,options:B,command:Q,escapedCommand:L,fileDescriptors:Z,startTime:G})=>{try{rm(Z,B);let J=aqD(B);return pqD(...EY(D,F,J))}catch(J){return sB({error:J,command:Q,escapedCommand:L,fileDescriptors:Z,options:B,startTime:G,isSync:!0})}},aqD=({encoding:D,maxBuffer:F,...B})=>({...B,encoding:"buffer",maxBuffer:MY(F)}),tqD=({error:D,exitCode:F,signal:B,timedOut:Q,isMaxBuffer:L,stdio:Z,all:G,options:J,command:C,escapedCommand:K,startTime:V})=>D===void 0?NY({command:C,escapedCommand:K,stdio:Z,all:G,ipcOutput:[],options:J,startTime:V}):GZ({error:D,command:C,escapedCommand:K,timedOut:Q,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:L,isForcefullyTerminated:!1,exitCode:F,signal:B,stdio:Z,all:G,ipcOutput:[],options:J,startTime:V,isSync:!0});import{setMaxListeners as kCD}from"node:events";import{spawn as hCD}from"node:child_process";import zp from"node:process";import{once as HV,on as oqD}from"node:events";var $p=({anyProcess:D,channel:F,isSubprocess:B,ipc:Q},{reference:L=!0,filter:Z}={})=>{return iB({methodName:"getOneMessage",isSubprocess:B,ipc:Q,isConnected:YY(D)}),sqD({anyProcess:D,channel:F,isSubprocess:B,filter:Z,reference:L})},sqD=async({anyProcess:D,channel:F,isSubprocess:B,filter:Q,reference:L})=>{GY(F,L);let Z=qF(D,F,B),G=new AbortController;try{return await Promise.race([eqD(Z,Q,G),DUD(Z,B,G),FUD(Z,B,G)])}catch(J){throw rB(D),J}finally{G.abort(),XY(F,L)}},eqD=async(D,F,{signal:B})=>{if(F===void 0){let[Q]=await HV(D,"message",{signal:B});return Q}for await(let[Q]of oqD(D,"message",{signal:B}))if(F(Q))return Q},DUD=async(D,F,{signal:B})=>{await HV(D,"disconnect",{signal:B}),cg(F)},FUD=async(D,F,{signal:B})=>{let[Q]=await HV(D,"strict:error",{signal:B});throw LY(Q,F)};import{once as Gp,on as BUD}from"node:events";var Xp=({anyProcess:D,channel:F,isSubprocess:B,ipc:Q},{reference:L=!0}={})=>WV({anyProcess:D,channel:F,isSubprocess:B,ipc:Q,shouldAwait:!B,reference:L}),WV=({anyProcess:D,channel:F,isSubprocess:B,ipc:Q,shouldAwait:L,reference:Z})=>{iB({methodName:"getEachMessage",isSubprocess:B,ipc:Q,isConnected:YY(D)}),GY(F,Z);let G=qF(D,F,B),J=new AbortController,C={};return QUD(D,G,J),LUD({ipcEmitter:G,isSubprocess:B,controller:J,state:C}),$UD({anyProcess:D,channel:F,ipcEmitter:G,isSubprocess:B,shouldAwait:L,controller:J,state:C,reference:Z})},QUD=async(D,F,B)=>{try{await Gp(F,"disconnect",{signal:B.signal}),B.abort()}catch{}},LUD=async({ipcEmitter:D,isSubprocess:F,controller:B,state:Q})=>{try{let[L]=await Gp(D,"strict:error",{signal:B.signal});Q.error=LY(L,F),B.abort()}catch{}},$UD=async function*({anyProcess:D,channel:F,ipcEmitter:B,isSubprocess:Q,shouldAwait:L,controller:Z,state:G,reference:J}){try{for await(let[C]of BUD(B,"message",{signal:Z.signal}))Zp(G),yield C}catch{Zp(G)}finally{if(Z.abort(),XY(F,J),!Q)rB(D);if(L)await D}},Zp=({error:D})=>{if(D)throw D};var Jp=(D,{ipc:F})=>{Object.assign(D,qp(D,!1,F))},Yp=()=>{let D=zp,F=!0,B=zp.channel!==void 0;return{...qp(D,!0,B),getCancelSignal:Kl.bind(void 0,{anyProcess:D,channel:D.channel,isSubprocess:!0,ipc:B})}},qp=(D,F,B)=>({sendMessage:HY.bind(void 0,{anyProcess:D,channel:D.channel,isSubprocess:F,ipc:B}),getOneMessage:$p.bind(void 0,{anyProcess:D,channel:D.channel,isSubprocess:F,ipc:B}),getEachMessage:Xp.bind(void 0,{anyProcess:D,channel:D.channel,isSubprocess:F,ipc:B})});import{ChildProcess as ZUD}from"node:child_process";import{PassThrough as GUD,Readable as XUD,Writable as zUD,Duplex as JUD}from"node:stream";var Up=({error:D,command:F,escapedCommand:B,fileDescriptors:Q,options:L,startTime:Z,verboseInfo:G})=>{ZV(Q);let J=new ZUD;YUD(J,Q),Object.assign(J,{readable:qUD,writable:UUD,duplex:CUD});let C=sB({error:D,command:F,escapedCommand:B,fileDescriptors:Q,options:L,startTime:Z,isSync:!1}),K=HUD(C,G,L);return{subprocess:J,promise:K}},YUD=(D,F)=>{let B=zZ(),Q=zZ(),L=zZ(),Z=Array.from({length:F.length-3},zZ),G=zZ(),J=[B,Q,L,...Z];Object.assign(D,{stdin:B,stdout:Q,stderr:L,all:G,stdio:J})},zZ=()=>{let D=new GUD;return D.end(),D},qUD=()=>new XUD({read(){}}),UUD=()=>new zUD({write(){}}),CUD=()=>new JUD({read(){},write(){}}),HUD=async(D,F,B)=>eB(D,F,B);import{createReadStream as Cp,createWriteStream as Hp}from"node:fs";import{Buffer as WUD}from"node:buffer";import{Readable as JZ,Writable as KUD,Duplex as EUD}from"node:stream";var Kp=(D,F)=>wY(VUD,D,F,!1),YZ=({type:D,optionName:F})=>{throw new TypeError(`The \`${F}\` option cannot be ${UF[D]}.`)},Wp={fileNumber:YZ,generator:qV,asyncGenerator:qV,nodeStream:({value:D})=>({stream:D}),webTransform({value:{transform:D,writableObjectMode:F,readableObjectMode:B}}){let Q=F||B;return{stream:EUD.fromWeb(D,{objectMode:Q})}},duplex:({value:{transform:D}})=>({stream:D}),native(){}},VUD={input:{...Wp,fileUrl:({value:D})=>({stream:Cp(D)}),filePath:({value:{file:D}})=>({stream:Cp(D)}),webStream:({value:D})=>({stream:JZ.fromWeb(D)}),iterable:({value:D})=>({stream:JZ.from(D)}),asyncIterable:({value:D})=>({stream:JZ.from(D)}),string:({value:D})=>({stream:JZ.from(D)}),uint8Array:({value:D})=>({stream:JZ.from(WUD.from(D))})},output:{...Wp,fileUrl:({value:D})=>({stream:Hp(D)}),filePath:({value:{file:D,append:F}})=>({stream:Hp(D,F?{flags:"a"}:{})}),webStream:({value:D})=>({stream:KUD.fromWeb(D)}),iterable:YZ,asyncIterable:YZ,string:YZ,uint8Array:YZ}};import{on as RUD,once as Ep}from"node:events";import{PassThrough as IUD,getDefaultHighWaterMark as uUD}from"node:stream";import{finished as Ip}from"node:stream/promises";function n7(D){if(!Array.isArray(D))throw new TypeError(`Expected an array, got \`${typeof D}\`.`);for(let L of D)KV(L);let F=D.some(({readableObjectMode:L})=>L),B=AUD(D,F),Q=new up({objectMode:F,writableHighWaterMark:B,readableHighWaterMark:B});for(let L of D)Q.add(L);return Q}var AUD=(D,F)=>{if(D.length===0)return uUD(F);let B=D.filter(({readableObjectMode:Q})=>Q===F).map(({readableHighWaterMark:Q})=>Q);return Math.max(...B)};class up extends IUD{#F=new Set([]);#B=new Set([]);#D=new Set([]);#Q;#$=Symbol("unpipe");#L=new WeakMap;add(D){if(KV(D),this.#F.has(D))return;this.#F.add(D),this.#Q??=OUD(this,this.#F,this.#$);let F=NUD({passThroughStream:this,stream:D,streams:this.#F,ended:this.#B,aborted:this.#D,onFinished:this.#Q,unpipeEvent:this.#$});this.#L.set(D,F),D.pipe(this,{end:!1})}async remove(D){if(KV(D),!this.#F.has(D))return!1;let F=this.#L.get(D);if(F===void 0)return!1;return this.#L.delete(D),D.unpipe(this),await F,!0}}var OUD=async(D,F,B)=>{hY(D,Vp);let Q=new AbortController;try{await Promise.race([TUD(D,Q),MUD(D,F,B,Q)])}finally{Q.abort(),hY(D,-Vp)}},TUD=async(D,{signal:F})=>{try{await Ip(D,{signal:F,cleanup:!0})}catch(B){throw Ap(D,B),B}},MUD=async(D,F,B,{signal:Q})=>{for await(let[L]of RUD(D,"unpipe",{signal:Q}))if(F.has(L))L.emit(B)},KV=(D)=>{if(typeof D?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof D}\`.`)},NUD=async({passThroughStream:D,stream:F,streams:B,ended:Q,aborted:L,onFinished:Z,unpipeEvent:G})=>{hY(D,Rp);let J=new AbortController;try{await Promise.race([PUD(Z,F,J),_UD({passThroughStream:D,stream:F,streams:B,ended:Q,aborted:L,controller:J}),jUD({stream:F,streams:B,ended:Q,aborted:L,unpipeEvent:G,controller:J})])}finally{J.abort(),hY(D,-Rp)}if(B.size>0&&B.size===Q.size+L.size)if(Q.size===0&&L.size>0)EV(D);else wUD(D)},PUD=async(D,F,{signal:B})=>{try{if(await D,!B.aborted)EV(F)}catch(Q){if(!B.aborted)Ap(F,Q)}},_UD=async({passThroughStream:D,stream:F,streams:B,ended:Q,aborted:L,controller:{signal:Z}})=>{try{if(await Ip(F,{signal:Z,cleanup:!0,readable:!0,writable:!1}),B.has(F))Q.add(F)}catch(G){if(Z.aborted||!B.has(F))return;if(Op(G))L.add(F);else Tp(D,G)}},jUD=async({stream:D,streams:F,ended:B,aborted:Q,unpipeEvent:L,controller:{signal:Z}})=>{if(await Ep(D,L,{signal:Z}),!D.readable)return Ep(Z,"abort",{signal:Z});F.delete(D),B.delete(D),Q.delete(D)},wUD=(D)=>{if(D.writable)D.end()},Ap=(D,F)=>{if(Op(F))EV(D);else Tp(D,F)},Op=(D)=>D?.code==="ERR_STREAM_PREMATURE_CLOSE",EV=(D)=>{if(D.readable||D.writable)D.destroy()},Tp=(D,F)=>{if(!D.destroyed)D.once("error",SUD),D.destroy(F)},SUD=()=>{},hY=(D,F)=>{let B=D.getMaxListeners();if(B!==0&&B!==Number.POSITIVE_INFINITY)D.setMaxListeners(B+F)},Vp=2,Rp=1;import{finished as Mp}from"node:stream/promises";var FQ=(D,F)=>{D.pipe(F),fUD(D,F),vUD(D,F)},fUD=async(D,F)=>{if(x4(D)||x4(F))return;try{await Mp(D,{cleanup:!0,readable:!0,writable:!1})}catch{}VV(F)},VV=(D)=>{if(D.writable)D.end()},vUD=async(D,F)=>{if(x4(D)||x4(F))return;try{await Mp(F,{cleanup:!0,readable:!1,writable:!0})}catch{}RV(D)},RV=(D)=>{if(D.readable)D.destroy()};var Np=(D,F,B)=>{let Q=new Map;for(let[L,{stdioItems:Z,direction:G}]of Object.entries(F)){for(let{stream:J}of Z.filter(({type:C})=>J4.has(C)))xUD(D,J,G,L);for(let{stream:J}of Z.filter(({type:C})=>!J4.has(C)))kUD({subprocess:D,stream:J,direction:G,fdNumber:L,pipeGroups:Q,controller:B})}for(let[L,Z]of Q.entries()){let G=Z.length===1?Z[0]:n7(Z);FQ(G,L)}},xUD=(D,F,B,Q)=>{if(B==="output")FQ(D.stdio[Q],F);else FQ(F,D.stdio[Q]);let L=yUD[Q];if(L!==void 0)D[L]=F;D.stdio[Q]=F},yUD=["stdin","stdout","stderr"],kUD=({subprocess:D,stream:F,direction:B,fdNumber:Q,pipeGroups:L,controller:Z})=>{if(F===void 0)return;hUD(F,Z);let[G,J]=B==="output"?[F,D.stdio[Q]]:[D.stdio[Q],F],C=L.get(G)??[];L.set(G,[...C,J])},hUD=(D,{signal:F})=>{if(x4(D))l7(D,bUD,F)},bUD=2;import{addAbortListener as mUD}from"node:events";var d7=[];d7.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")d7.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")d7.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var bY=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",IV=Symbol.for("signal-exit emitter"),uV=globalThis,gUD=Object.defineProperty.bind(Object);class Pp{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(uV[IV])return uV[IV];gUD(uV,IV,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,F){this.listeners[D].push(F)}removeListener(D,F){let B=this.listeners[D],Q=B.indexOf(F);if(Q===-1)return;if(Q===0&&B.length===1)B.length=0;else B.splice(Q,1)}emit(D,F,B){if(this.emitted[D])return!1;this.emitted[D]=!0;let Q=!1;for(let L of this.listeners[D])Q=L(F,B)===!0||Q;if(D==="exit")Q=this.emit("afterExit",F,B)||Q;return Q}}class OV{}var lUD=(D)=>{return{onExit(F,B){return D.onExit(F,B)},load(){return D.load()},unload(){return D.unload()}}};class _p extends OV{onExit(){return()=>{}}load(){}unload(){}}class jp extends OV{#F=AV.platform==="win32"?"SIGINT":"SIGHUP";#B=new Pp;#D;#Q;#$;#L={};#Z=!1;constructor(D){super();this.#D=D,this.#L={};for(let F of d7)this.#L[F]=()=>{let B=this.#D.listeners(F),{count:Q}=this.#B,L=D;if(typeof L.__signal_exit_emitter__==="object"&&typeof L.__signal_exit_emitter__.count==="number")Q+=L.__signal_exit_emitter__.count;if(B.length===Q){this.unload();let Z=this.#B.emit("exit",null,F),G=F==="SIGHUP"?this.#F:F;if(!Z)D.kill(D.pid,G)}};this.#$=D.reallyExit,this.#Q=D.emit}onExit(D,F){if(!bY(this.#D))return()=>{};if(this.#Z===!1)this.load();let B=F?.alwaysLast?"afterExit":"exit";return this.#B.on(B,D),()=>{if(this.#B.removeListener(B,D),this.#B.listeners.exit.length===0&&this.#B.listeners.afterExit.length===0)this.unload()}}load(){if(this.#Z)return;this.#Z=!0,this.#B.count+=1;for(let D of d7)try{let F=this.#L[D];if(F)this.#D.on(D,F)}catch(F){}this.#D.emit=(D,...F)=>{return this.#X(D,...F)},this.#D.reallyExit=(D)=>{return this.#G(D)}}unload(){if(!this.#Z)return;this.#Z=!1,d7.forEach((D)=>{let F=this.#L[D];if(!F)throw new Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,F)}catch(B){}}),this.#D.emit=this.#Q,this.#D.reallyExit=this.#$,this.#B.count-=1}#G(D){if(!bY(this.#D))return 0;return this.#D.exitCode=D||0,this.#B.emit("exit",this.#D.exitCode,null),this.#$.call(this.#D,this.#D.exitCode)}#X(D,...F){let B=this.#Q;if(D==="exit"&&bY(this.#D)){if(typeof F[0]==="number")this.#D.exitCode=F[0];let Q=B.call(this.#D,D,...F);return this.#B.emit("exit",this.#D.exitCode,null),Q}else return B.call(this.#D,D,...F)}}var AV=globalThis.process,{onExit:wp,load:BhD,unload:QhD}=lUD(bY(AV)?new jp(AV):new _p);var Sp=(D,{cleanup:F,detached:B},{signal:Q})=>{if(!F||B)return;let L=wp(()=>{D.kill()});mUD(Q,()=>{L()})};var vp=({source:D,sourcePromise:F,boundOptions:B,createNested:Q},...L)=>{let Z=iJ(),{destination:G,destinationStream:J,destinationError:C,from:K,unpipeSignal:V}=pUD(B,Q,L),{sourceStream:R,sourceError:I}=nUD(D,K),{options:A,fileDescriptors:P}=W2.get(D);return{sourcePromise:F,sourceStream:R,sourceOptions:A,sourceError:I,destination:G,destinationStream:J,destinationError:C,unpipeSignal:V,fileDescriptors:P,startTime:Z}},pUD=(D,F,B)=>{try{let{destination:Q,pipeOptions:{from:L,to:Z,unpipeSignal:G}={}}=cUD(D,F,...B),J=ZY(Q,Z);return{destination:Q,destinationStream:J,from:L,unpipeSignal:G}}catch(Q){return{destinationError:Q}}},cUD=(D,F,B,...Q)=>{if(Array.isArray(B))return{destination:F(fp,D)(B,...Q),pipeOptions:D};if(typeof B==="string"||B instanceof URL||WE(B)){if(Object.keys(D).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[L,Z,G]=kJ(B,...Q);return{destination:F(fp)(L,Z,G),pipeOptions:G}}if(W2.has(B)){if(Object.keys(D).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:B,pipeOptions:Q[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${B}`)},fp=({options:D})=>({options:{...D,stdin:"pipe",piped:!0}}),nUD=(D,F)=>{try{return{sourceStream:aB(D,F)}}catch(B){return{sourceError:B}}};var yp=({sourceStream:D,sourceError:F,destinationStream:B,destinationError:Q,fileDescriptors:L,sourceOptions:Z,startTime:G})=>{let J=dUD({sourceStream:D,sourceError:F,destinationStream:B,destinationError:Q});if(J!==void 0)throw TV({error:J,fileDescriptors:L,sourceOptions:Z,startTime:G})},dUD=({sourceStream:D,sourceError:F,destinationStream:B,destinationError:Q})=>{if(F!==void 0&&Q!==void 0)return Q;if(Q!==void 0)return RV(D),Q;if(F!==void 0)return VV(B),F},TV=({error:D,fileDescriptors:F,sourceOptions:B,startTime:Q})=>sB({error:D,command:xp,escapedCommand:xp,fileDescriptors:F,options:B,startTime:Q,isSync:!1}),xp="source.pipe(destination)";var kp=async(D)=>{let[{status:F,reason:B,value:Q=B},{status:L,reason:Z,value:G=Z}]=await D;if(!G.pipedFrom.includes(Q))G.pipedFrom.push(Q);if(L==="rejected")throw G;if(F==="rejected")throw Q;return G};import{finished as iUD}from"node:stream/promises";var hp=(D,F,B)=>{let Q=gY.has(F)?aUD(D,F):rUD(D,F);return l7(D,oUD,B.signal),l7(F,sUD,B.signal),tUD(F),Q},rUD=(D,F)=>{let B=n7([D]);return FQ(B,F),gY.set(F,B),B},aUD=(D,F)=>{let B=gY.get(F);return B.add(D),B},tUD=async(D)=>{try{await iUD(D,{cleanup:!0,readable:!1,writable:!0})}catch{}gY.delete(D)},gY=new WeakMap,oUD=2,sUD=1;import{aborted as eUD}from"node:util";var bp=(D,F)=>D===void 0?[]:[DCD(D,F)],DCD=async(D,{sourceStream:F,mergedStream:B,fileDescriptors:Q,sourceOptions:L,startTime:Z})=>{await eUD(D,F),await B.remove(F);let G=new Error("Pipe canceled by `unpipeSignal` option.");throw TV({error:G,fileDescriptors:Q,sourceOptions:L,startTime:Z})};var lY=(D,...F)=>{if(v3(F[0]))return lY.bind(void 0,{...D,boundOptions:{...D.boundOptions,...F[0]}});let{destination:B,...Q}=vp(D,...F),L=FCD({...Q,destination:B});return L.pipe=lY.bind(void 0,{...D,source:B,sourcePromise:L,boundOptions:{}}),L},FCD=async({sourcePromise:D,sourceStream:F,sourceOptions:B,sourceError:Q,destination:L,destinationStream:Z,destinationError:G,unpipeSignal:J,fileDescriptors:C,startTime:K})=>{let V=BCD(D,L);yp({sourceStream:F,sourceError:Q,destinationStream:Z,destinationError:G,fileDescriptors:C,sourceOptions:B,startTime:K});let R=new AbortController;try{let I=hp(F,Z,R);return await Promise.race([kp(V),...bp(J,{sourceStream:F,mergedStream:I,sourceOptions:B,fileDescriptors:C,startTime:K})])}finally{R.abort()}},BCD=(D,F)=>Promise.allSettled([D,F]);import{setImmediate as zCD}from"node:timers/promises";import{on as QCD}from"node:events";import{getDefaultHighWaterMark as LCD}from"node:stream";var mY=({subprocessStdout:D,subprocess:F,binary:B,shouldEncode:Q,encoding:L,preserveNewlines:Z})=>{let G=new AbortController;return $CD(F,G),lp({stream:D,controller:G,binary:B,shouldEncode:!D.readableObjectMode&&Q,encoding:L,shouldSplit:!D.readableObjectMode,preserveNewlines:Z})},$CD=async(D,F)=>{try{await D}catch{}finally{F.abort()}},MV=({stream:D,onStreamEnd:F,lines:B,encoding:Q,stripFinalNewline:L,allMixed:Z})=>{let G=new AbortController;ZCD(F,G,D);let J=D.readableObjectMode&&!Z;return lp({stream:D,controller:G,binary:Q==="buffer",shouldEncode:!J,encoding:Q,shouldSplit:!J&&B,preserveNewlines:!L})},ZCD=async(D,F,B)=>{try{await D}catch{B.destroy()}finally{F.abort()}},lp=({stream:D,controller:F,binary:B,shouldEncode:Q,encoding:L,shouldSplit:Z,preserveNewlines:G})=>{let J=QCD(D,"data",{signal:F.signal,highWaterMark:gp,highWatermark:gp});return GCD({onStdoutChunk:J,controller:F,binary:B,shouldEncode:Q,encoding:L,shouldSplit:Z,preserveNewlines:G})},NV=LCD(!0),gp=NV,GCD=async function*({onStdoutChunk:D,controller:F,binary:B,shouldEncode:Q,encoding:L,shouldSplit:Z,preserveNewlines:G}){let J=XCD({binary:B,shouldEncode:Q,encoding:L,shouldSplit:Z,preserveNewlines:G});try{for await(let[C]of D)yield*c7(C,J,0)}catch(C){if(!F.signal.aborted)throw C}finally{yield*XZ(J)}},XCD=({binary:D,shouldEncode:F,encoding:B,shouldSplit:Q,preserveNewlines:L})=>[fY(D,B,!F),SY(D,L,!Q,{})].filter(Boolean);var mp=async({stream:D,onStreamEnd:F,fdNumber:B,encoding:Q,buffer:L,maxBuffer:Z,lines:G,allMixed:J,stripFinalNewline:C,verboseInfo:K,streamInfo:V})=>{let R=JCD({stream:D,onStreamEnd:F,fdNumber:B,encoding:Q,allMixed:J,verboseInfo:K,streamInfo:V});if(!L){await Promise.all([YCD(D),R]);return}let I=GV(C,B),A=MV({stream:D,onStreamEnd:F,lines:G,encoding:Q,stripFinalNewline:I,allMixed:J}),[P]=await Promise.all([qCD({stream:D,iterable:A,fdNumber:B,encoding:Q,maxBuffer:Z,lines:G}),R]);return P},JCD=async({stream:D,onStreamEnd:F,fdNumber:B,encoding:Q,allMixed:L,verboseInfo:Z,streamInfo:{fileDescriptors:G}})=>{if(!yY({stdioItems:G[B]?.stdioItems,encoding:Q,verboseInfo:Z,fdNumber:B}))return;let J=MV({stream:D,onStreamEnd:F,lines:!0,encoding:Q,stripFinalNewline:!0,allMixed:L});await am(J,D,B,Z)},YCD=async(D)=>{if(await zCD(),D.readableFlowing===null)D.resume()},qCD=async({stream:D,stream:{readableObjectMode:F},iterable:B,fdNumber:Q,encoding:L,maxBuffer:Z,lines:G})=>{try{if(F||G)return await uY(B,{maxBuffer:Z});if(L==="buffer")return new Uint8Array(await AY(B,{maxBuffer:Z}));return await TY(B,{maxBuffer:Z})}catch(J){return pp(al({error:J,stream:D,readableObjectMode:F,lines:G,encoding:L,fdNumber:Q}))}},PV=async(D)=>{try{return await D}catch(F){return pp(F)}},pp=({bufferedData:D})=>Yb(D)?new Uint8Array(D):D;import{finished as UCD}from"node:stream/promises";var qZ=async(D,F,B,{isSameDirection:Q,stopOnExit:L=!1}={})=>{let Z=CCD(D,B),G=new AbortController;try{await Promise.race([...L?[B.exitPromise]:[],UCD(D,{cleanup:!0,signal:G.signal})])}catch(J){if(!Z.stdinCleanedUp)KCD(J,F,B,Q)}finally{G.abort()}},CCD=(D,{originalStreams:[F],subprocess:B})=>{let Q={stdinCleanedUp:!1};if(D===F)HCD(D,B,Q);return Q},HCD=(D,F,B)=>{let{_destroy:Q}=D;D._destroy=(...L)=>{WCD(F,B),Q.call(D,...L)}},WCD=({exitCode:D,signalCode:F},B)=>{if(D!==null||F!==null)B.stdinCleanedUp=!0},KCD=(D,F,B,Q)=>{if(!ECD(D,F,B,Q))throw D},ECD=(D,F,B,Q=!0)=>{if(B.propagating)return cp(D)||pY(D);return B.propagating=!0,_V(B,F)===Q?cp(D):pY(D)},_V=({fileDescriptors:D},F)=>F!=="all"&&D[F].direction==="input",pY=(D)=>D?.code==="ERR_STREAM_PREMATURE_CLOSE",cp=(D)=>D?.code==="EPIPE";var np=({subprocess:D,encoding:F,buffer:B,maxBuffer:Q,lines:L,stripFinalNewline:Z,verboseInfo:G,streamInfo:J})=>D.stdio.map((C,K)=>jV({stream:C,fdNumber:K,encoding:F,buffer:B[K],maxBuffer:Q[K],lines:L[K],allMixed:!1,stripFinalNewline:Z,verboseInfo:G,streamInfo:J})),jV=async({stream:D,fdNumber:F,encoding:B,buffer:Q,maxBuffer:L,lines:Z,allMixed:G,stripFinalNewline:J,verboseInfo:C,streamInfo:K})=>{if(!D)return;let V=qZ(D,F,K);if(_V(K,F)){await V;return}let[R]=await Promise.all([mp({stream:D,onStreamEnd:V,fdNumber:F,encoding:B,buffer:Q,maxBuffer:L,lines:Z,allMixed:G,stripFinalNewline:J,verboseInfo:C,streamInfo:K}),V]);return R};var dp=({stdout:D,stderr:F},{all:B})=>B&&(D||F)?n7([D,F].filter(Boolean)):void 0,ip=({subprocess:D,encoding:F,buffer:B,maxBuffer:Q,lines:L,stripFinalNewline:Z,verboseInfo:G,streamInfo:J})=>jV({...VCD(D,B),fdNumber:"all",encoding:F,maxBuffer:Q[1]+Q[2],lines:L[1]||L[2],allMixed:RCD(D),stripFinalNewline:Z,verboseInfo:G,streamInfo:J}),VCD=({stdout:D,stderr:F,all:B},[,Q,L])=>{let Z=Q||L;if(!Z)return{stream:B,buffer:Z};if(!Q)return{stream:F,buffer:Z};if(!L)return{stream:D,buffer:Z};return{stream:B,buffer:Z}},RCD=({all:D,stdout:F,stderr:B})=>D&&F&&B&&F.readableObjectMode!==B.readableObjectMode;import{once as ICD}from"node:events";var rp=(D)=>cB(D,"ipc"),ap=(D,F)=>{let B=dJ(D);U2({type:"ipc",verboseMessage:B,fdNumber:"ipc",verboseInfo:F})};var tp=async({subprocess:D,buffer:F,maxBuffer:B,ipc:Q,ipcOutput:L,verboseInfo:Z})=>{if(!Q)return L;let G=rp(Z),J=L5(F,"ipc"),C=L5(B,"ipc");for await(let K of WV({anyProcess:D,channel:D.channel,isSubprocess:!1,ipc:Q,shouldAwait:!1,reference:!0})){if(J)tl(D,L,C),L.push(K);if(G)ap(K,Z)}return L},op=async(D,F)=>{return await Promise.allSettled([D]),F};var sp=async({subprocess:D,options:{encoding:F,buffer:B,maxBuffer:Q,lines:L,timeoutDuration:Z,cancelSignal:G,gracefulCancel:J,forceKillAfterDelay:C,stripFinalNewline:K,ipc:V,ipcInput:R},context:I,verboseInfo:A,fileDescriptors:P,originalStreams:T,onInternalError:k,controller:p})=>{let LD=Dp(D,I),e={originalStreams:T,fileDescriptors:P,subprocess:D,exitPromise:LD,propagating:!1},s=np({subprocess:D,encoding:F,buffer:B,maxBuffer:Q,lines:L,stripFinalNewline:K,verboseInfo:A,streamInfo:e}),$D=ip({subprocess:D,encoding:F,buffer:B,maxBuffer:Q,lines:L,stripFinalNewline:K,verboseInfo:A,streamInfo:e}),XD=[],CD=tp({subprocess:D,buffer:B,maxBuffer:Q,ipc:V,ipcOutput:XD,verboseInfo:A}),dD=uCD(T,D,e),ID=ACD(P,e);try{return await Promise.race([Promise.all([{},Bp(LD),Promise.all(s),$D,CD,Nl(D,R),...dD,...ID]),k,OCD(D,p),...ul(D,Z,I,p),...pg({subprocess:D,cancelSignal:G,gracefulCancel:J,context:I,controller:p}),...Rl({subprocess:D,cancelSignal:G,gracefulCancel:J,forceKillAfterDelay:C,context:I,controller:p})])}catch(o0){return I.terminationReason??="other",Promise.all([{error:o0},LD,Promise.all(s.map((C1)=>PV(C1))),PV($D),op(CD,XD),Promise.allSettled(dD),Promise.allSettled(ID)])}},uCD=(D,F,B)=>D.map((Q,L)=>Q===F.stdio[L]?void 0:qZ(Q,L,B)),ACD=(D,F)=>D.flatMap(({stdioItems:B},Q)=>B.filter(({value:L,stream:Z=L})=>k4(Z,{checkOpen:!1})&&!x4(Z)).map(({type:L,value:Z,stream:G=Z})=>qZ(G,Q,F,{isSameDirection:J4.has(L),stopOnExit:L==="native"}))),OCD=async(D,{signal:F})=>{let[B]=await ICD(D,"error",{signal:F});throw B};var ep=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),UZ=(D,F,B)=>{let Q=D[B];if(!Q.has(F))Q.set(F,[]);let L=Q.get(F),Z=H2();return L.push(Z),{resolve:Z.resolve.bind(Z),promises:L}},BQ=async({resolve:D,promises:F},B)=>{D();let[Q]=await Promise.race([Promise.allSettled([!0,B]),Promise.all([!1,...F])]);return!Q};import{Readable as TCD}from"node:stream";import{callbackify as MCD}from"node:util";import{finished as Dc}from"node:stream/promises";var wV=async(D)=>{if(D===void 0)return;try{await SV(D)}catch{}},Fc=async(D)=>{if(D===void 0)return;try{await fV(D)}catch{}},SV=async(D)=>{await Dc(D,{cleanup:!0,readable:!1,writable:!0})},fV=async(D)=>{await Dc(D,{cleanup:!0,readable:!0,writable:!1})},cY=async(D,F)=>{if(await D,F)throw F},nY=(D,F,B)=>{if(B&&!pY(B))D.destroy(B);else if(F)D.destroy()};var Bc=({subprocess:D,concurrentStreams:F,encoding:B},{from:Q,binary:L=!0,preserveNewlines:Z=!0}={})=>{let G=L||v6.has(B),{subprocessStdout:J,waitReadableDestroy:C}=vV(D,Q,F),{readableEncoding:K,readableObjectMode:V,readableHighWaterMark:R}=xV(J,G),{read:I,onStdoutDataDone:A}=yV({subprocessStdout:J,subprocess:D,binary:G,encoding:B,preserveNewlines:Z}),P=new TCD({read:I,destroy:MCD(hV.bind(void 0,{subprocessStdout:J,subprocess:D,waitReadableDestroy:C})),highWaterMark:R,objectMode:V,encoding:K});return kV({subprocessStdout:J,onStdoutDataDone:A,readable:P,subprocess:D}),P},vV=(D,F,B)=>{let Q=aB(D,F),L=UZ(B,Q,"readableDestroy");return{subprocessStdout:Q,waitReadableDestroy:L}},xV=({readableEncoding:D,readableObjectMode:F,readableHighWaterMark:B},Q)=>Q?{readableEncoding:D,readableObjectMode:F,readableHighWaterMark:B}:{readableEncoding:D,readableObjectMode:!0,readableHighWaterMark:NV},yV=({subprocessStdout:D,subprocess:F,binary:B,encoding:Q,preserveNewlines:L})=>{let Z=H2(),G=mY({subprocessStdout:D,subprocess:F,binary:B,shouldEncode:!B,encoding:Q,preserveNewlines:L});return{read(){NCD(this,G,Z)},onStdoutDataDone:Z}},NCD=async(D,F,B)=>{try{let{value:Q,done:L}=await F.next();if(L)B.resolve();else D.push(Q)}catch{}},kV=async({subprocessStdout:D,onStdoutDataDone:F,readable:B,subprocess:Q,subprocessStdin:L})=>{try{if(await fV(D),await Q,await wV(L),await F,B.readable)B.push(null)}catch(Z){await wV(L),Qc(B,Z)}},hV=async({subprocessStdout:D,subprocess:F,waitReadableDestroy:B},Q)=>{if(await BQ(B,F))Qc(D,Q),await cY(F,Q)},Qc=(D,F)=>{nY(D,D.readable,F)};import{Writable as PCD}from"node:stream";import{callbackify as Lc}from"node:util";var $c=({subprocess:D,concurrentStreams:F},{to:B}={})=>{let{subprocessStdin:Q,waitWritableFinal:L,waitWritableDestroy:Z}=bV(D,B,F),G=new PCD({...gV(Q,D,L),destroy:Lc(mV.bind(void 0,{subprocessStdin:Q,subprocess:D,waitWritableFinal:L,waitWritableDestroy:Z})),highWaterMark:Q.writableHighWaterMark,objectMode:Q.writableObjectMode});return lV(Q,G),G},bV=(D,F,B)=>{let Q=ZY(D,F),L=UZ(B,Q,"writableFinal"),Z=UZ(B,Q,"writableDestroy");return{subprocessStdin:Q,waitWritableFinal:L,waitWritableDestroy:Z}},gV=(D,F,B)=>({write:_CD.bind(void 0,D),final:Lc(jCD.bind(void 0,D,F,B))}),_CD=(D,F,B,Q)=>{if(D.write(F,B))Q();else D.once("drain",Q)},jCD=async(D,F,B)=>{if(await BQ(B,F)){if(D.writable)D.end();await F}},lV=async(D,F,B)=>{try{if(await SV(D),F.writable)F.end()}catch(Q){await Fc(B),Zc(F,Q)}},mV=async({subprocessStdin:D,subprocess:F,waitWritableFinal:B,waitWritableDestroy:Q},L)=>{if(await BQ(B,F),await BQ(Q,F))Zc(D,L),await cY(F,L)},Zc=(D,F)=>{nY(D,D.writable,F)};import{Duplex as wCD}from"node:stream";import{callbackify as SCD}from"node:util";var Gc=({subprocess:D,concurrentStreams:F,encoding:B},{from:Q,to:L,binary:Z=!0,preserveNewlines:G=!0}={})=>{let J=Z||v6.has(B),{subprocessStdout:C,waitReadableDestroy:K}=vV(D,Q,F),{subprocessStdin:V,waitWritableFinal:R,waitWritableDestroy:I}=bV(D,L,F),{readableEncoding:A,readableObjectMode:P,readableHighWaterMark:T}=xV(C,J),{read:k,onStdoutDataDone:p}=yV({subprocessStdout:C,subprocess:D,binary:J,encoding:B,preserveNewlines:G}),LD=new wCD({read:k,...gV(V,D,R),destroy:SCD(fCD.bind(void 0,{subprocessStdout:C,subprocessStdin:V,subprocess:D,waitReadableDestroy:K,waitWritableFinal:R,waitWritableDestroy:I})),readableHighWaterMark:T,writableHighWaterMark:V.writableHighWaterMark,readableObjectMode:P,writableObjectMode:V.writableObjectMode,encoding:A});return kV({subprocessStdout:C,onStdoutDataDone:p,readable:LD,subprocess:D,subprocessStdin:V}),lV(V,LD,C),LD},fCD=async({subprocessStdout:D,subprocessStdin:F,subprocess:B,waitReadableDestroy:Q,waitWritableFinal:L,waitWritableDestroy:Z},G)=>{await Promise.all([hV({subprocessStdout:D,subprocess:B,waitReadableDestroy:Q},G),mV({subprocessStdin:F,subprocess:B,waitWritableFinal:L,waitWritableDestroy:Z},G)])};var pV=(D,F,{from:B,binary:Q=!1,preserveNewlines:L=!1}={})=>{let Z=Q||v6.has(F),G=aB(D,B),J=mY({subprocessStdout:G,subprocess:D,binary:Z,shouldEncode:!0,encoding:F,preserveNewlines:L});return vCD(J,G,D)},vCD=async function*(D,F,B){try{yield*D}finally{if(F.readable)F.destroy();await B}};var Xc=(D,{encoding:F})=>{let B=ep();D.readable=Bc.bind(void 0,{subprocess:D,concurrentStreams:B,encoding:F}),D.writable=$c.bind(void 0,{subprocess:D,concurrentStreams:B}),D.duplex=Gc.bind(void 0,{subprocess:D,concurrentStreams:B,encoding:F}),D.iterable=pV.bind(void 0,D,F),D[Symbol.asyncIterator]=pV.bind(void 0,D,F,{})};var zc=(D,F)=>{for(let[B,Q]of yCD){let L=Q.value.bind(F);Reflect.defineProperty(D,B,{...Q,value:L})}},xCD=(async()=>{})().constructor.prototype,yCD=["then","catch","finally"].map((D)=>[D,Reflect.getOwnPropertyDescriptor(xCD,D)]);var Jc=(D,F,B,Q)=>{let{file:L,commandArguments:Z,command:G,escapedCommand:J,startTime:C,verboseInfo:K,options:V,fileDescriptors:R}=bCD(D,F,B),{subprocess:I,promise:A}=lCD({file:L,commandArguments:Z,options:V,startTime:C,verboseInfo:K,command:G,escapedCommand:J,fileDescriptors:R});return I.pipe=lY.bind(void 0,{source:I,sourcePromise:A,boundOptions:{},createNested:Q}),zc(I,A),W2.set(I,{options:V,fileDescriptors:R}),I},bCD=(D,F,B)=>{let{command:Q,escapedCommand:L,startTime:Z,verboseInfo:G}=rJ(D,F,B),{file:J,commandArguments:C,options:K}=KY(D,F,B),V=gCD(K),R=Kp(V,G);return{file:J,commandArguments:C,command:Q,escapedCommand:L,startTime:Z,verboseInfo:G,options:V,fileDescriptors:R}},gCD=({timeout:D,signal:F,...B})=>{if(F!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...B,timeoutDuration:D}},lCD=({file:D,commandArguments:F,options:B,startTime:Q,verboseInfo:L,command:Z,escapedCommand:G,fileDescriptors:J})=>{let C;try{C=hCD(...EY(D,F,B))}catch(P){return Up({error:P,command:Z,escapedCommand:G,fileDescriptors:J,options:B,startTime:Q,verboseInfo:L})}let K=new AbortController;kCD(Number.POSITIVE_INFINITY,K.signal);let V=[...C.stdio];Np(C,J,K),Sp(C,B,K);let R={},I=H2();C.kill=lg.bind(void 0,{kill:C.kill.bind(C),options:B,onInternalError:I,context:R,controller:K}),C.all=dp(C,B),Xc(C,B),Jp(C,B);let A=mCD({subprocess:C,options:B,startTime:Q,verboseInfo:L,fileDescriptors:J,originalStreams:V,command:Z,escapedCommand:G,context:R,onInternalError:I,controller:K});return{subprocess:C,promise:A}},mCD=async({subprocess:D,options:F,startTime:B,verboseInfo:Q,fileDescriptors:L,originalStreams:Z,command:G,escapedCommand:J,context:C,onInternalError:K,controller:V})=>{let[R,[I,A],P,T,k]=await sp({subprocess:D,options:F,context:C,verboseInfo:Q,fileDescriptors:L,originalStreams:Z,onInternalError:K,controller:V});V.abort(),K.resolve();let p=P.map((s,$D)=>G5(s,F,$D)),LD=G5(T,F,"all"),e=pCD({errorInfo:R,exitCode:I,signal:A,stdio:p,all:LD,ipcOutput:k,context:C,options:F,command:G,escapedCommand:J,startTime:B});return eB(e,Q,F)},pCD=({errorInfo:D,exitCode:F,signal:B,stdio:Q,all:L,ipcOutput:Z,context:G,options:J,command:C,escapedCommand:K,startTime:V})=>("error"in D)?GZ({error:D.error,command:C,escapedCommand:K,timedOut:G.terminationReason==="timeout",isCanceled:G.terminationReason==="cancel"||G.terminationReason==="gracefulCancel",isGracefullyCanceled:G.terminationReason==="gracefulCancel",isMaxBuffer:D.error instanceof $5,isForcefullyTerminated:G.isForcefullyTerminated,exitCode:F,signal:B,stdio:Q,all:L,ipcOutput:Z,options:J,startTime:V,isSync:!1}):NY({command:C,escapedCommand:K,stdio:Q,all:L,ipcOutput:Z,options:J,startTime:V});var dY=(D,F)=>{let B=Object.fromEntries(Object.entries(F).map(([Q,L])=>[Q,cCD(Q,D[Q],L)]));return{...D,...B}},cCD=(D,F,B)=>{if(nCD.has(D)&&v3(F)&&v3(B))return{...F,...B};return B},nCD=new Set(["env",...uE]);var CF=(D,F,B,Q)=>{let L=(G,J,C)=>CF(G,J,B,C),Z=(...G)=>dCD({mapArguments:D,deepOptions:B,boundOptions:F,setBoundExeca:Q,createNested:L},...G);if(Q!==void 0)Q(Z,L,F);return Z},dCD=({mapArguments:D,deepOptions:F={},boundOptions:B={},setBoundExeca:Q,createNested:L},Z,...G)=>{if(v3(Z))return L(D,dY(B,Z),Q);let{file:J,commandArguments:C,options:K,isSync:V}=iCD({mapArguments:D,firstArgument:Z,nextArguments:G,deepOptions:F,boundOptions:B});return V?Lp(J,C,K):Jc(J,C,K,L)},iCD=({mapArguments:D,firstArgument:F,nextArguments:B,deepOptions:Q,boundOptions:L})=>{let Z=Kb(F)?Eb(F,B):[F,...B],[G,J,C]=kJ(...Z),K=dY(dY(Q,L),C),{file:V=G,commandArguments:R=J,options:I=K,isSync:A=!1}=D({file:G,commandArguments:J,options:K});return{file:V,commandArguments:R,options:I,isSync:A}};var Yc=({file:D,commandArguments:F})=>Uc(D,F),qc=({file:D,commandArguments:F})=>({...Uc(D,F),isSync:!0}),Uc=(D,F)=>{if(F.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${D} ${F}.`);let[B,...Q]=rCD(D);return{file:B,commandArguments:Q}},rCD=(D)=>{if(typeof D!=="string")throw new TypeError(`The command must be a string: ${String(D)}.`);let F=D.trim();if(F==="")return[];let B=[];for(let Q of F.split(aCD)){let L=B.at(-1);if(L&&L.endsWith("\\"))B[B.length-1]=`${L.slice(0,-1)} ${Q}`;else B.push(Q)}return B},aCD=/ +/g;var Cc=(D,F,B)=>{D.sync=F(tCD,B),D.s=D.sync},Hc=({options:D})=>Wc(D),tCD=({options:D})=>({...Wc(D),isSync:!0}),Wc=(D)=>({options:{...oCD(D),...D}}),oCD=({input:D,inputFile:F,stdio:B})=>D===void 0&&F===void 0&&B===void 0?{stdin:"inherit"}:{},Kc={preferLocal:!0};var Ec=CF(()=>({})),dgD=CF(()=>({isSync:!0})),igD=CF(Yc),rgD=CF(qc),agD=CF(Ol),tgD=CF(Hc,{},Kc,Cc),{sendMessage:ogD,getOneMessage:sgD,getEachMessage:egD,getCancelSignal:DlD}=Yp();var nc=Z0(cc(),1);async function cV(D){try{return await nc.default(D),!0}catch{return!1}}async function dc(D,F,B=[]){if(!await cV("claude"))throw new Error(nV());await Ec("claude",B,{stdio:"inherit",env:{...process.env,ANTHROPIC_BASE_URL:D,ANTHROPIC_AUTH_TOKEN:F},preferLocal:!0})}function nV(){return"Claude CLI not found. Install it with: npm install -g @anthropic-ai/claude-code"}function rc({args:D=[]}){return ic.useEffect(()=>{async function F(){if(s5("\uD83C\uDF31 Bonsai Start: Claude Code"),!await H6.isAuthenticated())w8("Not authenticated. Run `bonsai login` first."),process.exit(1);if(!await cV("claude"))w8(nV()),process.exit(1);try{let B=o$.getStoredKey(),Q="Bonsai CLI";if(!B){let L=await wj({message:"Name your Bonsai API key:",placeholder:Q,defaultValue:Q});if(i2(L))w8("Operation cancelled"),process.exit(1);let Z=L.trim()||Q,G=e5();G.start("Creating API key");let J=await o$.createKey(Z);o$.saveKey(J,Z),G.stop("Created and stored API key"),B=o$.getStoredKey()}if(!B)throw new Error("Failed to get or create API key");a2("Starting Claude Code with Bonsai"),await dc("https://go.trybons.ai",B.key,D)}catch(B){w8(B.message||"Unknown error"),process.exit(1)}}F()},[]),null}function ac({subcommand:D,args:F=[]}){if(!D)return iY.default.createElement($1,{color:"red"},"Missing subcommand. Available subcommands: claude");switch(D){case"claude":return iY.default.createElement(rc,{args:F});default:return iY.default.createElement($1,{color:"red"},"Unknown subcommand: ",D,". Available subcommands: claude")}}var y8=Z0(K1(),1);var X5={title:"Welcome to Bonsai CLI \uD83C\uDF31",description:"The command line interface for Bonsai.",usage:"$ bonsai [command]",commands:[{name:"login",description:"Authenticate with Bonsai"},{name:"start claude",description:"Start Claude Code with Bonsai"},{name:"sub link",description:"Link a provider subscription"},{name:"sub unlink",description:"Unlink a provider subscription"},{name:"logout",description:"Sign out of your account"}],options:[{name:"--version",description:"Show version number"},{name:"--help",description:"Show help"}],examples:["$ bonsai login","$ bonsai start claude","$ bonsai sub link","$ bonsai sub unlink","$ bonsai --version"]};function tc(){let D=X5.commands.map((Q)=>` ${Q.name.padEnd(14)} ${Q.description}`).join(`
|
|
260
260
|
`),F=X5.options.map((Q)=>` ${Q.name.padEnd(12)} ${Q.description}`).join(`
|
|
261
261
|
`),B=X5.examples.join(`
|
|
262
262
|
`);return`
|