skill-creator 1.5.1 → 1.5.2

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.
Files changed (84) hide show
  1. package/README.md +173 -103
  2. package/dist/buildIndex-B_9ABRtx.mjs +2 -0
  3. package/dist/buildIndex-B_9ABRtx.mjs.map +1 -0
  4. package/dist/buildIndex-Cea97e0l.mjs +1 -0
  5. package/dist/cli.d.mts +0 -0
  6. package/dist/cli.d.mts.map +1 -1
  7. package/dist/cli.mjs +17 -33
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/contentManager-CoVTiSDT.mjs +13 -0
  10. package/dist/contentManager-CoVTiSDT.mjs.map +1 -0
  11. package/dist/contentManager-CwquwC1s.mjs +1 -0
  12. package/dist/context7-BejCCqkm.mjs +1 -0
  13. package/dist/context7-BxMpyQiW.mjs +2 -0
  14. package/dist/context7-BxMpyQiW.mjs.map +1 -0
  15. package/dist/index.d.mts +317 -123
  16. package/dist/index.d.mts.map +1 -1
  17. package/dist/index.mjs +1 -20
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/{listContext7-DKXzgWdn.mjs → listContext7-DHj9AL-z.mjs} +2 -2
  20. package/dist/{listContext7-DKXzgWdn.mjs.map → listContext7-DHj9AL-z.mjs.map} +1 -1
  21. package/dist/package-CFJazwTO.mjs +2 -0
  22. package/dist/package-CFJazwTO.mjs.map +1 -0
  23. package/dist/referenceSearchUtils-DZgupMZp.mjs +2 -0
  24. package/dist/referenceSearchUtils-DZgupMZp.mjs.map +1 -0
  25. package/dist/removeContext7-BZtL4_CJ.mjs +3 -0
  26. package/dist/{removeContext7-DOXrTXeI.mjs.map → removeContext7-BZtL4_CJ.mjs.map} +1 -1
  27. package/dist/{removeSkill-C-ehFexk.mjs → removeSkill-Bat_plVG.mjs} +4 -4
  28. package/dist/removeSkill-Bat_plVG.mjs.map +1 -0
  29. package/dist/removeSkill-DjDZjhJU.mjs +1 -0
  30. package/dist/runScript-CSKqb831.mjs +13 -0
  31. package/dist/runScript-CSKqb831.mjs.map +1 -0
  32. package/dist/scopeSelection-BWteJQSv.mjs +2 -0
  33. package/dist/scopeSelection-BWteJQSv.mjs.map +1 -0
  34. package/dist/searchQuality-DVdHmamh.mjs +2 -0
  35. package/dist/searchQuality-DVdHmamh.mjs.map +1 -0
  36. package/dist/search_format-RyjXACJa.mjs +5 -0
  37. package/dist/search_format-RyjXACJa.mjs.map +1 -0
  38. package/dist/shared-DsVh4gOV.mjs +2 -0
  39. package/dist/shared-DsVh4gOV.mjs.map +1 -0
  40. package/dist/skillCreator-BomXoqdw.mjs +2 -0
  41. package/dist/skillCreator-BomXoqdw.mjs.map +1 -0
  42. package/dist/skillMdManager-DGBZ6M5J.mjs +7 -0
  43. package/dist/skillMdManager-DGBZ6M5J.mjs.map +1 -0
  44. package/dist/sqliteVectorSearchAdapter-56kZjbUT.mjs +28 -0
  45. package/dist/sqliteVectorSearchAdapter-56kZjbUT.mjs.map +1 -0
  46. package/dist/sqliteVectorSearchAdapter-DNkyKuZs.mjs +1 -0
  47. package/dist/unifiedSearch-CLdazMYU.mjs +4 -0
  48. package/dist/unifiedSearch-CLdazMYU.mjs.map +1 -0
  49. package/dist/unifiedSearch-DCFPrtzZ.mjs +1 -0
  50. package/package.json +32 -28
  51. package/templates/SKILL.md +19 -4
  52. package/templates/SKILL.zh-CN.md +54 -12
  53. package/templates/skill-creator.md +52 -19
  54. package/templates/skill-creator.zh-CN.md +55 -22
  55. package/dist/chunk-Da8dvM5T.mjs +0 -1
  56. package/dist/contentManager-8rmWJMb6.mjs +0 -22
  57. package/dist/contentManager-8rmWJMb6.mjs.map +0 -1
  58. package/dist/contentManager-Xt8N5psY.mjs +0 -1
  59. package/dist/dist-DZL34HNo.mjs +0 -8
  60. package/dist/dist-DZL34HNo.mjs.map +0 -1
  61. package/dist/dist-X_kVEzbK.mjs +0 -1
  62. package/dist/esm-8qfZdcpd.mjs +0 -33
  63. package/dist/esm-8qfZdcpd.mjs.map +0 -1
  64. package/dist/esm-BF5pvSbc.mjs +0 -1
  65. package/dist/esm-BbhxxeGF.mjs +0 -4
  66. package/dist/esm-BbhxxeGF.mjs.map +0 -1
  67. package/dist/package-Cxx_VSyD.mjs +0 -2
  68. package/dist/package-Cxx_VSyD.mjs.map +0 -1
  69. package/dist/path-CuoiIaIe.mjs +0 -2
  70. package/dist/path-CuoiIaIe.mjs.map +0 -1
  71. package/dist/removeContext7-DOXrTXeI.mjs +0 -3
  72. package/dist/removeSkill-C-ehFexk.mjs.map +0 -1
  73. package/dist/removeSkill-DWwhvzej.mjs +0 -1
  74. package/dist/runScript-Cr9RRN9y.mjs +0 -14
  75. package/dist/runScript-Cr9RRN9y.mjs.map +0 -1
  76. package/dist/search_format-DIs-1lKk.mjs +0 -5
  77. package/dist/search_format-DIs-1lKk.mjs.map +0 -1
  78. package/dist/shared-CFoY2Xhg.mjs +0 -2
  79. package/dist/shared-CFoY2Xhg.mjs.map +0 -1
  80. package/dist/skillMdManager-DP8fGZb7.mjs +0 -7
  81. package/dist/skillMdManager-DP8fGZb7.mjs.map +0 -1
  82. package/dist/unifiedSearch-CGZXw0NB.mjs +0 -1
  83. package/dist/unifiedSearch-l-lrSc9C.mjs +0 -4
  84. package/dist/unifiedSearch-l-lrSc9C.mjs.map +0 -1
@@ -1 +0,0 @@
1
- import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./esm-BbhxxeGF.mjs";export{m as glob};
@@ -1,4 +0,0 @@
1
- import{posix as e,win32 as t}from"node:path";import*as n from"node:fs";import{fileURLToPath as r}from"node:url";import{StringDecoder as i}from"node:string_decoder";import{lstatSync as a,readdir as o,readdirSync as s,readlinkSync as c,realpathSync as l}from"fs";import{EventEmitter as u}from"node:events";import d from"node:stream";import{lstat as f,readdir as p,readlink as m,realpath as ee}from"node:fs/promises";const h=(e,t,n)=>{let r=e instanceof RegExp?g(e,n):e,i=t instanceof RegExp?g(t,n):t,a=r!==null&&i!=null&&_(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},g=(e,t)=>{let n=t.match(e);return n?n[0]:null},_=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},v=`\0SLASH`+Math.random()+`\0`,te=`\0OPEN`+Math.random()+`\0`,ne=`\0CLOSE`+Math.random()+`\0`,re=`\0COMMA`+Math.random()+`\0`,ie=`\0PERIOD`+Math.random()+`\0`,ae=new RegExp(v,`g`),oe=new RegExp(te,`g`),se=new RegExp(ne,`g`),ce=new RegExp(re,`g`),le=new RegExp(ie,`g`),ue=/\\\\/g,de=/\\{/g,fe=/\\}/g,pe=/\\,/g,me=/\\./g;function he(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function ge(e){return e.replace(ue,v).replace(de,te).replace(fe,ne).replace(pe,re).replace(me,ie)}function _e(e){return e.replace(ae,`\\`).replace(oe,`{`).replace(se,`}`).replace(ce,`,`).replace(le,`.`)}function ve(e){if(!e)return[``];let t=[],n=h(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=ve(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function ye(e){return e?(e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),y(ge(e),!0).map(_e)):[]}function be(e){return`{`+e+`}`}function xe(e){return/^-?0\d/.test(e)}function Se(e,t){return e<=t}function Ce(e,t){return e>=t}function y(e,t){let n=[],r=h(`{`,`}`,e);if(!r)return[e];let i=r.pre,a=r.post.length?y(r.post,!1):[``];if(/\$$/.test(r.pre))for(let e=0;e<a.length;e++){let t=i+`{`+r.body+`}`+a[e];n.push(t)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),c=o||s,l=r.body.indexOf(`,`)>=0;if(!c&&!l)return r.post.match(/,(?!,).*\}/)?(e=r.pre+`{`+r.body+ne+r.post,y(e)):[e];let u;if(c)u=r.body.split(/\.\./);else if(u=ve(r.body),u.length===1&&u[0]!==void 0&&(u=y(u[0],!1).map(be),u.length===1))return a.map(e=>r.pre+u[0]+e);let d;if(c&&u[0]!==void 0&&u[1]!==void 0){let e=he(u[0]),t=he(u[1]),n=Math.max(u[0].length,u[1].length),r=u.length===3&&u[2]!==void 0?Math.abs(he(u[2])):1,i=Se;t<e&&(r*=-1,i=Ce);let a=u.some(xe);d=[];for(let o=e;i(o,t);o+=r){let e;if(s)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),a){let t=n-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}d.push(e)}}else{d=[];for(let e=0;e<u.length;e++)d.push.apply(d,y(u[e],!1))}for(let e=0;e<d.length;e++)for(let r=0;r<a.length;r++){let o=i+d[e]+a[r];(!t||c||o)&&n.push(o)}}return n}const we=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},Te={"[: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]},b=e=>e.replace(/[[\]\\-]/g,`\\$&`),Ee=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),De=e=>e.join(``),Oe=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(Te))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(b(d)+`-`+b(t)):t===d&&r.push(b(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(b(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(b(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[Ee(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+De(r)+`]`,p=`[`+(l?``:`^`)+De(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},x=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`),ke=new Set([`!`,`?`,`+`,`*`,`@`]),Ae=e=>ke.has(e),je=`(?!\\.)`,Me=new Set([`[`,`.`]),Ne=new Set([`..`,`.`]),Pe=new Set(`().*{}+?[]^$\\!`),Fe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Ie=`[^/]`,Le=Ie+`*?`,Re=Ie+`+?`;var ze=class e{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...t){for(let n of t)if(n!==``){if(typeof n!=`string`&&!(n instanceof e&&n.#i===this))throw Error(`invalid part: `+n);this.#r.push(n)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let t=this.#i;for(let n=0;n<this.#a;n++){let r=t.#r[n];if(!(r instanceof e&&r.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(t){let n=new e(this.type,t);for(let e of this.#r)n.copyIn(e);return n}static#f(t,n,r,i){let a=!1,o=!1,s=-1,c=!1;if(n.type===null){let l=r,u=``;for(;l<t.length;){let r=t.charAt(l++);if(a||r===`\\`){a=!a,u+=r;continue}if(o){l===s+1?(r===`^`||r===`!`)&&(c=!0):r===`]`&&!(l===s+2&&c)&&(o=!1),u+=r;continue}else if(r===`[`){o=!0,s=l,c=!1,u+=r;continue}if(!i.noext&&Ae(r)&&t.charAt(l)===`(`){n.push(u),u=``;let a=new e(r,n);l=e.#f(t,a,l,i),n.push(a);continue}u+=r}return n.push(u),l}let l=r+1,u=new e(null,n),d=[],f=``;for(;l<t.length;){let r=t.charAt(l++);if(a||r===`\\`){a=!a,f+=r;continue}if(o){l===s+1?(r===`^`||r===`!`)&&(c=!0):r===`]`&&!(l===s+2&&c)&&(o=!1),f+=r;continue}else if(r===`[`){o=!0,s=l,c=!1,f+=r;continue}if(Ae(r)&&t.charAt(l)===`(`){u.push(f),f=``;let n=new e(r,u);u.push(n),l=e.#f(t,n,l,i);continue}if(r===`|`){u.push(f),f=``,d.push(u),u=new e(null,n);continue}if(r===`)`)return f===``&&n.#r.length===0&&(n.#u=!0),u.push(f),f=``,n.push(...d,u),l;f+=r}return n.type=null,n.#t=void 0,n.#r=[t.substring(r-1)],l}static fromGlob(t,n={}){let r=new e(null,void 0,n);return e.#f(t,r,0,n),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(t){let n=t??!!this.#c.dot;if(this.#e===this&&this.#d(),!this.type){let r=this.isStart()&&this.isEnd(),i=this.#r.map(n=>{let[i,a,o,s]=typeof n==`string`?e.#m(n,this.#t,r):n.toRegExpSource(t);return this.#t=this.#t||o,this.#n=this.#n||s,i}).join(``),a=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ne.has(this.#r[0]))){let e=Me,r=n&&e.has(i.charAt(0))||i.startsWith(`\\.`)&&e.has(i.charAt(2))||i.startsWith(`\\.\\.`)&&e.has(i.charAt(4)),o=!n&&!t&&e.has(i.charAt(0));a=r?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?je:``}let o=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(o=`(?:$|\\/)`),[a+i+o,x(i),this.#t=!!this.#t,this.#n]}let r=this.type===`*`||this.type===`+`,i=this.type===`!`?`(?:(?!(?:`:`(?:`,a=this.#p(n);if(this.isStart()&&this.isEnd()&&!a&&this.type!==`!`){let e=this.toString();return this.#r=[e],this.type=null,this.#t=void 0,[e,x(this.toString()),!1,!1]}let o=!r||t||n?``:this.#p(!0);o===a&&(o=``),o&&(a=`(?:${a})(?:${o})*?`);let s=``;if(this.type===`!`&&this.#u)s=(this.isStart()&&!n?je:``)+Re;else{let e=this.type===`!`?`))`+(this.isStart()&&!n&&!t?je:``)+Le+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&o?`)`:this.type===`*`&&o?`)?`:`)${this.type}`;s=i+a+e}return[s,x(a),this.#t=!!this.#t,this.#n]}#p(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#m(e,t,n=!1){let r=!1,i=``,a=!1;for(let o=0;o<e.length;o++){let s=e.charAt(o);if(r){r=!1,i+=(Pe.has(s)?`\\`:``)+s;continue}if(s===`\\`){o===e.length-1?i+=`\\\\`:r=!0;continue}if(s===`[`){let[n,r,s,c]=Oe(e,o);if(s){i+=n,a||=r,o+=s-1,t||=c;continue}}if(s===`*`){n&&e===`*`?i+=Re:i+=Le,t=!0;continue}if(s===`?`){i+=Ie,t=!0;continue}i+=Fe(s)}return[i,x(e),!!t,a]}};const Be=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),S=(e,t,n={})=>(we(t),!n.nocomment&&t.charAt(0)===`#`?!1:new T(t,n).match(e)),Ve=/^\*+([^+@!?\*\[\(]*)$/,He=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Ue=e=>t=>t.endsWith(e),We=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Ge=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Ke=/^\*+\.\*+$/,qe=e=>!e.startsWith(`.`)&&e.includes(`.`),Je=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Ye=/^\.\*+$/,Xe=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Ze=/^\*+$/,Qe=e=>e.length!==0&&!e.startsWith(`.`),$e=e=>e.length!==0&&e!==`.`&&e!==`..`,et=/^\?+([^+@!?\*\[\(]*)?$/,tt=([e,t=``])=>{let n=at([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},nt=([e,t=``])=>{let n=ot([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},rt=([e,t=``])=>{let n=ot([e]);return t?e=>n(e)&&e.endsWith(t):n},it=([e,t=``])=>{let n=at([e]);return t?e=>n(e)&&e.endsWith(t):n},at=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},ot=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},st=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,ct={win32:{sep:`\\`},posix:{sep:`/`}};S.sep=st===`win32`?ct.win32.sep:ct.posix.sep;const C=Symbol(`globstar **`);S.GLOBSTAR=C,S.filter=(e,t={})=>n=>S(n,e,t);const w=(e,t={})=>Object.assign({},e,t);S.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return S;let t=S;return Object.assign((n,r,i={})=>t(n,r,w(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,w(e,n))}static defaults(n){return t.defaults(w(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,w(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,w(e,r))}},unescape:(n,r={})=>t.unescape(n,w(e,r)),escape:(n,r={})=>t.escape(n,w(e,r)),filter:(n,r={})=>t.filter(n,w(e,r)),defaults:n=>t.defaults(w(e,n)),makeRe:(n,r={})=>t.makeRe(n,w(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,w(e,r)),match:(n,r,i={})=>t.match(n,r,w(e,i)),sep:t.sep,GLOBSTAR:C})};const lt=(e,t={})=>(we(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ye(e));S.braceExpand=lt,S.makeRe=(e,t={})=>new T(e,t).makeRe(),S.match=(e,t,n={})=>{let r=new T(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const ut=/[?*]|[+@!]\(.*?\)|\[|\]/,dt=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var T=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){we(e),t||={},this.options=t,this.pattern=e,this.platform=t.platform||st,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!ut.test(e[2]))&&!ut.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=this.options;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),r=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),i=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),a=!i&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),o=r?3:n?0:void 0,s=a?3:i?0:void 0;if(typeof o==`number`&&typeof s==`number`){let[n,r]=[e[o],t[s]];n.toLowerCase()===r.toLowerCase()&&(t[s]=n,s>o?t=t.slice(s):o>s&&(e=e.slice(o)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(e=this.levelTwoFileOptimize(e)),this.debug(`matchOne`,this,{file:e,pattern:t}),this.debug(`matchOne`,e.length,t.length);for(var a=0,o=0,s=e.length,c=t.length;a<s&&o<c;a++,o++){this.debug(`matchOne loop`);var l=t[o],u=e[a];if(this.debug(t,l,u),l===!1)return!1;if(l===C){this.debug(`GLOBSTAR`,[t,l,u]);var d=a,f=o+1;if(f===c){for(this.debug(`** at the end`);a<s;a++)if(e[a]===`.`||e[a]===`..`||!r.dot&&e[a].charAt(0)===`.`)return!1;return!0}for(;d<s;){var p=e[d];if(this.debug(`
2
- globstar while`,e,d,t,f,p),this.matchOne(e.slice(d),t.slice(f),n))return this.debug(`globstar found match!`,d,s,p),!0;if(p===`.`||p===`..`||!r.dot&&p.charAt(0)===`.`){this.debug(`dot detected!`,e,d,t,f);break}this.debug(`globstar swallow a segment, and continue`),d++}return!!(n&&(this.debug(`
3
- >>> no match, partial?`,e,d,t,f),d===s))}let i;if(typeof l==`string`?(i=u===l,this.debug(`string match`,l,u,i)):(i=l.test(u),this.debug(`pattern match`,l,u,i)),!i)return!1}if(a===s&&o===c)return!0;if(a===s)return n;if(o===c)return a===s-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return lt(this.pattern,this.options)}parse(e){we(e);let t=this.options;if(e===`**`)return C;if(e===``)return``;let n,r=null;(n=e.match(Ze))?r=t.dot?$e:Qe:(n=e.match(Ve))?r=(t.nocase?t.dot?Ge:We:t.dot?Ue:He)(n[1]):(n=e.match(et))?r=(t.nocase?t.dot?nt:tt:t.dot?rt:it)(n):(n=e.match(Ke))?r=t.dot?Je:qe:(n=e.match(Ye))&&(r=Xe);let i=ze.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,`test`,{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?dt(e):e===C?C:e._src});return t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==C||a===C||(a===void 0?i!==void 0&&i!==C?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|`+n+`)?`:i!==C&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=C))}),t.filter(e=>e!==C).join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return S.defaults(e).Minimatch}};S.AST=ze,S.Minimatch=T,S.escape=Be,S.unescape=x;const ft=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,pt=new Set,mt=typeof process==`object`&&process?process:{},ht=(e,t,n,r)=>{typeof mt.emitWarning==`function`?mt.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)};let E=globalThis.AbortController,gt=globalThis.AbortSignal;if(E===void 0){gt=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},E=class{constructor(){t()}signal=new gt;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(let t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e=mt.env?.LRU_CACHE_IGNORE_AC_WARNING!==`1`,t=()=>{e&&(e=!1,ht("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))}}const _t=e=>!pt.has(e),D=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),vt=e=>D(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?yt:null:null;var yt=class extends Array{constructor(e){super(e),this.fill(0)}},bt=class e{heap;length;static#e=!1;static create(t){let n=vt(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},xt=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#B(t),backgroundFetch:(t,n,r,i)=>e.#z(t,n,r,i),moveToTail:t=>e.#H(t),indexes:t=>e.#F(t),rindexes:t=>e.#I(t),isStale:t=>e.#A(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:ee=0,sizeCalculation:h,fetchMethod:g,memoMethod:_,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:te,allowStaleOnFetchRejection:ne,allowStaleOnFetchAbort:re,ignoreFetchAbort:ie,perf:ae}=t;if(ae!==void 0&&typeof ae?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=ae??ft,n!==0&&!D(n))throw TypeError(`max option must be a nonnegative integer`);let oe=n?vt(n):Array;if(!oe)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=ee||this.#t,this.sizeCalculation=h,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(_!==void 0&&typeof _!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=_,g!==void 0&&typeof g!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=g,this.#C=!!g,this.#u=new Map,this.#d=Array(n).fill(void 0),this.#f=Array(n).fill(void 0),this.#p=new oe(n),this.#m=new oe(n),this.#h=0,this.#g=0,this.#_=bt.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#S=!!this.#n,this.#T=!!this.#r,this.#w=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!ne,this.allowStaleOnFetchAbort=!!re,this.ignoreFetchAbort=!!ie,this.maxEntrySize!==0){if(this.#t!==0&&!D(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!D(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#j()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!te,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=D(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!D(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#E()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;_t(t)&&(pt.add(t),ht(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#E(){let e=new yt(this.#e),t=new yt(this.#e);this.#x=e,this.#b=t,this.#k=(n,r,i=this.#s.now())=>{if(t[n]=r===0?0:i,e[n]=r,r!==0&&this.ttlAutopurge){let e=setTimeout(()=>{this.#A(n)&&this.#U(this.#d[n],`expire`)},r+1);e.unref&&e.unref()}},this.#D=n=>{t[n]=e[n]===0?0:this.#s.now()},this.#O=(i,a)=>{if(e[a]){let o=e[a],s=t[a];if(!o||!s)return;i.ttl=o,i.start=s,i.now=n||r(),i.remainingTTL=o-(i.now-s)}};let n=0,r=()=>{let e=this.#s.now();if(this.ttlResolution>0){n=e;let t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=i=>{let a=this.#u.get(i);if(a===void 0)return 0;let o=e[a],s=t[a];return!o||!s?1/0:o-((n||r())-s)},this.#A=i=>{let a=t[i],o=e[i];return!!o&&!!a&&(n||r())-a>o}}#D=()=>{};#O=()=>{};#k=()=>{};#A=()=>!1;#j(){let e=new yt(this.#e);this.#l=0,this.#y=e,this.#M=t=>{this.#l-=e[t],e[t]=0},this.#P=(e,t,n,r)=>{if(this.#B(t))return 0;if(!D(n))if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!D(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`);return n},this.#N=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#R(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#M=e=>{};#N=(e,t,n)=>{};#P=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#F({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;!(!this.#L(t)||((e||!this.#A(t))&&(yield t),t===this.#h));)t=this.#m[t]}*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;!(!this.#L(t)||((e||!this.#A(t))&&(yield t),t===this.#g));)t=this.#p[t]}#L(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#F())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#B(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#B(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#F()){let t=this.#d[e];t!==void 0&&!this.#B(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#B(this.#f[e])&&(yield t)}}*values(){for(let e of this.#F())this.#f[e]!==void 0&&!this.#B(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#B(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#F()){let r=this.#f[n],i=this.#B(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.get(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#F()){let r=this.#f[n],i=this.#B(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#B(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#I({allowStale:!0}))this.#A(t)&&(this.#U(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#B(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#F({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#B(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:s}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#P(e,t,n.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return s&&(s.set=`miss`,s.maxEntrySizeExceeded=!0),this.#U(e,`set`),this;let u=this.#c===0?void 0:this.#u.get(e);if(u===void 0)u=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#R(!1):this.#c:this.#_.pop(),this.#d[u]=e,this.#f[u]=t,this.#u.set(e,u),this.#p[this.#g]=u,this.#m[u]=this.#g,this.#g=u,this.#c++,this.#N(u,l,s),s&&(s.set=`add`),c=!1,this.#T&&this.#r?.(t,e,`add`);else{this.#H(u);let n=this.#f[u];if(t!==n){if(this.#C&&this.#B(n)){n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:t}=n;t!==void 0&&!a&&(this.#S&&this.#n?.(t,e,`set`),this.#w&&this.#v?.push([t,e,`set`]))}else a||(this.#S&&this.#n?.(n,e,`set`),this.#w&&this.#v?.push([n,e,`set`]));if(this.#M(u),this.#N(u,l,s),this.#f[u]=t,s){s.set=`replace`;let e=n&&this.#B(n)?n.__staleWhileFetching:n;e!==void 0&&(s.oldValue=e)}}else s&&(s.set=`update`);this.#T&&this.onInsert?.(t,e,t===n?`update`:`replace`)}if(r!==0&&!this.#x&&this.#E(),this.#x&&(c||this.#k(u,r,i),s&&this.#O(s,u)),!a&&this.#w&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#R(!0),this.#B(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#R(e){let t=this.#h,n=this.#d[t],r=this.#f[t];return this.#C&&this.#B(r)?r.__abortController.abort(Error(`evicted`)):(this.#S||this.#w)&&(this.#S&&this.#n?.(r,n,`evict`),this.#w&&this.#v?.push([r,n,`evict`])),this.#M(t),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#B(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#A(i))r&&(r.has=`stale`,this.#O(r,i));else return n&&this.#D(i),r&&(r.has=`hit`,this.#O(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#u.get(e);if(r===void 0||!n&&this.#A(r))return;let i=this.#f[r];return this.#B(i)?i.__staleWhileFetching:i}#z(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#B(i))return i;let a=new E,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0;if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason);let l=f,d=this.#f[t];return(d===f||c&&i&&d===void 0)&&(r===void 0?l.__staleWhileFetching===void 0?this.#U(e,`fetch`):this.#f[t]=l.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,s.options))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e)),u=r=>{let{aborted:i}=a.signal,o=i&&n.allowStaleOnFetchAbort,s=o||n.allowStaleOnFetchRejection,c=s||n.noDeleteOnFetchRejection,l=f;if(this.#f[t]===f&&(!c||l.__staleWhileFetching===void 0?this.#U(e,`fetch`):o||(this.#f[t]=l.__staleWhileFetching)),s)return n.status&&l.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);o&&o instanceof Promise&&o.then(e=>t(e===void 0?void 0:e),r),a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.set(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#B(e){if(!this.#C)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof E}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:ee=!1,status:h,signal:g}=t;if(!this.#C)return h&&(h.fetch=`get`),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:h});let _={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:h,signal:g},v=this.#u.get(e);if(v===void 0){h&&(h.fetch=`miss`);let t=this.#z(e,v,_,m);return t.__returned=t}else{let t=this.#f[v];if(this.#B(t)){let e=n&&t.__staleWhileFetching!==void 0;return h&&(h.fetch=`inflight`,e&&(h.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#A(v);if(!ee&&!i)return h&&(h.fetch=`hit`),this.#H(v),r&&this.#D(v),h&&this.#O(h,v),t;let a=this.#z(e,v,_,m),o=a.__staleWhileFetching!==void 0&&n;return h&&(h.fetch=i?`stale`:`refresh`,o&&i&&(h.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,forceRefresh:i,...a}=t,o=this.get(e,a);if(!i&&o!==void 0)return o;let s=n(e,o,{options:a,context:r});return this.set(e,s,a),s}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o!==void 0){let t=this.#f[o],s=this.#B(t);return a&&this.#O(a,o),this.#A(o)?(a&&(a.get=`stale`),s?(a&&n&&t.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#U(e,`expire`),a&&n&&(a.returnedStale=!0),n?t:void 0)):(a&&(a.get=`hit`),s?t.__staleWhileFetching:(this.#H(o),r&&this.#D(o),t))}else a&&(a.get=`miss`)}#V(e,t){this.#m[t]=e,this.#p[e]=t}#H(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#V(this.#m[e],this.#p[e]),this.#V(this.#g,e),this.#g=e)}delete(e){return this.#U(e,`delete`)}#U(e,t){let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0)if(n=!0,this.#c===1)this.#W(t);else{this.#M(r);let n=this.#f[r];if(this.#B(n)?n.__abortController.abort(Error(`deleted`)):(this.#S||this.#w)&&(this.#S&&this.#n?.(n,e,t),this.#w&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}if(this.#w&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#W(`delete`)}#W(e){for(let t of this.#I({allowStale:!0})){let n=this.#f[t];if(this.#B(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#S&&this.#n?.(n,r,e),this.#w&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b&&(this.#x.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#w&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}};const St=typeof process==`object`&&process?process:{stdout:null,stderr:null},Ct=e=>!!e&&typeof e==`object`&&(e instanceof Kt||e instanceof d||wt(e)||Tt(e)),wt=e=>!!e&&typeof e==`object`&&e instanceof u&&typeof e.pipe==`function`&&e.pipe!==d.Writable.prototype.pipe,Tt=e=>!!e&&typeof e==`object`&&e instanceof u&&typeof e.write==`function`&&typeof e.end==`function`,O=Symbol(`EOF`),k=Symbol(`maybeEmitEnd`),A=Symbol(`emittedEnd`),j=Symbol(`emittingEnd`),M=Symbol(`emittedError`),Et=Symbol(`closed`),Dt=Symbol(`read`),Ot=Symbol(`flush`),kt=Symbol(`flushChunk`),N=Symbol(`encoding`),P=Symbol(`decoder`),F=Symbol(`flowing`),I=Symbol(`paused`),L=Symbol(`resume`),R=Symbol(`buffer`),z=Symbol(`pipes`),B=Symbol(`bufferLength`),At=Symbol(`bufferPush`),jt=Symbol(`bufferShift`),V=Symbol(`objectMode`),H=Symbol(`destroyed`),Mt=Symbol(`error`),Nt=Symbol(`emitData`),Pt=Symbol(`emitEnd`),Ft=Symbol(`emitEnd2`),U=Symbol(`async`),It=Symbol(`abort`),Lt=Symbol(`aborted`),W=Symbol(`signal`),G=Symbol(`dataListeners`),K=Symbol(`discarded`),q=e=>Promise.resolve().then(e),Rt=e=>e(),zt=e=>e===`end`||e===`finish`||e===`prefinish`,Bt=e=>e instanceof ArrayBuffer||!!e&&typeof e==`object`&&e.constructor&&e.constructor.name===`ArrayBuffer`&&e.byteLength>=0,Vt=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e);var Ht=class{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[L](),this.dest.on(`drain`,this.ondrain)}unpipe(){this.dest.removeListener(`drain`,this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ut=class extends Ht{unpipe(){this.src.removeListener(`error`,this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>t.emit(`error`,e),e.on(`error`,this.proxyErrors)}};const Wt=e=>!!e.objectMode,Gt=e=>!e.objectMode&&!!e.encoding&&e.encoding!==`buffer`;var Kt=class extends u{[F]=!1;[I]=!1;[z]=[];[R]=[];[V];[N];[U];[P];[O]=!1;[A]=!1;[j]=!1;[Et]=!1;[M]=null;[B]=0;[H]=!1;[W];[Lt]=!1;[G]=0;[K]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding==`string`)throw TypeError(`Encoding and objectMode may not be used together`);Wt(t)?(this[V]=!0,this[N]=null):Gt(t)?(this[N]=t.encoding,this[V]=!1):(this[V]=!1,this[N]=null),this[U]=!!t.async,this[P]=this[N]?new i(this[N]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,`buffer`,{get:()=>this[R]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,`pipes`,{get:()=>this[z]});let{signal:n}=t;n&&(this[W]=n,n.aborted?this[It]():n.addEventListener(`abort`,()=>this[It]()))}get bufferLength(){return this[B]}get encoding(){return this[N]}set encoding(e){throw Error(`Encoding must be set at instantiation time`)}setEncoding(e){throw Error(`Encoding must be set at instantiation time`)}get objectMode(){return this[V]}set objectMode(e){throw Error(`objectMode must be set at instantiation time`)}get async(){return this[U]}set async(e){this[U]=this[U]||!!e}[It](){this[Lt]=!0,this.emit(`abort`,this[W]?.reason),this.destroy(this[W]?.reason)}get aborted(){return this[Lt]}set aborted(e){}write(e,t,n){if(this[Lt])return!1;if(this[O])throw Error(`write after end`);if(this[H])return this.emit(`error`,Object.assign(Error(`Cannot call write after a stream was destroyed`),{code:`ERR_STREAM_DESTROYED`})),!0;typeof t==`function`&&(n=t,t=`utf8`),t||=`utf8`;let r=this[U]?q:Rt;if(!this[V]&&!Buffer.isBuffer(e)){if(Vt(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Bt(e))e=Buffer.from(e);else if(typeof e!=`string`)throw Error(`Non-contiguous data written to non-objectMode stream`)}return this[V]?(this[F]&&this[B]!==0&&this[Ot](!0),this[F]?this.emit(`data`,e):this[At](e),this[B]!==0&&this.emit(`readable`),n&&r(n),this[F]):e.length?(typeof e==`string`&&!(t===this[N]&&!this[P]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[N]&&(e=this[P].write(e)),this[F]&&this[B]!==0&&this[Ot](!0),this[F]?this.emit(`data`,e):this[At](e),this[B]!==0&&this.emit(`readable`),n&&r(n),this[F]):(this[B]!==0&&this.emit(`readable`),n&&r(n),this[F])}read(e){if(this[H])return null;if(this[K]=!1,this[B]===0||e===0||e&&e>this[B])return this[k](),null;this[V]&&(e=null),this[R].length>1&&!this[V]&&(this[R]=[this[N]?this[R].join(``):Buffer.concat(this[R],this[B])]);let t=this[Dt](e||null,this[R][0]);return this[k](),t}[Dt](e,t){if(this[V])this[jt]();else{let n=t;e===n.length||e===null?this[jt]():typeof n==`string`?(this[R][0]=n.slice(e),t=n.slice(0,e),this[B]-=e):(this[R][0]=n.subarray(e),t=n.subarray(0,e),this[B]-=e)}return this.emit(`data`,t),!this[R].length&&!this[O]&&this.emit(`drain`),t}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=`utf8`),e!==void 0&&this.write(e,t),n&&this.once(`end`,n),this[O]=!0,this.writable=!1,(this[F]||!this[I])&&this[k](),this}[L](){this[H]||(!this[G]&&!this[z].length&&(this[K]=!0),this[I]=!1,this[F]=!0,this.emit(`resume`),this[R].length?this[Ot]():this[O]?this[k]():this.emit(`drain`))}resume(){return this[L]()}pause(){this[F]=!1,this[I]=!0,this[K]=!1}get destroyed(){return this[H]}get flowing(){return this[F]}get paused(){return this[I]}[At](e){this[V]?this[B]+=1:this[B]+=e.length,this[R].push(e)}[jt](){return this[V]?--this[B]:this[B]-=this[R][0].length,this[R].shift()}[Ot](e=!1){do;while(this[kt](this[jt]())&&this[R].length);!e&&!this[R].length&&!this[O]&&this.emit(`drain`)}[kt](e){return this.emit(`data`,e),this[F]}pipe(e,t){if(this[H])return e;this[K]=!1;let n=this[A];return t||={},e===St.stdout||e===St.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[z].push(t.proxyErrors?new Ut(this,e,t):new Ht(this,e,t)),this[U]?q(()=>this[L]()):this[L]()),e}unpipe(e){let t=this[z].find(t=>t.dest===e);t&&(this[z].length===1?(this[F]&&this[G]===0&&(this[F]=!1),this[z]=[]):this[z].splice(this[z].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e===`data`)this[K]=!1,this[G]++,!this[z].length&&!this[F]&&this[L]();else if(e===`readable`&&this[B]!==0)super.emit(`readable`);else if(zt(e)&&this[A])super.emit(e),this.removeAllListeners(e);else if(e===`error`&&this[M]){let e=t;this[U]?q(()=>e.call(this,this[M])):e.call(this,this[M])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e===`data`&&(this[G]=this.listeners(`data`).length,this[G]===0&&!this[K]&&!this[z].length&&(this[F]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e===`data`||e===void 0)&&(this[G]=0,!this[K]&&!this[z].length&&(this[F]=!1)),t}get emittedEnd(){return this[A]}[k](){!this[j]&&!this[A]&&!this[H]&&this[R].length===0&&this[O]&&(this[j]=!0,this.emit(`end`),this.emit(`prefinish`),this.emit(`finish`),this[Et]&&this.emit(`close`),this[j]=!1)}emit(e,...t){let n=t[0];if(e!==`error`&&e!==`close`&&e!==H&&this[H])return!1;if(e===`data`)return!this[V]&&!n?!1:this[U]?(q(()=>this[Nt](n)),!0):this[Nt](n);if(e===`end`)return this[Pt]();if(e===`close`){if(this[Et]=!0,!this[A]&&!this[H])return!1;let e=super.emit(`close`);return this.removeAllListeners(`close`),e}else if(e===`error`){this[M]=n,super.emit(Mt,n);let e=!this[W]||this.listeners(`error`).length?super.emit(`error`,n):!1;return this[k](),e}else if(e===`resume`){let e=super.emit(`resume`);return this[k](),e}else if(e===`finish`||e===`prefinish`){let t=super.emit(e);return this.removeAllListeners(e),t}let r=super.emit(e,...t);return this[k](),r}[Nt](e){for(let t of this[z])t.dest.write(e)===!1&&this.pause();let t=this[K]?!1:super.emit(`data`,e);return this[k](),t}[Pt](){return this[A]?!1:(this[A]=!0,this.readable=!1,this[U]?(q(()=>this[Ft]()),!0):this[Ft]())}[Ft](){if(this[P]){let e=this[P].end();if(e){for(let t of this[z])t.dest.write(e);this[K]||super.emit(`data`,e)}}for(let e of this[z])e.end();let e=super.emit(`end`);return this.removeAllListeners(`end`),e}async collect(){let e=Object.assign([],{dataLength:0});this[V]||(e.dataLength=0);let t=this.promise();return this.on(`data`,t=>{e.push(t),this[V]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[V])throw Error(`cannot concat in objectMode`);let e=await this.collect();return this[N]?e.join(``):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(H,()=>t(Error(`stream destroyed`))),this.on(`error`,e=>t(e)),this.on(`end`,()=>e())})}[Symbol.asyncIterator](){this[K]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[O])return t();let r,i,a=e=>{this.off(`data`,o),this.off(`end`,s),this.off(H,c),t(),i(e)},o=e=>{this.off(`error`,a),this.off(`end`,s),this.off(H,c),this.pause(),r({value:e,done:!!this[O]})},s=()=>{this.off(`error`,a),this.off(`data`,o),this.off(H,c),t(),r({done:!0,value:void 0})},c=()=>a(Error(`stream destroyed`));return new Promise((e,t)=>{i=t,r=e,this.once(H,c),this.once(`error`,a),this.once(`end`,s),this.once(`data`,o)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[K]=!1;let e=!1,t=()=>(this.pause(),this.off(Mt,t),this.off(H,t),this.off(`end`,t),e=!0,{done:!0,value:void 0});return this.once(`end`,t),this.once(Mt,t),this.once(H,t),{next:()=>{if(e)return t();let n=this.read();return n===null?t():{done:!1,value:n}},throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[H])return e?this.emit(`error`,e):this.emit(H),this;this[H]=!0,this[K]=!0,this[R].length=0,this[B]=0;let t=this;return typeof t.close==`function`&&!this[Et]&&t.close(),e?this.emit(`error`,e):this.emit(H),this}static get isStream(){return Ct}};const J={lstatSync:a,readdir:o,readdirSync:s,readlinkSync:c,realpathSync:l.native,promises:{lstat:f,readdir:p,readlink:m,realpath:ee}},qt=e=>!e||e===J||e===n?J:{...J,...e,promises:{...J.promises,...e.promises||{}}},Jt=/^\\\\\?\\([a-z]:)\\?$/i,Yt=e=>e.replace(/\//g,`\\`).replace(Jt,`$1\\`),Xt=/[\\\/]/,Zt=e=>e.isFile()?8:e.isDirectory()?4:e.isSymbolicLink()?10:e.isCharacterDevice()?2:e.isBlockDevice()?6:e.isSocket()?12:e.isFIFO()?1:0,Qt=new Map,Y=e=>{let t=Qt.get(e);if(t)return t;let n=e.normalize(`NFKD`);return Qt.set(e,n),n},$t=new Map,en=e=>{let t=$t.get(e);if(t)return t;let n=Y(e.toLowerCase());return $t.set(e,n),n};var tn=class extends xt{constructor(){super({max:256})}},nn=class extends xt{constructor(e=16*1024){super({maxSize:e,sizeCalculation:e=>e.length+1})}};const rn=Symbol(`PathScurry setAsCwd`);var X=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#i;get uid(){return this.#i}#a;get gid(){return this.#a}#o;get rdev(){return this.#o}#s;get blksize(){return this.#s}#c;get ino(){return this.#c}#l;get size(){return this.#l}#u;get blocks(){return this.#u}#d;get atimeMs(){return this.#d}#f;get mtimeMs(){return this.#f}#p;get ctimeMs(){return this.#p}#m;get birthtimeMs(){return this.#m}#h;get atime(){return this.#h}#g;get mtime(){return this.#g}#_;get ctime(){return this.#_}#v;get birthtime(){return this.#v}#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=0,n,r,i,a,o){this.name=e,this.#y=i?en(e):Y(e),this.#T=t&1023,this.nocase=i,this.roots=r,this.root=n||this,this.#E=a,this.#x=o.fullpath,this.#C=o.relative,this.#w=o.relativePosix,this.parent=o.parent,this.parent?this.#e=this.parent.#e:this.#e=qt(o.fs)}depth(){return this.#b===void 0?this.parent?this.#b=this.parent.depth()+1:this.#b=0:this.#b}childrenCache(){return this.#E}resolve(e){if(!e)return this;let t=this.getRootString(e),n=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#k(n):this.#k(n)}#k(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#E.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#E.set(this,t),this.#T&=-17,t}child(e,t){if(e===``||e===`.`)return this;if(e===`..`)return this.parent||this;let n=this.children(),r=this.nocase?en(e):Y(e);for(let e of n)if(e.#y===r)return e;let i=this.parent?this.sep:``,a=this.#x?this.#x+i+e:void 0,o=this.newChild(e,0,{...t,parent:this,fullpath:a});return this.canReaddir()||(o.#T|=128),n.push(o),o}relative(){if(this.isCWD)return``;if(this.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.name;let n=t.relative();return n+(!n||!t.parent?``:this.sep)+e}relativePosix(){if(this.sep===`/`)return this.relative();if(this.isCWD)return``;if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?``:`/`)+e}fullpath(){if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;return t?this.#x=t.fullpath()+(t.parent?this.sep:``)+e:this.#x=this.name}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep===`/`)return this.#S=this.fullpath();if(!this.parent){let e=this.fullpath().replace(/\\/g,`/`);return/^[a-z]:\//i.test(e)?this.#S=`//?/${e}`:this.#S=e}let e=this.parent,t=e.fullpathPosix();return this.#S=t+(!t||!e.parent?``:`/`)+this.name}isUnknown(){return(this.#T&15)==0}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?`Unknown`:this.isDirectory()?`Directory`:this.isFile()?`File`:this.isSymbolicLink()?`SymbolicLink`:this.isFIFO()?`FIFO`:this.isCharacterDevice()?`CharacterDevice`:this.isBlockDevice()?`BlockDevice`:this.isSocket()?`Socket`:`Unknown`}isFile(){return(this.#T&15)==8}isDirectory(){return(this.#T&15)==4}isCharacterDevice(){return(this.#T&15)==2}isBlockDevice(){return(this.#T&15)==6}isFIFO(){return(this.#T&15)==1}isSocket(){return(this.#T&15)==12}isSymbolicLink(){return(this.#T&10)==10}lstatCached(){return this.#T&32?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let e=this.#T&15;return!(e!==0&&e!==10||this.#T&256||this.#T&128)}calledReaddir(){return!!(this.#T&16)}isENOENT(){return!!(this.#T&128)}isNamed(e){return this.nocase?this.#y===en(e):this.#y===Y(e)}async readlink(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=await this.#e.promises.readlink(this.fullpath()),t=(await this.parent.realpath())?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}readlinkSync(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=this.#e.readlinkSync(this.fullpath()),t=this.parent.realpathSync()?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}#A(e){this.#T|=16;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#j()}}#j(){this.#T&128||(this.#T=(this.#T|128)&-16,this.#M())}#M(){let e=this.children();e.provisional=0;for(let t of e)t.#j()}#N(){this.#T|=512,this.#P()}#P(){if(this.#T&64)return;let e=this.#T;(e&15)==4&&(e&=-16),this.#T=e|64,this.#M()}#F(e=``){e===`ENOTDIR`||e===`EPERM`?this.#P():e===`ENOENT`?this.#j():this.children().provisional=0}#I(e=``){e===`ENOTDIR`?this.parent.#P():e===`ENOENT`&&this.#j()}#L(e=``){let t=this.#T;t|=256,e===`ENOENT`&&(t|=128),(e===`EINVAL`||e===`UNKNOWN`)&&(t&=-16),this.#T=t,e===`ENOTDIR`&&this.parent&&this.parent.#P()}#R(e,t){return this.#B(e,t)||this.#z(e,t)}#z(e,t){let n=Zt(e),r=this.newChild(e.name,n,{parent:this}),i=r.#T&15;return i!==4&&i!==10&&i!==0&&(r.#T|=64),t.unshift(r),t.provisional++,r}#B(e,t){for(let n=t.provisional;n<t.length;n++){let r=t[n];if((this.nocase?en(e.name):Y(e.name))===r.#y)return this.#V(e,r,n,t)}}#V(e,t,n,r){let i=t.name;return t.#T=t.#T&-16|Zt(e),i!==e.name&&(t.name=e.name),n!==r.provisional&&(n===r.length-1?r.pop():r.splice(n,1),r.unshift(t)),r.provisional++,t}async lstat(){if(!(this.#T&128))try{return this.#H(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#I(e.code)}}lstatSync(){if(!(this.#T&128))try{return this.#H(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#I(e.code)}}#H(e){let{atime:t,atimeMs:n,birthtime:r,birthtimeMs:i,blksize:a,blocks:o,ctime:s,ctimeMs:c,dev:l,gid:u,ino:d,mode:f,mtime:p,mtimeMs:m,nlink:ee,rdev:h,size:g,uid:_}=e;this.#h=t,this.#d=n,this.#v=r,this.#m=i,this.#s=a,this.#u=o,this.#_=s,this.#p=c,this.#t=l,this.#a=u,this.#c=d,this.#n=f,this.#g=p,this.#f=m,this.#r=ee,this.#o=h,this.#l=g,this.#i=_;let v=Zt(e);this.#T=this.#T&-16|v|32,v!==0&&v!==4&&v!==10&&(this.#T|=64)}#U=[];#W=!1;#G(e){this.#W=!1;let t=this.#U.slice();this.#U.length=0,t.forEach(t=>t(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let r=n.slice(0,n.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#U.push(e),this.#W)return;this.#W=!0;let r=this.fullpath();this.#e.readdir(r,{withFileTypes:!0},(e,t)=>{if(e)this.#F(e.code),n.provisional=0;else{for(let e of t)this.#R(e,n);this.#A(n)}this.#G(n.slice(0,n.provisional))})}#K;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#K)await this.#K;else{let n=()=>{};this.#K=new Promise(e=>n=e);try{for(let n of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}this.#K=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#e.readdirSync(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#T&704)return!1;let e=15&this.#T;return e===0||e===4||e===10}shouldWalk(e,t){return(this.#T&4)==4&&!(this.#T&704)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!(896&this.#T))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#O)return this.#O;if(!(896&this.#T))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}[rn](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],r=this;for(;r&&r.parent;)t.add(r),r.#C=n.join(this.sep),r.#w=n.join(`/`),r=r.parent,n.push(`..`);for(r=e;r&&r.parent&&!t.has(r);)r.#C=void 0,r.#w=void 0,r=r.parent}},an=class e extends X{sep=`\\`;splitSep=Xt;constructor(e,t=0,n,r,i,a,o){super(e,t,n,r,i,a,o)}newChild(t,n=0,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return t.parse(e).root}getRoot(e){if(e=Yt(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new cn(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,`\\`).replace(Jt,`$1\\`),e===t}},on=class e extends X{splitSep=`/`;sep=`/`;constructor(e,t=0,n,r,i,a,o){super(e,t,n,r,i,a,o)}getRootString(e){return e.startsWith(`/`)?`/`:``}getRoot(e){return this.root}newChild(t,n=0,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}},sn=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),t,n,{nocase:i,childrenCacheSize:a=16*1024,fs:o=J}={}){this.#r=qt(o),(e instanceof URL||e.startsWith(`file://`))&&(e=r(e));let s=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(s),this.#e=new tn,this.#t=new tn,this.#n=new nn(a);let c=s.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),i===void 0)throw TypeError(`must provide nocase setting to PathScurryBase ctor`);this.nocase=i,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,d=t.sep,f=this.rootPath,p=!1;for(let e of c){let t=u--;l=l.child(e,{relative:Array(t).fill(`..`).join(d),relativePosix:Array(t).fill(`..`).join(`/`),fullpath:f+=(p?``:d)+e}),p=!0}this.cwd=l}depth(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(!(!r||r===`.`)&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#e.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpath();return this.#e.set(t,r),r}resolvePosix(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(!(!r||r===`.`)&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#t.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpathPosix();return this.#t.set(t,r),r}relative(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let t=await e.readdir();return n?t:t.map(e=>e.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(e=>e.name):[]}async lstat(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=new Set,c=(e,t)=>{s.add(e),e.readdirCB((e,l)=>{if(e)return t(e);let u=l.length;if(!u)return t();let d=()=>{--u===0&&t()};for(let e of l)(!i||i(e))&&o.push(n?e:e.fullpath()),r&&e.isSymbolicLink()?e.realpath().then(e=>e?.isUnknown()?e.lstat():e).then(e=>e?.shouldWalk(s,a)?c(e,d):d()):e.shouldWalk(s,a)?c(e,d):d()},!0)},l=e;return new Promise((e,t)=>{c(l,n=>{if(n)return t(n);e(o)})})}walkSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=new Set([e]);for(let e of s){let t=e.readdirSync();for(let e of t){(!i||i(e))&&o.push(n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&s.add(t)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t;(!i||i(e))&&(yield n?e:e.fullpath());let o=new Set([e]);for(let e of o){let t=e.readdirSync();for(let e of t){(!i||i(e))&&(yield n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,a)&&o.add(t)}}}stream(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new Kt({objectMode:!0});(!i||i(e))&&o.write(n?e:e.fullpath());let s=new Set,c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let d=(t,p,m=!1)=>{if(t)return o.emit(`error`,t);if(r&&!m){let e=[];for(let t of p)t.isSymbolicLink()&&e.push(t.realpath().then(e=>e?.isUnknown()?e.lstat():e));if(e.length){Promise.all(e).then(()=>d(null,p,!0));return}}for(let t of p)t&&(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of p){let t=e.realpathCached()||e;t.shouldWalk(s,a)&&c.push(t)}e&&!o.flowing?o.once(`drain`,u):f||u()},f=!0;t.readdirCB(d,!0),f=!1}};return u(),o}streamSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof X||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new Kt({objectMode:!0}),s=new Set;(!i||i(e))&&o.write(n?e:e.fullpath());let c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let u=t.readdirSync();for(let t of u)(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of u){let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&c.push(t)}}e&&!o.flowing&&o.once(`drain`,u)};return u(),o}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e==`string`?this.cwd.resolve(e):e,this.cwd[rn](t)}},cn=class extends sn{sep=`\\`;constructor(e=process.cwd(),n={}){let{nocase:r=!0}=n;super(e,t,`\\`,{...n,nocase:r}),this.nocase=r;for(let e=this.cwd;e;e=e.parent)e.nocase=this.nocase}parseRootPath(e){return t.parse(e).root.toUpperCase()}newRoot(e){return new an(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)||e.startsWith(`\\`)||/^[a-z]:(\/|\\)/i.test(e)}},ln=class extends sn{sep=`/`;constructor(t=process.cwd(),n={}){let{nocase:r=!1}=n;super(t,e,`/`,{...n,nocase:r}),this.nocase=r}parseRootPath(e){return`/`}newRoot(e){return new on(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)}},un=class extends ln{constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}};process.platform;const dn=process.platform===`win32`?cn:process.platform===`darwin`?un:ln,fn=e=>e.length>=1,pn=e=>e.length>=1;var mn=class e{#e;#t;#n;length;#r;#i;#a;#o;#s;#c;#l=!0;constructor(e,t,n,r){if(!fn(e))throw TypeError(`empty pattern list`);if(!pn(t))throw TypeError(`empty glob list`);if(t.length!==e.length)throw TypeError(`mismatched pattern list and glob list lengths`);if(this.length=e.length,n<0||n>=this.length)throw TypeError(`index out of range`);if(this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#n===0){if(this.isUNC()){let[e,t,n,r,...i]=this.#e,[a,o,s,c,...l]=this.#t;i[0]===``&&(i.shift(),l.shift());let u=[e,t,n,r,``].join(`/`),d=[a,o,s,c,``].join(`/`);this.#e=[u,...i],this.#t=[d,...l],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[e,...t]=this.#e,[n,...r]=this.#t;t[0]===``&&(t.shift(),r.shift());let i=e+`/`,a=n+`/`;this.#e=[i,...t],this.#t=[a,...r],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]==`string`}isGlobstar(){return this.#e[this.#n]===C}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join(`/`):this.#t.join(`/`):this.#t.slice(this.#n).join(`/`))}hasMore(){return this.length>this.#n+1}rest(){return this.#i===void 0?this.hasMore()?(this.#i=new e(this.#e,this.#t,this.#n+1,this.#r),this.#i.#c=this.#c,this.#i.#s=this.#s,this.#i.#o=this.#o,this.#i):this.#i=null:this.#i}isUNC(){let e=this.#e;return this.#s===void 0?this.#s=this.#r===`win32`&&this.#n===0&&e[0]===``&&e[1]===``&&typeof e[2]==`string`&&!!e[2]&&typeof e[3]==`string`&&!!e[3]:this.#s}isDrive(){let e=this.#e;return this.#o===void 0?this.#o=this.#r===`win32`&&this.#n===0&&this.length>1&&typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]):this.#o}isAbsolute(){let e=this.#e;return this.#c===void 0?this.#c=e[0]===``&&e.length>1||this.isDrive()||this.isUNC():this.#c}root(){let e=this.#e[0];return typeof e==`string`&&this.isAbsolute()&&this.#n===0?e:``}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};const hn=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`;var gn=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:r,noglobstar:i,platform:a=hn}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:r,noglobstar:i,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let t of e)this.add(t)}add(e){let t=new T(e,this.mmopts);for(let e=0;e<t.set.length;e++){let n=t.set[e],r=t.globParts[e];if(!n||!r)throw Error(`invalid pattern object`);for(;n[0]===`.`&&r[0]===`.`;)n.shift(),r.shift();let i=new mn(n,r,0,this.platform),a=new T(i.globString(),this.mmopts),o=r[r.length-1]===`**`,s=i.isAbsolute();s?this.absolute.push(a):this.relative.push(a),o&&(s?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let t=e.fullpath(),n=`${t}/`,r=e.relative()||`.`,i=`${r}/`;for(let e of this.relative)if(e.match(r)||e.match(i))return!0;for(let e of this.absolute)if(e.match(t)||e.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+`/`,n=(e.relative()||`.`)+`/`;for(let e of this.relativeChildren)if(e.match(n))return!0;for(let e of this.absoluteChildren)if(e.match(t))return!0;return!1}},_n=class e{store;constructor(e=new Map){this.store=e}copy(){return new e(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),r=this.store.get(n);r?r.add(t.globString()):this.store.set(n,new Set([t.globString()]))}},vn=class{store=new Map;add(e,t,n){let r=(t?2:0)|(n?1:0),i=this.store.get(e);this.store.set(e,i===void 0?r:r&i)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},yn=class{store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(e=>e.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw Error(`attempting to walk unknown path`);return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},bn=class e{hasWalkedCache;matches=new vn;subwalks=new yn;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new _n}processPatterns(e,t){this.patterns=t;let n=t.map(t=>[e,t]);for(let[e,t]of n){this.hasWalkedCache.storeWalked(e,t);let n=t.root(),r=t.isAbsolute()&&this.opts.absolute!==!1;if(n){e=e.resolve(n===`/`&&this.opts.root!==void 0?this.opts.root:n);let r=t.rest();if(r)t=r;else{this.matches.add(e,!0,!1);continue}}if(e.isENOENT())continue;let i,a,o=!1;for(;typeof(i=t.pattern())==`string`&&(a=t.rest());)e=e.resolve(i),t=a,o=!0;if(i=t.pattern(),a=t.rest(),o){if(this.hasWalkedCache.hasWalked(e,t))continue;this.hasWalkedCache.storeWalked(e,t)}if(typeof i==`string`){let t=i===`..`||i===``||i===`.`;this.matches.add(e.resolve(i),r,t);continue}else if(i===C){(!e.isSymbolicLink()||this.follow||t.checkFollowGlobstar())&&this.subwalks.add(e,t);let n=a?.pattern(),i=a?.rest();if(!a||(n===``||n===`.`)&&!i)this.matches.add(e,r,n===``||n===`.`);else if(n===`..`){let t=e.parent||e;i?this.hasWalkedCache.hasWalked(t,i)||this.subwalks.add(t,i):this.matches.add(t,r,!0)}}else i instanceof RegExp&&this.subwalks.add(e,t)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),r=this.child();for(let e of t)for(let t of n){let n=t.isAbsolute(),i=t.pattern(),a=t.rest();i===C?r.testGlobstar(e,t,a,n):i instanceof RegExp?r.testRegExp(e,i,a,n):r.testString(e,i,a,n)}return r}testGlobstar(e,t,n,r){if((this.dot||!e.name.startsWith(`.`))&&(t.hasMore()||this.matches.add(e,r,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let t=n.pattern();if(typeof t==`string`&&t!==`..`&&t!==``&&t!==`.`)this.testString(e,t,n.rest(),r);else if(t===`..`){let t=e.parent||e;this.subwalks.add(t,n)}else t instanceof RegExp&&this.testRegExp(e,t,n.rest(),r)}}testRegExp(e,t,n,r){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}testString(e,t,n,r){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}};const xn=(e,t)=>typeof e==`string`?new gn([e],t):Array.isArray(e)?new gn(e,t):e;var Sn=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#n;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#n=!n.posix&&n.platform===`win32`?`\\`:`/`,this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#t=xn(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.add!=`function`))throw Error(`cannot ignore child matches, ignore lacks add() method.`);this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener(`abort`,()=>{this.#e.length=0}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#i(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=await r.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=r.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let t=`${e.relativePosix()}/**`;this.#t.add(t)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let r=this.opts.mark&&e.isDirectory()?this.#n:``;if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let t=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(t+r)}else{let t=this.opts.posix?e.relativePosix():e.relative(),n=this.opts.dotRelative&&!t.startsWith(`..`+this.#n)?`.`+this.#n:``;this.matchEmit(t?n+t+r:`.`+r)}}async match(e,t,n){let r=await this.matchCheck(e,n);r&&this.matchFinish(r,t)}matchSync(e,t,n){let r=this.matchCheckSync(e,n);r&&this.matchFinish(r,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new bn(this.opts),n)}walkCB2(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirCached();e.calledReaddir()?this.walkCB3(e,t,n,a):e.readdirCB((t,r)=>this.walkCB3(e,r,n,a),!0)}a()}walkCB3(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let[e,t]of n.subwalks.entries())i++,this.walkCB2(e,t,n.child(),a);a()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new bn(this.opts),n)}walkCB2Sync(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirSync();this.walkCB3Sync(e,t,n,a)}a()}walkCB3Sync(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let[e,t]of n.subwalks.entries())i++,this.walkCB2Sync(e,t,n.child(),a);a()}},Cn=class extends Sn{matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},wn=class extends Sn{results;constructor(e,t,n){super(e,t,n),this.results=new Kt({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}};const Tn=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`;var Z=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw TypeError(`glob options required`);if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith(`file://`))&&(t.cwd=r(t.cwd)):this.cwd=``,this.cwd=t.cwd||``,this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error(`cannot set absolute and withFileTypes:true`);if(typeof e==`string`&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(e=>e.replace(/\\/g,`/`))),this.matchBase){if(t.noglobstar)throw TypeError(`base matching requires globstar`);e=e.map(e=>e.includes(`/`)?e:`./**/${e}`)}if(this.pattern=e,this.platform=t.platform||Tn,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw Error(`nocase option contradicts provided scurry option`)}else this.scurry=new(t.platform===`win32`?cn:t.platform===`darwin`?un:t.platform?ln:dn)(this.cwd,{nocase:t.nocase,fs:t.fs});this.nocase=this.scurry.nocase;let n=this.platform===`darwin`||this.platform===`win32`,i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[a,o]=this.pattern.map(e=>new T(e,i)).reduce((e,t)=>(e[0].push(...t.set),e[1].push(...t.globParts),e),[[],[]]);this.patterns=a.map((e,t)=>{let n=o[t];if(!n)throw Error(`invalid pattern object`);return new mn(e,n,0,this.platform)})}async walk(){return[...await new Cn(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Cn(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new wn(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new wn(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),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()}};const En=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let n of e)if(new T(n,t).hasMagic())return!0;return!1};function Q(e,t={}){return new Z(e,t).streamSync()}function Dn(e,t={}){return new Z(e,t).stream()}function On(e,t={}){return new Z(e,t).walkSync()}async function kn(e,t={}){return new Z(e,t).walk()}function $(e,t={}){return new Z(e,t).iterateSync()}function An(e,t={}){return new Z(e,t).iterate()}const jn=Q,Mn=Object.assign(Dn,{sync:Q}),Nn=$,Pn=Object.assign(An,{sync:$}),Fn=Object.assign(On,{stream:Q,iterate:$}),In=Object.assign(kn,{glob:kn,globSync:On,sync:Fn,globStream:Dn,stream:Mn,globStreamSync:Q,streamSync:jn,globIterate:An,iterate:Pn,globIterateSync:$,iterateSync:Nn,Glob:Z,hasMagic:En,escape:Be,unescape:x});In.glob=In;export{Q as a,Nn as c,Fn as d,En as f,x as g,Be as h,Dn as i,Mn as l,gn as m,An as n,On as o,Z as p,$ as r,Pn as s,In as t,jn as u};
4
- //# sourceMappingURL=esm-BbhxxeGF.mjs.map