import{t as e}from"./chunk-YNYSPYQ5-gU4-j5DO.mjs";function t(e,t){return e.replace(/\$(&|\d+|<([^>]+)>)/g,(e,n,r)=>n===`&`?t[0]:r===void 0?t[parseInt(n,10)]??``:t.groups?.[r]??``)}function n(e,n,i={}){let{invertMatch:a=!1,showLineNumbers:o=!1,countOnly:s=!1,countMatches:c=!1,filename:l=``,onlyMatching:u=!1,beforeContext:d=0,afterContext:f=0,maxCount:p=0,contextSeparator:m=`--`,showColumn:h=!1,vimgrep:g=!1,showByteOffset:_=!1,replace:v=null,passthru:y=!1,multiline:b=!1,kResetGroup:x}=i;if(b)return r(e,n,{invertMatch:a,showLineNumbers:o,countOnly:s,countMatches:c,filename:l,onlyMatching:u,beforeContext:d,afterContext:f,maxCount:p,contextSeparator:m,showColumn:h,showByteOffset:_,replace:v,kResetGroup:x});let S=e.split(`
`),C=S.length,w=C>0&&S[C-1]===``?C-1:C;if(s||c){let e=0,t=(c||u)&&!a;for(let r=0;r<w;r++)if(n.lastIndex=0,t)for(let t=n.exec(S[r]);t!==null;t=n.exec(S[r]))e++,t[0].length===0&&n.lastIndex++;else n.test(S[r])!==a&&e++;return{output:`${l?`${l}:${e}`:String(e)}
`,matched:e>0,matchCount:e}}if(d===0&&f===0&&!y){let e=[],r=!1,i=0,s=0;for(let c=0;c<w&&!(p>0&&i>=p);c++){let d=S[c];if(n.lastIndex=0,n.test(d)!==a)if(r=!0,i++,u){n.lastIndex=0;for(let r=n.exec(d);r!==null;r=n.exec(d)){let i=x===void 0?r[0]:r[x]??``,a=v===null?i:t(v,r),u=l?`${l}:`:``;_&&(u+=`${s+r.index}:`),o&&(u+=`${c+1}:`),h&&(u+=`${r.index+1}:`),e.push(u+a),r[0].length===0&&n.lastIndex++}}else if(g){n.lastIndex=0;for(let t=n.exec(d);t!==null;t=n.exec(d)){let r=l?`${l}:`:``;_&&(r+=`${s+t.index}:`),o&&(r+=`${c+1}:`),h&&(r+=`${t.index+1}:`),e.push(r+d),t[0].length===0&&n.lastIndex++}}else{n.lastIndex=0;let r=n.exec(d),i=r?r.index+1:1,a=d;v!==null&&(n.lastIndex=0,a=n.replace(d,(...e)=>{if(e[0].length===0)return``;let n=e,r=e[e.length-1];return typeof r==`object`&&r?(n.groups=r,n.input=e[e.length-2],n.index=e[e.length-3]):(n.input=e[e.length-1],n.index=e[e.length-2]),t(v,n)}));let u=l?`${l}:`:``;_&&(u+=`${s+(r?r.index:0)}:`),o&&(u+=`${c+1}:`),h&&(u+=`${i}:`),e.push(u+a)}s+=d.length+1}return{output:e.length>0?`${e.join(`
`)}
`:``,matched:r,matchCount:i}}if(y){let e=[],t=!1,r=0;for(let i=0;i<w;i++){let s=S[i];n.lastIndex=0;let c=n.test(s)!==a;c&&(t=!0,r++);let u=c?`:`:`-`,d=l?`${l}${u}`:``;o&&(d+=`${i+1}${u}`),e.push(d+s)}return{output:e.length>0?`${e.join(`
`)}
`:``,matched:t,matchCount:r}}let T=[],E=0,D=new Set,O=-1,k=[];for(let e=0;e<w&&!(p>0&&E>=p);e++)n.lastIndex=0,n.test(S[e])!==a&&(k.push(e),E++);for(let e of k){let t=Math.max(0,e-d);O>=0&&t>O+1&&T.push(m);for(let n=t;n<e;n++)if(!D.has(n)){D.add(n),O=n;let e=S[n];o&&(e=`${n+1}-${e}`),l&&(e=`${l}-${e}`),T.push(e)}if(!D.has(e)){D.add(e),O=e;let t=S[e];if(u){n.lastIndex=0;for(let r=n.exec(t);r!==null;r=n.exec(t)){let t=x===void 0?r[0]:r[x]??``,i=v===null?t:v,a=l?`${l}:`:``;o&&(a+=`${e+1}:`),h&&(a+=`${r.index+1}:`),T.push(a+i),r[0].length===0&&n.lastIndex++}}else{let n=t;o&&(n=`${e+1}:${n}`),l&&(n=`${l}:${n}`),T.push(n)}}let r=Math.min(w-1,e+f);for(let t=e+1;t<=r;t++)if(!D.has(t)){D.add(t),O=t;let e=S[t];o&&(e=`${t+1}-${e}`),l&&(e=`${l}-${e}`),T.push(e)}}return{output:T.length>0?`${T.join(`
`)}
`:``,matched:E>0,matchCount:E}}function r(e,t,n){let{invertMatch:r,showLineNumbers:i,countOnly:a,countMatches:o,filename:s,onlyMatching:c,beforeContext:l,afterContext:u,maxCount:d,contextSeparator:f,showColumn:p,showByteOffset:m,replace:h,kResetGroup:g}=n,_=e.split(`
`),v=_.length,y=v>0&&_[v-1]===``?v-1:v,b=[0];for(let t=0;t<e.length;t++)e[t]===`
`&&b.push(t+1);let x=e=>{let t=0;for(let n=0;n<b.length&&!(b[n]>e);n++)t=n;return t},S=e=>e-b[x(e)]+1,C=[];t.lastIndex=0;for(let n=t.exec(e);n!==null&&!(d>0&&C.length>=d);n=t.exec(e)){let e=x(n.index),r=x(n.index+Math.max(0,n[0].length-1)),i=g===void 0?n[0]:n[g]??``;C.push({startLine:e,endLine:r,byteOffset:n.index,column:S(n.index),matchText:i}),n[0].length===0&&t.lastIndex++}if(a||o){let e;if(o)e=r?0:C.length;else{let t=new Set;for(let e of C)for(let n=e.startLine;n<=e.endLine;n++)t.add(n);e=r?y-t.size:t.size}return{output:`${s?`${s}:${e}`:String(e)}
`,matched:e>0,matchCount:e}}if(r){let e=new Set;for(let t of C)for(let n=t.startLine;n<=t.endLine;n++)e.add(n);let t=[];for(let n=0;n<y;n++)if(!e.has(n)){let e=_[n];i&&(e=`${n+1}:${e}`),s&&(e=`${s}:${e}`),t.push(e)}return{output:t.length>0?`${t.join(`
`)}
`:``,matched:t.length>0,matchCount:t.length}}if(C.length===0)return{output:``,matched:!1,matchCount:0};let w=new Set,T=-1,E=[];for(let e of C){let n=Math.max(0,e.startLine-l),r=Math.min(y-1,e.endLine+u);T>=0&&n>T+1&&E.push(f);for(let t=n;t<e.startLine;t++)if(!w.has(t)){w.add(t),T=t;let e=_[t];i&&(e=`${t+1}-${e}`),s&&(e=`${s}-${e}`),E.push(e)}if(c){let t=h===null?e.matchText:h,n=s?`${s}:`:``;m&&(n+=`${e.byteOffset}:`),i&&(n+=`${e.startLine+1}:`),p&&(n+=`${e.column}:`),E.push(n+t);for(let t=e.startLine;t<=e.endLine;t++)w.add(t),T=t}else for(let n=e.startLine;n<=e.endLine&&n<y;n++)if(!w.has(n)){w.add(n),T=n;let r=_[n];h!==null&&n===e.startLine&&(t.lastIndex=0,r=t.replace(r,h));let a=s?`${s}:`:``;m&&n===e.startLine&&(a+=`${e.byteOffset}:`),i&&(a+=`${n+1}:`),p&&n===e.startLine&&(a+=`${e.column}:`),E.push(a+r)}for(let t=e.endLine+1;t<=r;t++)if(!w.has(t)){w.add(t),T=t;let e=_[t];i&&(e=`${t+1}-${e}`),s&&(e=`${s}-${e}`),E.push(e)}}return{output:E.length>0?`${E.join(`
`)}
`:``,matched:!0,matchCount:C.length}}var i=new Map([[`alpha`,`a-zA-Z`],[`digit`,`0-9`],[`alnum`,`a-zA-Z0-9`],[`lower`,`a-z`],[`upper`,`A-Z`],[`xdigit`,`0-9A-Fa-f`],[`space`,` \\t\\n\\r\\f\\v`],[`blank`,` \\t`],[`punct`,"!-/:-@\\[-`{-~"],[`graph`,`!-~`],[`print`,` -~`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`ascii`,`\\x00-\\x7F`],[`word`,`a-zA-Z0-9_`]]);function a(e){let t=``,n=0;for(;n<e.length;){if(e.slice(n,n+7)===`[[:<:]]`){t+=`\\b`,n+=7;continue}if(e.slice(n,n+7)===`[[:>:]]`){t+=`\\b`,n+=7;continue}if(e[n]===`[`){let r=`[`;for(n++,n<e.length&&(e[n]===`^`||e[n]===`!`)&&(r+=`^`,n++),n<e.length&&e[n]===`]`&&(r+=`\\]`,n++);n<e.length&&e[n]!==`]`;){if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){let a=e.slice(n+2,t),o=i.get(a);if(o){r+=o,n=t+2;continue}}}if(e[n]===`\\`&&n+1<e.length){r+=e[n]+e[n+1],n+=2;continue}r+=e[n],n++}n<e.length&&e[n]===`]`&&(r+=`]`,n++),t+=r;continue}if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}return t}function o(t,n){let r,i;switch(n.mode){case`fixed`:r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);break;case`extended`:case`perl`:if(r=a(t),r=r.replace(/\(\?P<([^>]+)>/g,`(?<$1>`),n.mode===`perl`){r=s(r),r=c(r),r=l(r);let e=p(r);r=e.pattern,i=e.kResetGroup}break;default:r=a(t),r=_(r);break}n.wholeWord&&(r=`\\b(?:${r})\\b`),n.lineRegexp&&(r=`^${r}$`);let o=/\\u\{[0-9A-Fa-f]+\}/.test(r),u=`g`+(n.ignoreCase?`i`:``)+(n.multiline?`m`:``)+(n.multilineDotall?`s`:``)+(o?`u`:``);return{regex:e(r,u),kResetGroup:i}}function s(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`\\`&&n+1<e.length&&e[n+1]===`Q`){n+=2;let r=``;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length&&e[n+1]===`E`){n+=2;break}r+=e[n],n++}t+=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}else t+=e[n],n++;return t}function c(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,`\\u{$1}`)}function l(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`(`&&n+1<e.length&&e[n+1]===`?`){let r=e.slice(n).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(r){let i=r[1]||``,a=r[2]||``,o=r[3];if(o===`:`){let o=n+r[0].length-1,s=u(e,n);if(s!==-1){let r=d(e.slice(o+1,s),i,a);t+=`(?:${r})`,n=s+1;continue}}else if(o===`)`||o===``){n+=r[0].length;continue}}}t+=e[n],n++}return t}function u(e,t){let n=0,r=t;for(;r<e.length;){if(e[r]===`\\`){r+=2;continue}if(e[r]===`[`){for(r++;r<e.length&&e[r]!==`]`;)e[r]===`\\`&&r++,r++;r++;continue}if(e[r]===`(`)n++;else if(e[r]===`)`&&(n--,n===0))return r;r++}return-1}function d(e,t,n){let r=e;return t.includes(`i`)&&(r=f(r)),r}function f(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===`\\`){n+1<e.length?(t+=r+e[n+1],n+=2):(t+=r,n++);continue}if(r===`[`){t+=r,n++,n<e.length&&e[n]===`^`&&(t+=e[n],n++);let i=[];for(;n<e.length&&e[n]!==`]`;)if(e[n]===`\\`)i.push(e[n]),n++,n<e.length&&(i.push(e[n]),n++);else if(e[n]===`-`&&i.length>0&&n+1<e.length&&e[n+1]!==`]`){let t=i[i.length-1],r=e[n+1];i.push(`-`),i.push(r),/[a-z]/.test(t)&&/[a-z]/.test(r)?(i.push(t.toUpperCase()),i.push(`-`),i.push(r.toUpperCase())):/[A-Z]/.test(t)&&/[A-Z]/.test(r)&&(i.push(t.toLowerCase()),i.push(`-`),i.push(r.toLowerCase())),n+=2}else{let t=e[n];if(i.push(t),/[a-zA-Z]/.test(t)){let e=t===t.toLowerCase()?t.toUpperCase():t.toLowerCase();i.includes(e)||i.push(e)}n++}t+=i.join(``),n<e.length&&(t+=e[n],n++);continue}if(/[a-zA-Z]/.test(r)){let e=r.toLowerCase(),n=r.toUpperCase();t+=`[${n}${e}]`}else t+=r;n++}return t}function p(e){let t=m(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),i=h(n);return{pattern:`(?:${n})(${r})`,kResetGroup:i+1}}function m(e){let t=0;for(;t<e.length-1;)if(e[t]===`\\`){if(e[t+1]===`K`){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;if(n%2==0)return t}t+=2}else t++;return-1}function h(e){let t=0,n=0;for(;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(e[n]===`[`){for(n++;n<e.length&&e[n]!==`]`;)e[n]===`\\`&&n++,n++;n++;continue}if(e[n]===`(`)if(n+1<e.length&&e[n+1]===`?`){if(n+2<e.length){let r=e[n+2];if(r===`:`||r===`=`||r===`!`){n++;continue}if(r===`<`&&n+3<e.length){let r=e[n+3];if(r===`=`||r===`!`){n++;continue}t++,n++;continue}}}else t++;n++}return t}function g(e){let t=e.replace(/\$\{0\}|\$0(?![0-9])/g,`$$&`);return t=t.replace(/\$\{([^0-9}][^}]*)\}/g,`$$<$1>`),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,`$$<$1>`),t}function _(e){let t=``,n=0,r=!0,i=0;for(;n<e.length;){let a=e[n];if(a===`[`){for(t+=a,n++,n<e.length&&(e[n]===`^`||e[n]===`!`)&&(t+=e[n],n++),n<e.length&&e[n]===`]`&&(t+=e[n],n++);n<e.length&&e[n]!==`]`;)e[n]===`\\`&&n+1<e.length?(t+=e[n]+e[n+1],n+=2):(t+=e[n],n++);n<e.length&&e[n]===`]`&&(t+=e[n],n++),r=!1;continue}if(a===`\\`&&n+1<e.length){let o=e[n+1];if(o===`|`){t+=`|`,n+=2,r=!0;continue}if(o===`(`){t+=`(`,n+=2,i++,r=!0;continue}if(o===`)`){t+=`)`,n+=2,i=Math.max(0,i-1),r=!1;continue}if(o===`{`){let i=e.slice(n).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(i){let e=i[1],a=i[2]!==void 0,o=i[3]||``;a?t+=`{${e},${o}}`:t+=`{${e}}`,n+=i[0].length,r=!1;continue}t+=`\\{`,n+=2,r=!1;continue}if(o===`}`){t+=`\\}`,n+=2,r=!1;continue}t+=a+o,n+=2,r=!1;continue}if(a===`*`&&r){t+=`\\*`,n++;continue}if(a===`^`){if(r){t+=`^`,n++;continue}t+=`\\^`,n++;continue}if(a===`$`){let i=n===e.length-1,a=n+2<e.length&&e[n+1]===`\\`&&e[n+2]===`)`;i||a?t+=`$`:t+=`\\$`,n++,r=!1;continue}a===`+`||a===`?`||a===`|`||a===`(`||a===`)`||a===`{`||a===`}`?t+=`\\${a}`:t+=a,n++,r=!1}return t}export{o as n,g as r,n as t};
//# sourceMappingURL=chunk-VLGZJRPG-DpYP_EVp.mjs.map