@mherod/get-cookie 4.0.4 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-IRERRCUF.js → chunk-3FVH4L25.js} +2 -2
- package/dist/{chunk-UPNW543B.js → chunk-7XZ7PCDJ.js} +2 -2
- package/dist/chunk-DVWQBWUF.js +4 -0
- package/dist/chunk-DVWQBWUF.js.map +1 -0
- package/dist/{chunk-VMBA4NVU.js → chunk-I6AYGFSQ.js} +2 -2
- package/dist/chunk-U27I5BLR.js +2 -0
- package/dist/chunk-U27I5BLR.js.map +1 -0
- package/dist/chunk-YOZOS2YM.js +2 -0
- package/dist/chunk-YOZOS2YM.js.map +1 -0
- package/dist/cli.cjs +3 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/getChromeCookie-2ROVM47V.js +2 -0
- package/dist/{getChromePassword-GTIXL733.js → getChromePassword-O452VQWI.js} +2 -2
- package/dist/getCookie-CRE6M3GI.js +2 -0
- package/dist/getFirefoxCookie-5P74VDC7.js +2 -0
- package/dist/getGroupedRenderedCookies-DFEJTTC6.js +2 -0
- package/dist/getMergedRenderedCookies-W5GSSHQQ.js +2 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +1 -1
- package/package.json +1 -4
- package/dist/chunk-5FUMK7M3.js +0 -4
- package/dist/chunk-5FUMK7M3.js.map +0 -1
- package/dist/chunk-A6MIB6FP.js +0 -2
- package/dist/chunk-A6MIB6FP.js.map +0 -1
- package/dist/chunk-CFMK2YSL.js +0 -2
- package/dist/chunk-CFMK2YSL.js.map +0 -1
- package/dist/getChromeCookie-CL3SRRWX.js +0 -2
- package/dist/getCookie-WV5KDZN7.js +0 -2
- package/dist/getFirefoxCookie-BXQ2GXAW.js +0 -2
- package/dist/getGroupedRenderedCookies-FNJ6FQVQ.js +0 -2
- package/dist/getMergedRenderedCookies-PNC2LHSD.js +0 -2
- /package/dist/{chunk-IRERRCUF.js.map → chunk-3FVH4L25.js.map} +0 -0
- /package/dist/{chunk-UPNW543B.js.map → chunk-7XZ7PCDJ.js.map} +0 -0
- /package/dist/{chunk-VMBA4NVU.js.map → chunk-I6AYGFSQ.js.map} +0 -0
- /package/dist/{getChromeCookie-CL3SRRWX.js.map → getChromeCookie-2ROVM47V.js.map} +0 -0
- /package/dist/{getChromePassword-GTIXL733.js.map → getChromePassword-O452VQWI.js.map} +0 -0
- /package/dist/{getCookie-WV5KDZN7.js.map → getCookie-CRE6M3GI.js.map} +0 -0
- /package/dist/{getFirefoxCookie-BXQ2GXAW.js.map → getFirefoxCookie-5P74VDC7.js.map} +0 -0
- /package/dist/{getGroupedRenderedCookies-FNJ6FQVQ.js.map → getGroupedRenderedCookies-DFEJTTC6.js.map} +0 -0
- /package/dist/{getMergedRenderedCookies-PNC2LHSD.js.map → getMergedRenderedCookies-W5GSSHQQ.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t}from"./chunk-7XZ7PCDJ.js";import"./chunk-DVWQBWUF.js";import{a as r}from"./chunk-56Z35D5R.js";import"./chunk-I6AYGFSQ.js";async function i(o){try{return await new t().queryCookies(o.name,o.domain)}catch(e){return r.warn("Error querying Chrome cookies:",e),[]}}var a=i;export{a as default,i as getChromeCookie};
|
|
2
|
+
//# sourceMappingURL=getChromeCookie-2ROVM47V.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as i}from"./chunk-56Z35D5R.js";import"./chunk-
|
|
2
|
-
//# sourceMappingURL=getChromePassword-
|
|
1
|
+
import{c as i}from"./chunk-56Z35D5R.js";import"./chunk-I6AYGFSQ.js";import{memoize as l}from"lodash-es";import{exec as m}from"child_process";import{promisify as u}from"util";var f=u(m),o=class extends Error{constructor(n,e,s){super(n);this.command=e;this.originalError=s;this.name="CommandExecutionError"}};function d(t,r){if(t instanceof o)throw i("Command execution failed",t,{command:t.command,originalError:t.originalError}),t;if(t instanceof Error){let e=new o(t.message,r,t);throw i("Failed to execute command",t,{command:r,stack:t.stack}),e}let n=new o("Unknown error occurred during command execution",r);throw i("Failed to execute command",null,{error:t,command:r}),n}async function a(t,r={}){if(!t||typeof t!="string")throw new o("Command must be a non-empty string",t);let n={encoding:"utf8",maxBuffer:5*1024*1024,timeout:3e4};try{let{stdout:e,stderr:s}=await f(t,{...n,...r}),c=e.trim();if(!c)throw s?new o(`Command failed with stderr: ${s}`,t):new o("Command returned empty result",t);return c}catch(e){d(e,t)}}var g=async()=>a('security find-generic-password -w -s "Chrome Safe Storage"'),P=l(g);export{P as getChromePassword};
|
|
2
|
+
//# sourceMappingURL=getChromePassword-O452VQWI.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t}from"./chunk-3FVH4L25.js";import"./chunk-DVWQBWUF.js";import{a as r}from"./chunk-56Z35D5R.js";import"./chunk-I6AYGFSQ.js";async function i(e){try{return await new t().queryCookies(e.name,e.domain)}catch(o){return r.warn("Error querying Firefox cookies:",o instanceof Error?o.message:String(o)),[]}}var c=i;export{c as default,i as getFirefoxCookie};
|
|
2
|
+
//# sourceMappingURL=getFirefoxCookie-5P74VDC7.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as n}from"./chunk-YOZOS2YM.js";import{a as t,b as i}from"./chunk-U27I5BLR.js";import"./chunk-7XZ7PCDJ.js";import"./chunk-3FVH4L25.js";import"./chunk-DVWQBWUF.js";import{a as e}from"./chunk-56Z35D5R.js";import"./chunk-I6AYGFSQ.js";async function c(s,a={}){try{let r=await i(s);if(!Array.isArray(r))return[];let m=r.filter(p=>{let o=t.safeParse(p);return o.success?!0:(e.warn("Invalid cookie format:",o.error.format()),!1)});return n(m,{...a,format:"grouped"})}catch(r){return e.warn("Error getting grouped rendered cookies:",r instanceof Error?r.message:String(r)),[]}}var g=c;export{g as default,c as getGroupedRenderedCookies};
|
|
2
|
+
//# sourceMappingURL=getGroupedRenderedCookies-DFEJTTC6.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as s}from"./chunk-YOZOS2YM.js";import{a as i,b as n}from"./chunk-U27I5BLR.js";import"./chunk-7XZ7PCDJ.js";import"./chunk-3FVH4L25.js";import"./chunk-DVWQBWUF.js";import{a as r}from"./chunk-56Z35D5R.js";import"./chunk-I6AYGFSQ.js";async function d(a,m){try{let e=await n(a);if(!Array.isArray(e))return"";let c=e.filter(f=>{let t=i.safeParse(f);return t.success?!0:(r.warn("Invalid cookie format:",t.error.format()),!1)}),o=s(c,{...m,format:"merged"});return typeof o=="string"?o:""}catch(e){return r.warn("Error getting merged rendered cookies:",e instanceof Error?e.message:String(e)),""}}var C=d;export{C as default,d as getMergedRenderedCookies};
|
|
2
|
+
//# sourceMappingURL=getMergedRenderedCookies-W5GSSHQQ.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var sn=Object.create;var ge=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var on=Object.getOwnPropertyNames;var nn=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var Pi=r=>{throw TypeError(r)};var hn=(r,t,e)=>t in r?ge(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var E=(r,t)=>()=>(r&&(t=r(r=0)),t);var Di=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),_t=(r,t)=>{for(var e in t)ge(r,e,{get:t[e],enumerable:!0})},Mi=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of on(t))!an.call(r,i)&&i!==e&&ge(r,i,{get:()=>t[i],enumerable:!(s=rn(t,i))||s.enumerable});return r};var we=(r,t,e)=>(e=r!=null?sn(nn(r)):{},Mi(t||!r||!r.__esModule?ge(e,"default",{value:r,enumerable:!0}):e,r)),ln=r=>Mi(ge({},"__esModule",{value:!0}),r);var f=(r,t,e)=>hn(r,typeof t!="symbol"?t+"":t,e),Is=(r,t,e)=>t.has(r)||Pi("Cannot "+e);var a=(r,t,e)=>(Is(r,t,"read from private field"),e?e.call(r):t.get(r)),w=(r,t,e)=>t.has(r)?Pi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),p=(r,t,e,s)=>(Is(r,t,"write to private field"),s?s.call(r,e):t.set(r,e),e),b=(r,t,e)=>(Is(r,t,"access private method"),e);var Fi,cn,D,gt=E(()=>{"use strict";Fi=require("consola"),cn=(0,Fi.createConsola)({fancy:!0,formatOptions:{showLogLevel:!1,colors:!0,date:!1,compact:!0,columns:typeof process.stdout.columns=="number"?process.stdout.columns:80},level:typeof process.env.LOG_LEVEL=="string"&&process.env.LOG_LEVEL==="debug"?5:2}),D=cn});function Ni(r,t,e){let i=`${t?"\u2705":"\u274C"} ${r} ${t?"succeeded":"failed"}`;t?D.success(i,e):D.error(i,e)}function F(r,t,e){let s={...e!=null?e:{},error:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t};D.error(r,s)}function lt(r,t,e){D.withTag(r).debug(t,e)}function Li(r){return D.withTag(r)}function os(r,t,e){D.withTag(r).warn(t,e)}var vt=E(()=>{"use strict";gt();gt()});var Ai,Bi,ns,Ii=E(()=>{"use strict";Ai=require("lodash-es"),Bi={};(0,Ai.merge)(Bi,process.env);ns=Bi.HOME;if(typeof ns!="string"||ns.length===0)throw new Error("HOME environment variable is not set or empty")});var _i,ji,Yt,js=E(()=>{"use strict";_i=require("path");Ii();Yt=(0,_i.join)((ji=ns)!=null?ji:"","Library","Application Support","Google","Chrome")});function un(r){try{return r.close(),Promise.resolve()}catch(t){return F("Database close failed",t),Promise.reject(t instanceof Error?t:new Error("Failed to close database: Unknown error"))}}async function as({file:r,sql:t,params:e,rowFilter:s,rowTransform:i}){let o;try{o=await fn(r);let h=o.prepare(t).all(e),l=s?h.filter(s):h;return i?l.map(i):l}catch(n){throw F("Database query failed",n,{file:r,sql:t}),n}finally{o&&await un(o)}}var $i,Wi,fn,_s=E(()=>{"use strict";$i=we(require("better-sqlite3"),1),Wi=require("lodash-es");vt();fn=(0,Wi.memoize)(r=>{try{return Promise.resolve(new $i.default(r,{readonly:!0}))}catch(t){throw F("Database open failed",t,{file:r}),t}})});function pn(r){if(typeof r!="string")return!1;let t=r.trim();return t.length===0?!1:(0,Ui.existsSync)(t)}async function dn(){let r=[(0,hs.join)(Yt,"Default/Cookies"),(0,hs.join)(Yt,"Profile */Cookies"),(0,hs.join)(Yt,"Profile Default/Cookies")],t=[];for(let e of r){let s=await(0,zi.default)(e);t.push(...s)}return lt("ChromeCookies","Found cookie files",{count:t.length,files:t}),t}function mn(r,t){let e=r==="%",s=e?"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE host_key LIKE ?":"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE name = ? AND host_key LIKE ?",i=e?[`%${t}%`]:[r,`%${t}%`];return{sql:s,params:i}}async function gn(r,t,e){try{let{sql:s,params:i}=mn(t,e);lt("ChromeCookies","Executing query",{sql:s,params:i});let o=await as({file:r,sql:s,params:i,rowTransform:n=>({name:n.name,domain:n.host_key,value:n.encrypted_value,expiry:n.expires_utc})});return Ni("QueryCookies",!0,{file:r,count:o.length}),o}catch(s){return F("Failed to read cookie file",s,{file:r}),[]}}async function qi({name:r,domain:t,file:e}){let s=typeof e=="string"&&e.length>0?[e]:await dn();if(s.length===0)return lt("ChromeCookies","No cookie files found"),[];let i=[];for(let o of s){if(!pn(o)){lt("ChromeCookies","Cookie file missing or invalid",{file:o});continue}let n=await gn(o,r,t);i.push(...n)}return lt("ChromeCookies","Query complete",{totalCookies:i.length}),i}var Ui,hs,zi,Gi=E(()=>{"use strict";Ui=require("fs"),hs=require("path"),zi=we(require("fast-glob"),1);vt();js();_s()});var Ji=Di((kh,Vi)=>{"use strict";Vi.exports=Qi;function Qi(r,t,e){r instanceof RegExp&&(r=Hi(r,e)),t instanceof RegExp&&(t=Hi(t,e));var s=Ki(r,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+r.length,s[1]),post:e.slice(s[1]+t.length)}}function Hi(r,t){var e=t.match(r);return e?e[0]:null}Qi.range=Ki;function Ki(r,t,e){var s,i,o,n,h,l=e.indexOf(r),c=e.indexOf(t,l+1),u=l;if(l>=0&&c>0){if(r===t)return[l,c];for(s=[],o=e.length;u>=0&&!h;)u==l?(s.push(u),l=e.indexOf(r,u+1)):s.length==1?h=[s.pop(),c]:(i=s.pop(),i<o&&(o=i,n=c),c=e.indexOf(t,u+1)),u=l<c&&l>=0?l:c;s.length&&(h=[o,n])}return h}});var rr=Di((Sh,ir)=>{"use strict";var Yi=Ji();ir.exports=bn;var Zi="\0SLASH"+Math.random()+"\0",Xi="\0OPEN"+Math.random()+"\0",Ws="\0CLOSE"+Math.random()+"\0",tr="\0COMMA"+Math.random()+"\0",er="\0PERIOD"+Math.random()+"\0";function $s(r){return parseInt(r,10)==r?parseInt(r,10):r.charCodeAt(0)}function wn(r){return r.split("\\\\").join(Zi).split("\\{").join(Xi).split("\\}").join(Ws).split("\\,").join(tr).split("\\.").join(er)}function yn(r){return r.split(Zi).join("\\").split(Xi).join("{").split(Ws).join("}").split(tr).join(",").split(er).join(".")}function sr(r){if(!r)return[""];var t=[],e=Yi("{","}",r);if(!e)return r.split(",");var s=e.pre,i=e.body,o=e.post,n=s.split(",");n[n.length-1]+="{"+i+"}";var h=sr(o);return o.length&&(n[n.length-1]+=h.shift(),n.push.apply(n,h)),t.push.apply(t,n),t}function bn(r){return r?(r.substr(0,2)==="{}"&&(r="\\{\\}"+r.substr(2)),ye(wn(r),!0).map(yn)):[]}function kn(r){return"{"+r+"}"}function Sn(r){return/^-?0\d/.test(r)}function Cn(r,t){return r<=t}function xn(r,t){return r>=t}function ye(r,t){var e=[],s=Yi("{","}",r);if(!s)return[r];var i=s.pre,o=s.post.length?ye(s.post,!1):[""];if(/\$$/.test(s.pre))for(var n=0;n<o.length;n++){var h=i+"{"+s.body+"}"+o[n];e.push(h)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),u=l||c,m=s.body.indexOf(",")>=0;if(!u&&!m)return s.post.match(/,.*\}/)?(r=s.pre+"{"+s.body+Ws+s.post,ye(r)):[r];var d;if(u)d=s.body.split(/\.\./);else if(d=sr(s.body),d.length===1&&(d=ye(d[0],!1).map(kn),d.length===1))return o.map(function(en){return s.pre+d[0]+en});var y;if(u){var R=$s(d[0]),g=$s(d[1]),x=Math.max(d[0].length,d[1].length),C=d.length==3?Math.abs($s(d[2])):1,T=Cn,O=g<R;O&&(C*=-1,T=xn);var L=d.some(Sn);y=[];for(var V=R;T(V,g);V+=C){var X;if(c)X=String.fromCharCode(V),X==="\\"&&(X="");else if(X=String(V),L){var Ti=x-X.length;if(Ti>0){var Oi=new Array(Ti+1).join("0");V<0?X="-"+Oi+X.slice(1):X=Oi+X}}y.push(X)}}else{y=[];for(var jt=0;jt<d.length;jt++)y.push.apply(y,ye(d[jt],!1))}for(var jt=0;jt<y.length;jt++)for(var n=0;n<o.length;n++){var h=i+y[jt]+o[n];(!t||u||h)&&e.push(h)}}return e}});var be,or=E(()=>{"use strict";be=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>65536)throw new TypeError("pattern is too long")}});var En,ke,vn,nr,ar,hr=E(()=>{"use strict";En={"[: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]},ke=r=>r.replace(/[[\]\\-]/g,"\\$&"),vn=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),nr=r=>r.join(""),ar=(r,t)=>{let e=t;if(r.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],i=[],o=e+1,n=!1,h=!1,l=!1,c=!1,u=e,m="";t:for(;o<r.length;){let g=r.charAt(o);if((g==="!"||g==="^")&&o===e+1){c=!0,o++;continue}if(g==="]"&&n&&!l){u=o+1;break}if(n=!0,g==="\\"&&!l){l=!0,o++;continue}if(g==="["&&!l){for(let[x,[C,T,O]]of Object.entries(En))if(r.startsWith(x,o)){if(m)return["$.",!1,r.length-e,!0];o+=x.length,O?i.push(C):s.push(C),h=h||T;continue t}}if(l=!1,m){g>m?s.push(ke(m)+"-"+ke(g)):g===m&&s.push(ke(g)),m="",o++;continue}if(r.startsWith("-]",o+1)){s.push(ke(g+"-")),o+=2;continue}if(r.startsWith("-",o+1)){m=g,o+=2;continue}s.push(ke(g)),o++}if(u<o)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,r.length-e,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let g=s[0].length===2?s[0].slice(-1):s[0];return[vn(g),!1,u-e,!1]}let d="["+(c?"^":"")+nr(s)+"]",y="["+(c?"":"^")+nr(i)+"]";return[s.length&&i.length?"("+d+"|"+y+")":s.length?d:y,h,u-e,!0]}});var rt,ls=E(()=>{"use strict";rt=(r,{windowsPathsNoEscape:t=!1}={})=>t?r.replace(/\[([^\/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")});var Rn,lr,Tn,cs,On,Pn,Dn,Mn,zs,cr,fr,A,I,wt,P,N,Rt,$t,Tt,ct,Wt,Se,Ut,ur,Ot,fs,Us,pr,G,Zt,qs=E(()=>{"use strict";hr();ls();Rn=new Set(["!","?","+","*","@"]),lr=r=>Rn.has(r),Tn="(?!(?:^|/)\\.\\.?(?:$|/))",cs="(?!\\.)",On=new Set(["[","."]),Pn=new Set(["..","."]),Dn=new Set("().*{}+?[]^$\\!"),Mn=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),zs="[^/]",cr=zs+"*?",fr=zs+"+?",G=class G{constructor(t,e,s={}){w(this,Ut);f(this,"type");w(this,A);w(this,I);w(this,wt,!1);w(this,P,[]);w(this,N);w(this,Rt);w(this,$t);w(this,Tt,!1);w(this,ct);w(this,Wt);w(this,Se,!1);this.type=t,t&&p(this,I,!0),p(this,N,e),p(this,A,a(this,N)?a(a(this,N),A):this),p(this,ct,a(this,A)===this?s:a(a(this,A),ct)),p(this,$t,a(this,A)===this?[]:a(a(this,A),$t)),t==="!"&&!a(a(this,A),Tt)&&a(this,$t).push(this),p(this,Rt,a(this,N)?a(a(this,N),P).length:0)}get hasMagic(){if(a(this,I)!==void 0)return a(this,I);for(let t of a(this,P))if(typeof t!="string"&&(t.type||t.hasMagic))return p(this,I,!0);return a(this,I)}toString(){return a(this,Wt)!==void 0?a(this,Wt):this.type?p(this,Wt,this.type+"("+a(this,P).map(t=>String(t)).join("|")+")"):p(this,Wt,a(this,P).map(t=>String(t)).join(""))}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof G&&a(e,N)===this))throw new Error("invalid part: "+e);a(this,P).push(e)}}toJSON(){var e;let t=this.type===null?a(this,P).slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...a(this,P).map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===a(this,A)||a(a(this,A),Tt)&&((e=a(this,N))==null?void 0:e.type)==="!")&&t.push({}),t}isStart(){var e;if(a(this,A)===this)return!0;if(!((e=a(this,N))!=null&&e.isStart()))return!1;if(a(this,Rt)===0)return!0;let t=a(this,N);for(let s=0;s<a(this,Rt);s++){let i=a(t,P)[s];if(!(i instanceof G&&i.type==="!"))return!1}return!0}isEnd(){var e,s,i;if(a(this,A)===this||((e=a(this,N))==null?void 0:e.type)==="!")return!0;if(!((s=a(this,N))!=null&&s.isEnd()))return!1;if(!this.type)return(i=a(this,N))==null?void 0:i.isEnd();let t=a(this,N)?a(a(this,N),P).length:0;return a(this,Rt)===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new G(this.type,t);for(let s of a(this,P))e.copyIn(s);return e}static fromGlob(t,e={}){var i;let s=new G(null,void 0,e);return b(i=G,Ot,fs).call(i,t,s,0,e),s}toMMPattern(){if(this!==a(this,A))return a(this,A).toMMPattern();let t=this.toString(),[e,s,i,o]=this.toRegExpSource();if(!(i||a(this,I)||a(this,ct).nocase&&!a(this,ct).nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let h=(a(this,ct).nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${e}$`,h),{_src:e,_glob:t})}get options(){return a(this,ct)}toRegExpSource(t){var l;let e=t!=null?t:!!a(this,ct).dot;if(a(this,A)===this&&b(this,Ut,ur).call(this),!this.type){let c=this.isStart()&&this.isEnd(),u=a(this,P).map(R=>{var O;let[g,x,C,T]=typeof R=="string"?b(O=G,Ot,pr).call(O,R,a(this,I),c):R.toRegExpSource(t);return p(this,I,a(this,I)||C),p(this,wt,a(this,wt)||T),g}).join(""),m="";if(this.isStart()&&typeof a(this,P)[0]=="string"&&!(a(this,P).length===1&&Pn.has(a(this,P)[0]))){let g=On,x=e&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),C=!e&&!t&&g.has(u.charAt(0));m=x?Tn:C?cs:""}let d="";return this.isEnd()&&a(a(this,A),Tt)&&((l=a(this,N))==null?void 0:l.type)==="!"&&(d="(?:$|\\/)"),[m+u+d,rt(u),p(this,I,!!a(this,I)),a(this,wt)]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",o=b(this,Ut,Us).call(this,e);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let c=this.toString();return p(this,P,[c]),this.type=null,p(this,I,void 0),[c,rt(this.toString()),!1,!1]}let n=!s||t||e||!cs?"":b(this,Ut,Us).call(this,!0);n===o&&(n=""),n&&(o=`(?:${o})(?:${n})*?`);let h="";if(this.type==="!"&&a(this,Se))h=(this.isStart()&&!e?cs:"")+fr;else{let c=this.type==="!"?"))"+(this.isStart()&&!e&&!t?cs:"")+cr+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;h=i+o+c}return[h,rt(o),p(this,I,!!a(this,I)),a(this,wt)]}};A=new WeakMap,I=new WeakMap,wt=new WeakMap,P=new WeakMap,N=new WeakMap,Rt=new WeakMap,$t=new WeakMap,Tt=new WeakMap,ct=new WeakMap,Wt=new WeakMap,Se=new WeakMap,Ut=new WeakSet,ur=function(){if(this!==a(this,A))throw new Error("should only call on root");if(a(this,Tt))return this;this.toString(),p(this,Tt,!0);let t;for(;t=a(this,$t).pop();){if(t.type!=="!")continue;let e=t,s=a(e,N);for(;s;){for(let i=a(e,Rt)+1;!s.type&&i<a(s,P).length;i++)for(let o of a(t,P)){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(a(s,P)[i])}e=s,s=a(e,N)}}return this},Ot=new WeakSet,fs=function(t,e,s,i){var y,R;let o=!1,n=!1,h=-1,l=!1;if(e.type===null){let g=s,x="";for(;g<t.length;){let C=t.charAt(g++);if(o||C==="\\"){o=!o,x+=C;continue}if(n){g===h+1?(C==="^"||C==="!")&&(l=!0):C==="]"&&!(g===h+2&&l)&&(n=!1),x+=C;continue}else if(C==="["){n=!0,h=g,l=!1,x+=C;continue}if(!i.noext&&lr(C)&&t.charAt(g)==="("){e.push(x),x="";let T=new G(C,e);g=b(y=G,Ot,fs).call(y,t,T,g,i),e.push(T);continue}x+=C}return e.push(x),g}let c=s+1,u=new G(null,e),m=[],d="";for(;c<t.length;){let g=t.charAt(c++);if(o||g==="\\"){o=!o,d+=g;continue}if(n){c===h+1?(g==="^"||g==="!")&&(l=!0):g==="]"&&!(c===h+2&&l)&&(n=!1),d+=g;continue}else if(g==="["){n=!0,h=c,l=!1,d+=g;continue}if(lr(g)&&t.charAt(c)==="("){u.push(d),d="";let x=new G(g,u);u.push(x),c=b(R=G,Ot,fs).call(R,t,x,c,i);continue}if(g==="|"){u.push(d),d="",m.push(u),u=new G(null,e);continue}if(g===")")return d===""&&a(e,P).length===0&&p(e,Se,!0),u.push(d),d="",e.push(...m,u),c;d+=g}return e.type=null,p(e,I,void 0),p(e,P,[t.substring(s-1)]),c},Us=function(t){return a(this,P).map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,i,o,n]=e.toRegExpSource(t);return p(this,wt,a(this,wt)||n),s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")},pr=function(t,e,s=!1){let i=!1,o="",n=!1;for(let h=0;h<t.length;h++){let l=t.charAt(h);if(i){i=!1,o+=(Dn.has(l)?"\\":"")+l;continue}if(l==="\\"){h===t.length-1?o+="\\\\":i=!0;continue}if(l==="["){let[c,u,m,d]=ar(t,h);if(m){o+=c,n=n||u,h+=m-1,e=e||d;continue}}if(l==="*"){s&&t==="*"?o+=fr:o+=cr,e=!0;continue}if(l==="?"){o+=zs,e=!0;continue}o+=Mn(l)}return[o,rt(t),!!e,n]},w(G,Ot);Zt=G});var Xt,Gs=E(()=>{"use strict";Xt=(r,{windowsPathsNoEscape:t=!1}={})=>t?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&")});var gr,H,Fn,Nn,Ln,An,Bn,In,jn,_n,$n,Wn,Un,zn,qn,Gn,Hn,Qn,Kn,Vn,wr,yr,br,dr,Jn,U,Yn,Zn,Xn,ta,ea,tt,sa,kr,ia,ra,mr,oa,J,Pt=E(()=>{"use strict";gr=we(rr(),1);or();qs();Gs();ls();qs();Gs();ls();H=(r,t,e={})=>(be(t),!e.nocomment&&t.charAt(0)==="#"?!1:new J(t,e).match(r)),Fn=/^\*+([^+@!?\*\[\(]*)$/,Nn=r=>t=>!t.startsWith(".")&&t.endsWith(r),Ln=r=>t=>t.endsWith(r),An=r=>(r=r.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(r)),Bn=r=>(r=r.toLowerCase(),t=>t.toLowerCase().endsWith(r)),In=/^\*+\.\*+$/,jn=r=>!r.startsWith(".")&&r.includes("."),_n=r=>r!=="."&&r!==".."&&r.includes("."),$n=/^\.\*+$/,Wn=r=>r!=="."&&r!==".."&&r.startsWith("."),Un=/^\*+$/,zn=r=>r.length!==0&&!r.startsWith("."),qn=r=>r.length!==0&&r!=="."&&r!=="..",Gn=/^\?+([^+@!?\*\[\(]*)?$/,Hn=([r,t=""])=>{let e=wr([r]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},Qn=([r,t=""])=>{let e=yr([r]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},Kn=([r,t=""])=>{let e=yr([r]);return t?s=>e(s)&&s.endsWith(t):e},Vn=([r,t=""])=>{let e=wr([r]);return t?s=>e(s)&&s.endsWith(t):e},wr=([r])=>{let t=r.length;return e=>e.length===t&&!e.startsWith(".")},yr=([r])=>{let t=r.length;return e=>e.length===t&&e!=="."&&e!==".."},br=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",dr={win32:{sep:"\\"},posix:{sep:"/"}},Jn=br==="win32"?dr.win32.sep:dr.posix.sep;H.sep=Jn;U=Symbol("globstar **");H.GLOBSTAR=U;Yn="[^/]",Zn=Yn+"*?",Xn="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ta="(?:(?!(?:\\/|^)\\.).)*?",ea=(r,t={})=>e=>H(e,r,t);H.filter=ea;tt=(r,t={})=>Object.assign({},r,t),sa=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return H;let t=H;return Object.assign((s,i,o={})=>t(s,i,tt(r,o)),{Minimatch:class extends t.Minimatch{constructor(i,o={}){super(i,tt(r,o))}static defaults(i){return t.defaults(tt(r,i)).Minimatch}},AST:class extends t.AST{constructor(i,o,n={}){super(i,o,tt(r,n))}static fromGlob(i,o={}){return t.AST.fromGlob(i,tt(r,o))}},unescape:(s,i={})=>t.unescape(s,tt(r,i)),escape:(s,i={})=>t.escape(s,tt(r,i)),filter:(s,i={})=>t.filter(s,tt(r,i)),defaults:s=>t.defaults(tt(r,s)),makeRe:(s,i={})=>t.makeRe(s,tt(r,i)),braceExpand:(s,i={})=>t.braceExpand(s,tt(r,i)),match:(s,i,o={})=>t.match(s,i,tt(r,o)),sep:t.sep,GLOBSTAR:U})};H.defaults=sa;kr=(r,t={})=>(be(r),t.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,gr.default)(r));H.braceExpand=kr;ia=(r,t={})=>new J(r,t).makeRe();H.makeRe=ia;ra=(r,t,e={})=>{let s=new J(t,e);return r=r.filter(i=>s.match(i)),s.options.nonull&&!r.length&&r.push(t),r};H.match=ra;mr=/[?*]|[+@!]\(.*?\)|\[|\]/,oa=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),J=class{constructor(t,e={}){f(this,"options");f(this,"set");f(this,"pattern");f(this,"windowsPathsNoEscape");f(this,"nonegate");f(this,"negate");f(this,"comment");f(this,"empty");f(this,"preserveMultipleSlashes");f(this,"partial");f(this,"globSet");f(this,"globParts");f(this,"nocase");f(this,"isWindows");f(this,"platform");f(this,"windowsNoMagicRoot");f(this,"regexp");be(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||br,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.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 t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((o,n,h)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=o[0]===""&&o[1]===""&&(o[2]==="?"||!mr.test(o[2]))&&!mr.test(o[3]),c=/^[a-z]:/i.test(o[0]);if(l)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(c)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let n=this.set[o];n[0]===""&&n[1]===""&&this.globParts[o][2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])&&(n[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let i=0;i<t[s].length;i++)t[s][i]==="**"&&(t[s][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,i)=>{let o=s[s.length-1];return i==="**"&&o==="**"?s:i===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(s.pop(),s):(s.push(i),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let o=t[i];i===1&&o===""&&t[0]===""||(o==="."||o==="")&&(e=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let i=t[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let n=i;for(;s[n+1]==="**";)n++;n>i&&s.splice(i+1,n-i);let h=s[i+1],l=s[i+2],c=s[i+3];if(h!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(i,1);let u=s.slice(0);u[i]="**",t.push(u),i--}if(!this.preserveMultipleSlashes){for(let n=1;n<s.length-1;n++){let h=s[n];n===1&&h===""&&s[0]===""||(h==="."||h==="")&&(e=!0,s.splice(n,1),n--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let o=0;for(;(o=s.indexOf("..",o+1))!==-1;){let n=s[o-1];if(n&&n!=="."&&n!==".."&&n!=="**"){e=!0;let l=o===1&&s[o+1]==="**"?["."]:[];s.splice(o-1,2,...l),s.length===0&&s.push(""),o-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[],t[s]=i;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let i=0,o=0,n=[],h="";for(;i<t.length&&o<e.length;)if(t[i]===e[o])n.push(h==="b"?e[o]:t[i]),i++,o++;else if(s&&t[i]==="**"&&e[o]===t[i+1])n.push(t[i]),i++;else if(s&&e[o]==="**"&&t[i]===e[o+1])n.push(e[o]),o++;else if(t[i]==="*"&&e[o]&&(this.options.dot||!e[o].startsWith("."))&&e[o]!=="**"){if(h==="b")return!1;h="a",n.push(t[i]),i++,o++}else if(e[o]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(h==="a")return!1;h="b",n.push(e[o]),i++,o++}else return!1;return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let i=this.options;if(this.isWindows){let g=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),x=!g&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),C=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),T=!C&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),O=x?3:g?0:void 0,L=T?3:C?0:void 0;if(typeof O=="number"&&typeof L=="number"){let[V,X]=[t[O],e[L]];V.toLowerCase()===X.toLowerCase()&&(e[L]=V,L>O?e=e.slice(L):O>L&&(t=t.slice(O)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var n=0,h=0,l=t.length,c=e.length;n<l&&h<c;n++,h++){this.debug("matchOne loop");var u=e[h],m=t[n];if(this.debug(e,u,m),u===!1)return!1;if(u===U){this.debug("GLOBSTAR",[e,u,m]);var d=n,y=h+1;if(y===c){for(this.debug("** at the end");n<l;n++)if(t[n]==="."||t[n]===".."||!i.dot&&t[n].charAt(0)===".")return!1;return!0}for(;d<l;){var R=t[d];if(this.debug(`
|
|
2
|
-
globstar while`,t,
|
|
3
|
-
>>> no match, partial?`,t,d,e,y),d===l))}let g;if(typeof u=="string"?(g=m===u,this.debug("string match",u,m,g)):(g=u.test(m),this.debug("pattern match",u,m,g)),!g)return!1}if(n===l&&h===c)return!0;if(n===l)return s;if(h===c)return n===l-1&&t[n]==="";throw new Error("wtf?")}braceExpand(){return kr(this.pattern,this.options)}parse(t){be(t);let e=this.options;if(t==="**")return U;if(t==="")return"";let s,i=null;(s=t.match(Un))?i=e.dot?qn:zn:(s=t.match(Fn))?i=(e.nocase?e.dot?Bn:An:e.dot?Ln:Nn)(s[1]):(s=t.match(Gn))?i=(e.nocase?e.dot?Qn:Hn:e.dot?Kn:Vn)(s):(s=t.match(In))?i=e.dot?_n:jn:(s=t.match($n))&&(i=Wn);let o=Zt.fromGlob(t,this.options).toMMPattern();return i&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:i}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?Zn:e.dot?Xn:ta,i=new Set(e.nocase?["i"]:[]),o=t.map(l=>{let c=l.map(u=>{if(u instanceof RegExp)for(let m of u.flags.split(""))i.add(m);return typeof u=="string"?oa(u):u===U?U:u._src});return c.forEach((u,m)=>{let d=c[m+1],y=c[m-1];u!==U||y===U||(y===void 0?d!==void 0&&d!==U?c[m+1]="(?:\\/|"+s+"\\/)?"+d:c[m]=s:d===void 0?c[m-1]=y+"(?:\\/|"+s+")?":d!==U&&(c[m-1]=y+"(?:\\/|\\/"+s+"\\/)"+d,c[m+1]=U))}),c.filter(u=>u!==U).join("/")}).join("|"),[n,h]=t.length>1?["(?:",")"]:["",""];o="^"+n+o+h+"$",this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...i].join(""))}catch(l){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let o=this.set;this.debug(this.pattern,"set",o);let n=i[i.length-1];if(!n)for(let h=i.length-2;!n&&h>=0;h--)n=i[h];for(let h=0;h<o.length;h++){let l=o[h],c=i;if(s.matchBase&&l.length===1&&(c=[n]),this.matchOne(c,l,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return H.defaults(t).Minimatch}};H.AST=Zt;H.Minimatch=J;H.escape=Xt;H.unescape=rt});var ys,Zs,qr,Sr,na,aa,ha,yt,bt,Dt,us,Ce,ps,Cr,ds,xr,ot,te,j,xe,ee,_,Q,$,Hs,ms,z,M,Qs,Ks,Er,Vs,ft,Js,gs,Ee,zt,Y,ve,la,ca,fa,ua,ws,Ys,pa,da,vr,Rr,Tr,Or,Pr,Dr,Mr,Fr,Nr,Lr,Ar,Br,Ir,jr,_r,$r,Wr,Ur,zr,Mt,Xs=E(()=>{"use strict";ys=require("events"),Zs=we(require("stream"),1),qr=require("string_decoder"),Sr=typeof process=="object"&&process?process:{stdout:null,stderr:null},na=r=>!!r&&typeof r=="object"&&(r instanceof Mt||r instanceof Zs.default||aa(r)||ha(r)),aa=r=>!!r&&typeof r=="object"&&r instanceof ys.EventEmitter&&typeof r.pipe=="function"&&r.pipe!==Zs.default.Writable.prototype.pipe,ha=r=>!!r&&typeof r=="object"&&r instanceof ys.EventEmitter&&typeof r.write=="function"&&typeof r.end=="function",yt=Symbol("EOF"),bt=Symbol("maybeEmitEnd"),Dt=Symbol("emittedEnd"),us=Symbol("emittingEnd"),Ce=Symbol("emittedError"),ps=Symbol("closed"),Cr=Symbol("read"),ds=Symbol("flush"),xr=Symbol("flushChunk"),ot=Symbol("encoding"),te=Symbol("decoder"),j=Symbol("flowing"),xe=Symbol("paused"),ee=Symbol("resume"),_=Symbol("buffer"),Q=Symbol("pipes"),$=Symbol("bufferLength"),Hs=Symbol("bufferPush"),ms=Symbol("bufferShift"),z=Symbol("objectMode"),M=Symbol("destroyed"),Qs=Symbol("error"),Ks=Symbol("emitData"),Er=Symbol("emitEnd"),Vs=Symbol("emitEnd2"),ft=Symbol("async"),Js=Symbol("abort"),gs=Symbol("aborted"),Ee=Symbol("signal"),zt=Symbol("dataListeners"),Y=Symbol("discarded"),ve=r=>Promise.resolve().then(r),la=r=>r(),ca=r=>r==="end"||r==="finish"||r==="prefinish",fa=r=>r instanceof ArrayBuffer||!!r&&typeof r=="object"&&r.constructor&&r.constructor.name==="ArrayBuffer"&&r.byteLength>=0,ua=r=>!Buffer.isBuffer(r)&&ArrayBuffer.isView(r),ws=class{constructor(t,e,s){f(this,"src");f(this,"dest");f(this,"opts");f(this,"ondrain");this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[ee](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ys=class extends ws{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=i=>e.emit("error",i),t.on("error",this.proxyErrors)}},pa=r=>!!r.objectMode,da=r=>!r.objectMode&&!!r.encoding&&r.encoding!=="buffer",Mt=class extends ys.EventEmitter{constructor(...e){let s=e[0]||{};super();f(this,zr,!1);f(this,Ur,!1);f(this,Wr,[]);f(this,$r,[]);f(this,_r);f(this,jr);f(this,Ir);f(this,Br);f(this,Ar,!1);f(this,Lr,!1);f(this,Nr,!1);f(this,Fr,!1);f(this,Mr,null);f(this,Dr,0);f(this,Pr,!1);f(this,Or);f(this,Tr,!1);f(this,Rr,0);f(this,vr,!1);f(this,"writable",!0);f(this,"readable",!0);if(s.objectMode&&typeof s.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");pa(s)?(this[z]=!0,this[ot]=null):da(s)?(this[ot]=s.encoding,this[z]=!1):(this[z]=!1,this[ot]=null),this[ft]=!!s.async,this[te]=this[ot]?new qr.StringDecoder(this[ot]):null,s&&s.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[_]}),s&&s.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Q]});let{signal:i}=s;i&&(this[Ee]=i,i.aborted?this[Js]():i.addEventListener("abort",()=>this[Js]()))}get bufferLength(){return this[$]}get encoding(){return this[ot]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[z]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ft]}set async(e){this[ft]=this[ft]||!!e}[(zr=j,Ur=xe,Wr=Q,$r=_,_r=z,jr=ot,Ir=ft,Br=te,Ar=yt,Lr=Dt,Nr=us,Fr=ps,Mr=Ce,Dr=$,Pr=M,Or=Ee,Tr=gs,Rr=zt,vr=Y,Js)](){var e,s;this[gs]=!0,this.emit("abort",(e=this[Ee])==null?void 0:e.reason),this.destroy((s=this[Ee])==null?void 0:s.reason)}get aborted(){return this[gs]}set aborted(e){}write(e,s,i){var n;if(this[gs])return!1;if(this[yt])throw new Error("write after end");if(this[M])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof s=="function"&&(i=s,s="utf8"),s||(s="utf8");let o=this[ft]?ve:la;if(!this[z]&&!Buffer.isBuffer(e)){if(ua(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(fa(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[z]?(this[j]&&this[$]!==0&&this[ds](!0),this[j]?this.emit("data",e):this[Hs](e),this[$]!==0&&this.emit("readable"),i&&o(i),this[j]):e.length?(typeof e=="string"&&!(s===this[ot]&&!((n=this[te])!=null&&n.lastNeed))&&(e=Buffer.from(e,s)),Buffer.isBuffer(e)&&this[ot]&&(e=this[te].write(e)),this[j]&&this[$]!==0&&this[ds](!0),this[j]?this.emit("data",e):this[Hs](e),this[$]!==0&&this.emit("readable"),i&&o(i),this[j]):(this[$]!==0&&this.emit("readable"),i&&o(i),this[j])}read(e){if(this[M])return null;if(this[Y]=!1,this[$]===0||e===0||e&&e>this[$])return this[bt](),null;this[z]&&(e=null),this[_].length>1&&!this[z]&&(this[_]=[this[ot]?this[_].join(""):Buffer.concat(this[_],this[$])]);let s=this[Cr](e||null,this[_][0]);return this[bt](),s}[Cr](e,s){if(this[z])this[ms]();else{let i=s;e===i.length||e===null?this[ms]():typeof i=="string"?(this[_][0]=i.slice(e),s=i.slice(0,e),this[$]-=e):(this[_][0]=i.subarray(e),s=i.subarray(0,e),this[$]-=e)}return this.emit("data",s),!this[_].length&&!this[yt]&&this.emit("drain"),s}end(e,s,i){return typeof e=="function"&&(i=e,e=void 0),typeof s=="function"&&(i=s,s="utf8"),e!==void 0&&this.write(e,s),i&&this.once("end",i),this[yt]=!0,this.writable=!1,(this[j]||!this[xe])&&this[bt](),this}[ee](){this[M]||(!this[zt]&&!this[Q].length&&(this[Y]=!0),this[xe]=!1,this[j]=!0,this.emit("resume"),this[_].length?this[ds]():this[yt]?this[bt]():this.emit("drain"))}resume(){return this[ee]()}pause(){this[j]=!1,this[xe]=!0,this[Y]=!1}get destroyed(){return this[M]}get flowing(){return this[j]}get paused(){return this[xe]}[Hs](e){this[z]?this[$]+=1:this[$]+=e.length,this[_].push(e)}[ms](){return this[z]?this[$]-=1:this[$]-=this[_][0].length,this[_].shift()}[ds](e=!1){do;while(this[xr](this[ms]())&&this[_].length);!e&&!this[_].length&&!this[yt]&&this.emit("drain")}[xr](e){return this.emit("data",e),this[j]}pipe(e,s){if(this[M])return e;this[Y]=!1;let i=this[Dt];return s=s||{},e===Sr.stdout||e===Sr.stderr?s.end=!1:s.end=s.end!==!1,s.proxyErrors=!!s.proxyErrors,i?s.end&&e.end():(this[Q].push(s.proxyErrors?new Ys(this,e,s):new ws(this,e,s)),this[ft]?ve(()=>this[ee]()):this[ee]()),e}unpipe(e){let s=this[Q].find(i=>i.dest===e);s&&(this[Q].length===1?(this[j]&&this[zt]===0&&(this[j]=!1),this[Q]=[]):this[Q].splice(this[Q].indexOf(s),1),s.unpipe())}addListener(e,s){return this.on(e,s)}on(e,s){let i=super.on(e,s);if(e==="data")this[Y]=!1,this[zt]++,!this[Q].length&&!this[j]&&this[ee]();else if(e==="readable"&&this[$]!==0)super.emit("readable");else if(ca(e)&&this[Dt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Ce]){let o=s;this[ft]?ve(()=>o.call(this,this[Ce])):o.call(this,this[Ce])}return i}removeListener(e,s){return this.off(e,s)}off(e,s){let i=super.off(e,s);return e==="data"&&(this[zt]=this.listeners("data").length,this[zt]===0&&!this[Y]&&!this[Q].length&&(this[j]=!1)),i}removeAllListeners(e){let s=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[zt]=0,!this[Y]&&!this[Q].length&&(this[j]=!1)),s}get emittedEnd(){return this[Dt]}[bt](){!this[us]&&!this[Dt]&&!this[M]&&this[_].length===0&&this[yt]&&(this[us]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ps]&&this.emit("close"),this[us]=!1)}emit(e,...s){let i=s[0];if(e!=="error"&&e!=="close"&&e!==M&&this[M])return!1;if(e==="data")return!this[z]&&!i?!1:this[ft]?(ve(()=>this[Ks](i)),!0):this[Ks](i);if(e==="end")return this[Er]();if(e==="close"){if(this[ps]=!0,!this[Dt]&&!this[M])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[Ce]=i,super.emit(Qs,i);let n=!this[Ee]||this.listeners("error").length?super.emit("error",i):!1;return this[bt](),n}else if(e==="resume"){let n=super.emit("resume");return this[bt](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let o=super.emit(e,...s);return this[bt](),o}[Ks](e){for(let i of this[Q])i.dest.write(e)===!1&&this.pause();let s=this[Y]?!1:super.emit("data",e);return this[bt](),s}[Er](){return this[Dt]?!1:(this[Dt]=!0,this.readable=!1,this[ft]?(ve(()=>this[Vs]()),!0):this[Vs]())}[Vs](){if(this[te]){let s=this[te].end();if(s){for(let i of this[Q])i.dest.write(s);this[Y]||super.emit("data",s)}}for(let s of this[Q])s.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[z]||(e.dataLength=0);let s=this.promise();return this.on("data",i=>{e.push(i),this[z]||(e.dataLength+=i.length)}),await s,e}async concat(){if(this[z])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ot]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,s)=>{this.on(M,()=>s(new Error("stream destroyed"))),this.on("error",i=>s(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Y]=!1;let e=!1,s=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return s();let o=this.read();if(o!==null)return Promise.resolve({done:!1,value:o});if(this[yt])return s();let n,h,l=d=>{this.off("data",c),this.off("end",u),this.off(M,m),s(),h(d)},c=d=>{this.off("error",l),this.off("end",u),this.off(M,m),this.pause(),n({value:d,done:!!this[yt]})},u=()=>{this.off("error",l),this.off("data",c),this.off(M,m),s(),n({done:!0,value:void 0})},m=()=>l(new Error("stream destroyed"));return new Promise((d,y)=>{h=y,n=d,this.once(M,m),this.once("error",l),this.once("end",u),this.once("data",c)})},throw:s,return:s,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Y]=!1;let e=!1,s=()=>(this.pause(),this.off(Qs,s),this.off(M,s),this.off("end",s),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return s();let o=this.read();return o===null?s():{done:!1,value:o}};return this.once("end",s),this.once(Qs,s),this.once(M,s),{next:i,throw:s,return:s,[Symbol.iterator](){return this}}}destroy(e){if(this[M])return e?this.emit("error",e):this.emit(M),this;this[M]=!0,this[Y]=!0,this[_].length=0,this[$]=0;let s=this;return typeof s.close=="function"&&!this[ps]&&s.close(),e?this.emit("error",e):this.emit(M),this}static get isStream(){return na}}});var li,ne,Vr,mt,ma,Nt,ga,Te,Jr,Yr,wa,ya,st,Zr,Xr,ut,to,eo,qt,so,et,Re,ti,Gr,Oe,nt,bs,Ss,Hr,ba,ei,Qr,Pe,Kr,ks,vs,si,io,K,Ne,Le,Ae,Be,Ie,je,_e,$e,We,Ue,ze,qe,Ge,He,Qe,Ke,Ve,Je,Ft,Gt,pt,kt,St,Ct,S,Ht,xt,dt,k,ii,Cs,De,ri,oi,Me,xs,ni,ai,Es,ro,oo,no,hi,se,ie,ao,Qt,q,Rs,Ts,re,oe,Ye,Ze,Os,ae,he,Fe,qh,ho,lo=E(()=>{"use strict";li=require("lru-cache"),ne=require("path"),Vr=require("url"),mt=require("fs"),ma=we(require("fs"),1),Nt=require("fs/promises");Xs();ga=mt.realpathSync.native,Te={lstatSync:mt.lstatSync,readdir:mt.readdir,readdirSync:mt.readdirSync,readlinkSync:mt.readlinkSync,realpathSync:ga,promises:{lstat:Nt.lstat,readdir:Nt.readdir,readlink:Nt.readlink,realpath:Nt.realpath}},Jr=r=>!r||r===Te||r===ma?Te:{...Te,...r,promises:{...Te.promises,...r.promises||{}}},Yr=/^\\\\\?\\([a-z]:)\\?$/i,wa=r=>r.replace(/\//g,"\\").replace(Yr,"$1\\"),ya=/[\\\/]/,st=0,Zr=1,Xr=2,ut=4,to=6,eo=8,qt=10,so=12,et=15,Re=~et,ti=16,Gr=32,Oe=64,nt=128,bs=256,Ss=512,Hr=Oe|nt|Ss,ba=1023,ei=r=>r.isFile()?eo:r.isDirectory()?ut:r.isSymbolicLink()?qt:r.isCharacterDevice()?Xr:r.isBlockDevice()?to:r.isSocket()?so:r.isFIFO()?Zr:st,Qr=new Map,Pe=r=>{let t=Qr.get(r);if(t)return t;let e=r.normalize("NFKD");return Qr.set(r,e),e},Kr=new Map,ks=r=>{let t=Kr.get(r);if(t)return t;let e=Pe(r.toLowerCase());return Kr.set(r,e),e},vs=class extends li.LRUCache{constructor(){super({max:256})}},si=class extends li.LRUCache{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},io=Symbol("PathScurry setAsCwd"),q=class{constructor(t,e=st,s,i,o,n,h){w(this,k);f(this,"name");f(this,"root");f(this,"roots");f(this,"parent");f(this,"nocase");f(this,"isCWD",!1);w(this,K);w(this,Ne);w(this,Le);w(this,Ae);w(this,Be);w(this,Ie);w(this,je);w(this,_e);w(this,$e);w(this,We);w(this,Ue);w(this,ze);w(this,qe);w(this,Ge);w(this,He);w(this,Qe);w(this,Ke);w(this,Ve);w(this,Je);w(this,Ft);w(this,Gt);w(this,pt);w(this,kt);w(this,St);w(this,Ct);w(this,S);w(this,Ht);w(this,xt);w(this,dt);w(this,se,[]);w(this,ie,!1);w(this,Qt);this.name=t,p(this,Ft,o?ks(t):Pe(t)),p(this,S,e&ba),this.nocase=o,this.roots=i,this.root=s||this,p(this,Ht,n),p(this,pt,h.fullpath),p(this,St,h.relative),p(this,Ct,h.relativePosix),this.parent=h.parent,this.parent?p(this,K,a(this.parent,K)):p(this,K,Jr(h.fs))}get dev(){return a(this,Ne)}get mode(){return a(this,Le)}get nlink(){return a(this,Ae)}get uid(){return a(this,Be)}get gid(){return a(this,Ie)}get rdev(){return a(this,je)}get blksize(){return a(this,_e)}get ino(){return a(this,$e)}get size(){return a(this,We)}get blocks(){return a(this,Ue)}get atimeMs(){return a(this,ze)}get mtimeMs(){return a(this,qe)}get ctimeMs(){return a(this,Ge)}get birthtimeMs(){return a(this,He)}get atime(){return a(this,Qe)}get mtime(){return a(this,Ke)}get ctime(){return a(this,Ve)}get birthtime(){return a(this,Je)}get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}depth(){return a(this,Gt)!==void 0?a(this,Gt):this.parent?p(this,Gt,this.parent.depth()+1):p(this,Gt,0)}childrenCache(){return a(this,Ht)}resolve(t){var n;if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?b(n=this.getRoot(e),k,ii).call(n,i):b(this,k,ii).call(this,i)}children(){let t=a(this,Ht).get(this);if(t)return t;let e=Object.assign([],{provisional:0});return a(this,Ht).set(this,e),p(this,S,a(this,S)&~ti),e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),i=this.nocase?ks(t):Pe(t);for(let l of s)if(a(l,Ft)===i)return l;let o=this.parent?this.sep:"",n=a(this,pt)?a(this,pt)+o+t:void 0,h=this.newChild(t,st,{...e,parent:this,fullpath:n});return this.canReaddir()||p(h,S,a(h,S)|nt),s.push(h),h}relative(){if(this.isCWD)return"";if(a(this,St)!==void 0)return a(this,St);let t=this.name,e=this.parent;if(!e)return p(this,St,this.name);let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(a(this,Ct)!==void 0)return a(this,Ct);let t=this.name,e=this.parent;if(!e)return p(this,Ct,this.fullpathPosix());let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(a(this,pt)!==void 0)return a(this,pt);let t=this.name,e=this.parent;if(!e)return p(this,pt,this.name);let i=e.fullpath()+(e.parent?this.sep:"")+t;return p(this,pt,i)}fullpathPosix(){if(a(this,kt)!==void 0)return a(this,kt);if(this.sep==="/")return p(this,kt,this.fullpath());if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?p(this,kt,`//?/${i}`):p(this,kt,i)}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return p(this,kt,s)}isUnknown(){return(a(this,S)&et)===st}isType(t){return this[`is${t}`]()}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(a(this,S)&et)===eo}isDirectory(){return(a(this,S)&et)===ut}isCharacterDevice(){return(a(this,S)&et)===Xr}isBlockDevice(){return(a(this,S)&et)===to}isFIFO(){return(a(this,S)&et)===Zr}isSocket(){return(a(this,S)&et)===so}isSymbolicLink(){return(a(this,S)&qt)===qt}lstatCached(){return a(this,S)&Gr?this:void 0}readlinkCached(){return a(this,xt)}realpathCached(){return a(this,dt)}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(a(this,xt))return!0;if(!this.parent)return!1;let t=a(this,S)&et;return!(t!==st&&t!==qt||a(this,S)&bs||a(this,S)&nt)}calledReaddir(){return!!(a(this,S)&ti)}isENOENT(){return!!(a(this,S)&nt)}isNamed(t){return this.nocase?a(this,Ft)===ks(t):a(this,Ft)===Pe(t)}async readlink(){var e;let t=a(this,xt);if(t)return t;if(this.canReadlink()&&this.parent)try{let s=await a(this,K).promises.readlink(this.fullpath()),i=(e=await this.parent.realpath())==null?void 0:e.resolve(s);if(i)return p(this,xt,i)}catch(s){b(this,k,ai).call(this,s.code);return}}readlinkSync(){var e;let t=a(this,xt);if(t)return t;if(this.canReadlink()&&this.parent)try{let s=a(this,K).readlinkSync(this.fullpath()),i=(e=this.parent.realpathSync())==null?void 0:e.resolve(s);if(i)return p(this,xt,i)}catch(s){b(this,k,ai).call(this,s.code);return}}async lstat(){if(!(a(this,S)&nt))try{return b(this,k,hi).call(this,await a(this,K).promises.lstat(this.fullpath())),this}catch(t){b(this,k,ni).call(this,t.code)}}lstatSync(){if(!(a(this,S)&nt))try{return b(this,k,hi).call(this,a(this,K).lstatSync(this.fullpath())),this}catch(t){b(this,k,ni).call(this,t.code)}}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let o=s.slice(0,s.provisional);e?t(null,o):queueMicrotask(()=>t(null,o));return}if(a(this,se).push(t),a(this,ie))return;p(this,ie,!0);let i=this.fullpath();a(this,K).readdir(i,{withFileTypes:!0},(o,n)=>{if(o)b(this,k,xs).call(this,o.code),s.provisional=0;else{for(let h of n)b(this,k,Es).call(this,h,s);b(this,k,Cs).call(this,s)}b(this,k,ao).call(this,s.slice(0,s.provisional))})}async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(a(this,Qt))await a(this,Qt);else{let s=()=>{};p(this,Qt,new Promise(i=>s=i));try{for(let i of await a(this,K).promises.readdir(e,{withFileTypes:!0}))b(this,k,Es).call(this,i,t);b(this,k,Cs).call(this,t)}catch(i){b(this,k,xs).call(this,i.code),t.provisional=0}p(this,Qt,void 0),s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let s of a(this,K).readdirSync(e,{withFileTypes:!0}))b(this,k,Es).call(this,s,t);b(this,k,Cs).call(this,t)}catch(s){b(this,k,xs).call(this,s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(a(this,S)&Hr)return!1;let t=et&a(this,S);return t===st||t===ut||t===qt}shouldWalk(t,e){return(a(this,S)&ut)===ut&&!(a(this,S)&Hr)&&!t.has(this)&&(!e||e(this))}async realpath(){if(a(this,dt))return a(this,dt);if(!((Ss|bs|nt)&a(this,S)))try{let t=await a(this,K).promises.realpath(this.fullpath());return p(this,dt,this.resolve(t))}catch(t){b(this,k,oi).call(this)}}realpathSync(){if(a(this,dt))return a(this,dt);if(!((Ss|bs|nt)&a(this,S)))try{let t=a(this,K).realpathSync(this.fullpath());return p(this,dt,this.resolve(t))}catch(t){b(this,k,oi).call(this)}}[io](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),p(i,St,s.join(this.sep)),p(i,Ct,s.join("/")),i=i.parent,s.push("..");for(i=t;i&&i.parent&&!e.has(i);)p(i,St,void 0),p(i,Ct,void 0),i=i.parent}};K=new WeakMap,Ne=new WeakMap,Le=new WeakMap,Ae=new WeakMap,Be=new WeakMap,Ie=new WeakMap,je=new WeakMap,_e=new WeakMap,$e=new WeakMap,We=new WeakMap,Ue=new WeakMap,ze=new WeakMap,qe=new WeakMap,Ge=new WeakMap,He=new WeakMap,Qe=new WeakMap,Ke=new WeakMap,Ve=new WeakMap,Je=new WeakMap,Ft=new WeakMap,Gt=new WeakMap,pt=new WeakMap,kt=new WeakMap,St=new WeakMap,Ct=new WeakMap,S=new WeakMap,Ht=new WeakMap,xt=new WeakMap,dt=new WeakMap,k=new WeakSet,ii=function(t){let e=this;for(let s of t)e=e.child(s);return e},Cs=function(t){var e;p(this,S,a(this,S)|ti);for(let s=t.provisional;s<t.length;s++){let i=t[s];i&&b(e=i,k,De).call(e)}},De=function(){a(this,S)&nt||(p(this,S,(a(this,S)|nt)&Re),b(this,k,ri).call(this))},ri=function(){var e;let t=this.children();t.provisional=0;for(let s of t)b(e=s,k,De).call(e)},oi=function(){p(this,S,a(this,S)|Ss),b(this,k,Me).call(this)},Me=function(){if(a(this,S)&Oe)return;let t=a(this,S);(t&et)===ut&&(t&=Re),p(this,S,t|Oe),b(this,k,ri).call(this)},xs=function(t=""){t==="ENOTDIR"||t==="EPERM"?b(this,k,Me).call(this):t==="ENOENT"?b(this,k,De).call(this):this.children().provisional=0},ni=function(t=""){var e;if(t==="ENOTDIR"){let s=this.parent;b(e=s,k,Me).call(e)}else t==="ENOENT"&&b(this,k,De).call(this)},ai=function(t=""){var s;let e=a(this,S);e|=bs,t==="ENOENT"&&(e|=nt),(t==="EINVAL"||t==="UNKNOWN")&&(e&=Re),p(this,S,e),t==="ENOTDIR"&&this.parent&&b(s=this.parent,k,Me).call(s)},Es=function(t,e){return b(this,k,oo).call(this,t,e)||b(this,k,ro).call(this,t,e)},ro=function(t,e){let s=ei(t),i=this.newChild(t.name,s,{parent:this}),o=a(i,S)&et;return o!==ut&&o!==qt&&o!==st&&p(i,S,a(i,S)|Oe),e.unshift(i),e.provisional++,i},oo=function(t,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?ks(t.name):Pe(t.name))===a(i,Ft))return b(this,k,no).call(this,t,i,s,e)}},no=function(t,e,s,i){let o=e.name;return p(e,S,a(e,S)&Re|ei(t)),o!==t.name&&(e.name=t.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e},hi=function(t){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:o,blksize:n,blocks:h,ctime:l,ctimeMs:c,dev:u,gid:m,ino:d,mode:y,mtime:R,mtimeMs:g,nlink:x,rdev:C,size:T,uid:O}=t;p(this,Qe,e),p(this,ze,s),p(this,Je,i),p(this,He,o),p(this,_e,n),p(this,Ue,h),p(this,Ve,l),p(this,Ge,c),p(this,Ne,u),p(this,Ie,m),p(this,$e,d),p(this,Le,y),p(this,Ke,R),p(this,qe,g),p(this,Ae,x),p(this,je,C),p(this,We,T),p(this,Be,O);let L=ei(t);p(this,S,a(this,S)&Re|L|Gr),L!==st&&L!==ut&&L!==qt&&p(this,S,a(this,S)|Oe)},se=new WeakMap,ie=new WeakMap,ao=function(t){p(this,ie,!1);let e=a(this,se).slice();a(this,se).length=0,e.forEach(s=>s(null,t))},Qt=new WeakMap;Rs=class r extends q{constructor(e,s=st,i,o,n,h,l){super(e,s,i,o,n,h,l);f(this,"sep","\\");f(this,"splitSep",ya)}newChild(e,s=st,i={}){return new r(e,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return ne.win32.parse(e).root}getRoot(e){if(e=wa(e.toUpperCase()),e===this.root.name)return this.root;for(let[s,i]of Object.entries(this.roots))if(this.sameRoot(e,s))return this.roots[e]=i;return this.roots[e]=new ae(e,this).root}sameRoot(e,s=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(Yr,"$1\\"),e===s}},Ts=class r extends q{constructor(e,s=st,i,o,n,h,l){super(e,s,i,o,n,h,l);f(this,"splitSep","/");f(this,"sep","/")}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,s=st,i={}){return new r(e,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}},Os=class{constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:o=16*1024,fs:n=Te}={}){f(this,"root");f(this,"rootPath");f(this,"roots");f(this,"cwd");w(this,re);w(this,oe);w(this,Ye);f(this,"nocase");w(this,Ze);p(this,Ze,Jr(n)),(t instanceof URL||t.startsWith("file://"))&&(t=(0,Vr.fileURLToPath)(t));let h=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(h),p(this,re,new vs),p(this,oe,new vs),p(this,Ye,new si(o));let l=h.substring(this.rootPath.length).split(s);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(a(this,Ze)),this.roots[this.rootPath]=this.root;let c=this.root,u=l.length-1,m=e.sep,d=this.rootPath,y=!1;for(let R of l){let g=u--;c=c.child(R,{relative:new Array(g).fill("..").join(m),relativePosix:new Array(g).fill("..").join("/"),fullpath:d+=(y?"":m)+R}),y=!0}this.cwd=c}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return a(this,Ye)}resolve(...t){let e="";for(let o=t.length-1;o>=0;o--){let n=t[o];if(!(!n||n===".")&&(e=e?`${n}/${e}`:n,this.isAbsolute(n)))break}let s=a(this,re).get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return a(this,re).set(e,i),i}resolvePosix(...t){let e="";for(let o=t.length-1;o>=0;o--){let n=t[o];if(!(!n||n===".")&&(e=e?`${n}/${e}`:n,this.isAbsolute(n)))break}let s=a(this,oe).get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return a(this,oe).set(e,i),i}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let i=await t.readdir();return s?i:i.map(o=>o.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(i=>i.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s==null?void 0:s.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s==null?void 0:s.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s==null?void 0:s.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s==null?void 0:s.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:o,walkFilter:n}=e,h=[];(!o||o(t))&&h.push(s?t:t.fullpath());let l=new Set,c=(m,d)=>{l.add(m),m.readdirCB((y,R)=>{if(y)return d(y);let g=R.length;if(!g)return d();let x=()=>{--g===0&&d()};for(let C of R)(!o||o(C))&&h.push(s?C:C.fullpath()),i&&C.isSymbolicLink()?C.realpath().then(T=>T!=null&&T.isUnknown()?T.lstat():T).then(T=>T!=null&&T.shouldWalk(l,n)?c(T,x):x()):C.shouldWalk(l,n)?c(C,x):x()},!0)},u=t;return new Promise((m,d)=>{c(u,y=>{if(y)return d(y);m(h)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:o,walkFilter:n}=e,h=[];(!o||o(t))&&h.push(s?t:t.fullpath());let l=new Set([t]);for(let c of l){let u=c.readdirSync();for(let m of u){(!o||o(m))&&h.push(s?m:m.fullpath());let d=m;if(m.isSymbolicLink()){if(!(i&&(d=m.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(l,n)&&l.add(d)}}return h}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:o,walkFilter:n}=e;(!o||o(t))&&(yield s?t:t.fullpath());let h=new Set([t]);for(let l of h){let c=l.readdirSync();for(let u of c){(!o||o(u))&&(yield s?u:u.fullpath());let m=u;if(u.isSymbolicLink()){if(!(i&&(m=u.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(h,n)&&h.add(m)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:o,walkFilter:n}=e,h=new Mt({objectMode:!0});(!o||o(t))&&h.write(s?t:t.fullpath());let l=new Set,c=[t],u=0,m=()=>{let d=!1;for(;!d;){let y=c.shift();if(!y){u===0&&h.end();return}u++,l.add(y);let R=(x,C,T=!1)=>{if(x)return h.emit("error",x);if(i&&!T){let O=[];for(let L of C)L.isSymbolicLink()&&O.push(L.realpath().then(V=>V!=null&&V.isUnknown()?V.lstat():V));if(O.length){Promise.all(O).then(()=>R(null,C,!0));return}}for(let O of C)O&&(!o||o(O))&&(h.write(s?O:O.fullpath())||(d=!0));u--;for(let O of C){let L=O.realpathCached()||O;L.shouldWalk(l,n)&&c.push(L)}d&&!h.flowing?h.once("drain",m):g||m()},g=!0;y.readdirCB(R,!0),g=!1}};return m(),h}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof q||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:o,walkFilter:n}=e,h=new Mt({objectMode:!0}),l=new Set;(!o||o(t))&&h.write(s?t:t.fullpath());let c=[t],u=0,m=()=>{let d=!1;for(;!d;){let y=c.shift();if(!y){u===0&&h.end();return}u++,l.add(y);let R=y.readdirSync();for(let g of R)(!o||o(g))&&(h.write(s?g:g.fullpath())||(d=!0));u--;for(let g of R){let x=g;if(g.isSymbolicLink()){if(!(i&&(x=g.realpathSync())))continue;x.isUnknown()&&x.lstatSync()}x.shouldWalk(l,n)&&c.push(x)}}d&&!h.flowing&&h.once("drain",m)};return m(),h}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[io](e)}};re=new WeakMap,oe=new WeakMap,Ye=new WeakMap,Ze=new WeakMap;ae=class extends Os{constructor(e=process.cwd(),s={}){let{nocase:i=!0}=s;super(e,ne.win32,"\\",{...s,nocase:i});f(this,"sep","\\");this.nocase=i;for(let o=this.cwd;o;o=o.parent)o.nocase=this.nocase}parseRootPath(e){return ne.win32.parse(e).root.toUpperCase()}newRoot(e){return new Rs(this.rootPath,ut,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},he=class extends Os{constructor(e=process.cwd(),s={}){let{nocase:i=!1}=s;super(e,ne.posix,"/",{...s,nocase:i});f(this,"sep","/");this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new Ts(this.rootPath,ut,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Fe=class extends he{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},qh=process.platform==="win32"?Rs:Ts,ho=process.platform==="win32"?ae:process.platform==="darwin"?Fe:he});var ka,Sa,B,Z,W,Kt,at,Xe,Lt,At,Bt,le,ci,ce,fi=E(()=>{"use strict";Pt();ka=r=>r.length>=1,Sa=r=>r.length>=1,ci=class ci{constructor(t,e,s,i){w(this,B);w(this,Z);w(this,W);f(this,"length");w(this,Kt);w(this,at);w(this,Xe);w(this,Lt);w(this,At);w(this,Bt);w(this,le,!0);if(!ka(t))throw new TypeError("empty pattern list");if(!Sa(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(p(this,B,t),p(this,Z,e),p(this,W,s),p(this,Kt,i),a(this,W)===0){if(this.isUNC()){let[o,n,h,l,...c]=a(this,B),[u,m,d,y,...R]=a(this,Z);c[0]===""&&(c.shift(),R.shift());let g=[o,n,h,l,""].join("/"),x=[u,m,d,y,""].join("/");p(this,B,[g,...c]),p(this,Z,[x,...R]),this.length=a(this,B).length}else if(this.isDrive()||this.isAbsolute()){let[o,...n]=a(this,B),[h,...l]=a(this,Z);n[0]===""&&(n.shift(),l.shift());let c=o+"/",u=h+"/";p(this,B,[c,...n]),p(this,Z,[u,...l]),this.length=a(this,B).length}}}pattern(){return a(this,B)[a(this,W)]}isString(){return typeof a(this,B)[a(this,W)]=="string"}isGlobstar(){return a(this,B)[a(this,W)]===U}isRegExp(){return a(this,B)[a(this,W)]instanceof RegExp}globString(){return p(this,Xe,a(this,Xe)||(a(this,W)===0?this.isAbsolute()?a(this,Z)[0]+a(this,Z).slice(1).join("/"):a(this,Z).join("/"):a(this,Z).slice(a(this,W)).join("/")))}hasMore(){return this.length>a(this,W)+1}rest(){return a(this,at)!==void 0?a(this,at):this.hasMore()?(p(this,at,new ci(a(this,B),a(this,Z),a(this,W)+1,a(this,Kt))),p(a(this,at),Bt,a(this,Bt)),p(a(this,at),At,a(this,At)),p(a(this,at),Lt,a(this,Lt)),a(this,at)):p(this,at,null)}isUNC(){let t=a(this,B);return a(this,At)!==void 0?a(this,At):p(this,At,a(this,Kt)==="win32"&&a(this,W)===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3])}isDrive(){let t=a(this,B);return a(this,Lt)!==void 0?a(this,Lt):p(this,Lt,a(this,Kt)==="win32"&&a(this,W)===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]))}isAbsolute(){let t=a(this,B);return a(this,Bt)!==void 0?a(this,Bt):p(this,Bt,t[0]===""&&t.length>1||this.isDrive()||this.isUNC())}root(){let t=a(this,B)[0];return typeof t=="string"&&this.isAbsolute()&&a(this,W)===0?t:""}checkFollowGlobstar(){return!(a(this,W)===0||!this.isGlobstar()||!a(this,le))}markFollowGlobstar(){return a(this,W)===0||!this.isGlobstar()||!a(this,le)?!1:(p(this,le,!1),!0)}};B=new WeakMap,Z=new WeakMap,W=new WeakMap,Kt=new WeakMap,at=new WeakMap,Xe=new WeakMap,Lt=new WeakMap,At=new WeakMap,Bt=new WeakMap,le=new WeakMap;ce=ci});var Ca,fe,ui=E(()=>{"use strict";Pt();fi();Ca=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",fe=class{constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:o,platform:n=Ca}){f(this,"relative");f(this,"relativeChildren");f(this,"absolute");f(this,"absoluteChildren");f(this,"platform");f(this,"mmopts");this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=n,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:o,optimizationLevel:2,platform:n,nocomment:!0,nonegate:!0};for(let h of t)this.add(h)}add(t){let e=new J(t,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],o=e.globParts[s];if(!i||!o)throw new Error("invalid pattern object");for(;i[0]==="."&&o[0]===".";)i.shift(),o.shift();let n=new ce(i,o,0,this.platform),h=new J(n.globString(),this.mmopts),l=o[o.length-1]==="**",c=n.isAbsolute();c?this.absolute.push(h):this.relative.push(h),l&&(c?this.absoluteChildren.push(h):this.relativeChildren.push(h))}}ignored(t){let e=t.fullpath(),s=`${e}/`,i=t.relative()||".",o=`${i}/`;for(let n of this.relative)if(n.match(i)||n.match(o))return!0;for(let n of this.absolute)if(n.match(e)||n.match(s))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}}});var pi,di,mi,ts,co=E(()=>{"use strict";Pt();pi=class r{constructor(t=new Map){f(this,"store");this.store=t}copy(){return new r(new Map(this.store))}hasWalked(t,e){var s;return(s=this.store.get(t.fullpath()))==null?void 0:s.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),i=this.store.get(s);i?i.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},di=class{constructor(){f(this,"store",new Map)}add(t,e,s){let i=(e?2:0)|(s?1:0),o=this.store.get(t);this.store.set(t,o===void 0?i:i&o)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},mi=class{constructor(){f(this,"store",new Map)}add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(i=>i.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},ts=class r{constructor(t,e){f(this,"hasWalkedCache");f(this,"matches",new di);f(this,"subwalks",new mi);f(this,"patterns");f(this,"follow");f(this,"dot");f(this,"opts");this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new pi}processPatterns(t,e){this.patterns=e;let s=e.map(i=>[t,i]);for(let[i,o]of s){this.hasWalkedCache.storeWalked(i,o);let n=o.root(),h=o.isAbsolute()&&this.opts.absolute!==!1;if(n){i=i.resolve(n==="/"&&this.opts.root!==void 0?this.opts.root:n);let m=o.rest();if(m)o=m;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,c,u=!1;for(;typeof(l=o.pattern())=="string"&&(c=o.rest());)i=i.resolve(l),o=c,u=!0;if(l=o.pattern(),c=o.rest(),u){if(this.hasWalkedCache.hasWalked(i,o))continue;this.hasWalkedCache.storeWalked(i,o)}if(typeof l=="string"){let m=l===".."||l===""||l===".";this.matches.add(i.resolve(l),h,m);continue}else if(l===U){(!i.isSymbolicLink()||this.follow||o.checkFollowGlobstar())&&this.subwalks.add(i,o);let m=c==null?void 0:c.pattern(),d=c==null?void 0:c.rest();if(!c||(m===""||m===".")&&!d)this.matches.add(i,h,m===""||m===".");else if(m===".."){let y=i.parent||i;d?this.hasWalkedCache.hasWalked(y,d)||this.subwalks.add(y,d):this.matches.add(y,h,!0)}}else l instanceof RegExp&&this.subwalks.add(i,o)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new r(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),i=this.child();for(let o of e)for(let n of s){let h=n.isAbsolute(),l=n.pattern(),c=n.rest();l===U?i.testGlobstar(o,n,c,h):l instanceof RegExp?i.testRegExp(o,l,c,h):i.testString(o,l,c,h)}return i}testGlobstar(t,e,s,i){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,i,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let o=s.pattern();if(typeof o=="string"&&o!==".."&&o!==""&&o!==".")this.testString(t,o,s.rest(),i);else if(o===".."){let n=t.parent||t;this.subwalks.add(n,s)}else o instanceof RegExp&&this.testRegExp(t,o,s.rest(),i)}}testRegExp(t,e,s,i){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}testString(t,e,s,i){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}}});var xa,ue,Et,Jt,it,Vt,gi,Ps,es,ss,fo=E(()=>{"use strict";Xs();ui();co();xa=(r,t)=>typeof r=="string"?new fe([r],t):Array.isArray(r)?new fe(r,t):r,Ps=class{constructor(t,e,s){w(this,it);f(this,"path");f(this,"patterns");f(this,"opts");f(this,"seen",new Set);f(this,"paused",!1);f(this,"aborted",!1);w(this,ue,[]);w(this,Et);w(this,Jt);f(this,"signal");f(this,"maxDepth");f(this,"includeChildMatches");var i;if(this.patterns=t,this.path=e,this.opts=s,p(this,Jt,!s.posix&&s.platform==="win32"?"\\":"/"),this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(p(this,Et,xa((i=s.ignore)!=null?i:[],s)),!this.includeChildMatches&&typeof a(this,Et).add!="function")){let o="cannot ignore child matches, ignore lacks add() method.";throw new Error(o)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{a(this,ue).length=0}))}pause(){this.paused=!0}resume(){var e;if((e=this.signal)!=null&&e.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=a(this,ue).shift());)t()}onResume(t){var e;(e=this.signal)!=null&&e.aborted||(this.paused?a(this,ue).push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let o=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&(o!=null&&o.isSymbolicLink())){let n=await o.realpath();n&&(n.isUnknown()||this.opts.stat)&&await n.lstat()}return this.matchCheckTest(o,e)}matchCheckTest(t,e){var s;return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!((s=t.realpathCached())!=null&&s.isDirectory()))&&!b(this,it,Vt).call(this,t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let o=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&(o!=null&&o.isSymbolicLink())){let n=o.realpathSync();n&&(n!=null&&n.isUnknown()||this.opts.stat)&&n.lstatSync()}return this.matchCheckTest(o,e)}matchFinish(t,e){var o;if(b(this,it,Vt).call(this,t))return;if(!this.includeChildMatches&&((o=a(this,Et))!=null&&o.add)){let n=`${t.relativePosix()}/**`;a(this,Et).add(n)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let i=this.opts.mark&&t.isDirectory()?a(this,Jt):"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let n=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(n+i)}else{let n=this.opts.posix?t.relativePosix():t.relative(),h=this.opts.dotRelative&&!n.startsWith(".."+a(this,Jt))?"."+a(this,Jt):"";this.matchEmit(n?h+n+i:"."+i)}}async match(t,e,s){let i=await this.matchCheck(t,s);i&&this.matchFinish(i,e)}matchSync(t,e,s){let i=this.matchCheckSync(t,s);i&&this.matchFinish(i,e)}walkCB(t,e,s){var i;(i=this.signal)!=null&&i.aborted&&s(),this.walkCB2(t,e,new ts(this.opts),s)}walkCB2(t,e,s,i){var h;if(b(this,it,gi).call(this,t))return i();if((h=this.signal)!=null&&h.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,i));return}s.processPatterns(t,e);let o=1,n=()=>{--o===0&&i()};for(let[l,c,u]of s.matches.entries())b(this,it,Vt).call(this,l)||(o++,this.match(l,c,u).then(()=>n()));for(let l of s.subwalkTargets()){if(this.maxDepth!==1/0&&l.depth()>=this.maxDepth)continue;o++;let c=l.readdirCached();l.calledReaddir()?this.walkCB3(l,c,s,n):l.readdirCB((u,m)=>this.walkCB3(l,m,s,n),!0)}n()}walkCB3(t,e,s,i){s=s.filterEntries(t,e);let o=1,n=()=>{--o===0&&i()};for(let[h,l,c]of s.matches.entries())b(this,it,Vt).call(this,h)||(o++,this.match(h,l,c).then(()=>n()));for(let[h,l]of s.subwalks.entries())o++,this.walkCB2(h,l,s.child(),n);n()}walkCBSync(t,e,s){var i;(i=this.signal)!=null&&i.aborted&&s(),this.walkCB2Sync(t,e,new ts(this.opts),s)}walkCB2Sync(t,e,s,i){var h;if(b(this,it,gi).call(this,t))return i();if((h=this.signal)!=null&&h.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,i));return}s.processPatterns(t,e);let o=1,n=()=>{--o===0&&i()};for(let[l,c,u]of s.matches.entries())b(this,it,Vt).call(this,l)||this.matchSync(l,c,u);for(let l of s.subwalkTargets()){if(this.maxDepth!==1/0&&l.depth()>=this.maxDepth)continue;o++;let c=l.readdirSync();this.walkCB3Sync(l,c,s,n)}n()}walkCB3Sync(t,e,s,i){s=s.filterEntries(t,e);let o=1,n=()=>{--o===0&&i()};for(let[h,l,c]of s.matches.entries())b(this,it,Vt).call(this,h)||this.matchSync(h,l,c);for(let[h,l]of s.subwalks.entries())o++,this.walkCB2Sync(h,l,s.child(),n);n()}};ue=new WeakMap,Et=new WeakMap,Jt=new WeakMap,it=new WeakSet,Vt=function(t){var e,s;return this.seen.has(t)||!!((s=(e=a(this,Et))==null?void 0:e.ignored)!=null&&s.call(e,t))},gi=function(t){var e,s;return!!((s=(e=a(this,Et))==null?void 0:e.childrenIgnored)!=null&&s.call(e,t))};es=class extends Ps{constructor(e,s,i){super(e,s,i);f(this,"matches",new Set)}matchEmit(e){this.matches.add(e)}async walk(){var e;if((e=this.signal)!=null&&e.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,i)=>{this.walkCB(this.path,this.patterns,()=>{var o;(o=this.signal)!=null&&o.aborted?i(this.signal.reason):s(this.matches)})}),this.matches}walkSync(){var e;if((e=this.signal)!=null&&e.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{var s;if((s=this.signal)!=null&&s.aborted)throw this.signal.reason}),this.matches}},ss=class extends Ps{constructor(e,s,i){super(e,s,i);f(this,"results");this.results=new Mt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}});var uo,Ea,ht,wi=E(()=>{"use strict";Pt();uo=require("url");lo();fi();fo();Ea=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ht=class{constructor(t,e){f(this,"absolute");f(this,"cwd");f(this,"root");f(this,"dot");f(this,"dotRelative");f(this,"follow");f(this,"ignore");f(this,"magicalBraces");f(this,"mark");f(this,"matchBase");f(this,"maxDepth");f(this,"nobrace");f(this,"nocase");f(this,"nodir");f(this,"noext");f(this,"noglobstar");f(this,"pattern");f(this,"platform");f(this,"realpath");f(this,"scurry");f(this,"stat");f(this,"signal");f(this,"windowsPathsNoEscape");f(this,"withFileTypes");f(this,"includeChildMatches");f(this,"opts");f(this,"patterns");if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,uo.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=t,this.platform=e.platform||Ea,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=e.platform==="win32"?ae:e.platform==="darwin"?Fe:e.platform?he:ho;this.scurry=new l(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},o=this.pattern.map(l=>new J(l,i)),[n,h]=o.reduce((l,c)=>(l[0].push(...c.set),l[1].push(...c.globParts),l),[[],[]]);this.patterns=n.map((l,c)=>{let u=h[c];if(!u)throw new Error("invalid pattern object");return new ce(l,u,0,this.platform)})}async walk(){return[...await new es(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 es(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 ss(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 ss(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 yi,bi=E(()=>{"use strict";Pt();yi=(r,t={})=>{Array.isArray(r)||(r=[r]);for(let e of r)if(new J(e,t).hasMagic())return!0;return!1}});function Ds(r,t={}){return new ht(r,t).streamSync()}function go(r,t={}){return new ht(r,t).stream()}function wo(r,t={}){return new ht(r,t).walkSync()}async function po(r,t={}){return new ht(r,t).walk()}function Ms(r,t={}){return new ht(r,t).iterateSync()}function yo(r,t={}){return new ht(r,t).iterate()}var va,Ra,Ta,Oa,is,mo,ki=E(()=>{"use strict";Pt();wi();bi();Pt();wi();bi();ui();va=Ds,Ra=Object.assign(go,{sync:Ds}),Ta=Ms,Oa=Object.assign(yo,{sync:Ms}),is=Object.assign(wo,{stream:Ds,iterate:Ms}),mo=Object.assign(po,{glob:po,globSync:wo,sync:is,globStream:go,stream:Ra,globStreamSync:Ds,streamSync:va,globIterate:yo,iterate:Oa,globIterateSync:Ms,iterateSync:Ta,Glob:ht,hasMagic:yi,escape:Xt,unescape:rt});mo.glob=mo});function bo(){let r=is("./**/Cookies",{cwd:Yt,absolute:!0});return Ma.debug("Found cookie files:",r),r}var Pa,Da,Ma,ko=E(()=>{"use strict";Pa=require("fs"),Da=require("path");ki();gt();js();Ma=D.withTag("listChromeProfiles")});function La(r){var e;let t=[/.*?0t(.+)$/,/.*?1e`(.+)$/,/.*?[`'](.+)$/,/[^\x20-\x7E]*([\x20-\x7E].+)$/];for(let s of t){let i=r.match(s),o=(e=i==null?void 0:i[1])!=null?e:"";if(o.length>0)return o}return r}async function So(r,t){if(typeof t!="string")throw new Error("password must be a string");if(!Buffer.isBuffer(r))throw new Error("encryptedData must be a Buffer");return new Promise((e,s)=>{(0,Fs.pbkdf2)(t,"saltysalt",1003,16,"sha1",(i,o)=>{try{if(i){s(new Error("Failed to derive key: "+i.message));return}let n=Fa(r);if(n.length%16!==0){s(new Error("Encrypted data length is not a multiple of 16"));return}let h=Buffer.alloc(16," "),l=(0,Fs.createDecipheriv)("aes-128-cbc",o,h);l.setAutoPadding(!1);let c=l.update(n);try{l.final()}catch(m){s(new Error("Failed to finalize decryption: "+m.message));return}c=Na(c);let u=c.toString("utf8");e(La(u))}catch(n){s(new Error("Decryption failed: "+n.message))}})})}var Fs,Si,Fa,Na,Co=E(()=>{"use strict";Fs=require("crypto"),Si=require("lodash-es"),Fa=(0,Si.memoize)(r=>r.length>=3&&r[0]===118&&r[1]===49&&r[2]===48?r.slice(3):r,r=>r.toString("hex")),Na=(0,Si.memoize)(r=>{let t=r[r.length-1];return t&&t<=16?r.slice(0,-t):r},r=>r.toString("hex"))});function Ba(r,t){if(r instanceof It)throw F("Command execution failed",r,{command:r.command,originalError:r.originalError}),r;if(r instanceof Error){let s=new It(r.message,t,r);throw F("Failed to execute command",r,{command:t,stack:r.stack}),s}let e=new It("Unknown error occurred during command execution",t);throw F("Failed to execute command",null,{error:r,command:t}),e}async function vo(r,t={}){if(!r||typeof r!="string")throw new It("Command must be a non-empty string",r);let e={encoding:"utf8",maxBuffer:5*1024*1024,timeout:3e4};try{let{stdout:s,stderr:i}=await Aa(r,{...e,...t}),o=s.trim();if(!o)throw i?new It(`Command failed with stderr: ${i}`,r):new It("Command returned empty result",r);return o}catch(s){Ba(s,r)}}var xo,Eo,Aa,It,Ro=E(()=>{"use strict";xo=require("child_process"),Eo=require("util");vt();Aa=(0,Eo.promisify)(xo.exec),It=class extends Error{constructor(e,s,i){super(e);this.command=s;this.originalError=i;this.name="CommandExecutionError"}}});var Oo={};_t(Oo,{getChromePassword:()=>ja});var To,Ia,ja,Po=E(()=>{"use strict";To=require("lodash-es");Ro();Ia=async()=>vo('security find-generic-password -w -s "Chrome Safe Storage"'),ja=(0,To.memoize)(Ia)});var Do,Mo,Fo=E(()=>{"use strict";Do=require("lodash-es");vt();Mo=(0,Do.memoize)(async()=>{if(process.platform!=="darwin")throw F("Chrome password retrieval failed",new Error("This only works on macOS"),{platform:process.platform}),new Error("This only works on macOS");try{let{getChromePassword:r}=await Promise.resolve().then(()=>(Po(),Oo)),t=await r();return lt("ChromePassword","Retrieved password successfully",{platform:"macOS"}),t}catch(r){throw F("Chrome password retrieval failed",r,{platform:"macOS"}),r}})});function _a(r){return typeof r!="number"||r<=0?"Infinity":new Date(r)}function No(r,t,e,s,i,o){return{domain:r,name:t,value:e,expiry:_a(s),meta:{file:i,browser:"Chrome",decrypted:o}}}var pe,Ci=E(()=>{"use strict";vt();Gi();ko();Co();Fo();pe=class{constructor(){this.logger=Li("ChromeCookieQueryStrategy");this.browserName="Chrome"}async queryCookies(t,e){try{if(this.logger.info("Querying cookies",{name:t,domain:e}),process.platform!=="darwin")return this.logger.warn("Platform not supported",{platform:process.platform}),[];let s=bo();if(s.length===0)return this.logger.warn("No Chrome cookie files found"),[];let i=await Mo();return(await Promise.all(s.map(n=>this.processFile(n,t,e,i)))).flat()}catch(s){return s instanceof Error?F("Failed to query cookies",s,{name:t,domain:e}):F("Failed to query cookies",new Error(String(s)),{name:t,domain:e}),[]}}async processFile(t,e,s,i){try{let o=await qi({name:e,domain:s,file:t}),n={file:t,password:i};return(await Promise.allSettled(o.map(l=>this.processCookie(l,n)))).map(l=>l.status==="fulfilled"?l.value:null).filter(l=>l!==null)}catch(o){return o instanceof Error?this.logger.error("Failed to process cookie file",{error:o,file:t}):this.logger.error("Failed to process cookie file",{error:String(o),file:t}),[]}}async processCookie(t,e){try{let s=Buffer.isBuffer(t.value)?t.value:Buffer.from(String(t.value)),i=await So(s,e.password);return No(t.domain,t.name,i,t.expiry,e.file,!0)}catch(s){return s instanceof Error?this.logger.warn("Failed to decrypt cookie",{error:s}):this.logger.warn("Failed to decrypt cookie",{error:String(s)}),No(t.domain,t.name,t.value.toString("utf-8"),t.expiry,e.file,!1)}}}});function $a(){let r=[],t=process.env.HOME;if(typeof t!="string"||t.length===0)return os("FirefoxCookieQuery","HOME environment variable not set"),r;let e=[(0,xi.join)(t,"Library/Application Support/Firefox/Profiles/*/cookies.sqlite"),(0,xi.join)(t,".mozilla/firefox/*/cookies.sqlite")];for(let s of e){let i=is(s);r.push(...i)}return lt("FirefoxCookieQuery","Found Firefox cookie files",{files:r}),r}var xi,de,Ei=E(()=>{"use strict";xi=require("path");ki();vt();_s();de=class{constructor(){this.browserName="Firefox"}async queryCookies(t,e){let s=$a(),i=[];for(let o of s)try{let n=await as({file:o,sql:"SELECT name, value, host as domain, expiry FROM moz_cookies WHERE name = ? AND host LIKE ?",params:[t,`%${e}%`],rowTransform:h=>({name:h.name,value:h.value,domain:h.domain,expiry:h.expiry>0?new Date(h.expiry*1e3):"Infinity",meta:{file:o,browser:"Firefox",decrypted:!1}})});i.push(...n)}catch(n){n instanceof Error?os("FirefoxCookieQuery",`Error reading Firefox cookie file ${o}`,{error:n.message}):os("FirefoxCookieQuery",`Error reading Firefox cookie file ${o}`)}return i}}});function Ns(r,t){let e=t;for(;e<r.length&&r[e]!==0;)e++;return[r.toString("utf8",t,e),e+1]}function qa(r,t){let e=r.readUInt32LE(t),s=t+43,o=r.readUInt32LE(s)-za,n=t+56,[h,l]=Ns(r,n);n=l;let[c,u]=Ns(r,n);n=u;let[m,d]=Ns(r,n);n=d;let[y,R]=Ns(r,n);return[{name:c,value:y,domain:h.startsWith(".")?h.slice(1):h,path:m||"/",expiry:o,creation:o},e]}function Ga(r,t,e){let s=t+5,i=r.readUInt32BE(s),o=t+i,n=[],h=t+e;for(;o<h-8;)try{let[l,c]=qa(r,o);n.push(l),o+=c}catch(l){console.warn(`Error decoding cookie at offset ${o}:`,l);break}return n}function Ao(r){let t=(0,Lo.readFileSync)(r),e=t.readUInt32BE(4),s=[];for(let n=0;n<e;n++)s.push(t.readUInt32BE(8+n*4));let i=8+e*4,o=[];for(let n=0;n<e;n++)try{let h=Ga(t,i,s[n]);o.push(...h),i+=s[n]}catch(h){console.warn(`Error decoding page ${n}:`,h),i+=s[n]}return o}var Lo,Wa,Ua,za,Bo=E(()=>{"use strict";Lo=require("fs"),Wa=require("os"),Ua=require("path"),za=1706047360});var Io,Ls,jo=E(()=>{"use strict";Io=require("path");vt();Bo();Ls=class{constructor(){this.browserName="Safari"}getHomeDir(){let t=process.env.HOME;return typeof t!="string"||t.trim().length===0?(F("SafariCookieQueryStrategy","HOME environment variable not set"),""):t}getCookieDbPath(t){return(0,Io.join)(t,"Library","Containers","com.apple.Safari","Data","Library","Cookies","Cookies.binarycookies")}decodeCookies(t,e,s){try{return Ao(t).filter(o=>o.name===e&&o.domain.includes(s)).map(o=>({domain:o.domain,name:o.name,value:o.value.toString(),expiry:typeof o.expiry=="number"&&o.expiry>0?new Date(o.expiry*1e3):"Infinity",meta:{file:t,browser:"Safari",decrypted:!1}}))}catch(i){return i instanceof Error?F("SafariCookieQueryStrategy",`Error decoding ${t}`,{error:i,name:e,domain:s}):F("SafariCookieQueryStrategy",`Error decoding ${t}`,{error:"Unknown error",name:e,domain:s}),[]}}async queryCookies(t,e){let s=this.getHomeDir();if(typeof s!="string"||s.length===0)return Promise.resolve([]);let i=this.getCookieDbPath(s);return Promise.resolve(this.decodeCookies(i,t,e))}}});async function _o(r){if(!r.name||!r.domain)return[];let{name:t,domain:e}=r;if(typeof t!="string"||typeof e!="string")return[];let s=[new pe,new de,new Ls];return(await Promise.allSettled(s.map(o=>o.queryCookies(t,e)))).filter(o=>o.status==="fulfilled").flatMap(o=>o.value)}var $o=E(()=>{"use strict";Ci();Ei();jo()});var Wo={};_t(Wo,{default:()=>Ha,getCookie:()=>me});async function me(r){try{return await _o(r)}catch(t){return D.warn("Error querying cookies:",t instanceof Error?t.message:String(t)),[]}}var Ha,As=E(()=>{"use strict";gt();$o();Ha=me});var zo={};_t(zo,{default:()=>Qa,getChromeCookie:()=>Uo});async function Uo(r){try{return await new pe().queryCookies(r.name,r.domain)}catch(t){return D.warn("Error querying Chrome cookies:",t),[]}}var Qa,qo=E(()=>{"use strict";gt();Ci();Qa=Uo});var Ho={};_t(Ho,{default:()=>Ka,getFirefoxCookie:()=>Go});async function Go(r){try{return await new de().queryCookies(r.name,r.domain)}catch(t){return D.warn("Error querying Firefox cookies:",t instanceof Error?t.message:String(t)),[]}}var Ka,Qo=E(()=>{"use strict";gt();Ei();Ka=Go});var v,oc,Va,rs,nc,ac,Ja,hc,vi=E(()=>{"use strict";v=require("zod"),oc=v.z.object({name:v.z.string().trim().min(1,"Cookie name cannot be empty"),domain:v.z.string().trim().min(1,"Domain cannot be empty")}).strict(),Va=v.z.object({file:v.z.string().trim().min(1,"File path cannot be empty").optional(),browser:v.z.string().trim().optional(),decrypted:v.z.boolean().optional(),secure:v.z.boolean().optional(),httpOnly:v.z.boolean().optional(),path:v.z.string().optional()}).catchall(v.z.unknown()).strict(),rs=v.z.object({domain:v.z.string().trim().min(1,"Domain cannot be empty"),name:v.z.string().trim().min(1,"Cookie name cannot be empty"),value:v.z.string(),expiry:v.z.union([v.z.literal("Infinity"),v.z.date(),v.z.number().int().positive("Expiry must be a positive number")]).optional(),meta:Va.optional()}).strict(),nc=v.z.object({expiry:v.z.number().int().optional(),domain:v.z.string().trim().min(1,"Domain cannot be empty"),name:v.z.string().trim().min(1,"Cookie name cannot be empty"),value:v.z.union([v.z.string(),v.z.instanceof(Buffer)])}).strict(),ac=v.z.object({format:v.z.enum(["merged","grouped"]).optional(),separator:v.z.string().optional(),showFilePaths:v.z.boolean().optional()}).strict(),Ja=v.z.enum(["Chrome","Firefox","Safari","internal","unknown"]),hc=v.z.object({browserName:Ja,queryCookies:v.z.function().args(v.z.string(),v.z.string()).returns(v.z.promise(v.z.array(rs)))}).strict()});function Bs(r,t={}){let{format:e="merged",showFilePaths:s=!0,separator:i="; "}=t;if(r.length===0)return e==="merged"?"":[];if(e==="merged")return r.map(n=>n.value).join(i);let o=(0,Ko.groupBy)(r,n=>{var h,l;return(l=(h=n.meta)==null?void 0:h.file)!=null?l:"unknown"});return Object.entries(o).map(([n,h])=>{let l=h.map(c=>c.value).join(i);return s?`${n}: ${l}`:l})}var Ko,Ri=E(()=>{"use strict";Ko=require("lodash-es")});var Jo={};_t(Jo,{default:()=>Ya,getGroupedRenderedCookies:()=>Vo});async function Vo(r,t={}){try{let e=await me(r);if(!Array.isArray(e))return[];let s=e.filter(i=>{let o=rs.safeParse(i);return o.success?!0:(D.warn("Invalid cookie format:",o.error.format()),!1)});return Bs(s,{...t,format:"grouped"})}catch(e){return D.warn("Error getting grouped rendered cookies:",e instanceof Error?e.message:String(e)),[]}}var Ya,Yo=E(()=>{"use strict";vi();gt();As();Ri();Ya=Vo});var Xo={};_t(Xo,{default:()=>Za,getMergedRenderedCookies:()=>Zo});async function Zo(r,t){try{let e=await me(r);if(!Array.isArray(e))return"";let s=e.filter(o=>{let n=rs.safeParse(o);return n.success?!0:(D.warn("Invalid cookie format:",n.error.format()),!1)}),i=Bs(s,{...t,format:"merged"});return typeof i=="string"?i:""}catch(e){return D.warn("Error getting merged rendered cookies:",e instanceof Error?e.message:String(e)),""}}var Za,tn=E(()=>{"use strict";vi();gt();As();Ri();Za=Zo});var rh={};_t(rh,{getChromeCookie:()=>th,getCookie:()=>Xa,getFirefoxCookie:()=>eh,getGroupedRenderedCookies:()=>sh,getMergedRenderedCookies:()=>ih});module.exports=ln(rh);var Xa=()=>Promise.resolve().then(()=>(As(),Wo)).then(r=>r.getCookie),th=()=>Promise.resolve().then(()=>(qo(),zo)).then(r=>r.getChromeCookie),eh=()=>Promise.resolve().then(()=>(Qo(),Ho)).then(r=>r.getFirefoxCookie),sh=()=>Promise.resolve().then(()=>(Yo(),Jo)).then(r=>r.getGroupedRenderedCookies),ih=()=>Promise.resolve().then(()=>(tn(),Xo)).then(r=>r.getMergedRenderedCookies);0&&(module.exports={getChromeCookie,getCookie,getFirefoxCookie,getGroupedRenderedCookies,getMergedRenderedCookies});
|
|
1
|
+
"use strict";var ga=Object.create;var si=Object.defineProperty;var wa=Object.getOwnPropertyDescriptor;var ya=Object.getOwnPropertyNames;var Sa=Object.getPrototypeOf,ba=Object.prototype.hasOwnProperty;var Fr=o=>{throw TypeError(o)};var Ea=(o,t,e)=>t in o?si(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var D=(o,t)=>()=>(o&&(t=o(o=0)),t);var Ar=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),ge=(o,t)=>{for(var e in t)si(o,e,{get:t[e],enumerable:!0})},Dr=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ya(t))!ba.call(o,s)&&s!==e&&si(o,s,{get:()=>t[s],enumerable:!(i=wa(t,s))||i.enumerable});return o};var De=(o,t,e)=>(e=o!=null?ga(Sa(o)):{},Dr(t||!o||!o.__esModule?si(e,"default",{value:o,enumerable:!0}):e,o)),Ca=o=>Dr(si({},"__esModule",{value:!0}),o);var u=(o,t,e)=>Ea(o,typeof t!="symbol"?t+"":t,e),Ls=(o,t,e)=>t.has(o)||Fr("Cannot "+e);var r=(o,t,e)=>(Ls(o,t,"read from private field"),e?e.call(o):t.get(o)),y=(o,t,e)=>t.has(o)?Fr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),f=(o,t,e,i)=>(Ls(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e),m=(o,t,e)=>(Ls(o,t,"access private method"),e);var Zi=(o,t,e,i)=>({set _(s){f(o,t,s,e)},get _(){return r(o,t,i)}});var _r,xa,N,jt=D(()=>{"use strict";_r=require("consola"),xa=(0,_r.createConsola)({fancy:!0,formatOptions:{showLogLevel:!1,colors:!0,date:!1,compact:!0,columns:typeof process.stdout.columns=="number"?process.stdout.columns:80},level:typeof process.env.LOG_LEVEL=="string"&&process.env.LOG_LEVEL==="debug"?5:2}),N=xa});function Pr(o,t,e){let s=`${t?"\u2705":"\u274C"} ${o} ${t?"succeeded":"failed"}`;t?N.success(s,e):N.error(s,e)}function z(o,t,e){let i={...e!=null?e:{},error:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t};N.error(o,i)}function Lt(o,t,e){N.withTag(o).debug(t,e)}function Lr(o){return N.withTag(o)}function Yi(o,t,e){N.withTag(o).warn(t,e)}var Yt=D(()=>{"use strict";jt();jt()});var Mr,Nr,Ji,Br=D(()=>{"use strict";Mr=require("lodash-es"),Nr={};(0,Mr.merge)(Nr,process.env);Ji=Nr.HOME;if(typeof Ji!="string"||Ji.length===0)throw new Error("HOME environment variable is not set or empty")});var zr,Ir,_e,Ms=D(()=>{"use strict";zr=require("path");Br();_e=(0,zr.join)((Ir=Ji)!=null?Ir:"","Library","Application Support","Google","Chrome")});function va(o){try{return o.close(),Promise.resolve()}catch(t){return z("Database close failed",t),Promise.reject(t instanceof Error?t:new Error("Failed to close database: Unknown error"))}}async function Xi({file:o,sql:t,params:e,rowFilter:i,rowTransform:s}){let n;try{n=await ka(o);let l=n.prepare(t).all(e),h=i?l.filter(i):l;return s?h.map(s):h}catch(a){throw z("Database query failed",a,{file:o,sql:t}),a}finally{n&&await va(n)}}var Wr,jr,ka,Ns=D(()=>{"use strict";Wr=De(require("better-sqlite3"),1),jr=require("lodash-es");Yt();ka=(0,jr.memoize)(o=>{try{return Promise.resolve(new Wr.default(o,{readonly:!0}))}catch(t){throw z("Database open failed",t,{file:o}),t}})});function Ra(o){if(typeof o!="string")return!1;let t=o.trim();return t.length===0?!1:(0,Ur.existsSync)(t)}async function Ta(){let o=[(0,ts.join)(_e,"Default/Cookies"),(0,ts.join)(_e,"Profile */Cookies"),(0,ts.join)(_e,"Profile Default/Cookies")],t=[];for(let e of o){let i=await(0,$r.default)(e);t.push(...i)}return Lt("ChromeCookies","Found cookie files",{count:t.length,files:t}),t}function Oa(o,t){let e=o==="%",i=e?"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE host_key LIKE ?":"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE name = ? AND host_key LIKE ?",s=e?[`%${t}%`]:[o,`%${t}%`];return{sql:i,params:s}}async function Fa(o,t,e){try{let{sql:i,params:s}=Oa(t,e);Lt("ChromeCookies","Executing query",{sql:i,params:s});let n=await Xi({file:o,sql:i,params:s,rowTransform:a=>({name:a.name,domain:a.host_key,value:a.encrypted_value,expiry:a.expires_utc})});return Pr("QueryCookies",!0,{file:o,count:n.length}),n}catch(i){return z("Failed to read cookie file",i,{file:o}),[]}}async function Gr({name:o,domain:t,file:e}){let i=typeof e=="string"&&e.length>0?[e]:await Ta();if(i.length===0)return Lt("ChromeCookies","No cookie files found"),[];let s=[];for(let n of i){if(!Ra(n)){Lt("ChromeCookies","Cookie file missing or invalid",{file:n});continue}let a=await Fa(n,o,t);s.push(...a)}return Lt("ChromeCookies","Query complete",{totalCookies:s.length}),s}var Ur,ts,$r,qr=D(()=>{"use strict";Ur=require("fs"),ts=require("path"),$r=De(require("fast-glob"),1);Yt();Ms();Ns()});var Zr=Ar((Nl,Vr)=>{"use strict";Vr.exports=Qr;function Qr(o,t,e){o instanceof RegExp&&(o=Hr(o,e)),t instanceof RegExp&&(t=Hr(t,e));var i=Kr(o,t,e);return i&&{start:i[0],end:i[1],pre:e.slice(0,i[0]),body:e.slice(i[0]+o.length,i[1]),post:e.slice(i[1]+t.length)}}function Hr(o,t){var e=t.match(o);return e?e[0]:null}Qr.range=Kr;function Kr(o,t,e){var i,s,n,a,l,h=e.indexOf(o),c=e.indexOf(t,h+1),p=h;if(h>=0&&c>0){if(o===t)return[h,c];for(i=[],n=e.length;p>=0&&!l;)p==h?(i.push(p),h=e.indexOf(o,p+1)):i.length==1?l=[i.pop(),c]:(s=i.pop(),s<n&&(n=s,a=c),c=e.indexOf(t,p+1)),p=h<c&&h>=0?h:c;i.length&&(l=[n,a])}return l}});var ro=Ar((Bl,so)=>{"use strict";var Yr=Zr();so.exports=_a;var Jr="\0SLASH"+Math.random()+"\0",Xr="\0OPEN"+Math.random()+"\0",Is="\0CLOSE"+Math.random()+"\0",to="\0COMMA"+Math.random()+"\0",eo="\0PERIOD"+Math.random()+"\0";function Bs(o){return parseInt(o,10)==o?parseInt(o,10):o.charCodeAt(0)}function Aa(o){return o.split("\\\\").join(Jr).split("\\{").join(Xr).split("\\}").join(Is).split("\\,").join(to).split("\\.").join(eo)}function Da(o){return o.split(Jr).join("\\").split(Xr).join("{").split(Is).join("}").split(to).join(",").split(eo).join(".")}function io(o){if(!o)return[""];var t=[],e=Yr("{","}",o);if(!e)return o.split(",");var i=e.pre,s=e.body,n=e.post,a=i.split(",");a[a.length-1]+="{"+s+"}";var l=io(n);return n.length&&(a[a.length-1]+=l.shift(),a.push.apply(a,l)),t.push.apply(t,a),t}function _a(o){return o?(o.substr(0,2)==="{}"&&(o="\\{\\}"+o.substr(2)),ri(Aa(o),!0).map(Da)):[]}function Pa(o){return"{"+o+"}"}function La(o){return/^-?0\d/.test(o)}function Ma(o,t){return o<=t}function Na(o,t){return o>=t}function ri(o,t){var e=[],i=Yr("{","}",o);if(!i)return[o];var s=i.pre,n=i.post.length?ri(i.post,!1):[""];if(/\$$/.test(i.pre))for(var a=0;a<n.length;a++){var l=s+"{"+i.body+"}"+n[a];e.push(l)}else{var h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),p=h||c,d=i.body.indexOf(",")>=0;if(!p&&!d)return i.post.match(/,.*\}/)?(o=i.pre+"{"+i.body+Is+i.post,ri(o)):[o];var w;if(p)w=i.body.split(/\.\./);else if(w=io(i.body),w.length===1&&(w=ri(w[0],!1).map(Pa),w.length===1))return n.map(function(Vi){return i.pre+w[0]+Vi});var E;if(p){var x=Bs(w[0]),g=Bs(w[1]),C=Math.max(w[0].length,w[1].length),S=w.length==3?Math.abs(Bs(w[2])):1,k=Ma,R=g<x;R&&(S*=-1,k=Na);var A=w.some(La);E=[];for(var _=x;k(_,g);_+=S){var I;if(c)I=String.fromCharCode(_),I==="\\"&&(I="");else if(I=String(_),A){var St=C-I.length;if(St>0){var me=new Array(St+1).join("0");_<0?I="-"+me+I.slice(1):I=me+I}}E.push(I)}}else{E=[];for(var bt=0;bt<w.length;bt++)E.push.apply(E,ri(w[bt],!1))}for(var bt=0;bt<E.length;bt++)for(var a=0;a<n.length;a++){var l=s+E[bt]+n[a];(!t||p||l)&&e.push(l)}}return e}});var oi,oo=D(()=>{"use strict";oi=o=>{if(typeof o!="string")throw new TypeError("invalid pattern");if(o.length>65536)throw new TypeError("pattern is too long")}});var Ba,ni,Ia,no,ao,ho=D(()=>{"use strict";Ba={"[: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]},ni=o=>o.replace(/[[\]\\-]/g,"\\$&"),Ia=o=>o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),no=o=>o.join(""),ao=(o,t)=>{let e=t;if(o.charAt(e)!=="[")throw new Error("not in a brace expression");let i=[],s=[],n=e+1,a=!1,l=!1,h=!1,c=!1,p=e,d="";t:for(;n<o.length;){let g=o.charAt(n);if((g==="!"||g==="^")&&n===e+1){c=!0,n++;continue}if(g==="]"&&a&&!h){p=n+1;break}if(a=!0,g==="\\"&&!h){h=!0,n++;continue}if(g==="["&&!h){for(let[C,[S,k,R]]of Object.entries(Ba))if(o.startsWith(C,n)){if(d)return["$.",!1,o.length-e,!0];n+=C.length,R?s.push(S):i.push(S),l=l||k;continue t}}if(h=!1,d){g>d?i.push(ni(d)+"-"+ni(g)):g===d&&i.push(ni(g)),d="",n++;continue}if(o.startsWith("-]",n+1)){i.push(ni(g+"-")),n+=2;continue}if(o.startsWith("-",n+1)){d=g,n+=2;continue}i.push(ni(g)),n++}if(p<n)return["",!1,0,!1];if(!i.length&&!s.length)return["$.",!1,o.length-e,!0];if(s.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!c){let g=i[0].length===2?i[0].slice(-1):i[0];return[Ia(g),!1,p-e,!1]}let w="["+(c?"^":"")+no(i)+"]",E="["+(c?"":"^")+no(s)+"]";return[i.length&&s.length?"("+w+"|"+E+")":i.length?w:E,l,p-e,!0]}});var Et,es=D(()=>{"use strict";Et=(o,{windowsPathsNoEscape:t=!1}={})=>t?o.replace(/\[([^\/\\])\]/g,"$1"):o.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")});var za,lo,Wa,is,ja,Ua,$a,Ga,Ws,co,fo,U,q,Ut,M,W,Jt,we,Xt,Mt,ye,ai,Se,uo,te,ss,zs,po,it,Pe,js=D(()=>{"use strict";ho();es();za=new Set(["!","?","+","*","@"]),lo=o=>za.has(o),Wa="(?!(?:^|/)\\.\\.?(?:$|/))",is="(?!\\.)",ja=new Set(["[","."]),Ua=new Set(["..","."]),$a=new Set("().*{}+?[]^$\\!"),Ga=o=>o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ws="[^/]",co=Ws+"*?",fo=Ws+"+?",it=class it{constructor(t,e,i={}){y(this,Se);u(this,"type");y(this,U);y(this,q);y(this,Ut,!1);y(this,M,[]);y(this,W);y(this,Jt);y(this,we);y(this,Xt,!1);y(this,Mt);y(this,ye);y(this,ai,!1);this.type=t,t&&f(this,q,!0),f(this,W,e),f(this,U,r(this,W)?r(r(this,W),U):this),f(this,Mt,r(this,U)===this?i:r(r(this,U),Mt)),f(this,we,r(this,U)===this?[]:r(r(this,U),we)),t==="!"&&!r(r(this,U),Xt)&&r(this,we).push(this),f(this,Jt,r(this,W)?r(r(this,W),M).length:0)}get hasMagic(){if(r(this,q)!==void 0)return r(this,q);for(let t of r(this,M))if(typeof t!="string"&&(t.type||t.hasMagic))return f(this,q,!0);return r(this,q)}toString(){return r(this,ye)!==void 0?r(this,ye):this.type?f(this,ye,this.type+"("+r(this,M).map(t=>String(t)).join("|")+")"):f(this,ye,r(this,M).map(t=>String(t)).join(""))}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof it&&r(e,W)===this))throw new Error("invalid part: "+e);r(this,M).push(e)}}toJSON(){var e;let t=this.type===null?r(this,M).slice().map(i=>typeof i=="string"?i:i.toJSON()):[this.type,...r(this,M).map(i=>i.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===r(this,U)||r(r(this,U),Xt)&&((e=r(this,W))==null?void 0:e.type)==="!")&&t.push({}),t}isStart(){var e;if(r(this,U)===this)return!0;if(!((e=r(this,W))!=null&&e.isStart()))return!1;if(r(this,Jt)===0)return!0;let t=r(this,W);for(let i=0;i<r(this,Jt);i++){let s=r(t,M)[i];if(!(s instanceof it&&s.type==="!"))return!1}return!0}isEnd(){var e,i,s;if(r(this,U)===this||((e=r(this,W))==null?void 0:e.type)==="!")return!0;if(!((i=r(this,W))!=null&&i.isEnd()))return!1;if(!this.type)return(s=r(this,W))==null?void 0:s.isEnd();let t=r(this,W)?r(r(this,W),M).length:0;return r(this,Jt)===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new it(this.type,t);for(let i of r(this,M))e.copyIn(i);return e}static fromGlob(t,e={}){var s;let i=new it(null,void 0,e);return m(s=it,te,ss).call(s,t,i,0,e),i}toMMPattern(){if(this!==r(this,U))return r(this,U).toMMPattern();let t=this.toString(),[e,i,s,n]=this.toRegExpSource();if(!(s||r(this,q)||r(this,Mt).nocase&&!r(this,Mt).nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let l=(r(this,Mt).nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${e}$`,l),{_src:e,_glob:t})}get options(){return r(this,Mt)}toRegExpSource(t){var h;let e=t!=null?t:!!r(this,Mt).dot;if(r(this,U)===this&&m(this,Se,uo).call(this),!this.type){let c=this.isStart()&&this.isEnd(),p=r(this,M).map(x=>{var R;let[g,C,S,k]=typeof x=="string"?m(R=it,te,po).call(R,x,r(this,q),c):x.toRegExpSource(t);return f(this,q,r(this,q)||S),f(this,Ut,r(this,Ut)||k),g}).join(""),d="";if(this.isStart()&&typeof r(this,M)[0]=="string"&&!(r(this,M).length===1&&Ua.has(r(this,M)[0]))){let g=ja,C=e&&g.has(p.charAt(0))||p.startsWith("\\.")&&g.has(p.charAt(2))||p.startsWith("\\.\\.")&&g.has(p.charAt(4)),S=!e&&!t&&g.has(p.charAt(0));d=C?Wa:S?is:""}let w="";return this.isEnd()&&r(r(this,U),Xt)&&((h=r(this,W))==null?void 0:h.type)==="!"&&(w="(?:$|\\/)"),[d+p+w,Et(p),f(this,q,!!r(this,q)),r(this,Ut)]}let i=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",n=m(this,Se,zs).call(this,e);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let c=this.toString();return f(this,M,[c]),this.type=null,f(this,q,void 0),[c,Et(this.toString()),!1,!1]}let a=!i||t||e||!is?"":m(this,Se,zs).call(this,!0);a===n&&(a=""),a&&(n=`(?:${n})(?:${a})*?`);let l="";if(this.type==="!"&&r(this,ai))l=(this.isStart()&&!e?is:"")+fo;else{let c=this.type==="!"?"))"+(this.isStart()&&!e&&!t?is:"")+co+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;l=s+n+c}return[l,Et(n),f(this,q,!!r(this,q)),r(this,Ut)]}};U=new WeakMap,q=new WeakMap,Ut=new WeakMap,M=new WeakMap,W=new WeakMap,Jt=new WeakMap,we=new WeakMap,Xt=new WeakMap,Mt=new WeakMap,ye=new WeakMap,ai=new WeakMap,Se=new WeakSet,uo=function(){if(this!==r(this,U))throw new Error("should only call on root");if(r(this,Xt))return this;this.toString(),f(this,Xt,!0);let t;for(;t=r(this,we).pop();){if(t.type!=="!")continue;let e=t,i=r(e,W);for(;i;){for(let s=r(e,Jt)+1;!i.type&&s<r(i,M).length;s++)for(let n of r(t,M)){if(typeof n=="string")throw new Error("string part in extglob AST??");n.copyIn(r(i,M)[s])}e=i,i=r(e,W)}}return this},te=new WeakSet,ss=function(t,e,i,s){var E,x;let n=!1,a=!1,l=-1,h=!1;if(e.type===null){let g=i,C="";for(;g<t.length;){let S=t.charAt(g++);if(n||S==="\\"){n=!n,C+=S;continue}if(a){g===l+1?(S==="^"||S==="!")&&(h=!0):S==="]"&&!(g===l+2&&h)&&(a=!1),C+=S;continue}else if(S==="["){a=!0,l=g,h=!1,C+=S;continue}if(!s.noext&&lo(S)&&t.charAt(g)==="("){e.push(C),C="";let k=new it(S,e);g=m(E=it,te,ss).call(E,t,k,g,s),e.push(k);continue}C+=S}return e.push(C),g}let c=i+1,p=new it(null,e),d=[],w="";for(;c<t.length;){let g=t.charAt(c++);if(n||g==="\\"){n=!n,w+=g;continue}if(a){c===l+1?(g==="^"||g==="!")&&(h=!0):g==="]"&&!(c===l+2&&h)&&(a=!1),w+=g;continue}else if(g==="["){a=!0,l=c,h=!1,w+=g;continue}if(lo(g)&&t.charAt(c)==="("){p.push(w),w="";let C=new it(g,p);p.push(C),c=m(x=it,te,ss).call(x,t,C,c,s);continue}if(g==="|"){p.push(w),w="",d.push(p),p=new it(null,e);continue}if(g===")")return w===""&&r(e,M).length===0&&f(e,ai,!0),p.push(w),w="",e.push(...d,p),c;w+=g}return e.type=null,f(e,q,void 0),f(e,M,[t.substring(i-1)]),c},zs=function(t){return r(this,M).map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[i,s,n,a]=e.toRegExpSource(t);return f(this,Ut,r(this,Ut)||a),i}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")},po=function(t,e,i=!1){let s=!1,n="",a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(s){s=!1,n+=($a.has(h)?"\\":"")+h;continue}if(h==="\\"){l===t.length-1?n+="\\\\":s=!0;continue}if(h==="["){let[c,p,d,w]=ao(t,l);if(d){n+=c,a=a||p,l+=d-1,e=e||w;continue}}if(h==="*"){i&&t==="*"?n+=fo:n+=co,e=!0;continue}if(h==="?"){n+=Ws,e=!0;continue}n+=Ga(h)}return[n,Et(t),!!e,a]},y(it,te);Pe=it});var Le,Us=D(()=>{"use strict";Le=(o,{windowsPathsNoEscape:t=!1}={})=>t?o.replace(/[?*()[\]]/g,"[$&]"):o.replace(/[?*()[\]\\]/g,"\\$&")});var wo,st,qa,Ha,Qa,Ka,Va,Za,Ya,Ja,Xa,th,eh,ih,sh,rh,oh,nh,ah,hh,yo,So,bo,mo,lh,J,ch,fh,uh,ph,dh,mt,mh,Eo,gh,wh,go,yh,ht,ee=D(()=>{"use strict";wo=De(ro(),1);oo();js();Us();es();js();Us();es();st=(o,t,e={})=>(oi(t),!e.nocomment&&t.charAt(0)==="#"?!1:new ht(t,e).match(o)),qa=/^\*+([^+@!?\*\[\(]*)$/,Ha=o=>t=>!t.startsWith(".")&&t.endsWith(o),Qa=o=>t=>t.endsWith(o),Ka=o=>(o=o.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(o)),Va=o=>(o=o.toLowerCase(),t=>t.toLowerCase().endsWith(o)),Za=/^\*+\.\*+$/,Ya=o=>!o.startsWith(".")&&o.includes("."),Ja=o=>o!=="."&&o!==".."&&o.includes("."),Xa=/^\.\*+$/,th=o=>o!=="."&&o!==".."&&o.startsWith("."),eh=/^\*+$/,ih=o=>o.length!==0&&!o.startsWith("."),sh=o=>o.length!==0&&o!=="."&&o!=="..",rh=/^\?+([^+@!?\*\[\(]*)?$/,oh=([o,t=""])=>{let e=yo([o]);return t?(t=t.toLowerCase(),i=>e(i)&&i.toLowerCase().endsWith(t)):e},nh=([o,t=""])=>{let e=So([o]);return t?(t=t.toLowerCase(),i=>e(i)&&i.toLowerCase().endsWith(t)):e},ah=([o,t=""])=>{let e=So([o]);return t?i=>e(i)&&i.endsWith(t):e},hh=([o,t=""])=>{let e=yo([o]);return t?i=>e(i)&&i.endsWith(t):e},yo=([o])=>{let t=o.length;return e=>e.length===t&&!e.startsWith(".")},So=([o])=>{let t=o.length;return e=>e.length===t&&e!=="."&&e!==".."},bo=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",mo={win32:{sep:"\\"},posix:{sep:"/"}},lh=bo==="win32"?mo.win32.sep:mo.posix.sep;st.sep=lh;J=Symbol("globstar **");st.GLOBSTAR=J;ch="[^/]",fh=ch+"*?",uh="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ph="(?:(?!(?:\\/|^)\\.).)*?",dh=(o,t={})=>e=>st(e,o,t);st.filter=dh;mt=(o,t={})=>Object.assign({},o,t),mh=o=>{if(!o||typeof o!="object"||!Object.keys(o).length)return st;let t=st;return Object.assign((i,s,n={})=>t(i,s,mt(o,n)),{Minimatch:class extends t.Minimatch{constructor(s,n={}){super(s,mt(o,n))}static defaults(s){return t.defaults(mt(o,s)).Minimatch}},AST:class extends t.AST{constructor(s,n,a={}){super(s,n,mt(o,a))}static fromGlob(s,n={}){return t.AST.fromGlob(s,mt(o,n))}},unescape:(i,s={})=>t.unescape(i,mt(o,s)),escape:(i,s={})=>t.escape(i,mt(o,s)),filter:(i,s={})=>t.filter(i,mt(o,s)),defaults:i=>t.defaults(mt(o,i)),makeRe:(i,s={})=>t.makeRe(i,mt(o,s)),braceExpand:(i,s={})=>t.braceExpand(i,mt(o,s)),match:(i,s,n={})=>t.match(i,s,mt(o,n)),sep:t.sep,GLOBSTAR:J})};st.defaults=mh;Eo=(o,t={})=>(oi(o),t.nobrace||!/\{(?:(?!\{).)*\}/.test(o)?[o]:(0,wo.default)(o));st.braceExpand=Eo;gh=(o,t={})=>new ht(o,t).makeRe();st.makeRe=gh;wh=(o,t,e={})=>{let i=new ht(t,e);return o=o.filter(s=>i.match(s)),i.options.nonull&&!o.length&&o.push(t),o};st.match=wh;go=/[?*]|[+@!]\(.*?\)|\[|\]/,yh=o=>o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ht=class{constructor(t,e={}){u(this,"options");u(this,"set");u(this,"pattern");u(this,"windowsPathsNoEscape");u(this,"nonegate");u(this,"negate");u(this,"comment");u(this,"empty");u(this,"preserveMultipleSlashes");u(this,"partial");u(this,"globSet");u(this,"globParts");u(this,"nocase");u(this,"isWindows");u(this,"platform");u(this,"windowsNoMagicRoot");u(this,"regexp");oi(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||bo,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.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 t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((n,a,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=n[0]===""&&n[1]===""&&(n[2]==="?"||!go.test(n[2]))&&!go.test(n[3]),c=/^[a-z]:/i.test(n[0]);if(h)return[...n.slice(0,4),...n.slice(4).map(p=>this.parse(p))];if(c)return[n[0],...n.slice(1).map(p=>this.parse(p))]}return n.map(h=>this.parse(h))});if(this.debug(this.pattern,s),this.set=s.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let a=this.set[n];a[0]===""&&a[1]===""&&this.globParts[n][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i=0;i<t.length;i++)for(let s=0;s<t[i].length;s++)t[i][s]==="**"&&(t[i][s]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let i=-1;for(;(i=e.indexOf("**",i+1))!==-1;){let s=i;for(;e[s+1]==="**";)s++;s!==i&&e.splice(i,s-i)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((i,s)=>{let n=i[i.length-1];return s==="**"&&n==="**"?i:s===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(i.pop(),i):(i.push(s),i)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){let n=t[s];s===1&&n===""&&t[0]===""||(n==="."||n==="")&&(e=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let s=t[i-1];s&&s!=="."&&s!==".."&&s!=="**"&&(e=!0,t.splice(i-1,2),i-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let i of t){let s=-1;for(;(s=i.indexOf("**",s+1))!==-1;){let a=s;for(;i[a+1]==="**";)a++;a>s&&i.splice(s+1,a-s);let l=i[s+1],h=i[s+2],c=i[s+3];if(l!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;e=!0,i.splice(s,1);let p=i.slice(0);p[s]="**",t.push(p),s--}if(!this.preserveMultipleSlashes){for(let a=1;a<i.length-1;a++){let l=i[a];a===1&&l===""&&i[0]===""||(l==="."||l==="")&&(e=!0,i.splice(a,1),a--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(e=!0,i.pop())}let n=0;for(;(n=i.indexOf("..",n+1))!==-1;){let a=i[n-1];if(a&&a!=="."&&a!==".."&&a!=="**"){e=!0;let h=n===1&&i[n+1]==="**"?["."]:[];i.splice(n-1,2,...h),i.length===0&&i.push(""),n-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let i=e+1;i<t.length;i++){let s=this.partsMatch(t[e],t[i],!this.preserveMultipleSlashes);if(s){t[e]=[],t[i]=s;break}}return t.filter(e=>e.length)}partsMatch(t,e,i=!1){let s=0,n=0,a=[],l="";for(;s<t.length&&n<e.length;)if(t[s]===e[n])a.push(l==="b"?e[n]:t[s]),s++,n++;else if(i&&t[s]==="**"&&e[n]===t[s+1])a.push(t[s]),s++;else if(i&&e[n]==="**"&&t[s]===e[n+1])a.push(e[n]),n++;else if(t[s]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(l==="b")return!1;l="a",a.push(t[s]),s++,n++}else if(e[n]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(l==="a")return!1;l="b",a.push(e[n]),s++,n++}else return!1;return t.length===e.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,i=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)e=!e,i++;i&&(this.pattern=t.slice(i)),this.negate=e}matchOne(t,e,i=!1){let s=this.options;if(this.isWindows){let g=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),C=!g&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),S=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),k=!S&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),R=C?3:g?0:void 0,A=k?3:S?0:void 0;if(typeof R=="number"&&typeof A=="number"){let[_,I]=[t[R],e[A]];_.toLowerCase()===I.toLowerCase()&&(e[A]=_,A>R?e=e.slice(A):R>A&&(t=t.slice(R)))}}let{optimizationLevel:n=1}=this.options;n>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var a=0,l=0,h=t.length,c=e.length;a<h&&l<c;a++,l++){this.debug("matchOne loop");var p=e[l],d=t[a];if(this.debug(e,p,d),p===!1)return!1;if(p===J){this.debug("GLOBSTAR",[e,p,d]);var w=a,E=l+1;if(E===c){for(this.debug("** at the end");a<h;a++)if(t[a]==="."||t[a]===".."||!s.dot&&t[a].charAt(0)===".")return!1;return!0}for(;w<h;){var x=t[w];if(this.debug(`
|
|
2
|
+
globstar while`,t,w,e,E,x),this.matchOne(t.slice(w),e.slice(E),i))return this.debug("globstar found match!",w,h,x),!0;if(x==="."||x===".."||!s.dot&&x.charAt(0)==="."){this.debug("dot detected!",t,w,e,E);break}this.debug("globstar swallow a segment, and continue"),w++}return!!(i&&(this.debug(`
|
|
3
|
+
>>> no match, partial?`,t,w,e,E),w===h))}let g;if(typeof p=="string"?(g=d===p,this.debug("string match",p,d,g)):(g=p.test(d),this.debug("pattern match",p,d,g)),!g)return!1}if(a===h&&l===c)return!0;if(a===h)return i;if(l===c)return a===h-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return Eo(this.pattern,this.options)}parse(t){oi(t);let e=this.options;if(t==="**")return J;if(t==="")return"";let i,s=null;(i=t.match(eh))?s=e.dot?sh:ih:(i=t.match(qa))?s=(e.nocase?e.dot?Va:Ka:e.dot?Qa:Ha)(i[1]):(i=t.match(rh))?s=(e.nocase?e.dot?nh:oh:e.dot?ah:hh)(i):(i=t.match(Za))?s=e.dot?Ja:Ya:(i=t.match(Xa))&&(s=th);let n=Pe.fromGlob(t,this.options).toMMPattern();return s&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:s}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,i=e.noglobstar?fh:e.dot?uh:ph,s=new Set(e.nocase?["i"]:[]),n=t.map(h=>{let c=h.map(p=>{if(p instanceof RegExp)for(let d of p.flags.split(""))s.add(d);return typeof p=="string"?yh(p):p===J?J:p._src});return c.forEach((p,d)=>{let w=c[d+1],E=c[d-1];p!==J||E===J||(E===void 0?w!==void 0&&w!==J?c[d+1]="(?:\\/|"+i+"\\/)?"+w:c[d]=i:w===void 0?c[d-1]=E+"(?:\\/|"+i+")?":w!==J&&(c[d-1]=E+"(?:\\/|\\/"+i+"\\/)"+w,c[d+1]=J))}),c.filter(p=>p!==J).join("/")}).join("|"),[a,l]=t.length>1?["(?:",")"]:["",""];n="^"+a+n+l+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...s].join(""))}catch(h){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let n=this.set;this.debug(this.pattern,"set",n);let a=s[s.length-1];if(!a)for(let l=s.length-2;!a&&l>=0;l--)a=s[l];for(let l=0;l<n.length;l++){let h=n[l],c=s;if(i.matchBase&&h.length===1&&(c=[a]),this.matchOne(c,h,e))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return st.defaults(t).Minimatch}};st.AST=Pe;st.Minimatch=ht;st.escape=Le;st.unescape=Et});var Me,Ro,$s,To,ns,Co,xo,Sh,oc,ie,Oo,Ne,Be,be,Gs,ko,vo,Ct,lt,xt,kt,Ie,ze,$,vt,j,L,O,rt,ct,X,H,Rt,Q,Tt,Ot,ft,Ft,ne,ot,b,qs,Ee,$t,ci,ut,Fo,Ce,We,fi,se,re,Hs,rs,os,P,Qs,hi,oe,Ks,Vs,li,Ao=D(()=>{"use strict";Me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ro=new Set,$s=typeof process=="object"&&process?process:{},To=(o,t,e,i)=>{typeof $s.emitWarning=="function"?$s.emitWarning(o,t,e,i):console.error(`[${e}] ${t}: ${o}`)},ns=globalThis.AbortController,Co=globalThis.AbortSignal;if(typeof ns=="undefined"){Co=class{constructor(){u(this,"onabort");u(this,"_onabort",[]);u(this,"reason");u(this,"aborted",!1)}addEventListener(i,s){this._onabort.push(s)}},ns=class{constructor(){u(this,"signal",new Co);t()}abort(i){var s,n;if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let a of this.signal._onabort)a(i);(n=(s=this.signal).onabort)==null||n.call(s,i)}}};let o=((xo=$s.env)==null?void 0:xo.LRU_CACHE_IGNORE_AC_WARNING)!=="1",t=()=>{o&&(o=!1,To("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",t))}}Sh=o=>!Ro.has(o),oc=Symbol("type"),ie=o=>o&&o===Math.floor(o)&&o>0&&isFinite(o),Oo=o=>ie(o)?o<=Math.pow(2,8)?Uint8Array:o<=Math.pow(2,16)?Uint16Array:o<=Math.pow(2,32)?Uint32Array:o<=Number.MAX_SAFE_INTEGER?Ne:null:null,Ne=class extends Array{constructor(t){super(t),this.fill(0)}},be=class be{constructor(t,e){u(this,"heap");u(this,"length");if(!r(be,Be))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}static create(t){let e=Oo(t);if(!e)return[];f(be,Be,!0);let i=new be(t,e);return f(be,Be,!1),i}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}};Be=new WeakMap,y(be,Be,!1);Gs=be,Vs=class Vs{constructor(t){y(this,b);y(this,Ct);y(this,lt);y(this,xt);y(this,kt);y(this,Ie);y(this,ze);u(this,"ttl");u(this,"ttlResolution");u(this,"ttlAutopurge");u(this,"updateAgeOnGet");u(this,"updateAgeOnHas");u(this,"allowStale");u(this,"noDisposeOnSet");u(this,"noUpdateTTL");u(this,"maxEntrySize");u(this,"sizeCalculation");u(this,"noDeleteOnFetchRejection");u(this,"noDeleteOnStaleGet");u(this,"allowStaleOnFetchAbort");u(this,"allowStaleOnFetchRejection");u(this,"ignoreFetchAbort");y(this,$);y(this,vt);y(this,j);y(this,L);y(this,O);y(this,rt);y(this,ct);y(this,X);y(this,H);y(this,Rt);y(this,Q);y(this,Tt);y(this,Ot);y(this,ft);y(this,Ft);y(this,ne);y(this,ot);y(this,Ee,()=>{});y(this,$t,()=>{});y(this,ci,()=>{});y(this,ut,()=>!1);y(this,Ce,t=>{});y(this,We,(t,e,i)=>{});y(this,fi,(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});u(this,ko,"LRUCache");let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:h,dispose:c,disposeAfter:p,noDisposeOnSet:d,noUpdateTTL:w,maxSize:E=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:C,memoMethod:S,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:_,ignoreFetchAbort:I}=t;if(e!==0&&!ie(e))throw new TypeError("max option must be a nonnegative integer");let St=e?Oo(e):Array;if(!St)throw new Error("invalid max value: "+e);if(f(this,Ct,e),f(this,lt,E),this.maxEntrySize=x||r(this,lt),this.sizeCalculation=g,this.sizeCalculation){if(!r(this,lt)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,ze,S),C!==void 0&&typeof C!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,Ie,C),f(this,ne,!!C),f(this,j,new Map),f(this,L,new Array(e).fill(void 0)),f(this,O,new Array(e).fill(void 0)),f(this,rt,new St(e)),f(this,ct,new St(e)),f(this,X,0),f(this,H,0),f(this,Rt,Gs.create(e)),f(this,$,0),f(this,vt,0),typeof c=="function"&&f(this,xt,c),typeof p=="function"?(f(this,kt,p),f(this,Q,[])):(f(this,kt,void 0),f(this,Q,void 0)),f(this,Ft,!!r(this,xt)),f(this,ot,!!r(this,kt)),this.noDisposeOnSet=!!d,this.noUpdateTTL=!!w,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!_,this.ignoreFetchAbort=!!I,this.maxEntrySize!==0){if(r(this,lt)!==0&&!ie(r(this,lt)))throw new TypeError("maxSize must be a positive integer if specified");if(!ie(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");m(this,b,Fo).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=ie(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!ie(this.ttl))throw new TypeError("ttl must be a positive integer if specified");m(this,b,qs).call(this)}if(r(this,Ct)===0&&this.ttl===0&&r(this,lt)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!r(this,Ct)&&!r(this,lt)){let me="LRU_CACHE_UNBOUNDED";Sh(me)&&(Ro.add(me),To("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",me,Vs))}}static unsafeExposeInternals(t){return{starts:r(t,Ot),ttls:r(t,ft),sizes:r(t,Tt),keyMap:r(t,j),keyList:r(t,L),valList:r(t,O),next:r(t,rt),prev:r(t,ct),get head(){return r(t,X)},get tail(){return r(t,H)},free:r(t,Rt),isBackgroundFetch:e=>{var i;return m(i=t,b,P).call(i,e)},backgroundFetch:(e,i,s,n)=>{var a;return m(a=t,b,os).call(a,e,i,s,n)},moveToTail:e=>{var i;return m(i=t,b,hi).call(i,e)},indexes:e=>{var i;return m(i=t,b,se).call(i,e)},rindexes:e=>{var i;return m(i=t,b,re).call(i,e)},isStale:e=>{var i;return r(i=t,ut).call(i,e)}}}get max(){return r(this,Ct)}get maxSize(){return r(this,lt)}get calculatedSize(){return r(this,vt)}get size(){return r(this,$)}get fetchMethod(){return r(this,Ie)}get memoMethod(){return r(this,ze)}get dispose(){return r(this,xt)}get disposeAfter(){return r(this,kt)}getRemainingTTL(t){return r(this,j).has(t)?1/0:0}*entries(){for(let t of m(this,b,se).call(this))r(this,O)[t]!==void 0&&r(this,L)[t]!==void 0&&!m(this,b,P).call(this,r(this,O)[t])&&(yield[r(this,L)[t],r(this,O)[t]])}*rentries(){for(let t of m(this,b,re).call(this))r(this,O)[t]!==void 0&&r(this,L)[t]!==void 0&&!m(this,b,P).call(this,r(this,O)[t])&&(yield[r(this,L)[t],r(this,O)[t]])}*keys(){for(let t of m(this,b,se).call(this)){let e=r(this,L)[t];e!==void 0&&!m(this,b,P).call(this,r(this,O)[t])&&(yield e)}}*rkeys(){for(let t of m(this,b,re).call(this)){let e=r(this,L)[t];e!==void 0&&!m(this,b,P).call(this,r(this,O)[t])&&(yield e)}}*values(){for(let t of m(this,b,se).call(this))r(this,O)[t]!==void 0&&!m(this,b,P).call(this,r(this,O)[t])&&(yield r(this,O)[t])}*rvalues(){for(let t of m(this,b,re).call(this))r(this,O)[t]!==void 0&&!m(this,b,P).call(this,r(this,O)[t])&&(yield r(this,O)[t])}[(vo=Symbol.iterator,ko=Symbol.toStringTag,vo)](){return this.entries()}find(t,e={}){for(let i of m(this,b,se).call(this)){let s=r(this,O)[i],n=m(this,b,P).call(this,s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,r(this,L)[i],this))return this.get(r(this,L)[i],e)}}forEach(t,e=this){for(let i of m(this,b,se).call(this)){let s=r(this,O)[i],n=m(this,b,P).call(this,s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,r(this,L)[i],this)}}rforEach(t,e=this){for(let i of m(this,b,re).call(this)){let s=r(this,O)[i],n=m(this,b,P).call(this,s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,r(this,L)[i],this)}}purgeStale(){let t=!1;for(let e of m(this,b,re).call(this,{allowStale:!0}))r(this,ut).call(this,e)&&(m(this,b,oe).call(this,r(this,L)[e],"expire"),t=!0);return t}info(t){let e=r(this,j).get(t);if(e===void 0)return;let i=r(this,O)[e],s=m(this,b,P).call(this,i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(r(this,ft)&&r(this,Ot)){let a=r(this,ft)[e],l=r(this,Ot)[e];if(a&&l){let h=a-(Me.now()-l);n.ttl=h,n.start=Date.now()}}return r(this,Tt)&&(n.size=r(this,Tt)[e]),n}dump(){let t=[];for(let e of m(this,b,se).call(this,{allowStale:!0})){let i=r(this,L)[e],s=r(this,O)[e],n=m(this,b,P).call(this,s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let a={value:n};if(r(this,ft)&&r(this,Ot)){a.ttl=r(this,ft)[e];let l=Me.now()-r(this,Ot)[e];a.start=Math.floor(Date.now()-l)}r(this,Tt)&&(a.size=r(this,Tt)[e]),t.unshift([i,a])}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=Me.now()-s}this.set(e,i.value,i)}}set(t,e,i={}){var w,E,x,g,C;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:h}=i,{noUpdateTTL:c=this.noUpdateTTL}=i,p=r(this,fi).call(this,t,e,i.size||0,l);if(this.maxEntrySize&&p>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),m(this,b,oe).call(this,t,"set"),this;let d=r(this,$)===0?void 0:r(this,j).get(t);if(d===void 0)d=r(this,$)===0?r(this,H):r(this,Rt).length!==0?r(this,Rt).pop():r(this,$)===r(this,Ct)?m(this,b,rs).call(this,!1):r(this,$),r(this,L)[d]=t,r(this,O)[d]=e,r(this,j).set(t,d),r(this,rt)[r(this,H)]=d,r(this,ct)[d]=r(this,H),f(this,H,d),Zi(this,$)._++,r(this,We).call(this,d,p,h),h&&(h.set="add"),c=!1;else{m(this,b,hi).call(this,d);let S=r(this,O)[d];if(e!==S){if(r(this,ne)&&m(this,b,P).call(this,S)){S.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:k}=S;k!==void 0&&!a&&(r(this,Ft)&&((w=r(this,xt))==null||w.call(this,k,t,"set")),r(this,ot)&&((E=r(this,Q))==null||E.push([k,t,"set"])))}else a||(r(this,Ft)&&((x=r(this,xt))==null||x.call(this,S,t,"set")),r(this,ot)&&((g=r(this,Q))==null||g.push([S,t,"set"])));if(r(this,Ce).call(this,d),r(this,We).call(this,d,p,h),r(this,O)[d]=e,h){h.set="replace";let k=S&&m(this,b,P).call(this,S)?S.__staleWhileFetching:S;k!==void 0&&(h.oldValue=k)}}else h&&(h.set="update")}if(s!==0&&!r(this,ft)&&m(this,b,qs).call(this),r(this,ft)&&(c||r(this,ci).call(this,d,s,n),h&&r(this,$t).call(this,h,d)),!a&&r(this,ot)&&r(this,Q)){let S=r(this,Q),k;for(;k=S==null?void 0:S.shift();)(C=r(this,kt))==null||C.call(this,...k)}return this}pop(){var t;try{for(;r(this,$);){let e=r(this,O)[r(this,X)];if(m(this,b,rs).call(this,!0),m(this,b,P).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(r(this,ot)&&r(this,Q)){let e=r(this,Q),i;for(;i=e==null?void 0:e.shift();)(t=r(this,kt))==null||t.call(this,...i)}}}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=r(this,j).get(t);if(n!==void 0){let a=r(this,O)[n];if(m(this,b,P).call(this,a)&&a.__staleWhileFetching===void 0)return!1;if(r(this,ut).call(this,n))s&&(s.has="stale",r(this,$t).call(this,s,n));else return i&&r(this,Ee).call(this,n),s&&(s.has="hit",r(this,$t).call(this,s,n)),!0}else s&&(s.has="miss");return!1}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=r(this,j).get(t);if(s===void 0||!i&&r(this,ut).call(this,s))return;let n=r(this,O)[s];return m(this,b,P).call(this,n)?n.__staleWhileFetching:n}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:h=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:p=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:w=this.allowStaleOnFetchRejection,ignoreFetchAbort:E=this.ignoreFetchAbort,allowStaleOnFetchAbort:x=this.allowStaleOnFetchAbort,context:g,forceRefresh:C=!1,status:S,signal:k}=e;if(!r(this,ne))return S&&(S.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:S});let R={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:a,noDisposeOnSet:l,size:h,sizeCalculation:c,noUpdateTTL:p,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:x,ignoreFetchAbort:E,status:S,signal:k},A=r(this,j).get(t);if(A===void 0){S&&(S.fetch="miss");let _=m(this,b,os).call(this,t,A,R,g);return _.__returned=_}else{let _=r(this,O)[A];if(m(this,b,P).call(this,_)){let Vi=i&&_.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",Vi&&(S.returnedStale=!0)),Vi?_.__staleWhileFetching:_.__returned=_}let I=r(this,ut).call(this,A);if(!C&&!I)return S&&(S.fetch="hit"),m(this,b,hi).call(this,A),s&&r(this,Ee).call(this,A),S&&r(this,$t).call(this,S,A),_;let St=m(this,b,os).call(this,t,A,R,g),bt=St.__staleWhileFetching!==void 0&&i;return S&&(S.fetch=I?"stale":"refresh",bt&&I&&(S.returnedStale=!0)),bt?St.__staleWhileFetching:St.__returned=St}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=r(this,ze);if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...a}=e,l=this.get(t,a);if(!n&&l!==void 0)return l;let h=i(t,l,{options:a,context:s});return this.set(t,h,a),h}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:a}=e,l=r(this,j).get(t);if(l!==void 0){let h=r(this,O)[l],c=m(this,b,P).call(this,h);return a&&r(this,$t).call(this,a,l),r(this,ut).call(this,l)?(a&&(a.get="stale"),c?(a&&i&&h.__staleWhileFetching!==void 0&&(a.returnedStale=!0),i?h.__staleWhileFetching:void 0):(n||m(this,b,oe).call(this,t,"expire"),a&&i&&(a.returnedStale=!0),i?h:void 0)):(a&&(a.get="hit"),c?h.__staleWhileFetching:(m(this,b,hi).call(this,l),s&&r(this,Ee).call(this,l),h))}else a&&(a.get="miss")}delete(t){return m(this,b,oe).call(this,t,"delete")}clear(){return m(this,b,Ks).call(this,"delete")}};Ct=new WeakMap,lt=new WeakMap,xt=new WeakMap,kt=new WeakMap,Ie=new WeakMap,ze=new WeakMap,$=new WeakMap,vt=new WeakMap,j=new WeakMap,L=new WeakMap,O=new WeakMap,rt=new WeakMap,ct=new WeakMap,X=new WeakMap,H=new WeakMap,Rt=new WeakMap,Q=new WeakMap,Tt=new WeakMap,Ot=new WeakMap,ft=new WeakMap,Ft=new WeakMap,ne=new WeakMap,ot=new WeakMap,b=new WeakSet,qs=function(){let t=new Ne(r(this,Ct)),e=new Ne(r(this,Ct));f(this,ft,t),f(this,Ot,e),f(this,ci,(n,a,l=Me.now())=>{if(e[n]=a!==0?l:0,t[n]=a,a!==0&&this.ttlAutopurge){let h=setTimeout(()=>{r(this,ut).call(this,n)&&m(this,b,oe).call(this,r(this,L)[n],"expire")},a+1);h.unref&&h.unref()}}),f(this,Ee,n=>{e[n]=t[n]!==0?Me.now():0}),f(this,$t,(n,a)=>{if(t[a]){let l=t[a],h=e[a];if(!l||!h)return;n.ttl=l,n.start=h,n.now=i||s();let c=n.now-h;n.remainingTTL=l-c}});let i=0,s=()=>{let n=Me.now();if(this.ttlResolution>0){i=n;let a=setTimeout(()=>i=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=r(this,j).get(n);if(a===void 0)return 0;let l=t[a],h=e[a];if(!l||!h)return 1/0;let c=(i||s())-h;return l-c},f(this,ut,n=>{let a=e[n],l=t[n];return!!l&&!!a&&(i||s())-a>l})},Ee=new WeakMap,$t=new WeakMap,ci=new WeakMap,ut=new WeakMap,Fo=function(){let t=new Ne(r(this,Ct));f(this,vt,0),f(this,Tt,t),f(this,Ce,e=>{f(this,vt,r(this,vt)-t[e]),t[e]=0}),f(this,fi,(e,i,s,n)=>{if(m(this,b,P).call(this,i))return 0;if(!ie(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!ie(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),f(this,We,(e,i,s)=>{if(t[e]=i,r(this,lt)){let n=r(this,lt)-t[e];for(;r(this,vt)>n;)m(this,b,rs).call(this,!0)}f(this,vt,r(this,vt)+t[e]),s&&(s.entrySize=i,s.totalCalculatedSize=r(this,vt))})},Ce=new WeakMap,We=new WeakMap,fi=new WeakMap,se=function*({allowStale:t=this.allowStale}={}){if(r(this,$))for(let e=r(this,H);!(!m(this,b,Hs).call(this,e)||((t||!r(this,ut).call(this,e))&&(yield e),e===r(this,X)));)e=r(this,ct)[e]},re=function*({allowStale:t=this.allowStale}={}){if(r(this,$))for(let e=r(this,X);!(!m(this,b,Hs).call(this,e)||((t||!r(this,ut).call(this,e))&&(yield e),e===r(this,H)));)e=r(this,rt)[e]},Hs=function(t){return t!==void 0&&r(this,j).get(r(this,L)[t])===t},rs=function(t){var n,a;let e=r(this,X),i=r(this,L)[e],s=r(this,O)[e];return r(this,ne)&&m(this,b,P).call(this,s)?s.__abortController.abort(new Error("evicted")):(r(this,Ft)||r(this,ot))&&(r(this,Ft)&&((n=r(this,xt))==null||n.call(this,s,i,"evict")),r(this,ot)&&((a=r(this,Q))==null||a.push([s,i,"evict"]))),r(this,Ce).call(this,e),t&&(r(this,L)[e]=void 0,r(this,O)[e]=void 0,r(this,Rt).push(e)),r(this,$)===1?(f(this,X,f(this,H,0)),r(this,Rt).length=0):f(this,X,r(this,rt)[e]),r(this,j).delete(i),Zi(this,$)._--,e},os=function(t,e,i,s){let n=e===void 0?void 0:r(this,O)[e];if(m(this,b,P).call(this,n))return n;let a=new ns,{signal:l}=i;l==null||l.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let h={signal:a.signal,options:i,context:s},c=(g,C=!1)=>{let{aborted:S}=a.signal,k=i.ignoreFetchAbort&&g!==void 0;if(i.status&&(S&&!C?(i.status.fetchAborted=!0,i.status.fetchError=a.signal.reason,k&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),S&&!k&&!C)return d(a.signal.reason);let R=E;return r(this,O)[e]===E&&(g===void 0?R.__staleWhileFetching?r(this,O)[e]=R.__staleWhileFetching:m(this,b,oe).call(this,t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,g,h.options))),g},p=g=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=g),d(g)),d=g=>{let{aborted:C}=a.signal,S=C&&i.allowStaleOnFetchAbort,k=S||i.allowStaleOnFetchRejection,R=k||i.noDeleteOnFetchRejection,A=E;if(r(this,O)[e]===E&&(!R||A.__staleWhileFetching===void 0?m(this,b,oe).call(this,t,"fetch"):S||(r(this,O)[e]=A.__staleWhileFetching)),k)return i.status&&A.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),A.__staleWhileFetching;if(A.__returned===A)throw g},w=(g,C)=>{var k;let S=(k=r(this,Ie))==null?void 0:k.call(this,t,n,h);S&&S instanceof Promise&&S.then(R=>g(R===void 0?void 0:R),C),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(g(void 0),i.allowStaleOnFetchAbort&&(g=R=>c(R,!0)))})};i.status&&(i.status.fetchDispatched=!0);let E=new Promise(w).then(c,p),x=Object.assign(E,{__abortController:a,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,x,{...h.options,status:void 0}),e=r(this,j).get(t)):r(this,O)[e]=x,x},P=function(t){if(!r(this,ne))return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof ns},Qs=function(t,e){r(this,ct)[e]=t,r(this,rt)[t]=e},hi=function(t){t!==r(this,H)&&(t===r(this,X)?f(this,X,r(this,rt)[t]):m(this,b,Qs).call(this,r(this,ct)[t],r(this,rt)[t]),m(this,b,Qs).call(this,r(this,H),t),f(this,H,t))},oe=function(t,e){var s,n,a,l;let i=!1;if(r(this,$)!==0){let h=r(this,j).get(t);if(h!==void 0)if(i=!0,r(this,$)===1)m(this,b,Ks).call(this,e);else{r(this,Ce).call(this,h);let c=r(this,O)[h];if(m(this,b,P).call(this,c)?c.__abortController.abort(new Error("deleted")):(r(this,Ft)||r(this,ot))&&(r(this,Ft)&&((s=r(this,xt))==null||s.call(this,c,t,e)),r(this,ot)&&((n=r(this,Q))==null||n.push([c,t,e]))),r(this,j).delete(t),r(this,L)[h]=void 0,r(this,O)[h]=void 0,h===r(this,H))f(this,H,r(this,ct)[h]);else if(h===r(this,X))f(this,X,r(this,rt)[h]);else{let p=r(this,ct)[h];r(this,rt)[p]=r(this,rt)[h];let d=r(this,rt)[h];r(this,ct)[d]=r(this,ct)[h]}Zi(this,$)._--,r(this,Rt).push(h)}}if(r(this,ot)&&((a=r(this,Q))!=null&&a.length)){let h=r(this,Q),c;for(;c=h==null?void 0:h.shift();)(l=r(this,kt))==null||l.call(this,...c)}return i},Ks=function(t){var e,i,s;for(let n of m(this,b,re).call(this,{allowStale:!0})){let a=r(this,O)[n];if(m(this,b,P).call(this,a))a.__abortController.abort(new Error("deleted"));else{let l=r(this,L)[n];r(this,Ft)&&((e=r(this,xt))==null||e.call(this,a,l,t)),r(this,ot)&&((i=r(this,Q))==null||i.push([a,l,t]))}}if(r(this,j).clear(),r(this,O).fill(void 0),r(this,L).fill(void 0),r(this,ft)&&r(this,Ot)&&(r(this,ft).fill(0),r(this,Ot).fill(0)),r(this,Tt)&&r(this,Tt).fill(0),f(this,X,0),f(this,H,0),r(this,Rt).length=0,f(this,vt,0),f(this,$,0),r(this,ot)&&r(this,Q)){let n=r(this,Q),a;for(;a=n==null?void 0:n.shift();)(s=r(this,kt))==null||s.call(this,...a)}};li=Vs});var ps,ir,tn,Do,bh,Eh,Ch,Gt,qt,ae,as,ui,hs,_o,ls,Po,At,je,K,pi,Ue,V,nt,Z,Zs,cs,tt,B,Ys,Js,Lo,Xs,Nt,tr,fs,di,xe,pt,mi,xh,kh,vh,Rh,us,er,Th,Oh,Mo,No,Bo,Io,zo,Wo,jo,Uo,$o,Go,qo,Ho,Qo,Ko,Vo,Zo,Yo,Jo,Xo,he,sr=D(()=>{"use strict";ps=require("events"),ir=De(require("stream"),1),tn=require("string_decoder"),Do=typeof process=="object"&&process?process:{stdout:null,stderr:null},bh=o=>!!o&&typeof o=="object"&&(o instanceof he||o instanceof ir.default||Eh(o)||Ch(o)),Eh=o=>!!o&&typeof o=="object"&&o instanceof ps.EventEmitter&&typeof o.pipe=="function"&&o.pipe!==ir.default.Writable.prototype.pipe,Ch=o=>!!o&&typeof o=="object"&&o instanceof ps.EventEmitter&&typeof o.write=="function"&&typeof o.end=="function",Gt=Symbol("EOF"),qt=Symbol("maybeEmitEnd"),ae=Symbol("emittedEnd"),as=Symbol("emittingEnd"),ui=Symbol("emittedError"),hs=Symbol("closed"),_o=Symbol("read"),ls=Symbol("flush"),Po=Symbol("flushChunk"),At=Symbol("encoding"),je=Symbol("decoder"),K=Symbol("flowing"),pi=Symbol("paused"),Ue=Symbol("resume"),V=Symbol("buffer"),nt=Symbol("pipes"),Z=Symbol("bufferLength"),Zs=Symbol("bufferPush"),cs=Symbol("bufferShift"),tt=Symbol("objectMode"),B=Symbol("destroyed"),Ys=Symbol("error"),Js=Symbol("emitData"),Lo=Symbol("emitEnd"),Xs=Symbol("emitEnd2"),Nt=Symbol("async"),tr=Symbol("abort"),fs=Symbol("aborted"),di=Symbol("signal"),xe=Symbol("dataListeners"),pt=Symbol("discarded"),mi=o=>Promise.resolve().then(o),xh=o=>o(),kh=o=>o==="end"||o==="finish"||o==="prefinish",vh=o=>o instanceof ArrayBuffer||!!o&&typeof o=="object"&&o.constructor&&o.constructor.name==="ArrayBuffer"&&o.byteLength>=0,Rh=o=>!Buffer.isBuffer(o)&&ArrayBuffer.isView(o),us=class{constructor(t,e,i){u(this,"src");u(this,"dest");u(this,"opts");u(this,"ondrain");this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[Ue](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},er=class extends us{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=s=>e.emit("error",s),t.on("error",this.proxyErrors)}},Th=o=>!!o.objectMode,Oh=o=>!o.objectMode&&!!o.encoding&&o.encoding!=="buffer",he=class extends ps.EventEmitter{constructor(...e){let i=e[0]||{};super();u(this,Xo,!1);u(this,Jo,!1);u(this,Yo,[]);u(this,Zo,[]);u(this,Vo);u(this,Ko);u(this,Qo);u(this,Ho);u(this,qo,!1);u(this,Go,!1);u(this,$o,!1);u(this,Uo,!1);u(this,jo,null);u(this,Wo,0);u(this,zo,!1);u(this,Io);u(this,Bo,!1);u(this,No,0);u(this,Mo,!1);u(this,"writable",!0);u(this,"readable",!0);if(i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Th(i)?(this[tt]=!0,this[At]=null):Oh(i)?(this[At]=i.encoding,this[tt]=!1):(this[tt]=!1,this[At]=null),this[Nt]=!!i.async,this[je]=this[At]?new tn.StringDecoder(this[At]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[V]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[nt]});let{signal:s}=i;s&&(this[di]=s,s.aborted?this[tr]():s.addEventListener("abort",()=>this[tr]()))}get bufferLength(){return this[Z]}get encoding(){return this[At]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[tt]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Nt]}set async(e){this[Nt]=this[Nt]||!!e}[(Xo=K,Jo=pi,Yo=nt,Zo=V,Vo=tt,Ko=At,Qo=Nt,Ho=je,qo=Gt,Go=ae,$o=as,Uo=hs,jo=ui,Wo=Z,zo=B,Io=di,Bo=fs,No=xe,Mo=pt,tr)](){var e,i;this[fs]=!0,this.emit("abort",(e=this[di])==null?void 0:e.reason),this.destroy((i=this[di])==null?void 0:i.reason)}get aborted(){return this[fs]}set aborted(e){}write(e,i,s){var a;if(this[fs])return!1;if(this[Gt])throw new Error("write after end");if(this[B])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(s=i,i="utf8"),i||(i="utf8");let n=this[Nt]?mi:xh;if(!this[tt]&&!Buffer.isBuffer(e)){if(Rh(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(vh(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[tt]?(this[K]&&this[Z]!==0&&this[ls](!0),this[K]?this.emit("data",e):this[Zs](e),this[Z]!==0&&this.emit("readable"),s&&n(s),this[K]):e.length?(typeof e=="string"&&!(i===this[At]&&!((a=this[je])!=null&&a.lastNeed))&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[At]&&(e=this[je].write(e)),this[K]&&this[Z]!==0&&this[ls](!0),this[K]?this.emit("data",e):this[Zs](e),this[Z]!==0&&this.emit("readable"),s&&n(s),this[K]):(this[Z]!==0&&this.emit("readable"),s&&n(s),this[K])}read(e){if(this[B])return null;if(this[pt]=!1,this[Z]===0||e===0||e&&e>this[Z])return this[qt](),null;this[tt]&&(e=null),this[V].length>1&&!this[tt]&&(this[V]=[this[At]?this[V].join(""):Buffer.concat(this[V],this[Z])]);let i=this[_o](e||null,this[V][0]);return this[qt](),i}[_o](e,i){if(this[tt])this[cs]();else{let s=i;e===s.length||e===null?this[cs]():typeof s=="string"?(this[V][0]=s.slice(e),i=s.slice(0,e),this[Z]-=e):(this[V][0]=s.subarray(e),i=s.subarray(0,e),this[Z]-=e)}return this.emit("data",i),!this[V].length&&!this[Gt]&&this.emit("drain"),i}end(e,i,s){return typeof e=="function"&&(s=e,e=void 0),typeof i=="function"&&(s=i,i="utf8"),e!==void 0&&this.write(e,i),s&&this.once("end",s),this[Gt]=!0,this.writable=!1,(this[K]||!this[pi])&&this[qt](),this}[Ue](){this[B]||(!this[xe]&&!this[nt].length&&(this[pt]=!0),this[pi]=!1,this[K]=!0,this.emit("resume"),this[V].length?this[ls]():this[Gt]?this[qt]():this.emit("drain"))}resume(){return this[Ue]()}pause(){this[K]=!1,this[pi]=!0,this[pt]=!1}get destroyed(){return this[B]}get flowing(){return this[K]}get paused(){return this[pi]}[Zs](e){this[tt]?this[Z]+=1:this[Z]+=e.length,this[V].push(e)}[cs](){return this[tt]?this[Z]-=1:this[Z]-=this[V][0].length,this[V].shift()}[ls](e=!1){do;while(this[Po](this[cs]())&&this[V].length);!e&&!this[V].length&&!this[Gt]&&this.emit("drain")}[Po](e){return this.emit("data",e),this[K]}pipe(e,i){if(this[B])return e;this[pt]=!1;let s=this[ae];return i=i||{},e===Do.stdout||e===Do.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,s?i.end&&e.end():(this[nt].push(i.proxyErrors?new er(this,e,i):new us(this,e,i)),this[Nt]?mi(()=>this[Ue]()):this[Ue]()),e}unpipe(e){let i=this[nt].find(s=>s.dest===e);i&&(this[nt].length===1?(this[K]&&this[xe]===0&&(this[K]=!1),this[nt]=[]):this[nt].splice(this[nt].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let s=super.on(e,i);if(e==="data")this[pt]=!1,this[xe]++,!this[nt].length&&!this[K]&&this[Ue]();else if(e==="readable"&&this[Z]!==0)super.emit("readable");else if(kh(e)&&this[ae])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ui]){let n=i;this[Nt]?mi(()=>n.call(this,this[ui])):n.call(this,this[ui])}return s}removeListener(e,i){return this.off(e,i)}off(e,i){let s=super.off(e,i);return e==="data"&&(this[xe]=this.listeners("data").length,this[xe]===0&&!this[pt]&&!this[nt].length&&(this[K]=!1)),s}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[xe]=0,!this[pt]&&!this[nt].length&&(this[K]=!1)),i}get emittedEnd(){return this[ae]}[qt](){!this[as]&&!this[ae]&&!this[B]&&this[V].length===0&&this[Gt]&&(this[as]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[hs]&&this.emit("close"),this[as]=!1)}emit(e,...i){let s=i[0];if(e!=="error"&&e!=="close"&&e!==B&&this[B])return!1;if(e==="data")return!this[tt]&&!s?!1:this[Nt]?(mi(()=>this[Js](s)),!0):this[Js](s);if(e==="end")return this[Lo]();if(e==="close"){if(this[hs]=!0,!this[ae]&&!this[B])return!1;let a=super.emit("close");return this.removeAllListeners("close"),a}else if(e==="error"){this[ui]=s,super.emit(Ys,s);let a=!this[di]||this.listeners("error").length?super.emit("error",s):!1;return this[qt](),a}else if(e==="resume"){let a=super.emit("resume");return this[qt](),a}else if(e==="finish"||e==="prefinish"){let a=super.emit(e);return this.removeAllListeners(e),a}let n=super.emit(e,...i);return this[qt](),n}[Js](e){for(let s of this[nt])s.dest.write(e)===!1&&this.pause();let i=this[pt]?!1:super.emit("data",e);return this[qt](),i}[Lo](){return this[ae]?!1:(this[ae]=!0,this.readable=!1,this[Nt]?(mi(()=>this[Xs]()),!0):this[Xs]())}[Xs](){if(this[je]){let i=this[je].end();if(i){for(let s of this[nt])s.dest.write(i);this[pt]||super.emit("data",i)}}for(let i of this[nt])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[tt]||(e.dataLength=0);let i=this.promise();return this.on("data",s=>{e.push(s),this[tt]||(e.dataLength+=s.length)}),await i,e}async concat(){if(this[tt])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[At]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(B,()=>i(new Error("stream destroyed"))),this.on("error",s=>i(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[pt]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[Gt])return i();let a,l,h=w=>{this.off("data",c),this.off("end",p),this.off(B,d),i(),l(w)},c=w=>{this.off("error",h),this.off("end",p),this.off(B,d),this.pause(),a({value:w,done:!!this[Gt]})},p=()=>{this.off("error",h),this.off("data",c),this.off(B,d),i(),a({done:!0,value:void 0})},d=()=>h(new Error("stream destroyed"));return new Promise((w,E)=>{l=E,a=w,this.once(B,d),this.once("error",h),this.once("end",p),this.once("data",c)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[pt]=!1;let e=!1,i=()=>(this.pause(),this.off(Ys,i),this.off(B,i),this.off("end",i),e=!0,{done:!0,value:void 0}),s=()=>{if(e)return i();let n=this.read();return n===null?i():{done:!1,value:n}};return this.once("end",i),this.once(Ys,i),this.once(B,i),{next:s,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[B])return e?this.emit("error",e):this.emit(B),this;this[B]=!0,this[pt]=!0,this[V].length=0,this[Z]=0;let i=this;return typeof i.close=="function"&&!this[hs]&&i.close(),e?this.emit("error",e):this.emit(B),this}static get isStream(){return bh}}});var Qe,nn,Wt,Fh,ce,Ah,wi,an,hn,Dh,_h,wt,ln,cn,Bt,fn,un,ke,pn,gt,gi,rr,en,yi,Dt,ds,gs,sn,Ph,or,rn,Si,on,ms,bs,nr,dn,at,xi,ki,vi,Ri,Ti,Oi,Fi,Ai,Di,_i,Pi,Li,Mi,Ni,Bi,Ii,zi,Wi,le,ve,It,Ht,Qt,Kt,T,Re,Vt,zt,v,ar,ws,bi,hr,lr,Ei,ys,cr,fr,Ss,mn,gn,wn,ur,$e,Ge,yn,Te,et,Es,Cs,qe,He,ji,Ui,xs,Ke,Ve,Ci,uc,Sn,bn=D(()=>{"use strict";Ao();Qe=require("path"),nn=require("url"),Wt=require("fs"),Fh=De(require("fs"),1),ce=require("fs/promises");sr();Ah=Wt.realpathSync.native,wi={lstatSync:Wt.lstatSync,readdir:Wt.readdir,readdirSync:Wt.readdirSync,readlinkSync:Wt.readlinkSync,realpathSync:Ah,promises:{lstat:ce.lstat,readdir:ce.readdir,readlink:ce.readlink,realpath:ce.realpath}},an=o=>!o||o===wi||o===Fh?wi:{...wi,...o,promises:{...wi.promises,...o.promises||{}}},hn=/^\\\\\?\\([a-z]:)\\?$/i,Dh=o=>o.replace(/\//g,"\\").replace(hn,"$1\\"),_h=/[\\\/]/,wt=0,ln=1,cn=2,Bt=4,fn=6,un=8,ke=10,pn=12,gt=15,gi=~gt,rr=16,en=32,yi=64,Dt=128,ds=256,gs=512,sn=yi|Dt|gs,Ph=1023,or=o=>o.isFile()?un:o.isDirectory()?Bt:o.isSymbolicLink()?ke:o.isCharacterDevice()?cn:o.isBlockDevice()?fn:o.isSocket()?pn:o.isFIFO()?ln:wt,rn=new Map,Si=o=>{let t=rn.get(o);if(t)return t;let e=o.normalize("NFKD");return rn.set(o,e),e},on=new Map,ms=o=>{let t=on.get(o);if(t)return t;let e=Si(o.toLowerCase());return on.set(o,e),e},bs=class extends li{constructor(){super({max:256})}},nr=class extends li{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},dn=Symbol("PathScurry setAsCwd"),et=class{constructor(t,e=wt,i,s,n,a,l){y(this,v);u(this,"name");u(this,"root");u(this,"roots");u(this,"parent");u(this,"nocase");u(this,"isCWD",!1);y(this,at);y(this,xi);y(this,ki);y(this,vi);y(this,Ri);y(this,Ti);y(this,Oi);y(this,Fi);y(this,Ai);y(this,Di);y(this,_i);y(this,Pi);y(this,Li);y(this,Mi);y(this,Ni);y(this,Bi);y(this,Ii);y(this,zi);y(this,Wi);y(this,le);y(this,ve);y(this,It);y(this,Ht);y(this,Qt);y(this,Kt);y(this,T);y(this,Re);y(this,Vt);y(this,zt);y(this,$e,[]);y(this,Ge,!1);y(this,Te);this.name=t,f(this,le,n?ms(t):Si(t)),f(this,T,e&Ph),this.nocase=n,this.roots=s,this.root=i||this,f(this,Re,a),f(this,It,l.fullpath),f(this,Qt,l.relative),f(this,Kt,l.relativePosix),this.parent=l.parent,this.parent?f(this,at,r(this.parent,at)):f(this,at,an(l.fs))}get dev(){return r(this,xi)}get mode(){return r(this,ki)}get nlink(){return r(this,vi)}get uid(){return r(this,Ri)}get gid(){return r(this,Ti)}get rdev(){return r(this,Oi)}get blksize(){return r(this,Fi)}get ino(){return r(this,Ai)}get size(){return r(this,Di)}get blocks(){return r(this,_i)}get atimeMs(){return r(this,Pi)}get mtimeMs(){return r(this,Li)}get ctimeMs(){return r(this,Mi)}get birthtimeMs(){return r(this,Ni)}get atime(){return r(this,Bi)}get mtime(){return r(this,Ii)}get ctime(){return r(this,zi)}get birthtime(){return r(this,Wi)}get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}depth(){return r(this,ve)!==void 0?r(this,ve):this.parent?f(this,ve,this.parent.depth()+1):f(this,ve,0)}childrenCache(){return r(this,Re)}resolve(t){var a;if(!t)return this;let e=this.getRootString(t),s=t.substring(e.length).split(this.splitSep);return e?m(a=this.getRoot(e),v,ar).call(a,s):m(this,v,ar).call(this,s)}children(){let t=r(this,Re).get(this);if(t)return t;let e=Object.assign([],{provisional:0});return r(this,Re).set(this,e),f(this,T,r(this,T)&~rr),e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let i=this.children(),s=this.nocase?ms(t):Si(t);for(let h of i)if(r(h,le)===s)return h;let n=this.parent?this.sep:"",a=r(this,It)?r(this,It)+n+t:void 0,l=this.newChild(t,wt,{...e,parent:this,fullpath:a});return this.canReaddir()||f(l,T,r(l,T)|Dt),i.push(l),l}relative(){if(this.isCWD)return"";if(r(this,Qt)!==void 0)return r(this,Qt);let t=this.name,e=this.parent;if(!e)return f(this,Qt,this.name);let i=e.relative();return i+(!i||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(r(this,Kt)!==void 0)return r(this,Kt);let t=this.name,e=this.parent;if(!e)return f(this,Kt,this.fullpathPosix());let i=e.relativePosix();return i+(!i||!e.parent?"":"/")+t}fullpath(){if(r(this,It)!==void 0)return r(this,It);let t=this.name,e=this.parent;if(!e)return f(this,It,this.name);let s=e.fullpath()+(e.parent?this.sep:"")+t;return f(this,It,s)}fullpathPosix(){if(r(this,Ht)!==void 0)return r(this,Ht);if(this.sep==="/")return f(this,Ht,this.fullpath());if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?f(this,Ht,`//?/${s}`):f(this,Ht,s)}let t=this.parent,e=t.fullpathPosix(),i=e+(!e||!t.parent?"":"/")+this.name;return f(this,Ht,i)}isUnknown(){return(r(this,T)>)===wt}isType(t){return this[`is${t}`]()}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(r(this,T)>)===un}isDirectory(){return(r(this,T)>)===Bt}isCharacterDevice(){return(r(this,T)>)===cn}isBlockDevice(){return(r(this,T)>)===fn}isFIFO(){return(r(this,T)>)===ln}isSocket(){return(r(this,T)>)===pn}isSymbolicLink(){return(r(this,T)&ke)===ke}lstatCached(){return r(this,T)&en?this:void 0}readlinkCached(){return r(this,Vt)}realpathCached(){return r(this,zt)}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(r(this,Vt))return!0;if(!this.parent)return!1;let t=r(this,T)>return!(t!==wt&&t!==ke||r(this,T)&ds||r(this,T)&Dt)}calledReaddir(){return!!(r(this,T)&rr)}isENOENT(){return!!(r(this,T)&Dt)}isNamed(t){return this.nocase?r(this,le)===ms(t):r(this,le)===Si(t)}async readlink(){var e;let t=r(this,Vt);if(t)return t;if(this.canReadlink()&&this.parent)try{let i=await r(this,at).promises.readlink(this.fullpath()),s=(e=await this.parent.realpath())==null?void 0:e.resolve(i);if(s)return f(this,Vt,s)}catch(i){m(this,v,fr).call(this,i.code);return}}readlinkSync(){var e;let t=r(this,Vt);if(t)return t;if(this.canReadlink()&&this.parent)try{let i=r(this,at).readlinkSync(this.fullpath()),s=(e=this.parent.realpathSync())==null?void 0:e.resolve(i);if(s)return f(this,Vt,s)}catch(i){m(this,v,fr).call(this,i.code);return}}async lstat(){if(!(r(this,T)&Dt))try{return m(this,v,ur).call(this,await r(this,at).promises.lstat(this.fullpath())),this}catch(t){m(this,v,cr).call(this,t.code)}}lstatSync(){if(!(r(this,T)&Dt))try{return m(this,v,ur).call(this,r(this,at).lstatSync(this.fullpath())),this}catch(t){m(this,v,cr).call(this,t.code)}}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let i=this.children();if(this.calledReaddir()){let n=i.slice(0,i.provisional);e?t(null,n):queueMicrotask(()=>t(null,n));return}if(r(this,$e).push(t),r(this,Ge))return;f(this,Ge,!0);let s=this.fullpath();r(this,at).readdir(s,{withFileTypes:!0},(n,a)=>{if(n)m(this,v,ys).call(this,n.code),i.provisional=0;else{for(let l of a)m(this,v,Ss).call(this,l,i);m(this,v,ws).call(this,i)}m(this,v,yn).call(this,i.slice(0,i.provisional))})}async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(r(this,Te))await r(this,Te);else{let i=()=>{};f(this,Te,new Promise(s=>i=s));try{for(let s of await r(this,at).promises.readdir(e,{withFileTypes:!0}))m(this,v,Ss).call(this,s,t);m(this,v,ws).call(this,t)}catch(s){m(this,v,ys).call(this,s.code),t.provisional=0}f(this,Te,void 0),i()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let i of r(this,at).readdirSync(e,{withFileTypes:!0}))m(this,v,Ss).call(this,i,t);m(this,v,ws).call(this,t)}catch(i){m(this,v,ys).call(this,i.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(r(this,T)&sn)return!1;let t=gt&r(this,T);return t===wt||t===Bt||t===ke}shouldWalk(t,e){return(r(this,T)&Bt)===Bt&&!(r(this,T)&sn)&&!t.has(this)&&(!e||e(this))}async realpath(){if(r(this,zt))return r(this,zt);if(!((gs|ds|Dt)&r(this,T)))try{let t=await r(this,at).promises.realpath(this.fullpath());return f(this,zt,this.resolve(t))}catch(t){m(this,v,lr).call(this)}}realpathSync(){if(r(this,zt))return r(this,zt);if(!((gs|ds|Dt)&r(this,T)))try{let t=r(this,at).realpathSync(this.fullpath());return f(this,zt,this.resolve(t))}catch(t){m(this,v,lr).call(this)}}[dn](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),i=[],s=this;for(;s&&s.parent;)e.add(s),f(s,Qt,i.join(this.sep)),f(s,Kt,i.join("/")),s=s.parent,i.push("..");for(s=t;s&&s.parent&&!e.has(s);)f(s,Qt,void 0),f(s,Kt,void 0),s=s.parent}};at=new WeakMap,xi=new WeakMap,ki=new WeakMap,vi=new WeakMap,Ri=new WeakMap,Ti=new WeakMap,Oi=new WeakMap,Fi=new WeakMap,Ai=new WeakMap,Di=new WeakMap,_i=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Mi=new WeakMap,Ni=new WeakMap,Bi=new WeakMap,Ii=new WeakMap,zi=new WeakMap,Wi=new WeakMap,le=new WeakMap,ve=new WeakMap,It=new WeakMap,Ht=new WeakMap,Qt=new WeakMap,Kt=new WeakMap,T=new WeakMap,Re=new WeakMap,Vt=new WeakMap,zt=new WeakMap,v=new WeakSet,ar=function(t){let e=this;for(let i of t)e=e.child(i);return e},ws=function(t){var e;f(this,T,r(this,T)|rr);for(let i=t.provisional;i<t.length;i++){let s=t[i];s&&m(e=s,v,bi).call(e)}},bi=function(){r(this,T)&Dt||(f(this,T,(r(this,T)|Dt)&gi),m(this,v,hr).call(this))},hr=function(){var e;let t=this.children();t.provisional=0;for(let i of t)m(e=i,v,bi).call(e)},lr=function(){f(this,T,r(this,T)|gs),m(this,v,Ei).call(this)},Ei=function(){if(r(this,T)&yi)return;let t=r(this,T);(t>)===Bt&&(t&=gi),f(this,T,t|yi),m(this,v,hr).call(this)},ys=function(t=""){t==="ENOTDIR"||t==="EPERM"?m(this,v,Ei).call(this):t==="ENOENT"?m(this,v,bi).call(this):this.children().provisional=0},cr=function(t=""){var e;if(t==="ENOTDIR"){let i=this.parent;m(e=i,v,Ei).call(e)}else t==="ENOENT"&&m(this,v,bi).call(this)},fr=function(t=""){var i;let e=r(this,T);e|=ds,t==="ENOENT"&&(e|=Dt),(t==="EINVAL"||t==="UNKNOWN")&&(e&=gi),f(this,T,e),t==="ENOTDIR"&&this.parent&&m(i=this.parent,v,Ei).call(i)},Ss=function(t,e){return m(this,v,gn).call(this,t,e)||m(this,v,mn).call(this,t,e)},mn=function(t,e){let i=or(t),s=this.newChild(t.name,i,{parent:this}),n=r(s,T)>return n!==Bt&&n!==ke&&n!==wt&&f(s,T,r(s,T)|yi),e.unshift(s),e.provisional++,s},gn=function(t,e){for(let i=e.provisional;i<e.length;i++){let s=e[i];if((this.nocase?ms(t.name):Si(t.name))===r(s,le))return m(this,v,wn).call(this,t,s,i,e)}},wn=function(t,e,i,s){let n=e.name;return f(e,T,r(e,T)&gi|or(t)),n!==t.name&&(e.name=t.name),i!==s.provisional&&(i===s.length-1?s.pop():s.splice(i,1),s.unshift(e)),s.provisional++,e},ur=function(t){let{atime:e,atimeMs:i,birthtime:s,birthtimeMs:n,blksize:a,blocks:l,ctime:h,ctimeMs:c,dev:p,gid:d,ino:w,mode:E,mtime:x,mtimeMs:g,nlink:C,rdev:S,size:k,uid:R}=t;f(this,Bi,e),f(this,Pi,i),f(this,Wi,s),f(this,Ni,n),f(this,Fi,a),f(this,_i,l),f(this,zi,h),f(this,Mi,c),f(this,xi,p),f(this,Ti,d),f(this,Ai,w),f(this,ki,E),f(this,Ii,x),f(this,Li,g),f(this,vi,C),f(this,Oi,S),f(this,Di,k),f(this,Ri,R);let A=or(t);f(this,T,r(this,T)&gi|A|en),A!==wt&&A!==Bt&&A!==ke&&f(this,T,r(this,T)|yi)},$e=new WeakMap,Ge=new WeakMap,yn=function(t){f(this,Ge,!1);let e=r(this,$e).slice();r(this,$e).length=0,e.forEach(i=>i(null,t))},Te=new WeakMap;Es=class o extends et{constructor(e,i=wt,s,n,a,l,h){super(e,i,s,n,a,l,h);u(this,"sep","\\");u(this,"splitSep",_h)}newChild(e,i=wt,s={}){return new o(e,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(e){return Qe.win32.parse(e).root}getRoot(e){if(e=Dh(e.toUpperCase()),e===this.root.name)return this.root;for(let[i,s]of Object.entries(this.roots))if(this.sameRoot(e,i))return this.roots[e]=s;return this.roots[e]=new Ke(e,this).root}sameRoot(e,i=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(hn,"$1\\"),e===i}},Cs=class o extends et{constructor(e,i=wt,s,n,a,l,h){super(e,i,s,n,a,l,h);u(this,"splitSep","/");u(this,"sep","/")}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,i=wt,s={}){return new o(e,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}},xs=class{constructor(t=process.cwd(),e,i,{nocase:s,childrenCacheSize:n=16*1024,fs:a=wi}={}){u(this,"root");u(this,"rootPath");u(this,"roots");u(this,"cwd");y(this,qe);y(this,He);y(this,ji);u(this,"nocase");y(this,Ui);f(this,Ui,an(a)),(t instanceof URL||t.startsWith("file://"))&&(t=(0,nn.fileURLToPath)(t));let l=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(l),f(this,qe,new bs),f(this,He,new bs),f(this,ji,new nr(n));let h=l.substring(this.rootPath.length).split(i);if(h.length===1&&!h[0]&&h.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(r(this,Ui)),this.roots[this.rootPath]=this.root;let c=this.root,p=h.length-1,d=e.sep,w=this.rootPath,E=!1;for(let x of h){let g=p--;c=c.child(x,{relative:new Array(g).fill("..").join(d),relativePosix:new Array(g).fill("..").join("/"),fullpath:w+=(E?"":d)+x}),E=!0}this.cwd=c}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return r(this,ji)}resolve(...t){let e="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(e=e?`${a}/${e}`:a,this.isAbsolute(a)))break}let i=r(this,qe).get(e);if(i!==void 0)return i;let s=this.cwd.resolve(e).fullpath();return r(this,qe).set(e,s),s}resolvePosix(...t){let e="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(e=e?`${a}/${e}`:a,this.isAbsolute(a)))break}let i=r(this,He).get(e);if(i!==void 0)return i;let s=this.cwd.resolve(e).fullpathPosix();return r(this,He).set(e,s),s}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t,t=this.cwd);let{withFileTypes:i}=e;if(t.canReaddir()){let s=await t.readdir();return i?s:s.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t,t=this.cwd);let{withFileTypes:i=!0}=e;return t.canReaddir()?i?t.readdirSync():t.readdirSync().map(s=>s.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t.withFileTypes,t=this.cwd);let i=await t.readlink();return e?i:i==null?void 0:i.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t.withFileTypes,t=this.cwd);let i=t.readlinkSync();return e?i:i==null?void 0:i.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t.withFileTypes,t=this.cwd);let i=await t.realpath();return e?i:i==null?void 0:i.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t.withFileTypes,t=this.cwd);let i=t.realpathSync();return e?i:i==null?void 0:i.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=e,l=[];(!n||n(t))&&l.push(i?t:t.fullpath());let h=new Set,c=(d,w)=>{h.add(d),d.readdirCB((E,x)=>{if(E)return w(E);let g=x.length;if(!g)return w();let C=()=>{--g===0&&w()};for(let S of x)(!n||n(S))&&l.push(i?S:S.fullpath()),s&&S.isSymbolicLink()?S.realpath().then(k=>k!=null&&k.isUnknown()?k.lstat():k).then(k=>k!=null&&k.shouldWalk(h,a)?c(k,C):C()):S.shouldWalk(h,a)?c(S,C):C()},!0)},p=t;return new Promise((d,w)=>{c(p,E=>{if(E)return w(E);d(l)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=e,l=[];(!n||n(t))&&l.push(i?t:t.fullpath());let h=new Set([t]);for(let c of h){let p=c.readdirSync();for(let d of p){(!n||n(d))&&l.push(i?d:d.fullpath());let w=d;if(d.isSymbolicLink()){if(!(s&&(w=d.realpathSync())))continue;w.isUnknown()&&w.lstatSync()}w.shouldWalk(h,a)&&h.add(w)}}return l}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=e;(!n||n(t))&&(yield i?t:t.fullpath());let l=new Set([t]);for(let h of l){let c=h.readdirSync();for(let p of c){(!n||n(p))&&(yield i?p:p.fullpath());let d=p;if(p.isSymbolicLink()){if(!(s&&(d=p.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(l,a)&&l.add(d)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=e,l=new he({objectMode:!0});(!n||n(t))&&l.write(i?t:t.fullpath());let h=new Set,c=[t],p=0,d=()=>{let w=!1;for(;!w;){let E=c.shift();if(!E){p===0&&l.end();return}p++,h.add(E);let x=(C,S,k=!1)=>{if(C)return l.emit("error",C);if(s&&!k){let R=[];for(let A of S)A.isSymbolicLink()&&R.push(A.realpath().then(_=>_!=null&&_.isUnknown()?_.lstat():_));if(R.length){Promise.all(R).then(()=>x(null,S,!0));return}}for(let R of S)R&&(!n||n(R))&&(l.write(i?R:R.fullpath())||(w=!0));p--;for(let R of S){let A=R.realpathCached()||R;A.shouldWalk(h,a)&&c.push(A)}w&&!l.flowing?l.once("drain",d):g||d()},g=!0;E.readdirCB(x,!0),g=!1}};return d(),l}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof et||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:n,walkFilter:a}=e,l=new he({objectMode:!0}),h=new Set;(!n||n(t))&&l.write(i?t:t.fullpath());let c=[t],p=0,d=()=>{let w=!1;for(;!w;){let E=c.shift();if(!E){p===0&&l.end();return}p++,h.add(E);let x=E.readdirSync();for(let g of x)(!n||n(g))&&(l.write(i?g:g.fullpath())||(w=!0));p--;for(let g of x){let C=g;if(g.isSymbolicLink()){if(!(s&&(C=g.realpathSync())))continue;C.isUnknown()&&C.lstatSync()}C.shouldWalk(h,a)&&c.push(C)}}w&&!l.flowing&&l.once("drain",d)};return d(),l}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[dn](e)}};qe=new WeakMap,He=new WeakMap,ji=new WeakMap,Ui=new WeakMap;Ke=class extends xs{constructor(e=process.cwd(),i={}){let{nocase:s=!0}=i;super(e,Qe.win32,"\\",{...i,nocase:s});u(this,"sep","\\");this.nocase=s;for(let n=this.cwd;n;n=n.parent)n.nocase=this.nocase}parseRootPath(e){return Qe.win32.parse(e).root.toUpperCase()}newRoot(e){return new Es(this.rootPath,Bt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Ve=class extends xs{constructor(e=process.cwd(),i={}){let{nocase:s=!1}=i;super(e,Qe.posix,"/",{...i,nocase:s});u(this,"sep","/");this.nocase=s}parseRootPath(e){return"/"}newRoot(e){return new Cs(this.rootPath,Bt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Ci=class extends Ve{constructor(t=process.cwd(),e={}){let{nocase:i=!0}=e;super(t,{...e,nocase:i})}},uc=process.platform==="win32"?Es:Cs,Sn=process.platform==="win32"?Ke:process.platform==="darwin"?Ci:Ve});var Lh,Mh,G,dt,Y,Oe,_t,$i,fe,ue,pe,Ze,pr,Ye,dr=D(()=>{"use strict";ee();Lh=o=>o.length>=1,Mh=o=>o.length>=1,pr=class pr{constructor(t,e,i,s){y(this,G);y(this,dt);y(this,Y);u(this,"length");y(this,Oe);y(this,_t);y(this,$i);y(this,fe);y(this,ue);y(this,pe);y(this,Ze,!0);if(!Lh(t))throw new TypeError("empty pattern list");if(!Mh(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,i<0||i>=this.length)throw new TypeError("index out of range");if(f(this,G,t),f(this,dt,e),f(this,Y,i),f(this,Oe,s),r(this,Y)===0){if(this.isUNC()){let[n,a,l,h,...c]=r(this,G),[p,d,w,E,...x]=r(this,dt);c[0]===""&&(c.shift(),x.shift());let g=[n,a,l,h,""].join("/"),C=[p,d,w,E,""].join("/");f(this,G,[g,...c]),f(this,dt,[C,...x]),this.length=r(this,G).length}else if(this.isDrive()||this.isAbsolute()){let[n,...a]=r(this,G),[l,...h]=r(this,dt);a[0]===""&&(a.shift(),h.shift());let c=n+"/",p=l+"/";f(this,G,[c,...a]),f(this,dt,[p,...h]),this.length=r(this,G).length}}}pattern(){return r(this,G)[r(this,Y)]}isString(){return typeof r(this,G)[r(this,Y)]=="string"}isGlobstar(){return r(this,G)[r(this,Y)]===J}isRegExp(){return r(this,G)[r(this,Y)]instanceof RegExp}globString(){return f(this,$i,r(this,$i)||(r(this,Y)===0?this.isAbsolute()?r(this,dt)[0]+r(this,dt).slice(1).join("/"):r(this,dt).join("/"):r(this,dt).slice(r(this,Y)).join("/")))}hasMore(){return this.length>r(this,Y)+1}rest(){return r(this,_t)!==void 0?r(this,_t):this.hasMore()?(f(this,_t,new pr(r(this,G),r(this,dt),r(this,Y)+1,r(this,Oe))),f(r(this,_t),pe,r(this,pe)),f(r(this,_t),ue,r(this,ue)),f(r(this,_t),fe,r(this,fe)),r(this,_t)):f(this,_t,null)}isUNC(){let t=r(this,G);return r(this,ue)!==void 0?r(this,ue):f(this,ue,r(this,Oe)==="win32"&&r(this,Y)===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3])}isDrive(){let t=r(this,G);return r(this,fe)!==void 0?r(this,fe):f(this,fe,r(this,Oe)==="win32"&&r(this,Y)===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]))}isAbsolute(){let t=r(this,G);return r(this,pe)!==void 0?r(this,pe):f(this,pe,t[0]===""&&t.length>1||this.isDrive()||this.isUNC())}root(){let t=r(this,G)[0];return typeof t=="string"&&this.isAbsolute()&&r(this,Y)===0?t:""}checkFollowGlobstar(){return!(r(this,Y)===0||!this.isGlobstar()||!r(this,Ze))}markFollowGlobstar(){return r(this,Y)===0||!this.isGlobstar()||!r(this,Ze)?!1:(f(this,Ze,!1),!0)}};G=new WeakMap,dt=new WeakMap,Y=new WeakMap,Oe=new WeakMap,_t=new WeakMap,$i=new WeakMap,fe=new WeakMap,ue=new WeakMap,pe=new WeakMap,Ze=new WeakMap;Ye=pr});var Nh,Je,mr=D(()=>{"use strict";ee();dr();Nh=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Je=class{constructor(t,{nobrace:e,nocase:i,noext:s,noglobstar:n,platform:a=Nh}){u(this,"relative");u(this,"relativeChildren");u(this,"absolute");u(this,"absoluteChildren");u(this,"platform");u(this,"mmopts");this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:e,nocase:i,noext:s,noglobstar:n,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let l of t)this.add(l)}add(t){let e=new ht(t,this.mmopts);for(let i=0;i<e.set.length;i++){let s=e.set[i],n=e.globParts[i];if(!s||!n)throw new Error("invalid pattern object");for(;s[0]==="."&&n[0]===".";)s.shift(),n.shift();let a=new Ye(s,n,0,this.platform),l=new ht(a.globString(),this.mmopts),h=n[n.length-1]==="**",c=a.isAbsolute();c?this.absolute.push(l):this.relative.push(l),h&&(c?this.absoluteChildren.push(l):this.relativeChildren.push(l))}}ignored(t){let e=t.fullpath(),i=`${e}/`,s=t.relative()||".",n=`${s}/`;for(let a of this.relative)if(a.match(s)||a.match(n))return!0;for(let a of this.absolute)if(a.match(e)||a.match(i))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",i=(t.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(i))return!0;for(let s of this.absoluteChildren)if(s.match(e))return!0;return!1}}});var gr,wr,yr,Gi,En=D(()=>{"use strict";ee();gr=class o{constructor(t=new Map){u(this,"store");this.store=t}copy(){return new o(new Map(this.store))}hasWalked(t,e){var i;return(i=this.store.get(t.fullpath()))==null?void 0:i.has(e.globString())}storeWalked(t,e){let i=t.fullpath(),s=this.store.get(i);s?s.add(e.globString()):this.store.set(i,new Set([e.globString()]))}},wr=class{constructor(){u(this,"store",new Map)}add(t,e,i){let s=(e?2:0)|(i?1:0),n=this.store.get(t);this.store.set(t,n===void 0?s:s&n)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},yr=class{constructor(){u(this,"store",new Map)}add(t,e){if(!t.canReaddir())return;let i=this.store.get(t);i?i.find(s=>s.globString()===e.globString())||i.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},Gi=class o{constructor(t,e){u(this,"hasWalkedCache");u(this,"matches",new wr);u(this,"subwalks",new yr);u(this,"patterns");u(this,"follow");u(this,"dot");u(this,"opts");this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new gr}processPatterns(t,e){this.patterns=e;let i=e.map(s=>[t,s]);for(let[s,n]of i){this.hasWalkedCache.storeWalked(s,n);let a=n.root(),l=n.isAbsolute()&&this.opts.absolute!==!1;if(a){s=s.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let d=n.rest();if(d)n=d;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let h,c,p=!1;for(;typeof(h=n.pattern())=="string"&&(c=n.rest());)s=s.resolve(h),n=c,p=!0;if(h=n.pattern(),c=n.rest(),p){if(this.hasWalkedCache.hasWalked(s,n))continue;this.hasWalkedCache.storeWalked(s,n)}if(typeof h=="string"){let d=h===".."||h===""||h===".";this.matches.add(s.resolve(h),l,d);continue}else if(h===J){(!s.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(s,n);let d=c==null?void 0:c.pattern(),w=c==null?void 0:c.rest();if(!c||(d===""||d===".")&&!w)this.matches.add(s,l,d===""||d===".");else if(d===".."){let E=s.parent||s;w?this.hasWalkedCache.hasWalked(E,w)||this.subwalks.add(E,w):this.matches.add(E,l,!0)}}else h instanceof RegExp&&this.subwalks.add(s,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new o(this.opts,this.hasWalkedCache)}filterEntries(t,e){let i=this.subwalks.get(t),s=this.child();for(let n of e)for(let a of i){let l=a.isAbsolute(),h=a.pattern(),c=a.rest();h===J?s.testGlobstar(n,a,c,l):h instanceof RegExp?s.testRegExp(n,h,c,l):s.testString(n,h,c,l)}return s}testGlobstar(t,e,i,s){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(i&&e.checkFollowGlobstar()?this.subwalks.add(t,i):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),i){let n=i.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,i.rest(),s);else if(n===".."){let a=t.parent||t;this.subwalks.add(a,i)}else n instanceof RegExp&&this.testRegExp(t,n,i.rest(),s)}}testRegExp(t,e,i,s){e.test(t.name)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}testString(t,e,i,s){t.isNamed(e)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}}});var Bh,Xe,Zt,Ae,yt,Fe,Sr,ks,qi,Hi,Cn=D(()=>{"use strict";sr();mr();En();Bh=(o,t)=>typeof o=="string"?new Je([o],t):Array.isArray(o)?new Je(o,t):o,ks=class{constructor(t,e,i){y(this,yt);u(this,"path");u(this,"patterns");u(this,"opts");u(this,"seen",new Set);u(this,"paused",!1);u(this,"aborted",!1);y(this,Xe,[]);y(this,Zt);y(this,Ae);u(this,"signal");u(this,"maxDepth");u(this,"includeChildMatches");var s;if(this.patterns=t,this.path=e,this.opts=i,f(this,Ae,!i.posix&&i.platform==="win32"?"\\":"/"),this.includeChildMatches=i.includeChildMatches!==!1,(i.ignore||!this.includeChildMatches)&&(f(this,Zt,Bh((s=i.ignore)!=null?s:[],i)),!this.includeChildMatches&&typeof r(this,Zt).add!="function")){let n="cannot ignore child matches, ignore lacks add() method.";throw new Error(n)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{r(this,Xe).length=0}))}pause(){this.paused=!0}resume(){var e;if((e=this.signal)!=null&&e.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=r(this,Xe).shift());)t()}onResume(t){var e;(e=this.signal)!=null&&e.aborted||(this.paused?r(this,Xe).push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=t.realpathCached()||await t.realpath(),!i)return;t=i}let n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&(n!=null&&n.isSymbolicLink())){let a=await n.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(n,e)}matchCheckTest(t,e){var i;return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!((i=t.realpathCached())!=null&&i.isDirectory()))&&!m(this,yt,Fe).call(this,t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=t.realpathCached()||t.realpathSync(),!i)return;t=i}let n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&(n!=null&&n.isSymbolicLink())){let a=n.realpathSync();a&&(a!=null&&a.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(n,e)}matchFinish(t,e){var n;if(m(this,yt,Fe).call(this,t))return;if(!this.includeChildMatches&&((n=r(this,Zt))!=null&&n.add)){let a=`${t.relativePosix()}/**`;r(this,Zt).add(a)}let i=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?r(this,Ae):"";if(this.opts.withFileTypes)this.matchEmit(t);else if(i){let a=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(a+s)}else{let a=this.opts.posix?t.relativePosix():t.relative(),l=this.opts.dotRelative&&!a.startsWith(".."+r(this,Ae))?"."+r(this,Ae):"";this.matchEmit(a?l+a+s:"."+s)}}async match(t,e,i){let s=await this.matchCheck(t,i);s&&this.matchFinish(s,e)}matchSync(t,e,i){let s=this.matchCheckSync(t,i);s&&this.matchFinish(s,e)}walkCB(t,e,i){var s;(s=this.signal)!=null&&s.aborted&&i(),this.walkCB2(t,e,new Gi(this.opts),i)}walkCB2(t,e,i,s){var l;if(m(this,yt,Sr).call(this,t))return s();if((l=this.signal)!=null&&l.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(t,e,i,s));return}i.processPatterns(t,e);let n=1,a=()=>{--n===0&&s()};for(let[h,c,p]of i.matches.entries())m(this,yt,Fe).call(this,h)||(n++,this.match(h,c,p).then(()=>a()));for(let h of i.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let c=h.readdirCached();h.calledReaddir()?this.walkCB3(h,c,i,a):h.readdirCB((p,d)=>this.walkCB3(h,d,i,a),!0)}a()}walkCB3(t,e,i,s){i=i.filterEntries(t,e);let n=1,a=()=>{--n===0&&s()};for(let[l,h,c]of i.matches.entries())m(this,yt,Fe).call(this,l)||(n++,this.match(l,h,c).then(()=>a()));for(let[l,h]of i.subwalks.entries())n++,this.walkCB2(l,h,i.child(),a);a()}walkCBSync(t,e,i){var s;(s=this.signal)!=null&&s.aborted&&i(),this.walkCB2Sync(t,e,new Gi(this.opts),i)}walkCB2Sync(t,e,i,s){var l;if(m(this,yt,Sr).call(this,t))return s();if((l=this.signal)!=null&&l.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,i,s));return}i.processPatterns(t,e);let n=1,a=()=>{--n===0&&s()};for(let[h,c,p]of i.matches.entries())m(this,yt,Fe).call(this,h)||this.matchSync(h,c,p);for(let h of i.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let c=h.readdirSync();this.walkCB3Sync(h,c,i,a)}a()}walkCB3Sync(t,e,i,s){i=i.filterEntries(t,e);let n=1,a=()=>{--n===0&&s()};for(let[l,h,c]of i.matches.entries())m(this,yt,Fe).call(this,l)||this.matchSync(l,h,c);for(let[l,h]of i.subwalks.entries())n++,this.walkCB2Sync(l,h,i.child(),a);a()}};Xe=new WeakMap,Zt=new WeakMap,Ae=new WeakMap,yt=new WeakSet,Fe=function(t){var e,i;return this.seen.has(t)||!!((i=(e=r(this,Zt))==null?void 0:e.ignored)!=null&&i.call(e,t))},Sr=function(t){var e,i;return!!((i=(e=r(this,Zt))==null?void 0:e.childrenIgnored)!=null&&i.call(e,t))};qi=class extends ks{constructor(e,i,s){super(e,i,s);u(this,"matches",new Set)}matchEmit(e){this.matches.add(e)}async walk(){var e;if((e=this.signal)!=null&&e.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((i,s)=>{this.walkCB(this.path,this.patterns,()=>{var n;(n=this.signal)!=null&&n.aborted?s(this.signal.reason):i(this.matches)})}),this.matches}walkSync(){var e;if((e=this.signal)!=null&&e.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{var i;if((i=this.signal)!=null&&i.aborted)throw this.signal.reason}),this.matches}},Hi=class extends ks{constructor(e,i,s){super(e,i,s);u(this,"results");this.results=new he({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}});var xn,Ih,Pt,br=D(()=>{"use strict";ee();xn=require("url");bn();dr();Cn();Ih=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Pt=class{constructor(t,e){u(this,"absolute");u(this,"cwd");u(this,"root");u(this,"dot");u(this,"dotRelative");u(this,"follow");u(this,"ignore");u(this,"magicalBraces");u(this,"mark");u(this,"matchBase");u(this,"maxDepth");u(this,"nobrace");u(this,"nocase");u(this,"nodir");u(this,"noext");u(this,"noglobstar");u(this,"pattern");u(this,"platform");u(this,"realpath");u(this,"scurry");u(this,"stat");u(this,"signal");u(this,"windowsPathsNoEscape");u(this,"withFileTypes");u(this,"includeChildMatches");u(this,"opts");u(this,"patterns");if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,xn.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(h=>h.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(h=>h.includes("/")?h:`./**/${h}`)}if(this.pattern=t,this.platform=e.platform||Ih,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let h=e.platform==="win32"?Ke:e.platform==="darwin"?Ci:e.platform?Ve:Sn;this.scurry=new h(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",s={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(h=>new ht(h,s)),[a,l]=n.reduce((h,c)=>(h[0].push(...c.set),h[1].push(...c.globParts),h),[[],[]]);this.patterns=a.map((h,c)=>{let p=l[c];if(!p)throw new Error("invalid pattern object");return new Ye(h,p,0,this.platform)})}async walk(){return[...await new qi(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 qi(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 Hi(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 Hi(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 Er,Cr=D(()=>{"use strict";ee();Er=(o,t={})=>{Array.isArray(o)||(o=[o]);for(let e of o)if(new ht(e,t).hasMagic())return!0;return!1}});function vs(o,t={}){return new Pt(o,t).streamSync()}function Rn(o,t={}){return new Pt(o,t).stream()}function Tn(o,t={}){return new Pt(o,t).walkSync()}async function kn(o,t={}){return new Pt(o,t).walk()}function Rs(o,t={}){return new Pt(o,t).iterateSync()}function On(o,t={}){return new Pt(o,t).iterate()}var zh,Wh,jh,Uh,Qi,vn,xr=D(()=>{"use strict";ee();br();Cr();ee();br();Cr();mr();zh=vs,Wh=Object.assign(Rn,{sync:vs}),jh=Rs,Uh=Object.assign(On,{sync:Rs}),Qi=Object.assign(Tn,{stream:vs,iterate:Rs}),vn=Object.assign(kn,{glob:kn,globSync:Tn,sync:Qi,globStream:Rn,stream:Wh,globStreamSync:vs,streamSync:zh,globIterate:On,iterate:Uh,globIterateSync:Rs,iterateSync:jh,Glob:Pt,hasMagic:Er,escape:Le,unescape:Et});vn.glob=vn});function Fn(){let o=Qi("./**/Cookies",{cwd:_e,absolute:!0});return qh.debug("Found cookie files:",o),o}var $h,Gh,qh,An=D(()=>{"use strict";$h=require("fs"),Gh=require("path");xr();jt();Ms();qh=N.withTag("listChromeProfiles")});function Kh(o){var e;let t=[/.*?0t(.+)$/,/.*?1e`(.+)$/,/.*?[`'](.+)$/,/[^\x20-\x7E]*([\x20-\x7E].+)$/];for(let i of t){let s=o.match(i),n=(e=s==null?void 0:s[1])!=null?e:"";if(n.length>0)return n}return o}async function Dn(o,t){if(typeof t!="string")throw new Error("password must be a string");if(!Buffer.isBuffer(o))throw new Error("encryptedData must be a Buffer");return new Promise((e,i)=>{(0,Ts.pbkdf2)(t,"saltysalt",1003,16,"sha1",(s,n)=>{try{if(s){i(new Error("Failed to derive key: "+s.message));return}let a=Hh(o);if(a.length%16!==0){i(new Error("Encrypted data length is not a multiple of 16"));return}let l=Buffer.alloc(16," "),h=(0,Ts.createDecipheriv)("aes-128-cbc",n,l);h.setAutoPadding(!1);let c=h.update(a);try{h.final()}catch(d){i(new Error("Failed to finalize decryption: "+d.message));return}c=Qh(c);let p=c.toString("utf8");e(Kh(p))}catch(a){i(new Error("Decryption failed: "+a.message))}})})}var Ts,kr,Hh,Qh,_n=D(()=>{"use strict";Ts=require("crypto"),kr=require("lodash-es"),Hh=(0,kr.memoize)(o=>o.length>=3&&o[0]===118&&o[1]===49&&o[2]===48?o.slice(3):o,o=>o.toString("hex")),Qh=(0,kr.memoize)(o=>{let t=o[o.length-1];return t&&t<=16?o.slice(0,-t):o},o=>o.toString("hex"))});function Zh(o,t){if(o instanceof de)throw z("Command execution failed",o,{command:o.command,originalError:o.originalError}),o;if(o instanceof Error){let i=new de(o.message,t,o);throw z("Failed to execute command",o,{command:t,stack:o.stack}),i}let e=new de("Unknown error occurred during command execution",t);throw z("Failed to execute command",null,{error:o,command:t}),e}async function Mn(o,t={}){if(!o||typeof o!="string")throw new de("Command must be a non-empty string",o);let e={encoding:"utf8",maxBuffer:5*1024*1024,timeout:3e4};try{let{stdout:i,stderr:s}=await Vh(o,{...e,...t}),n=i.trim();if(!n)throw s?new de(`Command failed with stderr: ${s}`,o):new de("Command returned empty result",o);return n}catch(i){Zh(i,o)}}var Pn,Ln,Vh,de,Nn=D(()=>{"use strict";Pn=require("child_process"),Ln=require("util");Yt();Vh=(0,Ln.promisify)(Pn.exec),de=class extends Error{constructor(e,i,s){super(e);this.command=i;this.originalError=s;this.name="CommandExecutionError"}}});var In={};ge(In,{getChromePassword:()=>Jh});var Bn,Yh,Jh,zn=D(()=>{"use strict";Bn=require("lodash-es");Nn();Yh=async()=>Mn('security find-generic-password -w -s "Chrome Safe Storage"'),Jh=(0,Bn.memoize)(Yh)});var Wn,jn,Un=D(()=>{"use strict";Wn=require("lodash-es");Yt();jn=(0,Wn.memoize)(async()=>{if(process.platform!=="darwin")throw z("Chrome password retrieval failed",new Error("This only works on macOS"),{platform:process.platform}),new Error("This only works on macOS");try{let{getChromePassword:o}=await Promise.resolve().then(()=>(zn(),In)),t=await o();return Lt("ChromePassword","Retrieved password successfully",{platform:"macOS"}),t}catch(o){throw z("Chrome password retrieval failed",o,{platform:"macOS"}),o}})});function Xh(o){return typeof o!="number"||o<=0?"Infinity":new Date(o)}function $n(o,t,e,i,s,n){return{domain:o,name:t,value:e,expiry:Xh(i),meta:{file:s,browser:"Chrome",decrypted:n}}}var ti,vr=D(()=>{"use strict";Yt();qr();An();_n();Un();ti=class{constructor(){this.logger=Lr("ChromeCookieQueryStrategy");this.browserName="Chrome"}async queryCookies(t,e){try{if(this.logger.info("Querying cookies",{name:t,domain:e}),process.platform!=="darwin")return this.logger.warn("Platform not supported",{platform:process.platform}),[];let i=Fn();if(i.length===0)return this.logger.warn("No Chrome cookie files found"),[];let s=await jn();return(await Promise.all(i.map(a=>this.processFile(a,t,e,s)))).flat()}catch(i){return i instanceof Error?z("Failed to query cookies",i,{name:t,domain:e}):z("Failed to query cookies",new Error(String(i)),{name:t,domain:e}),[]}}async processFile(t,e,i,s){try{let n=await Gr({name:e,domain:i,file:t}),a={file:t,password:s};return(await Promise.allSettled(n.map(h=>this.processCookie(h,a)))).map(h=>h.status==="fulfilled"?h.value:null).filter(h=>h!==null)}catch(n){return n instanceof Error?this.logger.error("Failed to process cookie file",{error:n,file:t}):this.logger.error("Failed to process cookie file",{error:String(n),file:t}),[]}}async processCookie(t,e){try{let i=Buffer.isBuffer(t.value)?t.value:Buffer.from(String(t.value)),s=await Dn(i,e.password);return $n(t.domain,t.name,s,t.expiry,e.file,!0)}catch(i){return i instanceof Error?this.logger.warn("Failed to decrypt cookie",{error:i}):this.logger.warn("Failed to decrypt cookie",{error:String(i)}),$n(t.domain,t.name,t.value.toString("utf-8"),t.expiry,e.file,!1)}}}});function tl(){let o=[],t=process.env.HOME;if(typeof t!="string"||t.length===0)return Yi("FirefoxCookieQuery","HOME environment variable not set"),o;let e=[(0,Rr.join)(t,"Library/Application Support/Firefox/Profiles/*/cookies.sqlite"),(0,Rr.join)(t,".mozilla/firefox/*/cookies.sqlite")];for(let i of e){let s=Qi(i);o.push(...s)}return Lt("FirefoxCookieQuery","Found Firefox cookie files",{files:o}),o}var Rr,ei,Tr=D(()=>{"use strict";Rr=require("path");xr();Yt();Ns();ei=class{constructor(){this.browserName="Firefox"}async queryCookies(t,e){let i=tl(),s=[];for(let n of i)try{let a=await Xi({file:n,sql:"SELECT name, value, host as domain, expiry FROM moz_cookies WHERE name = ? AND host LIKE ?",params:[t,`%${e}%`],rowTransform:l=>({name:l.name,value:l.value,domain:l.domain,expiry:l.expiry>0?new Date(l.expiry*1e3):"Infinity",meta:{file:n,browser:"Firefox",decrypted:!1}})});s.push(...a)}catch(a){a instanceof Error?Yi("FirefoxCookieQuery",`Error reading Firefox cookie file ${n}`,{error:a.message}):Yi("FirefoxCookieQuery",`Error reading Firefox cookie file ${n}`)}return s}}});var Gn,F,Os,Fs,qn,Hn,Qn,df,el,Ki,mf,gf,il,wf,As=D(()=>{"use strict";Gn=De(require("destr"),1),F=require("zod"),Os=F.z.string().trim().min(1,"Domain cannot be empty").refine(o=>/^\.?[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(o),"Invalid domain format"),Fs=F.z.string().trim().min(1,"Cookie name cannot be empty").refine(o=>/^[\x21\x23-\x27\x2A\x2B\x2D-\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+$/.test(o),"Invalid cookie name format - must contain only valid characters (letters, numbers, and certain symbols)"),qn=F.z.string().trim().min(1,"Path cannot be empty").refine(o=>o.startsWith("/"),"Path must start with /").refine(o=>/^\/[!#$%&'()*+,\-./:=@\w]*$/.test(o),"Invalid path format - must contain only valid URL path characters").default("/"),Hn=F.z.string().trim().transform(o=>(0,Gn.default)(o)).pipe(F.z.any()),Qn=F.z.object({name:Fs,value:Hn,domain:Os,path:qn,expiry:F.z.number().int(),creation:F.z.number().int(),flags:F.z.number().optional(),version:F.z.number().int().optional(),port:F.z.number().int().optional(),comment:F.z.string().optional(),commentURL:F.z.string().optional()}),df=F.z.object({name:Fs,domain:Os}).strict(),el=F.z.object({file:F.z.string().trim().min(1,"File path cannot be empty").optional(),browser:F.z.string().trim().optional(),decrypted:F.z.boolean().optional(),secure:F.z.boolean().optional(),httpOnly:F.z.boolean().optional(),path:qn.optional()}).catchall(F.z.unknown()).strict(),Ki=F.z.object({domain:Os,name:Fs,value:Hn,expiry:F.z.union([F.z.literal("Infinity"),F.z.date(),F.z.number().int().positive("Expiry must be a positive number")]).optional(),meta:el.optional()}).strict(),mf=F.z.object({expiry:F.z.number().int().optional(),domain:Os,name:Fs,value:F.z.union([F.z.string(),F.z.instanceof(Buffer)])}).strict(),gf=F.z.object({format:F.z.enum(["merged","grouped"]).optional(),separator:F.z.string().optional(),showFilePaths:F.z.boolean().optional()}).strict(),il=F.z.enum(["Chrome","Firefox","Safari","internal","unknown"]),wf=F.z.object({browserName:il,queryCookies:F.z.function().args(F.z.string(),F.z.string()).returns(F.z.promise(F.z.array(Ki)))}).strict()});function al(o,t){let e=t;for(;e<o.length&&o[e]!==0;)e++;return[o.toString("utf8",t,e),e+1]}function hl(o,t){let e=o.readUInt32LE(t),i=o.readUInt32LE(t+4),s=o.readUInt32LE(t+8),n=o.readUInt32LE(t+12),a=o.readUInt32LE(t+16),l=o.readUInt32LE(t+20),h=o.readUInt32LE(t+24),c=o.readUInt32LE(t+28),p=o.readUInt32LE(t+32),d=o.readUInt32LE(t+36),w=o.readDoubleLE(t+40)+Kn,E=o.readDoubleLE(t+48)+Kn,x=t+56,g;n&&(g=o.readUInt16LE(x),x+=2);let C=[{field:"url",offset:a},{field:"name",offset:l},{field:"path",offset:h},{field:"value",offset:c},{field:"comment",offset:p},{field:"commentURL",offset:d}].sort((R,A)=>R.offset-A.offset),S={};for(let{field:R,offset:A}of C)if(A>0){let[_,I]=al(o,t+A);S[R]=_,x=Math.max(x,I)}return[Qn.parse({name:S.name,value:S.value,domain:S.url.startsWith(".")?S.url.slice(1):S.url,path:S.path||"/",expiry:Math.floor(w),creation:Math.floor(E),flags:s,version:i,port:g,comment:S.comment,commentURL:S.commentURL}),e]}function ll(o,t,e){let i=t+5,s=o.readUInt32BE(i),n=t+s,a=[],l=t+e;for(;n<l-8;)try{let[h,c]=hl(o,n);a.push(h),n+=c}catch(h){console.warn(`Error decoding cookie at offset ${n}:`,h);break}return a}function Zn(o){let t=(0,Vn.readFileSync)(o);if(t.toString("utf8",0,4)!==ol)throw new Error("Invalid cookie file format: wrong magic header");let i=t.readUInt32BE(4),s=[];for(let h=0;h<i;h++)s.push(t.readUInt32BE(8+h*4));let n=8+i*4,a=[];for(let h=0;h<i;h++)try{let c=ll(t,n,s[h]);a.push(...c),n+=s[h]}catch(c){console.warn(`Error decoding page ${h}:`,c),n+=s[h]}return Number(t.readBigUInt64BE(t.length-8))!==nl&&console.warn("Invalid cookie file format: wrong footer"),a}var Vn,sl,rl,ol,nl,Kn,Yn=D(()=>{"use strict";Vn=require("fs"),sl=require("os"),rl=require("path");As();ol="cook",nl=510912288576766e3,Kn=978307200});var Jn,Ds,Xn=D(()=>{"use strict";Jn=require("path");Yt();Yn();Ds=class{constructor(){this.browserName="Safari"}getHomeDir(){let t=process.env.HOME;return typeof t!="string"||t.trim().length===0?(z("SafariCookieQueryStrategy","HOME environment variable not set"),""):t}getCookieDbPath(t){return(0,Jn.join)(t,"Library","Containers","com.apple.Safari","Data","Library","Cookies","Cookies.binarycookies")}decodeCookies(t,e,i){try{return Zn(t).filter(n=>n.name===e&&n.domain.includes(i)).map(n=>({domain:n.domain,name:n.name,value:Buffer.isBuffer(n.value)?n.value.toString():String(n.value),expiry:typeof n.expiry=="number"&&n.expiry>0?new Date(n.expiry*1e3):"Infinity",meta:{file:t,browser:"Safari",decrypted:!1}}))}catch(s){return s instanceof Error?z("SafariCookieQueryStrategy",`Error decoding ${t}`,{error:s,name:e,domain:i}):z("SafariCookieQueryStrategy",`Error decoding ${t}`,{error:"Unknown error",name:e,domain:i}),[]}}async queryCookies(t,e){let i=this.getHomeDir();if(typeof i!="string"||i.length===0)return Promise.resolve([]);let s=this.getCookieDbPath(i);return Promise.resolve(this.decodeCookies(s,t,e))}}});async function ta(o){if(!o.name||!o.domain)return[];let{name:t,domain:e}=o;if(typeof t!="string"||typeof e!="string")return[];let i=[new ti,new ei,new Ds];return(await Promise.allSettled(i.map(n=>n.queryCookies(t,e)))).filter(n=>n.status==="fulfilled").flatMap(n=>n.value)}var ea=D(()=>{"use strict";vr();Tr();Xn()});var ia={};ge(ia,{default:()=>cl,getCookie:()=>ii});async function ii(o){try{return await ta(o)}catch(t){return N.warn("Error querying cookies:",t instanceof Error?t.message:String(t)),[]}}var cl,_s=D(()=>{"use strict";jt();ea();cl=ii});var ra={};ge(ra,{default:()=>fl,getChromeCookie:()=>sa});async function sa(o){try{return await new ti().queryCookies(o.name,o.domain)}catch(t){return N.warn("Error querying Chrome cookies:",t),[]}}var fl,oa=D(()=>{"use strict";jt();vr();fl=sa});var aa={};ge(aa,{default:()=>ul,getFirefoxCookie:()=>na});async function na(o){try{return await new ei().queryCookies(o.name,o.domain)}catch(t){return N.warn("Error querying Firefox cookies:",t instanceof Error?t.message:String(t)),[]}}var ul,ha=D(()=>{"use strict";jt();Tr();ul=na});function Ps(o,t={}){let{format:e="merged",showFilePaths:i=!0,separator:s="; "}=t;if(o.length===0)return e==="merged"?"":[];if(e==="merged")return o.map(a=>a.value).join(s);let n=(0,la.groupBy)(o,a=>{var l,h;return(h=(l=a.meta)==null?void 0:l.file)!=null?h:"unknown"});return Object.entries(n).map(([a,l])=>{let h=l.map(c=>c.value).join(s);return i?`${a}: ${h}`:h})}var la,Or=D(()=>{"use strict";la=require("lodash-es")});var fa={};ge(fa,{default:()=>pl,getGroupedRenderedCookies:()=>ca});async function ca(o,t={}){try{let e=await ii(o);if(!Array.isArray(e))return[];let i=e.filter(s=>{let n=Ki.safeParse(s);return n.success?!0:(N.warn("Invalid cookie format:",n.error.format()),!1)});return Ps(i,{...t,format:"grouped"})}catch(e){return N.warn("Error getting grouped rendered cookies:",e instanceof Error?e.message:String(e)),[]}}var pl,ua=D(()=>{"use strict";As();jt();_s();Or();pl=ca});var da={};ge(da,{default:()=>dl,getMergedRenderedCookies:()=>pa});async function pa(o,t){try{let e=await ii(o);if(!Array.isArray(e))return"";let i=e.filter(n=>{let a=Ki.safeParse(n);return a.success?!0:(N.warn("Invalid cookie format:",a.error.format()),!1)}),s=Ps(i,{...t,format:"merged"});return typeof s=="string"?s:""}catch(e){return N.warn("Error getting merged rendered cookies:",e instanceof Error?e.message:String(e)),""}}var dl,ma=D(()=>{"use strict";As();jt();_s();Or();dl=pa});var bl={};ge(bl,{getChromeCookie:()=>gl,getCookie:()=>ml,getFirefoxCookie:()=>wl,getGroupedRenderedCookies:()=>yl,getMergedRenderedCookies:()=>Sl});module.exports=Ca(bl);var ml=()=>Promise.resolve().then(()=>(_s(),ia)).then(o=>o.getCookie),gl=()=>Promise.resolve().then(()=>(oa(),ra)).then(o=>o.getChromeCookie),wl=()=>Promise.resolve().then(()=>(ha(),aa)).then(o=>o.getFirefoxCookie),yl=()=>Promise.resolve().then(()=>(ua(),fa)).then(o=>o.getGroupedRenderedCookies),Sl=()=>Promise.resolve().then(()=>(ma(),da)).then(o=>o.getMergedRenderedCookies);0&&(module.exports={getChromeCookie,getCookie,getFirefoxCookie,getGroupedRenderedCookies,getMergedRenderedCookies});
|
|
4
4
|
//# sourceMappingURL=index.cjs.map
|