@onoxm/vite-plugin-auto-router 0.1.1 → 0.1.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.
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- import t from"node:path";import e from"node:fs";import n from"os";import r from"path";import o from"util";import s from"stream";import i from"events";import a from"fs";function u(t){let e=0;for(;e<t.length&&/\s/.test(t[e]);)e++;if(e<t.length&&"("===t[e])return t;const n=t.indexOf("(");if(-1===n)return t;const r=t.indexOf(")",n);if(-1===r)return t;return t.slice(n,r+1)+" => "+t.slice(r+1)}const c=n=>e.existsSync(t.resolve(n,"tsconfig.json")),l={react:{ts:"src/router/autoRouter.tsx",js:"src/router/autoRouter.jsx"},vue:{ts:"src/router/autoRouter.ts",js:"src/router/autoRouter.js"}},p=(e,n,r)=>{let o=r;return o||(o=t.resolve(n,l[e][c(n)?"ts":"js"])),o};var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var d,g={},m={},y={};function _(){if(d)return y;return d=1,Object.defineProperty(y,"__esModule",{value:!0}),y.splitWhen=y.flatten=void 0,y.flatten=function(t){return t.reduce((t,e)=>[].concat(t,e),[])},y.splitWhen=function(t,e){const n=[[]];let r=0;for(const o of t)e(o)?(r++,n[r]=[]):n[r].push(o);return n},y}var R,b={};function S(){if(R)return b;return R=1,Object.defineProperty(b,"__esModule",{value:!0}),b.isEnoentCodeError=void 0,b.isEnoentCodeError=function(t){return"ENOENT"===t.code},b}var P,v={};var E,A={};function x(){if(E)return A;E=1,Object.defineProperty(A,"__esModule",{value:!0}),A.convertPosixPathToPattern=A.convertWindowsPathToPattern=A.convertPathToPattern=A.escapePosixPath=A.escapeWindowsPath=A.escape=A.removeLeadingDotSegment=A.makeAbsolute=A.unixify=void 0;const t=r,e="win32"===n.platform(),o=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,s=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,i=/^\\\\([.?])/,a=/\\(?![!()+@[\]{}])/g;function u(t){return t.replace(s,"\\$2")}function c(t){return t.replace(o,"\\$2")}function l(t){return u(t).replace(i,"//$1").replace(a,"/")}function p(t){return c(t)}return A.unixify=function(t){return t.replace(/\\/g,"/")},A.makeAbsolute=function(e,n){return t.resolve(e,n)},A.removeLeadingDotSegment=function(t){if("."===t.charAt(0)){const e=t.charAt(1);if("/"===e||"\\"===e)return t.slice(2)}return t},A.escape=e?u:c,A.escapeWindowsPath=u,A.escapePosixPath=c,A.convertPathToPattern=e?l:p,A.convertWindowsPathToPattern=l,A.convertPosixPathToPattern=p,A}var C,O,w,$,T,k,M={};function L(){return O?C:(O=1,C=function(t){if("string"!=typeof t||""===t)return!1;for(var e;e=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(e[2])return!0;t=t.slice(e.index+e[0].length)}return!1})}function j(){if($)return w;$=1;var t=L(),e={"{":"}","(":")","[":"]"},n=function(t){if("!"===t[0])return!0;for(var n=0,r=-2,o=-2,s=-2,i=-2,a=-2;n<t.length;){if("*"===t[n])return!0;if("?"===t[n+1]&&/[\].+)]/.test(t[n]))return!0;if(-1!==o&&"["===t[n]&&"]"!==t[n+1]&&(o<n&&(o=t.indexOf("]",n)),o>n)){if(-1===a||a>o)return!0;if(-1===(a=t.indexOf("\\",n))||a>o)return!0}if(-1!==s&&"{"===t[n]&&"}"!==t[n+1]&&(s=t.indexOf("}",n))>n&&(-1===(a=t.indexOf("\\",n))||a>s))return!0;if(-1!==i&&"("===t[n]&&"?"===t[n+1]&&/[:!=]/.test(t[n+2])&&")"!==t[n+3]&&(i=t.indexOf(")",n))>n&&(-1===(a=t.indexOf("\\",n))||a>i))return!0;if(-1!==r&&"("===t[n]&&"|"!==t[n+1]&&(r<n&&(r=t.indexOf("|",n)),-1!==r&&")"!==t[r+1]&&(i=t.indexOf(")",r))>r&&(-1===(a=t.indexOf("\\",r))||a>i)))return!0;if("\\"===t[n]){var u=t[n+1];n+=2;var c=e[u];if(c){var l=t.indexOf(c,n);-1!==l&&(n=l+1)}if("!"===t[n])return!0}else n++}return!1},r=function(t){if("!"===t[0])return!0;for(var n=0;n<t.length;){if(/[*?{}()[\]]/.test(t[n]))return!0;if("\\"===t[n]){var r=t[n+1];n+=2;var o=e[r];if(o){var s=t.indexOf(o,n);-1!==s&&(n=s+1)}if("!"===t[n])return!0}else n++}return!1};return w=function(e,o){if("string"!=typeof e||""===e)return!1;if(t(e))return!0;var s=n;return o&&!1===o.strict&&(s=r),s(e)}}function H(){if(k)return T;k=1;var t=j(),e=r.posix.dirname,o="win32"===n.platform(),s=/\\/g,i=/[\{\[].*[\}\]]$/,a=/(^|[^\\])([\{\[]|\([^\)]+$)/,u=/\\([\!\*\?\|\[\]\(\)\{\}])/g;return T=function(n,r){Object.assign({flipBackslashes:!0},r).flipBackslashes&&o&&n.indexOf("/")<0&&(n=n.replace(s,"/")),i.test(n)&&(n+="/"),n+="a";do{n=e(n)}while(t(n)||a.test(n));return n.replace(u,"$1")}}var F,D,N,I,B,W,G,U,K,V,Q,q,z,X,Y,Z,J,tt,et,nt={};function rt(){return F||(F=1,(t=nt).isInteger=t=>"number"==typeof t?Number.isInteger(t):"string"==typeof t&&""!==t.trim()&&Number.isInteger(Number(t)),t.find=(t,e)=>t.nodes.find(t=>t.type===e),t.exceedsLimit=(e,n,r=1,o)=>!1!==o&&!(!t.isInteger(e)||!t.isInteger(n))&&(Number(n)-Number(e))/Number(r)>=o,t.escapeNode=(t,e=0,n)=>{const r=t.nodes[e];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},t.encloseBrace=t=>!("brace"!==t.type||t.commas>>0+t.ranges|0||(t.invalid=!0,0)),t.isInvalidBrace=t=>!("brace"!==t.type||!0!==t.invalid&&!t.dollar&&(t.commas>>0+t.ranges|0&&!0===t.open&&!0===t.close||(t.invalid=!0,0))),t.isOpenOrClose=t=>"open"===t.type||"close"===t.type||!0===t.open||!0===t.close,t.reduce=t=>t.reduce((t,e)=>("text"===e.type&&t.push(e.value),"range"===e.type&&(e.type="text"),t),[]),t.flatten=(...t)=>{const e=[],n=t=>{for(let r=0;r<t.length;r++){const o=t[r];Array.isArray(o)?n(o):void 0!==o&&e.push(o)}return e};return n(t),e}),nt;var t}function ot(){if(N)return D;N=1;const t=rt();return D=(e,n={})=>{const r=(e,o={})=>{const s=n.escapeInvalid&&t.isInvalidBrace(o),i=!0===e.invalid&&!0===n.escapeInvalid;let a="";if(e.value)return(s||i)&&t.isOpenOrClose(e)?"\\"+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(const t of e.nodes)a+=r(t);return a};return r(e)}}function st(){return B?I:(B=1,I=function(t){return"number"==typeof t?t-t===0:"string"==typeof t&&""!==t.trim()&&(Number.isFinite?Number.isFinite(+t):isFinite(+t))})}function it(){if(G)return W;G=1;const t=st(),e=(n,s,i)=>{if(!1===t(n))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||n===s)return String(n);if(!1===t(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let a={relaxZeros:!0,...i};"boolean"==typeof a.strictZeros&&(a.relaxZeros=!1===a.strictZeros);let u=n+":"+s+"="+String(a.relaxZeros)+String(a.shorthand)+String(a.capture)+String(a.wrap);if(e.cache.hasOwnProperty(u))return e.cache[u].result;let c=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(c-l)){let t=n+"|"+s;return a.capture?`(${t})`:!1===a.wrap?t:`(?:${t})`}let h=p(n)||p(s),f={min:n,max:s,a:c,b:l},d=[],g=[];if(h&&(f.isPadded=h,f.maxLen=String(f.max).length),c<0){g=r(l<0?Math.abs(l):1,Math.abs(c),f,a),c=f.a=0}return l>=0&&(d=r(c,l,f,a)),f.negatives=g,f.positives=d,f.result=function(t,e){let n=o(t,e,"-",!1)||[],r=o(e,t,"",!1)||[],s=o(t,e,"-?",!0)||[];return n.concat(s).concat(r).join("|")}(g,d),!0===a.capture?f.result=`(${f.result})`:!1!==a.wrap&&d.length+g.length>1&&(f.result=`(?:${f.result})`),e.cache[u]=f,f.result};function n(t,e,n){if(t===e)return{pattern:t,count:[],digits:0};let r=function(t,e){let n=[];for(let r=0;r<t.length;r++)n.push([t[r],e[r]]);return n}(t,e),o=r.length,s="",i=0;for(let t=0;t<o;t++){let[e,n]=r[t];e===n?s+=e:"0"!==e||"9"!==n?s+=l(e,n):i++}return i&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[i],digits:o}}function r(t,e,r,o){let i,l=function(t,e){let n=1,r=1,o=a(t,n),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),n+=1,o=a(t,n);for(o=u(e+1,r)-1;t<o&&o<=e;)i.add(o),r+=1,o=u(e+1,r)-1;return i=[...i],i.sort(s),i}(t,e),p=[],f=t;for(let t=0;t<l.length;t++){let e=l[t],s=n(String(f),String(e),o),a="";r.isPadded||!i||i.pattern!==s.pattern?(r.isPadded&&(a=h(e,r,o)),s.string=a+s.pattern+c(s.count),p.push(s),f=e+1,i=s):(i.count.length>1&&i.count.pop(),i.count.push(s.count[0]),i.string=i.pattern+c(i.count),f=e+1)}return p}function o(t,e,n,r,o){let s=[];for(let o of t){let{string:t}=o;r||i(e,"string",t)||s.push(n+t),r&&i(e,"string",t)&&s.push(n+t)}return s}function s(t,e){return t>e?1:e>t?-1:0}function i(t,e,n){return t.some(t=>t[e]===n)}function a(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function u(t,e){return t-t%Math.pow(10,e)}function c(t){let[e=0,n=""]=t;return n||e>1?`{${e+(n?","+n:"")}}`:""}function l(t,e,n){return`[${t}${e-t===1?"":"-"}${e}]`}function p(t){return/^-?(0+)\d/.test(t)}function h(t,e,n){if(!e.isPadded)return t;let r=Math.abs(e.maxLen-String(t).length),o=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}return e.cache={},e.clearCache=()=>e.cache={},W=e}function at(){if(K)return U;K=1;const t=o,e=it(),n=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),r=t=>"number"==typeof t||"string"==typeof t&&""!==t,s=t=>Number.isInteger(+t),i=t=>{let e=`${t}`,n=-1;if("-"===e[0]&&(e=e.slice(1)),"0"===e)return!1;for(;"0"===e[++n];);return n>0},a=(t,e,n)=>{if(e>0){let n="-"===t[0]?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return!1===n?String(t):t},u=(t,e)=>{let n="-"===t[0]?"-":"";for(n&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return n?"-"+t:t},c=(t,n,r,o)=>{if(r)return e(t,n,{wrap:!1,...o});let s=String.fromCharCode(t);return t===n?s:`[${s}-${String.fromCharCode(n)}]`},l=(t,n,r)=>{if(Array.isArray(t)){let e=!0===r.wrap,n=r.capture?"":"?:";return e?`(${n}${t.join("|")})`:t.join("|")}return e(t,n,r)},p=(...e)=>new RangeError("Invalid range arguments: "+t.inspect(...e)),h=(t,e,n)=>{if(!0===n.strictRanges)throw p([t,e]);return[]},f=(t,e,n=1,r={})=>{let o=Number(t),s=Number(e);if(!Number.isInteger(o)||!Number.isInteger(s)){if(!0===r.strictRanges)throw p([t,e]);return[]}0===o&&(o=0),0===s&&(s=0);let h=o>s,f=String(t),d=String(e),g=String(n);n=Math.max(Math.abs(n),1);let m=i(f)||i(d)||i(g),y=m?Math.max(f.length,d.length,g.length):0,_=!1===m&&!1===((t,e,n)=>"string"==typeof t||"string"==typeof e||!0===n.stringify)(t,e,r),R=r.transform||(t=>e=>!0===t?Number(e):String(e))(_);if(r.toRegex&&1===n)return c(u(t,y),u(e,y),!0,r);let b={negatives:[],positives:[]},S=t=>b[t<0?"negatives":"positives"].push(Math.abs(t)),P=[],v=0;for(;h?o>=s:o<=s;)!0===r.toRegex&&n>1?S(o):P.push(a(R(o,v),y,_)),o=h?o-n:o+n,v++;return!0===r.toRegex?n>1?((t,e,n)=>{t.negatives.sort((t,e)=>t<e?-1:t>e?1:0),t.positives.sort((t,e)=>t<e?-1:t>e?1:0);let r,o=e.capture?"":"?:",s="",i="";return t.positives.length&&(s=t.positives.map(t=>u(String(t),n)).join("|")),t.negatives.length&&(i=`-(${o}${t.negatives.map(t=>u(String(t),n)).join("|")})`),r=s&&i?`${s}|${i}`:s||i,e.wrap?`(${o}${r})`:r})(b,r,y):l(P,null,{wrap:!1,...r}):P},d=(t,e,o,i={})=>{if(null==e&&r(t))return[t];if(!r(t)||!r(e))return h(t,e,i);if("function"==typeof o)return d(t,e,1,{transform:o});if(n(o))return d(t,e,0,o);let a={...i};return!0===a.capture&&(a.wrap=!0),o=o||a.step||1,s(o)?s(t)&&s(e)?f(t,e,o,a):((t,e,n=1,r={})=>{if(!s(t)&&t.length>1||!s(e)&&e.length>1)return h(t,e,r);let o=r.transform||(t=>String.fromCharCode(t)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),u=i>a,p=Math.min(i,a),f=Math.max(i,a);if(r.toRegex&&1===n)return c(p,f,!1,r);let d=[],g=0;for(;u?i>=a:i<=a;)d.push(o(i,g)),i=u?i-n:i+n,g++;return!0===r.toRegex?l(d,null,{wrap:!1,options:r}):d})(t,e,Math.max(Math.abs(o),1),a):null==o||n(o)?d(t,e,1,o):((t,e)=>{if(!0===e.strictRanges)throw new TypeError(`Expected step "${t}" to be a number`);return[]})(o,a)};return U=d}function ut(){if(J)return Z;J=1;const t=ot(),{MAX_LENGTH:e,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:i,CHAR_RIGHT_PARENTHESES:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:c,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:p,CHAR_DOUBLE_QUOTE:h,CHAR_SINGLE_QUOTE:f,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:g}=Y?X:(Y=1,X={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return Z=(m,y={})=>{if("string"!=typeof m)throw new TypeError("Expected a string");const _=y||{},R="number"==typeof _.maxLength?Math.min(e,_.maxLength):e;if(m.length>R)throw new SyntaxError(`Input length (${m.length}), exceeds max characters (${R})`);const b={type:"root",input:m,nodes:[]},S=[b];let P=b,v=b,E=0;const A=m.length;let x,C=0,O=0;const w=()=>m[C++],$=t=>{if("text"===t.type&&"dot"===v.type&&(v.type="text"),!v||"text"!==v.type||"text"!==t.type)return P.nodes.push(t),t.parent=P,t.prev=v,v=t,t;v.value+=t.value};for($({type:"bos"});C<A;)if(P=S[S.length-1],x=w(),x!==g&&x!==d)if(x!==n)if(x!==p){if(x===l){let t;for(E++;C<A&&(t=w());)if(x+=t,t!==l)if(t!==n){if(t===p&&(E--,0===E))break}else x+=w();else E++;$({type:"text",value:x});continue}if(x!==i)if(x!==a){if(x===h||x===f||x===r){const t=x;let e;for(!0!==y.keepQuotes&&(x="");C<A&&(e=w());)if(e!==n){if(e===t){!0===y.keepQuotes&&(x+=e);break}x+=e}else x+=e+w();$({type:"text",value:x});continue}if(x===u){O++;const t=v.value&&"$"===v.value.slice(-1)||!0===P.dollar;P=$({type:"brace",open:!0,close:!1,dollar:t,depth:O,commas:0,ranges:0,nodes:[]}),S.push(P),$({type:"open",value:x});continue}if(x===c){if("brace"!==P.type){$({type:"text",value:x});continue}const t="close";P=S.pop(),P.close=!0,$({type:t,value:x}),O--,P=S[S.length-1];continue}if(x===o&&O>0){if(P.ranges>0){P.ranges=0;const e=P.nodes.shift();P.nodes=[e,{type:"text",value:t(P)}]}$({type:"comma",value:x}),P.commas++}else{if(x===s&&O>0&&0===P.commas){const t=P.nodes;if(0===O||0===t.length){$({type:"text",value:x});continue}if("dot"===v.type){if(P.range=[],v.value+=x,v.type="range",3!==P.nodes.length&&5!==P.nodes.length){P.invalid=!0,P.ranges=0,v.type="text";continue}P.ranges++,P.args=[];continue}if("range"===v.type){t.pop();const e=t[t.length-1];e.value+=v.value+x,v=e,P.ranges--;continue}$({type:"dot",value:x});continue}$({type:"text",value:x})}}else{if("paren"!==P.type){$({type:"text",value:x});continue}P=S.pop(),$({type:"text",value:x}),P=S[S.length-1]}else P=$({type:"paren",nodes:[]}),S.push(P),$({type:"text",value:x})}else $({type:"text",value:"\\"+x});else $({type:"text",value:(y.keepEscaping?x:"")+w()});do{if(P=S.pop(),"root"!==P.type){P.nodes.forEach(t=>{t.nodes||("open"===t.type&&(t.isOpen=!0),"close"===t.type&&(t.isClose=!0),t.nodes||(t.type="text"),t.invalid=!0)});const t=S[S.length-1],e=t.nodes.indexOf(P);t.nodes.splice(e,1,...P.nodes)}}while(S.length>0);return $({type:"eos"}),b}}function ct(){if(et)return tt;et=1;const t=ot(),e=function(){if(Q)return V;Q=1;const t=at(),e=rt();return V=(n,r={})=>{const o=(n,s={})=>{const i=e.isInvalidBrace(s),a=!0===n.invalid&&!0===r.escapeInvalid,u=!0===i||!0===a,c=!0===r.escapeInvalid?"\\":"";let l="";if(!0===n.isOpen)return c+n.value;if(!0===n.isClose)return console.log("node.isClose",c,n.value),c+n.value;if("open"===n.type)return u?c+n.value:"(";if("close"===n.type)return u?c+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){const o=e.reduce(n.nodes),s=t(...o,{...r,wrap:!1,toRegex:!0,strictZeros:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(const t of n.nodes)l+=o(t,n);return l};return o(n)}}(),n=function(){if(z)return q;z=1;const t=at(),e=ot(),n=rt(),r=(t="",e="",o=!1)=>{const s=[];if(t=[].concat(t),!(e=[].concat(e)).length)return t;if(!t.length)return o?n.flatten(e).map(t=>`{${t}}`):e;for(const n of t)if(Array.isArray(n))for(const t of n)s.push(r(t,e,o));else for(let t of e)!0===o&&"string"==typeof t&&(t=`{${t}}`),s.push(Array.isArray(t)?r(n,t,o):n+t);return n.flatten(s)};return q=(o,s={})=>{const i=void 0===s.rangeLimit?1e3:s.rangeLimit,a=(o,u={})=>{o.queue=[];let c=u,l=u.queue;for(;"brace"!==c.type&&"root"!==c.type&&c.parent;)c=c.parent,l=c.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),e(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){const a=n.reduce(o.nodes);if(n.exceedsLimit(...a,s.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=t(...a,s);return 0===u.length&&(u=e(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}const p=n.encloseBrace(o);let h=o.queue,f=o;for(;"brace"!==f.type&&"root"!==f.type&&f.parent;)f=f.parent,h=f.queue;for(let t=0;t<o.nodes.length;t++){const e=o.nodes[t];"comma"!==e.type||"brace"!==o.type?"close"!==e.type?e.value&&"open"!==e.type?h.push(r(h.pop(),e.value)):e.nodes&&a(e,o):l.push(r(l.pop(),h,p)):(1===t&&h.push(""),h.push(""))}return h};return n.flatten(a(o))},q}(),r=ut(),o=(t,e={})=>{let n=[];if(Array.isArray(t))for(const r of t){const t=o.create(r,e);Array.isArray(t)?n.push(...t):n.push(t)}else n=[].concat(o.create(t,e));return e&&!0===e.expand&&!0===e.nodupes&&(n=[...new Set(n)]),n};return o.parse=(t,e={})=>r(t,e),o.stringify=(e,n={})=>t("string"==typeof e?o.parse(e,n):e,n),o.compile=(t,n={})=>("string"==typeof t&&(t=o.parse(t,n)),e(t,n)),o.expand=(t,e={})=>{"string"==typeof t&&(t=o.parse(t,e));let r=n(t,e);return!0===e.noempty&&(r=r.filter(Boolean)),!0===e.nodupes&&(r=[...new Set(r)]),r},o.create=(t,e={})=>""===t||t.length<3?[t]:!0!==e.expand?o.compile(t,e):o.expand(t,e),tt=o}var lt,pt,ht,ft,dt,gt,mt,yt,_t,Rt,bt,St,Pt,vt,Et={};function At(){if(pt)return lt;pt=1;const t=r,e="\\\\/",n=`[^${e}]`,o="\\.",s="\\/",i="[^/]",a=`(?:${s}|$)`,u=`(?:^|${s})`,c=`${o}{1,2}${a}`,l={DOT_LITERAL:o,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:s,ONE_CHAR:"(?=.)",QMARK:i,END_ANCHOR:a,DOTS_SLASH:c,NO_DOT:`(?!${o})`,NO_DOTS:`(?!${u}${c})`,NO_DOT_SLASH:`(?!${o}{0,1}${a})`,NO_DOTS_SLASH:`(?!${c})`,QMARK_NO_DOT:`[^.${s}]`,STAR:`${i}*?`,START_ANCHOR:u},p={...l,SLASH_LITERAL:`[${e}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${o}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[${e}])${o}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`};return lt={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:t.sep,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?p:l}}function xt(){return ht||(ht=1,function(t){const e=r,n="win32"===process.platform,{REGEX_BACKSLASH:o,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:a}=At();t.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),t.hasRegexChars=t=>i.test(t),t.isRegexChar=e=>1===e.length&&t.hasRegexChars(e),t.escapeRegex=t=>t.replace(a,"\\$1"),t.toPosixSlashes=t=>t.replace(o,"/"),t.removeBackslashes=t=>t.replace(s,t=>"\\"===t?"":t),t.supportsLookbehinds=()=>{const t=process.version.slice(1).split(".").map(Number);return 3===t.length&&t[0]>=9||8===t[0]&&t[1]>=10},t.isWindows=t=>t&&"boolean"==typeof t.windows?t.windows:!0===n||"\\"===e.sep,t.escapeLast=(e,n,r)=>{const o=e.lastIndexOf(n,r);return-1===o?e:"\\"===e[o-1]?t.escapeLast(e,n,o-1):`${e.slice(0,o)}\\${e.slice(o)}`},t.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n},t.wrapOutput=(t,e={},n={})=>{let r=`${n.contains?"":"^"}(?:${t})${n.contains?"":"$"}`;return!0===e.negated&&(r=`(?:^(?!${r}).*$)`),r}}(Et)),Et}function Ct(){if(_t)return yt;_t=1;const t=r,e=function(){if(dt)return ft;dt=1;const t=xt(),{CHAR_ASTERISK:e,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:c,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:p,CHAR_QUESTION_MARK:h,CHAR_RIGHT_CURLY_BRACE:f,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:g}=At(),m=t=>t===a||t===r,y=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};return ft=(_,R)=>{const b=R||{},S=_.length-1,P=!0===b.parts||!0===b.scanToEnd,v=[],E=[],A=[];let x,C,O=_,w=-1,$=0,T=0,k=!1,M=!1,L=!1,j=!1,H=!1,F=!1,D=!1,N=!1,I=!1,B=!1,W=0,G={value:"",depth:0,isGlob:!1};const U=()=>w>=S,K=()=>O.charCodeAt(w+1),V=()=>(x=C,O.charCodeAt(++w));for(;w<S;){let t;if(C=V(),C!==r){if(!0===F||C===u){for(W++;!0!==U()&&(C=V());)if(C!==r)if(C!==u){if(!0!==F&&C===s&&(C=V())===s){if(k=G.isBrace=!0,L=G.isGlob=!0,B=!0,!0===P)continue;break}if(!0!==F&&C===o){if(k=G.isBrace=!0,L=G.isGlob=!0,B=!0,!0===P)continue;break}if(C===f&&(W--,0===W)){F=!1,k=G.isBrace=!0,B=!0;break}}else W++;else D=G.backslashes=!0,V();if(!0===P)continue;break}if(C!==a){if(!0!==b.noext&&!0==(C===p||C===n||C===e||C===h||C===i)&&K()===c){if(L=G.isGlob=!0,j=G.isExtglob=!0,B=!0,C===i&&w===$&&(I=!0),!0===P){for(;!0!==U()&&(C=V());)if(C!==r){if(C===d){L=G.isGlob=!0,B=!0;break}}else D=G.backslashes=!0,C=V();continue}break}if(C===e){if(x===e&&(H=G.isGlobstar=!0),L=G.isGlob=!0,B=!0,!0===P)continue;break}if(C===h){if(L=G.isGlob=!0,B=!0,!0===P)continue;break}if(C===l){for(;!0!==U()&&(t=V());)if(t!==r){if(t===g){M=G.isBracket=!0,L=G.isGlob=!0,B=!0;break}}else D=G.backslashes=!0,V();if(!0===P)continue;break}if(!0===b.nonegate||C!==i||w!==$){if(!0!==b.noparen&&C===c){if(L=G.isGlob=!0,!0===P){for(;!0!==U()&&(C=V());)if(C!==c){if(C===d){B=!0;break}}else D=G.backslashes=!0,C=V();continue}break}if(!0===L){if(B=!0,!0===P)continue;break}}else N=G.negated=!0,$++}else{if(v.push(w),E.push(G),G={value:"",depth:0,isGlob:!1},!0===B)continue;if(x===s&&w===$+1){$+=2;continue}T=w+1}}else D=G.backslashes=!0,C=V(),C===u&&(F=!0)}!0===b.noext&&(j=!1,L=!1);let Q=O,q="",z="";$>0&&(q=O.slice(0,$),O=O.slice($),T-=$),Q&&!0===L&&T>0?(Q=O.slice(0,T),z=O.slice(T)):!0===L?(Q="",z=O):Q=O,Q&&""!==Q&&"/"!==Q&&Q!==O&&m(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===b.unescape&&(z&&(z=t.removeBackslashes(z)),Q&&!0===D&&(Q=t.removeBackslashes(Q)));const X={prefix:q,input:_,start:$,base:Q,glob:z,isBrace:k,isBracket:M,isGlob:L,isExtglob:j,isGlobstar:H,negated:N,negatedExtglob:I};if(!0===b.tokens&&(X.maxDepth=0,m(C)||E.push(G),X.tokens=E),!0===b.parts||!0===b.tokens){let t;for(let e=0;e<v.length;e++){const n=t?t+1:$,r=v[e],o=_.slice(n,r);b.tokens&&(0===e&&0!==$?(E[e].isPrefix=!0,E[e].value=q):E[e].value=o,y(E[e]),X.maxDepth+=E[e].depth),0===e&&""===o||A.push(o),t=r}if(t&&t+1<_.length){const e=_.slice(t+1);A.push(e),b.tokens&&(E[E.length-1].value=e,y(E[E.length-1]),X.maxDepth+=E[E.length-1].depth)}X.slashes=v,X.parts=A}return X},ft}(),n=function(){if(mt)return gt;mt=1;const t=At(),e=xt(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=t,a=(t,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...t,n);t.sort();const r=`[${t.join("-")}]`;try{new RegExp(r)}catch(n){return t.map(t=>e.escapeRegex(t)).join("..")}return r},u=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,c=(l,p)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=i[l]||l;const h={...p},f="number"==typeof h.maxLength?Math.min(n,h.maxLength):n;let d=l.length;if(d>f)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${f}`);const g={type:"bos",value:"",output:h.prepend||""},m=[g],y=h.capture?"":"?:",_=e.isWindows(p),R=t.globChars(_),b=t.extglobChars(R),{DOT_LITERAL:S,PLUS_LITERAL:P,SLASH_LITERAL:v,ONE_CHAR:E,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:C,NO_DOTS_SLASH:O,QMARK:w,QMARK_NO_DOT:$,STAR:T,START_ANCHOR:k}=R,M=t=>`(${y}(?:(?!${k}${t.dot?A:S}).)*?)`,L=h.dot?"":x,j=h.dot?w:$;let H=!0===h.bash?M(h):T;h.capture&&(H=`(${H})`),"boolean"==typeof h.noext&&(h.noextglob=h.noext);const F={input:l,index:-1,start:0,dot:!0===h.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:m};l=e.removePrefix(l,F),d=l.length;const D=[],N=[],I=[];let B,W=g;const G=()=>F.index===d-1,U=F.peek=(t=1)=>l[F.index+t],K=F.advance=()=>l[++F.index]||"",V=()=>l.slice(F.index+1),Q=(t="",e=0)=>{F.consumed+=t,F.index+=e},q=t=>{F.output+=null!=t.output?t.output:t.value,Q(t.value)},z=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)K(),F.start++,t++;return t%2!=0&&(F.negated=!0,F.start++,!0)},X=t=>{F[t]++,I.push(t)},Y=t=>{F[t]--,I.pop()},Z=t=>{if("globstar"===W.type){const e=F.braces>0&&("comma"===t.type||"brace"===t.type),n=!0===t.extglob||D.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||n||(F.output=F.output.slice(0,-W.output.length),W.type="star",W.value="*",W.output=H,F.output+=W.output)}if(D.length&&"paren"!==t.type&&(D[D.length-1].inner+=t.value),(t.value||t.output)&&q(t),W&&"text"===W.type&&"text"===t.type)return W.value+=t.value,void(W.output=(W.output||"")+t.value);t.prev=W,m.push(t),W=t},J=(t,e)=>{const n={...b[e],conditions:1,inner:""};n.prev=W,n.parens=F.parens,n.output=F.output;const r=(h.capture?"(":"")+n.open;X("parens"),Z({type:t,value:e,output:F.output?"":E}),Z({type:"paren",extglob:!0,value:K(),output:r}),D.push(n)},tt=t=>{let e,n=t.close+(h.capture?")":"");if("negate"===t.type){let r=H;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(r=M(h)),(r!==H||G()||/^\)+$/.test(V()))&&(n=t.close=`)$))${r}`),t.inner.includes("*")&&(e=V())&&/^\.[^\\/.]+$/.test(e)){const o=c(e,{...p,fastpaths:!1}).output;n=t.close=`)${o})${r})`}"bos"===t.prev.type&&(F.negatedExtglob=!0)}Z({type:"paren",extglob:!0,value:B,output:n}),Y("parens")};if(!1!==h.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let t=!1,n=l.replace(s,(e,n,r,o,s,i)=>"\\"===o?(t=!0,e):"?"===o?n?n+o+(s?w.repeat(s.length):""):0===i?j+(s?w.repeat(s.length):""):w.repeat(r.length):"."===o?S.repeat(r.length):"*"===o?n?n+o+(s?H:""):H:n?e:`\\${e}`);return!0===t&&(n=!0===h.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),n===l&&!0===h.contains?(F.output=l,F):(F.output=e.wrapOutput(n,F,p),F)}for(;!G();){if(B=K(),"\0"===B)continue;if("\\"===B){const t=U();if("/"===t&&!0!==h.bash)continue;if("."===t||";"===t)continue;if(!t){B+="\\",Z({type:"text",value:B});continue}const e=/^\\+/.exec(V());let n=0;if(e&&e[0].length>2&&(n=e[0].length,F.index+=n,n%2!=0&&(B+="\\")),!0===h.unescape?B=K():B+=K(),0===F.brackets){Z({type:"text",value:B});continue}}if(F.brackets>0&&("]"!==B||"["===W.value||"[^"===W.value)){if(!1!==h.posix&&":"===B){const t=W.value.slice(1);if(t.includes("[")&&(W.posix=!0,t.includes(":"))){const t=W.value.lastIndexOf("["),e=W.value.slice(0,t),n=W.value.slice(t+2),o=r[n];if(o){W.value=e+o,F.backtrack=!0,K(),g.output||1!==m.indexOf(W)||(g.output=E);continue}}}("["===B&&":"!==U()||"-"===B&&"]"===U())&&(B=`\\${B}`),"]"!==B||"["!==W.value&&"[^"!==W.value||(B=`\\${B}`),!0===h.posix&&"!"===B&&"["===W.value&&(B="^"),W.value+=B,q({value:B});continue}if(1===F.quotes&&'"'!==B){B=e.escapeRegex(B),W.value+=B,q({value:B});continue}if('"'===B){F.quotes=1===F.quotes?0:1,!0===h.keepQuotes&&Z({type:"text",value:B});continue}if("("===B){X("parens"),Z({type:"paren",value:B});continue}if(")"===B){if(0===F.parens&&!0===h.strictBrackets)throw new SyntaxError(u("opening","("));const t=D[D.length-1];if(t&&F.parens===t.parens+1){tt(D.pop());continue}Z({type:"paren",value:B,output:F.parens?")":"\\)"}),Y("parens");continue}if("["===B){if(!0!==h.nobracket&&V().includes("]"))X("brackets");else{if(!0!==h.nobracket&&!0===h.strictBrackets)throw new SyntaxError(u("closing","]"));B=`\\${B}`}Z({type:"bracket",value:B});continue}if("]"===B){if(!0===h.nobracket||W&&"bracket"===W.type&&1===W.value.length){Z({type:"text",value:B,output:`\\${B}`});continue}if(0===F.brackets){if(!0===h.strictBrackets)throw new SyntaxError(u("opening","["));Z({type:"text",value:B,output:`\\${B}`});continue}Y("brackets");const t=W.value.slice(1);if(!0===W.posix||"^"!==t[0]||t.includes("/")||(B=`/${B}`),W.value+=B,q({value:B}),!1===h.literalBrackets||e.hasRegexChars(t))continue;const n=e.escapeRegex(W.value);if(F.output=F.output.slice(0,-W.value.length),!0===h.literalBrackets){F.output+=n,W.value=n;continue}W.value=`(${y}${n}|${W.value})`,F.output+=W.value;continue}if("{"===B&&!0!==h.nobrace){X("braces");const t={type:"brace",value:B,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};N.push(t),Z(t);continue}if("}"===B){const t=N[N.length-1];if(!0===h.nobrace||!t){Z({type:"text",value:B,output:B});continue}let e=")";if(!0===t.dots){const t=m.slice(),n=[];for(let e=t.length-1;e>=0&&(m.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&n.unshift(t[e].value);e=a(n,h),F.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){const n=F.output.slice(0,t.outputIndex),r=F.tokens.slice(t.tokensIndex);t.value=t.output="\\{",B=e="\\}",F.output=n;for(const t of r)F.output+=t.output||t.value}Z({type:"brace",value:B,output:e}),Y("braces"),N.pop();continue}if("|"===B){D.length>0&&D[D.length-1].conditions++,Z({type:"text",value:B});continue}if(","===B){let t=B;const e=N[N.length-1];e&&"braces"===I[I.length-1]&&(e.comma=!0,t="|"),Z({type:"comma",value:B,output:t});continue}if("/"===B){if("dot"===W.type&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",m.pop(),W=g;continue}Z({type:"slash",value:B,output:v});continue}if("."===B){if(F.braces>0&&"dot"===W.type){"."===W.value&&(W.output=S);const t=N[N.length-1];W.type="dots",W.output+=B,W.value+=B,t.dots=!0;continue}if(F.braces+F.parens===0&&"bos"!==W.type&&"slash"!==W.type){Z({type:"text",value:B,output:S});continue}Z({type:"dot",value:B,output:S});continue}if("?"===B){if((!W||"("!==W.value)&&!0!==h.noextglob&&"("===U()&&"?"!==U(2)){J("qmark",B);continue}if(W&&"paren"===W.type){const t=U();let n=B;if("<"===t&&!e.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===W.value&&!/[!=<:]/.test(t)||"<"===t&&!/<([!=]|\w+>)/.test(V()))&&(n=`\\${B}`),Z({type:"text",value:B,output:n});continue}if(!0!==h.dot&&("slash"===W.type||"bos"===W.type)){Z({type:"qmark",value:B,output:$});continue}Z({type:"qmark",value:B,output:w});continue}if("!"===B){if(!0!==h.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){J("negate",B);continue}if(!0!==h.nonegate&&0===F.index){z();continue}}if("+"===B){if(!0!==h.noextglob&&"("===U()&&"?"!==U(2)){J("plus",B);continue}if(W&&"("===W.value||!1===h.regex){Z({type:"plus",value:B,output:P});continue}if(W&&("bracket"===W.type||"paren"===W.type||"brace"===W.type)||F.parens>0){Z({type:"plus",value:B});continue}Z({type:"plus",value:P});continue}if("@"===B){if(!0!==h.noextglob&&"("===U()&&"?"!==U(2)){Z({type:"at",extglob:!0,value:B,output:""});continue}Z({type:"text",value:B});continue}if("*"!==B){"$"!==B&&"^"!==B||(B=`\\${B}`);const t=o.exec(V());t&&(B+=t[0],F.index+=t[0].length),Z({type:"text",value:B});continue}if(W&&("globstar"===W.type||!0===W.star)){W.type="star",W.star=!0,W.value+=B,W.output=H,F.backtrack=!0,F.globstar=!0,Q(B);continue}let t=V();if(!0!==h.noextglob&&/^\([^?]/.test(t)){J("star",B);continue}if("star"===W.type){if(!0===h.noglobstar){Q(B);continue}const e=W.prev,n=e.prev,r="slash"===e.type||"bos"===e.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===h.bash&&(!r||t[0]&&"/"!==t[0])){Z({type:"star",value:B,output:""});continue}const s=F.braces>0&&("comma"===e.type||"brace"===e.type),i=D.length&&("pipe"===e.type||"paren"===e.type);if(!r&&"paren"!==e.type&&!s&&!i){Z({type:"star",value:B,output:""});continue}for(;"/**"===t.slice(0,3);){const e=l[F.index+4];if(e&&"/"!==e)break;t=t.slice(3),Q("/**",3)}if("bos"===e.type&&G()){W.type="globstar",W.value+=B,W.output=M(h),F.output=W.output,F.globstar=!0,Q(B);continue}if("slash"===e.type&&"bos"!==e.prev.type&&!o&&G()){F.output=F.output.slice(0,-(e.output+W.output).length),e.output=`(?:${e.output}`,W.type="globstar",W.output=M(h)+(h.strictSlashes?")":"|$)"),W.value+=B,F.globstar=!0,F.output+=e.output+W.output,Q(B);continue}if("slash"===e.type&&"bos"!==e.prev.type&&"/"===t[0]){const n=void 0!==t[1]?"|$":"";F.output=F.output.slice(0,-(e.output+W.output).length),e.output=`(?:${e.output}`,W.type="globstar",W.output=`${M(h)}${v}|${v}${n})`,W.value+=B,F.output+=e.output+W.output,F.globstar=!0,Q(B+K()),Z({type:"slash",value:"/",output:""});continue}if("bos"===e.type&&"/"===t[0]){W.type="globstar",W.value+=B,W.output=`(?:^|${v}|${M(h)}${v})`,F.output=W.output,F.globstar=!0,Q(B+K()),Z({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-W.output.length),W.type="globstar",W.output=M(h),W.value+=B,F.output+=W.output,F.globstar=!0,Q(B);continue}const n={type:"star",value:B,output:H};!0!==h.bash?!W||"bracket"!==W.type&&"paren"!==W.type||!0!==h.regex?(F.index!==F.start&&"slash"!==W.type&&"dot"!==W.type||("dot"===W.type?(F.output+=C,W.output+=C):!0===h.dot?(F.output+=O,W.output+=O):(F.output+=L,W.output+=L),"*"!==U()&&(F.output+=E,W.output+=E)),Z(n)):(n.output=B,Z(n)):(n.output=".*?","bos"!==W.type&&"slash"!==W.type||(n.output=L+n.output),Z(n))}for(;F.brackets>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing","]"));F.output=e.escapeLast(F.output,"["),Y("brackets")}for(;F.parens>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing",")"));F.output=e.escapeLast(F.output,"("),Y("parens")}for(;F.braces>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing","}"));F.output=e.escapeLast(F.output,"{"),Y("braces")}if(!0===h.strictSlashes||"star"!==W.type&&"bracket"!==W.type||Z({type:"maybe_slash",value:"",output:`${v}?`}),!0===F.backtrack){F.output="";for(const t of F.tokens)F.output+=null!=t.output?t.output:t.value,t.suffix&&(F.output+=t.suffix)}return F};return c.fastpaths=(r,o)=>{const s={...o},a="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>a)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${a}`);r=i[r]||r;const c=e.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:f,NO_DOT:d,NO_DOTS:g,NO_DOTS_SLASH:m,STAR:y,START_ANCHOR:_}=t.globChars(c),R=s.dot?g:d,b=s.dot?m:d,S=s.capture?"":"?:";let P=!0===s.bash?".*?":y;s.capture&&(P=`(${P})`);const v=t=>!0===t.noglobstar?P:`(${S}(?:(?!${_}${t.dot?f:l}).)*?)`,E=t=>{switch(t){case"*":return`${R}${h}${P}`;case".*":return`${l}${h}${P}`;case"*.*":return`${R}${P}${l}${h}${P}`;case"*/*":return`${R}${P}${p}${h}${b}${P}`;case"**":return R+v(s);case"**/*":return`(?:${R}${v(s)}${p})?${b}${h}${P}`;case"**/*.*":return`(?:${R}${v(s)}${p})?${b}${P}${l}${h}${P}`;case"**/.*":return`(?:${R}${v(s)}${p})?${l}${h}${P}`;default:{const e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;const n=E(e[1]);if(!n)return;return n+l+e[2]}}},A=e.removePrefix(r,{negated:!1,prefix:""});let x=E(A);return x&&!0!==s.strictSlashes&&(x+=`${p}?`),x},gt=c}(),o=xt(),s=At(),i=(t,e,n=!1)=>{if(Array.isArray(t)){const r=t.map(t=>i(t,e,n)),o=t=>{for(const e of r){const n=e(t);if(n)return n}return!1};return o}const r=(s=t)&&"object"==typeof s&&!Array.isArray(s)&&t.tokens&&t.input;var s;if(""===t||"string"!=typeof t&&!r)throw new TypeError("Expected pattern to be a non-empty string");const a=e||{},u=o.isWindows(e),c=r?i.compileRe(t,e):i.makeRe(t,e,!1,!0),l=c.state;delete c.state;let p=()=>!1;if(a.ignore){const t={...e,ignore:null,onMatch:null,onResult:null};p=i(a.ignore,t,n)}const h=(n,r=!1)=>{const{isMatch:o,match:s,output:h}=i.test(n,c,e,{glob:t,posix:u}),f={glob:t,state:l,regex:c,posix:u,input:n,output:h,match:s,isMatch:o};return"function"==typeof a.onResult&&a.onResult(f),!1===o?(f.isMatch=!1,!!r&&f):p(n)?("function"==typeof a.onIgnore&&a.onIgnore(f),f.isMatch=!1,!!r&&f):("function"==typeof a.onMatch&&a.onMatch(f),!r||f)};return n&&(h.state=l),h};return i.test=(t,e,n,{glob:r,posix:s}={})=>{if("string"!=typeof t)throw new TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};const a=n||{},u=a.format||(s?o.toPosixSlashes:null);let c=t===r,l=c&&u?u(t):t;return!1===c&&(l=u?u(t):t,c=l===r),!1!==c&&!0!==a.capture||(c=!0===a.matchBase||!0===a.basename?i.matchBase(t,e,n,s):e.exec(l)),{isMatch:Boolean(c),match:c,output:l}},i.matchBase=(e,n,r,s=o.isWindows(r))=>(n instanceof RegExp?n:i.makeRe(n,r)).test(t.basename(e)),i.isMatch=(t,e,n)=>i(e,n)(t),i.parse=(t,e)=>Array.isArray(t)?t.map(t=>i.parse(t,e)):n(t,{...e,fastpaths:!1}),i.scan=(t,n)=>e(t,n),i.compileRe=(t,e,n=!1,r=!1)=>{if(!0===n)return t.output;const o=e||{},s=o.contains?"":"^",a=o.contains?"":"$";let u=`${s}(?:${t.output})${a}`;t&&!0===t.negated&&(u=`^(?!${u}).*$`);const c=i.toRegex(u,e);return!0===r&&(c.state=t),c},i.makeRe=(t,e={},r=!1,o=!1)=>{if(!t||"string"!=typeof t)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===e.fastpaths||"."!==t[0]&&"*"!==t[0]||(s.output=n.fastpaths(t,e)),s.output||(s=n(t,e)),i.compileRe(s,e,r,o)},i.toRegex=(t,e)=>{try{const n=e||{};return new RegExp(t,n.flags||(n.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},i.constants=s,yt=i}function Ot(){return bt?Rt:(bt=1,Rt=Ct())}function wt(){if(vt)return M;vt=1,Object.defineProperty(M,"__esModule",{value:!0}),M.isAbsolute=M.partitionAbsoluteAndRelative=M.removeDuplicateSlashes=M.matchAny=M.convertPatternsToRe=M.makeRe=M.getPatternParts=M.expandBraceExpansion=M.expandPatternsWithBraceExpansion=M.isAffectDepthOfReadingPattern=M.endsWithSlashGlobStar=M.hasGlobStar=M.getBaseDirectory=M.isPatternRelatedToParentDirectory=M.getPatternsOutsideCurrentDirectory=M.getPatternsInsideCurrentDirectory=M.getPositivePatterns=M.getNegativePatterns=M.isPositivePattern=M.isNegativePattern=M.convertToNegativePattern=M.convertToPositivePattern=M.isDynamicPattern=M.isStaticPattern=void 0;const t=r,e=H(),n=function(){if(Pt)return St;Pt=1;const t=o,e=ct(),n=Ot(),r=xt(),s=t=>""===t||"./"===t,i=t=>{const e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},a=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let o=new Set,s=new Set,i=new Set,a=0,u=t=>{i.add(t.output),r&&r.onResult&&r.onResult(t)};for(let i=0;i<e.length;i++){let c=n(String(e[i]),{...r,onResult:u},!0),l=c.state.negated||c.state.negatedExtglob;l&&a++;for(let e of t){let t=c(e,!0);(l?!t.isMatch:t.isMatch)&&(l?o.add(t.output):(o.delete(t.output),s.add(t.output)))}}let c=(a===e.length?[...i]:[...s]).filter(t=>!o.has(t));if(r&&0===c.length){if(!0===r.failglob)throw new Error(`No matches found for "${e.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?e.map(t=>t.replace(/\\/g,"")):e}return c};return a.match=a,a.matcher=(t,e)=>n(t,e),a.any=a.isMatch=(t,e,r)=>n(e,r)(t),a.not=(t,e,n={})=>{e=[].concat(e).map(String);let r=new Set,o=[],s=new Set(a(t,e,{...n,onResult:t=>{n.onResult&&n.onResult(t),o.push(t.output)}}));for(let t of o)s.has(t)||r.add(t);return[...r]},a.contains=(e,n,r)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${t.inspect(e)}"`);if(Array.isArray(n))return n.some(t=>a.contains(e,t,r));if("string"==typeof n){if(s(e)||s(n))return!1;if(e.includes(n)||e.startsWith("./")&&e.slice(2).includes(n))return!0}return a.isMatch(e,n,{...r,contains:!0})},a.matchKeys=(t,e,n)=>{if(!r.isObject(t))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(t),e,n),s={};for(let e of o)s[e]=t[e];return s},a.some=(t,e,r)=>{let o=[].concat(t);for(let t of[].concat(e)){let e=n(String(t),r);if(o.some(t=>e(t)))return!0}return!1},a.every=(t,e,r)=>{let o=[].concat(t);for(let t of[].concat(e)){let e=n(String(t),r);if(!o.every(t=>e(t)))return!1}return!0},a.all=(e,r,o)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${t.inspect(e)}"`);return[].concat(r).every(t=>n(t,o)(e))},a.capture=(t,e,o)=>{let s=r.isWindows(o),i=n.makeRe(String(t),{...o,capture:!0}).exec(s?r.toPosixSlashes(e):e);if(i)return i.slice(1).map(t=>void 0===t?"":t)},a.makeRe=(...t)=>n.makeRe(...t),a.scan=(...t)=>n.scan(...t),a.parse=(t,r)=>{let o=[];for(let s of[].concat(t||[]))for(let t of e(String(s),r))o.push(n.parse(t,r));return o},a.braces=(t,n)=>{if("string"!=typeof t)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!i(t)?[t]:e(t,n)},a.braceExpand=(t,e)=>{if("string"!=typeof t)throw new TypeError("Expected a string");return a.braces(t,{...e,expand:!0})},a.hasBraces=i,St=a}(),s=/[*?]|^!/,i=/\[[^[]*]/,a=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,u=/[!*+?@]\([^(]*\)/,c=/,|\.\./,l=/(?!^)\/{2,}/g;function p(t,e={}){return!h(t,e)}function h(t,e={}){return""!==t&&(!(!1!==e.caseSensitiveMatch&&!t.includes("\\"))||(!!(s.test(t)||i.test(t)||a.test(t))||(!(!1===e.extglob||!u.test(t))||!(!1===e.braceExpansion||!function(t){const e=t.indexOf("{");if(-1===e)return!1;const n=t.indexOf("}",e+1);if(-1===n)return!1;const r=t.slice(e,n);return c.test(r)}(t)))))}function f(t){return t.startsWith("!")&&"("!==t[1]}function d(t){return!f(t)}function g(t){return t.startsWith("..")||t.startsWith("./..")}function m(t){return t.endsWith("/**")}function y(t){const e=n.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((t,e)=>t.length-e.length),e.filter(t=>""!==t)}function _(t,e){return n.makeRe(t,e)}function R(e){return t.isAbsolute(e)}return M.isStaticPattern=p,M.isDynamicPattern=h,M.convertToPositivePattern=function(t){return f(t)?t.slice(1):t},M.convertToNegativePattern=function(t){return"!"+t},M.isNegativePattern=f,M.isPositivePattern=d,M.getNegativePatterns=function(t){return t.filter(f)},M.getPositivePatterns=function(t){return t.filter(d)},M.getPatternsInsideCurrentDirectory=function(t){return t.filter(t=>!g(t))},M.getPatternsOutsideCurrentDirectory=function(t){return t.filter(g)},M.isPatternRelatedToParentDirectory=g,M.getBaseDirectory=function(t){return e(t,{flipBackslashes:!1})},M.hasGlobStar=function(t){return t.includes("**")},M.endsWithSlashGlobStar=m,M.isAffectDepthOfReadingPattern=function(e){const n=t.basename(e);return m(e)||p(n)},M.expandPatternsWithBraceExpansion=function(t){return t.reduce((t,e)=>t.concat(y(e)),[])},M.expandBraceExpansion=y,M.getPatternParts=function(t,e){let{parts:r}=n.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return 0===r.length&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r},M.makeRe=_,M.convertPatternsToRe=function(t,e){return t.map(t=>_(t,e))},M.matchAny=function(t,e){return e.some(e=>e.test(t))},M.removeDuplicateSlashes=function(t){return t.replace(l,"/")},M.partitionAbsoluteAndRelative=function(t){const e=[],n=[];for(const r of t)R(r)?e.push(r):n.push(r);return[e,n]},M.isAbsolute=R,M}var $t,Tt,kt,Mt={};function Lt(){if(Tt)return $t;Tt=1;const t=s.PassThrough,e=Array.prototype.slice;function n(e,r){if(Array.isArray(e))for(let t=0,o=e.length;t<o;t++)e[t]=n(e[t],r);else{if(!e._readableState&&e.pipe&&(e=e.pipe(t(r))),!e._readableState||!e.pause||!e.pipe)throw new Error("Only readable stream can be merged.");e.pause()}return e}return $t=function(){const r=[],o=e.call(arguments);let s=!1,i=o[o.length-1];i&&!Array.isArray(i)&&null==i.pipe?o.pop():i={};const a=!1!==i.end,u=!0===i.pipeError;null==i.objectMode&&(i.objectMode=!0);null==i.highWaterMark&&(i.highWaterMark=65536);const c=t(i);function l(){for(let t=0,e=arguments.length;t<e;t++)r.push(n(arguments[t],i));return p(),this}function p(){if(s)return;s=!0;let t=r.shift();if(!t)return void process.nextTick(h);Array.isArray(t)||(t=[t]);let e=t.length+1;function n(){--e>0||(s=!1,p())}function o(t){function e(){t.removeListener("merge2UnpipeEnd",e),t.removeListener("end",e),u&&t.removeListener("error",r),n()}function r(t){c.emit("error",t)}if(t._readableState.endEmitted)return n();t.on("merge2UnpipeEnd",e),t.on("end",e),u&&t.on("error",r),t.pipe(c,{end:!1}),t.resume()}for(let e=0;e<t.length;e++)o(t[e]);n()}function h(){s=!1,c.emit("queueDrain"),a&&c.end()}c.setMaxListeners(0),c.add=l,c.on("unpipe",function(t){t.emit("merge2UnpipeEnd")}),o.length&&l.apply(null,o);return c},$t}var jt,Ht,Ft,Dt={};function Nt(){if(jt)return Dt;return jt=1,Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.isEmpty=Dt.isString=void 0,Dt.isString=function(t){return"string"==typeof t},Dt.isEmpty=function(t){return""===t},Dt}function It(){if(Ht)return m;Ht=1,Object.defineProperty(m,"__esModule",{value:!0}),m.string=m.stream=m.pattern=m.path=m.fs=m.errno=m.array=void 0;const t=_();m.array=t;const e=S();m.errno=e;const n=function(){if(P)return v;P=1,Object.defineProperty(v,"__esModule",{value:!0}),v.createDirentFromStats=void 0;class t{constructor(t,e){this.name=t,this.isBlockDevice=e.isBlockDevice.bind(e),this.isCharacterDevice=e.isCharacterDevice.bind(e),this.isDirectory=e.isDirectory.bind(e),this.isFIFO=e.isFIFO.bind(e),this.isFile=e.isFile.bind(e),this.isSocket=e.isSocket.bind(e),this.isSymbolicLink=e.isSymbolicLink.bind(e)}}return v.createDirentFromStats=function(e,n){return new t(e,n)},v}();m.fs=n;const r=x();m.path=r;const o=wt();m.pattern=o;const s=function(){if(kt)return Mt;kt=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.merge=void 0;const t=Lt();function e(t){t.forEach(t=>t.emit("close"))}return Mt.merge=function(n){const r=t(n);return n.forEach(t=>{t.once("error",t=>r.emit("error",t))}),r.once("close",()=>e(n)),r.once("end",()=>e(n)),r},Mt}();m.stream=s;const i=Nt();return m.string=i,m}var Bt,Wt={},Gt={},Ut={},Kt={},Vt={},Qt={},qt={},zt={},Xt={};function Yt(){if(Bt)return Xt;function t(t,e){t(e)}function e(t,e){t(null,e)}return Bt=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.read=void 0,Xt.read=function(n,r,o){r.fs.lstat(n,(s,i)=>{null===s?i.isSymbolicLink()&&r.followSymbolicLink?r.fs.stat(n,(n,s)=>{if(null!==n)return r.throwErrorOnBrokenSymbolicLink?void t(o,n):void e(o,i);r.markSymbolicLink&&(s.isSymbolicLink=()=>!0),e(o,s)}):e(o,i):t(o,s)})},Xt}var Zt,Jt={};var te,ee,ne,re,oe,se,ie,ae={},ue={};function ce(){if(ee)return ae;ee=1,Object.defineProperty(ae,"__esModule",{value:!0});const t=(te||(te=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;const e=a;t.FILE_SYSTEM_ADAPTER={lstat:e.lstat,stat:e.stat,lstatSync:e.lstatSync,statSync:e.statSync},t.createFileSystemAdapter=function(e){return void 0===e?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}}(ue)),ue);return ae.default=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=t.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(t,e){return null!=t?t:e}},ae}function le(){if(ne)return zt;ne=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.statSync=zt.stat=zt.Settings=void 0;const t=Yt(),e=(Zt||(Zt=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.read=void 0,Jt.read=function(t,e){const n=e.fs.lstatSync(t);if(!n.isSymbolicLink()||!e.followSymbolicLink)return n;try{const n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(t){if(!e.throwErrorOnBrokenSymbolicLink)return n;throw t}}),Jt),n=ce();function r(t={}){return t instanceof n.default?t:new n.default(t)}return zt.Settings=n.default,zt.stat=function(e,n,o){"function"!=typeof n?t.read(e,r(n),o):t.read(e,r(),n)},zt.statSync=function(t,n){const o=r(n);return e.read(t,o)},zt}function pe(){if(oe)return re;let t;return oe=1,re="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:h):e=>(t||(t=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0))}var he,fe={};function de(){if(he)return fe;he=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const t=process.versions.node.split(".");if(void 0===t[0]||void 0===t[1])throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);const e=Number.parseInt(t[0],10),n=Number.parseInt(t[1],10),r=e>10,o=10===e&&n>=10;return fe.IS_SUPPORT_READDIR_WITH_FILE_TYPES=r||o,fe}var ge,me,ye={},_e={};function Re(){if(me)return ye;me=1,Object.defineProperty(ye,"__esModule",{value:!0}),ye.fs=void 0;const t=function(){if(ge)return _e;ge=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.createDirentFromStats=void 0;class t{constructor(t,e){this.name=t,this.isBlockDevice=e.isBlockDevice.bind(e),this.isCharacterDevice=e.isCharacterDevice.bind(e),this.isDirectory=e.isDirectory.bind(e),this.isFIFO=e.isFIFO.bind(e),this.isFile=e.isFile.bind(e),this.isSocket=e.isSocket.bind(e),this.isSymbolicLink=e.isSymbolicLink.bind(e)}}return _e.createDirentFromStats=function(e,n){return new t(e,n)},_e}();return ye.fs=t,ye}var be,Se,Pe={};function ve(){if(be)return Pe;return be=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.joinPathSegments=void 0,Pe.joinPathSegments=function(t,e,n){return t.endsWith(n)?t+e:t+n+e},Pe}function Ee(){if(Se)return qt;Se=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.readdir=qt.readdirWithFileTypes=qt.read=void 0;const t=le(),e=function(){if(ie)return se;ie=1,se=function(e,n){let r,o,s,i=!0;function a(e){function o(){n&&n(e,r),n=null}i?t(o):o()}function u(t,e,n){r[t]=n,(0===--o||e)&&a(e)}Array.isArray(e)?(r=[],o=e.length):(s=Object.keys(e),r={},o=s.length),o?s?s.forEach(function(t){e[t](function(e,n){u(t,e,n)})}):e.forEach(function(t,e){t(function(t,n){u(e,t,n)})}):a(null),i=!1};const t=pe();return se}(),n=de(),r=Re(),o=ve();function s(t,n,s){n.fs.readdir(t,{withFileTypes:!0},(i,c)=>{if(null!==i)return void a(s,i);const l=c.map(e=>({dirent:e,name:e.name,path:o.joinPathSegments(t,e.name,n.pathSegmentSeparator)}));if(!n.followSymbolicLinks)return void u(s,l);const p=l.map(t=>function(t,e){return n=>{t.dirent.isSymbolicLink()?e.fs.stat(t.path,(o,s)=>{if(null!==o)return e.throwErrorOnBrokenSymbolicLink?void n(o):void n(null,t);t.dirent=r.fs.createDirentFromStats(t.name,s),n(null,t)}):n(null,t)}}(t,n));e(p,(t,e)=>{null===t?u(s,e):a(s,t)})})}function i(n,s,i){s.fs.readdir(n,(c,l)=>{if(null!==c)return void a(i,c);const p=l.map(e=>{const i=o.joinPathSegments(n,e,s.pathSegmentSeparator);return n=>{t.stat(i,s.fsStatSettings,(t,o)=>{if(null!==t)return void n(t);const a={name:e,path:i,dirent:r.fs.createDirentFromStats(e,o)};s.stats&&(a.stats=o),n(null,a)})}});e(p,(t,e)=>{null===t?u(i,e):a(i,t)})})}function a(t,e){t(e)}function u(t,e){t(null,e)}return qt.read=function(t,e,r){e.stats||!n.IS_SUPPORT_READDIR_WITH_FILE_TYPES?i(t,e,r):s(t,e,r)},qt.readdirWithFileTypes=s,qt.readdir=i,qt}var Ae,xe={};var Ce,Oe,we,$e={},Te={};function ke(){return Ce||(Ce=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;const e=a;t.FILE_SYSTEM_ADAPTER={lstat:e.lstat,stat:e.stat,lstatSync:e.lstatSync,statSync:e.statSync,readdir:e.readdir,readdirSync:e.readdirSync},t.createFileSystemAdapter=function(e){return void 0===e?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}}(Te)),Te}function Me(){if(we)return Qt;we=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.Settings=Qt.scandirSync=Qt.scandir=void 0;const t=Ee(),e=function(){if(Ae)return xe;Ae=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.readdir=xe.readdirWithFileTypes=xe.read=void 0;const t=le(),e=de(),n=Re(),r=ve();function o(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(o=>{const s={dirent:o,name:o.name,path:r.joinPathSegments(t,o.name,e.pathSegmentSeparator)};if(s.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{const t=e.fs.statSync(s.path);s.dirent=n.fs.createDirentFromStats(s.name,t)}catch(t){if(e.throwErrorOnBrokenSymbolicLink)throw t}return s})}function s(e,o){return o.fs.readdirSync(e).map(s=>{const i=r.joinPathSegments(e,s,o.pathSegmentSeparator),a=t.statSync(i,o.fsStatSettings),u={name:s,path:i,dirent:n.fs.createDirentFromStats(s,a)};return o.stats&&(u.stats=a),u})}return xe.read=function(t,n){return!n.stats&&e.IS_SUPPORT_READDIR_WITH_FILE_TYPES?o(t,n):s(t,n)},xe.readdirWithFileTypes=o,xe.readdir=s,xe}(),n=function(){if(Oe)return $e;Oe=1,Object.defineProperty($e,"__esModule",{value:!0});const t=r,e=le(),n=ke();return $e.default=class{constructor(r={}){this._options=r,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=n.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,t.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new e.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(t,e){return null!=t?t:e}},$e}();function o(t={}){return t instanceof n.default?t:new n.default(t)}return Qt.Settings=n.default,Qt.scandir=function(e,n,r){"function"!=typeof n?t.read(e,o(n),r):t.read(e,o(),n)},Qt.scandirSync=function(t,n){const r=o(n);return e.read(t,r)},Qt}var Le,je,He,Fe={exports:{}};function De(){if(He)return Fe.exports;He=1;var t=je?Le:(je=1,Le=function(t){var e=new t,n=e;return{get:function(){var r=e;return r.next?e=r.next:(e=new t,n=e),r.next=null,r},release:function(t){n.next=t,n=t}}});function e(e,o,s){if("function"==typeof e&&(s=o,o=e,e=null),!(s>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var i=t(r),a=null,u=null,c=0,l=null,p={push:function(t,r){var f=i.get();f.context=e,f.release=h,f.value=t,f.callback=r||n,f.errorHandler=l,c>=s||p.paused?u?(u.next=f,u=f):(a=f,u=f,p.saturated()):(c++,o.call(e,f.value,f.worked))},drain:n,saturated:n,pause:function(){p.paused=!0},paused:!1,get concurrency(){return s},set concurrency(t){if(!(t>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(s=t,!p.paused)for(;a&&c<s;)c++,h()},running:function(){return c},resume:function(){if(!p.paused)return;if(p.paused=!1,null===a)return c++,void h();for(;a&&c<s;)c++,h()},idle:function(){return 0===c&&0===p.length()},length:function(){var t=a,e=0;for(;t;)t=t.next,e++;return e},getQueue:function(){var t=a,e=[];for(;t;)e.push(t.value),t=t.next;return e},unshift:function(t,r){var f=i.get();f.context=e,f.release=h,f.value=t,f.callback=r||n,f.errorHandler=l,c>=s||p.paused?a?(f.next=a,a=f):(a=f,u=f,p.saturated()):(c++,o.call(e,f.value,f.worked))},empty:n,kill:function(){a=null,u=null,p.drain=n},killAndDrain:function(){a=null,u=null,p.drain(),p.drain=n},error:function(t){l=t},abort:function(){var t=a;a=null,u=null;for(;t;){var e=t.next,r=t.callback,o=t.errorHandler,s=t.value,i=t.context;t.value=null,t.callback=n,t.errorHandler=null,o&&o(new Error("abort"),s),r.call(i,new Error("abort")),t.release(t),t=e}p.drain=n}};return p;function h(t){t&&i.release(t);var n=a;n&&c<=s?p.paused?c--:(u===a&&(u=null),a=n.next,n.next=null,o.call(e,n.value,n.worked),null===u&&p.empty()):0===--c&&p.drain()}}function n(){}function r(){this.value=null,this.callback=n,this.next=null,this.release=n,this.context=null,this.errorHandler=null;var t=this;this.worked=function(e,r){var o=t.callback,s=t.errorHandler,i=t.value;t.value=null,t.callback=n,t.errorHandler&&s(e,i),o.call(t.context,e,r),t.release(t)}}return Fe.exports=e,Fe.exports.promise=function(t,r,o){"function"==typeof t&&(o=r,r=t,t=null);var s=e(t,function(t,e){r.call(this,t).then(function(t){e(null,t)},e)},o),i=s.push,a=s.unshift;return s.push=function(t){var e=new Promise(function(e,n){i(t,function(t,r){t?n(t):e(r)})});return e.catch(n),e},s.unshift=function(t){var e=new Promise(function(e,n){a(t,function(t,r){t?n(t):e(r)})});return e.catch(n),e},s.drained=function(){return new Promise(function(t){process.nextTick(function(){if(s.idle())t();else{var e=s.drain;s.drain=function(){"function"==typeof e&&e(),t(),s.drain=e}}})})},s},Fe.exports}var Ne,Ie={};function Be(){if(Ne)return Ie;return Ne=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.joinPathSegments=Ie.replacePathSegmentSeparator=Ie.isAppliedFilter=Ie.isFatalError=void 0,Ie.isFatalError=function(t,e){return null===t.errorFilter||!t.errorFilter(e)},Ie.isAppliedFilter=function(t,e){return null===t||t(e)},Ie.replacePathSegmentSeparator=function(t,e){return t.split(/[/\\]/).join(e)},Ie.joinPathSegments=function(t,e,n){return""===t?e:t.endsWith(n)?t+e:t+n+e},Ie}var We,Ge,Ue,Ke={};function Ve(){if(We)return Ke;We=1,Object.defineProperty(Ke,"__esModule",{value:!0});const t=Be();return Ke.default=class{constructor(e,n){this._root=e,this._settings=n,this._root=t.replacePathSegmentSeparator(e,n.pathSegmentSeparator)}},Ke}function Qe(){if(Ge)return Vt;Ge=1,Object.defineProperty(Vt,"__esModule",{value:!0});const t=i,e=Me(),n=De(),r=Be(),o=Ve();class s extends o.default{constructor(r,o){super(r,o),this._settings=o,this._scandir=e.scandir,this._emitter=new t.EventEmitter,this._queue=n(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(t){this._emitter.on("entry",t)}onError(t){this._emitter.once("error",t)}onEnd(t){this._emitter.once("end",t)}_pushToQueue(t,e){const n={directory:t,base:e};this._queue.push(n,t=>{null!==t&&this._handleError(t)})}_worker(t,e){this._scandir(t.directory,this._settings.fsScandirSettings,(n,r)=>{if(null===n){for(const e of r)this._handleEntry(e,t.base);e(null,void 0)}else e(n,void 0)})}_handleError(t){!this._isDestroyed&&r.isFatalError(this._settings,t)&&(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",t))}_handleEntry(t,e){if(this._isDestroyed||this._isFatalError)return;const n=t.path;void 0!==e&&(t.path=r.joinPathSegments(e,t.name,this._settings.pathSegmentSeparator)),r.isAppliedFilter(this._settings.entryFilter,t)&&this._emitEntry(t),t.dirent.isDirectory()&&r.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(n,void 0===e?void 0:t.path)}_emitEntry(t){this._emitter.emit("entry",t)}}return Vt.default=s,Vt}var qe,ze={};var Xe,Ye,Ze={},Je={};function tn(){if(Ye)return Ze;Ye=1,Object.defineProperty(Ze,"__esModule",{value:!0});const t=function(){if(Xe)return Je;Xe=1,Object.defineProperty(Je,"__esModule",{value:!0});const t=Me(),e=Be(),n=Ve();class r extends n.default{constructor(){super(...arguments),this._scandir=t.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(t,e){this._queue.add({directory:t,base:e})}_handleQueue(){for(const t of this._queue.values())this._handleDirectory(t.directory,t.base)}_handleDirectory(t,e){try{const n=this._scandir(t,this._settings.fsScandirSettings);for(const t of n)this._handleEntry(t,e)}catch(t){this._handleError(t)}}_handleError(t){if(e.isFatalError(this._settings,t))throw t}_handleEntry(t,n){const r=t.path;void 0!==n&&(t.path=e.joinPathSegments(n,t.name,this._settings.pathSegmentSeparator)),e.isAppliedFilter(this._settings.entryFilter,t)&&this._pushToStorage(t),t.dirent.isDirectory()&&e.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(r,void 0===n?void 0:t.path)}_pushToStorage(t){this._storage.push(t)}}return Je.default=r,Je}();return Ze.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings)}read(){return this._reader.read()}},Ze}var en,nn,rn={};function on(){if(nn)return Ut;nn=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.Settings=Ut.walkStream=Ut.walkSync=Ut.walk=void 0;const t=function(){if(Ue)return Kt;Ue=1,Object.defineProperty(Kt,"__esModule",{value:!0});const t=Qe();return Kt.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings),this._storage=[]}read(t){this._reader.onError(e=>{!function(t,e){t(e)}(t,e)}),this._reader.onEntry(t=>{this._storage.push(t)}),this._reader.onEnd(()=>{!function(t,e){t(null,e)}(t,this._storage)}),this._reader.read()}},Kt}(),e=function(){if(qe)return ze;qe=1,Object.defineProperty(ze,"__esModule",{value:!0});const t=s,e=Qe();return ze.default=class{constructor(n,r){this._root=n,this._settings=r,this._reader=new e.default(this._root,this._settings),this._stream=new t.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(t=>{this._stream.emit("error",t)}),this._reader.onEntry(t=>{this._stream.push(t)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}},ze}(),n=tn(),o=function(){if(en)return rn;en=1,Object.defineProperty(rn,"__esModule",{value:!0});const t=r,e=Me();return rn.default=class{constructor(n={}){this._options=n,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,t.sep),this.fsScandirSettings=new e.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(t,e){return null!=t?t:e}},rn}();function i(t={}){return t instanceof o.default?t:new o.default(t)}return Ut.Settings=o.default,Ut.walk=function(e,n,r){"function"!=typeof n?new t.default(e,i(n)).read(r):new t.default(e,i()).read(n)},Ut.walkSync=function(t,e){const r=i(e);return new n.default(t,r).read()},Ut.walkStream=function(t,n){const r=i(n);return new e.default(t,r).read()},Ut}var sn,an={};function un(){if(sn)return an;sn=1,Object.defineProperty(an,"__esModule",{value:!0});const t=r,e=le(),n=It();return an.default=class{constructor(t){this._settings=t,this._fsStatSettings=new e.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return t.resolve(this._settings.cwd,e)}_makeEntry(t,e){const r={name:e,path:e,dirent:n.fs.createDirentFromStats(e,t)};return this._settings.stats&&(r.stats=t),r}_isFatalError(t){return!n.errno.isEnoentCodeError(t)&&!this._settings.suppressErrors}},an}var cn,ln,pn={};function hn(){if(cn)return pn;cn=1,Object.defineProperty(pn,"__esModule",{value:!0});const t=s,e=le(),n=on(),r=un();class o extends r.default{constructor(){super(...arguments),this._walkStream=n.walkStream,this._stat=e.stat}dynamic(t,e){return this._walkStream(t,e)}static(e,n){const r=e.map(this._getFullEntryPath,this),o=new t.PassThrough({objectMode:!0});o._write=(t,s,i)=>this._getEntry(r[t],e[t],n).then(e=>{null!==e&&n.entryFilter(e)&&o.push(e),t===r.length-1&&o.end(),i()}).catch(i);for(let t=0;t<r.length;t++)o.write(t);return o}_getEntry(t,e,n){return this._getStat(t).then(t=>this._makeEntry(t,e)).catch(t=>{if(n.errorFilter(t))return null;throw t})}_getStat(t){return new Promise((e,n)=>{this._stat(t,this._fsStatSettings,(t,r)=>null===t?e(r):n(t))})}}return pn.default=o,pn}var fn,dn,gn,mn={},yn={},_n={},Rn={};function bn(){if(dn)return _n;dn=1,Object.defineProperty(_n,"__esModule",{value:!0});const t=function(){if(fn)return Rn;fn=1,Object.defineProperty(Rn,"__esModule",{value:!0});const t=It();return Rn.default=class{constructor(t,e,n){this._patterns=t,this._settings=e,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(const t of this._patterns){const e=this._getPatternSegments(t),n=this._splitSegmentsIntoSections(e);this._storage.push({complete:n.length<=1,pattern:t,segments:e,sections:n})}}_getPatternSegments(e){return t.pattern.getPatternParts(e,this._micromatchOptions).map(e=>t.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:t.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e})}_splitSegmentsIntoSections(e){return t.array.splitWhen(e,e=>e.dynamic&&t.pattern.hasGlobStar(e.pattern))}},Rn}();class e extends t.default{match(t){const e=t.split("/"),n=e.length,r=this._storage.filter(t=>!t.complete||t.segments.length>n);for(const t of r){const r=t.sections[0];if(!t.complete&&n>r.length)return!0;if(e.every((e,n)=>{const r=t.segments[n];return!(!r.dynamic||!r.patternRe.test(e))||!r.dynamic&&r.pattern===e}))return!0}return!1}}return _n.default=e,_n}var Sn,Pn={};var vn,En={};var An,xn,Cn,On={};function wn(){if(xn)return mn;xn=1,Object.defineProperty(mn,"__esModule",{value:!0});const t=r,e=function(){if(gn)return yn;gn=1,Object.defineProperty(yn,"__esModule",{value:!0});const t=It(),e=bn();return yn.default=class{constructor(t,e){this._settings=t,this._micromatchOptions=e}getFilter(t,e,n){const r=this._getMatcher(e),o=this._getNegativePatternsRe(n);return e=>this._filter(t,e,r,o)}_getMatcher(t){return new e.default(t,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){const n=e.filter(t.pattern.isAffectDepthOfReadingPattern);return t.pattern.convertPatternsToRe(n,this._micromatchOptions)}_filter(e,n,r,o){if(this._isSkippedByDeep(e,n.path))return!1;if(this._isSkippedSymbolicLink(n))return!1;const s=t.path.removeLeadingDotSegment(n.path);return!this._isSkippedByPositivePatterns(s,r)&&this._isSkippedByNegativePatterns(s,o)}_isSkippedByDeep(t,e){return this._settings.deep!==1/0&&this._getEntryLevel(t,e)>=this._settings.deep}_getEntryLevel(t,e){const n=e.split("/").length;return""===t?n:n-t.split("/").length}_isSkippedSymbolicLink(t){return!this._settings.followSymbolicLinks&&t.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(t,e){return!this._settings.baseNameMatch&&!e.match(t)}_isSkippedByNegativePatterns(e,n){return!t.pattern.matchAny(e,n)}},yn}(),n=function(){if(Sn)return Pn;Sn=1,Object.defineProperty(Pn,"__esModule",{value:!0});const t=It();return Pn.default=class{constructor(t,e){this._settings=t,this._micromatchOptions=e,this.index=new Map}getFilter(e,n){const[r,o]=t.pattern.partitionAbsoluteAndRelative(n),s={positive:{all:t.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:t.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:t.pattern.convertPatternsToRe(o,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return t=>this._filter(t,s)}_filter(e,n){const r=t.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(r))return!1;if(this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;const o=this._isMatchToPatternsSet(r,n,e.dirent.isDirectory());return this._settings.unique&&o&&this._createIndexRecord(r),o}_isDuplicateEntry(t){return this.index.has(t)}_createIndexRecord(t){this.index.set(t,void 0)}_onlyFileFilter(t){return this._settings.onlyFiles&&!t.dirent.isFile()}_onlyDirectoryFilter(t){return this._settings.onlyDirectories&&!t.dirent.isDirectory()}_isMatchToPatternsSet(t,e,n){return!!this._isMatchToPatterns(t,e.positive.all,n)&&(!this._isMatchToPatterns(t,e.negative.relative,n)&&!this._isMatchToAbsoluteNegative(t,e.negative.absolute,n))}_isMatchToAbsoluteNegative(e,n,r){if(0===n.length)return!1;const o=t.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(o,n,r)}_isMatchToPatterns(e,n,r){if(0===n.length)return!1;const o=t.pattern.matchAny(e,n);return!o&&r?t.pattern.matchAny(e+"/",n):o}},Pn}(),o=function(){if(vn)return En;vn=1,Object.defineProperty(En,"__esModule",{value:!0});const t=It();return En.default=class{constructor(t){this._settings=t}getFilter(){return t=>this._isNonFatalError(t)}_isNonFatalError(e){return t.errno.isEnoentCodeError(e)||this._settings.suppressErrors}},En}(),s=function(){if(An)return On;An=1,Object.defineProperty(On,"__esModule",{value:!0});const t=It();return On.default=class{constructor(t){this._settings=t}getTransformer(){return t=>this._transform(t)}_transform(e){let n=e.path;return this._settings.absolute&&(n=t.path.makeAbsolute(this._settings.cwd,n),n=t.path.unixify(n)),this._settings.markDirectories&&e.dirent.isDirectory()&&(n+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:n}):n}},On}();return mn.default=class{constructor(t){this._settings=t,this.errorFilter=new o.default(this._settings),this.entryFilter=new n.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new e.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new s.default(this._settings)}_getRootDirectory(e){return t.resolve(this._settings.cwd,e.base)}_getReaderOptions(t){const e="."===t.base?"":t.base;return{basePath:e,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(e,t.positive,t.negative),entryFilter:this.entryFilter.getFilter(t.positive,t.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}},mn}function $n(){if(Cn)return Wt;Cn=1,Object.defineProperty(Wt,"__esModule",{value:!0});const t=function(){if(ln)return Gt;ln=1,Object.defineProperty(Gt,"__esModule",{value:!0});const t=on(),e=un(),n=hn();class r extends e.default{constructor(){super(...arguments),this._walkAsync=t.walk,this._readerStream=new n.default(this._settings)}dynamic(t,e){return new Promise((n,r)=>{this._walkAsync(t,e,(t,e)=>{null===t?n(e):r(t)})})}async static(t,e){const n=[],r=this._readerStream.static(t,e);return new Promise((t,e)=>{r.once("error",e),r.on("data",t=>n.push(t)),r.once("end",()=>t(n))})}}return Gt.default=r,Gt}(),e=wn();class n extends e.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}async read(t){const e=this._getRootDirectory(t),n=this._getReaderOptions(t);return(await this.api(e,t,n)).map(t=>n.transform(t))}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return Wt.default=n,Wt}var Tn,kn={};var Mn,Ln,jn={},Hn={};function Fn(){if(Ln)return jn;Ln=1,Object.defineProperty(jn,"__esModule",{value:!0});const t=function(){if(Mn)return Hn;Mn=1,Object.defineProperty(Hn,"__esModule",{value:!0});const t=le(),e=on(),n=un();class r extends n.default{constructor(){super(...arguments),this._walkSync=e.walkSync,this._statSync=t.statSync}dynamic(t,e){return this._walkSync(t,e)}static(t,e){const n=[];for(const r of t){const t=this._getFullEntryPath(r),o=this._getEntry(t,r,e);null!==o&&e.entryFilter(o)&&n.push(o)}return n}_getEntry(t,e,n){try{const n=this._getStat(t);return this._makeEntry(n,e)}catch(t){if(n.errorFilter(t))return null;throw t}}_getStat(t){return this._statSync(t,this._fsStatSettings)}}return Hn.default=r,Hn}(),e=wn();class n extends e.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}read(t){const e=this._getRootDirectory(t),n=this._getReaderOptions(t);return this.api(e,t,n).map(n.transform)}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return jn.default=n,jn}var Dn,Nn,In,Bn={};var Wn=function(){if(In)return Nn;In=1;const t=function(){if(Ft)return g;Ft=1,Object.defineProperty(g,"__esModule",{value:!0}),g.convertPatternGroupToTask=g.convertPatternGroupsToTasks=g.groupPatternsByBaseDirectory=g.getNegativePatternsAsPositive=g.getPositivePatterns=g.convertPatternsToTasks=g.generate=void 0;const t=It();function e(e,n){let r=e;return n.braceExpansion&&(r=t.pattern.expandPatternsWithBraceExpansion(r)),n.baseNameMatch&&(r=r.map(t=>t.includes("/")?t:`**/${t}`)),r.map(e=>t.pattern.removeDuplicateSlashes(e))}function n(e,n,r){const o=[],u=t.pattern.getPatternsOutsideCurrentDirectory(e),c=t.pattern.getPatternsInsideCurrentDirectory(e),l=s(u),p=s(c);return o.push(...i(l,n,r)),"."in p?o.push(a(".",c,n,r)):o.push(...i(p,n,r)),o}function r(e){return t.pattern.getPositivePatterns(e)}function o(e,n){return t.pattern.getNegativePatterns(e).concat(n).map(t.pattern.convertToPositivePattern)}function s(e){return e.reduce((e,n)=>{const r=t.pattern.getBaseDirectory(n);return r in e?e[r].push(n):e[r]=[n],e},{})}function i(t,e,n){return Object.keys(t).map(r=>a(r,t[r],e,n))}function a(e,n,r,o){return{dynamic:o,positive:n,negative:r,base:e,patterns:[].concat(n,r.map(t.pattern.convertToNegativePattern))}}return g.generate=function(s,i){const a=e(s,i),u=e(i.ignore,i),c=r(a),l=o(a,u),p=c.filter(e=>t.pattern.isStaticPattern(e,i)),h=c.filter(e=>t.pattern.isDynamicPattern(e,i)),f=n(p,l,!1),d=n(h,l,!0);return f.concat(d)},g.convertPatternsToTasks=n,g.getPositivePatterns=r,g.getNegativePatternsAsPositive=o,g.groupPatternsByBaseDirectory=s,g.convertPatternGroupsToTasks=i,g.convertPatternGroupToTask=a,g}(),e=$n(),r=function(){if(Tn)return kn;Tn=1,Object.defineProperty(kn,"__esModule",{value:!0});const t=s,e=hn(),n=wn();class r extends n.default{constructor(){super(...arguments),this._reader=new e.default(this._settings)}read(e){const n=this._getRootDirectory(e),r=this._getReaderOptions(e),o=this.api(n,e,r),s=new t.Readable({objectMode:!0,read:()=>{}});return o.once("error",t=>s.emit("error",t)).on("data",t=>s.emit("data",r.transform(t))).once("end",()=>s.emit("end")),s.once("close",()=>o.destroy()),s}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return kn.default=r,kn}(),o=Fn(),i=(Dn||(Dn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;const e=a,r=n,o=Math.max(r.cpus().length,1);t.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:e.lstat,lstatSync:e.lstatSync,stat:e.stat,statSync:e.statSync,readdir:e.readdir,readdirSync:e.readdirSync},t.default=class{constructor(t={}){this._options=t,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,o),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(t,e){return void 0===t?e:t}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},t.DEFAULT_FILE_SYSTEM_ADAPTER),e)}}}(Bn)),Bn),u=It();async function c(t,n){p(t);const r=l(t,e.default,n),o=await Promise.all(r);return u.array.flatten(o)}function l(e,n,r){const o=[].concat(e),s=new i.default(r),a=t.generate(o,s),u=new n(s);return a.map(u.read,u)}function p(t){if(![].concat(t).every(t=>u.string.isString(t)&&!u.string.isEmpty(t)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}return function(e){function n(t,e){p(t);const n=l(t,o.default,e);return u.array.flatten(n)}function s(t,e){p(t);const n=l(t,r.default,e);return u.stream.merge(n)}var a,c;e.glob=e,e.globSync=n,e.globStream=s,e.async=e,e.sync=n,e.stream=s,e.generateTasks=function(e,n){p(e);const r=[].concat(e),o=new i.default(n);return t.generate(r,o)},e.isDynamicPattern=function(t,e){p(t);const n=new i.default(e);return u.pattern.isDynamicPattern(t,n)},e.escapePath=function(t){return p(t),u.path.escape(t)},e.convertPathToPattern=function(t){return p(t),u.path.convertPathToPattern(t)},(a=e.posix||(e.posix={})).escapePath=function(t){return p(t),u.path.escapePosixPath(t)},a.convertPathToPattern=function(t){return p(t),u.path.convertPosixPathToPattern(t)},(c=e.win32||(e.win32={})).escapePath=function(t){return p(t),u.path.escapeWindowsPath(t)},c.convertPathToPattern=function(t){return p(t),u.path.convertWindowsPathToPattern(t)}}(c||(c={})),Nn=c}(),Gn=f(Wn);const Un={"/home":"/","/root":"/"},Kn=(t,e)=>{const n=t.split("/"),r=n[n.length-1];return r.endsWith(e)?r.slice(0,-e.length):r},Vn=t=>{const e=Un[t];if(e)return e;return"/notfound"===t.toLowerCase()||"/404"===t?"/*":t},Qn=t=>{if(t.endsWith(".config.ts")){return"index"===Kn(t,".config.ts")?t.replace("index.config.ts","index.ts"):t.slice(0,-10)+".tsx"}return t.replace("index.config.ts","index.ts")},qn=t=>{if(t.endsWith(".config.ts")){const e=Kn(t,".config.ts"),n=(t=>{const e=t.split("/");return e.pop(),e.join("/")})(t).replace("/src/pages","");return"index"===e?n||"/":n?`${n}/${e}`:`/${e}`}return t.replace("/src/pages","").replace("/index.config.ts","")||"/"},zn=async(t,e)=>{const n=[];for(const[r,o]of((t,e)=>Object.keys(t).map(t=>{const n=(r=t).endsWith(".tsx")?r.slice(0,-4)+".config.ts":r.replace("index.ts","index.config.ts");var r;return[n,e[n]||{}]}))(t,e)){const e=Qn(r);if(!t[e])continue;const s=o?.path||qn(r)||"/",i=Or(s),a=Vn(i);n.push({...o,path:a,type:o?.type,isRoot:"/root"===i,element:t[e]})}return n},Xn=t=>{if(t.index)return t;if("wrap"!==t.type){const{path:e,children:n,...r}=t;if(Object.keys(r).length>0){return{path:e,children:[{path:"",index:!0,...r},...(n||[]).map(Xn)]}}}return t.children?{...t,children:t.children.map(Xn)}:t},Yn=t=>{const e=(t=>{const e=new Map,n=[],r=new Map,o=t=>{let e=r.get(t);return void 0===e&&(e="/"===t?[]:t.split("/").filter(Boolean),r.set(t,e)),e},s=t.slice().sort((t,e)=>t.path.length-e.path.length);for(const t of s){const r=t.path,s=o(r),i={...t,children:[]};if(e.set(r,i),s.length<=1){n.push(i);continue}const a="/"+s.slice(0,-1).join("/"),u=e.get(a);u?(i.path=s[s.length-1],u.children.push(i)):n.push(i)}return n})(t);return(t=>t.map(Xn))(e)},Zn=t=>{const{isRoot:e,type:n,children:r,...o}=t;return r?.length?{...o,children:r.map(Zn)}:o},Jn=t=>{const{children:e}=t;if(!e?.length){const{children:e,...n}=t;return n}const n=e.map(Jn);if("wrap"===t.type)return{...t,children:n};const{path:r,element:o,type:s,children:i,...a}=t;return o?{path:r,children:[{index:!0,element:o,...a},...n]}:{path:r,...a,children:n}},tr=t=>Zn(Jn(t)),er=t=>Yn(t).map(tr),nr=t=>{if(t.some(t=>t.isRoot))return(t=>{let e,n,r;const o=[];for(const s of t)if(s.isRoot){if(e)throw new Error("There cannot be multiple root routes in a route");e=s}else"/"===s.path?n=s:"/*"===s.path?r=s:o.push(s);if(Ar(o,"path"))throw new Error("There cannot be duplicate paths in a route");const s=[n&&{...n,index:!0},...er(o)].filter(t=>Boolean(t)),i=[];return e&&i.push(Zn({...e,children:s})),r&&i.push(Zn(r)),i})(t);if(Ar(t,"path"))throw new Error("There cannot be duplicate paths in a route");return er(t)},rr=(t,e)=>({import:`import ${t} from './${e}'`,component:`<start><${t} /></end>`,lazy:`const ${t} = lazy(() => import('${e}'))`,lazyComponent:`<start><Suspense><${t} /></Suspense></end>`});const or=/[/\\]/,sr=/[^a-zA-Z0-9]/g,ir=/^(\d)/,ar="index.tsx",ur=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";function cr(e){const n=t.extname(e),r=t.basename(e,n),o=t.dirname(e).split(or).filter(Boolean);"index"!==r&&"Index"!==r&&o.push(r);return o.map(t=>{const e=(t=>t.replace(sr,"_").replace(ir,"_$1"))(t);return e.split("_").map(ur).join("")}).join("")||"Component"}const lr=(t,e,n,r,o,s)=>{const i=(t=>t.includes(ar)?t.replace(ar,"index.ts"):t)(Pr(t,e)),a=Sr(Rr(n,t)),u=((t,e)=>{if(!e.has(t))return e.add(t),t;let n=1;for(;e.has(`${t}_${n}`);)n++;return`${t}_${n}`})(cr(a),s),c=`element(${a})`;r[`/${i}`]=c,o.set(c,{path:a,componentName:u})},pr=(t,e,n,r)=>{const o=Pr(t,e);n[`/${o}`]=((t,e,n)=>{const r={};for(const[o,s]of Object.entries(e))if("function"==typeof s){const e=`${t}-${o}`;r[o]=e,n.set(e,`<start>${u(s.toString())}</end>`)}else r[o]=s;return r})(o,_r(t),r)};function hr(t,e,n,r,o,s,i,a){const u={},c=t.replace(/^\/+/,""),l=Gn.sync(c,{cwd:e,absolute:!0,onlyFiles:!0}).filter(Er);for(const t of l)if("module"===o){if(t.includes(".config."))continue;lr(t,n,r,u,s,i)}else pr(t,n,u,a);return u}const fr=async(n,r,o,s,i)=>{const a=t.resolve(r,n);if(!e.existsSync(a))throw new Error(`[ono-auto-router] Pages directory does not exist: ${a}`);const u=new Map,c=new Set,l=new Map,p=hr("/**/*.{jsx,tsx}",a,r,o,"module",u,c,l),h=hr("/**/*.config.{js,ts,jsx,tsx}",a,r,o,"config",u,c,l),f=await zn(p,h),d=((t,e,n,r)=>{let o=t;for(const[t,n]of e){const e=rr(n.componentName,n.path);o=o.replace(t,r?e.lazyComponent:e.component)}for(const[t,e]of n)o=o.replace(t,e);return Cr(o)})(function(t,e,n,r){const o=n.length>0?`\n${n.join("\n")}\n`:"";return`// Auto-generated by ono-auto-router\n${r?"import type { RouteObject } from 'react-router-dom'":""}\n${e.join("\n")}\n${r?"\ntype PageConfig = Partial<\n Omit<RouteObject, 'path' | 'Component' | 'element' | 'children'> & {\n path: string\n type?: 'single' | 'wrap'\n }\n>\n":""}${r?"\nexport const defineConfig = (config: PageConfig) => config":""}\n${o}\nexport const routes${r?": RouteObject[]":""} = ${JSON.stringify(t,null,2)}\n`}(nr(f),((t,e)=>{if(t)return["import { lazy, Suspense } from 'react'"];const n=[];for(const t of e.values())n.push(rr(t.componentName,t.path).import);return n})(s,u),((t,e)=>{if(!t)return[];const n=[];for(const t of e.values())n.push(rr(t.componentName,t.path).lazy);return n})(s,u),i),u,l,s);Tr(o,d)},dr=(n,r,o,s)=>{const i=t.resolve(r,n);if(!e.existsSync(i))throw new Error(`[ono-auto-router] Pages directory does not exist: ${i}`);const a=o.split(".")[0],u=(t=>`// Auto-generated by ono-auto-router${t?"\nexport { defineConfig } from './defineConfig'":""}\nexport { routes } from './getRoutes'\n`)(s),c=((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport type { RouteRecordRaw } from 'vue-router'":""}\nimport { buildRouteTree } from './buildRouteTree'\nimport { cleanIsRoot } from './cleanIsRoot'\nimport { removeEmptyChildren } from './removeEmptyChildren'${e?"\nimport type { MyRouteObject, PageConfig, PagesComponentType } from './types'":""}\nimport { hasDuplicateProperty, replaceBracketsWithColon } from './utils'\n\nconst pathCache = new Map${e?"<string, { compPath: string; basePath: string }>":""}()\nconst basenameCache = new Map${e?"<string, string>":""}()\n\nconst normalizePagePath = ${e?"(key: string): string":"(key)"} => {\n if (key.includes('index.vue')) return key.replace('index.vue', 'index.ts')\n if (key.includes('root.vue')) return key.replace('root.vue', 'root/index.ts')\n if (key.includes('404.vue')) return key.replace('404.vue', '404/index.ts')\n if (key.toLowerCase().includes('notfound.vue'))\n return key.toLowerCase().replace('notfound.vue', 'notfound/index.ts')\n return key\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath)"} => {\n const cacheKey = ext ? filePath + ':' + ext : filePath\n if (basenameCache.has(cacheKey)) {\n return basenameCache.get(cacheKey)!\n }\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1] || ''\n let result = lastPart\n if (ext && lastPart.endsWith(ext)) {\n result = lastPart.slice(0, -ext.length)\n }\n basenameCache.set(cacheKey, result)\n return result\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getPathsFromConfig = ${e?"(configPath: string)":"(configPath)"} => {\n const cacheKey = configPath\n if (pathCache.has(cacheKey)) {\n return pathCache.get(cacheKey)!\n }\n\n let compPath: string\n let basePath: string\n\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n\n if (fileName === 'index') {\n compPath = configPath.replace('index.config.ts', 'index.ts')\n basePath = dirPath || '/'\n } else {\n compPath = configPath.slice(0, -10) + '.vue'\n basePath = dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n } else {\n compPath = configPath.replace('index.config.ts', 'index.ts')\n basePath =\n configPath.replace('/${t}', '').replace('/index.config.ts', '') ||\n '/'\n }\n\n const result = { compPath, basePath }\n pathCache.set(cacheKey, result)\n return result\n}\n\nconst formatPath = ${e?"(path: string): string":"(path)"} => {\n const lowerPath = path.toLowerCase()\n if (lowerPath === '/home') return '/'\n if (lowerPath === '/notfound' || path === '/404') return '/:pathMatch(.*)*'\n return path.replace('/index.ts', '') || '/'\n}\n\nconst getConfigFileName = ${e?"(pagePath: string): string":"(pagePath)"} => {\n if (pagePath.endsWith('.vue')) {\n return pagePath.slice(0, -4) + '.config.ts'\n }\n return pagePath.replace('index.ts', 'index.config.ts')\n}\n\nconst createBaseRoutes = ()${e?": MyRouteObject[]":""} => {\n const pagesComponent = Object.fromEntries(\n Object.entries({\n ...import.meta.glob('/${t}/**/index.vue'),\n ...import.meta.glob('/${t}/*.vue')\n }${e?" as PagesComponentType":""}).map(([key, value]) => [\n normalizePagePath(key),\n value\n ])\n )\n\n const pagesModule${e?": Record<string, PageConfig>":""} = import.meta.glob(\n '/${t}/**/*.config.ts',\n { eager: true, import: 'default' }\n )\n\n const result${e?": MyRouteObject[]":""} = []\n\n for (const pagePath of Object.keys(pagesComponent)) {\n const configPath = getConfigFileName(pagePath)\n const content = pagesModule[configPath] || {}\n const { compPath, basePath } = getPathsFromConfig(configPath)\n const path = replaceBracketsWithColon(content?.path || basePath || '/')\n const name = path.split('/').filter(Boolean).join('-') || 'index'\n\n result.push({\n path: formatPath(path),\n name,\n component: pagesComponent[compPath],\n isRoot: path === '/root',\n ...content!\n })\n }\n\n return result\n}\n\nconst processRoutes = ${e?"(\n routes: MyRouteObject[],\n removeLeadingSlash = false\n): MyRouteObject[]":"(routes, removeLeadingSlash)"} =>\n buildRouteTree(routes, removeLeadingSlash)\n .map(removeEmptyChildren)\n .map(cleanIsRoot)\n\nconst handleRootRoute = (\n routes${e?": (MyRouteObject & { isRoot?: boolean })[]":""}\n): MyRouteObject[] => {\n let rootRoute${e?": (MyRouteObject & { isRoot?: boolean }) | undefined":" = undefined"}\n let homeRoute${e?": MyRouteObject | undefined":" = undefined"}\n let notFoundRoute${e?": MyRouteObject | undefined":" = undefined"}\n const filteredRoutes${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const route of routes) {\n if (route.isRoot) {\n if (rootRoute)\n throw new Error('There cannot be multiple root routes in a route')\n rootRoute = route\n } else if (route.path === '/') {\n homeRoute = route\n } else if (route.path === '/:pathMatch(.*)*') {\n notFoundRoute = route\n } else {\n filteredRoutes.push(route)\n }\n }\n\n if (hasDuplicateProperty(filteredRoutes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n const processedRoutes${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n if (rootRoute) {\n const children = [\n homeRoute && { ...homeRoute, path: '' },\n ...processRoutes(filteredRoutes, true)\n ].filter(Boolean)${e?" as MyRouteObject[]":""}\n processedRoutes.push({ ...rootRoute, path: '/', children })\n }\n\n if (notFoundRoute) processedRoutes.push(notFoundRoute)\n\n return processedRoutes.map(cleanIsRoot)\n}\n\nexport const createRoutes = ()${e?": RouteRecordRaw[]":""} => {\n const routes = createBaseRoutes()\n\n if (routes.some((r${e?": MyRouteObject & { isRoot?: boolean }":""}) => r.isRoot))\n return handleRootRoute(routes)${e?" as RouteRecordRaw[]":""}\n\n if (hasDuplicateProperty(routes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n return processRoutes(routes)${e?" as RouteRecordRaw[]":""}\n}\n`)(n,s),l=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const buildRouteTree = ${t?"(\n routes: MyRouteObject[],\n removeLeadingSlash: boolean = false\n)":"(routes, removeLeadingSlash)"} => {\n const routeMap = new Map<string, MyRouteObject & { isRoot?: boolean }>()\n const rootRoutes${t?": MyRouteObject[]":""} = []\n\n const sortedRoutes = [...routes].sort((a, b) => a.path.length - b.path.length)\n\n for (const route of sortedRoutes) {\n let path = route.path\n if (removeLeadingSlash && path.startsWith('/')) {\n path = path.slice(1)\n }\n routeMap.set(path, { ...route, path, children: [] })\n }\n\n for (const [path, route] of routeMap) {\n const slashIndex = path.lastIndexOf('/')\n\n if (slashIndex <= 0) {\n const { isRoot, ...rest } = route\n rootRoutes.push(rest)\n continue\n }\n\n const parentPath = path.slice(0, slashIndex)\n const parentRoute = routeMap.get(parentPath)\n\n if (parentRoute) {\n const relativePath = path.slice(slashIndex + 1)\n const childRoute = { ...route, path: relativePath }\n parentRoute.children!.push(childRoute)\n } else {\n const { isRoot, ...rest } = route\n rootRoutes.push(rest)\n }\n }\n\n return rootRoutes\n}\n`)(s),p=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const cleanIsRoot = ${t?"(\n route: MyRouteObject & { isRoot?: boolean }\n): MyRouteObject":"(route)"} => {\n const { isRoot, type, children, ...rest } = route\n const result${t?": MyRouteObject":""} = { ...rest }\n\n if (children?.length) {\n result.children = children.map(cleanIsRoot)\n }\n\n return result\n}\n`)(s),h=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const removeEmptyChildren = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n if (!route.children?.length) {\n const { children, ...rest } = route\n return rest\n }\n\n const hasIndexRoute = route.children.some(\n child => child.path === '' || child.path === '/'\n )\n\n const routeType = route.type || 'single'\n\n if (routeType === 'wrap') {\n const { children, ...rest } = route\n return { ...rest, children: children.map(removeEmptyChildren) }\n }\n\n if (routeType === 'single' || (!hasIndexRoute && route.component)) {\n const { path, component, type, ...rest } = route\n return {\n path,\n children: [\n { path: '', component, ...rest } as MyRouteObject,\n ...route.children.map(removeEmptyChildren)\n ]\n }\n }\n\n if (hasIndexRoute) {\n const { path, ...rest } = route\n const updatedChildren = route.children.map(child =>\n child.path === '' || child.path === '/' ? { ...rest, ...child } : child\n )\n return { path, children: updatedChildren.map(removeEmptyChildren) }\n }\n\n return { ...route, children: route.children.map(removeEmptyChildren) }\n}\n`)(s),f=s?"// Auto-generated by ono-auto-router\nimport type { PageConfig } from './types'\n\nexport const defineConfig = (config: PageConfig) => config\n":"",d=s?"// Auto-generated by ono-auto-router\nimport type { RouteRecordRaw } from 'vue-router'\n\nexport type PagesComponentType = Record<string, () => Promise<unknown>>\n\nexport interface MyRouteObject extends Omit<RouteRecordRaw, 'children'> {\n type?: 'single' | 'wrap'\n isRoot?: boolean\n children?: MyRouteObject[]\n}\n\nexport type PageConfig = Partial<Omit<MyRouteObject, 'component' | 'children' | 'isRoot'>>\n":"",g=(t=>`// Auto-generated by ono-auto-router\nconst hasDuplicateProperty = ${t?"<T>(items: T[], propName: keyof T)":"(items, propName)"} => {\n const seenValues = new Set()\n return items.some(item => {\n if (seenValues.has(item[propName])) {\n return true\n }\n seenValues.add(item[propName])\n return false\n })\n}\n\nconst replaceBracketsWithColon = ${t?"(str: string)":"(str)"} => {\n return str.replace(/\\[([^\\]]+)\\]/g, ':$1').replace('.tsx', '')\n}\n\nexport { hasDuplicateProperty, replaceBracketsWithColon }\n`)(s);Tr(t.resolve(a,"./index.ts"),u),Tr(t.resolve(a,"./createRoutes.tsx"),c),Tr(t.resolve(a,"./buildRouteTree.ts"),l),Tr(t.resolve(a,"./cleanIsRoot.ts"),p),Tr(t.resolve(a,"./removeEmptyChildren.ts"),h),f&&Tr(t.resolve(a,"./defineConfig.ts"),f),d&&Tr(t.resolve(a,"./types.ts"),d),Tr(t.resolve(a,"./getRoutes.ts"),"// Auto-generated by ono-auto-router\nimport { createRoutes } from './createRoutes'\n\nexport const routes = createRoutes()\n"),Tr(t.resolve(a,"./utils.ts"),g)},gr=t=>{try{if(!e.existsSync(t))return;e.unlinkSync(t)}catch(t){console.error("删除文件失败:",t)}},mr=t=>{try{if(!e.existsSync(t))return;e.rmSync(t,{recursive:!0})}catch(t){console.error("删除目录失败:",t)}},yr=(n,r,o,s,i,a)=>{const u=c(o),l=s.split(".")[0];gr(l+".js"),gr(l+".ts"),gr(l+".jsx"),gr(l+".tsx"),mr(l),"react"===n?a?((n,r,o,s,i)=>{const a=t.resolve(r,n);if(!e.existsSync(a))throw new Error(`[ono-auto-router] Pages directory does not exist: ${a}`);const u=o.split(".")[0],c=(t=>`// Auto-generated by ono-auto-router${t?"\nexport { defineConfig } from './defineConfig'":""}\nexport { routes } from './getRoutes'\n`)(i),l=s?((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport {\n lazy,\n Suspense,\n type ComponentType,\n type JSX,\n type LazyExoticComponent\n} from 'react'\nimport type { RouteObject } from 'react-router'\nimport { replaceBracketsWithColon } from './utils'\nimport type { PagesComponentType } from './types'\n\ninterface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport interface PageConfig extends Partial<Omit<MyRouteObject, 'children'>> {\n loading?: JSX.Element | true\n}\n":"\nimport { replaceBracketsWithColon } from './utils'\n"}\nconst PATH_REPLACEMENTS${e?": Record<string, string>":""} = {\n '/home': '/',\n '/root': '/'\n}\n\nconst cachedLazyComponents${e?": Record<\n string,\n LazyExoticComponent<ComponentType<unknown>>\n>":""} = {}\n\nconst getConfigFileName = (pagePath: string): string => {\n if (pagePath.endsWith('.tsx')) {\n return pagePath.slice(0, -4) + '.config.ts'\n }\n return pagePath.replace('index.ts', 'index.config.ts')\n}\n\nconst formatPageModule = (${e?"\n pagesComponent: Record<string, ComponentType<unknown>>,\n pagesModule: Record<string, PageConfig>\n":"pagesComponent, pagesModule"})${e?": [string, PageConfig][]":""} => {\n return Object.keys(pagesComponent).map(page => {\n const configKey = getConfigFileName(page)\n return [configKey, pagesModule[configKey] || {}]\n })\n}\n\nconst normalizePath = ${e?"(pathStr: string): string":"(pathStr)"} => {\n if (PATH_REPLACEMENTS[pathStr]) {\n return PATH_REPLACEMENTS[pathStr]\n }\n\n const lowerPath = pathStr.toLowerCase()\n if (lowerPath === '/notfound' || pathStr === '/404') {\n return '/*'\n }\n\n return pathStr\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath, ext)"} => {\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1]\n if (ext && lastPart.endsWith(ext)) {\n return lastPart.slice(0, -ext.length)\n }\n return lastPart\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getCompPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n if (fileName === 'index') {\n return configPath.replace('index.config.ts', 'index.tsx')\n }\n return configPath.slice(0, -10) + '.tsx'\n }\n return configPath.replace('index.config.ts', 'index.tsx')\n}\n\nconst getRawPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n if (fileName === 'index') {\n return dirPath || '/'\n }\n return dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n return (\n configPath.replace('/${t}', '').replace('/index.config.ts', '') || '/'\n )\n}\n\nconst getFileDefault = ${e?"(modules: Record<string, { default: unknown }>)":"(modules)"} => {\n const result${e?": Record<string, unknown>":""} = {}\n\n for (const [path, module] of Object.entries(modules)) {\n if ('default' in module) {\n result[path] = module.default\n }\n }\n\n return result\n}\n\nconst filterUnComponent = ${e?"(pagesComponent: PagesComponentType)":"(pagesComponent)"} => {\n const result: PagesComponentType = {}\n\n for (const key of Object.keys(pagesComponent)) {\n if (!key.includes('.config.tsx')) {\n result[key] = pagesComponent[key]\n }\n }\n\n return result\n}\n\nconst LazyComponent = ({\n Element\n}:${e?" {\n Element: LazyExoticComponent<ComponentType<unknown>>\n}":""}) => {\n return (\n <Suspense>\n <Element />\n </Suspense>\n )\n}\n\nexport const createBaseRoutes = () => {\n const pagesComponent = filterUnComponent({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}')${e?" as PagesComponentType":""}\n })\n\n const pagesString = getFileDefault({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}', {\n eager: true\n })\n })${e?" as Record<string, ComponentType<unknown>>":""}\n\n const pagesModule = getFileDefault({\n ...import.meta.glob('/${t}/**/*.config.${e?"ts":"js"}', {\n eager: true\n })\n })${e?" as Record<string, PageConfig>":""}\n\n const result${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const [pagePath, page] of formatPageModule(pagesString, pagesModule)) {\n const compPath = getCompPathFromConfig(pagePath)\n\n if (!pagesComponent[compPath]) continue\n\n const rawPath = page?.path || getRawPathFromConfig(pagePath) || '/'\n const processedPath = replaceBracketsWithColon(rawPath)\n const routePath = normalizePath(processedPath)\n\n let Component: MyRouteObject['element']\n if (page?.element) {\n Component = page.element\n } else {\n if (!cachedLazyComponents[compPath]) {\n cachedLazyComponents[compPath] = lazy(pagesComponent[compPath])\n }\n\n Component = <LazyComponent Element={cachedLazyComponents[compPath]} />\n }\n result.push({\n ...page,\n path: routePath,\n type: page?.type,\n isRoot: processedPath === '/root',\n element: Component\n })\n }\n\n return result\n}\n`)(n,i):((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport type { ComponentType, JSX } from 'react'\nimport type { RouteObject } from 'react-router'\nimport { replaceBracketsWithColon } from './utils'\nimport type { PagesComponentType } from './types'\n\ninterface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport interface PageConfig extends Partial<Omit<MyRouteObject, 'children'>> {\n loading?: JSX.Element | true\n}\n":"\nimport { replaceBracketsWithColon } from './utils'\n"}\nconst PATH_REPLACEMENTS${e?": Record<string, string>":""} = {\n '/home': '/',\n '/root': '/'\n}\n\nconst getConfigFileName = (pagePath: string): string => {\n if (pagePath.endsWith('.tsx')) {\n return pagePath.slice(0, -4) + '.config.ts'\n }\n return pagePath.replace('index.ts', 'index.config.ts')\n}\n\nconst formatPageModule = (${e?"\n pagesComponent: PagesComponentType,\n pagesModule: Record<string, PageConfig>\n":"pagesComponent, pagesModule"})${e?": [string, PageConfig][]":""} => {\n return Object.keys(pagesComponent).map(page => {\n const configKey = getConfigFileName(page)\n return [configKey, pagesModule[configKey] || {}]\n })\n}\n\nconst normalizePath = ${e?"(pathStr: string): string":"(pathStr)"} => {\n if (PATH_REPLACEMENTS[pathStr]) {\n return PATH_REPLACEMENTS[pathStr]\n }\n\n const lowerPath = pathStr.toLowerCase()\n if (lowerPath === '/notfound' || pathStr === '/404') {\n return '/*'\n }\n\n return pathStr\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath, ext)"} => {\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1]\n if (ext && lastPart.endsWith(ext)) {\n return lastPart.slice(0, -ext.length)\n }\n return lastPart\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getCompPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n if (fileName === 'index') {\n return configPath.replace('index.config.ts', 'index.tsx')\n }\n return configPath.slice(0, -10) + '.tsx'\n }\n return configPath.replace('index.config.ts', 'index.tsx')\n}\n\nconst getRawPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n if (fileName === 'index') {\n return dirPath || '/'\n }\n return dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n return (\n configPath.replace('/${t}', '').replace('/index.config.ts', '') || '/'\n )\n}\n\nconst getFileDefault = ${e?"(modules: Record<string, { default: unknown }>)":"(modules)"} => {\n const result: PagesComponentType | Record<string, PageConfig> = {}\n\n for (const [path, module] of Object.entries(modules)) {\n if ('default' in module) {\n result[path] = module.default as ComponentType<unknown> | PageConfig\n }\n }\n\n return result\n}\n\nconst filterUnComponent = ${e?"(pagesComponent: PagesComponentType)":"(pagesComponent)"} => {\n const result: PagesComponentType = {}\n\n for (const key of Object.keys(pagesComponent)) {\n if (!key.includes('.config.tsx')) {\n result[key] = pagesComponent[key]\n }\n }\n\n return result\n}\n\nexport const createBaseRoutes = () => {\n const pagesComponent = filterUnComponent(\n getFileDefault({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}', { eager: true })\n })${e?" as PagesComponentType":""}\n )\n\n const pagesModule = getFileDefault({\n ...import.meta.glob('/${t}/**/*.config.${e?"ts":"js"}', {\n eager: true\n })\n })${e?" as Record<string, PageConfig>":""}\n\n const result${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const [pagePath, page] of formatPageModule(pagesComponent, pagesModule)) {\n const compPath = getCompPathFromConfig(pagePath)\n\n if (!pagesComponent[compPath]) continue\n\n const rawPath = page?.path || getRawPathFromConfig(pagePath) || '/'\n const processedPath = replaceBracketsWithColon(rawPath)\n const routePath = normalizePath(processedPath)\n\n const Component = pagesComponent[compPath]\n result.push({\n ...page,\n path: routePath,\n type: page?.type,\n isRoot: processedPath === '/root',\n element: <Component />\n })\n }\n\n return result\n}\n`)(n,i),p=(t=>`// Auto-generated by ono-auto-router\nimport { hasDuplicateProperty } from './utils'\nimport { buildRouteTree } from './buildRouteTree'\nimport { cleanIsRoot } from './cleanIsRoot'\nimport { removeEmptyChildren } from './removeEmptyChildren'${t?"\nimport type { MyRouteObject } from './types'":""}\n\nconst processRoute = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} =>\n cleanIsRoot(removeEmptyChildren(route))\n\nconst processRoutes = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} =>\n buildRouteTree(routes).map(processRoute)\n\nconst handleRootRoute = ${t?"(routes: (MyRouteObject & { isRoot?: boolean })[])":"(routes)"} => {\n let rootRoute${t?": MyRouteObject | undefined":" = undefined"}\n let homeRoute${t?": MyRouteObject | undefined":" = undefined"}\n let notFoundRoute${t?": MyRouteObject | undefined":" = undefined"}\n const filteredRoutes${t?": MyRouteObject[]":""} = []\n\n for (const route of routes) {\n if (route.isRoot) {\n if (rootRoute)\n throw new Error('There cannot be multiple root routes in a route')\n rootRoute = route\n } else if (route.path === '/') {\n homeRoute = route\n } else if (route.path === '/*') {\n notFoundRoute = route\n } else {\n filteredRoutes.push(route)\n }\n }\n\n if (hasDuplicateProperty(filteredRoutes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n const children = [\n homeRoute && { ...homeRoute, index: true },\n ...processRoutes(filteredRoutes)\n ].filter((route): route is NonNullable<typeof route> => Boolean(route))\n\n const result${t?": MyRouteObject[]":""} = []\n\n if (rootRoute) {\n result.push(cleanIsRoot({ ...rootRoute, children }))\n }\n\n if (notFoundRoute) {\n result.push(cleanIsRoot(notFoundRoute))\n }\n\n return result\n}\n\nexport const formatRoutes = (\n routes${t?": (MyRouteObject & { isRoot?: boolean })[]":""}\n) => {\n if (routes.some(r => r.isRoot)) return handleRootRoute(routes)\n\n if (hasDuplicateProperty(routes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n return processRoutes(routes)\n}\n`)(i),h=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nconst processSingleRoute = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n if (route.index) {\n return route\n }\n\n if (route.type !== 'wrap') {\n const { path: routePath, children, ...extraProps } = route\n const hasExtraProps = Object.keys(extraProps).length > 0\n\n if (hasExtraProps) {\n const indexRoute: MyRouteObject = {\n path: '',\n index: true,\n ...extraProps\n }\n\n return {\n path: routePath,\n children: [indexRoute, ...(children || []).map(processSingleRoute)]\n }\n }\n }\n\n if (route.children) {\n return {\n ...route,\n children: route.children.map(processSingleRoute)\n }\n }\n\n return route\n}\n\nconst formatRouteTree = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n return routes.map(processSingleRoute)\n}\n\nconst buildTreeStructure = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n const routeMap = new Map${t?"<string, MyRouteObject>":""}()\n const rootRoutes${t?": MyRouteObject[]":""} = []\n const pathPartsCache = new Map${t?"<string, string[]>":""}()\n\n const getPathParts = ${t?"(pathStr: string): string[]":"(pathStr)"} => {\n let parts = pathPartsCache.get(pathStr)\n if (parts === undefined) {\n parts = pathStr === '/' ? [] : pathStr.split('/').filter(Boolean)\n pathPartsCache.set(pathStr, parts)\n }\n return parts\n }\n\n const sortedRoutes = routes\n .slice()\n .sort((a, b) => a.path.length - b.path.length)\n\n for (const route of sortedRoutes) {\n const routePath = route.path\n const pathParts = getPathParts(routePath)\n const currentRoute = { ...route, children: [] }\n routeMap.set(routePath, currentRoute)\n\n if (pathParts.length <= 1) {\n rootRoutes.push(currentRoute)\n continue\n }\n\n const parentPath = '/' + pathParts.slice(0, -1).join('/')\n const parentRoute = routeMap.get(parentPath)\n\n if (parentRoute) {\n currentRoute.path = pathParts[pathParts.length - 1]\n parentRoute.children!.push(currentRoute)\n } else {\n rootRoutes.push(currentRoute)\n }\n }\n\n return rootRoutes\n}\n\nexport const buildRouteTree = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n const treeStructure = buildTreeStructure(routes)\n return formatRouteTree(treeStructure)\n}\n`)(i),f=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n\ntype RouteWithIsRoot = MyRouteObject & { isRoot?: boolean }\n":""}\nexport const cleanIsRoot = ${t?"(route: RouteWithIsRoot): MyRouteObject":"(route)"} => {\n const { isRoot, type, children, ...rest } = route as RouteWithIsRoot & {\n type?: unknown\n }\n\n if (!children?.length) {\n return rest\n }\n\n return {\n ...rest,\n children: children.map(cleanIsRoot)\n }\n}\n`)(i),d=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const removeEmptyChildren = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n const { children } = route\n\n if (!children?.length) {\n const { children: _, ...rest } = route\n return rest\n }\n\n const processedChildren = children.map(removeEmptyChildren)\n\n if (route.type === 'wrap') {\n return { ...route, children: processedChildren }\n }\n\n const { path, element, type, children: _, ...rest } = route\n\n if (!element) {\n return { path, ...rest, children: processedChildren }\n }\n\n return {\n path,\n children: [\n { index: true, element, ...rest } as MyRouteObject,\n ...processedChildren\n ]\n }\n}\n`)(i),g=i?"// Auto-generated by ono-auto-router\nimport type { PageConfig } from './types'\nexport const defineConfig = (config: PageConfig) => config\n":"",m=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { RouteObject } from 'react-router'":""}\nimport { createBaseRoutes } from './createBaseRoutes'\nimport { formatRoutes } from './formatRoutes'\n\nconst getRoutes = () => {\n const baseRoutes = createBaseRoutes()\n const formattedRoutes = formatRoutes(baseRoutes)${t?" as RouteObject[]":""}\n return formattedRoutes\n}\n\nexport const routes = getRoutes()\n`)(i),y=i?(t=>`// Auto-generated by ono-auto-router\nimport type { ComponentType } from 'react'\nimport type { RouteObject } from 'react-router'\n\n${t?"export type PagesComponentType = Record<\n string,\n () => Promise<{ default: ComponentType<unknown> }>\n>":"export type PagesComponentType = Record<string, ComponentType<unknown>>"}\n\nexport interface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport type PageConfig = Partial<\n Omit<MyRouteObject, 'Component' | 'element' | 'children'>\n>\n`)(s):"",_=(t=>`// Auto-generated by ono-auto-router\nexport const hasDuplicateProperty = ${t?"<T>(items: T[], propName: keyof T)":"(items, propName)"} => {\n const seenValues = new Set()\n return items.some(item => {\n if (seenValues.has(item[propName])) {\n return true\n }\n seenValues.add(item[propName])\n return false\n })\n}\n\nexport const replaceBracketsWithColon = ${t?"(str: string)":"(str)"} => {\n return str.replace(/\\[([^\\]]+)\\]/g, ':$1').replace('.tsx', '')\n}\n`)(i);Tr(t.resolve(u,"./index.ts"),c),Tr(t.resolve(u,"./createBaseRoutes.tsx"),l),Tr(t.resolve(u,"./formatRoutes.ts"),p),Tr(t.resolve(u,"./buildRouteTree.ts"),h),Tr(t.resolve(u,"./cleanIsRoot.ts"),f),Tr(t.resolve(u,"./removeEmptyChildren.ts"),d),g&&Tr(t.resolve(u,"./defineConfig.ts"),g),y&&Tr(t.resolve(u,"./types.ts"),y),Tr(t.resolve(u,"./getRoutes.ts"),m),Tr(t.resolve(u,"./utils.ts"),_)})(r,o,s,i,u):fr(r,o,s,i,u):dr(r,o,s,u)};function _r(t){try{const n=e.readFileSync(t,"utf-8").match(/export\s+default\s+([\s\S]*?)(?=\n\w|$)/);if(!n)return console.warn("No export default found in:",t),null;const r=n[1].trim();try{if(r.startsWith("{")){return new Function(`return ${r}`)()}if(r.includes("defineConfig(")){const t=r.match(/defineConfig([\s\S]*)$/);if(t){return new Function(`return ${t[1]}`)()}}return null}catch(t){return console.error("Error parsing export default content:",t),null}}catch(t){return console.error("Error reading file:",t),null}}function Rr(e,n){let r=t.resolve(e);if(r.endsWith(".js")||r.endsWith(".jsx")||r.endsWith(".ts")||r.endsWith(".tsx")){const t=r.split("\\");r=t.slice(0,-1).join("\\")}const o=t.resolve(n);return t.relative(r,o)}const br=/\\/g,Sr=t=>t.replace(br,"/"),Pr=(e,n)=>Sr(t.relative(n,e)),vr=/export\s+default\s+[\w(\[\]\{\})]+/;function Er(t){try{if(!e.existsSync(t))return console.warn(`File not found: ${t}`),!1;const n=e.readFileSync(t,"utf-8");return vr.test(n)}catch(t){return console.error("Read error:",t),!1}}const Ar=(t,e)=>{const n=new Set;return t.some(t=>!!n.has(t[e])||(n.add(t[e]),!1))};function xr(t){return t.replace(/"<start>([\s\S]*?)<\/end>"/g,"$1")}function Cr(t){let e=t;for(;;){const t=xr(e);if(t===e)break;e=t}return e}const Or=t=>t.replace(/\[([^\]]+)\]/g,":$1").replace(".tsx","");function wr(t){e.existsSync(t)||e.mkdirSync(t,{recursive:!0})}function $r(n,r){wr(t.dirname(n)),e.writeFileSync(n,r,"utf-8")}async function Tr(n,r){const o=t.dirname(n);await e.promises.mkdir(o,{recursive:!0}),await e.promises.writeFile(n,r,"utf-8")}function kr(t,e,n){const r=n.length>0?`\n${n.join("\n")}\n`:"";return`// Auto-generated by ono-auto-router\nimport { createRouter, createWebHistory } from 'vue-router'\n${e.join("\n")}\n${r}\n\nexport const routes = ${JSON.stringify(t,null,2)}\n\nexport const router = createRouter({\n history: createWebHistory(import.meta.env.BASE_URL),\n routes\n})\n\nexport default router\n`}export{u as convertFunctionToArrow,mr as deleteDir,gr as deleteFile,wr as ensureDirSync,p as formatRoutesFile,yr as generateRoutesTemplate,kr as generateVueRoutesTemplate,_r as getDefaultExportContent,Rr as getRelativePath,Pr as getRelativeProjectPath,Er as hasDefaultExport,Ar as hasDuplicateProperty,Sr as normalizePathWithWindows,Cr as removeCustomTagFunctionFromJSXAll,Or as replaceBracketsWithColon,c as useTs,Tr as writeFile,$r as writeFileSync};
1
+ import t from"node:path";import e from"node:fs";import n from"os";import r from"path";import o from"util";import s from"stream";import i from"events";import a from"fs";function u(t){let e=c(t,0),n=!1;if(e+5<=t.length&&"async"===t.slice(e,e+5).toLowerCase()&&(n=!0,e=c(t,e+5)),e<t.length&&"("===t[e]){const n=l(t,e);if(-1!==n){let e=c(t,n+1);if(e+1<t.length&&"="===t[e]&&">"===t[e+1])return t}}const r=t.indexOf("(");if(-1===r)return t;const o=l(t,r);if(-1===o)return t;return(n?"async ":"")+t.slice(r,o+1)+" => "+t.slice(o+1)}function c(t,e){for(;e<t.length&&/\s/.test(t[e]);)e++;return e}function l(t,e){let n=0,r=!1,o="";for(let s=e;s<t.length;s++){const e=t[s];if('"'!==e&&"'"!==e&&"`"!==e){if(!r)if("("===e)n++;else if(")"===e&&(n--,0===n))return s}else r?e===o&&(r=!1):(r=!0,o=e)}return-1}const p=n=>e.existsSync(t.resolve(n,"tsconfig.json")),h={react:{ts:"src/router/autoRouter.tsx",js:"src/router/autoRouter.jsx"},vue:{ts:"src/router/autoRouter.ts",js:"src/router/autoRouter.js"}},f=(e,n,r)=>{let o=r;return o||(o=t.resolve(n,h[e][p(n)?"ts":"js"])),o};var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var m,y={},_={},R={};function b(){if(m)return R;return m=1,Object.defineProperty(R,"__esModule",{value:!0}),R.splitWhen=R.flatten=void 0,R.flatten=function(t){return t.reduce((t,e)=>[].concat(t,e),[])},R.splitWhen=function(t,e){const n=[[]];let r=0;for(const o of t)e(o)?(r++,n[r]=[]):n[r].push(o);return n},R}var S,P={};function v(){if(S)return P;return S=1,Object.defineProperty(P,"__esModule",{value:!0}),P.isEnoentCodeError=void 0,P.isEnoentCodeError=function(t){return"ENOENT"===t.code},P}var E,A={};var x,C={};function O(){if(x)return C;x=1,Object.defineProperty(C,"__esModule",{value:!0}),C.convertPosixPathToPattern=C.convertWindowsPathToPattern=C.convertPathToPattern=C.escapePosixPath=C.escapeWindowsPath=C.escape=C.removeLeadingDotSegment=C.makeAbsolute=C.unixify=void 0;const t=r,e="win32"===n.platform(),o=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,s=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,i=/^\\\\([.?])/,a=/\\(?![!()+@[\]{}])/g;function u(t){return t.replace(s,"\\$2")}function c(t){return t.replace(o,"\\$2")}function l(t){return u(t).replace(i,"//$1").replace(a,"/")}function p(t){return c(t)}return C.unixify=function(t){return t.replace(/\\/g,"/")},C.makeAbsolute=function(e,n){return t.resolve(e,n)},C.removeLeadingDotSegment=function(t){if("."===t.charAt(0)){const e=t.charAt(1);if("/"===e||"\\"===e)return t.slice(2)}return t},C.escape=e?u:c,C.escapeWindowsPath=u,C.escapePosixPath=c,C.convertPathToPattern=e?l:p,C.convertWindowsPathToPattern=l,C.convertPosixPathToPattern=p,C}var w,$,T,k,M,L,j={};function H(){return $?w:($=1,w=function(t){if("string"!=typeof t||""===t)return!1;for(var e;e=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(e[2])return!0;t=t.slice(e.index+e[0].length)}return!1})}function F(){if(k)return T;k=1;var t=H(),e={"{":"}","(":")","[":"]"},n=function(t){if("!"===t[0])return!0;for(var n=0,r=-2,o=-2,s=-2,i=-2,a=-2;n<t.length;){if("*"===t[n])return!0;if("?"===t[n+1]&&/[\].+)]/.test(t[n]))return!0;if(-1!==o&&"["===t[n]&&"]"!==t[n+1]&&(o<n&&(o=t.indexOf("]",n)),o>n)){if(-1===a||a>o)return!0;if(-1===(a=t.indexOf("\\",n))||a>o)return!0}if(-1!==s&&"{"===t[n]&&"}"!==t[n+1]&&(s=t.indexOf("}",n))>n&&(-1===(a=t.indexOf("\\",n))||a>s))return!0;if(-1!==i&&"("===t[n]&&"?"===t[n+1]&&/[:!=]/.test(t[n+2])&&")"!==t[n+3]&&(i=t.indexOf(")",n))>n&&(-1===(a=t.indexOf("\\",n))||a>i))return!0;if(-1!==r&&"("===t[n]&&"|"!==t[n+1]&&(r<n&&(r=t.indexOf("|",n)),-1!==r&&")"!==t[r+1]&&(i=t.indexOf(")",r))>r&&(-1===(a=t.indexOf("\\",r))||a>i)))return!0;if("\\"===t[n]){var u=t[n+1];n+=2;var c=e[u];if(c){var l=t.indexOf(c,n);-1!==l&&(n=l+1)}if("!"===t[n])return!0}else n++}return!1},r=function(t){if("!"===t[0])return!0;for(var n=0;n<t.length;){if(/[*?{}()[\]]/.test(t[n]))return!0;if("\\"===t[n]){var r=t[n+1];n+=2;var o=e[r];if(o){var s=t.indexOf(o,n);-1!==s&&(n=s+1)}if("!"===t[n])return!0}else n++}return!1};return T=function(e,o){if("string"!=typeof e||""===e)return!1;if(t(e))return!0;var s=n;return o&&!1===o.strict&&(s=r),s(e)}}function D(){if(L)return M;L=1;var t=F(),e=r.posix.dirname,o="win32"===n.platform(),s=/\\/g,i=/[\{\[].*[\}\]]$/,a=/(^|[^\\])([\{\[]|\([^\)]+$)/,u=/\\([\!\*\?\|\[\]\(\)\{\}])/g;return M=function(n,r){Object.assign({flipBackslashes:!0},r).flipBackslashes&&o&&n.indexOf("/")<0&&(n=n.replace(s,"/")),i.test(n)&&(n+="/"),n+="a";do{n=e(n)}while(t(n)||a.test(n));return n.replace(u,"$1")}}var N,I,B,W,G,U,K,V,Q,q,z,X,Y,Z,J,tt,et,nt,rt,ot={};function st(){return N||(N=1,(t=ot).isInteger=t=>"number"==typeof t?Number.isInteger(t):"string"==typeof t&&""!==t.trim()&&Number.isInteger(Number(t)),t.find=(t,e)=>t.nodes.find(t=>t.type===e),t.exceedsLimit=(e,n,r=1,o)=>!1!==o&&!(!t.isInteger(e)||!t.isInteger(n))&&(Number(n)-Number(e))/Number(r)>=o,t.escapeNode=(t,e=0,n)=>{const r=t.nodes[e];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},t.encloseBrace=t=>!("brace"!==t.type||t.commas>>0+t.ranges|0||(t.invalid=!0,0)),t.isInvalidBrace=t=>!("brace"!==t.type||!0!==t.invalid&&!t.dollar&&(t.commas>>0+t.ranges|0&&!0===t.open&&!0===t.close||(t.invalid=!0,0))),t.isOpenOrClose=t=>"open"===t.type||"close"===t.type||!0===t.open||!0===t.close,t.reduce=t=>t.reduce((t,e)=>("text"===e.type&&t.push(e.value),"range"===e.type&&(e.type="text"),t),[]),t.flatten=(...t)=>{const e=[],n=t=>{for(let r=0;r<t.length;r++){const o=t[r];Array.isArray(o)?n(o):void 0!==o&&e.push(o)}return e};return n(t),e}),ot;var t}function it(){if(B)return I;B=1;const t=st();return I=(e,n={})=>{const r=(e,o={})=>{const s=n.escapeInvalid&&t.isInvalidBrace(o),i=!0===e.invalid&&!0===n.escapeInvalid;let a="";if(e.value)return(s||i)&&t.isOpenOrClose(e)?"\\"+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(const t of e.nodes)a+=r(t);return a};return r(e)}}function at(){return G?W:(G=1,W=function(t){return"number"==typeof t?t-t===0:"string"==typeof t&&""!==t.trim()&&(Number.isFinite?Number.isFinite(+t):isFinite(+t))})}function ut(){if(K)return U;K=1;const t=at(),e=(n,s,i)=>{if(!1===t(n))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||n===s)return String(n);if(!1===t(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let a={relaxZeros:!0,...i};"boolean"==typeof a.strictZeros&&(a.relaxZeros=!1===a.strictZeros);let u=n+":"+s+"="+String(a.relaxZeros)+String(a.shorthand)+String(a.capture)+String(a.wrap);if(e.cache.hasOwnProperty(u))return e.cache[u].result;let c=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(c-l)){let t=n+"|"+s;return a.capture?`(${t})`:!1===a.wrap?t:`(?:${t})`}let h=p(n)||p(s),f={min:n,max:s,a:c,b:l},d=[],g=[];if(h&&(f.isPadded=h,f.maxLen=String(f.max).length),c<0){g=r(l<0?Math.abs(l):1,Math.abs(c),f,a),c=f.a=0}return l>=0&&(d=r(c,l,f,a)),f.negatives=g,f.positives=d,f.result=function(t,e){let n=o(t,e,"-",!1)||[],r=o(e,t,"",!1)||[],s=o(t,e,"-?",!0)||[];return n.concat(s).concat(r).join("|")}(g,d),!0===a.capture?f.result=`(${f.result})`:!1!==a.wrap&&d.length+g.length>1&&(f.result=`(?:${f.result})`),e.cache[u]=f,f.result};function n(t,e,n){if(t===e)return{pattern:t,count:[],digits:0};let r=function(t,e){let n=[];for(let r=0;r<t.length;r++)n.push([t[r],e[r]]);return n}(t,e),o=r.length,s="",i=0;for(let t=0;t<o;t++){let[e,n]=r[t];e===n?s+=e:"0"!==e||"9"!==n?s+=l(e,n):i++}return i&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[i],digits:o}}function r(t,e,r,o){let i,l=function(t,e){let n=1,r=1,o=a(t,n),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),n+=1,o=a(t,n);for(o=u(e+1,r)-1;t<o&&o<=e;)i.add(o),r+=1,o=u(e+1,r)-1;return i=[...i],i.sort(s),i}(t,e),p=[],f=t;for(let t=0;t<l.length;t++){let e=l[t],s=n(String(f),String(e),o),a="";r.isPadded||!i||i.pattern!==s.pattern?(r.isPadded&&(a=h(e,r,o)),s.string=a+s.pattern+c(s.count),p.push(s),f=e+1,i=s):(i.count.length>1&&i.count.pop(),i.count.push(s.count[0]),i.string=i.pattern+c(i.count),f=e+1)}return p}function o(t,e,n,r,o){let s=[];for(let o of t){let{string:t}=o;r||i(e,"string",t)||s.push(n+t),r&&i(e,"string",t)&&s.push(n+t)}return s}function s(t,e){return t>e?1:e>t?-1:0}function i(t,e,n){return t.some(t=>t[e]===n)}function a(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function u(t,e){return t-t%Math.pow(10,e)}function c(t){let[e=0,n=""]=t;return n||e>1?`{${e+(n?","+n:"")}}`:""}function l(t,e,n){return`[${t}${e-t===1?"":"-"}${e}]`}function p(t){return/^-?(0+)\d/.test(t)}function h(t,e,n){if(!e.isPadded)return t;let r=Math.abs(e.maxLen-String(t).length),o=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}return e.cache={},e.clearCache=()=>e.cache={},U=e}function ct(){if(Q)return V;Q=1;const t=o,e=ut(),n=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),r=t=>"number"==typeof t||"string"==typeof t&&""!==t,s=t=>Number.isInteger(+t),i=t=>{let e=`${t}`,n=-1;if("-"===e[0]&&(e=e.slice(1)),"0"===e)return!1;for(;"0"===e[++n];);return n>0},a=(t,e,n)=>{if(e>0){let n="-"===t[0]?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return!1===n?String(t):t},u=(t,e)=>{let n="-"===t[0]?"-":"";for(n&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return n?"-"+t:t},c=(t,n,r,o)=>{if(r)return e(t,n,{wrap:!1,...o});let s=String.fromCharCode(t);return t===n?s:`[${s}-${String.fromCharCode(n)}]`},l=(t,n,r)=>{if(Array.isArray(t)){let e=!0===r.wrap,n=r.capture?"":"?:";return e?`(${n}${t.join("|")})`:t.join("|")}return e(t,n,r)},p=(...e)=>new RangeError("Invalid range arguments: "+t.inspect(...e)),h=(t,e,n)=>{if(!0===n.strictRanges)throw p([t,e]);return[]},f=(t,e,n=1,r={})=>{let o=Number(t),s=Number(e);if(!Number.isInteger(o)||!Number.isInteger(s)){if(!0===r.strictRanges)throw p([t,e]);return[]}0===o&&(o=0),0===s&&(s=0);let h=o>s,f=String(t),d=String(e),g=String(n);n=Math.max(Math.abs(n),1);let m=i(f)||i(d)||i(g),y=m?Math.max(f.length,d.length,g.length):0,_=!1===m&&!1===((t,e,n)=>"string"==typeof t||"string"==typeof e||!0===n.stringify)(t,e,r),R=r.transform||(t=>e=>!0===t?Number(e):String(e))(_);if(r.toRegex&&1===n)return c(u(t,y),u(e,y),!0,r);let b={negatives:[],positives:[]},S=t=>b[t<0?"negatives":"positives"].push(Math.abs(t)),P=[],v=0;for(;h?o>=s:o<=s;)!0===r.toRegex&&n>1?S(o):P.push(a(R(o,v),y,_)),o=h?o-n:o+n,v++;return!0===r.toRegex?n>1?((t,e,n)=>{t.negatives.sort((t,e)=>t<e?-1:t>e?1:0),t.positives.sort((t,e)=>t<e?-1:t>e?1:0);let r,o=e.capture?"":"?:",s="",i="";return t.positives.length&&(s=t.positives.map(t=>u(String(t),n)).join("|")),t.negatives.length&&(i=`-(${o}${t.negatives.map(t=>u(String(t),n)).join("|")})`),r=s&&i?`${s}|${i}`:s||i,e.wrap?`(${o}${r})`:r})(b,r,y):l(P,null,{wrap:!1,...r}):P},d=(t,e,o,i={})=>{if(null==e&&r(t))return[t];if(!r(t)||!r(e))return h(t,e,i);if("function"==typeof o)return d(t,e,1,{transform:o});if(n(o))return d(t,e,0,o);let a={...i};return!0===a.capture&&(a.wrap=!0),o=o||a.step||1,s(o)?s(t)&&s(e)?f(t,e,o,a):((t,e,n=1,r={})=>{if(!s(t)&&t.length>1||!s(e)&&e.length>1)return h(t,e,r);let o=r.transform||(t=>String.fromCharCode(t)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),u=i>a,p=Math.min(i,a),f=Math.max(i,a);if(r.toRegex&&1===n)return c(p,f,!1,r);let d=[],g=0;for(;u?i>=a:i<=a;)d.push(o(i,g)),i=u?i-n:i+n,g++;return!0===r.toRegex?l(d,null,{wrap:!1,options:r}):d})(t,e,Math.max(Math.abs(o),1),a):null==o||n(o)?d(t,e,1,o):((t,e)=>{if(!0===e.strictRanges)throw new TypeError(`Expected step "${t}" to be a number`);return[]})(o,a)};return V=d}function lt(){if(et)return tt;et=1;const t=it(),{MAX_LENGTH:e,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:i,CHAR_RIGHT_PARENTHESES:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:c,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:p,CHAR_DOUBLE_QUOTE:h,CHAR_SINGLE_QUOTE:f,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:g}=J?Z:(J=1,Z={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return tt=(m,y={})=>{if("string"!=typeof m)throw new TypeError("Expected a string");const _=y||{},R="number"==typeof _.maxLength?Math.min(e,_.maxLength):e;if(m.length>R)throw new SyntaxError(`Input length (${m.length}), exceeds max characters (${R})`);const b={type:"root",input:m,nodes:[]},S=[b];let P=b,v=b,E=0;const A=m.length;let x,C=0,O=0;const w=()=>m[C++],$=t=>{if("text"===t.type&&"dot"===v.type&&(v.type="text"),!v||"text"!==v.type||"text"!==t.type)return P.nodes.push(t),t.parent=P,t.prev=v,v=t,t;v.value+=t.value};for($({type:"bos"});C<A;)if(P=S[S.length-1],x=w(),x!==g&&x!==d)if(x!==n)if(x!==p){if(x===l){let t;for(E++;C<A&&(t=w());)if(x+=t,t!==l)if(t!==n){if(t===p&&(E--,0===E))break}else x+=w();else E++;$({type:"text",value:x});continue}if(x!==i)if(x!==a){if(x===h||x===f||x===r){const t=x;let e;for(!0!==y.keepQuotes&&(x="");C<A&&(e=w());)if(e!==n){if(e===t){!0===y.keepQuotes&&(x+=e);break}x+=e}else x+=e+w();$({type:"text",value:x});continue}if(x===u){O++;const t=v.value&&"$"===v.value.slice(-1)||!0===P.dollar;P=$({type:"brace",open:!0,close:!1,dollar:t,depth:O,commas:0,ranges:0,nodes:[]}),S.push(P),$({type:"open",value:x});continue}if(x===c){if("brace"!==P.type){$({type:"text",value:x});continue}const t="close";P=S.pop(),P.close=!0,$({type:t,value:x}),O--,P=S[S.length-1];continue}if(x===o&&O>0){if(P.ranges>0){P.ranges=0;const e=P.nodes.shift();P.nodes=[e,{type:"text",value:t(P)}]}$({type:"comma",value:x}),P.commas++}else{if(x===s&&O>0&&0===P.commas){const t=P.nodes;if(0===O||0===t.length){$({type:"text",value:x});continue}if("dot"===v.type){if(P.range=[],v.value+=x,v.type="range",3!==P.nodes.length&&5!==P.nodes.length){P.invalid=!0,P.ranges=0,v.type="text";continue}P.ranges++,P.args=[];continue}if("range"===v.type){t.pop();const e=t[t.length-1];e.value+=v.value+x,v=e,P.ranges--;continue}$({type:"dot",value:x});continue}$({type:"text",value:x})}}else{if("paren"!==P.type){$({type:"text",value:x});continue}P=S.pop(),$({type:"text",value:x}),P=S[S.length-1]}else P=$({type:"paren",nodes:[]}),S.push(P),$({type:"text",value:x})}else $({type:"text",value:"\\"+x});else $({type:"text",value:(y.keepEscaping?x:"")+w()});do{if(P=S.pop(),"root"!==P.type){P.nodes.forEach(t=>{t.nodes||("open"===t.type&&(t.isOpen=!0),"close"===t.type&&(t.isClose=!0),t.nodes||(t.type="text"),t.invalid=!0)});const t=S[S.length-1],e=t.nodes.indexOf(P);t.nodes.splice(e,1,...P.nodes)}}while(S.length>0);return $({type:"eos"}),b}}function pt(){if(rt)return nt;rt=1;const t=it(),e=function(){if(z)return q;z=1;const t=ct(),e=st();return q=(n,r={})=>{const o=(n,s={})=>{const i=e.isInvalidBrace(s),a=!0===n.invalid&&!0===r.escapeInvalid,u=!0===i||!0===a,c=!0===r.escapeInvalid?"\\":"";let l="";if(!0===n.isOpen)return c+n.value;if(!0===n.isClose)return console.log("node.isClose",c,n.value),c+n.value;if("open"===n.type)return u?c+n.value:"(";if("close"===n.type)return u?c+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){const o=e.reduce(n.nodes),s=t(...o,{...r,wrap:!1,toRegex:!0,strictZeros:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(const t of n.nodes)l+=o(t,n);return l};return o(n)}}(),n=function(){if(Y)return X;Y=1;const t=ct(),e=it(),n=st(),r=(t="",e="",o=!1)=>{const s=[];if(t=[].concat(t),!(e=[].concat(e)).length)return t;if(!t.length)return o?n.flatten(e).map(t=>`{${t}}`):e;for(const n of t)if(Array.isArray(n))for(const t of n)s.push(r(t,e,o));else for(let t of e)!0===o&&"string"==typeof t&&(t=`{${t}}`),s.push(Array.isArray(t)?r(n,t,o):n+t);return n.flatten(s)};return X=(o,s={})=>{const i=void 0===s.rangeLimit?1e3:s.rangeLimit,a=(o,u={})=>{o.queue=[];let c=u,l=u.queue;for(;"brace"!==c.type&&"root"!==c.type&&c.parent;)c=c.parent,l=c.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),e(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){const a=n.reduce(o.nodes);if(n.exceedsLimit(...a,s.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=t(...a,s);return 0===u.length&&(u=e(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}const p=n.encloseBrace(o);let h=o.queue,f=o;for(;"brace"!==f.type&&"root"!==f.type&&f.parent;)f=f.parent,h=f.queue;for(let t=0;t<o.nodes.length;t++){const e=o.nodes[t];"comma"!==e.type||"brace"!==o.type?"close"!==e.type?e.value&&"open"!==e.type?h.push(r(h.pop(),e.value)):e.nodes&&a(e,o):l.push(r(l.pop(),h,p)):(1===t&&h.push(""),h.push(""))}return h};return n.flatten(a(o))},X}(),r=lt(),o=(t,e={})=>{let n=[];if(Array.isArray(t))for(const r of t){const t=o.create(r,e);Array.isArray(t)?n.push(...t):n.push(t)}else n=[].concat(o.create(t,e));return e&&!0===e.expand&&!0===e.nodupes&&(n=[...new Set(n)]),n};return o.parse=(t,e={})=>r(t,e),o.stringify=(e,n={})=>t("string"==typeof e?o.parse(e,n):e,n),o.compile=(t,n={})=>("string"==typeof t&&(t=o.parse(t,n)),e(t,n)),o.expand=(t,e={})=>{"string"==typeof t&&(t=o.parse(t,e));let r=n(t,e);return!0===e.noempty&&(r=r.filter(Boolean)),!0===e.nodupes&&(r=[...new Set(r)]),r},o.create=(t,e={})=>""===t||t.length<3?[t]:!0!==e.expand?o.compile(t,e):o.expand(t,e),nt=o}var ht,ft,dt,gt,mt,yt,_t,Rt,bt,St,Pt,vt,Et,At,xt={};function Ct(){if(ft)return ht;ft=1;const t=r,e="\\\\/",n=`[^${e}]`,o="\\.",s="\\/",i="[^/]",a=`(?:${s}|$)`,u=`(?:^|${s})`,c=`${o}{1,2}${a}`,l={DOT_LITERAL:o,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:s,ONE_CHAR:"(?=.)",QMARK:i,END_ANCHOR:a,DOTS_SLASH:c,NO_DOT:`(?!${o})`,NO_DOTS:`(?!${u}${c})`,NO_DOT_SLASH:`(?!${o}{0,1}${a})`,NO_DOTS_SLASH:`(?!${c})`,QMARK_NO_DOT:`[^.${s}]`,STAR:`${i}*?`,START_ANCHOR:u},p={...l,SLASH_LITERAL:`[${e}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${o}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[${e}])${o}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`};return ht={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:t.sep,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?p:l}}function Ot(){return dt||(dt=1,function(t){const e=r,n="win32"===process.platform,{REGEX_BACKSLASH:o,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:a}=Ct();t.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),t.hasRegexChars=t=>i.test(t),t.isRegexChar=e=>1===e.length&&t.hasRegexChars(e),t.escapeRegex=t=>t.replace(a,"\\$1"),t.toPosixSlashes=t=>t.replace(o,"/"),t.removeBackslashes=t=>t.replace(s,t=>"\\"===t?"":t),t.supportsLookbehinds=()=>{const t=process.version.slice(1).split(".").map(Number);return 3===t.length&&t[0]>=9||8===t[0]&&t[1]>=10},t.isWindows=t=>t&&"boolean"==typeof t.windows?t.windows:!0===n||"\\"===e.sep,t.escapeLast=(e,n,r)=>{const o=e.lastIndexOf(n,r);return-1===o?e:"\\"===e[o-1]?t.escapeLast(e,n,o-1):`${e.slice(0,o)}\\${e.slice(o)}`},t.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n},t.wrapOutput=(t,e={},n={})=>{let r=`${n.contains?"":"^"}(?:${t})${n.contains?"":"$"}`;return!0===e.negated&&(r=`(?:^(?!${r}).*$)`),r}}(xt)),xt}function wt(){if(bt)return Rt;bt=1;const t=r,e=function(){if(mt)return gt;mt=1;const t=Ot(),{CHAR_ASTERISK:e,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:c,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:p,CHAR_QUESTION_MARK:h,CHAR_RIGHT_CURLY_BRACE:f,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:g}=Ct(),m=t=>t===a||t===r,y=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};return gt=(_,R)=>{const b=R||{},S=_.length-1,P=!0===b.parts||!0===b.scanToEnd,v=[],E=[],A=[];let x,C,O=_,w=-1,$=0,T=0,k=!1,M=!1,L=!1,j=!1,H=!1,F=!1,D=!1,N=!1,I=!1,B=!1,W=0,G={value:"",depth:0,isGlob:!1};const U=()=>w>=S,K=()=>O.charCodeAt(w+1),V=()=>(x=C,O.charCodeAt(++w));for(;w<S;){let t;if(C=V(),C!==r){if(!0===F||C===u){for(W++;!0!==U()&&(C=V());)if(C!==r)if(C!==u){if(!0!==F&&C===s&&(C=V())===s){if(k=G.isBrace=!0,L=G.isGlob=!0,B=!0,!0===P)continue;break}if(!0!==F&&C===o){if(k=G.isBrace=!0,L=G.isGlob=!0,B=!0,!0===P)continue;break}if(C===f&&(W--,0===W)){F=!1,k=G.isBrace=!0,B=!0;break}}else W++;else D=G.backslashes=!0,V();if(!0===P)continue;break}if(C!==a){if(!0!==b.noext&&!0==(C===p||C===n||C===e||C===h||C===i)&&K()===c){if(L=G.isGlob=!0,j=G.isExtglob=!0,B=!0,C===i&&w===$&&(I=!0),!0===P){for(;!0!==U()&&(C=V());)if(C!==r){if(C===d){L=G.isGlob=!0,B=!0;break}}else D=G.backslashes=!0,C=V();continue}break}if(C===e){if(x===e&&(H=G.isGlobstar=!0),L=G.isGlob=!0,B=!0,!0===P)continue;break}if(C===h){if(L=G.isGlob=!0,B=!0,!0===P)continue;break}if(C===l){for(;!0!==U()&&(t=V());)if(t!==r){if(t===g){M=G.isBracket=!0,L=G.isGlob=!0,B=!0;break}}else D=G.backslashes=!0,V();if(!0===P)continue;break}if(!0===b.nonegate||C!==i||w!==$){if(!0!==b.noparen&&C===c){if(L=G.isGlob=!0,!0===P){for(;!0!==U()&&(C=V());)if(C!==c){if(C===d){B=!0;break}}else D=G.backslashes=!0,C=V();continue}break}if(!0===L){if(B=!0,!0===P)continue;break}}else N=G.negated=!0,$++}else{if(v.push(w),E.push(G),G={value:"",depth:0,isGlob:!1},!0===B)continue;if(x===s&&w===$+1){$+=2;continue}T=w+1}}else D=G.backslashes=!0,C=V(),C===u&&(F=!0)}!0===b.noext&&(j=!1,L=!1);let Q=O,q="",z="";$>0&&(q=O.slice(0,$),O=O.slice($),T-=$),Q&&!0===L&&T>0?(Q=O.slice(0,T),z=O.slice(T)):!0===L?(Q="",z=O):Q=O,Q&&""!==Q&&"/"!==Q&&Q!==O&&m(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===b.unescape&&(z&&(z=t.removeBackslashes(z)),Q&&!0===D&&(Q=t.removeBackslashes(Q)));const X={prefix:q,input:_,start:$,base:Q,glob:z,isBrace:k,isBracket:M,isGlob:L,isExtglob:j,isGlobstar:H,negated:N,negatedExtglob:I};if(!0===b.tokens&&(X.maxDepth=0,m(C)||E.push(G),X.tokens=E),!0===b.parts||!0===b.tokens){let t;for(let e=0;e<v.length;e++){const n=t?t+1:$,r=v[e],o=_.slice(n,r);b.tokens&&(0===e&&0!==$?(E[e].isPrefix=!0,E[e].value=q):E[e].value=o,y(E[e]),X.maxDepth+=E[e].depth),0===e&&""===o||A.push(o),t=r}if(t&&t+1<_.length){const e=_.slice(t+1);A.push(e),b.tokens&&(E[E.length-1].value=e,y(E[E.length-1]),X.maxDepth+=E[E.length-1].depth)}X.slashes=v,X.parts=A}return X},gt}(),n=function(){if(_t)return yt;_t=1;const t=Ct(),e=Ot(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=t,a=(t,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...t,n);t.sort();const r=`[${t.join("-")}]`;try{new RegExp(r)}catch(n){return t.map(t=>e.escapeRegex(t)).join("..")}return r},u=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,c=(l,p)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=i[l]||l;const h={...p},f="number"==typeof h.maxLength?Math.min(n,h.maxLength):n;let d=l.length;if(d>f)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${f}`);const g={type:"bos",value:"",output:h.prepend||""},m=[g],y=h.capture?"":"?:",_=e.isWindows(p),R=t.globChars(_),b=t.extglobChars(R),{DOT_LITERAL:S,PLUS_LITERAL:P,SLASH_LITERAL:v,ONE_CHAR:E,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:C,NO_DOTS_SLASH:O,QMARK:w,QMARK_NO_DOT:$,STAR:T,START_ANCHOR:k}=R,M=t=>`(${y}(?:(?!${k}${t.dot?A:S}).)*?)`,L=h.dot?"":x,j=h.dot?w:$;let H=!0===h.bash?M(h):T;h.capture&&(H=`(${H})`),"boolean"==typeof h.noext&&(h.noextglob=h.noext);const F={input:l,index:-1,start:0,dot:!0===h.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:m};l=e.removePrefix(l,F),d=l.length;const D=[],N=[],I=[];let B,W=g;const G=()=>F.index===d-1,U=F.peek=(t=1)=>l[F.index+t],K=F.advance=()=>l[++F.index]||"",V=()=>l.slice(F.index+1),Q=(t="",e=0)=>{F.consumed+=t,F.index+=e},q=t=>{F.output+=null!=t.output?t.output:t.value,Q(t.value)},z=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)K(),F.start++,t++;return t%2!=0&&(F.negated=!0,F.start++,!0)},X=t=>{F[t]++,I.push(t)},Y=t=>{F[t]--,I.pop()},Z=t=>{if("globstar"===W.type){const e=F.braces>0&&("comma"===t.type||"brace"===t.type),n=!0===t.extglob||D.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||n||(F.output=F.output.slice(0,-W.output.length),W.type="star",W.value="*",W.output=H,F.output+=W.output)}if(D.length&&"paren"!==t.type&&(D[D.length-1].inner+=t.value),(t.value||t.output)&&q(t),W&&"text"===W.type&&"text"===t.type)return W.value+=t.value,void(W.output=(W.output||"")+t.value);t.prev=W,m.push(t),W=t},J=(t,e)=>{const n={...b[e],conditions:1,inner:""};n.prev=W,n.parens=F.parens,n.output=F.output;const r=(h.capture?"(":"")+n.open;X("parens"),Z({type:t,value:e,output:F.output?"":E}),Z({type:"paren",extglob:!0,value:K(),output:r}),D.push(n)},tt=t=>{let e,n=t.close+(h.capture?")":"");if("negate"===t.type){let r=H;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(r=M(h)),(r!==H||G()||/^\)+$/.test(V()))&&(n=t.close=`)$))${r}`),t.inner.includes("*")&&(e=V())&&/^\.[^\\/.]+$/.test(e)){const o=c(e,{...p,fastpaths:!1}).output;n=t.close=`)${o})${r})`}"bos"===t.prev.type&&(F.negatedExtglob=!0)}Z({type:"paren",extglob:!0,value:B,output:n}),Y("parens")};if(!1!==h.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let t=!1,n=l.replace(s,(e,n,r,o,s,i)=>"\\"===o?(t=!0,e):"?"===o?n?n+o+(s?w.repeat(s.length):""):0===i?j+(s?w.repeat(s.length):""):w.repeat(r.length):"."===o?S.repeat(r.length):"*"===o?n?n+o+(s?H:""):H:n?e:`\\${e}`);return!0===t&&(n=!0===h.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),n===l&&!0===h.contains?(F.output=l,F):(F.output=e.wrapOutput(n,F,p),F)}for(;!G();){if(B=K(),"\0"===B)continue;if("\\"===B){const t=U();if("/"===t&&!0!==h.bash)continue;if("."===t||";"===t)continue;if(!t){B+="\\",Z({type:"text",value:B});continue}const e=/^\\+/.exec(V());let n=0;if(e&&e[0].length>2&&(n=e[0].length,F.index+=n,n%2!=0&&(B+="\\")),!0===h.unescape?B=K():B+=K(),0===F.brackets){Z({type:"text",value:B});continue}}if(F.brackets>0&&("]"!==B||"["===W.value||"[^"===W.value)){if(!1!==h.posix&&":"===B){const t=W.value.slice(1);if(t.includes("[")&&(W.posix=!0,t.includes(":"))){const t=W.value.lastIndexOf("["),e=W.value.slice(0,t),n=W.value.slice(t+2),o=r[n];if(o){W.value=e+o,F.backtrack=!0,K(),g.output||1!==m.indexOf(W)||(g.output=E);continue}}}("["===B&&":"!==U()||"-"===B&&"]"===U())&&(B=`\\${B}`),"]"!==B||"["!==W.value&&"[^"!==W.value||(B=`\\${B}`),!0===h.posix&&"!"===B&&"["===W.value&&(B="^"),W.value+=B,q({value:B});continue}if(1===F.quotes&&'"'!==B){B=e.escapeRegex(B),W.value+=B,q({value:B});continue}if('"'===B){F.quotes=1===F.quotes?0:1,!0===h.keepQuotes&&Z({type:"text",value:B});continue}if("("===B){X("parens"),Z({type:"paren",value:B});continue}if(")"===B){if(0===F.parens&&!0===h.strictBrackets)throw new SyntaxError(u("opening","("));const t=D[D.length-1];if(t&&F.parens===t.parens+1){tt(D.pop());continue}Z({type:"paren",value:B,output:F.parens?")":"\\)"}),Y("parens");continue}if("["===B){if(!0!==h.nobracket&&V().includes("]"))X("brackets");else{if(!0!==h.nobracket&&!0===h.strictBrackets)throw new SyntaxError(u("closing","]"));B=`\\${B}`}Z({type:"bracket",value:B});continue}if("]"===B){if(!0===h.nobracket||W&&"bracket"===W.type&&1===W.value.length){Z({type:"text",value:B,output:`\\${B}`});continue}if(0===F.brackets){if(!0===h.strictBrackets)throw new SyntaxError(u("opening","["));Z({type:"text",value:B,output:`\\${B}`});continue}Y("brackets");const t=W.value.slice(1);if(!0===W.posix||"^"!==t[0]||t.includes("/")||(B=`/${B}`),W.value+=B,q({value:B}),!1===h.literalBrackets||e.hasRegexChars(t))continue;const n=e.escapeRegex(W.value);if(F.output=F.output.slice(0,-W.value.length),!0===h.literalBrackets){F.output+=n,W.value=n;continue}W.value=`(${y}${n}|${W.value})`,F.output+=W.value;continue}if("{"===B&&!0!==h.nobrace){X("braces");const t={type:"brace",value:B,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};N.push(t),Z(t);continue}if("}"===B){const t=N[N.length-1];if(!0===h.nobrace||!t){Z({type:"text",value:B,output:B});continue}let e=")";if(!0===t.dots){const t=m.slice(),n=[];for(let e=t.length-1;e>=0&&(m.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&n.unshift(t[e].value);e=a(n,h),F.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){const n=F.output.slice(0,t.outputIndex),r=F.tokens.slice(t.tokensIndex);t.value=t.output="\\{",B=e="\\}",F.output=n;for(const t of r)F.output+=t.output||t.value}Z({type:"brace",value:B,output:e}),Y("braces"),N.pop();continue}if("|"===B){D.length>0&&D[D.length-1].conditions++,Z({type:"text",value:B});continue}if(","===B){let t=B;const e=N[N.length-1];e&&"braces"===I[I.length-1]&&(e.comma=!0,t="|"),Z({type:"comma",value:B,output:t});continue}if("/"===B){if("dot"===W.type&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",m.pop(),W=g;continue}Z({type:"slash",value:B,output:v});continue}if("."===B){if(F.braces>0&&"dot"===W.type){"."===W.value&&(W.output=S);const t=N[N.length-1];W.type="dots",W.output+=B,W.value+=B,t.dots=!0;continue}if(F.braces+F.parens===0&&"bos"!==W.type&&"slash"!==W.type){Z({type:"text",value:B,output:S});continue}Z({type:"dot",value:B,output:S});continue}if("?"===B){if((!W||"("!==W.value)&&!0!==h.noextglob&&"("===U()&&"?"!==U(2)){J("qmark",B);continue}if(W&&"paren"===W.type){const t=U();let n=B;if("<"===t&&!e.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===W.value&&!/[!=<:]/.test(t)||"<"===t&&!/<([!=]|\w+>)/.test(V()))&&(n=`\\${B}`),Z({type:"text",value:B,output:n});continue}if(!0!==h.dot&&("slash"===W.type||"bos"===W.type)){Z({type:"qmark",value:B,output:$});continue}Z({type:"qmark",value:B,output:w});continue}if("!"===B){if(!0!==h.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){J("negate",B);continue}if(!0!==h.nonegate&&0===F.index){z();continue}}if("+"===B){if(!0!==h.noextglob&&"("===U()&&"?"!==U(2)){J("plus",B);continue}if(W&&"("===W.value||!1===h.regex){Z({type:"plus",value:B,output:P});continue}if(W&&("bracket"===W.type||"paren"===W.type||"brace"===W.type)||F.parens>0){Z({type:"plus",value:B});continue}Z({type:"plus",value:P});continue}if("@"===B){if(!0!==h.noextglob&&"("===U()&&"?"!==U(2)){Z({type:"at",extglob:!0,value:B,output:""});continue}Z({type:"text",value:B});continue}if("*"!==B){"$"!==B&&"^"!==B||(B=`\\${B}`);const t=o.exec(V());t&&(B+=t[0],F.index+=t[0].length),Z({type:"text",value:B});continue}if(W&&("globstar"===W.type||!0===W.star)){W.type="star",W.star=!0,W.value+=B,W.output=H,F.backtrack=!0,F.globstar=!0,Q(B);continue}let t=V();if(!0!==h.noextglob&&/^\([^?]/.test(t)){J("star",B);continue}if("star"===W.type){if(!0===h.noglobstar){Q(B);continue}const e=W.prev,n=e.prev,r="slash"===e.type||"bos"===e.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===h.bash&&(!r||t[0]&&"/"!==t[0])){Z({type:"star",value:B,output:""});continue}const s=F.braces>0&&("comma"===e.type||"brace"===e.type),i=D.length&&("pipe"===e.type||"paren"===e.type);if(!r&&"paren"!==e.type&&!s&&!i){Z({type:"star",value:B,output:""});continue}for(;"/**"===t.slice(0,3);){const e=l[F.index+4];if(e&&"/"!==e)break;t=t.slice(3),Q("/**",3)}if("bos"===e.type&&G()){W.type="globstar",W.value+=B,W.output=M(h),F.output=W.output,F.globstar=!0,Q(B);continue}if("slash"===e.type&&"bos"!==e.prev.type&&!o&&G()){F.output=F.output.slice(0,-(e.output+W.output).length),e.output=`(?:${e.output}`,W.type="globstar",W.output=M(h)+(h.strictSlashes?")":"|$)"),W.value+=B,F.globstar=!0,F.output+=e.output+W.output,Q(B);continue}if("slash"===e.type&&"bos"!==e.prev.type&&"/"===t[0]){const n=void 0!==t[1]?"|$":"";F.output=F.output.slice(0,-(e.output+W.output).length),e.output=`(?:${e.output}`,W.type="globstar",W.output=`${M(h)}${v}|${v}${n})`,W.value+=B,F.output+=e.output+W.output,F.globstar=!0,Q(B+K()),Z({type:"slash",value:"/",output:""});continue}if("bos"===e.type&&"/"===t[0]){W.type="globstar",W.value+=B,W.output=`(?:^|${v}|${M(h)}${v})`,F.output=W.output,F.globstar=!0,Q(B+K()),Z({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-W.output.length),W.type="globstar",W.output=M(h),W.value+=B,F.output+=W.output,F.globstar=!0,Q(B);continue}const n={type:"star",value:B,output:H};!0!==h.bash?!W||"bracket"!==W.type&&"paren"!==W.type||!0!==h.regex?(F.index!==F.start&&"slash"!==W.type&&"dot"!==W.type||("dot"===W.type?(F.output+=C,W.output+=C):!0===h.dot?(F.output+=O,W.output+=O):(F.output+=L,W.output+=L),"*"!==U()&&(F.output+=E,W.output+=E)),Z(n)):(n.output=B,Z(n)):(n.output=".*?","bos"!==W.type&&"slash"!==W.type||(n.output=L+n.output),Z(n))}for(;F.brackets>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing","]"));F.output=e.escapeLast(F.output,"["),Y("brackets")}for(;F.parens>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing",")"));F.output=e.escapeLast(F.output,"("),Y("parens")}for(;F.braces>0;){if(!0===h.strictBrackets)throw new SyntaxError(u("closing","}"));F.output=e.escapeLast(F.output,"{"),Y("braces")}if(!0===h.strictSlashes||"star"!==W.type&&"bracket"!==W.type||Z({type:"maybe_slash",value:"",output:`${v}?`}),!0===F.backtrack){F.output="";for(const t of F.tokens)F.output+=null!=t.output?t.output:t.value,t.suffix&&(F.output+=t.suffix)}return F};return c.fastpaths=(r,o)=>{const s={...o},a="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>a)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${a}`);r=i[r]||r;const c=e.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:f,NO_DOT:d,NO_DOTS:g,NO_DOTS_SLASH:m,STAR:y,START_ANCHOR:_}=t.globChars(c),R=s.dot?g:d,b=s.dot?m:d,S=s.capture?"":"?:";let P=!0===s.bash?".*?":y;s.capture&&(P=`(${P})`);const v=t=>!0===t.noglobstar?P:`(${S}(?:(?!${_}${t.dot?f:l}).)*?)`,E=t=>{switch(t){case"*":return`${R}${h}${P}`;case".*":return`${l}${h}${P}`;case"*.*":return`${R}${P}${l}${h}${P}`;case"*/*":return`${R}${P}${p}${h}${b}${P}`;case"**":return R+v(s);case"**/*":return`(?:${R}${v(s)}${p})?${b}${h}${P}`;case"**/*.*":return`(?:${R}${v(s)}${p})?${b}${P}${l}${h}${P}`;case"**/.*":return`(?:${R}${v(s)}${p})?${l}${h}${P}`;default:{const e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;const n=E(e[1]);if(!n)return;return n+l+e[2]}}},A=e.removePrefix(r,{negated:!1,prefix:""});let x=E(A);return x&&!0!==s.strictSlashes&&(x+=`${p}?`),x},yt=c}(),o=Ot(),s=Ct(),i=(t,e,n=!1)=>{if(Array.isArray(t)){const r=t.map(t=>i(t,e,n)),o=t=>{for(const e of r){const n=e(t);if(n)return n}return!1};return o}const r=(s=t)&&"object"==typeof s&&!Array.isArray(s)&&t.tokens&&t.input;var s;if(""===t||"string"!=typeof t&&!r)throw new TypeError("Expected pattern to be a non-empty string");const a=e||{},u=o.isWindows(e),c=r?i.compileRe(t,e):i.makeRe(t,e,!1,!0),l=c.state;delete c.state;let p=()=>!1;if(a.ignore){const t={...e,ignore:null,onMatch:null,onResult:null};p=i(a.ignore,t,n)}const h=(n,r=!1)=>{const{isMatch:o,match:s,output:h}=i.test(n,c,e,{glob:t,posix:u}),f={glob:t,state:l,regex:c,posix:u,input:n,output:h,match:s,isMatch:o};return"function"==typeof a.onResult&&a.onResult(f),!1===o?(f.isMatch=!1,!!r&&f):p(n)?("function"==typeof a.onIgnore&&a.onIgnore(f),f.isMatch=!1,!!r&&f):("function"==typeof a.onMatch&&a.onMatch(f),!r||f)};return n&&(h.state=l),h};return i.test=(t,e,n,{glob:r,posix:s}={})=>{if("string"!=typeof t)throw new TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};const a=n||{},u=a.format||(s?o.toPosixSlashes:null);let c=t===r,l=c&&u?u(t):t;return!1===c&&(l=u?u(t):t,c=l===r),!1!==c&&!0!==a.capture||(c=!0===a.matchBase||!0===a.basename?i.matchBase(t,e,n,s):e.exec(l)),{isMatch:Boolean(c),match:c,output:l}},i.matchBase=(e,n,r,s=o.isWindows(r))=>(n instanceof RegExp?n:i.makeRe(n,r)).test(t.basename(e)),i.isMatch=(t,e,n)=>i(e,n)(t),i.parse=(t,e)=>Array.isArray(t)?t.map(t=>i.parse(t,e)):n(t,{...e,fastpaths:!1}),i.scan=(t,n)=>e(t,n),i.compileRe=(t,e,n=!1,r=!1)=>{if(!0===n)return t.output;const o=e||{},s=o.contains?"":"^",a=o.contains?"":"$";let u=`${s}(?:${t.output})${a}`;t&&!0===t.negated&&(u=`^(?!${u}).*$`);const c=i.toRegex(u,e);return!0===r&&(c.state=t),c},i.makeRe=(t,e={},r=!1,o=!1)=>{if(!t||"string"!=typeof t)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===e.fastpaths||"."!==t[0]&&"*"!==t[0]||(s.output=n.fastpaths(t,e)),s.output||(s=n(t,e)),i.compileRe(s,e,r,o)},i.toRegex=(t,e)=>{try{const n=e||{};return new RegExp(t,n.flags||(n.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},i.constants=s,Rt=i}function $t(){return Pt?St:(Pt=1,St=wt())}function Tt(){if(At)return j;At=1,Object.defineProperty(j,"__esModule",{value:!0}),j.isAbsolute=j.partitionAbsoluteAndRelative=j.removeDuplicateSlashes=j.matchAny=j.convertPatternsToRe=j.makeRe=j.getPatternParts=j.expandBraceExpansion=j.expandPatternsWithBraceExpansion=j.isAffectDepthOfReadingPattern=j.endsWithSlashGlobStar=j.hasGlobStar=j.getBaseDirectory=j.isPatternRelatedToParentDirectory=j.getPatternsOutsideCurrentDirectory=j.getPatternsInsideCurrentDirectory=j.getPositivePatterns=j.getNegativePatterns=j.isPositivePattern=j.isNegativePattern=j.convertToNegativePattern=j.convertToPositivePattern=j.isDynamicPattern=j.isStaticPattern=void 0;const t=r,e=D(),n=function(){if(Et)return vt;Et=1;const t=o,e=pt(),n=$t(),r=Ot(),s=t=>""===t||"./"===t,i=t=>{const e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},a=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let o=new Set,s=new Set,i=new Set,a=0,u=t=>{i.add(t.output),r&&r.onResult&&r.onResult(t)};for(let i=0;i<e.length;i++){let c=n(String(e[i]),{...r,onResult:u},!0),l=c.state.negated||c.state.negatedExtglob;l&&a++;for(let e of t){let t=c(e,!0);(l?!t.isMatch:t.isMatch)&&(l?o.add(t.output):(o.delete(t.output),s.add(t.output)))}}let c=(a===e.length?[...i]:[...s]).filter(t=>!o.has(t));if(r&&0===c.length){if(!0===r.failglob)throw new Error(`No matches found for "${e.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?e.map(t=>t.replace(/\\/g,"")):e}return c};return a.match=a,a.matcher=(t,e)=>n(t,e),a.any=a.isMatch=(t,e,r)=>n(e,r)(t),a.not=(t,e,n={})=>{e=[].concat(e).map(String);let r=new Set,o=[],s=new Set(a(t,e,{...n,onResult:t=>{n.onResult&&n.onResult(t),o.push(t.output)}}));for(let t of o)s.has(t)||r.add(t);return[...r]},a.contains=(e,n,r)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${t.inspect(e)}"`);if(Array.isArray(n))return n.some(t=>a.contains(e,t,r));if("string"==typeof n){if(s(e)||s(n))return!1;if(e.includes(n)||e.startsWith("./")&&e.slice(2).includes(n))return!0}return a.isMatch(e,n,{...r,contains:!0})},a.matchKeys=(t,e,n)=>{if(!r.isObject(t))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(t),e,n),s={};for(let e of o)s[e]=t[e];return s},a.some=(t,e,r)=>{let o=[].concat(t);for(let t of[].concat(e)){let e=n(String(t),r);if(o.some(t=>e(t)))return!0}return!1},a.every=(t,e,r)=>{let o=[].concat(t);for(let t of[].concat(e)){let e=n(String(t),r);if(!o.every(t=>e(t)))return!1}return!0},a.all=(e,r,o)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${t.inspect(e)}"`);return[].concat(r).every(t=>n(t,o)(e))},a.capture=(t,e,o)=>{let s=r.isWindows(o),i=n.makeRe(String(t),{...o,capture:!0}).exec(s?r.toPosixSlashes(e):e);if(i)return i.slice(1).map(t=>void 0===t?"":t)},a.makeRe=(...t)=>n.makeRe(...t),a.scan=(...t)=>n.scan(...t),a.parse=(t,r)=>{let o=[];for(let s of[].concat(t||[]))for(let t of e(String(s),r))o.push(n.parse(t,r));return o},a.braces=(t,n)=>{if("string"!=typeof t)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!i(t)?[t]:e(t,n)},a.braceExpand=(t,e)=>{if("string"!=typeof t)throw new TypeError("Expected a string");return a.braces(t,{...e,expand:!0})},a.hasBraces=i,vt=a}(),s=/[*?]|^!/,i=/\[[^[]*]/,a=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,u=/[!*+?@]\([^(]*\)/,c=/,|\.\./,l=/(?!^)\/{2,}/g;function p(t,e={}){return!h(t,e)}function h(t,e={}){return""!==t&&(!(!1!==e.caseSensitiveMatch&&!t.includes("\\"))||(!!(s.test(t)||i.test(t)||a.test(t))||(!(!1===e.extglob||!u.test(t))||!(!1===e.braceExpansion||!function(t){const e=t.indexOf("{");if(-1===e)return!1;const n=t.indexOf("}",e+1);if(-1===n)return!1;const r=t.slice(e,n);return c.test(r)}(t)))))}function f(t){return t.startsWith("!")&&"("!==t[1]}function d(t){return!f(t)}function g(t){return t.startsWith("..")||t.startsWith("./..")}function m(t){return t.endsWith("/**")}function y(t){const e=n.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((t,e)=>t.length-e.length),e.filter(t=>""!==t)}function _(t,e){return n.makeRe(t,e)}function R(e){return t.isAbsolute(e)}return j.isStaticPattern=p,j.isDynamicPattern=h,j.convertToPositivePattern=function(t){return f(t)?t.slice(1):t},j.convertToNegativePattern=function(t){return"!"+t},j.isNegativePattern=f,j.isPositivePattern=d,j.getNegativePatterns=function(t){return t.filter(f)},j.getPositivePatterns=function(t){return t.filter(d)},j.getPatternsInsideCurrentDirectory=function(t){return t.filter(t=>!g(t))},j.getPatternsOutsideCurrentDirectory=function(t){return t.filter(g)},j.isPatternRelatedToParentDirectory=g,j.getBaseDirectory=function(t){return e(t,{flipBackslashes:!1})},j.hasGlobStar=function(t){return t.includes("**")},j.endsWithSlashGlobStar=m,j.isAffectDepthOfReadingPattern=function(e){const n=t.basename(e);return m(e)||p(n)},j.expandPatternsWithBraceExpansion=function(t){return t.reduce((t,e)=>t.concat(y(e)),[])},j.expandBraceExpansion=y,j.getPatternParts=function(t,e){let{parts:r}=n.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return 0===r.length&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r},j.makeRe=_,j.convertPatternsToRe=function(t,e){return t.map(t=>_(t,e))},j.matchAny=function(t,e){return e.some(e=>e.test(t))},j.removeDuplicateSlashes=function(t){return t.replace(l,"/")},j.partitionAbsoluteAndRelative=function(t){const e=[],n=[];for(const r of t)R(r)?e.push(r):n.push(r);return[e,n]},j.isAbsolute=R,j}var kt,Mt,Lt,jt={};function Ht(){if(Mt)return kt;Mt=1;const t=s.PassThrough,e=Array.prototype.slice;function n(e,r){if(Array.isArray(e))for(let t=0,o=e.length;t<o;t++)e[t]=n(e[t],r);else{if(!e._readableState&&e.pipe&&(e=e.pipe(t(r))),!e._readableState||!e.pause||!e.pipe)throw new Error("Only readable stream can be merged.");e.pause()}return e}return kt=function(){const r=[],o=e.call(arguments);let s=!1,i=o[o.length-1];i&&!Array.isArray(i)&&null==i.pipe?o.pop():i={};const a=!1!==i.end,u=!0===i.pipeError;null==i.objectMode&&(i.objectMode=!0);null==i.highWaterMark&&(i.highWaterMark=65536);const c=t(i);function l(){for(let t=0,e=arguments.length;t<e;t++)r.push(n(arguments[t],i));return p(),this}function p(){if(s)return;s=!0;let t=r.shift();if(!t)return void process.nextTick(h);Array.isArray(t)||(t=[t]);let e=t.length+1;function n(){--e>0||(s=!1,p())}function o(t){function e(){t.removeListener("merge2UnpipeEnd",e),t.removeListener("end",e),u&&t.removeListener("error",r),n()}function r(t){c.emit("error",t)}if(t._readableState.endEmitted)return n();t.on("merge2UnpipeEnd",e),t.on("end",e),u&&t.on("error",r),t.pipe(c,{end:!1}),t.resume()}for(let e=0;e<t.length;e++)o(t[e]);n()}function h(){s=!1,c.emit("queueDrain"),a&&c.end()}c.setMaxListeners(0),c.add=l,c.on("unpipe",function(t){t.emit("merge2UnpipeEnd")}),o.length&&l.apply(null,o);return c},kt}var Ft,Dt,Nt,It={};function Bt(){if(Ft)return It;return Ft=1,Object.defineProperty(It,"__esModule",{value:!0}),It.isEmpty=It.isString=void 0,It.isString=function(t){return"string"==typeof t},It.isEmpty=function(t){return""===t},It}function Wt(){if(Dt)return _;Dt=1,Object.defineProperty(_,"__esModule",{value:!0}),_.string=_.stream=_.pattern=_.path=_.fs=_.errno=_.array=void 0;const t=b();_.array=t;const e=v();_.errno=e;const n=function(){if(E)return A;E=1,Object.defineProperty(A,"__esModule",{value:!0}),A.createDirentFromStats=void 0;class t{constructor(t,e){this.name=t,this.isBlockDevice=e.isBlockDevice.bind(e),this.isCharacterDevice=e.isCharacterDevice.bind(e),this.isDirectory=e.isDirectory.bind(e),this.isFIFO=e.isFIFO.bind(e),this.isFile=e.isFile.bind(e),this.isSocket=e.isSocket.bind(e),this.isSymbolicLink=e.isSymbolicLink.bind(e)}}return A.createDirentFromStats=function(e,n){return new t(e,n)},A}();_.fs=n;const r=O();_.path=r;const o=Tt();_.pattern=o;const s=function(){if(Lt)return jt;Lt=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.merge=void 0;const t=Ht();function e(t){t.forEach(t=>t.emit("close"))}return jt.merge=function(n){const r=t(n);return n.forEach(t=>{t.once("error",t=>r.emit("error",t))}),r.once("close",()=>e(n)),r.once("end",()=>e(n)),r},jt}();_.stream=s;const i=Bt();return _.string=i,_}var Gt,Ut={},Kt={},Vt={},Qt={},qt={},zt={},Xt={},Yt={},Zt={};function Jt(){if(Gt)return Zt;function t(t,e){t(e)}function e(t,e){t(null,e)}return Gt=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.read=void 0,Zt.read=function(n,r,o){r.fs.lstat(n,(s,i)=>{null===s?i.isSymbolicLink()&&r.followSymbolicLink?r.fs.stat(n,(n,s)=>{if(null!==n)return r.throwErrorOnBrokenSymbolicLink?void t(o,n):void e(o,i);r.markSymbolicLink&&(s.isSymbolicLink=()=>!0),e(o,s)}):e(o,i):t(o,s)})},Zt}var te,ee={};var ne,re,oe,se,ie,ae,ue,ce={},le={};function pe(){if(re)return ce;re=1,Object.defineProperty(ce,"__esModule",{value:!0});const t=(ne||(ne=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;const e=a;t.FILE_SYSTEM_ADAPTER={lstat:e.lstat,stat:e.stat,lstatSync:e.lstatSync,statSync:e.statSync},t.createFileSystemAdapter=function(e){return void 0===e?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}}(le)),le);return ce.default=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=t.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(t,e){return null!=t?t:e}},ce}function he(){if(oe)return Yt;oe=1,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.statSync=Yt.stat=Yt.Settings=void 0;const t=Jt(),e=(te||(te=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.read=void 0,ee.read=function(t,e){const n=e.fs.lstatSync(t);if(!n.isSymbolicLink()||!e.followSymbolicLink)return n;try{const n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(t){if(!e.throwErrorOnBrokenSymbolicLink)return n;throw t}}),ee),n=pe();function r(t={}){return t instanceof n.default?t:new n.default(t)}return Yt.Settings=n.default,Yt.stat=function(e,n,o){"function"!=typeof n?t.read(e,r(n),o):t.read(e,r(),n)},Yt.statSync=function(t,n){const o=r(n);return e.read(t,o)},Yt}function fe(){if(ie)return se;let t;return ie=1,se="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:d):e=>(t||(t=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0))}var de,ge={};function me(){if(de)return ge;de=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const t=process.versions.node.split(".");if(void 0===t[0]||void 0===t[1])throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);const e=Number.parseInt(t[0],10),n=Number.parseInt(t[1],10),r=e>10,o=10===e&&n>=10;return ge.IS_SUPPORT_READDIR_WITH_FILE_TYPES=r||o,ge}var ye,_e,Re={},be={};function Se(){if(_e)return Re;_e=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.fs=void 0;const t=function(){if(ye)return be;ye=1,Object.defineProperty(be,"__esModule",{value:!0}),be.createDirentFromStats=void 0;class t{constructor(t,e){this.name=t,this.isBlockDevice=e.isBlockDevice.bind(e),this.isCharacterDevice=e.isCharacterDevice.bind(e),this.isDirectory=e.isDirectory.bind(e),this.isFIFO=e.isFIFO.bind(e),this.isFile=e.isFile.bind(e),this.isSocket=e.isSocket.bind(e),this.isSymbolicLink=e.isSymbolicLink.bind(e)}}return be.createDirentFromStats=function(e,n){return new t(e,n)},be}();return Re.fs=t,Re}var Pe,ve,Ee={};function Ae(){if(Pe)return Ee;return Pe=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.joinPathSegments=void 0,Ee.joinPathSegments=function(t,e,n){return t.endsWith(n)?t+e:t+n+e},Ee}function xe(){if(ve)return Xt;ve=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.readdir=Xt.readdirWithFileTypes=Xt.read=void 0;const t=he(),e=function(){if(ue)return ae;ue=1,ae=function(e,n){let r,o,s,i=!0;function a(e){function o(){n&&n(e,r),n=null}i?t(o):o()}function u(t,e,n){r[t]=n,(0===--o||e)&&a(e)}Array.isArray(e)?(r=[],o=e.length):(s=Object.keys(e),r={},o=s.length),o?s?s.forEach(function(t){e[t](function(e,n){u(t,e,n)})}):e.forEach(function(t,e){t(function(t,n){u(e,t,n)})}):a(null),i=!1};const t=fe();return ae}(),n=me(),r=Se(),o=Ae();function s(t,n,s){n.fs.readdir(t,{withFileTypes:!0},(i,c)=>{if(null!==i)return void a(s,i);const l=c.map(e=>({dirent:e,name:e.name,path:o.joinPathSegments(t,e.name,n.pathSegmentSeparator)}));if(!n.followSymbolicLinks)return void u(s,l);const p=l.map(t=>function(t,e){return n=>{t.dirent.isSymbolicLink()?e.fs.stat(t.path,(o,s)=>{if(null!==o)return e.throwErrorOnBrokenSymbolicLink?void n(o):void n(null,t);t.dirent=r.fs.createDirentFromStats(t.name,s),n(null,t)}):n(null,t)}}(t,n));e(p,(t,e)=>{null===t?u(s,e):a(s,t)})})}function i(n,s,i){s.fs.readdir(n,(c,l)=>{if(null!==c)return void a(i,c);const p=l.map(e=>{const i=o.joinPathSegments(n,e,s.pathSegmentSeparator);return n=>{t.stat(i,s.fsStatSettings,(t,o)=>{if(null!==t)return void n(t);const a={name:e,path:i,dirent:r.fs.createDirentFromStats(e,o)};s.stats&&(a.stats=o),n(null,a)})}});e(p,(t,e)=>{null===t?u(i,e):a(i,t)})})}function a(t,e){t(e)}function u(t,e){t(null,e)}return Xt.read=function(t,e,r){e.stats||!n.IS_SUPPORT_READDIR_WITH_FILE_TYPES?i(t,e,r):s(t,e,r)},Xt.readdirWithFileTypes=s,Xt.readdir=i,Xt}var Ce,Oe={};var we,$e,Te,ke={},Me={};function Le(){return we||(we=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;const e=a;t.FILE_SYSTEM_ADAPTER={lstat:e.lstat,stat:e.stat,lstatSync:e.lstatSync,statSync:e.statSync,readdir:e.readdir,readdirSync:e.readdirSync},t.createFileSystemAdapter=function(e){return void 0===e?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}}(Me)),Me}function je(){if(Te)return zt;Te=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.Settings=zt.scandirSync=zt.scandir=void 0;const t=xe(),e=function(){if(Ce)return Oe;Ce=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.readdir=Oe.readdirWithFileTypes=Oe.read=void 0;const t=he(),e=me(),n=Se(),r=Ae();function o(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(o=>{const s={dirent:o,name:o.name,path:r.joinPathSegments(t,o.name,e.pathSegmentSeparator)};if(s.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{const t=e.fs.statSync(s.path);s.dirent=n.fs.createDirentFromStats(s.name,t)}catch(t){if(e.throwErrorOnBrokenSymbolicLink)throw t}return s})}function s(e,o){return o.fs.readdirSync(e).map(s=>{const i=r.joinPathSegments(e,s,o.pathSegmentSeparator),a=t.statSync(i,o.fsStatSettings),u={name:s,path:i,dirent:n.fs.createDirentFromStats(s,a)};return o.stats&&(u.stats=a),u})}return Oe.read=function(t,n){return!n.stats&&e.IS_SUPPORT_READDIR_WITH_FILE_TYPES?o(t,n):s(t,n)},Oe.readdirWithFileTypes=o,Oe.readdir=s,Oe}(),n=function(){if($e)return ke;$e=1,Object.defineProperty(ke,"__esModule",{value:!0});const t=r,e=he(),n=Le();return ke.default=class{constructor(r={}){this._options=r,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=n.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,t.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new e.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(t,e){return null!=t?t:e}},ke}();function o(t={}){return t instanceof n.default?t:new n.default(t)}return zt.Settings=n.default,zt.scandir=function(e,n,r){"function"!=typeof n?t.read(e,o(n),r):t.read(e,o(),n)},zt.scandirSync=function(t,n){const r=o(n);return e.read(t,r)},zt}var He,Fe,De,Ne={exports:{}};function Ie(){if(De)return Ne.exports;De=1;var t=Fe?He:(Fe=1,He=function(t){var e=new t,n=e;return{get:function(){var r=e;return r.next?e=r.next:(e=new t,n=e),r.next=null,r},release:function(t){n.next=t,n=t}}});function e(e,o,s){if("function"==typeof e&&(s=o,o=e,e=null),!(s>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var i=t(r),a=null,u=null,c=0,l=null,p={push:function(t,r){var f=i.get();f.context=e,f.release=h,f.value=t,f.callback=r||n,f.errorHandler=l,c>=s||p.paused?u?(u.next=f,u=f):(a=f,u=f,p.saturated()):(c++,o.call(e,f.value,f.worked))},drain:n,saturated:n,pause:function(){p.paused=!0},paused:!1,get concurrency(){return s},set concurrency(t){if(!(t>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(s=t,!p.paused)for(;a&&c<s;)c++,h()},running:function(){return c},resume:function(){if(!p.paused)return;if(p.paused=!1,null===a)return c++,void h();for(;a&&c<s;)c++,h()},idle:function(){return 0===c&&0===p.length()},length:function(){var t=a,e=0;for(;t;)t=t.next,e++;return e},getQueue:function(){var t=a,e=[];for(;t;)e.push(t.value),t=t.next;return e},unshift:function(t,r){var f=i.get();f.context=e,f.release=h,f.value=t,f.callback=r||n,f.errorHandler=l,c>=s||p.paused?a?(f.next=a,a=f):(a=f,u=f,p.saturated()):(c++,o.call(e,f.value,f.worked))},empty:n,kill:function(){a=null,u=null,p.drain=n},killAndDrain:function(){a=null,u=null,p.drain(),p.drain=n},error:function(t){l=t},abort:function(){var t=a;a=null,u=null;for(;t;){var e=t.next,r=t.callback,o=t.errorHandler,s=t.value,i=t.context;t.value=null,t.callback=n,t.errorHandler=null,o&&o(new Error("abort"),s),r.call(i,new Error("abort")),t.release(t),t=e}p.drain=n}};return p;function h(t){t&&i.release(t);var n=a;n&&c<=s?p.paused?c--:(u===a&&(u=null),a=n.next,n.next=null,o.call(e,n.value,n.worked),null===u&&p.empty()):0===--c&&p.drain()}}function n(){}function r(){this.value=null,this.callback=n,this.next=null,this.release=n,this.context=null,this.errorHandler=null;var t=this;this.worked=function(e,r){var o=t.callback,s=t.errorHandler,i=t.value;t.value=null,t.callback=n,t.errorHandler&&s(e,i),o.call(t.context,e,r),t.release(t)}}return Ne.exports=e,Ne.exports.promise=function(t,r,o){"function"==typeof t&&(o=r,r=t,t=null);var s=e(t,function(t,e){r.call(this,t).then(function(t){e(null,t)},e)},o),i=s.push,a=s.unshift;return s.push=function(t){var e=new Promise(function(e,n){i(t,function(t,r){t?n(t):e(r)})});return e.catch(n),e},s.unshift=function(t){var e=new Promise(function(e,n){a(t,function(t,r){t?n(t):e(r)})});return e.catch(n),e},s.drained=function(){return new Promise(function(t){process.nextTick(function(){if(s.idle())t();else{var e=s.drain;s.drain=function(){"function"==typeof e&&e(),t(),s.drain=e}}})})},s},Ne.exports}var Be,We={};function Ge(){if(Be)return We;return Be=1,Object.defineProperty(We,"__esModule",{value:!0}),We.joinPathSegments=We.replacePathSegmentSeparator=We.isAppliedFilter=We.isFatalError=void 0,We.isFatalError=function(t,e){return null===t.errorFilter||!t.errorFilter(e)},We.isAppliedFilter=function(t,e){return null===t||t(e)},We.replacePathSegmentSeparator=function(t,e){return t.split(/[/\\]/).join(e)},We.joinPathSegments=function(t,e,n){return""===t?e:t.endsWith(n)?t+e:t+n+e},We}var Ue,Ke,Ve,Qe={};function qe(){if(Ue)return Qe;Ue=1,Object.defineProperty(Qe,"__esModule",{value:!0});const t=Ge();return Qe.default=class{constructor(e,n){this._root=e,this._settings=n,this._root=t.replacePathSegmentSeparator(e,n.pathSegmentSeparator)}},Qe}function ze(){if(Ke)return qt;Ke=1,Object.defineProperty(qt,"__esModule",{value:!0});const t=i,e=je(),n=Ie(),r=Ge(),o=qe();class s extends o.default{constructor(r,o){super(r,o),this._settings=o,this._scandir=e.scandir,this._emitter=new t.EventEmitter,this._queue=n(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(t){this._emitter.on("entry",t)}onError(t){this._emitter.once("error",t)}onEnd(t){this._emitter.once("end",t)}_pushToQueue(t,e){const n={directory:t,base:e};this._queue.push(n,t=>{null!==t&&this._handleError(t)})}_worker(t,e){this._scandir(t.directory,this._settings.fsScandirSettings,(n,r)=>{if(null===n){for(const e of r)this._handleEntry(e,t.base);e(null,void 0)}else e(n,void 0)})}_handleError(t){!this._isDestroyed&&r.isFatalError(this._settings,t)&&(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",t))}_handleEntry(t,e){if(this._isDestroyed||this._isFatalError)return;const n=t.path;void 0!==e&&(t.path=r.joinPathSegments(e,t.name,this._settings.pathSegmentSeparator)),r.isAppliedFilter(this._settings.entryFilter,t)&&this._emitEntry(t),t.dirent.isDirectory()&&r.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(n,void 0===e?void 0:t.path)}_emitEntry(t){this._emitter.emit("entry",t)}}return qt.default=s,qt}var Xe,Ye={};var Ze,Je,tn={},en={};function nn(){if(Je)return tn;Je=1,Object.defineProperty(tn,"__esModule",{value:!0});const t=function(){if(Ze)return en;Ze=1,Object.defineProperty(en,"__esModule",{value:!0});const t=je(),e=Ge(),n=qe();class r extends n.default{constructor(){super(...arguments),this._scandir=t.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(t,e){this._queue.add({directory:t,base:e})}_handleQueue(){for(const t of this._queue.values())this._handleDirectory(t.directory,t.base)}_handleDirectory(t,e){try{const n=this._scandir(t,this._settings.fsScandirSettings);for(const t of n)this._handleEntry(t,e)}catch(t){this._handleError(t)}}_handleError(t){if(e.isFatalError(this._settings,t))throw t}_handleEntry(t,n){const r=t.path;void 0!==n&&(t.path=e.joinPathSegments(n,t.name,this._settings.pathSegmentSeparator)),e.isAppliedFilter(this._settings.entryFilter,t)&&this._pushToStorage(t),t.dirent.isDirectory()&&e.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(r,void 0===n?void 0:t.path)}_pushToStorage(t){this._storage.push(t)}}return en.default=r,en}();return tn.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings)}read(){return this._reader.read()}},tn}var rn,on,sn={};function an(){if(on)return Vt;on=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.Settings=Vt.walkStream=Vt.walkSync=Vt.walk=void 0;const t=function(){if(Ve)return Qt;Ve=1,Object.defineProperty(Qt,"__esModule",{value:!0});const t=ze();return Qt.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings),this._storage=[]}read(t){this._reader.onError(e=>{!function(t,e){t(e)}(t,e)}),this._reader.onEntry(t=>{this._storage.push(t)}),this._reader.onEnd(()=>{!function(t,e){t(null,e)}(t,this._storage)}),this._reader.read()}},Qt}(),e=function(){if(Xe)return Ye;Xe=1,Object.defineProperty(Ye,"__esModule",{value:!0});const t=s,e=ze();return Ye.default=class{constructor(n,r){this._root=n,this._settings=r,this._reader=new e.default(this._root,this._settings),this._stream=new t.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(t=>{this._stream.emit("error",t)}),this._reader.onEntry(t=>{this._stream.push(t)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}},Ye}(),n=nn(),o=function(){if(rn)return sn;rn=1,Object.defineProperty(sn,"__esModule",{value:!0});const t=r,e=je();return sn.default=class{constructor(n={}){this._options=n,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,t.sep),this.fsScandirSettings=new e.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(t,e){return null!=t?t:e}},sn}();function i(t={}){return t instanceof o.default?t:new o.default(t)}return Vt.Settings=o.default,Vt.walk=function(e,n,r){"function"!=typeof n?new t.default(e,i(n)).read(r):new t.default(e,i()).read(n)},Vt.walkSync=function(t,e){const r=i(e);return new n.default(t,r).read()},Vt.walkStream=function(t,n){const r=i(n);return new e.default(t,r).read()},Vt}var un,cn={};function ln(){if(un)return cn;un=1,Object.defineProperty(cn,"__esModule",{value:!0});const t=r,e=he(),n=Wt();return cn.default=class{constructor(t){this._settings=t,this._fsStatSettings=new e.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return t.resolve(this._settings.cwd,e)}_makeEntry(t,e){const r={name:e,path:e,dirent:n.fs.createDirentFromStats(e,t)};return this._settings.stats&&(r.stats=t),r}_isFatalError(t){return!n.errno.isEnoentCodeError(t)&&!this._settings.suppressErrors}},cn}var pn,hn,fn={};function dn(){if(pn)return fn;pn=1,Object.defineProperty(fn,"__esModule",{value:!0});const t=s,e=he(),n=an(),r=ln();class o extends r.default{constructor(){super(...arguments),this._walkStream=n.walkStream,this._stat=e.stat}dynamic(t,e){return this._walkStream(t,e)}static(e,n){const r=e.map(this._getFullEntryPath,this),o=new t.PassThrough({objectMode:!0});o._write=(t,s,i)=>this._getEntry(r[t],e[t],n).then(e=>{null!==e&&n.entryFilter(e)&&o.push(e),t===r.length-1&&o.end(),i()}).catch(i);for(let t=0;t<r.length;t++)o.write(t);return o}_getEntry(t,e,n){return this._getStat(t).then(t=>this._makeEntry(t,e)).catch(t=>{if(n.errorFilter(t))return null;throw t})}_getStat(t){return new Promise((e,n)=>{this._stat(t,this._fsStatSettings,(t,r)=>null===t?e(r):n(t))})}}return fn.default=o,fn}var gn,mn,yn,_n={},Rn={},bn={},Sn={};function Pn(){if(mn)return bn;mn=1,Object.defineProperty(bn,"__esModule",{value:!0});const t=function(){if(gn)return Sn;gn=1,Object.defineProperty(Sn,"__esModule",{value:!0});const t=Wt();return Sn.default=class{constructor(t,e,n){this._patterns=t,this._settings=e,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(const t of this._patterns){const e=this._getPatternSegments(t),n=this._splitSegmentsIntoSections(e);this._storage.push({complete:n.length<=1,pattern:t,segments:e,sections:n})}}_getPatternSegments(e){return t.pattern.getPatternParts(e,this._micromatchOptions).map(e=>t.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:t.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e})}_splitSegmentsIntoSections(e){return t.array.splitWhen(e,e=>e.dynamic&&t.pattern.hasGlobStar(e.pattern))}},Sn}();class e extends t.default{match(t){const e=t.split("/"),n=e.length,r=this._storage.filter(t=>!t.complete||t.segments.length>n);for(const t of r){const r=t.sections[0];if(!t.complete&&n>r.length)return!0;if(e.every((e,n)=>{const r=t.segments[n];return!(!r.dynamic||!r.patternRe.test(e))||!r.dynamic&&r.pattern===e}))return!0}return!1}}return bn.default=e,bn}var vn,En={};var An,xn={};var Cn,On,wn,$n={};function Tn(){if(On)return _n;On=1,Object.defineProperty(_n,"__esModule",{value:!0});const t=r,e=function(){if(yn)return Rn;yn=1,Object.defineProperty(Rn,"__esModule",{value:!0});const t=Wt(),e=Pn();return Rn.default=class{constructor(t,e){this._settings=t,this._micromatchOptions=e}getFilter(t,e,n){const r=this._getMatcher(e),o=this._getNegativePatternsRe(n);return e=>this._filter(t,e,r,o)}_getMatcher(t){return new e.default(t,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){const n=e.filter(t.pattern.isAffectDepthOfReadingPattern);return t.pattern.convertPatternsToRe(n,this._micromatchOptions)}_filter(e,n,r,o){if(this._isSkippedByDeep(e,n.path))return!1;if(this._isSkippedSymbolicLink(n))return!1;const s=t.path.removeLeadingDotSegment(n.path);return!this._isSkippedByPositivePatterns(s,r)&&this._isSkippedByNegativePatterns(s,o)}_isSkippedByDeep(t,e){return this._settings.deep!==1/0&&this._getEntryLevel(t,e)>=this._settings.deep}_getEntryLevel(t,e){const n=e.split("/").length;return""===t?n:n-t.split("/").length}_isSkippedSymbolicLink(t){return!this._settings.followSymbolicLinks&&t.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(t,e){return!this._settings.baseNameMatch&&!e.match(t)}_isSkippedByNegativePatterns(e,n){return!t.pattern.matchAny(e,n)}},Rn}(),n=function(){if(vn)return En;vn=1,Object.defineProperty(En,"__esModule",{value:!0});const t=Wt();return En.default=class{constructor(t,e){this._settings=t,this._micromatchOptions=e,this.index=new Map}getFilter(e,n){const[r,o]=t.pattern.partitionAbsoluteAndRelative(n),s={positive:{all:t.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:t.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:t.pattern.convertPatternsToRe(o,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return t=>this._filter(t,s)}_filter(e,n){const r=t.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(r))return!1;if(this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;const o=this._isMatchToPatternsSet(r,n,e.dirent.isDirectory());return this._settings.unique&&o&&this._createIndexRecord(r),o}_isDuplicateEntry(t){return this.index.has(t)}_createIndexRecord(t){this.index.set(t,void 0)}_onlyFileFilter(t){return this._settings.onlyFiles&&!t.dirent.isFile()}_onlyDirectoryFilter(t){return this._settings.onlyDirectories&&!t.dirent.isDirectory()}_isMatchToPatternsSet(t,e,n){return!!this._isMatchToPatterns(t,e.positive.all,n)&&(!this._isMatchToPatterns(t,e.negative.relative,n)&&!this._isMatchToAbsoluteNegative(t,e.negative.absolute,n))}_isMatchToAbsoluteNegative(e,n,r){if(0===n.length)return!1;const o=t.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(o,n,r)}_isMatchToPatterns(e,n,r){if(0===n.length)return!1;const o=t.pattern.matchAny(e,n);return!o&&r?t.pattern.matchAny(e+"/",n):o}},En}(),o=function(){if(An)return xn;An=1,Object.defineProperty(xn,"__esModule",{value:!0});const t=Wt();return xn.default=class{constructor(t){this._settings=t}getFilter(){return t=>this._isNonFatalError(t)}_isNonFatalError(e){return t.errno.isEnoentCodeError(e)||this._settings.suppressErrors}},xn}(),s=function(){if(Cn)return $n;Cn=1,Object.defineProperty($n,"__esModule",{value:!0});const t=Wt();return $n.default=class{constructor(t){this._settings=t}getTransformer(){return t=>this._transform(t)}_transform(e){let n=e.path;return this._settings.absolute&&(n=t.path.makeAbsolute(this._settings.cwd,n),n=t.path.unixify(n)),this._settings.markDirectories&&e.dirent.isDirectory()&&(n+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:n}):n}},$n}();return _n.default=class{constructor(t){this._settings=t,this.errorFilter=new o.default(this._settings),this.entryFilter=new n.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new e.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new s.default(this._settings)}_getRootDirectory(e){return t.resolve(this._settings.cwd,e.base)}_getReaderOptions(t){const e="."===t.base?"":t.base;return{basePath:e,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(e,t.positive,t.negative),entryFilter:this.entryFilter.getFilter(t.positive,t.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}},_n}function kn(){if(wn)return Ut;wn=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=function(){if(hn)return Kt;hn=1,Object.defineProperty(Kt,"__esModule",{value:!0});const t=an(),e=ln(),n=dn();class r extends e.default{constructor(){super(...arguments),this._walkAsync=t.walk,this._readerStream=new n.default(this._settings)}dynamic(t,e){return new Promise((n,r)=>{this._walkAsync(t,e,(t,e)=>{null===t?n(e):r(t)})})}async static(t,e){const n=[],r=this._readerStream.static(t,e);return new Promise((t,e)=>{r.once("error",e),r.on("data",t=>n.push(t)),r.once("end",()=>t(n))})}}return Kt.default=r,Kt}(),e=Tn();class n extends e.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}async read(t){const e=this._getRootDirectory(t),n=this._getReaderOptions(t);return(await this.api(e,t,n)).map(t=>n.transform(t))}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return Ut.default=n,Ut}var Mn,Ln={};var jn,Hn,Fn={},Dn={};function Nn(){if(Hn)return Fn;Hn=1,Object.defineProperty(Fn,"__esModule",{value:!0});const t=function(){if(jn)return Dn;jn=1,Object.defineProperty(Dn,"__esModule",{value:!0});const t=he(),e=an(),n=ln();class r extends n.default{constructor(){super(...arguments),this._walkSync=e.walkSync,this._statSync=t.statSync}dynamic(t,e){return this._walkSync(t,e)}static(t,e){const n=[];for(const r of t){const t=this._getFullEntryPath(r),o=this._getEntry(t,r,e);null!==o&&e.entryFilter(o)&&n.push(o)}return n}_getEntry(t,e,n){try{const n=this._getStat(t);return this._makeEntry(n,e)}catch(t){if(n.errorFilter(t))return null;throw t}}_getStat(t){return this._statSync(t,this._fsStatSettings)}}return Dn.default=r,Dn}(),e=Tn();class n extends e.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}read(t){const e=this._getRootDirectory(t),n=this._getReaderOptions(t);return this.api(e,t,n).map(n.transform)}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return Fn.default=n,Fn}var In,Bn,Wn,Gn={};var Un=function(){if(Wn)return Bn;Wn=1;const t=function(){if(Nt)return y;Nt=1,Object.defineProperty(y,"__esModule",{value:!0}),y.convertPatternGroupToTask=y.convertPatternGroupsToTasks=y.groupPatternsByBaseDirectory=y.getNegativePatternsAsPositive=y.getPositivePatterns=y.convertPatternsToTasks=y.generate=void 0;const t=Wt();function e(e,n){let r=e;return n.braceExpansion&&(r=t.pattern.expandPatternsWithBraceExpansion(r)),n.baseNameMatch&&(r=r.map(t=>t.includes("/")?t:`**/${t}`)),r.map(e=>t.pattern.removeDuplicateSlashes(e))}function n(e,n,r){const o=[],u=t.pattern.getPatternsOutsideCurrentDirectory(e),c=t.pattern.getPatternsInsideCurrentDirectory(e),l=s(u),p=s(c);return o.push(...i(l,n,r)),"."in p?o.push(a(".",c,n,r)):o.push(...i(p,n,r)),o}function r(e){return t.pattern.getPositivePatterns(e)}function o(e,n){return t.pattern.getNegativePatterns(e).concat(n).map(t.pattern.convertToPositivePattern)}function s(e){return e.reduce((e,n)=>{const r=t.pattern.getBaseDirectory(n);return r in e?e[r].push(n):e[r]=[n],e},{})}function i(t,e,n){return Object.keys(t).map(r=>a(r,t[r],e,n))}function a(e,n,r,o){return{dynamic:o,positive:n,negative:r,base:e,patterns:[].concat(n,r.map(t.pattern.convertToNegativePattern))}}return y.generate=function(s,i){const a=e(s,i),u=e(i.ignore,i),c=r(a),l=o(a,u),p=c.filter(e=>t.pattern.isStaticPattern(e,i)),h=c.filter(e=>t.pattern.isDynamicPattern(e,i)),f=n(p,l,!1),d=n(h,l,!0);return f.concat(d)},y.convertPatternsToTasks=n,y.getPositivePatterns=r,y.getNegativePatternsAsPositive=o,y.groupPatternsByBaseDirectory=s,y.convertPatternGroupsToTasks=i,y.convertPatternGroupToTask=a,y}(),e=kn(),r=function(){if(Mn)return Ln;Mn=1,Object.defineProperty(Ln,"__esModule",{value:!0});const t=s,e=dn(),n=Tn();class r extends n.default{constructor(){super(...arguments),this._reader=new e.default(this._settings)}read(e){const n=this._getRootDirectory(e),r=this._getReaderOptions(e),o=this.api(n,e,r),s=new t.Readable({objectMode:!0,read:()=>{}});return o.once("error",t=>s.emit("error",t)).on("data",t=>s.emit("data",r.transform(t))).once("end",()=>s.emit("end")),s.once("close",()=>o.destroy()),s}api(t,e,n){return e.dynamic?this._reader.dynamic(t,n):this._reader.static(e.patterns,n)}}return Ln.default=r,Ln}(),o=Nn(),i=(In||(In=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;const e=a,r=n,o=Math.max(r.cpus().length,1);t.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:e.lstat,lstatSync:e.lstatSync,stat:e.stat,statSync:e.statSync,readdir:e.readdir,readdirSync:e.readdirSync},t.default=class{constructor(t={}){this._options=t,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,o),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(t,e){return void 0===t?e:t}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},t.DEFAULT_FILE_SYSTEM_ADAPTER),e)}}}(Gn)),Gn),u=Wt();async function c(t,n){p(t);const r=l(t,e.default,n),o=await Promise.all(r);return u.array.flatten(o)}function l(e,n,r){const o=[].concat(e),s=new i.default(r),a=t.generate(o,s),u=new n(s);return a.map(u.read,u)}function p(t){if(![].concat(t).every(t=>u.string.isString(t)&&!u.string.isEmpty(t)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}return function(e){function n(t,e){p(t);const n=l(t,o.default,e);return u.array.flatten(n)}function s(t,e){p(t);const n=l(t,r.default,e);return u.stream.merge(n)}var a,c;e.glob=e,e.globSync=n,e.globStream=s,e.async=e,e.sync=n,e.stream=s,e.generateTasks=function(e,n){p(e);const r=[].concat(e),o=new i.default(n);return t.generate(r,o)},e.isDynamicPattern=function(t,e){p(t);const n=new i.default(e);return u.pattern.isDynamicPattern(t,n)},e.escapePath=function(t){return p(t),u.path.escape(t)},e.convertPathToPattern=function(t){return p(t),u.path.convertPathToPattern(t)},(a=e.posix||(e.posix={})).escapePath=function(t){return p(t),u.path.escapePosixPath(t)},a.convertPathToPattern=function(t){return p(t),u.path.convertPosixPathToPattern(t)},(c=e.win32||(e.win32={})).escapePath=function(t){return p(t),u.path.escapeWindowsPath(t)},c.convertPathToPattern=function(t){return p(t),u.path.convertWindowsPathToPattern(t)}}(c||(c={})),Bn=c}(),Kn=g(Un);const Vn={"/home":"/","/root":"/"},Qn=(t,e)=>{const n=t.split("/"),r=n[n.length-1];return r.endsWith(e)?r.slice(0,-e.length):r},qn=t=>{const e=Vn[t];if(e)return e;return"/notfound"===t.toLowerCase()||"/404"===t?"/*":t},zn=t=>{if(t.endsWith(".config.ts")){return"index"===Qn(t,".config.ts")?t.replace("index.config.ts","index.ts"):t.slice(0,-10)+".tsx"}return t.replace("index.config.ts","index.ts")},Xn=t=>{if(t.endsWith(".config.ts")){const e=Qn(t,".config.ts"),n=(t=>{const e=t.split("/");return e.pop(),e.join("/")})(t).replace("/src/pages","");return"index"===e?n||"/":n?`${n}/${e}`:`/${e}`}return t.replace("/src/pages","").replace("/index.config.ts","")||"/"},Yn=async(t,e)=>{const n=[];for(const[r,o]of((t,e)=>Object.keys(t).map(t=>{const n=(r=t).endsWith(".tsx")?r.slice(0,-4)+".config.ts":r.replace("index.ts","index.config.ts");var r;return[n,e[n]||{}]}))(t,e)){const e=zn(r);if(!t[e])continue;const s=o?.path||Xn(r)||"/",i=$r(s),a=qn(i);n.push({...o,path:a,type:o?.type,isRoot:"/root"===i,element:t[e]})}return n},Zn=t=>{if(t.index)return t;if("wrap"!==t.type){const{path:e,children:n,...r}=t;if(Object.keys(r).length>0){return{path:e,children:[{path:"",index:!0,...r},...(n||[]).map(Zn)]}}}return t.children?{...t,children:t.children.map(Zn)}:t},Jn=t=>{const e=(t=>{const e=new Map,n=[],r=new Map,o=t=>{let e=r.get(t);return void 0===e&&(e="/"===t?[]:t.split("/").filter(Boolean),r.set(t,e)),e},s=t.slice().sort((t,e)=>t.path.length-e.path.length);for(const t of s){const r=t.path,s=o(r),i={...t,children:[]};if(e.set(r,i),s.length<=1){n.push(i);continue}const a="/"+s.slice(0,-1).join("/"),u=e.get(a);u?(i.path=s[s.length-1],u.children.push(i)):n.push(i)}return n})(t);return(t=>t.map(Zn))(e)},tr=t=>{const{isRoot:e,type:n,children:r,...o}=t;return r?.length?{...o,children:r.map(tr)}:o},er=t=>{const{children:e}=t;if(!e?.length){const{children:e,...n}=t;return n}const n=e.map(er);if("wrap"===t.type)return{...t,children:n};const{path:r,element:o,type:s,children:i,...a}=t;return o?{path:r,children:[{index:!0,element:o,...a},...n]}:{path:r,...a,children:n}},nr=t=>tr(er(t)),rr=t=>Jn(t).map(nr),or=t=>{if(t.some(t=>t.isRoot))return(t=>{let e,n,r;const o=[];for(const s of t)if(s.isRoot){if(e)throw new Error("There cannot be multiple root routes in a route");e=s}else"/"===s.path?n=s:"/*"===s.path?r=s:o.push(s);if(Cr(o,"path"))throw new Error("There cannot be duplicate paths in a route");const s=[n&&{...n,index:!0},...rr(o)].filter(t=>Boolean(t)),i=[];return e&&i.push(tr({...e,children:s})),r&&i.push(tr(r)),i})(t);if(Cr(t,"path"))throw new Error("There cannot be duplicate paths in a route");return rr(t)},sr=(t,e)=>({import:`import ${t} from './${e}'`,component:`<start><${t} /></end>`,lazy:`const ${t} = lazy(() => import('${e}'))`,lazyComponent:`<start><Suspense><${t} /></Suspense></end>`});const ir=/[/\\]/,ar=/[^a-zA-Z0-9]/g,ur=/^(\d)/,cr="index.tsx",lr=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";function pr(e){const n=t.extname(e),r=t.basename(e,n),o=t.dirname(e).split(ir).filter(Boolean);"index"!==r&&"Index"!==r&&o.push(r);return o.map(t=>{const e=(t=>t.replace(ar,"_").replace(ur,"_$1"))(t);return e.split("_").map(lr).join("")}).join("")||"Component"}const hr=(t,e,n,r,o,s)=>{const i=(t=>t.includes(cr)?t.replace(cr,"index.ts"):t)(Er(t,e)),a=vr(Sr(n,t)),u=((t,e)=>{if(!e.has(t))return e.add(t),t;let n=1;for(;e.has(`${t}_${n}`);)n++;return`${t}_${n}`})(pr(a),s),c=`element(${a})`;r[`/${i}`]=c,o.set(c,{path:a,componentName:u})},fr=(t,e,n,r)=>{const o=Er(t,e);n[`/${o}`]=((t,e,n)=>{const r={};for(const[o,s]of Object.entries(e))if("function"==typeof s){const e=`${t}-${o}`;r[o]=e,n.set(e,`<start>${u(s.toString())}</end>`)}else r[o]=s;return r})(o,br(t),r)};function dr(t,e,n,r,o,s,i,a){const u={},c=t.replace(/^\/+/,""),l=Kn.sync(c,{cwd:e,absolute:!0,onlyFiles:!0}).filter(xr);for(const t of l)if("module"===o){if(t.includes(".config."))continue;hr(t,n,r,u,s,i)}else fr(t,n,u,a);return u}const gr=async(n,r,o,s,i)=>{const a=t.resolve(r,n);if(!e.existsSync(a))throw new Error(`[ono-auto-router] Pages directory does not exist: ${a}`);const u=new Map,c=new Set,l=new Map,p=dr("/**/*.{jsx,tsx}",a,r,o,"module",u,c,l),h=dr("/**/*.config.{js,ts,jsx,tsx}",a,r,o,"config",u,c,l),f=await Yn(p,h),d=((t,e,n,r)=>{let o=t;for(const[t,n]of e){const e=sr(n.componentName,n.path);o=o.replace(t,r?e.lazyComponent:e.component)}for(const[t,e]of n)o=o.replace(t,e);return wr(o)})(function(t,e,n,r){const o=n.length>0?`\n${n.join("\n")}\n`:"";return`// Auto-generated by ono-auto-router\n${r?"import type { RouteObject } from 'react-router-dom'":""}\n${e.join("\n")}\n${r?"\ntype PageConfig = Partial<\n Omit<RouteObject, 'path' | 'Component' | 'element' | 'children'> & {\n path: string\n type?: 'single' | 'wrap'\n }\n>\n":""}${r?"\nexport const defineConfig = (config: PageConfig) => config":""}\n${o}\nexport const routes${r?": RouteObject[]":""} = ${JSON.stringify(t,null,2)}\n`}(or(f),((t,e)=>{if(t)return["import { lazy, Suspense } from 'react'"];const n=[];for(const t of e.values())n.push(sr(t.componentName,t.path).import);return n})(s,u),((t,e)=>{if(!t)return[];const n=[];for(const t of e.values())n.push(sr(t.componentName,t.path).lazy);return n})(s,u),i),u,l,s);Mr(o,d)},mr=(n,r,o,s)=>{const i=t.resolve(r,n);if(!e.existsSync(i))throw new Error(`[ono-auto-router] Pages directory does not exist: ${i}`);const a=o.split(".")[0],u=(t=>`// Auto-generated by ono-auto-router${t?"\nexport { defineConfig } from './defineConfig'":""}\nexport { routes } from './getRoutes'\n`)(s),c=((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport type { RouteRecordRaw } from 'vue-router'":""}\nimport { buildRouteTree } from './buildRouteTree'\nimport { cleanIsRoot } from './cleanIsRoot'\nimport { removeEmptyChildren } from './removeEmptyChildren'${e?"\nimport type { MyRouteObject, PageConfig, PagesComponentType } from './types'":""}\nimport { hasDuplicateProperty, replaceBracketsWithColon } from './utils'\n\nconst pathCache = new Map${e?"<string, { compPath: string; basePath: string }>":""}()\nconst basenameCache = new Map${e?"<string, string>":""}()\n\nconst normalizePagePath = ${e?"(key: string): string":"(key)"} => {\n if (key.includes('index.vue')) return key.replace('index.vue', 'index.ts')\n if (key.includes('root.vue')) return key.replace('root.vue', 'root/index.ts')\n if (key.includes('404.vue')) return key.replace('404.vue', '404/index.ts')\n if (key.toLowerCase().includes('notfound.vue'))\n return key.toLowerCase().replace('notfound.vue', 'notfound/index.ts')\n return key\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath)"} => {\n const cacheKey = ext ? filePath + ':' + ext : filePath\n if (basenameCache.has(cacheKey)) {\n return basenameCache.get(cacheKey)!\n }\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1] || ''\n let result = lastPart\n if (ext && lastPart.endsWith(ext)) {\n result = lastPart.slice(0, -ext.length)\n }\n basenameCache.set(cacheKey, result)\n return result\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getPathsFromConfig = ${e?"(configPath: string)":"(configPath)"} => {\n const cacheKey = configPath\n if (pathCache.has(cacheKey)) {\n return pathCache.get(cacheKey)!\n }\n\n let compPath: string\n let basePath: string\n\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n\n if (fileName === 'index') {\n compPath = configPath.replace('index.config.ts', 'index.ts')\n basePath = dirPath || '/'\n } else {\n compPath = configPath.slice(0, -10) + '.vue'\n basePath = dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n } else {\n compPath = configPath.replace('index.config.ts', 'index.ts')\n basePath =\n configPath.replace('/${t}', '').replace('/index.config.ts', '') ||\n '/'\n }\n\n const result = { compPath, basePath }\n pathCache.set(cacheKey, result)\n return result\n}\n\nconst formatPath = ${e?"(path: string): string":"(path)"} => {\n const lowerPath = path.toLowerCase()\n if (lowerPath === '/home') return '/'\n if (lowerPath === '/notfound' || path === '/404') return '/:pathMatch(.*)*'\n return path.replace('/index.ts', '') || '/'\n}\n\nconst getConfigFileName = ${e?"(pagePath: string): string":"(pagePath)"} => {\n if (pagePath.endsWith('.vue')) {\n return pagePath.slice(0, -4) + '.config.ts'\n }\n return pagePath.replace('index.ts', 'index.config.ts')\n}\n\nconst createBaseRoutes = ()${e?": MyRouteObject[]":""} => {\n const pagesComponent = Object.fromEntries(\n Object.entries({\n ...import.meta.glob('/${t}/**/index.vue'),\n ...import.meta.glob('/${t}/*.vue')\n }${e?" as PagesComponentType":""}).map(([key, value]) => [\n normalizePagePath(key),\n value\n ])\n )\n\n const pagesModule${e?": Record<string, PageConfig>":""} = import.meta.glob(\n '/${t}/**/*.config.ts',\n { eager: true, import: 'default' }\n )\n\n const result${e?": MyRouteObject[]":""} = []\n\n for (const pagePath of Object.keys(pagesComponent)) {\n const configPath = getConfigFileName(pagePath)\n const content = pagesModule[configPath] || {}\n const { compPath, basePath } = getPathsFromConfig(configPath)\n const path = replaceBracketsWithColon(content?.path || basePath || '/')\n const name = path.split('/').filter(Boolean).join('-') || 'index'\n\n result.push({\n path: formatPath(path),\n name,\n component: pagesComponent[compPath],\n isRoot: path === '/root',\n ...content!\n })\n }\n\n return result\n}\n\nconst processRoutes = ${e?"(\n routes: MyRouteObject[],\n removeLeadingSlash = false\n): MyRouteObject[]":"(routes, removeLeadingSlash)"} =>\n buildRouteTree(routes, removeLeadingSlash)\n .map(removeEmptyChildren)\n .map(cleanIsRoot)\n\nconst handleRootRoute = (\n routes${e?": (MyRouteObject & { isRoot?: boolean })[]":""}\n): MyRouteObject[] => {\n let rootRoute${e?": (MyRouteObject & { isRoot?: boolean }) | undefined":" = undefined"}\n let homeRoute${e?": MyRouteObject | undefined":" = undefined"}\n let notFoundRoute${e?": MyRouteObject | undefined":" = undefined"}\n const filteredRoutes${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const route of routes) {\n if (route.isRoot) {\n if (rootRoute)\n throw new Error('There cannot be multiple root routes in a route')\n rootRoute = route\n } else if (route.path === '/') {\n homeRoute = route\n } else if (route.path === '/:pathMatch(.*)*') {\n notFoundRoute = route\n } else {\n filteredRoutes.push(route)\n }\n }\n\n if (hasDuplicateProperty(filteredRoutes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n const processedRoutes${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n if (rootRoute) {\n const children = [\n homeRoute && { ...homeRoute, path: '' },\n ...processRoutes(filteredRoutes, true)\n ].filter(Boolean)${e?" as MyRouteObject[]":""}\n processedRoutes.push({ ...rootRoute, path: '/', children })\n }\n\n if (notFoundRoute) processedRoutes.push(notFoundRoute)\n\n return processedRoutes.map(cleanIsRoot)\n}\n\nexport const createRoutes = ()${e?": RouteRecordRaw[]":""} => {\n const routes = createBaseRoutes()\n\n if (routes.some((r${e?": MyRouteObject & { isRoot?: boolean }":""}) => r.isRoot))\n return handleRootRoute(routes)${e?" as RouteRecordRaw[]":""}\n\n if (hasDuplicateProperty(routes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n return processRoutes(routes)${e?" as RouteRecordRaw[]":""}\n}\n`)(n,s),l=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const buildRouteTree = ${t?"(\n routes: MyRouteObject[],\n removeLeadingSlash: boolean = false\n)":"(routes, removeLeadingSlash)"} => {\n const routeMap = new Map<string, MyRouteObject & { isRoot?: boolean }>()\n const rootRoutes${t?": MyRouteObject[]":""} = []\n\n const sortedRoutes = [...routes].sort((a, b) => a.path.length - b.path.length)\n\n for (const route of sortedRoutes) {\n let path = route.path\n if (removeLeadingSlash && path.startsWith('/')) {\n path = path.slice(1)\n }\n routeMap.set(path, { ...route, path, children: [] })\n }\n\n for (const [path, route] of routeMap) {\n const slashIndex = path.lastIndexOf('/')\n\n if (slashIndex <= 0) {\n const { isRoot, ...rest } = route\n rootRoutes.push(rest)\n continue\n }\n\n const parentPath = path.slice(0, slashIndex)\n const parentRoute = routeMap.get(parentPath)\n\n if (parentRoute) {\n const relativePath = path.slice(slashIndex + 1)\n const childRoute = { ...route, path: relativePath }\n parentRoute.children!.push(childRoute)\n } else {\n const { isRoot, ...rest } = route\n rootRoutes.push(rest)\n }\n }\n\n return rootRoutes\n}\n`)(s),p=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const cleanIsRoot = ${t?"(\n route: MyRouteObject & { isRoot?: boolean }\n): MyRouteObject":"(route)"} => {\n const { isRoot, type, children, ...rest } = route\n const result${t?": MyRouteObject":""} = { ...rest }\n\n if (children?.length) {\n result.children = children.map(cleanIsRoot)\n }\n\n return result\n}\n`)(s),h=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const removeEmptyChildren = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n if (!route.children?.length) {\n const { children, ...rest } = route\n return rest\n }\n\n const hasIndexRoute = route.children.some(\n child => child.path === '' || child.path === '/'\n )\n\n const routeType = route.type || 'single'\n\n if (routeType === 'wrap') {\n const { children, ...rest } = route\n return { ...rest, children: children.map(removeEmptyChildren) }\n }\n\n if (routeType === 'single' || (!hasIndexRoute && route.component)) {\n const { path, component, type, ...rest } = route\n return {\n path,\n children: [\n { path: '', component, ...rest } as MyRouteObject,\n ...route.children.map(removeEmptyChildren)\n ]\n }\n }\n\n if (hasIndexRoute) {\n const { path, ...rest } = route\n const updatedChildren = route.children.map(child =>\n child.path === '' || child.path === '/' ? { ...rest, ...child } : child\n )\n return { path, children: updatedChildren.map(removeEmptyChildren) }\n }\n\n return { ...route, children: route.children.map(removeEmptyChildren) }\n}\n`)(s),f=s?"// Auto-generated by ono-auto-router\nimport type { PageConfig } from './types'\n\nexport const defineConfig = (config: PageConfig) => config\n":"",d=s?"// Auto-generated by ono-auto-router\nimport type { RouteRecordRaw } from 'vue-router'\n\nexport type PagesComponentType = Record<string, () => Promise<unknown>>\n\nexport interface MyRouteObject extends Omit<RouteRecordRaw, 'children'> {\n type?: 'single' | 'wrap'\n isRoot?: boolean\n children?: MyRouteObject[]\n}\n\nexport type PageConfig = Partial<Omit<MyRouteObject, 'component' | 'children' | 'isRoot'>>\n":"",g=(t=>`// Auto-generated by ono-auto-router\nconst hasDuplicateProperty = ${t?"<T>(items: T[], propName: keyof T)":"(items, propName)"} => {\n const seenValues = new Set()\n return items.some(item => {\n if (seenValues.has(item[propName])) {\n return true\n }\n seenValues.add(item[propName])\n return false\n })\n}\n\nconst replaceBracketsWithColon = ${t?"(str: string)":"(str)"} => {\n return str.replace(/\\[([^\\]]+)\\]/g, ':$1').replace('.tsx', '')\n}\n\nexport { hasDuplicateProperty, replaceBracketsWithColon }\n`)(s);Mr(t.resolve(a,"./index.ts"),u),Mr(t.resolve(a,"./createRoutes.tsx"),c),Mr(t.resolve(a,"./buildRouteTree.ts"),l),Mr(t.resolve(a,"./cleanIsRoot.ts"),p),Mr(t.resolve(a,"./removeEmptyChildren.ts"),h),f&&Mr(t.resolve(a,"./defineConfig.ts"),f),d&&Mr(t.resolve(a,"./types.ts"),d),Mr(t.resolve(a,"./getRoutes.ts"),"// Auto-generated by ono-auto-router\nimport { createRoutes } from './createRoutes'\n\nexport const routes = createRoutes()\n"),Mr(t.resolve(a,"./utils.ts"),g)},yr=t=>{try{if(!e.existsSync(t))return;e.unlinkSync(t)}catch(t){console.error("删除文件失败:",t)}},_r=t=>{try{if(!e.existsSync(t))return;e.rmSync(t,{recursive:!0})}catch(t){console.error("删除目录失败:",t)}},Rr=(n,r,o,s,i,a)=>{const u=p(o),c=s.split(".")[0];yr(c+".js"),yr(c+".ts"),yr(c+".jsx"),yr(c+".tsx"),_r(c),"react"===n?a?((n,r,o,s,i)=>{const a=t.resolve(r,n);if(!e.existsSync(a))throw new Error(`[ono-auto-router] Pages directory does not exist: ${a}`);const u=o.split(".")[0],c=(t=>`// Auto-generated by ono-auto-router${t?"\nexport { defineConfig } from './defineConfig'":""}\nexport { routes } from './getRoutes'\n`)(i),l=s?((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport {\n lazy,\n Suspense,\n type ComponentType,\n type JSX,\n type LazyExoticComponent\n} from 'react'\nimport type { RouteObject } from 'react-router'\nimport { replaceBracketsWithColon } from './utils'\nimport type { PagesComponentType } from './types'\n\ninterface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport interface PageConfig extends Partial<Omit<MyRouteObject, 'children'>> {\n loading?: JSX.Element | true\n}\n":"\nimport { replaceBracketsWithColon } from './utils'\n"}\nconst PATH_REPLACEMENTS${e?": Record<string, string>":""} = {\n '/home': '/',\n '/root': '/'\n}\n\nconst cachedLazyComponents${e?": Record<\n string,\n LazyExoticComponent<ComponentType<unknown>>\n>":""} = {}\n\nconst getConfigFileName = (pagePath: string): string => {\n if (pagePath.endsWith('.tsx')) {\n return pagePath.slice(0, -4) + '.config.ts'\n }\n return pagePath.replace('index.ts', 'index.config.ts')\n}\n\nconst formatPageModule = (${e?"\n pagesComponent: Record<string, ComponentType<unknown>>,\n pagesModule: Record<string, PageConfig>\n":"pagesComponent, pagesModule"})${e?": [string, PageConfig][]":""} => {\n return Object.keys(pagesComponent).map(page => {\n const configKey = getConfigFileName(page)\n return [configKey, pagesModule[configKey] || {}]\n })\n}\n\nconst normalizePath = ${e?"(pathStr: string): string":"(pathStr)"} => {\n if (PATH_REPLACEMENTS[pathStr]) {\n return PATH_REPLACEMENTS[pathStr]\n }\n\n const lowerPath = pathStr.toLowerCase()\n if (lowerPath === '/notfound' || pathStr === '/404') {\n return '/*'\n }\n\n return pathStr\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath, ext)"} => {\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1]\n if (ext && lastPart.endsWith(ext)) {\n return lastPart.slice(0, -ext.length)\n }\n return lastPart\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getCompPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n if (fileName === 'index') {\n return configPath.replace('index.config.ts', 'index.tsx')\n }\n return configPath.slice(0, -10) + '.tsx'\n }\n return configPath.replace('index.config.ts', 'index.tsx')\n}\n\nconst getRawPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n if (fileName === 'index') {\n return dirPath || '/'\n }\n return dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n return (\n configPath.replace('/${t}', '').replace('/index.config.ts', '') || '/'\n )\n}\n\nconst getFileDefault = ${e?"(modules: Record<string, { default: unknown }>)":"(modules)"} => {\n const result${e?": Record<string, unknown>":""} = {}\n\n for (const [path, module] of Object.entries(modules)) {\n if ('default' in module) {\n result[path] = module.default\n }\n }\n\n return result\n}\n\nconst filterUnComponent = ${e?"(pagesComponent: PagesComponentType)":"(pagesComponent)"} => {\n const result: PagesComponentType = {}\n\n for (const key of Object.keys(pagesComponent)) {\n if (!key.includes('.config.tsx')) {\n result[key] = pagesComponent[key]\n }\n }\n\n return result\n}\n\nconst LazyComponent = ({\n Element\n}:${e?" {\n Element: LazyExoticComponent<ComponentType<unknown>>\n}":""}) => {\n return (\n <Suspense>\n <Element />\n </Suspense>\n )\n}\n\nexport const createBaseRoutes = () => {\n const pagesComponent = filterUnComponent({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}')${e?" as PagesComponentType":""}\n })\n\n const pagesString = getFileDefault({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}', {\n eager: true\n })\n })${e?" as Record<string, ComponentType<unknown>>":""}\n\n const pagesModule = getFileDefault({\n ...import.meta.glob('/${t}/**/*.config.${e?"ts":"js"}', {\n eager: true\n })\n })${e?" as Record<string, PageConfig>":""}\n\n const result${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const [pagePath, page] of formatPageModule(pagesString, pagesModule)) {\n const compPath = getCompPathFromConfig(pagePath)\n\n if (!pagesComponent[compPath]) continue\n\n const rawPath = page?.path || getRawPathFromConfig(pagePath) || '/'\n const processedPath = replaceBracketsWithColon(rawPath)\n const routePath = normalizePath(processedPath)\n\n let Component: MyRouteObject['element']\n if (page?.element) {\n Component = page.element\n } else {\n if (!cachedLazyComponents[compPath]) {\n cachedLazyComponents[compPath] = lazy(pagesComponent[compPath])\n }\n\n Component = <LazyComponent Element={cachedLazyComponents[compPath]} />\n }\n result.push({\n ...page,\n path: routePath,\n type: page?.type,\n isRoot: processedPath === '/root',\n element: Component\n })\n }\n\n return result\n}\n`)(n,i):((t,e)=>`// Auto-generated by ono-auto-router${e?"\nimport type { ComponentType, JSX } from 'react'\nimport type { RouteObject } from 'react-router'\nimport { replaceBracketsWithColon } from './utils'\nimport type { PagesComponentType } from './types'\n\ninterface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport interface PageConfig extends Partial<Omit<MyRouteObject, 'children'>> {\n loading?: JSX.Element | true\n}\n":"\nimport { replaceBracketsWithColon } from './utils'\n"}\nconst PATH_REPLACEMENTS${e?": Record<string, string>":""} = {\n '/home': '/',\n '/root': '/'\n}\n\nconst getConfigFileName = (pagePath: string): string => {\n if (pagePath.endsWith('.tsx')) {\n return pagePath.slice(0, -4) + '.config.ts'\n }\n return pagePath.replace('index.ts', 'index.config.ts')\n}\n\nconst formatPageModule = (${e?"\n pagesComponent: PagesComponentType,\n pagesModule: Record<string, PageConfig>\n":"pagesComponent, pagesModule"})${e?": [string, PageConfig][]":""} => {\n return Object.keys(pagesComponent).map(page => {\n const configKey = getConfigFileName(page)\n return [configKey, pagesModule[configKey] || {}]\n })\n}\n\nconst normalizePath = ${e?"(pathStr: string): string":"(pathStr)"} => {\n if (PATH_REPLACEMENTS[pathStr]) {\n return PATH_REPLACEMENTS[pathStr]\n }\n\n const lowerPath = pathStr.toLowerCase()\n if (lowerPath === '/notfound' || pathStr === '/404') {\n return '/*'\n }\n\n return pathStr\n}\n\nconst getBasename = ${e?"(filePath: string, ext?: string): string":"(filePath, ext)"} => {\n const parts = filePath.split('/')\n const lastPart = parts[parts.length - 1]\n if (ext && lastPart.endsWith(ext)) {\n return lastPart.slice(0, -ext.length)\n }\n return lastPart\n}\n\nconst getDirname = ${e?"(filePath: string): string":"(filePath)"} => {\n const parts = filePath.split('/')\n parts.pop()\n return parts.join('/')\n}\n\nconst getCompPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n if (fileName === 'index') {\n return configPath.replace('index.config.ts', 'index.tsx')\n }\n return configPath.slice(0, -10) + '.tsx'\n }\n return configPath.replace('index.config.ts', 'index.tsx')\n}\n\nconst getRawPathFromConfig = ${e?"(configPath: string): string":"(configPath)"} => {\n if (configPath.endsWith('.config.ts')) {\n const fileName = getBasename(configPath, '.config.ts')\n const dirPath = getDirname(configPath).replace('/${t}', '')\n if (fileName === 'index') {\n return dirPath || '/'\n }\n return dirPath ? dirPath + '/' + fileName : '/' + fileName\n }\n return (\n configPath.replace('/${t}', '').replace('/index.config.ts', '') || '/'\n )\n}\n\nconst getFileDefault = ${e?"(modules: Record<string, { default: unknown }>)":"(modules)"} => {\n const result: PagesComponentType | Record<string, PageConfig> = {}\n\n for (const [path, module] of Object.entries(modules)) {\n if ('default' in module) {\n result[path] = module.default as ComponentType<unknown> | PageConfig\n }\n }\n\n return result\n}\n\nconst filterUnComponent = ${e?"(pagesComponent: PagesComponentType)":"(pagesComponent)"} => {\n const result: PagesComponentType = {}\n\n for (const key of Object.keys(pagesComponent)) {\n if (!key.includes('.config.tsx')) {\n result[key] = pagesComponent[key]\n }\n }\n\n return result\n}\n\nexport const createBaseRoutes = () => {\n const pagesComponent = filterUnComponent(\n getFileDefault({\n ...import.meta.glob('/${t}/**/*.${e?"tsx":"jsx"}', { eager: true })\n })${e?" as PagesComponentType":""}\n )\n\n const pagesModule = getFileDefault({\n ...import.meta.glob('/${t}/**/*.config.${e?"ts":"js"}', {\n eager: true\n })\n })${e?" as Record<string, PageConfig>":""}\n\n const result${e?": (MyRouteObject & { isRoot?: boolean })[]":""} = []\n\n for (const [pagePath, page] of formatPageModule(pagesComponent, pagesModule)) {\n const compPath = getCompPathFromConfig(pagePath)\n\n if (!pagesComponent[compPath]) continue\n\n const rawPath = page?.path || getRawPathFromConfig(pagePath) || '/'\n const processedPath = replaceBracketsWithColon(rawPath)\n const routePath = normalizePath(processedPath)\n\n const Component = pagesComponent[compPath]\n result.push({\n ...page,\n path: routePath,\n type: page?.type,\n isRoot: processedPath === '/root',\n element: <Component />\n })\n }\n\n return result\n}\n`)(n,i),p=(t=>`// Auto-generated by ono-auto-router\nimport { hasDuplicateProperty } from './utils'\nimport { buildRouteTree } from './buildRouteTree'\nimport { cleanIsRoot } from './cleanIsRoot'\nimport { removeEmptyChildren } from './removeEmptyChildren'${t?"\nimport type { MyRouteObject } from './types'":""}\n\nconst processRoute = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} =>\n cleanIsRoot(removeEmptyChildren(route))\n\nconst processRoutes = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} =>\n buildRouteTree(routes).map(processRoute)\n\nconst handleRootRoute = ${t?"(routes: (MyRouteObject & { isRoot?: boolean })[])":"(routes)"} => {\n let rootRoute${t?": MyRouteObject | undefined":" = undefined"}\n let homeRoute${t?": MyRouteObject | undefined":" = undefined"}\n let notFoundRoute${t?": MyRouteObject | undefined":" = undefined"}\n const filteredRoutes${t?": MyRouteObject[]":""} = []\n\n for (const route of routes) {\n if (route.isRoot) {\n if (rootRoute)\n throw new Error('There cannot be multiple root routes in a route')\n rootRoute = route\n } else if (route.path === '/') {\n homeRoute = route\n } else if (route.path === '/*') {\n notFoundRoute = route\n } else {\n filteredRoutes.push(route)\n }\n }\n\n if (hasDuplicateProperty(filteredRoutes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n const children = [\n homeRoute && { ...homeRoute, index: true },\n ...processRoutes(filteredRoutes)\n ].filter((route): route is NonNullable<typeof route> => Boolean(route))\n\n const result${t?": MyRouteObject[]":""} = []\n\n if (rootRoute) {\n result.push(cleanIsRoot({ ...rootRoute, children }))\n }\n\n if (notFoundRoute) {\n result.push(cleanIsRoot(notFoundRoute))\n }\n\n return result\n}\n\nexport const formatRoutes = (\n routes${t?": (MyRouteObject & { isRoot?: boolean })[]":""}\n) => {\n if (routes.some(r => r.isRoot)) return handleRootRoute(routes)\n\n if (hasDuplicateProperty(routes, 'path'))\n throw new Error('There cannot be duplicate paths in a route')\n\n return processRoutes(routes)\n}\n`)(i),h=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nconst processSingleRoute = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n if (route.index) {\n return route\n }\n\n if (route.type !== 'wrap') {\n const { path: routePath, children, ...extraProps } = route\n const hasExtraProps = Object.keys(extraProps).length > 0\n\n if (hasExtraProps) {\n const indexRoute: MyRouteObject = {\n path: '',\n index: true,\n ...extraProps\n }\n\n return {\n path: routePath,\n children: [indexRoute, ...(children || []).map(processSingleRoute)]\n }\n }\n }\n\n if (route.children) {\n return {\n ...route,\n children: route.children.map(processSingleRoute)\n }\n }\n\n return route\n}\n\nconst formatRouteTree = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n return routes.map(processSingleRoute)\n}\n\nconst buildTreeStructure = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n const routeMap = new Map${t?"<string, MyRouteObject>":""}()\n const rootRoutes${t?": MyRouteObject[]":""} = []\n const pathPartsCache = new Map${t?"<string, string[]>":""}()\n\n const getPathParts = ${t?"(pathStr: string): string[]":"(pathStr)"} => {\n let parts = pathPartsCache.get(pathStr)\n if (parts === undefined) {\n parts = pathStr === '/' ? [] : pathStr.split('/').filter(Boolean)\n pathPartsCache.set(pathStr, parts)\n }\n return parts\n }\n\n const sortedRoutes = routes\n .slice()\n .sort((a, b) => a.path.length - b.path.length)\n\n for (const route of sortedRoutes) {\n const routePath = route.path\n const pathParts = getPathParts(routePath)\n const currentRoute = { ...route, children: [] }\n routeMap.set(routePath, currentRoute)\n\n if (pathParts.length <= 1) {\n rootRoutes.push(currentRoute)\n continue\n }\n\n const parentPath = '/' + pathParts.slice(0, -1).join('/')\n const parentRoute = routeMap.get(parentPath)\n\n if (parentRoute) {\n currentRoute.path = pathParts[pathParts.length - 1]\n parentRoute.children!.push(currentRoute)\n } else {\n rootRoutes.push(currentRoute)\n }\n }\n\n return rootRoutes\n}\n\nexport const buildRouteTree = ${t?"(routes: MyRouteObject[]): MyRouteObject[]":"(routes)"} => {\n const treeStructure = buildTreeStructure(routes)\n return formatRouteTree(treeStructure)\n}\n`)(i),f=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n\ntype RouteWithIsRoot = MyRouteObject & { isRoot?: boolean }\n":""}\nexport const cleanIsRoot = ${t?"(route: RouteWithIsRoot): MyRouteObject":"(route)"} => {\n const { isRoot, type, children, ...rest } = route as RouteWithIsRoot & {\n type?: unknown\n }\n\n if (!children?.length) {\n return rest\n }\n\n return {\n ...rest,\n children: children.map(cleanIsRoot)\n }\n}\n`)(i),d=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { MyRouteObject } from './types'\n":""}\nexport const removeEmptyChildren = ${t?"(route: MyRouteObject): MyRouteObject":"(route)"} => {\n const { children } = route\n\n if (!children?.length) {\n const { children: _, ...rest } = route\n return rest\n }\n\n const processedChildren = children.map(removeEmptyChildren)\n\n if (route.type === 'wrap') {\n return { ...route, children: processedChildren }\n }\n\n const { path, element, type, children: _, ...rest } = route\n\n if (!element) {\n return { path, ...rest, children: processedChildren }\n }\n\n return {\n path,\n children: [\n { index: true, element, ...rest } as MyRouteObject,\n ...processedChildren\n ]\n }\n}\n`)(i),g=i?"// Auto-generated by ono-auto-router\nimport type { PageConfig } from './types'\nexport const defineConfig = (config: PageConfig) => config\n":"",m=(t=>`// Auto-generated by ono-auto-router${t?"\nimport type { RouteObject } from 'react-router'":""}\nimport { createBaseRoutes } from './createBaseRoutes'\nimport { formatRoutes } from './formatRoutes'\n\nconst getRoutes = () => {\n const baseRoutes = createBaseRoutes()\n const formattedRoutes = formatRoutes(baseRoutes)${t?" as RouteObject[]":""}\n return formattedRoutes\n}\n\nexport const routes = getRoutes()\n`)(i),y=i?(t=>`// Auto-generated by ono-auto-router\nimport type { ComponentType } from 'react'\nimport type { RouteObject } from 'react-router'\n\n${t?"export type PagesComponentType = Record<\n string,\n () => Promise<{ default: ComponentType<unknown> }>\n>":"export type PagesComponentType = Record<string, ComponentType<unknown>>"}\n\nexport interface MyRouteObject extends Omit<RouteObject, 'path' | 'children'> {\n path: string\n type?: 'single' | 'wrap'\n children?: MyRouteObject[]\n}\n\nexport type PageConfig = Partial<\n Omit<MyRouteObject, 'Component' | 'element' | 'children'>\n>\n`)(s):"",_=(t=>`// Auto-generated by ono-auto-router\nexport const hasDuplicateProperty = ${t?"<T>(items: T[], propName: keyof T)":"(items, propName)"} => {\n const seenValues = new Set()\n return items.some(item => {\n if (seenValues.has(item[propName])) {\n return true\n }\n seenValues.add(item[propName])\n return false\n })\n}\n\nexport const replaceBracketsWithColon = ${t?"(str: string)":"(str)"} => {\n return str.replace(/\\[([^\\]]+)\\]/g, ':$1').replace('.tsx', '')\n}\n`)(i);Mr(t.resolve(u,"./index.ts"),c),Mr(t.resolve(u,"./createBaseRoutes.tsx"),l),Mr(t.resolve(u,"./formatRoutes.ts"),p),Mr(t.resolve(u,"./buildRouteTree.ts"),h),Mr(t.resolve(u,"./cleanIsRoot.ts"),f),Mr(t.resolve(u,"./removeEmptyChildren.ts"),d),g&&Mr(t.resolve(u,"./defineConfig.ts"),g),y&&Mr(t.resolve(u,"./types.ts"),y),Mr(t.resolve(u,"./getRoutes.ts"),m),Mr(t.resolve(u,"./utils.ts"),_)})(r,o,s,i,u):gr(r,o,s,i,u):mr(r,o,s,u)};function br(t){try{const n=e.readFileSync(t,"utf-8").match(/export\s+default\s+([\s\S]*?)(?=\n\w|$)/);if(!n)return console.warn("No export default found in:",t),null;const r=n[1].trim();try{if(r.startsWith("{")){return new Function(`return ${r}`)()}if(r.includes("defineConfig(")){const t=r.match(/defineConfig([\s\S]*)$/);if(t){return new Function(`return ${t[1]}`)()}}return null}catch(t){return console.error("Error parsing export default content:",t),null}}catch(t){return console.error("Error reading file:",t),null}}function Sr(e,n){let r=t.resolve(e);if(r.endsWith(".js")||r.endsWith(".jsx")||r.endsWith(".ts")||r.endsWith(".tsx")){const t=r.split("\\");r=t.slice(0,-1).join("\\")}const o=t.resolve(n);return t.relative(r,o)}const Pr=/\\/g,vr=t=>t.replace(Pr,"/"),Er=(e,n)=>vr(t.relative(n,e)),Ar=/export\s+default\s+[\w(\[\]\{\})]+/;function xr(t){try{if(!e.existsSync(t))return console.warn(`File not found: ${t}`),!1;const n=e.readFileSync(t,"utf-8");return Ar.test(n)}catch(t){return console.error("Read error:",t),!1}}const Cr=(t,e)=>{const n=new Set;return t.some(t=>!!n.has(t[e])||(n.add(t[e]),!1))};function Or(t){return t.replace(/"<start>([\s\S]*?)<\/end>"/g,"$1")}function wr(t){let e=t;for(;;){const t=Or(e);if(t===e)break;e=t}return e}const $r=t=>t.replace(/\[([^\]]+)\]/g,":$1").replace(".tsx","");function Tr(t){e.existsSync(t)||e.mkdirSync(t,{recursive:!0})}function kr(n,r){Tr(t.dirname(n)),e.writeFileSync(n,r,"utf-8")}async function Mr(n,r){const o=t.dirname(n);await e.promises.mkdir(o,{recursive:!0}),await e.promises.writeFile(n,r,"utf-8")}function Lr(t,e,n){const r=n.length>0?`\n${n.join("\n")}\n`:"";return`// Auto-generated by ono-auto-router\nimport { createRouter, createWebHistory } from 'vue-router'\n${e.join("\n")}\n${r}\n\nexport const routes = ${JSON.stringify(t,null,2)}\n\nexport const router = createRouter({\n history: createWebHistory(import.meta.env.BASE_URL),\n routes\n})\n\nexport default router\n`}export{u as convertFunctionToArrow,_r as deleteDir,yr as deleteFile,Tr as ensureDirSync,f as formatRoutesFile,Rr as generateRoutesTemplate,Lr as generateVueRoutesTemplate,br as getDefaultExportContent,Sr as getRelativePath,Er as getRelativeProjectPath,xr as hasDefaultExport,Cr as hasDuplicateProperty,vr as normalizePathWithWindows,wr as removeCustomTagFunctionFromJSXAll,$r as replaceBracketsWithColon,p as useTs,Mr as writeFile,kr as writeFileSync};