just-bash 2.5.2 → 2.5.4
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/bin/chunks/chunk-DV5HL4K2.js +17 -0
- package/dist/bin/chunks/file-LNCFDPQZ.js +23 -0
- package/dist/bin/chunks/grep-IIVQXFNI.js +9 -0
- package/dist/bin/chunks/rg-Q4OTJOEF.js +33 -0
- package/dist/bin/just-bash.js +1 -1
- package/dist/bin/shell/chunks/chunk-DV5HL4K2.js +17 -0
- package/dist/bin/shell/chunks/file-LNCFDPQZ.js +23 -0
- package/dist/bin/shell/chunks/grep-IIVQXFNI.js +9 -0
- package/dist/bin/shell/chunks/rg-Q4OTJOEF.js +33 -0
- package/dist/bin/shell/shell.js +1 -1
- package/dist/bundle/browser.js +332 -332
- package/dist/bundle/chunks/chunk-BOJ3OAZB.js +16 -0
- package/dist/bundle/chunks/file-XPA6O6H2.js +22 -0
- package/dist/bundle/chunks/grep-ACVE42JK.js +8 -0
- package/dist/bundle/chunks/rg-YLZJWCEJ.js +32 -0
- package/dist/bundle/index.js +1 -1
- package/dist/commands/search-engine/index.d.ts +1 -1
- package/dist/commands/search-engine/matcher.d.ts +2 -0
- package/dist/commands/search-engine/regex.d.ts +6 -1
- package/package.json +1 -1
- package/dist/bin/chunks/chunk-CTLU5QUH.js +0 -17
- package/dist/bin/chunks/file-XMPFXMUJ.js +0 -23
- package/dist/bin/chunks/grep-QCXXYC54.js +0 -9
- package/dist/bin/chunks/rg-GVIT6FTE.js +0 -33
- package/dist/bin/shell/chunks/chunk-CTLU5QUH.js +0 -17
- package/dist/bin/shell/chunks/file-XMPFXMUJ.js +0 -23
- package/dist/bin/shell/chunks/grep-QCXXYC54.js +0 -9
- package/dist/bin/shell/chunks/rg-GVIT6FTE.js +0 -33
- package/dist/bundle/chunks/chunk-OHJS5H37.js +0 -16
- package/dist/bundle/chunks/file-AWZ3TUFP.js +0 -22
- package/dist/bundle/chunks/grep-TUWLGQC2.js +0 -8
- package/dist/bundle/chunks/rg-KTCMPGU6.js +0 -32
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
function _(t,n){return t.replace(/\$(&|\d+|<([^>]+)>)/g,(e,i,s)=>{if(i==="&")return n[0];if(s!==void 0)return n.groups?.[s]??"";let d=parseInt(i,10);return n[d]??""})}function F(t,n,e={}){let{invertMatch:i=!1,showLineNumbers:s=!1,countOnly:d=!1,countMatches:$=!1,filename:h="",onlyMatching:I=!1,beforeContext:z=0,afterContext:O=0,maxCount:A=0,contextSeparator:Z="--",showColumn:P=!1,vimgrep:E=!1,showByteOffset:S=!1,replace:b=null,passthru:R=!1,multiline:T=!1,kResetGroup:k}=e;if(T)return K(t,n,{invertMatch:i,showLineNumbers:s,countOnly:d,countMatches:$,filename:h,onlyMatching:I,beforeContext:z,afterContext:O,maxCount:A,contextSeparator:Z,showColumn:P,showByteOffset:S,replace:b,kResetGroup:k});let m=t.split(`
|
|
3
|
+
`),j=m.length,v=j>0&&m[j-1]===""?j-1:j;if(d||$){let f=0,a=($||I)&&!i;for(let l=0;l<v;l++)if(n.lastIndex=0,a)for(let u=n.exec(m[l]);u!==null;u=n.exec(m[l]))f++,u[0].length===0&&n.lastIndex++;else n.test(m[l])!==i&&f++;return{output:`${h?`${h}:${f}`:String(f)}
|
|
4
|
+
`,matched:f>0,matchCount:f}}if(z===0&&O===0&&!R){let f=[],a=!1,o=0,l=0;for(let u=0;u<v&&!(A>0&&o>=A);u++){let L=m[u];if(n.lastIndex=0,n.test(L)!==i)if(a=!0,o++,I){n.lastIndex=0;for(let r=n.exec(L);r!==null;r=n.exec(L)){let M=k!==void 0?r[k]??"":r[0],N=b!==null?_(b,r):M,y=h?`${h}:`:"";S&&(y+=`${l+r.index}:`),s&&(y+=`${u+1}:`),P&&(y+=`${r.index+1}:`),f.push(y+N),r[0].length===0&&n.lastIndex++}}else if(E){n.lastIndex=0;for(let r=n.exec(L);r!==null;r=n.exec(L)){let M=h?`${h}:`:"";S&&(M+=`${l+r.index}:`),s&&(M+=`${u+1}:`),P&&(M+=`${r.index+1}:`),f.push(M+L),r[0].length===0&&n.lastIndex++}}else{n.lastIndex=0;let r=n.exec(L),M=r?r.index+1:1,N=L;b!==null&&(n.lastIndex=0,N=L.replace(n,(...w)=>{if(w[0].length===0)return"";let U=w,B=w[w.length-1];return typeof B=="object"&&B!==null?(U.groups=B,U.input=w[w.length-2],U.index=w[w.length-3]):(U.input=w[w.length-1],U.index=w[w.length-2]),_(b,U)}));let y=h?`${h}:`:"";S&&(y+=`${l+(r?r.index:0)}:`),s&&(y+=`${u+1}:`),P&&(y+=`${M}:`),f.push(y+N)}l+=L.length+1}return{output:f.length>0?`${f.join(`
|
|
5
|
+
`)}
|
|
6
|
+
`:"",matched:a,matchCount:o}}if(R){let f=[],a=!1,o=0;for(let l=0;l<v;l++){let u=m[l];n.lastIndex=0;let G=n.test(u)!==i;G&&(a=!0,o++);let r=G?":":"-",M=h?`${h}${r}`:"";s&&(M+=`${l+1}${r}`),f.push(M+u)}return{output:f.length>0?`${f.join(`
|
|
7
|
+
`)}
|
|
8
|
+
`:"",matched:a,matchCount:o}}let x=[],C=0,p=new Set,g=-1,c=[];for(let f=0;f<v&&!(A>0&&C>=A);f++)n.lastIndex=0,n.test(m[f])!==i&&(c.push(f),C++);for(let f of c){let a=Math.max(0,f-z);g>=0&&a>g+1&&x.push(Z);for(let l=a;l<f;l++)if(!p.has(l)){p.add(l),g=l;let u=m[l];s&&(u=`${l+1}-${u}`),h&&(u=`${h}-${u}`),x.push(u)}if(!p.has(f)){p.add(f),g=f;let l=m[f];if(I){n.lastIndex=0;for(let u=n.exec(l);u!==null;u=n.exec(l)){let L=k!==void 0?u[k]??"":u[0],G=b!==null?b:L,r=h?`${h}:`:"";s&&(r+=`${f+1}:`),P&&(r+=`${u.index+1}:`),x.push(r+G),u[0].length===0&&n.lastIndex++}}else{let u=l;s&&(u=`${f+1}:${u}`),h&&(u=`${h}:${u}`),x.push(u)}}let o=Math.min(v-1,f+O);for(let l=f+1;l<=o;l++)if(!p.has(l)){p.add(l),g=l;let u=m[l];s&&(u=`${l+1}-${u}`),h&&(u=`${h}-${u}`),x.push(u)}}return{output:x.length>0?`${x.join(`
|
|
9
|
+
`)}
|
|
10
|
+
`:"",matched:C>0,matchCount:C}}function K(t,n,e){let{invertMatch:i,showLineNumbers:s,countOnly:d,countMatches:$,filename:h,onlyMatching:I,beforeContext:z,afterContext:O,maxCount:A,contextSeparator:Z,showColumn:P,showByteOffset:E,replace:S,kResetGroup:b}=e,R=t.split(`
|
|
11
|
+
`),T=R.length,k=T>0&&R[T-1]===""?T-1:T,m=[0];for(let c=0;c<t.length;c++)t[c]===`
|
|
12
|
+
`&&m.push(c+1);let j=c=>{let f=0;for(let a=0;a<m.length&&!(m[a]>c);a++)f=a;return f},v=c=>{let f=j(c);return c-m[f]+1},x=[];n.lastIndex=0;for(let c=n.exec(t);c!==null&&!(A>0&&x.length>=A);c=n.exec(t)){let f=j(c.index),a=j(c.index+Math.max(0,c[0].length-1)),o=b!==void 0?c[b]??"":c[0];x.push({startLine:f,endLine:a,byteOffset:c.index,column:v(c.index),matchText:o}),c[0].length===0&&n.lastIndex++}if(d||$){let c;if($)c=i?0:x.length;else{let a=new Set;for(let o of x)for(let l=o.startLine;l<=o.endLine;l++)a.add(l);c=i?k-a.size:a.size}return{output:`${h?`${h}:${c}`:String(c)}
|
|
13
|
+
`,matched:c>0,matchCount:c}}if(i){let c=new Set;for(let a of x)for(let o=a.startLine;o<=a.endLine;o++)c.add(o);let f=[];for(let a=0;a<k;a++)if(!c.has(a)){let o=R[a];s&&(o=`${a+1}:${o}`),h&&(o=`${h}:${o}`),f.push(o)}return{output:f.length>0?`${f.join(`
|
|
14
|
+
`)}
|
|
15
|
+
`:"",matched:f.length>0,matchCount:f.length}}if(x.length===0)return{output:"",matched:!1,matchCount:0};let C=new Set,p=-1,g=[];for(let c of x){let f=Math.max(0,c.startLine-z),a=Math.min(k-1,c.endLine+O);p>=0&&f>p+1&&g.push(Z);for(let o=f;o<c.startLine;o++)if(!C.has(o)){C.add(o),p=o;let l=R[o];s&&(l=`${o+1}-${l}`),h&&(l=`${h}-${l}`),g.push(l)}if(I){let o=S!==null?S:c.matchText,l=h?`${h}:`:"";E&&(l+=`${c.byteOffset}:`),s&&(l+=`${c.startLine+1}:`),P&&(l+=`${c.column}:`),g.push(l+o);for(let u=c.startLine;u<=c.endLine;u++)C.add(u),p=u}else for(let o=c.startLine;o<=c.endLine&&o<k;o++)if(!C.has(o)){C.add(o),p=o;let l=R[o];S!==null&&o===c.startLine&&(n.lastIndex=0,l=l.replace(n,S));let u=h?`${h}:`:"";E&&o===c.startLine&&(u+=`${c.byteOffset}:`),s&&(u+=`${o+1}:`),P&&o===c.startLine&&(u+=`${c.column}:`),g.push(u+l)}for(let o=c.endLine+1;o<=a;o++)if(!C.has(o)){C.add(o),p=o;let l=R[o];s&&(l=`${o+1}-${l}`),h&&(l=`${h}-${l}`),g.push(l)}}return{output:g.length>0?`${g.join(`
|
|
16
|
+
`)}
|
|
17
|
+
`:"",matched:!0,matchCount:x.length}}function Q(t,n){let e,i;switch(n.mode){case"fixed":e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(e=t.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),n.mode==="perl"){e=q(e),e=D(e),e=W(e);let $=X(e);e=$.pattern,i=$.kResetGroup}break}default:e=ne(t);break}n.wholeWord&&(e=`(?<![\\w])(?:${e})(?![\\w])`),n.lineRegexp&&(e=`^${e}$`);let s=/\\u\{[0-9A-Fa-f]+\}/.test(e),d="g"+(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.multilineDotall?"s":"")+(s?"u":"");return{regex:new RegExp(e,d),kResetGroup:i}}function q(t){let n="",e=0;for(;e<t.length;)if(t[e]==="\\"&&e+1<t.length&&t[e+1]==="Q"){e+=2;let i="";for(;e<t.length;){if(t[e]==="\\"&&e+1<t.length&&t[e+1]==="E"){e+=2;break}i+=t[e],e++}n+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else n+=t[e],e++;return n}function D(t){return t.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function W(t){let n="",e=0;for(;e<t.length;){if(t[e]==="("&&e+1<t.length&&t[e+1]==="?"){let i=t.slice(e).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(i){let s=i[1]||"",d=i[2]||"",$=i[3];if($===":"){let h=e+i[0].length-1,I=H(t,e);if(I!==-1){let z=t.slice(h+1,I),O=J(z,s,d);n+=`(?:${O})`,e=I+1;continue}}else if($===")"||$===""){e+=i[0].length;continue}}}n+=t[e],e++}return n}function H(t,n){let e=0,i=n;for(;i<t.length;){if(t[i]==="\\"){i+=2;continue}if(t[i]==="["){for(i++;i<t.length&&t[i]!=="]";)t[i]==="\\"&&i++,i++;i++;continue}if(t[i]==="(")e++;else if(t[i]===")"&&(e--,e===0))return i;i++}return-1}function J(t,n,e){let i=t;return n.includes("i")&&(i=V(i)),i}function V(t){let n="",e=0;for(;e<t.length;){let i=t[e];if(i==="\\"){e+1<t.length?(n+=i+t[e+1],e+=2):(n+=i,e++);continue}if(i==="["){n+=i,e++,e<t.length&&t[e]==="^"&&(n+=t[e],e++);let s=[];for(;e<t.length&&t[e]!=="]";)if(t[e]==="\\")s.push(t[e]),e++,e<t.length&&(s.push(t[e]),e++);else if(t[e]==="-"&&s.length>0&&e+1<t.length&&t[e+1]!=="]"){let d=s[s.length-1],$=t[e+1];s.push("-"),s.push($),/[a-z]/.test(d)&&/[a-z]/.test($)?(s.push(d.toUpperCase()),s.push("-"),s.push($.toUpperCase())):/[A-Z]/.test(d)&&/[A-Z]/.test($)&&(s.push(d.toLowerCase()),s.push("-"),s.push($.toLowerCase())),e+=2}else{let d=t[e];if(s.push(d),/[a-zA-Z]/.test(d)){let $=d===d.toLowerCase()?d.toUpperCase():d.toLowerCase();s.includes($)||s.push($)}e++}n+=s.join(""),e<t.length&&(n+=t[e],e++);continue}if(/[a-zA-Z]/.test(i)){let s=i.toLowerCase(),d=i.toUpperCase();n+=`[${d}${s}]`}else n+=i;e++}return n}function X(t){let n=Y(t);if(n===-1)return{pattern:t};let e=t.slice(0,n),i=t.slice(n+2),s=ee(e);return{pattern:`(?:${e})(${i})`,kResetGroup:s+1}}function Y(t){let n=0;for(;n<t.length-1;)if(t[n]==="\\"){if(t[n+1]==="K"){let e=0,i=n-1;for(;i>=0&&t[i]==="\\";)e++,i--;if(e%2===0)return n}n+=2}else n++;return-1}function ee(t){let n=0,e=0;for(;e<t.length;){if(t[e]==="\\"){e+=2;continue}if(t[e]==="["){for(e++;e<t.length&&t[e]!=="]";)t[e]==="\\"&&e++,e++;e++;continue}if(t[e]==="(")if(e+1<t.length&&t[e+1]==="?"){if(e+2<t.length){let i=t[e+2];if(i===":"||i==="="||i==="!"){e++;continue}if(i==="<"&&e+3<t.length){let s=t[e+3];if(s==="="||s==="!"){e++;continue}n++,e++;continue}}}else n++;e++}return n}function te(t){let n=t.replace(/\$\{0\}|\$0(?![0-9])/g,"$$&");return n=n.replace(/\$\{([^0-9}][^}]*)\}/g,"$$<$1>"),n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),n}function ne(t){let n="",e=0;for(;e<t.length;){let i=t[e];if(i==="\\"&&e+1<t.length){let s=t[e+1];if(s==="|"||s==="("||s===")"){n+=s,e+=2;continue}else if(s==="{"||s==="}"){n+=`\\${s}`,e+=2;continue}}i==="+"||i==="?"||i==="|"||i==="("||i===")"||i==="{"||i==="}"?n+=`\\${i}`:n+=i,e++}return n}export{F as a,Q as b,te as c};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as Ce,b as Fe,c as ne}from"./chunk-GTNBSMZR.js";import{a as G,c as B,e as be}from"./chunk-KGOUQS5A.js";var Te=B(ae=>{ae.read=function(i,e,t,r,n){var o,s,f=n*8-r-1,a=(1<<f)-1,m=a>>1,c=-7,p=t?n-1:0,l=t?-1:1,u=i[e+p];for(p+=l,o=u&(1<<-c)-1,u>>=-c,c+=f;c>0;o=o*256+i[e+p],p+=l,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=s*256+i[e+p],p+=l,c-=8);if(o===0)o=1-m;else{if(o===a)return s?NaN:(u?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-m}return(u?-1:1)*s*Math.pow(2,o-r)};ae.write=function(i,e,t,r,n,o){var s,f,a,m=o*8-n-1,c=(1<<m)-1,p=c>>1,l=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:o-1,T=r?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),s+p>=1?e+=l/a:e+=l*Math.pow(2,1-p),e*a>=2&&(s++,a/=2),s+p>=c?(f=0,s=c):s+p>=1?(f=(e*a-1)*Math.pow(2,n),s=s+p):(f=e*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;i[t+u]=f&255,u+=T,f/=256,n-=8);for(s=s<<n|f,m+=n;m>0;i[t+u]=s&255,u+=T,s/=256,m-=8);i[t+u-T]|=k*128}});var ze=B((Ki,Me)=>{var j=1e3,P=j*60,N=P*60,z=N*24,yt=z*7,bt=z*365.25;Me.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Ct(i);if(t==="number"&&isFinite(i))return e.long?vt(i):Ft(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Ct(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*bt;case"weeks":case"week":case"w":return t*yt;case"days":case"day":case"d":return t*z;case"hours":case"hour":case"hrs":case"hr":case"h":return t*N;case"minutes":case"minute":case"mins":case"min":case"m":return t*P;case"seconds":case"second":case"secs":case"sec":case"s":return t*j;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Ft(i){var e=Math.abs(i);return e>=z?Math.round(i/z)+"d":e>=N?Math.round(i/N)+"h":e>=P?Math.round(i/P)+"m":e>=j?Math.round(i/j)+"s":i+"ms"}function vt(i){var e=Math.abs(i);return e>=z?Y(i,e,z,"day"):e>=N?Y(i,e,N,"hour"):e>=P?Y(i,e,P,"minute"):e>=j?Y(i,e,j,"second"):i+" ms"}function Y(i,e,t,r){var n=e>=t*1.5;return Math.round(i/t)+" "+r+(n?"s":"")}});var fe=B((er,Ue)=>{function St(i){t.debug=t,t.default=t,t.coerce=a,t.disable=s,t.enable=n,t.enabled=f,t.humanize=ze(),t.destroy=m,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let p=0;for(let l=0;l<c.length;l++)p=(p<<5)-p+c.charCodeAt(l),p|=0;return t.colors[Math.abs(p)%t.colors.length]}t.selectColor=e;function t(c){let p,l=null,u,T;function k(...F){if(!k.enabled)return;let O=k,V=Number(new Date),rt=V-(p||V);O.diff=rt,O.prev=p,O.curr=V,p=V,F[0]=t.coerce(F[0]),typeof F[0]!="string"&&F.unshift("%O");let q=0;F[0]=F[0].replace(/%([a-zA-Z%])/g,(re,nt)=>{if(re==="%%")return"%";q++;let ye=t.formatters[nt];if(typeof ye=="function"){let ot=F[q];re=ye.call(O,ot),F.splice(q,1),q--}return re}),t.formatArgs.call(O,F),(O.log||t.log).apply(O,F)}return k.namespace=c,k.useColors=t.useColors(),k.color=t.selectColor(c),k.extend=r,k.destroy=t.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(u!==t.namespaces&&(u=t.namespaces,T=t.enabled(c)),T),set:F=>{l=F}}),typeof t.init=="function"&&t.init(k),k}function r(c,p){let l=t(this.namespace+(typeof p>"u"?":":p)+c);return l.log=this.log,l}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let p=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let l of p)l[0]==="-"?t.skips.push(l.slice(1)):t.names.push(l)}function o(c,p){let l=0,u=0,T=-1,k=0;for(;l<c.length;)if(u<p.length&&(p[u]===c[l]||p[u]==="*"))p[u]==="*"?(T=u,k=l,u++):(l++,u++);else if(T!==-1)u=T+1,k++,l=k;else return!1;for(;u<p.length&&p[u]==="*";)u++;return u===p.length}function s(){let c=[...t.names,...t.skips.map(p=>"-"+p)].join(",");return t.enable(""),c}function f(c){for(let p of t.skips)if(o(c,p))return!1;for(let p of t.names)if(o(c,p))return!0;return!1}function a(c){return c instanceof Error?c.stack||c.message:c}function m(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Ue.exports=St});var Le=B((C,K)=>{C.formatArgs=Et;C.save=At;C.load=Bt;C.useColors=Tt;C.storage=It();C.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();C.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Tt(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Et(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+K.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}C.log=console.debug||console.log||(()=>{});function At(i){try{i?C.storage.setItem("debug",i):C.storage.removeItem("debug")}catch{}}function Bt(){let i;try{i=C.storage.getItem("debug")||C.storage.getItem("DEBUG")}catch{}return!i&&typeof process<"u"&&"env"in process&&(i=process.env.DEBUG),i}function It(){try{return localStorage}catch{}}K.exports=fe()(C);var{formatters:Ot}=K.exports;Ot.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var je=B((tr,Re)=>{"use strict";Re.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),n=e.indexOf("--");return r!==-1&&(n===-1||r<n)}});var _e=B((ir,Ne)=>{"use strict";var Dt=G("os"),Pe=G("tty"),v=je(),{env:g}=process,I;v("no-color")||v("no-colors")||v("color=false")||v("color=never")?I=0:(v("color")||v("colors")||v("color=true")||v("color=always"))&&(I=1);"FORCE_COLOR"in g&&(g.FORCE_COLOR==="true"?I=1:g.FORCE_COLOR==="false"?I=0:I=g.FORCE_COLOR.length===0?1:Math.min(parseInt(g.FORCE_COLOR,10),3));function pe(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function me(i,e){if(I===0)return 0;if(v("color=16m")||v("color=full")||v("color=truecolor"))return 3;if(v("color=256"))return 2;if(i&&!e&&I===void 0)return 0;let t=I||0;if(g.TERM==="dumb")return t;if(process.platform==="win32"){let r=Dt.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in g)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in g)||g.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in g)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(g.TEAMCITY_VERSION)?1:0;if(g.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in g){let r=parseInt((g.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(g.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(g.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(g.TERM)||"COLORTERM"in g?1:t}function Mt(i){let e=me(i,i&&i.isTTY);return pe(e)}Ne.exports={supportsColor:Mt,stdout:pe(me(!0,Pe.isatty(1))),stderr:pe(me(!0,Pe.isatty(2)))}});var He=B((w,te)=>{var zt=G("tty"),ee=G("util");w.init=_t;w.log=jt;w.formatArgs=Lt;w.save=Pt;w.load=Nt;w.useColors=Ut;w.destroy=ee.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");w.colors=[6,2,3,4,5,1];try{let i=_e();i&&(i.stderr||i).level>=2&&(w.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}w.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,o)=>o.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function Ut(){return"colors"in w.inspectOpts?!!w.inspectOpts.colors:zt.isatty(process.stderr.fd)}function Lt(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),o=` ${n};1m${e} \x1B[0m`;i[0]=o+i[0].split(`
|
|
3
|
+
`).join(`
|
|
4
|
+
`+o),i.push(n+"m+"+te.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Rt()+e+" "+i[0]}function Rt(){return w.inspectOpts.hideDate?"":new Date().toISOString()+" "}function jt(...i){return process.stderr.write(ee.formatWithOptions(w.inspectOpts,...i)+`
|
|
5
|
+
`)}function Pt(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Nt(){return process.env.DEBUG}function _t(i){i.inspectOpts={};let e=Object.keys(w.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=w.inspectOpts[e[t]]}te.exports=fe()(w);var{formatters:$e}=te.exports;$e.o=function(i){return this.inspectOpts.colors=this.useColors,ee.inspect(i,this.inspectOpts).split(`
|
|
6
|
+
`).map(e=>e.trim()).join(" ")};$e.O=function(i){return this.inspectOpts.colors=this.useColors,ee.inspect(i,this.inspectOpts)}});var We=B((rr,le)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?le.exports=Le():le.exports=He()});var st="End-Of-Stream",x=class extends Error{constructor(){super(st),this.name="EndOfStreamError"}},D=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var M=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0&&!t)throw new x;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let o=Math.min(n.length,t);e.set(n.subarray(0,o),r),r+=o,t-=o,o<n.length&&this.peekQueue.push(n.subarray(o))}return r}async readRemainderFromStream(e,t){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new D;let n=await this.readFromStream(e.subarray(r),t);if(n===0)break;r+=n}if(!t&&r<e.length)throw new x;return r}};var J=class extends M{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}};var _=class extends J{async readFromStream(e,t){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}};var L=class extends M{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let r=Math.min(t.length,e.length);return e.set(t.subarray(0,r)),r<t.length?this.buffer=t.subarray(r):this.buffer=null,r}async readFromStream(e,t){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){let n=await this.reader.read();if(n.done){this.endOfStream=!0;break}n.value&&(r+=this.writeChunk(e.subarray(r),n.value))}if(!t&&r===0&&this.endOfStream)throw new x;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function oe(i){try{let e=i.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new L(e):new _(e)}catch(e){if(e instanceof TypeError)return new L(i.getReader());throw e}}var S=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})<e.len)throw new x;return e.get(r,0)}async peekToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:t})<e.len)throw new x;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new x;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new x;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){let t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}};var ct=256e3,X=class extends S{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let o=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=o,(!t||!t.mayBeLess)&&o<r.length)throw new x;return o}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=0;if(r.position){let o=r.position-this.position;if(o>0){let s=new Uint8Array(r.length+o);return n=await this.peekBuffer(s,{mayBeLess:r.mayBeLess}),e.set(s.subarray(o)),n-o}if(o<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(o){if(t?.mayBeLess&&o instanceof x)return 0;throw o}if(!r.mayBeLess&&n<r.length)throw new x}return n}async ignore(e){let t=Math.min(ct,e),r=new Uint8Array(t),n=0;for(;n<e;){let o=e-n,s=await this.readBuffer(r,{length:Math.min(t,o)});if(s<0)return s;n+=s}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}};var Z=class extends S{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new x;return e.set(this.uint8Array.subarray(r.position,r.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};var Q=class extends S{constructor(e,t){super(t),this.blob=e,this.fileInfo={...t?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new x;let o=await this.blob.slice(r.position,r.position+n).arrayBuffer();return e.set(new Uint8Array(o)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};function se(i,e){let t=oe(i),r=e??{},n=r.onClose;return r.onClose=async()=>{if(await t.close(),n)return n()},new X(t,r)}function ve(i,e){return new Z(i,e)}function Se(i,e){return new Q(i,e)}import{open as pt}from"node:fs/promises";var $=class i extends S{static async fromFile(e){let t=await pt(e,"r"),r=await t.stat();return new i(t,{fileInfo:{path:e,size:r.size}})}constructor(e,t){super(t),this.fileHandle=e,this.fileInfo=t.fileInfo}async readBuffer(e,t){let r=this.normalizeOptions(e,t);if(this.position=r.position,r.length===0)return 0;let n=await this.fileHandle.read(e,0,r.length,r.position);if(this.position+=n.bytesRead,n.bytesRead<r.length&&(!t||!t.mayBeLess))throw new x;return n.bytesRead}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=await this.fileHandle.read(e,0,r.length,r.position);if(!r.mayBeLess&&n.bytesRead<r.length)throw new x;return n.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(e){this.position=e}supportsRandomAccess(){return!0}};var mt=$.fromFile;var Ae=be(Te(),1);var ce={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},ut={};for(let[i,e]of Object.entries(ce))ut[e]=Number.parseInt(i);function Ee(i,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(i):xt(i);case"utf-16le":return dt(i);case"ascii":return ht(i);case"latin1":case"iso-8859-1":return gt(i);case"windows-1252":return wt(i);default:throw new RangeError(`Encoding '${e}' not supported`)}}function xt(i){let e="",t=0;for(;t<i.length;){let r=i[t++];if(r<128)e+=String.fromCharCode(r);else if(r<224){let n=i[t++]&63;e+=String.fromCharCode((r&31)<<6|n)}else if(r<240){let n=i[t++]&63,o=i[t++]&63;e+=String.fromCharCode((r&15)<<12|n<<6|o)}else{let n=i[t++]&63,o=i[t++]&63,s=i[t++]&63,f=(r&7)<<18|n<<12|o<<6|s;f-=65536,e+=String.fromCharCode(55296+(f>>10&1023),56320+(f&1023))}}return e}function dt(i){let e="";for(let t=0;t<i.length;t+=2)e+=String.fromCharCode(i[t]|i[t+1]<<8);return e}function ht(i){return String.fromCharCode(...i.map(e=>e&127))}function gt(i){return String.fromCharCode(...i)}function wt(i){let e="";for(let t of i)t>=128&&t<=159&&ce[t]?e+=ce[t]:e+=String.fromCharCode(t);return e}function y(i){return new DataView(i.buffer,i.byteOffset)}var Be={len:1,get(i,e){return y(i).getUint8(e)},put(i,e,t){return y(i).setUint8(e,t),e+1}},d={len:2,get(i,e){return y(i).getUint16(e,!0)},put(i,e,t){return y(i).setUint16(e,t,!0),e+2}},R={len:2,get(i,e){return y(i).getUint16(e)},put(i,e,t){return y(i).setUint16(e,t),e+2}};var h={len:4,get(i,e){return y(i).getUint32(e,!0)},put(i,e,t){return y(i).setUint32(e,t,!0),e+4}},Ie={len:4,get(i,e){return y(i).getUint32(e)},put(i,e,t){return y(i).setUint32(e,t),e+4}};var Oe={len:4,get(i,e){return y(i).getInt32(e)},put(i,e,t){return y(i).setInt32(e,t),e+4}};var De={len:8,get(i,e){return y(i).getBigUint64(e,!0)},put(i,e,t){return y(i).setBigUint64(e,t,!0),e+8}};var b=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){let r=e.subarray(t,t+this.len);return Ee(r,this.encoding)}};var Je=be(We(),1);var U={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},ue={get(i){return{signature:h.get(i,0),compressedSize:h.get(i,8),uncompressedSize:h.get(i,12)}},len:16},Ve={get(i){let e=d.get(i,6);return{signature:h.get(i,0),minVersion:d.get(i,4),dataDescriptor:!!(e&8),compressedMethod:d.get(i,8),compressedSize:h.get(i,18),uncompressedSize:h.get(i,22),filenameLength:d.get(i,26),extraFieldLength:d.get(i,28),filename:null}},len:30},qe={get(i){return{signature:h.get(i,0),nrOfThisDisk:d.get(i,4),nrOfThisDiskWithTheStart:d.get(i,6),nrOfEntriesOnThisDisk:d.get(i,8),nrOfEntriesOfSize:d.get(i,10),sizeOfCd:h.get(i,12),offsetOfStartOfCd:h.get(i,16),zipFileCommentLength:d.get(i,20)}},len:22},Ge={get(i){let e=d.get(i,8);return{signature:h.get(i,0),minVersion:d.get(i,6),dataDescriptor:!!(e&8),compressedMethod:d.get(i,10),compressedSize:h.get(i,20),uncompressedSize:h.get(i,24),filenameLength:d.get(i,28),extraFieldLength:d.get(i,30),fileCommentLength:d.get(i,32),relativeOffsetOfLocalHeader:h.get(i,42),filename:null}},len:46};function Xe(i){let e=new Uint8Array(h.len);return h.put(e,0,i),e}var E=(0,Je.default)("tokenizer:inflate"),xe=256*1024,$t=Xe(U.DataDescriptor),ie=Xe(U.EndOfCentralDirectory),H=class i{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(xe)}async isZip(){return await this.peekSignature()===U.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(h)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,t=Math.min(16*1024,e.fileInfo.size),r=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(r,{position:e.fileInfo.size-t});for(let n=r.length-4;n>=0;n--)if(r[n]===ie[0]&&r[n+1]===ie[1]&&r[n+2]===ie[2]&&r[n+3]===ie[3])return e.fileInfo.size-t+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){E("Cannot reading central-directory without random-read support");return}E("Reading central-directory...");let e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){E("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(qe,t),n=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let o=0;o<r.nrOfEntriesOfSize;++o){let s=await this.tokenizer.readToken(Ge);if(s.signature!==U.CentralFileHeader)throw new Error("Expected Central-File-Header signature");s.filename=await this.tokenizer.readToken(new b(s.filenameLength,"utf-8")),await this.tokenizer.ignore(s.extraFieldLength),await this.tokenizer.ignore(s.fileCommentLength),n.push(s),E(`Add central-directory file-entry: n=${o+1}/${n.length}: filename=${n[o].filename}`)}return this.tokenizer.setPosition(e),n}this.tokenizer.setPosition(e)}async unzip(e){let t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let r=!1;do{let n=await this.readLocalFileHeader();if(!n)break;let o=e(n);r=!!o.stop;let s;if(await this.tokenizer.ignore(n.extraFieldLength),n.dataDescriptor&&n.compressedSize===0){let f=[],a=xe;E("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let m=-1;for(;m<0&&a===xe;){a=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),m=Ht(this.syncBuffer.subarray(0,a),$t);let c=m>=0?m:a;if(o.handler){let p=new Uint8Array(c);await this.tokenizer.readBuffer(p),f.push(p)}else await this.tokenizer.ignore(c)}E(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),o.handler&&await this.inflate(n,Wt(f),o.handler)}else o.handler?(E(`Reading compressed-file-data: ${n.compressedSize} bytes`),s=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(s),await this.inflate(n,s,o.handler)):(E(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(E(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(ue)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-ue.len}`)}while(!r)}async iterateOverCentralDirectory(e,t){for(let r of e){let n=t(r);if(n.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let o=await this.readLocalFileHeader();if(o){await this.tokenizer.ignore(o.extraFieldLength);let s=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(s),await this.inflate(o,s,n.handler)}}if(n.stop)break}}async inflate(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);E(`Decompress filename=${e.filename}, compressed-size=${t.length}`);let n=await i.decompressDeflateRaw(t);return r(n)}static async decompressDeflateRaw(e){let t=new ReadableStream({start(o){o.enqueue(e),o.close()}}),r=new DecompressionStream("deflate-raw"),n=t.pipeThrough(r);try{let s=await new Response(n).arrayBuffer();return new Uint8Array(s)}catch(o){let s=o instanceof Error?`Failed to deflate ZIP entry: ${o.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(s)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(h);if(e===U.LocalFileHeader){let t=await this.tokenizer.readToken(Ve);return t.filename=await this.tokenizer.readToken(new b(t.filenameLength,"utf-8")),t}if(e===U.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function Ht(i,e){let t=i.length,r=e.length;if(r>t)return-1;for(let n=0;n<=t-r;n++){let o=!0;for(let s=0;s<r;s++)if(i[n+s]!==e[s]){o=!1;break}if(o)return n}return-1}function Wt(i){let e=i.reduce((n,o)=>n+o.length,0),t=new Uint8Array(e),r=0;for(let n of i)t.set(n,r),r+=n.length;return t}var W=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let r=new Uint8Array(1024),n=await e.readBuffer(r,{mayBeLess:!0});if(n===0){t.close();return}t.enqueue(r.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}};var ur={utf8:new globalThis.TextDecoder("utf8")};var xr=new globalThis.TextEncoder;var dr=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function de(i){let{byteLength:e}=i;if(e===6)return i.getUint16(0)*2**32+i.getUint32(2);if(e===5)return i.getUint8(0)*2**32+i.getUint32(1);if(e===4)return i.getUint32(0);if(e===3)return i.getUint8(0)*2**16+i.getUint16(1);if(e===2)return i.getUint16(0);if(e===1)return i.getUint8(0)}function Ze(i,e){if(e==="utf-16le"){let t=[];for(let r=0;r<i.length;r++){let n=i.charCodeAt(r);t.push(n&255,n>>8&255)}return t}if(e==="utf-16be"){let t=[];for(let r=0;r<i.length;r++){let n=i.charCodeAt(r);t.push(n>>8&255,n&255)}return t}return[...i].map(t=>t.charCodeAt(0))}function Qe(i,e=0){let t=Number.parseInt(new b(6).get(i,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(t))return!1;let r=256;for(let n=e;n<e+148;n++)r+=i[n];for(let n=e+156;n<e+512;n++)r+=i[n];return t===r}var Ye={get:(i,e)=>i[e+3]&127|i[e+2]<<7|i[e+1]<<14|i[e]<<21,len:4};var Ke=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],et=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"];var he=4100;async function ke(i,e){return new we(e).fromBuffer(i)}function ge(i){switch(i=i.toLowerCase(),i){case"application/epub+zip":return{ext:"epub",mime:i};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:i};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:i};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:i};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:i};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:i};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:i};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:i};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:i};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:i};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:i};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:i};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:i};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:i};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:i};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:i};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function A(i,e,t){t={offset:0,...t};for(let[r,n]of e.entries())if(t.mask){if(n!==(t.mask[r]&i[r+t.offset]))return!1}else if(n!==i[r+t.offset])return!1;return!0}var we=class{constructor(e){this.options={mpegOffsetTolerance:0,...e},this.detectors=[...e?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e?.signal}}async fromTokenizer(e){let t=e.position;for(let r of this.detectors){let n=await r.detect(e);if(n)return n;if(t!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t?.length>1)return this.fromTokenizer(ve(t,this.tokenizerOptions))}async fromBlob(e){let t=Se(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async fromStream(e){let t=se(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t){let{sampleSize:r=he}=t,n,o,s=e.getReader({mode:"byob"});try{let{value:m,done:c}=await s.read(new Uint8Array(r));if(o=m,!c&&m)try{n=await this.fromBuffer(m.subarray(0,r))}catch(p){if(!(p instanceof x))throw p;n=void 0}o=m}finally{s.releaseLock()}let f=new TransformStream({async start(m){m.enqueue(o)},transform(m,c){c.enqueue(m)}}),a=e.pipeThrough(f);return a.fileType=n,a}check(e,t){return A(this.buffer,e,t)}checkString(e,t){return this.check(Ze(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(he),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8])){let r=new W(e).inflate(),n=!0;try{let o;try{o=await this.fromStream(r)}catch{n=!1}if(o&&o.ext==="tar")return{ext:"tar.gz",mime:"application/gzip"}}finally{n&&await r.cancel()}return{ext:"gz",mime:"application/gzip"}}if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);let t=await e.readToken(Ye);return e.position+t>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(t),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let t;return await new H(e).unzip(r=>{switch(r.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(n){let o=new TextDecoder("utf-8").decode(n).trim();t=ge(o)},stop:!0};case"[Content_Types].xml":return{async handler(n){let o=new TextDecoder("utf-8").decode(n),s=o.indexOf('.main+xml"');if(s===-1){let f="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";o.includes(`ContentType="${f}"`)&&(t=ge(f))}else{o=o.slice(0,Math.max(0,s));let f=o.lastIndexOf('"'),a=o.slice(Math.max(0,f+1));t=ge(a)}},stop:!0};default:return/classes\d*\.dex/.test(r.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}).catch(r=>{if(!(r instanceof x))throw r}),t??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),A(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:A(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:A(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:A(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:A(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:A(t,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){let t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){let f=await e.peekNumber(Be),a=128,m=0;for(;(f&a)===0&&a!==0;)++m,a>>=1;let c=new Uint8Array(m+1);return await e.readBuffer(c),c}async function r(){let f=await t(),a=await t();a[0]^=128>>a.length-1;let m=Math.min(6,a.length),c=new DataView(f.buffer),p=new DataView(a.buffer,a.length-m,m);return{id:de(c),len:de(p)}}async function n(f){for(;f>0;){let a=await r();if(a.id===17026)return(await e.readToken(new b(a.len))).replaceAll(/\00.*$/g,"");await e.ignore(a.len),--f}}let o=await r();switch(await n(o.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let t=new b(4,"latin1").get(this.buffer,2);if(t.match("^d*")&&t>=1e3&&t<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new b(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
7
|
+
`,"\r"," "," ","\0"].some(t=>this.checkString(t,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){await e.ignore(8);async function t(){return{length:await e.readToken(Oe),type:await e.readToken(new b(4,"latin1"))}}do{let r=await t();if(r.length<0)return;switch(r.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(r.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let t=new b(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(t){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return t.startsWith("3g")?t.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
8
|
+
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function t(){let r=new Uint8Array(16);return await e.readBuffer(r),{id:r,size:Number(await e.readToken(De))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){let r=await t(),n=r.size-24;if(A(r.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let o=new Uint8Array(16);if(n-=await e.readBuffer(o),A(o,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(A(o,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(n)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new b(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let t=new DataView(this.buffer.buffer).getUint32(12,!0);if(t>12&&this.buffer.length>=t+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,t+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&Qe(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let t="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:t})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:t})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
|
|
9
|
+
`,{offset:2,encoding:t})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async e=>{if(this.buffer=new Uint8Array(he),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let t=0;t<=this.options.mpegOffsetTolerance;++t){let r=this.scanMpeg(t);if(r)return r}};async readTiffTag(e){let t=await this.tokenizer.readToken(e?R:d);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let t=await this.tokenizer.readToken(e?R:d);for(let r=0;r<t;++r){let n=await this.readTiffTag(e);if(n)return n}}async readTiffHeader(e){let t=(e?R:d).get(this.buffer,2),r=(e?Ie:h).get(this.buffer,4);if(t===42){if(r>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r>=8){let o=(e?R:d).get(this.buffer,8),s=(e?R:d).get(this.buffer,10);if(o===28&&s===254||o===31&&s===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(r),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(t===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:e+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},Vt=new Set(Ke),qt=new Set(et);var Gt={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},tt={".js":{description:"JavaScript source",mime:"text/javascript"},".mjs":{description:"JavaScript module",mime:"text/javascript"},".cjs":{description:"CommonJS module",mime:"text/javascript"},".ts":{description:"TypeScript source",mime:"text/typescript"},".tsx":{description:"TypeScript JSX source",mime:"text/typescript"},".jsx":{description:"JavaScript JSX source",mime:"text/javascript"},".py":{description:"Python script",mime:"text/x-python"},".rb":{description:"Ruby script",mime:"text/x-ruby"},".go":{description:"Go source",mime:"text/x-go"},".rs":{description:"Rust source",mime:"text/x-rust"},".c":{description:"C source",mime:"text/x-c"},".h":{description:"C header",mime:"text/x-c"},".cpp":{description:"C++ source",mime:"text/x-c++"},".hpp":{description:"C++ header",mime:"text/x-c++"},".java":{description:"Java source",mime:"text/x-java"},".sh":{description:"Bourne-Again shell script",mime:"text/x-shellscript"},".bash":{description:"Bourne-Again shell script",mime:"text/x-shellscript"},".zsh":{description:"Zsh shell script",mime:"text/x-shellscript"},".json":{description:"JSON data",mime:"application/json"},".yaml":{description:"YAML data",mime:"text/yaml"},".yml":{description:"YAML data",mime:"text/yaml"},".xml":{description:"XML document",mime:"application/xml"},".csv":{description:"CSV text",mime:"text/csv"},".toml":{description:"TOML data",mime:"text/toml"},".html":{description:"HTML document",mime:"text/html"},".htm":{description:"HTML document",mime:"text/html"},".css":{description:"CSS stylesheet",mime:"text/css"},".svg":{description:"SVG image",mime:"image/svg+xml"},".md":{description:"Markdown document",mime:"text/markdown"},".markdown":{description:"Markdown document",mime:"text/markdown"},".txt":{description:"ASCII text",mime:"text/plain"},".rst":{description:"reStructuredText",mime:"text/x-rst"},".env":{description:"ASCII text",mime:"text/plain"},".gitignore":{description:"ASCII text",mime:"text/plain"},".dockerignore":{description:"ASCII text",mime:"text/plain"}},it={jpg:"JPEG image data",jpeg:"JPEG image data",png:"PNG image data",gif:"GIF image data",webp:"WebP image data",bmp:"PC bitmap",ico:"MS Windows icon resource",tif:"TIFF image data",tiff:"TIFF image data",psd:"Adobe Photoshop Document",avif:"AVIF image",heic:"HEIC image",heif:"HEIF image",jxl:"JPEG XL image",icns:"Mac OS X icon",svg:"SVG Scalable Vector Graphics image",pdf:"PDF document",epub:"EPUB document",mobi:"Mobipocket E-book",djvu:"DjVu document",zip:"Zip archive data",gz:"gzip compressed data",gzip:"gzip compressed data",bz2:"bzip2 compressed data",xz:"XZ compressed data",tar:"POSIX tar archive",rar:"RAR archive data","7z":"7-zip archive data",lz:"lzip compressed data",lzma:"LZMA compressed data",zst:"Zstandard compressed data",cab:"Microsoft Cabinet archive",ar:"Unix ar archive",rpm:"RPM package",deb:"Debian binary package",apk:"Android Package",dmg:"Apple disk image",iso:"ISO 9660 CD-ROM filesystem data",vhd:"Microsoft Virtual Hard Disk",vhdx:"Microsoft Virtual Hard Disk (new format)",qcow2:"QEMU QCOW Image",mp3:"Audio file with ID3",m4a:"MPEG-4 audio",aac:"AAC audio",wav:"RIFF (little-endian) data, WAVE audio",flac:"FLAC audio bitstream data",ogg:"Ogg data",oga:"Ogg audio",opus:"Ogg Opus audio",aiff:"AIFF audio",wma:"Windows Media Audio",amr:"AMR audio",mid:"MIDI audio",midi:"MIDI audio",ape:"Monkey's Audio",mp4:"ISO Media, MPEG-4",m4v:"MPEG-4 video",webm:"WebM",avi:"RIFF (little-endian) data, AVI",mov:"ISO Media, Apple QuickTime movie",mkv:"Matroska data",wmv:"Windows Media Video",flv:"Flash Video","3gp":"3GPP multimedia","3g2":"3GPP2 multimedia",ogv:"Ogg video",mts:"MPEG transport stream",m2ts:"MPEG transport stream",ts:"MPEG transport stream",mpg:"MPEG video",mpeg:"MPEG video",exe:"PE32 executable",dll:"PE32 DLL",elf:"ELF executable",mach:"Mach-O executable",wasm:"WebAssembly (wasm) binary module",dex:"Android Dalvik executable",class:"Java class file",swf:"Adobe Flash",doc:"Microsoft Word Document",docx:"Microsoft Word 2007+ Document",xls:"Microsoft Excel Spreadsheet",xlsx:"Microsoft Excel 2007+ Spreadsheet",ppt:"Microsoft PowerPoint Presentation",pptx:"Microsoft PowerPoint 2007+ Presentation",odt:"OpenDocument Text",ods:"OpenDocument Spreadsheet",odp:"OpenDocument Presentation",ttf:"TrueType Font",otf:"OpenType Font",woff:"Web Open Font Format",woff2:"Web Open Font Format 2",eot:"Embedded OpenType font",stl:"Stereolithography CAD",obj:"Wavefront 3D Object",gltf:"GL Transmission Format",glb:"GL Transmission Format (binary)",sqlite:"SQLite 3.x database",mdb:"Microsoft Access Database",xml:"XML document",json:"JSON data",macho:"Mach-O binary",ics:"iCalendar data",vcf:"vCard data",msi:"Microsoft Installer",ps:"PostScript",ai:"Adobe Illustrator",indd:"Adobe InDesign",sketch:"Sketch design file",fig:"Figma design file",xd:"Adobe XD",blend:"Blender",fbx:"Autodesk FBX",lnk:"MS Windows shortcut",alias:"Mac OS alias",torrent:"BitTorrent file",pcap:"pcap capture file",arrow:"Apache Arrow",parquet:"Apache Parquet"};function Jt(i,e){if(it[i])return it[i];let[t,r]=e.split("/"),n=r?.split("+")[0]?.replace(/-/g," ")||i;switch(t){case"image":return`${n.toUpperCase()} image data`;case"audio":return`${n.toUpperCase()} audio`;case"video":return`${n.toUpperCase()} video`;case"font":return`${n} font`;case"model":return`${n} 3D model`;case"application":return r?.includes("zip")||r?.includes("compressed")?`${n} archive data`:r?.includes("executable")?`${n} executable`:`${i.toUpperCase()} data`;default:return`${i.toUpperCase()} data`}}function Xt(i){let e=i.split("/").pop()||i;if(e.startsWith(".")&&!e.includes(".",1))return e;let t=e.lastIndexOf(".");return t===-1||t===0?"":e.slice(t).toLowerCase()}function Zt(i,e){if(i.startsWith("#!")){let a=i.split(`
|
|
10
|
+
`)[0];return a.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:a.includes("node")||a.includes("bun")||a.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:a.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:a.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:a.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:a.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let t=i.trimStart();if(t.startsWith("<?xml"))return{description:"XML document",mime:"application/xml"};if(t.startsWith("<!DOCTYPE html")||t.toLowerCase().startsWith("<html"))return{description:"HTML document",mime:"text/html"};let r=i.includes(`\r
|
|
11
|
+
`),n=i.includes("\r")&&!r,o="";r?o=", with CRLF line terminators":n&&(o=", with CR line terminators");let s=Xt(e);if(s&&tt[s]){let a=tt[s];return a.mime.startsWith("text/")&&o?{description:`${a.description}${o}`,mime:a.mime}:a}let f=!1;for(let a=0;a<Math.min(i.length,8192);a++)if(i.charCodeAt(a)>127){f=!0;break}return f?{description:`UTF-8 Unicode text${o}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${o}`,mime:"text/plain"}}async function Qt(i,e){if(e.length===0)return{description:"empty",mime:"inode/x-empty"};let t=await ke(e);if(t)return{description:Jt(t.ext,t.mime),mime:t.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(e);return Zt(r,i)}var Dr={name:"file",async execute(i,e){if(Fe(i))return Ce(Gt);let t=!1,r=!1,n=[];for(let f of i)if(f.startsWith("--")){if(f==="--brief")t=!0;else if(f==="--mime"||f==="--mime-type")r=!0;else if(f!=="--dereference")return ne("file",f)}else if(f.startsWith("-")&&f!=="-"){for(let a of f.slice(1))if(a==="b")t=!0;else if(a==="i")r=!0;else if(a!=="L")return ne("file",`-${a}`)}else n.push(f);if(n.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
|
|
12
|
+
`,exitCode:1};let o="",s=0;for(let f of n)try{let a=e.fs.resolvePath(e.cwd,f);if((await e.fs.stat(a)).isDirectory){let u=r?"inode/directory":"directory";o+=t?`${u}
|
|
13
|
+
`:`${f}: ${u}
|
|
14
|
+
`;continue}let c=await e.fs.readFileBuffer(a),p=await Qt(f,c),l=r?p.mime:p.description;o+=t?`${l}
|
|
15
|
+
`:`${f}: ${l}
|
|
16
|
+
`}catch{o+=t?`cannot open
|
|
17
|
+
`:`${f}: cannot open (No such file or directory)
|
|
18
|
+
`,s=1}return{stdout:o,stderr:"",exitCode:s}}};export{Dr as fileCommand};
|
|
19
|
+
/*! Bundled license information:
|
|
20
|
+
|
|
21
|
+
ieee754/index.js:
|
|
22
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
23
|
+
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as y}from"./chunk-26Q3PZQ6.js";import{a as S,b as z}from"./chunk-DV5HL4K2.js";import{a as _,b as j,c as G}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var te={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},J={name:"grep",async execute(t,s){if(j(t))return _(te);let o=!1,f=!1,c=!1,h=!1,m=!1,l=!1,i=!1,d=!1,w=!1,u=!1,p=!1,T=!1,x=!1,q=!1,B=!1,M=0,R=0,F=0,W=[],A=[],Q=[],N=null,I=[];for(let r=0;r<t.length;r++){let n=t[r];if(n.startsWith("-")&&n!=="-"){if(n==="-e"&&r+1<t.length){N=t[++r];continue}if(n.startsWith("--include=")){W.push(n.slice(10));continue}if(n.startsWith("--exclude=")){A.push(n.slice(10));continue}if(n.startsWith("--exclude-dir=")){Q.push(n.slice(14));continue}if(n.startsWith("--max-count=")){M=parseInt(n.slice(12),10);continue}let C=n.match(/^-m(\d+)$/);if(C){M=parseInt(C[1],10);continue}if(n==="-m"&&r+1<t.length){M=parseInt(t[++r],10);continue}let a=n.match(/^-([ABC])(\d+)$/);if(a){let e=parseInt(a[2],10);a[1]==="A"?F=e:a[1]==="B"?R=e:a[1]==="C"&&(R=e,F=e);continue}if((n==="-A"||n==="-B"||n==="-C")&&r+1<t.length){let e=parseInt(t[++r],10);n==="-A"?F=e:n==="-B"?R=e:(R=e,F=e);continue}let g=n.startsWith("--")?[n]:n.slice(1).split("");for(let e of g)if(e==="i"||e==="--ignore-case")o=!0;else if(e==="n"||e==="--line-number")f=!0;else if(e==="v"||e==="--invert-match")c=!0;else if(e==="c"||e==="--count")h=!0;else if(e==="l"||e==="--files-with-matches")m=!0;else if(e==="L"||e==="--files-without-match")l=!0;else if(e==="r"||e==="R"||e==="--recursive")i=!0;else if(e==="w"||e==="--word-regexp")d=!0;else if(e==="x"||e==="--line-regexp")w=!0;else if(e==="E"||e==="--extended-regexp")u=!0;else if(e==="P"||e==="--perl-regexp")p=!0;else if(e==="F"||e==="--fixed-strings")T=!0;else if(e==="o"||e==="--only-matching")x=!0;else if(e==="h"||e==="--no-filename")q=!0;else if(e==="q"||e==="--quiet"||e==="--silent")B=!0;else{if(e.startsWith("--"))return G("grep",e);if(e.length===1)return G("grep",`-${e}`)}}else N===null?N=n:I.push(n)}if(N===null)return{stdout:"",stderr:`grep: missing pattern
|
|
3
|
+
`,exitCode:2};let V=T?"fixed":u?"extended":p?"perl":"basic",U,b;try{let r=z(N,{mode:V,ignoreCase:o,wholeWord:d,lineRegexp:w});U=r.regex,b=r.kResetGroup}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${N}
|
|
4
|
+
`,exitCode:2}}if(I.length===0&&s.stdin){let r=S(s.stdin,U,{invertMatch:c,showLineNumbers:f,countOnly:h,filename:"",onlyMatching:x,beforeContext:R,afterContext:F,maxCount:M,kResetGroup:b});return B?{stdout:"",stderr:"",exitCode:r.matched?0:1}:{stdout:r.output,stderr:"",exitCode:r.matched?0:1}}if(I.length===0)return{stdout:"",stderr:`grep: no input files
|
|
5
|
+
`,exitCode:2};let $="",D="",H=!1,k=!1,P=[];for(let r of I)if(r.includes("*")||r.includes("?")||r.includes("[")){let n=await se(r,s);if(i)for(let C of n){let a=await O(C.path,s,W,A,Q,C.isFile);P.push(...a)}else P.push(...n)}else if(i){let n=await O(r,s,W,A,Q);P.push(...n)}else P.push({path:r});let X=(P.length>1||i)&&!q,Z=50;for(let r=0;r<P.length;r+=Z){let n=P.slice(r,r+Z),C=await Promise.all(n.map(async a=>{let g=a.path,e=g.split("/").pop()||g;if(A.length>0&&!i&&A.some(v=>y(e,v,{stripQuotes:!0}))||W.length>0&&!i&&!W.some(v=>y(e,v,{stripQuotes:!0})))return null;try{let v=s.fs.resolvePath(s.cwd,g),L=!1;if(a.isFile===void 0?L=(await s.fs.stat(v)).isDirectory:L=!a.isFile,L)return i?null:{error:`grep: ${g}: Is a directory
|
|
6
|
+
`};let Y=await s.fs.readFile(v),ee=S(Y,U,{invertMatch:c,showLineNumbers:f,countOnly:h,filename:X?g:"",onlyMatching:x,beforeContext:R,afterContext:F,maxCount:M,kResetGroup:b});return{file:g,result:ee}}catch{return{error:`grep: ${g}: No such file or directory
|
|
7
|
+
`}}}));for(let a of C){if(a===null)continue;if("error"in a&&a.error){D+=a.error,a.error.includes("Is a directory")||(k=!0);continue}if(!("file"in a)||!a.result)continue;let{file:g,result:e}=a;if(e.matched){if(H=!0,B)return{stdout:"",stderr:"",exitCode:0};m?$+=`${g}
|
|
8
|
+
`:l||($+=e.output)}else l?$+=`${g}
|
|
9
|
+
`:h&&!m&&($+=e.output)}}let E;return k?E=2:l?E=$.length>0?0:1:E=H?0:1,B?{stdout:"",stderr:"",exitCode:E}:{stdout:$,stderr:D,exitCode:E}}};async function K(t,s,o,f){let c=o.fs.resolvePath(o.cwd,t);try{if(!(await o.fs.stat(c)).isDirectory){let l=t.split("/").pop()||"";if(s){let i=s.replace(/^\//,"");y(l,i,{stripQuotes:!0})&&f.push(t)}return}let m=await o.fs.readdir(c);for(let l of m){let i=t==="."?l:`${t}/${l}`,d=o.fs.resolvePath(o.cwd,i);if((await o.fs.stat(d)).isDirectory)await K(i,s,o,f);else if(s){let u=s.replace(/^\//,"");y(l,u,{stripQuotes:!0})&&f.push(i)}}}catch{}}async function se(t,s){let o=[],f=t.lastIndexOf("/"),c,h;if(f===-1?(c=s.cwd,h=t):(c=t.slice(0,f)||"/",h=t.slice(f+1)),t.includes("**")){let l=[],i=t.split("**"),d=i[0].replace(/\/$/,"")||".",w=i[1]||"";return await K(d,w,s,l),l.map(u=>({path:u}))}let m=s.fs.resolvePath(s.cwd,c);try{if(s.fs.readdirWithFileTypes){let l=await s.fs.readdirWithFileTypes(m);for(let i of l)if(y(i.name,h,{stripQuotes:!0})){let d=f===-1?i.name:`${c}/${i.name}`;o.push({path:d,isFile:i.isFile})}}else{let l=await s.fs.readdir(m);for(let i of l)if(y(i,h,{stripQuotes:!0})){let d=f===-1?i:`${c}/${i}`;o.push({path:d})}}}catch{}return o.sort((l,i)=>l.path.localeCompare(i.path))}async function O(t,s,o=[],f=[],c=[],h){let m=s.fs.resolvePath(s.cwd,t),l=[];try{let i,d;if(h!==void 0)i=h,d=!h;else{let u=await s.fs.stat(m);i=u.isFile,d=u.isDirectory}if(i){let u=t.split("/").pop()||t;return f.length>0&&f.some(p=>y(u,p,{stripQuotes:!0}))?[]:o.length>0&&!o.some(p=>y(u,p,{stripQuotes:!0}))?[]:[{path:t,isFile:!0}]}if(!d)return[];let w=t.split("/").pop()||t;if(c.length>0&&c.some(u=>y(w,u,{stripQuotes:!0})))return[];if(s.fs.readdirWithFileTypes){let u=await s.fs.readdirWithFileTypes(m);for(let p of u){if(p.name.startsWith("."))continue;let T=t==="."?p.name:`${t}/${p.name}`,x=await O(T,s,o,f,c,p.isFile);l.push(...x)}}else{let u=await s.fs.readdir(m);for(let p of u){if(p.startsWith("."))continue;let T=t==="."?p:`${t}/${p}`,x=await O(T,s,o,f,c);l.push(...x)}}}catch{}return l}var oe={name:"fgrep",async execute(t,s){return J.execute(["-F",...t],s)}},ae={name:"egrep",async execute(t,s){return J.execute(["-E",...t],s)}};export{ae as egrepCommand,oe as fgrepCommand,J as grepCommand};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as E,b as A,c as z}from"./chunk-DV5HL4K2.js";import{a as L,b as _,c as j}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var B={js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}},$=class{types;constructor(){this.types=new Map(Object.entries(B).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let s=t.slice(0,n),r=t.slice(n+1);if(r.startsWith("include:")){let l=r.slice(8),i=this.types.get(l);if(i){let o=this.types.get(s)||{extensions:[],globs:[]};o.extensions.push(...i.extensions),o.globs.push(...i.globs),this.types.set(s,o)}}else{let l=this.types.get(s)||{extensions:[],globs:[]};if(r.startsWith("*.")&&!r.slice(2).includes("*")){let i=r.slice(1);l.extensions.includes(i)||l.extensions.push(i)}else l.globs.includes(r)||l.globs.push(r);this.types.set(s,l)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let s=t.toLowerCase();for(let r of n){if(r==="all"){if(this.matchesAnyType(t))return!0;continue}let l=this.types.get(r);if(l){for(let i of l.extensions)if(s.endsWith(i))return!0;for(let i of l.globs)if(i.includes("*")){let o=i.replace(/\./g,"\\.").replace(/\*/g,".*");if(new RegExp(`^${o}$`,"i").test(t))return!0}else if(s===i.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let s of this.types.values()){for(let r of s.extensions)if(n.endsWith(r))return!0;for(let r of s.globs)if(r.includes("*")){let l=r.replace(/\./g,"\\.").replace(/\*/g,".*");if(new RegExp(`^${l}$`,"i").test(t))return!0}else if(n===r.toLowerCase())return!0}return!1}};function G(){let e=[];for(let[t,n]of Object.entries(B).sort()){let s=[];for(let r of n.extensions)s.push(`*${r}`);for(let r of n.globs)s.push(r);e.push(`${t}: ${s.join(", ")}`)}return`${e.join(`
|
|
3
|
+
`)}
|
|
4
|
+
`}function U(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:1/0,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}function X(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function Q(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
|
|
5
|
+
`,exitCode:1}}function q(e){return null}var V=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:q},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:q},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:parseInt},{long:"max-filesize",target:"maxFilesize",parse:X,validate:Q},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",target:"maxDepth",parse:()=>1/0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],ee={i:e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1},"--ignore-case":e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1},s:e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1},"--case-sensitive":e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1},S:e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1},"--smart-case":e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1},F:e=>{e.fixedStrings=!0},"--fixed-strings":e=>{e.fixedStrings=!0},w:e=>{e.wordRegexp=!0},"--word-regexp":e=>{e.wordRegexp=!0},x:e=>{e.lineRegexp=!0},"--line-regexp":e=>{e.lineRegexp=!0},v:e=>{e.invertMatch=!0},"--invert-match":e=>{e.invertMatch=!0},U:e=>{e.multiline=!0},"--multiline":e=>{e.multiline=!0},"--multiline-dotall":e=>{e.multilineDotall=!0,e.multiline=!0},c:e=>{e.count=!0},"--count":e=>{e.count=!0},"--count-matches":e=>{e.countMatches=!0},l:e=>{e.filesWithMatches=!0},"--files":e=>{e.files=!0},"--files-with-matches":e=>{e.filesWithMatches=!0},"--files-without-match":e=>{e.filesWithoutMatch=!0},"--stats":e=>{e.stats=!0},o:e=>{e.onlyMatching=!0},"--only-matching":e=>{e.onlyMatching=!0},q:e=>{e.quiet=!0},"--quiet":e=>{e.quiet=!0},N:e=>{e.lineNumber=!1},"--no-line-number":e=>{e.lineNumber=!1},H:e=>{e.withFilename=!0},"--with-filename":e=>{e.withFilename=!0},I:e=>{e.noFilename=!0},"--no-filename":e=>{e.noFilename=!0},0:e=>{e.nullSeparator=!0},"--null":e=>{e.nullSeparator=!0},b:e=>{e.byteOffset=!0},"--byte-offset":e=>{e.byteOffset=!0},"--column":e=>{e.column=!0,e.lineNumber=!0},"--no-column":e=>{e.column=!1},"--vimgrep":e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0},"--json":e=>{e.json=!0},"--hidden":e=>{e.hidden=!0},"--no-ignore":e=>{e.noIgnore=!0},"--no-ignore-dot":e=>{e.noIgnoreDot=!0},"--no-ignore-vcs":e=>{e.noIgnoreVcs=!0},L:e=>{e.followSymlinks=!0},"--follow":e=>{e.followSymlinks=!0},z:e=>{e.searchZip=!0},"--search-zip":e=>{e.searchZip=!0},a:e=>{e.searchBinary=!0},"--text":e=>{e.searchBinary=!0},"--heading":e=>{e.heading=!0},"--passthru":e=>{e.passthru=!0},"--include-zero":e=>{e.includeZero=!0},"--glob-case-insensitive":e=>{e.globCaseInsensitive=!0}},te=new Set(["n","--line-number"]);function se(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function ne(e,t,n){let s=e[t];for(let r of V){if(s.startsWith(`--${r.long}=`)){let l=s.slice(`--${r.long}=`.length),i=D(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s.startsWith(`-${r.short}`)&&s.length>2){let l=s.slice(2),i=D(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s===`-${r.short}`||s===`--${r.long}`){if(t+1>=e.length)return null;let l=e[t+1],i=D(n,r,l);return i?{newIndex:t+1,error:i}:{newIndex:t+1}}}return null}function re(e){return V.find(t=>t.short===e)}function D(e,t,n){if(t.validate){let r=t.validate(n);if(r)return r}let s=t.parse?t.parse(n):n;t.multi?e[t.target].push(s):e[t.target]=s}function ie(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let s=e[t+1];if(s==="path"||s==="none")return{value:s,newIndex:t+1}}if(n.startsWith("--sort=")){let s=n.slice(7);if(s==="path"||s==="none")return{value:s,newIndex:t}}return null}function le(e,t){let n=e[t],s=n.match(/^-([ABC])(\d+)$/);return s?{flag:s[1],value:parseInt(s[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function oe(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function Z(e){let t=U(),n=null,s=[],r=-1,l=-1,i=-1,o=!1;for(let c=0;c<e.length;c++){let a=e[c];if(a.startsWith("-")&&a!=="-"){let u=le(e,c);if(u){let{flag:f,value:x,newIndex:b}=u;f==="A"?r=Math.max(r,x):f==="B"?l=Math.max(l,x):i=x,c=b;continue}let m=oe(a);if(m!==null){t.maxCount=m;continue}let p=ne(e,c,t);if(p){if(p.error)return{success:!1,error:p.error};c=p.newIndex;continue}let g=ie(e,c);if(g){t.sort=g.value,c=g.newIndex;continue}let w=a.startsWith("--")?[a]:a.slice(1).split(""),d=!1;for(let f of w){if(te.has(f)){t.lineNumber=!0,o=!0;continue}if(f==="u"||f==="--unrestricted"){se(t);continue}if(f==="P"||f==="--pcre2")return{success:!1,error:{stdout:"",stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
|
|
6
|
+
`,exitCode:1}};if(f.length===1){let b=re(f);if(b){if(c+1>=e.length)return{success:!1,error:j("rg",`-${f}`)};let h=D(t,b,e[c+1]);if(h)return{success:!1,error:h};c++,d=!0;continue}}let x=ee[f];if(x){x(t);continue}if(f.startsWith("--"))return{success:!1,error:j("rg",f)};if(f.length===1)return{success:!1,error:j("rg",`-${f}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=a:s.push(a)}return(r>=0||i>=0)&&(t.afterContext=Math.max(r>=0?r:0,i>=0?i:0)),(l>=0||i>=0)&&(t.beforeContext=Math.max(l>=0?l:0,i>=0?i:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(o=!0),{success:!0,options:t,paths:s,explicitLineNumbers:o}}import{gunzipSync as ae}from"node:zlib";var M=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
|
|
7
|
+
`);for(let s of n){let r=s.replace(/\s+$/,"");if(!r||r.startsWith("#"))continue;let l=!1;r.startsWith("!")&&(l=!0,r=r.slice(1));let i=!1;r.endsWith("/")&&(i=!0,r=r.slice(0,-1));let o=!1;r.startsWith("/")?(o=!0,r=r.slice(1)):r.includes("/")&&!r.startsWith("**/")&&(o=!0);let c=this.patternToRegex(r,o);this.patterns.push({pattern:s,regex:c,negated:l,directoryOnly:i,rooted:o})}}patternToRegex(t,n){let s="";n?s="^":s="(?:^|/)";let r=0;for(;r<t.length;){let l=t[r];if(l==="*")t[r+1]==="*"?t[r+2]==="/"?(s+="(?:.*/)?",r+=3):(r+2>=t.length,s+=".*",r+=2):(s+="[^/]*",r++);else if(l==="?")s+="[^/]",r++;else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let o=t.slice(r,i+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),s+=o,r=i+1}else s+="\\[",r++}else l==="/"?(s+="/",r++):(s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r++)}return s+="(?:/.*)?$",new RegExp(s)}matches(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");let r=!1;for(let l of this.patterns)l.directoryOnly&&!n||l.regex.test(s)&&(r=!l.negated);return r}isWhitelisted(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");for(let r of this.patterns)if(!(r.directoryOnly&&!n)&&r.negated&&r.regex.test(s))return!0;return!1}getBasePath(){return this.basePath}},k=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,s=!1,r=!1){this.fs=t,this.skipDotIgnore=s,this.skipVcsIgnore=r}async load(t){let n=[],s=t;for(;;){n.unshift(s);let l=this.fs.resolvePath(s,"..");if(l===s)break;s=l}let r=[];this.skipVcsIgnore||r.push(".gitignore"),this.skipDotIgnore||r.push(".rgignore",".ignore");for(let l of n){this.loadedDirs.add(l);for(let i of r){let o=this.fs.resolvePath(l,i);try{let c=await this.fs.readFile(o),a=new M(l);a.parse(c),this.parsers.push(a)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let s of n){let r=this.fs.resolvePath(t,s);try{let l=await this.fs.readFile(r),i=new M(t);i.parse(l),this.parsers.push(i)}catch{}}}addPatternsFromContent(t,n){let s=new M(n);s.parse(t),this.parsers.push(s)}matches(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.matches(l,n))return!0}return!1}isWhitelisted(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.isWhitelisted(l,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}};async function P(e,t,n=!1,s=!1,r=[]){let l=new k(e,t,n,s);await l.load(t);for(let i of r)try{let o=e.resolvePath(t,i),c=await e.readFile(o);l.addPatternsFromContent(c,t)}catch{}return l}function ce(e){return e.length>=2&&e[0]===31&&e[1]===139}function fe(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s==="["&&!t?t=!0:s==="]"&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function H(e){let{ctx:t,options:n,paths:s,explicitLineNumbers:r}=e;for(let f of n.globs){let x=f.startsWith("!")?f.slice(1):f,b=fe(x);if(b)return{stdout:"",stderr:`${b}
|
|
8
|
+
`,exitCode:1}}if(n.files){let f=[...n.patterns,...s];return ge(t,f,n)}let l=[...n.patterns];for(let f of n.patternFiles)try{let x;if(f==="-")x=t.stdin;else{let h=t.fs.resolvePath(t.cwd,f);x=await t.fs.readFile(h)}let b=x.split(`
|
|
9
|
+
`).filter(h=>h.length>0);l.push(...b)}catch{return{stdout:"",stderr:`rg: ${f}: No such file or directory
|
|
10
|
+
`,exitCode:2}}if(l.length===0)return n.patternFiles.length>0?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`rg: no pattern given
|
|
11
|
+
`,exitCode:2};let i=s.length===0?["."]:s,o=ue(n,l),c,a;try{let f=he(l,n,o);c=f.regex,a=f.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${l.join(", ")}
|
|
12
|
+
`,exitCode:2}}let u=null;n.noIgnore||(u=await P(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let m=new $;for(let f of n.typeClear)m.clearType(f);for(let f of n.typeAdd)m.addType(f);let{files:p,singleExplicitFile:g}=await J(t,i,n,u,m);if(p.length===0)return{stdout:"",stderr:"",exitCode:1};let w=!n.noFilename&&(n.withFilename||!g||p.length>1),d=n.lineNumber;return r||(g&&p.length===1&&(d=!1),n.onlyMatching&&(d=!1)),me(t,p,c,n,w,d,a)}function ue(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function he(e,t,n){let s;return e.length===1?s=e[0]:s=e.map(r=>t.fixedStrings?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${r})`).join("|"),A(s,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function J(e,t,n,s,r){let l=[],i=0,o=0;for(let a of t){let u=e.fs.resolvePath(e.cwd,a);try{let m=await e.fs.stat(u);if(m.isFile){if(i++,n.maxFilesize>0&&m.size>n.maxFilesize)continue;K(a,n,s,u,r)&&l.push(a)}else m.isDirectory&&(o++,await Y(e,a,u,0,n,s,r,l))}catch{}}return{files:n.sort==="path"?l.sort():l,singleExplicitFile:i===1&&o===0}}async function Y(e,t,n,s,r,l,i,o){if(!(s>=r.maxDepth)){l&&await l.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(a=>({name:a,isFile:void 0}));for(let a of c){let u=a.name;if(!r.noIgnore&&k.isCommonIgnored(u))continue;let m=u.startsWith("."),p=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,g=e.fs.resolvePath(n,u),w,d,f=!1;if(a.isFile!==void 0&&"isDirectory"in a){let h=a;if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;if(f&&r.followSymlinks)try{let y=await e.fs.stat(g);w=y.isFile,d=y.isDirectory}catch{continue}else w=h.isFile,d=h.isDirectory}else try{let h=e.fs.lstat?await e.fs.lstat(g):await e.fs.stat(g);if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;let y=f&&r.followSymlinks?await e.fs.stat(g):h;w=y.isFile,d=y.isDirectory}catch{continue}if(!l?.matches(g,d)&&!(m&&!r.hidden&&!l?.isWhitelisted(g,d))){if(d)await Y(e,p,g,s+1,r,l,i,o);else if(w){if(r.maxFilesize>0)try{if((await e.fs.stat(g)).size>r.maxFilesize)continue}catch{continue}K(p,r,l,g,i)&&o.push(p)}}}}catch{}}}function K(e,t,n,s,r){let l=e.split("/").pop()||e;if(n?.matches(s,!1)||t.types.length>0&&!r.matchesType(l,t.types)||t.typesNot.length>0&&r.matchesType(l,t.typesNot))return!1;if(t.globs.length>0){let i=t.globCaseInsensitive,o=t.globs.filter(a=>!a.startsWith("!")),c=t.globs.filter(a=>a.startsWith("!")).map(a=>a.slice(1));if(o.length>0){let a=!1;for(let u of o)if(v(l,u,i)||v(e,u,i)){a=!0;break}if(!a)return!1}for(let a of c)if(a.startsWith("/")){let u=a.slice(1);if(v(e,u,i))return!1}else if(v(l,a,i)||v(e,a,i))return!1}if(t.iglobs.length>0){let i=t.iglobs.filter(c=>!c.startsWith("!")),o=t.iglobs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(i.length>0){let c=!1;for(let a of i)if(v(l,a,!0)||v(e,a,!0)){c=!0;break}if(!c)return!1}for(let c of o)if(c.startsWith("/")){let a=c.slice(1);if(v(e,a,!0))return!1}else if(v(l,c,!0)||v(e,c,!0))return!1}return!0}function v(e,t,n=!1){let s="^";for(let r=0;r<t.length;r++){let l=t[r];if(l==="*")t[r+1]==="*"?(s+=".*",r++):s+="[^/]*";else if(l==="?")s+="[^/]";else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let o=t.slice(r,i+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),s+=o,r=i}else s+="\\["}else s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return s+="$",new RegExp(s,n?"i":"").test(e)}async function ge(e,t,n){let s=null;n.noIgnore||(s=await P(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let r=new $;for(let a of n.typeClear)r.clearType(a);for(let a of n.typeAdd)r.addType(a);let l=t.length===0?["."]:t,{files:i}=await J(e,l,n,s,r);if(i.length===0)return{stdout:"",stderr:"",exitCode:1};if(n.quiet)return{stdout:"",stderr:"",exitCode:0};let o=n.nullSeparator?"\0":`
|
|
13
|
+
`;return{stdout:i.map(a=>a+o).join(""),stderr:"",exitCode:0}}function pe(e,t){if(t.length===0)return!0;for(let n of t)if(v(e,n,!1))return!0;return!1}async function de(e,t,n,s){try{if(s.preprocessor&&e.exec){let i=n.split("/").pop()||n;if(pe(i,s.preprocessorGlobs)){let o=await e.exec(`${s.preprocessor} "${t}"`,{cwd:e.cwd});if(o.exitCode===0&&o.stdout){let c=o.stdout.slice(0,8192);return{content:o.stdout,isBinary:c.includes("\0")}}}}if(s.searchZip&&n.endsWith(".gz")){let i=await e.fs.readFileBuffer(t);if(ce(i))try{let o=ae(i),c=new TextDecoder().decode(o),a=c.slice(0,8192);return{content:c,isBinary:a.includes("\0")}}catch{return null}}let r=await e.fs.readFile(t),l=r.slice(0,8192);return{content:r,isBinary:l.includes("\0")}}catch{return null}}async function me(e,t,n,s,r,l,i){let o="",c=!1,a=[],u=0,m=0,p=0,g=50;e:for(let f=0;f<t.length;f+=g){let x=t.slice(f,f+g),b=await Promise.all(x.map(async h=>{let y=e.fs.resolvePath(e.cwd,h),F=await de(e,y,h,s);if(!F)return null;let{content:C,isBinary:T}=F;if(p+=C.length,T&&!s.searchBinary)return null;let W=r&&!s.heading?h:"",S=E(C,n,{invertMatch:s.invertMatch,showLineNumbers:l,countOnly:s.count,countMatches:s.countMatches,filename:W,onlyMatching:s.onlyMatching,beforeContext:s.beforeContext,afterContext:s.afterContext,maxCount:s.maxCount,contextSeparator:s.contextSeparator,showColumn:s.column,vimgrep:s.vimgrep,showByteOffset:s.byteOffset,replace:s.replace!==null?z(s.replace):null,passthru:s.passthru,multiline:s.multiline,kResetGroup:i});return s.json&&S.matched?{file:h,result:S,content:C,isBinary:!1}:{file:h,result:S}}));for(let h of b){if(!h)continue;let{file:y,result:F}=h;if(F.matched){if(c=!0,m++,u+=F.matchCount,s.quiet&&!s.json)break e;if(s.json&&!s.quiet){let C=h.content||"";a.push(JSON.stringify({type:"begin",data:{path:{text:y}}}));let T=C.split(`
|
|
14
|
+
`);n.lastIndex=0;let W=0;for(let S=0;S<T.length;S++){let N=T[S];n.lastIndex=0;let O=[];for(let I=n.exec(N);I!==null;I=n.exec(N)){let R={match:{text:I[0]},start:I.index,end:I.index+I[0].length};s.replace!==null&&(R.replacement={text:s.replace}),O.push(R),I[0].length===0&&n.lastIndex++}if(O.length>0){let I={type:"match",data:{path:{text:y},lines:{text:`${N}
|
|
15
|
+
`},line_number:S+1,absolute_offset:W,submatches:O}};a.push(JSON.stringify(I))}W+=N.length+1}a.push(JSON.stringify({type:"end",data:{path:{text:y},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:C.length,bytes_printed:0,matched_lines:F.matchCount,matches:F.matchCount}}}))}else if(s.filesWithMatches){let C=s.nullSeparator?"\0":`
|
|
16
|
+
`;o+=`${y}${C}`}else s.filesWithoutMatch||(s.heading&&!s.noFilename&&(o+=`${y}
|
|
17
|
+
`),o+=F.output)}else if(s.filesWithoutMatch){let C=s.nullSeparator?"\0":`
|
|
18
|
+
`;o+=`${y}${C}`}else s.includeZero&&(s.count||s.countMatches)&&(o+=F.output)}}s.json&&(a.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:m,bytes_searched:p,bytes_printed:0,matched_lines:u,matches:u}}})),o=`${a.join(`
|
|
19
|
+
`)}
|
|
20
|
+
`);let w=s.quiet&&!s.json?"":o;if(s.stats&&!s.json){let f=["",`${u} matches`,`${u} matched lines`,`${m} files contained matches`,`${t.length} files searched`,`${p} bytes searched`].join(`
|
|
21
|
+
`);w+=`${f}
|
|
22
|
+
`}let d;return s.filesWithoutMatch?d=o.length>0?0:1:d=c?0:1,{stdout:w,stderr:"",exitCode:d}}var xe={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern.
|
|
23
|
+
Unlike grep, rg is recursive by default and respects .gitignore files.
|
|
24
|
+
|
|
25
|
+
EXAMPLES:
|
|
26
|
+
rg foo Search for 'foo' in current directory
|
|
27
|
+
rg foo src/ Search in src/ directory
|
|
28
|
+
rg -i foo Case-insensitive search
|
|
29
|
+
rg -w foo Match whole words only
|
|
30
|
+
rg -t js foo Search only JavaScript files
|
|
31
|
+
rg -g '*.ts' foo Search files matching glob
|
|
32
|
+
rg --hidden foo Include hidden files
|
|
33
|
+
rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},De={name:"rg",async execute(e,t){if(_(e))return L(xe);if(e.includes("--type-list"))return{stdout:G(),stderr:"",exitCode:0};let n=Z(e);return n.success?H({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}};export{De as rgCommand};
|
package/dist/bin/just-bash.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as z,b as K,c as U,d as Y,e as X,f as k,g as W,h as me,i as B,j as ie,k as Ue}from"./chunks/chunk-NWWB2XRE.js";import"./chunks/chunk-OBH7XN5N.js";import{a as se}from"./chunks/chunk-4VDEBYW7.js";import"./chunks/chunk-KGOUQS5A.js";import{resolve as Mn}from"node:path";var ge=[{name:"echo",load:async()=>(await import("./chunks/echo-WSKTON6U.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-AJXZOSPN.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-HWUQKYUM.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-BEHQBUMC.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-XJABRAUN.js")).mkdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-TSNAXMZ2.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-2PKAWTSQ.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-XXWRVG2D.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-3ATZ2ABL.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-EFFNQ3RY.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-3DIKREF7.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-53KG2MCJ.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-VL3R4LAM.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-DYK37Z24.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-BES27CZT.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-QSBRKIF5.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-UEQ7KMY5.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-QCXXYC54.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-QCXXYC54.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-QCXXYC54.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-GVIT6FTE.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-5LQMJYRJ.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-D2US2LMM.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-KUHOCH5S.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-IXHB2FVS.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-CPIFQTKY.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-IHF6BEOO.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-FT6WBQZG.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-MBLEXZBI.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-VP42N2JN.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-DSM3NUGM.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-452R4I2C.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-77K5HH2M.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-BFVYAPOU.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-ZEKN6D4Q.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-JJFZRWRC.js")).split},{name:"column",load:async()=>(await import("./chunks/column-TSFEMTG6.js")).column},{name:"join",load:async()=>(await import("./chunks/join-3IXMEGNA.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-ZFIT2GTM.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-CBEJ35BR.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-SO5MVUEX.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-EES7TR26.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-DQBEJH47.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-XQPYLN3H.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-YLLSNZZN.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-YLLSNZZN.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-PCMLRCRW.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-PCMLRCRW.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-G5C2J2OY.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-IWT2HHEA.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-OVATH2SQ.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-OVATH2SQ.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-CI7A5IXQ.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-UT3MT5UU.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-UT3MT5UU.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-XXZPU5CA.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-O7TCK5TL.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-GI3QVUGD.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-IQLPMFYI.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-O5BOTJGJ.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-JED4EKFH.js")).timeoutCommand},{name:"seq",load:async()=>(await import("./chunks/seq-AVK43XM2.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-RMGXYNQJ.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-2VAAFCTS.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-67P4ME4N.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-MV3WQ4QF.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-XMPFXMUJ.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-EPEXKI4B.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-7C5JICNL.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-73KOOLC6.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-KNRFDAY7.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-WXDKRL2Z.js")).hostname},{name:"od",load:async()=>(await import("./chunks/od-SLM7SRWU.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-YXK3WZQL.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-YXK3WZQL.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-YXK3WZQL.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(ge.push({name:"tar",load:async()=>(await import("./chunks/tar-C27YYUAS.js")).tarCommand}),ge.push({name:"yq",load:async()=>(await import("./chunks/yq-MF2SNFGL.js")).yqCommand}),ge.push({name:"xan",load:async()=>(await import("./chunks/xan-6K2NGTHM.js")).xanCommand}),ge.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-THMDBIGF.js")).sqlite3Command}));var zn=[{name:"curl",load:async()=>(await import("./chunks/curl-LCMREE7R.js")).curlCommand}],hr=new Map;function mr(t){return{name:t.name,async execute(e,n){let r=hr.get(t.name);return r||(r=await t.load(),hr.set(t.name,r)),r.execute(e,n)}}}function pr(t){return(t?ge.filter(n=>t.includes(n.name)):ge).map(mr)}function yr(){return zn.map(mr)}function wr(t){return"load"in t&&typeof t.load=="function"}function Er(t){let e=null;return{name:t.name,async execute(n,r){return e||(e=await t.load()),e.execute(n,r)}}}var Un=new TextEncoder,jn=new TextDecoder;function Ae(t,e){if(t instanceof Uint8Array)return t;if(e==="base64")return Uint8Array.from(atob(t),n=>n.charCodeAt(0));if(e==="hex"){let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=parseInt(t.slice(r,r+2),16);return n}return e==="binary"||e==="latin1"?Uint8Array.from(t,n=>n.charCodeAt(0)):Un.encode(t)}function je(t,e){return e==="base64"?btoa(String.fromCharCode(...t)):e==="hex"?Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join(""):e==="binary"||e==="latin1"?String.fromCharCode(...t):jn.decode(t)}function oe(t){if(t!=null)return typeof t=="string"?t:t.encoding??void 0}var Ge=new TextEncoder;function Gn(t){return typeof t=="object"&&t!==null&&!(t instanceof Uint8Array)&&"content"in t}var ke=class{data=new Map;constructor(e){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),e)for(let[n,r]of Object.entries(e))Gn(r)?this.writeFileSync(n,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(n,r)}normalizePath(e){if(!e||e==="/")return"/";let n=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;n.startsWith("/")||(n=`/${n}`);let r=n.split("/").filter(o=>o&&o!=="."),s=[];for(let o of r)o===".."?s.pop():s.push(o);return`/${s.join("/")}`||"/"}dirname(e){let n=this.normalizePath(e);if(n==="/")return"/";let r=n.lastIndexOf("/");return r===0?"/":n.slice(0,r)}ensureParentDirs(e){let n=this.dirname(e);n!=="/"&&(this.data.has(n)||(this.ensureParentDirs(n),this.data.set(n,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(e,n,r,s){let o=this.normalizePath(e);this.ensureParentDirs(o);let i=oe(r),a=Ae(n,i);this.data.set(o,{type:"file",content:a,mode:s?.mode??420,mtime:s?.mtime??new Date})}async readFile(e,n){let r=await this.readFileBuffer(e),s=oe(n);return je(r,s)}async readFileBuffer(e){let n=this.resolvePathWithSymlinks(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, open '${e}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${e}'`);return r.content instanceof Uint8Array?r.content:Ge.encode(r.content)}async writeFile(e,n,r){this.writeFileSync(e,n,r)}async appendFile(e,n,r){let s=this.normalizePath(e),o=this.data.get(s);if(o&&o.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${e}'`);let i=oe(r),a=Ae(n,i);if(o?.type==="file"){let l=o.content instanceof Uint8Array?o.content:Ge.encode(o.content),c=new Uint8Array(l.length+a.length);c.set(l),c.set(a,l.length),this.data.set(s,{type:"file",content:c,mode:o.mode,mtime:new Date})}else this.writeFileSync(e,n,r)}async exists(e){try{let n=this.resolvePathWithSymlinks(e);return this.data.has(n)}catch{return!1}}async stat(e){let n=this.resolvePathWithSymlinks(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${e}'`);let s=0;return r.type==="file"&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Ge.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}async lstat(e){let n=this.resolveIntermediateSymlinks(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};let s=0;return r.type==="file"&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Ge.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}resolveSymlink(e,n){if(n.startsWith("/"))return this.normalizePath(n);let r=this.dirname(e);return this.normalizePath(r==="/"?`/${n}`:`${r}/${n}`)}resolveIntermediateSymlinks(e){let n=this.normalizePath(e);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",o=new Set;for(let i=0;i<r.length-1;i++){let a=r[i];s=`${s}/${a}`;let l=this.data.get(s),c=0,f=40;for(;l&&l.type==="symlink"&&c<f;){if(o.has(s))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`);o.add(s),s=this.resolveSymlink(s,l.target),l=this.data.get(s),c++}if(c>=f)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`)}return`${s}/${r[r.length-1]}`}resolvePathWithSymlinks(e){let n=this.normalizePath(e);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",o=new Set;for(let i of r){s=`${s}/${i}`;let a=this.data.get(s),l=0,c=40;for(;a&&a.type==="symlink"&&l<c;){if(o.has(s))throw new Error(`ELOOP: too many levels of symbolic links, open '${e}'`);o.add(s),s=this.resolveSymlink(s,a.target),a=this.data.get(s),l++}if(l>=c)throw new Error(`ELOOP: too many levels of symbolic links, open '${e}'`)}return s}async mkdir(e,n){this.mkdirSync(e,n)}mkdirSync(e,n){let r=this.normalizePath(e);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${e}'`);if(!n?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${e}'`);return}let s=this.dirname(r);if(s!=="/"&&!this.data.has(s))if(n?.recursive)this.mkdirSync(s,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(e){return(await this.readdirWithFileTypes(e)).map(r=>r.name)}async readdirWithFileTypes(e){let n=this.normalizePath(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${e}'`);let s=new Set;for(;r&&r.type==="symlink";){if(s.has(n))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${e}'`);s.add(n),n=this.resolveSymlink(n,r.target),r=this.data.get(n)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${e}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${e}'`);let o=n==="/"?"/":`${n}/`,i=new Map;for(let[a,l]of this.data.entries())if(a!==n&&a.startsWith(o)){let c=a.slice(o.length),f=c.split("/")[0];f&&!c.includes("/",f.length)&&!i.has(f)&&i.set(f,{name:f,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(i.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(e,n){let r=this.normalizePath(e),s=this.data.get(r);if(!s){if(n?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${e}'`)}if(s.type==="directory"){let o=await this.readdir(r);if(o.length>0){if(!n?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${e}'`);for(let i of o){let a=r==="/"?`/${i}`:`${r}/${i}`;await this.rm(a,n)}}}this.data.delete(r)}async cp(e,n,r){let s=this.normalizePath(e),o=this.normalizePath(n),i=this.data.get(s);if(!i)throw new Error(`ENOENT: no such file or directory, cp '${e}'`);if(i.type==="file")this.ensureParentDirs(o),this.data.set(o,{...i});else if(i.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${e}'`);await this.mkdir(o,{recursive:!0});let a=await this.readdir(s);for(let l of a){let c=s==="/"?`/${l}`:`${s}/${l}`,f=o==="/"?`/${l}`:`${o}/${l}`;await this.cp(c,f,r)}}}async mv(e,n){await this.cp(e,n,{recursive:!0}),await this.rm(e,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(e,n){if(n.startsWith("/"))return this.normalizePath(n);let r=e==="/"?`/${n}`:`${e}/${n}`;return this.normalizePath(r)}async chmod(e,n){let r=this.normalizePath(e),s=this.data.get(r);if(!s)throw new Error(`ENOENT: no such file or directory, chmod '${e}'`);s.mode=n}async symlink(e,n){let r=this.normalizePath(n);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:e,mode:511,mtime:new Date})}async link(e,n){let r=this.normalizePath(e),s=this.normalizePath(n),o=this.data.get(r);if(!o)throw new Error(`ENOENT: no such file or directory, link '${e}'`);if(o.type!=="file")throw new Error(`EPERM: operation not permitted, link '${e}'`);if(this.data.has(s))throw new Error(`EEXIST: file already exists, link '${n}'`);this.ensureParentDirs(s),this.data.set(s,{type:"file",content:o.content,mode:o.mode,mtime:o.mtime})}async readlink(e){let n=this.normalizePath(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${e}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${e}'`);return r.target}};var gr="5.1.0(1)-release",Ar="Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT";function Re(){return{pid:process.pid,ppid:process.ppid,uid:process.getuid?.()??1e3,gid:process.getgid?.()??1e3}}function Sr(){let{pid:t,ppid:e,uid:n,gid:r}=Re();return`Name: bash
|
|
2
|
+
import{a as z,b as K,c as U,d as Y,e as X,f as k,g as W,h as me,i as B,j as ie,k as Ue}from"./chunks/chunk-NWWB2XRE.js";import"./chunks/chunk-OBH7XN5N.js";import{a as se}from"./chunks/chunk-4VDEBYW7.js";import"./chunks/chunk-KGOUQS5A.js";import{resolve as Mn}from"node:path";var ge=[{name:"echo",load:async()=>(await import("./chunks/echo-WSKTON6U.js")).echoCommand},{name:"cat",load:async()=>(await import("./chunks/cat-AJXZOSPN.js")).catCommand},{name:"printf",load:async()=>(await import("./chunks/printf-HWUQKYUM.js")).printfCommand},{name:"ls",load:async()=>(await import("./chunks/ls-BEHQBUMC.js")).lsCommand},{name:"mkdir",load:async()=>(await import("./chunks/mkdir-XJABRAUN.js")).mkdirCommand},{name:"touch",load:async()=>(await import("./chunks/touch-TSNAXMZ2.js")).touchCommand},{name:"rm",load:async()=>(await import("./chunks/rm-2PKAWTSQ.js")).rmCommand},{name:"cp",load:async()=>(await import("./chunks/cp-XXWRVG2D.js")).cpCommand},{name:"mv",load:async()=>(await import("./chunks/mv-3ATZ2ABL.js")).mvCommand},{name:"ln",load:async()=>(await import("./chunks/ln-EFFNQ3RY.js")).lnCommand},{name:"chmod",load:async()=>(await import("./chunks/chmod-3DIKREF7.js")).chmodCommand},{name:"pwd",load:async()=>(await import("./chunks/pwd-53KG2MCJ.js")).pwdCommand},{name:"readlink",load:async()=>(await import("./chunks/readlink-VL3R4LAM.js")).readlinkCommand},{name:"head",load:async()=>(await import("./chunks/head-DYK37Z24.js")).headCommand},{name:"tail",load:async()=>(await import("./chunks/tail-BES27CZT.js")).tailCommand},{name:"wc",load:async()=>(await import("./chunks/wc-QSBRKIF5.js")).wcCommand},{name:"stat",load:async()=>(await import("./chunks/stat-UEQ7KMY5.js")).statCommand},{name:"grep",load:async()=>(await import("./chunks/grep-IIVQXFNI.js")).grepCommand},{name:"fgrep",load:async()=>(await import("./chunks/grep-IIVQXFNI.js")).fgrepCommand},{name:"egrep",load:async()=>(await import("./chunks/grep-IIVQXFNI.js")).egrepCommand},{name:"rg",load:async()=>(await import("./chunks/rg-Q4OTJOEF.js")).rgCommand},{name:"sed",load:async()=>(await import("./chunks/sed-5LQMJYRJ.js")).sedCommand},{name:"awk",load:async()=>(await import("./chunks/awk2-D2US2LMM.js")).awkCommand2},{name:"sort",load:async()=>(await import("./chunks/sort-KUHOCH5S.js")).sortCommand},{name:"uniq",load:async()=>(await import("./chunks/uniq-IXHB2FVS.js")).uniqCommand},{name:"comm",load:async()=>(await import("./chunks/comm-CPIFQTKY.js")).commCommand},{name:"cut",load:async()=>(await import("./chunks/cut-IHF6BEOO.js")).cutCommand},{name:"paste",load:async()=>(await import("./chunks/paste-FT6WBQZG.js")).pasteCommand},{name:"tr",load:async()=>(await import("./chunks/tr-MBLEXZBI.js")).trCommand},{name:"rev",load:async()=>(await import("./chunks/rev-VP42N2JN.js")).rev},{name:"nl",load:async()=>(await import("./chunks/nl-DSM3NUGM.js")).nl},{name:"fold",load:async()=>(await import("./chunks/fold-452R4I2C.js")).fold},{name:"expand",load:async()=>(await import("./chunks/expand-77K5HH2M.js")).expand},{name:"unexpand",load:async()=>(await import("./chunks/unexpand-BFVYAPOU.js")).unexpand},{name:"strings",load:async()=>(await import("./chunks/strings-ZEKN6D4Q.js")).strings},{name:"split",load:async()=>(await import("./chunks/split-JJFZRWRC.js")).split},{name:"column",load:async()=>(await import("./chunks/column-TSFEMTG6.js")).column},{name:"join",load:async()=>(await import("./chunks/join-3IXMEGNA.js")).join},{name:"tee",load:async()=>(await import("./chunks/tee-ZFIT2GTM.js")).teeCommand},{name:"find",load:async()=>(await import("./chunks/find-CBEJ35BR.js")).findCommand},{name:"basename",load:async()=>(await import("./chunks/basename-SO5MVUEX.js")).basenameCommand},{name:"dirname",load:async()=>(await import("./chunks/dirname-EES7TR26.js")).dirnameCommand},{name:"tree",load:async()=>(await import("./chunks/tree-DQBEJH47.js")).treeCommand},{name:"du",load:async()=>(await import("./chunks/du-XQPYLN3H.js")).duCommand},{name:"env",load:async()=>(await import("./chunks/env-YLLSNZZN.js")).envCommand},{name:"printenv",load:async()=>(await import("./chunks/env-YLLSNZZN.js")).printenvCommand},{name:"alias",load:async()=>(await import("./chunks/alias-PCMLRCRW.js")).aliasCommand},{name:"unalias",load:async()=>(await import("./chunks/alias-PCMLRCRW.js")).unaliasCommand},{name:"history",load:async()=>(await import("./chunks/history-G5C2J2OY.js")).historyCommand},{name:"xargs",load:async()=>(await import("./chunks/xargs-IWT2HHEA.js")).xargsCommand},{name:"true",load:async()=>(await import("./chunks/true-OVATH2SQ.js")).trueCommand},{name:"false",load:async()=>(await import("./chunks/true-OVATH2SQ.js")).falseCommand},{name:"clear",load:async()=>(await import("./chunks/clear-CI7A5IXQ.js")).clearCommand},{name:"bash",load:async()=>(await import("./chunks/bash-UT3MT5UU.js")).bashCommand},{name:"sh",load:async()=>(await import("./chunks/bash-UT3MT5UU.js")).shCommand},{name:"jq",load:async()=>(await import("./chunks/jq-XXZPU5CA.js")).jqCommand},{name:"base64",load:async()=>(await import("./chunks/base64-O7TCK5TL.js")).base64Command},{name:"diff",load:async()=>(await import("./chunks/diff-GI3QVUGD.js")).diffCommand},{name:"date",load:async()=>(await import("./chunks/date-IQLPMFYI.js")).dateCommand},{name:"sleep",load:async()=>(await import("./chunks/sleep-O5BOTJGJ.js")).sleepCommand},{name:"timeout",load:async()=>(await import("./chunks/timeout-JED4EKFH.js")).timeoutCommand},{name:"seq",load:async()=>(await import("./chunks/seq-AVK43XM2.js")).seqCommand},{name:"expr",load:async()=>(await import("./chunks/expr-RMGXYNQJ.js")).exprCommand},{name:"md5sum",load:async()=>(await import("./chunks/md5sum-2VAAFCTS.js")).md5sumCommand},{name:"sha1sum",load:async()=>(await import("./chunks/sha1sum-67P4ME4N.js")).sha1sumCommand},{name:"sha256sum",load:async()=>(await import("./chunks/sha256sum-MV3WQ4QF.js")).sha256sumCommand},{name:"file",load:async()=>(await import("./chunks/file-LNCFDPQZ.js")).fileCommand},{name:"html-to-markdown",load:async()=>(await import("./chunks/html-to-markdown-EPEXKI4B.js")).htmlToMarkdownCommand},{name:"help",load:async()=>(await import("./chunks/help-7C5JICNL.js")).helpCommand},{name:"which",load:async()=>(await import("./chunks/which-73KOOLC6.js")).whichCommand},{name:"tac",load:async()=>(await import("./chunks/tac-KNRFDAY7.js")).tac},{name:"hostname",load:async()=>(await import("./chunks/hostname-WXDKRL2Z.js")).hostname},{name:"od",load:async()=>(await import("./chunks/od-SLM7SRWU.js")).od},{name:"gzip",load:async()=>(await import("./chunks/gzip-YXK3WZQL.js")).gzipCommand},{name:"gunzip",load:async()=>(await import("./chunks/gzip-YXK3WZQL.js")).gunzipCommand},{name:"zcat",load:async()=>(await import("./chunks/gzip-YXK3WZQL.js")).zcatCommand}];(typeof __BROWSER__>"u"||!__BROWSER__)&&(ge.push({name:"tar",load:async()=>(await import("./chunks/tar-C27YYUAS.js")).tarCommand}),ge.push({name:"yq",load:async()=>(await import("./chunks/yq-MF2SNFGL.js")).yqCommand}),ge.push({name:"xan",load:async()=>(await import("./chunks/xan-6K2NGTHM.js")).xanCommand}),ge.push({name:"sqlite3",load:async()=>(await import("./chunks/sqlite3-THMDBIGF.js")).sqlite3Command}));var zn=[{name:"curl",load:async()=>(await import("./chunks/curl-LCMREE7R.js")).curlCommand}],hr=new Map;function mr(t){return{name:t.name,async execute(e,n){let r=hr.get(t.name);return r||(r=await t.load(),hr.set(t.name,r)),r.execute(e,n)}}}function pr(t){return(t?ge.filter(n=>t.includes(n.name)):ge).map(mr)}function yr(){return zn.map(mr)}function wr(t){return"load"in t&&typeof t.load=="function"}function Er(t){let e=null;return{name:t.name,async execute(n,r){return e||(e=await t.load()),e.execute(n,r)}}}var Un=new TextEncoder,jn=new TextDecoder;function Ae(t,e){if(t instanceof Uint8Array)return t;if(e==="base64")return Uint8Array.from(atob(t),n=>n.charCodeAt(0));if(e==="hex"){let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=parseInt(t.slice(r,r+2),16);return n}return e==="binary"||e==="latin1"?Uint8Array.from(t,n=>n.charCodeAt(0)):Un.encode(t)}function je(t,e){return e==="base64"?btoa(String.fromCharCode(...t)):e==="hex"?Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join(""):e==="binary"||e==="latin1"?String.fromCharCode(...t):jn.decode(t)}function oe(t){if(t!=null)return typeof t=="string"?t:t.encoding??void 0}var Ge=new TextEncoder;function Gn(t){return typeof t=="object"&&t!==null&&!(t instanceof Uint8Array)&&"content"in t}var ke=class{data=new Map;constructor(e){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),e)for(let[n,r]of Object.entries(e))Gn(r)?this.writeFileSync(n,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(n,r)}normalizePath(e){if(!e||e==="/")return"/";let n=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;n.startsWith("/")||(n=`/${n}`);let r=n.split("/").filter(o=>o&&o!=="."),s=[];for(let o of r)o===".."?s.pop():s.push(o);return`/${s.join("/")}`||"/"}dirname(e){let n=this.normalizePath(e);if(n==="/")return"/";let r=n.lastIndexOf("/");return r===0?"/":n.slice(0,r)}ensureParentDirs(e){let n=this.dirname(e);n!=="/"&&(this.data.has(n)||(this.ensureParentDirs(n),this.data.set(n,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(e,n,r,s){let o=this.normalizePath(e);this.ensureParentDirs(o);let i=oe(r),a=Ae(n,i);this.data.set(o,{type:"file",content:a,mode:s?.mode??420,mtime:s?.mtime??new Date})}async readFile(e,n){let r=await this.readFileBuffer(e),s=oe(n);return je(r,s)}async readFileBuffer(e){let n=this.resolvePathWithSymlinks(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, open '${e}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${e}'`);return r.content instanceof Uint8Array?r.content:Ge.encode(r.content)}async writeFile(e,n,r){this.writeFileSync(e,n,r)}async appendFile(e,n,r){let s=this.normalizePath(e),o=this.data.get(s);if(o&&o.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${e}'`);let i=oe(r),a=Ae(n,i);if(o?.type==="file"){let l=o.content instanceof Uint8Array?o.content:Ge.encode(o.content),c=new Uint8Array(l.length+a.length);c.set(l),c.set(a,l.length),this.data.set(s,{type:"file",content:c,mode:o.mode,mtime:new Date})}else this.writeFileSync(e,n,r)}async exists(e){try{let n=this.resolvePathWithSymlinks(e);return this.data.has(n)}catch{return!1}}async stat(e){let n=this.resolvePathWithSymlinks(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${e}'`);let s=0;return r.type==="file"&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Ge.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}async lstat(e){let n=this.resolveIntermediateSymlinks(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};let s=0;return r.type==="file"&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Ge.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}resolveSymlink(e,n){if(n.startsWith("/"))return this.normalizePath(n);let r=this.dirname(e);return this.normalizePath(r==="/"?`/${n}`:`${r}/${n}`)}resolveIntermediateSymlinks(e){let n=this.normalizePath(e);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",o=new Set;for(let i=0;i<r.length-1;i++){let a=r[i];s=`${s}/${a}`;let l=this.data.get(s),c=0,f=40;for(;l&&l.type==="symlink"&&c<f;){if(o.has(s))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`);o.add(s),s=this.resolveSymlink(s,l.target),l=this.data.get(s),c++}if(c>=f)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`)}return`${s}/${r[r.length-1]}`}resolvePathWithSymlinks(e){let n=this.normalizePath(e);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",o=new Set;for(let i of r){s=`${s}/${i}`;let a=this.data.get(s),l=0,c=40;for(;a&&a.type==="symlink"&&l<c;){if(o.has(s))throw new Error(`ELOOP: too many levels of symbolic links, open '${e}'`);o.add(s),s=this.resolveSymlink(s,a.target),a=this.data.get(s),l++}if(l>=c)throw new Error(`ELOOP: too many levels of symbolic links, open '${e}'`)}return s}async mkdir(e,n){this.mkdirSync(e,n)}mkdirSync(e,n){let r=this.normalizePath(e);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${e}'`);if(!n?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${e}'`);return}let s=this.dirname(r);if(s!=="/"&&!this.data.has(s))if(n?.recursive)this.mkdirSync(s,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(e){return(await this.readdirWithFileTypes(e)).map(r=>r.name)}async readdirWithFileTypes(e){let n=this.normalizePath(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${e}'`);let s=new Set;for(;r&&r.type==="symlink";){if(s.has(n))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${e}'`);s.add(n),n=this.resolveSymlink(n,r.target),r=this.data.get(n)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${e}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${e}'`);let o=n==="/"?"/":`${n}/`,i=new Map;for(let[a,l]of this.data.entries())if(a!==n&&a.startsWith(o)){let c=a.slice(o.length),f=c.split("/")[0];f&&!c.includes("/",f.length)&&!i.has(f)&&i.set(f,{name:f,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(i.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(e,n){let r=this.normalizePath(e),s=this.data.get(r);if(!s){if(n?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${e}'`)}if(s.type==="directory"){let o=await this.readdir(r);if(o.length>0){if(!n?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${e}'`);for(let i of o){let a=r==="/"?`/${i}`:`${r}/${i}`;await this.rm(a,n)}}}this.data.delete(r)}async cp(e,n,r){let s=this.normalizePath(e),o=this.normalizePath(n),i=this.data.get(s);if(!i)throw new Error(`ENOENT: no such file or directory, cp '${e}'`);if(i.type==="file")this.ensureParentDirs(o),this.data.set(o,{...i});else if(i.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${e}'`);await this.mkdir(o,{recursive:!0});let a=await this.readdir(s);for(let l of a){let c=s==="/"?`/${l}`:`${s}/${l}`,f=o==="/"?`/${l}`:`${o}/${l}`;await this.cp(c,f,r)}}}async mv(e,n){await this.cp(e,n,{recursive:!0}),await this.rm(e,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(e,n){if(n.startsWith("/"))return this.normalizePath(n);let r=e==="/"?`/${n}`:`${e}/${n}`;return this.normalizePath(r)}async chmod(e,n){let r=this.normalizePath(e),s=this.data.get(r);if(!s)throw new Error(`ENOENT: no such file or directory, chmod '${e}'`);s.mode=n}async symlink(e,n){let r=this.normalizePath(n);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:e,mode:511,mtime:new Date})}async link(e,n){let r=this.normalizePath(e),s=this.normalizePath(n),o=this.data.get(r);if(!o)throw new Error(`ENOENT: no such file or directory, link '${e}'`);if(o.type!=="file")throw new Error(`EPERM: operation not permitted, link '${e}'`);if(this.data.has(s))throw new Error(`EEXIST: file already exists, link '${n}'`);this.ensureParentDirs(s),this.data.set(s,{type:"file",content:o.content,mode:o.mode,mtime:o.mtime})}async readlink(e){let n=this.normalizePath(e),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${e}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${e}'`);return r.target}};var gr="5.1.0(1)-release",Ar="Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT";function Re(){return{pid:process.pid,ppid:process.ppid,uid:process.getuid?.()??1e3,gid:process.getgid?.()??1e3}}function Sr(){let{pid:t,ppid:e,uid:n,gid:r}=Re();return`Name: bash
|
|
3
3
|
State: R (running)
|
|
4
4
|
Pid: ${t}
|
|
5
5
|
PPid: ${e}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
function _(t,n){return t.replace(/\$(&|\d+|<([^>]+)>)/g,(e,i,s)=>{if(i==="&")return n[0];if(s!==void 0)return n.groups?.[s]??"";let d=parseInt(i,10);return n[d]??""})}function F(t,n,e={}){let{invertMatch:i=!1,showLineNumbers:s=!1,countOnly:d=!1,countMatches:$=!1,filename:h="",onlyMatching:I=!1,beforeContext:z=0,afterContext:O=0,maxCount:A=0,contextSeparator:Z="--",showColumn:P=!1,vimgrep:E=!1,showByteOffset:S=!1,replace:b=null,passthru:R=!1,multiline:T=!1,kResetGroup:k}=e;if(T)return K(t,n,{invertMatch:i,showLineNumbers:s,countOnly:d,countMatches:$,filename:h,onlyMatching:I,beforeContext:z,afterContext:O,maxCount:A,contextSeparator:Z,showColumn:P,showByteOffset:S,replace:b,kResetGroup:k});let m=t.split(`
|
|
3
|
+
`),j=m.length,v=j>0&&m[j-1]===""?j-1:j;if(d||$){let f=0,a=($||I)&&!i;for(let l=0;l<v;l++)if(n.lastIndex=0,a)for(let u=n.exec(m[l]);u!==null;u=n.exec(m[l]))f++,u[0].length===0&&n.lastIndex++;else n.test(m[l])!==i&&f++;return{output:`${h?`${h}:${f}`:String(f)}
|
|
4
|
+
`,matched:f>0,matchCount:f}}if(z===0&&O===0&&!R){let f=[],a=!1,o=0,l=0;for(let u=0;u<v&&!(A>0&&o>=A);u++){let L=m[u];if(n.lastIndex=0,n.test(L)!==i)if(a=!0,o++,I){n.lastIndex=0;for(let r=n.exec(L);r!==null;r=n.exec(L)){let M=k!==void 0?r[k]??"":r[0],N=b!==null?_(b,r):M,y=h?`${h}:`:"";S&&(y+=`${l+r.index}:`),s&&(y+=`${u+1}:`),P&&(y+=`${r.index+1}:`),f.push(y+N),r[0].length===0&&n.lastIndex++}}else if(E){n.lastIndex=0;for(let r=n.exec(L);r!==null;r=n.exec(L)){let M=h?`${h}:`:"";S&&(M+=`${l+r.index}:`),s&&(M+=`${u+1}:`),P&&(M+=`${r.index+1}:`),f.push(M+L),r[0].length===0&&n.lastIndex++}}else{n.lastIndex=0;let r=n.exec(L),M=r?r.index+1:1,N=L;b!==null&&(n.lastIndex=0,N=L.replace(n,(...w)=>{if(w[0].length===0)return"";let U=w,B=w[w.length-1];return typeof B=="object"&&B!==null?(U.groups=B,U.input=w[w.length-2],U.index=w[w.length-3]):(U.input=w[w.length-1],U.index=w[w.length-2]),_(b,U)}));let y=h?`${h}:`:"";S&&(y+=`${l+(r?r.index:0)}:`),s&&(y+=`${u+1}:`),P&&(y+=`${M}:`),f.push(y+N)}l+=L.length+1}return{output:f.length>0?`${f.join(`
|
|
5
|
+
`)}
|
|
6
|
+
`:"",matched:a,matchCount:o}}if(R){let f=[],a=!1,o=0;for(let l=0;l<v;l++){let u=m[l];n.lastIndex=0;let G=n.test(u)!==i;G&&(a=!0,o++);let r=G?":":"-",M=h?`${h}${r}`:"";s&&(M+=`${l+1}${r}`),f.push(M+u)}return{output:f.length>0?`${f.join(`
|
|
7
|
+
`)}
|
|
8
|
+
`:"",matched:a,matchCount:o}}let x=[],C=0,p=new Set,g=-1,c=[];for(let f=0;f<v&&!(A>0&&C>=A);f++)n.lastIndex=0,n.test(m[f])!==i&&(c.push(f),C++);for(let f of c){let a=Math.max(0,f-z);g>=0&&a>g+1&&x.push(Z);for(let l=a;l<f;l++)if(!p.has(l)){p.add(l),g=l;let u=m[l];s&&(u=`${l+1}-${u}`),h&&(u=`${h}-${u}`),x.push(u)}if(!p.has(f)){p.add(f),g=f;let l=m[f];if(I){n.lastIndex=0;for(let u=n.exec(l);u!==null;u=n.exec(l)){let L=k!==void 0?u[k]??"":u[0],G=b!==null?b:L,r=h?`${h}:`:"";s&&(r+=`${f+1}:`),P&&(r+=`${u.index+1}:`),x.push(r+G),u[0].length===0&&n.lastIndex++}}else{let u=l;s&&(u=`${f+1}:${u}`),h&&(u=`${h}:${u}`),x.push(u)}}let o=Math.min(v-1,f+O);for(let l=f+1;l<=o;l++)if(!p.has(l)){p.add(l),g=l;let u=m[l];s&&(u=`${l+1}-${u}`),h&&(u=`${h}-${u}`),x.push(u)}}return{output:x.length>0?`${x.join(`
|
|
9
|
+
`)}
|
|
10
|
+
`:"",matched:C>0,matchCount:C}}function K(t,n,e){let{invertMatch:i,showLineNumbers:s,countOnly:d,countMatches:$,filename:h,onlyMatching:I,beforeContext:z,afterContext:O,maxCount:A,contextSeparator:Z,showColumn:P,showByteOffset:E,replace:S,kResetGroup:b}=e,R=t.split(`
|
|
11
|
+
`),T=R.length,k=T>0&&R[T-1]===""?T-1:T,m=[0];for(let c=0;c<t.length;c++)t[c]===`
|
|
12
|
+
`&&m.push(c+1);let j=c=>{let f=0;for(let a=0;a<m.length&&!(m[a]>c);a++)f=a;return f},v=c=>{let f=j(c);return c-m[f]+1},x=[];n.lastIndex=0;for(let c=n.exec(t);c!==null&&!(A>0&&x.length>=A);c=n.exec(t)){let f=j(c.index),a=j(c.index+Math.max(0,c[0].length-1)),o=b!==void 0?c[b]??"":c[0];x.push({startLine:f,endLine:a,byteOffset:c.index,column:v(c.index),matchText:o}),c[0].length===0&&n.lastIndex++}if(d||$){let c;if($)c=i?0:x.length;else{let a=new Set;for(let o of x)for(let l=o.startLine;l<=o.endLine;l++)a.add(l);c=i?k-a.size:a.size}return{output:`${h?`${h}:${c}`:String(c)}
|
|
13
|
+
`,matched:c>0,matchCount:c}}if(i){let c=new Set;for(let a of x)for(let o=a.startLine;o<=a.endLine;o++)c.add(o);let f=[];for(let a=0;a<k;a++)if(!c.has(a)){let o=R[a];s&&(o=`${a+1}:${o}`),h&&(o=`${h}:${o}`),f.push(o)}return{output:f.length>0?`${f.join(`
|
|
14
|
+
`)}
|
|
15
|
+
`:"",matched:f.length>0,matchCount:f.length}}if(x.length===0)return{output:"",matched:!1,matchCount:0};let C=new Set,p=-1,g=[];for(let c of x){let f=Math.max(0,c.startLine-z),a=Math.min(k-1,c.endLine+O);p>=0&&f>p+1&&g.push(Z);for(let o=f;o<c.startLine;o++)if(!C.has(o)){C.add(o),p=o;let l=R[o];s&&(l=`${o+1}-${l}`),h&&(l=`${h}-${l}`),g.push(l)}if(I){let o=S!==null?S:c.matchText,l=h?`${h}:`:"";E&&(l+=`${c.byteOffset}:`),s&&(l+=`${c.startLine+1}:`),P&&(l+=`${c.column}:`),g.push(l+o);for(let u=c.startLine;u<=c.endLine;u++)C.add(u),p=u}else for(let o=c.startLine;o<=c.endLine&&o<k;o++)if(!C.has(o)){C.add(o),p=o;let l=R[o];S!==null&&o===c.startLine&&(n.lastIndex=0,l=l.replace(n,S));let u=h?`${h}:`:"";E&&o===c.startLine&&(u+=`${c.byteOffset}:`),s&&(u+=`${o+1}:`),P&&o===c.startLine&&(u+=`${c.column}:`),g.push(u+l)}for(let o=c.endLine+1;o<=a;o++)if(!C.has(o)){C.add(o),p=o;let l=R[o];s&&(l=`${o+1}-${l}`),h&&(l=`${h}-${l}`),g.push(l)}}return{output:g.length>0?`${g.join(`
|
|
16
|
+
`)}
|
|
17
|
+
`:"",matched:!0,matchCount:x.length}}function Q(t,n){let e,i;switch(n.mode){case"fixed":e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(e=t.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),n.mode==="perl"){e=q(e),e=D(e),e=W(e);let $=X(e);e=$.pattern,i=$.kResetGroup}break}default:e=ne(t);break}n.wholeWord&&(e=`(?<![\\w])(?:${e})(?![\\w])`),n.lineRegexp&&(e=`^${e}$`);let s=/\\u\{[0-9A-Fa-f]+\}/.test(e),d="g"+(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.multilineDotall?"s":"")+(s?"u":"");return{regex:new RegExp(e,d),kResetGroup:i}}function q(t){let n="",e=0;for(;e<t.length;)if(t[e]==="\\"&&e+1<t.length&&t[e+1]==="Q"){e+=2;let i="";for(;e<t.length;){if(t[e]==="\\"&&e+1<t.length&&t[e+1]==="E"){e+=2;break}i+=t[e],e++}n+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else n+=t[e],e++;return n}function D(t){return t.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function W(t){let n="",e=0;for(;e<t.length;){if(t[e]==="("&&e+1<t.length&&t[e+1]==="?"){let i=t.slice(e).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(i){let s=i[1]||"",d=i[2]||"",$=i[3];if($===":"){let h=e+i[0].length-1,I=H(t,e);if(I!==-1){let z=t.slice(h+1,I),O=J(z,s,d);n+=`(?:${O})`,e=I+1;continue}}else if($===")"||$===""){e+=i[0].length;continue}}}n+=t[e],e++}return n}function H(t,n){let e=0,i=n;for(;i<t.length;){if(t[i]==="\\"){i+=2;continue}if(t[i]==="["){for(i++;i<t.length&&t[i]!=="]";)t[i]==="\\"&&i++,i++;i++;continue}if(t[i]==="(")e++;else if(t[i]===")"&&(e--,e===0))return i;i++}return-1}function J(t,n,e){let i=t;return n.includes("i")&&(i=V(i)),i}function V(t){let n="",e=0;for(;e<t.length;){let i=t[e];if(i==="\\"){e+1<t.length?(n+=i+t[e+1],e+=2):(n+=i,e++);continue}if(i==="["){n+=i,e++,e<t.length&&t[e]==="^"&&(n+=t[e],e++);let s=[];for(;e<t.length&&t[e]!=="]";)if(t[e]==="\\")s.push(t[e]),e++,e<t.length&&(s.push(t[e]),e++);else if(t[e]==="-"&&s.length>0&&e+1<t.length&&t[e+1]!=="]"){let d=s[s.length-1],$=t[e+1];s.push("-"),s.push($),/[a-z]/.test(d)&&/[a-z]/.test($)?(s.push(d.toUpperCase()),s.push("-"),s.push($.toUpperCase())):/[A-Z]/.test(d)&&/[A-Z]/.test($)&&(s.push(d.toLowerCase()),s.push("-"),s.push($.toLowerCase())),e+=2}else{let d=t[e];if(s.push(d),/[a-zA-Z]/.test(d)){let $=d===d.toLowerCase()?d.toUpperCase():d.toLowerCase();s.includes($)||s.push($)}e++}n+=s.join(""),e<t.length&&(n+=t[e],e++);continue}if(/[a-zA-Z]/.test(i)){let s=i.toLowerCase(),d=i.toUpperCase();n+=`[${d}${s}]`}else n+=i;e++}return n}function X(t){let n=Y(t);if(n===-1)return{pattern:t};let e=t.slice(0,n),i=t.slice(n+2),s=ee(e);return{pattern:`(?:${e})(${i})`,kResetGroup:s+1}}function Y(t){let n=0;for(;n<t.length-1;)if(t[n]==="\\"){if(t[n+1]==="K"){let e=0,i=n-1;for(;i>=0&&t[i]==="\\";)e++,i--;if(e%2===0)return n}n+=2}else n++;return-1}function ee(t){let n=0,e=0;for(;e<t.length;){if(t[e]==="\\"){e+=2;continue}if(t[e]==="["){for(e++;e<t.length&&t[e]!=="]";)t[e]==="\\"&&e++,e++;e++;continue}if(t[e]==="(")if(e+1<t.length&&t[e+1]==="?"){if(e+2<t.length){let i=t[e+2];if(i===":"||i==="="||i==="!"){e++;continue}if(i==="<"&&e+3<t.length){let s=t[e+3];if(s==="="||s==="!"){e++;continue}n++,e++;continue}}}else n++;e++}return n}function te(t){let n=t.replace(/\$\{0\}|\$0(?![0-9])/g,"$$&");return n=n.replace(/\$\{([^0-9}][^}]*)\}/g,"$$<$1>"),n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),n}function ne(t){let n="",e=0;for(;e<t.length;){let i=t[e];if(i==="\\"&&e+1<t.length){let s=t[e+1];if(s==="|"||s==="("||s===")"){n+=s,e+=2;continue}else if(s==="{"||s==="}"){n+=`\\${s}`,e+=2;continue}}i==="+"||i==="?"||i==="|"||i==="("||i===")"||i==="{"||i==="}"?n+=`\\${i}`:n+=i,e++}return n}export{F as a,Q as b,te as c};
|