zen-code 4.9.2 → 4.10.1
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/app.js +2606 -182
- package/dist/cli.js +3116 -1
- package/dist/nonInteractive.js +2084 -4
- package/dist/zen-keyboard.js +358 -3
- package/package.json +37 -37
- package/dist/chunk-0pss3s5r.js +0 -88
- package/dist/chunk-0sxrk9sx.js +0 -1
- package/dist/chunk-0zk0m93z.js +0 -26
- package/dist/chunk-178yjjsx.js +0 -1
- package/dist/chunk-1p9xzvpt.js +0 -3
- package/dist/chunk-2eh0sv3s.js +0 -2
- package/dist/chunk-43xrz4wp.js +0 -2
- package/dist/chunk-48ce2wt0.js +0 -1
- package/dist/chunk-48vkm1yn.js +0 -5
- package/dist/chunk-55nx49pj.js +0 -7
- package/dist/chunk-578m1dhj.js +0 -2
- package/dist/chunk-5dsevrtz.js +0 -91
- package/dist/chunk-62zh99t6.js +0 -298
- package/dist/chunk-66890qd3.js +0 -2
- package/dist/chunk-6nfpdtn6.js +0 -1
- package/dist/chunk-738m8242.js +0 -53
- package/dist/chunk-8f2zh5h6.js +0 -2
- package/dist/chunk-8ty2zfve.js +0 -3
- package/dist/chunk-94jawhw7.js +0 -3
- package/dist/chunk-98wjxsna.js +0 -79
- package/dist/chunk-9b7nj74j.js +0 -1
- package/dist/chunk-9k64296h.js +0 -4
- package/dist/chunk-9x562s6p.js +0 -1
- package/dist/chunk-a90fm6gz.js +0 -278
- package/dist/chunk-ac5t2ywn.js +0 -100
- package/dist/chunk-ad2hbq42.js +0 -1
- package/dist/chunk-afhxxkmv.js +0 -16
- package/dist/chunk-b4vvgbav.js +0 -1
- package/dist/chunk-b9pcntkv.js +0 -253
- package/dist/chunk-c7y5efa0.js +0 -1
- package/dist/chunk-cbjnwrt7.js +0 -2
- package/dist/chunk-ce53j63y.js +0 -3
- package/dist/chunk-dcs1r9as.js +0 -2
- package/dist/chunk-dcwnpdtk.js +0 -9
- package/dist/chunk-dxec2q4t.js +0 -23
- package/dist/chunk-e3tyc24s.js +0 -310
- package/dist/chunk-e8hp8d68.js +0 -81
- package/dist/chunk-fkrydbn4.js +0 -18
- package/dist/chunk-frhhpxxy.js +0 -2
- package/dist/chunk-fw3nrwpf.js +0 -1
- package/dist/chunk-gyhxdxb4.js +0 -1
- package/dist/chunk-h1enhch1.js +0 -2
- package/dist/chunk-hcnx1j2z.js +0 -1
- package/dist/chunk-hfegb4pr.js +0 -2
- package/dist/chunk-hfypkhky.js +0 -2
- package/dist/chunk-hmemx3cw.js +0 -2
- package/dist/chunk-hra0748z.js +0 -2
- package/dist/chunk-hsev32dg.js +0 -4
- package/dist/chunk-hyf24r36.js +0 -2
- package/dist/chunk-jb4yt88g.js +0 -6
- package/dist/chunk-jjcmm167.js +0 -1
- package/dist/chunk-jrepjpft.js +0 -2
- package/dist/chunk-k38fjqj7.js +0 -140
- package/dist/chunk-kym9tb01.js +0 -1
- package/dist/chunk-mt1g6g89.js +0 -1
- package/dist/chunk-p0vzbr7s.js +0 -585
- package/dist/chunk-pndhbee8.js +0 -2
- package/dist/chunk-pwrscdkf.js +0 -2
- package/dist/chunk-r019959h.js +0 -2
- package/dist/chunk-r10bn684.js +0 -1
- package/dist/chunk-r3pe49q4.js +0 -8
- package/dist/chunk-r4tq44hr.js +0 -1
- package/dist/chunk-rjrnaka2.js +0 -1
- package/dist/chunk-rt5mpgbg.js +0 -6
- package/dist/chunk-rztre6k0.js +0 -1
- package/dist/chunk-s77qbhtz.js +0 -3
- package/dist/chunk-t7rwtc17.js +0 -1
- package/dist/chunk-v8g52kan.js +0 -1
- package/dist/chunk-vd6c87cm.js +0 -2
- package/dist/chunk-vfwbx331.js +0 -2
- package/dist/chunk-vh9zd1v3.js +0 -5
- package/dist/chunk-w2hbsa9j.js +0 -86
- package/dist/chunk-wabmqprd.js +0 -184
- package/dist/chunk-wpy5r9ma.js +0 -40
- package/dist/chunk-x552nspp.js +0 -6
- package/dist/chunk-x90r4sje.js +0 -1
- package/dist/chunk-yndex7hs.js +0 -1
- package/dist/chunk-yqwxbcc7.js +0 -31
- package/dist/chunk-z8n7y37k.js +0 -1
- package/dist/chunk-zr7sx9hd.js +0 -1
- package/dist/chunk-zxqmghzf.js +0 -1
package/dist/chunk-wabmqprd.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import{Ig as W_,Jg as vK}from"./chunk-x552nspp.js";import{Vh as o}from"./chunk-dcwnpdtk.js";import{ri as C}from"./chunk-cbjnwrt7.js";import{lq as _2}from"./chunk-1p9xzvpt.js";import{pq as Wq,qq as k,tq as w}from"./chunk-dcs1r9as.js";var eJ=k((jI,tJ)=>{tJ.exports=sJ;function sJ(q,J){if(q&&J)return sJ(q)(J);if(typeof q!=="function")throw TypeError("need wrapper function");return Object.keys(q).forEach(function(Q){X[Q]=q[Q]}),X;function X(){var Q=Array(arguments.length);for(var $=0;$<Q.length;$++)Q[$]=arguments[$];var Z=q.apply(this,Q),Y=Q[Q.length-1];if(typeof Z==="function"&&Z!==Y)Object.keys(Y).forEach(function(H){Z[H]=Y[H]});return Z}}});var H4=k((RI,Y4)=>{var qX=eJ();Y4.exports=qX(r1);Y4.exports.strict=qX(JX);r1.proto=r1(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r1(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return JX(this)},configurable:!0})});function r1(q){var J=function(){if(J.called)return J.value;return J.called=!0,J.value=q.apply(this,arguments)};return J.called=!1,J}function JX(q){var J=function(){if(J.called)throw Error(J.onceError);return J.called=!0,J.value=q.apply(this,arguments)},X=q.name||"Function wrapped with `once`";return J.onceError=X+" shouldn't be called more than once",J.called=!1,J}});var $X=k((FI,QX)=>{var Cz=H4(),kz=function(){},Tz=global.Bare?queueMicrotask:process.nextTick.bind(process),wz=function(q){return q.setHeader&&typeof q.abort==="function"},Pz=function(q){return q.stdio&&Array.isArray(q.stdio)&&q.stdio.length===3},XX=function(q,J,X){if(typeof J==="function")return XX(q,null,J);if(!J)J={};X=Cz(X||kz);var{_writableState:Q,_readableState:$}=q,Z=J.readable||J.readable!==!1&&q.readable,Y=J.writable||J.writable!==!1&&q.writable,H=!1,K=function(){if(!q.writable)V()},V=function(){if(Y=!1,!Z)X.call(q)},G=function(){if(Z=!1,!Y)X.call(q)},W=function(x){X.call(q,x?Error("exited with error code: "+x):null)},U=function(x){X.call(q,x)},z=function(){Tz(L)},L=function(){if(H)return;if(Z&&!($&&($.ended&&!$.destroyed)))return X.call(q,Error("premature close"));if(Y&&!(Q&&(Q.ended&&!Q.destroyed)))return X.call(q,Error("premature close"))},_=function(){q.req.on("finish",V)};if(wz(q))if(q.on("complete",V),q.on("abort",z),q.req)_();else q.on("request",_);else if(Y&&!Q)q.on("end",K),q.on("close",K);if(Pz(q))q.on("exit",W);if(q.on("end",G),q.on("finish",V),J.error!==!1)q.on("error",U);return q.on("close",z),function(){if(H=!0,q.removeListener("complete",V),q.removeListener("abort",z),q.removeListener("request",_),q.req)q.req.removeListener("finish",V);q.removeListener("end",K),q.removeListener("close",K),q.removeListener("finish",V),q.removeListener("exit",W),q.removeListener("end",G),q.removeListener("error",U),q.removeListener("close",z)}};QX.exports=XX});var HX=k((MI,YX)=>{var Az=H4(),Dz=$X(),s1;try{s1=w("fs")}catch(q){}var G2=function(){},Iz=typeof process>"u"?!1:/^v?\.0/.test(process.version),t1=function(q){return typeof q==="function"},Oz=function(q){if(!Iz)return!1;if(!s1)return!1;return(q instanceof(s1.ReadStream||G2)||q instanceof(s1.WriteStream||G2))&&t1(q.close)},vz=function(q){return q.setHeader&&t1(q.abort)},Nz=function(q,J,X,Q){Q=Az(Q);var $=!1;q.on("close",function(){$=!0}),Dz(q,{readable:J,writable:X},function(Y){if(Y)return Q(Y);$=!0,Q()});var Z=!1;return function(Y){if($)return;if(Z)return;if(Z=!0,Oz(q))return q.close(G2);if(vz(q))return q.abort();if(t1(q.destroy))return q.destroy();Q(Y||Error("stream was destroyed"))}},ZX=function(q){q()},Ez=function(q,J){return q.pipe(J)},yz=function(){var q=Array.prototype.slice.call(arguments),J=t1(q[q.length-1]||G2)&&q.pop()||G2;if(Array.isArray(q[0]))q=q[0];if(q.length<2)throw Error("pump requires two streams per minimum");var X,Q=q.map(function($,Z){var Y=Z<q.length-1,H=Z>0;return Nz($,Y,H,function(K){if(!X)X=K;if(K)Q.forEach(ZX);if(Y)return;Q.forEach(ZX),J(X)})});return q.reduce(Ez)};YX.exports=yz});var VX=k((CI,KX)=>{var{PassThrough:Sz}=w("stream");KX.exports=(q)=>{q={...q};let{array:J}=q,{encoding:X}=q,Q=X==="buffer",$=!1;if(J)$=!(X||Q);else X=X||"utf8";if(Q)X=null;let Z=new Sz({objectMode:$});if(X)Z.setEncoding(X);let Y=0,H=[];return Z.on("data",(K)=>{if(H.push(K),$)Y=H.length;else Y+=K.length}),Z.getBufferedValue=()=>{if(J)return H;return Q?Buffer.concat(H,Y):H.join("")},Z.getBufferedLength=()=>Y,Z}});var GX=k((kI,T6)=>{var{constants:hz}=w("buffer"),bz=HX(),gz=VX();class K4 extends Error{constructor(){super("maxBuffer exceeded");this.name="MaxBufferError"}}async function e1(q,J){if(!q)return Promise.reject(Error("Expected a stream"));J={maxBuffer:1/0,...J};let{maxBuffer:X}=J,Q;return await new Promise(($,Z)=>{let Y=(H)=>{if(H&&Q.getBufferedLength()<=hz.MAX_LENGTH)H.bufferedData=Q.getBufferedValue();Z(H)};Q=bz(q,gz(J),(H)=>{if(H){Y(H);return}$()}),Q.on("data",()=>{if(Q.getBufferedLength()>X)Y(new K4)})}),Q.getBufferedValue()}T6.exports=e1;T6.exports.default=e1;T6.exports.buffer=(q,J)=>e1(q,{...J,encoding:"buffer"});T6.exports.array=(q,J)=>e1(q,{...J,array:!0});T6.exports.MaxBufferError=K4});var _X=k((TI,zX)=>{zX.exports=q8;function q8(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}q8.prototype.go=function(q){if(this.pending<this.max)UX(this,q);else this.waiting.push(q)};q8.prototype.wait=function(q){if(this.pending===0)q(this.error);else this.listeners.push(q)};q8.prototype.hold=function(){return WX(this)};function WX(q){q.pending+=1;var J=!1;return X;function X($){if(J)throw Error("callback called twice");if(J=!0,q.error=q.error||$,q.pending-=1,q.waiting.length>0&&q.pending<q.max)UX(q,q.waiting.shift());else if(q.pending===0){var Z=q.listeners;q.listeners=[],Z.forEach(Q)}}function Q($){$(q.error)}}function UX(q,J){J(WX(q))}});var BX=k((cz)=>{var W2=w("fs"),J8=w("util"),V4=w("stream"),LX=V4.Readable,G4=V4.Writable,fz=V4.PassThrough,uz=_X(),X8=w("events").EventEmitter;cz.createFromBuffer=mz;cz.createFromFd=dz;cz.BufferSlicer=v0;cz.FdSlicer=O0;J8.inherits(O0,X8);function O0(q,J){J=J||{},X8.call(this),this.fd=q,this.pend=new uz,this.pend.max=1,this.refCount=0,this.autoClose=!!J.autoClose}O0.prototype.read=function(q,J,X,Q,$){var Z=this;Z.pend.go(function(Y){W2.read(Z.fd,q,J,X,Q,function(H,K,V){Y(),$(H,K,V)})})};O0.prototype.write=function(q,J,X,Q,$){var Z=this;Z.pend.go(function(Y){W2.write(Z.fd,q,J,X,Q,function(H,K,V){Y(),$(H,K,V)})})};O0.prototype.createReadStream=function(q){return new Q8(this,q)};O0.prototype.createWriteStream=function(q){return new $8(this,q)};O0.prototype.ref=function(){this.refCount+=1};O0.prototype.unref=function(){var q=this;if(q.refCount-=1,q.refCount>0)return;if(q.refCount<0)throw Error("invalid unref");if(q.autoClose)W2.close(q.fd,J);function J(X){if(X)q.emit("error",X);else q.emit("close")}};J8.inherits(Q8,LX);function Q8(q,J){J=J||{},LX.call(this,J),this.context=q,this.context.ref(),this.start=J.start||0,this.endOffset=J.end,this.pos=this.start,this.destroyed=!1}Q8.prototype._read=function(q){var J=this;if(J.destroyed)return;var X=Math.min(J._readableState.highWaterMark,q);if(J.endOffset!=null)X=Math.min(X,J.endOffset-J.pos);if(X<=0){J.destroyed=!0,J.push(null),J.context.unref();return}J.context.pend.go(function(Q){if(J.destroyed)return Q();var $=new Buffer(X);W2.read(J.context.fd,$,0,X,J.pos,function(Z,Y){if(Z)J.destroy(Z);else if(Y===0)J.destroyed=!0,J.push(null),J.context.unref();else J.pos+=Y,J.push($.slice(0,Y));Q()})})};Q8.prototype.destroy=function(q){if(this.destroyed)return;q=q||Error("stream destroyed"),this.destroyed=!0,this.emit("error",q),this.context.unref()};J8.inherits($8,G4);function $8(q,J){J=J||{},G4.call(this,J),this.context=q,this.context.ref(),this.start=J.start||0,this.endOffset=J.end==null?1/0:+J.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}$8.prototype._write=function(q,J,X){var Q=this;if(Q.destroyed)return;if(Q.pos+q.length>Q.endOffset){var $=Error("maximum file length exceeded");$.code="ETOOBIG",Q.destroy(),X($);return}Q.context.pend.go(function(Z){if(Q.destroyed)return Z();W2.write(Q.context.fd,q,0,q.length,Q.pos,function(Y,H){if(Y)Q.destroy(),Z(),X(Y);else Q.bytesWritten+=H,Q.pos+=H,Q.emit("progress"),Z(),X()})})};$8.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=!0,this.context.unref()};J8.inherits(v0,X8);function v0(q,J){X8.call(this),J=J||{},this.refCount=0,this.buffer=q,this.maxChunkSize=J.maxChunkSize||Number.MAX_SAFE_INTEGER}v0.prototype.read=function(q,J,X,Q,$){var Z=Q+X,Y=Z-this.buffer.length,H=Y>0?Y:X;this.buffer.copy(q,J,Q,Z),setImmediate(function(){$(null,H)})};v0.prototype.write=function(q,J,X,Q,$){q.copy(this.buffer,Q,J,J+X),setImmediate(function(){$(null,X,q)})};v0.prototype.createReadStream=function(q){q=q||{};var J=new fz(q);J.destroyed=!1,J.start=q.start||0,J.endOffset=q.end,J.pos=J.endOffset||this.buffer.length;var X=this.buffer.slice(J.start,J.pos),Q=0;while(!0){var $=Q+this.maxChunkSize;if($>=X.length){if(Q<X.length)J.write(X.slice(Q,X.length));break}J.write(X.slice(Q,$)),Q=$}return J.end(),J.destroy=function(){J.destroyed=!0},J};v0.prototype.createWriteStream=function(q){var J=this;q=q||{};var X=new G4(q);return X.start=q.start||0,X.endOffset=q.end==null?this.buffer.length:+q.end,X.bytesWritten=0,X.pos=X.start,X.destroyed=!1,X._write=function(Q,$,Z){if(X.destroyed)return;var Y=X.pos+Q.length;if(Y>X.endOffset){var H=Error("maximum file length exceeded");H.code="ETOOBIG",X.destroyed=!0,Z(H);return}Q.copy(J.buffer,X.pos,0,Q.length),X.bytesWritten+=Q.length,X.pos=Y,X.emit("progress"),Z()},X.destroy=function(){X.destroyed=!0},X};v0.prototype.ref=function(){this.refCount+=1};v0.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")};function mz(q,J){return new v0(q,J)}function dz(q,J){return new O0(q,J)}});var RX=k((PI,jX)=>{var f0=w("buffer").Buffer,W4=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array<"u")W4=new Int32Array(W4);function xX(q){if(f0.isBuffer(q))return q;var J=typeof f0.alloc==="function"&&typeof f0.from==="function";if(typeof q==="number")return J?f0.alloc(q):new f0(q);else if(typeof q==="string")return J?f0.from(q):new f0(q);else throw Error("input must be buffer, number, or string, received "+typeof q)}function az(q){var J=xX(4);return J.writeInt32BE(q,0),J}function U4(q,J){if(q=xX(q),f0.isBuffer(J))J=J.readUInt32BE(0);var X=~~J^-1;for(var Q=0;Q<q.length;Q++)X=W4[(X^q[Q])&255]^X>>>8;return X^-1}function z4(){return az(U4.apply(null,arguments))}z4.signed=function(){return U4.apply(null,arguments)};z4.unsigned=function(){return U4.apply(null,arguments)>>>0};jX.exports=z4});var PX=k((J_)=>{var _4=w("fs"),oz=w("zlib"),FX=BX(),rz=RX(),H8=w("util"),K8=w("events").EventEmitter,MX=w("stream").Transform,L4=w("stream").PassThrough,sz=w("stream").Writable;J_.open=tz;J_.fromFd=CX;J_.fromBuffer=ez;J_.fromRandomAccessReader=B4;J_.dosDateTimeToDate=TX;J_.validateFileName=wX;J_.ZipFile=u0;J_.Entry=U2;J_.RandomAccessReader=m0;function tz(q,J,X){if(typeof J==="function")X=J,J=null;if(J==null)J={};if(J.autoClose==null)J.autoClose=!0;if(J.lazyEntries==null)J.lazyEntries=!1;if(J.decodeStrings==null)J.decodeStrings=!0;if(J.validateEntrySizes==null)J.validateEntrySizes=!0;if(J.strictFileNames==null)J.strictFileNames=!1;if(X==null)X=Y8;_4.open(q,"r",function(Q,$){if(Q)return X(Q);CX($,J,function(Z,Y){if(Z)_4.close($,Y8);X(Z,Y)})})}function CX(q,J,X){if(typeof J==="function")X=J,J=null;if(J==null)J={};if(J.autoClose==null)J.autoClose=!1;if(J.lazyEntries==null)J.lazyEntries=!1;if(J.decodeStrings==null)J.decodeStrings=!0;if(J.validateEntrySizes==null)J.validateEntrySizes=!0;if(J.strictFileNames==null)J.strictFileNames=!1;if(X==null)X=Y8;_4.fstat(q,function(Q,$){if(Q)return X(Q);var Z=FX.createFromFd(q,{autoClose:!0});B4(Z,$.size,J,X)})}function ez(q,J,X){if(typeof J==="function")X=J,J=null;if(J==null)J={};if(J.autoClose=!1,J.lazyEntries==null)J.lazyEntries=!1;if(J.decodeStrings==null)J.decodeStrings=!0;if(J.validateEntrySizes==null)J.validateEntrySizes=!0;if(J.strictFileNames==null)J.strictFileNames=!1;var Q=FX.createFromBuffer(q,{maxChunkSize:65536});B4(Q,q.length,J,X)}function B4(q,J,X,Q){if(typeof X==="function")Q=X,X=null;if(X==null)X={};if(X.autoClose==null)X.autoClose=!0;if(X.lazyEntries==null)X.lazyEntries=!1;if(X.decodeStrings==null)X.decodeStrings=!0;var $=!!X.decodeStrings;if(X.validateEntrySizes==null)X.validateEntrySizes=!0;if(X.strictFileNames==null)X.strictFileNames=!1;if(Q==null)Q=Y8;if(typeof J!=="number")throw Error("expected totalSize parameter to be a number");if(J>Number.MAX_SAFE_INTEGER)throw Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");q.ref();var Z=22,Y=65535,H=Math.min(Z+Y,J),K=M0(H),V=J-K.length;w6(q,K,0,H,V,function(G){if(G)return Q(G);for(var W=H-Z;W>=0;W-=1){if(K.readUInt32LE(W)!==101010256)continue;var U=K.slice(W),z=U.readUInt16LE(4);if(z!==0)return Q(Error("multi-disk zip files are not supported: found disk number: "+z));var L=U.readUInt16LE(10),_=U.readUInt32LE(16),x=U.readUInt16LE(20),B=U.length-Z;if(x!==B)return Q(Error("invalid comment length. expected: "+B+". found: "+x));var j=$?Z8(U,22,U.length,!1):U.slice(22);if(!(L===65535||_===4294967295))return Q(null,new u0(q,_,J,L,j,X.autoClose,X.lazyEntries,$,X.validateEntrySizes,X.strictFileNames));var R=M0(20),M=V+W-R.length;w6(q,R,0,R.length,M,function(F){if(F)return Q(F);if(R.readUInt32LE(0)!==117853008)return Q(Error("invalid zip64 end of central directory locator signature"));var I=P6(R,8),P=M0(56);w6(q,P,0,P.length,I,function(g){if(g)return Q(g);if(P.readUInt32LE(0)!==101075792)return Q(Error("invalid zip64 end of central directory record signature"));return L=P6(P,32),_=P6(P,48),Q(null,new u0(q,_,J,L,j,X.autoClose,X.lazyEntries,$,X.validateEntrySizes,X.strictFileNames))})});return}Q(Error("end of central directory record signature not found"))})}H8.inherits(u0,K8);function u0(q,J,X,Q,$,Z,Y,H,K,V){var G=this;if(K8.call(G),G.reader=q,G.reader.on("error",function(W){kX(G,W)}),G.reader.once("close",function(){G.emit("close")}),G.readEntryCursor=J,G.fileSize=X,G.entryCount=Q,G.comment=$,G.entriesRead=0,G.autoClose=!!Z,G.lazyEntries=!!Y,G.decodeStrings=!!H,G.validateEntrySizes=!!K,G.strictFileNames=!!V,G.isOpen=!0,G.emittedError=!1,!G.lazyEntries)G._readEntry()}u0.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};function G0(q,J){if(q.autoClose)q.close();kX(q,J)}function kX(q,J){if(q.emittedError)return;q.emittedError=!0,q.emit("error",J)}u0.prototype.readEntry=function(){if(!this.lazyEntries)throw Error("readEntry() called without lazyEntries:true");this._readEntry()};u0.prototype._readEntry=function(){var q=this;if(q.entryCount===q.entriesRead){setImmediate(function(){if(q.autoClose)q.close();if(q.emittedError)return;q.emit("end")});return}if(q.emittedError)return;var J=M0(46);w6(q.reader,J,0,J.length,q.readEntryCursor,function(X){if(X)return G0(q,X);if(q.emittedError)return;var Q=new U2,$=J.readUInt32LE(0);if($!==33639248)return G0(q,Error("invalid central directory file header signature: 0x"+$.toString(16)));if(Q.versionMadeBy=J.readUInt16LE(4),Q.versionNeededToExtract=J.readUInt16LE(6),Q.generalPurposeBitFlag=J.readUInt16LE(8),Q.compressionMethod=J.readUInt16LE(10),Q.lastModFileTime=J.readUInt16LE(12),Q.lastModFileDate=J.readUInt16LE(14),Q.crc32=J.readUInt32LE(16),Q.compressedSize=J.readUInt32LE(20),Q.uncompressedSize=J.readUInt32LE(24),Q.fileNameLength=J.readUInt16LE(28),Q.extraFieldLength=J.readUInt16LE(30),Q.fileCommentLength=J.readUInt16LE(32),Q.internalFileAttributes=J.readUInt16LE(36),Q.externalFileAttributes=J.readUInt32LE(38),Q.relativeOffsetOfLocalHeader=J.readUInt32LE(42),Q.generalPurposeBitFlag&64)return G0(q,Error("strong encryption is not supported"));q.readEntryCursor+=46,J=M0(Q.fileNameLength+Q.extraFieldLength+Q.fileCommentLength),w6(q.reader,J,0,J.length,q.readEntryCursor,function(Z){if(Z)return G0(q,Z);if(q.emittedError)return;var Y=(Q.generalPurposeBitFlag&2048)!==0;Q.fileName=q.decodeStrings?Z8(J,0,Q.fileNameLength,Y):J.slice(0,Q.fileNameLength);var H=Q.fileNameLength+Q.extraFieldLength,K=J.slice(Q.fileNameLength,H);Q.extraFields=[];var V=0;while(V<K.length-3){var G=K.readUInt16LE(V+0),W=K.readUInt16LE(V+2),U=V+4,z=U+W;if(z>K.length)return G0(q,Error("extra field length exceeds extra field buffer size"));var L=M0(W);K.copy(L,0,U,z),Q.extraFields.push({id:G,data:L}),V=z}if(Q.fileComment=q.decodeStrings?Z8(J,H,H+Q.fileCommentLength,Y):J.slice(H,H+Q.fileCommentLength),Q.comment=Q.fileComment,q.readEntryCursor+=J.length,q.entriesRead+=1,Q.uncompressedSize===4294967295||Q.compressedSize===4294967295||Q.relativeOffsetOfLocalHeader===4294967295){var _=null;for(var V=0;V<Q.extraFields.length;V++){var x=Q.extraFields[V];if(x.id===1){_=x.data;break}}if(_==null)return G0(q,Error("expected zip64 extended information extra field"));var B=0;if(Q.uncompressedSize===4294967295){if(B+8>_.length)return G0(q,Error("zip64 extended information extra field does not include uncompressed size"));Q.uncompressedSize=P6(_,B),B+=8}if(Q.compressedSize===4294967295){if(B+8>_.length)return G0(q,Error("zip64 extended information extra field does not include compressed size"));Q.compressedSize=P6(_,B),B+=8}if(Q.relativeOffsetOfLocalHeader===4294967295){if(B+8>_.length)return G0(q,Error("zip64 extended information extra field does not include relative header offset"));Q.relativeOffsetOfLocalHeader=P6(_,B),B+=8}}if(q.decodeStrings)for(var V=0;V<Q.extraFields.length;V++){var x=Q.extraFields[V];if(x.id===28789){if(x.data.length<6)continue;if(x.data.readUInt8(0)!==1)continue;var j=x.data.readUInt32LE(1);if(rz.unsigned(J.slice(0,Q.fileNameLength))!==j)continue;Q.fileName=Z8(x.data,5,x.data.length,!0);break}}if(q.validateEntrySizes&&Q.compressionMethod===0){var R=Q.uncompressedSize;if(Q.isEncrypted())R+=12;if(Q.compressedSize!==R){var M="compressed/uncompressed size mismatch for stored file: "+Q.compressedSize+" != "+Q.uncompressedSize;return G0(q,Error(M))}}if(q.decodeStrings){if(!q.strictFileNames)Q.fileName=Q.fileName.replace(/\\/g,"/");var F=wX(Q.fileName,q.validateFileNameOptions);if(F!=null)return G0(q,Error(F))}if(q.emit("entry",Q),!q.lazyEntries)q._readEntry()})})};u0.prototype.openReadStream=function(q,J,X){var Q=this,$=0,Z=q.compressedSize;if(X==null)X=J,J={};else{if(J.decrypt!=null){if(!q.isEncrypted())throw Error("options.decrypt can only be specified for encrypted entries");if(J.decrypt!==!1)throw Error("invalid options.decrypt value: "+J.decrypt);if(q.isCompressed()){if(J.decompress!==!1)throw Error("entry is encrypted and compressed, and options.decompress !== false")}}if(J.decompress!=null){if(!q.isCompressed())throw Error("options.decompress can only be specified for compressed entries");if(!(J.decompress===!1||J.decompress===!0))throw Error("invalid options.decompress value: "+J.decompress)}if(J.start!=null||J.end!=null){if(q.isCompressed()&&J.decompress!==!1)throw Error("start/end range not allowed for compressed entry without options.decompress === false");if(q.isEncrypted()&&J.decrypt!==!1)throw Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(J.start!=null){if($=J.start,$<0)throw Error("options.start < 0");if($>q.compressedSize)throw Error("options.start > entry.compressedSize")}if(J.end!=null){if(Z=J.end,Z<0)throw Error("options.end < 0");if(Z>q.compressedSize)throw Error("options.end > entry.compressedSize");if(Z<$)throw Error("options.end < options.start")}}if(!Q.isOpen)return X(Error("closed"));if(q.isEncrypted()){if(J.decrypt!==!1)return X(Error("entry is encrypted, and options.decrypt !== false"))}Q.reader.ref();var Y=M0(30);w6(Q.reader,Y,0,Y.length,q.relativeOffsetOfLocalHeader,function(H){try{if(H)return X(H);var K=Y.readUInt32LE(0);if(K!==67324752)return X(Error("invalid local file header signature: 0x"+K.toString(16)));var V=Y.readUInt16LE(26),G=Y.readUInt16LE(28),W=q.relativeOffsetOfLocalHeader+Y.length+V+G,U;if(q.compressionMethod===0)U=!1;else if(q.compressionMethod===8)U=J.decompress!=null?J.decompress:!0;else return X(Error("unsupported compression method: "+q.compressionMethod));var z=W,L=z+q.compressedSize;if(q.compressedSize!==0){if(L>Q.fileSize)return X(Error("file data overflows file bounds: "+z+" + "+q.compressedSize+" > "+Q.fileSize))}var _=Q.reader.createReadStream({start:z+$,end:z+Z}),x=_;if(U){var B=!1,j=oz.createInflateRaw();if(_.on("error",function(R){setImmediate(function(){if(!B)j.emit("error",R)})}),_.pipe(j),Q.validateEntrySizes)x=new z2(q.uncompressedSize),j.on("error",function(R){setImmediate(function(){if(!B)x.emit("error",R)})}),j.pipe(x);else x=j;x.destroy=function(){if(B=!0,j!==x)j.unpipe(x);_.unpipe(j),_.destroy()}}X(null,x)}finally{Q.reader.unref()}})};function U2(){}U2.prototype.getLastModDate=function(){return TX(this.lastModFileDate,this.lastModFileTime)};U2.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};U2.prototype.isCompressed=function(){return this.compressionMethod===8};function TX(q,J){var X=q&31,Q=(q>>5&15)-1,$=(q>>9&127)+1980,Z=0,Y=(J&31)*2,H=J>>5&63,K=J>>11&31;return new Date($,Q,X,K,H,Y,Z)}function wX(q){if(q.indexOf("\\")!==-1)return"invalid characters in fileName: "+q;if(/^[a-zA-Z]:/.test(q)||/^\//.test(q))return"absolute path: "+q;if(q.split("/").indexOf("..")!==-1)return"invalid relative path: "+q;return null}function w6(q,J,X,Q,$,Z){if(Q===0)return setImmediate(function(){Z(null,M0(0))});q.read(J,X,Q,$,function(Y,H){if(Y)return Z(Y);if(H<Q)return Z(Error("unexpected EOF"));Z()})}H8.inherits(z2,MX);function z2(q){MX.call(this),this.actualByteCount=0,this.expectedByteCount=q}z2.prototype._transform=function(q,J,X){if(this.actualByteCount+=q.length,this.actualByteCount>this.expectedByteCount){var Q="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return X(Error(Q))}X(null,q)};z2.prototype._flush=function(q){if(this.actualByteCount<this.expectedByteCount){var J="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return q(Error(J))}q()};H8.inherits(m0,K8);function m0(){K8.call(this),this.refCount=0}m0.prototype.ref=function(){this.refCount+=1};m0.prototype.unref=function(){var q=this;if(q.refCount-=1,q.refCount>0)return;if(q.refCount<0)throw Error("invalid unref");q.close(J);function J(X){if(X)return q.emit("error",X);q.emit("close")}};m0.prototype.createReadStream=function(q){var{start:J,end:X}=q;if(J===X){var Q=new L4;return setImmediate(function(){Q.end()}),Q}var $=this._readStreamForRange(J,X),Z=!1,Y=new V8(this);$.on("error",function(K){setImmediate(function(){if(!Z)Y.emit("error",K)})}),Y.destroy=function(){$.unpipe(Y),Y.unref(),$.destroy()};var H=new z2(X-J);return Y.on("error",function(K){setImmediate(function(){if(!Z)H.emit("error",K)})}),H.destroy=function(){Z=!0,Y.unpipe(H),Y.destroy()},$.pipe(Y).pipe(H)};m0.prototype._readStreamForRange=function(q,J){throw Error("not implemented")};m0.prototype.read=function(q,J,X,Q,$){var Z=this.createReadStream({start:Q,end:Q+X}),Y=new sz,H=0;Y._write=function(K,V,G){K.copy(q,J+H,0,K.length),H+=K.length,G()},Y.on("finish",$),Z.on("error",function(K){$(K)}),Z.pipe(Y)};m0.prototype.close=function(q){setImmediate(q)};H8.inherits(V8,L4);function V8(q){L4.call(this),this.context=q,this.context.ref(),this.unreffedYet=!1}V8.prototype._flush=function(q){this.unref(),q()};V8.prototype.unref=function(q){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};var q_="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function Z8(q,J,X,Q){if(Q)return q.toString("utf8",J,X);else{var $="";for(var Z=J;Z<X;Z++)$+=q_[q[Z]];return $}}function P6(q,J){var X=q.readUInt32LE(J),Q=q.readUInt32LE(J+4);return Q*4294967296+X}var M0;if(typeof Buffer.allocUnsafe==="function")M0=function(q){return Buffer.allocUnsafe(q)};else M0=function(q){return new Buffer(q)};function Y8(q){if(q)throw q}});var IX=k((DI,DX)=>{var W0=W_()("extract-zip"),{createWriteStream:U_,promises:A6}=w("fs"),z_=GX(),Q6=w("path"),{promisify:x4}=w("util"),__=w("stream"),L_=PX(),B_=x4(L_.open),x_=x4(__.pipeline);class AX{constructor(q,J){this.zipPath=q,this.opts=J}async extract(){return W0("opening",this.zipPath,"with opts",this.opts),this.zipfile=await B_(this.zipPath,{lazyEntries:!0}),this.canceled=!1,new Promise((q,J)=>{this.zipfile.on("error",(X)=>{this.canceled=!0,J(X)}),this.zipfile.readEntry(),this.zipfile.on("close",()=>{if(!this.canceled)W0("zip extraction complete"),q()}),this.zipfile.on("entry",async(X)=>{if(this.canceled){W0("skipping entry",X.fileName,{cancelled:this.canceled});return}if(W0("zipfile entry",X.fileName),X.fileName.startsWith("__MACOSX/")){this.zipfile.readEntry();return}let Q=Q6.dirname(Q6.join(this.opts.dir,X.fileName));try{await A6.mkdir(Q,{recursive:!0});let $=await A6.realpath(Q);if(Q6.relative(this.opts.dir,$).split(Q6.sep).includes(".."))throw Error(`Out of bound path "${$}" found while processing file ${X.fileName}`);await this.extractEntry(X),W0("finished processing",X.fileName),this.zipfile.readEntry()}catch($){this.canceled=!0,this.zipfile.close(),J($)}})})}async extractEntry(q){if(this.canceled){W0("skipping entry extraction",q.fileName,{cancelled:this.canceled});return}if(this.opts.onEntry)this.opts.onEntry(q,this.zipfile);let J=Q6.join(this.opts.dir,q.fileName),X=q.externalFileAttributes>>16&65535,Q=61440,$=16384,Z=40960,Y=(X&Q)===Z,H=(X&Q)===$;if(!H&&q.fileName.endsWith("/"))H=!0;let K=q.versionMadeBy>>8;if(!H)H=K===0&&q.externalFileAttributes===16;W0("extracting entry",{filename:q.fileName,isDir:H,isSymlink:Y});let V=this.getExtractedMode(X,H)&511,G=H?J:Q6.dirname(J),W={recursive:!0};if(H)W.mode=V;if(W0("mkdir",{dir:G,...W}),await A6.mkdir(G,W),H)return;W0("opening read stream",J);let U=await x4(this.zipfile.openReadStream.bind(this.zipfile))(q);if(Y){let z=await z_(U);W0("creating symlink",z,J),await A6.symlink(z,J)}else await x_(U,U_(J,{mode:V}))}getExtractedMode(q,J){let X=q;if(X===0)if(J){if(this.opts.defaultDirMode)X=parseInt(this.opts.defaultDirMode,10);if(!X)X=493}else{if(this.opts.defaultFileMode)X=parseInt(this.opts.defaultFileMode,10);if(!X)X=420}return X}}DX.exports=async function(q,J){if(W0("creating target directory",J.dir),!Q6.isAbsolute(J.dir))throw Error("Target directory is expected to be absolute");return await A6.mkdir(J.dir,{recursive:!0}),J.dir=await A6.realpath(J.dir),new AX(q,J).extract()}});var y=k((j_)=>{j_.fromCallback=function(q){return Object.defineProperty(function(...J){if(typeof J[J.length-1]==="function")q.apply(this,J);else return new Promise((X,Q)=>{J.push(($,Z)=>$!=null?Q($):X(Z)),q.apply(this,J)})},"name",{value:q.name})};j_.fromPromise=function(q){return Object.defineProperty(function(...J){let X=J[J.length-1];if(typeof X!=="function")return q.apply(this,J);else J.pop(),q.apply(this,J).then((Q)=>X(null,Q),X)},"name",{value:q.name})}});var n=k((j4)=>{var OX=y().fromCallback,p=_2(),M_=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter((q)=>{return typeof p[q]==="function"});Object.assign(j4,p);M_.forEach((q)=>{j4[q]=OX(p[q])});j4.exists=function(q,J){if(typeof J==="function")return p.exists(q,J);return new Promise((X)=>{return p.exists(q,X)})};j4.read=function(q,J,X,Q,$,Z){if(typeof Z==="function")return p.read(q,J,X,Q,$,Z);return new Promise((Y,H)=>{p.read(q,J,X,Q,$,(K,V,G)=>{if(K)return H(K);Y({bytesRead:V,buffer:G})})})};j4.write=function(q,J,...X){if(typeof X[X.length-1]==="function")return p.write(q,J,...X);return new Promise((Q,$)=>{p.write(q,J,...X,(Z,Y,H)=>{if(Z)return $(Z);Q({bytesWritten:Y,buffer:H})})})};j4.readv=function(q,J,...X){if(typeof X[X.length-1]==="function")return p.readv(q,J,...X);return new Promise((Q,$)=>{p.readv(q,J,...X,(Z,Y,H)=>{if(Z)return $(Z);Q({bytesRead:Y,buffers:H})})})};j4.writev=function(q,J,...X){if(typeof X[X.length-1]==="function")return p.writev(q,J,...X);return new Promise((Q,$)=>{p.writev(q,J,...X,(Z,Y,H)=>{if(Z)return $(Z);Q({bytesWritten:Y,buffers:H})})})};if(typeof p.realpath.native==="function")j4.realpath.native=OX(p.realpath.native);else process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var NX=k((D_,vX)=>{var A_=w("path");D_.checkPath=function(J){if(process.platform==="win32"){if(/[<>:"|?*]/.test(J.replace(A_.parse(J).root,""))){let Q=Error(`Path contains invalid characters: ${J}`);throw Q.code="EINVAL",Q}}}});var hX=k((O_,R4)=>{var EX=n(),{checkPath:yX}=NX(),SX=(q)=>{let J={mode:511};if(typeof q==="number")return q;return{...J,...q}.mode};O_.makeDir=async(q,J)=>{return yX(q),EX.mkdir(q,{mode:SX(J),recursive:!0})};O_.makeDirSync=(q,J)=>{return yX(q),EX.mkdirSync(q,{mode:SX(J),recursive:!0})}});var U0=k((NI,bX)=>{var E_=y().fromPromise,{makeDir:y_,makeDirSync:F4}=hX(),M4=E_(y_);bX.exports={mkdirs:M4,mkdirsSync:F4,mkdirp:M4,mkdirpSync:F4,ensureDir:M4,ensureDirSync:F4}});var d0=k((EI,fX)=>{var S_=y().fromPromise,gX=n();function h_(q){return gX.access(q).then(()=>!0).catch(()=>!1)}fX.exports={pathExists:S_(h_),pathExistsSync:gX.existsSync}});var C4=k((yI,uX)=>{var D6=n(),b_=y().fromPromise;async function g_(q,J,X){let Q=await D6.open(q,"r+"),$=null;try{await D6.futimes(Q,J,X)}finally{try{await D6.close(Q)}catch(Z){$=Z}}if($)throw $}function f_(q,J,X){let Q=D6.openSync(q,"r+");return D6.futimesSync(Q,J,X),D6.closeSync(Q)}uX.exports={utimesMillis:b_(g_),utimesMillisSync:f_}});var $6=k((SI,lX)=>{var I6=n(),S=w("path"),mX=y().fromPromise;function u_(q,J,X){let Q=X.dereference?($)=>I6.stat($,{bigint:!0}):($)=>I6.lstat($,{bigint:!0});return Promise.all([Q(q),Q(J).catch(($)=>{if($.code==="ENOENT")return null;throw $})]).then(([$,Z])=>({srcStat:$,destStat:Z}))}function m_(q,J,X){let Q,$=X.dereference?(Y)=>I6.statSync(Y,{bigint:!0}):(Y)=>I6.lstatSync(Y,{bigint:!0}),Z=$(q);try{Q=$(J)}catch(Y){if(Y.code==="ENOENT")return{srcStat:Z,destStat:null};throw Y}return{srcStat:Z,destStat:Q}}async function d_(q,J,X,Q){let{srcStat:$,destStat:Z}=await u_(q,J,Q);if(Z){if(L2($,Z)){let Y=S.basename(q),H=S.basename(J);if(X==="move"&&Y!==H&&Y.toLowerCase()===H.toLowerCase())return{srcStat:$,destStat:Z,isChangingCase:!0};throw Error("Source and destination must not be the same.")}if($.isDirectory()&&!Z.isDirectory())throw Error(`Cannot overwrite non-directory '${J}' with directory '${q}'.`);if(!$.isDirectory()&&Z.isDirectory())throw Error(`Cannot overwrite directory '${J}' with non-directory '${q}'.`)}if($.isDirectory()&&k4(q,J))throw Error(G8(q,J,X));return{srcStat:$,destStat:Z}}function c_(q,J,X,Q){let{srcStat:$,destStat:Z}=m_(q,J,Q);if(Z){if(L2($,Z)){let Y=S.basename(q),H=S.basename(J);if(X==="move"&&Y!==H&&Y.toLowerCase()===H.toLowerCase())return{srcStat:$,destStat:Z,isChangingCase:!0};throw Error("Source and destination must not be the same.")}if($.isDirectory()&&!Z.isDirectory())throw Error(`Cannot overwrite non-directory '${J}' with directory '${q}'.`);if(!$.isDirectory()&&Z.isDirectory())throw Error(`Cannot overwrite directory '${J}' with non-directory '${q}'.`)}if($.isDirectory()&&k4(q,J))throw Error(G8(q,J,X));return{srcStat:$,destStat:Z}}async function dX(q,J,X,Q){let $=S.resolve(S.dirname(q)),Z=S.resolve(S.dirname(X));if(Z===$||Z===S.parse(Z).root)return;let Y;try{Y=await I6.stat(Z,{bigint:!0})}catch(H){if(H.code==="ENOENT")return;throw H}if(L2(J,Y))throw Error(G8(q,X,Q));return dX(q,J,Z,Q)}function cX(q,J,X,Q){let $=S.resolve(S.dirname(q)),Z=S.resolve(S.dirname(X));if(Z===$||Z===S.parse(Z).root)return;let Y;try{Y=I6.statSync(Z,{bigint:!0})}catch(H){if(H.code==="ENOENT")return;throw H}if(L2(J,Y))throw Error(G8(q,X,Q));return cX(q,J,Z,Q)}function L2(q,J){return J.ino!==void 0&&J.dev!==void 0&&J.ino===q.ino&&J.dev===q.dev}function k4(q,J){let X=S.resolve(q).split(S.sep).filter(($)=>$),Q=S.resolve(J).split(S.sep).filter(($)=>$);return X.every(($,Z)=>Q[Z]===$)}function G8(q,J,X){return`Cannot ${X} '${q}' to a subdirectory of itself, '${J}'.`}lX.exports={checkPaths:mX(d_),checkPathsSync:c_,checkParentPaths:mX(dX),checkParentPathsSync:cX,isSrcSubdir:k4,areIdentical:L2}});var nX=k((hI,pX)=>{async function l_(q,J){let X=[];for await(let Q of q)X.push(J(Q).then(()=>null,($)=>$??Error("unknown error")));await Promise.all(X.map((Q)=>Q.then(($)=>{if($!==null)throw $})))}pX.exports={asyncIteratorConcurrentProcess:l_}});var sX=k((bI,rX)=>{var u=n(),B2=w("path"),{mkdirs:p_}=U0(),{pathExists:n_}=d0(),{utimesMillis:i_}=C4(),x2=$6(),{asyncIteratorConcurrentProcess:a_}=nX();async function o_(q,J,X={}){if(typeof X==="function")X={filter:X};if(X.clobber="clobber"in X?!!X.clobber:!0,X.overwrite="overwrite"in X?!!X.overwrite:X.clobber,X.preserveTimestamps&&process.arch==="ia32")process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
2
|
-
|
|
3
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:Q,destStat:$}=await x2.checkPaths(q,J,"copy",X);if(await x2.checkParentPaths(q,Q,J,"copy"),!await aX(q,J,X))return;let Y=B2.dirname(J);if(!await n_(Y))await p_(Y);await oX($,q,J,X)}async function aX(q,J,X){if(!X.filter)return!0;return X.filter(q,J)}async function oX(q,J,X,Q){let Z=await(Q.dereference?u.stat:u.lstat)(J);if(Z.isDirectory())return e_(Z,q,J,X,Q);if(Z.isFile()||Z.isCharacterDevice()||Z.isBlockDevice())return r_(Z,q,J,X,Q);if(Z.isSymbolicLink())return qL(q,J,X,Q);if(Z.isSocket())throw Error(`Cannot copy a socket file: ${J}`);if(Z.isFIFO())throw Error(`Cannot copy a FIFO pipe: ${J}`);throw Error(`Unknown file: ${J}`)}async function r_(q,J,X,Q,$){if(!J)return iX(q,X,Q,$);if($.overwrite)return await u.unlink(Q),iX(q,X,Q,$);if($.errorOnExist)throw Error(`'${Q}' already exists`)}async function iX(q,J,X,Q){if(await u.copyFile(J,X),Q.preserveTimestamps){if(s_(q.mode))await t_(X,q.mode);let $=await u.stat(J);await i_(X,$.atime,$.mtime)}return u.chmod(X,q.mode)}function s_(q){return(q&128)===0}function t_(q,J){return u.chmod(q,J|128)}async function e_(q,J,X,Q,$){if(!J)await u.mkdir(Q);if(await a_(await u.opendir(X),async(Z)=>{let Y=B2.join(X,Z.name),H=B2.join(Q,Z.name);if(await aX(Y,H,$)){let{destStat:V}=await x2.checkPaths(Y,H,"copy",$);await oX(V,Y,H,$)}}),!J)await u.chmod(Q,q.mode)}async function qL(q,J,X,Q){let $=await u.readlink(J);if(Q.dereference)$=B2.resolve(process.cwd(),$);if(!q)return u.symlink($,X);let Z=null;try{Z=await u.readlink(X)}catch(Y){if(Y.code==="EINVAL"||Y.code==="UNKNOWN")return u.symlink($,X);throw Y}if(Q.dereference)Z=B2.resolve(process.cwd(),Z);if($!==Z){if(x2.isSrcSubdir($,Z))throw Error(`Cannot copy '${$}' to a subdirectory of itself, '${Z}'.`);if(x2.isSrcSubdir(Z,$))throw Error(`Cannot overwrite '${Z}' with '${$}'.`)}return await u.unlink(X),u.symlink($,X)}rX.exports=o_});var XQ=k((gI,JQ)=>{var i=_2(),j2=w("path"),JL=U0().mkdirsSync,XL=C4().utimesMillisSync,R2=$6();function QL(q,J,X){if(typeof X==="function")X={filter:X};if(X=X||{},X.clobber="clobber"in X?!!X.clobber:!0,X.overwrite="overwrite"in X?!!X.overwrite:X.clobber,X.preserveTimestamps&&process.arch==="ia32")process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
4
|
-
|
|
5
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:Q,destStat:$}=R2.checkPathsSync(q,J,"copy",X);if(R2.checkParentPathsSync(q,Q,J,"copy"),X.filter&&!X.filter(q,J))return;let Z=j2.dirname(J);if(!i.existsSync(Z))JL(Z);return tX($,q,J,X)}function tX(q,J,X,Q){let Z=(Q.dereference?i.statSync:i.lstatSync)(J);if(Z.isDirectory())return GL(Z,q,J,X,Q);else if(Z.isFile()||Z.isCharacterDevice()||Z.isBlockDevice())return $L(Z,q,J,X,Q);else if(Z.isSymbolicLink())return zL(q,J,X,Q);else if(Z.isSocket())throw Error(`Cannot copy a socket file: ${J}`);else if(Z.isFIFO())throw Error(`Cannot copy a FIFO pipe: ${J}`);throw Error(`Unknown file: ${J}`)}function $L(q,J,X,Q,$){if(!J)return eX(q,X,Q,$);return ZL(q,X,Q,$)}function ZL(q,J,X,Q){if(Q.overwrite)return i.unlinkSync(X),eX(q,J,X,Q);else if(Q.errorOnExist)throw Error(`'${X}' already exists`)}function eX(q,J,X,Q){if(i.copyFileSync(J,X),Q.preserveTimestamps)YL(q.mode,J,X);return T4(X,q.mode)}function YL(q,J,X){if(HL(q))KL(X,q);return VL(J,X)}function HL(q){return(q&128)===0}function KL(q,J){return T4(q,J|128)}function T4(q,J){return i.chmodSync(q,J)}function VL(q,J){let X=i.statSync(q);return XL(J,X.atime,X.mtime)}function GL(q,J,X,Q,$){if(!J)return WL(q.mode,X,Q,$);return qQ(X,Q,$)}function WL(q,J,X,Q){return i.mkdirSync(X),qQ(J,X,Q),T4(X,q)}function qQ(q,J,X){let Q=i.opendirSync(q);try{let $;while(($=Q.readSync())!==null)UL($.name,q,J,X)}finally{Q.closeSync()}}function UL(q,J,X,Q){let $=j2.join(J,q),Z=j2.join(X,q);if(Q.filter&&!Q.filter($,Z))return;let{destStat:Y}=R2.checkPathsSync($,Z,"copy",Q);return tX(Y,$,Z,Q)}function zL(q,J,X,Q){let $=i.readlinkSync(J);if(Q.dereference)$=j2.resolve(process.cwd(),$);if(!q)return i.symlinkSync($,X);else{let Z;try{Z=i.readlinkSync(X)}catch(Y){if(Y.code==="EINVAL"||Y.code==="UNKNOWN")return i.symlinkSync($,X);throw Y}if(Q.dereference)Z=j2.resolve(process.cwd(),Z);if($!==Z){if(R2.isSrcSubdir($,Z))throw Error(`Cannot copy '${$}' to a subdirectory of itself, '${Z}'.`);if(R2.isSrcSubdir(Z,$))throw Error(`Cannot overwrite '${Z}' with '${$}'.`)}return _L($,X)}}function _L(q,J){return i.unlinkSync(J),i.symlinkSync(q,J)}JQ.exports=QL});var W8=k((fI,QQ)=>{var LL=y().fromPromise;QQ.exports={copy:LL(sX()),copySync:XQ()}});var F2=k((uI,ZQ)=>{var $Q=_2(),BL=y().fromCallback;function xL(q,J){$Q.rm(q,{recursive:!0,force:!0},J)}function jL(q){$Q.rmSync(q,{recursive:!0,force:!0})}ZQ.exports={remove:BL(xL),removeSync:jL}});var zQ=k((mI,UQ)=>{var RL=y().fromPromise,KQ=n(),VQ=w("path"),GQ=U0(),WQ=F2(),YQ=RL(async function(J){let X;try{X=await KQ.readdir(J)}catch{return GQ.mkdirs(J)}return Promise.all(X.map((Q)=>WQ.remove(VQ.join(J,Q))))});function HQ(q){let J;try{J=KQ.readdirSync(q)}catch{return GQ.mkdirsSync(q)}J.forEach((X)=>{X=VQ.join(q,X),WQ.removeSync(X)})}UQ.exports={emptyDirSync:HQ,emptydirSync:HQ,emptyDir:YQ,emptydir:YQ}});var xQ=k((dI,BQ)=>{var FL=y().fromPromise,_Q=w("path"),N0=n(),LQ=U0();async function ML(q){let J;try{J=await N0.stat(q)}catch{}if(J&&J.isFile())return;let X=_Q.dirname(q),Q=null;try{Q=await N0.stat(X)}catch($){if($.code==="ENOENT"){await LQ.mkdirs(X),await N0.writeFile(q,"");return}else throw $}if(Q.isDirectory())await N0.writeFile(q,"");else await N0.readdir(X)}function CL(q){let J;try{J=N0.statSync(q)}catch{}if(J&&J.isFile())return;let X=_Q.dirname(q);try{if(!N0.statSync(X).isDirectory())N0.readdirSync(X)}catch(Q){if(Q&&Q.code==="ENOENT")LQ.mkdirsSync(X);else throw Q}N0.writeFileSync(q,"")}BQ.exports={createFile:FL(ML),createFileSync:CL}});var CQ=k((cI,MQ)=>{var kL=y().fromPromise,jQ=w("path"),c0=n(),RQ=U0(),{pathExists:TL}=d0(),{areIdentical:FQ}=$6();async function wL(q,J){let X;try{X=await c0.lstat(J)}catch{}let Q;try{Q=await c0.lstat(q)}catch(Y){throw Y.message=Y.message.replace("lstat","ensureLink"),Y}if(X&&FQ(Q,X))return;let $=jQ.dirname(J);if(!await TL($))await RQ.mkdirs($);await c0.link(q,J)}function PL(q,J){let X;try{X=c0.lstatSync(J)}catch{}try{let Z=c0.lstatSync(q);if(X&&FQ(Z,X))return}catch(Z){throw Z.message=Z.message.replace("lstat","ensureLink"),Z}let Q=jQ.dirname(J);if(c0.existsSync(Q))return c0.linkSync(q,J);return RQ.mkdirsSync(Q),c0.linkSync(q,J)}MQ.exports={createLink:kL(wL),createLinkSync:PL}});var TQ=k((lI,kQ)=>{var l0=w("path"),M2=n(),{pathExists:AL}=d0(),DL=y().fromPromise;async function IL(q,J){if(l0.isAbsolute(q)){try{await M2.lstat(q)}catch(Z){throw Z.message=Z.message.replace("lstat","ensureSymlink"),Z}return{toCwd:q,toDst:q}}let X=l0.dirname(J),Q=l0.join(X,q);if(await AL(Q))return{toCwd:Q,toDst:q};try{await M2.lstat(q)}catch(Z){throw Z.message=Z.message.replace("lstat","ensureSymlink"),Z}return{toCwd:q,toDst:l0.relative(X,q)}}function OL(q,J){if(l0.isAbsolute(q)){if(!M2.existsSync(q))throw Error("absolute srcpath does not exist");return{toCwd:q,toDst:q}}let X=l0.dirname(J),Q=l0.join(X,q);if(M2.existsSync(Q))return{toCwd:Q,toDst:q};if(!M2.existsSync(q))throw Error("relative srcpath does not exist");return{toCwd:q,toDst:l0.relative(X,q)}}kQ.exports={symlinkPaths:DL(IL),symlinkPathsSync:OL}});var AQ=k((pI,PQ)=>{var wQ=n(),vL=y().fromPromise;async function NL(q,J){if(J)return J;let X;try{X=await wQ.lstat(q)}catch{return"file"}return X&&X.isDirectory()?"dir":"file"}function EL(q,J){if(J)return J;let X;try{X=wQ.lstatSync(q)}catch{return"file"}return X&&X.isDirectory()?"dir":"file"}PQ.exports={symlinkType:vL(NL),symlinkTypeSync:EL}});var vQ=k((nI,OQ)=>{var yL=y().fromPromise,DQ=w("path"),C0=n(),{mkdirs:SL,mkdirsSync:hL}=U0(),{symlinkPaths:bL,symlinkPathsSync:gL}=TQ(),{symlinkType:fL,symlinkTypeSync:uL}=AQ(),{pathExists:mL}=d0(),{areIdentical:IQ}=$6();async function dL(q,J,X){let Q;try{Q=await C0.lstat(J)}catch{}if(Q&&Q.isSymbolicLink()){let[H,K]=await Promise.all([C0.stat(q),C0.stat(J)]);if(IQ(H,K))return}let $=await bL(q,J);q=$.toDst;let Z=await fL($.toCwd,X),Y=DQ.dirname(J);if(!await mL(Y))await SL(Y);return C0.symlink(q,J,Z)}function cL(q,J,X){let Q;try{Q=C0.lstatSync(J)}catch{}if(Q&&Q.isSymbolicLink()){let H=C0.statSync(q),K=C0.statSync(J);if(IQ(H,K))return}let $=gL(q,J);q=$.toDst,X=uL($.toCwd,X);let Z=DQ.dirname(J);if(C0.existsSync(Z))return C0.symlinkSync(q,J,X);return hL(Z),C0.symlinkSync(q,J,X)}OQ.exports={createSymlink:yL(dL),createSymlinkSync:cL}});var fQ=k((iI,gQ)=>{var{createFile:NQ,createFileSync:EQ}=xQ(),{createLink:yQ,createLinkSync:SQ}=CQ(),{createSymlink:hQ,createSymlinkSync:bQ}=vQ();gQ.exports={createFile:NQ,createFileSync:EQ,ensureFile:NQ,ensureFileSync:EQ,createLink:yQ,createLinkSync:SQ,ensureLink:yQ,ensureLinkSync:SQ,createSymlink:hQ,createSymlinkSync:bQ,ensureSymlink:hQ,ensureSymlinkSync:bQ}});var U8=k((aI,uQ)=>{function lL(q,{EOL:J=`
|
|
6
|
-
`,finalEOL:X=!0,replacer:Q=null,spaces:$}={}){let Z=X?J:"";return JSON.stringify(q,Q,$).replace(/\n/g,J)+Z}function pL(q){if(Buffer.isBuffer(q))q=q.toString("utf8");return q.replace(/^\uFEFF/,"")}uQ.exports={stringify:lL,stripBom:pL}});var lQ=k((oI,cQ)=>{var O6;try{O6=_2()}catch(q){O6=w("fs")}var z8=y(),{stringify:mQ,stripBom:dQ}=U8();async function nL(q,J={}){if(typeof J==="string")J={encoding:J};let X=J.fs||O6,Q="throws"in J?J.throws:!0,$=await z8.fromCallback(X.readFile)(q,J);$=dQ($);let Z;try{Z=JSON.parse($,J?J.reviver:null)}catch(Y){if(Q)throw Y.message=`${q}: ${Y.message}`,Y;else return null}return Z}var iL=z8.fromPromise(nL);function aL(q,J={}){if(typeof J==="string")J={encoding:J};let X=J.fs||O6,Q="throws"in J?J.throws:!0;try{let $=X.readFileSync(q,J);return $=dQ($),JSON.parse($,J.reviver)}catch($){if(Q)throw $.message=`${q}: ${$.message}`,$;else return null}}async function oL(q,J,X={}){let Q=X.fs||O6,$=mQ(J,X);await z8.fromCallback(Q.writeFile)(q,$,X)}var rL=z8.fromPromise(oL);function sL(q,J,X={}){let Q=X.fs||O6,$=mQ(J,X);return Q.writeFileSync(q,$,X)}cQ.exports={readFile:iL,readFileSync:aL,writeFile:rL,writeFileSync:sL}});var nQ=k((rI,pQ)=>{var _8=lQ();pQ.exports={readJson:_8.readFile,readJsonSync:_8.readFileSync,writeJson:_8.writeFile,writeJsonSync:_8.writeFileSync}});var L8=k((sI,oQ)=>{var tL=y().fromPromise,w4=n(),iQ=w("path"),aQ=U0(),eL=d0().pathExists;async function qB(q,J,X="utf-8"){let Q=iQ.dirname(q);if(!await eL(Q))await aQ.mkdirs(Q);return w4.writeFile(q,J,X)}function JB(q,...J){let X=iQ.dirname(q);if(!w4.existsSync(X))aQ.mkdirsSync(X);w4.writeFileSync(q,...J)}oQ.exports={outputFile:tL(qB),outputFileSync:JB}});var sQ=k((tI,rQ)=>{var{stringify:XB}=U8(),{outputFile:QB}=L8();async function $B(q,J,X={}){let Q=XB(J,X);await QB(q,Q,X)}rQ.exports=$B});var eQ=k((eI,tQ)=>{var{stringify:ZB}=U8(),{outputFileSync:YB}=L8();function HB(q,J,X){let Q=ZB(J,X);YB(q,Q,X)}tQ.exports=HB});var J$=k((qO,q$)=>{var KB=y().fromPromise,a=nQ();a.outputJson=KB(sQ());a.outputJsonSync=eQ();a.outputJSON=a.outputJson;a.outputJSONSync=a.outputJsonSync;a.writeJSON=a.writeJson;a.writeJSONSync=a.writeJsonSync;a.readJSON=a.readJson;a.readJSONSync=a.readJsonSync;q$.exports=a});var Y$=k((JO,Z$)=>{var VB=n(),X$=w("path"),{copy:GB}=W8(),{remove:$$}=F2(),{mkdirp:WB}=U0(),{pathExists:UB}=d0(),Q$=$6();async function zB(q,J,X={}){let Q=X.overwrite||X.clobber||!1,{srcStat:$,isChangingCase:Z=!1}=await Q$.checkPaths(q,J,"move",X);await Q$.checkParentPaths(q,$,J,"move");let Y=X$.dirname(J);if(X$.parse(Y).root!==Y)await WB(Y);return _B(q,J,Q,Z)}async function _B(q,J,X,Q){if(!Q){if(X)await $$(J);else if(await UB(J))throw Error("dest already exists.")}try{await VB.rename(q,J)}catch($){if($.code!=="EXDEV")throw $;await LB(q,J,X)}}async function LB(q,J,X){return await GB(q,J,{overwrite:X,errorOnExist:!0,preserveTimestamps:!0}),$$(q)}Z$.exports=zB});var W$=k((XO,G$)=>{var K$=_2(),A4=w("path"),BB=W8().copySync,V$=F2().removeSync,xB=U0().mkdirpSync,H$=$6();function jB(q,J,X){X=X||{};let Q=X.overwrite||X.clobber||!1,{srcStat:$,isChangingCase:Z=!1}=H$.checkPathsSync(q,J,"move",X);if(H$.checkParentPathsSync(q,$,J,"move"),!RB(J))xB(A4.dirname(J));return FB(q,J,Q,Z)}function RB(q){let J=A4.dirname(q);return A4.parse(J).root===J}function FB(q,J,X,Q){if(Q)return P4(q,J,X);if(X)return V$(J),P4(q,J,X);if(K$.existsSync(J))throw Error("dest already exists.");return P4(q,J,X)}function P4(q,J,X){try{K$.renameSync(q,J)}catch(Q){if(Q.code!=="EXDEV")throw Q;return MB(q,J,X)}}function MB(q,J,X){return BB(q,J,{overwrite:X,errorOnExist:!0,preserveTimestamps:!0}),V$(q)}G$.exports=jB});var z$=k((QO,U$)=>{var CB=y().fromPromise;U$.exports={move:CB(Y$()),moveSync:W$()}});var kB=k(($O,_$)=>{_$.exports={...n(),...W8(),...zQ(),...fQ(),...J$(),...U0(),...z$(),...L8(),...d0(),...F2()}});import{promises as N6}from"fs";import{resolve as v$,join as N$}from"path";var E$=C.object({operation:C.enum(["create","list","exists"]).describe("The folder operation to perform"),folder_path:C.string().describe("The path to the folder (absolute or relative to cwd)"),description:C.string().optional().describe("What you want to do"),recursive:C.boolean().default(!0).optional().describe("For create: create parent directories if they do not exist")}).strict(),y4=o(async({operation:q,folder_path:J,recursive:X=!0},Q)=>{if(!Q.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");try{let $=v$(Q.state.cwd,J);switch(q){case"create":return await N6.mkdir($,{recursive:X}),`✓ Folder created successfully at: ${$}`;case"exists":try{await N6.access($);let Z=await N6.stat($);return`✓ Folder exists at: ${$}
|
|
7
|
-
Type: ${Z.isDirectory()?"Directory":"File"}`}catch{return`✗ Folder does not exist at: ${$}`}case"list":try{let Z=await N6.readdir($,{withFileTypes:!0});if(Z.length===0)return`Folder is empty: ${$}`;let Y=[];Y.push(`\uD83D\uDCC1 ${$}
|
|
8
|
-
`);let H=[],K=[];for(let V of Z){let G=N$($,V.name);try{let W=await N6.stat(G),U=W.size,z=W.mtime.toLocaleDateString(),_=`${V.isDirectory()?"\uD83D\uDCC1":"\uD83D\uDCC4"} ${V.name}${V.isDirectory()?"/":""} (${U} bytes, ${z})`;if(V.isDirectory())H.push(_);else K.push(_)}catch(W){K.push(`⚠️ ${V.name} (unreadable)`)}}if(H.length>0)Y.push("Directories:"),H.forEach((V)=>Y.push(` ${V}`)),Y.push("");if(K.length>0)Y.push("Files:"),K.forEach((V)=>Y.push(` ${V}`));return Y.push(`
|
|
9
|
-
Total: ${H.length} directories, ${K.length} files`),Y.join(`
|
|
10
|
-
`)}catch(Z){if(Z.code==="ENOENT")return`✗ Folder not found: ${$}`;if(Z.code==="ENOTDIR")return`✗ Path exists but is not a folder: ${$}`;throw Z}default:return`✗ Unknown operation: ${q}`}}catch($){if($.code==="ENOENT")return`✗ Folder not found: ${J}`;if($.code==="EACCES")return`✗ Permission denied: ${J}`;return`✗ Error: ${$.message}`}},{name:"folder_operations",description:`Unified folder operations tool supporting create, list, and existence check. Relative paths are resolved based on the current working directory (cwd).
|
|
11
|
-
|
|
12
|
-
**Operations:**
|
|
13
|
-
- create: Create a folder (supports nested directory creation)
|
|
14
|
-
- list: List all files and subdirectories with metadata
|
|
15
|
-
- exists: Check if a folder exists
|
|
16
|
-
|
|
17
|
-
**Usage Examples:**
|
|
18
|
-
- Create nested folders: {operation: "create", folder_path: "/path/to/nested/folder"}
|
|
19
|
-
- Create with relative path: {operation: "create", folder_path: "data/output"}
|
|
20
|
-
- List contents: {operation: "list", folder_path: "/path/to/folder"}
|
|
21
|
-
- List with relative path: {operation: "list", folder_path: "src"}
|
|
22
|
-
- Check existence: {operation: "exists", folder_path: "path/to/folder"}
|
|
23
|
-
|
|
24
|
-
**Important:**
|
|
25
|
-
- All folder paths can be absolute or relative to cwd
|
|
26
|
-
- Create operation is recursive (creates parent directories if needed)
|
|
27
|
-
- List operation shows file sizes and modification dates
|
|
28
|
-
- Delete operations are not supported for safety reasons. Use terminal commands with user approval if needed.`,schema:E$});var M8=(q,J,X)=>{let Q=q instanceof RegExp?S4(q,X):q,$=J instanceof RegExp?S4(J,X):J,Z=Q!==null&&$!=null&&y$(Q,$,X);return Z&&{start:Z[0],end:Z[1],pre:X.slice(0,Z[0]),body:X.slice(Z[0]+Q.length,Z[1]),post:X.slice(Z[1]+$.length)}},S4=(q,J)=>{let X=J.match(q);return X?X[0]:null},y$=(q,J,X)=>{let Q,$,Z,Y=void 0,H,K=X.indexOf(q),V=X.indexOf(J,K+1),G=K;if(K>=0&&V>0){if(q===J)return[K,V];Q=[],Z=X.length;while(G>=0&&!H){if(G===K)Q.push(G),K=X.indexOf(q,G+1);else if(Q.length===1){let W=Q.pop();if(W!==void 0)H=[W,V]}else{if($=Q.pop(),$!==void 0&&$<Z)Z=$,Y=V;V=X.indexOf(J,G+1)}G=K<V&&K>=0?K:V}if(Q.length&&Y!==void 0)H=[Z,Y]}return H};var h4="\x00SLASH"+Math.random()+"\x00",b4="\x00OPEN"+Math.random()+"\x00",k8="\x00CLOSE"+Math.random()+"\x00",g4="\x00COMMA"+Math.random()+"\x00",f4="\x00PERIOD"+Math.random()+"\x00",S$=new RegExp(h4,"g"),h$=new RegExp(b4,"g"),b$=new RegExp(k8,"g"),g$=new RegExp(g4,"g"),f$=new RegExp(f4,"g"),u$=/\\\\/g,m$=/\\{/g,d$=/\\}/g,c$=/\\,/g,l$=/\\./g,p$=1e5;function C8(q){return!isNaN(q)?parseInt(q,10):q.charCodeAt(0)}function n$(q){return q.replace(u$,h4).replace(m$,b4).replace(d$,k8).replace(c$,g4).replace(l$,f4)}function i$(q){return q.replace(S$,"\\").replace(h$,"{").replace(b$,"}").replace(g$,",").replace(f$,".")}function u4(q){if(!q)return[""];let J=[],X=M8("{","}",q);if(!X)return q.split(",");let{pre:Q,body:$,post:Z}=X,Y=Q.split(",");Y[Y.length-1]+="{"+$+"}";let H=u4(Z);if(Z.length)Y[Y.length-1]+=H.shift(),Y.push.apply(Y,H);return J.push.apply(J,Y),J}function m4(q,J={}){if(!q)return[];let{max:X=p$}=J;if(q.slice(0,2)==="{}")q="\\{\\}"+q.slice(2);return E6(n$(q),X,!0).map(i$)}function a$(q){return"{"+q+"}"}function o$(q){return/^-?0\d/.test(q)}function r$(q,J){return q<=J}function s$(q,J){return q>=J}function E6(q,J,X){let Q=[],$=M8("{","}",q);if(!$)return[q];let Z=$.pre,Y=$.post.length?E6($.post,J,!1):[""];if(/\$$/.test($.pre))for(let H=0;H<Y.length&&H<J;H++){let K=Z+"{"+$.body+"}"+Y[H];Q.push(K)}else{let H=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test($.body),K=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test($.body),V=H||K,G=$.body.indexOf(",")>=0;if(!V&&!G){if($.post.match(/,(?!,).*\}/))return q=$.pre+"{"+$.body+k8+$.post,E6(q,J,!0);return[q]}let W;if(V)W=$.body.split(/\.\./);else if(W=u4($.body),W.length===1&&W[0]!==void 0){if(W=E6(W[0],J,!1).map(a$),W.length===1)return Y.map((z)=>$.pre+W[0]+z)}let U;if(V&&W[0]!==void 0&&W[1]!==void 0){let z=C8(W[0]),L=C8(W[1]),_=Math.max(W[0].length,W[1].length),x=W.length===3&&W[2]!==void 0?Math.abs(C8(W[2])):1,B=r$;if(L<z)x*=-1,B=s$;let R=W.some(o$);U=[];for(let M=z;B(M,L);M+=x){let F;if(K){if(F=String.fromCharCode(M),F==="\\")F=""}else if(F=String(M),R){let I=_-F.length;if(I>0){let P=Array(I+1).join("0");if(M<0)F="-"+P+F.slice(1);else F=P+F}}U.push(F)}}else{U=[];for(let z=0;z<W.length;z++)U.push.apply(U,E6(W[z],J,!1))}for(let z=0;z<U.length;z++)for(let L=0;L<Y.length&&Q.length<J;L++){let _=Z+U[z]+Y[L];if(!X||V||_)Q.push(_)}}return Q}var y6=(q)=>{if(typeof q!=="string")throw TypeError("invalid pattern");if(q.length>65536)throw TypeError("pattern is too long")};var t$={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},S6=(q)=>q.replace(/[[\]\\-]/g,"\\$&"),e$=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),d4=(q)=>q.join(""),c4=(q,J)=>{let X=J;if(q.charAt(X)!=="[")throw Error("not in a brace expression");let Q=[],$=[],Z=X+1,Y=!1,H=!1,K=!1,V=!1,G=X,W="";q:while(Z<q.length){let _=q.charAt(Z);if((_==="!"||_==="^")&&Z===X+1){V=!0,Z++;continue}if(_==="]"&&Y&&!K){G=Z+1;break}if(Y=!0,_==="\\"){if(!K){K=!0,Z++;continue}}if(_==="["&&!K){for(let[x,[B,j,R]]of Object.entries(t$))if(q.startsWith(x,Z)){if(W)return["$.",!1,q.length-X,!0];if(Z+=x.length,R)$.push(B);else Q.push(B);H=H||j;continue q}}if(K=!1,W){if(_>W)Q.push(S6(W)+"-"+S6(_));else if(_===W)Q.push(S6(_));W="",Z++;continue}if(q.startsWith("-]",Z+1)){Q.push(S6(_+"-")),Z+=2;continue}if(q.startsWith("-",Z+1)){W=_,Z+=2;continue}Q.push(S6(_)),Z++}if(G<Z)return["",!1,0,!1];if(!Q.length&&!$.length)return["$.",!1,q.length-X,!0];if($.length===0&&Q.length===1&&/^\\?.$/.test(Q[0])&&!V){let _=Q[0].length===2?Q[0].slice(-1):Q[0];return[e$(_),!1,G-X,!1]}let U="["+(V?"^":"")+d4(Q)+"]",z="["+(V?"":"^")+d4($)+"]";return[Q.length&&$.length?"("+U+"|"+z+")":Q.length?U:z,H,G-X,!0]};var $0=(q,{windowsPathsNoEscape:J=!1,magicalBraces:X=!0}={})=>{if(X)return J?q.replace(/\[([^\/\\])\]/g,"$1"):q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");return J?q.replace(/\[([^\/\\{}])\]/g,"$1"):q.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};var qZ=new Set(["!","?","+","*","@"]),l4=(q)=>qZ.has(q),JZ="(?!(?:^|/)\\.\\.?(?:$|/))",C2="(?!\\.)",XZ=new Set(["[","."]),QZ=new Set(["..","."]),$Z=new Set("().*{}+?[]^$\\!"),ZZ=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),T8="[^/]",p4=T8+"*?",n4=T8+"+?";class h{type;#q;#X;#J=!1;#Q=[];#Z;#V;#U;#W=!1;#H;#_;#z=!1;constructor(q,J,X={}){if(this.type=q,q)this.#X=!0;if(this.#Z=J,this.#q=this.#Z?this.#Z.#q:this,this.#H=this.#q===this?X:this.#q.#H,this.#U=this.#q===this?[]:this.#q.#U,q==="!"&&!this.#q.#W)this.#U.push(this);this.#V=this.#Z?this.#Z.#Q.length:0}get hasMagic(){if(this.#X!==void 0)return this.#X;for(let q of this.#Q){if(typeof q==="string")continue;if(q.type||q.hasMagic)return this.#X=!0}return this.#X}toString(){if(this.#_!==void 0)return this.#_;if(!this.type)return this.#_=this.#Q.map((q)=>String(q)).join("");else return this.#_=this.type+"("+this.#Q.map((q)=>String(q)).join("|")+")"}#K(){if(this!==this.#q)throw Error("should only call on root");if(this.#W)return this;this.toString(),this.#W=!0;let q;while(q=this.#U.pop()){if(q.type!=="!")continue;let J=q,X=J.#Z;while(X){for(let Q=J.#V+1;!X.type&&Q<X.#Q.length;Q++)for(let $ of q.#Q){if(typeof $==="string")throw Error("string part in extglob AST??");$.copyIn(X.#Q[Q])}J=X,X=J.#Z}}return this}push(...q){for(let J of q){if(J==="")continue;if(typeof J!=="string"&&!(J instanceof h&&J.#Z===this))throw Error("invalid part: "+J);this.#Q.push(J)}}toJSON(){let q=this.type===null?this.#Q.slice().map((J)=>typeof J==="string"?J:J.toJSON()):[this.type,...this.#Q.map((J)=>J.toJSON())];if(this.isStart()&&!this.type)q.unshift([]);if(this.isEnd()&&(this===this.#q||this.#q.#W&&this.#Z?.type==="!"))q.push({});return q}isStart(){if(this.#q===this)return!0;if(!this.#Z?.isStart())return!1;if(this.#V===0)return!0;let q=this.#Z;for(let J=0;J<this.#V;J++){let X=q.#Q[J];if(!(X instanceof h&&X.type==="!"))return!1}return!0}isEnd(){if(this.#q===this)return!0;if(this.#Z?.type==="!")return!0;if(!this.#Z?.isEnd())return!1;if(!this.type)return this.#Z?.isEnd();let q=this.#Z?this.#Z.#Q.length:0;return this.#V===q-1}copyIn(q){if(typeof q==="string")this.push(q);else this.push(q.clone(this))}clone(q){let J=new h(this.type,q);for(let X of this.#Q)J.copyIn(X);return J}static#Y(q,J,X,Q){let $=!1,Z=!1,Y=-1,H=!1;if(J.type===null){let U=X,z="";while(U<q.length){let L=q.charAt(U++);if($||L==="\\"){$=!$,z+=L;continue}if(Z){if(U===Y+1){if(L==="^"||L==="!")H=!0}else if(L==="]"&&!(U===Y+2&&H))Z=!1;z+=L;continue}else if(L==="["){Z=!0,Y=U,H=!1,z+=L;continue}if(!Q.noext&&l4(L)&&q.charAt(U)==="("){J.push(z),z="";let _=new h(L,J);U=h.#Y(q,_,U,Q),J.push(_);continue}z+=L}return J.push(z),U}let K=X+1,V=new h(null,J),G=[],W="";while(K<q.length){let U=q.charAt(K++);if($||U==="\\"){$=!$,W+=U;continue}if(Z){if(K===Y+1){if(U==="^"||U==="!")H=!0}else if(U==="]"&&!(K===Y+2&&H))Z=!1;W+=U;continue}else if(U==="["){Z=!0,Y=K,H=!1,W+=U;continue}if(l4(U)&&q.charAt(K)==="("){V.push(W),W="";let z=new h(U,V);V.push(z),K=h.#Y(q,z,K,Q);continue}if(U==="|"){V.push(W),W="",G.push(V),V=new h(null,J);continue}if(U===")"){if(W===""&&J.#Q.length===0)J.#z=!0;return V.push(W),W="",J.push(...G,V),K}W+=U}return J.type=null,J.#X=void 0,J.#Q=[q.substring(X-1)],K}static fromGlob(q,J={}){let X=new h(null,void 0,J);return h.#Y(q,X,0,J),X}toMMPattern(){if(this!==this.#q)return this.#q.toMMPattern();let q=this.toString(),[J,X,Q,$]=this.toRegExpSource();if(!(Q||this.#X||this.#H.nocase&&!this.#H.nocaseMagicOnly&&q.toUpperCase()!==q.toLowerCase()))return X;let Y=(this.#H.nocase?"i":"")+($?"u":"");return Object.assign(new RegExp(`^${J}$`,Y),{_src:J,_glob:q})}get options(){return this.#H}toRegExpSource(q){let J=q??!!this.#H.dot;if(this.#q===this)this.#K();if(!this.type){let H=this.isStart()&&this.isEnd()&&!this.#Q.some((U)=>typeof U!=="string"),K=this.#Q.map((U)=>{let[z,L,_,x]=typeof U==="string"?h.#M(U,this.#X,H):U.toRegExpSource(q);return this.#X=this.#X||_,this.#J=this.#J||x,z}).join(""),V="";if(this.isStart()){if(typeof this.#Q[0]==="string"){if(!(this.#Q.length===1&&QZ.has(this.#Q[0]))){let z=XZ,L=J&&z.has(K.charAt(0))||K.startsWith("\\.")&&z.has(K.charAt(2))||K.startsWith("\\.\\.")&&z.has(K.charAt(4)),_=!J&&!q&&z.has(K.charAt(0));V=L?JZ:_?C2:""}}}let G="";if(this.isEnd()&&this.#q.#W&&this.#Z?.type==="!")G="(?:$|\\/)";return[V+K+G,$0(K),this.#X=!!this.#X,this.#J]}let X=this.type==="*"||this.type==="+",Q=this.type==="!"?"(?:(?!(?:":"(?:",$=this.#L(J);if(this.isStart()&&this.isEnd()&&!$&&this.type!=="!"){let H=this.toString();return this.#Q=[H],this.type=null,this.#X=void 0,[H,$0(this.toString()),!1,!1]}let Z=!X||q||J||!C2?"":this.#L(!0);if(Z===$)Z="";if(Z)$=`(?:${$})(?:${Z})*?`;let Y="";if(this.type==="!"&&this.#z)Y=(this.isStart()&&!J?C2:"")+n4;else{let H=this.type==="!"?"))"+(this.isStart()&&!J&&!q?C2:"")+p4+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&Z?")":this.type==="*"&&Z?")?":`)${this.type}`;Y=Q+$+H}return[Y,$0($),this.#X=!!this.#X,this.#J]}#L(q){return this.#Q.map((J)=>{if(typeof J==="string")throw Error("string type in extglob ast??");let[X,Q,$,Z]=J.toRegExpSource(q);return this.#J=this.#J||Z,X}).filter((J)=>!(this.isStart()&&this.isEnd())||!!J).join("|")}static#M(q,J,X=!1){let Q=!1,$="",Z=!1,Y=!1;for(let H=0;H<q.length;H++){let K=q.charAt(H);if(Q){Q=!1,$+=($Z.has(K)?"\\":"")+K;continue}if(K==="*"){if(Y)continue;Y=!0,$+=X&&/^[*]+$/.test(q)?n4:p4,J=!0;continue}else Y=!1;if(K==="\\"){if(H===q.length-1)$+="\\\\";else Q=!0;continue}if(K==="["){let[V,G,W,U]=c4(q,H);if(W){$+=V,Z=Z||G,H+=W-1,J=J||U;continue}}if(K==="?"){$+=T8,J=!0;continue}$+=ZZ(K)}return[$,$0(q),!!J,Z]}}var H6=(q,{windowsPathsNoEscape:J=!1,magicalBraces:X=!1}={})=>{if(X)return J?q.replace(/[?*()[\]{}]/g,"[$&]"):q.replace(/[?*()[\]\\{}]/g,"\\$&");return J?q.replace(/[?*()[\]]/g,"[$&]"):q.replace(/[?*()[\]\\]/g,"\\$&")};var d=(q,J,X={})=>{if(y6(J),!X.nocomment&&J.charAt(0)==="#")return!1;return new e(J,X).match(q)},YZ=/^\*+([^+@!?\*\[\(]*)$/,HZ=(q)=>(J)=>!J.startsWith(".")&&J.endsWith(q),KZ=(q)=>(J)=>J.endsWith(q),VZ=(q)=>{return q=q.toLowerCase(),(J)=>!J.startsWith(".")&&J.toLowerCase().endsWith(q)},GZ=(q)=>{return q=q.toLowerCase(),(J)=>J.toLowerCase().endsWith(q)},WZ=/^\*+\.\*+$/,UZ=(q)=>!q.startsWith(".")&&q.includes("."),zZ=(q)=>q!=="."&&q!==".."&&q.includes("."),_Z=/^\.\*+$/,LZ=(q)=>q!=="."&&q!==".."&&q.startsWith("."),BZ=/^\*+$/,xZ=(q)=>q.length!==0&&!q.startsWith("."),jZ=(q)=>q.length!==0&&q!=="."&&q!=="..",RZ=/^\?+([^+@!?\*\[\(]*)?$/,FZ=([q,J=""])=>{let X=o4([q]);if(!J)return X;return J=J.toLowerCase(),(Q)=>X(Q)&&Q.toLowerCase().endsWith(J)},MZ=([q,J=""])=>{let X=r4([q]);if(!J)return X;return J=J.toLowerCase(),(Q)=>X(Q)&&Q.toLowerCase().endsWith(J)},CZ=([q,J=""])=>{let X=r4([q]);return!J?X:(Q)=>X(Q)&&Q.endsWith(J)},kZ=([q,J=""])=>{let X=o4([q]);return!J?X:(Q)=>X(Q)&&Q.endsWith(J)},o4=([q])=>{let J=q.length;return(X)=>X.length===J&&!X.startsWith(".")},r4=([q])=>{let J=q.length;return(X)=>X.length===J&&X!=="."&&X!==".."},s4=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",i4={win32:{sep:"\\"},posix:{sep:"/"}},TZ=s4==="win32"?i4.win32.sep:i4.posix.sep;d.sep=TZ;var b=Symbol("globstar **");d.GLOBSTAR=b;var wZ="[^/]",PZ=wZ+"*?",AZ="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",DZ="(?:(?!(?:\\/|^)\\.).)*?",IZ=(q,J={})=>(X)=>d(X,q,J);d.filter=IZ;var t=(q,J={})=>Object.assign({},q,J),OZ=(q)=>{if(!q||typeof q!=="object"||!Object.keys(q).length)return d;let J=d;return Object.assign((Q,$,Z={})=>J(Q,$,t(q,Z)),{Minimatch:class extends J.Minimatch{constructor($,Z={}){super($,t(q,Z))}static defaults($){return J.defaults(t(q,$)).Minimatch}},AST:class extends J.AST{constructor($,Z,Y={}){super($,Z,t(q,Y))}static fromGlob($,Z={}){return J.AST.fromGlob($,t(q,Z))}},unescape:(Q,$={})=>J.unescape(Q,t(q,$)),escape:(Q,$={})=>J.escape(Q,t(q,$)),filter:(Q,$={})=>J.filter(Q,t(q,$)),defaults:(Q)=>J.defaults(t(q,Q)),makeRe:(Q,$={})=>J.makeRe(Q,t(q,$)),braceExpand:(Q,$={})=>J.braceExpand(Q,t(q,$)),match:(Q,$,Z={})=>J.match(Q,$,t(q,Z)),sep:J.sep,GLOBSTAR:b})};d.defaults=OZ;var t4=(q,J={})=>{if(y6(q),J.nobrace||!/\{(?:(?!\{).)*\}/.test(q))return[q];return m4(q,{max:J.braceExpandMax})};d.braceExpand=t4;var vZ=(q,J={})=>new e(q,J).makeRe();d.makeRe=vZ;var NZ=(q,J,X={})=>{let Q=new e(J,X);if(q=q.filter(($)=>Q.match($)),Q.options.nonull&&!q.length)q.push(J);return q};d.match=NZ;var a4=/[?*]|[+@!]\(.*?\)|\[|\]/,EZ=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class e{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(q,J={}){y6(q),J=J||{},this.options=J,this.pattern=q,this.platform=J.platform||s4,this.isWindows=this.platform==="win32";let X="allowWindowsEscape";if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J[X]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!J.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!J.nonegate,this.comment=!1,this.empty=!1,this.partial=!!J.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=J.windowsNoMagicRoot!==void 0?J.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let q of this.set)for(let J of q)if(typeof J!=="string")return!0;return!1}debug(...q){}make(){let q=this.pattern,J=this.options;if(!J.nocomment&&q.charAt(0)==="#"){this.comment=!0;return}if(!q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],J.debug)this.debug=(...$)=>console.error(...$);this.debug(this.pattern,this.globSet);let X=this.globSet.map(($)=>this.slashSplit($));this.globParts=this.preprocess(X),this.debug(this.pattern,this.globParts);let Q=this.globParts.map(($,Z,Y)=>{if(this.isWindows&&this.windowsNoMagicRoot){let H=$[0]===""&&$[1]===""&&($[2]==="?"||!a4.test($[2]))&&!a4.test($[3]),K=/^[a-z]:/i.test($[0]);if(H)return[...$.slice(0,4),...$.slice(4).map((V)=>this.parse(V))];else if(K)return[$[0],...$.slice(1).map((V)=>this.parse(V))]}return $.map((H)=>this.parse(H))});if(this.debug(this.pattern,Q),this.set=Q.filter(($)=>$.indexOf(!1)===-1),this.isWindows)for(let $=0;$<this.set.length;$++){let Z=this.set[$];if(Z[0]===""&&Z[1]===""&&this.globParts[$][2]==="?"&&typeof Z[3]==="string"&&/^[a-z]:$/i.test(Z[3]))Z[2]="?"}this.debug(this.pattern,this.set)}preprocess(q){if(this.options.noglobstar){for(let X=0;X<q.length;X++)for(let Q=0;Q<q[X].length;Q++)if(q[X][Q]==="**")q[X][Q]="*"}let{optimizationLevel:J=1}=this.options;if(J>=2)q=this.firstPhasePreProcess(q),q=this.secondPhasePreProcess(q);else if(J>=1)q=this.levelOneOptimize(q);else q=this.adjascentGlobstarOptimize(q);return q}adjascentGlobstarOptimize(q){return q.map((J)=>{let X=-1;while((X=J.indexOf("**",X+1))!==-1){let Q=X;while(J[Q+1]==="**")Q++;if(Q!==X)J.splice(X,Q-X)}return J})}levelOneOptimize(q){return q.map((J)=>{return J=J.reduce((X,Q)=>{let $=X[X.length-1];if(Q==="**"&&$==="**")return X;if(Q===".."){if($&&$!==".."&&$!=="."&&$!=="**")return X.pop(),X}return X.push(Q),X},[]),J.length===0?[""]:J})}levelTwoFileOptimize(q){if(!Array.isArray(q))q=this.slashSplit(q);let J=!1;do{if(J=!1,!this.preserveMultipleSlashes){for(let Q=1;Q<q.length-1;Q++){let $=q[Q];if(Q===1&&$===""&&q[0]==="")continue;if($==="."||$==="")J=!0,q.splice(Q,1),Q--}if(q[0]==="."&&q.length===2&&(q[1]==="."||q[1]===""))J=!0,q.pop()}let X=0;while((X=q.indexOf("..",X+1))!==-1){let Q=q[X-1];if(Q&&Q!=="."&&Q!==".."&&Q!=="**")J=!0,q.splice(X-1,2),X-=2}}while(J);return q.length===0?[""]:q}firstPhasePreProcess(q){let J=!1;do{J=!1;for(let X of q){let Q=-1;while((Q=X.indexOf("**",Q+1))!==-1){let Z=Q;while(X[Z+1]==="**")Z++;if(Z>Q)X.splice(Q+1,Z-Q);let Y=X[Q+1],H=X[Q+2],K=X[Q+3];if(Y!=="..")continue;if(!H||H==="."||H===".."||!K||K==="."||K==="..")continue;J=!0,X.splice(Q,1);let V=X.slice(0);V[Q]="**",q.push(V),Q--}if(!this.preserveMultipleSlashes){for(let Z=1;Z<X.length-1;Z++){let Y=X[Z];if(Z===1&&Y===""&&X[0]==="")continue;if(Y==="."||Y==="")J=!0,X.splice(Z,1),Z--}if(X[0]==="."&&X.length===2&&(X[1]==="."||X[1]===""))J=!0,X.pop()}let $=0;while(($=X.indexOf("..",$+1))!==-1){let Z=X[$-1];if(Z&&Z!=="."&&Z!==".."&&Z!=="**"){J=!0;let H=$===1&&X[$+1]==="**"?["."]:[];if(X.splice($-1,2,...H),X.length===0)X.push("");$-=2}}}}while(J);return q}secondPhasePreProcess(q){for(let J=0;J<q.length-1;J++)for(let X=J+1;X<q.length;X++){let Q=this.partsMatch(q[J],q[X],!this.preserveMultipleSlashes);if(Q){q[J]=[],q[X]=Q;break}}return q.filter((J)=>J.length)}partsMatch(q,J,X=!1){let Q=0,$=0,Z=[],Y="";while(Q<q.length&&$<J.length)if(q[Q]===J[$])Z.push(Y==="b"?J[$]:q[Q]),Q++,$++;else if(X&&q[Q]==="**"&&J[$]===q[Q+1])Z.push(q[Q]),Q++;else if(X&&J[$]==="**"&&q[Q]===J[$+1])Z.push(J[$]),$++;else if(q[Q]==="*"&&J[$]&&(this.options.dot||!J[$].startsWith("."))&&J[$]!=="**"){if(Y==="b")return!1;Y="a",Z.push(q[Q]),Q++,$++}else if(J[$]==="*"&&q[Q]&&(this.options.dot||!q[Q].startsWith("."))&&q[Q]!=="**"){if(Y==="a")return!1;Y="b",Z.push(J[$]),Q++,$++}else return!1;return q.length===J.length&&Z}parseNegate(){if(this.nonegate)return;let q=this.pattern,J=!1,X=0;for(let Q=0;Q<q.length&&q.charAt(Q)==="!";Q++)J=!J,X++;if(X)this.pattern=q.slice(X);this.negate=J}matchOne(q,J,X=!1){let Q=this.options;if(this.isWindows){let L=typeof q[0]==="string"&&/^[a-z]:$/i.test(q[0]),_=!L&&q[0]===""&&q[1]===""&&q[2]==="?"&&/^[a-z]:$/i.test(q[3]),x=typeof J[0]==="string"&&/^[a-z]:$/i.test(J[0]),B=!x&&J[0]===""&&J[1]===""&&J[2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]),j=_?3:L?0:void 0,R=B?3:x?0:void 0;if(typeof j==="number"&&typeof R==="number"){let[M,F]=[q[j],J[R]];if(M.toLowerCase()===F.toLowerCase()){if(J[R]=M,R>j)J=J.slice(R);else if(j>R)q=q.slice(j)}}}let{optimizationLevel:$=1}=this.options;if($>=2)q=this.levelTwoFileOptimize(q);this.debug("matchOne",this,{file:q,pattern:J}),this.debug("matchOne",q.length,J.length);for(var Z=0,Y=0,H=q.length,K=J.length;Z<H&&Y<K;Z++,Y++){this.debug("matchOne loop");var V=J[Y],G=q[Z];if(this.debug(J,V,G),V===!1)return!1;if(V===b){this.debug("GLOBSTAR",[J,V,G]);var W=Z,U=Y+1;if(U===K){this.debug("** at the end");for(;Z<H;Z++)if(q[Z]==="."||q[Z]===".."||!Q.dot&&q[Z].charAt(0)===".")return!1;return!0}while(W<H){var z=q[W];if(this.debug(`
|
|
29
|
-
globstar while`,q,W,J,U,z),this.matchOne(q.slice(W),J.slice(U),X))return this.debug("globstar found match!",W,H,z),!0;else{if(z==="."||z===".."||!Q.dot&&z.charAt(0)==="."){this.debug("dot detected!",q,W,J,U);break}this.debug("globstar swallow a segment, and continue"),W++}}if(X){if(this.debug(`
|
|
30
|
-
>>> no match, partial?`,q,W,J,U),W===H)return!0}return!1}let L;if(typeof V==="string")L=G===V,this.debug("string match",V,G,L);else L=V.test(G),this.debug("pattern match",V,G,L);if(!L)return!1}if(Z===H&&Y===K)return!0;else if(Z===H)return X;else if(Y===K)return Z===H-1&&q[Z]==="";else throw Error("wtf?")}braceExpand(){return t4(this.pattern,this.options)}parse(q){y6(q);let J=this.options;if(q==="**")return b;if(q==="")return"";let X,Q=null;if(X=q.match(BZ))Q=J.dot?jZ:xZ;else if(X=q.match(YZ))Q=(J.nocase?J.dot?GZ:VZ:J.dot?KZ:HZ)(X[1]);else if(X=q.match(RZ))Q=(J.nocase?J.dot?MZ:FZ:J.dot?CZ:kZ)(X);else if(X=q.match(WZ))Q=J.dot?zZ:UZ;else if(X=q.match(_Z))Q=LZ;let $=h.fromGlob(q,this.options).toMMPattern();if(Q&&typeof $==="object")Reflect.defineProperty($,"test",{value:Q});return $}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let q=this.set;if(!q.length)return this.regexp=!1,this.regexp;let J=this.options,X=J.noglobstar?PZ:J.dot?AZ:DZ,Q=new Set(J.nocase?["i"]:[]),$=q.map((H)=>{let K=H.map((G)=>{if(G instanceof RegExp)for(let W of G.flags.split(""))Q.add(W);return typeof G==="string"?EZ(G):G===b?b:G._src});K.forEach((G,W)=>{let U=K[W+1],z=K[W-1];if(G!==b||z===b)return;if(z===void 0)if(U!==void 0&&U!==b)K[W+1]="(?:\\/|"+X+"\\/)?"+U;else K[W]=X;else if(U===void 0)K[W-1]=z+"(?:\\/|\\/"+X+")?";else if(U!==b)K[W-1]=z+"(?:\\/|\\/"+X+"\\/)"+U,K[W+1]=b});let V=K.filter((G)=>G!==b);if(this.partial&&V.length>=1){let G=[];for(let W=1;W<=V.length;W++)G.push(V.slice(0,W).join("/"));return"(?:"+G.join("|")+")"}return V.join("/")}).join("|"),[Z,Y]=q.length>1?["(?:",")"]:["",""];if($="^"+Z+$+Y+"$",this.partial)$="^(?:\\/|"+Z+$.slice(1,-1)+Y+")$";if(this.negate)$="^(?!"+$+").+$";try{this.regexp=new RegExp($,[...Q].join(""))}catch(H){this.regexp=!1}return this.regexp}slashSplit(q){if(this.preserveMultipleSlashes)return q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(q))return["",...q.split(/\/+/)];else return q.split(/\/+/)}match(q,J=this.partial){if(this.debug("match",q,this.pattern),this.comment)return!1;if(this.empty)return q==="";if(q==="/"&&J)return!0;let X=this.options;if(this.isWindows)q=q.split("\\").join("/");let Q=this.slashSplit(q);this.debug(this.pattern,"split",Q);let $=this.set;this.debug(this.pattern,"set",$);let Z=Q[Q.length-1];if(!Z)for(let Y=Q.length-2;!Z&&Y>=0;Y--)Z=Q[Y];for(let Y=0;Y<$.length;Y++){let H=$[Y],K=Q;if(X.matchBase&&H.length===1)K=[Z];if(this.matchOne(K,H,J)){if(X.flipNegate)return!0;return!this.negate}}if(X.flipNegate)return!1;return this.negate}static defaults(q){return d.defaults(q).Minimatch}}d.AST=h;d.Minimatch=e;d.escape=H6;d.unescape=$0;import{fileURLToPath as zY}from"node:url";var yZ=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,q7=new Set,w8=typeof process=="object"&&process?process:{},J7=(q,J,X,Q)=>{typeof w8.emitWarning=="function"?w8.emitWarning(q,J,X,Q):console.error(`[${X}] ${J}: ${q}`)},T2=globalThis.AbortController,e4=globalThis.AbortSignal;if(typeof T2>"u"){e4=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(X,Q){this._onabort.push(Q)}},T2=class{constructor(){J()}signal=new e4;abort(X){if(!this.signal.aborted){this.signal.reason=X,this.signal.aborted=!0;for(let Q of this.signal._onabort)Q(X);this.signal.onabort?.(X)}}};let q=w8.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{q&&(q=!1,J7("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",J))}}var SZ=(q)=>!q7.has(q),Ex=Symbol("type"),E0=(q)=>q&&q===Math.floor(q)&&q>0&&isFinite(q),X7=(q)=>E0(q)?q<=Math.pow(2,8)?Uint8Array:q<=Math.pow(2,16)?Uint16Array:q<=Math.pow(2,32)?Uint32Array:q<=Number.MAX_SAFE_INTEGER?k2:null:null,k2=class extends Array{constructor(q){super(q),this.fill(0)}},hZ=class q{heap;length;static#q=!1;static create(J){let X=X7(J);if(!X)return[];q.#q=!0;let Q=new q(J,X);return q.#q=!1,Q}constructor(J,X){if(!q.#q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new X(J),this.length=0}push(J){this.heap[this.length++]=J}pop(){return this.heap[--this.length]}},h6=class q{#q;#X;#J;#Q;#Z;#V;#U;#W;get perf(){return this.#W}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#H;#_;#z;#K;#Y;#L;#M;#F;#B;#D;#x;#T;#w;#j;#R;#C;#P;#$;#y;static unsafeExposeInternals(J){return{starts:J.#w,ttls:J.#j,autopurgeTimers:J.#R,sizes:J.#T,keyMap:J.#z,keyList:J.#K,valList:J.#Y,next:J.#L,prev:J.#M,get head(){return J.#F},get tail(){return J.#B},free:J.#D,isBackgroundFetch:(X)=>J.#G(X),backgroundFetch:(X,Q,$,Z)=>J.#d(X,Q,$,Z),moveToTail:(X)=>J.#h(X),indexes:(X)=>J.#O(X),rindexes:(X)=>J.#v(X),isStale:(X)=>J.#k(X)}}get max(){return this.#q}get maxSize(){return this.#X}get calculatedSize(){return this.#_}get size(){return this.#H}get fetchMethod(){return this.#V}get memoMethod(){return this.#U}get dispose(){return this.#J}get onInsert(){return this.#Q}get disposeAfter(){return this.#Z}constructor(J){let{max:X=0,ttl:Q,ttlResolution:$=1,ttlAutopurge:Z,updateAgeOnGet:Y,updateAgeOnHas:H,allowStale:K,dispose:V,onInsert:G,disposeAfter:W,noDisposeOnSet:U,noUpdateTTL:z,maxSize:L=0,maxEntrySize:_=0,sizeCalculation:x,fetchMethod:B,memoMethod:j,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:M,allowStaleOnFetchRejection:F,allowStaleOnFetchAbort:I,ignoreFetchAbort:P,perf:g}=J;if(g!==void 0&&typeof g?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#W=g??yZ,X!==0&&!E0(X))throw TypeError("max option must be a nonnegative integer");let m=X?X7(X):Array;if(!m)throw Error("invalid max value: "+X);if(this.#q=X,this.#X=L,this.maxEntrySize=_||this.#X,this.sizeCalculation=x,this.sizeCalculation){if(!this.#X&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(j!==void 0&&typeof j!="function")throw TypeError("memoMethod must be a function if defined");if(this.#U=j,B!==void 0&&typeof B!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#V=B,this.#P=!!B,this.#z=new Map,this.#K=Array(X).fill(void 0),this.#Y=Array(X).fill(void 0),this.#L=new m(X),this.#M=new m(X),this.#F=0,this.#B=0,this.#D=hZ.create(X),this.#H=0,this.#_=0,typeof V=="function"&&(this.#J=V),typeof G=="function"&&(this.#Q=G),typeof W=="function"?(this.#Z=W,this.#x=[]):(this.#Z=void 0,this.#x=void 0),this.#C=!!this.#J,this.#y=!!this.#Q,this.#$=!!this.#Z,this.noDisposeOnSet=!!U,this.noUpdateTTL=!!z,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!F,this.allowStaleOnFetchAbort=!!I,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(this.#X!==0&&!E0(this.#X))throw TypeError("maxSize must be a positive integer if specified");if(!E0(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#l()}if(this.allowStale=!!K,this.noDeleteOnStaleGet=!!M,this.updateAgeOnGet=!!Y,this.updateAgeOnHas=!!H,this.ttlResolution=E0($)||$===0?$:1,this.ttlAutopurge=!!Z,this.ttl=Q||0,this.ttl){if(!E0(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#q===0&&this.ttl===0&&this.#X===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#q&&!this.#X){let n0="LRU_CACHE_UNBOUNDED";SZ(n0)&&(q7.add(n0),J7("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",n0,q))}}getRemainingTTL(J){return this.#z.has(J)?1/0:0}#N(){let J=new k2(this.#q),X=new k2(this.#q);this.#j=J,this.#w=X;let Q=this.ttlAutopurge?Array(this.#q):void 0;this.#R=Q,this.#g=(Y,H,K=this.#W.now())=>{if(X[Y]=H!==0?K:0,J[Y]=H,Q?.[Y]&&(clearTimeout(Q[Y]),Q[Y]=void 0),H!==0&&Q){let V=setTimeout(()=>{this.#k(Y)&&this.#I(this.#K[Y],"expire")},H+1);V.unref&&V.unref(),Q[Y]=V}},this.#A=(Y)=>{X[Y]=J[Y]!==0?this.#W.now():0},this.#E=(Y,H)=>{if(J[H]){let K=J[H],V=X[H];if(!K||!V)return;Y.ttl=K,Y.start=V,Y.now=$||Z();let G=Y.now-V;Y.remainingTTL=K-G}};let $=0,Z=()=>{let Y=this.#W.now();if(this.ttlResolution>0){$=Y;let H=setTimeout(()=>$=0,this.ttlResolution);H.unref&&H.unref()}return Y};this.getRemainingTTL=(Y)=>{let H=this.#z.get(Y);if(H===void 0)return 0;let K=J[H],V=X[H];if(!K||!V)return 1/0;let G=($||Z())-V;return K-G},this.#k=(Y)=>{let H=X[Y],K=J[Y];return!!K&&!!H&&($||Z())-H>K}}#A=()=>{};#E=()=>{};#g=()=>{};#k=()=>!1;#l(){let J=new k2(this.#q);this.#_=0,this.#T=J,this.#b=(X)=>{this.#_-=J[X],J[X]=0},this.#f=(X,Q,$,Z)=>{if(this.#G(Q))return 0;if(!E0($))if(Z){if(typeof Z!="function")throw TypeError("sizeCalculation must be a function");if($=Z(Q,X),!E0($))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return $},this.#S=(X,Q,$)=>{if(J[X]=Q,this.#X){let Z=this.#X-J[X];for(;this.#_>Z;)this.#m(!0)}this.#_+=J[X],$&&($.entrySize=Q,$.totalCalculatedSize=this.#_)}}#b=(J)=>{};#S=(J,X,Q)=>{};#f=(J,X,Q,$)=>{if(Q||$)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#O({allowStale:J=this.allowStale}={}){if(this.#H)for(let X=this.#B;!(!this.#u(X)||((J||!this.#k(X))&&(yield X),X===this.#F));)X=this.#M[X]}*#v({allowStale:J=this.allowStale}={}){if(this.#H)for(let X=this.#F;!(!this.#u(X)||((J||!this.#k(X))&&(yield X),X===this.#B));)X=this.#L[X]}#u(J){return J!==void 0&&this.#z.get(this.#K[J])===J}*entries(){for(let J of this.#O())this.#Y[J]!==void 0&&this.#K[J]!==void 0&&!this.#G(this.#Y[J])&&(yield[this.#K[J],this.#Y[J]])}*rentries(){for(let J of this.#v())this.#Y[J]!==void 0&&this.#K[J]!==void 0&&!this.#G(this.#Y[J])&&(yield[this.#K[J],this.#Y[J]])}*keys(){for(let J of this.#O()){let X=this.#K[J];X!==void 0&&!this.#G(this.#Y[J])&&(yield X)}}*rkeys(){for(let J of this.#v()){let X=this.#K[J];X!==void 0&&!this.#G(this.#Y[J])&&(yield X)}}*values(){for(let J of this.#O())this.#Y[J]!==void 0&&!this.#G(this.#Y[J])&&(yield this.#Y[J])}*rvalues(){for(let J of this.#v())this.#Y[J]!==void 0&&!this.#G(this.#Y[J])&&(yield this.#Y[J])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(J,X={}){for(let Q of this.#O()){let $=this.#Y[Q],Z=this.#G($)?$.__staleWhileFetching:$;if(Z!==void 0&&J(Z,this.#K[Q],this))return this.get(this.#K[Q],X)}}forEach(J,X=this){for(let Q of this.#O()){let $=this.#Y[Q],Z=this.#G($)?$.__staleWhileFetching:$;Z!==void 0&&J.call(X,Z,this.#K[Q],this)}}rforEach(J,X=this){for(let Q of this.#v()){let $=this.#Y[Q],Z=this.#G($)?$.__staleWhileFetching:$;Z!==void 0&&J.call(X,Z,this.#K[Q],this)}}purgeStale(){let J=!1;for(let X of this.#v({allowStale:!0}))this.#k(X)&&(this.#I(this.#K[X],"expire"),J=!0);return J}info(J){let X=this.#z.get(J);if(X===void 0)return;let Q=this.#Y[X],$=this.#G(Q)?Q.__staleWhileFetching:Q;if($===void 0)return;let Z={value:$};if(this.#j&&this.#w){let Y=this.#j[X],H=this.#w[X];if(Y&&H){let K=Y-(this.#W.now()-H);Z.ttl=K,Z.start=Date.now()}}return this.#T&&(Z.size=this.#T[X]),Z}dump(){let J=[];for(let X of this.#O({allowStale:!0})){let Q=this.#K[X],$=this.#Y[X],Z=this.#G($)?$.__staleWhileFetching:$;if(Z===void 0||Q===void 0)continue;let Y={value:Z};if(this.#j&&this.#w){Y.ttl=this.#j[X];let H=this.#W.now()-this.#w[X];Y.start=Math.floor(Date.now()-H)}this.#T&&(Y.size=this.#T[X]),J.unshift([Q,Y])}return J}load(J){this.clear();for(let[X,Q]of J){if(Q.start){let $=Date.now()-Q.start;Q.start=this.#W.now()-$}this.set(X,Q.value,Q)}}set(J,X,Q={}){if(X===void 0)return this.delete(J),this;let{ttl:$=this.ttl,start:Z,noDisposeOnSet:Y=this.noDisposeOnSet,sizeCalculation:H=this.sizeCalculation,status:K}=Q,{noUpdateTTL:V=this.noUpdateTTL}=Q,G=this.#f(J,X,Q.size||0,H);if(this.maxEntrySize&&G>this.maxEntrySize)return K&&(K.set="miss",K.maxEntrySizeExceeded=!0),this.#I(J,"set"),this;let W=this.#H===0?void 0:this.#z.get(J);if(W===void 0)W=this.#H===0?this.#B:this.#D.length!==0?this.#D.pop():this.#H===this.#q?this.#m(!1):this.#H,this.#K[W]=J,this.#Y[W]=X,this.#z.set(J,W),this.#L[this.#B]=W,this.#M[W]=this.#B,this.#B=W,this.#H++,this.#S(W,G,K),K&&(K.set="add"),V=!1,this.#y&&this.#Q?.(X,J,"add");else{this.#h(W);let U=this.#Y[W];if(X!==U){if(this.#P&&this.#G(U)){U.__abortController.abort(Error("replaced"));let{__staleWhileFetching:z}=U;z!==void 0&&!Y&&(this.#C&&this.#J?.(z,J,"set"),this.#$&&this.#x?.push([z,J,"set"]))}else Y||(this.#C&&this.#J?.(U,J,"set"),this.#$&&this.#x?.push([U,J,"set"]));if(this.#b(W),this.#S(W,G,K),this.#Y[W]=X,K){K.set="replace";let z=U&&this.#G(U)?U.__staleWhileFetching:U;z!==void 0&&(K.oldValue=z)}}else K&&(K.set="update");this.#y&&this.onInsert?.(X,J,X===U?"update":"replace")}if($!==0&&!this.#j&&this.#N(),this.#j&&(V||this.#g(W,$,Z),K&&this.#E(K,W)),!Y&&this.#$&&this.#x){let U=this.#x,z;for(;z=U?.shift();)this.#Z?.(...z)}return this}pop(){try{for(;this.#H;){let J=this.#Y[this.#F];if(this.#m(!0),this.#G(J)){if(J.__staleWhileFetching)return J.__staleWhileFetching}else if(J!==void 0)return J}}finally{if(this.#$&&this.#x){let J=this.#x,X;for(;X=J?.shift();)this.#Z?.(...X)}}}#m(J){let X=this.#F,Q=this.#K[X],$=this.#Y[X];return this.#P&&this.#G($)?$.__abortController.abort(Error("evicted")):(this.#C||this.#$)&&(this.#C&&this.#J?.($,Q,"evict"),this.#$&&this.#x?.push([$,Q,"evict"])),this.#b(X),this.#R?.[X]&&(clearTimeout(this.#R[X]),this.#R[X]=void 0),J&&(this.#K[X]=void 0,this.#Y[X]=void 0,this.#D.push(X)),this.#H===1?(this.#F=this.#B=0,this.#D.length=0):this.#F=this.#L[X],this.#z.delete(Q),this.#H--,X}has(J,X={}){let{updateAgeOnHas:Q=this.updateAgeOnHas,status:$}=X,Z=this.#z.get(J);if(Z!==void 0){let Y=this.#Y[Z];if(this.#G(Y)&&Y.__staleWhileFetching===void 0)return!1;if(this.#k(Z))$&&($.has="stale",this.#E($,Z));else return Q&&this.#A(Z),$&&($.has="hit",this.#E($,Z)),!0}else $&&($.has="miss");return!1}peek(J,X={}){let{allowStale:Q=this.allowStale}=X,$=this.#z.get(J);if($===void 0||!Q&&this.#k($))return;let Z=this.#Y[$];return this.#G(Z)?Z.__staleWhileFetching:Z}#d(J,X,Q,$){let Z=X===void 0?void 0:this.#Y[X];if(this.#G(Z))return Z;let Y=new T2,{signal:H}=Q;H?.addEventListener("abort",()=>Y.abort(H.reason),{signal:Y.signal});let K={signal:Y.signal,options:Q,context:$},V=(_,x=!1)=>{let{aborted:B}=Y.signal,j=Q.ignoreFetchAbort&&_!==void 0,R=Q.ignoreFetchAbort||!!(Q.allowStaleOnFetchAbort&&_!==void 0);if(Q.status&&(B&&!x?(Q.status.fetchAborted=!0,Q.status.fetchError=Y.signal.reason,j&&(Q.status.fetchAbortIgnored=!0)):Q.status.fetchResolved=!0),B&&!j&&!x)return W(Y.signal.reason,R);let M=z,F=this.#Y[X];return(F===z||j&&x&&F===void 0)&&(_===void 0?M.__staleWhileFetching!==void 0?this.#Y[X]=M.__staleWhileFetching:this.#I(J,"fetch"):(Q.status&&(Q.status.fetchUpdated=!0),this.set(J,_,K.options))),_},G=(_)=>(Q.status&&(Q.status.fetchRejected=!0,Q.status.fetchError=_),W(_,!1)),W=(_,x)=>{let{aborted:B}=Y.signal,j=B&&Q.allowStaleOnFetchAbort,R=j||Q.allowStaleOnFetchRejection,M=R||Q.noDeleteOnFetchRejection,F=z;if(this.#Y[X]===z&&(!M||!x&&F.__staleWhileFetching===void 0?this.#I(J,"fetch"):j||(this.#Y[X]=F.__staleWhileFetching)),R)return Q.status&&F.__staleWhileFetching!==void 0&&(Q.status.returnedStale=!0),F.__staleWhileFetching;if(F.__returned===F)throw _},U=(_,x)=>{let B=this.#V?.(J,Z,K);B&&B instanceof Promise&&B.then((j)=>_(j===void 0?void 0:j),x),Y.signal.addEventListener("abort",()=>{(!Q.ignoreFetchAbort||Q.allowStaleOnFetchAbort)&&(_(void 0),Q.allowStaleOnFetchAbort&&(_=(j)=>V(j,!0)))})};Q.status&&(Q.status.fetchDispatched=!0);let z=new Promise(U).then(V,G),L=Object.assign(z,{__abortController:Y,__staleWhileFetching:Z,__returned:void 0});return X===void 0?(this.set(J,L,{...K.options,status:void 0}),X=this.#z.get(J)):this.#Y[X]=L,L}#G(J){if(!this.#P)return!1;let X=J;return!!X&&X instanceof Promise&&X.hasOwnProperty("__staleWhileFetching")&&X.__abortController instanceof T2}async fetch(J,X={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:Z=this.noDeleteOnStaleGet,ttl:Y=this.ttl,noDisposeOnSet:H=this.noDisposeOnSet,size:K=0,sizeCalculation:V=this.sizeCalculation,noUpdateTTL:G=this.noUpdateTTL,noDeleteOnFetchRejection:W=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:U=this.allowStaleOnFetchRejection,ignoreFetchAbort:z=this.ignoreFetchAbort,allowStaleOnFetchAbort:L=this.allowStaleOnFetchAbort,context:_,forceRefresh:x=!1,status:B,signal:j}=X;if(!this.#P)return B&&(B.fetch="get"),this.get(J,{allowStale:Q,updateAgeOnGet:$,noDeleteOnStaleGet:Z,status:B});let R={allowStale:Q,updateAgeOnGet:$,noDeleteOnStaleGet:Z,ttl:Y,noDisposeOnSet:H,size:K,sizeCalculation:V,noUpdateTTL:G,noDeleteOnFetchRejection:W,allowStaleOnFetchRejection:U,allowStaleOnFetchAbort:L,ignoreFetchAbort:z,status:B,signal:j},M=this.#z.get(J);if(M===void 0){B&&(B.fetch="miss");let F=this.#d(J,M,R,_);return F.__returned=F}else{let F=this.#Y[M];if(this.#G(F)){let m=Q&&F.__staleWhileFetching!==void 0;return B&&(B.fetch="inflight",m&&(B.returnedStale=!0)),m?F.__staleWhileFetching:F.__returned=F}let I=this.#k(M);if(!x&&!I)return B&&(B.fetch="hit"),this.#h(M),$&&this.#A(M),B&&this.#E(B,M),F;let P=this.#d(J,M,R,_),g=P.__staleWhileFetching!==void 0&&Q;return B&&(B.fetch=I?"stale":"refresh",g&&I&&(B.returnedStale=!0)),g?P.__staleWhileFetching:P.__returned=P}}async forceFetch(J,X={}){let Q=await this.fetch(J,X);if(Q===void 0)throw Error("fetch() returned undefined");return Q}memo(J,X={}){let Q=this.#U;if(!Q)throw Error("no memoMethod provided to constructor");let{context:$,forceRefresh:Z,...Y}=X,H=this.get(J,Y);if(!Z&&H!==void 0)return H;let K=Q(J,H,{options:Y,context:$});return this.set(J,K,Y),K}get(J,X={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:Z=this.noDeleteOnStaleGet,status:Y}=X,H=this.#z.get(J);if(H!==void 0){let K=this.#Y[H],V=this.#G(K);return Y&&this.#E(Y,H),this.#k(H)?(Y&&(Y.get="stale"),V?(Y&&Q&&K.__staleWhileFetching!==void 0&&(Y.returnedStale=!0),Q?K.__staleWhileFetching:void 0):(Z||this.#I(J,"expire"),Y&&Q&&(Y.returnedStale=!0),Q?K:void 0)):(Y&&(Y.get="hit"),V?K.__staleWhileFetching:(this.#h(H),$&&this.#A(H),K))}else Y&&(Y.get="miss")}#c(J,X){this.#M[X]=J,this.#L[J]=X}#h(J){J!==this.#B&&(J===this.#F?this.#F=this.#L[J]:this.#c(this.#M[J],this.#L[J]),this.#c(this.#B,J),this.#B=J)}delete(J){return this.#I(J,"delete")}#I(J,X){let Q=!1;if(this.#H!==0){let $=this.#z.get(J);if($!==void 0)if(this.#R?.[$]&&(clearTimeout(this.#R?.[$]),this.#R[$]=void 0),Q=!0,this.#H===1)this.#p(X);else{this.#b($);let Z=this.#Y[$];if(this.#G(Z)?Z.__abortController.abort(Error("deleted")):(this.#C||this.#$)&&(this.#C&&this.#J?.(Z,J,X),this.#$&&this.#x?.push([Z,J,X])),this.#z.delete(J),this.#K[$]=void 0,this.#Y[$]=void 0,$===this.#B)this.#B=this.#M[$];else if($===this.#F)this.#F=this.#L[$];else{let Y=this.#M[$];this.#L[Y]=this.#L[$];let H=this.#L[$];this.#M[H]=this.#M[$]}this.#H--,this.#D.push($)}}if(this.#$&&this.#x?.length){let $=this.#x,Z;for(;Z=$?.shift();)this.#Z?.(...Z)}return Q}clear(){return this.#p("delete")}#p(J){for(let X of this.#v({allowStale:!0})){let Q=this.#Y[X];if(this.#G(Q))Q.__abortController.abort(Error("deleted"));else{let $=this.#K[X];this.#C&&this.#J?.(Q,$,J),this.#$&&this.#x?.push([Q,$,J])}}if(this.#z.clear(),this.#Y.fill(void 0),this.#K.fill(void 0),this.#j&&this.#w){this.#j.fill(0),this.#w.fill(0);for(let X of this.#R??[])X!==void 0&&clearTimeout(X);this.#R?.fill(void 0)}if(this.#T&&this.#T.fill(0),this.#F=0,this.#B=0,this.#D.length=0,this.#_=0,this.#H=0,this.#$&&this.#x){let X=this.#x,Q;for(;Q=X?.shift();)this.#Z?.(...Q)}}};import{posix as iZ,win32 as S8}from"node:path";import{fileURLToPath as aZ}from"node:url";import{lstatSync as oZ,readdir as rZ,readdirSync as sZ,readlinkSync as tZ,realpathSync as eZ}from"fs";import*as qY from"node:fs";import{lstat as XY,readdir as QY,readlink as $Y,realpath as ZY}from"node:fs/promises";import{EventEmitter as v8}from"node:events";import H7 from"node:stream";import{StringDecoder as bZ}from"node:string_decoder";var Q7=typeof process==="object"&&process?process:{stdout:null,stderr:null},gZ=(q)=>!!q&&typeof q==="object"&&(q instanceof a0||q instanceof H7||fZ(q)||uZ(q)),fZ=(q)=>!!q&&typeof q==="object"&&q instanceof v8&&typeof q.pipe==="function"&&q.pipe!==H7.Writable.prototype.pipe,uZ=(q)=>!!q&&typeof q==="object"&&q instanceof v8&&typeof q.write==="function"&&typeof q.end==="function",k0=Symbol("EOF"),T0=Symbol("maybeEmitEnd"),y0=Symbol("emittedEnd"),w2=Symbol("emittingEnd"),b6=Symbol("emittedError"),P2=Symbol("closed"),$7=Symbol("read"),A2=Symbol("flush"),Z7=Symbol("flushChunk"),Z0=Symbol("encoding"),K6=Symbol("decoder"),v=Symbol("flowing"),g6=Symbol("paused"),V6=Symbol("resume"),N=Symbol("buffer"),c=Symbol("pipes"),E=Symbol("bufferLength"),P8=Symbol("bufferPush"),D2=Symbol("bufferShift"),f=Symbol("objectMode"),A=Symbol("destroyed"),A8=Symbol("error"),D8=Symbol("emitData"),Y7=Symbol("emitEnd"),I8=Symbol("emitEnd2"),z0=Symbol("async"),O8=Symbol("abort"),I2=Symbol("aborted"),f6=Symbol("signal"),i0=Symbol("dataListeners"),r=Symbol("discarded"),u6=(q)=>Promise.resolve().then(q),mZ=(q)=>q(),dZ=(q)=>q==="end"||q==="finish"||q==="prefinish",cZ=(q)=>q instanceof ArrayBuffer||!!q&&typeof q==="object"&&q.constructor&&q.constructor.name==="ArrayBuffer"&&q.byteLength>=0,lZ=(q)=>!Buffer.isBuffer(q)&&ArrayBuffer.isView(q);class N8{src;dest;opts;ondrain;constructor(q,J,X){this.src=q,this.dest=J,this.opts=X,this.ondrain=()=>q[V6](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class K7 extends N8{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(q,J,X){super(q,J,X);this.proxyErrors=(Q)=>this.dest.emit("error",Q),q.on("error",this.proxyErrors)}}var pZ=(q)=>!!q.objectMode,nZ=(q)=>!q.objectMode&&!!q.encoding&&q.encoding!=="buffer";class a0 extends v8{[v]=!1;[g6]=!1;[c]=[];[N]=[];[f];[Z0];[z0];[K6];[k0]=!1;[y0]=!1;[w2]=!1;[P2]=!1;[b6]=null;[E]=0;[A]=!1;[f6];[I2]=!1;[i0]=0;[r]=!1;writable=!0;readable=!0;constructor(...q){let J=q[0]||{};super();if(J.objectMode&&typeof J.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(pZ(J))this[f]=!0,this[Z0]=null;else if(nZ(J))this[Z0]=J.encoding,this[f]=!1;else this[f]=!1,this[Z0]=null;if(this[z0]=!!J.async,this[K6]=this[Z0]?new bZ(this[Z0]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[N]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[c]});let{signal:X}=J;if(X)if(this[f6]=X,X.aborted)this[O8]();else X.addEventListener("abort",()=>this[O8]())}get bufferLength(){return this[E]}get encoding(){return this[Z0]}set encoding(q){throw Error("Encoding must be set at instantiation time")}setEncoding(q){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[f]}set objectMode(q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[z0]}set["async"](q){this[z0]=this[z0]||!!q}[O8](){this[I2]=!0,this.emit("abort",this[f6]?.reason),this.destroy(this[f6]?.reason)}get aborted(){return this[I2]}set aborted(q){}write(q,J,X){if(this[I2])return!1;if(this[k0])throw Error("write after end");if(this[A])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof J==="function")X=J,J="utf8";if(!J)J="utf8";let Q=this[z0]?u6:mZ;if(!this[f]&&!Buffer.isBuffer(q)){if(lZ(q))q=Buffer.from(q.buffer,q.byteOffset,q.byteLength);else if(cZ(q))q=Buffer.from(q);else if(typeof q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[f]){if(this[v]&&this[E]!==0)this[A2](!0);if(this[v])this.emit("data",q);else this[P8](q);if(this[E]!==0)this.emit("readable");if(X)Q(X);return this[v]}if(!q.length){if(this[E]!==0)this.emit("readable");if(X)Q(X);return this[v]}if(typeof q==="string"&&!(J===this[Z0]&&!this[K6]?.lastNeed))q=Buffer.from(q,J);if(Buffer.isBuffer(q)&&this[Z0])q=this[K6].write(q);if(this[v]&&this[E]!==0)this[A2](!0);if(this[v])this.emit("data",q);else this[P8](q);if(this[E]!==0)this.emit("readable");if(X)Q(X);return this[v]}read(q){if(this[A])return null;if(this[r]=!1,this[E]===0||q===0||q&&q>this[E])return this[T0](),null;if(this[f])q=null;if(this[N].length>1&&!this[f])this[N]=[this[Z0]?this[N].join(""):Buffer.concat(this[N],this[E])];let J=this[$7](q||null,this[N][0]);return this[T0](),J}[$7](q,J){if(this[f])this[D2]();else{let X=J;if(q===X.length||q===null)this[D2]();else if(typeof X==="string")this[N][0]=X.slice(q),J=X.slice(0,q),this[E]-=q;else this[N][0]=X.subarray(q),J=X.subarray(0,q),this[E]-=q}if(this.emit("data",J),!this[N].length&&!this[k0])this.emit("drain");return J}end(q,J,X){if(typeof q==="function")X=q,q=void 0;if(typeof J==="function")X=J,J="utf8";if(q!==void 0)this.write(q,J);if(X)this.once("end",X);if(this[k0]=!0,this.writable=!1,this[v]||!this[g6])this[T0]();return this}[V6](){if(this[A])return;if(!this[i0]&&!this[c].length)this[r]=!0;if(this[g6]=!1,this[v]=!0,this.emit("resume"),this[N].length)this[A2]();else if(this[k0])this[T0]();else this.emit("drain")}resume(){return this[V6]()}pause(){this[v]=!1,this[g6]=!0,this[r]=!1}get destroyed(){return this[A]}get flowing(){return this[v]}get paused(){return this[g6]}[P8](q){if(this[f])this[E]+=1;else this[E]+=q.length;this[N].push(q)}[D2](){if(this[f])this[E]-=1;else this[E]-=this[N][0].length;return this[N].shift()}[A2](q=!1){do;while(this[Z7](this[D2]())&&this[N].length);if(!q&&!this[N].length&&!this[k0])this.emit("drain")}[Z7](q){return this.emit("data",q),this[v]}pipe(q,J){if(this[A])return q;this[r]=!1;let X=this[y0];if(J=J||{},q===Q7.stdout||q===Q7.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,X){if(J.end)q.end()}else if(this[c].push(!J.proxyErrors?new N8(this,q,J):new K7(this,q,J)),this[z0])u6(()=>this[V6]());else this[V6]();return q}unpipe(q){let J=this[c].find((X)=>X.dest===q);if(J){if(this[c].length===1){if(this[v]&&this[i0]===0)this[v]=!1;this[c]=[]}else this[c].splice(this[c].indexOf(J),1);J.unpipe()}}addListener(q,J){return this.on(q,J)}on(q,J){let X=super.on(q,J);if(q==="data"){if(this[r]=!1,this[i0]++,!this[c].length&&!this[v])this[V6]()}else if(q==="readable"&&this[E]!==0)super.emit("readable");else if(dZ(q)&&this[y0])super.emit(q),this.removeAllListeners(q);else if(q==="error"&&this[b6]){let Q=J;if(this[z0])u6(()=>Q.call(this,this[b6]));else Q.call(this,this[b6])}return X}removeListener(q,J){return this.off(q,J)}off(q,J){let X=super.off(q,J);if(q==="data"){if(this[i0]=this.listeners("data").length,this[i0]===0&&!this[r]&&!this[c].length)this[v]=!1}return X}removeAllListeners(q){let J=super.removeAllListeners(q);if(q==="data"||q===void 0){if(this[i0]=0,!this[r]&&!this[c].length)this[v]=!1}return J}get emittedEnd(){return this[y0]}[T0](){if(!this[w2]&&!this[y0]&&!this[A]&&this[N].length===0&&this[k0]){if(this[w2]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[P2])this.emit("close");this[w2]=!1}}emit(q,...J){let X=J[0];if(q!=="error"&&q!=="close"&&q!==A&&this[A])return!1;else if(q==="data")return!this[f]&&!X?!1:this[z0]?(u6(()=>this[D8](X)),!0):this[D8](X);else if(q==="end")return this[Y7]();else if(q==="close"){if(this[P2]=!0,!this[y0]&&!this[A])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(q==="error"){this[b6]=X,super.emit(A8,X);let $=!this[f6]||this.listeners("error").length?super.emit("error",X):!1;return this[T0](),$}else if(q==="resume"){let $=super.emit("resume");return this[T0](),$}else if(q==="finish"||q==="prefinish"){let $=super.emit(q);return this.removeAllListeners(q),$}let Q=super.emit(q,...J);return this[T0](),Q}[D8](q){for(let X of this[c])if(X.dest.write(q)===!1)this.pause();let J=this[r]?!1:super.emit("data",q);return this[T0](),J}[Y7](){if(this[y0])return!1;return this[y0]=!0,this.readable=!1,this[z0]?(u6(()=>this[I8]()),!0):this[I8]()}[I8](){if(this[K6]){let J=this[K6].end();if(J){for(let X of this[c])X.dest.write(J);if(!this[r])super.emit("data",J)}}for(let J of this[c])J.end();let q=super.emit("end");return this.removeAllListeners("end"),q}async collect(){let q=Object.assign([],{dataLength:0});if(!this[f])q.dataLength=0;let J=this.promise();return this.on("data",(X)=>{if(q.push(X),!this[f])q.dataLength+=X.length}),await J,q}async concat(){if(this[f])throw Error("cannot concat in objectMode");let q=await this.collect();return this[Z0]?q.join(""):Buffer.concat(q,q.dataLength)}async promise(){return new Promise((q,J)=>{this.on(A,()=>J(Error("stream destroyed"))),this.on("error",(X)=>J(X)),this.on("end",()=>q())})}[Symbol.asyncIterator](){this[r]=!1;let q=!1,J=async()=>{return this.pause(),q=!0,{value:void 0,done:!0}};return{next:()=>{if(q)return J();let Q=this.read();if(Q!==null)return Promise.resolve({done:!1,value:Q});if(this[k0])return J();let $,Z,Y=(G)=>{this.off("data",H),this.off("end",K),this.off(A,V),J(),Z(G)},H=(G)=>{this.off("error",Y),this.off("end",K),this.off(A,V),this.pause(),$({value:G,done:!!this[k0]})},K=()=>{this.off("error",Y),this.off("data",H),this.off(A,V),J(),$({done:!0,value:void 0})},V=()=>Y(Error("stream destroyed"));return new Promise((G,W)=>{Z=W,$=G,this.once(A,V),this.once("error",Y),this.once("end",K),this.once("data",H)})},throw:J,return:J,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[r]=!1;let q=!1,J=()=>{return this.pause(),this.off(A8,J),this.off(A,J),this.off("end",J),q=!0,{done:!0,value:void 0}},X=()=>{if(q)return J();let Q=this.read();return Q===null?J():{done:!1,value:Q}};return this.once("end",J),this.once(A8,J),this.once(A,J),{next:X,throw:J,return:J,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(q){if(this[A]){if(q)this.emit("error",q);else this.emit(A);return this}this[A]=!0,this[r]=!0,this[N].length=0,this[E]=0;let J=this;if(typeof J.close==="function"&&!this[P2])J.close();if(q)this.emit("error",q);else this.emit(A);return this}static get isStream(){return gZ}}var JY=eZ.native,d6={lstatSync:oZ,readdir:rZ,readdirSync:sZ,readlinkSync:tZ,realpathSync:JY,promises:{lstat:XY,readdir:QY,readlink:$Y,realpath:ZY}},z7=(q)=>!q||q===d6||q===qY?d6:{...d6,...q,promises:{...d6.promises,...q.promises||{}}},_7=/^\\\\\?\\([a-z]:)\\?$/i,YY=(q)=>q.replace(/\//g,"\\").replace(_7,"$1\\"),HY=/[\\\/]/,J0=0,L7=1,B7=2,_0=4,x7=6,j7=8,o0=10,R7=12,q0=15,m6=~q0,E8=16,V7=32,c6=64,Y0=128,O2=256,N2=512,G7=c6|Y0|N2,KY=1023,y8=(q)=>q.isFile()?j7:q.isDirectory()?_0:q.isSymbolicLink()?o0:q.isCharacterDevice()?B7:q.isBlockDevice()?x7:q.isSocket()?R7:q.isFIFO()?L7:J0,W7=new h6({max:4096}),l6=(q)=>{let J=W7.get(q);if(J)return J;let X=q.normalize("NFKD");return W7.set(q,X),X},U7=new h6({max:4096}),v2=(q)=>{let J=U7.get(q);if(J)return J;let X=l6(q.toLowerCase());return U7.set(q,X),X};class h8 extends h6{constructor(){super({max:256})}}class F7 extends h6{constructor(q=16384){super({maxSize:q,sizeCalculation:(J)=>J.length+1})}}var M7=Symbol("PathScurry setAsCwd");class l{name;root;roots;parent;nocase;isCWD=!1;#q;#X;get dev(){return this.#X}#J;get mode(){return this.#J}#Q;get nlink(){return this.#Q}#Z;get uid(){return this.#Z}#V;get gid(){return this.#V}#U;get rdev(){return this.#U}#W;get blksize(){return this.#W}#H;get ino(){return this.#H}#_;get size(){return this.#_}#z;get blocks(){return this.#z}#K;get atimeMs(){return this.#K}#Y;get mtimeMs(){return this.#Y}#L;get ctimeMs(){return this.#L}#M;get birthtimeMs(){return this.#M}#F;get atime(){return this.#F}#B;get mtime(){return this.#B}#D;get ctime(){return this.#D}#x;get birthtime(){return this.#x}#T;#w;#j;#R;#C;#P;#$;#y;#N;#A;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(q,J=J0,X,Q,$,Z,Y){if(this.name=q,this.#T=$?v2(q):l6(q),this.#$=J&KY,this.nocase=$,this.roots=Q,this.root=X||this,this.#y=Z,this.#j=Y.fullpath,this.#C=Y.relative,this.#P=Y.relativePosix,this.parent=Y.parent,this.parent)this.#q=this.parent.#q;else this.#q=z7(Y.fs)}depth(){if(this.#w!==void 0)return this.#w;if(!this.parent)return this.#w=0;return this.#w=this.parent.depth()+1}childrenCache(){return this.#y}resolve(q){if(!q)return this;let J=this.getRootString(q),Q=q.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#E(Q):this.#E(Q)}#E(q){let J=this;for(let X of q)J=J.child(X);return J}children(){let q=this.#y.get(this);if(q)return q;let J=Object.assign([],{provisional:0});return this.#y.set(this,J),this.#$&=~E8,J}child(q,J){if(q===""||q===".")return this;if(q==="..")return this.parent||this;let X=this.children(),Q=this.nocase?v2(q):l6(q);for(let H of X)if(H.#T===Q)return H;let $=this.parent?this.sep:"",Z=this.#j?this.#j+$+q:void 0,Y=this.newChild(q,J0,{...J,parent:this,fullpath:Z});if(!this.canReaddir())Y.#$|=Y0;return X.push(Y),Y}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let q=this.name,J=this.parent;if(!J)return this.#C=this.name;let X=J.relative();return X+(!X||!J.parent?"":this.sep)+q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#P!==void 0)return this.#P;let q=this.name,J=this.parent;if(!J)return this.#P=this.fullpathPosix();let X=J.relativePosix();return X+(!X||!J.parent?"":"/")+q}fullpath(){if(this.#j!==void 0)return this.#j;let q=this.name,J=this.parent;if(!J)return this.#j=this.name;let Q=J.fullpath()+(!J.parent?"":this.sep)+q;return this.#j=Q}fullpathPosix(){if(this.#R!==void 0)return this.#R;if(this.sep==="/")return this.#R=this.fullpath();if(!this.parent){let Q=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(Q))return this.#R=`//?/${Q}`;else return this.#R=Q}let q=this.parent,J=q.fullpathPosix(),X=J+(!J||!q.parent?"":"/")+this.name;return this.#R=X}isUnknown(){return(this.#$&q0)===J0}isType(q){return this[`is${q}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#$&q0)===j7}isDirectory(){return(this.#$&q0)===_0}isCharacterDevice(){return(this.#$&q0)===B7}isBlockDevice(){return(this.#$&q0)===x7}isFIFO(){return(this.#$&q0)===L7}isSocket(){return(this.#$&q0)===R7}isSymbolicLink(){return(this.#$&o0)===o0}lstatCached(){return this.#$&V7?this:void 0}readlinkCached(){return this.#N}realpathCached(){return this.#A}readdirCached(){let q=this.children();return q.slice(0,q.provisional)}canReadlink(){if(this.#N)return!0;if(!this.parent)return!1;let q=this.#$&q0;return!(q!==J0&&q!==o0||this.#$&O2||this.#$&Y0)}calledReaddir(){return!!(this.#$&E8)}isENOENT(){return!!(this.#$&Y0)}isNamed(q){return!this.nocase?this.#T===l6(q):this.#T===v2(q)}async readlink(){let q=this.#N;if(q)return q;if(!this.canReadlink())return;if(!this.parent)return;try{let J=await this.#q.promises.readlink(this.fullpath()),X=(await this.parent.realpath())?.resolve(J);if(X)return this.#N=X}catch(J){this.#v(J.code);return}}readlinkSync(){let q=this.#N;if(q)return q;if(!this.canReadlink())return;if(!this.parent)return;try{let J=this.#q.readlinkSync(this.fullpath()),X=this.parent.realpathSync()?.resolve(J);if(X)return this.#N=X}catch(J){this.#v(J.code);return}}#g(q){this.#$|=E8;for(let J=q.provisional;J<q.length;J++){let X=q[J];if(X)X.#k()}}#k(){if(this.#$&Y0)return;this.#$=(this.#$|Y0)&m6,this.#l()}#l(){let q=this.children();q.provisional=0;for(let J of q)J.#k()}#b(){this.#$|=N2,this.#S()}#S(){if(this.#$&c6)return;let q=this.#$;if((q&q0)===_0)q&=m6;this.#$=q|c6,this.#l()}#f(q=""){if(q==="ENOTDIR"||q==="EPERM")this.#S();else if(q==="ENOENT")this.#k();else this.children().provisional=0}#O(q=""){if(q==="ENOTDIR")this.parent.#S();else if(q==="ENOENT")this.#k()}#v(q=""){let J=this.#$;if(J|=O2,q==="ENOENT")J|=Y0;if(q==="EINVAL"||q==="UNKNOWN")J&=m6;if(this.#$=J,q==="ENOTDIR"&&this.parent)this.parent.#S()}#u(q,J){return this.#d(q,J)||this.#m(q,J)}#m(q,J){let X=y8(q),Q=this.newChild(q.name,X,{parent:this}),$=Q.#$&q0;if($!==_0&&$!==o0&&$!==J0)Q.#$|=c6;return J.unshift(Q),J.provisional++,Q}#d(q,J){for(let X=J.provisional;X<J.length;X++){let Q=J[X];if((this.nocase?v2(q.name):l6(q.name))!==Q.#T)continue;return this.#G(q,Q,X,J)}}#G(q,J,X,Q){let $=J.name;if(J.#$=J.#$&m6|y8(q),$!==q.name)J.name=q.name;if(X!==Q.provisional){if(X===Q.length-1)Q.pop();else Q.splice(X,1);Q.unshift(J)}return Q.provisional++,J}async lstat(){if((this.#$&Y0)===0)try{return this.#c(await this.#q.promises.lstat(this.fullpath())),this}catch(q){this.#O(q.code)}}lstatSync(){if((this.#$&Y0)===0)try{return this.#c(this.#q.lstatSync(this.fullpath())),this}catch(q){this.#O(q.code)}}#c(q){let{atime:J,atimeMs:X,birthtime:Q,birthtimeMs:$,blksize:Z,blocks:Y,ctime:H,ctimeMs:K,dev:V,gid:G,ino:W,mode:U,mtime:z,mtimeMs:L,nlink:_,rdev:x,size:B,uid:j}=q;this.#F=J,this.#K=X,this.#x=Q,this.#M=$,this.#W=Z,this.#z=Y,this.#D=H,this.#L=K,this.#X=V,this.#V=G,this.#H=W,this.#J=U,this.#B=z,this.#Y=L,this.#Q=_,this.#U=x,this.#_=B,this.#Z=j;let R=y8(q);if(this.#$=this.#$&m6|R|V7,R!==J0&&R!==_0&&R!==o0)this.#$|=c6}#h=[];#I=!1;#p(q){this.#I=!1;let J=this.#h.slice();this.#h.length=0,J.forEach((X)=>X(null,q))}readdirCB(q,J=!1){if(!this.canReaddir()){if(J)q(null,[]);else queueMicrotask(()=>q(null,[]));return}let X=this.children();if(this.calledReaddir()){let $=X.slice(0,X.provisional);if(J)q(null,$);else queueMicrotask(()=>q(null,$));return}if(this.#h.push(q),this.#I)return;this.#I=!0;let Q=this.fullpath();this.#q.readdir(Q,{withFileTypes:!0},($,Z)=>{if($)this.#f($.code),X.provisional=0;else{for(let Y of Z)this.#u(Y,X);this.#g(X)}this.#p(X.slice(0,X.provisional));return})}#n;async readdir(){if(!this.canReaddir())return[];let q=this.children();if(this.calledReaddir())return q.slice(0,q.provisional);let J=this.fullpath();if(this.#n)await this.#n;else{let X=()=>{};this.#n=new Promise((Q)=>X=Q);try{for(let Q of await this.#q.promises.readdir(J,{withFileTypes:!0}))this.#u(Q,q);this.#g(q)}catch(Q){this.#f(Q.code),q.provisional=0}this.#n=void 0,X()}return q.slice(0,q.provisional)}readdirSync(){if(!this.canReaddir())return[];let q=this.children();if(this.calledReaddir())return q.slice(0,q.provisional);let J=this.fullpath();try{for(let X of this.#q.readdirSync(J,{withFileTypes:!0}))this.#u(X,q);this.#g(q)}catch(X){this.#f(X.code),q.provisional=0}return q.slice(0,q.provisional)}canReaddir(){if(this.#$&G7)return!1;let q=q0&this.#$;if(!(q===J0||q===_0||q===o0))return!1;return!0}shouldWalk(q,J){return(this.#$&_0)===_0&&!(this.#$&G7)&&!q.has(this)&&(!J||J(this))}async realpath(){if(this.#A)return this.#A;if((N2|O2|Y0)&this.#$)return;try{let q=await this.#q.promises.realpath(this.fullpath());return this.#A=this.resolve(q)}catch(q){this.#b()}}realpathSync(){if(this.#A)return this.#A;if((N2|O2|Y0)&this.#$)return;try{let q=this.#q.realpathSync(this.fullpath());return this.#A=this.resolve(q)}catch(q){this.#b()}}[M7](q){if(q===this)return;q.isCWD=!1,this.isCWD=!0;let J=new Set([]),X=[],Q=this;while(Q&&Q.parent)J.add(Q),Q.#C=X.join(this.sep),Q.#P=X.join("/"),Q=Q.parent,X.push("..");Q=q;while(Q&&Q.parent&&!J.has(Q))Q.#C=void 0,Q.#P=void 0,Q=Q.parent}}class E2 extends l{sep="\\";splitSep=HY;constructor(q,J=J0,X,Q,$,Z,Y){super(q,J,X,Q,$,Z,Y)}newChild(q,J=J0,X={}){return new E2(q,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}getRootString(q){return S8.parse(q).root}getRoot(q){if(q=YY(q.toUpperCase()),q===this.root.name)return this.root;for(let[J,X]of Object.entries(this.roots))if(this.sameRoot(q,J))return this.roots[q]=X;return this.roots[q]=new p6(q,this).root}sameRoot(q,J=this.root.name){return q=q.toUpperCase().replace(/\//g,"\\").replace(_7,"$1\\"),q===J}}class y2 extends l{splitSep="/";sep="/";constructor(q,J=J0,X,Q,$,Z,Y){super(q,J,X,Q,$,Z,Y)}getRootString(q){return q.startsWith("/")?"/":""}getRoot(q){return this.root}newChild(q,J=J0,X={}){return new y2(q,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}}class b8{root;rootPath;roots;cwd;#q;#X;#J;nocase;#Q;constructor(q=process.cwd(),J,X,{nocase:Q,childrenCacheSize:$=16384,fs:Z=d6}={}){if(this.#Q=z7(Z),q instanceof URL||q.startsWith("file://"))q=aZ(q);let Y=J.resolve(q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(Y),this.#q=new h8,this.#X=new h8,this.#J=new F7($);let H=Y.substring(this.rootPath.length).split(X);if(H.length===1&&!H[0])H.pop();if(Q===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Q,this.root=this.newRoot(this.#Q),this.roots[this.rootPath]=this.root;let K=this.root,V=H.length-1,G=J.sep,W=this.rootPath,U=!1;for(let z of H){let L=V--;K=K.child(z,{relative:Array(L).fill("..").join(G),relativePosix:Array(L).fill("..").join("/"),fullpath:W+=(U?"":G)+z}),U=!0}this.cwd=K}depth(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.depth()}childrenCache(){return this.#J}resolve(...q){let J="";for(let $=q.length-1;$>=0;$--){let Z=q[$];if(!Z||Z===".")continue;if(J=J?`${Z}/${J}`:Z,this.isAbsolute(Z))break}let X=this.#q.get(J);if(X!==void 0)return X;let Q=this.cwd.resolve(J).fullpath();return this.#q.set(J,Q),Q}resolvePosix(...q){let J="";for(let $=q.length-1;$>=0;$--){let Z=q[$];if(!Z||Z===".")continue;if(J=J?`${Z}/${J}`:Z,this.isAbsolute(Z))break}let X=this.#X.get(J);if(X!==void 0)return X;let Q=this.cwd.resolve(J).fullpathPosix();return this.#X.set(J,Q),Q}relative(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.relative()}relativePosix(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.relativePosix()}basename(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.name}dirname(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return(q.parent||q).fullpath()}async readdir(q=this.cwd,J={withFileTypes:!0}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q,q=this.cwd;let{withFileTypes:X}=J;if(!q.canReaddir())return[];else{let Q=await q.readdir();return X?Q:Q.map(($)=>$.name)}}readdirSync(q=this.cwd,J={withFileTypes:!0}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q,q=this.cwd;let{withFileTypes:X=!0}=J;if(!q.canReaddir())return[];else if(X)return q.readdirSync();else return q.readdirSync().map((Q)=>Q.name)}async lstat(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.lstat()}lstatSync(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.lstatSync()}async readlink(q=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q.withFileTypes,q=this.cwd;let X=await q.readlink();return J?X:X?.fullpath()}readlinkSync(q=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q.withFileTypes,q=this.cwd;let X=q.readlinkSync();return J?X:X?.fullpath()}async realpath(q=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q.withFileTypes,q=this.cwd;let X=await q.realpath();return J?X:X?.fullpath()}realpathSync(q=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q.withFileTypes,q=this.cwd;let X=q.realpathSync();return J?X:X?.fullpath()}async walk(q=this.cwd,J={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q,q=this.cwd;let{withFileTypes:X=!0,follow:Q=!1,filter:$,walkFilter:Z}=J,Y=[];if(!$||$(q))Y.push(X?q:q.fullpath());let H=new Set,K=(G,W)=>{H.add(G),G.readdirCB((U,z)=>{if(U)return W(U);let L=z.length;if(!L)return W();let _=()=>{if(--L===0)W()};for(let x of z){if(!$||$(x))Y.push(X?x:x.fullpath());if(Q&&x.isSymbolicLink())x.realpath().then((B)=>B?.isUnknown()?B.lstat():B).then((B)=>B?.shouldWalk(H,Z)?K(B,_):_());else if(x.shouldWalk(H,Z))K(x,_);else _()}},!0)},V=q;return new Promise((G,W)=>{K(V,(U)=>{if(U)return W(U);G(Y)})})}walkSync(q=this.cwd,J={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q,q=this.cwd;let{withFileTypes:X=!0,follow:Q=!1,filter:$,walkFilter:Z}=J,Y=[];if(!$||$(q))Y.push(X?q:q.fullpath());let H=new Set([q]);for(let K of H){let V=K.readdirSync();for(let G of V){if(!$||$(G))Y.push(X?G:G.fullpath());let W=G;if(G.isSymbolicLink()){if(!(Q&&(W=G.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(H,Z))H.add(W)}}return Y}[Symbol.asyncIterator](){return this.iterate()}iterate(q=this.cwd,J={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q,q=this.cwd;return this.stream(q,J)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(q=this.cwd,J={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q,q=this.cwd;let{withFileTypes:X=!0,follow:Q=!1,filter:$,walkFilter:Z}=J;if(!$||$(q))yield X?q:q.fullpath();let Y=new Set([q]);for(let H of Y){let K=H.readdirSync();for(let V of K){if(!$||$(V))yield X?V:V.fullpath();let G=V;if(V.isSymbolicLink()){if(!(Q&&(G=V.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(Y,Z))Y.add(G)}}}stream(q=this.cwd,J={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q,q=this.cwd;let{withFileTypes:X=!0,follow:Q=!1,filter:$,walkFilter:Z}=J,Y=new a0({objectMode:!0});if(!$||$(q))Y.write(X?q:q.fullpath());let H=new Set,K=[q],V=0,G=()=>{let W=!1;while(!W){let U=K.shift();if(!U){if(V===0)Y.end();return}V++,H.add(U);let z=(_,x,B=!1)=>{if(_)return Y.emit("error",_);if(Q&&!B){let j=[];for(let R of x)if(R.isSymbolicLink())j.push(R.realpath().then((M)=>M?.isUnknown()?M.lstat():M));if(j.length){Promise.all(j).then(()=>z(null,x,!0));return}}for(let j of x)if(j&&(!$||$(j))){if(!Y.write(X?j:j.fullpath()))W=!0}V--;for(let j of x){let R=j.realpathCached()||j;if(R.shouldWalk(H,Z))K.push(R)}if(W&&!Y.flowing)Y.once("drain",G);else if(!L)G()},L=!0;U.readdirCB(z,!0),L=!1}};return G(),Y}streamSync(q=this.cwd,J={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof l))J=q,q=this.cwd;let{withFileTypes:X=!0,follow:Q=!1,filter:$,walkFilter:Z}=J,Y=new a0({objectMode:!0}),H=new Set;if(!$||$(q))Y.write(X?q:q.fullpath());let K=[q],V=0,G=()=>{let W=!1;while(!W){let U=K.shift();if(!U){if(V===0)Y.end();return}V++,H.add(U);let z=U.readdirSync();for(let L of z)if(!$||$(L)){if(!Y.write(X?L:L.fullpath()))W=!0}V--;for(let L of z){let _=L;if(L.isSymbolicLink()){if(!(Q&&(_=L.realpathSync())))continue;if(_.isUnknown())_.lstatSync()}if(_.shouldWalk(H,Z))K.push(_)}}if(W&&!Y.flowing)Y.once("drain",G)};return G(),Y}chdir(q=this.cwd){let J=this.cwd;this.cwd=typeof q==="string"?this.cwd.resolve(q):q,this.cwd[M7](J)}}class p6 extends b8{sep="\\";constructor(q=process.cwd(),J={}){let{nocase:X=!0}=J;super(q,S8,"\\",{...J,nocase:X});this.nocase=X;for(let Q=this.cwd;Q;Q=Q.parent)Q.nocase=this.nocase}parseRootPath(q){return S8.parse(q).root.toUpperCase()}newRoot(q){return new E2(this.rootPath,_0,void 0,this.roots,this.nocase,this.childrenCache(),{fs:q})}isAbsolute(q){return q.startsWith("/")||q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(q)}}class n6 extends b8{sep="/";constructor(q=process.cwd(),J={}){let{nocase:X=!1}=J;super(q,iZ,"/",{...J,nocase:X});this.nocase=X}parseRootPath(q){return"/"}newRoot(q){return new y2(this.rootPath,_0,void 0,this.roots,this.nocase,this.childrenCache(),{fs:q})}isAbsolute(q){return q.startsWith("/")}}class S2 extends n6{constructor(q=process.cwd(),J={}){let{nocase:X=!0}=J;super(q,{...J,nocase:X})}}var ax=process.platform==="win32"?E2:y2,C7=process.platform==="win32"?p6:process.platform==="darwin"?S2:n6;var VY=(q)=>q.length>=1,GY=(q)=>q.length>=1;class G6{#q;#X;#J;length;#Q;#Z;#V;#U;#W;#H;#_=!0;constructor(q,J,X,Q){if(!VY(q))throw TypeError("empty pattern list");if(!GY(J))throw TypeError("empty glob list");if(J.length!==q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=q.length,X<0||X>=this.length)throw TypeError("index out of range");if(this.#q=q,this.#X=J,this.#J=X,this.#Q=Q,this.#J===0){if(this.isUNC()){let[$,Z,Y,H,...K]=this.#q,[V,G,W,U,...z]=this.#X;if(K[0]==="")K.shift(),z.shift();let L=[$,Z,Y,H,""].join("/"),_=[V,G,W,U,""].join("/");this.#q=[L,...K],this.#X=[_,...z],this.length=this.#q.length}else if(this.isDrive()||this.isAbsolute()){let[$,...Z]=this.#q,[Y,...H]=this.#X;if(Z[0]==="")Z.shift(),H.shift();let K=$+"/",V=Y+"/";this.#q=[K,...Z],this.#X=[V,...H],this.length=this.#q.length}}}pattern(){return this.#q[this.#J]}isString(){return typeof this.#q[this.#J]==="string"}isGlobstar(){return this.#q[this.#J]===b}isRegExp(){return this.#q[this.#J]instanceof RegExp}globString(){return this.#V=this.#V||(this.#J===0?this.isAbsolute()?this.#X[0]+this.#X.slice(1).join("/"):this.#X.join("/"):this.#X.slice(this.#J).join("/"))}hasMore(){return this.length>this.#J+1}rest(){if(this.#Z!==void 0)return this.#Z;if(!this.hasMore())return this.#Z=null;return this.#Z=new G6(this.#q,this.#X,this.#J+1,this.#Q),this.#Z.#H=this.#H,this.#Z.#W=this.#W,this.#Z.#U=this.#U,this.#Z}isUNC(){let q=this.#q;return this.#W!==void 0?this.#W:this.#W=this.#Q==="win32"&&this.#J===0&&q[0]===""&&q[1]===""&&typeof q[2]==="string"&&!!q[2]&&typeof q[3]==="string"&&!!q[3]}isDrive(){let q=this.#q;return this.#U!==void 0?this.#U:this.#U=this.#Q==="win32"&&this.#J===0&&this.length>1&&typeof q[0]==="string"&&/^[a-z]:$/i.test(q[0])}isAbsolute(){let q=this.#q;return this.#H!==void 0?this.#H:this.#H=q[0]===""&&q.length>1||this.isDrive()||this.isUNC()}root(){let q=this.#q[0];return typeof q==="string"&&this.isAbsolute()&&this.#J===0?q:""}checkFollowGlobstar(){return!(this.#J===0||!this.isGlobstar()||!this.#_)}markFollowGlobstar(){if(this.#J===0||!this.isGlobstar()||!this.#_)return!1;return this.#_=!1,!0}}var WY=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class i6{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(q,{nobrace:J,nocase:X,noext:Q,noglobstar:$,platform:Z=WY}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=Z,this.mmopts={dot:!0,nobrace:J,nocase:X,noext:Q,noglobstar:$,optimizationLevel:2,platform:Z,nocomment:!0,nonegate:!0};for(let Y of q)this.add(Y)}add(q){let J=new e(q,this.mmopts);for(let X=0;X<J.set.length;X++){let Q=J.set[X],$=J.globParts[X];if(!Q||!$)throw Error("invalid pattern object");while(Q[0]==="."&&$[0]===".")Q.shift(),$.shift();let Z=new G6(Q,$,0,this.platform),Y=new e(Z.globString(),this.mmopts),H=$[$.length-1]==="**",K=Z.isAbsolute();if(K)this.absolute.push(Y);else this.relative.push(Y);if(H)if(K)this.absoluteChildren.push(Y);else this.relativeChildren.push(Y)}}ignored(q){let J=q.fullpath(),X=`${J}/`,Q=q.relative()||".",$=`${Q}/`;for(let Z of this.relative)if(Z.match(Q)||Z.match($))return!0;for(let Z of this.absolute)if(Z.match(J)||Z.match(X))return!0;return!1}childrenIgnored(q){let J=q.fullpath()+"/",X=(q.relative()||".")+"/";for(let Q of this.relativeChildren)if(Q.match(X))return!0;for(let Q of this.absoluteChildren)if(Q.match(J))return!0;return!1}}class g8{store;constructor(q=new Map){this.store=q}copy(){return new g8(new Map(this.store))}hasWalked(q,J){return this.store.get(q.fullpath())?.has(J.globString())}storeWalked(q,J){let X=q.fullpath(),Q=this.store.get(X);if(Q)Q.add(J.globString());else this.store.set(X,new Set([J.globString()]))}}class k7{store=new Map;add(q,J,X){let Q=(J?2:0)|(X?1:0),$=this.store.get(q);this.store.set(q,$===void 0?Q:Q&$)}entries(){return[...this.store.entries()].map(([q,J])=>[q,!!(J&2),!!(J&1)])}}class T7{store=new Map;add(q,J){if(!q.canReaddir())return;let X=this.store.get(q);if(X){if(!X.find((Q)=>Q.globString()===J.globString()))X.push(J)}else this.store.set(q,[J])}get(q){let J=this.store.get(q);if(!J)throw Error("attempting to walk unknown path");return J}entries(){return this.keys().map((q)=>[q,this.store.get(q)])}keys(){return[...this.store.keys()].filter((q)=>q.canReaddir())}}class a6{hasWalkedCache;matches=new k7;subwalks=new T7;patterns;follow;dot;opts;constructor(q,J){this.opts=q,this.follow=!!q.follow,this.dot=!!q.dot,this.hasWalkedCache=J?J.copy():new g8}processPatterns(q,J){this.patterns=J;let X=J.map((Q)=>[q,Q]);for(let[Q,$]of X){this.hasWalkedCache.storeWalked(Q,$);let Z=$.root(),Y=$.isAbsolute()&&this.opts.absolute!==!1;if(Z){Q=Q.resolve(Z==="/"&&this.opts.root!==void 0?this.opts.root:Z);let G=$.rest();if(!G){this.matches.add(Q,!0,!1);continue}else $=G}if(Q.isENOENT())continue;let H,K,V=!1;while(typeof(H=$.pattern())==="string"&&(K=$.rest()))Q=Q.resolve(H),$=K,V=!0;if(H=$.pattern(),K=$.rest(),V){if(this.hasWalkedCache.hasWalked(Q,$))continue;this.hasWalkedCache.storeWalked(Q,$)}if(typeof H==="string"){let G=H===".."||H===""||H===".";this.matches.add(Q.resolve(H),Y,G);continue}else if(H===b){if(!Q.isSymbolicLink()||this.follow||$.checkFollowGlobstar())this.subwalks.add(Q,$);let G=K?.pattern(),W=K?.rest();if(!K||(G===""||G===".")&&!W)this.matches.add(Q,Y,G===""||G===".");else if(G===".."){let U=Q.parent||Q;if(!W)this.matches.add(U,Y,!0);else if(!this.hasWalkedCache.hasWalked(U,W))this.subwalks.add(U,W)}}else if(H instanceof RegExp)this.subwalks.add(Q,$)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a6(this.opts,this.hasWalkedCache)}filterEntries(q,J){let X=this.subwalks.get(q),Q=this.child();for(let $ of J)for(let Z of X){let Y=Z.isAbsolute(),H=Z.pattern(),K=Z.rest();if(H===b)Q.testGlobstar($,Z,K,Y);else if(H instanceof RegExp)Q.testRegExp($,H,K,Y);else Q.testString($,H,K,Y)}return Q}testGlobstar(q,J,X,Q){if(this.dot||!q.name.startsWith(".")){if(!J.hasMore())this.matches.add(q,Q,!1);if(q.canReaddir()){if(this.follow||!q.isSymbolicLink())this.subwalks.add(q,J);else if(q.isSymbolicLink()){if(X&&J.checkFollowGlobstar())this.subwalks.add(q,X);else if(J.markFollowGlobstar())this.subwalks.add(q,J)}}}if(X){let $=X.pattern();if(typeof $==="string"&&$!==".."&&$!==""&&$!==".")this.testString(q,$,X.rest(),Q);else if($===".."){let Z=q.parent||q;this.subwalks.add(Z,X)}else if($ instanceof RegExp)this.testRegExp(q,$,X.rest(),Q)}}testRegExp(q,J,X,Q){if(!J.test(q.name))return;if(!X)this.matches.add(q,Q,!1);else this.subwalks.add(q,X)}testString(q,J,X,Q){if(!q.isNamed(J))return;if(!X)this.matches.add(q,Q,!1);else this.subwalks.add(q,X)}}var UY=(q,J)=>typeof q==="string"?new i6([q],J):Array.isArray(q)?new i6(q,J):q;class f8{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#q=[];#X;#J;signal;maxDepth;includeChildMatches;constructor(q,J,X){if(this.patterns=q,this.path=J,this.opts=X,this.#J=!X.posix&&X.platform==="win32"?"\\":"/",this.includeChildMatches=X.includeChildMatches!==!1,X.ignore||!this.includeChildMatches){if(this.#X=UY(X.ignore??[],X),!this.includeChildMatches&&typeof this.#X.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=X.maxDepth||1/0,X.signal)this.signal=X.signal,this.signal.addEventListener("abort",()=>{this.#q.length=0})}#Q(q){return this.seen.has(q)||!!this.#X?.ignored?.(q)}#Z(q){return!!this.#X?.childrenIgnored?.(q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let q=void 0;while(!this.paused&&(q=this.#q.shift()))q()}onResume(q){if(this.signal?.aborted)return;if(!this.paused)q();else this.#q.push(q)}async matchCheck(q,J){if(J&&this.opts.nodir)return;let X;if(this.opts.realpath){if(X=q.realpathCached()||await q.realpath(),!X)return;q=X}let $=q.isUnknown()||this.opts.stat?await q.lstat():q;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let Z=await $.realpath();if(Z&&(Z.isUnknown()||this.opts.stat))await Z.lstat()}return this.matchCheckTest($,J)}matchCheckTest(q,J){return q&&(this.maxDepth===1/0||q.depth()<=this.maxDepth)&&(!J||q.canReaddir())&&(!this.opts.nodir||!q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!q.isSymbolicLink()||!q.realpathCached()?.isDirectory())&&!this.#Q(q)?q:void 0}matchCheckSync(q,J){if(J&&this.opts.nodir)return;let X;if(this.opts.realpath){if(X=q.realpathCached()||q.realpathSync(),!X)return;q=X}let $=q.isUnknown()||this.opts.stat?q.lstatSync():q;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let Z=$.realpathSync();if(Z&&(Z?.isUnknown()||this.opts.stat))Z.lstatSync()}return this.matchCheckTest($,J)}matchFinish(q,J){if(this.#Q(q))return;if(!this.includeChildMatches&&this.#X?.add){let $=`${q.relativePosix()}/**`;this.#X.add($)}let X=this.opts.absolute===void 0?J:this.opts.absolute;this.seen.add(q);let Q=this.opts.mark&&q.isDirectory()?this.#J:"";if(this.opts.withFileTypes)this.matchEmit(q);else if(X){let $=this.opts.posix?q.fullpathPosix():q.fullpath();this.matchEmit($+Q)}else{let $=this.opts.posix?q.relativePosix():q.relative(),Z=this.opts.dotRelative&&!$.startsWith(".."+this.#J)?"."+this.#J:"";this.matchEmit(!$?"."+Q:Z+$+Q)}}async match(q,J,X){let Q=await this.matchCheck(q,X);if(Q)this.matchFinish(Q,J)}matchSync(q,J,X){let Q=this.matchCheckSync(q,X);if(Q)this.matchFinish(Q,J)}walkCB(q,J,X){if(this.signal?.aborted)X();this.walkCB2(q,J,new a6(this.opts),X)}walkCB2(q,J,X,Q){if(this.#Z(q))return Q();if(this.signal?.aborted)Q();if(this.paused){this.onResume(()=>this.walkCB2(q,J,X,Q));return}X.processPatterns(q,J);let $=1,Z=()=>{if(--$===0)Q()};for(let[Y,H,K]of X.matches.entries()){if(this.#Q(Y))continue;$++,this.match(Y,H,K).then(()=>Z())}for(let Y of X.subwalkTargets()){if(this.maxDepth!==1/0&&Y.depth()>=this.maxDepth)continue;$++;let H=Y.readdirCached();if(Y.calledReaddir())this.walkCB3(Y,H,X,Z);else Y.readdirCB((K,V)=>this.walkCB3(Y,V,X,Z),!0)}Z()}walkCB3(q,J,X,Q){X=X.filterEntries(q,J);let $=1,Z=()=>{if(--$===0)Q()};for(let[Y,H,K]of X.matches.entries()){if(this.#Q(Y))continue;$++,this.match(Y,H,K).then(()=>Z())}for(let[Y,H]of X.subwalks.entries())$++,this.walkCB2(Y,H,X.child(),Z);Z()}walkCBSync(q,J,X){if(this.signal?.aborted)X();this.walkCB2Sync(q,J,new a6(this.opts),X)}walkCB2Sync(q,J,X,Q){if(this.#Z(q))return Q();if(this.signal?.aborted)Q();if(this.paused){this.onResume(()=>this.walkCB2Sync(q,J,X,Q));return}X.processPatterns(q,J);let $=1,Z=()=>{if(--$===0)Q()};for(let[Y,H,K]of X.matches.entries()){if(this.#Q(Y))continue;this.matchSync(Y,H,K)}for(let Y of X.subwalkTargets()){if(this.maxDepth!==1/0&&Y.depth()>=this.maxDepth)continue;$++;let H=Y.readdirSync();this.walkCB3Sync(Y,H,X,Z)}Z()}walkCB3Sync(q,J,X,Q){X=X.filterEntries(q,J);let $=1,Z=()=>{if(--$===0)Q()};for(let[Y,H,K]of X.matches.entries()){if(this.#Q(Y))continue;this.matchSync(Y,H,K)}for(let[Y,H]of X.subwalks.entries())$++,this.walkCB2Sync(Y,H,X.child(),Z);Z()}}class h2 extends f8{matches=new Set;constructor(q,J,X){super(q,J,X)}matchEmit(q){this.matches.add(q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((q,J)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)J(this.signal.reason);else q(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class b2 extends f8{results;constructor(q,J,X){super(q,J,X);this.results=new a0({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(q){if(this.results.write(q),!this.results.flowing)this.pause()}stream(){let q=this.path;if(q.isUnknown())q.lstat().then(()=>{this.walkCB(q,this.patterns,()=>this.results.end())});else this.walkCB(q,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var _Y=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class L0{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(q,J){if(!J)throw TypeError("glob options required");if(this.withFileTypes=!!J.withFileTypes,this.signal=J.signal,this.follow=!!J.follow,this.dot=!!J.dot,this.dotRelative=!!J.dotRelative,this.nodir=!!J.nodir,this.mark=!!J.mark,!J.cwd)this.cwd="";else if(J.cwd instanceof URL||J.cwd.startsWith("file://"))J.cwd=zY(J.cwd);if(this.cwd=J.cwd||"",this.root=J.root,this.magicalBraces=!!J.magicalBraces,this.nobrace=!!J.nobrace,this.noext=!!J.noext,this.realpath=!!J.realpath,this.absolute=J.absolute,this.includeChildMatches=J.includeChildMatches!==!1,this.noglobstar=!!J.noglobstar,this.matchBase=!!J.matchBase,this.maxDepth=typeof J.maxDepth==="number"?J.maxDepth:1/0,this.stat=!!J.stat,this.ignore=J.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof q==="string")q=[q];if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)q=q.map((H)=>H.replace(/\\/g,"/"));if(this.matchBase){if(J.noglobstar)throw TypeError("base matching requires globstar");q=q.map((H)=>H.includes("/")?H:`./**/${H}`)}if(this.pattern=q,this.platform=J.platform||_Y,this.opts={...J,platform:this.platform},J.scurry){if(this.scurry=J.scurry,J.nocase!==void 0&&J.nocase!==J.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let H=J.platform==="win32"?p6:J.platform==="darwin"?S2:J.platform?n6:C7;this.scurry=new H(this.cwd,{nocase:J.nocase,fs:J.fs})}this.nocase=this.scurry.nocase;let X=this.platform==="darwin"||this.platform==="win32",Q={...J,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:X,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},$=this.pattern.map((H)=>new e(H,Q)),[Z,Y]=$.reduce((H,K)=>{return H[0].push(...K.set),H[1].push(...K.globParts),H},[[],[]]);this.patterns=Z.map((H,K)=>{let V=Y[K];if(!V)throw Error("invalid pattern object");return new G6(H,V,0,this.platform)})}async walk(){return[...await new h2(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new h2(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new b2(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new b2(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var u8=(q,J={})=>{if(!Array.isArray(q))q=[q];for(let X of q)if(new e(X,J).hasMagic())return!0;return!1};function f2(q,J={}){return new L0(q,J).streamSync()}function P7(q,J={}){return new L0(q,J).stream()}function A7(q,J={}){return new L0(q,J).walkSync()}async function w7(q,J={}){return new L0(q,J).walk()}function u2(q,J={}){return new L0(q,J).iterateSync()}function D7(q,J={}){return new L0(q,J).iterate()}var LY=f2,BY=Object.assign(P7,{sync:f2}),xY=u2,jY=Object.assign(D7,{sync:u2}),RY=Object.assign(A7,{stream:f2,iterate:u2}),g2=Object.assign(w7,{glob:w7,globSync:A7,sync:RY,globStream:P7,stream:BY,globStreamSync:f2,streamSync:LY,globIterate:D7,iterate:jY,globIterateSync:u2,iterateSync:xY,Glob:L0,hasMagic:u8,escape:H6,unescape:$0});g2.glob=g2;import{resolve as FY}from"path";var MY=C.object({description:C.string().optional().describe("what you want to do"),pattern:C.string().describe("The glob pattern to match files against"),path:C.string().optional().describe('The directory to search in. Can be absolute or relative to cwd. If not specified, the current working directory (cwd) will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.')}),I7=o(async({pattern:q,path:J},X)=>{if(!X.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let Q=J?FY(X.state.cwd,J):X.state.cwd,$=await g2(q,{ignore:["node_modules",".git","dist","build",".next",".turbo","coverage",".nyc_output","temp",".cache","vendor","venv","__pycache__","*.pyc","target","out",".output"],cwd:Q,absolute:!0});if($.length===0)return"No files found.";return $.join(`
|
|
31
|
-
`)},{name:"glob_files",description:`- Fast file pattern matching tool that works with any codebase size
|
|
32
|
-
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
33
|
-
- Returns matching file paths sorted by modification time
|
|
34
|
-
- Use this tool when you need to find files by name patterns
|
|
35
|
-
- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
|
|
36
|
-
- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.`,schema:MY});function D(q){if(typeof q!=="object"||q===null)return!1;let J=Object.getPrototypeOf(q);return(J===null||J===Object.prototype||Object.getPrototypeOf(J)===null)&&!(Symbol.toStringTag in q)&&!(Symbol.iterator in q)}import{fileURLToPath as CY}from"node:url";var W6=(q,J)=>{let X=d8(kY(q));if(typeof X!=="string")throw TypeError(`${J} must be a string or a file URL: ${X}.`);return X},kY=(q)=>m8(q)?q.toString():q,m8=(q)=>typeof q!=="string"&&q&&Object.getPrototypeOf(q)===String.prototype,d8=(q)=>q instanceof URL?CY(q):q;var m2=(q,J=[],X={})=>{let Q=W6(q,"First argument"),[$,Z]=D(J)?[[],J]:[J,X];if(!Array.isArray($))throw TypeError(`Second argument must be either an array of arguments or an options object: ${$}`);if($.some((K)=>typeof K==="object"&&K!==null))throw TypeError(`Second argument must be an array of strings: ${$}`);let Y=$.map(String),H=Y.find((K)=>K.includes("\x00"));if(H!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${H}`);if(!D(Z))throw TypeError(`Last argument must be an options object: ${Z}`);return[Q,Y,Z]};import{ChildProcess as OY}from"node:child_process";import{StringDecoder as TY}from"node:string_decoder";var{toString:O7}=Object.prototype,v7=(q)=>O7.call(q)==="[object ArrayBuffer]",O=(q)=>O7.call(q)==="[object Uint8Array]",w0=(q)=>new Uint8Array(q.buffer,q.byteOffset,q.byteLength),wY=new TextEncoder,N7=(q)=>wY.encode(q),PY=new TextDecoder,d2=(q)=>PY.decode(q),E7=(q,J)=>{return AY(q,J).join("")},AY=(q,J)=>{if(J==="utf8"&&q.every((Z)=>typeof Z==="string"))return q;let X=new TY(J),Q=q.map((Z)=>typeof Z==="string"?N7(Z):Z).map((Z)=>X.write(Z)),$=X.end();return $===""?Q:[...Q,$]},o6=(q)=>{if(q.length===1&&O(q[0]))return q[0];return c8(DY(q))},DY=(q)=>q.map((J)=>typeof J==="string"?N7(J):J),c8=(q)=>{let J=new Uint8Array(IY(q)),X=0;for(let Q of q)J.set(Q,X),X+=Q.length;return J},IY=(q)=>{let J=0;for(let X of q)J+=X.length;return J};var b7=(q)=>Array.isArray(q)&&Array.isArray(q.raw),g7=(q,J)=>{let X=[];for(let[Z,Y]of q.entries())X=vY({templates:q,expressions:J,tokens:X,index:Z,template:Y});if(X.length===0)throw TypeError("Template script must not be empty");let[Q,...$]=X;return[Q,$,{}]},vY=({templates:q,expressions:J,tokens:X,index:Q,template:$})=>{if($===void 0)throw TypeError(`Invalid backslash sequence: ${q.raw[Q]}`);let{nextTokens:Z,leadingWhitespaces:Y,trailingWhitespaces:H}=NY($,q.raw[Q]),K=S7(X,Z,Y);if(Q===J.length)return K;let V=J[Q],G=Array.isArray(V)?V.map((W)=>h7(W)):[h7(V)];return S7(K,G,H)},NY=(q,J)=>{if(J.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let X=[],Q=0,$=y7.has(J[0]);for(let Y=0,H=0;Y<q.length;Y+=1,H+=1){let K=J[H];if(y7.has(K)){if(Q!==Y)X.push(q.slice(Q,Y));Q=Y+1}else if(K==="\\"){let V=J[H+1];if(V===`
|
|
37
|
-
`)Y-=1,H+=1;else if(V==="u"&&J[H+2]==="{")H=J.indexOf("}",H+3);else H+=EY[V]??1}}let Z=Q===q.length;if(!Z)X.push(q.slice(Q));return{nextTokens:X,leadingWhitespaces:$,trailingWhitespaces:Z}},y7=new Set([" ","\t","\r",`
|
|
38
|
-
`]),EY={x:3,u:5},S7=(q,J,X)=>X||q.length===0||J.length===0?[...q,...J]:[...q.slice(0,-1),`${q.at(-1)}${J[0]}`,...J.slice(1)],h7=(q)=>{let J=typeof q;if(J==="string")return q;if(J==="number")return String(q);if(D(q)&&(("stdout"in q)||("isMaxBuffer"in q)))return yY(q);if(q instanceof OY||Object.prototype.toString.call(q)==="[object Promise]")throw TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.");throw TypeError(`Unexpected "${J}" in template expression`)},yY=({stdout:q})=>{if(typeof q==="string")return q;if(O(q))return d2(q);if(q===void 0)throw TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`);throw TypeError(`Unexpected "${typeof q}" stdout in template expression`)};import{spawnSync as zW}from"node:child_process";import{debuglog as SY}from"node:util";import l8 from"node:process";var H0=(q)=>c2.includes(q),c2=[l8.stdin,l8.stdout,l8.stderr],X0=["stdin","stdout","stderr"],l2=(q)=>X0[q]??`stdio[${q}]`;var u7=(q)=>{let J={...q};for(let X of i8)J[X]=p8(q,X);return J},p8=(q,J)=>{let X=Array.from({length:hY(q)+1}),Q=bY(q[J],X,J);return dY(Q,J)},hY=({stdio:q})=>Array.isArray(q)?Math.max(q.length,X0.length):X0.length,bY=(q,J,X)=>D(q)?gY(q,J,X):J.fill(q),gY=(q,J,X)=>{for(let Q of Object.keys(q).sort(fY))for(let $ of uY(Q,X,J))J[$]=q[Q];return J},fY=(q,J)=>f7(q)<f7(J)?1:-1,f7=(q)=>{if(q==="stdout"||q==="stderr")return 0;return q==="all"?2:1},uY=(q,J,X)=>{if(q==="ipc")return[X.length-1];let Q=n8(q);if(Q===void 0||Q===0)throw TypeError(`"${J}.${q}" is invalid.
|
|
39
|
-
It must be "${J}.stdout", "${J}.stderr", "${J}.all", "${J}.ipc", or "${J}.fd3", "${J}.fd4" (and so on).`);if(Q>=X.length)throw TypeError(`"${J}.${q}" is invalid: that file descriptor does not exist.
|
|
40
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);return Q==="all"?[1,2]:[Q]},n8=(q)=>{if(q==="all")return q;if(X0.includes(q))return X0.indexOf(q);let J=mY.exec(q);if(J!==null)return Number(J[1])},mY=/^fd(\d+)$/,dY=(q,J)=>q.map((X)=>X===void 0?lY[J]:X),cY=SY("execa").enabled?"full":"none",lY={lines:!1,buffer:!0,maxBuffer:1e8,verbose:cY,stripFinalNewline:!0},i8=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],P0=(q,J)=>J==="ipc"?q.at(-1):q[J];var U6=({verbose:q},J)=>a8(q,J)!=="none",z6=({verbose:q},J)=>!["none","short"].includes(a8(q,J)),m7=({verbose:q},J)=>{let X=a8(q,J);return p2(X)?X:void 0},a8=(q,J)=>J===void 0?pY(q):P0(q,J),pY=(q)=>q.find((J)=>p2(J))??n2.findLast((J)=>q.includes(J)),p2=(q)=>typeof q==="function",n2=["none","short","full"];import{inspect as zH}from"node:util";import{platform as nY}from"node:process";import{stripVTControlCharacters as iY}from"node:util";var d7=(q,J)=>{let X=[q,...J],Q=X.join(" "),$=X.map((Z)=>eY(c7(Z))).join(" ");return{command:Q,escapedCommand:$}},r6=(q)=>iY(q).split(`
|
|
41
|
-
`).map((J)=>c7(J)).join(`
|
|
42
|
-
`),c7=(q)=>q.replaceAll(rY,(J)=>aY(J)),aY=(q)=>{let J=sY[q];if(J!==void 0)return J;let X=q.codePointAt(0),Q=X.toString(16);return X<=tY?`\\u${Q.padStart(4,"0")}`:`\\U${Q}`},oY=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},rY=oY(),sY={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},tY=65535,eY=(q)=>{if(qH.test(q))return q;return nY==="win32"?`"${q.replaceAll('"','""')}"`:`'${q.replaceAll("'","'\\''")}'`},qH=/^[\w./-]+$/;import l7 from"node:process";function o8(){let{env:q}=l7,{TERM:J,TERM_PROGRAM:X}=q;if(l7.platform!=="win32")return J!=="linux";return Boolean(q.WT_SESSION)||Boolean(q.TERMINUS_SUBLIME)||q.ConEmuTask==="{cmd::Cmder}"||X==="Terminus-Sublime"||X==="vscode"||J==="xterm-256color"||J==="alacritty"||J==="rxvt-unicode"||J==="rxvt-unicode-256color"||q.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var p7={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},n7={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},JH={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},XH={...p7,...n7},QH={...p7,...JH},$H=o8(),ZH=$H?XH:QH,i2=ZH,JR=Object.entries(n7);import YH from"node:tty";var HH=YH?.WriteStream?.prototype?.hasColors?.()??!1,T=(q,J)=>{if(!HH)return($)=>$;let X=`\x1B[${q}m`,Q=`\x1B[${J}m`;return($)=>{let Z=$+"",Y=Z.indexOf(Q);if(Y===-1)return X+Z+Q;let H=X,K=0,G=(J===22?Q:"")+X;while(Y!==-1)H+=Z.slice(K,Y)+G,K=Y+Q.length,Y=Z.indexOf(Q,K);return H+=Z.slice(K)+Q,H}},$R=T(0,0),i7=T(1,22),ZR=T(2,22),YR=T(3,23),HR=T(4,24),KR=T(53,55),VR=T(7,27),GR=T(8,28),WR=T(9,29),UR=T(30,39),zR=T(31,39),_R=T(32,39),LR=T(33,39),BR=T(34,39),xR=T(35,39),jR=T(36,39),RR=T(37,39),a2=T(90,39),FR=T(40,49),MR=T(41,49),CR=T(42,49),kR=T(43,49),TR=T(44,49),wR=T(45,49),PR=T(46,49),AR=T(47,49),DR=T(100,49),a7=T(91,39),IR=T(92,39),o7=T(93,39),OR=T(94,39),vR=T(95,39),NR=T(96,39),ER=T(97,39),yR=T(101,49),SR=T(102,49),hR=T(103,49),bR=T(104,49),gR=T(105,49),fR=T(106,49),uR=T(107,49);var t7=({type:q,message:J,timestamp:X,piped:Q,commandId:$,result:{failed:Z=!1}={},options:{reject:Y=!0}})=>{let H=KH(X),K=VH[q]({failed:Z,reject:Y,piped:Q}),V=GH[q]({reject:Y});return`${a2(`[${H}]`)} ${a2(`[${$}]`)} ${V(K)} ${V(J)}`},KH=(q)=>`${o2(q.getHours(),2)}:${o2(q.getMinutes(),2)}:${o2(q.getSeconds(),2)}.${o2(q.getMilliseconds(),3)}`,o2=(q,J)=>String(q).padStart(J,"0"),r7=({failed:q,reject:J})=>{if(!q)return i2.tick;return J?i2.cross:i2.warning},VH={command:({piped:q})=>q?"|":"$",output:()=>" ",ipc:()=>"*",error:r7,duration:r7},s7=(q)=>q,GH={command:()=>i7,output:()=>s7,ipc:()=>s7,error:({reject:q})=>q?a7:o7,duration:()=>a2};var e7=(q,J,X)=>{let Q=m7(J,X);return q.map(({verboseLine:$,verboseObject:Z})=>WH($,Z,Q)).filter(($)=>$!==void 0).map(($)=>UH($)).join("")},WH=(q,J,X)=>{if(X===void 0)return q;let Q=X(q,J);if(typeof Q==="string")return Q},UH=(q)=>q.endsWith(`
|
|
43
|
-
`)?q:`${q}
|
|
44
|
-
`;var B0=({type:q,verboseMessage:J,fdNumber:X,verboseInfo:Q,result:$})=>{let Z=_H({type:q,result:$,verboseInfo:Q}),Y=LH(J,Z),H=e7(Y,Q,X);if(H!=="")console.warn(H.slice(0,-1))},_H=({type:q,result:J,verboseInfo:{escapedCommand:X,commandId:Q,rawOptions:{piped:$=!1,...Z}}})=>({type:q,escapedCommand:X,commandId:`${Q}`,timestamp:new Date,piped:$,result:J,options:Z}),LH=(q,J)=>q.split(`
|
|
45
|
-
`).map((X)=>BH({...J,message:X})),BH=(q)=>{return{verboseLine:t7(q),verboseObject:q}},r2=(q)=>{let J=typeof q==="string"?q:zH(q);return r6(J).replaceAll("\t"," ".repeat(xH))},xH=2;var q5=(q,J)=>{if(!U6(J))return;B0({type:"command",verboseMessage:q,verboseInfo:J})};var J5=(q,J,X)=>{FH(q);let Q=jH(q);return{verbose:q,escapedCommand:J,commandId:Q,rawOptions:X}},jH=(q)=>U6({verbose:q})?RH++:void 0,RH=0n,FH=(q)=>{for(let J of q){if(J===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(J===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!n2.includes(J)&&!p2(J)){let X=n2.map((Q)=>`'${Q}'`).join(", ");throw TypeError(`The "verbose" option must not be ${J}. Allowed values are: ${X} or a function.`)}}};import{hrtime as X5}from"node:process";var s2=()=>X5.bigint(),r8=(q)=>Number(X5.bigint()-q)/1e6;var t2=(q,J,X)=>{let Q=s2(),{command:$,escapedCommand:Z}=d7(q,J),Y=p8(X,"verbose"),H=J5(Y,Z,{...X});return q5(Z,H),{command:$,escapedCommand:Z,startTime:Q,verboseInfo:H}};var zq=Wq(vK(),1);import NK from"node:path";import Uq from"node:process";import J1 from"node:process";import r0 from"node:path";function e2(q={}){let{env:J=process.env,platform:X=process.platform}=q;if(X!=="win32")return"PATH";return Object.keys(J).reverse().find((Q)=>Q.toUpperCase()==="PATH")||"Path"}import{promisify as MH}from"node:util";import{execFile as CH,execFileSync as _F}from"node:child_process";import Q5 from"node:path";import{fileURLToPath as kH}from"node:url";var xF=MH(CH);function q1(q){return q instanceof URL?kH(q):q}function $5(q){return{*[Symbol.iterator](){let J=Q5.resolve(q1(q)),X;while(X!==J)yield J,X=J,J=Q5.resolve(J,"..")}}}var TH=({cwd:q=J1.cwd(),path:J=J1.env[e2()],preferLocal:X=!0,execPath:Q=J1.execPath,addExecPath:$=!0}={})=>{let Z=r0.resolve(q1(q)),Y=[],H=J.split(r0.delimiter);if(X)wH(Y,H,Z);if($)PH(Y,H,Q,Z);return J===""||J===r0.delimiter?`${Y.join(r0.delimiter)}${J}`:[...Y,J].join(r0.delimiter)},wH=(q,J,X)=>{for(let Q of $5(X)){let $=r0.join(Q,"node_modules/.bin");if(!J.includes($))q.push($)}},PH=(q,J,X,Q)=>{let $=r0.resolve(Q,q1(X),"..");if(!J.includes($))q.push($)},Z5=({env:q=J1.env,...J}={})=>{q={...q};let X=e2({env:q});return J.path=q[X],q[X]=TH(J),q};import{setTimeout as mH}from"node:timers/promises";var Y5=(q,J,X)=>{let Q=X?Q1:X1,$=q instanceof x0?{}:{cause:q};return new Q(J,$)};class x0 extends Error{}var H5=(q,J)=>{Object.defineProperty(q.prototype,"name",{value:J,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,V5,{value:!0,writable:!1,enumerable:!1,configurable:!1})},K5=(q)=>$1(q)&&(V5 in q),V5=Symbol("isExecaError"),$1=(q)=>Object.prototype.toString.call(q)==="[object Error]";class X1 extends Error{}H5(X1,X1.name);class Q1 extends Error{}H5(Q1,Q1.name);import{constants as s6}from"node:os";import{constants as OH}from"node:os";var G5=()=>{let q=s8-W5+1;return Array.from({length:q},AH)},AH=(q,J)=>({name:`SIGRT${J+1}`,number:W5+J,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),W5=34,s8=64;import{constants as DH}from"node:os";var U5=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var t8=()=>{let q=G5();return[...U5,...q].map(IH)},IH=({name:q,number:J,description:X,action:Q,forced:$=!1,standard:Z})=>{let{signals:{[q]:Y}}=DH,H=Y!==void 0;return{name:q,number:H?Y:J,description:X,supported:H,action:Q,forced:$,standard:Z}};var vH=()=>{let q=t8();return Object.fromEntries(q.map(NH))},NH=({name:q,number:J,description:X,supported:Q,action:$,forced:Z,standard:Y})=>[q,{name:q,number:J,description:X,supported:Q,action:$,forced:Z,standard:Y}],z5=vH(),EH=()=>{let q=t8(),J=s8+1,X=Array.from({length:J},(Q,$)=>yH($,q));return Object.assign({},...X)},yH=(q,J)=>{let X=SH(q,J);if(X===void 0)return{};let{name:Q,description:$,supported:Z,action:Y,forced:H,standard:K}=X;return{[q]:{name:Q,number:q,description:$,supported:Z,action:Y,forced:H,standard:K}}},SH=(q,J)=>{let X=J.find(({name:Q})=>OH.signals[Q]===q);if(X!==void 0)return X;return J.find((Q)=>Q.number===q)},SF=EH();var L5=(q)=>{if(q===0)throw TypeError("Invalid option `killSignal`: 0 cannot be used.");return x5(q,"option `killSignal`")},B5=(q)=>q===0?q:x5(q,"`subprocess.kill()`'s argument"),x5=(q,J)=>{if(Number.isInteger(q))return hH(q,J);if(typeof q==="string")return gH(q,J);throw TypeError(`Invalid ${J} ${String(q)}: it must be a string or an integer.
|
|
46
|
-
${e8()}`)},hH=(q,J)=>{if(_5.has(q))return _5.get(q);throw TypeError(`Invalid ${J} ${q}: this signal integer does not exist.
|
|
47
|
-
${e8()}`)},bH=()=>new Map(Object.entries(s6.signals).reverse().map(([q,J])=>[J,q])),_5=bH(),gH=(q,J)=>{if(q in s6.signals)return q;if(q.toUpperCase()in s6.signals)throw TypeError(`Invalid ${J} '${q}': please rename it to '${q.toUpperCase()}'.`);throw TypeError(`Invalid ${J} '${q}': this signal name does not exist.
|
|
48
|
-
${e8()}`)},e8=()=>`Available signal names: ${fH()}.
|
|
49
|
-
Available signal numbers: ${uH()}.`,fH=()=>Object.keys(s6.signals).sort().map((q)=>`'${q}'`).join(", "),uH=()=>[...new Set(Object.values(s6.signals).sort((q,J)=>q-J))].join(", "),Z1=(q)=>z5[q].description;var j5=(q)=>{if(q===!1)return q;if(q===!0)return dH;if(!Number.isFinite(q)||q<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${q}\` (${typeof q})`);return q},dH=5000,R5=({kill:q,options:{forceKillAfterDelay:J,killSignal:X},onInternalError:Q,context:$,controller:Z},Y,H)=>{let{signal:K,error:V}=cH(Y,H,X);lH(V,Q);let G=q(K);return pH({kill:q,signal:K,forceKillAfterDelay:J,killSignal:X,killResult:G,context:$,controller:Z}),G},cH=(q,J,X)=>{let[Q=X,$]=$1(q)?[void 0,q]:[q,J];if(typeof Q!=="string"&&!Number.isInteger(Q))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(Q)}`);if($!==void 0&&!$1($))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${$}`);return{signal:B5(Q),error:$}},lH=(q,J)=>{if(q!==void 0)J.reject(q)},pH=async({kill:q,signal:J,forceKillAfterDelay:X,killSignal:Q,killResult:$,context:Z,controller:Y})=>{if(J===Q&&$)q3({kill:q,forceKillAfterDelay:X,context:Z,controllerSignal:Y.signal})},q3=async({kill:q,forceKillAfterDelay:J,context:X,controllerSignal:Q})=>{if(J===!1)return;try{if(await mH(J,void 0,{signal:Q}),q("SIGKILL"))X.isForcefullyTerminated??=!0}catch{}};import{once as nH}from"node:events";var Y1=async(q,J)=>{if(!q.aborted)await nH(q,"abort",{signal:J})};var F5=({cancelSignal:q})=>{if(q!==void 0&&Object.prototype.toString.call(q)!=="[object AbortSignal]")throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(q)}`)},M5=({subprocess:q,cancelSignal:J,gracefulCancel:X,context:Q,controller:$})=>J===void 0||X?[]:[iH(q,J,Q,$)],iH=async(q,J,X,{signal:Q})=>{throw await Y1(J,Q),X.terminationReason??="cancel",q.kill(),J.reason};import{scheduler as _K}from"node:timers/promises";import{promisify as WK}from"node:util";var _6=({methodName:q,isSubprocess:J,ipc:X,isConnected:Q})=>{aH(q,J,X),J3(q,J,Q)},aH=(q,J,X)=>{if(!X)throw Error(`${K0(q,J)} can only be used if the \`ipc\` option is \`true\`.`)},J3=(q,J,X)=>{if(!X)throw Error(`${K0(q,J)} cannot be used: the ${S0(J)} has already exited or disconnected.`)},C5=(q)=>{throw Error(`${K0("getOneMessage",q)} could not complete: the ${S0(q)} exited or disconnected.`)},k5=(q)=>{throw Error(`${K0("sendMessage",q)} failed: the ${S0(q)} is sending a message too, instead of listening to incoming messages.
|
|
50
|
-
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
51
|
-
|
|
52
|
-
const [receivedMessage] = await Promise.all([
|
|
53
|
-
${K0("getOneMessage",q)},
|
|
54
|
-
${K0("sendMessage",q,"message, {strict: true}")},
|
|
55
|
-
]);`)},H1=(q,J)=>Error(`${K0("sendMessage",J)} failed when sending an acknowledgment response to the ${S0(J)}.`,{cause:q}),T5=(q)=>{throw Error(`${K0("sendMessage",q)} failed: the ${S0(q)} is not listening to incoming messages.`)},w5=(q)=>{throw Error(`${K0("sendMessage",q)} failed: the ${S0(q)} exited without listening to incoming messages.`)},P5=()=>Error(`\`cancelSignal\` aborted: the ${S0(!0)} disconnected.`),A5=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},D5=({error:q,methodName:J,isSubprocess:X})=>{if(q.code==="EPIPE")throw Error(`${K0(J,X)} cannot be used: the ${S0(X)} is disconnecting.`,{cause:q})},I5=({error:q,methodName:J,isSubprocess:X,message:Q})=>{if(oH(q))throw Error(`${K0(J,X)}'s argument type is invalid: the message cannot be serialized: ${String(Q)}.`,{cause:q})},oH=({code:q,message:J})=>rH.has(q)||sH.some((X)=>J.includes(X)),rH=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),sH=["could not be cloned","circular structure","call stack size exceeded"],K0=(q,J,X="")=>q==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${tH(J)}${q}(${X})`,tH=(q)=>q?"":"subprocess.",S0=(q)=>q?"parent process":"subprocess",L6=(q)=>{if(q.connected)q.disconnect()};var j0=()=>{let q={},J=new Promise((X,Q)=>{Object.assign(q,{resolve:X,reject:Q})});return Object.assign(J,q)};var V1=(q,J="stdin")=>{let{options:Q,fileDescriptors:$}=R0.get(q),Z=O5($,J,!0),Y=q.stdio[Z];if(Y===null)throw TypeError(v5(Z,J,Q,!0));return Y},B6=(q,J="stdout")=>{let{options:Q,fileDescriptors:$}=R0.get(q),Z=O5($,J,!1),Y=Z==="all"?q.all:q.stdio[Z];if(Y===null||Y===void 0)throw TypeError(v5(Z,J,Q,!1));return Y},R0=new WeakMap,O5=(q,J,X)=>{let Q=eH(J,X);return qK(Q,J,X,q),Q},eH=(q,J)=>{let X=n8(q);if(X!==void 0)return X;let{validOptions:Q,defaultValue:$}=J?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw TypeError(`"${t6(J)}" must not be "${q}".
|
|
56
|
-
It must be ${Q} or "fd3", "fd4" (and so on).
|
|
57
|
-
It is optional and defaults to "${$}".`)},qK=(q,J,X,Q)=>{let $=Q[N5(q)];if($===void 0)throw TypeError(`"${t6(X)}" must not be ${J}. That file descriptor does not exist.
|
|
58
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);if($.direction==="input"&&!X)throw TypeError(`"${t6(X)}" must not be ${J}. It must be a readable stream, not writable.`);if($.direction!=="input"&&X)throw TypeError(`"${t6(X)}" must not be ${J}. It must be a writable stream, not readable.`)},v5=(q,J,X,Q)=>{if(q==="all"&&!X.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:$,optionValue:Z}=JK(q,X);return`The "${$}: ${K1(Z)}" option is incompatible with using "${t6(Q)}: ${K1(J)}".
|
|
59
|
-
Please set this option with "pipe" instead.`},JK=(q,{stdin:J,stdout:X,stderr:Q,stdio:$})=>{let Z=N5(q);if(Z===0&&J!==void 0)return{optionName:"stdin",optionValue:J};if(Z===1&&X!==void 0)return{optionName:"stdout",optionValue:X};if(Z===2&&Q!==void 0)return{optionName:"stderr",optionValue:Q};return{optionName:`stdio[${Z}]`,optionValue:$[Z]}},N5=(q)=>q==="all"?1:q,t6=(q)=>q?"to":"from",K1=(q)=>{if(typeof q==="string")return`'${q}'`;return typeof q==="number"?`${q}`:"Stream"};import{once as HK}from"node:events";import{addAbortListener as XK}from"node:events";var s0=(q,J,X)=>{let Q=q.getMaxListeners();if(Q===0||Q===Number.POSITIVE_INFINITY)return;q.setMaxListeners(Q+J),XK(X,()=>{q.setMaxListeners(q.getMaxListeners()-J)})};import{EventEmitter as ZK}from"node:events";import{once as QK}from"node:events";import{scheduler as $K}from"node:timers/promises";var G1=(q,J)=>{if(J)X3(q)},X3=(q)=>{q.refCounted()},W1=(q,J)=>{if(J)Q3(q)},Q3=(q)=>{q.unrefCounted()},E5=(q,J)=>{if(J)Q3(q),Q3(q)},y5=(q,J)=>{if(J)X3(q),X3(q)};var S5=async({anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:Q},$)=>{if(g5($)||u5($))return;if(!U1.has(q))U1.set(q,[]);let Z=U1.get(q);if(Z.push($),Z.length>1)return;while(Z.length>0){await f5(q,Q,$),await $K.yield();let Y=await b5({wrappedMessage:Z[0],anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:Q});Z.shift(),Q.emit("message",Y),Q.emit("message:done")}},h5=async({anyProcess:q,channel:J,isSubprocess:X,ipcEmitter:Q,boundOnMessage:$})=>{$3();let Z=U1.get(q);while(Z?.length>0)await QK(Q,"message:done");q.removeListener("message",$),y5(J,X),Q.connected=!1,Q.emit("disconnect")},U1=new WeakMap;var h0=(q,J,X)=>{if(z1.has(q))return z1.get(q);let Q=new ZK;return Q.connected=!0,z1.set(q,Q),YK({ipcEmitter:Q,anyProcess:q,channel:J,isSubprocess:X}),Q},z1=new WeakMap,YK=({ipcEmitter:q,anyProcess:J,channel:X,isSubprocess:Q})=>{let $=S5.bind(void 0,{anyProcess:J,channel:X,isSubprocess:Q,ipcEmitter:q});J.on("message",$),J.once("disconnect",h5.bind(void 0,{anyProcess:J,channel:X,isSubprocess:Q,ipcEmitter:q,boundOnMessage:$})),E5(X,Q)},_1=(q)=>{let J=z1.get(q);return J===void 0?q.channel!==null:J.connected};var m5=({anyProcess:q,channel:J,isSubprocess:X,message:Q,strict:$})=>{if(!$)return Q;let Z=h0(q,J,X),Y=x1(q,Z);return{id:KK++,type:B1,message:Q,hasListeners:Y}},KK=0n,d5=(q,J)=>{if(J?.type!==B1||J.hasListeners)return;for(let{id:X}of q)if(X!==void 0)L1[X].resolve({isDeadlock:!0,hasListeners:!1})},b5=async({wrappedMessage:q,anyProcess:J,channel:X,isSubprocess:Q,ipcEmitter:$})=>{if(q?.type!==B1||!J.connected)return q;let{id:Z,message:Y}=q,H={id:Z,type:l5,message:x1(J,$)};try{await j1({anyProcess:J,channel:X,isSubprocess:Q,ipc:!0},H)}catch(K){$.emit("strict:error",K)}return Y},g5=(q)=>{if(q?.type!==l5)return!1;let{id:J,message:X}=q;return L1[J]?.resolve({isDeadlock:!1,hasListeners:X}),!0},c5=async(q,J,X)=>{if(q?.type!==B1)return;let Q=j0();L1[q.id]=Q;let $=new AbortController;try{let{isDeadlock:Z,hasListeners:Y}=await Promise.race([Q,VK(J,X,$)]);if(Z)k5(X);if(!Y)T5(X)}finally{$.abort(),delete L1[q.id]}},L1={},VK=async(q,J,{signal:X})=>{s0(q,1,X),await HK(q,"disconnect",{signal:X}),w5(J)},B1="execa:ipc:request",l5="execa:ipc:response";var p5=(q,J,X)=>{if(!e6.has(q))e6.set(q,new Set);let Q=e6.get(q),$=j0(),Z=X?J.id:void 0,Y={onMessageSent:$,id:Z};return Q.add(Y),{outgoingMessages:Q,outgoingMessage:Y}},n5=({outgoingMessages:q,outgoingMessage:J})=>{q.delete(J),J.onMessageSent.resolve()},f5=async(q,J,X)=>{while(!x1(q,J)&&e6.get(q)?.size>0){let Q=[...e6.get(q)];d5(Q,X),await Promise.all(Q.map(({onMessageSent:$})=>$))}},e6=new WeakMap,x1=(q,J)=>J.listenerCount("message")>GK(q),GK=(q)=>R0.has(q)&&!P0(R0.get(q).options.buffer,"ipc")?1:0;var j1=({anyProcess:q,channel:J,isSubprocess:X,ipc:Q},$,{strict:Z=!1}={})=>{return _6({methodName:"sendMessage",isSubprocess:X,ipc:Q,isConnected:q.connected}),UK({anyProcess:q,channel:J,methodName:"sendMessage",isSubprocess:X,message:$,strict:Z})},UK=async({anyProcess:q,channel:J,methodName:X,isSubprocess:Q,message:$,strict:Z})=>{let Y=m5({anyProcess:q,channel:J,isSubprocess:Q,message:$,strict:Z}),H=p5(q,Y,Z);try{await Y3({anyProcess:q,methodName:X,isSubprocess:Q,wrappedMessage:Y,message:$})}catch(K){throw L6(q),K}finally{n5(H)}},Y3=async({anyProcess:q,methodName:J,isSubprocess:X,wrappedMessage:Q,message:$})=>{let Z=zK(q);try{await Promise.all([c5(Q,q,X),Z(Q)])}catch(Y){throw D5({error:Y,methodName:J,isSubprocess:X}),I5({error:Y,methodName:J,isSubprocess:X,message:$}),Y}},zK=(q)=>{if(Z3.has(q))return Z3.get(q);let J=WK(q.send.bind(q));return Z3.set(q,J),J},Z3=new WeakMap;var a5=(q,J)=>{return J3("cancelSignal",!1,q.connected),Y3({anyProcess:q,methodName:"cancelSignal",isSubprocess:!1,wrappedMessage:{type:r5,message:J},message:J})},o5=async({anyProcess:q,channel:J,isSubprocess:X,ipc:Q})=>{return await LK({anyProcess:q,channel:J,isSubprocess:X,ipc:Q}),H3.signal},LK=async({anyProcess:q,channel:J,isSubprocess:X,ipc:Q})=>{if(i5)return;if(i5=!0,!Q){A5();return}if(J===null){$3();return}h0(q,J,X),await _K.yield()},i5=!1,u5=(q)=>{if(q?.type!==r5)return!1;return H3.abort(q.message),!0},r5="execa:ipc:cancel",$3=()=>{H3.abort(P5())},H3=new AbortController;var s5=({gracefulCancel:q,cancelSignal:J,ipc:X,serialization:Q})=>{if(!q)return;if(J===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!X)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(Q==="json")throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")},t5=({subprocess:q,cancelSignal:J,gracefulCancel:X,forceKillAfterDelay:Q,context:$,controller:Z})=>X?[BK({subprocess:q,cancelSignal:J,forceKillAfterDelay:Q,context:$,controller:Z})]:[],BK=async({subprocess:q,cancelSignal:J,forceKillAfterDelay:X,context:Q,controller:{signal:$}})=>{await Y1(J,$);let Z=xK(J);throw await a5(q,Z),q3({kill:q.kill,forceKillAfterDelay:X,context:Q,controllerSignal:$}),Q.terminationReason??="gracefulCancel",J.reason},xK=({reason:q})=>{if(!(q instanceof DOMException))return q;let J=Error(q.message);return Object.defineProperty(J,"stack",{value:q.stack,enumerable:!1,configurable:!0,writable:!0}),J};import{setTimeout as jK}from"node:timers/promises";var e5=({timeout:q})=>{if(q!==void 0&&(!Number.isFinite(q)||q<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${q}\` (${typeof q})`)},qq=(q,J,X,Q)=>J===0||J===void 0?[]:[RK(q,J,X,Q)],RK=async(q,J,X,{signal:Q})=>{throw await jK(J,void 0,{signal:Q}),X.terminationReason??="timeout",q.kill(),new x0};import{execPath as FK,execArgv as MK}from"node:process";import Jq from"node:path";var Xq=({options:q})=>{if(q.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...q,node:!0}}},Qq=(q,J,{node:X=!1,nodePath:Q=FK,nodeOptions:$=MK.filter((K)=>!K.startsWith("--inspect")),cwd:Z,execPath:Y,...H})=>{if(Y!==void 0)throw TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let K=W6(Q,'The "nodePath" option'),V=Jq.resolve(Z,K),G={...H,nodePath:V,node:X,cwd:Z};if(!X)return[q,J,G];if(Jq.basename(q,".exe")==="node")throw TypeError('When the "node" option is true, the first argument does not need to be "node".');return[V,[...$,q,...J],{ipc:!0,...G,shell:!1}]};import{serialize as CK}from"node:v8";var $q=({ipcInput:q,ipc:J,serialization:X})=>{if(q===void 0)return;if(!J)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");wK[X](q)},kK=(q)=>{try{CK(q)}catch(J){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:J})}},TK=(q)=>{try{JSON.stringify(q)}catch(J){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:J})}},wK={advanced:kK,json:TK},Zq=async(q,J)=>{if(J===void 0)return;await q.sendMessage(J)};var Hq=({encoding:q})=>{if(K3.has(q))return;let J=AK(q);if(J!==void 0)throw TypeError(`Invalid option \`encoding: ${R1(q)}\`.
|
|
60
|
-
Please rename it to ${R1(J)}.`);let X=[...K3].map((Q)=>R1(Q)).join(", ");throw TypeError(`Invalid option \`encoding: ${R1(q)}\`.
|
|
61
|
-
Please rename it to one of: ${X}.`)},PK=new Set(["utf8","utf16le"]),s=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),K3=new Set([...PK,...s]),AK=(q)=>{if(q===null)return"buffer";if(typeof q!=="string")return;let J=q.toLowerCase();if(J in Yq)return Yq[J];if(K3.has(J))return J},Yq={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},R1=(q)=>typeof q==="string"?`"${q}"`:String(q);import{statSync as DK}from"node:fs";import IK from"node:path";import OK from"node:process";var Kq=(q=Vq())=>{let J=W6(q,'The "cwd" option');return IK.resolve(J)},Vq=()=>{try{return OK.cwd()}catch(q){throw q.message=`The current directory does not exist.
|
|
62
|
-
${q.message}`,q}},Gq=(q,J)=>{if(J===Vq())return q;let X;try{X=DK(J)}catch(Q){return`The "cwd" option is invalid: ${J}.
|
|
63
|
-
${Q.message}
|
|
64
|
-
${q}`}if(!X.isDirectory())return`The "cwd" option is not a directory: ${J}.
|
|
65
|
-
${q}`;return q};var F1=(q,J,X)=>{X.cwd=Kq(X.cwd);let[Q,$,Z]=Qq(q,J,X),{command:Y,args:H,options:K}=zq.default._parse(Q,$,Z),V=u7(K),G=EK(V);if(e5(G),Hq(G),$q(G),F5(G),s5(G),G.shell=d8(G.shell),G.env=yK(G),G.killSignal=L5(G.killSignal),G.forceKillAfterDelay=j5(G.forceKillAfterDelay),G.lines=G.lines.map((W,U)=>W&&!s.has(G.encoding)&&G.buffer[U]),Uq.platform==="win32"&&NK.basename(Y,".exe")==="cmd")H.unshift("/q");return{file:Y,commandArguments:H,options:G}},EK=({extendEnv:q=!0,preferLocal:J=!1,cwd:X,localDir:Q=X,encoding:$="utf8",reject:Z=!0,cleanup:Y=!0,all:H=!1,windowsHide:K=!0,killSignal:V="SIGTERM",forceKillAfterDelay:G=!0,gracefulCancel:W=!1,ipcInput:U,ipc:z=U!==void 0||W,serialization:L="advanced",..._})=>({..._,extendEnv:q,preferLocal:J,cwd:X,localDirectory:Q,encoding:$,reject:Z,cleanup:Y,all:H,windowsHide:K,killSignal:V,forceKillAfterDelay:G,gracefulCancel:W,ipcInput:U,ipc:z,serialization:L}),yK=({env:q,extendEnv:J,preferLocal:X,node:Q,localDirectory:$,nodePath:Z})=>{let Y=J?{...Uq.env,...q}:q;if(X||Q)return Z5({env:Y,cwd:$,execPath:Z,preferLocal:X,addExecPath:Q});return Y};var M1=(q,J,X)=>X.shell&&J.length>0?[[q,...J].join(" "),[],X]:[q,J,X];import{inspect as _V}from"node:util";function x6(q){if(typeof q==="string")return SK(q);if(!(ArrayBuffer.isView(q)&&q.BYTES_PER_ELEMENT===1))throw Error("Input must be a string or a Uint8Array");return hK(q)}var SK=(q)=>q.at(-1)===_q?q.slice(0,q.at(-2)===Lq?-2:-1):q,hK=(q)=>q.at(-1)===bK?q.subarray(0,q.at(-2)===gK?-2:-1):q,_q=`
|
|
66
|
-
`,bK=_q.codePointAt(0),Lq="\r",gK=Lq.codePointAt(0);import{on as GV}from"node:events";import{finished as WV}from"node:stream/promises";function V0(q,{checkOpen:J=!0}={}){return q!==null&&typeof q==="object"&&(q.writable||q.readable||!J||q.writable===void 0&&q.readable===void 0)&&typeof q.pipe==="function"}function V3(q,{checkOpen:J=!0}={}){return V0(q,{checkOpen:J})&&(q.writable||!J)&&typeof q.write==="function"&&typeof q.end==="function"&&typeof q.writable==="boolean"&&typeof q.writableObjectMode==="boolean"&&typeof q.destroy==="function"&&typeof q.destroyed==="boolean"}function t0(q,{checkOpen:J=!0}={}){return V0(q,{checkOpen:J})&&(q.readable||!J)&&typeof q.read==="function"&&typeof q.readable==="boolean"&&typeof q.readableObjectMode==="boolean"&&typeof q.destroy==="function"&&typeof q.destroyed==="boolean"}function G3(q,J){return V3(q,J)&&t0(q,J)}var fK=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class Bq{#q;#X;#J=!1;#Q=void 0;constructor(q,J){this.#q=q,this.#X=J}next(){let q=()=>this.#Z();return this.#Q=this.#Q?this.#Q.then(q,q):q(),this.#Q}return(q){let J=()=>this.#V(q);return this.#Q?this.#Q.then(J,J):J()}async#Z(){if(this.#J)return{done:!0,value:void 0};let q;try{q=await this.#q.read()}catch(J){throw this.#Q=void 0,this.#J=!0,this.#q.releaseLock(),J}return q.done&&(this.#Q=void 0,this.#J=!0,this.#q.releaseLock()),q}async#V(q){if(this.#J)return{done:!0,value:q};if(this.#J=!0,!this.#X){let J=this.#q.cancel(q);return this.#q.releaseLock(),await J,{done:!0,value:q}}return this.#q.releaseLock(),{done:!0,value:q}}}var W3=Symbol();function xq(){return this[W3].next()}Object.defineProperty(xq,"name",{value:"next"});function jq(q){return this[W3].return(q)}Object.defineProperty(jq,"name",{value:"return"});var uK=Object.create(fK,{next:{enumerable:!0,configurable:!0,writable:!0,value:xq},return:{enumerable:!0,configurable:!0,writable:!0,value:jq}});function U3({preventCancel:q=!1}={}){let J=this.getReader(),X=new Bq(J,q),Q=Object.create(uK);return Q[W3]=X,Q}var Rq=(q)=>{if(t0(q,{checkOpen:!1})&&q2.on!==void 0)return dK(q);if(typeof q?.[Symbol.asyncIterator]==="function")return q;if(mK.call(q)==="[object ReadableStream]")return U3.call(q);throw TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:mK}=Object.prototype,dK=async function*(q){let J=new AbortController,X={};cK(q,J,X);try{for await(let[Q]of q2.on(q,"data",{signal:J.signal}))yield Q}catch(Q){if(X.error!==void 0)throw X.error;else if(!J.signal.aborted)throw Q}finally{q.destroy()}},cK=async(q,J,X)=>{try{await q2.finished(q,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(Q){X.error=Q}finally{J.abort()}},q2={};var j6=async(q,{init:J,convertChunk:X,getSize:Q,truncateChunk:$,addChunk:Z,getFinalChunk:Y,finalize:H},{maxBuffer:K=Number.POSITIVE_INFINITY}={})=>{let V=Rq(q),G=J();G.length=0;try{for await(let W of V){let U=pK(W),z=X[U](W,G);Cq({convertedChunk:z,state:G,getSize:Q,truncateChunk:$,addChunk:Z,maxBuffer:K})}return lK({state:G,convertChunk:X,getSize:Q,truncateChunk:$,addChunk:Z,getFinalChunk:Y,maxBuffer:K}),H(G)}catch(W){let U=typeof W==="object"&&W!==null?W:Error(W);throw U.bufferedData=H(G),U}},lK=({state:q,getSize:J,truncateChunk:X,addChunk:Q,getFinalChunk:$,maxBuffer:Z})=>{let Y=$(q);if(Y!==void 0)Cq({convertedChunk:Y,state:q,getSize:J,truncateChunk:X,addChunk:Q,maxBuffer:Z})},Cq=({convertedChunk:q,state:J,getSize:X,truncateChunk:Q,addChunk:$,maxBuffer:Z})=>{let Y=X(q),H=J.length+Y;if(H<=Z){Fq(q,J,$,H);return}let K=Q(q,Z-J.length);if(K!==void 0)Fq(K,J,$,Z);throw new A0},Fq=(q,J,X,Q)=>{J.contents=X(q,J,Q),J.length=Q},pK=(q)=>{let J=typeof q;if(J==="string")return"string";if(J!=="object"||q===null)return"others";if(globalThis.Buffer?.isBuffer(q))return"buffer";let X=Mq.call(q);if(X==="[object ArrayBuffer]")return"arrayBuffer";if(X==="[object DataView]")return"dataView";if(Number.isInteger(q.byteLength)&&Number.isInteger(q.byteOffset)&&Mq.call(q.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},{toString:Mq}=Object.prototype;class A0 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}var D0=(q)=>q,J2=()=>{return},C1=({contents:q})=>q,k1=(q)=>{throw Error(`Streams in object mode are not supported: ${String(q)}`)},T1=(q)=>q.length;async function w1(q,J){return j6(q,oK,J)}var nK=()=>({contents:[]}),iK=()=>1,aK=(q,{contents:J})=>{return J.push(q),J},oK={init:nK,convertChunk:{string:D0,buffer:D0,arrayBuffer:D0,dataView:D0,typedArray:D0,others:D0},getSize:iK,truncateChunk:J2,addChunk:aK,getFinalChunk:J2,finalize:C1};async function P1(q,J){return j6(q,$V,J)}var rK=()=>({contents:new ArrayBuffer(0)}),sK=(q)=>tK.encode(q),tK=new TextEncoder,kq=(q)=>new Uint8Array(q),Tq=(q)=>new Uint8Array(q.buffer,q.byteOffset,q.byteLength),eK=(q,J)=>q.slice(0,J),qV=(q,{contents:J,length:X},Q)=>{let $=Aq()?XV(J,Q):JV(J,Q);return new Uint8Array($).set(q,X),$},JV=(q,J)=>{if(J<=q.byteLength)return q;let X=new ArrayBuffer(Pq(J));return new Uint8Array(X).set(new Uint8Array(q),0),X},XV=(q,J)=>{if(J<=q.maxByteLength)return q.resize(J),q;let X=new ArrayBuffer(J,{maxByteLength:Pq(J)});return new Uint8Array(X).set(new Uint8Array(q),0),X},Pq=(q)=>wq**Math.ceil(Math.log(q)/Math.log(wq)),wq=2,QV=({contents:q,length:J})=>Aq()?q:q.slice(0,J),Aq=()=>("resize"in ArrayBuffer.prototype),$V={init:rK,convertChunk:{string:sK,buffer:kq,arrayBuffer:kq,dataView:Tq,typedArray:Tq,others:k1},getSize:T1,truncateChunk:eK,addChunk:qV,getFinalChunk:J2,finalize:QV};async function D1(q,J){return j6(q,VV,J)}var ZV=()=>({contents:"",textDecoder:new TextDecoder}),A1=(q,{textDecoder:J})=>J.decode(q,{stream:!0}),YV=(q,{contents:J})=>J+q,HV=(q,J)=>q.slice(0,J),KV=({textDecoder:q})=>{let J=q.decode();return J===""?void 0:J},VV={init:ZV,convertChunk:{string:D0,buffer:A1,arrayBuffer:A1,dataView:A1,typedArray:A1,others:k1},getSize:T1,truncateChunk:HV,addChunk:YV,getFinalChunk:KV,finalize:C1};Object.assign(q2,{on:GV,finished:WV});var Dq=({error:q,stream:J,readableObjectMode:X,lines:Q,encoding:$,fdNumber:Z})=>{if(!(q instanceof A0))throw q;if(Z==="all")return q;let Y=UV(X,Q,$);throw q.maxBufferInfo={fdNumber:Z,unit:Y},J.destroy(),q},UV=(q,J,X)=>{if(q)return"objects";if(J)return"lines";if(X==="buffer")return"bytes";return"characters"},Iq=(q,J,X)=>{if(J.length!==X)return;let Q=new A0;throw Q.maxBufferInfo={fdNumber:"ipc"},Q},Oq=(q,J)=>{let{streamName:X,threshold:Q,unit:$}=zV(q,J);return`Command's ${X} was larger than ${Q} ${$}`},zV=(q,J)=>{if(q?.maxBufferInfo===void 0)return{streamName:"output",threshold:J[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:X,unit:Q}}=q;delete q.maxBufferInfo;let $=P0(J,X);if(X==="ipc")return{streamName:"IPC output",threshold:$,unit:"messages"};return{streamName:l2(X),threshold:$,unit:Q}},vq=(q,J,X)=>q?.code==="ENOBUFS"&&J!==null&&J.some((Q)=>Q!==null&&Q.length>I1(X)),Nq=(q,J,X)=>{if(!J)return q;let Q=I1(X);return q.length>Q?q.slice(0,Q):q},I1=([,q])=>q;var yq=({stdio:q,all:J,ipcOutput:X,originalError:Q,signal:$,signalDescription:Z,exitCode:Y,escapedCommand:H,timedOut:K,isCanceled:V,isGracefullyCanceled:G,isMaxBuffer:W,isForcefullyTerminated:U,forceKillAfterDelay:z,killSignal:L,maxBuffer:_,timeout:x,cwd:B})=>{let j=Q?.code,R=LV({originalError:Q,timedOut:K,timeout:x,isMaxBuffer:W,maxBuffer:_,errorCode:j,signal:$,signalDescription:Z,exitCode:Y,isCanceled:V,isGracefullyCanceled:G,isForcefullyTerminated:U,forceKillAfterDelay:z,killSignal:L}),M=xV(Q,B),F=M===void 0?"":`
|
|
67
|
-
${M}`,I=`${R}: ${H}${F}`,P=J===void 0?[q[2],q[1]]:[J],g=[I,...P,...q.slice(3),X.map((m)=>jV(m)).join(`
|
|
68
|
-
`)].map((m)=>r6(x6(RV(m)))).filter(Boolean).join(`
|
|
69
|
-
|
|
70
|
-
`);return{originalMessage:M,shortMessage:I,message:g}},LV=({originalError:q,timedOut:J,timeout:X,isMaxBuffer:Q,maxBuffer:$,errorCode:Z,signal:Y,signalDescription:H,exitCode:K,isCanceled:V,isGracefullyCanceled:G,isForcefullyTerminated:W,forceKillAfterDelay:U,killSignal:z})=>{let L=BV(W,U);if(J)return`Command timed out after ${X} milliseconds${L}`;if(G){if(Y===void 0)return`Command was gracefully canceled with exit code ${K}`;return W?`Command was gracefully canceled${L}`:`Command was gracefully canceled with ${Y} (${H})`}if(V)return`Command was canceled${L}`;if(Q)return`${Oq(q,$)}${L}`;if(Z!==void 0)return`Command failed with ${Z}${L}`;if(W)return`Command was killed with ${z} (${Z1(z)})${L}`;if(Y!==void 0)return`Command was killed with ${Y} (${H})`;if(K!==void 0)return`Command failed with exit code ${K}`;return"Command failed"},BV=(q,J)=>q?` and was forcefully terminated after ${J} milliseconds`:"",xV=(q,J)=>{if(q instanceof x0)return;let X=K5(q)?q.originalMessage:String(q?.message??q),Q=r6(Gq(X,J));return Q===""?void 0:Q},jV=(q)=>typeof q==="string"?q:_V(q),RV=(q)=>Array.isArray(q)?q.map((J)=>x6(Eq(J))).filter(Boolean).join(`
|
|
71
|
-
`):Eq(q),Eq=(q)=>{if(typeof q==="string")return q;if(O(q))return d2(q);return""};var O1=({command:q,escapedCommand:J,stdio:X,all:Q,ipcOutput:$,options:{cwd:Z},startTime:Y})=>Sq({command:q,escapedCommand:J,cwd:Z,durationMs:r8(Y),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:X[1],stderr:X[2],all:Q,stdio:X,ipcOutput:$,pipedFrom:[]}),R6=({error:q,command:J,escapedCommand:X,fileDescriptors:Q,options:$,startTime:Z,isSync:Y})=>X2({error:q,command:J,escapedCommand:X,startTime:Z,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:Q.length}),ipcOutput:[],options:$,isSync:Y}),X2=({error:q,command:J,escapedCommand:X,startTime:Q,timedOut:$,isCanceled:Z,isGracefullyCanceled:Y,isMaxBuffer:H,isForcefullyTerminated:K,exitCode:V,signal:G,stdio:W,all:U,ipcOutput:z,options:{timeoutDuration:L,timeout:_=L,forceKillAfterDelay:x,killSignal:B,cwd:j,maxBuffer:R},isSync:M})=>{let{exitCode:F,signal:I,signalDescription:P}=MV(V,G),{originalMessage:g,shortMessage:m,message:n0}=yq({stdio:W,all:U,ipcOutput:z,originalError:q,signal:I,signalDescription:P,exitCode:F,escapedCommand:X,timedOut:$,isCanceled:Z,isGracefullyCanceled:Y,isMaxBuffer:H,isForcefullyTerminated:K,forceKillAfterDelay:x,killSignal:B,maxBuffer:R,timeout:_,cwd:j}),v6=Y5(q,n0,M);return Object.assign(v6,FV({error:v6,command:J,escapedCommand:X,startTime:Q,timedOut:$,isCanceled:Z,isGracefullyCanceled:Y,isMaxBuffer:H,isForcefullyTerminated:K,exitCode:F,signal:I,signalDescription:P,stdio:W,all:U,ipcOutput:z,cwd:j,originalMessage:g,shortMessage:m})),v6},FV=({error:q,command:J,escapedCommand:X,startTime:Q,timedOut:$,isCanceled:Z,isGracefullyCanceled:Y,isMaxBuffer:H,isForcefullyTerminated:K,exitCode:V,signal:G,signalDescription:W,stdio:U,all:z,ipcOutput:L,cwd:_,originalMessage:x,shortMessage:B})=>Sq({shortMessage:B,originalMessage:x,command:J,escapedCommand:X,cwd:_,durationMs:r8(Q),failed:!0,timedOut:$,isCanceled:Z,isGracefullyCanceled:Y,isTerminated:G!==void 0,isMaxBuffer:H,isForcefullyTerminated:K,exitCode:V,signal:G,signalDescription:W,code:q.cause?.code,stdout:U[1],stderr:U[2],all:z,stdio:U,ipcOutput:L,pipedFrom:[]}),Sq=(q)=>Object.fromEntries(Object.entries(q).filter(([,J])=>J!==void 0)),MV=(q,J)=>{let X=q===null?void 0:q,Q=J===null?void 0:J,$=Q===void 0?void 0:Z1(J);return{exitCode:X,signal:Q,signalDescription:$}};var hq=(q)=>Number.isFinite(q)?q:0;function CV(q){return{days:Math.trunc(q/86400000),hours:Math.trunc(q/3600000%24),minutes:Math.trunc(q/60000%60),seconds:Math.trunc(q/1000%60),milliseconds:Math.trunc(q%1000),microseconds:Math.trunc(hq(q*1000)%1000),nanoseconds:Math.trunc(hq(q*1e6)%1000)}}function kV(q){return{days:q/86400000n,hours:q/3600000n%24n,minutes:q/60000n%60n,seconds:q/1000n%60n,milliseconds:q%1000n,microseconds:0n,nanoseconds:0n}}function z3(q){switch(typeof q){case"number":{if(Number.isFinite(q))return CV(q);break}case"bigint":return kV(q)}throw TypeError("Expected a finite number or bigint")}var TV=(q)=>q===0||q===0n,wV=(q,J)=>J===1||J===1n?q:`${q}s`,PV=0.0000001,AV=24n*60n*60n*1000n;function _3(q,J){let X=typeof q==="bigint";if(!X&&!Number.isFinite(q))throw TypeError("Expected a finite number or bigint");J={...J};let Q=q<0?"-":"";if(q=q<0?-q:q,J.colonNotation)J.compact=!1,J.formatSubMilliseconds=!1,J.separateMilliseconds=!1,J.verbose=!1;if(J.compact)J.unitCount=1,J.secondsDecimalDigits=0,J.millisecondsDecimalDigits=0;let $=[],Z=(G,W)=>{let U=Math.floor(G*10**W+PV);return(Math.round(U)/10**W).toFixed(W)},Y=(G,W,U,z)=>{if(($.length===0||!J.colonNotation)&&TV(G)&&!(J.colonNotation&&U==="m"))return;if(z??=String(G),J.colonNotation){let L=z.includes(".")?z.split(".")[0].length:z.length,_=$.length>0?2:1;z="0".repeat(Math.max(0,_-L))+z}else z+=J.verbose?" "+wV(W,G):U;$.push(z)},H=z3(q),K=BigInt(H.days);if(J.hideYearAndDays)Y(BigInt(K)*24n+BigInt(H.hours),"hour","h");else{if(J.hideYear)Y(K,"day","d");else Y(K/365n,"year","y"),Y(K%365n,"day","d");Y(Number(H.hours),"hour","h")}if(Y(Number(H.minutes),"minute","m"),!J.hideSeconds)if(J.separateMilliseconds||J.formatSubMilliseconds||!J.colonNotation&&q<1000&&!J.subSecondsAsDecimals){let G=Number(H.seconds),W=Number(H.milliseconds),U=Number(H.microseconds),z=Number(H.nanoseconds);if(Y(G,"second","s"),J.formatSubMilliseconds)Y(W,"millisecond","ms"),Y(U,"microsecond","µs"),Y(z,"nanosecond","ns");else{let L=W+U/1000+z/1e6,_=typeof J.millisecondsDecimalDigits==="number"?J.millisecondsDecimalDigits:0,x=L>=1?Math.round(L):Math.ceil(L),B=_?L.toFixed(_):x;Y(Number.parseFloat(B),"millisecond","ms",B)}}else{let G=(X?Number(q%AV):q)/1000%60,W=typeof J.secondsDecimalDigits==="number"?J.secondsDecimalDigits:1,U=Z(G,W),z=J.keepDecimalsOnWholeSeconds?U:U.replace(/\.0+$/,"");Y(Number.parseFloat(z),"second","s",z)}if($.length===0)return Q+"0"+(J.verbose?" milliseconds":"ms");let V=J.colonNotation?":":" ";if(typeof J.unitCount==="number")$=$.slice(0,Math.max(J.unitCount,1));return Q+$.join(V)}var bq=(q,J)=>{if(q.failed)B0({type:"error",verboseMessage:q.shortMessage,verboseInfo:J,result:q})};var gq=(q,J)=>{if(!U6(J))return;bq(q,J),DV(q,J)},DV=(q,J)=>{let X=`(done in ${_3(q.durationMs)})`;B0({type:"duration",verboseMessage:X,verboseInfo:J,result:q})};var F6=(q,J,{reject:X})=>{if(gq(q,J),q.failed&&X)throw q;return q};import{readFileSync as W9}from"node:fs";var mq=(q,J)=>{if(e0(q))return"asyncGenerator";if(lq(q))return"generator";if(v1(q))return"fileUrl";if(EV(q))return"filePath";if(hV(q))return"webStream";if(V0(q,{checkOpen:!1}))return"native";if(O(q))return"uint8Array";if(bV(q))return"asyncIterable";if(gV(q))return"iterable";if(x3(q))return dq({transform:q},J);if(NV(q))return IV(q,J);return"native"},IV=(q,J)=>{if(G3(q.transform,{checkOpen:!1}))return OV(q,J);if(x3(q.transform))return dq(q,J);return vV(q,J)},OV=(q,J)=>{return cq(q,J,"Duplex stream"),"duplex"},dq=(q,J)=>{return cq(q,J,"web TransformStream"),"webTransform"},cq=({final:q,binary:J,objectMode:X},Q,$)=>{fq(q,`${Q}.final`,$),fq(J,`${Q}.binary`,$),L3(X,`${Q}.objectMode`)},fq=(q,J,X)=>{if(q!==void 0)throw TypeError(`The \`${J}\` option can only be defined when using a generator, not a ${X}.`)},vV=({transform:q,final:J,binary:X,objectMode:Q},$)=>{if(q!==void 0&&!uq(q))throw TypeError(`The \`${$}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(G3(J,{checkOpen:!1}))throw TypeError(`The \`${$}.final\` option must not be a Duplex stream.`);if(x3(J))throw TypeError(`The \`${$}.final\` option must not be a web TransformStream.`);if(J!==void 0&&!uq(J))throw TypeError(`The \`${$}.final\` option must be a generator.`);return L3(X,`${$}.binary`),L3(Q,`${$}.objectMode`),e0(q)||e0(J)?"asyncGenerator":"generator"},L3=(q,J)=>{if(q!==void 0&&typeof q!=="boolean")throw TypeError(`The \`${J}\` option must use a boolean.`)},uq=(q)=>e0(q)||lq(q),e0=(q)=>Object.prototype.toString.call(q)==="[object AsyncGeneratorFunction]",lq=(q)=>Object.prototype.toString.call(q)==="[object GeneratorFunction]",NV=(q)=>D(q)&&(q.transform!==void 0||q.final!==void 0),v1=(q)=>Object.prototype.toString.call(q)==="[object URL]",pq=(q)=>v1(q)&&q.protocol!=="file:",EV=(q)=>D(q)&&Object.keys(q).length>0&&Object.keys(q).every((J)=>yV.has(J))&&B3(q.file),yV=new Set(["file","append"]),B3=(q)=>typeof q==="string",nq=(q,J)=>q==="native"&&typeof J==="string"&&!SV.has(J),SV=new Set(["ipc","ignore","inherit","overlapped","pipe"]),iq=(q)=>Object.prototype.toString.call(q)==="[object ReadableStream]",N1=(q)=>Object.prototype.toString.call(q)==="[object WritableStream]",hV=(q)=>iq(q)||N1(q),x3=(q)=>iq(q?.readable)&&N1(q?.writable),bV=(q)=>aq(q)&&typeof q[Symbol.asyncIterator]==="function",gV=(q)=>aq(q)&&typeof q[Symbol.iterator]==="function",aq=(q)=>typeof q==="object"&&q!==null,Q0=new Set(["generator","asyncGenerator","duplex","webTransform"]),E1=new Set(["fileUrl","filePath","fileNumber"]),j3=new Set(["fileUrl","filePath"]),oq=new Set([...j3,"webStream","nodeStream"]),rq=new Set(["webTransform","duplex"]),b0={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var R3=(q,J,X,Q)=>Q==="output"?fV(q,J,X):uV(q,J,X),fV=(q,J,X)=>{let Q=J!==0&&X[J-1].value.readableObjectMode;return{writableObjectMode:Q,readableObjectMode:q??Q}},uV=(q,J,X)=>{let Q=J===0?q===!0:X[J-1].value.readableObjectMode,$=J!==X.length-1&&(q??Q);return{writableObjectMode:Q,readableObjectMode:$}},sq=(q,J)=>{let X=q.findLast(({type:Q})=>Q0.has(Q));if(X===void 0)return!1;return J==="input"?X.value.writableObjectMode:X.value.readableObjectMode};var tq=(q,J,X,Q)=>[...q.filter(({type:$})=>!Q0.has($)),...mV(q,J,X,Q)],mV=(q,J,X,{encoding:Q})=>{let $=q.filter(({type:Y})=>Q0.has(Y)),Z=Array.from({length:$.length});for(let[Y,H]of Object.entries($))Z[Y]=dV({stdioItem:H,index:Number(Y),newTransforms:Z,optionName:J,direction:X,encoding:Q});return nV(Z,X)},dV=({stdioItem:q,stdioItem:{type:J},index:X,newTransforms:Q,optionName:$,direction:Z,encoding:Y})=>{if(J==="duplex")return cV({stdioItem:q,optionName:$});if(J==="webTransform")return lV({stdioItem:q,index:X,newTransforms:Q,direction:Z});return pV({stdioItem:q,index:X,newTransforms:Q,direction:Z,encoding:Y})},cV=({stdioItem:q,stdioItem:{value:{transform:J,transform:{writableObjectMode:X,readableObjectMode:Q},objectMode:$=Q}},optionName:Z})=>{if($&&!Q)throw TypeError(`The \`${Z}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!$&&Q)throw TypeError(`The \`${Z}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...q,value:{transform:J,writableObjectMode:X,readableObjectMode:Q}}},lV=({stdioItem:q,stdioItem:{value:J},index:X,newTransforms:Q,direction:$})=>{let{transform:Z,objectMode:Y}=D(J)?J:{transform:J},{writableObjectMode:H,readableObjectMode:K}=R3(Y,X,Q,$);return{...q,value:{transform:Z,writableObjectMode:H,readableObjectMode:K}}},pV=({stdioItem:q,stdioItem:{value:J},index:X,newTransforms:Q,direction:$,encoding:Z})=>{let{transform:Y,final:H,binary:K=!1,preserveNewlines:V=!1,objectMode:G}=D(J)?J:{transform:J},W=K||s.has(Z),{writableObjectMode:U,readableObjectMode:z}=R3(G,X,Q,$);return{...q,value:{transform:Y,final:H,binary:W,preserveNewlines:V,writableObjectMode:U,readableObjectMode:z}}},nV=(q,J)=>J==="input"?q.reverse():q;import F3 from"node:process";var eq=(q,J,X)=>{let Q=q.map(($)=>iV($,J));if(Q.includes("input")&&Q.includes("output"))throw TypeError(`The \`${X}\` option must not be an array of both readable and writable values.`);return Q.find(Boolean)??rV},iV=({type:q,value:J},X)=>aV[X]??q9[q](J),aV=["input","output","output"],M6=()=>{return},M3=()=>"input",q9={generator:M6,asyncGenerator:M6,fileUrl:M6,filePath:M6,iterable:M3,asyncIterable:M3,uint8Array:M3,webStream:(q)=>N1(q)?"output":"input",nodeStream(q){if(!t0(q,{checkOpen:!1}))return"output";return V3(q,{checkOpen:!1})?void 0:"input"},webTransform:M6,duplex:M6,native(q){let J=oV(q);if(J!==void 0)return J;if(V0(q,{checkOpen:!1}))return q9.nodeStream(q)}},oV=(q)=>{if([0,F3.stdin].includes(q))return"input";if([1,2,F3.stdout,F3.stderr].includes(q))return"output"},rV="output";var J9=(q,J)=>J&&!q.includes("ipc")?[...q,"ipc"]:q;var X9=({stdio:q,ipc:J,buffer:X,...Q},$,Z)=>{let Y=sV(q,Q).map((H,K)=>Q9(H,K));return Z?eV(Y,X,$):J9(Y,J)},sV=(q,J)=>{if(q===void 0)return X0.map((Q)=>J[Q]);if(tV(J))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${X0.map((Q)=>`\`${Q}\``).join(", ")}`);if(typeof q==="string")return[q,q,q];if(!Array.isArray(q))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof q}\``);let X=Math.max(q.length,X0.length);return Array.from({length:X},(Q,$)=>q[$])},tV=(q)=>X0.some((J)=>q[J]!==void 0),Q9=(q,J)=>{if(Array.isArray(q))return q.map((X)=>Q9(X,J));if(q===null||q===void 0)return J>=X0.length?"ignore":"pipe";return q},eV=(q,J,X)=>q.map((Q,$)=>!J[$]&&$!==0&&!z6(X,$)&&qG(Q)?"ignore":Q),qG=(q)=>q==="pipe"||Array.isArray(q)&&q.every((J)=>J==="pipe");import{readFileSync as JG}from"node:fs";import XG from"node:tty";var Z9=({stdioItem:q,stdioItem:{type:J},isStdioArray:X,fdNumber:Q,direction:$,isSync:Z})=>{if(!X||J!=="native")return q;return Z?QG({stdioItem:q,fdNumber:Q,direction:$}):YG({stdioItem:q,fdNumber:Q})},QG=({stdioItem:q,stdioItem:{value:J,optionName:X},fdNumber:Q,direction:$})=>{let Z=$G({value:J,optionName:X,fdNumber:Q,direction:$});if(Z!==void 0)return Z;if(V0(J,{checkOpen:!1}))throw TypeError(`The \`${X}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return q},$G=({value:q,optionName:J,fdNumber:X,direction:Q})=>{let $=ZG(q,X);if($===void 0)return;if(Q==="output")return{type:"fileNumber",value:$,optionName:J};if(XG.isatty($))throw TypeError(`The \`${J}: ${K1(q)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:w0(JG($)),optionName:J}},ZG=(q,J)=>{if(q==="inherit")return J;if(typeof q==="number")return q;let X=c2.indexOf(q);if(X!==-1)return X},YG=({stdioItem:q,stdioItem:{value:J,optionName:X},fdNumber:Q})=>{if(J==="inherit")return{type:"nodeStream",value:$9(Q,J,X),optionName:X};if(typeof J==="number")return{type:"nodeStream",value:$9(J,J,X),optionName:X};if(V0(J,{checkOpen:!1}))return{type:"nodeStream",value:J,optionName:X};return q},$9=(q,J,X)=>{let Q=c2[q];if(Q===void 0)throw TypeError(`The \`${X}: ${J}\` option is invalid: no such standard stream.`);return Q};var Y9=({input:q,inputFile:J},X)=>X===0?[...HG(q),...VG(J)]:[],HG=(q)=>q===void 0?[]:[{type:KG(q),value:q,optionName:"input"}],KG=(q)=>{if(t0(q,{checkOpen:!1}))return"nodeStream";if(typeof q==="string")return"string";if(O(q))return"uint8Array";throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},VG=(q)=>q===void 0?[]:[{...GG(q),optionName:"inputFile"}],GG=(q)=>{if(v1(q))return{type:"fileUrl",value:q};if(B3(q))return{type:"filePath",value:{file:q}};throw Error("The `inputFile` option must be a file path string or a file URL.")};var H9=(q)=>q.filter((J,X)=>q.every((Q,$)=>J.value!==Q.value||X>=$||J.type==="generator"||J.type==="asyncGenerator")),K9=({stdioItem:{type:q,value:J,optionName:X},direction:Q,fileDescriptors:$,isSync:Z})=>{let Y=WG($,q);if(Y.length===0)return;if(Z){UG({otherStdioItems:Y,type:q,value:J,optionName:X,direction:Q});return}if(oq.has(q))return V9({otherStdioItems:Y,type:q,value:J,optionName:X,direction:Q});if(rq.has(q))_G({otherStdioItems:Y,type:q,value:J,optionName:X})},WG=(q,J)=>q.flatMap(({direction:X,stdioItems:Q})=>Q.filter(($)=>$.type===J).map(($)=>({...$,direction:X}))),UG=({otherStdioItems:q,type:J,value:X,optionName:Q,direction:$})=>{if(j3.has(J))V9({otherStdioItems:q,type:J,value:X,optionName:Q,direction:$})},V9=({otherStdioItems:q,type:J,value:X,optionName:Q,direction:$})=>{let Z=q.filter((H)=>zG(H,X));if(Z.length===0)return;let Y=Z.find((H)=>H.direction!==$);return G9(Y,Q,J),$==="output"?Z[0].stream:void 0},zG=({type:q,value:J},X)=>{if(q==="filePath")return J.file===X.file;if(q==="fileUrl")return J.href===X.href;return J===X},_G=({otherStdioItems:q,type:J,value:X,optionName:Q})=>{let $=q.find(({value:{transform:Z}})=>Z===X.transform);G9($,Q,J)},G9=(q,J,X)=>{if(q!==void 0)throw TypeError(`The \`${q.optionName}\` and \`${J}\` options must not target ${b0[X]} that is the same.`)};var y1=(q,J,X,Q)=>{let Z=X9(J,X,Q).map((H,K)=>LG({stdioOption:H,fdNumber:K,options:J,isSync:Q})),Y=kG({initialFileDescriptors:Z,addProperties:q,options:J,isSync:Q});return J.stdio=Y.map(({stdioItems:H})=>PG(H)),Y},LG=({stdioOption:q,fdNumber:J,options:X,isSync:Q})=>{let $=l2(J),{stdioItems:Z,isStdioArray:Y}=BG({stdioOption:q,fdNumber:J,options:X,optionName:$}),H=eq(Z,J,$),K=Z.map((W)=>Z9({stdioItem:W,isStdioArray:Y,fdNumber:J,direction:H,isSync:Q})),V=tq(K,$,H,X),G=sq(V,H);return CG(V,G),{direction:H,objectMode:G,stdioItems:V}},BG=({stdioOption:q,fdNumber:J,options:X,optionName:Q})=>{let Z=[...(Array.isArray(q)?q:[q]).map((K)=>xG(K,Q)),...Y9(X,J)],Y=H9(Z),H=Y.length>1;return jG(Y,H,Q),FG(Y),{stdioItems:Y,isStdioArray:H}},xG=(q,J)=>({type:mq(q,J),value:q,optionName:J}),jG=(q,J,X)=>{if(q.length===0)throw TypeError(`The \`${X}\` option must not be an empty array.`);if(!J)return;for(let{value:Q,optionName:$}of q)if(RG.has(Q))throw Error(`The \`${$}\` option must not include \`${Q}\`.`)},RG=new Set(["ignore","ipc"]),FG=(q)=>{for(let J of q)MG(J)},MG=({type:q,value:J,optionName:X})=>{if(pq(J))throw TypeError(`The \`${X}: URL\` option must use the \`file:\` scheme.
|
|
72
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(nq(q,J))throw TypeError(`The \`${X}: { file: '...' }\` option must be used instead of \`${X}: '...'\`.`)},CG=(q,J)=>{if(!J)return;let X=q.find(({type:Q})=>E1.has(Q));if(X!==void 0)throw TypeError(`The \`${X.optionName}\` option cannot use both files and transforms in objectMode.`)},kG=({initialFileDescriptors:q,addProperties:J,options:X,isSync:Q})=>{let $=[];try{for(let Z of q)$.push(TG({fileDescriptor:Z,fileDescriptors:$,addProperties:J,options:X,isSync:Q}));return $}catch(Z){throw C3($),Z}},TG=({fileDescriptor:{direction:q,objectMode:J,stdioItems:X},fileDescriptors:Q,addProperties:$,options:Z,isSync:Y})=>{let H=X.map((K)=>wG({stdioItem:K,addProperties:$,direction:q,options:Z,fileDescriptors:Q,isSync:Y}));return{direction:q,objectMode:J,stdioItems:H}},wG=({stdioItem:q,addProperties:J,direction:X,options:Q,fileDescriptors:$,isSync:Z})=>{let Y=K9({stdioItem:q,direction:X,fileDescriptors:$,isSync:Z});if(Y!==void 0)return{...q,stream:Y};return{...q,...J[X][q.type](q,Q)}},C3=(q)=>{for(let{stdioItems:J}of q)for(let{stream:X}of J)if(X!==void 0&&!H0(X))X.destroy()},PG=(q)=>{if(q.length>1)return q.some(({value:Q})=>Q==="overlapped")?"overlapped":"pipe";let[{type:J,value:X}]=q;return J==="native"?X:"pipe"};var z9=(q,J)=>y1(DG,q,J,!0),F0=({type:q,optionName:J})=>{_9(J,b0[q])},AG=({optionName:q,value:J})=>{if(J==="ipc"||J==="overlapped")_9(q,`"${J}"`);return{}},_9=(q,J)=>{throw TypeError(`The \`${q}\` option cannot be ${J} with synchronous methods.`)},U9={generator(){},asyncGenerator:F0,webStream:F0,nodeStream:F0,webTransform:F0,duplex:F0,asyncIterable:F0,native:AG},DG={input:{...U9,fileUrl:({value:q})=>({contents:[w0(W9(q))]}),filePath:({value:{file:q}})=>({contents:[w0(W9(q))]}),fileNumber:F0,iterable:({value:q})=>({contents:[...q]}),string:({value:q})=>({contents:[q]}),uint8Array:({value:q})=>({contents:[q]})},output:{...U9,fileUrl:({value:q})=>({path:q}),filePath:({value:{file:q,append:J}})=>({path:q,append:J}),fileNumber:({value:q})=>({path:q}),iterable:F0,string:F0,uint8Array:F0}};var I0=(q,{stripFinalNewline:J},X)=>k3(J,X)&&q!==void 0&&!Array.isArray(q)?x6(q):q,k3=(q,J)=>J==="all"?q[1]||q[2]:q[J];import{Transform as oG,getDefaultHighWaterMark as w9}from"node:stream";var S1=(q,J,X,Q)=>q||X?void 0:B9(J,Q),w3=(q,J,X)=>X?q.flatMap((Q)=>L9(Q,J)):L9(q,J),L9=(q,J)=>{let{transform:X,final:Q}=B9(J,{});return[...X(q),...Q()]},B9=(q,J)=>{return J.previousChunks="",{transform:IG.bind(void 0,J,q),final:vG.bind(void 0,J)}},IG=function*(q,J,X){if(typeof X!=="string"){yield X;return}let{previousChunks:Q}=q,$=-1;for(let Z=0;Z<X.length;Z+=1)if(X[Z]===`
|
|
73
|
-
`){let Y=OG(X,Z,J,q),H=X.slice($+1,Z+1-Y);if(Q.length>0)H=T3(Q,H),Q="";yield H,$=Z}if($!==X.length-1)Q=T3(Q,X.slice($+1));q.previousChunks=Q},OG=(q,J,X,Q)=>{if(X)return 0;return Q.isWindowsNewline=J!==0&&q[J-1]==="\r",Q.isWindowsNewline?2:1},vG=function*({previousChunks:q}){if(q.length>0)yield q},x9=({binary:q,preserveNewlines:J,readableObjectMode:X,state:Q})=>q||J||X?void 0:{transform:NG.bind(void 0,Q)},NG=function*({isWindowsNewline:q=!1},J){let{unixNewline:X,windowsNewline:Q,LF:$,concatBytes:Z}=typeof J==="string"?EG:SG;if(J.at(-1)===$){yield J;return}yield Z(J,q?Q:X)},T3=(q,J)=>`${q}${J}`,EG={windowsNewline:`\r
|
|
74
|
-
`,unixNewline:`
|
|
75
|
-
`,LF:`
|
|
76
|
-
`,concatBytes:T3},yG=(q,J)=>{let X=new Uint8Array(q.length+J.length);return X.set(q,0),X.set(J,q.length),X},SG={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:yG};import{Buffer as hG}from"node:buffer";var j9=(q,J)=>q?void 0:bG.bind(void 0,J),bG=function*(q,J){if(typeof J!=="string"&&!O(J)&&!hG.isBuffer(J))throw TypeError(`The \`${q}\` option's transform must use "objectMode: true" to receive as input: ${typeof J}.`);yield J},R9=(q,J)=>q?gG.bind(void 0,J):fG.bind(void 0,J),gG=function*(q,J){F9(q,J),yield J},fG=function*(q,J){if(F9(q,J),typeof J!=="string"&&!O(J))throw TypeError(`The \`${q}\` option's function must yield a string or an Uint8Array, not ${typeof J}.`);yield J},F9=(q,J)=>{if(J===null||J===void 0)throw TypeError(`The \`${q}\` option's function must not call \`yield ${J}\`.
|
|
77
|
-
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
78
|
-
if (condition) { yield value; }`)};import{Buffer as uG}from"node:buffer";import{StringDecoder as mG}from"node:string_decoder";var h1=(q,J,X)=>{if(X)return;if(q)return{transform:dG.bind(void 0,new TextEncoder)};let Q=new mG(J);return{transform:cG.bind(void 0,Q),final:lG.bind(void 0,Q)}},dG=function*(q,J){if(uG.isBuffer(J))yield w0(J);else if(typeof J==="string")yield q.encode(J);else yield J},cG=function*(q,J){yield O(J)?q.write(J):J},lG=function*(q){let J=q.end();if(J!=="")yield J};import{callbackify as M9}from"node:util";var P3=M9(async(q,J,X,Q)=>{J.currentIterable=q(...X);try{for await(let $ of J.currentIterable)Q.push($)}finally{delete J.currentIterable}}),b1=async function*(q,J,X){if(X===J.length){yield q;return}let{transform:Q=nG}=J[X];for await(let $ of Q(q))yield*b1($,J,X+1)},C9=async function*(q){for(let[J,{final:X}]of Object.entries(q))yield*pG(X,Number(J),q)},pG=async function*(q,J,X){if(q===void 0)return;for await(let Q of q())yield*b1(Q,X,J+1)},k9=M9(async({currentIterable:q},J)=>{if(q!==void 0){await(J?q.throw(J):q.return());return}if(J)throw J}),nG=function*(q){yield q};var A3=(q,J,X,Q)=>{try{for(let $ of q(...J))X.push($);Q()}catch($){Q($)}},T9=(q,J)=>[...J.flatMap((X)=>[...q6(X,q,0)]),...Q2(q)],q6=function*(q,J,X){if(X===J.length){yield q;return}let{transform:Q=aG}=J[X];for(let $ of Q(q))yield*q6($,J,X+1)},Q2=function*(q){for(let[J,{final:X}]of Object.entries(q))yield*iG(X,Number(J),q)},iG=function*(q,J,X){if(q===void 0)return;for(let Q of q())yield*q6(Q,X,J+1)},aG=function*(q){yield q};var D3=({value:q,value:{transform:J,final:X,writableObjectMode:Q,readableObjectMode:$},optionName:Z},{encoding:Y})=>{let H={},K=P9(q,Y,Z),V=e0(J),G=e0(X),W=V?P3.bind(void 0,b1,H):A3.bind(void 0,q6),U=V||G?P3.bind(void 0,C9,H):A3.bind(void 0,Q2),z=V||G?k9.bind(void 0,H):void 0;return{stream:new oG({writableObjectMode:Q,writableHighWaterMark:w9(Q),readableObjectMode:$,readableHighWaterMark:w9($),transform(_,x,B){W([_,K,0],this,B)},flush(_){U([K],this,_)},destroy:z})}},g1=(q,J,X,Q)=>{let $=J.filter(({type:Y})=>Y==="generator"),Z=Q?$.reverse():$;for(let{value:Y,optionName:H}of Z){let K=P9(Y,X,H);q=T9(K,q)}return q},P9=({transform:q,final:J,binary:X,writableObjectMode:Q,readableObjectMode:$,preserveNewlines:Z},Y,H)=>{let K={};return[{transform:j9(Q,H)},h1(X,Y,Q),S1(X,Z,Q,K),{transform:q,final:J},{transform:R9($,H)},x9({binary:X,preserveNewlines:Z,readableObjectMode:$,state:K})].filter(Boolean)};var A9=(q,J)=>{for(let X of rG(q))sG(q,X,J)},rG=(q)=>new Set(Object.entries(q).filter(([,{direction:J}])=>J==="input").map(([J])=>Number(J))),sG=(q,J,X)=>{let{stdioItems:Q}=q[J],$=Q.filter(({contents:H})=>H!==void 0);if($.length===0)return;if(J!==0){let[{type:H,optionName:K}]=$;throw TypeError(`Only the \`stdin\` option, not \`${K}\`, can be ${b0[H]} with synchronous methods.`)}let Y=$.map(({contents:H})=>H).map((H)=>tG(H,Q));X.input=o6(Y)},tG=(q,J)=>{let X=g1(q,J,"utf8",!0);return eG(X),o6(X)},eG=(q)=>{let J=q.find((X)=>typeof X!=="string"&&!O(X));if(J!==void 0)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${J}.`)};import{writeFileSync as QW,appendFileSync as $W}from"node:fs";var f1=({stdioItems:q,encoding:J,verboseInfo:X,fdNumber:Q})=>Q!=="all"&&z6(X,Q)&&!s.has(J)&&qW(Q)&&(q.some(({type:$,value:Z})=>$==="native"&&JW.has(Z))||q.every(({type:$})=>Q0.has($))),qW=(q)=>q===1||q===2,JW=new Set(["pipe","overlapped"]),D9=async(q,J,X,Q)=>{for await(let $ of q)if(!XW(J))O9($,X,Q)},I9=(q,J,X)=>{for(let Q of q)O9(Q,J,X)},XW=(q)=>q._readableState.pipes.length>0,O9=(q,J,X)=>{let Q=r2(q);B0({type:"output",verboseMessage:Q,fdNumber:J,verboseInfo:X})};var v9=({fileDescriptors:q,syncResult:{output:J},options:X,isMaxBuffer:Q,verboseInfo:$})=>{if(J===null)return{output:Array.from({length:3})};let Z={},Y=new Set([]);return{output:J.map((K,V)=>ZW({result:K,fileDescriptors:q,fdNumber:V,state:Z,outputFiles:Y,isMaxBuffer:Q,verboseInfo:$},X)),...Z}},ZW=({result:q,fileDescriptors:J,fdNumber:X,state:Q,outputFiles:$,isMaxBuffer:Z,verboseInfo:Y},{buffer:H,encoding:K,lines:V,stripFinalNewline:G,maxBuffer:W})=>{if(q===null)return;let U=Nq(q,Z,W),z=w0(U),{stdioItems:L,objectMode:_}=J[X],x=YW([z],L,K,Q),{serializedResult:B,finalResult:j=B}=HW({chunks:x,objectMode:_,encoding:K,lines:V,stripFinalNewline:G,fdNumber:X});KW({serializedResult:B,fdNumber:X,state:Q,verboseInfo:Y,encoding:K,stdioItems:L,objectMode:_});let R=H[X]?j:void 0;try{if(Q.error===void 0)VW(B,L,$);return R}catch(M){return Q.error=M,R}},YW=(q,J,X,Q)=>{try{return g1(q,J,X,!1)}catch($){return Q.error=$,q}},HW=({chunks:q,objectMode:J,encoding:X,lines:Q,stripFinalNewline:$,fdNumber:Z})=>{if(J)return{serializedResult:q};if(X==="buffer")return{serializedResult:o6(q)};let Y=E7(q,X);if(Q[Z])return{serializedResult:Y,finalResult:w3(Y,!$[Z],J)};return{serializedResult:Y}},KW=({serializedResult:q,fdNumber:J,state:X,verboseInfo:Q,encoding:$,stdioItems:Z,objectMode:Y})=>{if(!f1({stdioItems:Z,encoding:$,verboseInfo:Q,fdNumber:J}))return;let H=w3(q,!1,Y);try{I9(H,J,Q)}catch(K){X.error??=K}},VW=(q,J,X)=>{for(let{path:Q,append:$}of J.filter(({type:Z})=>E1.has(Z))){let Z=typeof Q==="string"?Q:Q.toString();if($||X.has(Z))$W(Q,q);else X.add(Z),QW(Q,q)}};var N9=([,q,J],X)=>{if(!X.all)return;if(q===void 0)return J;if(J===void 0)return q;if(Array.isArray(q))return Array.isArray(J)?[...q,...J]:[...q,I0(J,X,"all")];if(Array.isArray(J))return[I0(q,X,"all"),...J];if(O(q)&&O(J))return c8([q,J]);return`${q}${J}`};import{once as I3}from"node:events";var E9=async(q,J)=>{let[X,Q]=await GW(q);return J.isForcefullyTerminated??=!1,[X,Q]},GW=async(q)=>{let[J,X]=await Promise.allSettled([I3(q,"spawn"),I3(q,"exit")]);if(J.status==="rejected")return[];return X.status==="rejected"?y9(q):X.value},y9=async(q)=>{try{return await I3(q,"exit")}catch{return y9(q)}},S9=async(q)=>{let[J,X]=await q;if(!WW(J,X)&&O3(J,X))throw new x0;return[J,X]},WW=(q,J)=>q===void 0&&J===void 0,O3=(q,J)=>q!==0||J!==null;var h9=({error:q,status:J,signal:X,output:Q},{maxBuffer:$})=>{let Z=UW(q,J,X),Y=Z?.code==="ETIMEDOUT",H=vq(Z,Q,$);return{resultError:Z,exitCode:J,signal:X,timedOut:Y,isMaxBuffer:H}},UW=(q,J,X)=>{if(q!==void 0)return q;return O3(J,X)?new x0:void 0};var b9=(q,J,X)=>{let{file:Q,commandArguments:$,command:Z,escapedCommand:Y,startTime:H,verboseInfo:K,options:V,fileDescriptors:G}=_W(q,J,X),W=xW({file:Q,commandArguments:$,options:V,command:Z,escapedCommand:Y,verboseInfo:K,fileDescriptors:G,startTime:H});return F6(W,K,V)},_W=(q,J,X)=>{let{command:Q,escapedCommand:$,startTime:Z,verboseInfo:Y}=t2(q,J,X),H=LW(X),{file:K,commandArguments:V,options:G}=F1(q,J,H);BW(G);let W=z9(G,Y);return{file:K,commandArguments:V,command:Q,escapedCommand:$,startTime:Z,verboseInfo:Y,options:G,fileDescriptors:W}},LW=(q)=>q.node&&!q.ipc?{...q,ipc:!1}:q,BW=({ipc:q,ipcInput:J,detached:X,cancelSignal:Q})=>{if(J)u1("ipcInput");if(q)u1("ipc: true");if(X)u1("detached: true");if(Q)u1("cancelSignal")},u1=(q)=>{throw TypeError(`The "${q}" option cannot be used with synchronous methods.`)},xW=({file:q,commandArguments:J,options:X,command:Q,escapedCommand:$,verboseInfo:Z,fileDescriptors:Y,startTime:H})=>{let K=jW({file:q,commandArguments:J,options:X,command:Q,escapedCommand:$,fileDescriptors:Y,startTime:H});if(K.failed)return K;let{resultError:V,exitCode:G,signal:W,timedOut:U,isMaxBuffer:z}=h9(K,X),{output:L,error:_=V}=v9({fileDescriptors:Y,syncResult:K,options:X,isMaxBuffer:z,verboseInfo:Z}),x=L.map((j,R)=>I0(j,X,R)),B=I0(N9(L,X),X,"all");return FW({error:_,exitCode:G,signal:W,timedOut:U,isMaxBuffer:z,stdio:x,all:B,options:X,command:Q,escapedCommand:$,startTime:H})},jW=({file:q,commandArguments:J,options:X,command:Q,escapedCommand:$,fileDescriptors:Z,startTime:Y})=>{try{A9(Z,X);let H=RW(X);return zW(...M1(q,J,H))}catch(H){return R6({error:H,command:Q,escapedCommand:$,fileDescriptors:Z,options:X,startTime:Y,isSync:!0})}},RW=({encoding:q,maxBuffer:J,...X})=>({...X,encoding:"buffer",maxBuffer:I1(J)}),FW=({error:q,exitCode:J,signal:X,timedOut:Q,isMaxBuffer:$,stdio:Z,all:Y,options:H,command:K,escapedCommand:V,startTime:G})=>q===void 0?O1({command:K,escapedCommand:V,stdio:Z,all:Y,ipcOutput:[],options:H,startTime:G}):X2({error:q,command:K,escapedCommand:V,timedOut:Q,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:$,isForcefullyTerminated:!1,exitCode:J,signal:X,stdio:Z,all:Y,ipcOutput:[],options:H,startTime:G,isSync:!0});import{setMaxListeners as Hz}from"node:events";import{spawn as Kz}from"node:child_process";import d9 from"node:process";import{once as v3,on as MW}from"node:events";var g9=({anyProcess:q,channel:J,isSubprocess:X,ipc:Q},{reference:$=!0,filter:Z}={})=>{return _6({methodName:"getOneMessage",isSubprocess:X,ipc:Q,isConnected:_1(q)}),CW({anyProcess:q,channel:J,isSubprocess:X,filter:Z,reference:$})},CW=async({anyProcess:q,channel:J,isSubprocess:X,filter:Q,reference:$})=>{G1(J,$);let Z=h0(q,J,X),Y=new AbortController;try{return await Promise.race([kW(Z,Q,Y),TW(Z,X,Y),wW(Z,X,Y)])}catch(H){throw L6(q),H}finally{Y.abort(),W1(J,$)}},kW=async(q,J,{signal:X})=>{if(J===void 0){let[Q]=await v3(q,"message",{signal:X});return Q}for await(let[Q]of MW(q,"message",{signal:X}))if(J(Q))return Q},TW=async(q,J,{signal:X})=>{await v3(q,"disconnect",{signal:X}),C5(J)},wW=async(q,J,{signal:X})=>{let[Q]=await v3(q,"strict:error",{signal:X});throw H1(Q,J)};import{once as u9,on as PW}from"node:events";var m9=({anyProcess:q,channel:J,isSubprocess:X,ipc:Q},{reference:$=!0}={})=>N3({anyProcess:q,channel:J,isSubprocess:X,ipc:Q,shouldAwait:!X,reference:$}),N3=({anyProcess:q,channel:J,isSubprocess:X,ipc:Q,shouldAwait:$,reference:Z})=>{_6({methodName:"getEachMessage",isSubprocess:X,ipc:Q,isConnected:_1(q)}),G1(J,Z);let Y=h0(q,J,X),H=new AbortController,K={};return AW(q,Y,H),DW({ipcEmitter:Y,isSubprocess:X,controller:H,state:K}),IW({anyProcess:q,channel:J,ipcEmitter:Y,isSubprocess:X,shouldAwait:$,controller:H,state:K,reference:Z})},AW=async(q,J,X)=>{try{await u9(J,"disconnect",{signal:X.signal}),X.abort()}catch{}},DW=async({ipcEmitter:q,isSubprocess:J,controller:X,state:Q})=>{try{let[$]=await u9(q,"strict:error",{signal:X.signal});Q.error=H1($,J),X.abort()}catch{}},IW=async function*({anyProcess:q,channel:J,ipcEmitter:X,isSubprocess:Q,shouldAwait:$,controller:Z,state:Y,reference:H}){try{for await(let[K]of PW(X,"message",{signal:Z.signal}))f9(Y),yield K}catch{f9(Y)}finally{if(Z.abort(),W1(J,H),!Q)L6(q);if($)await q}},f9=({error:q})=>{if(q)throw q};var c9=(q,{ipc:J})=>{Object.assign(q,p9(q,!1,J))},l9=()=>{let q=d9,J=!0,X=d9.channel!==void 0;return{...p9(q,!0,X),getCancelSignal:o5.bind(void 0,{anyProcess:q,channel:q.channel,isSubprocess:!0,ipc:X})}},p9=(q,J,X)=>({sendMessage:j1.bind(void 0,{anyProcess:q,channel:q.channel,isSubprocess:J,ipc:X}),getOneMessage:g9.bind(void 0,{anyProcess:q,channel:q.channel,isSubprocess:J,ipc:X}),getEachMessage:m9.bind(void 0,{anyProcess:q,channel:q.channel,isSubprocess:J,ipc:X})});import{ChildProcess as OW}from"node:child_process";import{PassThrough as vW,Readable as NW,Writable as EW,Duplex as yW}from"node:stream";var n9=({error:q,command:J,escapedCommand:X,fileDescriptors:Q,options:$,startTime:Z,verboseInfo:Y})=>{C3(Q);let H=new OW;SW(H,Q),Object.assign(H,{readable:hW,writable:bW,duplex:gW});let K=R6({error:q,command:J,escapedCommand:X,fileDescriptors:Q,options:$,startTime:Z,isSync:!1}),V=fW(K,Y,$);return{subprocess:H,promise:V}},SW=(q,J)=>{let X=$2(),Q=$2(),$=$2(),Z=Array.from({length:J.length-3},$2),Y=$2(),H=[X,Q,$,...Z];Object.assign(q,{stdin:X,stdout:Q,stderr:$,all:Y,stdio:H})},$2=()=>{let q=new vW;return q.end(),q},hW=()=>new NW({read(){}}),bW=()=>new EW({write(){}}),gW=()=>new yW({read(){},write(){}}),fW=async(q,J,X)=>F6(q,J,X);import{createReadStream as i9,createWriteStream as a9}from"node:fs";import{Buffer as uW}from"node:buffer";import{Readable as Z2,Writable as mW,Duplex as dW}from"node:stream";var r9=(q,J)=>y1(cW,q,J,!1),Y2=({type:q,optionName:J})=>{throw TypeError(`The \`${J}\` option cannot be ${b0[q]}.`)},o9={fileNumber:Y2,generator:D3,asyncGenerator:D3,nodeStream:({value:q})=>({stream:q}),webTransform({value:{transform:q,writableObjectMode:J,readableObjectMode:X}}){let Q=J||X;return{stream:dW.fromWeb(q,{objectMode:Q})}},duplex:({value:{transform:q}})=>({stream:q}),native(){}},cW={input:{...o9,fileUrl:({value:q})=>({stream:i9(q)}),filePath:({value:{file:q}})=>({stream:i9(q)}),webStream:({value:q})=>({stream:Z2.fromWeb(q)}),iterable:({value:q})=>({stream:Z2.from(q)}),asyncIterable:({value:q})=>({stream:Z2.from(q)}),string:({value:q})=>({stream:Z2.from(q)}),uint8Array:({value:q})=>({stream:Z2.from(uW.from(q))})},output:{...o9,fileUrl:({value:q})=>({stream:a9(q)}),filePath:({value:{file:q,append:J}})=>({stream:a9(q,J?{flags:"a"}:{})}),webStream:({value:q})=>({stream:mW.fromWeb(q)}),iterable:Y2,asyncIterable:Y2,string:Y2,uint8Array:Y2}};import{on as lW,once as s9}from"node:events";import{PassThrough as pW,getDefaultHighWaterMark as nW}from"node:stream";import{finished as qJ}from"node:stream/promises";function J6(q){if(!Array.isArray(q))throw TypeError(`Expected an array, got \`${typeof q}\`.`);for(let $ of q)E3($);let J=q.some(({readableObjectMode:$})=>$),X=iW(q,J),Q=new JJ({objectMode:J,writableHighWaterMark:X,readableHighWaterMark:X});for(let $ of q)Q.add($);return Q}var iW=(q,J)=>{if(q.length===0)return nW(J);let X=q.filter(({readableObjectMode:Q})=>Q===J).map(({readableHighWaterMark:Q})=>Q);return Math.max(...X)};class JJ extends pW{#q=new Set([]);#X=new Set([]);#J=new Set([]);#Q;#Z=Symbol("unpipe");#V=new WeakMap;add(q){if(E3(q),this.#q.has(q))return;this.#q.add(q),this.#Q??=aW(this,this.#q,this.#Z);let J=sW({passThroughStream:this,stream:q,streams:this.#q,ended:this.#X,aborted:this.#J,onFinished:this.#Q,unpipeEvent:this.#Z});this.#V.set(q,J),q.pipe(this,{end:!1})}async remove(q){if(E3(q),!this.#q.has(q))return!1;let J=this.#V.get(q);if(J===void 0)return!1;return this.#V.delete(q),q.unpipe(this),await J,!0}}var aW=async(q,J,X)=>{m1(q,t9);let Q=new AbortController;try{await Promise.race([oW(q,Q),rW(q,J,X,Q)])}finally{Q.abort(),m1(q,-t9)}},oW=async(q,{signal:J})=>{try{await qJ(q,{signal:J,cleanup:!0})}catch(X){throw XJ(q,X),X}},rW=async(q,J,X,{signal:Q})=>{for await(let[$]of lW(q,"unpipe",{signal:Q}))if(J.has($))$.emit(X)},E3=(q)=>{if(typeof q?.pipe!=="function")throw TypeError(`Expected a readable stream, got: \`${typeof q}\`.`)},sW=async({passThroughStream:q,stream:J,streams:X,ended:Q,aborted:$,onFinished:Z,unpipeEvent:Y})=>{m1(q,e9);let H=new AbortController;try{await Promise.race([tW(Z,J,H),eW({passThroughStream:q,stream:J,streams:X,ended:Q,aborted:$,controller:H}),qU({stream:J,streams:X,ended:Q,aborted:$,unpipeEvent:Y,controller:H})])}finally{H.abort(),m1(q,-e9)}if(X.size>0&&X.size===Q.size+$.size)if(Q.size===0&&$.size>0)y3(q);else JU(q)},tW=async(q,J,{signal:X})=>{try{if(await q,!X.aborted)y3(J)}catch(Q){if(!X.aborted)XJ(J,Q)}},eW=async({passThroughStream:q,stream:J,streams:X,ended:Q,aborted:$,controller:{signal:Z}})=>{try{if(await qJ(J,{signal:Z,cleanup:!0,readable:!0,writable:!1}),X.has(J))Q.add(J)}catch(Y){if(Z.aborted||!X.has(J))return;if(QJ(Y))$.add(J);else $J(q,Y)}},qU=async({stream:q,streams:J,ended:X,aborted:Q,unpipeEvent:$,controller:{signal:Z}})=>{if(await s9(q,$,{signal:Z}),!q.readable)return s9(Z,"abort",{signal:Z});J.delete(q),X.delete(q),Q.delete(q)},JU=(q)=>{if(q.writable)q.end()},XJ=(q,J)=>{if(QJ(J))y3(q);else $J(q,J)},QJ=(q)=>q?.code==="ERR_STREAM_PREMATURE_CLOSE",y3=(q)=>{if(q.readable||q.writable)q.destroy()},$J=(q,J)=>{if(!q.destroyed)q.once("error",XU),q.destroy(J)},XU=()=>{},m1=(q,J)=>{let X=q.getMaxListeners();if(X!==0&&X!==Number.POSITIVE_INFINITY)q.setMaxListeners(X+J)},t9=2,e9=1;import{finished as ZJ}from"node:stream/promises";var C6=(q,J)=>{q.pipe(J),QU(q,J),$U(q,J)},QU=async(q,J)=>{if(H0(q)||H0(J))return;try{await ZJ(q,{cleanup:!0,readable:!0,writable:!1})}catch{}S3(J)},S3=(q)=>{if(q.writable)q.end()},$U=async(q,J)=>{if(H0(q)||H0(J))return;try{await ZJ(J,{cleanup:!0,readable:!1,writable:!0})}catch{}h3(q)},h3=(q)=>{if(q.readable)q.destroy()};var YJ=(q,J,X)=>{let Q=new Map;for(let[$,{stdioItems:Z,direction:Y}]of Object.entries(J)){for(let{stream:H}of Z.filter(({type:K})=>Q0.has(K)))ZU(q,H,Y,$);for(let{stream:H}of Z.filter(({type:K})=>!Q0.has(K)))HU({subprocess:q,stream:H,direction:Y,fdNumber:$,pipeGroups:Q,controller:X})}for(let[$,Z]of Q.entries()){let Y=Z.length===1?Z[0]:J6(Z);C6(Y,$)}},ZU=(q,J,X,Q)=>{if(X==="output")C6(q.stdio[Q],J);else C6(J,q.stdio[Q]);let $=YU[Q];if($!==void 0)q[$]=J;q.stdio[Q]=J},YU=["stdin","stdout","stderr"],HU=({subprocess:q,stream:J,direction:X,fdNumber:Q,pipeGroups:$,controller:Z})=>{if(J===void 0)return;KU(J,Z);let[Y,H]=X==="output"?[J,q.stdio[Q]]:[q.stdio[Q],J],K=$.get(Y)??[];$.set(Y,[...K,H])},KU=(q,{signal:J})=>{if(H0(q))s0(q,VU,J)},VU=2;import{addAbortListener as UU}from"node:events";var X6=[];X6.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")X6.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")X6.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var d1=(q)=>!!q&&typeof q==="object"&&typeof q.removeListener==="function"&&typeof q.emit==="function"&&typeof q.reallyExit==="function"&&typeof q.listeners==="function"&&typeof q.kill==="function"&&typeof q.pid==="number"&&typeof q.on==="function",b3=Symbol.for("signal-exit emitter"),g3=globalThis,GU=Object.defineProperty.bind(Object);class HJ{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(g3[b3])return g3[b3];GU(g3,b3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(q,J){this.listeners[q].push(J)}removeListener(q,J){let X=this.listeners[q],Q=X.indexOf(J);if(Q===-1)return;if(Q===0&&X.length===1)X.length=0;else X.splice(Q,1)}emit(q,J,X){if(this.emitted[q])return!1;this.emitted[q]=!0;let Q=!1;for(let $ of this.listeners[q])Q=$(J,X)===!0||Q;if(q==="exit")Q=this.emit("afterExit",J,X)||Q;return Q}}class u3{}var WU=(q)=>{return{onExit(J,X){return q.onExit(J,X)},load(){return q.load()},unload(){return q.unload()}}};class KJ extends u3{onExit(){return()=>{}}load(){}unload(){}}class VJ extends u3{#q=f3.platform==="win32"?"SIGINT":"SIGHUP";#X=new HJ;#J;#Q;#Z;#V={};#U=!1;constructor(q){super();this.#J=q,this.#V={};for(let J of X6)this.#V[J]=()=>{let X=this.#J.listeners(J),{count:Q}=this.#X,$=q;if(typeof $.__signal_exit_emitter__==="object"&&typeof $.__signal_exit_emitter__.count==="number")Q+=$.__signal_exit_emitter__.count;if(X.length===Q){this.unload();let Z=this.#X.emit("exit",null,J),Y=J==="SIGHUP"?this.#q:J;if(!Z)q.kill(q.pid,Y)}};this.#Z=q.reallyExit,this.#Q=q.emit}onExit(q,J){if(!d1(this.#J))return()=>{};if(this.#U===!1)this.load();let X=J?.alwaysLast?"afterExit":"exit";return this.#X.on(X,q),()=>{if(this.#X.removeListener(X,q),this.#X.listeners.exit.length===0&&this.#X.listeners.afterExit.length===0)this.unload()}}load(){if(this.#U)return;this.#U=!0,this.#X.count+=1;for(let q of X6)try{let J=this.#V[q];if(J)this.#J.on(q,J)}catch(J){}this.#J.emit=(q,...J)=>{return this.#H(q,...J)},this.#J.reallyExit=(q)=>{return this.#W(q)}}unload(){if(!this.#U)return;this.#U=!1,X6.forEach((q)=>{let J=this.#V[q];if(!J)throw Error("Listener not defined for signal: "+q);try{this.#J.removeListener(q,J)}catch(X){}}),this.#J.emit=this.#Q,this.#J.reallyExit=this.#Z,this.#X.count-=1}#W(q){if(!d1(this.#J))return 0;return this.#J.exitCode=q||0,this.#X.emit("exit",this.#J.exitCode,null),this.#Z.call(this.#J,this.#J.exitCode)}#H(q,...J){let X=this.#Q;if(q==="exit"&&d1(this.#J)){if(typeof J[0]==="number")this.#J.exitCode=J[0];let Q=X.call(this.#J,q,...J);return this.#X.emit("exit",this.#J.exitCode,null),Q}else return X.call(this.#J,q,...J)}}var f3=globalThis.process,{onExit:GJ,load:jP,unload:RP}=WU(d1(f3)?new VJ(f3):new KJ);var WJ=(q,{cleanup:J,detached:X},{signal:Q})=>{if(!J||X)return;let $=GJ(()=>{q.kill()});UU(Q,()=>{$()})};var zJ=({source:q,sourcePromise:J,boundOptions:X,createNested:Q},...$)=>{let Z=s2(),{destination:Y,destinationStream:H,destinationError:K,from:V,unpipeSignal:G}=zU(X,Q,$),{sourceStream:W,sourceError:U}=LU(q,V),{options:z,fileDescriptors:L}=R0.get(q);return{sourcePromise:J,sourceStream:W,sourceOptions:z,sourceError:U,destination:Y,destinationStream:H,destinationError:K,unpipeSignal:G,fileDescriptors:L,startTime:Z}},zU=(q,J,X)=>{try{let{destination:Q,pipeOptions:{from:$,to:Z,unpipeSignal:Y}={}}=_U(q,J,...X),H=V1(Q,Z);return{destination:Q,destinationStream:H,from:$,unpipeSignal:Y}}catch(Q){return{destinationError:Q}}},_U=(q,J,X,...Q)=>{if(Array.isArray(X))return{destination:J(UJ,q)(X,...Q),pipeOptions:q};if(typeof X==="string"||X instanceof URL||m8(X)){if(Object.keys(q).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[$,Z,Y]=m2(X,...Q);return{destination:J(UJ)($,Z,Y),pipeOptions:Y}}if(R0.has(X)){if(Object.keys(q).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:X,pipeOptions:Q[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${X}`)},UJ=({options:q})=>({options:{...q,stdin:"pipe",piped:!0}}),LU=(q,J)=>{try{return{sourceStream:B6(q,J)}}catch(X){return{sourceError:X}}};var LJ=({sourceStream:q,sourceError:J,destinationStream:X,destinationError:Q,fileDescriptors:$,sourceOptions:Z,startTime:Y})=>{let H=BU({sourceStream:q,sourceError:J,destinationStream:X,destinationError:Q});if(H!==void 0)throw m3({error:H,fileDescriptors:$,sourceOptions:Z,startTime:Y})},BU=({sourceStream:q,sourceError:J,destinationStream:X,destinationError:Q})=>{if(J!==void 0&&Q!==void 0)return Q;if(Q!==void 0)return h3(q),Q;if(J!==void 0)return S3(X),J},m3=({error:q,fileDescriptors:J,sourceOptions:X,startTime:Q})=>R6({error:q,command:_J,escapedCommand:_J,fileDescriptors:J,options:X,startTime:Q,isSync:!1}),_J="source.pipe(destination)";var BJ=async(q)=>{let[{status:J,reason:X,value:Q=X},{status:$,reason:Z,value:Y=Z}]=await q;if(!Y.pipedFrom.includes(Q))Y.pipedFrom.push(Q);if($==="rejected")throw Y;if(J==="rejected")throw Q;return Y};import{finished as xU}from"node:stream/promises";var xJ=(q,J,X)=>{let Q=c1.has(J)?RU(q,J):jU(q,J);return s0(q,MU,X.signal),s0(J,CU,X.signal),FU(J),Q},jU=(q,J)=>{let X=J6([q]);return C6(X,J),c1.set(J,X),X},RU=(q,J)=>{let X=c1.get(J);return X.add(q),X},FU=async(q)=>{try{await xU(q,{cleanup:!0,readable:!1,writable:!0})}catch{}c1.delete(q)},c1=new WeakMap,MU=2,CU=1;import{aborted as kU}from"node:util";var jJ=(q,J)=>q===void 0?[]:[TU(q,J)],TU=async(q,{sourceStream:J,mergedStream:X,fileDescriptors:Q,sourceOptions:$,startTime:Z})=>{await kU(q,J),await X.remove(J);let Y=Error("Pipe canceled by `unpipeSignal` option.");throw m3({error:Y,fileDescriptors:Q,sourceOptions:$,startTime:Z})};var l1=(q,...J)=>{if(D(J[0]))return l1.bind(void 0,{...q,boundOptions:{...q.boundOptions,...J[0]}});let{destination:X,...Q}=zJ(q,...J),$=wU({...Q,destination:X});return $.pipe=l1.bind(void 0,{...q,source:X,sourcePromise:$,boundOptions:{}}),$},wU=async({sourcePromise:q,sourceStream:J,sourceOptions:X,sourceError:Q,destination:$,destinationStream:Z,destinationError:Y,unpipeSignal:H,fileDescriptors:K,startTime:V})=>{let G=PU(q,$);LJ({sourceStream:J,sourceError:Q,destinationStream:Z,destinationError:Y,fileDescriptors:K,sourceOptions:X,startTime:V});let W=new AbortController;try{let U=xJ(J,Z,W);return await Promise.race([BJ(G),...jJ(H,{sourceStream:J,mergedStream:U,sourceOptions:X,fileDescriptors:K,startTime:V})])}finally{W.abort()}},PU=(q,J)=>Promise.allSettled([q,J]);import{setImmediate as EU}from"node:timers/promises";import{on as AU}from"node:events";import{getDefaultHighWaterMark as DU}from"node:stream";var p1=({subprocessStdout:q,subprocess:J,binary:X,shouldEncode:Q,encoding:$,preserveNewlines:Z})=>{let Y=new AbortController;return IU(J,Y),FJ({stream:q,controller:Y,binary:X,shouldEncode:!q.readableObjectMode&&Q,encoding:$,shouldSplit:!q.readableObjectMode,preserveNewlines:Z})},IU=async(q,J)=>{try{await q}catch{}finally{J.abort()}},d3=({stream:q,onStreamEnd:J,lines:X,encoding:Q,stripFinalNewline:$,allMixed:Z})=>{let Y=new AbortController;OU(J,Y,q);let H=q.readableObjectMode&&!Z;return FJ({stream:q,controller:Y,binary:Q==="buffer",shouldEncode:!H,encoding:Q,shouldSplit:!H&&X,preserveNewlines:!$})},OU=async(q,J,X)=>{try{await q}catch{X.destroy()}finally{J.abort()}},FJ=({stream:q,controller:J,binary:X,shouldEncode:Q,encoding:$,shouldSplit:Z,preserveNewlines:Y})=>{let H=AU(q,"data",{signal:J.signal,highWaterMark:RJ,highWatermark:RJ});return vU({onStdoutChunk:H,controller:J,binary:X,shouldEncode:Q,encoding:$,shouldSplit:Z,preserveNewlines:Y})},c3=DU(!0),RJ=c3,vU=async function*({onStdoutChunk:q,controller:J,binary:X,shouldEncode:Q,encoding:$,shouldSplit:Z,preserveNewlines:Y}){let H=NU({binary:X,shouldEncode:Q,encoding:$,shouldSplit:Z,preserveNewlines:Y});try{for await(let[K]of q)yield*q6(K,H,0)}catch(K){if(!J.signal.aborted)throw K}finally{yield*Q2(H)}},NU=({binary:q,shouldEncode:J,encoding:X,shouldSplit:Q,preserveNewlines:$})=>[h1(q,X,!J),S1(q,$,!Q,{})].filter(Boolean);var MJ=async({stream:q,onStreamEnd:J,fdNumber:X,encoding:Q,buffer:$,maxBuffer:Z,lines:Y,allMixed:H,stripFinalNewline:K,verboseInfo:V,streamInfo:G})=>{let W=yU({stream:q,onStreamEnd:J,fdNumber:X,encoding:Q,allMixed:H,verboseInfo:V,streamInfo:G});if(!$){await Promise.all([SU(q),W]);return}let U=k3(K,X),z=d3({stream:q,onStreamEnd:J,lines:Y,encoding:Q,stripFinalNewline:U,allMixed:H}),[L]=await Promise.all([hU({stream:q,iterable:z,fdNumber:X,encoding:Q,maxBuffer:Z,lines:Y}),W]);return L},yU=async({stream:q,onStreamEnd:J,fdNumber:X,encoding:Q,allMixed:$,verboseInfo:Z,streamInfo:{fileDescriptors:Y}})=>{if(!f1({stdioItems:Y[X]?.stdioItems,encoding:Q,verboseInfo:Z,fdNumber:X}))return;let H=d3({stream:q,onStreamEnd:J,lines:!0,encoding:Q,stripFinalNewline:!0,allMixed:$});await D9(H,q,X,Z)},SU=async(q)=>{if(await EU(),q.readableFlowing===null)q.resume()},hU=async({stream:q,stream:{readableObjectMode:J},iterable:X,fdNumber:Q,encoding:$,maxBuffer:Z,lines:Y})=>{try{if(J||Y)return await w1(X,{maxBuffer:Z});if($==="buffer")return new Uint8Array(await P1(X,{maxBuffer:Z}));return await D1(X,{maxBuffer:Z})}catch(H){return CJ(Dq({error:H,stream:q,readableObjectMode:J,lines:Y,encoding:$,fdNumber:Q}))}},l3=async(q)=>{try{return await q}catch(J){return CJ(J)}},CJ=({bufferedData:q})=>v7(q)?new Uint8Array(q):q;import{finished as bU}from"node:stream/promises";var H2=async(q,J,X,{isSameDirection:Q,stopOnExit:$=!1}={})=>{let Z=gU(q,X),Y=new AbortController;try{await Promise.race([...$?[X.exitPromise]:[],bU(q,{cleanup:!0,signal:Y.signal})])}catch(H){if(!Z.stdinCleanedUp)mU(H,J,X,Q)}finally{Y.abort()}},gU=(q,{originalStreams:[J],subprocess:X})=>{let Q={stdinCleanedUp:!1};if(q===J)fU(q,X,Q);return Q},fU=(q,J,X)=>{let{_destroy:Q}=q;q._destroy=(...$)=>{uU(J,X),Q.call(q,...$)}},uU=({exitCode:q,signalCode:J},X)=>{if(q!==null||J!==null)X.stdinCleanedUp=!0},mU=(q,J,X,Q)=>{if(!dU(q,J,X,Q))throw q},dU=(q,J,X,Q=!0)=>{if(X.propagating)return kJ(q)||n1(q);return X.propagating=!0,p3(X,J)===Q?kJ(q):n1(q)},p3=({fileDescriptors:q},J)=>J!=="all"&&q[J].direction==="input",n1=(q)=>q?.code==="ERR_STREAM_PREMATURE_CLOSE",kJ=(q)=>q?.code==="EPIPE";var TJ=({subprocess:q,encoding:J,buffer:X,maxBuffer:Q,lines:$,stripFinalNewline:Z,verboseInfo:Y,streamInfo:H})=>q.stdio.map((K,V)=>n3({stream:K,fdNumber:V,encoding:J,buffer:X[V],maxBuffer:Q[V],lines:$[V],allMixed:!1,stripFinalNewline:Z,verboseInfo:Y,streamInfo:H})),n3=async({stream:q,fdNumber:J,encoding:X,buffer:Q,maxBuffer:$,lines:Z,allMixed:Y,stripFinalNewline:H,verboseInfo:K,streamInfo:V})=>{if(!q)return;let G=H2(q,J,V);if(p3(V,J)){await G;return}let[W]=await Promise.all([MJ({stream:q,onStreamEnd:G,fdNumber:J,encoding:X,buffer:Q,maxBuffer:$,lines:Z,allMixed:Y,stripFinalNewline:H,verboseInfo:K,streamInfo:V}),G]);return W};var wJ=({stdout:q,stderr:J},{all:X})=>X&&(q||J)?J6([q,J].filter(Boolean)):void 0,PJ=({subprocess:q,encoding:J,buffer:X,maxBuffer:Q,lines:$,stripFinalNewline:Z,verboseInfo:Y,streamInfo:H})=>n3({...cU(q,X),fdNumber:"all",encoding:J,maxBuffer:Q[1]+Q[2],lines:$[1]||$[2],allMixed:lU(q),stripFinalNewline:Z,verboseInfo:Y,streamInfo:H}),cU=({stdout:q,stderr:J,all:X},[,Q,$])=>{let Z=Q||$;if(!Z)return{stream:X,buffer:Z};if(!Q)return{stream:J,buffer:Z};if(!$)return{stream:q,buffer:Z};return{stream:X,buffer:Z}},lU=({all:q,stdout:J,stderr:X})=>q&&J&&X&&J.readableObjectMode!==X.readableObjectMode;import{once as pU}from"node:events";var AJ=(q)=>z6(q,"ipc"),DJ=(q,J)=>{let X=r2(q);B0({type:"ipc",verboseMessage:X,fdNumber:"ipc",verboseInfo:J})};var IJ=async({subprocess:q,buffer:J,maxBuffer:X,ipc:Q,ipcOutput:$,verboseInfo:Z})=>{if(!Q)return $;let Y=AJ(Z),H=P0(J,"ipc"),K=P0(X,"ipc");for await(let V of N3({anyProcess:q,channel:q.channel,isSubprocess:!1,ipc:Q,shouldAwait:!1,reference:!0})){if(H)Iq(q,$,K),$.push(V);if(Y)DJ(V,Z)}return $},OJ=async(q,J)=>{return await Promise.allSettled([q]),J};var vJ=async({subprocess:q,options:{encoding:J,buffer:X,maxBuffer:Q,lines:$,timeoutDuration:Z,cancelSignal:Y,gracefulCancel:H,forceKillAfterDelay:K,stripFinalNewline:V,ipc:G,ipcInput:W},context:U,verboseInfo:z,fileDescriptors:L,originalStreams:_,onInternalError:x,controller:B})=>{let j=E9(q,U),R={originalStreams:_,fileDescriptors:L,subprocess:q,exitPromise:j,propagating:!1},M=TJ({subprocess:q,encoding:J,buffer:X,maxBuffer:Q,lines:$,stripFinalNewline:V,verboseInfo:z,streamInfo:R}),F=PJ({subprocess:q,encoding:J,buffer:X,maxBuffer:Q,lines:$,stripFinalNewline:V,verboseInfo:z,streamInfo:R}),I=[],P=IJ({subprocess:q,buffer:X,maxBuffer:Q,ipc:G,ipcOutput:I,verboseInfo:z}),g=nU(_,q,R),m=iU(L,R);try{return await Promise.race([Promise.all([{},S9(j),Promise.all(M),F,P,Zq(q,W),...g,...m]),x,aU(q,B),...qq(q,Z,U,B),...M5({subprocess:q,cancelSignal:Y,gracefulCancel:H,context:U,controller:B}),...t5({subprocess:q,cancelSignal:Y,gracefulCancel:H,forceKillAfterDelay:K,context:U,controller:B})])}catch(n0){return U.terminationReason??="other",Promise.all([{error:n0},j,Promise.all(M.map((v6)=>l3(v6))),l3(F),OJ(P,I),Promise.allSettled(g),Promise.allSettled(m)])}},nU=(q,J,X)=>q.map((Q,$)=>Q===J.stdio[$]?void 0:H2(Q,$,X)),iU=(q,J)=>q.flatMap(({stdioItems:X},Q)=>X.filter(({value:$,stream:Z=$})=>V0(Z,{checkOpen:!1})&&!H0(Z)).map(({type:$,value:Z,stream:Y=Z})=>H2(Y,Q,J,{isSameDirection:Q0.has($),stopOnExit:$==="native"}))),aU=async(q,{signal:J})=>{let[X]=await pU(q,"error",{signal:J});throw X};var NJ=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),K2=(q,J,X)=>{let Q=q[X];if(!Q.has(J))Q.set(J,[]);let $=Q.get(J),Z=j0();return $.push(Z),{resolve:Z.resolve.bind(Z),promises:$}},k6=async({resolve:q,promises:J},X)=>{q();let[Q]=await Promise.race([Promise.allSettled([!0,X]),Promise.all([!1,...J])]);return!Q};import{Readable as oU}from"node:stream";import{callbackify as rU}from"node:util";import{finished as EJ}from"node:stream/promises";var i3=async(q)=>{if(q===void 0)return;try{await a3(q)}catch{}},yJ=async(q)=>{if(q===void 0)return;try{await o3(q)}catch{}},a3=async(q)=>{await EJ(q,{cleanup:!0,readable:!1,writable:!0})},o3=async(q)=>{await EJ(q,{cleanup:!0,readable:!0,writable:!1})},i1=async(q,J)=>{if(await q,J)throw J},a1=(q,J,X)=>{if(X&&!n1(X))q.destroy(X);else if(J)q.destroy()};var SJ=({subprocess:q,concurrentStreams:J,encoding:X},{from:Q,binary:$=!0,preserveNewlines:Z=!0}={})=>{let Y=$||s.has(X),{subprocessStdout:H,waitReadableDestroy:K}=r3(q,Q,J),{readableEncoding:V,readableObjectMode:G,readableHighWaterMark:W}=s3(H,Y),{read:U,onStdoutDataDone:z}=t3({subprocessStdout:H,subprocess:q,binary:Y,encoding:X,preserveNewlines:Z}),L=new oU({read:U,destroy:rU(q4.bind(void 0,{subprocessStdout:H,subprocess:q,waitReadableDestroy:K})),highWaterMark:W,objectMode:G,encoding:V});return e3({subprocessStdout:H,onStdoutDataDone:z,readable:L,subprocess:q}),L},r3=(q,J,X)=>{let Q=B6(q,J),$=K2(X,Q,"readableDestroy");return{subprocessStdout:Q,waitReadableDestroy:$}},s3=({readableEncoding:q,readableObjectMode:J,readableHighWaterMark:X},Q)=>Q?{readableEncoding:q,readableObjectMode:J,readableHighWaterMark:X}:{readableEncoding:q,readableObjectMode:!0,readableHighWaterMark:c3},t3=({subprocessStdout:q,subprocess:J,binary:X,encoding:Q,preserveNewlines:$})=>{let Z=j0(),Y=p1({subprocessStdout:q,subprocess:J,binary:X,shouldEncode:!X,encoding:Q,preserveNewlines:$});return{read(){sU(this,Y,Z)},onStdoutDataDone:Z}},sU=async(q,J,X)=>{try{let{value:Q,done:$}=await J.next();if($)X.resolve();else q.push(Q)}catch{}},e3=async({subprocessStdout:q,onStdoutDataDone:J,readable:X,subprocess:Q,subprocessStdin:$})=>{try{if(await o3(q),await Q,await i3($),await J,X.readable)X.push(null)}catch(Z){await i3($),hJ(X,Z)}},q4=async({subprocessStdout:q,subprocess:J,waitReadableDestroy:X},Q)=>{if(await k6(X,J))hJ(q,Q),await i1(J,Q)},hJ=(q,J)=>{a1(q,q.readable,J)};import{Writable as tU}from"node:stream";import{callbackify as bJ}from"node:util";var gJ=({subprocess:q,concurrentStreams:J},{to:X}={})=>{let{subprocessStdin:Q,waitWritableFinal:$,waitWritableDestroy:Z}=J4(q,X,J),Y=new tU({...X4(Q,q,$),destroy:bJ($4.bind(void 0,{subprocessStdin:Q,subprocess:q,waitWritableFinal:$,waitWritableDestroy:Z})),highWaterMark:Q.writableHighWaterMark,objectMode:Q.writableObjectMode});return Q4(Q,Y),Y},J4=(q,J,X)=>{let Q=V1(q,J),$=K2(X,Q,"writableFinal"),Z=K2(X,Q,"writableDestroy");return{subprocessStdin:Q,waitWritableFinal:$,waitWritableDestroy:Z}},X4=(q,J,X)=>({write:eU.bind(void 0,q),final:bJ(qz.bind(void 0,q,J,X))}),eU=(q,J,X,Q)=>{if(q.write(J,X))Q();else q.once("drain",Q)},qz=async(q,J,X)=>{if(await k6(X,J)){if(q.writable)q.end();await J}},Q4=async(q,J,X)=>{try{if(await a3(q),J.writable)J.end()}catch(Q){await yJ(X),fJ(J,Q)}},$4=async({subprocessStdin:q,subprocess:J,waitWritableFinal:X,waitWritableDestroy:Q},$)=>{if(await k6(X,J),await k6(Q,J))fJ(q,$),await i1(J,$)},fJ=(q,J)=>{a1(q,q.writable,J)};import{Duplex as Jz}from"node:stream";import{callbackify as Xz}from"node:util";var uJ=({subprocess:q,concurrentStreams:J,encoding:X},{from:Q,to:$,binary:Z=!0,preserveNewlines:Y=!0}={})=>{let H=Z||s.has(X),{subprocessStdout:K,waitReadableDestroy:V}=r3(q,Q,J),{subprocessStdin:G,waitWritableFinal:W,waitWritableDestroy:U}=J4(q,$,J),{readableEncoding:z,readableObjectMode:L,readableHighWaterMark:_}=s3(K,H),{read:x,onStdoutDataDone:B}=t3({subprocessStdout:K,subprocess:q,binary:H,encoding:X,preserveNewlines:Y}),j=new Jz({read:x,...X4(G,q,W),destroy:Xz(Qz.bind(void 0,{subprocessStdout:K,subprocessStdin:G,subprocess:q,waitReadableDestroy:V,waitWritableFinal:W,waitWritableDestroy:U})),readableHighWaterMark:_,writableHighWaterMark:G.writableHighWaterMark,readableObjectMode:L,writableObjectMode:G.writableObjectMode,encoding:z});return e3({subprocessStdout:K,onStdoutDataDone:B,readable:j,subprocess:q,subprocessStdin:G}),Q4(G,j,K),j},Qz=async({subprocessStdout:q,subprocessStdin:J,subprocess:X,waitReadableDestroy:Q,waitWritableFinal:$,waitWritableDestroy:Z},Y)=>{await Promise.all([q4({subprocessStdout:q,subprocess:X,waitReadableDestroy:Q},Y),$4({subprocessStdin:J,subprocess:X,waitWritableFinal:$,waitWritableDestroy:Z},Y)])};var Z4=(q,J,{from:X,binary:Q=!1,preserveNewlines:$=!1}={})=>{let Z=Q||s.has(J),Y=B6(q,X),H=p1({subprocessStdout:Y,subprocess:q,binary:Z,shouldEncode:!0,encoding:J,preserveNewlines:$});return $z(H,Y,q)},$z=async function*(q,J,X){try{yield*q}finally{if(J.readable)J.destroy();await X}};var mJ=(q,{encoding:J})=>{let X=NJ();q.readable=SJ.bind(void 0,{subprocess:q,concurrentStreams:X,encoding:J}),q.writable=gJ.bind(void 0,{subprocess:q,concurrentStreams:X}),q.duplex=uJ.bind(void 0,{subprocess:q,concurrentStreams:X,encoding:J}),q.iterable=Z4.bind(void 0,q,J),q[Symbol.asyncIterator]=Z4.bind(void 0,q,J,{})};var dJ=(q,J)=>{for(let[X,Q]of Yz){let $=Q.value.bind(J);Reflect.defineProperty(q,X,{...Q,value:$})}},Zz=(async()=>{})().constructor.prototype,Yz=["then","catch","finally"].map((q)=>[q,Reflect.getOwnPropertyDescriptor(Zz,q)]);var cJ=(q,J,X,Q)=>{let{file:$,commandArguments:Z,command:Y,escapedCommand:H,startTime:K,verboseInfo:V,options:G,fileDescriptors:W}=Vz(q,J,X),{subprocess:U,promise:z}=Wz({file:$,commandArguments:Z,options:G,startTime:K,verboseInfo:V,command:Y,escapedCommand:H,fileDescriptors:W});return U.pipe=l1.bind(void 0,{source:U,sourcePromise:z,boundOptions:{},createNested:Q}),dJ(U,z),R0.set(U,{options:G,fileDescriptors:W}),U},Vz=(q,J,X)=>{let{command:Q,escapedCommand:$,startTime:Z,verboseInfo:Y}=t2(q,J,X),{file:H,commandArguments:K,options:V}=F1(q,J,X),G=Gz(V),W=r9(G,Y);return{file:H,commandArguments:K,command:Q,escapedCommand:$,startTime:Z,verboseInfo:Y,options:G,fileDescriptors:W}},Gz=({timeout:q,signal:J,...X})=>{if(J!==void 0)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...X,timeoutDuration:q}},Wz=({file:q,commandArguments:J,options:X,startTime:Q,verboseInfo:$,command:Z,escapedCommand:Y,fileDescriptors:H})=>{let K;try{K=Kz(...M1(q,J,X))}catch(L){return n9({error:L,command:Z,escapedCommand:Y,fileDescriptors:H,options:X,startTime:Q,verboseInfo:$})}let V=new AbortController;Hz(Number.POSITIVE_INFINITY,V.signal);let G=[...K.stdio];YJ(K,H,V),WJ(K,X,V);let W={},U=j0();K.kill=R5.bind(void 0,{kill:K.kill.bind(K),options:X,onInternalError:U,context:W,controller:V}),K.all=wJ(K,X),mJ(K,X),c9(K,X);let z=Uz({subprocess:K,options:X,startTime:Q,verboseInfo:$,fileDescriptors:H,originalStreams:G,command:Z,escapedCommand:Y,context:W,onInternalError:U,controller:V});return{subprocess:K,promise:z}},Uz=async({subprocess:q,options:J,startTime:X,verboseInfo:Q,fileDescriptors:$,originalStreams:Z,command:Y,escapedCommand:H,context:K,onInternalError:V,controller:G})=>{let[W,[U,z],L,_,x]=await vJ({subprocess:q,options:J,context:K,verboseInfo:Q,fileDescriptors:$,originalStreams:Z,onInternalError:V,controller:G});G.abort(),V.resolve();let B=L.map((M,F)=>I0(M,J,F)),j=I0(_,J,"all"),R=zz({errorInfo:W,exitCode:U,signal:z,stdio:B,all:j,ipcOutput:x,context:K,options:J,command:Y,escapedCommand:H,startTime:X});return F6(R,Q,J)},zz=({errorInfo:q,exitCode:J,signal:X,stdio:Q,all:$,ipcOutput:Z,context:Y,options:H,command:K,escapedCommand:V,startTime:G})=>("error"in q)?X2({error:q.error,command:K,escapedCommand:V,timedOut:Y.terminationReason==="timeout",isCanceled:Y.terminationReason==="cancel"||Y.terminationReason==="gracefulCancel",isGracefullyCanceled:Y.terminationReason==="gracefulCancel",isMaxBuffer:q.error instanceof A0,isForcefullyTerminated:Y.isForcefullyTerminated,exitCode:J,signal:X,stdio:Q,all:$,ipcOutput:Z,options:H,startTime:G,isSync:!1}):O1({command:K,escapedCommand:V,stdio:Q,all:$,ipcOutput:Z,options:H,startTime:G});var o1=(q,J)=>{let X=Object.fromEntries(Object.entries(J).map(([Q,$])=>[Q,_z(Q,q[Q],$)]));return{...q,...X}},_z=(q,J,X)=>{if(Lz.has(q)&&D(J)&&D(X))return{...J,...X};return X},Lz=new Set(["env",...i8]);var g0=(q,J,X,Q)=>{let $=(Y,H,K)=>g0(Y,H,X,K),Z=(...Y)=>Bz({mapArguments:q,deepOptions:X,boundOptions:J,setBoundExeca:Q,createNested:$},...Y);if(Q!==void 0)Q(Z,$,J);return Z},Bz=({mapArguments:q,deepOptions:J={},boundOptions:X={},setBoundExeca:Q,createNested:$},Z,...Y)=>{if(D(Z))return $(q,o1(X,Z),Q);let{file:H,commandArguments:K,options:V,isSync:G}=xz({mapArguments:q,firstArgument:Z,nextArguments:Y,deepOptions:J,boundOptions:X});return G?b9(H,K,V):cJ(H,K,V,$)},xz=({mapArguments:q,firstArgument:J,nextArguments:X,deepOptions:Q,boundOptions:$})=>{let Z=b7(J)?g7(J,X):[J,...X],[Y,H,K]=m2(...Z),V=o1(o1(Q,$),K),{file:G=Y,commandArguments:W=H,options:U=V,isSync:z=!1}=q({file:Y,commandArguments:H,options:V});return{file:G,commandArguments:W,options:U,isSync:z}};var lJ=({file:q,commandArguments:J})=>nJ(q,J),pJ=({file:q,commandArguments:J})=>({...nJ(q,J),isSync:!0}),nJ=(q,J)=>{if(J.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${q} ${J}.`);let[X,...Q]=jz(q);return{file:X,commandArguments:Q}},jz=(q)=>{if(typeof q!=="string")throw TypeError(`The command must be a string: ${String(q)}.`);let J=q.trim();if(J==="")return[];let X=[];for(let Q of J.split(Rz)){let $=X.at(-1);if($&&$.endsWith("\\"))X[X.length-1]=`${$.slice(0,-1)} ${Q}`;else X.push(Q)}return X},Rz=/ +/g;var iJ=(q,J,X)=>{q.sync=J(Fz,X),q.s=q.sync},aJ=({options:q})=>oJ(q),Fz=({options:q})=>({...oJ(q),isSync:!0}),oJ=(q)=>({options:{...Mz(q),...q}}),Mz=({input:q,inputFile:J,stdio:X})=>q===void 0&&J===void 0&&X===void 0?{stdin:"inherit"}:{},rJ={preferLocal:!0};var V2=g0(()=>({})),KI=g0(()=>({isSync:!0})),VI=g0(lJ),GI=g0(pJ),WI=g0(Xq),UI=g0(aJ,{},rJ,iJ),{sendMessage:zI,getOneMessage:_I,getEachMessage:LI,getCancelSignal:BI}=l9();var aB=Wq(IX(),1);import{dirname as oB,join as rB}from"node:path";import{fileURLToPath as sB}from"node:url";import YO,{promises as TB}from"node:fs";async function wB(q){try{return await TB.access(q),!0}catch{return!1}}import O4 from"node:fs";import x8 from"node:path";import uB from"node:stream";import{promisify as mB}from"node:util";import{promisify as PB}from"util";import D4 from"crypto";var L$=PB(D4.randomBytes),AB="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~".split(""),DB="0123456789".split(""),IB="CDEHKMPRTUWXY012458".split(""),OB="!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~".split(""),vB="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),NB=(q,J)=>{let X=J.length,Q=Math.floor(65536/X)*X-1,$=2*Math.ceil(1.1*q),Z="",Y=0;while(Y<q){let H=D4.randomBytes($),K=0;while(K<$&&Y<q){let V=H.readUInt16LE(K);if(K+=2,V>Q)continue;Z+=J[V%X],Y++}}return Z},EB=async(q,J)=>{let X=J.length,Q=Math.floor(65536/X)*X-1,$=2*Math.ceil(1.1*q),Z="",Y=0;while(Y<q){let H=await L$($),K=0;while(K<$&&Y<q){let V=H.readUInt16LE(K);if(K+=2,V>Q)continue;Z+=J[V%X],Y++}}return Z},yB=(q,J,X)=>D4.randomBytes(q).toString(J).slice(0,X),SB=async(q,J,X)=>{return(await L$(q)).toString(J).slice(0,X)},hB=new Set([void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"]),B$=(q,J)=>({length:X,type:Q,characters:$})=>{if(!(X>=0&&Number.isFinite(X)))throw TypeError("Expected a `length` to be a non-negative finite number");if(Q!==void 0&&$!==void 0)throw TypeError("Expected either `type` or `characters`");if($!==void 0&&typeof $!=="string")throw TypeError("Expected `characters` to be string");if(!hB.has(Q))throw TypeError(`Unknown type: ${Q}`);if(Q===void 0&&$===void 0)Q="hex";if(Q==="hex"||Q===void 0&&$===void 0)return J(Math.ceil(X*0.5),"hex",X);if(Q==="base64")return J(Math.ceil(X*0.75),"base64",X);if(Q==="url-safe")return q(X,AB);if(Q==="numeric")return q(X,DB);if(Q==="distinguishable")return q(X,IB);if(Q==="ascii-printable")return q(X,OB);if(Q==="alphanumeric")return q(X,vB);if($.length===0)throw TypeError("Expected `characters` string length to be greater than or equal to 1");if($.length>65536)throw TypeError("Expected `characters` string length to be less or equal to 65536");return q(X,$.split(""))},x$=B$(NB,yB);x$.async=B$(EB,SB);var j$=x$;function I4(){return j$({length:32})}import{promises as bB}from"node:fs";import gB from"node:os";var fB=await bB.realpath(gB.tmpdir()),B8=fB;var wO=mB(uB.pipeline);function j8(q){if(typeof q!=="string")throw TypeError(`Expected a string, got ${typeof q}`);let J=q.trim();if(!(J!==""&&J!=="."&&J!==".."&&!q.includes("/")&&!q.includes("\\")&&!q.includes("\x00")))throw Error(`Unsafe path component: ${JSON.stringify(q)}`)}function dB(q,J){j8(q);let X=J??B8,Q=x8.join(X,q);return O4.mkdirSync(Q,{recursive:!0}),Q}var R$=(q="",{parentDirectory:J,rootDirectory:X}={})=>{if(q)j8(q);if(X!==void 0){if(!x8.isAbsolute(X))throw Error("The `rootDirectory` option must be an absolute path");O4.mkdirSync(X,{recursive:!0})}let Q=J?dB(J,X):X??B8;return x8.join(Q,q+I4())};function PO({name:q,extension:J,parentDirectory:X,rootDirectory:Q}={}){if(q!==void 0&&q!==null){if(J!==void 0&&J!==null)throw Error("The `name` and `extension` options are mutually exclusive");return j8(q),x8.join(cB({parentDirectory:X,rootDirectory:Q}),q)}if(J!==void 0&&J!==null)j8(J);return R$("",{parentDirectory:X,rootDirectory:Q})+(J===void 0||J===null?"":"."+J.replace(/^\./,""))}function cB({prefix:q="",parentDirectory:J,rootDirectory:X}={}){let Q=R$(q,{parentDirectory:J,rootDirectory:X});return O4.mkdirSync(Q,{recursive:!0}),Q}import lB from"os";import R8 from"path";var p0=lB.homedir(),{env:Z6}=process,F$=Z6.XDG_DATA_HOME||(p0?R8.join(p0,".local","share"):void 0),M$=Z6.XDG_CONFIG_HOME||(p0?R8.join(p0,".config"):void 0),vO=Z6.XDG_STATE_HOME||(p0?R8.join(p0,".local","state"):void 0),pB=Z6.XDG_CACHE_HOME||(p0?R8.join(p0,".cache"):void 0),NO=Z6.XDG_RUNTIME_DIR||void 0,nB=(Z6.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(F$)nB.unshift(F$);var iB=(Z6.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(M$)iB.unshift(M$);var tB=oB(sB(import.meta.url));var gO=process.env.RIPGREP_VERSION||"v15.0.0";var C$=rB(tB,`rg${process.platform==="win32"?".exe":""}`);import{resolve as eB}from"path";var qx=async(q,J,X={})=>{let{timeout:Q=15000,cwd:$}=X;try{let Z=await V2(q,J,{cwd:$||process.cwd(),timeout:Q,reject:!1,stripFinalNewline:!1,stdio:["pipe","pipe","pipe"],env:process.env});return{code:Z.exitCode??0,stdout:Z.stdout,stderr:Z.stderr}}catch(Z){if(Z.timedOut)return{code:124,stdout:Z.stdout||"",stderr:(Z.stderr||"")+`
|
|
79
|
-
Process timed out`};return{code:Z.exitCode||1,stdout:Z.stdout||"",stderr:Z.stderr||Z.message||"Unknown error"}}},k$=o(async({args:q,head_limit:J},X)=>{if(!X.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");if(!q||q.length===0)return"Error: No arguments provided. Please provide ripgrep arguments.";if(!J&&!q.includes("--max-count"))J=500;let Q=q[q.length-1],$=[...q];if(Q&&!Q.startsWith("-"))$[$.length-1]=eB(X.state.cwd,Q);let Z=await qx(C$,$,{timeout:15000,cwd:X.state.cwd});if(J&&Z.stdout){let Y=Z.stdout.split(`
|
|
80
|
-
`);if(Y.length>J)Z.stdout=Y.slice(0,J).join(`
|
|
81
|
-
`)}if(Z.code!==0&&Z.stderr){if(Z.code===1&&Z.stdout==="")return"No matches found.";if(Z.code===124||Z.stderr.includes("timeout")||Z.stderr.includes("timed out"))return"Error: Search timed out after 15 seconds. Please use a more specific pattern or limit the search scope with type/glob/path parameters.";return`Error executing ripgrep: ${Z.stderr}`}return Z.stdout||"No matches found."},{name:"search_files_rg",description:`Ripgrep (rg) - A fast text search tool that recursively searches directories for regex patterns
|
|
82
|
-
|
|
83
|
-
⚠️ IMPORTANT USAGE GUIDELINES:
|
|
84
|
-
- This tool wraps the ripgrep (rg) command-line tool
|
|
85
|
-
- Use this ONLY for searching TEXT PATTERNS within file contents
|
|
86
|
-
- For reading entire files, use the Read tool instead
|
|
87
|
-
- For finding files by name patterns, use the Glob tool instead
|
|
88
|
-
|
|
89
|
-
\uD83D\uDD0D SEARCH PATH REQUIREMENT:
|
|
90
|
-
- MUST always specify a search path at the end of args array
|
|
91
|
-
- If no specific path needed, use "./" for current directory
|
|
92
|
-
- Never omit the path parameter - ripgrep requires it
|
|
93
|
-
- Relative paths are resolved relative to the current working directory (cwd)
|
|
94
|
-
|
|
95
|
-
Usage - Pass ripgrep (rg) arguments as an array:
|
|
96
|
-
The args array corresponds directly to 'rg [OPTIONS] PATTERN [PATH...]'
|
|
97
|
-
|
|
98
|
-
Examples:
|
|
99
|
-
- Search pattern in current directory: ["PATTERN", "./"]
|
|
100
|
-
- Search in specific path: ["PATTERN", "src/"]
|
|
101
|
-
- Search with file type filter: ["--type", "ts", "PATTERN", "./"]
|
|
102
|
-
- Case insensitive search: ["-i", "PATTERN", "./"]
|
|
103
|
-
- Show line numbers: ["-n", "PATTERN", "./"]
|
|
104
|
-
- Show context lines: ["-C", "3", "PATTERN", "./"]
|
|
105
|
-
- Only show file names: ["-l", "PATTERN", "./"]
|
|
106
|
-
- Count matches: ["-c", "PATTERN", "./"]
|
|
107
|
-
- Multiple options: ["-n", "-i", "--type", "js", "function", "src/"]
|
|
108
|
-
|
|
109
|
-
Common ripgrep (rg) options:
|
|
110
|
-
- -i, --ignore-case: Case insensitive search
|
|
111
|
-
- -n, --line-number: Show line numbers
|
|
112
|
-
- -A NUM: Show NUM lines after each match
|
|
113
|
-
- -B NUM: Show NUM lines before each match
|
|
114
|
-
- -C NUM: Show NUM lines around each match
|
|
115
|
-
- -l, --files-with-matches: Only show file paths that match
|
|
116
|
-
- -c, --count: Only show count of matches per file
|
|
117
|
-
- --type TYPE: Only search files of TYPE (js, ts, py, rust, etc.)
|
|
118
|
-
- --glob PATTERN: Include/exclude files matching PATTERN
|
|
119
|
-
- --max-count NUM: Stop after NUM matches per file
|
|
120
|
-
- --no-ignore: Don't respect .gitignore files
|
|
121
|
-
- --hidden: Search hidden files and directories
|
|
122
|
-
|
|
123
|
-
Performance:
|
|
124
|
-
- 15 second timeout per search
|
|
125
|
-
- Results limited to 500 lines by default (use head_limit parameter)
|
|
126
|
-
- Respects .gitignore by default (use --no-ignore to override)
|
|
127
|
-
`,schema:C.object({description:C.string().optional().describe("what you want to do"),args:C.array(C.string()).describe('Ripgrep (rg) command arguments as array. Format: [OPTIONS...] PATTERN [PATH...]. MUST include path at end! Examples: ["import", "./"] (search "import" in current dir), ["-n", "-i", "function", "./"] (search "function" with line numbers, case insensitive), ["--type", "ts", "export", "src/"] (search "export" in TypeScript files in src/).'),head_limit:C.number().optional().describe("Limit output to first N lines. If not specified and no --max-count in args, defaults to 500 lines for performance.")})});import{promises as Jx}from"fs";import{resolve as Xx}from"path";var v4=2000,Qx=C.object({description:C.string().optional().describe("what you want to do"),file_path:C.string().describe("The path to the file to read (absolute or relative to cwd)"),offset:C.number().default(0).optional().describe("The line number to start reading from. Only provide if the file is too large to read at once"),limit:C.number().default(v4).optional().describe("The number of lines to read. Only provide if the file is too large to read at once.")}),T$=o(async({file_path:q,offset:J,limit:X},Q)=>{try{if(!Q.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let $=Xx(Q.state.cwd,q),Y=(await Jx.readFile($,"utf-8")).split(`
|
|
128
|
-
`);if(J)Y=Y.slice(J-1);if(X)Y=Y.slice(0,X);return Y.join(`
|
|
129
|
-
`)}catch($){if($.code==="ENOENT")return`Error: File not found at ${q}`;throw $}},{name:"read_file",description:`Reads a file from the local filesystem. Relative paths are resolved based on the current working directory (cwd).
|
|
130
|
-
Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
|
|
131
|
-
|
|
132
|
-
Usage:
|
|
133
|
-
- The file_path parameter can be either an absolute path or a relative path
|
|
134
|
-
- Relative paths are resolved relative to the current working directory (cwd)
|
|
135
|
-
- By default, it reads up to ${v4} lines starting from the beginning of the file
|
|
136
|
-
- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters
|
|
137
|
-
- Any lines longer than ${v4} characters will be truncated
|
|
138
|
-
- Results are returned using cat -n format, with line numbers starting at 1
|
|
139
|
-
- This tool allows You to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as You is a multimodal LLM.
|
|
140
|
-
- This tool can read PDF files (.pdf). PDFs are processed page by page, extracting both text and visual content for analysis.
|
|
141
|
-
- This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
|
|
142
|
-
- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful.
|
|
143
|
-
- You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/123/abc/T/TemporaryItems/NSIRD_screencaptureui_ZfB1tD/Screenshot.png
|
|
144
|
-
- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.`,schema:Qx});import{promises as $x}from"fs";import{resolve as Zx}from"path";var w$=o(async({file_path:q,content:J},X)=>{if(!X.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");try{let Q=Zx(X.state.cwd,q);return await $x.writeFile(Q,J,"utf-8"),`File ${Q} has been written successfully.`}catch(Q){return`Error writing file: ${Q.message}`}},{name:"write_file",description:`Writes a file to the local filesystem. Relative paths are resolved based on the current working directory (cwd).
|
|
145
|
-
Usage:
|
|
146
|
-
- This tool will overwrite the existing file if there is one at the provided path.
|
|
147
|
-
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
|
|
148
|
-
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
149
|
-
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
|
150
|
-
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`,schema:C.object({description:C.string().optional().describe("what you want to do"),file_path:C.string().describe("The path to the file to write (absolute or relative to cwd)"),content:C.string().describe("The content to write to the file")})});import{promises as N4}from"fs";import{resolve as Yx}from"path";var Hx=C.object({description:C.string().optional().describe("what you want to do"),file_path:C.string().describe("The path to the file to modify (absolute or relative to cwd)"),old_string:C.string().describe("The text to replace"),new_string:C.string().describe("The text to replace it with (must be different from old_string)"),replace_all:C.boolean().optional().default(!1).describe("Replace all occurences of old_string (default false)")}),P$=o(async({file_path:q,old_string:J,new_string:X,replace_all:Q=!1},$)=>{try{if(!$.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let Z=Yx($.state.cwd,q),Y=await N4.readFile(Z,"utf-8");if(Q){if(!Y.includes(J))return`Error: old_string not found in ${Z}`;let H=Y.split(J).join(X);return await N4.writeFile(Z,H,"utf-8"),`File ${Z} has been edited successfully. Replaced all occurrences of old_string.`}else{let H=Y.split(J);if(H.length===1)return`Error: old_string not found in ${Z}`;if(H.length>2)return`Error: old_string is not unique in ${Z} (found ${H.length-1} occurrences). Please provide more context or set replace_all to true.`;let K=Y.replace(J,X);return await N4.writeFile(Z,K,"utf-8"),`File ${Z} has been edited successfully. Replaced single occurrence of old_string.`}}catch(Z){if(Z.code==="ENOENT")return`Error: File not found at ${q}`;throw Z}},{name:"edit_file",description:`Performs exact string replacements in files. Relative paths are resolved based on the current working directory (cwd).
|
|
151
|
-
|
|
152
|
-
Usage:
|
|
153
|
-
- You must use your \`Read\` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
|
|
154
|
-
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
|
|
155
|
-
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
156
|
-
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
|
157
|
-
- The edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`.
|
|
158
|
-
- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.`,schema:Hx});class A${name="FilesystemMiddleware";contextSchema=void 0;stateSchema=void 0;tools=[T$,w$,P$,I7,k$,y4];async execute(){return this}}var Y6=new Map;var F8=process.platform==="win32",D$=F8?"cmd.exe":"/bin/bash",I$=F8?["/d","/s","/c"]:["-c"],E4=o(async({command:q,timeout:J,run_in_background:X,kill_process_id:Q,get_output_id:$,filter:Z},Y)=>{if(Q){let H=parseInt(Q,10),K=Y6.get(H);if(!K)return`Error: No background process found with ID ${Q}.`;return K.process.kill(),Y6.delete(H),`Successfully killed process with ID ${Q}.`}if($){let H=parseInt($,10),K=Y6.get(H);if(!K)return`Error: No background process found with ID ${$}.`;let V=K.stdout.join(""),G=K.stderr.join("");if(K.stdout=[],K.stderr=[],Z){let U=new RegExp(Z);V=V.split(`
|
|
159
|
-
`).filter((z)=>U.test(z)).join(`
|
|
160
|
-
`),G=G.split(`
|
|
161
|
-
`).filter((z)=>U.test(z)).join(`
|
|
162
|
-
`)}let W="";if(V)W+=`STDOUT:
|
|
163
|
-
${V}
|
|
164
|
-
`;if(G)W+=`STDERR:
|
|
165
|
-
${G}
|
|
166
|
-
`;return W||"No new output since last check."}if(!q)return"Error: 'command' argument is required unless using 'kill_process_id' or 'get_output_id'.";if(!Y.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");if(X)try{let H=V2(D$,[...I$,q],{cwd:Y.state.cwd,timeout:J??20000,reject:!1,windowsVerbatimArguments:F8});if(!H.pid)return"Failed to start command in background.";let K={process:H,stdout:[],stderr:[],command:q,startTime:Date.now()};return Y6.set(H.pid,K),H.stdout?.on("data",(V)=>{K.stdout.push(V.toString())}),H.stderr?.on("data",(V)=>{K.stderr.push(V.toString())}),H.on("close",()=>{}),`Command started in background with ID: ${H.pid}`}catch(H){return`Error starting background command: ${H}`}else try{let H=await V2(D$,[...I$,q],{cwd:Y.state.cwd,timeout:J??20000,reject:!1,windowsVerbatimArguments:F8});if(H.exitCode!==0)return H.stderr;return H.stdout}catch(H){return`Error executing command: ${H}`}},{name:"terminal",description:`Executes commands in a persistent shell session (Bash on Linux/macOS, CMD on Windows). Commands are executed in the current working directory (cwd).
|
|
167
|
-
Features:
|
|
168
|
-
- Run commands (foreground or background)
|
|
169
|
-
- Retrieve background process output
|
|
170
|
-
- Kill background processes
|
|
171
|
-
- Cross-platform support (auto-detects OS)
|
|
172
|
-
|
|
173
|
-
Usage:
|
|
174
|
-
1. Run Command: Provide \`command\`. Optional: \`run_in_background\`, \`timeout\`.
|
|
175
|
-
2. Check Output: Provide \`get_output_id\`. Optional: \`filter\`.
|
|
176
|
-
3. Kill Process: Provide \`kill_process_id\`.
|
|
177
|
-
|
|
178
|
-
Notes:
|
|
179
|
-
- For file paths with spaces, ALWAYS use quotes: "path/to file"
|
|
180
|
-
- Commands are executed relative to the current working directory (cwd)
|
|
181
|
-
- Avoid interactive commands (like top, vim)
|
|
182
|
-
- Use '&&' or ';' to chain commands (PowerShell/CMD syntax varies, simple chaining often works)
|
|
183
|
-
- CAN'T BATCH CALL THIS TOOL!
|
|
184
|
-
`,schema:C.object({description:C.string().describe("what you want to do"),command:C.string().optional().describe("The command to execute (required for running commands)"),timeout:C.number().optional().describe("Timeout in ms (default: 20000)"),run_in_background:C.boolean().optional().describe("Run command in background"),kill_process_id:C.string().optional().describe("ID of process to kill"),get_output_id:C.string().optional().describe("ID of process to get output from"),filter:C.string().optional().describe("Regex to filter output (only for get_output_id)")})});class O${name="TerminalMiddleware";contextSchema=void 0;stateSchema=void 0;tools=[E4];async execute(){return this}}export{y4 as Ye,I7 as Ze,V2 as _e,IX as $e,kB as af,wB as bf,PO as cf,pB as df,T$ as ef,P$ as ff,A$ as gf,Y6 as hf,O$ as if};
|