var p={isMatch:(n,e)=>{let r=c(n);return e.some(t=>d(r,c(t)))}},m=async n=>{if(n==="micromatch"){let e;try{e=await import("micromatch")}catch{throw new Error("micromatch is not installed. Please add it as a dependency if you want to use it.")}return{isMatch:(r,t)=>{try{return e.isMatch(c(r),t.map(c))}catch(i){throw new Error(`micromatch failed to run isMatch: ${i.message}`)}}}}if(n==="picomatch"){let e;try{e=(await import("picomatch")).default}catch{throw new Error("picomatch is not installed. Please add it as a dependency if you want to use it.")}return{isMatch:(r,t)=>{try{return e(t.map(c))(c(r))}catch(i){throw new Error(`picomatch failed to run isMatch: ${i.message}`)}}}}throw new Error(`Unknown matcher name: ${n}`)},c=n=>{let e="",r=!1;for(let t of n)r?(e+=t,r=!1):t==="\\"?(r=!0,e+="\\"):t==="."?e+="/":e+=t;return e},u=n=>{let e=n.startsWith("!"),r=e?n.slice(1):n,t=[],i="",s=!1;for(let a of r)s?(i+="\\"+a,s=!1):a==="\\"?s=!0:a==="/"?(t.push(i),i=""):i+=a;return s&&(i+="\\"),t.push(i),e&&(t.negated=!0),t},d=(n,e)=>{let r=n.split("/"),t=u(e),i=t.negated===!0,s=h(r,t);return i?!s:s},h=(n,e)=>{let r=0,t=0;for(;r<n.length&&t<e.length;){let i=e[t];if(i==="**"){if(t===e.length-1)return!0;for(let s=0;r+s<=n.length;s++)if(h(n.slice(r+s),e.slice(t+1)))return!0;return!1}if(!g(n[r],i))return!1;r++,t++}for(;t<e.length&&e[t]==="**";)t++;return r===n.length&&t===e.length},g=(n,e)=>{let r=!1,t=!1,i="",s="";for(let o=0;o<e.length;o++){let l=e[o];if(r){s+=l,r=!1;continue}if(l==="\\"){r=!0;continue}if(l==="*"){if(!t){t=!0,i=s,s="";continue}s+="*";continue}s+=l}if(r&&(s+="\\"),!t){let o=s.replace(/\\(.)/g,"$1");return n===o}let a=s.replace(/\\(.)/g,"$1"),f=i.replace(/\\(.)/g,"$1");return n.startsWith(f)&&n.endsWith(a)};export{p as a,m as b};
