var t,e;function r(){if(e)return t;function r(t){return Array.isArray(t)?t:[t]}e=1;const s=/^\s+$/,n=/(?:[^\\]|^)\\$/,i=/^\\!/,o=/^\\#/,a=/\r?\n/g,h=/^\.*\/|^\.+$/;let c="node-ignore";"undefined"!=typeof Symbol&&(c=Symbol.for("node-ignore"));const l=c,u=/([0-z])-([0-z])/g,d=()=>!1,g=[[/^\uFEFF/,()=>""],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(0===r.indexOf("\\")?" ":"")],[/(\\+?)\s/g,(t,e)=>{const{length:r}=e;return e.slice(0,r-r%2)+" "}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>e+r.replace(/\\\*/g,"[^\\/]*")],[/\\\\\\(?=[$.|*+(){^])/g,()=>"\\"],[/\\\\/g,()=>"\\"],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,s,n)=>"\\"===e?`\\[${r}${(t=>{const{length:e}=t;return t.slice(0,e-e%2)})(s)}${n}`:"]"===n&&s.length%2==0?`[${(t=>t.replace(u,(t,e,r)=>e.charCodeAt(0)<=r.charCodeAt(0)?t:""))(r)}${s}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],_=Object.create(null),p=t=>"string"==typeof t;class ${constructor(t,e,r,s){this.origin=t,this.pattern=e,this.negative=r,this.regex=s}}const f=(t,e)=>{const r=t;let s=!1;0===t.indexOf("!")&&(s=!0,t=t.substr(1));const n=((t,e)=>{let r=_[t];return r||(r=g.reduce((e,[r,s])=>e.replace(r,s.bind(t)),t),_[t]=r),e?new RegExp(r,"i"):new RegExp(r)})(t=t.replace(i,"!").replace(o,"#"),e);return new $(r,t,s,n)},v=(t,e)=>{throw new e(t)},b=(t,e,r)=>{if(!p(t))return r(`path must be a string, but got \`${e}\``,TypeError);if(!t)return r("path must not be empty",TypeError);if(b.isNotRelative(t)){return r(`path should be a ${"`path.relative()`d"} string, but got "${e}"`,RangeError)}return!0},C=t=>h.test(t);b.isNotRelative=C,b.convert=t=>t;class y{constructor({ignorecase:t=!0,ignoreCase:e=t,allowRelativePaths:r=!1}={}){var s,n,i;s=this,n=l,i=!0,Object.defineProperty(s,n,{value:i}),this._rules=[],this._ignoreCase=e,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[l])return this._rules=this._rules.concat(t._rules),void(this._added=!0);if((t=>t&&p(t)&&!s.test(t)&&!n.test(t)&&0!==t.indexOf("#"))(t)){const e=f(t,this._ignoreCase);this._added=!0,this._rules.push(e)}}add(t){return this._added=!1,r(p(t)?(t=>t.split(a))(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,e){let r=!1,s=!1;return this._rules.forEach(n=>{const{negative:i}=n;if(s===i&&r!==s||i&&!r&&!s&&!e)return;n.regex.test(t)&&(r=!i,s=i)}),{ignored:r,unignored:s}}_test(t,e,r,s){const n=t&&b.convert(t);return b(n,t,this._allowRelativePaths?d:v),this._t(n,e,r,s)}_t(t,e,r,s){if(t in e)return e[t];if(s||(s=t.split("/")),s.pop(),!s.length)return e[t]=this._testOne(t,r);const n=this._t(s.join("/")+"/",e,r,s);return e[t]=n.ignored?n:this._testOne(t,r)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return r(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}}const O=t=>new y(t);if(O.isPathValid=t=>b(t&&b.convert(t),t,d),O.default=O,t=O,"undefined"!=typeof process&&(process.env&&process.env.IGNORE_TEST_WIN32||"win32"===process.platform)){const t=t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/");b.convert=t;const e=/^[a-z]:\//i;b.isNotRelative=t=>e.test(t)||C(t)}return t}export{r as __require};