bit-ship
Version:
Bit-Ship CLI is tool that analyses your code and generates a custom environment for your needs You can use if to local development, CI/CD or even production.
1 lines • 93.6 kB
JavaScript
import*as t from"node:process";import{fileURLToPath as e}from"node:url";import{win32 as s,posix as i}from"node:path";import{realpathSync as r,readlinkSync as n,readdirSync as o,readdir as h,lstatSync as a,existsSync as l}from"fs";import*as c from"node:fs";import{realpath as p,readlink as d,readdir as u,lstat as f}from"node:fs/promises";import{EventEmitter as g}from"node:events";import m from"node:stream";import{StringDecoder as y}from"node:string_decoder";import{readFile as w,writeFile as v}from"fs/promises";import{exec as b}from"child_process";var S=function(){return S=Object.assign||function(t){for(var e,s=1,i=arguments.length;s<i;s++)for(var r in e=arguments[s])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},S.apply(this,arguments)};function k(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{a(i.next(t))}catch(t){n(t)}}function h(t){try{a(i.throw(t))}catch(t){n(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}a((i=i.apply(t,e||[])).next())}))}function x(t,e){var s,i,r,n={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=h(0),o.throw=h(1),o.return=h(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function h(h){return function(a){return function(h){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(n=0)),n;)try{if(s=1,i&&(r=2&h[0]?i.return:h[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,h[1])).done)return r;switch(i=0,r&&(h=[2&h[0],r.value]),h[0]){case 0:case 1:r=h;break;case 4:return n.label++,{value:h[1],done:!1};case 5:n.label++,i=h[1],h=[0];continue;case 7:h=n.ops.pop(),n.trys.pop();continue;default:if(!(r=n.trys,(r=r.length>0&&r[r.length-1])||6!==h[0]&&2!==h[0])){n=0;continue}if(3===h[0]&&(!r||h[1]>r[0]&&h[1]<r[3])){n.label=h[1];break}if(6===h[0]&&n.label<r[1]){n.label=r[1],r=h;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(h);break}r[2]&&n.ops.pop(),n.trys.pop();continue}h=e.call(t,n)}catch(t){h=[6,t],i=0}finally{s=r=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([h,a])}}}"function"==typeof SuppressedError&&SuppressedError;const E={fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},L={silent:{level:-1},fatal:{level:E.fatal},error:{level:E.error},warn:{level:E.warn},log:{level:E.log},info:{level:E.info},success:{level:E.success},fail:{level:E.fail},ready:{level:E.info},start:{level:E.info},box:{level:E.info},debug:{level:E.debug},trace:{level:E.trace},verbose:{level:E.verbose}};function C(t){if(null===t||"object"!=typeof t)return!1;const e=Object.getPrototypeOf(t);return(null===e||e===Object.prototype||null===Object.getPrototypeOf(e))&&(!(Symbol.iterator in t)&&(!(Symbol.toStringTag in t)||"[object Module]"===Object.prototype.toString.call(t)))}function T(t,e,s=".",i){if(!C(e))return T(t,{},s);const r=Object.assign({},e);for(const e in t){if("__proto__"===e||"constructor"===e)continue;const i=t[e];null!=i&&(Array.isArray(i)&&Array.isArray(r[e])?r[e]=[...i,...r[e]]:C(i)&&C(r[e])?r[e]=T(i,r[e],(s?`${s}.`:"")+e.toString()):r[e]=i)}return r}const A=(...t)=>t.reduce(((t,e)=>T(t,e,"")),{});function F(t){return e=t,"[object Object]"===Object.prototype.toString.call(e)&&(!(!t.message&&!t.args)&&!t.stack);var e}let M=!1;const O=[];class _{options;_lastLog;_mockFn;constructor(t={}){const e=t.types||L;this.options=A({...t,defaults:{...t.defaults},level:R(t.level,e),reporters:[...t.reporters||[]]},{types:L,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(const t in e){const s={type:t,...this.options.defaults,...e[t]};this[t]=this._wrapLogFn(s),this[t].raw=this._wrapLogFn(s,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(t){this.options.level=R(t,this.options.types,this.options.level)}prompt(t,e){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(t,e)}create(t){const e=new _({...this.options,...t});return this._mockFn&&e.mockTypes(this._mockFn),e}withDefaults(t){return this.create({...this.options,defaults:{...this.options.defaults,...t}})}withTag(t){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+t:t})}addReporter(t){return this.options.reporters.push(t),this}removeReporter(t){if(t){const e=this.options.reporters.indexOf(t);if(-1!==e)return this.options.reporters.splice(e,1)}else this.options.reporters.splice(0);return this}setReporters(t){return this.options.reporters=Array.isArray(t)?t:[t],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(const t in this.options.types)console["__"+t]||(console["__"+t]=console[t]),console[t]=this[t].raw}restoreConsole(){for(const t in this.options.types)console["__"+t]&&(console[t]=console["__"+t],delete console["__"+t])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(t,e){t&&(t.__write||(t.__write=t.write),t.write=t=>{this[e].raw(String(t).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(t){t&&t.__write&&(t.write=t.__write,delete t.__write)}pauseLogs(){M=!0}resumeLogs(){M=!1;const t=O.splice(0);for(const e of t)e[0]._logFn(e[1],e[2])}mockTypes(t){const e=t||this.options.mockFn;if(this._mockFn=e,"function"==typeof e)for(const t in this.options.types)this[t]=e(t,this.options.types[t])||this[t],this[t].raw=this[t]}_wrapLogFn(t,e){return(...s)=>{if(!M)return this._logFn(t,s,e);O.push([this,t,s,e])}}_logFn(t,e,s){if((t.level||0)>this.level)return!1;const i={date:new Date,args:[],...t,level:R(t.level,this.options.types)};!s&&1===e.length&&F(e[0])?Object.assign(i,e[0]):i.args=[...e],i.message&&(i.args.unshift(i.message),delete i.message),i.additional&&(Array.isArray(i.additional)||(i.additional=i.additional.split("\n")),i.args.push("\n"+i.additional.join("\n")),delete i.additional),i.type="string"==typeof i.type?i.type.toLowerCase():"log",i.tag="string"==typeof i.tag?i.tag:"";const r=(t=!1)=>{const e=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&e>0){const t=[...this._lastLog.object.args];e>1&&t.push(`(repeated ${e} times)`),this._log({...this._lastLog.object,args:t}),this._lastLog.count=1}t&&(this._lastLog.object=i,this._log(i))};clearTimeout(this._lastLog.timeout);const n=this._lastLog.time&&i.date?i.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=i.date,n<this.options.throttle)try{const t=JSON.stringify([i.type,i.tag,i.args]),e=this._lastLog.serialized===t;if(this._lastLog.serialized=t,e&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin))return void(this._lastLog.timeout=setTimeout(r,this.options.throttle))}catch{}r(!0)}_log(t){for(const e of this.options.reporters)e.log(t,{options:this.options})}}function R(t,e={},s=3){return void 0===t?s:"number"==typeof t?t:e[t]&&void 0!==e[t].level?e[t].level:s}_.prototype.add=_.prototype.addReporter,_.prototype.remove=_.prototype.removeReporter,_.prototype.clear=_.prototype.removeReporter,_.prototype.withScope=_.prototype.withTag,_.prototype.mock=_.prototype.mockTypes,_.prototype.pause=_.prototype.pauseLogs,_.prototype.resume=_.prototype.resumeLogs;class z{options;defaultColor;levelColorMap;typeColorMap;constructor(t){this.options={...t},this.defaultColor="#7f8c8d",this.levelColorMap={0:"#c0392b",1:"#f39c12",3:"#00BCD4"},this.typeColorMap={success:"#2ecc71"}}_getLogFn(t){return t<1?console.__error||console.error:1===t?console.__warn||console.warn:console.__log||console.log}log(t){const e=this._getLogFn(t.level),s="log"===t.type?"":t.type,i=t.tag||"",r=`\n background: ${this.typeColorMap[t.type]||this.levelColorMap[t.level]||this.defaultColor};\n border-radius: 0.5em;\n color: white;\n font-weight: bold;\n padding: 2px 0.5em;\n `,n=`%c${[i,s].filter(Boolean).join(":")}`;"string"==typeof t.args[0]?e(`${n}%c ${t.args[0]}`,r,"",...t.args.slice(1)):e(n,r,...t.args)}}const P=function(t={}){return function(t={}){return new _(t)}({reporters:t.reporters||[new z({})],prompt:(t,e={})=>"confirm"===e.type?Promise.resolve(confirm(t)):Promise.resolve(prompt(t)),...t})}();function j(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var D,N,B,W;var I=function(){if(W)return B;W=1;var t=function(){if(N)return D;function t(t,i,r){t instanceof RegExp&&(t=e(t,r)),i instanceof RegExp&&(i=e(i,r));var n=s(t,i,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+t.length,n[1]),post:r.slice(n[1]+i.length)}}function e(t,e){var s=e.match(t);return s?s[0]:null}function s(t,e,s){var i,r,n,o,h,a=s.indexOf(t),l=s.indexOf(e,a+1),c=a;if(a>=0&&l>0){if(t===e)return[a,l];for(i=[],n=s.length;c>=0&&!h;)c==a?(i.push(c),a=s.indexOf(t,c+1)):1==i.length?h=[i.pop(),l]:((r=i.pop())<n&&(n=r,o=l),l=s.indexOf(e,c+1)),c=a<l&&a>=0?a:l;i.length&&(h=[n,o])}return h}return N=1,D=t,t.range=s,D}();B=function(t){if(!t)return[];"{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2));return u(function(t){return t.split("\\\\").join(e).split("\\{").join(s).split("\\}").join(i).split("\\,").join(r).split("\\.").join(n)}(t),!0).map(h)};var e="\0SLASH"+Math.random()+"\0",s="\0OPEN"+Math.random()+"\0",i="\0CLOSE"+Math.random()+"\0",r="\0COMMA"+Math.random()+"\0",n="\0PERIOD"+Math.random()+"\0";function o(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function h(t){return t.split(e).join("\\").split(s).join("{").split(i).join("}").split(r).join(",").split(n).join(".")}function a(e){if(!e)return[""];var s=[],i=t("{","}",e);if(!i)return e.split(",");var r=i.pre,n=i.body,o=i.post,h=r.split(",");h[h.length-1]+="{"+n+"}";var l=a(o);return o.length&&(h[h.length-1]+=l.shift(),h.push.apply(h,l)),s.push.apply(s,h),s}function l(t){return"{"+t+"}"}function c(t){return/^-?0\d/.test(t)}function p(t,e){return t<=e}function d(t,e){return t>=e}function u(e,s){var r=[],n=t("{","}",e);if(!n)return[e];var h=n.pre,f=n.post.length?u(n.post,!1):[""];if(/\$$/.test(n.pre))for(var g=0;g<f.length;g++){var m=h+"{"+n.body+"}"+f[g];r.push(m)}else{var y,w,v=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),b=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),S=v||b,k=n.body.indexOf(",")>=0;if(!S&&!k)return n.post.match(/,.*\}/)?u(e=n.pre+"{"+n.body+i+n.post):[e];if(S)y=n.body.split(/\.\./);else if(1===(y=a(n.body)).length&&1===(y=u(y[0],!1).map(l)).length)return f.map((function(t){return n.pre+y[0]+t}));if(S){var x=o(y[0]),E=o(y[1]),L=Math.max(y[0].length,y[1].length),C=3==y.length?Math.abs(o(y[2])):1,T=p;E<x&&(C*=-1,T=d);var A=y.some(c);w=[];for(var F=x;T(F,E);F+=C){var M;if(b)"\\"===(M=String.fromCharCode(F))&&(M="");else if(M=String(F),A){var O=L-M.length;if(O>0){var _=new Array(O+1).join("0");M=F<0?"-"+_+M.slice(1):_+M}}w.push(M)}}else{w=[];for(var R=0;R<y.length;R++)w.push.apply(w,u(y[R],!1))}for(R=0;R<w.length;R++)for(g=0;g<f.length;g++){m=h+w[R]+f[g];(!s||S||m)&&r.push(m)}}return r}return B}(),$=j(I);const U=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")},G={"[: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]},H=t=>t.replace(/[[\]\\-]/g,"\\$&"),q=t=>t.join(""),J=(t,e)=>{const s=e;if("["!==t.charAt(s))throw new Error("not in a brace expression");const i=[],r=[];let n=s+1,o=!1,h=!1,a=!1,l=!1,c=s,p="";t:for(;n<t.length;){const e=t.charAt(n);if("!"!==e&&"^"!==e||n!==s+1){if("]"===e&&o&&!a){c=n+1;break}if(o=!0,"\\"!==e||a){if("["===e&&!a)for(const[e,[o,a,l]]of Object.entries(G))if(t.startsWith(e,n)){if(p)return["$.",!1,t.length-s,!0];n+=e.length,l?r.push(o):i.push(o),h=h||a;continue t}a=!1,p?(e>p?i.push(H(p)+"-"+H(e)):e===p&&i.push(H(e)),p="",n++):t.startsWith("-]",n+1)?(i.push(H(e+"-")),n+=2):t.startsWith("-",n+1)?(p=e,n+=2):(i.push(H(e)),n++)}else a=!0,n++}else l=!0,n++}if(c<n)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,t.length-s,!0];if(0===r.length&&1===i.length&&/^\\?.$/.test(i[0])&&!l){const t=2===i[0].length?i[0].slice(-1):i[0];return[(d=t,d.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")),!1,c-s,!1]}var d;const u="["+(l?"^":"")+q(i)+"]",f="["+(l?"":"^")+q(r)+"]";return[i.length&&r.length?"("+u+"|"+f+")":i.length?u:f,h,c-s,!0]},V=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),Z=new Set(["!","?","+","*","@"]),Y=t=>Z.has(t),K="(?!\\.)",X=new Set(["[","."]),Q=new Set(["..","."]),tt=new Set("().*{}+?[]^$\\!"),et="[^/]",st=et+"*?",it=et+"+?";class rt{type;#t;#e;#s=!1;#i=[];#r;#n;#o;#h=!1;#a;#l;#c=!1;constructor(t,e,s={}){this.type=t,t&&(this.#e=!0),this.#r=e,this.#t=this.#r?this.#r.#t:this,this.#a=this.#t===this?s:this.#t.#a,this.#o=this.#t===this?[]:this.#t.#o,"!"!==t||this.#t.#h||this.#o.push(this),this.#n=this.#r?this.#r.#i.length:0}get hasMagic(){if(void 0!==this.#e)return this.#e;for(const t of this.#i)if("string"!=typeof t&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return void 0!==this.#l?this.#l:this.type?this.#l=this.type+"("+this.#i.map((t=>String(t))).join("|")+")":this.#l=this.#i.map((t=>String(t))).join("")}#p(){if(this!==this.#t)throw new Error("should only call on root");if(this.#h)return this;let t;for(this.toString(),this.#h=!0;t=this.#o.pop();){if("!"!==t.type)continue;let e=t,s=e.#r;for(;s;){for(let i=e.#n+1;!s.type&&i<s.#i.length;i++)for(const e of t.#i){if("string"==typeof e)throw new Error("string part in extglob AST??");e.copyIn(s.#i[i])}e=s,s=e.#r}}return this}push(...t){for(const e of t)if(""!==e){if("string"!=typeof e&&!(e instanceof rt&&e.#r===this))throw new Error("invalid part: "+e);this.#i.push(e)}}toJSON(){const t=null===this.type?this.#i.slice().map((t=>"string"==typeof t?t:t.toJSON())):[this.type,...this.#i.map((t=>t.toJSON()))];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#h&&"!"===this.#r?.type)&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#r?.isStart())return!1;if(0===this.#n)return!0;const t=this.#r;for(let e=0;e<this.#n;e++){const s=t.#i[e];if(!(s instanceof rt&&"!"===s.type))return!1}return!0}isEnd(){if(this.#t===this)return!0;if("!"===this.#r?.type)return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();const t=this.#r?this.#r.#i.length:0;return this.#n===t-1}copyIn(t){"string"==typeof t?this.push(t):this.push(t.clone(this))}clone(t){const e=new rt(this.type,t);for(const t of this.#i)e.copyIn(t);return e}static#d(t,e,s,i){let r=!1,n=!1,o=-1,h=!1;if(null===e.type){let a=s,l="";for(;a<t.length;){const s=t.charAt(a++);if(r||"\\"===s)r=!r,l+=s;else if(n)a===o+1?"^"!==s&&"!"!==s||(h=!0):"]"!==s||a===o+2&&h||(n=!1),l+=s;else if("["!==s)if(i.noext||!Y(s)||"("!==t.charAt(a))l+=s;else{e.push(l),l="";const r=new rt(s,e);a=rt.#d(t,r,a,i),e.push(r)}else n=!0,o=a,h=!1,l+=s}return e.push(l),a}let a=s+1,l=new rt(null,e);const c=[];let p="";for(;a<t.length;){const s=t.charAt(a++);if(r||"\\"===s)r=!r,p+=s;else if(n)a===o+1?"^"!==s&&"!"!==s||(h=!0):"]"!==s||a===o+2&&h||(n=!1),p+=s;else if("["!==s)if(Y(s)&&"("===t.charAt(a)){l.push(p),p="";const e=new rt(s,l);l.push(e),a=rt.#d(t,e,a,i)}else if("|"!==s){if(")"===s)return""===p&&0===e.#i.length&&(e.#c=!0),l.push(p),p="",e.push(...c,l),a;p+=s}else l.push(p),p="",c.push(l),l=new rt(null,e);else n=!0,o=a,h=!1,p+=s}return e.type=null,e.#e=void 0,e.#i=[t.substring(s-1)],a}static fromGlob(t,e={}){const s=new rt(null,void 0,e);return rt.#d(t,s,0,e),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();const t=this.toString(),[e,s,i,r]=this.toRegExpSource();if(!(i||this.#e||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;const n=(this.#a.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,n),{_src:e,_glob:t})}get options(){return this.#a}toRegExpSource(t){const e=t??!!this.#a.dot;if(this.#t===this&&this.#p(),!this.type){const s=this.isStart()&&this.isEnd(),i=this.#i.map((e=>{const[i,r,n,o]="string"==typeof e?rt.#u(e,this.#e,s):e.toRegExpSource(t);return this.#e=this.#e||n,this.#s=this.#s||o,i})).join("");let r="";if(this.isStart()&&"string"==typeof this.#i[0]){if(!(1===this.#i.length&&Q.has(this.#i[0]))){const s=X,n=e&&s.has(i.charAt(0))||i.startsWith("\\.")&&s.has(i.charAt(2))||i.startsWith("\\.\\.")&&s.has(i.charAt(4)),o=!e&&!t&&s.has(i.charAt(0));r=n?"(?!(?:^|/)\\.\\.?(?:$|/))":o?K:""}}let n="";this.isEnd()&&this.#t.#h&&"!"===this.#r?.type&&(n="(?:$|\\/)");return[r+i+n,V(i),this.#e=!!this.#e,this.#s]}const s="*"===this.type||"+"===this.type,i="!"===this.type?"(?:(?!(?:":"(?:";let r=this.#f(e);if(this.isStart()&&this.isEnd()&&!r&&"!"!==this.type){const t=this.toString();return this.#i=[t],this.type=null,this.#e=void 0,[t,V(this.toString()),!1,!1]}let n=!s||t||e?"":this.#f(!0);n===r&&(n=""),n&&(r=`(?:${r})(?:${n})*?`);let o="";if("!"===this.type&&this.#c)o=(this.isStart()&&!e?K:"")+it;else{o=i+r+("!"===this.type?"))"+(!this.isStart()||e||t?"":K)+st+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&n?")":"*"===this.type&&n?")?":`)${this.type}`)}return[o,V(r),this.#e=!!this.#e,this.#s]}#f(t){return this.#i.map((e=>{if("string"==typeof e)throw new Error("string type in extglob ast??");const[s,i,r,n]=e.toRegExpSource(t);return this.#s=this.#s||n,s})).filter((t=>!(this.isStart()&&this.isEnd()&&!t))).join("|")}static#u(t,e,s=!1){let i=!1,r="",n=!1;for(let o=0;o<t.length;o++){const h=t.charAt(o);if(i)i=!1,r+=(tt.has(h)?"\\":"")+h;else if("\\"!==h){if("["===h){const[s,i,h,a]=J(t,o);if(h){r+=s,n=n||i,o+=h-1,e=e||a;continue}}"*"!==h?"?"!==h?r+=h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):(r+=et,e=!0):(r+=s&&"*"===t?it:st,e=!0)}else o===t.length-1?r+="\\\\":i=!0}return[r,V(t),!!e,n]}}const nt=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&"),ot=(t,e,s={})=>(U(e),!(!s.nocomment&&"#"===e.charAt(0))&&new _t(e,s).match(t)),ht=/^\*+([^+@!?\*\[\(]*)$/,at=t=>e=>!e.startsWith(".")&&e.endsWith(t),lt=t=>e=>e.endsWith(t),ct=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),pt=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),dt=/^\*+\.\*+$/,ut=t=>!t.startsWith(".")&&t.includes("."),ft=t=>"."!==t&&".."!==t&&t.includes("."),gt=/^\.\*+$/,mt=t=>"."!==t&&".."!==t&&t.startsWith("."),yt=/^\*+$/,wt=t=>0!==t.length&&!t.startsWith("."),vt=t=>0!==t.length&&"."!==t&&".."!==t,bt=/^\?+([^+@!?\*\[\(]*)?$/,St=([t,e=""])=>{const s=Lt([t]);return e?(e=e.toLowerCase(),t=>s(t)&&t.toLowerCase().endsWith(e)):s},kt=([t,e=""])=>{const s=Ct([t]);return e?(e=e.toLowerCase(),t=>s(t)&&t.toLowerCase().endsWith(e)):s},xt=([t,e=""])=>{const s=Ct([t]);return e?t=>s(t)&&t.endsWith(e):s},Et=([t,e=""])=>{const s=Lt([t]);return e?t=>s(t)&&t.endsWith(e):s},Lt=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")},Ct=([t])=>{const e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},Tt="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";ot.sep="win32"===Tt?{sep:"\\"}.sep:{sep:"/"}.sep;const At=Symbol("globstar **");ot.GLOBSTAR=At;ot.filter=(t,e={})=>s=>ot(s,t,e);const Ft=(t,e={})=>Object.assign({},t,e);ot.defaults=t=>{if(!t||"object"!=typeof t||!Object.keys(t).length)return ot;const e=ot;return Object.assign(((s,i,r={})=>e(s,i,Ft(t,r))),{Minimatch:class extends e.Minimatch{constructor(e,s={}){super(e,Ft(t,s))}static defaults(s){return e.defaults(Ft(t,s)).Minimatch}},AST:class extends e.AST{constructor(e,s,i={}){super(e,s,Ft(t,i))}static fromGlob(s,i={}){return e.AST.fromGlob(s,Ft(t,i))}},unescape:(s,i={})=>e.unescape(s,Ft(t,i)),escape:(s,i={})=>e.escape(s,Ft(t,i)),filter:(s,i={})=>e.filter(s,Ft(t,i)),defaults:s=>e.defaults(Ft(t,s)),makeRe:(s,i={})=>e.makeRe(s,Ft(t,i)),braceExpand:(s,i={})=>e.braceExpand(s,Ft(t,i)),match:(s,i,r={})=>e.match(s,i,Ft(t,r)),sep:e.sep,GLOBSTAR:At})};const Mt=(t,e={})=>(U(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:$(t));ot.braceExpand=Mt;ot.makeRe=(t,e={})=>new _t(t,e).makeRe();ot.match=(t,e,s={})=>{const i=new _t(e,s);return t=t.filter((t=>i.match(t))),i.options.nonull&&!t.length&&t.push(e),t};const Ot=/[?*]|[+@!]\(.*?\)|\[|\]/;class _t{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){U(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||Tt,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,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=void 0!==e.windowsNoMagicRoot?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(const t of this.set)for(const e of t)if("string"!=typeof e)return!0;return!1}debug(...t){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);const s=this.globSet.map((t=>this.slashSplit(t)));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map(((t,e,s)=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=!(""!==t[0]||""!==t[1]||"?"!==t[2]&&Ot.test(t[2])||Ot.test(t[3])),s=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map((t=>this.parse(t)))];if(s)return[t[0],...t.slice(1).map((t=>this.parse(t)))]}return t.map((t=>this.parse(t)))}));if(this.debug(this.pattern,i),this.set=i.filter((t=>-1===t.indexOf(!1))),this.isWindows)for(let t=0;t<this.set.length;t++){const e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let s=0;s<t[e].length;s++)"**"===t[e][s]&&(t[e][s]="*");const{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map((t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let s=e;for(;"**"===t[s+1];)s++;s!==e&&t.splice(e,s-e)}return t}))}levelOneOptimize(t){return t.map((t=>0===(t=t.reduce(((t,e)=>{const s=t[t.length-1];return"**"===e&&"**"===s?t:".."===e&&s&&".."!==s&&"."!==s&&"**"!==s?(t.pop(),t):(t.push(e),t)}),[])).length?[""]:t))}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++){const i=t[s];1===s&&""===i&&""===t[0]||("."!==i&&""!==i||(e=!0,t.splice(s,1),s--))}"."!==t[0]||2!==t.length||"."!==t[1]&&""!==t[1]||(e=!0,t.pop())}let s=0;for(;-1!==(s=t.indexOf("..",s+1));){const i=t[s-1];i&&"."!==i&&".."!==i&&"**"!==i&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let i=-1;for(;-1!==(i=s.indexOf("**",i+1));){let r=i;for(;"**"===s[r+1];)r++;r>i&&s.splice(i+1,r-i);let n=s[i+1];const o=s[i+2],h=s[i+3];if(".."!==n)continue;if(!o||"."===o||".."===o||!h||"."===h||".."===h)continue;e=!0,s.splice(i,1);const a=s.slice(0);a[i]="**",t.push(a),i--}if(!this.preserveMultipleSlashes){for(let t=1;t<s.length-1;t++){const i=s[t];1===t&&""===i&&""===s[0]||("."!==i&&""!==i||(e=!0,s.splice(t,1),t--))}"."!==s[0]||2!==s.length||"."!==s[1]&&""!==s[1]||(e=!0,s.pop())}let r=0;for(;-1!==(r=s.indexOf("..",r+1));){const t=s[r-1];if(t&&"."!==t&&".."!==t&&"**"!==t){e=!0;const t=1===r&&"**"===s[r+1]?["."]:[];s.splice(r-1,2,...t),0===s.length&&s.push(""),r-=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++){const i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[],t[s]=i;break}}return t.filter((t=>t.length))}partsMatch(t,e,s=!1){let i=0,r=0,n=[],o="";for(;i<t.length&&r<e.length;)if(t[i]===e[r])n.push("b"===o?e[r]:t[i]),i++,r++;else if(s&&"**"===t[i]&&e[r]===t[i+1])n.push(t[i]),i++;else if(s&&"**"===e[r]&&t[i]===e[r+1])n.push(e[r]),r++;else if("*"!==t[i]||!e[r]||!this.options.dot&&e[r].startsWith(".")||"**"===e[r]){if("*"!==e[r]||!t[i]||!this.options.dot&&t[i].startsWith(".")||"**"===t[i])return!1;if("a"===o)return!1;o="b",n.push(e[r]),i++,r++}else{if("b"===o)return!1;o="a",n.push(t[i]),i++,r++}return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;const t=this.pattern;let 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){const i=this.options;if(this.isWindows){const s="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),i=!s&&""===t[0]&&""===t[1]&&"?"===t[2]&&/^[a-z]:$/i.test(t[3]),r="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),n=i?3:s?0:void 0,o=!r&&""===e[0]&&""===e[1]&&"?"===e[2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])?3:r?0:void 0;if("number"==typeof n&&"number"==typeof o){const[s,i]=[t[n],e[o]];s.toLowerCase()===i.toLowerCase()&&(e[o]=s,o>n?e=e.slice(o):n>o&&(t=t.slice(n)))}}const{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var n=0,o=0,h=t.length,a=e.length;n<h&&o<a;n++,o++){this.debug("matchOne loop");var l=e[o],c=t[n];if(this.debug(e,l,c),!1===l)return!1;if(l===At){this.debug("GLOBSTAR",[e,l,c]);var p=n,d=o+1;if(d===a){for(this.debug("** at the end");n<h;n++)if("."===t[n]||".."===t[n]||!i.dot&&"."===t[n].charAt(0))return!1;return!0}for(;p<h;){var u=t[p];if(this.debug("\nglobstar while",t,p,e,d,u),this.matchOne(t.slice(p),e.slice(d),s))return this.debug("globstar found match!",p,h,u),!0;if("."===u||".."===u||!i.dot&&"."===u.charAt(0)){this.debug("dot detected!",t,p,e,d);break}this.debug("globstar swallow a segment, and continue"),p++}return!(!s||(this.debug("\n>>> no match, partial?",t,p,e,d),p!==h))}let r;if("string"==typeof l?(r=c===l,this.debug("string match",l,c,r)):(r=l.test(c),this.debug("pattern match",l,c,r)),!r)return!1}if(n===h&&o===a)return!0;if(n===h)return s;if(o===a)return n===h-1&&""===t[n];throw new Error("wtf?")}braceExpand(){return Mt(this.pattern,this.options)}parse(t){U(t);const e=this.options;if("**"===t)return At;if(""===t)return"";let s,i=null;(s=t.match(yt))?i=e.dot?vt:wt:(s=t.match(ht))?i=(e.nocase?e.dot?pt:ct:e.dot?lt:at)(s[1]):(s=t.match(bt))?i=(e.nocase?e.dot?kt:St:e.dot?xt:Et)(s):(s=t.match(dt))?i=e.dot?ft:ut:(s=t.match(gt))&&(i=mt);const r=rt.fromGlob(t,this.options).toMMPattern();return i&&"object"==typeof r&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const e=this.options,s=e.noglobstar?"[^/]*?":e.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=new Set(e.nocase?["i"]:[]);let r=t.map((t=>{const e=t.map((t=>{if(t instanceof RegExp)for(const e of t.flags.split(""))i.add(e);return"string"==typeof t?t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):t===At?At:t._src}));return e.forEach(((t,i)=>{const r=e[i+1],n=e[i-1];t===At&&n!==At&&(void 0===n?void 0!==r&&r!==At?e[i+1]="(?:\\/|"+s+"\\/)?"+r:e[i]=s:void 0===r?e[i-1]=n+"(?:\\/|"+s+")?":r!==At&&(e[i-1]=n+"(?:\\/|\\/"+s+"\\/)"+r,e[i+1]=At))})),e.filter((t=>t!==At)).join("/")})).join("|");const[n,o]=t.length>1?["(?:",")"]:["",""];r="^"+n+r+o+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch(t){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;const s=this.options;this.isWindows&&(t=t.split("\\").join("/"));const i=this.slashSplit(t);this.debug(this.pattern,"split",i);const r=this.set;this.debug(this.pattern,"set",r);let n=i[i.length-1];if(!n)for(let t=i.length-2;!n&&t>=0;t--)n=i[t];for(let t=0;t<r.length;t++){const o=r[t];let h=i;s.matchBase&&1===o.length&&(h=[n]);if(this.matchOne(h,o,e))return!!s.flipNegate||!this.negate}return!s.flipNegate&&this.negate}static defaults(t){return ot.defaults(t).Minimatch}}ot.AST=rt,ot.Minimatch=_t,ot.escape=nt,ot.unescape=V;const Rt="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,zt=new Set,Pt="object"==typeof process&&process?process:{},jt=(t,e,s,i)=>{"function"==typeof Pt.emitWarning?Pt.emitWarning(t,e,s,i):console.error(`[${s}] ${e}: ${t}`)};let Dt=globalThis.AbortController,Nt=globalThis.AbortSignal;if(void 0===Dt){Nt=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},Dt=class{constructor(){e()}signal=new Nt;abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=!0;for(const e of this.signal._onabort)e(t);this.signal.onabort?.(t)}}};let t="1"!==Pt.env?.LRU_CACHE_IGNORE_AC_WARNING;const e=()=>{t&&(t=!1,jt("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",e))}}const Bt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Wt=t=>Bt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?It:null:null;class It extends Array{constructor(t){super(t),this.fill(0)}}class $t{heap;length;static#g=!1;static create(t){const e=Wt(t);if(!e)return[];$t.#g=!0;const s=new $t(t,e);return $t.#g=!1,s}constructor(t,e){if(!$t.#g)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class Ut{#m;#y;#w;#v;#b;#S;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#k;#x;#E;#L;#C;#T;#A;#F;#M;#O;#_;#R;#z;#P;#j;#D;#N;static unsafeExposeInternals(t){return{starts:t.#z,ttls:t.#P,sizes:t.#R,keyMap:t.#E,keyList:t.#L,valList:t.#C,next:t.#T,prev:t.#A,get head(){return t.#F},get tail(){return t.#M},free:t.#O,isBackgroundFetch:e=>t.#B(e),backgroundFetch:(e,s,i,r)=>t.#W(e,s,i,r),moveToTail:e=>t.#I(e),indexes:e=>t.#$(e),rindexes:e=>t.#U(e),isStale:e=>t.#G(e)}}get max(){return this.#m}get maxSize(){return this.#y}get calculatedSize(){return this.#x}get size(){return this.#k}get fetchMethod(){return this.#b}get memoMethod(){return this.#S}get dispose(){return this.#w}get disposeAfter(){return this.#v}constructor(t){const{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:n,updateAgeOnHas:o,allowStale:h,dispose:a,disposeAfter:l,noDisposeOnSet:c,noUpdateTTL:p,maxSize:d=0,maxEntrySize:u=0,sizeCalculation:f,fetchMethod:g,memoMethod:m,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:b,ignoreFetchAbort:S}=t;if(0!==e&&!Bt(e))throw new TypeError("max option must be a nonnegative integer");const k=e?Wt(e):Array;if(!k)throw new Error("invalid max value: "+e);if(this.#m=e,this.#y=d,this.maxEntrySize=u||this.#y,this.sizeCalculation=f,this.sizeCalculation){if(!this.#y&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==m&&"function"!=typeof m)throw new TypeError("memoMethod must be a function if defined");if(this.#S=m,void 0!==g&&"function"!=typeof g)throw new TypeError("fetchMethod must be a function if specified");if(this.#b=g,this.#D=!!g,this.#E=new Map,this.#L=new Array(e).fill(void 0),this.#C=new Array(e).fill(void 0),this.#T=new k(e),this.#A=new k(e),this.#F=0,this.#M=0,this.#O=$t.create(e),this.#k=0,this.#x=0,"function"==typeof a&&(this.#w=a),"function"==typeof l?(this.#v=l,this.#_=[]):(this.#v=void 0,this.#_=void 0),this.#j=!!this.#w,this.#N=!!this.#v,this.noDisposeOnSet=!!c,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!v,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!S,0!==this.maxEntrySize){if(0!==this.#y&&!Bt(this.#y))throw new TypeError("maxSize must be a positive integer if specified");if(!Bt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#H()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!o,this.ttlResolution=Bt(i)||0===i?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!Bt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#q()}if(0===this.#m&&0===this.ttl&&0===this.#y)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#m&&!this.#y){const t="LRU_CACHE_UNBOUNDED";if((t=>!zt.has(t))(t)){zt.add(t);jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,Ut)}}}getRemainingTTL(t){return this.#E.has(t)?1/0:0}#q(){const t=new It(this.#m),e=new It(this.#m);this.#P=t,this.#z=e,this.#J=(s,i,r=Rt.now())=>{if(e[s]=0!==i?r:0,t[s]=i,0!==i&&this.ttlAutopurge){const t=setTimeout((()=>{this.#G(s)&&this.#V(this.#L[s],"expire")}),i+1);t.unref&&t.unref()}},this.#Z=s=>{e[s]=0!==t[s]?Rt.now():0},this.#Y=(r,n)=>{if(t[n]){const o=t[n],h=e[n];if(!o||!h)return;r.ttl=o,r.start=h,r.now=s||i();const a=r.now-h;r.remainingTTL=o-a}};let s=0;const i=()=>{const t=Rt.now();if(this.ttlResolution>0){s=t;const e=setTimeout((()=>s=0),this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=r=>{const n=this.#E.get(r);if(void 0===n)return 0;const o=t[n],h=e[n];if(!o||!h)return 1/0;return o-((s||i())-h)},this.#G=r=>{const n=e[r],o=t[r];return!!o&&!!n&&(s||i())-n>o}}#Z=()=>{};#Y=()=>{};#J=()=>{};#G=()=>!1;#H(){const t=new It(this.#m);this.#x=0,this.#R=t,this.#K=e=>{this.#x-=t[e],t[e]=0},this.#X=(t,e,s,i)=>{if(this.#B(e))return 0;if(!Bt(s)){if(!i)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof i)throw new TypeError("sizeCalculation must be a function");if(s=i(e,t),!Bt(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return s},this.#Q=(e,s,i)=>{if(t[e]=s,this.#y){const s=this.#y-t[e];for(;this.#x>s;)this.#tt(!0)}this.#x+=t[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#x)}}#K=t=>{};#Q=(t,e,s)=>{};#X=(t,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#$({allowStale:t=this.allowStale}={}){if(this.#k)for(let e=this.#M;this.#et(e)&&(!t&&this.#G(e)||(yield e),e!==this.#F);)e=this.#A[e]}*#U({allowStale:t=this.allowStale}={}){if(this.#k)for(let e=this.#F;this.#et(e)&&(!t&&this.#G(e)||(yield e),e!==this.#M);)e=this.#T[e]}#et(t){return void 0!==t&&this.#E.get(this.#L[t])===t}*entries(){for(const t of this.#$())void 0===this.#C[t]||void 0===this.#L[t]||this.#B(this.#C[t])||(yield[this.#L[t],this.#C[t]])}*rentries(){for(const t of this.#U())void 0===this.#C[t]||void 0===this.#L[t]||this.#B(this.#C[t])||(yield[this.#L[t],this.#C[t]])}*keys(){for(const t of this.#$()){const e=this.#L[t];void 0===e||this.#B(this.#C[t])||(yield e)}}*rkeys(){for(const t of this.#U()){const e=this.#L[t];void 0===e||this.#B(this.#C[t])||(yield e)}}*values(){for(const t of this.#$()){void 0===this.#C[t]||this.#B(this.#C[t])||(yield this.#C[t])}}*rvalues(){for(const t of this.#U()){void 0===this.#C[t]||this.#B(this.#C[t])||(yield this.#C[t])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const s of this.#$()){const i=this.#C[s],r=this.#B(i)?i.__staleWhileFetching:i;if(void 0!==r&&t(r,this.#L[s],this))return this.get(this.#L[s],e)}}forEach(t,e=this){for(const s of this.#$()){const i=this.#C[s],r=this.#B(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.#L[s],this)}}rforEach(t,e=this){for(const s of this.#U()){const i=this.#C[s],r=this.#B(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.#L[s],this)}}purgeStale(){let t=!1;for(const e of this.#U({allowStale:!0}))this.#G(e)&&(this.#V(this.#L[e],"expire"),t=!0);return t}info(t){const e=this.#E.get(t);if(void 0===e)return;const s=this.#C[e],i=this.#B(s)?s.__staleWhileFetching:s;if(void 0===i)return;const r={value:i};if(this.#P&&this.#z){const t=this.#P[e],s=this.#z[e];if(t&&s){const e=t-(Rt.now()-s);r.ttl=e,r.start=Date.now()}}return this.#R&&(r.size=this.#R[e]),r}dump(){const t=[];for(const e of this.#$({allowStale:!0})){const s=this.#L[e],i=this.#C[e],r=this.#B(i)?i.__staleWhileFetching:i;if(void 0===r||void 0===s)continue;const n={value:r};if(this.#P&&this.#z){n.ttl=this.#P[e];const t=Rt.now()-this.#z[e];n.start=Math.floor(Date.now()-t)}this.#R&&(n.size=this.#R[e]),t.unshift([s,n])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=Rt.now()-t}this.set(e,s.value,s)}}set(t,e,s={}){if(void 0===e)return this.delete(t),this;const{ttl:i=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:h}=s;let{noUpdateTTL:a=this.noUpdateTTL}=s;const l=this.#X(t,e,s.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.#V(t,"set"),this;let c=0===this.#k?void 0:this.#E.get(t);if(void 0===c)c=0===this.#k?this.#M:0!==this.#O.length?this.#O.pop():this.#k===this.#m?this.#tt(!1):this.#k,this.#L[c]=t,this.#C[c]=e,this.#E.set(t,c),this.#T[this.#M]=c,this.#A[c]=this.#M,this.#M=c,this.#k++,this.#Q(c,l,h),h&&(h.set="add"),a=!1;else{this.#I(c);const s=this.#C[c];if(e!==s){if(this.#D&&this.#B(s)){s.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=s;void 0===e||n||(this.#j&&this.#w?.(e,t,"set"),this.#N&&this.#_?.push([e,t,"set"]))}else n||(this.#j&&this.#w?.(s,t,"set"),this.#N&&this.#_?.push([s,t,"set"]));if(this.#K(c),this.#Q(c,l,h),this.#C[c]=e,h){h.set="replace";const t=s&&this.#B(s)?s.__staleWhileFetching:s;void 0!==t&&(h.oldValue=t)}}else h&&(h.set="update")}if(0===i||this.#P||this.#q(),this.#P&&(a||this.#J(c,i,r),h&&this.#Y(h,c)),!n&&this.#N&&this.#_){const t=this.#_;let e;for(;e=t?.shift();)this.#v?.(...e)}return this}pop(){try{for(;this.#k;){const t=this.#C[this.#F];if(this.#tt(!0),this.#B(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#N&&this.#_){const t=this.#_;let e;for(;e=t?.shift();)this.#v?.(...e)}}}#tt(t){const e=this.#F,s=this.#L[e],i=this.#C[e];return this.#D&&this.#B(i)?i.__abortController.abort(new Error("evicted")):(this.#j||this.#N)&&(this.#j&&this.#w?.(i,s,"evict"),this.#N&&this.#_?.push([i,s,"evict"])),this.#K(e),t&&(this.#L[e]=void 0,this.#C[e]=void 0,this.#O.push(e)),1===this.#k?(this.#F=this.#M=0,this.#O.length=0):this.#F=this.#T[e],this.#E.delete(s),this.#k--,e}has(t,e={}){const{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#E.get(t);if(void 0!==r){const t=this.#C[r];if(this.#B(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#G(r))return s&&this.#Z(r),i&&(i.has="hit",this.#Y(i,r)),!0;i&&(i.has="stale",this.#Y(i,r))}else i&&(i.has="miss");return!1}peek(t,e={}){const{allowStale:s=this.allowStale}=e,i=this.#E.get(t);if(void 0===i||!s&&this.#G(i))return;const r=this.#C[i];return this.#B(r)?r.__staleWhileFetching:r}#W(t,e,s,i){const r=void 0===e?void 0:this.#C[e];if(this.#B(r))return r;const n=new Dt,{signal:o}=s;o?.addEventListener("abort",(()=>n.abort(o.reason)),{signal:n.signal});const h={signal:n.signal,options:s,context:i},a=(i,r=!1)=>{const{aborted:o}=n.signal,a=s.ignoreFetchAbort&&void 0!==i;if(s.status&&(o&&!r?(s.status.fetchAborted=!0,s.status.fetchError=n.signal.reason,a&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),o&&!a&&!r)return l(n.signal.reason);const p=c;return this.#C[e]===c&&(void 0===i?p.__staleWhileFetching?this.#C[e]=p.__staleWhileFetching:this.#V(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,i,h.options))),i},l=i=>{const{aborted:r}=n.signal,o=r&&s.allowStaleOnFetchAbort,h=o||s.allowStaleOnFetchRejection,a=h||s.noDeleteOnFetchRejection,l=c;if(this.#C[e]===c){!a||void 0===l.__staleWhileFetching?this.#V(t,"fetch"):o||(this.#C[e]=l.__staleWhileFetching)}if(h)return s.status&&void 0!==l.__staleWhileFetching&&(s.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw i};s.status&&(s.status.fetchDispatched=!0);const c=new Promise(((e,i)=>{const o=this.#b?.(t,r,h);o&&o instanceof Promise&&o.then((t=>e(void 0===t?void 0:t)),i),n.signal.addEventListener("abort",(()=>{s.ignoreFetchAbort&&!s.allowStaleOnFetchAbort||(e(void 0),s.allowStaleOnFetchAbort&&(e=t=>a(t,!0)))}))})).then(a,(t=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=t),l(t)))),p=Object.assign(c,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return void 0===e?(this.set(t,p,{...h.options,status:void 0}),e=this.#E.get(t)):this.#C[e]=p,p}#B(t){if(!this.#D)return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Dt}async fetch(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:h=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:f,forceRefresh:g=!1,status:m,signal:y}=e;if(!this.#D)return m&&(m.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:m});const w={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:o,size:h,sizeCalculation:a,noUpdateTTL:l,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:u,ignoreFetchAbort:d,status:m,signal:y};let v=this.#E.get(t);if(void 0===v){m&&(m.fetch="miss");const e=this.#W(t,v,w,f);return e.__returned=e}{const e=this.#C[v];if(this.#B(e)){const t=s&&void 0!==e.__staleWhileFetching;return m&&(m.fetch="inflight",t&&(m.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}const r=this.#G(v);if(!g&&!r)return m&&(m.fetch="hit"),this.#I(v),i&&this.#Z(v),m&&this.#Y(m,v),e;const n=this.#W(t,v,w,f),o=void 0!==n.__staleWhileFetching&&s;return m&&(m.fetch=r?"stale":"refresh",o&&r&&(m.returnedStale=!0)),o?n.__staleWhileFetching:n.__returned=n}}async forceFetch(t,e={}){const s=await this.fetch(t,e);if(void 0===s)throw new Error("fetch() returned undefined");return s}memo(t,e={}){const s=this.#S;if(!s)throw new Error("no memoMethod provided to constructor");const{context:i,forceRefresh:r,...n}=e,o=this.get(t,n);if(!r&&void 0!==o)return o;const h=s(t,o,{options:n,context:i});return this.set(t,h,n),h}get(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=e,o=this.#E.get(t);if(void 0!==o){const e=this.#C[o],h=this.#B(e);return n&&this.#Y(n,o),this.#G(o)?(n&&(n.get="stale"),h?(n&&s&&void 0!==e.__staleWhileFetching&&(n.returnedStale=!0),s?e.__staleWhileFetching:void 0):(r||this.#V(t,"expire"),n&&s&&(n.returnedStale=!0),s?e:void 0)):(n&&(n.get="hit"),h?e.__staleWhileFetching:(this.#I(o),i&&this.#Z(o),e))}n&&(n.get="miss")}#st(t,e){this.#A[e]=t,this.#T[t]=e}#I(t){t!==this.#M&&(t===this.#F?this.#F=this.#T[t]:this.#st(this.#A[t],this.#T[t]),this.#st(this.#M,t),this.#M=t)}delete(t){return this.#V(t,"delete")}#V(t,e){let s=!1;if(0!==this.#k){const i=this.#E.get(t);if(void 0!==i)if(s=!0,1===this.#k)this.#it(e);else{this.#K(i);const s=this.#C[i];if(this.#B(s)?s.__abortController.abort(new Error("deleted")):(this.#j||this.#N)&&(this.#j&&this.#w?.(s,t,e),this.#N&&this.#_?.push([s,t,e])),this.#E.delete(t),this.#L[i]=void 0,this.#C[i]=void 0,i===this.#M)this.#M=this.#A[i];else if(i===this.#F)this.#F=this.#T[i];else{const t=this.#A[i];this.#T[t]=this.#T[i];const e=this.#T[i];this.#A[e]=this.#A[i]}this.#k--,this.#O.push(i)}}if(this.#N&&this.#_?.length){const t=this.#_;let e;for(;e=t?.shift();)this.#v?.(...e)}return s}clear(){return this.#it("delete")}#it(t){for(const e of this.#U({allowStale:!0})){const s=this.#C[e];if(this.#B(s))s.__abortController.abort(new Error("deleted"));else{const i=this.#L[e];this.#j&&this.#w?.(s,i,t),this.#N&&this.#_?.push([s,i,t])}}if(this.#E.clear(),this.#C.fill(void 0),this.#L.fill(void 0),this.#P&&this.#z&&(this.#P.fill(0),this.#z.fill(0)),this.#R&&this.#R.fill(0),this.#F=0,this.#M=0,this.#O.length=0,this.#x=0,this.#k=0,this.#N&&this.#_){const t=this.#_;let e;for(;e=t?.shift();)this.#v?.(...e)}}}const Gt="object"==typeof process&&process?process:{stdout:null,stderr:null},Ht=t=>!!t&&"object"==typeof t&&(t instanceof Fe||t instanceof m||qt(t)||Jt(t)),qt=t=>!!t&&"object"==typeof t&&t instanceof g&&"function"==typeof t.pipe&&t.pipe!==m.Writable.prototype.pipe,Jt=t=>!!t&&"object"==typeof t&&t instanceof g&&"function"==typeof t.write&&"function"==typeof t.end,Vt=Symbol("EOF"),Zt=Symbol("maybeEmitEnd"),Yt=Symbol("emittedEnd"),Kt=Symbol("emittingEnd"),Xt=Symbol("emittedError"),Qt=Symbol("closed"),te=Symbol("read"),ee=Symbol("flush"),se=Symbol("flushChunk"),ie=Symbol("encoding"),re=Symbol("decoder"),ne=Symbol("flowing"),oe=Symbol("paused"),he=Symbol("resume"),ae=Symbol("buffer"),le=Symbol("pipes"),ce=Symbol("bufferLength"),pe=Symbol("bufferPush"),de=Symbol("bufferShift"),ue=Symbol("objectMode"),fe=Symbol("destroyed"),ge=Symbol("error"),me=Symbol("emitData"),ye=Symbol("emitEnd"),we=Symbol("emitEnd2"),ve=Symbol("async"),be=Symbol("abort"),Se=Symbol("aborted"),ke=Symbol("signal"),xe=Symbol("dataListeners"),Ee=Symbol("discarded"),Le=t=>Promise.resolve().then(t),Ce=t=>t();class Te{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[he](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class Ae extends Te{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=t=>e.emit("error",t),t.on("error",this.proxyErrors)}}class Fe extends g{[ne]=!1;[oe]=!1;[le]=[];[ae]=[];[ue];[ie];[ve];[re];[Vt]=!1;[Yt]=!1;[Kt]=!1;[Qt]=!1;[Xt]=null;[ce]=0;[fe]=!1;[ke];[Se]=!1;[xe]=0;[Ee]=!1;writable=!0;readable=!0;constructor(...t){const e=t[0]||{};if(super(),e.objectMode&&"string"==typeof e.encoding)throw new TypeError("Encoding and objectMode may not be used together");e.objectMode?(this[ue]=!0,this[ie]=null):(t=>!t.objectMode&&!!t.encoding&&"buffer"!==t.encoding)(e)?(this[ie]=e.encoding,this[ue]=!1):(this[ue]=!1,this[ie]=null),this[ve]=!!e.async,this[re]=this[ie]?new y(this[ie]):null,e&&!0===e.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[ae]}),e&&!0===e.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[le]});const{signal:s}=e;s&&(this[ke]=s,s.aborted?this[be]():s.addEventListener("abort",(()=>this[be]())))}get bufferLength(){return this[ce]}get encoding(){return this[ie]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[ue]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ve]}set async(t){this[ve]=this[ve]||!!t}[be](){this[Se]=!0,this.emit("abort",this[ke]?.reason),this.destroy(this[ke]?.reason)}get aborted(){return this[Se]}set aborted(t){}write(t,e,s){if(this[Se])return!1;if(this[Vt])throw new Error("write after end");if(this[fe])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof e&&(s=e,e="utf8"),e||(e="utf8");const i=this[ve]?Le:Ce;if(!this[ue]&&!Buffer.isBuffer(t))if(r=t,!Buffer.isBuffer(r)&&ArrayBuffer.isView(r))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if((t=>t instanceof ArrayBuffer||!!t&&"object"==typeof t&&t.constructor&&"ArrayBuffer"===t.constructor.name&&t.byteLength>=0)(t))t=Buffer.from(t);else if("string"!=typeof t)throw new Error("Non-contiguous data written to non-objectMode stream");var r;return this[ue]?(this[ne]&&0!==this[ce]&&this[ee](!0),this[ne]?this.emit("data",t):this[pe](t),0!==this[ce]&&this.emit("readable"),s&&i(s),this[ne]):t.length?("string"!=typeof t||e===this[ie]&&!this[re]?.lastNeed||(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[ie]&&(t=thi