Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

it-glob

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

it-glob - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

6

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.ItGlob = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var ItGlob=(()=>{var Ft=Object.create;var Z=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var Jt=Object.getOwnPropertyNames;var Vt=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty;var Kt=(i,t,e)=>t in i?Z(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var X=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Qt=(i,t)=>{for(var e in t)Z(i,e,{get:t[e],enumerable:!0})},ut=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Jt(t))!Xt.call(i,n)&&n!==e&&Z(i,n,{get:()=>t[n],enumerable:!(s=Ht(t,n))||s.enumerable});return i};var et=(i,t,e)=>(e=i!=null?Ft(Vt(i)):{},ut(t||!i||!i.__esModule?Z(e,"default",{value:i,enumerable:!0}):e,i)),Yt=i=>ut(Z({},"__esModule",{value:!0}),i);var ft=(i,t,e)=>(Kt(i,typeof t!="symbol"?t+"":t,e),e),st=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var a=(i,t,e)=>(st(i,t,"read from private field"),e?e.call(i):t.get(i)),M=(i,t,e)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,e)},y=(i,t,e,s)=>(st(i,t,"write to private field"),s?s.call(i,e):t.set(i,e),e);var I=(i,t,e)=>(st(i,t,"access private method"),e);var pt=X(()=>{});var gt=X(()=>{});var xt=X((Ve,yt)=>{"use strict";yt.exports=mt;function mt(i,t,e){i instanceof RegExp&&(i=dt(i,e)),t instanceof RegExp&&(t=dt(t,e));var s=wt(i,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+i.length,s[1]),post:e.slice(s[1]+t.length)}}function dt(i,t){var e=t.match(i);return e?e[0]:null}mt.range=wt;function wt(i,t,e){var s,n,r,o,h,c=e.indexOf(i),u=e.indexOf(t,c+1),l=c;if(c>=0&&u>0){if(i===t)return[c,u];for(s=[],r=e.length;l>=0&&!h;)l==c?(s.push(l),c=e.indexOf(i,l+1)):s.length==1?h=[s.pop(),u]:(n=s.pop(),n<r&&(r=n,o=u),u=e.indexOf(t,l+1)),l=c<u&&c>=0?c:u;s.length&&(h=[r,o])}return h}});var At=X((Xe,Ot)=>{var vt=xt();Ot.exports=se;var St="\0SLASH"+Math.random()+"\0",Et="\0OPEN"+Math.random()+"\0",nt="\0CLOSE"+Math.random()+"\0",bt="\0COMMA"+Math.random()+"\0",Tt="\0PERIOD"+Math.random()+"\0";function it(i){return parseInt(i,10)==i?parseInt(i,10):i.charCodeAt(0)}function te(i){return i.split("\\\\").join(St).split("\\{").join(Et).split("\\}").join(nt).split("\\,").join(bt).split("\\.").join(Tt)}function ee(i){return i.split(St).join("\\").split(Et).join("{").split(nt).join("}").split(bt).join(",").split(Tt).join(".")}function Mt(i){if(!i)return[""];var t=[],e=vt("{","}",i);if(!e)return i.split(",");var s=e.pre,n=e.body,r=e.post,o=s.split(",");o[o.length-1]+="{"+n+"}";var h=Mt(r);return r.length&&(o[o.length-1]+=h.shift(),o.push.apply(o,h)),t.push.apply(t,o),t}function se(i){return i?(i.substr(0,2)==="{}"&&(i="\\{\\}"+i.substr(2)),F(te(i),!0).map(ee)):[]}function ie(i){return"{"+i+"}"}function ne(i){return/^-?0\d/.test(i)}function re(i,t){return i<=t}function oe(i,t){return i>=t}function F(i,t){var e=[],s=vt("{","}",i);if(!s)return[i];var n=s.pre,r=s.post.length?F(s.post,!1):[""];if(/\$$/.test(s.pre))for(var o=0;o<r.length;o++){var h=n+"{"+s.body+"}"+r[o];e.push(h)}else{var c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),l=c||u,g=s.body.indexOf(",")>=0;if(!l&&!g)return s.post.match(/,.*\}/)?(i=s.pre+"{"+s.body+nt+s.post,F(i)):[i];var f;if(l)f=s.body.split(/\.\./);else if(f=Mt(s.body),f.length===1&&(f=F(f[0],!1).map(ie),f.length===1))return r.map(function(Zt){return s.pre+f[0]+Zt});var d;if(l){var T=it(f[0]),p=it(f[1]),S=Math.max(f[0].length,f[1].length),m=f.length==3?Math.abs(it(f[2])):1,A=re,tt=p<T;tt&&(m*=-1,A=oe);var Ut=f.some(ne);d=[];for(var U=T;A(U,p);U+=m){var C;if(u)C=String.fromCharCode(U),C==="\\"&&(C="");else if(C=String(U),Ut){var ct=S-C.length;if(ct>0){var lt=new Array(ct+1).join("0");U<0?C="-"+lt+C.slice(1):C=lt+C}}d.push(C)}}else{d=[];for(var k=0;k<f.length;k++)d.push.apply(d,F(f[k],!1))}for(var k=0;k<d.length;k++)for(var o=0;o<r.length;o++){var h=n+d[k]+r[o];(!t||l||h)&&e.push(h)}}return e}});var qe={};Qt(qe,{default:()=>_t});var ht=et(pt(),1),q=et(gt(),1);var kt=et(At(),1);var H=i=>{if(typeof i!="string")throw new TypeError("invalid pattern");if(i.length>65536)throw new TypeError("pattern is too long")};var ae={"[: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]},J=i=>i.replace(/[[\]\\-]/g,"\\$&"),he=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Nt=i=>i.join(""),$t=(i,t)=>{let e=t;if(i.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],n=[],r=e+1,o=!1,h=!1,c=!1,u=!1,l=e,g="";t:for(;r<i.length;){let p=i.charAt(r);if((p==="!"||p==="^")&&r===e+1){u=!0,r++;continue}if(p==="]"&&o&&!c){l=r+1;break}if(o=!0,p==="\\"&&!c){c=!0,r++;continue}if(p==="["&&!c){for(let[S,[m,A,tt]]of Object.entries(ae))if(i.startsWith(S,r)){if(g)return["$.",!1,i.length-e,!0];r+=S.length,tt?n.push(m):s.push(m),h=h||A;continue t}}if(c=!1,g){p>g?s.push(J(g)+"-"+J(p)):p===g&&s.push(J(p)),g="",r++;continue}if(i.startsWith("-]",r+1)){s.push(J(p+"-")),r+=2;continue}if(i.startsWith("-",r+1)){g=p,r+=2;continue}s.push(J(p)),r++}if(l<r)return["",!1,0,!1];if(!s.length&&!n.length)return["$.",!1,i.length-e,!0];if(n.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!u){let p=s[0].length===2?s[0].slice(-1):s[0];return[he(p),!1,l-e,!1]}let f="["+(u?"^":"")+Nt(s)+"]",d="["+(u?"":"^")+Nt(n)+"]";return[s.length&&n.length?"("+f+"|"+d+")":s.length?f:d,h,l-e,!0]};var L=(i,{windowsPathsNoEscape:t=!1}={})=>t?i.replace(/\[([^\/\\])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var ce=new Set(["!","?","+","*","@"]),jt=i=>ce.has(i),le="(?!\\.\\.?(?:$|/))",rt="(?!\\.)",ue=new Set(["[","."]),fe=new Set(["..","."]),pe=new Set("().*{}+?[]^$\\!"),ge=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ot="[^/]",Ct=ot+"*?",Rt=ot+"+?",v,E,R,w,x,W,G,D,N,z,V,Q,Lt,B,K,Y,Wt,O=class{constructor(t,e,s={}){M(this,Q);ft(this,"type");M(this,v,void 0);M(this,E,void 0);M(this,R,!1);M(this,w,[]);M(this,x,void 0);M(this,W,void 0);M(this,G,void 0);M(this,D,!1);M(this,N,void 0);M(this,z,void 0);M(this,V,!1);this.type=t,t&&y(this,E,!0),y(this,x,e),y(this,v,a(this,x)?a(a(this,x),v):this),y(this,N,a(this,v)===this?s:a(a(this,v),N)),y(this,G,a(this,v)===this?[]:a(a(this,v),G)),t==="!"&&!a(a(this,v),D)&&a(this,G).push(this),y(this,W,a(this,x)?a(a(this,x),w).length:0)}get hasMagic(){if(a(this,E)!==void 0)return a(this,E);for(let t of a(this,w))if(typeof t!="string"&&(t.type||t.hasMagic))return y(this,E,!0);return a(this,E)}toString(){return a(this,z)!==void 0?a(this,z):this.type?y(this,z,this.type+"("+a(this,w).map(t=>String(t)).join("|")+")"):y(this,z,a(this,w).map(t=>String(t)).join(""))}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof O&&a(e,x)===this))throw new Error("invalid part: "+e);a(this,w).push(e)}}toJSON(){let t=this.type===null?a(this,w).slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...a(this,w).map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===a(this,v)||a(a(this,v),D)&&a(this,x)?.type==="!")&&t.push({}),t}isStart(){if(a(this,v)===this)return!0;if(!a(this,x)?.isStart())return!1;if(a(this,W)===0)return!0;let t=a(this,x);for(let e=0;e<a(this,W);e++){let s=a(t,w)[e];if(!(s instanceof O&&s.type==="!"))return!1}return!0}isEnd(){if(a(this,v)===this||a(this,x)?.type==="!")return!0;if(!a(this,x)?.isEnd())return!1;if(!this.type)return a(this,x)?.isEnd();let t=a(this,x)?a(a(this,x),w).length:0;return a(this,W)===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new O(this.type,t);for(let s of a(this,w))e.copyIn(s);return e}static fromGlob(t,e={}){var n;let s=new O(null,void 0,e);return I(n=O,B,K).call(n,t,s,0,e),s}toMMPattern(){if(this!==a(this,v))return a(this,v).toMMPattern();let t=this.toString(),[e,s,n,r]=this.toRegExpSource();if(!(n||a(this,E)||a(this,N).nocase&&!a(this,N).nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let h=(a(this,N).nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,h),{_src:e,_glob:t})}toRegExpSource(){if(a(this,v)===this&&I(this,Q,Lt).call(this),!this.type){let n=this.isStart()&&this.isEnd(),r=a(this,w).map(u=>{var T;let[l,g,f,d]=typeof u=="string"?I(T=O,Y,Wt).call(T,u,a(this,E),n):u.toRegExpSource();return y(this,E,a(this,E)||f),y(this,R,a(this,R)||d),l}).join(""),o="";if(this.isStart()&&typeof a(this,w)[0]=="string"&&!(a(this,w).length===1&&fe.has(a(this,w)[0]))){let l=ue,g=a(this,N).dot&&l.has(r.charAt(0))||r.startsWith("\\.")&&l.has(r.charAt(2))||r.startsWith("\\.\\.")&&l.has(r.charAt(4)),f=!a(this,N).dot&&l.has(r.charAt(0));o=g?le:f?rt:""}let h="";return this.isEnd()&&a(a(this,v),D)&&a(this,x)?.type==="!"&&(h="(?:$|\\/)"),[o+r+h,L(r),y(this,E,!!a(this,E)),a(this,R)]}let t=this.type==="!"?"(?:(?!(?:":"(?:",e=a(this,w).map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,o,h,c]=n.toRegExpSource();return y(this,R,a(this,R)||c),r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|");if(this.isStart()&&this.isEnd()&&!e&&this.type!=="!"){let n=this.toString();return y(this,w,[n]),this.type=null,y(this,E,void 0),[n,L(this.toString()),!1,!1]}let s="";if(this.type==="!"&&a(this,V))s=(this.isStart()&&!a(this,N).dot?rt:"")+Rt;else{let n=this.type==="!"?"))"+(this.isStart()&&!a(this,N).dot?rt:"")+Ct+")":this.type==="@"?")":`)${this.type}`;s=t+e+n}return[s,L(e),y(this,E,!!a(this,E)),a(this,R)]}},P=O;v=new WeakMap,E=new WeakMap,R=new WeakMap,w=new WeakMap,x=new WeakMap,W=new WeakMap,G=new WeakMap,D=new WeakMap,N=new WeakMap,z=new WeakMap,V=new WeakMap,Q=new WeakSet,Lt=function(){if(this!==a(this,v))throw new Error("should only call on root");if(a(this,D))return this;this.toString(),y(this,D,!0);let t;for(;t=a(this,G).pop();){if(t.type!=="!")continue;let e=t,s=a(e,x);for(;s;){for(let n=a(e,W)+1;!s.type&&n<a(s,w).length;n++)for(let r of a(t,w)){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(a(s,w)[n])}e=s,s=a(e,x)}}return this},B=new WeakSet,K=function(t,e,s,n){var d,T;let r=!1,o=!1,h=-1,c=!1;if(e.type===null){let p=s,S="";for(;p<t.length;){let m=t.charAt(p++);if(r||m==="\\"){r=!r,S+=m;continue}if(o){p===h+1?(m==="^"||m==="!")&&(c=!0):m==="]"&&!(p===h+2&&c)&&(o=!1),S+=m;continue}else if(m==="["){o=!0,h=p,c=!1,S+=m;continue}if(!n.noext&&jt(m)&&t.charAt(p)==="("){e.push(S),S="";let A=new O(m,e);p=I(d=O,B,K).call(d,t,A,p,n),e.push(A);continue}S+=m}return e.push(S),p}let u=s+1,l=new O(null,e),g=[],f="";for(;u<t.length;){let p=t.charAt(u++);if(r||p==="\\"){r=!r,f+=p;continue}if(o){u===h+1?(p==="^"||p==="!")&&(c=!0):p==="]"&&!(u===h+2&&c)&&(o=!1),f+=p;continue}else if(p==="["){o=!0,h=u,c=!1,f+=p;continue}if(jt(p)&&t.charAt(u)==="("){l.push(f),f="";let S=new O(p,l);l.push(S),u=I(T=O,B,K).call(T,t,S,u,n);continue}if(p==="|"){l.push(f),f="",g.push(l),l=new O(null,e);continue}if(p===")")return f===""&&a(e,w).length===0&&y(e,V,!0),l.push(f),f="",e.push(...g,l),u;f+=p}return e.type=null,y(e,E,void 0),y(e,w,[t.substring(s-1)]),u},Y=new WeakSet,Wt=function(t,e,s=!1){let n=!1,r="",o=!1;for(let h=0;h<t.length;h++){let c=t.charAt(h);if(n){n=!1,r+=(pe.has(c)?"\\":"")+c;continue}if(c==="\\"){h===t.length-1?r+="\\\\":n=!0;continue}if(c==="["){let[u,l,g,f]=$t(t,h);if(g){r+=u,o=o||l,h+=g-1,e=e||f;continue}}if(c==="*"){s&&t==="*"?r+=Rt:r+=Ct,e=!0;continue}if(c==="?"){r+=ot,e=!0;continue}r+=ge(c)}return[r,L(t),!!e,o]},M(P,B),M(P,Y);var at=(i,{windowsPathsNoEscape:t=!1}={})=>t?i.replace(/[?*()[\]]/g,"[$&]"):i.replace(/[?*()[\]\\]/g,"\\$&");var b=(i,t,e={})=>(H(t),!e.nocomment&&t.charAt(0)==="#"?!1:new _(t,e).match(i)),de=/^\*+([^+@!?\*\[\(]*)$/,me=i=>t=>!t.startsWith(".")&&t.endsWith(i),we=i=>t=>t.endsWith(i),ye=i=>(i=i.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(i)),xe=i=>(i=i.toLowerCase(),t=>t.toLowerCase().endsWith(i)),ve=/^\*+\.\*+$/,Se=i=>!i.startsWith(".")&&i.includes("."),Ee=i=>i!=="."&&i!==".."&&i.includes("."),be=/^\.\*+$/,Te=i=>i!=="."&&i!==".."&&i.startsWith("."),Me=/^\*+$/,Oe=i=>i.length!==0&&!i.startsWith("."),Ae=i=>i.length!==0&&i!=="."&&i!=="..",Ne=/^\?+([^+@!?\*\[\(]*)?$/,$e=([i,t=""])=>{let e=Gt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},je=([i,t=""])=>{let e=zt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},Ce=([i,t=""])=>{let e=zt([i]);return t?s=>e(s)&&s.endsWith(t):e},Re=([i,t=""])=>{let e=Gt([i]);return t?s=>e(s)&&s.endsWith(t):e},Gt=([i])=>{let t=i.length;return e=>e.length===t&&!e.startsWith(".")},zt=([i])=>{let t=i.length;return e=>e.length===t&&e!=="."&&e!==".."},It=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Dt={win32:{sep:"\\"},posix:{sep:"/"}},Le=It==="win32"?Dt.win32.sep:Dt.posix.sep;b.sep=Le;var j=Symbol("globstar **");b.GLOBSTAR=j;var We="[^/]",De=We+"*?",Pe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ke="(?:(?!(?:\\/|^)\\.).)*?",Ge=(i,t={})=>e=>b(e,i,t);b.filter=Ge;var $=(i,t={})=>Object.assign({},i,t),ze=i=>{if(!i||typeof i!="object"||!Object.keys(i).length)return b;let t=b;return Object.assign((s,n,r={})=>t(s,n,$(i,r)),{Minimatch:class extends t.Minimatch{constructor(n,r={}){super(n,$(i,r))}static defaults(n){return t.defaults($(i,n)).Minimatch}},AST:class extends t.AST{constructor(n,r,o={}){super(n,r,$(i,o))}static fromGlob(n,r={}){return t.AST.fromGlob(n,$(i,r))}},unescape:(s,n={})=>t.unescape(s,$(i,n)),escape:(s,n={})=>t.escape(s,$(i,n)),filter:(s,n={})=>t.filter(s,$(i,n)),defaults:s=>t.defaults($(i,s)),makeRe:(s,n={})=>t.makeRe(s,$(i,n)),braceExpand:(s,n={})=>t.braceExpand(s,$(i,n)),match:(s,n,r={})=>t.match(s,n,$(i,r)),sep:t.sep,GLOBSTAR:j})};b.defaults=ze;var Bt=(i,t={})=>(H(i),t.nobrace||!/\{(?:(?!\{).)*\}/.test(i)?[i]:(0,kt.default)(i));b.braceExpand=Bt;var Ie=(i,t={})=>new _(i,t).makeRe();b.makeRe=Ie;var Be=(i,t,e={})=>{let s=new _(t,e);return i=i.filter(n=>s.match(n)),s.options.nonull&&!i.length&&i.push(t),i};b.match=Be;var Pt=/[?*]|[+@!]\(.*?\)|\[|\]/,_e=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){H(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||It,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let n=this.globParts.map((r,o,h)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=r[0]===""&&r[1]===""&&(r[2]==="?"||!Pt.test(r[2]))&&!Pt.test(r[3]),u=/^[a-z]:/i.test(r[0]);if(c)return[...r.slice(0,4),...r.slice(4).map(l=>this.parse(l))];if(u)return[r[0],...r.slice(1).map(l=>this.parse(l))]}return r.map(c=>this.parse(c))});if(this.debug(this.pattern,n),this.set=n.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let n=0;n<t[s].length;n++)t[s][n]==="**"&&(t[s][n]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let n=s;for(;e[n+1]==="**";)n++;n!==s&&e.splice(s,n-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,n)=>{let r=s[s.length-1];return n==="**"&&r==="**"?s:n===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(n),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;n<t.length-1;n++){let r=t[n];n===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(n,1),n--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let n=t[s-1];n&&n!=="."&&n!==".."&&n!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let n=-1;for(;(n=s.indexOf("**",n+1))!==-1;){let o=n;for(;s[o+1]==="**";)o++;o>n&&s.splice(n+1,o-n);let h=s[n+1],c=s[n+2],u=s[n+3];if(h!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;e=!0,s.splice(n,1);let l=s.slice(0);l[n]="**",t.push(l),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let h=s[o];o===1&&h===""&&s[0]===""||(h==="."||h==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let c=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...c),s.length===0&&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++){let n=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);n&&(t[e]=n,t[s]=[])}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let n=0,r=0,o=[],h="";for(;n<t.length&&r<e.length;)if(t[n]===e[r])o.push(h==="b"?e[r]:t[n]),n++,r++;else if(s&&t[n]==="**"&&e[r]===t[n+1])o.push(t[n]),n++;else if(s&&e[r]==="**"&&t[n]===e[r+1])o.push(e[r]),r++;else if(t[n]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(h==="b")return!1;h="a",o.push(t[n]),n++,r++}else if(e[r]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(h==="a")return!1;h="b",o.push(e[r]),n++,r++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let n=0;n<t.length&&t.charAt(n)==="!";n++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let n=this.options;if(this.isWindows){let p=t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),S=e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]);if(p&&S){let m=t[3],A=e[3];m.toLowerCase()===A.toLowerCase()&&(t[3]=A)}else if(S&&typeof t[0]=="string"){let m=e[3],A=t[0];m.toLowerCase()===A.toLowerCase()&&(e[3]=A,e=e.slice(3))}else if(p&&typeof e[0]=="string"){let m=t[3];m.toLowerCase()===e[0].toLowerCase()&&(e[0]=m,t=t.slice(3))}}let{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 o=0,h=0,c=t.length,u=e.length;o<c&&h<u;o++,h++){this.debug("matchOne loop");var l=e[h],g=t[o];if(this.debug(e,l,g),l===!1)return!1;if(l===j){this.debug("GLOBSTAR",[e,l,g]);var f=o,d=h+1;if(d===u){for(this.debug("** at the end");o<c;o++)if(t[o]==="."||t[o]===".."||!n.dot&&t[o].charAt(0)===".")return!1;return!0}for(;f<c;){var T=t[f];if(this.debug(`
globstar while`,t,f,e,d,T),this.matchOne(t.slice(f),e.slice(d),s))return this.debug("globstar found match!",f,c,T),!0;if(T==="."||T===".."||!n.dot&&T.charAt(0)==="."){this.debug("dot detected!",t,f,e,d);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(s&&(this.debug(`
>>> no match, partial?`,t,f,e,d),f===c))}let p;if(typeof l=="string"?(p=g===l,this.debug("string match",l,g,p)):(p=l.test(g),this.debug("pattern match",l,g,p)),!p)return!1}if(o===c&&h===u)return!0;if(o===c)return s;if(h===u)return o===c-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Bt(this.pattern,this.options)}parse(t){H(t);let e=this.options;if(t==="**")return j;if(t==="")return"";let s,n=null;(s=t.match(Me))?n=e.dot?Ae:Oe:(s=t.match(de))?n=(e.nocase?e.dot?xe:ye:e.dot?we:me)(s[1]):(s=t.match(Ne))?n=(e.nocase?e.dot?je:$e:e.dot?Ce:Re)(s):(s=t.match(ve))?n=e.dot?Ee:Se:(s=t.match(be))&&(n=Te);let r=P.fromGlob(t,this.options).toMMPattern();return n?Object.assign(r,{test:n}):r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?De:e.dot?Pe:ke,n=new Set(e.nocase?["i"]:[]),r=t.map(c=>{let u=c.map(l=>{if(l instanceof RegExp)for(let g of l.flags.split(""))n.add(g);return typeof l=="string"?_e(l):l===j?j:l._src});return u.forEach((l,g)=>{let f=u[g+1],d=u[g-1];l!==j||d===j||(d===void 0?f!==void 0&&f!==j?u[g+1]="(?:\\/|"+s+"\\/)?"+f:u[g]=s:f===void 0?u[g-1]=d+"(?:\\/|"+s+")?":f!==j&&(u[g-1]=d+"(?:\\/|\\/"+s+"\\/)"+f,u[g+1]=j))}),u.filter(l=>l!==j).join("/")}).join("|"),[o,h]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+h+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...n].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let n=this.slashSplit(t);this.debug(this.pattern,"split",n);let r=this.set;this.debug(this.pattern,"set",r);let o=n[n.length-1];if(!o)for(let h=n.length-2;!o&&h>=0;h--)o=n[h];for(let h=0;h<r.length;h++){let c=r[h],u=n;if(s.matchBase&&c.length===1&&(u=[o]),this.matchOne(u,c,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return b.defaults(t).Minimatch}};b.AST=P;b.Minimatch=_;b.escape=at;b.unescape=L;async function*_t(i,t,e={}){let s=q.default.resolve(i),n=q.default.relative(e.cwd??process.cwd(),i);if((await ht.default.stat(s)).isDirectory()){for await(let o of qt(s,"",t,e))yield o;return}b(n,t,e)&&(yield e.absolute===!0?s:n)}async function*qt(i,t,e,s){for await(let n of await ht.default.opendir(q.default.join(i,t))){let r=q.default.join(t,n.name),o=q.default.join(i,t,n.name),h=b(r,e,s),c=n.isDirectory();c&&s.nodir===!0&&(h=!1),h&&(yield s.absolute===!0?o:r),c&&(yield*qt(i,r,e,s))}}return Yt(qe);})();
"use strict";var ItGlob=(()=>{var Et=Object.create;var D=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var Mt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var L=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ot=(i,t)=>{for(var e in t)D(i,e,{get:t[e],enumerable:!0})},Z=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Tt(t))!At.call(i,n)&&n!==e&&D(i,n,{get:()=>t[n],enumerable:!(s=bt(t,n))||s.enumerable});return i};var k=(i,t,e)=>(e=i!=null?Et(Mt(i)):{},Z(t||!i||!i.__esModule?D(e,"default",{value:i,enumerable:!0}):e,i)),Nt=i=>Z(D({},"__esModule",{value:!0}),i);var F=L(()=>{});var H=L(()=>{});var Q=L((Te,K)=>{"use strict";K.exports=V;function V(i,t,e){i instanceof RegExp&&(i=J(i,e)),t instanceof RegExp&&(t=J(t,e));var s=X(i,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+i.length,s[1]),post:e.slice(s[1]+t.length)}}function J(i,t){var e=t.match(i);return e?e[0]:null}V.range=X;function X(i,t,e){var s,n,r,o,h,a=e.indexOf(i),c=e.indexOf(t,a+1),l=a;if(a>=0&&c>0){if(i===t)return[a,c];for(s=[],r=e.length;l>=0&&!h;)l==a?(s.push(l),a=e.indexOf(i,l+1)):s.length==1?h=[s.pop(),c]:(n=s.pop(),n<r&&(r=n,o=c),c=e.indexOf(t,l+1)),l=a<c&&a>=0?a:c;s.length&&(h=[r,o])}return h}});var ot=L((Me,rt)=>{var Y=Q();rt.exports=Rt;var tt="\0SLASH"+Math.random()+"\0",et="\0OPEN"+Math.random()+"\0",G="\0CLOSE"+Math.random()+"\0",st="\0COMMA"+Math.random()+"\0",it="\0PERIOD"+Math.random()+"\0";function z(i){return parseInt(i,10)==i?parseInt(i,10):i.charCodeAt(0)}function $t(i){return i.split("\\\\").join(tt).split("\\{").join(et).split("\\}").join(G).split("\\,").join(st).split("\\.").join(it)}function jt(i){return i.split(tt).join("\\").split(et).join("{").split(G).join("}").split(st).join(",").split(it).join(".")}function nt(i){if(!i)return[""];var t=[],e=Y("{","}",i);if(!e)return i.split(",");var s=e.pre,n=e.body,r=e.post,o=s.split(",");o[o.length-1]+="{"+n+"}";var h=nt(r);return r.length&&(o[o.length-1]+=h.shift(),o.push.apply(o,h)),t.push.apply(t,o),t}function Rt(i){return i?(i.substr(0,2)==="{}"&&(i="\\{\\}"+i.substr(2)),R($t(i),!0).map(jt)):[]}function Ct(i){return"{"+i+"}"}function Wt(i){return/^-?0\d/.test(i)}function Dt(i,t){return i<=t}function Lt(i,t){return i>=t}function R(i,t){var e=[],s=Y("{","}",i);if(!s)return[i];var n=s.pre,r=s.post.length?R(s.post,!1):[""];if(/\$$/.test(s.pre))for(var o=0;o<r.length;o++){var h=n+"{"+s.body+"}"+r[o];e.push(h)}else{var a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),l=a||c,g=s.body.indexOf(",")>=0;if(!l&&!g)return s.post.match(/,.*\}/)?(i=s.pre+"{"+s.body+G+s.post,R(i)):[i];var u;if(l)u=s.body.split(/\.\./);else if(u=nt(s.body),u.length===1&&(u=R(u[0],!1).map(Ct),u.length===1))return r.map(function(St){return s.pre+u[0]+St});var f;if(l){var d=z(u[0]),p=z(u[1]),w=Math.max(u[0].length,u[1].length),S=u.length==3?Math.abs(z(u[2])):1,O=Dt,E=p<d;E&&(S*=-1,O=Lt);var b=u.some(Wt);f=[];for(var T=d;O(T,p);T+=S){var y;if(c)y=String.fromCharCode(T),y==="\\"&&(y="");else if(y=String(T),b){var q=w-y.length;if(q>0){var U=new Array(q+1).join("0");T<0?y="-"+U+y.slice(1):y=U+y}}f.push(y)}}else{f=[];for(var A=0;A<u.length;A++)f.push.apply(f,R(u[A],!1))}for(var A=0;A<f.length;A++)for(var o=0;o<r.length;o++){var h=n+f[A]+r[o];(!t||l||h)&&e.push(h)}}return e}});var ye={};Ot(ye,{default:()=>xt});var _=k(F(),1),j=k(H(),1);var gt=k(ot(),1);var C=i=>{if(typeof i!="string")throw new TypeError("invalid pattern");if(i.length>65536)throw new TypeError("pattern is too long")};var Pt={"[: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]},W=i=>i.replace(/[[\]\\-]/g,"\\$&"),kt=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ht=i=>i.join(""),at=(i,t)=>{let e=t;if(i.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],n=[],r=e+1,o=!1,h=!1,a=!1,c=!1,l=e,g="";t:for(;r<i.length;){let p=i.charAt(r);if((p==="!"||p==="^")&&r===e+1){c=!0,r++;continue}if(p==="]"&&o&&!a){l=r+1;break}if(o=!0,p==="\\"&&!a){a=!0,r++;continue}if(p==="["&&!a){for(let[w,[S,O,E]]of Object.entries(Pt))if(i.startsWith(w,r)){if(g)return["$.",!1,i.length-e,!0];r+=w.length,E?n.push(S):s.push(S),h=h||O;continue t}}if(a=!1,g){p>g?s.push(W(g)+"-"+W(p)):p===g&&s.push(W(p)),g="",r++;continue}if(i.startsWith("-]",r+1)){s.push(W(p+"-")),r+=2;continue}if(i.startsWith("-",r+1)){g=p,r+=2;continue}s.push(W(p)),r++}if(l<r)return["",!1,0,!1];if(!s.length&&!n.length)return["$.",!1,i.length-e,!0];if(n.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let p=s[0].length===2?s[0].slice(-1):s[0];return[kt(p),!1,l-e,!1]}let u="["+(c?"^":"")+ht(s)+"]",f="["+(c?"":"^")+ht(n)+"]";return[s.length&&n.length?"("+u+"|"+f+")":s.length?u:f,h,l-e,!0]};var M=(i,{windowsPathsNoEscape:t=!1}={})=>t?i.replace(/\[([^\/\\])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var zt=new Set(["!","?","+","*","@"]),ct=i=>zt.has(i),Gt="(?!(?:^|/)\\.\\.?(?:$|/))",P="(?!\\.)",It=new Set(["[","."]),Bt=new Set(["..","."]),_t=new Set("().*{}+?[]^$\\!"),qt=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),I="[^/]",lt=I+"*?",ut=I+"+?",N=class i{type;#s;#i;#n=!1;#t=[];#e;#o;#a;#h=!1;#r;#c;#u=!1;constructor(t,e,s={}){this.type=t,t&&(this.#i=!0),this.#e=e,this.#s=this.#e?this.#e.#s:this,this.#r=this.#s===this?s:this.#s.#r,this.#a=this.#s===this?[]:this.#s.#a,t==="!"&&!this.#s.#h&&this.#a.push(this),this.#o=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#c=this.#t.map(t=>String(t)).join("")}#p(){if(this!==this.#s)throw new Error("should only call on root");if(this.#h)return this;this.toString(),this.#h=!0;let t;for(;t=this.#a.pop();){if(t.type!=="!")continue;let e=t,s=e.#e;for(;s;){for(let n=e.#o+1;!s.type&&n<s.#t.length;n++)for(let r of t.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#t[n])}e=s,s=e.#e}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof i&&e.#e===this))throw new Error("invalid part: "+e);this.#t.push(e)}}toJSON(){let t=this.type===null?this.#t.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#t.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#s||this.#s.#h&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#s===this)return!0;if(!this.#e?.isStart())return!1;if(this.#o===0)return!0;let t=this.#e;for(let e=0;e<this.#o;e++){let s=t.#t[e];if(!(s instanceof i&&s.type==="!"))return!1}return!0}isEnd(){if(this.#s===this||this.#e?.type==="!")return!0;if(!this.#e?.isEnd())return!1;if(!this.type)return this.#e?.isEnd();let t=this.#e?this.#e.#t.length:0;return this.#o===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new i(this.type,t);for(let s of this.#t)e.copyIn(s);return e}static#l(t,e,s,n){let r=!1,o=!1,h=-1,a=!1;if(e.type===null){let f=s,d="";for(;f<t.length;){let p=t.charAt(f++);if(r||p==="\\"){r=!r,d+=p;continue}if(o){f===h+1?(p==="^"||p==="!")&&(a=!0):p==="]"&&!(f===h+2&&a)&&(o=!1),d+=p;continue}else if(p==="["){o=!0,h=f,a=!1,d+=p;continue}if(!n.noext&&ct(p)&&t.charAt(f)==="("){e.push(d),d="";let w=new i(p,e);f=i.#l(t,w,f,n),e.push(w);continue}d+=p}return e.push(d),f}let c=s+1,l=new i(null,e),g=[],u="";for(;c<t.length;){let f=t.charAt(c++);if(r||f==="\\"){r=!r,u+=f;continue}if(o){c===h+1?(f==="^"||f==="!")&&(a=!0):f==="]"&&!(c===h+2&&a)&&(o=!1),u+=f;continue}else if(f==="["){o=!0,h=c,a=!1,u+=f;continue}if(ct(f)&&t.charAt(c)==="("){l.push(u),u="";let d=new i(f,l);l.push(d),c=i.#l(t,d,c,n);continue}if(f==="|"){l.push(u),u="",g.push(l),l=new i(null,e);continue}if(f===")")return u===""&&e.#t.length===0&&(e.#u=!0),l.push(u),u="",e.push(...g,l),c;u+=f}return e.type=null,e.#i=void 0,e.#t=[t.substring(s-1)],c}static fromGlob(t,e={}){let s=new i(null,void 0,e);return i.#l(t,s,0,e),s}toMMPattern(){if(this!==this.#s)return this.#s.toMMPattern();let t=this.toString(),[e,s,n,r]=this.toRegExpSource();if(!(n||this.#i||this.#r.nocase&&!this.#r.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let h=(this.#r.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,h),{_src:e,_glob:t})}toRegExpSource(t){let e=t??!!this.#r.dot;if(this.#s===this&&this.#p(),!this.type){let a=this.isStart()&&this.isEnd(),c=this.#t.map(f=>{let[d,p,w,S]=typeof f=="string"?i.#g(f,this.#i,a):f.toRegExpSource(t);return this.#i=this.#i||w,this.#n=this.#n||S,d}).join(""),l="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Bt.has(this.#t[0]))){let d=It,p=e&&d.has(c.charAt(0))||c.startsWith("\\.")&&d.has(c.charAt(2))||c.startsWith("\\.\\.")&&d.has(c.charAt(4)),w=!e&&!t&&d.has(c.charAt(0));l=p?Gt:w?P:""}let g="";return this.isEnd()&&this.#s.#h&&this.#e?.type==="!"&&(g="(?:$|\\/)"),[l+c+g,M(c),this.#i=!!this.#i,this.#n]}let s=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#f(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let a=this.toString();return this.#t=[a],this.type=null,this.#i=void 0,[a,M(this.toString()),!1,!1]}let o=!s||t||e||!P?"":this.#f(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let h="";if(this.type==="!"&&this.#u)h=(this.isStart()&&!e?P:"")+ut;else{let a=this.type==="!"?"))"+(this.isStart()&&!e&&!t?P:"")+lt+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;h=n+r+a}return[h,M(r),this.#i=!!this.#i,this.#n]}#f(t){return this.#t.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,n,r,o]=e.toRegExpSource(t);return this.#n=this.#n||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#g(t,e,s=!1){let n=!1,r="",o=!1;for(let h=0;h<t.length;h++){let a=t.charAt(h);if(n){n=!1,r+=(_t.has(a)?"\\":"")+a;continue}if(a==="\\"){h===t.length-1?r+="\\\\":n=!0;continue}if(a==="["){let[c,l,g,u]=at(t,h);if(g){r+=c,o=o||l,h+=g-1,e=e||u;continue}}if(a==="*"){s&&t==="*"?r+=ut:r+=lt,e=!0;continue}if(a==="?"){r+=I,e=!0;continue}r+=qt(a)}return[r,M(t),!!e,o]}};var B=(i,{windowsPathsNoEscape:t=!1}={})=>t?i.replace(/[?*()[\]]/g,"[$&]"):i.replace(/[?*()[\]\\]/g,"\\$&");var m=(i,t,e={})=>(C(t),!e.nocomment&&t.charAt(0)==="#"?!1:new $(t,e).match(i)),Ut=/^\*+([^+@!?\*\[\(]*)$/,Zt=i=>t=>!t.startsWith(".")&&t.endsWith(i),Ft=i=>t=>t.endsWith(i),Ht=i=>(i=i.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(i)),Jt=i=>(i=i.toLowerCase(),t=>t.toLowerCase().endsWith(i)),Vt=/^\*+\.\*+$/,Xt=i=>!i.startsWith(".")&&i.includes("."),Kt=i=>i!=="."&&i!==".."&&i.includes("."),Qt=/^\.\*+$/,Yt=i=>i!=="."&&i!==".."&&i.startsWith("."),te=/^\*+$/,ee=i=>i.length!==0&&!i.startsWith("."),se=i=>i.length!==0&&i!=="."&&i!=="..",ie=/^\?+([^+@!?\*\[\(]*)?$/,ne=([i,t=""])=>{let e=dt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},re=([i,t=""])=>{let e=mt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},oe=([i,t=""])=>{let e=mt([i]);return t?s=>e(s)&&s.endsWith(t):e},he=([i,t=""])=>{let e=dt([i]);return t?s=>e(s)&&s.endsWith(t):e},dt=([i])=>{let t=i.length;return e=>e.length===t&&!e.startsWith(".")},mt=([i])=>{let t=i.length;return e=>e.length===t&&e!=="."&&e!==".."},wt=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ft={win32:{sep:"\\"},posix:{sep:"/"}},ae=wt==="win32"?ft.win32.sep:ft.posix.sep;m.sep=ae;var v=Symbol("globstar **");m.GLOBSTAR=v;var ce="[^/]",le=ce+"*?",ue="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",fe="(?:(?!(?:\\/|^)\\.).)*?",pe=(i,t={})=>e=>m(e,i,t);m.filter=pe;var x=(i,t={})=>Object.assign({},i,t),ge=i=>{if(!i||typeof i!="object"||!Object.keys(i).length)return m;let t=m;return Object.assign((s,n,r={})=>t(s,n,x(i,r)),{Minimatch:class extends t.Minimatch{constructor(n,r={}){super(n,x(i,r))}static defaults(n){return t.defaults(x(i,n)).Minimatch}},AST:class extends t.AST{constructor(n,r,o={}){super(n,r,x(i,o))}static fromGlob(n,r={}){return t.AST.fromGlob(n,x(i,r))}},unescape:(s,n={})=>t.unescape(s,x(i,n)),escape:(s,n={})=>t.escape(s,x(i,n)),filter:(s,n={})=>t.filter(s,x(i,n)),defaults:s=>t.defaults(x(i,s)),makeRe:(s,n={})=>t.makeRe(s,x(i,n)),braceExpand:(s,n={})=>t.braceExpand(s,x(i,n)),match:(s,n,r={})=>t.match(s,n,x(i,r)),sep:t.sep,GLOBSTAR:v})};m.defaults=ge;var yt=(i,t={})=>(C(i),t.nobrace||!/\{(?:(?!\{).)*\}/.test(i)?[i]:(0,gt.default)(i));m.braceExpand=yt;var de=(i,t={})=>new $(i,t).makeRe();m.makeRe=de;var me=(i,t,e={})=>{let s=new $(t,e);return i=i.filter(n=>s.match(n)),s.options.nonull&&!i.length&&i.push(t),i};m.match=me;var pt=/[?*]|[+@!]\(.*?\)|\[|\]/,we=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){C(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||wt,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let n=this.globParts.map((r,o,h)=>{if(this.isWindows&&this.windowsNoMagicRoot){let a=r[0]===""&&r[1]===""&&(r[2]==="?"||!pt.test(r[2]))&&!pt.test(r[3]),c=/^[a-z]:/i.test(r[0]);if(a)return[...r.slice(0,4),...r.slice(4).map(l=>this.parse(l))];if(c)return[r[0],...r.slice(1).map(l=>this.parse(l))]}return r.map(a=>this.parse(a))});if(this.debug(this.pattern,n),this.set=n.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let n=0;n<t[s].length;n++)t[s][n]==="**"&&(t[s][n]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let n=s;for(;e[n+1]==="**";)n++;n!==s&&e.splice(s,n-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,n)=>{let r=s[s.length-1];return n==="**"&&r==="**"?s:n===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(n),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;n<t.length-1;n++){let r=t[n];n===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(n,1),n--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let n=t[s-1];n&&n!=="."&&n!==".."&&n!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let n=-1;for(;(n=s.indexOf("**",n+1))!==-1;){let o=n;for(;s[o+1]==="**";)o++;o>n&&s.splice(n+1,o-n);let h=s[n+1],a=s[n+2],c=s[n+3];if(h!==".."||!a||a==="."||a===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(n,1);let l=s.slice(0);l[n]="**",t.push(l),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let h=s[o];o===1&&h===""&&s[0]===""||(h==="."||h==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let a=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...a),s.length===0&&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++){let n=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);n&&(t[e]=n,t[s]=[])}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let n=0,r=0,o=[],h="";for(;n<t.length&&r<e.length;)if(t[n]===e[r])o.push(h==="b"?e[r]:t[n]),n++,r++;else if(s&&t[n]==="**"&&e[r]===t[n+1])o.push(t[n]),n++;else if(s&&e[r]==="**"&&t[n]===e[r+1])o.push(e[r]),r++;else if(t[n]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(h==="b")return!1;h="a",o.push(t[n]),n++,r++}else if(e[r]==="*"&&t[n]&&(this.options.dot||!t[n].startsWith("."))&&t[n]!=="**"){if(h==="a")return!1;h="b",o.push(e[r]),n++,r++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let n=0;n<t.length&&t.charAt(n)==="!";n++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let n=this.options;if(this.isWindows){let p=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),w=!p&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),S=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),O=!S&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),E=w?3:p?0:void 0,b=O?3:S?0:void 0;if(typeof E=="number"&&typeof b=="number"){let[T,y]=[t[E],e[b]];T.toLowerCase()===y.toLowerCase()&&(e[b]=T,b>E?e=e.slice(b):E>b&&(t=t.slice(E)))}}let{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 o=0,h=0,a=t.length,c=e.length;o<a&&h<c;o++,h++){this.debug("matchOne loop");var l=e[h],g=t[o];if(this.debug(e,l,g),l===!1)return!1;if(l===v){this.debug("GLOBSTAR",[e,l,g]);var u=o,f=h+1;if(f===c){for(this.debug("** at the end");o<a;o++)if(t[o]==="."||t[o]===".."||!n.dot&&t[o].charAt(0)===".")return!1;return!0}for(;u<a;){var d=t[u];if(this.debug(`
globstar while`,t,u,e,f,d),this.matchOne(t.slice(u),e.slice(f),s))return this.debug("globstar found match!",u,a,d),!0;if(d==="."||d===".."||!n.dot&&d.charAt(0)==="."){this.debug("dot detected!",t,u,e,f);break}this.debug("globstar swallow a segment, and continue"),u++}return!!(s&&(this.debug(`
>>> no match, partial?`,t,u,e,f),u===a))}let p;if(typeof l=="string"?(p=g===l,this.debug("string match",l,g,p)):(p=l.test(g),this.debug("pattern match",l,g,p)),!p)return!1}if(o===a&&h===c)return!0;if(o===a)return s;if(h===c)return o===a-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return yt(this.pattern,this.options)}parse(t){C(t);let e=this.options;if(t==="**")return v;if(t==="")return"";let s,n=null;(s=t.match(te))?n=e.dot?se:ee:(s=t.match(Ut))?n=(e.nocase?e.dot?Jt:Ht:e.dot?Ft:Zt)(s[1]):(s=t.match(ie))?n=(e.nocase?e.dot?re:ne:e.dot?oe:he)(s):(s=t.match(Vt))?n=e.dot?Kt:Xt:(s=t.match(Qt))&&(n=Yt);let r=N.fromGlob(t,this.options).toMMPattern();return n?Object.assign(r,{test:n}):r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?le:e.dot?ue:fe,n=new Set(e.nocase?["i"]:[]),r=t.map(a=>{let c=a.map(l=>{if(l instanceof RegExp)for(let g of l.flags.split(""))n.add(g);return typeof l=="string"?we(l):l===v?v:l._src});return c.forEach((l,g)=>{let u=c[g+1],f=c[g-1];l!==v||f===v||(f===void 0?u!==void 0&&u!==v?c[g+1]="(?:\\/|"+s+"\\/)?"+u:c[g]=s:u===void 0?c[g-1]=f+"(?:\\/|"+s+")?":u!==v&&(c[g-1]=f+"(?:\\/|\\/"+s+"\\/)"+u,c[g+1]=v))}),c.filter(l=>l!==v).join("/")}).join("|"),[o,h]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+h+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...n].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let n=this.slashSplit(t);this.debug(this.pattern,"split",n);let r=this.set;this.debug(this.pattern,"set",r);let o=n[n.length-1];if(!o)for(let h=n.length-2;!o&&h>=0;h--)o=n[h];for(let h=0;h<r.length;h++){let a=r[h],c=n;if(s.matchBase&&a.length===1&&(c=[o]),this.matchOne(c,a,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return m.defaults(t).Minimatch}};m.AST=N;m.Minimatch=$;m.escape=B;m.unescape=M;async function*xt(i,t,e={}){let s=j.default.resolve(i),n=j.default.relative(e.cwd??process.cwd(),i);if((await _.default.stat(s)).isDirectory()){for await(let o of vt(s,"",t,e))yield o;return}m(n,t,e)&&(yield e.absolute===!0?s:n)}async function*vt(i,t,e,s){for await(let n of await _.default.opendir(j.default.join(i,t))){let r=j.default.join(t,n.name),o=j.default.join(i,t,n.name),h=m(r,e,s),a=n.isDirectory();a&&s.nodir===!0&&(h=!1),h&&(yield s.absolute===!0?o:r),a&&(yield*vt(i,r,e,s))}}return Nt(ye);})();
return ItGlob}));
{
"name": "it-glob",
"version": "2.0.4",
"version": "2.0.5",
"description": "Async iterable filename pattern matcher",

@@ -15,6 +15,2 @@ "author": "Alex Potsides <alex@achingbrain.net>",

},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"type": "module",

@@ -137,3 +133,3 @@ "types": "./dist/src/index.d.ts",

"devDependencies": {
"aegir": "^39.0.2",
"aegir": "^40.0.11",
"it-all": "^3.0.0"

@@ -140,0 +136,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc