zen-code 4.8.3 → 4.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -172,7 +172,7 @@ The assistant did not use the todo list because this is a single command executi
172
172
  - Use clear, descriptive task names
173
173
 
174
174
  When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
175
- `,schema:b1});import{z as o}from"zod";import{tool as f1}from"langchain";var E1=o.object({label:o.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),h1=o.object({description:o.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:o.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:o.array(E1).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:o.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:o.string().optional().describe("自定义输入框的占位符文本")}),x5=f1(()=>{},{name:"ask_user_questions",description:"Ask the user a question with selectable options",schema:h1});var g1=[x5,I5];async function d1(Q,X){await Q.addTool({id:X.name,name:X.name,description:X.description});let Z={id:X.name,name:X.name,description:X.description,paramsSchema:X.schema,execute:async(q)=>{let V=await X.invoke(q);if(V&&typeof V==="object"&&"content"in V)return V.content;return V}};Q.tools.registerImplementation(Z)}async function O5(Q){return await Promise.all(g1.map((X)=>d1(Q,X)))}import{tool as c1}from"@langchain/core/tools";import{z as H2}from"zod";import{promises as W2}from"fs";import{resolve as l1,join as n1}from"path";var i1=H2.object({operation:H2.enum(["create","list","exists"]).describe("The folder operation to perform"),folder_path:H2.string().describe("The path to the folder (absolute or relative to cwd)"),description:H2.string().optional().describe("What you want to do"),recursive:H2.boolean().default(!0).optional().describe("For create: create parent directories if they do not exist")}).strict(),u5=c1(async({operation:Q,folder_path:X,recursive:Z=!0},q)=>{try{let V=l1(q.state.cwd,X);switch(Q){case"create":return await W2.mkdir(V,{recursive:Z}),`✓ Folder created successfully at: ${V}`;case"exists":try{await W2.access(V);let $=await W2.stat(V);return`✓ Folder exists at: ${V}
175
+ `,schema:b1});import{z as i}from"zod";import{tool as f1}from"langchain";var E1=i.object({label:i.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),h1=i.object({description:i.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:i.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:i.array(E1).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:i.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:i.string().optional().describe("自定义输入框的占位符文本")}),x5=f1(()=>{},{name:"ask_user_questions",description:"Ask the user a question with selectable options",schema:h1});var g1=[x5,I5];async function d1(Q,X){await Q.addTool({id:X.name,name:X.name,description:X.description});let Z={id:X.name,name:X.name,description:X.description,paramsSchema:X.schema,execute:async(q)=>{let V=await X.invoke(q);if(V&&typeof V==="object"&&"content"in V)return V.content;return V}};Q.tools.registerImplementation(Z)}async function O5(Q){return await Promise.all(g1.map((X)=>d1(Q,X)))}import{tool as c1}from"@langchain/core/tools";import{z as H2}from"zod";import{promises as W2}from"fs";import{resolve as l1,join as n1}from"path";var o1=H2.object({operation:H2.enum(["create","list","exists"]).describe("The folder operation to perform"),folder_path:H2.string().describe("The path to the folder (absolute or relative to cwd)"),description:H2.string().optional().describe("What you want to do"),recursive:H2.boolean().default(!0).optional().describe("For create: create parent directories if they do not exist")}).strict(),u5=c1(async({operation:Q,folder_path:X,recursive:Z=!0},q)=>{if(!q.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");try{let V=l1(q.state.cwd,X);switch(Q){case"create":return await W2.mkdir(V,{recursive:Z}),`✓ Folder created successfully at: ${V}`;case"exists":try{await W2.access(V);let $=await W2.stat(V);return`✓ Folder exists at: ${V}
176
176
  Type: ${$.isDirectory()?"Directory":"File"}`}catch{return`✗ Folder does not exist at: ${V}`}case"list":try{let $=await W2.readdir(V,{withFileTypes:!0});if($.length===0)return`Folder is empty: ${V}`;let J=[];J.push(`\uD83D\uDCC1 ${V}
177
177
  `);let K=[],Y=[];for(let H of $){let z=n1(V,H.name);try{let W=await W2.stat(z),j=W.size,U=W.mtime.toLocaleDateString(),G=`${H.isDirectory()?"\uD83D\uDCC1":"\uD83D\uDCC4"} ${H.name}${H.isDirectory()?"/":""} (${j} bytes, ${U})`;if(H.isDirectory())K.push(G);else Y.push(G)}catch(W){Y.push(`⚠️ ${H.name} (unreadable)`)}}if(K.length>0)J.push("Directories:"),K.forEach((H)=>J.push(` ${H}`)),J.push("");if(Y.length>0)J.push("Files:"),Y.forEach((H)=>J.push(` ${H}`));return J.push(`
178
178
  Total: ${K.length} directories, ${Y.length} files`),J.join(`
@@ -194,16 +194,16 @@ Total: ${K.length} directories, ${Y.length} files`),J.join(`
194
194
  - All folder paths can be absolute or relative to cwd
195
195
  - Create operation is recursive (creates parent directories if needed)
196
196
  - List operation shows file sizes and modification dates
197
- - Delete operations are not supported for safety reasons. Use terminal commands with user approval if needed.`,schema:i1});import{tool as D6}from"@langchain/core/tools";import{z as a2}from"zod";var X5=(Q,X,Z)=>{let q=Q instanceof RegExp?R5(Q,Z):Q,V=X instanceof RegExp?R5(X,Z):X,$=q!==null&&V!=null&&o1(q,V,Z);return $&&{start:$[0],end:$[1],pre:Z.slice(0,$[0]),body:Z.slice($[0]+q.length,$[1]),post:Z.slice($[1]+V.length)}},R5=(Q,X)=>{let Z=X.match(Q);return Z?Z[0]:null},o1=(Q,X,Z)=>{let q,V,$,J=void 0,K,Y=Z.indexOf(Q),H=Z.indexOf(X,Y+1),z=Y;if(Y>=0&&H>0){if(Q===X)return[Y,H];q=[],$=Z.length;while(z>=0&&!K){if(z===Y)q.push(z),Y=Z.indexOf(Q,z+1);else if(q.length===1){let W=q.pop();if(W!==void 0)K=[W,H]}else{if(V=q.pop(),V!==void 0&&V<$)$=V,J=H;H=Z.indexOf(X,z+1)}z=Y<H&&Y>=0?Y:H}if(q.length&&J!==void 0)K=[$,J]}return K};var F5="\x00SLASH"+Math.random()+"\x00",T5="\x00OPEN"+Math.random()+"\x00",q5="\x00CLOSE"+Math.random()+"\x00",m5="\x00COMMA"+Math.random()+"\x00",N5="\x00PERIOD"+Math.random()+"\x00",a1=new RegExp(F5,"g"),p1=new RegExp(T5,"g"),s1=new RegExp(q5,"g"),r1=new RegExp(m5,"g"),e1=new RegExp(N5,"g"),t1=/\\\\/g,QQ=/\\{/g,XQ=/\\}/g,ZQ=/\\,/g,qQ=/\\./g,VQ=1e5;function Z5(Q){return!isNaN(Q)?parseInt(Q,10):Q.charCodeAt(0)}function $Q(Q){return Q.replace(t1,F5).replace(QQ,T5).replace(XQ,q5).replace(ZQ,m5).replace(qQ,N5)}function JQ(Q){return Q.replace(a1,"\\").replace(p1,"{").replace(s1,"}").replace(r1,",").replace(e1,".")}function D5(Q){if(!Q)return[""];let X=[],Z=X5("{","}",Q);if(!Z)return Q.split(",");let{pre:q,body:V,post:$}=Z,J=q.split(",");J[J.length-1]+="{"+V+"}";let K=D5($);if($.length)J[J.length-1]+=K.shift(),J.push.apply(J,K);return X.push.apply(X,J),X}function S5(Q,X={}){if(!Q)return[];let{max:Z=VQ}=X;if(Q.slice(0,2)==="{}")Q="\\{\\}"+Q.slice(2);return z2($Q(Q),Z,!0).map(JQ)}function KQ(Q){return"{"+Q+"}"}function YQ(Q){return/^-?0\d/.test(Q)}function HQ(Q,X){return Q<=X}function WQ(Q,X){return Q>=X}function z2(Q,X,Z){let q=[],V=X5("{","}",Q);if(!V)return[Q];let $=V.pre,J=V.post.length?z2(V.post,X,!1):[""];if(/\$$/.test(V.pre))for(let K=0;K<J.length&&K<X;K++){let Y=$+"{"+V.body+"}"+J[K];q.push(Y)}else{let K=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(V.body),Y=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(V.body),H=K||Y,z=V.body.indexOf(",")>=0;if(!H&&!z){if(V.post.match(/,(?!,).*\}/))return Q=V.pre+"{"+V.body+q5+V.post,z2(Q,X,!0);return[Q]}let W;if(H)W=V.body.split(/\.\./);else if(W=D5(V.body),W.length===1&&W[0]!==void 0){if(W=z2(W[0],X,!1).map(KQ),W.length===1)return J.map((U)=>V.pre+W[0]+U)}let j;if(H&&W[0]!==void 0&&W[1]!==void 0){let U=Z5(W[0]),k=Z5(W[1]),G=Math.max(W[0].length,W[1].length),v=W.length===3&&W[2]!==void 0?Math.abs(Z5(W[2])):1,B=HQ;if(k<U)v*=-1,B=WQ;let A=W.some(YQ);j=[];for(let _=U;B(_,k);_+=v){let w;if(Y){if(w=String.fromCharCode(_),w==="\\")w=""}else if(w=String(_),A){let i=G-w.length;if(i>0){let c=Array(i+1).join("0");if(_<0)w="-"+c+w.slice(1);else w=c+w}}j.push(w)}}else{j=[];for(let U=0;U<W.length;U++)j.push.apply(j,z2(W[U],X,!1))}for(let U=0;U<j.length;U++)for(let k=0;k<J.length&&q.length<X;k++){let G=$+j[U]+J[k];if(!Z||H||G)q.push(G)}}return q}var j2=(Q)=>{if(typeof Q!=="string")throw TypeError("invalid pattern");if(Q.length>65536)throw TypeError("pattern is too long")};var zQ={"[: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]},U2=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),jQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),P5=(Q)=>Q.join(""),y5=(Q,X)=>{let Z=X;if(Q.charAt(Z)!=="[")throw Error("not in a brace expression");let q=[],V=[],$=Z+1,J=!1,K=!1,Y=!1,H=!1,z=Z,W="";Q:while($<Q.length){let G=Q.charAt($);if((G==="!"||G==="^")&&$===Z+1){H=!0,$++;continue}if(G==="]"&&J&&!Y){z=$+1;break}if(J=!0,G==="\\"){if(!Y){Y=!0,$++;continue}}if(G==="["&&!Y){for(let[v,[B,C,A]]of Object.entries(zQ))if(Q.startsWith(v,$)){if(W)return["$.",!1,Q.length-Z,!0];if($+=v.length,A)V.push(B);else q.push(B);K=K||C;continue Q}}if(Y=!1,W){if(G>W)q.push(U2(W)+"-"+U2(G));else if(G===W)q.push(U2(G));W="",$++;continue}if(Q.startsWith("-]",$+1)){q.push(U2(G+"-")),$+=2;continue}if(Q.startsWith("-",$+1)){W=G,$+=2;continue}q.push(U2(G)),$++}if(z<$)return["",!1,0,!1];if(!q.length&&!V.length)return["$.",!1,Q.length-Z,!0];if(V.length===0&&q.length===1&&/^\\?.$/.test(q[0])&&!H){let G=q[0].length===2?q[0].slice(-1):q[0];return[jQ(G),!1,z-Z,!1]}let j="["+(H?"^":"")+P5(q)+"]",U="["+(H?"":"^")+P5(V)+"]";return[q.length&&V.length?"("+j+"|"+U+")":q.length?j:U,K,z-Z,!0]};var b=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!0}={})=>{if(Z)return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");return X?Q.replace(/\[([^\/\\{}])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};var UQ=new Set(["!","?","+","*","@"]),b5=(Q)=>UQ.has(Q),GQ="(?!(?:^|/)\\.\\.?(?:$|/))",F2="(?!\\.)",kQ=new Set(["[","."]),BQ=new Set(["..","."]),CQ=new Set("().*{}+?[]^$\\!"),vQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),V5="[^/]",f5=V5+"*?",E5=V5+"+?";class O{type;#Q;#Z;#$=!1;#V=[];#J;#A;#C;#W=!1;#K;#j;#z=!1;constructor(Q,X,Z={}){if(this.type=Q,Q)this.#Z=!0;if(this.#J=X,this.#Q=this.#J?this.#J.#Q:this,this.#K=this.#Q===this?Z:this.#Q.#K,this.#C=this.#Q===this?[]:this.#Q.#C,Q==="!"&&!this.#Q.#W)this.#C.push(this);this.#A=this.#J?this.#J.#V.length:0}get hasMagic(){if(this.#Z!==void 0)return this.#Z;for(let Q of this.#V){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#Z=!0}return this.#Z}toString(){if(this.#j!==void 0)return this.#j;if(!this.type)return this.#j=this.#V.map((Q)=>String(Q)).join("");else return this.#j=this.type+"("+this.#V.map((Q)=>String(Q)).join("|")+")"}#Y(){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.#C.pop()){if(Q.type!=="!")continue;let X=Q,Z=X.#J;while(Z){for(let q=X.#A+1;!Z.type&&q<Z.#V.length;q++)for(let V of Q.#V){if(typeof V==="string")throw Error("string part in extglob AST??");V.copyIn(Z.#V[q])}X=Z,Z=X.#J}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof O&&X.#J===this))throw Error("invalid part: "+X);this.#V.push(X)}}toJSON(){let Q=this.type===null?this.#V.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#V.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#W&&this.#J?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#J?.isStart())return!1;if(this.#A===0)return!0;let Q=this.#J;for(let X=0;X<this.#A;X++){let Z=Q.#V[X];if(!(Z instanceof O&&Z.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#J?.type==="!")return!0;if(!this.#J?.isEnd())return!1;if(!this.type)return this.#J?.isEnd();let Q=this.#J?this.#J.#V.length:0;return this.#A===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new O(this.type,Q);for(let Z of this.#V)X.copyIn(Z);return X}static#q(Q,X,Z,q){let V=!1,$=!1,J=-1,K=!1;if(X.type===null){let j=Z,U="";while(j<Q.length){let k=Q.charAt(j++);if(V||k==="\\"){V=!V,U+=k;continue}if($){if(j===J+1){if(k==="^"||k==="!")K=!0}else if(k==="]"&&!(j===J+2&&K))$=!1;U+=k;continue}else if(k==="["){$=!0,J=j,K=!1,U+=k;continue}if(!q.noext&&b5(k)&&Q.charAt(j)==="("){X.push(U),U="";let G=new O(k,X);j=O.#q(Q,G,j,q),X.push(G);continue}U+=k}return X.push(U),j}let Y=Z+1,H=new O(null,X),z=[],W="";while(Y<Q.length){let j=Q.charAt(Y++);if(V||j==="\\"){V=!V,W+=j;continue}if($){if(Y===J+1){if(j==="^"||j==="!")K=!0}else if(j==="]"&&!(Y===J+2&&K))$=!1;W+=j;continue}else if(j==="["){$=!0,J=Y,K=!1,W+=j;continue}if(b5(j)&&Q.charAt(Y)==="("){H.push(W),W="";let U=new O(j,H);H.push(U),Y=O.#q(Q,U,Y,q);continue}if(j==="|"){H.push(W),W="",z.push(H),H=new O(null,X);continue}if(j===")"){if(W===""&&X.#V.length===0)X.#z=!0;return H.push(W),W="",X.push(...z,H),Y}W+=j}return X.type=null,X.#Z=void 0,X.#V=[Q.substring(Z-1)],Y}static fromGlob(Q,X={}){let Z=new O(null,void 0,X);return O.#q(Q,Z,0,X),Z}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,Z,q,V]=this.toRegExpSource();if(!(q||this.#Z||this.#K.nocase&&!this.#K.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return Z;let J=(this.#K.nocase?"i":"")+(V?"u":"");return Object.assign(new RegExp(`^${X}$`,J),{_src:X,_glob:Q})}get options(){return this.#K}toRegExpSource(Q){let X=Q??!!this.#K.dot;if(this.#Q===this)this.#Y();if(!this.type){let K=this.isStart()&&this.isEnd()&&!this.#V.some((j)=>typeof j!=="string"),Y=this.#V.map((j)=>{let[U,k,G,v]=typeof j==="string"?O.#_(j,this.#Z,K):j.toRegExpSource(Q);return this.#Z=this.#Z||G,this.#$=this.#$||v,U}).join(""),H="";if(this.isStart()){if(typeof this.#V[0]==="string"){if(!(this.#V.length===1&&BQ.has(this.#V[0]))){let U=kQ,k=X&&U.has(Y.charAt(0))||Y.startsWith("\\.")&&U.has(Y.charAt(2))||Y.startsWith("\\.\\.")&&U.has(Y.charAt(4)),G=!X&&!Q&&U.has(Y.charAt(0));H=k?GQ:G?F2:""}}}let z="";if(this.isEnd()&&this.#Q.#W&&this.#J?.type==="!")z="(?:$|\\/)";return[H+Y+z,b(Y),this.#Z=!!this.#Z,this.#$]}let Z=this.type==="*"||this.type==="+",q=this.type==="!"?"(?:(?!(?:":"(?:",V=this.#U(X);if(this.isStart()&&this.isEnd()&&!V&&this.type!=="!"){let K=this.toString();return this.#V=[K],this.type=null,this.#Z=void 0,[K,b(this.toString()),!1,!1]}let $=!Z||Q||X||!F2?"":this.#U(!0);if($===V)$="";if($)V=`(?:${V})(?:${$})*?`;let J="";if(this.type==="!"&&this.#z)J=(this.isStart()&&!X?F2:"")+E5;else{let K=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?F2:"")+f5+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&$?")":this.type==="*"&&$?")?":`)${this.type}`;J=q+V+K}return[J,b(V),this.#Z=!!this.#Z,this.#$]}#U(Q){return this.#V.map((X)=>{if(typeof X==="string")throw Error("string type in extglob ast??");let[Z,q,V,$]=X.toRegExpSource(Q);return this.#$=this.#$||$,Z}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#_(Q,X,Z=!1){let q=!1,V="",$=!1,J=!1;for(let K=0;K<Q.length;K++){let Y=Q.charAt(K);if(q){q=!1,V+=(CQ.has(Y)?"\\":"")+Y;continue}if(Y==="*"){if(J)continue;J=!0,V+=Z&&/^[*]+$/.test(Q)?E5:f5,X=!0;continue}else J=!1;if(Y==="\\"){if(K===Q.length-1)V+="\\\\";else q=!0;continue}if(Y==="["){let[H,z,W,j]=y5(Q,K);if(W){V+=H,$=$||z,K+=W-1,X=X||j;continue}}if(Y==="?"){V+=V5,X=!0;continue}V+=vQ(Y)}return[V,b(Q),!!X,$]}}var q2=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!1}={})=>{if(Z)return X?Q.replace(/[?*()[\]{}]/g,"[$&]"):Q.replace(/[?*()[\]\\{}]/g,"\\$&");return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var F=(Q,X,Z={})=>{if(j2(X),!Z.nocomment&&X.charAt(0)==="#")return!1;return new S(X,Z).match(Q)},wQ=/^\*+([^+@!?\*\[\(]*)$/,AQ=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),_Q=(Q)=>(X)=>X.endsWith(Q),LQ=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},MQ=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},IQ=/^\*+\.\*+$/,xQ=(Q)=>!Q.startsWith(".")&&Q.includes("."),OQ=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),uQ=/^\.\*+$/,RQ=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),FQ=/^\*+$/,TQ=(Q)=>Q.length!==0&&!Q.startsWith("."),mQ=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",NQ=/^\?+([^+@!?\*\[\(]*)?$/,DQ=([Q,X=""])=>{let Z=d5([Q]);if(!X)return Z;return X=X.toLowerCase(),(q)=>Z(q)&&q.toLowerCase().endsWith(X)},SQ=([Q,X=""])=>{let Z=c5([Q]);if(!X)return Z;return X=X.toLowerCase(),(q)=>Z(q)&&q.toLowerCase().endsWith(X)},PQ=([Q,X=""])=>{let Z=c5([Q]);return!X?Z:(q)=>Z(q)&&q.endsWith(X)},yQ=([Q,X=""])=>{let Z=d5([Q]);return!X?Z:(q)=>Z(q)&&q.endsWith(X)},d5=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&!Z.startsWith(".")},c5=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&Z!=="."&&Z!==".."},l5=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",h5={win32:{sep:"\\"},posix:{sep:"/"}},bQ=l5==="win32"?h5.win32.sep:h5.posix.sep;F.sep=bQ;var u=Symbol("globstar **");F.GLOBSTAR=u;var fQ="[^/]",EQ=fQ+"*?",hQ="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",gQ="(?:(?!(?:\\/|^)\\.).)*?",dQ=(Q,X={})=>(Z)=>F(Z,Q,X);F.filter=dQ;var D=(Q,X={})=>Object.assign({},Q,X),cQ=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return F;let X=F;return Object.assign((q,V,$={})=>X(q,V,D(Q,$)),{Minimatch:class extends X.Minimatch{constructor(V,$={}){super(V,D(Q,$))}static defaults(V){return X.defaults(D(Q,V)).Minimatch}},AST:class extends X.AST{constructor(V,$,J={}){super(V,$,D(Q,J))}static fromGlob(V,$={}){return X.AST.fromGlob(V,D(Q,$))}},unescape:(q,V={})=>X.unescape(q,D(Q,V)),escape:(q,V={})=>X.escape(q,D(Q,V)),filter:(q,V={})=>X.filter(q,D(Q,V)),defaults:(q)=>X.defaults(D(Q,q)),makeRe:(q,V={})=>X.makeRe(q,D(Q,V)),braceExpand:(q,V={})=>X.braceExpand(q,D(Q,V)),match:(q,V,$={})=>X.match(q,V,D(Q,$)),sep:X.sep,GLOBSTAR:u})};F.defaults=cQ;var n5=(Q,X={})=>{if(j2(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return S5(Q,{max:X.braceExpandMax})};F.braceExpand=n5;var lQ=(Q,X={})=>new S(Q,X).makeRe();F.makeRe=lQ;var nQ=(Q,X,Z={})=>{let q=new S(X,Z);if(Q=Q.filter((V)=>q.match(V)),q.options.nonull&&!Q.length)Q.push(X);return Q};F.match=nQ;var g5=/[?*]|[+@!]\(.*?\)|\[|\]/,iQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class S{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Q,X={}){j2(Q),X=X||{},this.options=X,this.pattern=Q,this.platform=X.platform||l5,this.isWindows=this.platform==="win32";let Z="allowWindowsEscape";if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X[Z]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.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 X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...V)=>console.error(...V);this.debug(this.pattern,this.globSet);let Z=this.globSet.map((V)=>this.slashSplit(V));this.globParts=this.preprocess(Z),this.debug(this.pattern,this.globParts);let q=this.globParts.map((V,$,J)=>{if(this.isWindows&&this.windowsNoMagicRoot){let K=V[0]===""&&V[1]===""&&(V[2]==="?"||!g5.test(V[2]))&&!g5.test(V[3]),Y=/^[a-z]:/i.test(V[0]);if(K)return[...V.slice(0,4),...V.slice(4).map((H)=>this.parse(H))];else if(Y)return[V[0],...V.slice(1).map((H)=>this.parse(H))]}return V.map((K)=>this.parse(K))});if(this.debug(this.pattern,q),this.set=q.filter((V)=>V.indexOf(!1)===-1),this.isWindows)for(let V=0;V<this.set.length;V++){let $=this.set[V];if($[0]===""&&$[1]===""&&this.globParts[V][2]==="?"&&typeof $[3]==="string"&&/^[a-z]:$/i.test($[3]))$[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let Z=0;Z<Q.length;Z++)for(let q=0;q<Q[Z].length;q++)if(Q[Z][q]==="**")Q[Z][q]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let Z=-1;while((Z=X.indexOf("**",Z+1))!==-1){let q=Z;while(X[q+1]==="**")q++;if(q!==Z)X.splice(Z,q-Z)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce((Z,q)=>{let V=Z[Z.length-1];if(q==="**"&&V==="**")return Z;if(q===".."){if(V&&V!==".."&&V!=="."&&V!=="**")return Z.pop(),Z}return Z.push(q),Z},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let q=1;q<Q.length-1;q++){let V=Q[q];if(q===1&&V===""&&Q[0]==="")continue;if(V==="."||V==="")X=!0,Q.splice(q,1),q--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let Z=0;while((Z=Q.indexOf("..",Z+1))!==-1){let q=Q[Z-1];if(q&&q!=="."&&q!==".."&&q!=="**")X=!0,Q.splice(Z-1,2),Z-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let Z of Q){let q=-1;while((q=Z.indexOf("**",q+1))!==-1){let $=q;while(Z[$+1]==="**")$++;if($>q)Z.splice(q+1,$-q);let J=Z[q+1],K=Z[q+2],Y=Z[q+3];if(J!=="..")continue;if(!K||K==="."||K===".."||!Y||Y==="."||Y==="..")continue;X=!0,Z.splice(q,1);let H=Z.slice(0);H[q]="**",Q.push(H),q--}if(!this.preserveMultipleSlashes){for(let $=1;$<Z.length-1;$++){let J=Z[$];if($===1&&J===""&&Z[0]==="")continue;if(J==="."||J==="")X=!0,Z.splice($,1),$--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))X=!0,Z.pop()}let V=0;while((V=Z.indexOf("..",V+1))!==-1){let $=Z[V-1];if($&&$!=="."&&$!==".."&&$!=="**"){X=!0;let K=V===1&&Z[V+1]==="**"?["."]:[];if(Z.splice(V-1,2,...K),Z.length===0)Z.push("");V-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let Z=X+1;Z<Q.length;Z++){let q=this.partsMatch(Q[X],Q[Z],!this.preserveMultipleSlashes);if(q){Q[X]=[],Q[Z]=q;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,Z=!1){let q=0,V=0,$=[],J="";while(q<Q.length&&V<X.length)if(Q[q]===X[V])$.push(J==="b"?X[V]:Q[q]),q++,V++;else if(Z&&Q[q]==="**"&&X[V]===Q[q+1])$.push(Q[q]),q++;else if(Z&&X[V]==="**"&&Q[q]===X[V+1])$.push(X[V]),V++;else if(Q[q]==="*"&&X[V]&&(this.options.dot||!X[V].startsWith("."))&&X[V]!=="**"){if(J==="b")return!1;J="a",$.push(Q[q]),q++,V++}else if(X[V]==="*"&&Q[q]&&(this.options.dot||!Q[q].startsWith("."))&&Q[q]!=="**"){if(J==="a")return!1;J="b",$.push(X[V]),q++,V++}else return!1;return Q.length===X.length&&$}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,Z=0;for(let q=0;q<Q.length&&Q.charAt(q)==="!";q++)X=!X,Z++;if(Z)this.pattern=Q.slice(Z);this.negate=X}matchOne(Q,X,Z=!1){let q=this.options;if(this.isWindows){let k=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),G=!k&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),v=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),B=!v&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),C=G?3:k?0:void 0,A=B?3:v?0:void 0;if(typeof C==="number"&&typeof A==="number"){let[_,w]=[Q[C],X[A]];if(_.toLowerCase()===w.toLowerCase()){if(X[A]=_,A>C)X=X.slice(A);else if(C>A)Q=Q.slice(C)}}}let{optimizationLevel:V=1}=this.options;if(V>=2)Q=this.levelTwoFileOptimize(Q);this.debug("matchOne",this,{file:Q,pattern:X}),this.debug("matchOne",Q.length,X.length);for(var $=0,J=0,K=Q.length,Y=X.length;$<K&&J<Y;$++,J++){this.debug("matchOne loop");var H=X[J],z=Q[$];if(this.debug(X,H,z),H===!1)return!1;if(H===u){this.debug("GLOBSTAR",[X,H,z]);var W=$,j=J+1;if(j===Y){this.debug("** at the end");for(;$<K;$++)if(Q[$]==="."||Q[$]===".."||!q.dot&&Q[$].charAt(0)===".")return!1;return!0}while(W<K){var U=Q[W];if(this.debug(`
197
+ - Delete operations are not supported for safety reasons. Use terminal commands with user approval if needed.`,schema:o1});import{tool as D6}from"@langchain/core/tools";import{z as a2}from"zod";var X5=(Q,X,Z)=>{let q=Q instanceof RegExp?R5(Q,Z):Q,V=X instanceof RegExp?R5(X,Z):X,$=q!==null&&V!=null&&i1(q,V,Z);return $&&{start:$[0],end:$[1],pre:Z.slice(0,$[0]),body:Z.slice($[0]+q.length,$[1]),post:Z.slice($[1]+V.length)}},R5=(Q,X)=>{let Z=X.match(Q);return Z?Z[0]:null},i1=(Q,X,Z)=>{let q,V,$,J=void 0,K,Y=Z.indexOf(Q),H=Z.indexOf(X,Y+1),z=Y;if(Y>=0&&H>0){if(Q===X)return[Y,H];q=[],$=Z.length;while(z>=0&&!K){if(z===Y)q.push(z),Y=Z.indexOf(Q,z+1);else if(q.length===1){let W=q.pop();if(W!==void 0)K=[W,H]}else{if(V=q.pop(),V!==void 0&&V<$)$=V,J=H;H=Z.indexOf(X,z+1)}z=Y<H&&Y>=0?Y:H}if(q.length&&J!==void 0)K=[$,J]}return K};var F5="\x00SLASH"+Math.random()+"\x00",T5="\x00OPEN"+Math.random()+"\x00",q5="\x00CLOSE"+Math.random()+"\x00",m5="\x00COMMA"+Math.random()+"\x00",N5="\x00PERIOD"+Math.random()+"\x00",a1=new RegExp(F5,"g"),p1=new RegExp(T5,"g"),s1=new RegExp(q5,"g"),r1=new RegExp(m5,"g"),e1=new RegExp(N5,"g"),t1=/\\\\/g,QQ=/\\{/g,XQ=/\\}/g,ZQ=/\\,/g,qQ=/\\./g,VQ=1e5;function Z5(Q){return!isNaN(Q)?parseInt(Q,10):Q.charCodeAt(0)}function $Q(Q){return Q.replace(t1,F5).replace(QQ,T5).replace(XQ,q5).replace(ZQ,m5).replace(qQ,N5)}function JQ(Q){return Q.replace(a1,"\\").replace(p1,"{").replace(s1,"}").replace(r1,",").replace(e1,".")}function D5(Q){if(!Q)return[""];let X=[],Z=X5("{","}",Q);if(!Z)return Q.split(",");let{pre:q,body:V,post:$}=Z,J=q.split(",");J[J.length-1]+="{"+V+"}";let K=D5($);if($.length)J[J.length-1]+=K.shift(),J.push.apply(J,K);return X.push.apply(X,J),X}function S5(Q,X={}){if(!Q)return[];let{max:Z=VQ}=X;if(Q.slice(0,2)==="{}")Q="\\{\\}"+Q.slice(2);return z2($Q(Q),Z,!0).map(JQ)}function KQ(Q){return"{"+Q+"}"}function YQ(Q){return/^-?0\d/.test(Q)}function HQ(Q,X){return Q<=X}function WQ(Q,X){return Q>=X}function z2(Q,X,Z){let q=[],V=X5("{","}",Q);if(!V)return[Q];let $=V.pre,J=V.post.length?z2(V.post,X,!1):[""];if(/\$$/.test(V.pre))for(let K=0;K<J.length&&K<X;K++){let Y=$+"{"+V.body+"}"+J[K];q.push(Y)}else{let K=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(V.body),Y=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(V.body),H=K||Y,z=V.body.indexOf(",")>=0;if(!H&&!z){if(V.post.match(/,(?!,).*\}/))return Q=V.pre+"{"+V.body+q5+V.post,z2(Q,X,!0);return[Q]}let W;if(H)W=V.body.split(/\.\./);else if(W=D5(V.body),W.length===1&&W[0]!==void 0){if(W=z2(W[0],X,!1).map(KQ),W.length===1)return J.map((U)=>V.pre+W[0]+U)}let j;if(H&&W[0]!==void 0&&W[1]!==void 0){let U=Z5(W[0]),k=Z5(W[1]),G=Math.max(W[0].length,W[1].length),v=W.length===3&&W[2]!==void 0?Math.abs(Z5(W[2])):1,B=HQ;if(k<U)v*=-1,B=WQ;let A=W.some(YQ);j=[];for(let _=U;B(_,k);_+=v){let w;if(Y){if(w=String.fromCharCode(_),w==="\\")w=""}else if(w=String(_),A){let o=G-w.length;if(o>0){let c=Array(o+1).join("0");if(_<0)w="-"+c+w.slice(1);else w=c+w}}j.push(w)}}else{j=[];for(let U=0;U<W.length;U++)j.push.apply(j,z2(W[U],X,!1))}for(let U=0;U<j.length;U++)for(let k=0;k<J.length&&q.length<X;k++){let G=$+j[U]+J[k];if(!Z||H||G)q.push(G)}}return q}var j2=(Q)=>{if(typeof Q!=="string")throw TypeError("invalid pattern");if(Q.length>65536)throw TypeError("pattern is too long")};var zQ={"[: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]},U2=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),jQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),P5=(Q)=>Q.join(""),y5=(Q,X)=>{let Z=X;if(Q.charAt(Z)!=="[")throw Error("not in a brace expression");let q=[],V=[],$=Z+1,J=!1,K=!1,Y=!1,H=!1,z=Z,W="";Q:while($<Q.length){let G=Q.charAt($);if((G==="!"||G==="^")&&$===Z+1){H=!0,$++;continue}if(G==="]"&&J&&!Y){z=$+1;break}if(J=!0,G==="\\"){if(!Y){Y=!0,$++;continue}}if(G==="["&&!Y){for(let[v,[B,C,A]]of Object.entries(zQ))if(Q.startsWith(v,$)){if(W)return["$.",!1,Q.length-Z,!0];if($+=v.length,A)V.push(B);else q.push(B);K=K||C;continue Q}}if(Y=!1,W){if(G>W)q.push(U2(W)+"-"+U2(G));else if(G===W)q.push(U2(G));W="",$++;continue}if(Q.startsWith("-]",$+1)){q.push(U2(G+"-")),$+=2;continue}if(Q.startsWith("-",$+1)){W=G,$+=2;continue}q.push(U2(G)),$++}if(z<$)return["",!1,0,!1];if(!q.length&&!V.length)return["$.",!1,Q.length-Z,!0];if(V.length===0&&q.length===1&&/^\\?.$/.test(q[0])&&!H){let G=q[0].length===2?q[0].slice(-1):q[0];return[jQ(G),!1,z-Z,!1]}let j="["+(H?"^":"")+P5(q)+"]",U="["+(H?"":"^")+P5(V)+"]";return[q.length&&V.length?"("+j+"|"+U+")":q.length?j:U,K,z-Z,!0]};var b=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!0}={})=>{if(Z)return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");return X?Q.replace(/\[([^\/\\{}])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};var UQ=new Set(["!","?","+","*","@"]),b5=(Q)=>UQ.has(Q),GQ="(?!(?:^|/)\\.\\.?(?:$|/))",F2="(?!\\.)",kQ=new Set(["[","."]),BQ=new Set(["..","."]),CQ=new Set("().*{}+?[]^$\\!"),vQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),V5="[^/]",f5=V5+"*?",E5=V5+"+?";class O{type;#Q;#Z;#$=!1;#V=[];#J;#A;#C;#W=!1;#K;#j;#z=!1;constructor(Q,X,Z={}){if(this.type=Q,Q)this.#Z=!0;if(this.#J=X,this.#Q=this.#J?this.#J.#Q:this,this.#K=this.#Q===this?Z:this.#Q.#K,this.#C=this.#Q===this?[]:this.#Q.#C,Q==="!"&&!this.#Q.#W)this.#C.push(this);this.#A=this.#J?this.#J.#V.length:0}get hasMagic(){if(this.#Z!==void 0)return this.#Z;for(let Q of this.#V){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#Z=!0}return this.#Z}toString(){if(this.#j!==void 0)return this.#j;if(!this.type)return this.#j=this.#V.map((Q)=>String(Q)).join("");else return this.#j=this.type+"("+this.#V.map((Q)=>String(Q)).join("|")+")"}#Y(){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.#C.pop()){if(Q.type!=="!")continue;let X=Q,Z=X.#J;while(Z){for(let q=X.#A+1;!Z.type&&q<Z.#V.length;q++)for(let V of Q.#V){if(typeof V==="string")throw Error("string part in extglob AST??");V.copyIn(Z.#V[q])}X=Z,Z=X.#J}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof O&&X.#J===this))throw Error("invalid part: "+X);this.#V.push(X)}}toJSON(){let Q=this.type===null?this.#V.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#V.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#W&&this.#J?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#J?.isStart())return!1;if(this.#A===0)return!0;let Q=this.#J;for(let X=0;X<this.#A;X++){let Z=Q.#V[X];if(!(Z instanceof O&&Z.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#J?.type==="!")return!0;if(!this.#J?.isEnd())return!1;if(!this.type)return this.#J?.isEnd();let Q=this.#J?this.#J.#V.length:0;return this.#A===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new O(this.type,Q);for(let Z of this.#V)X.copyIn(Z);return X}static#q(Q,X,Z,q){let V=!1,$=!1,J=-1,K=!1;if(X.type===null){let j=Z,U="";while(j<Q.length){let k=Q.charAt(j++);if(V||k==="\\"){V=!V,U+=k;continue}if($){if(j===J+1){if(k==="^"||k==="!")K=!0}else if(k==="]"&&!(j===J+2&&K))$=!1;U+=k;continue}else if(k==="["){$=!0,J=j,K=!1,U+=k;continue}if(!q.noext&&b5(k)&&Q.charAt(j)==="("){X.push(U),U="";let G=new O(k,X);j=O.#q(Q,G,j,q),X.push(G);continue}U+=k}return X.push(U),j}let Y=Z+1,H=new O(null,X),z=[],W="";while(Y<Q.length){let j=Q.charAt(Y++);if(V||j==="\\"){V=!V,W+=j;continue}if($){if(Y===J+1){if(j==="^"||j==="!")K=!0}else if(j==="]"&&!(Y===J+2&&K))$=!1;W+=j;continue}else if(j==="["){$=!0,J=Y,K=!1,W+=j;continue}if(b5(j)&&Q.charAt(Y)==="("){H.push(W),W="";let U=new O(j,H);H.push(U),Y=O.#q(Q,U,Y,q);continue}if(j==="|"){H.push(W),W="",z.push(H),H=new O(null,X);continue}if(j===")"){if(W===""&&X.#V.length===0)X.#z=!0;return H.push(W),W="",X.push(...z,H),Y}W+=j}return X.type=null,X.#Z=void 0,X.#V=[Q.substring(Z-1)],Y}static fromGlob(Q,X={}){let Z=new O(null,void 0,X);return O.#q(Q,Z,0,X),Z}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,Z,q,V]=this.toRegExpSource();if(!(q||this.#Z||this.#K.nocase&&!this.#K.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return Z;let J=(this.#K.nocase?"i":"")+(V?"u":"");return Object.assign(new RegExp(`^${X}$`,J),{_src:X,_glob:Q})}get options(){return this.#K}toRegExpSource(Q){let X=Q??!!this.#K.dot;if(this.#Q===this)this.#Y();if(!this.type){let K=this.isStart()&&this.isEnd()&&!this.#V.some((j)=>typeof j!=="string"),Y=this.#V.map((j)=>{let[U,k,G,v]=typeof j==="string"?O.#_(j,this.#Z,K):j.toRegExpSource(Q);return this.#Z=this.#Z||G,this.#$=this.#$||v,U}).join(""),H="";if(this.isStart()){if(typeof this.#V[0]==="string"){if(!(this.#V.length===1&&BQ.has(this.#V[0]))){let U=kQ,k=X&&U.has(Y.charAt(0))||Y.startsWith("\\.")&&U.has(Y.charAt(2))||Y.startsWith("\\.\\.")&&U.has(Y.charAt(4)),G=!X&&!Q&&U.has(Y.charAt(0));H=k?GQ:G?F2:""}}}let z="";if(this.isEnd()&&this.#Q.#W&&this.#J?.type==="!")z="(?:$|\\/)";return[H+Y+z,b(Y),this.#Z=!!this.#Z,this.#$]}let Z=this.type==="*"||this.type==="+",q=this.type==="!"?"(?:(?!(?:":"(?:",V=this.#U(X);if(this.isStart()&&this.isEnd()&&!V&&this.type!=="!"){let K=this.toString();return this.#V=[K],this.type=null,this.#Z=void 0,[K,b(this.toString()),!1,!1]}let $=!Z||Q||X||!F2?"":this.#U(!0);if($===V)$="";if($)V=`(?:${V})(?:${$})*?`;let J="";if(this.type==="!"&&this.#z)J=(this.isStart()&&!X?F2:"")+E5;else{let K=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?F2:"")+f5+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&$?")":this.type==="*"&&$?")?":`)${this.type}`;J=q+V+K}return[J,b(V),this.#Z=!!this.#Z,this.#$]}#U(Q){return this.#V.map((X)=>{if(typeof X==="string")throw Error("string type in extglob ast??");let[Z,q,V,$]=X.toRegExpSource(Q);return this.#$=this.#$||$,Z}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#_(Q,X,Z=!1){let q=!1,V="",$=!1,J=!1;for(let K=0;K<Q.length;K++){let Y=Q.charAt(K);if(q){q=!1,V+=(CQ.has(Y)?"\\":"")+Y;continue}if(Y==="*"){if(J)continue;J=!0,V+=Z&&/^[*]+$/.test(Q)?E5:f5,X=!0;continue}else J=!1;if(Y==="\\"){if(K===Q.length-1)V+="\\\\";else q=!0;continue}if(Y==="["){let[H,z,W,j]=y5(Q,K);if(W){V+=H,$=$||z,K+=W-1,X=X||j;continue}}if(Y==="?"){V+=V5,X=!0;continue}V+=vQ(Y)}return[V,b(Q),!!X,$]}}var q2=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!1}={})=>{if(Z)return X?Q.replace(/[?*()[\]{}]/g,"[$&]"):Q.replace(/[?*()[\]\\{}]/g,"\\$&");return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var F=(Q,X,Z={})=>{if(j2(X),!Z.nocomment&&X.charAt(0)==="#")return!1;return new S(X,Z).match(Q)},wQ=/^\*+([^+@!?\*\[\(]*)$/,AQ=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),_Q=(Q)=>(X)=>X.endsWith(Q),LQ=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},MQ=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},IQ=/^\*+\.\*+$/,xQ=(Q)=>!Q.startsWith(".")&&Q.includes("."),OQ=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),uQ=/^\.\*+$/,RQ=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),FQ=/^\*+$/,TQ=(Q)=>Q.length!==0&&!Q.startsWith("."),mQ=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",NQ=/^\?+([^+@!?\*\[\(]*)?$/,DQ=([Q,X=""])=>{let Z=d5([Q]);if(!X)return Z;return X=X.toLowerCase(),(q)=>Z(q)&&q.toLowerCase().endsWith(X)},SQ=([Q,X=""])=>{let Z=c5([Q]);if(!X)return Z;return X=X.toLowerCase(),(q)=>Z(q)&&q.toLowerCase().endsWith(X)},PQ=([Q,X=""])=>{let Z=c5([Q]);return!X?Z:(q)=>Z(q)&&q.endsWith(X)},yQ=([Q,X=""])=>{let Z=d5([Q]);return!X?Z:(q)=>Z(q)&&q.endsWith(X)},d5=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&!Z.startsWith(".")},c5=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&Z!=="."&&Z!==".."},l5=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",h5={win32:{sep:"\\"},posix:{sep:"/"}},bQ=l5==="win32"?h5.win32.sep:h5.posix.sep;F.sep=bQ;var u=Symbol("globstar **");F.GLOBSTAR=u;var fQ="[^/]",EQ=fQ+"*?",hQ="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",gQ="(?:(?!(?:\\/|^)\\.).)*?",dQ=(Q,X={})=>(Z)=>F(Z,Q,X);F.filter=dQ;var D=(Q,X={})=>Object.assign({},Q,X),cQ=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return F;let X=F;return Object.assign((q,V,$={})=>X(q,V,D(Q,$)),{Minimatch:class extends X.Minimatch{constructor(V,$={}){super(V,D(Q,$))}static defaults(V){return X.defaults(D(Q,V)).Minimatch}},AST:class extends X.AST{constructor(V,$,J={}){super(V,$,D(Q,J))}static fromGlob(V,$={}){return X.AST.fromGlob(V,D(Q,$))}},unescape:(q,V={})=>X.unescape(q,D(Q,V)),escape:(q,V={})=>X.escape(q,D(Q,V)),filter:(q,V={})=>X.filter(q,D(Q,V)),defaults:(q)=>X.defaults(D(Q,q)),makeRe:(q,V={})=>X.makeRe(q,D(Q,V)),braceExpand:(q,V={})=>X.braceExpand(q,D(Q,V)),match:(q,V,$={})=>X.match(q,V,D(Q,$)),sep:X.sep,GLOBSTAR:u})};F.defaults=cQ;var n5=(Q,X={})=>{if(j2(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return S5(Q,{max:X.braceExpandMax})};F.braceExpand=n5;var lQ=(Q,X={})=>new S(Q,X).makeRe();F.makeRe=lQ;var nQ=(Q,X,Z={})=>{let q=new S(X,Z);if(Q=Q.filter((V)=>q.match(V)),q.options.nonull&&!Q.length)Q.push(X);return Q};F.match=nQ;var g5=/[?*]|[+@!]\(.*?\)|\[|\]/,oQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class S{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Q,X={}){j2(Q),X=X||{},this.options=X,this.pattern=Q,this.platform=X.platform||l5,this.isWindows=this.platform==="win32";let Z="allowWindowsEscape";if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X[Z]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.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 X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...V)=>console.error(...V);this.debug(this.pattern,this.globSet);let Z=this.globSet.map((V)=>this.slashSplit(V));this.globParts=this.preprocess(Z),this.debug(this.pattern,this.globParts);let q=this.globParts.map((V,$,J)=>{if(this.isWindows&&this.windowsNoMagicRoot){let K=V[0]===""&&V[1]===""&&(V[2]==="?"||!g5.test(V[2]))&&!g5.test(V[3]),Y=/^[a-z]:/i.test(V[0]);if(K)return[...V.slice(0,4),...V.slice(4).map((H)=>this.parse(H))];else if(Y)return[V[0],...V.slice(1).map((H)=>this.parse(H))]}return V.map((K)=>this.parse(K))});if(this.debug(this.pattern,q),this.set=q.filter((V)=>V.indexOf(!1)===-1),this.isWindows)for(let V=0;V<this.set.length;V++){let $=this.set[V];if($[0]===""&&$[1]===""&&this.globParts[V][2]==="?"&&typeof $[3]==="string"&&/^[a-z]:$/i.test($[3]))$[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let Z=0;Z<Q.length;Z++)for(let q=0;q<Q[Z].length;q++)if(Q[Z][q]==="**")Q[Z][q]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let Z=-1;while((Z=X.indexOf("**",Z+1))!==-1){let q=Z;while(X[q+1]==="**")q++;if(q!==Z)X.splice(Z,q-Z)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce((Z,q)=>{let V=Z[Z.length-1];if(q==="**"&&V==="**")return Z;if(q===".."){if(V&&V!==".."&&V!=="."&&V!=="**")return Z.pop(),Z}return Z.push(q),Z},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let q=1;q<Q.length-1;q++){let V=Q[q];if(q===1&&V===""&&Q[0]==="")continue;if(V==="."||V==="")X=!0,Q.splice(q,1),q--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let Z=0;while((Z=Q.indexOf("..",Z+1))!==-1){let q=Q[Z-1];if(q&&q!=="."&&q!==".."&&q!=="**")X=!0,Q.splice(Z-1,2),Z-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let Z of Q){let q=-1;while((q=Z.indexOf("**",q+1))!==-1){let $=q;while(Z[$+1]==="**")$++;if($>q)Z.splice(q+1,$-q);let J=Z[q+1],K=Z[q+2],Y=Z[q+3];if(J!=="..")continue;if(!K||K==="."||K===".."||!Y||Y==="."||Y==="..")continue;X=!0,Z.splice(q,1);let H=Z.slice(0);H[q]="**",Q.push(H),q--}if(!this.preserveMultipleSlashes){for(let $=1;$<Z.length-1;$++){let J=Z[$];if($===1&&J===""&&Z[0]==="")continue;if(J==="."||J==="")X=!0,Z.splice($,1),$--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))X=!0,Z.pop()}let V=0;while((V=Z.indexOf("..",V+1))!==-1){let $=Z[V-1];if($&&$!=="."&&$!==".."&&$!=="**"){X=!0;let K=V===1&&Z[V+1]==="**"?["."]:[];if(Z.splice(V-1,2,...K),Z.length===0)Z.push("");V-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let Z=X+1;Z<Q.length;Z++){let q=this.partsMatch(Q[X],Q[Z],!this.preserveMultipleSlashes);if(q){Q[X]=[],Q[Z]=q;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,Z=!1){let q=0,V=0,$=[],J="";while(q<Q.length&&V<X.length)if(Q[q]===X[V])$.push(J==="b"?X[V]:Q[q]),q++,V++;else if(Z&&Q[q]==="**"&&X[V]===Q[q+1])$.push(Q[q]),q++;else if(Z&&X[V]==="**"&&Q[q]===X[V+1])$.push(X[V]),V++;else if(Q[q]==="*"&&X[V]&&(this.options.dot||!X[V].startsWith("."))&&X[V]!=="**"){if(J==="b")return!1;J="a",$.push(Q[q]),q++,V++}else if(X[V]==="*"&&Q[q]&&(this.options.dot||!Q[q].startsWith("."))&&Q[q]!=="**"){if(J==="a")return!1;J="b",$.push(X[V]),q++,V++}else return!1;return Q.length===X.length&&$}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,Z=0;for(let q=0;q<Q.length&&Q.charAt(q)==="!";q++)X=!X,Z++;if(Z)this.pattern=Q.slice(Z);this.negate=X}matchOne(Q,X,Z=!1){let q=this.options;if(this.isWindows){let k=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),G=!k&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),v=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),B=!v&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),C=G?3:k?0:void 0,A=B?3:v?0:void 0;if(typeof C==="number"&&typeof A==="number"){let[_,w]=[Q[C],X[A]];if(_.toLowerCase()===w.toLowerCase()){if(X[A]=_,A>C)X=X.slice(A);else if(C>A)Q=Q.slice(C)}}}let{optimizationLevel:V=1}=this.options;if(V>=2)Q=this.levelTwoFileOptimize(Q);this.debug("matchOne",this,{file:Q,pattern:X}),this.debug("matchOne",Q.length,X.length);for(var $=0,J=0,K=Q.length,Y=X.length;$<K&&J<Y;$++,J++){this.debug("matchOne loop");var H=X[J],z=Q[$];if(this.debug(X,H,z),H===!1)return!1;if(H===u){this.debug("GLOBSTAR",[X,H,z]);var W=$,j=J+1;if(j===Y){this.debug("** at the end");for(;$<K;$++)if(Q[$]==="."||Q[$]===".."||!q.dot&&Q[$].charAt(0)===".")return!1;return!0}while(W<K){var U=Q[W];if(this.debug(`
198
198
  globstar while`,Q,W,X,j,U),this.matchOne(Q.slice(W),X.slice(j),Z))return this.debug("globstar found match!",W,K,U),!0;else{if(U==="."||U===".."||!q.dot&&U.charAt(0)==="."){this.debug("dot detected!",Q,W,X,j);break}this.debug("globstar swallow a segment, and continue"),W++}}if(Z){if(this.debug(`
199
- >>> no match, partial?`,Q,W,X,j),W===K)return!0}return!1}let k;if(typeof H==="string")k=z===H,this.debug("string match",H,z,k);else k=H.test(z),this.debug("pattern match",H,z,k);if(!k)return!1}if($===K&&J===Y)return!0;else if($===K)return Z;else if(J===Y)return $===K-1&&Q[$]==="";else throw Error("wtf?")}braceExpand(){return n5(this.pattern,this.options)}parse(Q){j2(Q);let X=this.options;if(Q==="**")return u;if(Q==="")return"";let Z,q=null;if(Z=Q.match(FQ))q=X.dot?mQ:TQ;else if(Z=Q.match(wQ))q=(X.nocase?X.dot?MQ:LQ:X.dot?_Q:AQ)(Z[1]);else if(Z=Q.match(NQ))q=(X.nocase?X.dot?SQ:DQ:X.dot?PQ:yQ)(Z);else if(Z=Q.match(IQ))q=X.dot?OQ:xQ;else if(Z=Q.match(uQ))q=RQ;let V=O.fromGlob(Q,this.options).toMMPattern();if(q&&typeof V==="object")Reflect.defineProperty(V,"test",{value:q});return V}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,Z=X.noglobstar?EQ:X.dot?hQ:gQ,q=new Set(X.nocase?["i"]:[]),V=Q.map((K)=>{let Y=K.map((z)=>{if(z instanceof RegExp)for(let W of z.flags.split(""))q.add(W);return typeof z==="string"?iQ(z):z===u?u:z._src});Y.forEach((z,W)=>{let j=Y[W+1],U=Y[W-1];if(z!==u||U===u)return;if(U===void 0)if(j!==void 0&&j!==u)Y[W+1]="(?:\\/|"+Z+"\\/)?"+j;else Y[W]=Z;else if(j===void 0)Y[W-1]=U+"(?:\\/|\\/"+Z+")?";else if(j!==u)Y[W-1]=U+"(?:\\/|\\/"+Z+"\\/)"+j,Y[W+1]=u});let H=Y.filter((z)=>z!==u);if(this.partial&&H.length>=1){let z=[];for(let W=1;W<=H.length;W++)z.push(H.slice(0,W).join("/"));return"(?:"+z.join("|")+")"}return H.join("/")}).join("|"),[$,J]=Q.length>1?["(?:",")"]:["",""];if(V="^"+$+V+J+"$",this.partial)V="^(?:\\/|"+$+V.slice(1,-1)+J+")$";if(this.negate)V="^(?!"+V+").+$";try{this.regexp=new RegExp(V,[...q].join(""))}catch(K){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,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let Z=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let q=this.slashSplit(Q);this.debug(this.pattern,"split",q);let V=this.set;this.debug(this.pattern,"set",V);let $=q[q.length-1];if(!$)for(let J=q.length-2;!$&&J>=0;J--)$=q[J];for(let J=0;J<V.length;J++){let K=V[J],Y=q;if(Z.matchBase&&K.length===1)Y=[$];if(this.matchOne(Y,K,X)){if(Z.flipNegate)return!0;return!this.negate}}if(Z.flipNegate)return!1;return this.negate}static defaults(Q){return F.defaults(Q).Minimatch}}F.AST=O;F.Minimatch=S;F.escape=q2;F.unescape=b;import{fileURLToPath as O6}from"node:url";var oQ=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,o5=new Set,$5=typeof process=="object"&&process?process:{},a5=(Q,X,Z,q)=>{typeof $5.emitWarning=="function"?$5.emitWarning(Q,X,Z,q):console.error(`[${Z}] ${X}: ${Q}`)},m2=globalThis.AbortController,i5=globalThis.AbortSignal;if(typeof m2>"u"){i5=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,q){this._onabort.push(q)}},m2=class{constructor(){X()}signal=new i5;abort(Z){if(!this.signal.aborted){this.signal.reason=Z,this.signal.aborted=!0;for(let q of this.signal._onabort)q(Z);this.signal.onabort?.(Z)}}};let Q=$5.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{Q&&(Q=!1,a5("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",X))}}var aQ=(Q)=>!o5.has(Q),h0=Symbol("type"),a=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),p5=(Q)=>a(Q)?Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?T2:null:null,T2=class extends Array{constructor(Q){super(Q),this.fill(0)}},pQ=class Q{heap;length;static#Q=!1;static create(X){let Z=p5(X);if(!Z)return[];Q.#Q=!0;let q=new Q(X,Z);return Q.#Q=!1,q}constructor(X,Z){if(!Q.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new Z(X),this.length=0}push(X){this.heap[this.length++]=X}pop(){return this.heap[--this.length]}},G2=class Q{#Q;#Z;#$;#V;#J;#A;#C;#W;get perf(){return this.#W}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#K;#j;#z;#Y;#q;#U;#_;#w;#G;#R;#k;#I;#x;#B;#v;#L;#O;#X;#S;static unsafeExposeInternals(X){return{starts:X.#x,ttls:X.#B,autopurgeTimers:X.#v,sizes:X.#I,keyMap:X.#z,keyList:X.#Y,valList:X.#q,next:X.#U,prev:X.#_,get head(){return X.#w},get tail(){return X.#G},free:X.#R,isBackgroundFetch:(Z)=>X.#H(Z),backgroundFetch:(Z,q,V,$)=>X.#d(Z,q,V,$),moveToTail:(Z)=>X.#y(Z),indexes:(Z)=>X.#T(Z),rindexes:(Z)=>X.#m(Z),isStale:(Z)=>X.#M(Z)}}get max(){return this.#Q}get maxSize(){return this.#Z}get calculatedSize(){return this.#j}get size(){return this.#K}get fetchMethod(){return this.#A}get memoMethod(){return this.#C}get dispose(){return this.#$}get onInsert(){return this.#V}get disposeAfter(){return this.#J}constructor(X){let{max:Z=0,ttl:q,ttlResolution:V=1,ttlAutopurge:$,updateAgeOnGet:J,updateAgeOnHas:K,allowStale:Y,dispose:H,onInsert:z,disposeAfter:W,noDisposeOnSet:j,noUpdateTTL:U,maxSize:k=0,maxEntrySize:G=0,sizeCalculation:v,fetchMethod:B,memoMethod:C,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:i,ignoreFetchAbort:c,perf:Q2}=X;if(Q2!==void 0&&typeof Q2?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#W=Q2??oQ,Z!==0&&!a(Z))throw TypeError("max option must be a nonnegative integer");let X2=Z?p5(Z):Array;if(!X2)throw Error("invalid max value: "+Z);if(this.#Q=Z,this.#Z=k,this.maxEntrySize=G||this.#Z,this.sizeCalculation=v,this.sizeCalculation){if(!this.#Z&&!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(C!==void 0&&typeof C!="function")throw TypeError("memoMethod must be a function if defined");if(this.#C=C,B!==void 0&&typeof B!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#A=B,this.#O=!!B,this.#z=new Map,this.#Y=Array(Z).fill(void 0),this.#q=Array(Z).fill(void 0),this.#U=new X2(Z),this.#_=new X2(Z),this.#w=0,this.#G=0,this.#R=pQ.create(Z),this.#K=0,this.#j=0,typeof H=="function"&&(this.#$=H),typeof z=="function"&&(this.#V=z),typeof W=="function"?(this.#J=W,this.#k=[]):(this.#J=void 0,this.#k=void 0),this.#L=!!this.#$,this.#S=!!this.#V,this.#X=!!this.#J,this.noDisposeOnSet=!!j,this.noUpdateTTL=!!U,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!i,this.ignoreFetchAbort=!!c,this.maxEntrySize!==0){if(this.#Z!==0&&!a(this.#Z))throw TypeError("maxSize must be a positive integer if specified");if(!a(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#l()}if(this.allowStale=!!Y,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!J,this.updateAgeOnHas=!!K,this.ttlResolution=a(V)||V===0?V:1,this.ttlAutopurge=!!$,this.ttl=q||0,this.ttl){if(!a(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#Q===0&&this.ttl===0&&this.#Z===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#Z){let Q5="LRU_CACHE_UNBOUNDED";aQ(Q5)&&(o5.add(Q5),a5("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Q5,Q))}}getRemainingTTL(X){return this.#z.has(X)?1/0:0}#N(){let X=new T2(this.#Q),Z=new T2(this.#Q);this.#B=X,this.#x=Z;let q=this.ttlAutopurge?Array(this.#Q):void 0;this.#v=q,this.#f=(J,K,Y=this.#W.now())=>{if(Z[J]=K!==0?Y:0,X[J]=K,q?.[J]&&(clearTimeout(q[J]),q[J]=void 0),K!==0&&q){let H=setTimeout(()=>{this.#M(J)&&this.#F(this.#Y[J],"expire")},K+1);H.unref&&H.unref(),q[J]=H}},this.#u=(J)=>{Z[J]=X[J]!==0?this.#W.now():0},this.#D=(J,K)=>{if(X[K]){let Y=X[K],H=Z[K];if(!Y||!H)return;J.ttl=Y,J.start=H,J.now=V||$();let z=J.now-H;J.remainingTTL=Y-z}};let V=0,$=()=>{let J=this.#W.now();if(this.ttlResolution>0){V=J;let K=setTimeout(()=>V=0,this.ttlResolution);K.unref&&K.unref()}return J};this.getRemainingTTL=(J)=>{let K=this.#z.get(J);if(K===void 0)return 0;let Y=X[K],H=Z[K];if(!Y||!H)return 1/0;let z=(V||$())-H;return Y-z},this.#M=(J)=>{let K=Z[J],Y=X[J];return!!Y&&!!K&&(V||$())-K>Y}}#u=()=>{};#D=()=>{};#f=()=>{};#M=()=>!1;#l(){let X=new T2(this.#Q);this.#j=0,this.#I=X,this.#b=(Z)=>{this.#j-=X[Z],X[Z]=0},this.#E=(Z,q,V,$)=>{if(this.#H(q))return 0;if(!a(V))if($){if(typeof $!="function")throw TypeError("sizeCalculation must be a function");if(V=$(q,Z),!a(V))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 V},this.#P=(Z,q,V)=>{if(X[Z]=q,this.#Z){let $=this.#Z-X[Z];for(;this.#j>$;)this.#g(!0)}this.#j+=X[Z],V&&(V.entrySize=q,V.totalCalculatedSize=this.#j)}}#b=(X)=>{};#P=(X,Z,q)=>{};#E=(X,Z,q,V)=>{if(q||V)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:X=this.allowStale}={}){if(this.#K)for(let Z=this.#G;!(!this.#h(Z)||((X||!this.#M(Z))&&(yield Z),Z===this.#w));)Z=this.#_[Z]}*#m({allowStale:X=this.allowStale}={}){if(this.#K)for(let Z=this.#w;!(!this.#h(Z)||((X||!this.#M(Z))&&(yield Z),Z===this.#G));)Z=this.#U[Z]}#h(X){return X!==void 0&&this.#z.get(this.#Y[X])===X}*entries(){for(let X of this.#T())this.#q[X]!==void 0&&this.#Y[X]!==void 0&&!this.#H(this.#q[X])&&(yield[this.#Y[X],this.#q[X]])}*rentries(){for(let X of this.#m())this.#q[X]!==void 0&&this.#Y[X]!==void 0&&!this.#H(this.#q[X])&&(yield[this.#Y[X],this.#q[X]])}*keys(){for(let X of this.#T()){let Z=this.#Y[X];Z!==void 0&&!this.#H(this.#q[X])&&(yield Z)}}*rkeys(){for(let X of this.#m()){let Z=this.#Y[X];Z!==void 0&&!this.#H(this.#q[X])&&(yield Z)}}*values(){for(let X of this.#T())this.#q[X]!==void 0&&!this.#H(this.#q[X])&&(yield this.#q[X])}*rvalues(){for(let X of this.#m())this.#q[X]!==void 0&&!this.#H(this.#q[X])&&(yield this.#q[X])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(X,Z={}){for(let q of this.#T()){let V=this.#q[q],$=this.#H(V)?V.__staleWhileFetching:V;if($!==void 0&&X($,this.#Y[q],this))return this.get(this.#Y[q],Z)}}forEach(X,Z=this){for(let q of this.#T()){let V=this.#q[q],$=this.#H(V)?V.__staleWhileFetching:V;$!==void 0&&X.call(Z,$,this.#Y[q],this)}}rforEach(X,Z=this){for(let q of this.#m()){let V=this.#q[q],$=this.#H(V)?V.__staleWhileFetching:V;$!==void 0&&X.call(Z,$,this.#Y[q],this)}}purgeStale(){let X=!1;for(let Z of this.#m({allowStale:!0}))this.#M(Z)&&(this.#F(this.#Y[Z],"expire"),X=!0);return X}info(X){let Z=this.#z.get(X);if(Z===void 0)return;let q=this.#q[Z],V=this.#H(q)?q.__staleWhileFetching:q;if(V===void 0)return;let $={value:V};if(this.#B&&this.#x){let J=this.#B[Z],K=this.#x[Z];if(J&&K){let Y=J-(this.#W.now()-K);$.ttl=Y,$.start=Date.now()}}return this.#I&&($.size=this.#I[Z]),$}dump(){let X=[];for(let Z of this.#T({allowStale:!0})){let q=this.#Y[Z],V=this.#q[Z],$=this.#H(V)?V.__staleWhileFetching:V;if($===void 0||q===void 0)continue;let J={value:$};if(this.#B&&this.#x){J.ttl=this.#B[Z];let K=this.#W.now()-this.#x[Z];J.start=Math.floor(Date.now()-K)}this.#I&&(J.size=this.#I[Z]),X.unshift([q,J])}return X}load(X){this.clear();for(let[Z,q]of X){if(q.start){let V=Date.now()-q.start;q.start=this.#W.now()-V}this.set(Z,q.value,q)}}set(X,Z,q={}){if(Z===void 0)return this.delete(X),this;let{ttl:V=this.ttl,start:$,noDisposeOnSet:J=this.noDisposeOnSet,sizeCalculation:K=this.sizeCalculation,status:Y}=q,{noUpdateTTL:H=this.noUpdateTTL}=q,z=this.#E(X,Z,q.size||0,K);if(this.maxEntrySize&&z>this.maxEntrySize)return Y&&(Y.set="miss",Y.maxEntrySizeExceeded=!0),this.#F(X,"set"),this;let W=this.#K===0?void 0:this.#z.get(X);if(W===void 0)W=this.#K===0?this.#G:this.#R.length!==0?this.#R.pop():this.#K===this.#Q?this.#g(!1):this.#K,this.#Y[W]=X,this.#q[W]=Z,this.#z.set(X,W),this.#U[this.#G]=W,this.#_[W]=this.#G,this.#G=W,this.#K++,this.#P(W,z,Y),Y&&(Y.set="add"),H=!1,this.#S&&this.#V?.(Z,X,"add");else{this.#y(W);let j=this.#q[W];if(Z!==j){if(this.#O&&this.#H(j)){j.__abortController.abort(Error("replaced"));let{__staleWhileFetching:U}=j;U!==void 0&&!J&&(this.#L&&this.#$?.(U,X,"set"),this.#X&&this.#k?.push([U,X,"set"]))}else J||(this.#L&&this.#$?.(j,X,"set"),this.#X&&this.#k?.push([j,X,"set"]));if(this.#b(W),this.#P(W,z,Y),this.#q[W]=Z,Y){Y.set="replace";let U=j&&this.#H(j)?j.__staleWhileFetching:j;U!==void 0&&(Y.oldValue=U)}}else Y&&(Y.set="update");this.#S&&this.onInsert?.(Z,X,Z===j?"update":"replace")}if(V!==0&&!this.#B&&this.#N(),this.#B&&(H||this.#f(W,V,$),Y&&this.#D(Y,W)),!J&&this.#X&&this.#k){let j=this.#k,U;for(;U=j?.shift();)this.#J?.(...U)}return this}pop(){try{for(;this.#K;){let X=this.#q[this.#w];if(this.#g(!0),this.#H(X)){if(X.__staleWhileFetching)return X.__staleWhileFetching}else if(X!==void 0)return X}}finally{if(this.#X&&this.#k){let X=this.#k,Z;for(;Z=X?.shift();)this.#J?.(...Z)}}}#g(X){let Z=this.#w,q=this.#Y[Z],V=this.#q[Z];return this.#O&&this.#H(V)?V.__abortController.abort(Error("evicted")):(this.#L||this.#X)&&(this.#L&&this.#$?.(V,q,"evict"),this.#X&&this.#k?.push([V,q,"evict"])),this.#b(Z),this.#v?.[Z]&&(clearTimeout(this.#v[Z]),this.#v[Z]=void 0),X&&(this.#Y[Z]=void 0,this.#q[Z]=void 0,this.#R.push(Z)),this.#K===1?(this.#w=this.#G=0,this.#R.length=0):this.#w=this.#U[Z],this.#z.delete(q),this.#K--,Z}has(X,Z={}){let{updateAgeOnHas:q=this.updateAgeOnHas,status:V}=Z,$=this.#z.get(X);if($!==void 0){let J=this.#q[$];if(this.#H(J)&&J.__staleWhileFetching===void 0)return!1;if(this.#M($))V&&(V.has="stale",this.#D(V,$));else return q&&this.#u($),V&&(V.has="hit",this.#D(V,$)),!0}else V&&(V.has="miss");return!1}peek(X,Z={}){let{allowStale:q=this.allowStale}=Z,V=this.#z.get(X);if(V===void 0||!q&&this.#M(V))return;let $=this.#q[V];return this.#H($)?$.__staleWhileFetching:$}#d(X,Z,q,V){let $=Z===void 0?void 0:this.#q[Z];if(this.#H($))return $;let J=new m2,{signal:K}=q;K?.addEventListener("abort",()=>J.abort(K.reason),{signal:J.signal});let Y={signal:J.signal,options:q,context:V},H=(G,v=!1)=>{let{aborted:B}=J.signal,C=q.ignoreFetchAbort&&G!==void 0,A=q.ignoreFetchAbort||!!(q.allowStaleOnFetchAbort&&G!==void 0);if(q.status&&(B&&!v?(q.status.fetchAborted=!0,q.status.fetchError=J.signal.reason,C&&(q.status.fetchAbortIgnored=!0)):q.status.fetchResolved=!0),B&&!C&&!v)return W(J.signal.reason,A);let _=U,w=this.#q[Z];return(w===U||C&&v&&w===void 0)&&(G===void 0?_.__staleWhileFetching!==void 0?this.#q[Z]=_.__staleWhileFetching:this.#F(X,"fetch"):(q.status&&(q.status.fetchUpdated=!0),this.set(X,G,Y.options))),G},z=(G)=>(q.status&&(q.status.fetchRejected=!0,q.status.fetchError=G),W(G,!1)),W=(G,v)=>{let{aborted:B}=J.signal,C=B&&q.allowStaleOnFetchAbort,A=C||q.allowStaleOnFetchRejection,_=A||q.noDeleteOnFetchRejection,w=U;if(this.#q[Z]===U&&(!_||!v&&w.__staleWhileFetching===void 0?this.#F(X,"fetch"):C||(this.#q[Z]=w.__staleWhileFetching)),A)return q.status&&w.__staleWhileFetching!==void 0&&(q.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw G},j=(G,v)=>{let B=this.#A?.(X,$,Y);B&&B instanceof Promise&&B.then((C)=>G(C===void 0?void 0:C),v),J.signal.addEventListener("abort",()=>{(!q.ignoreFetchAbort||q.allowStaleOnFetchAbort)&&(G(void 0),q.allowStaleOnFetchAbort&&(G=(C)=>H(C,!0)))})};q.status&&(q.status.fetchDispatched=!0);let U=new Promise(j).then(H,z),k=Object.assign(U,{__abortController:J,__staleWhileFetching:$,__returned:void 0});return Z===void 0?(this.set(X,k,{...Y.options,status:void 0}),Z=this.#z.get(X)):this.#q[Z]=k,k}#H(X){if(!this.#O)return!1;let Z=X;return!!Z&&Z instanceof Promise&&Z.hasOwnProperty("__staleWhileFetching")&&Z.__abortController instanceof m2}async fetch(X,Z={}){let{allowStale:q=this.allowStale,updateAgeOnGet:V=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,ttl:J=this.ttl,noDisposeOnSet:K=this.noDisposeOnSet,size:Y=0,sizeCalculation:H=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:W=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:j=this.allowStaleOnFetchRejection,ignoreFetchAbort:U=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:G,forceRefresh:v=!1,status:B,signal:C}=Z;if(!this.#O)return B&&(B.fetch="get"),this.get(X,{allowStale:q,updateAgeOnGet:V,noDeleteOnStaleGet:$,status:B});let A={allowStale:q,updateAgeOnGet:V,noDeleteOnStaleGet:$,ttl:J,noDisposeOnSet:K,size:Y,sizeCalculation:H,noUpdateTTL:z,noDeleteOnFetchRejection:W,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:k,ignoreFetchAbort:U,status:B,signal:C},_=this.#z.get(X);if(_===void 0){B&&(B.fetch="miss");let w=this.#d(X,_,A,G);return w.__returned=w}else{let w=this.#q[_];if(this.#H(w)){let X2=q&&w.__staleWhileFetching!==void 0;return B&&(B.fetch="inflight",X2&&(B.returnedStale=!0)),X2?w.__staleWhileFetching:w.__returned=w}let i=this.#M(_);if(!v&&!i)return B&&(B.fetch="hit"),this.#y(_),V&&this.#u(_),B&&this.#D(B,_),w;let c=this.#d(X,_,A,G),Q2=c.__staleWhileFetching!==void 0&&q;return B&&(B.fetch=i?"stale":"refresh",Q2&&i&&(B.returnedStale=!0)),Q2?c.__staleWhileFetching:c.__returned=c}}async forceFetch(X,Z={}){let q=await this.fetch(X,Z);if(q===void 0)throw Error("fetch() returned undefined");return q}memo(X,Z={}){let q=this.#C;if(!q)throw Error("no memoMethod provided to constructor");let{context:V,forceRefresh:$,...J}=Z,K=this.get(X,J);if(!$&&K!==void 0)return K;let Y=q(X,K,{options:J,context:V});return this.set(X,Y,J),Y}get(X,Z={}){let{allowStale:q=this.allowStale,updateAgeOnGet:V=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,status:J}=Z,K=this.#z.get(X);if(K!==void 0){let Y=this.#q[K],H=this.#H(Y);return J&&this.#D(J,K),this.#M(K)?(J&&(J.get="stale"),H?(J&&q&&Y.__staleWhileFetching!==void 0&&(J.returnedStale=!0),q?Y.__staleWhileFetching:void 0):($||this.#F(X,"expire"),J&&q&&(J.returnedStale=!0),q?Y:void 0)):(J&&(J.get="hit"),H?Y.__staleWhileFetching:(this.#y(K),V&&this.#u(K),Y))}else J&&(J.get="miss")}#c(X,Z){this.#_[Z]=X,this.#U[X]=Z}#y(X){X!==this.#G&&(X===this.#w?this.#w=this.#U[X]:this.#c(this.#_[X],this.#U[X]),this.#c(this.#G,X),this.#G=X)}delete(X){return this.#F(X,"delete")}#F(X,Z){let q=!1;if(this.#K!==0){let V=this.#z.get(X);if(V!==void 0)if(this.#v?.[V]&&(clearTimeout(this.#v?.[V]),this.#v[V]=void 0),q=!0,this.#K===1)this.#n(Z);else{this.#b(V);let $=this.#q[V];if(this.#H($)?$.__abortController.abort(Error("deleted")):(this.#L||this.#X)&&(this.#L&&this.#$?.($,X,Z),this.#X&&this.#k?.push([$,X,Z])),this.#z.delete(X),this.#Y[V]=void 0,this.#q[V]=void 0,V===this.#G)this.#G=this.#_[V];else if(V===this.#w)this.#w=this.#U[V];else{let J=this.#_[V];this.#U[J]=this.#U[V];let K=this.#U[V];this.#_[K]=this.#_[V]}this.#K--,this.#R.push(V)}}if(this.#X&&this.#k?.length){let V=this.#k,$;for(;$=V?.shift();)this.#J?.(...$)}return q}clear(){return this.#n("delete")}#n(X){for(let Z of this.#m({allowStale:!0})){let q=this.#q[Z];if(this.#H(q))q.__abortController.abort(Error("deleted"));else{let V=this.#Y[Z];this.#L&&this.#$?.(q,V,X),this.#X&&this.#k?.push([q,V,X])}}if(this.#z.clear(),this.#q.fill(void 0),this.#Y.fill(void 0),this.#B&&this.#x){this.#B.fill(0),this.#x.fill(0);for(let Z of this.#v??[])Z!==void 0&&clearTimeout(Z);this.#v?.fill(void 0)}if(this.#I&&this.#I.fill(0),this.#w=0,this.#G=0,this.#R.length=0,this.#j=0,this.#K=0,this.#X&&this.#k){let Z=this.#k,q;for(;q=Z?.shift();)this.#J?.(...q)}}};import{posix as J6,win32 as k5}from"node:path";import{fileURLToPath as K6}from"node:url";import{lstatSync as Y6,readdir as H6,readdirSync as W6,readlinkSync as z6,realpathSync as j6}from"fs";import*as U6 from"node:fs";import{lstat as k6,readdir as B6,readlink as C6,realpath as v6}from"node:fs/promises";import{EventEmitter as z5}from"node:events";import Q1 from"node:stream";import{StringDecoder as sQ}from"node:string_decoder";var s5=typeof process==="object"&&process?process:{stdout:null,stderr:null},rQ=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof e||Q instanceof Q1||eQ(Q)||tQ(Q)),eQ=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof z5&&typeof Q.pipe==="function"&&Q.pipe!==Q1.Writable.prototype.pipe,tQ=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof z5&&typeof Q.write==="function"&&typeof Q.end==="function",l=Symbol("EOF"),n=Symbol("maybeEmitEnd"),p=Symbol("emittedEnd"),N2=Symbol("emittingEnd"),k2=Symbol("emittedError"),D2=Symbol("closed"),r5=Symbol("read"),S2=Symbol("flush"),e5=Symbol("flushChunk"),f=Symbol("encoding"),V2=Symbol("decoder"),M=Symbol("flowing"),B2=Symbol("paused"),$2=Symbol("resume"),I=Symbol("buffer"),T=Symbol("pipes"),x=Symbol("bufferLength"),J5=Symbol("bufferPush"),P2=Symbol("bufferShift"),R=Symbol("objectMode"),L=Symbol("destroyed"),K5=Symbol("error"),Y5=Symbol("emitData"),t5=Symbol("emitEnd"),H5=Symbol("emitEnd2"),h=Symbol("async"),W5=Symbol("abort"),y2=Symbol("aborted"),C2=Symbol("signal"),r=Symbol("dataListeners"),N=Symbol("discarded"),v2=(Q)=>Promise.resolve().then(Q),Q6=(Q)=>Q(),X6=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",Z6=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,q6=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class j5{src;dest;opts;ondrain;constructor(Q,X,Z){this.src=Q,this.dest=X,this.opts=Z,this.ondrain=()=>Q[$2](),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 X1 extends j5{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,Z){super(Q,X,Z);this.proxyErrors=(q)=>this.dest.emit("error",q),Q.on("error",this.proxyErrors)}}var V6=(Q)=>!!Q.objectMode,$6=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class e extends z5{[M]=!1;[B2]=!1;[T]=[];[I]=[];[R];[f];[h];[V2];[l]=!1;[p]=!1;[N2]=!1;[D2]=!1;[k2]=null;[x]=0;[L]=!1;[C2];[y2]=!1;[r]=0;[N]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(V6(X))this[R]=!0,this[f]=null;else if($6(X))this[f]=X.encoding,this[R]=!1;else this[R]=!1,this[f]=null;if(this[h]=!!X.async,this[V2]=this[f]?new sQ(this[f]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[I]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[T]});let{signal:Z}=X;if(Z)if(this[C2]=Z,Z.aborted)this[W5]();else Z.addEventListener("abort",()=>this[W5]())}get bufferLength(){return this[x]}get encoding(){return this[f]}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[R]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[h]}set["async"](Q){this[h]=this[h]||!!Q}[W5](){this[y2]=!0,this.emit("abort",this[C2]?.reason),this.destroy(this[C2]?.reason)}get aborted(){return this[y2]}set aborted(Q){}write(Q,X,Z){if(this[y2])return!1;if(this[l])throw Error("write after end");if(this[L])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")Z=X,X="utf8";if(!X)X="utf8";let q=this[h]?v2:Q6;if(!this[R]&&!Buffer.isBuffer(Q)){if(q6(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(Z6(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[R]){if(this[M]&&this[x]!==0)this[S2](!0);if(this[M])this.emit("data",Q);else this[J5](Q);if(this[x]!==0)this.emit("readable");if(Z)q(Z);return this[M]}if(!Q.length){if(this[x]!==0)this.emit("readable");if(Z)q(Z);return this[M]}if(typeof Q==="string"&&!(X===this[f]&&!this[V2]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[f])Q=this[V2].write(Q);if(this[M]&&this[x]!==0)this[S2](!0);if(this[M])this.emit("data",Q);else this[J5](Q);if(this[x]!==0)this.emit("readable");if(Z)q(Z);return this[M]}read(Q){if(this[L])return null;if(this[N]=!1,this[x]===0||Q===0||Q&&Q>this[x])return this[n](),null;if(this[R])Q=null;if(this[I].length>1&&!this[R])this[I]=[this[f]?this[I].join(""):Buffer.concat(this[I],this[x])];let X=this[r5](Q||null,this[I][0]);return this[n](),X}[r5](Q,X){if(this[R])this[P2]();else{let Z=X;if(Q===Z.length||Q===null)this[P2]();else if(typeof Z==="string")this[I][0]=Z.slice(Q),X=Z.slice(0,Q),this[x]-=Q;else this[I][0]=Z.subarray(Q),X=Z.subarray(0,Q),this[x]-=Q}if(this.emit("data",X),!this[I].length&&!this[l])this.emit("drain");return X}end(Q,X,Z){if(typeof Q==="function")Z=Q,Q=void 0;if(typeof X==="function")Z=X,X="utf8";if(Q!==void 0)this.write(Q,X);if(Z)this.once("end",Z);if(this[l]=!0,this.writable=!1,this[M]||!this[B2])this[n]();return this}[$2](){if(this[L])return;if(!this[r]&&!this[T].length)this[N]=!0;if(this[B2]=!1,this[M]=!0,this.emit("resume"),this[I].length)this[S2]();else if(this[l])this[n]();else this.emit("drain")}resume(){return this[$2]()}pause(){this[M]=!1,this[B2]=!0,this[N]=!1}get destroyed(){return this[L]}get flowing(){return this[M]}get paused(){return this[B2]}[J5](Q){if(this[R])this[x]+=1;else this[x]+=Q.length;this[I].push(Q)}[P2](){if(this[R])this[x]-=1;else this[x]-=this[I][0].length;return this[I].shift()}[S2](Q=!1){do;while(this[e5](this[P2]())&&this[I].length);if(!Q&&!this[I].length&&!this[l])this.emit("drain")}[e5](Q){return this.emit("data",Q),this[M]}pipe(Q,X){if(this[L])return Q;this[N]=!1;let Z=this[p];if(X=X||{},Q===s5.stdout||Q===s5.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,Z){if(X.end)Q.end()}else if(this[T].push(!X.proxyErrors?new j5(this,Q,X):new X1(this,Q,X)),this[h])v2(()=>this[$2]());else this[$2]();return Q}unpipe(Q){let X=this[T].find((Z)=>Z.dest===Q);if(X){if(this[T].length===1){if(this[M]&&this[r]===0)this[M]=!1;this[T]=[]}else this[T].splice(this[T].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let Z=super.on(Q,X);if(Q==="data"){if(this[N]=!1,this[r]++,!this[T].length&&!this[M])this[$2]()}else if(Q==="readable"&&this[x]!==0)super.emit("readable");else if(X6(Q)&&this[p])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[k2]){let q=X;if(this[h])v2(()=>q.call(this,this[k2]));else q.call(this,this[k2])}return Z}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let Z=super.off(Q,X);if(Q==="data"){if(this[r]=this.listeners("data").length,this[r]===0&&!this[N]&&!this[T].length)this[M]=!1}return Z}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[r]=0,!this[N]&&!this[T].length)this[M]=!1}return X}get emittedEnd(){return this[p]}[n](){if(!this[N2]&&!this[p]&&!this[L]&&this[I].length===0&&this[l]){if(this[N2]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[D2])this.emit("close");this[N2]=!1}}emit(Q,...X){let Z=X[0];if(Q!=="error"&&Q!=="close"&&Q!==L&&this[L])return!1;else if(Q==="data")return!this[R]&&!Z?!1:this[h]?(v2(()=>this[Y5](Z)),!0):this[Y5](Z);else if(Q==="end")return this[t5]();else if(Q==="close"){if(this[D2]=!0,!this[p]&&!this[L])return!1;let V=super.emit("close");return this.removeAllListeners("close"),V}else if(Q==="error"){this[k2]=Z,super.emit(K5,Z);let V=!this[C2]||this.listeners("error").length?super.emit("error",Z):!1;return this[n](),V}else if(Q==="resume"){let V=super.emit("resume");return this[n](),V}else if(Q==="finish"||Q==="prefinish"){let V=super.emit(Q);return this.removeAllListeners(Q),V}let q=super.emit(Q,...X);return this[n](),q}[Y5](Q){for(let Z of this[T])if(Z.dest.write(Q)===!1)this.pause();let X=this[N]?!1:super.emit("data",Q);return this[n](),X}[t5](){if(this[p])return!1;return this[p]=!0,this.readable=!1,this[h]?(v2(()=>this[H5]()),!0):this[H5]()}[H5](){if(this[V2]){let X=this[V2].end();if(X){for(let Z of this[T])Z.dest.write(X);if(!this[N])super.emit("data",X)}}for(let X of this[T])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[R])Q.dataLength=0;let X=this.promise();return this.on("data",(Z)=>{if(Q.push(Z),!this[R])Q.dataLength+=Z.length}),await X,Q}async concat(){if(this[R])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[f]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(L,()=>X(Error("stream destroyed"))),this.on("error",(Z)=>X(Z)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[N]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let q=this.read();if(q!==null)return Promise.resolve({done:!1,value:q});if(this[l])return X();let V,$,J=(z)=>{this.off("data",K),this.off("end",Y),this.off(L,H),X(),$(z)},K=(z)=>{this.off("error",J),this.off("end",Y),this.off(L,H),this.pause(),V({value:z,done:!!this[l]})},Y=()=>{this.off("error",J),this.off("data",K),this.off(L,H),X(),V({done:!0,value:void 0})},H=()=>J(Error("stream destroyed"));return new Promise((z,W)=>{$=W,V=z,this.once(L,H),this.once("error",J),this.once("end",Y),this.once("data",K)})},throw:X,return:X,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[N]=!1;let Q=!1,X=()=>{return this.pause(),this.off(K5,X),this.off(L,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},Z=()=>{if(Q)return X();let q=this.read();return q===null?X():{done:!1,value:q}};return this.once("end",X),this.once(K5,X),this.once(L,X),{next:Z,throw:X,return:X,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(Q){if(this[L]){if(Q)this.emit("error",Q);else this.emit(L);return this}this[L]=!0,this[N]=!0,this[I].length=0,this[x]=0;let X=this;if(typeof X.close==="function"&&!this[D2])X.close();if(Q)this.emit("error",Q);else this.emit(L);return this}static get isStream(){return rQ}}var G6=j6.native,A2={lstatSync:Y6,readdir:H6,readdirSync:W6,readlinkSync:z6,realpathSync:G6,promises:{lstat:k6,readdir:B6,readlink:C6,realpath:v6}},J1=(Q)=>!Q||Q===A2||Q===U6?A2:{...A2,...Q,promises:{...A2.promises,...Q.promises||{}}},K1=/^\\\\\?\\([a-z]:)\\?$/i,w6=(Q)=>Q.replace(/\//g,"\\").replace(K1,"$1\\"),A6=/[\\\/]/,y=0,Y1=1,H1=2,g=4,W1=6,z1=8,t=10,j1=12,P=15,w2=~P,U5=16,Z1=32,_2=64,E=128,b2=256,E2=512,q1=_2|E|E2,_6=1023,G5=(Q)=>Q.isFile()?z1:Q.isDirectory()?g:Q.isSymbolicLink()?t:Q.isCharacterDevice()?H1:Q.isBlockDevice()?W1:Q.isSocket()?j1:Q.isFIFO()?Y1:y,V1=new G2({max:4096}),L2=(Q)=>{let X=V1.get(Q);if(X)return X;let Z=Q.normalize("NFKD");return V1.set(Q,Z),Z},$1=new G2({max:4096}),f2=(Q)=>{let X=$1.get(Q);if(X)return X;let Z=L2(Q.toLowerCase());return $1.set(Q,Z),Z};class B5 extends G2{constructor(){super({max:256})}}class U1 extends G2{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var G1=Symbol("PathScurry setAsCwd");class m{name;root;roots;parent;nocase;isCWD=!1;#Q;#Z;get dev(){return this.#Z}#$;get mode(){return this.#$}#V;get nlink(){return this.#V}#J;get uid(){return this.#J}#A;get gid(){return this.#A}#C;get rdev(){return this.#C}#W;get blksize(){return this.#W}#K;get ino(){return this.#K}#j;get size(){return this.#j}#z;get blocks(){return this.#z}#Y;get atimeMs(){return this.#Y}#q;get mtimeMs(){return this.#q}#U;get ctimeMs(){return this.#U}#_;get birthtimeMs(){return this.#_}#w;get atime(){return this.#w}#G;get mtime(){return this.#G}#R;get ctime(){return this.#R}#k;get birthtime(){return this.#k}#I;#x;#B;#v;#L;#O;#X;#S;#N;#u;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=y,Z,q,V,$,J){if(this.name=Q,this.#I=V?f2(Q):L2(Q),this.#X=X&_6,this.nocase=V,this.roots=q,this.root=Z||this,this.#S=$,this.#B=J.fullpath,this.#L=J.relative,this.#O=J.relativePosix,this.parent=J.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=J1(J.fs)}depth(){if(this.#x!==void 0)return this.#x;if(!this.parent)return this.#x=0;return this.#x=this.parent.depth()+1}childrenCache(){return this.#S}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),q=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#D(q):this.#D(q)}#D(Q){let X=this;for(let Z of Q)X=X.child(Z);return X}children(){let Q=this.#S.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#S.set(this,X),this.#X&=~U5,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let Z=this.children(),q=this.nocase?f2(Q):L2(Q);for(let K of Z)if(K.#I===q)return K;let V=this.parent?this.sep:"",$=this.#B?this.#B+V+Q:void 0,J=this.newChild(Q,y,{...X,parent:this,fullpath:$});if(!this.canReaddir())J.#X|=E;return Z.push(J),J}relative(){if(this.isCWD)return"";if(this.#L!==void 0)return this.#L;let Q=this.name,X=this.parent;if(!X)return this.#L=this.name;let Z=X.relative();return Z+(!Z||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let Q=this.name,X=this.parent;if(!X)return this.#O=this.fullpathPosix();let Z=X.relativePosix();return Z+(!Z||!X.parent?"":"/")+Q}fullpath(){if(this.#B!==void 0)return this.#B;let Q=this.name,X=this.parent;if(!X)return this.#B=this.name;let q=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#B=q}fullpathPosix(){if(this.#v!==void 0)return this.#v;if(this.sep==="/")return this.#v=this.fullpath();if(!this.parent){let q=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(q))return this.#v=`//?/${q}`;else return this.#v=q}let Q=this.parent,X=Q.fullpathPosix(),Z=X+(!X||!Q.parent?"":"/")+this.name;return this.#v=Z}isUnknown(){return(this.#X&P)===y}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.#X&P)===z1}isDirectory(){return(this.#X&P)===g}isCharacterDevice(){return(this.#X&P)===H1}isBlockDevice(){return(this.#X&P)===W1}isFIFO(){return(this.#X&P)===Y1}isSocket(){return(this.#X&P)===j1}isSymbolicLink(){return(this.#X&t)===t}lstatCached(){return this.#X&Z1?this:void 0}readlinkCached(){return this.#N}realpathCached(){return this.#u}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.#X&P;return!(Q!==y&&Q!==t||this.#X&b2||this.#X&E)}calledReaddir(){return!!(this.#X&U5)}isENOENT(){return!!(this.#X&E)}isNamed(Q){return!this.nocase?this.#I===L2(Q):this.#I===f2(Q)}async readlink(){let Q=this.#N;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),Z=(await this.parent.realpath())?.resolve(X);if(Z)return this.#N=Z}catch(X){this.#m(X.code);return}}readlinkSync(){let Q=this.#N;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),Z=this.parent.realpathSync()?.resolve(X);if(Z)return this.#N=Z}catch(X){this.#m(X.code);return}}#f(Q){this.#X|=U5;for(let X=Q.provisional;X<Q.length;X++){let Z=Q[X];if(Z)Z.#M()}}#M(){if(this.#X&E)return;this.#X=(this.#X|E)&w2,this.#l()}#l(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#M()}#b(){this.#X|=E2,this.#P()}#P(){if(this.#X&_2)return;let Q=this.#X;if((Q&P)===g)Q&=w2;this.#X=Q|_2,this.#l()}#E(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#P();else if(Q==="ENOENT")this.#M();else this.children().provisional=0}#T(Q=""){if(Q==="ENOTDIR")this.parent.#P();else if(Q==="ENOENT")this.#M()}#m(Q=""){let X=this.#X;if(X|=b2,Q==="ENOENT")X|=E;if(Q==="EINVAL"||Q==="UNKNOWN")X&=w2;if(this.#X=X,Q==="ENOTDIR"&&this.parent)this.parent.#P()}#h(Q,X){return this.#d(Q,X)||this.#g(Q,X)}#g(Q,X){let Z=G5(Q),q=this.newChild(Q.name,Z,{parent:this}),V=q.#X&P;if(V!==g&&V!==t&&V!==y)q.#X|=_2;return X.unshift(q),X.provisional++,q}#d(Q,X){for(let Z=X.provisional;Z<X.length;Z++){let q=X[Z];if((this.nocase?f2(Q.name):L2(Q.name))!==q.#I)continue;return this.#H(Q,q,Z,X)}}#H(Q,X,Z,q){let V=X.name;if(X.#X=X.#X&w2|G5(Q),V!==Q.name)X.name=Q.name;if(Z!==q.provisional){if(Z===q.length-1)q.pop();else q.splice(Z,1);q.unshift(X)}return q.provisional++,X}async lstat(){if((this.#X&E)===0)try{return this.#c(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#T(Q.code)}}lstatSync(){if((this.#X&E)===0)try{return this.#c(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#T(Q.code)}}#c(Q){let{atime:X,atimeMs:Z,birthtime:q,birthtimeMs:V,blksize:$,blocks:J,ctime:K,ctimeMs:Y,dev:H,gid:z,ino:W,mode:j,mtime:U,mtimeMs:k,nlink:G,rdev:v,size:B,uid:C}=Q;this.#w=X,this.#Y=Z,this.#k=q,this.#_=V,this.#W=$,this.#z=J,this.#R=K,this.#U=Y,this.#Z=H,this.#A=z,this.#K=W,this.#$=j,this.#G=U,this.#q=k,this.#V=G,this.#C=v,this.#j=B,this.#J=C;let A=G5(Q);if(this.#X=this.#X&w2|A|Z1,A!==y&&A!==g&&A!==t)this.#X|=_2}#y=[];#F=!1;#n(Q){this.#F=!1;let X=this.#y.slice();this.#y.length=0,X.forEach((Z)=>Z(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let Z=this.children();if(this.calledReaddir()){let V=Z.slice(0,Z.provisional);if(X)Q(null,V);else queueMicrotask(()=>Q(null,V));return}if(this.#y.push(Q),this.#F)return;this.#F=!0;let q=this.fullpath();this.#Q.readdir(q,{withFileTypes:!0},(V,$)=>{if(V)this.#E(V.code),Z.provisional=0;else{for(let J of $)this.#h(J,Z);this.#f(Z)}this.#n(Z.slice(0,Z.provisional));return})}#i;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#i)await this.#i;else{let Z=()=>{};this.#i=new Promise((q)=>Z=q);try{for(let q of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#h(q,Q);this.#f(Q)}catch(q){this.#E(q.code),Q.provisional=0}this.#i=void 0,Z()}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 X=this.fullpath();try{for(let Z of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#h(Z,Q);this.#f(Q)}catch(Z){this.#E(Z.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#X&q1)return!1;let Q=P&this.#X;if(!(Q===y||Q===g||Q===t))return!1;return!0}shouldWalk(Q,X){return(this.#X&g)===g&&!(this.#X&q1)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#u)return this.#u;if((E2|b2|E)&this.#X)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#u=this.resolve(Q)}catch(Q){this.#b()}}realpathSync(){if(this.#u)return this.#u;if((E2|b2|E)&this.#X)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#u=this.resolve(Q)}catch(Q){this.#b()}}[G1](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),Z=[],q=this;while(q&&q.parent)X.add(q),q.#L=Z.join(this.sep),q.#O=Z.join("/"),q=q.parent,Z.push("..");q=Q;while(q&&q.parent&&!X.has(q))q.#L=void 0,q.#O=void 0,q=q.parent}}class h2 extends m{sep="\\";splitSep=A6;constructor(Q,X=y,Z,q,V,$,J){super(Q,X,Z,q,V,$,J)}newChild(Q,X=y,Z={}){return new h2(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}getRootString(Q){return k5.parse(Q).root}getRoot(Q){if(Q=w6(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,Z]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=Z;return this.roots[Q]=new M2(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(K1,"$1\\"),Q===X}}class g2 extends m{splitSep="/";sep="/";constructor(Q,X=y,Z,q,V,$,J){super(Q,X,Z,q,V,$,J)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=y,Z={}){return new g2(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}}class C5{root;rootPath;roots;cwd;#Q;#Z;#$;nocase;#V;constructor(Q=process.cwd(),X,Z,{nocase:q,childrenCacheSize:V=16384,fs:$=A2}={}){if(this.#V=J1($),Q instanceof URL||Q.startsWith("file://"))Q=K6(Q);let J=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(J),this.#Q=new B5,this.#Z=new B5,this.#$=new U1(V);let K=J.substring(this.rootPath.length).split(Z);if(K.length===1&&!K[0])K.pop();if(q===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=q,this.root=this.newRoot(this.#V),this.roots[this.rootPath]=this.root;let Y=this.root,H=K.length-1,z=X.sep,W=this.rootPath,j=!1;for(let U of K){let k=H--;Y=Y.child(U,{relative:Array(k).fill("..").join(z),relativePosix:Array(k).fill("..").join("/"),fullpath:W+=(j?"":z)+U}),j=!0}this.cwd=Y}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#$}resolve(...Q){let X="";for(let V=Q.length-1;V>=0;V--){let $=Q[V];if(!$||$===".")continue;if(X=X?`${$}/${X}`:$,this.isAbsolute($))break}let Z=this.#Q.get(X);if(Z!==void 0)return Z;let q=this.cwd.resolve(X).fullpath();return this.#Q.set(X,q),q}resolvePosix(...Q){let X="";for(let V=Q.length-1;V>=0;V--){let $=Q[V];if(!$||$===".")continue;if(X=X?`${$}/${X}`:$,this.isAbsolute($))break}let Z=this.#Z.get(X);if(Z!==void 0)return Z;let q=this.cwd.resolve(X).fullpathPosix();return this.#Z.set(X,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,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z}=X;if(!Q.canReaddir())return[];else{let q=await Q.readdir();return Z?q:q.map((V)=>V.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0}=X;if(!Q.canReaddir())return[];else if(Z)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:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.readlink();return X?Z:Z?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q.withFileTypes,Q=this.cwd;let Z=Q.readlinkSync();return X?Z:Z?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.realpath();return X?Z:Z?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q.withFileTypes,Q=this.cwd;let Z=Q.realpathSync();return X?Z:Z?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X,J=[];if(!V||V(Q))J.push(Z?Q:Q.fullpath());let K=new Set,Y=(z,W)=>{K.add(z),z.readdirCB((j,U)=>{if(j)return W(j);let k=U.length;if(!k)return W();let G=()=>{if(--k===0)W()};for(let v of U){if(!V||V(v))J.push(Z?v:v.fullpath());if(q&&v.isSymbolicLink())v.realpath().then((B)=>B?.isUnknown()?B.lstat():B).then((B)=>B?.shouldWalk(K,$)?Y(B,G):G());else if(v.shouldWalk(K,$))Y(v,G);else G()}},!0)},H=Q;return new Promise((z,W)=>{Y(H,(j)=>{if(j)return W(j);z(J)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X,J=[];if(!V||V(Q))J.push(Z?Q:Q.fullpath());let K=new Set([Q]);for(let Y of K){let H=Y.readdirSync();for(let z of H){if(!V||V(z))J.push(Z?z:z.fullpath());let W=z;if(z.isSymbolicLink()){if(!(q&&(W=z.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(K,$))K.add(W)}}return J}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X;if(!V||V(Q))yield Z?Q:Q.fullpath();let J=new Set([Q]);for(let K of J){let Y=K.readdirSync();for(let H of Y){if(!V||V(H))yield Z?H:H.fullpath();let z=H;if(H.isSymbolicLink()){if(!(q&&(z=H.realpathSync())))continue;if(z.isUnknown())z.lstatSync()}if(z.shouldWalk(J,$))J.add(z)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X,J=new e({objectMode:!0});if(!V||V(Q))J.write(Z?Q:Q.fullpath());let K=new Set,Y=[Q],H=0,z=()=>{let W=!1;while(!W){let j=Y.shift();if(!j){if(H===0)J.end();return}H++,K.add(j);let U=(G,v,B=!1)=>{if(G)return J.emit("error",G);if(q&&!B){let C=[];for(let A of v)if(A.isSymbolicLink())C.push(A.realpath().then((_)=>_?.isUnknown()?_.lstat():_));if(C.length){Promise.all(C).then(()=>U(null,v,!0));return}}for(let C of v)if(C&&(!V||V(C))){if(!J.write(Z?C:C.fullpath()))W=!0}H--;for(let C of v){let A=C.realpathCached()||C;if(A.shouldWalk(K,$))Y.push(A)}if(W&&!J.flowing)J.once("drain",z);else if(!k)z()},k=!0;j.readdirCB(U,!0),k=!1}};return z(),J}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X,J=new e({objectMode:!0}),K=new Set;if(!V||V(Q))J.write(Z?Q:Q.fullpath());let Y=[Q],H=0,z=()=>{let W=!1;while(!W){let j=Y.shift();if(!j){if(H===0)J.end();return}H++,K.add(j);let U=j.readdirSync();for(let k of U)if(!V||V(k)){if(!J.write(Z?k:k.fullpath()))W=!0}H--;for(let k of U){let G=k;if(k.isSymbolicLink()){if(!(q&&(G=k.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(K,$))Y.push(G)}}if(W&&!J.flowing)J.once("drain",z)};return z(),J}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[G1](X)}}class M2 extends C5{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,k5,"\\",{...X,nocase:Z});this.nocase=Z;for(let q=this.cwd;q;q=q.parent)q.nocase=this.nocase}parseRootPath(Q){return k5.parse(Q).root.toUpperCase()}newRoot(Q){return new h2(this.rootPath,g,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class I2 extends C5{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:Z=!1}=X;super(Q,J6,"/",{...X,nocase:Z});this.nocase=Z}parseRootPath(Q){return"/"}newRoot(Q){return new g2(this.rootPath,g,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class d2 extends I2{constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,{...X,nocase:Z})}}var X7=process.platform==="win32"?h2:g2,k1=process.platform==="win32"?M2:process.platform==="darwin"?d2:I2;var L6=(Q)=>Q.length>=1,M6=(Q)=>Q.length>=1;class J2{#Q;#Z;#$;length;#V;#J;#A;#C;#W;#K;#j=!0;constructor(Q,X,Z,q){if(!L6(Q))throw TypeError("empty pattern list");if(!M6(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,Z<0||Z>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#Z=X,this.#$=Z,this.#V=q,this.#$===0){if(this.isUNC()){let[V,$,J,K,...Y]=this.#Q,[H,z,W,j,...U]=this.#Z;if(Y[0]==="")Y.shift(),U.shift();let k=[V,$,J,K,""].join("/"),G=[H,z,W,j,""].join("/");this.#Q=[k,...Y],this.#Z=[G,...U],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[V,...$]=this.#Q,[J,...K]=this.#Z;if($[0]==="")$.shift(),K.shift();let Y=V+"/",H=J+"/";this.#Q=[Y,...$],this.#Z=[H,...K],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#$]}isString(){return typeof this.#Q[this.#$]==="string"}isGlobstar(){return this.#Q[this.#$]===u}isRegExp(){return this.#Q[this.#$]instanceof RegExp}globString(){return this.#A=this.#A||(this.#$===0?this.isAbsolute()?this.#Z[0]+this.#Z.slice(1).join("/"):this.#Z.join("/"):this.#Z.slice(this.#$).join("/"))}hasMore(){return this.length>this.#$+1}rest(){if(this.#J!==void 0)return this.#J;if(!this.hasMore())return this.#J=null;return this.#J=new J2(this.#Q,this.#Z,this.#$+1,this.#V),this.#J.#K=this.#K,this.#J.#W=this.#W,this.#J.#C=this.#C,this.#J}isUNC(){let Q=this.#Q;return this.#W!==void 0?this.#W:this.#W=this.#V==="win32"&&this.#$===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#C!==void 0?this.#C:this.#C=this.#V==="win32"&&this.#$===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#K!==void 0?this.#K:this.#K=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#$===0?Q:""}checkFollowGlobstar(){return!(this.#$===0||!this.isGlobstar()||!this.#j)}markFollowGlobstar(){if(this.#$===0||!this.isGlobstar()||!this.#j)return!1;return this.#j=!1,!0}}var I6=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class x2{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:Z,noext:q,noglobstar:V,platform:$=I6}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=$,this.mmopts={dot:!0,nobrace:X,nocase:Z,noext:q,noglobstar:V,optimizationLevel:2,platform:$,nocomment:!0,nonegate:!0};for(let J of Q)this.add(J)}add(Q){let X=new S(Q,this.mmopts);for(let Z=0;Z<X.set.length;Z++){let q=X.set[Z],V=X.globParts[Z];if(!q||!V)throw Error("invalid pattern object");while(q[0]==="."&&V[0]===".")q.shift(),V.shift();let $=new J2(q,V,0,this.platform),J=new S($.globString(),this.mmopts),K=V[V.length-1]==="**",Y=$.isAbsolute();if(Y)this.absolute.push(J);else this.relative.push(J);if(K)if(Y)this.absoluteChildren.push(J);else this.relativeChildren.push(J)}}ignored(Q){let X=Q.fullpath(),Z=`${X}/`,q=Q.relative()||".",V=`${q}/`;for(let $ of this.relative)if($.match(q)||$.match(V))return!0;for(let $ of this.absolute)if($.match(X)||$.match(Z))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",Z=(Q.relative()||".")+"/";for(let q of this.relativeChildren)if(q.match(Z))return!0;for(let q of this.absoluteChildren)if(q.match(X))return!0;return!1}}class v5{store;constructor(Q=new Map){this.store=Q}copy(){return new v5(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let Z=Q.fullpath(),q=this.store.get(Z);if(q)q.add(X.globString());else this.store.set(Z,new Set([X.globString()]))}}class B1{store=new Map;add(Q,X,Z){let q=(X?2:0)|(Z?1:0),V=this.store.get(Q);this.store.set(Q,V===void 0?q:q&V)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class C1{store=new Map;add(Q,X){if(!Q.canReaddir())return;let Z=this.store.get(Q);if(Z){if(!Z.find((q)=>q.globString()===X.globString()))Z.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class O2{hasWalkedCache;matches=new B1;subwalks=new C1;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new v5}processPatterns(Q,X){this.patterns=X;let Z=X.map((q)=>[Q,q]);for(let[q,V]of Z){this.hasWalkedCache.storeWalked(q,V);let $=V.root(),J=V.isAbsolute()&&this.opts.absolute!==!1;if($){q=q.resolve($==="/"&&this.opts.root!==void 0?this.opts.root:$);let z=V.rest();if(!z){this.matches.add(q,!0,!1);continue}else V=z}if(q.isENOENT())continue;let K,Y,H=!1;while(typeof(K=V.pattern())==="string"&&(Y=V.rest()))q=q.resolve(K),V=Y,H=!0;if(K=V.pattern(),Y=V.rest(),H){if(this.hasWalkedCache.hasWalked(q,V))continue;this.hasWalkedCache.storeWalked(q,V)}if(typeof K==="string"){let z=K===".."||K===""||K===".";this.matches.add(q.resolve(K),J,z);continue}else if(K===u){if(!q.isSymbolicLink()||this.follow||V.checkFollowGlobstar())this.subwalks.add(q,V);let z=Y?.pattern(),W=Y?.rest();if(!Y||(z===""||z===".")&&!W)this.matches.add(q,J,z===""||z===".");else if(z===".."){let j=q.parent||q;if(!W)this.matches.add(j,J,!0);else if(!this.hasWalkedCache.hasWalked(j,W))this.subwalks.add(j,W)}}else if(K instanceof RegExp)this.subwalks.add(q,V)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new O2(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let Z=this.subwalks.get(Q),q=this.child();for(let V of X)for(let $ of Z){let J=$.isAbsolute(),K=$.pattern(),Y=$.rest();if(K===u)q.testGlobstar(V,$,Y,J);else if(K instanceof RegExp)q.testRegExp(V,K,Y,J);else q.testString(V,K,Y,J)}return q}testGlobstar(Q,X,Z,q){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,q,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if(Z&&X.checkFollowGlobstar())this.subwalks.add(Q,Z);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if(Z){let V=Z.pattern();if(typeof V==="string"&&V!==".."&&V!==""&&V!==".")this.testString(Q,V,Z.rest(),q);else if(V===".."){let $=Q.parent||Q;this.subwalks.add($,Z)}else if(V instanceof RegExp)this.testRegExp(Q,V,Z.rest(),q)}}testRegExp(Q,X,Z,q){if(!X.test(Q.name))return;if(!Z)this.matches.add(Q,q,!1);else this.subwalks.add(Q,Z)}testString(Q,X,Z,q){if(!Q.isNamed(X))return;if(!Z)this.matches.add(Q,q,!1);else this.subwalks.add(Q,Z)}}var x6=(Q,X)=>typeof Q==="string"?new x2([Q],X):Array.isArray(Q)?new x2(Q,X):Q;class w5{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#Z;#$;signal;maxDepth;includeChildMatches;constructor(Q,X,Z){if(this.patterns=Q,this.path=X,this.opts=Z,this.#$=!Z.posix&&Z.platform==="win32"?"\\":"/",this.includeChildMatches=Z.includeChildMatches!==!1,Z.ignore||!this.includeChildMatches){if(this.#Z=x6(Z.ignore??[],Z),!this.includeChildMatches&&typeof this.#Z.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Z.maxDepth||1/0,Z.signal)this.signal=Z.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#V(Q){return this.seen.has(Q)||!!this.#Z?.ignored?.(Q)}#J(Q){return!!this.#Z?.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,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||await Q.realpath(),!Z)return;Q=Z}let V=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&V?.isSymbolicLink()){let $=await V.realpath();if($&&($.isUnknown()||this.opts.stat))await $.lstat()}return this.matchCheckTest(V,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#V(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||Q.realpathSync(),!Z)return;Q=Z}let V=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&V?.isSymbolicLink()){let $=V.realpathSync();if($&&($?.isUnknown()||this.opts.stat))$.lstatSync()}return this.matchCheckTest(V,X)}matchFinish(Q,X){if(this.#V(Q))return;if(!this.includeChildMatches&&this.#Z?.add){let V=`${Q.relativePosix()}/**`;this.#Z.add(V)}let Z=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let q=this.opts.mark&&Q.isDirectory()?this.#$:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if(Z){let V=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit(V+q)}else{let V=this.opts.posix?Q.relativePosix():Q.relative(),$=this.opts.dotRelative&&!V.startsWith(".."+this.#$)?"."+this.#$:"";this.matchEmit(!V?"."+q:$+V+q)}}async match(Q,X,Z){let q=await this.matchCheck(Q,Z);if(q)this.matchFinish(q,X)}matchSync(Q,X,Z){let q=this.matchCheckSync(Q,Z);if(q)this.matchFinish(q,X)}walkCB(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2(Q,X,new O2(this.opts),Z)}walkCB2(Q,X,Z,q){if(this.#J(Q))return q();if(this.signal?.aborted)q();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,Z,q));return}Z.processPatterns(Q,X);let V=1,$=()=>{if(--V===0)q()};for(let[J,K,Y]of Z.matches.entries()){if(this.#V(J))continue;V++,this.match(J,K,Y).then(()=>$())}for(let J of Z.subwalkTargets()){if(this.maxDepth!==1/0&&J.depth()>=this.maxDepth)continue;V++;let K=J.readdirCached();if(J.calledReaddir())this.walkCB3(J,K,Z,$);else J.readdirCB((Y,H)=>this.walkCB3(J,H,Z,$),!0)}$()}walkCB3(Q,X,Z,q){Z=Z.filterEntries(Q,X);let V=1,$=()=>{if(--V===0)q()};for(let[J,K,Y]of Z.matches.entries()){if(this.#V(J))continue;V++,this.match(J,K,Y).then(()=>$())}for(let[J,K]of Z.subwalks.entries())V++,this.walkCB2(J,K,Z.child(),$);$()}walkCBSync(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2Sync(Q,X,new O2(this.opts),Z)}walkCB2Sync(Q,X,Z,q){if(this.#J(Q))return q();if(this.signal?.aborted)q();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,Z,q));return}Z.processPatterns(Q,X);let V=1,$=()=>{if(--V===0)q()};for(let[J,K,Y]of Z.matches.entries()){if(this.#V(J))continue;this.matchSync(J,K,Y)}for(let J of Z.subwalkTargets()){if(this.maxDepth!==1/0&&J.depth()>=this.maxDepth)continue;V++;let K=J.readdirSync();this.walkCB3Sync(J,K,Z,$)}$()}walkCB3Sync(Q,X,Z,q){Z=Z.filterEntries(Q,X);let V=1,$=()=>{if(--V===0)q()};for(let[J,K,Y]of Z.matches.entries()){if(this.#V(J))continue;this.matchSync(J,K,Y)}for(let[J,K]of Z.subwalks.entries())V++,this.walkCB2Sync(J,K,Z.child(),$);$()}}class c2 extends w5{matches=new Set;constructor(Q,X,Z){super(Q,X,Z)}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,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(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 l2 extends w5{results;constructor(Q,X,Z){super(Q,X,Z);this.results=new e({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 u6=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class d{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,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=O6(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((K)=>K.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((K)=>K.includes("/")?K:`./**/${K}`)}if(this.pattern=Q,this.platform=X.platform||u6,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let K=X.platform==="win32"?M2:X.platform==="darwin"?d2:X.platform?I2:k1;this.scurry=new K(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let Z=this.platform==="darwin"||this.platform==="win32",q={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Z,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},V=this.pattern.map((K)=>new S(K,q)),[$,J]=V.reduce((K,Y)=>{return K[0].push(...Y.set),K[1].push(...Y.globParts),K},[[],[]]);this.patterns=$.map((K,Y)=>{let H=J[Y];if(!H)throw Error("invalid pattern object");return new J2(K,H,0,this.platform)})}async walk(){return[...await new c2(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 c2(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 l2(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 l2(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 A5=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let Z of Q)if(new S(Z,X).hasMagic())return!0;return!1};function i2(Q,X={}){return new d(Q,X).streamSync()}function w1(Q,X={}){return new d(Q,X).stream()}function A1(Q,X={}){return new d(Q,X).walkSync()}async function v1(Q,X={}){return new d(Q,X).walk()}function o2(Q,X={}){return new d(Q,X).iterateSync()}function _1(Q,X={}){return new d(Q,X).iterate()}var R6=i2,F6=Object.assign(w1,{sync:i2}),T6=o2,m6=Object.assign(_1,{sync:o2}),N6=Object.assign(A1,{stream:i2,iterate:o2}),n2=Object.assign(v1,{glob:v1,globSync:A1,sync:N6,globStream:w1,stream:F6,globStreamSync:i2,streamSync:R6,globIterate:_1,iterate:m6,globIterateSync:o2,iterateSync:T6,Glob:d,hasMagic:A5,escape:q2,unescape:b});n2.glob=n2;import{resolve as S6}from"path";var P6=a2.object({description:a2.string().optional().describe("what you want to do"),pattern:a2.string().describe("The glob pattern to match files against"),path:a2.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.')}),L1=D6(async({pattern:Q,path:X},Z)=>{let q=X?S6(Z.state.cwd,X):Z.state.cwd,V=await n2(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(V.length===0)return"No files found.";return V.join(`
199
+ >>> no match, partial?`,Q,W,X,j),W===K)return!0}return!1}let k;if(typeof H==="string")k=z===H,this.debug("string match",H,z,k);else k=H.test(z),this.debug("pattern match",H,z,k);if(!k)return!1}if($===K&&J===Y)return!0;else if($===K)return Z;else if(J===Y)return $===K-1&&Q[$]==="";else throw Error("wtf?")}braceExpand(){return n5(this.pattern,this.options)}parse(Q){j2(Q);let X=this.options;if(Q==="**")return u;if(Q==="")return"";let Z,q=null;if(Z=Q.match(FQ))q=X.dot?mQ:TQ;else if(Z=Q.match(wQ))q=(X.nocase?X.dot?MQ:LQ:X.dot?_Q:AQ)(Z[1]);else if(Z=Q.match(NQ))q=(X.nocase?X.dot?SQ:DQ:X.dot?PQ:yQ)(Z);else if(Z=Q.match(IQ))q=X.dot?OQ:xQ;else if(Z=Q.match(uQ))q=RQ;let V=O.fromGlob(Q,this.options).toMMPattern();if(q&&typeof V==="object")Reflect.defineProperty(V,"test",{value:q});return V}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,Z=X.noglobstar?EQ:X.dot?hQ:gQ,q=new Set(X.nocase?["i"]:[]),V=Q.map((K)=>{let Y=K.map((z)=>{if(z instanceof RegExp)for(let W of z.flags.split(""))q.add(W);return typeof z==="string"?oQ(z):z===u?u:z._src});Y.forEach((z,W)=>{let j=Y[W+1],U=Y[W-1];if(z!==u||U===u)return;if(U===void 0)if(j!==void 0&&j!==u)Y[W+1]="(?:\\/|"+Z+"\\/)?"+j;else Y[W]=Z;else if(j===void 0)Y[W-1]=U+"(?:\\/|\\/"+Z+")?";else if(j!==u)Y[W-1]=U+"(?:\\/|\\/"+Z+"\\/)"+j,Y[W+1]=u});let H=Y.filter((z)=>z!==u);if(this.partial&&H.length>=1){let z=[];for(let W=1;W<=H.length;W++)z.push(H.slice(0,W).join("/"));return"(?:"+z.join("|")+")"}return H.join("/")}).join("|"),[$,J]=Q.length>1?["(?:",")"]:["",""];if(V="^"+$+V+J+"$",this.partial)V="^(?:\\/|"+$+V.slice(1,-1)+J+")$";if(this.negate)V="^(?!"+V+").+$";try{this.regexp=new RegExp(V,[...q].join(""))}catch(K){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,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let Z=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let q=this.slashSplit(Q);this.debug(this.pattern,"split",q);let V=this.set;this.debug(this.pattern,"set",V);let $=q[q.length-1];if(!$)for(let J=q.length-2;!$&&J>=0;J--)$=q[J];for(let J=0;J<V.length;J++){let K=V[J],Y=q;if(Z.matchBase&&K.length===1)Y=[$];if(this.matchOne(Y,K,X)){if(Z.flipNegate)return!0;return!this.negate}}if(Z.flipNegate)return!1;return this.negate}static defaults(Q){return F.defaults(Q).Minimatch}}F.AST=O;F.Minimatch=S;F.escape=q2;F.unescape=b;import{fileURLToPath as O6}from"node:url";var iQ=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,i5=new Set,$5=typeof process=="object"&&process?process:{},a5=(Q,X,Z,q)=>{typeof $5.emitWarning=="function"?$5.emitWarning(Q,X,Z,q):console.error(`[${Z}] ${X}: ${Q}`)},m2=globalThis.AbortController,o5=globalThis.AbortSignal;if(typeof m2>"u"){o5=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,q){this._onabort.push(q)}},m2=class{constructor(){X()}signal=new o5;abort(Z){if(!this.signal.aborted){this.signal.reason=Z,this.signal.aborted=!0;for(let q of this.signal._onabort)q(Z);this.signal.onabort?.(Z)}}};let Q=$5.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{Q&&(Q=!1,a5("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",X))}}var aQ=(Q)=>!i5.has(Q),h0=Symbol("type"),a=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),p5=(Q)=>a(Q)?Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?T2:null:null,T2=class extends Array{constructor(Q){super(Q),this.fill(0)}},pQ=class Q{heap;length;static#Q=!1;static create(X){let Z=p5(X);if(!Z)return[];Q.#Q=!0;let q=new Q(X,Z);return Q.#Q=!1,q}constructor(X,Z){if(!Q.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new Z(X),this.length=0}push(X){this.heap[this.length++]=X}pop(){return this.heap[--this.length]}},G2=class Q{#Q;#Z;#$;#V;#J;#A;#C;#W;get perf(){return this.#W}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#K;#j;#z;#Y;#q;#U;#_;#w;#G;#R;#k;#I;#x;#B;#v;#L;#O;#X;#S;static unsafeExposeInternals(X){return{starts:X.#x,ttls:X.#B,autopurgeTimers:X.#v,sizes:X.#I,keyMap:X.#z,keyList:X.#Y,valList:X.#q,next:X.#U,prev:X.#_,get head(){return X.#w},get tail(){return X.#G},free:X.#R,isBackgroundFetch:(Z)=>X.#H(Z),backgroundFetch:(Z,q,V,$)=>X.#d(Z,q,V,$),moveToTail:(Z)=>X.#y(Z),indexes:(Z)=>X.#T(Z),rindexes:(Z)=>X.#m(Z),isStale:(Z)=>X.#M(Z)}}get max(){return this.#Q}get maxSize(){return this.#Z}get calculatedSize(){return this.#j}get size(){return this.#K}get fetchMethod(){return this.#A}get memoMethod(){return this.#C}get dispose(){return this.#$}get onInsert(){return this.#V}get disposeAfter(){return this.#J}constructor(X){let{max:Z=0,ttl:q,ttlResolution:V=1,ttlAutopurge:$,updateAgeOnGet:J,updateAgeOnHas:K,allowStale:Y,dispose:H,onInsert:z,disposeAfter:W,noDisposeOnSet:j,noUpdateTTL:U,maxSize:k=0,maxEntrySize:G=0,sizeCalculation:v,fetchMethod:B,memoMethod:C,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:o,ignoreFetchAbort:c,perf:Q2}=X;if(Q2!==void 0&&typeof Q2?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#W=Q2??iQ,Z!==0&&!a(Z))throw TypeError("max option must be a nonnegative integer");let X2=Z?p5(Z):Array;if(!X2)throw Error("invalid max value: "+Z);if(this.#Q=Z,this.#Z=k,this.maxEntrySize=G||this.#Z,this.sizeCalculation=v,this.sizeCalculation){if(!this.#Z&&!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(C!==void 0&&typeof C!="function")throw TypeError("memoMethod must be a function if defined");if(this.#C=C,B!==void 0&&typeof B!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#A=B,this.#O=!!B,this.#z=new Map,this.#Y=Array(Z).fill(void 0),this.#q=Array(Z).fill(void 0),this.#U=new X2(Z),this.#_=new X2(Z),this.#w=0,this.#G=0,this.#R=pQ.create(Z),this.#K=0,this.#j=0,typeof H=="function"&&(this.#$=H),typeof z=="function"&&(this.#V=z),typeof W=="function"?(this.#J=W,this.#k=[]):(this.#J=void 0,this.#k=void 0),this.#L=!!this.#$,this.#S=!!this.#V,this.#X=!!this.#J,this.noDisposeOnSet=!!j,this.noUpdateTTL=!!U,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!o,this.ignoreFetchAbort=!!c,this.maxEntrySize!==0){if(this.#Z!==0&&!a(this.#Z))throw TypeError("maxSize must be a positive integer if specified");if(!a(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#l()}if(this.allowStale=!!Y,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!J,this.updateAgeOnHas=!!K,this.ttlResolution=a(V)||V===0?V:1,this.ttlAutopurge=!!$,this.ttl=q||0,this.ttl){if(!a(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#Q===0&&this.ttl===0&&this.#Z===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#Z){let Q5="LRU_CACHE_UNBOUNDED";aQ(Q5)&&(i5.add(Q5),a5("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Q5,Q))}}getRemainingTTL(X){return this.#z.has(X)?1/0:0}#N(){let X=new T2(this.#Q),Z=new T2(this.#Q);this.#B=X,this.#x=Z;let q=this.ttlAutopurge?Array(this.#Q):void 0;this.#v=q,this.#f=(J,K,Y=this.#W.now())=>{if(Z[J]=K!==0?Y:0,X[J]=K,q?.[J]&&(clearTimeout(q[J]),q[J]=void 0),K!==0&&q){let H=setTimeout(()=>{this.#M(J)&&this.#F(this.#Y[J],"expire")},K+1);H.unref&&H.unref(),q[J]=H}},this.#u=(J)=>{Z[J]=X[J]!==0?this.#W.now():0},this.#D=(J,K)=>{if(X[K]){let Y=X[K],H=Z[K];if(!Y||!H)return;J.ttl=Y,J.start=H,J.now=V||$();let z=J.now-H;J.remainingTTL=Y-z}};let V=0,$=()=>{let J=this.#W.now();if(this.ttlResolution>0){V=J;let K=setTimeout(()=>V=0,this.ttlResolution);K.unref&&K.unref()}return J};this.getRemainingTTL=(J)=>{let K=this.#z.get(J);if(K===void 0)return 0;let Y=X[K],H=Z[K];if(!Y||!H)return 1/0;let z=(V||$())-H;return Y-z},this.#M=(J)=>{let K=Z[J],Y=X[J];return!!Y&&!!K&&(V||$())-K>Y}}#u=()=>{};#D=()=>{};#f=()=>{};#M=()=>!1;#l(){let X=new T2(this.#Q);this.#j=0,this.#I=X,this.#b=(Z)=>{this.#j-=X[Z],X[Z]=0},this.#E=(Z,q,V,$)=>{if(this.#H(q))return 0;if(!a(V))if($){if(typeof $!="function")throw TypeError("sizeCalculation must be a function");if(V=$(q,Z),!a(V))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 V},this.#P=(Z,q,V)=>{if(X[Z]=q,this.#Z){let $=this.#Z-X[Z];for(;this.#j>$;)this.#g(!0)}this.#j+=X[Z],V&&(V.entrySize=q,V.totalCalculatedSize=this.#j)}}#b=(X)=>{};#P=(X,Z,q)=>{};#E=(X,Z,q,V)=>{if(q||V)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:X=this.allowStale}={}){if(this.#K)for(let Z=this.#G;!(!this.#h(Z)||((X||!this.#M(Z))&&(yield Z),Z===this.#w));)Z=this.#_[Z]}*#m({allowStale:X=this.allowStale}={}){if(this.#K)for(let Z=this.#w;!(!this.#h(Z)||((X||!this.#M(Z))&&(yield Z),Z===this.#G));)Z=this.#U[Z]}#h(X){return X!==void 0&&this.#z.get(this.#Y[X])===X}*entries(){for(let X of this.#T())this.#q[X]!==void 0&&this.#Y[X]!==void 0&&!this.#H(this.#q[X])&&(yield[this.#Y[X],this.#q[X]])}*rentries(){for(let X of this.#m())this.#q[X]!==void 0&&this.#Y[X]!==void 0&&!this.#H(this.#q[X])&&(yield[this.#Y[X],this.#q[X]])}*keys(){for(let X of this.#T()){let Z=this.#Y[X];Z!==void 0&&!this.#H(this.#q[X])&&(yield Z)}}*rkeys(){for(let X of this.#m()){let Z=this.#Y[X];Z!==void 0&&!this.#H(this.#q[X])&&(yield Z)}}*values(){for(let X of this.#T())this.#q[X]!==void 0&&!this.#H(this.#q[X])&&(yield this.#q[X])}*rvalues(){for(let X of this.#m())this.#q[X]!==void 0&&!this.#H(this.#q[X])&&(yield this.#q[X])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(X,Z={}){for(let q of this.#T()){let V=this.#q[q],$=this.#H(V)?V.__staleWhileFetching:V;if($!==void 0&&X($,this.#Y[q],this))return this.get(this.#Y[q],Z)}}forEach(X,Z=this){for(let q of this.#T()){let V=this.#q[q],$=this.#H(V)?V.__staleWhileFetching:V;$!==void 0&&X.call(Z,$,this.#Y[q],this)}}rforEach(X,Z=this){for(let q of this.#m()){let V=this.#q[q],$=this.#H(V)?V.__staleWhileFetching:V;$!==void 0&&X.call(Z,$,this.#Y[q],this)}}purgeStale(){let X=!1;for(let Z of this.#m({allowStale:!0}))this.#M(Z)&&(this.#F(this.#Y[Z],"expire"),X=!0);return X}info(X){let Z=this.#z.get(X);if(Z===void 0)return;let q=this.#q[Z],V=this.#H(q)?q.__staleWhileFetching:q;if(V===void 0)return;let $={value:V};if(this.#B&&this.#x){let J=this.#B[Z],K=this.#x[Z];if(J&&K){let Y=J-(this.#W.now()-K);$.ttl=Y,$.start=Date.now()}}return this.#I&&($.size=this.#I[Z]),$}dump(){let X=[];for(let Z of this.#T({allowStale:!0})){let q=this.#Y[Z],V=this.#q[Z],$=this.#H(V)?V.__staleWhileFetching:V;if($===void 0||q===void 0)continue;let J={value:$};if(this.#B&&this.#x){J.ttl=this.#B[Z];let K=this.#W.now()-this.#x[Z];J.start=Math.floor(Date.now()-K)}this.#I&&(J.size=this.#I[Z]),X.unshift([q,J])}return X}load(X){this.clear();for(let[Z,q]of X){if(q.start){let V=Date.now()-q.start;q.start=this.#W.now()-V}this.set(Z,q.value,q)}}set(X,Z,q={}){if(Z===void 0)return this.delete(X),this;let{ttl:V=this.ttl,start:$,noDisposeOnSet:J=this.noDisposeOnSet,sizeCalculation:K=this.sizeCalculation,status:Y}=q,{noUpdateTTL:H=this.noUpdateTTL}=q,z=this.#E(X,Z,q.size||0,K);if(this.maxEntrySize&&z>this.maxEntrySize)return Y&&(Y.set="miss",Y.maxEntrySizeExceeded=!0),this.#F(X,"set"),this;let W=this.#K===0?void 0:this.#z.get(X);if(W===void 0)W=this.#K===0?this.#G:this.#R.length!==0?this.#R.pop():this.#K===this.#Q?this.#g(!1):this.#K,this.#Y[W]=X,this.#q[W]=Z,this.#z.set(X,W),this.#U[this.#G]=W,this.#_[W]=this.#G,this.#G=W,this.#K++,this.#P(W,z,Y),Y&&(Y.set="add"),H=!1,this.#S&&this.#V?.(Z,X,"add");else{this.#y(W);let j=this.#q[W];if(Z!==j){if(this.#O&&this.#H(j)){j.__abortController.abort(Error("replaced"));let{__staleWhileFetching:U}=j;U!==void 0&&!J&&(this.#L&&this.#$?.(U,X,"set"),this.#X&&this.#k?.push([U,X,"set"]))}else J||(this.#L&&this.#$?.(j,X,"set"),this.#X&&this.#k?.push([j,X,"set"]));if(this.#b(W),this.#P(W,z,Y),this.#q[W]=Z,Y){Y.set="replace";let U=j&&this.#H(j)?j.__staleWhileFetching:j;U!==void 0&&(Y.oldValue=U)}}else Y&&(Y.set="update");this.#S&&this.onInsert?.(Z,X,Z===j?"update":"replace")}if(V!==0&&!this.#B&&this.#N(),this.#B&&(H||this.#f(W,V,$),Y&&this.#D(Y,W)),!J&&this.#X&&this.#k){let j=this.#k,U;for(;U=j?.shift();)this.#J?.(...U)}return this}pop(){try{for(;this.#K;){let X=this.#q[this.#w];if(this.#g(!0),this.#H(X)){if(X.__staleWhileFetching)return X.__staleWhileFetching}else if(X!==void 0)return X}}finally{if(this.#X&&this.#k){let X=this.#k,Z;for(;Z=X?.shift();)this.#J?.(...Z)}}}#g(X){let Z=this.#w,q=this.#Y[Z],V=this.#q[Z];return this.#O&&this.#H(V)?V.__abortController.abort(Error("evicted")):(this.#L||this.#X)&&(this.#L&&this.#$?.(V,q,"evict"),this.#X&&this.#k?.push([V,q,"evict"])),this.#b(Z),this.#v?.[Z]&&(clearTimeout(this.#v[Z]),this.#v[Z]=void 0),X&&(this.#Y[Z]=void 0,this.#q[Z]=void 0,this.#R.push(Z)),this.#K===1?(this.#w=this.#G=0,this.#R.length=0):this.#w=this.#U[Z],this.#z.delete(q),this.#K--,Z}has(X,Z={}){let{updateAgeOnHas:q=this.updateAgeOnHas,status:V}=Z,$=this.#z.get(X);if($!==void 0){let J=this.#q[$];if(this.#H(J)&&J.__staleWhileFetching===void 0)return!1;if(this.#M($))V&&(V.has="stale",this.#D(V,$));else return q&&this.#u($),V&&(V.has="hit",this.#D(V,$)),!0}else V&&(V.has="miss");return!1}peek(X,Z={}){let{allowStale:q=this.allowStale}=Z,V=this.#z.get(X);if(V===void 0||!q&&this.#M(V))return;let $=this.#q[V];return this.#H($)?$.__staleWhileFetching:$}#d(X,Z,q,V){let $=Z===void 0?void 0:this.#q[Z];if(this.#H($))return $;let J=new m2,{signal:K}=q;K?.addEventListener("abort",()=>J.abort(K.reason),{signal:J.signal});let Y={signal:J.signal,options:q,context:V},H=(G,v=!1)=>{let{aborted:B}=J.signal,C=q.ignoreFetchAbort&&G!==void 0,A=q.ignoreFetchAbort||!!(q.allowStaleOnFetchAbort&&G!==void 0);if(q.status&&(B&&!v?(q.status.fetchAborted=!0,q.status.fetchError=J.signal.reason,C&&(q.status.fetchAbortIgnored=!0)):q.status.fetchResolved=!0),B&&!C&&!v)return W(J.signal.reason,A);let _=U,w=this.#q[Z];return(w===U||C&&v&&w===void 0)&&(G===void 0?_.__staleWhileFetching!==void 0?this.#q[Z]=_.__staleWhileFetching:this.#F(X,"fetch"):(q.status&&(q.status.fetchUpdated=!0),this.set(X,G,Y.options))),G},z=(G)=>(q.status&&(q.status.fetchRejected=!0,q.status.fetchError=G),W(G,!1)),W=(G,v)=>{let{aborted:B}=J.signal,C=B&&q.allowStaleOnFetchAbort,A=C||q.allowStaleOnFetchRejection,_=A||q.noDeleteOnFetchRejection,w=U;if(this.#q[Z]===U&&(!_||!v&&w.__staleWhileFetching===void 0?this.#F(X,"fetch"):C||(this.#q[Z]=w.__staleWhileFetching)),A)return q.status&&w.__staleWhileFetching!==void 0&&(q.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw G},j=(G,v)=>{let B=this.#A?.(X,$,Y);B&&B instanceof Promise&&B.then((C)=>G(C===void 0?void 0:C),v),J.signal.addEventListener("abort",()=>{(!q.ignoreFetchAbort||q.allowStaleOnFetchAbort)&&(G(void 0),q.allowStaleOnFetchAbort&&(G=(C)=>H(C,!0)))})};q.status&&(q.status.fetchDispatched=!0);let U=new Promise(j).then(H,z),k=Object.assign(U,{__abortController:J,__staleWhileFetching:$,__returned:void 0});return Z===void 0?(this.set(X,k,{...Y.options,status:void 0}),Z=this.#z.get(X)):this.#q[Z]=k,k}#H(X){if(!this.#O)return!1;let Z=X;return!!Z&&Z instanceof Promise&&Z.hasOwnProperty("__staleWhileFetching")&&Z.__abortController instanceof m2}async fetch(X,Z={}){let{allowStale:q=this.allowStale,updateAgeOnGet:V=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,ttl:J=this.ttl,noDisposeOnSet:K=this.noDisposeOnSet,size:Y=0,sizeCalculation:H=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:W=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:j=this.allowStaleOnFetchRejection,ignoreFetchAbort:U=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:G,forceRefresh:v=!1,status:B,signal:C}=Z;if(!this.#O)return B&&(B.fetch="get"),this.get(X,{allowStale:q,updateAgeOnGet:V,noDeleteOnStaleGet:$,status:B});let A={allowStale:q,updateAgeOnGet:V,noDeleteOnStaleGet:$,ttl:J,noDisposeOnSet:K,size:Y,sizeCalculation:H,noUpdateTTL:z,noDeleteOnFetchRejection:W,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:k,ignoreFetchAbort:U,status:B,signal:C},_=this.#z.get(X);if(_===void 0){B&&(B.fetch="miss");let w=this.#d(X,_,A,G);return w.__returned=w}else{let w=this.#q[_];if(this.#H(w)){let X2=q&&w.__staleWhileFetching!==void 0;return B&&(B.fetch="inflight",X2&&(B.returnedStale=!0)),X2?w.__staleWhileFetching:w.__returned=w}let o=this.#M(_);if(!v&&!o)return B&&(B.fetch="hit"),this.#y(_),V&&this.#u(_),B&&this.#D(B,_),w;let c=this.#d(X,_,A,G),Q2=c.__staleWhileFetching!==void 0&&q;return B&&(B.fetch=o?"stale":"refresh",Q2&&o&&(B.returnedStale=!0)),Q2?c.__staleWhileFetching:c.__returned=c}}async forceFetch(X,Z={}){let q=await this.fetch(X,Z);if(q===void 0)throw Error("fetch() returned undefined");return q}memo(X,Z={}){let q=this.#C;if(!q)throw Error("no memoMethod provided to constructor");let{context:V,forceRefresh:$,...J}=Z,K=this.get(X,J);if(!$&&K!==void 0)return K;let Y=q(X,K,{options:J,context:V});return this.set(X,Y,J),Y}get(X,Z={}){let{allowStale:q=this.allowStale,updateAgeOnGet:V=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,status:J}=Z,K=this.#z.get(X);if(K!==void 0){let Y=this.#q[K],H=this.#H(Y);return J&&this.#D(J,K),this.#M(K)?(J&&(J.get="stale"),H?(J&&q&&Y.__staleWhileFetching!==void 0&&(J.returnedStale=!0),q?Y.__staleWhileFetching:void 0):($||this.#F(X,"expire"),J&&q&&(J.returnedStale=!0),q?Y:void 0)):(J&&(J.get="hit"),H?Y.__staleWhileFetching:(this.#y(K),V&&this.#u(K),Y))}else J&&(J.get="miss")}#c(X,Z){this.#_[Z]=X,this.#U[X]=Z}#y(X){X!==this.#G&&(X===this.#w?this.#w=this.#U[X]:this.#c(this.#_[X],this.#U[X]),this.#c(this.#G,X),this.#G=X)}delete(X){return this.#F(X,"delete")}#F(X,Z){let q=!1;if(this.#K!==0){let V=this.#z.get(X);if(V!==void 0)if(this.#v?.[V]&&(clearTimeout(this.#v?.[V]),this.#v[V]=void 0),q=!0,this.#K===1)this.#n(Z);else{this.#b(V);let $=this.#q[V];if(this.#H($)?$.__abortController.abort(Error("deleted")):(this.#L||this.#X)&&(this.#L&&this.#$?.($,X,Z),this.#X&&this.#k?.push([$,X,Z])),this.#z.delete(X),this.#Y[V]=void 0,this.#q[V]=void 0,V===this.#G)this.#G=this.#_[V];else if(V===this.#w)this.#w=this.#U[V];else{let J=this.#_[V];this.#U[J]=this.#U[V];let K=this.#U[V];this.#_[K]=this.#_[V]}this.#K--,this.#R.push(V)}}if(this.#X&&this.#k?.length){let V=this.#k,$;for(;$=V?.shift();)this.#J?.(...$)}return q}clear(){return this.#n("delete")}#n(X){for(let Z of this.#m({allowStale:!0})){let q=this.#q[Z];if(this.#H(q))q.__abortController.abort(Error("deleted"));else{let V=this.#Y[Z];this.#L&&this.#$?.(q,V,X),this.#X&&this.#k?.push([q,V,X])}}if(this.#z.clear(),this.#q.fill(void 0),this.#Y.fill(void 0),this.#B&&this.#x){this.#B.fill(0),this.#x.fill(0);for(let Z of this.#v??[])Z!==void 0&&clearTimeout(Z);this.#v?.fill(void 0)}if(this.#I&&this.#I.fill(0),this.#w=0,this.#G=0,this.#R.length=0,this.#j=0,this.#K=0,this.#X&&this.#k){let Z=this.#k,q;for(;q=Z?.shift();)this.#J?.(...q)}}};import{posix as J6,win32 as k5}from"node:path";import{fileURLToPath as K6}from"node:url";import{lstatSync as Y6,readdir as H6,readdirSync as W6,readlinkSync as z6,realpathSync as j6}from"fs";import*as U6 from"node:fs";import{lstat as k6,readdir as B6,readlink as C6,realpath as v6}from"node:fs/promises";import{EventEmitter as z5}from"node:events";import Q1 from"node:stream";import{StringDecoder as sQ}from"node:string_decoder";var s5=typeof process==="object"&&process?process:{stdout:null,stderr:null},rQ=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof e||Q instanceof Q1||eQ(Q)||tQ(Q)),eQ=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof z5&&typeof Q.pipe==="function"&&Q.pipe!==Q1.Writable.prototype.pipe,tQ=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof z5&&typeof Q.write==="function"&&typeof Q.end==="function",l=Symbol("EOF"),n=Symbol("maybeEmitEnd"),p=Symbol("emittedEnd"),N2=Symbol("emittingEnd"),k2=Symbol("emittedError"),D2=Symbol("closed"),r5=Symbol("read"),S2=Symbol("flush"),e5=Symbol("flushChunk"),f=Symbol("encoding"),V2=Symbol("decoder"),M=Symbol("flowing"),B2=Symbol("paused"),$2=Symbol("resume"),I=Symbol("buffer"),T=Symbol("pipes"),x=Symbol("bufferLength"),J5=Symbol("bufferPush"),P2=Symbol("bufferShift"),R=Symbol("objectMode"),L=Symbol("destroyed"),K5=Symbol("error"),Y5=Symbol("emitData"),t5=Symbol("emitEnd"),H5=Symbol("emitEnd2"),h=Symbol("async"),W5=Symbol("abort"),y2=Symbol("aborted"),C2=Symbol("signal"),r=Symbol("dataListeners"),N=Symbol("discarded"),v2=(Q)=>Promise.resolve().then(Q),Q6=(Q)=>Q(),X6=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",Z6=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,q6=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class j5{src;dest;opts;ondrain;constructor(Q,X,Z){this.src=Q,this.dest=X,this.opts=Z,this.ondrain=()=>Q[$2](),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 X1 extends j5{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,Z){super(Q,X,Z);this.proxyErrors=(q)=>this.dest.emit("error",q),Q.on("error",this.proxyErrors)}}var V6=(Q)=>!!Q.objectMode,$6=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class e extends z5{[M]=!1;[B2]=!1;[T]=[];[I]=[];[R];[f];[h];[V2];[l]=!1;[p]=!1;[N2]=!1;[D2]=!1;[k2]=null;[x]=0;[L]=!1;[C2];[y2]=!1;[r]=0;[N]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(V6(X))this[R]=!0,this[f]=null;else if($6(X))this[f]=X.encoding,this[R]=!1;else this[R]=!1,this[f]=null;if(this[h]=!!X.async,this[V2]=this[f]?new sQ(this[f]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[I]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[T]});let{signal:Z}=X;if(Z)if(this[C2]=Z,Z.aborted)this[W5]();else Z.addEventListener("abort",()=>this[W5]())}get bufferLength(){return this[x]}get encoding(){return this[f]}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[R]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[h]}set["async"](Q){this[h]=this[h]||!!Q}[W5](){this[y2]=!0,this.emit("abort",this[C2]?.reason),this.destroy(this[C2]?.reason)}get aborted(){return this[y2]}set aborted(Q){}write(Q,X,Z){if(this[y2])return!1;if(this[l])throw Error("write after end");if(this[L])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")Z=X,X="utf8";if(!X)X="utf8";let q=this[h]?v2:Q6;if(!this[R]&&!Buffer.isBuffer(Q)){if(q6(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(Z6(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[R]){if(this[M]&&this[x]!==0)this[S2](!0);if(this[M])this.emit("data",Q);else this[J5](Q);if(this[x]!==0)this.emit("readable");if(Z)q(Z);return this[M]}if(!Q.length){if(this[x]!==0)this.emit("readable");if(Z)q(Z);return this[M]}if(typeof Q==="string"&&!(X===this[f]&&!this[V2]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[f])Q=this[V2].write(Q);if(this[M]&&this[x]!==0)this[S2](!0);if(this[M])this.emit("data",Q);else this[J5](Q);if(this[x]!==0)this.emit("readable");if(Z)q(Z);return this[M]}read(Q){if(this[L])return null;if(this[N]=!1,this[x]===0||Q===0||Q&&Q>this[x])return this[n](),null;if(this[R])Q=null;if(this[I].length>1&&!this[R])this[I]=[this[f]?this[I].join(""):Buffer.concat(this[I],this[x])];let X=this[r5](Q||null,this[I][0]);return this[n](),X}[r5](Q,X){if(this[R])this[P2]();else{let Z=X;if(Q===Z.length||Q===null)this[P2]();else if(typeof Z==="string")this[I][0]=Z.slice(Q),X=Z.slice(0,Q),this[x]-=Q;else this[I][0]=Z.subarray(Q),X=Z.subarray(0,Q),this[x]-=Q}if(this.emit("data",X),!this[I].length&&!this[l])this.emit("drain");return X}end(Q,X,Z){if(typeof Q==="function")Z=Q,Q=void 0;if(typeof X==="function")Z=X,X="utf8";if(Q!==void 0)this.write(Q,X);if(Z)this.once("end",Z);if(this[l]=!0,this.writable=!1,this[M]||!this[B2])this[n]();return this}[$2](){if(this[L])return;if(!this[r]&&!this[T].length)this[N]=!0;if(this[B2]=!1,this[M]=!0,this.emit("resume"),this[I].length)this[S2]();else if(this[l])this[n]();else this.emit("drain")}resume(){return this[$2]()}pause(){this[M]=!1,this[B2]=!0,this[N]=!1}get destroyed(){return this[L]}get flowing(){return this[M]}get paused(){return this[B2]}[J5](Q){if(this[R])this[x]+=1;else this[x]+=Q.length;this[I].push(Q)}[P2](){if(this[R])this[x]-=1;else this[x]-=this[I][0].length;return this[I].shift()}[S2](Q=!1){do;while(this[e5](this[P2]())&&this[I].length);if(!Q&&!this[I].length&&!this[l])this.emit("drain")}[e5](Q){return this.emit("data",Q),this[M]}pipe(Q,X){if(this[L])return Q;this[N]=!1;let Z=this[p];if(X=X||{},Q===s5.stdout||Q===s5.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,Z){if(X.end)Q.end()}else if(this[T].push(!X.proxyErrors?new j5(this,Q,X):new X1(this,Q,X)),this[h])v2(()=>this[$2]());else this[$2]();return Q}unpipe(Q){let X=this[T].find((Z)=>Z.dest===Q);if(X){if(this[T].length===1){if(this[M]&&this[r]===0)this[M]=!1;this[T]=[]}else this[T].splice(this[T].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let Z=super.on(Q,X);if(Q==="data"){if(this[N]=!1,this[r]++,!this[T].length&&!this[M])this[$2]()}else if(Q==="readable"&&this[x]!==0)super.emit("readable");else if(X6(Q)&&this[p])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[k2]){let q=X;if(this[h])v2(()=>q.call(this,this[k2]));else q.call(this,this[k2])}return Z}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let Z=super.off(Q,X);if(Q==="data"){if(this[r]=this.listeners("data").length,this[r]===0&&!this[N]&&!this[T].length)this[M]=!1}return Z}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[r]=0,!this[N]&&!this[T].length)this[M]=!1}return X}get emittedEnd(){return this[p]}[n](){if(!this[N2]&&!this[p]&&!this[L]&&this[I].length===0&&this[l]){if(this[N2]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[D2])this.emit("close");this[N2]=!1}}emit(Q,...X){let Z=X[0];if(Q!=="error"&&Q!=="close"&&Q!==L&&this[L])return!1;else if(Q==="data")return!this[R]&&!Z?!1:this[h]?(v2(()=>this[Y5](Z)),!0):this[Y5](Z);else if(Q==="end")return this[t5]();else if(Q==="close"){if(this[D2]=!0,!this[p]&&!this[L])return!1;let V=super.emit("close");return this.removeAllListeners("close"),V}else if(Q==="error"){this[k2]=Z,super.emit(K5,Z);let V=!this[C2]||this.listeners("error").length?super.emit("error",Z):!1;return this[n](),V}else if(Q==="resume"){let V=super.emit("resume");return this[n](),V}else if(Q==="finish"||Q==="prefinish"){let V=super.emit(Q);return this.removeAllListeners(Q),V}let q=super.emit(Q,...X);return this[n](),q}[Y5](Q){for(let Z of this[T])if(Z.dest.write(Q)===!1)this.pause();let X=this[N]?!1:super.emit("data",Q);return this[n](),X}[t5](){if(this[p])return!1;return this[p]=!0,this.readable=!1,this[h]?(v2(()=>this[H5]()),!0):this[H5]()}[H5](){if(this[V2]){let X=this[V2].end();if(X){for(let Z of this[T])Z.dest.write(X);if(!this[N])super.emit("data",X)}}for(let X of this[T])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[R])Q.dataLength=0;let X=this.promise();return this.on("data",(Z)=>{if(Q.push(Z),!this[R])Q.dataLength+=Z.length}),await X,Q}async concat(){if(this[R])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[f]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(L,()=>X(Error("stream destroyed"))),this.on("error",(Z)=>X(Z)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[N]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let q=this.read();if(q!==null)return Promise.resolve({done:!1,value:q});if(this[l])return X();let V,$,J=(z)=>{this.off("data",K),this.off("end",Y),this.off(L,H),X(),$(z)},K=(z)=>{this.off("error",J),this.off("end",Y),this.off(L,H),this.pause(),V({value:z,done:!!this[l]})},Y=()=>{this.off("error",J),this.off("data",K),this.off(L,H),X(),V({done:!0,value:void 0})},H=()=>J(Error("stream destroyed"));return new Promise((z,W)=>{$=W,V=z,this.once(L,H),this.once("error",J),this.once("end",Y),this.once("data",K)})},throw:X,return:X,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[N]=!1;let Q=!1,X=()=>{return this.pause(),this.off(K5,X),this.off(L,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},Z=()=>{if(Q)return X();let q=this.read();return q===null?X():{done:!1,value:q}};return this.once("end",X),this.once(K5,X),this.once(L,X),{next:Z,throw:X,return:X,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(Q){if(this[L]){if(Q)this.emit("error",Q);else this.emit(L);return this}this[L]=!0,this[N]=!0,this[I].length=0,this[x]=0;let X=this;if(typeof X.close==="function"&&!this[D2])X.close();if(Q)this.emit("error",Q);else this.emit(L);return this}static get isStream(){return rQ}}var G6=j6.native,A2={lstatSync:Y6,readdir:H6,readdirSync:W6,readlinkSync:z6,realpathSync:G6,promises:{lstat:k6,readdir:B6,readlink:C6,realpath:v6}},J1=(Q)=>!Q||Q===A2||Q===U6?A2:{...A2,...Q,promises:{...A2.promises,...Q.promises||{}}},K1=/^\\\\\?\\([a-z]:)\\?$/i,w6=(Q)=>Q.replace(/\//g,"\\").replace(K1,"$1\\"),A6=/[\\\/]/,y=0,Y1=1,H1=2,g=4,W1=6,z1=8,t=10,j1=12,P=15,w2=~P,U5=16,Z1=32,_2=64,E=128,b2=256,E2=512,q1=_2|E|E2,_6=1023,G5=(Q)=>Q.isFile()?z1:Q.isDirectory()?g:Q.isSymbolicLink()?t:Q.isCharacterDevice()?H1:Q.isBlockDevice()?W1:Q.isSocket()?j1:Q.isFIFO()?Y1:y,V1=new G2({max:4096}),L2=(Q)=>{let X=V1.get(Q);if(X)return X;let Z=Q.normalize("NFKD");return V1.set(Q,Z),Z},$1=new G2({max:4096}),f2=(Q)=>{let X=$1.get(Q);if(X)return X;let Z=L2(Q.toLowerCase());return $1.set(Q,Z),Z};class B5 extends G2{constructor(){super({max:256})}}class U1 extends G2{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var G1=Symbol("PathScurry setAsCwd");class m{name;root;roots;parent;nocase;isCWD=!1;#Q;#Z;get dev(){return this.#Z}#$;get mode(){return this.#$}#V;get nlink(){return this.#V}#J;get uid(){return this.#J}#A;get gid(){return this.#A}#C;get rdev(){return this.#C}#W;get blksize(){return this.#W}#K;get ino(){return this.#K}#j;get size(){return this.#j}#z;get blocks(){return this.#z}#Y;get atimeMs(){return this.#Y}#q;get mtimeMs(){return this.#q}#U;get ctimeMs(){return this.#U}#_;get birthtimeMs(){return this.#_}#w;get atime(){return this.#w}#G;get mtime(){return this.#G}#R;get ctime(){return this.#R}#k;get birthtime(){return this.#k}#I;#x;#B;#v;#L;#O;#X;#S;#N;#u;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=y,Z,q,V,$,J){if(this.name=Q,this.#I=V?f2(Q):L2(Q),this.#X=X&_6,this.nocase=V,this.roots=q,this.root=Z||this,this.#S=$,this.#B=J.fullpath,this.#L=J.relative,this.#O=J.relativePosix,this.parent=J.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=J1(J.fs)}depth(){if(this.#x!==void 0)return this.#x;if(!this.parent)return this.#x=0;return this.#x=this.parent.depth()+1}childrenCache(){return this.#S}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),q=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#D(q):this.#D(q)}#D(Q){let X=this;for(let Z of Q)X=X.child(Z);return X}children(){let Q=this.#S.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#S.set(this,X),this.#X&=~U5,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let Z=this.children(),q=this.nocase?f2(Q):L2(Q);for(let K of Z)if(K.#I===q)return K;let V=this.parent?this.sep:"",$=this.#B?this.#B+V+Q:void 0,J=this.newChild(Q,y,{...X,parent:this,fullpath:$});if(!this.canReaddir())J.#X|=E;return Z.push(J),J}relative(){if(this.isCWD)return"";if(this.#L!==void 0)return this.#L;let Q=this.name,X=this.parent;if(!X)return this.#L=this.name;let Z=X.relative();return Z+(!Z||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let Q=this.name,X=this.parent;if(!X)return this.#O=this.fullpathPosix();let Z=X.relativePosix();return Z+(!Z||!X.parent?"":"/")+Q}fullpath(){if(this.#B!==void 0)return this.#B;let Q=this.name,X=this.parent;if(!X)return this.#B=this.name;let q=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#B=q}fullpathPosix(){if(this.#v!==void 0)return this.#v;if(this.sep==="/")return this.#v=this.fullpath();if(!this.parent){let q=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(q))return this.#v=`//?/${q}`;else return this.#v=q}let Q=this.parent,X=Q.fullpathPosix(),Z=X+(!X||!Q.parent?"":"/")+this.name;return this.#v=Z}isUnknown(){return(this.#X&P)===y}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.#X&P)===z1}isDirectory(){return(this.#X&P)===g}isCharacterDevice(){return(this.#X&P)===H1}isBlockDevice(){return(this.#X&P)===W1}isFIFO(){return(this.#X&P)===Y1}isSocket(){return(this.#X&P)===j1}isSymbolicLink(){return(this.#X&t)===t}lstatCached(){return this.#X&Z1?this:void 0}readlinkCached(){return this.#N}realpathCached(){return this.#u}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.#X&P;return!(Q!==y&&Q!==t||this.#X&b2||this.#X&E)}calledReaddir(){return!!(this.#X&U5)}isENOENT(){return!!(this.#X&E)}isNamed(Q){return!this.nocase?this.#I===L2(Q):this.#I===f2(Q)}async readlink(){let Q=this.#N;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),Z=(await this.parent.realpath())?.resolve(X);if(Z)return this.#N=Z}catch(X){this.#m(X.code);return}}readlinkSync(){let Q=this.#N;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),Z=this.parent.realpathSync()?.resolve(X);if(Z)return this.#N=Z}catch(X){this.#m(X.code);return}}#f(Q){this.#X|=U5;for(let X=Q.provisional;X<Q.length;X++){let Z=Q[X];if(Z)Z.#M()}}#M(){if(this.#X&E)return;this.#X=(this.#X|E)&w2,this.#l()}#l(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#M()}#b(){this.#X|=E2,this.#P()}#P(){if(this.#X&_2)return;let Q=this.#X;if((Q&P)===g)Q&=w2;this.#X=Q|_2,this.#l()}#E(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#P();else if(Q==="ENOENT")this.#M();else this.children().provisional=0}#T(Q=""){if(Q==="ENOTDIR")this.parent.#P();else if(Q==="ENOENT")this.#M()}#m(Q=""){let X=this.#X;if(X|=b2,Q==="ENOENT")X|=E;if(Q==="EINVAL"||Q==="UNKNOWN")X&=w2;if(this.#X=X,Q==="ENOTDIR"&&this.parent)this.parent.#P()}#h(Q,X){return this.#d(Q,X)||this.#g(Q,X)}#g(Q,X){let Z=G5(Q),q=this.newChild(Q.name,Z,{parent:this}),V=q.#X&P;if(V!==g&&V!==t&&V!==y)q.#X|=_2;return X.unshift(q),X.provisional++,q}#d(Q,X){for(let Z=X.provisional;Z<X.length;Z++){let q=X[Z];if((this.nocase?f2(Q.name):L2(Q.name))!==q.#I)continue;return this.#H(Q,q,Z,X)}}#H(Q,X,Z,q){let V=X.name;if(X.#X=X.#X&w2|G5(Q),V!==Q.name)X.name=Q.name;if(Z!==q.provisional){if(Z===q.length-1)q.pop();else q.splice(Z,1);q.unshift(X)}return q.provisional++,X}async lstat(){if((this.#X&E)===0)try{return this.#c(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#T(Q.code)}}lstatSync(){if((this.#X&E)===0)try{return this.#c(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#T(Q.code)}}#c(Q){let{atime:X,atimeMs:Z,birthtime:q,birthtimeMs:V,blksize:$,blocks:J,ctime:K,ctimeMs:Y,dev:H,gid:z,ino:W,mode:j,mtime:U,mtimeMs:k,nlink:G,rdev:v,size:B,uid:C}=Q;this.#w=X,this.#Y=Z,this.#k=q,this.#_=V,this.#W=$,this.#z=J,this.#R=K,this.#U=Y,this.#Z=H,this.#A=z,this.#K=W,this.#$=j,this.#G=U,this.#q=k,this.#V=G,this.#C=v,this.#j=B,this.#J=C;let A=G5(Q);if(this.#X=this.#X&w2|A|Z1,A!==y&&A!==g&&A!==t)this.#X|=_2}#y=[];#F=!1;#n(Q){this.#F=!1;let X=this.#y.slice();this.#y.length=0,X.forEach((Z)=>Z(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let Z=this.children();if(this.calledReaddir()){let V=Z.slice(0,Z.provisional);if(X)Q(null,V);else queueMicrotask(()=>Q(null,V));return}if(this.#y.push(Q),this.#F)return;this.#F=!0;let q=this.fullpath();this.#Q.readdir(q,{withFileTypes:!0},(V,$)=>{if(V)this.#E(V.code),Z.provisional=0;else{for(let J of $)this.#h(J,Z);this.#f(Z)}this.#n(Z.slice(0,Z.provisional));return})}#o;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#o)await this.#o;else{let Z=()=>{};this.#o=new Promise((q)=>Z=q);try{for(let q of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#h(q,Q);this.#f(Q)}catch(q){this.#E(q.code),Q.provisional=0}this.#o=void 0,Z()}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 X=this.fullpath();try{for(let Z of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#h(Z,Q);this.#f(Q)}catch(Z){this.#E(Z.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#X&q1)return!1;let Q=P&this.#X;if(!(Q===y||Q===g||Q===t))return!1;return!0}shouldWalk(Q,X){return(this.#X&g)===g&&!(this.#X&q1)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#u)return this.#u;if((E2|b2|E)&this.#X)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#u=this.resolve(Q)}catch(Q){this.#b()}}realpathSync(){if(this.#u)return this.#u;if((E2|b2|E)&this.#X)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#u=this.resolve(Q)}catch(Q){this.#b()}}[G1](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),Z=[],q=this;while(q&&q.parent)X.add(q),q.#L=Z.join(this.sep),q.#O=Z.join("/"),q=q.parent,Z.push("..");q=Q;while(q&&q.parent&&!X.has(q))q.#L=void 0,q.#O=void 0,q=q.parent}}class h2 extends m{sep="\\";splitSep=A6;constructor(Q,X=y,Z,q,V,$,J){super(Q,X,Z,q,V,$,J)}newChild(Q,X=y,Z={}){return new h2(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}getRootString(Q){return k5.parse(Q).root}getRoot(Q){if(Q=w6(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,Z]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=Z;return this.roots[Q]=new M2(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(K1,"$1\\"),Q===X}}class g2 extends m{splitSep="/";sep="/";constructor(Q,X=y,Z,q,V,$,J){super(Q,X,Z,q,V,$,J)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=y,Z={}){return new g2(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}}class C5{root;rootPath;roots;cwd;#Q;#Z;#$;nocase;#V;constructor(Q=process.cwd(),X,Z,{nocase:q,childrenCacheSize:V=16384,fs:$=A2}={}){if(this.#V=J1($),Q instanceof URL||Q.startsWith("file://"))Q=K6(Q);let J=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(J),this.#Q=new B5,this.#Z=new B5,this.#$=new U1(V);let K=J.substring(this.rootPath.length).split(Z);if(K.length===1&&!K[0])K.pop();if(q===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=q,this.root=this.newRoot(this.#V),this.roots[this.rootPath]=this.root;let Y=this.root,H=K.length-1,z=X.sep,W=this.rootPath,j=!1;for(let U of K){let k=H--;Y=Y.child(U,{relative:Array(k).fill("..").join(z),relativePosix:Array(k).fill("..").join("/"),fullpath:W+=(j?"":z)+U}),j=!0}this.cwd=Y}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#$}resolve(...Q){let X="";for(let V=Q.length-1;V>=0;V--){let $=Q[V];if(!$||$===".")continue;if(X=X?`${$}/${X}`:$,this.isAbsolute($))break}let Z=this.#Q.get(X);if(Z!==void 0)return Z;let q=this.cwd.resolve(X).fullpath();return this.#Q.set(X,q),q}resolvePosix(...Q){let X="";for(let V=Q.length-1;V>=0;V--){let $=Q[V];if(!$||$===".")continue;if(X=X?`${$}/${X}`:$,this.isAbsolute($))break}let Z=this.#Z.get(X);if(Z!==void 0)return Z;let q=this.cwd.resolve(X).fullpathPosix();return this.#Z.set(X,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,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z}=X;if(!Q.canReaddir())return[];else{let q=await Q.readdir();return Z?q:q.map((V)=>V.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0}=X;if(!Q.canReaddir())return[];else if(Z)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:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.readlink();return X?Z:Z?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q.withFileTypes,Q=this.cwd;let Z=Q.readlinkSync();return X?Z:Z?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.realpath();return X?Z:Z?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q.withFileTypes,Q=this.cwd;let Z=Q.realpathSync();return X?Z:Z?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X,J=[];if(!V||V(Q))J.push(Z?Q:Q.fullpath());let K=new Set,Y=(z,W)=>{K.add(z),z.readdirCB((j,U)=>{if(j)return W(j);let k=U.length;if(!k)return W();let G=()=>{if(--k===0)W()};for(let v of U){if(!V||V(v))J.push(Z?v:v.fullpath());if(q&&v.isSymbolicLink())v.realpath().then((B)=>B?.isUnknown()?B.lstat():B).then((B)=>B?.shouldWalk(K,$)?Y(B,G):G());else if(v.shouldWalk(K,$))Y(v,G);else G()}},!0)},H=Q;return new Promise((z,W)=>{Y(H,(j)=>{if(j)return W(j);z(J)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X,J=[];if(!V||V(Q))J.push(Z?Q:Q.fullpath());let K=new Set([Q]);for(let Y of K){let H=Y.readdirSync();for(let z of H){if(!V||V(z))J.push(Z?z:z.fullpath());let W=z;if(z.isSymbolicLink()){if(!(q&&(W=z.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(K,$))K.add(W)}}return J}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X;if(!V||V(Q))yield Z?Q:Q.fullpath();let J=new Set([Q]);for(let K of J){let Y=K.readdirSync();for(let H of Y){if(!V||V(H))yield Z?H:H.fullpath();let z=H;if(H.isSymbolicLink()){if(!(q&&(z=H.realpathSync())))continue;if(z.isUnknown())z.lstatSync()}if(z.shouldWalk(J,$))J.add(z)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X,J=new e({objectMode:!0});if(!V||V(Q))J.write(Z?Q:Q.fullpath());let K=new Set,Y=[Q],H=0,z=()=>{let W=!1;while(!W){let j=Y.shift();if(!j){if(H===0)J.end();return}H++,K.add(j);let U=(G,v,B=!1)=>{if(G)return J.emit("error",G);if(q&&!B){let C=[];for(let A of v)if(A.isSymbolicLink())C.push(A.realpath().then((_)=>_?.isUnknown()?_.lstat():_));if(C.length){Promise.all(C).then(()=>U(null,v,!0));return}}for(let C of v)if(C&&(!V||V(C))){if(!J.write(Z?C:C.fullpath()))W=!0}H--;for(let C of v){let A=C.realpathCached()||C;if(A.shouldWalk(K,$))Y.push(A)}if(W&&!J.flowing)J.once("drain",z);else if(!k)z()},k=!0;j.readdirCB(U,!0),k=!1}};return z(),J}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof m))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:q=!1,filter:V,walkFilter:$}=X,J=new e({objectMode:!0}),K=new Set;if(!V||V(Q))J.write(Z?Q:Q.fullpath());let Y=[Q],H=0,z=()=>{let W=!1;while(!W){let j=Y.shift();if(!j){if(H===0)J.end();return}H++,K.add(j);let U=j.readdirSync();for(let k of U)if(!V||V(k)){if(!J.write(Z?k:k.fullpath()))W=!0}H--;for(let k of U){let G=k;if(k.isSymbolicLink()){if(!(q&&(G=k.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(K,$))Y.push(G)}}if(W&&!J.flowing)J.once("drain",z)};return z(),J}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[G1](X)}}class M2 extends C5{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,k5,"\\",{...X,nocase:Z});this.nocase=Z;for(let q=this.cwd;q;q=q.parent)q.nocase=this.nocase}parseRootPath(Q){return k5.parse(Q).root.toUpperCase()}newRoot(Q){return new h2(this.rootPath,g,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class I2 extends C5{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:Z=!1}=X;super(Q,J6,"/",{...X,nocase:Z});this.nocase=Z}parseRootPath(Q){return"/"}newRoot(Q){return new g2(this.rootPath,g,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class d2 extends I2{constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,{...X,nocase:Z})}}var X7=process.platform==="win32"?h2:g2,k1=process.platform==="win32"?M2:process.platform==="darwin"?d2:I2;var L6=(Q)=>Q.length>=1,M6=(Q)=>Q.length>=1;class J2{#Q;#Z;#$;length;#V;#J;#A;#C;#W;#K;#j=!0;constructor(Q,X,Z,q){if(!L6(Q))throw TypeError("empty pattern list");if(!M6(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,Z<0||Z>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#Z=X,this.#$=Z,this.#V=q,this.#$===0){if(this.isUNC()){let[V,$,J,K,...Y]=this.#Q,[H,z,W,j,...U]=this.#Z;if(Y[0]==="")Y.shift(),U.shift();let k=[V,$,J,K,""].join("/"),G=[H,z,W,j,""].join("/");this.#Q=[k,...Y],this.#Z=[G,...U],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[V,...$]=this.#Q,[J,...K]=this.#Z;if($[0]==="")$.shift(),K.shift();let Y=V+"/",H=J+"/";this.#Q=[Y,...$],this.#Z=[H,...K],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#$]}isString(){return typeof this.#Q[this.#$]==="string"}isGlobstar(){return this.#Q[this.#$]===u}isRegExp(){return this.#Q[this.#$]instanceof RegExp}globString(){return this.#A=this.#A||(this.#$===0?this.isAbsolute()?this.#Z[0]+this.#Z.slice(1).join("/"):this.#Z.join("/"):this.#Z.slice(this.#$).join("/"))}hasMore(){return this.length>this.#$+1}rest(){if(this.#J!==void 0)return this.#J;if(!this.hasMore())return this.#J=null;return this.#J=new J2(this.#Q,this.#Z,this.#$+1,this.#V),this.#J.#K=this.#K,this.#J.#W=this.#W,this.#J.#C=this.#C,this.#J}isUNC(){let Q=this.#Q;return this.#W!==void 0?this.#W:this.#W=this.#V==="win32"&&this.#$===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#C!==void 0?this.#C:this.#C=this.#V==="win32"&&this.#$===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#K!==void 0?this.#K:this.#K=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#$===0?Q:""}checkFollowGlobstar(){return!(this.#$===0||!this.isGlobstar()||!this.#j)}markFollowGlobstar(){if(this.#$===0||!this.isGlobstar()||!this.#j)return!1;return this.#j=!1,!0}}var I6=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class x2{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:Z,noext:q,noglobstar:V,platform:$=I6}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=$,this.mmopts={dot:!0,nobrace:X,nocase:Z,noext:q,noglobstar:V,optimizationLevel:2,platform:$,nocomment:!0,nonegate:!0};for(let J of Q)this.add(J)}add(Q){let X=new S(Q,this.mmopts);for(let Z=0;Z<X.set.length;Z++){let q=X.set[Z],V=X.globParts[Z];if(!q||!V)throw Error("invalid pattern object");while(q[0]==="."&&V[0]===".")q.shift(),V.shift();let $=new J2(q,V,0,this.platform),J=new S($.globString(),this.mmopts),K=V[V.length-1]==="**",Y=$.isAbsolute();if(Y)this.absolute.push(J);else this.relative.push(J);if(K)if(Y)this.absoluteChildren.push(J);else this.relativeChildren.push(J)}}ignored(Q){let X=Q.fullpath(),Z=`${X}/`,q=Q.relative()||".",V=`${q}/`;for(let $ of this.relative)if($.match(q)||$.match(V))return!0;for(let $ of this.absolute)if($.match(X)||$.match(Z))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",Z=(Q.relative()||".")+"/";for(let q of this.relativeChildren)if(q.match(Z))return!0;for(let q of this.absoluteChildren)if(q.match(X))return!0;return!1}}class v5{store;constructor(Q=new Map){this.store=Q}copy(){return new v5(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let Z=Q.fullpath(),q=this.store.get(Z);if(q)q.add(X.globString());else this.store.set(Z,new Set([X.globString()]))}}class B1{store=new Map;add(Q,X,Z){let q=(X?2:0)|(Z?1:0),V=this.store.get(Q);this.store.set(Q,V===void 0?q:q&V)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class C1{store=new Map;add(Q,X){if(!Q.canReaddir())return;let Z=this.store.get(Q);if(Z){if(!Z.find((q)=>q.globString()===X.globString()))Z.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class O2{hasWalkedCache;matches=new B1;subwalks=new C1;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new v5}processPatterns(Q,X){this.patterns=X;let Z=X.map((q)=>[Q,q]);for(let[q,V]of Z){this.hasWalkedCache.storeWalked(q,V);let $=V.root(),J=V.isAbsolute()&&this.opts.absolute!==!1;if($){q=q.resolve($==="/"&&this.opts.root!==void 0?this.opts.root:$);let z=V.rest();if(!z){this.matches.add(q,!0,!1);continue}else V=z}if(q.isENOENT())continue;let K,Y,H=!1;while(typeof(K=V.pattern())==="string"&&(Y=V.rest()))q=q.resolve(K),V=Y,H=!0;if(K=V.pattern(),Y=V.rest(),H){if(this.hasWalkedCache.hasWalked(q,V))continue;this.hasWalkedCache.storeWalked(q,V)}if(typeof K==="string"){let z=K===".."||K===""||K===".";this.matches.add(q.resolve(K),J,z);continue}else if(K===u){if(!q.isSymbolicLink()||this.follow||V.checkFollowGlobstar())this.subwalks.add(q,V);let z=Y?.pattern(),W=Y?.rest();if(!Y||(z===""||z===".")&&!W)this.matches.add(q,J,z===""||z===".");else if(z===".."){let j=q.parent||q;if(!W)this.matches.add(j,J,!0);else if(!this.hasWalkedCache.hasWalked(j,W))this.subwalks.add(j,W)}}else if(K instanceof RegExp)this.subwalks.add(q,V)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new O2(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let Z=this.subwalks.get(Q),q=this.child();for(let V of X)for(let $ of Z){let J=$.isAbsolute(),K=$.pattern(),Y=$.rest();if(K===u)q.testGlobstar(V,$,Y,J);else if(K instanceof RegExp)q.testRegExp(V,K,Y,J);else q.testString(V,K,Y,J)}return q}testGlobstar(Q,X,Z,q){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,q,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if(Z&&X.checkFollowGlobstar())this.subwalks.add(Q,Z);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if(Z){let V=Z.pattern();if(typeof V==="string"&&V!==".."&&V!==""&&V!==".")this.testString(Q,V,Z.rest(),q);else if(V===".."){let $=Q.parent||Q;this.subwalks.add($,Z)}else if(V instanceof RegExp)this.testRegExp(Q,V,Z.rest(),q)}}testRegExp(Q,X,Z,q){if(!X.test(Q.name))return;if(!Z)this.matches.add(Q,q,!1);else this.subwalks.add(Q,Z)}testString(Q,X,Z,q){if(!Q.isNamed(X))return;if(!Z)this.matches.add(Q,q,!1);else this.subwalks.add(Q,Z)}}var x6=(Q,X)=>typeof Q==="string"?new x2([Q],X):Array.isArray(Q)?new x2(Q,X):Q;class w5{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#Z;#$;signal;maxDepth;includeChildMatches;constructor(Q,X,Z){if(this.patterns=Q,this.path=X,this.opts=Z,this.#$=!Z.posix&&Z.platform==="win32"?"\\":"/",this.includeChildMatches=Z.includeChildMatches!==!1,Z.ignore||!this.includeChildMatches){if(this.#Z=x6(Z.ignore??[],Z),!this.includeChildMatches&&typeof this.#Z.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Z.maxDepth||1/0,Z.signal)this.signal=Z.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#V(Q){return this.seen.has(Q)||!!this.#Z?.ignored?.(Q)}#J(Q){return!!this.#Z?.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,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||await Q.realpath(),!Z)return;Q=Z}let V=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&V?.isSymbolicLink()){let $=await V.realpath();if($&&($.isUnknown()||this.opts.stat))await $.lstat()}return this.matchCheckTest(V,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#V(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||Q.realpathSync(),!Z)return;Q=Z}let V=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&V?.isSymbolicLink()){let $=V.realpathSync();if($&&($?.isUnknown()||this.opts.stat))$.lstatSync()}return this.matchCheckTest(V,X)}matchFinish(Q,X){if(this.#V(Q))return;if(!this.includeChildMatches&&this.#Z?.add){let V=`${Q.relativePosix()}/**`;this.#Z.add(V)}let Z=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let q=this.opts.mark&&Q.isDirectory()?this.#$:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if(Z){let V=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit(V+q)}else{let V=this.opts.posix?Q.relativePosix():Q.relative(),$=this.opts.dotRelative&&!V.startsWith(".."+this.#$)?"."+this.#$:"";this.matchEmit(!V?"."+q:$+V+q)}}async match(Q,X,Z){let q=await this.matchCheck(Q,Z);if(q)this.matchFinish(q,X)}matchSync(Q,X,Z){let q=this.matchCheckSync(Q,Z);if(q)this.matchFinish(q,X)}walkCB(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2(Q,X,new O2(this.opts),Z)}walkCB2(Q,X,Z,q){if(this.#J(Q))return q();if(this.signal?.aborted)q();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,Z,q));return}Z.processPatterns(Q,X);let V=1,$=()=>{if(--V===0)q()};for(let[J,K,Y]of Z.matches.entries()){if(this.#V(J))continue;V++,this.match(J,K,Y).then(()=>$())}for(let J of Z.subwalkTargets()){if(this.maxDepth!==1/0&&J.depth()>=this.maxDepth)continue;V++;let K=J.readdirCached();if(J.calledReaddir())this.walkCB3(J,K,Z,$);else J.readdirCB((Y,H)=>this.walkCB3(J,H,Z,$),!0)}$()}walkCB3(Q,X,Z,q){Z=Z.filterEntries(Q,X);let V=1,$=()=>{if(--V===0)q()};for(let[J,K,Y]of Z.matches.entries()){if(this.#V(J))continue;V++,this.match(J,K,Y).then(()=>$())}for(let[J,K]of Z.subwalks.entries())V++,this.walkCB2(J,K,Z.child(),$);$()}walkCBSync(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2Sync(Q,X,new O2(this.opts),Z)}walkCB2Sync(Q,X,Z,q){if(this.#J(Q))return q();if(this.signal?.aborted)q();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,Z,q));return}Z.processPatterns(Q,X);let V=1,$=()=>{if(--V===0)q()};for(let[J,K,Y]of Z.matches.entries()){if(this.#V(J))continue;this.matchSync(J,K,Y)}for(let J of Z.subwalkTargets()){if(this.maxDepth!==1/0&&J.depth()>=this.maxDepth)continue;V++;let K=J.readdirSync();this.walkCB3Sync(J,K,Z,$)}$()}walkCB3Sync(Q,X,Z,q){Z=Z.filterEntries(Q,X);let V=1,$=()=>{if(--V===0)q()};for(let[J,K,Y]of Z.matches.entries()){if(this.#V(J))continue;this.matchSync(J,K,Y)}for(let[J,K]of Z.subwalks.entries())V++,this.walkCB2Sync(J,K,Z.child(),$);$()}}class c2 extends w5{matches=new Set;constructor(Q,X,Z){super(Q,X,Z)}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,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(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 l2 extends w5{results;constructor(Q,X,Z){super(Q,X,Z);this.results=new e({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 u6=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class d{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,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=O6(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((K)=>K.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((K)=>K.includes("/")?K:`./**/${K}`)}if(this.pattern=Q,this.platform=X.platform||u6,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let K=X.platform==="win32"?M2:X.platform==="darwin"?d2:X.platform?I2:k1;this.scurry=new K(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let Z=this.platform==="darwin"||this.platform==="win32",q={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Z,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},V=this.pattern.map((K)=>new S(K,q)),[$,J]=V.reduce((K,Y)=>{return K[0].push(...Y.set),K[1].push(...Y.globParts),K},[[],[]]);this.patterns=$.map((K,Y)=>{let H=J[Y];if(!H)throw Error("invalid pattern object");return new J2(K,H,0,this.platform)})}async walk(){return[...await new c2(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 c2(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 l2(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 l2(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 A5=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let Z of Q)if(new S(Z,X).hasMagic())return!0;return!1};function o2(Q,X={}){return new d(Q,X).streamSync()}function w1(Q,X={}){return new d(Q,X).stream()}function A1(Q,X={}){return new d(Q,X).walkSync()}async function v1(Q,X={}){return new d(Q,X).walk()}function i2(Q,X={}){return new d(Q,X).iterateSync()}function _1(Q,X={}){return new d(Q,X).iterate()}var R6=o2,F6=Object.assign(w1,{sync:o2}),T6=i2,m6=Object.assign(_1,{sync:i2}),N6=Object.assign(A1,{stream:o2,iterate:i2}),n2=Object.assign(v1,{glob:v1,globSync:A1,sync:N6,globStream:w1,stream:F6,globStreamSync:o2,streamSync:R6,globIterate:_1,iterate:m6,globIterateSync:i2,iterateSync:T6,Glob:d,hasMagic:A5,escape:q2,unescape:b});n2.glob=n2;import{resolve as S6}from"path";var P6=a2.object({description:a2.string().optional().describe("what you want to do"),pattern:a2.string().describe("The glob pattern to match files against"),path:a2.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.')}),L1=D6(async({pattern:Q,path:X},Z)=>{if(!Z.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let q=X?S6(Z.state.cwd,X):Z.state.cwd,V=await n2(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(V.length===0)return"No files found.";return V.join(`
200
200
  `)},{name:"glob_files",description:`- Fast file pattern matching tool that works with any codebase size
201
201
  - Supports glob patterns like "**/*.js" or "src/**/*.ts"
202
202
  - Returns matching file paths sorted by modification time
203
203
  - Use this tool when you need to find files by name patterns
204
204
  - When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
205
- - 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:P6});import{tool as h6}from"@langchain/core/tools";import{z as u2}from"zod";import{execa as b7}from"execa";import E7 from"extract-zip";import g7 from"fs-extra";import{dirname as y6,join as b6}from"node:path";import{fileURLToPath as f6}from"node:url";import{pathExists as n7}from"path-exists";import{temporaryFile as o7}from"tempy";import{xdgCache as p7}from"xdg-basedir";var E6=y6(f6(import.meta.url));var s7=process.env.RIPGREP_VERSION||"v15.0.0";var M1=b6(E6,`rg${process.platform==="win32"?".exe":""}`);import{execa as g6}from"execa";import{resolve as d6}from"path";var c6=async(Q,X,Z={})=>{let{timeout:q=15000,cwd:V}=Z;try{let $=await g6(Q,X,{cwd:V||process.cwd(),timeout:q,reject:!1,stripFinalNewline:!1,stdio:["pipe","pipe","pipe"],env:process.env});return{code:$.exitCode??0,stdout:$.stdout,stderr:$.stderr}}catch($){if($.timedOut)return{code:124,stdout:$.stdout||"",stderr:($.stderr||"")+`
206
- Process timed out`};return{code:$.exitCode||1,stdout:$.stdout||"",stderr:$.stderr||$.message||"Unknown error"}}},I1=h6(async({args:Q,head_limit:X},Z)=>{if(!Q||Q.length===0)return"Error: No arguments provided. Please provide ripgrep arguments.";if(!X&&!Q.includes("--max-count"))X=500;let q=Q[Q.length-1],V=[...Q];if(q&&!q.startsWith("-"))V[V.length-1]=d6(Z.state.cwd,q);let $=await c6(M1,V,{timeout:15000,cwd:Z.state.cwd});if(X&&$.stdout){let J=$.stdout.split(`
205
+ - 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:P6});import{tool as h6}from"@langchain/core/tools";import{z as u2}from"zod";import{execa as b7}from"execa";import E7 from"extract-zip";import g7 from"fs-extra";import{dirname as y6,join as b6}from"node:path";import{fileURLToPath as f6}from"node:url";import{pathExists as n7}from"path-exists";import{temporaryFile as i7}from"tempy";import{xdgCache as p7}from"xdg-basedir";var E6=y6(f6(import.meta.url));var s7=process.env.RIPGREP_VERSION||"v15.0.0";var M1=b6(E6,`rg${process.platform==="win32"?".exe":""}`);import{execa as g6}from"execa";import{resolve as d6}from"path";var c6=async(Q,X,Z={})=>{let{timeout:q=15000,cwd:V}=Z;try{let $=await g6(Q,X,{cwd:V||process.cwd(),timeout:q,reject:!1,stripFinalNewline:!1,stdio:["pipe","pipe","pipe"],env:process.env});return{code:$.exitCode??0,stdout:$.stdout,stderr:$.stderr}}catch($){if($.timedOut)return{code:124,stdout:$.stdout||"",stderr:($.stderr||"")+`
206
+ Process timed out`};return{code:$.exitCode||1,stdout:$.stdout||"",stderr:$.stderr||$.message||"Unknown error"}}},I1=h6(async({args:Q,head_limit:X},Z)=>{if(!Z.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(!X&&!Q.includes("--max-count"))X=500;let q=Q[Q.length-1],V=[...Q];if(q&&!q.startsWith("-"))V[V.length-1]=d6(Z.state.cwd,q);let $=await c6(M1,V,{timeout:15000,cwd:Z.state.cwd});if(X&&$.stdout){let J=$.stdout.split(`
207
207
  `);if(J.length>X)$.stdout=J.slice(0,X).join(`
208
208
  `)}if($.code!==0&&$.stderr){if($.code===1&&$.stdout==="")return"No matches found.";if($.code===124||$.stderr.includes("timeout")||$.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: ${$.stderr}`}return $.stdout||"No matches found."},{name:"search_files_rg",description:`Ripgrep (rg) - A fast text search tool that recursively searches directories for regex patterns
209
209
 
@@ -251,7 +251,7 @@ Performance:
251
251
  - 15 second timeout per search
252
252
  - Results limited to 500 lines by default (use head_limit parameter)
253
253
  - Respects .gitignore by default (use --no-ignore to override)
254
- `,schema:u2.object({description:u2.string().optional().describe("what you want to do"),args:u2.array(u2.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:u2.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{tool as l6}from"@langchain/core/tools";import{z as R2}from"zod";import{promises as n6}from"fs";import{resolve as i6}from"path";var _5=2000,o6=R2.object({description:R2.string().optional().describe("what you want to do"),file_path:R2.string().describe("The path to the file to read (absolute or relative to cwd)"),offset:R2.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:R2.number().default(_5).optional().describe("The number of lines to read. Only provide if the file is too large to read at once.")}),x1=l6(async({file_path:Q,offset:X,limit:Z},q)=>{try{let V=i6(q.state.cwd,Q),J=(await n6.readFile(V,"utf-8")).split(`
254
+ `,schema:u2.object({description:u2.string().optional().describe("what you want to do"),args:u2.array(u2.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:u2.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{tool as l6}from"@langchain/core/tools";import{z as R2}from"zod";import{promises as n6}from"fs";import{resolve as o6}from"path";var _5=2000,i6=R2.object({description:R2.string().optional().describe("what you want to do"),file_path:R2.string().describe("The path to the file to read (absolute or relative to cwd)"),offset:R2.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:R2.number().default(_5).optional().describe("The number of lines to read. Only provide if the file is too large to read at once.")}),x1=l6(async({file_path:Q,offset:X,limit:Z},q)=>{try{if(!q.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let V=o6(q.state.cwd,Q),J=(await n6.readFile(V,"utf-8")).split(`
255
255
  `);if(X)J=J.slice(X-1);if(Z)J=J.slice(0,Z);return J.join(`
256
256
  `)}catch(V){if(V.code==="ENOENT")return`Error: File not found at ${Q}`;throw V}},{name:"read_file",description:`Reads a file from the local filesystem. Relative paths are resolved based on the current working directory (cwd).
257
257
  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.
@@ -268,13 +268,13 @@ Usage:
268
268
  - This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
269
269
  - 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.
270
270
  - 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
271
- - If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.`,schema:o6});import{tool as a6}from"@langchain/core/tools";import{z as p2}from"zod";import{promises as p6}from"fs";import{resolve as s6}from"path";var O1=a6(async({file_path:Q,content:X},Z)=>{try{let q=s6(Z.state.cwd,Q);return await p6.writeFile(q,X,"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).
271
+ - If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.`,schema:i6});import{tool as a6}from"@langchain/core/tools";import{z as p2}from"zod";import{promises as p6}from"fs";import{resolve as s6}from"path";var O1=a6(async({file_path:Q,content:X},Z)=>{if(!Z.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");try{let q=s6(Z.state.cwd,Q);return await p6.writeFile(q,X,"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).
272
272
  Usage:
273
273
  - This tool will overwrite the existing file if there is one at the provided path.
274
274
  - 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.
275
275
  - ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
276
276
  - NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
277
- - Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`,schema:p2.object({description:p2.string().optional().describe("what you want to do"),file_path:p2.string().describe("The path to the file to write (absolute or relative to cwd)"),content:p2.string().describe("The content to write to the file")})});import{tool as r6}from"@langchain/core/tools";import{z as K2}from"zod";import{promises as L5}from"fs";import{resolve as e6}from"path";var t6=K2.object({description:K2.string().optional().describe("what you want to do"),file_path:K2.string().describe("The path to the file to modify (absolute or relative to cwd)"),old_string:K2.string().describe("The text to replace"),new_string:K2.string().describe("The text to replace it with (must be different from old_string)"),replace_all:K2.boolean().optional().default(!1).describe("Replace all occurences of old_string (default false)")}),u1=r6(async({file_path:Q,old_string:X,new_string:Z,replace_all:q=!1},V)=>{try{let $=e6(V.state.cwd,Q),J=await L5.readFile($,"utf-8");if(q){if(!J.includes(X))return`Error: old_string not found in ${$}`;let K=J.split(X).join(Z);return await L5.writeFile($,K,"utf-8"),`File ${$} has been edited successfully. Replaced all occurrences of old_string.`}else{let K=J.split(X);if(K.length===1)return`Error: old_string not found in ${$}`;if(K.length>2)return`Error: old_string is not unique in ${$} (found ${K.length-1} occurrences). Please provide more context or set replace_all to true.`;let Y=J.replace(X,Z);return await L5.writeFile($,Y,"utf-8"),`File ${$} has been edited successfully. Replaced single occurrence of old_string.`}}catch($){if($.code==="ENOENT")return`Error: File not found at ${Q}`;throw $}},{name:"edit_file",description:`Performs exact string replacements in files. Relative paths are resolved based on the current working directory (cwd).
277
+ - Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`,schema:p2.object({description:p2.string().optional().describe("what you want to do"),file_path:p2.string().describe("The path to the file to write (absolute or relative to cwd)"),content:p2.string().describe("The content to write to the file")})});import{tool as r6}from"@langchain/core/tools";import{z as K2}from"zod";import{promises as L5}from"fs";import{resolve as e6}from"path";var t6=K2.object({description:K2.string().optional().describe("what you want to do"),file_path:K2.string().describe("The path to the file to modify (absolute or relative to cwd)"),old_string:K2.string().describe("The text to replace"),new_string:K2.string().describe("The text to replace it with (must be different from old_string)"),replace_all:K2.boolean().optional().default(!1).describe("Replace all occurences of old_string (default false)")}),u1=r6(async({file_path:Q,old_string:X,new_string:Z,replace_all:q=!1},V)=>{try{if(!V.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let $=e6(V.state.cwd,Q),J=await L5.readFile($,"utf-8");if(q){if(!J.includes(X))return`Error: old_string not found in ${$}`;let K=J.split(X).join(Z);return await L5.writeFile($,K,"utf-8"),`File ${$} has been edited successfully. Replaced all occurrences of old_string.`}else{let K=J.split(X);if(K.length===1)return`Error: old_string not found in ${$}`;if(K.length>2)return`Error: old_string is not unique in ${$} (found ${K.length-1} occurrences). Please provide more context or set replace_all to true.`;let Y=J.replace(X,Z);return await L5.writeFile($,Y,"utf-8"),`File ${$} has been edited successfully. Replaced single occurrence of old_string.`}}catch($){if($.code==="ENOENT")return`Error: File not found at ${Q}`;throw $}},{name:"edit_file",description:`Performs exact string replacements in files. Relative paths are resolved based on the current working directory (cwd).
278
278
 
279
279
  Usage:
280
280
  - 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.
@@ -290,7 +290,7 @@ Usage:
290
290
  ${H}
291
291
  `;if(z)W+=`STDERR:
292
292
  ${z}
293
- `;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(Z)try{let K=R1(F1,[...T1,Q],{cwd:J.state.cwd,timeout:X,reject:!1,windowsVerbatimArguments:e2});if(!K.pid)return"Failed to start command in background.";let Y={process:K,stdout:[],stderr:[]};return r2.set(K.pid,Y),K.stdout?.on("data",(H)=>{Y.stdout.push(H.toString())}),K.stderr?.on("data",(H)=>{Y.stderr.push(H.toString())}),K.on("close",()=>{}),`Command started in background with ID: ${K.pid}`}catch(K){return`Error starting background command: ${K}`}else try{let K=await R1(F1,[...T1,Q],{cwd:J.state.cwd,timeout:X,reject:!1,windowsVerbatimArguments:e2});if(K.exitCode!==0)return K.stderr;return K.stdout}catch(K){return`Error executing command: ${K}`}},{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).
293
+ `;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(!J.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");if(Z)try{let K=R1(F1,[...T1,Q],{cwd:J.state.cwd,timeout:X,reject:!1,windowsVerbatimArguments:e2});if(!K.pid)return"Failed to start command in background.";let Y={process:K,stdout:[],stderr:[]};return r2.set(K.pid,Y),K.stdout?.on("data",(H)=>{Y.stdout.push(H.toString())}),K.stderr?.on("data",(H)=>{Y.stderr.push(H.toString())}),K.on("close",()=>{}),`Command started in background with ID: ${K.pid}`}catch(K){return`Error starting background command: ${K}`}else try{let K=await R1(F1,[...T1,Q],{cwd:J.state.cwd,timeout:X,reject:!1,windowsVerbatimArguments:e2});if(K.exitCode!==0)return K.stderr;return K.stdout}catch(K){return`Error executing command: ${K}`}},{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).
294
294
  Features:
295
295
  - Run commands (foreground or background)
296
296
  - Retrieve background process output
@@ -308,7 +308,7 @@ Notes:
308
308
  - Avoid interactive commands (like top, vim)
309
309
  - Use '&&' or ';' to chain commands (PowerShell/CMD syntax varies, simple chaining often works)
310
310
  - CAN'T BATCH CALL THIS TOOL!
311
- `,schema:s.object({description:s.string().describe("what you want to do"),command:s.string().optional().describe("The command to execute (required for running commands)"),timeout:s.number().optional().describe("Timeout in ms (default: 120000)"),run_in_background:s.boolean().optional().describe("Run command in background"),kill_process_id:s.string().optional().describe("ID of process to kill"),get_output_id:s.string().optional().describe("ID of process to get output from"),filter:s.string().optional().describe("Regex to filter output (only for get_output_id)")})});class t2{name="TerminalMiddleware";contextSchema=void 0;stateSchema=void 0;tools=[M5];async execute(){return this}}async function m1(Q){let X={id:"filesystem",name:"filesystem",description:"File and directory operations (read, write, search, glob)",execute:async()=>{return new s2}};await Q.addMiddleware(X),Q.middlewares.registerImplementation(X);let Z={id:"terminal",name:"terminal",description:"Terminal command execution (Bash/CMD, background processes)",execute:async()=>{return new t2}};await Q.addMiddleware(Z),Q.middlewares.registerImplementation(Z);let q={id:"subagents",name:"subagents",description:"Task delegation to specialized agents",execute:async()=>{let{createSubAgentsMiddleware:K}=await import("./chunk-vgvekk29.js");return await K(Q)}};await Q.addMiddleware(q),Q.middlewares.registerImplementation(q);let V={id:"memories",name:"memories",description:"Knowledge persistence",execute:async(K)=>{K.projectMemoriesDir=K.projectMemoriesDir||"./.claude/memories";let{MemoriesMiddleware:Y}=await import("./chunk-e2vdc3vs.js");return new Y(K)}};await Q.addMiddleware(V),Q.middlewares.registerImplementation(V);let $={id:"skills",name:"skills",description:"Progressive skills disclosure",execute:async(K)=>{if(K.projectSkillsDir=K.projectSkillsDir||"./.claude/skills",!K.skillsDir){let H=await import("os"),z=await import("path");K.skillsDir=z.join(H.homedir(),".claude","skills")}let{SkillsMiddleware:Y}=await import("@langgraph-js/standard-agent");return new Y(K)}};await Q.addMiddleware($),Q.middlewares.registerImplementation($);let J={id:"agents_md",name:"agents_md",description:"Inject agent documentation",execute:async(K)=>{let{AgentsMdMiddleware:Y}=await import("@langgraph-js/standard-agent");return new Y({projectRoot:K?.projectRoot})}};await Q.addMiddleware(J),Q.middlewares.registerImplementation(J)}var N1=`# 架构师 - 任务派发协调者
311
+ `,schema:s.object({description:s.string().describe("what you want to do"),command:s.string().optional().describe("The command to execute (required for running commands)"),timeout:s.number().optional().describe("Timeout in ms (default: 120000)"),run_in_background:s.boolean().optional().describe("Run command in background"),kill_process_id:s.string().optional().describe("ID of process to kill"),get_output_id:s.string().optional().describe("ID of process to get output from"),filter:s.string().optional().describe("Regex to filter output (only for get_output_id)")})});class t2{name="TerminalMiddleware";contextSchema=void 0;stateSchema=void 0;tools=[M5];async execute(){return this}}async function m1(Q){let X={id:"filesystem",name:"filesystem",description:"File and directory operations (read, write, search, glob)",execute:async()=>{return new s2}};await Q.addMiddleware(X),Q.middlewares.registerImplementation(X);let Z={id:"terminal",name:"terminal",description:"Terminal command execution (Bash/CMD, background processes)",execute:async()=>{return new t2}};await Q.addMiddleware(Z),Q.middlewares.registerImplementation(Z);let q={id:"subagents",name:"subagents",description:"Task delegation to specialized agents",execute:async()=>{let{createSubAgentsMiddleware:K}=await import("./chunk-b2pfdcdb.js");return await K(Q)}};await Q.addMiddleware(q),Q.middlewares.registerImplementation(q);let V={id:"memories",name:"memories",description:"Knowledge persistence",execute:async(K)=>{K.projectMemoriesDir=K.projectMemoriesDir||"./.claude/memories";let{MemoriesMiddleware:Y}=await import("./chunk-e2vdc3vs.js");return new Y(K)}};await Q.addMiddleware(V),Q.middlewares.registerImplementation(V);let $={id:"skills",name:"skills",description:"Progressive skills disclosure",execute:async(K)=>{if(K.projectSkillsDir=K.projectSkillsDir||"./.claude/skills",!K.skillsDir){let H=await import("os"),z=await import("path");K.skillsDir=z.join(H.homedir(),".claude","skills")}let{SkillsMiddleware:Y}=await import("@langgraph-js/standard-agent");return new Y(K)}};await Q.addMiddleware($),Q.middlewares.registerImplementation($);let J={id:"agents_md",name:"agents_md",description:"Inject agent documentation",execute:async(K)=>{let{AgentsMdMiddleware:Y}=await import("@langgraph-js/standard-agent");return new Y({projectRoot:K?.projectRoot})}};await Q.addMiddleware(J),Q.middlewares.registerImplementation(J)}var N1=`# 架构师 - 任务派发协调者
312
312
 
313
313
  你是一位**任务派发架构师**,核心职责是将用户需求分析并拆解为子任务,然后委派给合适的子 agent 执行。
314
314
 
@@ -1,4 +1,4 @@
1
- import"./chunk-98x8wkt6.js";import"./chunk-rxxn6qxm.js";import"./chunk-g0fa5dyc.js";import"./chunk-zqx4fcfe.js";import{sb as A}from"./chunk-3s46q55v.js";import"./chunk-mrkf2b3t.js";import"./chunk-pnhf6jtr.js";import"./chunk-y5pf2d0x.js";import"./chunk-v28dexnx.js";import{bc as N}from"./chunk-4n978rje.js";import"./chunk-wtwgpw9g.js";import"./chunk-vkfhjhhh.js";import"./chunk-0gpa9n28.js";import"./chunk-feptb1bb.js";import{HumanMessage as q}from"langchain";import{AgentPackage as B,ToolRegistry as l,MiddlewareRegistry as P}from"@langgraph-js/standard-agent";async function D(){return new Promise((b,x)=>{let T="";process.stdin.setEncoding("utf8"),process.stdin.on("data",(d)=>{T+=d}),process.stdin.on("end",()=>{b(T)}),process.stdin.on("error",(d)=>{x(d)})})}async function i(b,x=!1){let T=await N();await T.initialize();let d=await T.getConfig(),y=b||"";if(x)try{y=(await D()).trim()}catch(w){throw console.error("❌ 读取 stdin 失败:",w),w}if(!y)console.error("❌ 错误: 未提供输入内容"),console.error(`
1
+ import"./chunk-98x8wkt6.js";import"./chunk-qejfdzc7.js";import"./chunk-g0fa5dyc.js";import"./chunk-zqx4fcfe.js";import{sb as A}from"./chunk-1jj1bxmb.js";import"./chunk-zf08x9b0.js";import"./chunk-cp9xkgbn.js";import"./chunk-y5pf2d0x.js";import"./chunk-v28dexnx.js";import{bc as N}from"./chunk-4n978rje.js";import"./chunk-wtwgpw9g.js";import"./chunk-vkfhjhhh.js";import"./chunk-0gpa9n28.js";import"./chunk-feptb1bb.js";import{HumanMessage as q}from"langchain";import{AgentPackage as B,ToolRegistry as l,MiddlewareRegistry as P}from"@langgraph-js/standard-agent";async function D(){return new Promise((b,x)=>{let T="";process.stdin.setEncoding("utf8"),process.stdin.on("data",(d)=>{T+=d}),process.stdin.on("end",()=>{b(T)}),process.stdin.on("error",(d)=>{x(d)})})}async function i(b,x=!1){let T=await N();await T.initialize();let d=await T.getConfig(),y=b||"";if(x)try{y=(await D()).trim()}catch(w){throw console.error("❌ 读取 stdin 失败:",w),w}if(!y)console.error("❌ 错误: 未提供输入内容"),console.error(`
2
2
  用法:`),console.error(' zen-code -p "你的任务描述"'),console.error(' echo "内容" | zen-code'),process.exit(1);try{let w={messages:[new q(y)],provider_id:d.provider_id,model_id:d.model_id,enable_thinking:d.enable_thinking},E=await A.invoke(w,{recursionLimit:500}),F=E.messages||[],M=F[F.length-1];if(M)console.log(M.text);return E}catch(w){throw console.error(`
3
3
  ❌ 执行失败: ${w instanceof Error?w.message:String(w)}
4
4
  `),w}}export{i as runNonInteractive};