just-bash 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/chunks/alias-MGDOL4KG.js +7 -0
- package/dist/bin/chunks/awk2-TV3KCXON.js +21 -0
- package/dist/bin/{shell/chunks/base64-O7TCK5TL.js → chunks/base64-43KPK6TL.js} +1 -1
- package/dist/bin/chunks/bash-OAUBNRSG.js +6 -0
- package/dist/bin/{shell/chunks/cat-AJXZOSPN.js → chunks/cat-HNXE2ES2.js} +1 -1
- package/dist/bin/chunks/chunk-4PRVMER6.js +2 -0
- package/dist/bin/chunks/chunk-GANRM5LO.js +17 -0
- package/dist/bin/chunks/chunk-GIFF636B.js +2 -0
- package/dist/bin/chunks/chunk-GZHFXDDO.js +10 -0
- package/dist/bin/chunks/chunk-JBABAK44.js +4 -0
- package/dist/bin/chunks/chunk-SE4C7FJY.js +33 -0
- package/dist/bin/chunks/chunk-VHH2M5JC.js +74 -0
- package/dist/bin/chunks/chunk-XI5LBYFX.js +6 -0
- package/dist/bin/chunks/{column-TSFEMTG6.js → column-HQ4AK5DM.js} +1 -1
- package/dist/bin/chunks/{cp-XXWRVG2D.js → cp-VFXCUKXO.js} +1 -1
- package/dist/bin/chunks/{curl-TH7YRBSA.js → curl-7IUASLUJ.js} +1 -1
- package/dist/bin/chunks/{diff-GI3QVUGD.js → diff-ZGXLP3DN.js} +1 -1
- package/dist/bin/chunks/{du-XQPYLN3H.js → du-PECPOFQT.js} +1 -1
- package/dist/bin/chunks/env-W6IMQ43Y.js +9 -0
- package/dist/bin/chunks/expansion-LVCGISX6.js +2 -0
- package/dist/bin/chunks/expr-433HIVAI.js +5 -0
- package/dist/bin/chunks/find-KHOYETRP.js +11 -0
- package/dist/bin/{shell/chunks/grep-VX7MJMVN.js → chunks/grep-X7UU5FD6.js} +1 -1
- package/dist/bin/chunks/{gzip-YXK3WZQL.js → gzip-5ILPB46W.js} +1 -1
- package/dist/bin/chunks/history-56DL6SXU.js +3 -0
- package/dist/bin/{shell/chunks/jq-RGZHJNXC.js → chunks/jq-QR3PX7FE.js} +1 -1
- package/dist/bin/{shell/chunks/ls-BEHQBUMC.js → chunks/ls-5LN47VHU.js} +1 -1
- package/dist/bin/{shell/chunks/mkdir-XJABRAUN.js → chunks/mkdir-XMSNS6S5.js} +1 -1
- package/dist/bin/chunks/{mv-3ATZ2ABL.js → mv-P4KHB27X.js} +1 -1
- package/dist/bin/chunks/{paste-FT6WBQZG.js → paste-UCH462KK.js} +1 -1
- package/dist/bin/chunks/{printf-YPXD4CRE.js → printf-XPBSFXJE.js} +1 -1
- package/dist/bin/chunks/{python3-JGT65AEB.js → python3-ZWX5SFJ3.js} +5 -5
- package/dist/bin/chunks/rg-RSJPHAP5.js +33 -0
- package/dist/bin/chunks/{rm-2PKAWTSQ.js → rm-S7ASVG34.js} +1 -1
- package/dist/bin/chunks/{rmdir-GOODLY5W.js → rmdir-OEMA5ZTD.js} +1 -1
- package/dist/bin/chunks/{sed-JPDTWF4W.js → sed-356P4DZB.js} +25 -25
- package/dist/bin/chunks/{stat-UEQ7KMY5.js → stat-ZZVPXHLF.js} +1 -1
- package/dist/bin/chunks/{tar-LFENC54A.js → tar-CLEBMI4R.js} +18 -18
- package/dist/bin/{shell/chunks/tee-ZFIT2GTM.js → chunks/tee-XSKPK43X.js} +1 -1
- package/dist/bin/chunks/time-F4NVQOJH.js +14 -0
- package/dist/bin/{shell/chunks/tr-MBLEXZBI.js → chunks/tr-FMT6JWLE.js} +1 -1
- package/dist/bin/chunks/{tree-DQBEJH47.js → tree-WC3AXFHC.js} +1 -1
- package/dist/bin/chunks/{uniq-IXHB2FVS.js → uniq-NNXAFO6D.js} +1 -1
- package/dist/bin/{shell/chunks/wc-SAOHEZYP.js → chunks/wc-CZ2TD6T6.js} +1 -1
- package/dist/bin/chunks/{which-FCDFBOMN.js → which-5QEJAXNR.js} +1 -1
- package/dist/bin/chunks/worker.js +382 -64
- package/dist/bin/chunks/xan-UZG3SZON.js +140 -0
- package/dist/bin/chunks/{xan-view-6Z6TWXMY.js → xan-view-5SZBYPLG.js} +1 -1
- package/dist/bin/chunks/{yq-PFV4T2PV.js → yq-T255J4ZP.js} +1 -1
- package/dist/bin/just-bash.js +251 -251
- package/dist/bin/shell/chunks/alias-MGDOL4KG.js +7 -0
- package/dist/bin/shell/chunks/awk2-TV3KCXON.js +21 -0
- package/dist/bin/{chunks/base64-O7TCK5TL.js → shell/chunks/base64-43KPK6TL.js} +1 -1
- package/dist/bin/shell/chunks/bash-OAUBNRSG.js +6 -0
- package/dist/bin/{chunks/cat-AJXZOSPN.js → shell/chunks/cat-HNXE2ES2.js} +1 -1
- package/dist/bin/shell/chunks/chunk-4PRVMER6.js +2 -0
- package/dist/bin/shell/chunks/chunk-GANRM5LO.js +17 -0
- package/dist/bin/shell/chunks/chunk-GIFF636B.js +2 -0
- package/dist/bin/shell/chunks/chunk-GZHFXDDO.js +10 -0
- package/dist/bin/shell/chunks/chunk-JBABAK44.js +4 -0
- package/dist/bin/shell/chunks/chunk-SE4C7FJY.js +33 -0
- package/dist/bin/shell/chunks/chunk-VHH2M5JC.js +74 -0
- package/dist/bin/shell/chunks/chunk-XI5LBYFX.js +6 -0
- package/dist/bin/shell/chunks/{column-TSFEMTG6.js → column-HQ4AK5DM.js} +1 -1
- package/dist/bin/shell/chunks/{cp-XXWRVG2D.js → cp-VFXCUKXO.js} +1 -1
- package/dist/bin/shell/chunks/{curl-TH7YRBSA.js → curl-7IUASLUJ.js} +1 -1
- package/dist/bin/shell/chunks/{diff-GI3QVUGD.js → diff-ZGXLP3DN.js} +1 -1
- package/dist/bin/shell/chunks/{du-XQPYLN3H.js → du-PECPOFQT.js} +1 -1
- package/dist/bin/shell/chunks/env-W6IMQ43Y.js +9 -0
- package/dist/bin/shell/chunks/expansion-LVCGISX6.js +2 -0
- package/dist/bin/shell/chunks/expr-433HIVAI.js +5 -0
- package/dist/bin/shell/chunks/find-KHOYETRP.js +11 -0
- package/dist/bin/{chunks/grep-VX7MJMVN.js → shell/chunks/grep-X7UU5FD6.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-YXK3WZQL.js → gzip-5ILPB46W.js} +1 -1
- package/dist/bin/shell/chunks/history-56DL6SXU.js +3 -0
- package/dist/bin/{chunks/jq-RGZHJNXC.js → shell/chunks/jq-QR3PX7FE.js} +1 -1
- package/dist/bin/{chunks/ls-BEHQBUMC.js → shell/chunks/ls-5LN47VHU.js} +1 -1
- package/dist/bin/{chunks/mkdir-XJABRAUN.js → shell/chunks/mkdir-XMSNS6S5.js} +1 -1
- package/dist/bin/shell/chunks/{mv-3ATZ2ABL.js → mv-P4KHB27X.js} +1 -1
- package/dist/bin/shell/chunks/{paste-FT6WBQZG.js → paste-UCH462KK.js} +1 -1
- package/dist/bin/shell/chunks/{printf-YPXD4CRE.js → printf-XPBSFXJE.js} +1 -1
- package/dist/bin/shell/chunks/{python3-JGT65AEB.js → python3-ZWX5SFJ3.js} +5 -5
- package/dist/bin/shell/chunks/rg-RSJPHAP5.js +33 -0
- package/dist/bin/shell/chunks/{rm-2PKAWTSQ.js → rm-S7ASVG34.js} +1 -1
- package/dist/bin/shell/chunks/{rmdir-GOODLY5W.js → rmdir-OEMA5ZTD.js} +1 -1
- package/dist/bin/shell/chunks/{sed-JPDTWF4W.js → sed-356P4DZB.js} +25 -25
- package/dist/bin/shell/chunks/{stat-UEQ7KMY5.js → stat-ZZVPXHLF.js} +1 -1
- package/dist/bin/shell/chunks/{tar-LFENC54A.js → tar-CLEBMI4R.js} +18 -18
- package/dist/bin/{chunks/tee-ZFIT2GTM.js → shell/chunks/tee-XSKPK43X.js} +1 -1
- package/dist/bin/shell/chunks/time-F4NVQOJH.js +14 -0
- package/dist/bin/{chunks/tr-MBLEXZBI.js → shell/chunks/tr-FMT6JWLE.js} +1 -1
- package/dist/bin/shell/chunks/{tree-DQBEJH47.js → tree-WC3AXFHC.js} +1 -1
- package/dist/bin/shell/chunks/{uniq-IXHB2FVS.js → uniq-NNXAFO6D.js} +1 -1
- package/dist/bin/{chunks/wc-SAOHEZYP.js → shell/chunks/wc-CZ2TD6T6.js} +1 -1
- package/dist/bin/shell/chunks/{which-FCDFBOMN.js → which-5QEJAXNR.js} +1 -1
- package/dist/bin/shell/chunks/xan-UZG3SZON.js +140 -0
- package/dist/bin/shell/chunks/{xan-view-6Z6TWXMY.js → xan-view-5SZBYPLG.js} +1 -1
- package/dist/bin/shell/chunks/{yq-PFV4T2PV.js → yq-T255J4ZP.js} +1 -1
- package/dist/bin/shell/shell.js +226 -226
- package/dist/bundle/browser.js +892 -863
- package/dist/bundle/chunks/alias-YGOORMWI.js +6 -0
- package/dist/bundle/chunks/awk2-PTU7M2NS.js +20 -0
- package/dist/bundle/chunks/{base64-3BME25ON.js → base64-2JFR3HGT.js} +1 -1
- package/dist/bundle/chunks/bash-BYWM5OPC.js +5 -0
- package/dist/bundle/chunks/{cat-MV4K6AUA.js → cat-GPKR7D6K.js} +1 -1
- package/dist/bundle/chunks/chunk-F55TLFGB.js +9 -0
- package/dist/bundle/chunks/chunk-GMMICOEF.js +73 -0
- package/dist/bundle/chunks/chunk-HWKDQ44K.js +3 -0
- package/dist/bundle/chunks/chunk-IJXFPKNC.js +1 -0
- package/dist/bundle/chunks/chunk-OJDRYQWQ.js +1 -0
- package/dist/bundle/chunks/chunk-PHXIZ5A4.js +5 -0
- package/dist/bundle/chunks/chunk-TMKMSBKB.js +16 -0
- package/dist/bundle/chunks/chunk-YNYSPYQ5.js +32 -0
- package/dist/bundle/chunks/{column-XPDNNO5Y.js → column-R6OLMEUA.js} +1 -1
- package/dist/bundle/chunks/{cp-PBJT3GBF.js → cp-NJSENVKC.js} +1 -1
- package/dist/bundle/chunks/{curl-XLP4VABU.js → curl-QDCXHQMX.js} +1 -1
- package/dist/bundle/chunks/{diff-ZLJYSBRK.js → diff-ELUS3RW7.js} +1 -1
- package/dist/bundle/chunks/{du-NQXEC3EF.js → du-T4JUAAB2.js} +1 -1
- package/dist/bundle/chunks/env-M3AXY56V.js +8 -0
- package/dist/bundle/chunks/expansion-OP223NMV.js +1 -0
- package/dist/bundle/chunks/expr-YSFDPKPV.js +4 -0
- package/dist/bundle/chunks/find-WTVSUXL3.js +10 -0
- package/dist/bundle/chunks/{grep-NIC6JNLH.js → grep-F7ILPL2H.js} +1 -1
- package/dist/bundle/chunks/{gzip-L3NDJG3F.js → gzip-4P4KGYT5.js} +1 -1
- package/dist/bundle/chunks/history-TMBGOQO6.js +2 -0
- package/dist/bundle/chunks/{jq-RLRYRPOJ.js → jq-RIXCOULU.js} +1 -1
- package/dist/bundle/chunks/{ls-5W3NU5OJ.js → ls-PUJHEPXS.js} +1 -1
- package/dist/bundle/chunks/{mkdir-7UKY4B3B.js → mkdir-SF2UE4KB.js} +1 -1
- package/dist/bundle/chunks/{mv-FXHEKRTB.js → mv-JPBZPM4O.js} +1 -1
- package/dist/bundle/chunks/{paste-QTGVEPH5.js → paste-QAP6Y75J.js} +1 -1
- package/dist/bundle/chunks/{printf-66XGXFCD.js → printf-OAPYPRGV.js} +1 -1
- package/dist/bundle/chunks/{python3-3OP7EKER.js → python3-SKZGHYDO.js} +5 -5
- package/dist/bundle/chunks/rg-O3ZIRBAJ.js +32 -0
- package/dist/bundle/chunks/{rm-I2SRVF7H.js → rm-MJFRIDNT.js} +1 -1
- package/dist/bundle/chunks/{rmdir-XFQE4ZYV.js → rmdir-DU6C7ZEO.js} +1 -1
- package/dist/bundle/chunks/{sed-IV6HLDXU.js → sed-P5OTD3EL.js} +25 -25
- package/dist/bundle/chunks/{stat-IVQBBOKN.js → stat-IOLJTP7U.js} +1 -1
- package/dist/bundle/chunks/{tar-LWIHPMT6.js → tar-5V4PGBFL.js} +18 -18
- package/dist/bundle/chunks/{tee-2QU4NRSJ.js → tee-4KHTWVWB.js} +1 -1
- package/dist/bundle/chunks/time-EGF4KTWV.js +13 -0
- package/dist/bundle/chunks/{tr-EDGW5FG6.js → tr-P43NRVKL.js} +1 -1
- package/dist/bundle/chunks/{tree-MEM64BW3.js → tree-UFVZH4SS.js} +1 -1
- package/dist/bundle/chunks/{uniq-47QVBRNC.js → uniq-XBP4SJA3.js} +1 -1
- package/dist/bundle/chunks/{wc-HE5XARI4.js → wc-VDPK3LVS.js} +1 -1
- package/dist/bundle/chunks/{which-UBLRBDHN.js → which-GF77XMJD.js} +1 -1
- package/dist/bundle/chunks/worker.js +382 -64
- package/dist/bundle/chunks/xan-HKCQ46BH.js +139 -0
- package/dist/bundle/chunks/{xan-view-DMFUMZG7.js → xan-view-ECQUO7AJ.js} +1 -1
- package/dist/bundle/chunks/{yq-L665QPQU.js → yq-6SPP5BHS.js} +1 -1
- package/dist/bundle/index.js +253 -253
- package/dist/commands/awk/interpreter/context.d.ts +3 -2
- package/dist/commands/query-engine/evaluator.d.ts +2 -2
- package/dist/commands/query-engine/safe-object.d.ts +49 -0
- package/dist/commands/query-engine/value-operations.d.ts +1 -0
- package/dist/commands/search-engine/matcher.d.ts +2 -1
- package/dist/commands/search-engine/regex.d.ts +2 -1
- package/dist/commands/xan/aggregation.d.ts +1 -1
- package/dist/commands/xan/csv.d.ts +16 -0
- package/dist/interpreter/alias-expansion.d.ts +1 -1
- package/dist/interpreter/helpers/ifs.d.ts +4 -4
- package/dist/interpreter/simple-command-assignments.d.ts +1 -1
- package/dist/interpreter/types.d.ts +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +3 -2
- package/dist/bin/chunks/alias-EGIS5LUE.js +0 -7
- package/dist/bin/chunks/awk2-GFEJOWML.js +0 -21
- package/dist/bin/chunks/bash-PGDTHIM2.js +0 -6
- package/dist/bin/chunks/chunk-26Q3PZQ6.js +0 -2
- package/dist/bin/chunks/chunk-FSAGDARS.js +0 -74
- package/dist/bin/chunks/chunk-IRUD2E3M.js +0 -17
- package/dist/bin/chunks/chunk-KD3EODLB.js +0 -6
- package/dist/bin/chunks/chunk-TA7RUHGQ.js +0 -4
- package/dist/bin/chunks/chunk-UUQYHLBO.js +0 -10
- package/dist/bin/chunks/env-7A4MH7BJ.js +0 -9
- package/dist/bin/chunks/expansion-BOR3ELLC.js +0 -2
- package/dist/bin/chunks/expr-RMGXYNQJ.js +0 -5
- package/dist/bin/chunks/find-PHDZK64M.js +0 -11
- package/dist/bin/chunks/history-G5C2J2OY.js +0 -3
- package/dist/bin/chunks/rg-RSDLLECO.js +0 -33
- package/dist/bin/chunks/time-37F5EBPK.js +0 -14
- package/dist/bin/chunks/xan-5HNHTFMB.js +0 -140
- package/dist/bin/shell/chunks/alias-EGIS5LUE.js +0 -7
- package/dist/bin/shell/chunks/awk2-GFEJOWML.js +0 -21
- package/dist/bin/shell/chunks/bash-PGDTHIM2.js +0 -6
- package/dist/bin/shell/chunks/chunk-26Q3PZQ6.js +0 -2
- package/dist/bin/shell/chunks/chunk-FSAGDARS.js +0 -74
- package/dist/bin/shell/chunks/chunk-IRUD2E3M.js +0 -17
- package/dist/bin/shell/chunks/chunk-KD3EODLB.js +0 -6
- package/dist/bin/shell/chunks/chunk-TA7RUHGQ.js +0 -4
- package/dist/bin/shell/chunks/chunk-UUQYHLBO.js +0 -10
- package/dist/bin/shell/chunks/env-7A4MH7BJ.js +0 -9
- package/dist/bin/shell/chunks/expansion-BOR3ELLC.js +0 -2
- package/dist/bin/shell/chunks/expr-RMGXYNQJ.js +0 -5
- package/dist/bin/shell/chunks/find-PHDZK64M.js +0 -11
- package/dist/bin/shell/chunks/history-G5C2J2OY.js +0 -3
- package/dist/bin/shell/chunks/rg-RSDLLECO.js +0 -33
- package/dist/bin/shell/chunks/time-37F5EBPK.js +0 -14
- package/dist/bin/shell/chunks/xan-5HNHTFMB.js +0 -140
- package/dist/bundle/chunks/alias-ATFBB6D2.js +0 -6
- package/dist/bundle/chunks/awk2-6FBZTP57.js +0 -20
- package/dist/bundle/chunks/bash-OLRNM52U.js +0 -5
- package/dist/bundle/chunks/chunk-3AWP5CWK.js +0 -73
- package/dist/bundle/chunks/chunk-A263W2RD.js +0 -9
- package/dist/bundle/chunks/chunk-CXEWLFNE.js +0 -16
- package/dist/bundle/chunks/chunk-CZPA5RBA.js +0 -5
- package/dist/bundle/chunks/chunk-UJMN5NLH.js +0 -1
- package/dist/bundle/chunks/chunk-ZVV5VXYZ.js +0 -3
- package/dist/bundle/chunks/env-2UI6XINU.js +0 -8
- package/dist/bundle/chunks/expansion-RIGCFEMA.js +0 -1
- package/dist/bundle/chunks/expr-DG4E7SIS.js +0 -4
- package/dist/bundle/chunks/find-YGMSVGUV.js +0 -10
- package/dist/bundle/chunks/history-MQDK2OPD.js +0 -2
- package/dist/bundle/chunks/rg-SRMB7L6G.js +0 -32
- package/dist/bundle/chunks/time-UWXBG6CS.js +0 -13
- package/dist/bundle/chunks/xan-A6VPI4HJ.js +0 -139
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-OBH7XN5N.js";import{a as U}from"./chunk-TA7RUHGQ.js";import{a as I,b as J}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var G=(n,t,e)=>{let s=n instanceof RegExp?Z(n,e):n,r=t instanceof RegExp?Z(t,e):t,i=s!==null&&r!=null&&wt(s,r,e);return i&&{start:i[0],end:i[1],pre:e.slice(0,i[0]),body:e.slice(i[0]+s.length,i[1]),post:e.slice(i[1]+r.length)}},Z=(n,t)=>{let e=t.match(n);return e?e[0]:null},wt=(n,t,e)=>{let s,r,i,o,l,h=e.indexOf(n),f=e.indexOf(t,h+1),u=h;if(h>=0&&f>0){if(n===t)return[h,f];for(s=[],i=e.length;u>=0&&!l;){if(u===h)s.push(u),h=e.indexOf(n,u+1);else if(s.length===1){let g=s.pop();g!==void 0&&(l=[g,f])}else r=s.pop(),r!==void 0&&r<i&&(i=r,o=f),f=e.indexOf(t,u+1);u=h<f&&h>=0?h:f}s.length&&o!==void 0&&(l=[i,o])}return l};var K="\0SLASH"+Math.random()+"\0",V="\0OPEN"+Math.random()+"\0",F="\0CLOSE"+Math.random()+"\0",X="\0COMMA"+Math.random()+"\0",Y="\0PERIOD"+Math.random()+"\0",St=new RegExp(K,"g"),xt=new RegExp(V,"g"),$t=new RegExp(F,"g"),bt=new RegExp(X,"g"),Et=new RegExp(Y,"g"),At=/\\\\/g,Tt=/\\{/g,Mt=/\\}/g,vt=/\\,/g,Pt=/\\./g;function B(n){return isNaN(n)?n.charCodeAt(0):parseInt(n,10)}function Nt(n){return n.replace(At,K).replace(Tt,V).replace(Mt,F).replace(vt,X).replace(Pt,Y)}function Ot(n){return n.replace(St,"\\").replace(xt,"{").replace($t,"}").replace(bt,",").replace(Et,".")}function Q(n){if(!n)return[""];let t=[],e=G("{","}",n);if(!e)return n.split(",");let{pre:s,body:r,post:i}=e,o=s.split(",");o[o.length-1]+="{"+r+"}";let l=Q(i);return i.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}function tt(n){return n?(n.slice(0,2)==="{}"&&(n="\\{\\}"+n.slice(2)),z(Nt(n),!0).map(Ot)):[]}function Ct(n){return"{"+n+"}"}function Dt(n){return/^-?0\d/.test(n)}function zt(n,t){return n<=t}function Rt(n,t){return n>=t}function z(n,t){let e=[],s=G("{","}",n);if(!s)return[n];let r=s.pre,i=s.post.length?z(s.post,!1):[""];if(/\$$/.test(s.pre))for(let o=0;o<i.length;o++){let l=r+"{"+s.body+"}"+i[o];e.push(l)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),h=o||l,f=s.body.indexOf(",")>=0;if(!h&&!f)return s.post.match(/,(?!,).*\}/)?(n=s.pre+"{"+s.body+F+s.post,z(n)):[n];let u;if(h)u=s.body.split(/\.\./);else if(u=Q(s.body),u.length===1&&u[0]!==void 0&&(u=z(u[0],!1).map(Ct),u.length===1))return i.map(a=>s.pre+u[0]+a);let g;if(h&&u[0]!==void 0&&u[1]!==void 0){let a=B(u[0]),c=B(u[1]),p=Math.max(u[0].length,u[1].length),d=u.length===3&&u[2]!==void 0?Math.abs(B(u[2])):1,S=zt;c<a&&(d*=-1,S=Rt);let x=u.some(Dt);g=[];for(let y=a;S(y,c);y+=d){let m;if(l)m=String.fromCharCode(y),m==="\\"&&(m="");else if(m=String(y),x){let b=p-m.length;if(b>0){let $=new Array(b+1).join("0");y<0?m="-"+$+m.slice(1):m=$+m}}g.push(m)}}else{g=[];for(let a=0;a<u.length;a++)g.push.apply(g,z(u[a],!1))}for(let a=0;a<g.length;a++)for(let c=0;c<i.length;c++){let p=r+g[a]+i[c];(!t||h||p)&&e.push(p)}}return e}var R=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var Wt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},W=n=>n.replace(/[[\]\\-]/g,"\\$&"),jt=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),et=n=>n.join(""),st=(n,t)=>{let e=t;if(n.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],r=[],i=e+1,o=!1,l=!1,h=!1,f=!1,u=e,g="";t:for(;i<n.length;){let d=n.charAt(i);if((d==="!"||d==="^")&&i===e+1){f=!0,i++;continue}if(d==="]"&&o&&!h){u=i+1;break}if(o=!0,d==="\\"&&!h){h=!0,i++;continue}if(d==="["&&!h){for(let[S,[w,x,y]]of Object.entries(Wt))if(n.startsWith(S,i)){if(g)return["$.",!1,n.length-e,!0];i+=S.length,y?r.push(w):s.push(w),l=l||x;continue t}}if(h=!1,g){d>g?s.push(W(g)+"-"+W(d)):d===g&&s.push(W(d)),g="",i++;continue}if(n.startsWith("-]",i+1)){s.push(W(d+"-")),i+=2;continue}if(n.startsWith("-",i+1)){g=d,i+=2;continue}s.push(W(d)),i++}if(u<i)return["",!1,0,!1];if(!s.length&&!r.length)return["$.",!1,n.length-e,!0];if(r.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!f){let d=s[0].length===2?s[0].slice(-1):s[0];return[jt(d),!1,u-e,!1]}let a="["+(f?"^":"")+et(s)+"]",c="["+(f?"":"^")+et(r)+"]";return[s.length&&r.length?"("+a+"|"+c+")":s.length?a:c,l,u-e,!0]};var v=(n,{windowsPathsNoEscape:t=!1,magicalBraces:e=!0}={})=>e?t?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?n.replace(/\[([^\/\\{}])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var Lt=new Set(["!","?","+","*","@"]),nt=n=>Lt.has(n),kt="(?!(?:^|/)\\.\\.?(?:$|/))",j="(?!\\.)",Gt=new Set(["[","."]),Bt=new Set(["..","."]),Ft=new Set("().*{}+?[]^$\\!"),_t=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_="[^/]",it=_+"*?",rt=_+"+?",O=class n{type;#s;#n;#r=!1;#t=[];#e;#o;#c;#a=!1;#i;#l;#u=!1;constructor(t,e,s={}){this.type=t,t&&(this.#n=!0),this.#e=e,this.#s=this.#e?this.#e.#s:this,this.#i=this.#s===this?s:this.#s.#i,this.#c=this.#s===this?[]:this.#s.#c,t==="!"&&!this.#s.#a&&this.#c.push(this),this.#o=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#l=this.#t.map(t=>String(t)).join("")}#p(){if(this!==this.#s)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let t;for(;t=this.#c.pop();){if(t.type!=="!")continue;let e=t,s=e.#e;for(;s;){for(let r=e.#o+1;!s.type&&r<s.#t.length;r++)for(let i of t.#t){if(typeof i=="string")throw new Error("string part in extglob AST??");i.copyIn(s.#t[r])}e=s,s=e.#e}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof n&&e.#e===this))throw new Error("invalid part: "+e);this.#t.push(e)}}toJSON(){let t=this.type===null?this.#t.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#t.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#s||this.#s.#a&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#s===this)return!0;if(!this.#e?.isStart())return!1;if(this.#o===0)return!0;let t=this.#e;for(let e=0;e<this.#o;e++){let s=t.#t[e];if(!(s instanceof n&&s.type==="!"))return!1}return!0}isEnd(){if(this.#s===this||this.#e?.type==="!")return!0;if(!this.#e?.isEnd())return!1;if(!this.type)return this.#e?.isEnd();let t=this.#e?this.#e.#t.length:0;return this.#o===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new n(this.type,t);for(let s of this.#t)e.copyIn(s);return e}static#h(t,e,s,r){let i=!1,o=!1,l=-1,h=!1;if(e.type===null){let c=s,p="";for(;c<t.length;){let d=t.charAt(c++);if(i||d==="\\"){i=!i,p+=d;continue}if(o){c===l+1?(d==="^"||d==="!")&&(h=!0):d==="]"&&!(c===l+2&&h)&&(o=!1),p+=d;continue}else if(d==="["){o=!0,l=c,h=!1,p+=d;continue}if(!r.noext&&nt(d)&&t.charAt(c)==="("){e.push(p),p="";let S=new n(d,e);c=n.#h(t,S,c,r),e.push(S);continue}p+=d}return e.push(p),c}let f=s+1,u=new n(null,e),g=[],a="";for(;f<t.length;){let c=t.charAt(f++);if(i||c==="\\"){i=!i,a+=c;continue}if(o){f===l+1?(c==="^"||c==="!")&&(h=!0):c==="]"&&!(f===l+2&&h)&&(o=!1),a+=c;continue}else if(c==="["){o=!0,l=f,h=!1,a+=c;continue}if(nt(c)&&t.charAt(f)==="("){u.push(a),a="";let p=new n(c,u);u.push(p),f=n.#h(t,p,f,r);continue}if(c==="|"){u.push(a),a="",g.push(u),u=new n(null,e);continue}if(c===")")return a===""&&e.#t.length===0&&(e.#u=!0),u.push(a),a="",e.push(...g,u),f;a+=c}return e.type=null,e.#n=void 0,e.#t=[t.substring(s-1)],f}static fromGlob(t,e={}){let s=new n(null,void 0,e);return n.#h(t,s,0,e),s}toMMPattern(){if(this!==this.#s)return this.#s.toMMPattern();let t=this.toString(),[e,s,r,i]=this.toRegExpSource();if(!(r||this.#n||this.#i.nocase&&!this.#i.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let l=(this.#i.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${e}$`,l),{_src:e,_glob:t})}get options(){return this.#i}toRegExpSource(t){let e=t??!!this.#i.dot;if(this.#s===this&&this.#p(),!this.type){let h=this.isStart()&&this.isEnd()&&!this.#t.some(c=>typeof c!="string"),f=this.#t.map(c=>{let[p,d,S,w]=typeof c=="string"?n.#d(c,this.#n,h):c.toRegExpSource(t);return this.#n=this.#n||S,this.#r=this.#r||w,p}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Bt.has(this.#t[0]))){let p=Gt,d=e&&p.has(f.charAt(0))||f.startsWith("\\.")&&p.has(f.charAt(2))||f.startsWith("\\.\\.")&&p.has(f.charAt(4)),S=!e&&!t&&p.has(f.charAt(0));u=d?kt:S?j:""}let g="";return this.isEnd()&&this.#s.#a&&this.#e?.type==="!"&&(g="(?:$|\\/)"),[u+f+g,v(f),this.#n=!!this.#n,this.#r]}let s=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",i=this.#f(e);if(this.isStart()&&this.isEnd()&&!i&&this.type!=="!"){let h=this.toString();return this.#t=[h],this.type=null,this.#n=void 0,[h,v(this.toString()),!1,!1]}let o=!s||t||e||!j?"":this.#f(!0);o===i&&(o=""),o&&(i=`(?:${i})(?:${o})*?`);let l="";if(this.type==="!"&&this.#u)l=(this.isStart()&&!e?j:"")+rt;else{let h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?j:"")+it+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=r+i+h}return[l,v(i),this.#n=!!this.#n,this.#r]}#f(t){return this.#t.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,r,i,o]=e.toRegExpSource(t);return this.#r=this.#r||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#d(t,e,s=!1){let r=!1,i="",o=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(r){r=!1,i+=(Ft.has(h)?"\\":"")+h;continue}if(h==="\\"){l===t.length-1?i+="\\\\":r=!0;continue}if(h==="["){let[f,u,g,a]=st(t,l);if(g){i+=f,o=o||u,l+=g-1,e=e||a;continue}}if(h==="*"){i+=s&&t==="*"?rt:it,e=!0;continue}if(h==="?"){i+=_,e=!0;continue}i+=_t(h)}return[i,v(t),!!e,o]}};var q=(n,{windowsPathsNoEscape:t=!1,magicalBraces:e=!1}={})=>e?t?n.replace(/[?*()[\]{}]/g,"[$&]"):n.replace(/[?*()[\]\\{}]/g,"\\$&"):t?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var E=(n,t,e={})=>(R(t),!e.nocomment&&t.charAt(0)==="#"?!1:new C(t,e).match(n)),qt=/^\*+([^+@!?\*\[\(]*)$/,Ht=n=>t=>!t.startsWith(".")&&t.endsWith(n),It=n=>t=>t.endsWith(n),Jt=n=>(n=n.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(n)),Ut=n=>(n=n.toLowerCase(),t=>t.toLowerCase().endsWith(n)),Zt=/^\*+\.\*+$/,Kt=n=>!n.startsWith(".")&&n.includes("."),Vt=n=>n!=="."&&n!==".."&&n.includes("."),Xt=/^\.\*+$/,Yt=n=>n!=="."&&n!==".."&&n.startsWith("."),Qt=/^\*+$/,te=n=>n.length!==0&&!n.startsWith("."),ee=n=>n.length!==0&&n!=="."&&n!=="..",se=/^\?+([^+@!?\*\[\(]*)?$/,ne=([n,t=""])=>{let e=ct([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},ie=([n,t=""])=>{let e=lt([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},re=([n,t=""])=>{let e=lt([n]);return t?s=>e(s)&&s.endsWith(t):e},oe=([n,t=""])=>{let e=ct([n]);return t?s=>e(s)&&s.endsWith(t):e},ct=([n])=>{let t=n.length;return e=>e.length===t&&!e.startsWith(".")},lt=([n])=>{let t=n.length;return e=>e.length===t&&e!=="."&&e!==".."},ht=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ot={win32:{sep:"\\"},posix:{sep:"/"}},ae=ht==="win32"?ot.win32.sep:ot.posix.sep;E.sep=ae;var M=Symbol("globstar **");E.GLOBSTAR=M;var ce="[^/]",le=ce+"*?",he="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ue="(?:(?!(?:\\/|^)\\.).)*?",fe=(n,t={})=>e=>E(e,n,t);E.filter=fe;var T=(n,t={})=>Object.assign({},n,t),pe=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return E;let t=E;return Object.assign((s,r,i={})=>t(s,r,T(n,i)),{Minimatch:class extends t.Minimatch{constructor(r,i={}){super(r,T(n,i))}static defaults(r){return t.defaults(T(n,r)).Minimatch}},AST:class extends t.AST{constructor(r,i,o={}){super(r,i,T(n,o))}static fromGlob(r,i={}){return t.AST.fromGlob(r,T(n,i))}},unescape:(s,r={})=>t.unescape(s,T(n,r)),escape:(s,r={})=>t.escape(s,T(n,r)),filter:(s,r={})=>t.filter(s,T(n,r)),defaults:s=>t.defaults(T(n,s)),makeRe:(s,r={})=>t.makeRe(s,T(n,r)),braceExpand:(s,r={})=>t.braceExpand(s,T(n,r)),match:(s,r,i={})=>t.match(s,r,T(n,i)),sep:t.sep,GLOBSTAR:M})};E.defaults=pe;var ut=(n,t={})=>(R(n),t.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:tt(n));E.braceExpand=ut;var de=(n,t={})=>new C(n,t).makeRe();E.makeRe=de;var ge=(n,t,e={})=>{let s=new C(t,e);return n=n.filter(r=>s.match(r)),s.options.nonull&&!n.length&&n.push(t),n};E.match=ge;var at=/[?*]|[+@!]\(.*?\)|\[|\]/,me=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),C=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){R(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||ht,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...i)=>console.error(...i)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let r=this.globParts.map((i,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=i[0]===""&&i[1]===""&&(i[2]==="?"||!at.test(i[2]))&&!at.test(i[3]),f=/^[a-z]:/i.test(i[0]);if(h)return[...i.slice(0,4),...i.slice(4).map(u=>this.parse(u))];if(f)return[i[0],...i.slice(1).map(u=>this.parse(u))]}return i.map(h=>this.parse(h))});if(this.debug(this.pattern,r),this.set=r.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i<this.set.length;i++){let o=this.set[i];o[0]===""&&o[1]===""&&this.globParts[i][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let r=0;r<t[s].length;r++)t[s][r]==="**"&&(t[s][r]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let r=s;for(;e[r+1]==="**";)r++;r!==s&&e.splice(s,r-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,r)=>{let i=s[s.length-1];return r==="**"&&i==="**"?s:r===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(s.pop(),s):(s.push(r),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let i=t[r];r===1&&i===""&&t[0]===""||(i==="."||i==="")&&(e=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let r=t[s-1];r&&r!=="."&&r!==".."&&r!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let r=-1;for(;(r=s.indexOf("**",r+1))!==-1;){let o=r;for(;s[o+1]==="**";)o++;o>r&&s.splice(r+1,o-r);let l=s[r+1],h=s[r+2],f=s[r+3];if(l!==".."||!h||h==="."||h===".."||!f||f==="."||f==="..")continue;e=!0,s.splice(r,1);let u=s.slice(0);u[r]="**",t.push(u),r--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let l=s[o];o===1&&l===""&&s[0]===""||(l==="."||l==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let i=0;for(;(i=s.indexOf("..",i+1))!==-1;){let o=s[i-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let h=i===1&&s[i+1]==="**"?["."]:[];s.splice(i-1,2,...h),s.length===0&&s.push(""),i-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let r=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(r){t[e]=[],t[s]=r;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let r=0,i=0,o=[],l="";for(;r<t.length&&i<e.length;)if(t[r]===e[i])o.push(l==="b"?e[i]:t[r]),r++,i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(l==="b")return!1;l="a",o.push(t[r]),r++,i++}else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(l==="a")return!1;l="b",o.push(e[i]),r++,i++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let r=this.options;if(this.isWindows){let d=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),S=!d&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),w=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),x=!w&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),y=S?3:d?0:void 0,m=x?3:w?0:void 0;if(typeof y=="number"&&typeof m=="number"){let[b,$]=[t[y],e[m]];b.toLowerCase()===$.toLowerCase()&&(e[m]=b,m>y?e=e.slice(m):y>m&&(t=t.slice(y)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var o=0,l=0,h=t.length,f=e.length;o<h&&l<f;o++,l++){this.debug("matchOne loop");var u=e[l],g=t[o];if(this.debug(e,u,g),u===!1)return!1;if(u===M){this.debug("GLOBSTAR",[e,u,g]);var a=o,c=l+1;if(c===f){for(this.debug("** at the end");o<h;o++)if(t[o]==="."||t[o]===".."||!r.dot&&t[o].charAt(0)===".")return!1;return!0}for(;a<h;){var p=t[a];if(this.debug(`
|
|
2
|
+
import"./chunk-OBH7XN5N.js";import{a as U}from"./chunk-JBABAK44.js";import{a as I,b as J}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var G=(n,t,e)=>{let s=n instanceof RegExp?Z(n,e):n,r=t instanceof RegExp?Z(t,e):t,i=s!==null&&r!=null&&wt(s,r,e);return i&&{start:i[0],end:i[1],pre:e.slice(0,i[0]),body:e.slice(i[0]+s.length,i[1]),post:e.slice(i[1]+r.length)}},Z=(n,t)=>{let e=t.match(n);return e?e[0]:null},wt=(n,t,e)=>{let s,r,i,o,l,h=e.indexOf(n),f=e.indexOf(t,h+1),u=h;if(h>=0&&f>0){if(n===t)return[h,f];for(s=[],i=e.length;u>=0&&!l;){if(u===h)s.push(u),h=e.indexOf(n,u+1);else if(s.length===1){let g=s.pop();g!==void 0&&(l=[g,f])}else r=s.pop(),r!==void 0&&r<i&&(i=r,o=f),f=e.indexOf(t,u+1);u=h<f&&h>=0?h:f}s.length&&o!==void 0&&(l=[i,o])}return l};var K="\0SLASH"+Math.random()+"\0",V="\0OPEN"+Math.random()+"\0",F="\0CLOSE"+Math.random()+"\0",X="\0COMMA"+Math.random()+"\0",Y="\0PERIOD"+Math.random()+"\0",St=new RegExp(K,"g"),xt=new RegExp(V,"g"),$t=new RegExp(F,"g"),bt=new RegExp(X,"g"),Et=new RegExp(Y,"g"),At=/\\\\/g,Tt=/\\{/g,Mt=/\\}/g,vt=/\\,/g,Pt=/\\./g;function B(n){return isNaN(n)?n.charCodeAt(0):parseInt(n,10)}function Nt(n){return n.replace(At,K).replace(Tt,V).replace(Mt,F).replace(vt,X).replace(Pt,Y)}function Ot(n){return n.replace(St,"\\").replace(xt,"{").replace($t,"}").replace(bt,",").replace(Et,".")}function Q(n){if(!n)return[""];let t=[],e=G("{","}",n);if(!e)return n.split(",");let{pre:s,body:r,post:i}=e,o=s.split(",");o[o.length-1]+="{"+r+"}";let l=Q(i);return i.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}function tt(n){return n?(n.slice(0,2)==="{}"&&(n="\\{\\}"+n.slice(2)),z(Nt(n),!0).map(Ot)):[]}function Ct(n){return"{"+n+"}"}function Dt(n){return/^-?0\d/.test(n)}function zt(n,t){return n<=t}function Rt(n,t){return n>=t}function z(n,t){let e=[],s=G("{","}",n);if(!s)return[n];let r=s.pre,i=s.post.length?z(s.post,!1):[""];if(/\$$/.test(s.pre))for(let o=0;o<i.length;o++){let l=r+"{"+s.body+"}"+i[o];e.push(l)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),h=o||l,f=s.body.indexOf(",")>=0;if(!h&&!f)return s.post.match(/,(?!,).*\}/)?(n=s.pre+"{"+s.body+F+s.post,z(n)):[n];let u;if(h)u=s.body.split(/\.\./);else if(u=Q(s.body),u.length===1&&u[0]!==void 0&&(u=z(u[0],!1).map(Ct),u.length===1))return i.map(a=>s.pre+u[0]+a);let g;if(h&&u[0]!==void 0&&u[1]!==void 0){let a=B(u[0]),c=B(u[1]),p=Math.max(u[0].length,u[1].length),d=u.length===3&&u[2]!==void 0?Math.abs(B(u[2])):1,S=zt;c<a&&(d*=-1,S=Rt);let x=u.some(Dt);g=[];for(let y=a;S(y,c);y+=d){let m;if(l)m=String.fromCharCode(y),m==="\\"&&(m="");else if(m=String(y),x){let b=p-m.length;if(b>0){let $=new Array(b+1).join("0");y<0?m="-"+$+m.slice(1):m=$+m}}g.push(m)}}else{g=[];for(let a=0;a<u.length;a++)g.push.apply(g,z(u[a],!1))}for(let a=0;a<g.length;a++)for(let c=0;c<i.length;c++){let p=r+g[a]+i[c];(!t||h||p)&&e.push(p)}}return e}var R=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var Wt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},W=n=>n.replace(/[[\]\\-]/g,"\\$&"),jt=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),et=n=>n.join(""),st=(n,t)=>{let e=t;if(n.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],r=[],i=e+1,o=!1,l=!1,h=!1,f=!1,u=e,g="";t:for(;i<n.length;){let d=n.charAt(i);if((d==="!"||d==="^")&&i===e+1){f=!0,i++;continue}if(d==="]"&&o&&!h){u=i+1;break}if(o=!0,d==="\\"&&!h){h=!0,i++;continue}if(d==="["&&!h){for(let[S,[w,x,y]]of Object.entries(Wt))if(n.startsWith(S,i)){if(g)return["$.",!1,n.length-e,!0];i+=S.length,y?r.push(w):s.push(w),l=l||x;continue t}}if(h=!1,g){d>g?s.push(W(g)+"-"+W(d)):d===g&&s.push(W(d)),g="",i++;continue}if(n.startsWith("-]",i+1)){s.push(W(d+"-")),i+=2;continue}if(n.startsWith("-",i+1)){g=d,i+=2;continue}s.push(W(d)),i++}if(u<i)return["",!1,0,!1];if(!s.length&&!r.length)return["$.",!1,n.length-e,!0];if(r.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!f){let d=s[0].length===2?s[0].slice(-1):s[0];return[jt(d),!1,u-e,!1]}let a="["+(f?"^":"")+et(s)+"]",c="["+(f?"":"^")+et(r)+"]";return[s.length&&r.length?"("+a+"|"+c+")":s.length?a:c,l,u-e,!0]};var v=(n,{windowsPathsNoEscape:t=!1,magicalBraces:e=!0}={})=>e?t?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?n.replace(/\[([^\/\\{}])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var Lt=new Set(["!","?","+","*","@"]),nt=n=>Lt.has(n),kt="(?!(?:^|/)\\.\\.?(?:$|/))",j="(?!\\.)",Gt=new Set(["[","."]),Bt=new Set(["..","."]),Ft=new Set("().*{}+?[]^$\\!"),_t=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_="[^/]",it=_+"*?",rt=_+"+?",O=class n{type;#s;#n;#r=!1;#t=[];#e;#o;#c;#a=!1;#i;#l;#u=!1;constructor(t,e,s={}){this.type=t,t&&(this.#n=!0),this.#e=e,this.#s=this.#e?this.#e.#s:this,this.#i=this.#s===this?s:this.#s.#i,this.#c=this.#s===this?[]:this.#s.#c,t==="!"&&!this.#s.#a&&this.#c.push(this),this.#o=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#l=this.#t.map(t=>String(t)).join("")}#p(){if(this!==this.#s)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let t;for(;t=this.#c.pop();){if(t.type!=="!")continue;let e=t,s=e.#e;for(;s;){for(let r=e.#o+1;!s.type&&r<s.#t.length;r++)for(let i of t.#t){if(typeof i=="string")throw new Error("string part in extglob AST??");i.copyIn(s.#t[r])}e=s,s=e.#e}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof n&&e.#e===this))throw new Error("invalid part: "+e);this.#t.push(e)}}toJSON(){let t=this.type===null?this.#t.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#t.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#s||this.#s.#a&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#s===this)return!0;if(!this.#e?.isStart())return!1;if(this.#o===0)return!0;let t=this.#e;for(let e=0;e<this.#o;e++){let s=t.#t[e];if(!(s instanceof n&&s.type==="!"))return!1}return!0}isEnd(){if(this.#s===this||this.#e?.type==="!")return!0;if(!this.#e?.isEnd())return!1;if(!this.type)return this.#e?.isEnd();let t=this.#e?this.#e.#t.length:0;return this.#o===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new n(this.type,t);for(let s of this.#t)e.copyIn(s);return e}static#h(t,e,s,r){let i=!1,o=!1,l=-1,h=!1;if(e.type===null){let c=s,p="";for(;c<t.length;){let d=t.charAt(c++);if(i||d==="\\"){i=!i,p+=d;continue}if(o){c===l+1?(d==="^"||d==="!")&&(h=!0):d==="]"&&!(c===l+2&&h)&&(o=!1),p+=d;continue}else if(d==="["){o=!0,l=c,h=!1,p+=d;continue}if(!r.noext&&nt(d)&&t.charAt(c)==="("){e.push(p),p="";let S=new n(d,e);c=n.#h(t,S,c,r),e.push(S);continue}p+=d}return e.push(p),c}let f=s+1,u=new n(null,e),g=[],a="";for(;f<t.length;){let c=t.charAt(f++);if(i||c==="\\"){i=!i,a+=c;continue}if(o){f===l+1?(c==="^"||c==="!")&&(h=!0):c==="]"&&!(f===l+2&&h)&&(o=!1),a+=c;continue}else if(c==="["){o=!0,l=f,h=!1,a+=c;continue}if(nt(c)&&t.charAt(f)==="("){u.push(a),a="";let p=new n(c,u);u.push(p),f=n.#h(t,p,f,r);continue}if(c==="|"){u.push(a),a="",g.push(u),u=new n(null,e);continue}if(c===")")return a===""&&e.#t.length===0&&(e.#u=!0),u.push(a),a="",e.push(...g,u),f;a+=c}return e.type=null,e.#n=void 0,e.#t=[t.substring(s-1)],f}static fromGlob(t,e={}){let s=new n(null,void 0,e);return n.#h(t,s,0,e),s}toMMPattern(){if(this!==this.#s)return this.#s.toMMPattern();let t=this.toString(),[e,s,r,i]=this.toRegExpSource();if(!(r||this.#n||this.#i.nocase&&!this.#i.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let l=(this.#i.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${e}$`,l),{_src:e,_glob:t})}get options(){return this.#i}toRegExpSource(t){let e=t??!!this.#i.dot;if(this.#s===this&&this.#p(),!this.type){let h=this.isStart()&&this.isEnd()&&!this.#t.some(c=>typeof c!="string"),f=this.#t.map(c=>{let[p,d,S,w]=typeof c=="string"?n.#d(c,this.#n,h):c.toRegExpSource(t);return this.#n=this.#n||S,this.#r=this.#r||w,p}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Bt.has(this.#t[0]))){let p=Gt,d=e&&p.has(f.charAt(0))||f.startsWith("\\.")&&p.has(f.charAt(2))||f.startsWith("\\.\\.")&&p.has(f.charAt(4)),S=!e&&!t&&p.has(f.charAt(0));u=d?kt:S?j:""}let g="";return this.isEnd()&&this.#s.#a&&this.#e?.type==="!"&&(g="(?:$|\\/)"),[u+f+g,v(f),this.#n=!!this.#n,this.#r]}let s=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",i=this.#f(e);if(this.isStart()&&this.isEnd()&&!i&&this.type!=="!"){let h=this.toString();return this.#t=[h],this.type=null,this.#n=void 0,[h,v(this.toString()),!1,!1]}let o=!s||t||e||!j?"":this.#f(!0);o===i&&(o=""),o&&(i=`(?:${i})(?:${o})*?`);let l="";if(this.type==="!"&&this.#u)l=(this.isStart()&&!e?j:"")+rt;else{let h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?j:"")+it+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=r+i+h}return[l,v(i),this.#n=!!this.#n,this.#r]}#f(t){return this.#t.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,r,i,o]=e.toRegExpSource(t);return this.#r=this.#r||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#d(t,e,s=!1){let r=!1,i="",o=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(r){r=!1,i+=(Ft.has(h)?"\\":"")+h;continue}if(h==="\\"){l===t.length-1?i+="\\\\":r=!0;continue}if(h==="["){let[f,u,g,a]=st(t,l);if(g){i+=f,o=o||u,l+=g-1,e=e||a;continue}}if(h==="*"){i+=s&&t==="*"?rt:it,e=!0;continue}if(h==="?"){i+=_,e=!0;continue}i+=_t(h)}return[i,v(t),!!e,o]}};var q=(n,{windowsPathsNoEscape:t=!1,magicalBraces:e=!1}={})=>e?t?n.replace(/[?*()[\]{}]/g,"[$&]"):n.replace(/[?*()[\]\\{}]/g,"\\$&"):t?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var E=(n,t,e={})=>(R(t),!e.nocomment&&t.charAt(0)==="#"?!1:new C(t,e).match(n)),qt=/^\*+([^+@!?\*\[\(]*)$/,Ht=n=>t=>!t.startsWith(".")&&t.endsWith(n),It=n=>t=>t.endsWith(n),Jt=n=>(n=n.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(n)),Ut=n=>(n=n.toLowerCase(),t=>t.toLowerCase().endsWith(n)),Zt=/^\*+\.\*+$/,Kt=n=>!n.startsWith(".")&&n.includes("."),Vt=n=>n!=="."&&n!==".."&&n.includes("."),Xt=/^\.\*+$/,Yt=n=>n!=="."&&n!==".."&&n.startsWith("."),Qt=/^\*+$/,te=n=>n.length!==0&&!n.startsWith("."),ee=n=>n.length!==0&&n!=="."&&n!=="..",se=/^\?+([^+@!?\*\[\(]*)?$/,ne=([n,t=""])=>{let e=ct([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},ie=([n,t=""])=>{let e=lt([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},re=([n,t=""])=>{let e=lt([n]);return t?s=>e(s)&&s.endsWith(t):e},oe=([n,t=""])=>{let e=ct([n]);return t?s=>e(s)&&s.endsWith(t):e},ct=([n])=>{let t=n.length;return e=>e.length===t&&!e.startsWith(".")},lt=([n])=>{let t=n.length;return e=>e.length===t&&e!=="."&&e!==".."},ht=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ot={win32:{sep:"\\"},posix:{sep:"/"}},ae=ht==="win32"?ot.win32.sep:ot.posix.sep;E.sep=ae;var M=Symbol("globstar **");E.GLOBSTAR=M;var ce="[^/]",le=ce+"*?",he="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ue="(?:(?!(?:\\/|^)\\.).)*?",fe=(n,t={})=>e=>E(e,n,t);E.filter=fe;var T=(n,t={})=>Object.assign({},n,t),pe=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return E;let t=E;return Object.assign((s,r,i={})=>t(s,r,T(n,i)),{Minimatch:class extends t.Minimatch{constructor(r,i={}){super(r,T(n,i))}static defaults(r){return t.defaults(T(n,r)).Minimatch}},AST:class extends t.AST{constructor(r,i,o={}){super(r,i,T(n,o))}static fromGlob(r,i={}){return t.AST.fromGlob(r,T(n,i))}},unescape:(s,r={})=>t.unescape(s,T(n,r)),escape:(s,r={})=>t.escape(s,T(n,r)),filter:(s,r={})=>t.filter(s,T(n,r)),defaults:s=>t.defaults(T(n,s)),makeRe:(s,r={})=>t.makeRe(s,T(n,r)),braceExpand:(s,r={})=>t.braceExpand(s,T(n,r)),match:(s,r,i={})=>t.match(s,r,T(n,i)),sep:t.sep,GLOBSTAR:M})};E.defaults=pe;var ut=(n,t={})=>(R(n),t.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:tt(n));E.braceExpand=ut;var de=(n,t={})=>new C(n,t).makeRe();E.makeRe=de;var ge=(n,t,e={})=>{let s=new C(t,e);return n=n.filter(r=>s.match(r)),s.options.nonull&&!n.length&&n.push(t),n};E.match=ge;var at=/[?*]|[+@!]\(.*?\)|\[|\]/,me=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),C=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){R(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||ht,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...i)=>console.error(...i)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let r=this.globParts.map((i,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=i[0]===""&&i[1]===""&&(i[2]==="?"||!at.test(i[2]))&&!at.test(i[3]),f=/^[a-z]:/i.test(i[0]);if(h)return[...i.slice(0,4),...i.slice(4).map(u=>this.parse(u))];if(f)return[i[0],...i.slice(1).map(u=>this.parse(u))]}return i.map(h=>this.parse(h))});if(this.debug(this.pattern,r),this.set=r.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i<this.set.length;i++){let o=this.set[i];o[0]===""&&o[1]===""&&this.globParts[i][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let r=0;r<t[s].length;r++)t[s][r]==="**"&&(t[s][r]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let r=s;for(;e[r+1]==="**";)r++;r!==s&&e.splice(s,r-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,r)=>{let i=s[s.length-1];return r==="**"&&i==="**"?s:r===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(s.pop(),s):(s.push(r),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let i=t[r];r===1&&i===""&&t[0]===""||(i==="."||i==="")&&(e=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let r=t[s-1];r&&r!=="."&&r!==".."&&r!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let r=-1;for(;(r=s.indexOf("**",r+1))!==-1;){let o=r;for(;s[o+1]==="**";)o++;o>r&&s.splice(r+1,o-r);let l=s[r+1],h=s[r+2],f=s[r+3];if(l!==".."||!h||h==="."||h===".."||!f||f==="."||f==="..")continue;e=!0,s.splice(r,1);let u=s.slice(0);u[r]="**",t.push(u),r--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let l=s[o];o===1&&l===""&&s[0]===""||(l==="."||l==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let i=0;for(;(i=s.indexOf("..",i+1))!==-1;){let o=s[i-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let h=i===1&&s[i+1]==="**"?["."]:[];s.splice(i-1,2,...h),s.length===0&&s.push(""),i-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let r=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(r){t[e]=[],t[s]=r;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let r=0,i=0,o=[],l="";for(;r<t.length&&i<e.length;)if(t[r]===e[i])o.push(l==="b"?e[i]:t[r]),r++,i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(l==="b")return!1;l="a",o.push(t[r]),r++,i++}else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(l==="a")return!1;l="b",o.push(e[i]),r++,i++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let r=this.options;if(this.isWindows){let d=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),S=!d&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),w=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),x=!w&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),y=S?3:d?0:void 0,m=x?3:w?0:void 0;if(typeof y=="number"&&typeof m=="number"){let[b,$]=[t[y],e[m]];b.toLowerCase()===$.toLowerCase()&&(e[m]=b,m>y?e=e.slice(m):y>m&&(t=t.slice(y)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var o=0,l=0,h=t.length,f=e.length;o<h&&l<f;o++,l++){this.debug("matchOne loop");var u=e[l],g=t[o];if(this.debug(e,u,g),u===!1)return!1;if(u===M){this.debug("GLOBSTAR",[e,u,g]);var a=o,c=l+1;if(c===f){for(this.debug("** at the end");o<h;o++)if(t[o]==="."||t[o]===".."||!r.dot&&t[o].charAt(0)===".")return!1;return!0}for(;a<h;){var p=t[a];if(this.debug(`
|
|
3
3
|
globstar while`,t,a,e,c,p),this.matchOne(t.slice(a),e.slice(c),s))return this.debug("globstar found match!",a,h,p),!0;if(p==="."||p===".."||!r.dot&&p.charAt(0)==="."){this.debug("dot detected!",t,a,e,c);break}this.debug("globstar swallow a segment, and continue"),a++}return!!(s&&(this.debug(`
|
|
4
4
|
>>> no match, partial?`,t,a,e,c),a===h))}let d;if(typeof u=="string"?(d=g===u,this.debug("string match",u,g,d)):(d=u.test(g),this.debug("pattern match",u,g,d)),!d)return!1}if(o===h&&l===f)return!0;if(o===h)return s;if(l===f)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return ut(this.pattern,this.options)}parse(t){R(t);let e=this.options;if(t==="**")return M;if(t==="")return"";let s,r=null;(s=t.match(Qt))?r=e.dot?ee:te:(s=t.match(qt))?r=(e.nocase?e.dot?Ut:Jt:e.dot?It:Ht)(s[1]):(s=t.match(se))?r=(e.nocase?e.dot?ie:ne:e.dot?re:oe)(s):(s=t.match(Zt))?r=e.dot?Vt:Kt:(s=t.match(Xt))&&(r=Yt);let i=O.fromGlob(t,this.options).toMMPattern();return r&&typeof i=="object"&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?le:e.dot?he:ue,r=new Set(e.nocase?["i"]:[]),i=t.map(h=>{let f=h.map(g=>{if(g instanceof RegExp)for(let a of g.flags.split(""))r.add(a);return typeof g=="string"?me(g):g===M?M:g._src});f.forEach((g,a)=>{let c=f[a+1],p=f[a-1];g!==M||p===M||(p===void 0?c!==void 0&&c!==M?f[a+1]="(?:\\/|"+s+"\\/)?"+c:f[a]=s:c===void 0?f[a-1]=p+"(?:\\/|\\/"+s+")?":c!==M&&(f[a-1]=p+"(?:\\/|\\/"+s+"\\/)"+c,f[a+1]=M))});let u=f.filter(g=>g!==M);if(this.partial&&u.length>=1){let g=[];for(let a=1;a<=u.length;a++)g.push(u.slice(0,a).join("/"));return"(?:"+g.join("|")+")"}return u.join("/")}).join("|"),[o,l]=t.length>1?["(?:",")"]:["",""];i="^"+o+i+l+"$",this.partial&&(i="^(?:\\/|"+o+i.slice(1,-1)+l+")$"),this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let i=this.set;this.debug(this.pattern,"set",i);let o=r[r.length-1];if(!o)for(let l=r.length-2;!o&&l>=0;l--)o=r[l];for(let l=0;l<i.length;l++){let h=i[l],f=r;if(s.matchBase&&h.length===1&&(f=[o]),this.matchOne(f,h,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return E.defaults(t).Minimatch}};E.AST=O;E.Minimatch=C;E.escape=q;E.unescape=v;function L(n){if(n<1024)return String(n);if(n<1024*1024){let e=n/1024;return e<10?`${e.toFixed(1)}K`:`${Math.round(e)}K`}if(n<1024*1024*1024){let e=n/1048576;return e<10?`${e.toFixed(1)}M`:`${Math.round(e)}M`}let t=n/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function k(n){let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n.getMonth()],s=String(n.getDate()).padStart(2," "),r=new Date,i=new Date(r.getTime()-4320*60*60*1e3);if(n>i){let l=String(n.getHours()).padStart(2,"0"),h=String(n.getMinutes()).padStart(2,"0");return`${e} ${s} ${l}:${h}`}let o=n.getFullYear();return`${e} ${s} ${o}`}var ye={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},we={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},Ie={name:"ls",async execute(n,t){if(J(n))return I(ye);let e=U("ls",n,we);if(!e.ok)return e.error;let s=e.result.flags.showAll,r=e.result.flags.showAlmostAll,i=e.result.flags.longFormat,o=e.result.flags.humanReadable,l=e.result.flags.recursive,h=e.result.flags.reverse,f=e.result.flags.sortBySize,u=e.result.flags.directoryOnly,g=e.result.flags.sortByTime;e.result.flags.onePerLine;let a=e.result.positional;a.length===0&&a.push(".");let c="",p="",d=0;for(let S=0;S<a.length;S++){let w=a[S];if(S>0&&c&&!c.endsWith(`
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-JBABAK44.js";import{a as l}from"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var g={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},y={name:"mkdir",async execute(u,o){let e=a("mkdir",u,g);if(!e.ok)return e.error;let m=e.result.flags.recursive,f=e.result.flags.verbose,n=e.result.positional;if(n.length===0)return{stdout:"",stderr:`mkdir: missing operand
|
|
3
3
|
`,exitCode:1};let c="",t="",d=0;for(let r of n)try{let i=o.fs.resolvePath(o.cwd,r);await o.fs.mkdir(i,{recursive:m}),f&&(c+=`mkdir: created directory '${r}'
|
|
4
4
|
`)}catch(i){let s=l(i);s.includes("ENOENT")||s.includes("no such file")?t+=`mkdir: cannot create directory '${r}': No such file or directory
|
|
5
5
|
`:s.includes("EEXIST")||s.includes("already exists")?t+=`mkdir: cannot create directory '${r}': File exists
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as y}from"./chunk-
|
|
2
|
+
import{a as y}from"./chunk-JBABAK44.js";import{a as $}from"./chunk-4VDEBYW7.js";import{a as g,b as u}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var C={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},P={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},O={name:"mv",async execute(m,t){if(u(m))return g(C);let s=y("mv",m,P);if(!s.ok)return s.error;let p=s.result.flags.force,d=s.result.flags.noClobber,w=s.result.flags.verbose,l=s.result.positional;if(d&&(p=!1),l.length<2)return{stdout:"",stderr:`mv: missing destination file operand
|
|
3
3
|
`,exitCode:1};let r=l.pop()??"",v=l,n=t.fs.resolvePath(t.cwd,r),h="",c="",b=0,a=!1;try{a=(await t.fs.stat(n)).isDirectory}catch{}if(v.length>1&&!a)return{stdout:"",stderr:`mv: target '${r}' is not a directory
|
|
4
4
|
`,exitCode:1};for(let e of v)try{let f=t.fs.resolvePath(t.cwd,e),o=n;if(a){let i=e.split("/").pop()||e;o=n==="/"?`/${i}`:`${n}/${i}`}if(d)try{await t.fs.stat(o);continue}catch{}if(await t.fs.mv(f,o),w){let i=a?`${r}/${e.split("/").pop()||e}`:r;h+=`renamed '${e}' -> '${i}'
|
|
5
5
|
`}}catch(f){let o=$(f);o.includes("ENOENT")||o.includes("no such file")?c+=`mv: cannot stat '${e}': No such file or directory
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as g}from"./chunk-
|
|
2
|
+
import{a as g}from"./chunk-JBABAK44.js";import{a as c,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var L={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},x={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},P={name:"paste",async execute(s,i){if(m(s))return c(L);let n=g("paste",s,x);if(!n.ok)return n.error;let l=n.result.flags.delimiter,d=n.result.flags.serial,p=n.result.positional;if(p.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ...
|
|
3
3
|
`,exitCode:1};let a=i.stdin?i.stdin.split(`
|
|
4
4
|
`):[""];a.length>0&&a[a.length-1]===""&&a.pop();let I=p.filter(e=>e==="-").length,f=[],u=0;for(let e of p)if(e==="-"){let t=[];for(let o=u;o<a.length;o+=I)t.push(a[o]);f.push(t),u++}else{let t=i.fs.resolvePath(i.cwd,e);try{let r=(await i.fs.readFile(t)).split(`
|
|
5
5
|
`);r.length>0&&r[r.length-1]===""&&r.pop(),f.push(r)}catch{return{stdout:"",stderr:`paste: ${e}: No such file or directory
|
|
@@ -4,7 +4,7 @@ import{a as A,c as W}from"./chunk-D5WP4CKS.js";import{a as D}from"./chunk-4VDEBY
|
|
|
4
4
|
`,exitCode:2};let r=null,e=0;for(;e<t.length;){let c=t[e];if(c==="--"){e++;break}if(c==="-v"){if(e+1>=t.length)return{stdout:"",stderr:`printf: -v: option requires an argument
|
|
5
5
|
`,exitCode:1};if(r=t[e+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(\[[^\]]+\])?$/.test(r))return{stdout:"",stderr:`printf: \`${r}': not a valid identifier
|
|
6
6
|
`,exitCode:2};e+=2}else{if(c.startsWith("-")&&c!=="-")break;break}}if(e>=t.length)return{stdout:"",stderr:`printf: usage: printf format [arguments]
|
|
7
|
-
`,exitCode:1};let s=t[e],n=t.slice(e+1);try{let c=W(s),o="",u=0,l=!1,i="",h=a.env.TZ;do{let{result:d,argsConsumed:p,error:f,errMsg:m,stopped:y}=K(c,n,u,h);if(o+=d,u+=p,f&&(l=!0,m&&(i=m)),y)break}while(u<n.length&&u>0);if(u===0&&n.length>0,r){let d=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(d){let p=d[1],f=d[3];f=f.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(m,y)=>a.env
|
|
7
|
+
`,exitCode:1};let s=t[e],n=t.slice(e+1);try{let c=W(s),o="",u=0,l=!1,i="",h=a.env.get("TZ");do{let{result:d,argsConsumed:p,error:f,errMsg:m,stopped:y}=K(c,n,u,h);if(o+=d,u+=p,f&&(l=!0,m&&(i=m)),y)break}while(u<n.length&&u>0);if(u===0&&n.length>0,r){let d=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(d){let p=d[1],f=d[3];f=f.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(m,y)=>a.env.get(y)??""),a.env.set(`${p}_${f}`,o)}else a.env.set(r,o);return{stdout:"",stderr:i,exitCode:l?1:0}}return{stdout:o,stderr:i,exitCode:l?1:0}}catch(c){return{stdout:"",stderr:`printf: ${D(c)}
|
|
8
8
|
`,exitCode:1}}}};function K(t,a,r,e){let s="",n=0,c=0,o=!1,u="";for(;n<t.length;)if(t[n]==="%"&&n+1<t.length){let l=n;if(n++,t[n]==="%"){s+="%",n++;continue}let i=t.slice(l).match(/^%(-?\d*)(?:\.(\d+))?\(([^)]*)\)T/);if(i){let w=i[1]?parseInt(i[1],10):0,E=i[2]?parseInt(i[2],10):-1,J=i[3],Y=i[0],v=a[r+c]||"";c++;let M;v===""||v==="-1"||v==="-2"?M=Math.floor(Date.now()/1e3):M=parseInt(v,10)||0;let x=P(J,M,e);if(E>=0&&x.length>E&&(x=x.slice(0,E)),w!==0){let F=Math.abs(w);x.length<F&&(w<0?x=x.padEnd(F," "):x=x.padStart(F," "))}s+=x,n=l+Y.length;continue}for(;n<t.length&&"+-0 #'".includes(t[n]);)n++;let h=!1;if(t[n]==="*")h=!0,n++;else for(;n<t.length&&/\d/.test(t[n]);)n++;let d=!1;if(t[n]===".")if(n++,t[n]==="*")d=!0,n++;else for(;n<t.length&&/\d/.test(t[n]);)n++;n<t.length&&"hlL".includes(t[n])&&n++;let p=t[n]||"";n++;let m=t.slice(l,n);if(h){let w=parseInt(a[r+c]||"0",10);c++,m=m.replace("*",String(w))}if(d){let w=parseInt(a[r+c]||"0",10);c++,m=m.replace(".*",`.${w}`)}let y=a[r+c]||"";c++;let{value:k,parseError:$,parseErrMsg:S,stopped:U}=ee(m,p,y);if(s+=k,$&&(o=!0,S&&(u=S)),U)return{result:s,argsConsumed:c,error:o,errMsg:u,stopped:!0}}else s+=t[n],n++;return{result:s,argsConsumed:c,error:o,errMsg:u,stopped:!1}}function ee(t,a,r){let e=!1,s="";switch(a){case"d":case"i":{let n=I(r);return e=g,e&&(s=`printf: ${r}: invalid number
|
|
9
9
|
`),{value:Z(t,n),parseError:e,parseErrMsg:s}}case"o":{let n=I(r);return e=g,e&&(s=`printf: ${r}: invalid number
|
|
10
10
|
`),{value:te(t,n),parseError:e,parseErrMsg:s}}case"u":{let n=I(r);e=g,e&&(s=`printf: ${r}: invalid number
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as y,b as D}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{fileURLToPath as
|
|
2
|
+
import{a as C}from"./chunk-4PRVMER6.js";import{a as y,b as D}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{fileURLToPath as L}from"node:url";import{Worker as N}from"node:worker_threads";var a={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200},n={PENDING:0,READY:1,SUCCESS:2,ERROR:3},u={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},i={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},p={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},R={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},h={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function O(){return new SharedArrayBuffer(p.TOTAL)}var w=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return Atomics.load(this.int32View,i.OP_CODE/4)}setOpCode(t){Atomics.store(this.int32View,i.OP_CODE/4,t)}getStatus(){return Atomics.load(this.int32View,i.STATUS/4)}setStatus(t){Atomics.store(this.int32View,i.STATUS/4,t)}getPathLength(){return Atomics.load(this.int32View,i.PATH_LENGTH/4)}setPathLength(t){Atomics.store(this.int32View,i.PATH_LENGTH/4,t)}getDataLength(){return Atomics.load(this.int32View,i.DATA_LENGTH/4)}setDataLength(t){Atomics.store(this.int32View,i.DATA_LENGTH/4,t)}getResultLength(){return Atomics.load(this.int32View,i.RESULT_LENGTH/4)}setResultLength(t){Atomics.store(this.int32View,i.RESULT_LENGTH/4,t)}getErrorCode(){return Atomics.load(this.int32View,i.ERROR_CODE/4)}setErrorCode(t){Atomics.store(this.int32View,i.ERROR_CODE/4,t)}getFlags(){return Atomics.load(this.int32View,i.FLAGS/4)}setFlags(t){Atomics.store(this.int32View,i.FLAGS/4,t)}getMode(){return Atomics.load(this.int32View,i.MODE/4)}setMode(t){Atomics.store(this.int32View,i.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(i.PATH_BUFFER,i.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>p.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${p.PATH_BUFFER}`);this.uint8View.set(e,i.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setData(t){if(t.length>p.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setResult(t){if(t.length>p.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[i.DATA_BUFFER+h.IS_FILE]=t.isFile?1:0,this.uint8View[i.DATA_BUFFER+h.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[i.DATA_BUFFER+h.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(i.DATA_BUFFER+h.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(i.DATA_BUFFER+h.SIZE,e,!0),this.dataView.setFloat64(i.DATA_BUFFER+h.MTIME,t.mtime.getTime(),!0),this.setResultLength(h.TOTAL)}decodeStat(){return{isFile:this.uint8View[i.DATA_BUFFER+h.IS_FILE]===1,isDirectory:this.uint8View[i.DATA_BUFFER+h.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[i.DATA_BUFFER+h.IS_SYMLINK]===1,mode:this.dataView.getInt32(i.DATA_BUFFER+h.MODE,!0),size:this.dataView.getFloat64(i.DATA_BUFFER+h.SIZE,!0),mtime:new Date(this.dataView.getFloat64(i.DATA_BUFFER+h.MTIME,!0))}}waitForReady(t){return Atomics.wait(this.int32View,i.STATUS/4,n.PENDING,t)}waitForReadyAsync(t){return Atomics.waitAsync(this.int32View,i.STATUS/4,n.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getStatus();if(s===n.READY)return!0;let o=Date.now()-e;if(o>=t)return!1;let l=t-o,d=Atomics.waitAsync(this.int32View,i.STATUS/4,s,l);if(d.async&&await d.value==="timed-out")return!1}}waitForResult(t){return Atomics.wait(this.int32View,i.STATUS/4,n.READY,t)}notify(){return Atomics.notify(this.int32View,i.STATUS/4)}reset(){this.setOpCode(a.NOOP),this.setStatus(n.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(u.NONE),this.setFlags(R.NONE),this.setMode(0)}};var A=class{fs;cwd;secureFetch;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};constructor(t,e,s,o=void 0){this.fs=e,this.cwd=s,this.secureFetch=o,this.protocol=new w(t)}async run(t){this.running=!0;let e=Date.now();for(;this.running;){let s=Date.now()-e;if(s>=t){this.output.stderr+=`
|
|
3
3
|
python3: execution timeout exceeded
|
|
4
4
|
`,this.output.exitCode=124;break}let o=t-s;if(!await this.protocol.waitUntilReady(o)){this.output.stderr+=`
|
|
5
5
|
python3: execution timeout exceeded
|
|
6
|
-
`,this.output.exitCode=124;break}let d=this.protocol.getOpCode();await this.handleOperation(d),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case a.READ_FILE:await this.handleReadFile();break;case a.WRITE_FILE:await this.handleWriteFile();break;case a.STAT:await this.handleStat();break;case a.LSTAT:await this.handleLstat();break;case a.READDIR:await this.handleReaddir();break;case a.MKDIR:await this.handleMkdir();break;case a.RM:await this.handleRm();break;case a.EXISTS:await this.handleExists();break;case a.APPEND_FILE:await this.handleAppendFile();break;case a.SYMLINK:await this.handleSymlink();break;case a.READLINK:await this.handleReadlink();break;case a.CHMOD:await this.handleChmod();break;case a.REALPATH:await this.handleRealpath();break;case a.WRITE_STDOUT:this.handleWriteStdout();break;case a.WRITE_STDERR:this.handleWriteStderr();break;case a.EXIT:this.handleExit();break;case a.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setStatus(n.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return t.startsWith("/mnt/host/")?t.slice(9):t.startsWith("/mnt/host")?t.slice(9)||"/":this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&R.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setStatus(n.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&R.RECURSIVE)!==0,o=(e&R.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:o}),this.protocol.setStatus(n.SUCCESS)}catch(l){this.setErrorFromException(l)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setStatus(n.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}handleWriteStdout(){let t=this.protocol.getDataAsString();this.output.stdout+=t,this.protocol.setStatus(n.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();this.output.stderr+=t,this.protocol.setStatus(n.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.output.exitCode=t,this.protocol.setStatus(n.SUCCESS),this.running=!1}async handleHttpRequest(){if(!this.secureFetch){this.protocol.setErrorCode(u.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(n.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},o=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),l=JSON.stringify({status:o.status,statusText:o.statusText,headers:o.headers,body:o.body,url:o.url});this.protocol.setResultFromString(l),this.protocol.setStatus(n.SUCCESS)}catch(s){let o=s instanceof Error?s.message:String(s);this.protocol.setErrorCode(u.NETWORK_ERROR),this.protocol.setResultFromString(o),this.protocol.setStatus(n.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=u.IO_ERROR,o=e.toLowerCase();o.includes("no such file")||o.includes("not found")||o.includes("enoent")?s=u.NOT_FOUND:o.includes("is a directory")||o.includes("eisdir")?s=u.IS_DIRECTORY:o.includes("not a directory")||o.includes("enotdir")?s=u.NOT_DIRECTORY:o.includes("already exists")||o.includes("eexist")?s=u.EXISTS:(o.includes("permission")||o.includes("eperm")||o.includes("eacces"))&&(s=u.PERMISSION_DENIED),this.protocol.setErrorCode(s),this.protocol.setResultFromString(e),this.protocol.setStatus(n.ERROR)}};var
|
|
6
|
+
`,this.output.exitCode=124;break}let d=this.protocol.getOpCode();await this.handleOperation(d),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case a.READ_FILE:await this.handleReadFile();break;case a.WRITE_FILE:await this.handleWriteFile();break;case a.STAT:await this.handleStat();break;case a.LSTAT:await this.handleLstat();break;case a.READDIR:await this.handleReaddir();break;case a.MKDIR:await this.handleMkdir();break;case a.RM:await this.handleRm();break;case a.EXISTS:await this.handleExists();break;case a.APPEND_FILE:await this.handleAppendFile();break;case a.SYMLINK:await this.handleSymlink();break;case a.READLINK:await this.handleReadlink();break;case a.CHMOD:await this.handleChmod();break;case a.REALPATH:await this.handleRealpath();break;case a.WRITE_STDOUT:this.handleWriteStdout();break;case a.WRITE_STDERR:this.handleWriteStderr();break;case a.EXIT:this.handleExit();break;case a.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setStatus(n.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return t.startsWith("/mnt/host/")?t.slice(9):t.startsWith("/mnt/host")?t.slice(9)||"/":this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&R.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setStatus(n.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&R.RECURSIVE)!==0,o=(e&R.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:o}),this.protocol.setStatus(n.SUCCESS)}catch(l){this.setErrorFromException(l)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setStatus(n.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}handleWriteStdout(){let t=this.protocol.getDataAsString();this.output.stdout+=t,this.protocol.setStatus(n.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();this.output.stderr+=t,this.protocol.setStatus(n.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.output.exitCode=t,this.protocol.setStatus(n.SUCCESS),this.running=!1}async handleHttpRequest(){if(!this.secureFetch){this.protocol.setErrorCode(u.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(n.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},o=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),l=JSON.stringify({status:o.status,statusText:o.statusText,headers:o.headers,body:o.body,url:o.url});this.protocol.setResultFromString(l),this.protocol.setStatus(n.SUCCESS)}catch(s){let o=s instanceof Error?s.message:String(s);this.protocol.setErrorCode(u.NETWORK_ERROR),this.protocol.setResultFromString(o),this.protocol.setStatus(n.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=u.IO_ERROR,o=e.toLowerCase();o.includes("no such file")||o.includes("not found")||o.includes("enoent")?s=u.NOT_FOUND:o.includes("is a directory")||o.includes("eisdir")?s=u.IS_DIRECTORY:o.includes("not a directory")||o.includes("enotdir")?s=u.NOT_DIRECTORY:o.includes("already exists")||o.includes("eexist")?s=u.EXISTS:(o.includes("permission")||o.includes("eperm")||o.includes("eacces"))&&(s=u.PERMISSION_DENIED),this.protocol.setErrorCode(s),this.protocol.setResultFromString(e),this.protocol.setStatus(n.ERROR)}};var V=3e4,k={name:"python3",summary:"Execute Python code via Pyodide",usage:"python3 [OPTIONS] [-c CODE | -m MODULE | FILE] [ARGS...]",description:["Execute Python code using Pyodide (Python compiled to WebAssembly).","","This command runs Python in a sandboxed environment with access to","the virtual filesystem. Only Pyodide-bundled packages are available."],options:["-c CODE Execute CODE as Python script","-m MODULE Run library module as a script","--version Show Python version","--help Show this help"],examples:['python3 -c "print(1 + 2)"','python3 -c "import sys; print(sys.version)"',"python3 script.py","python3 script.py arg1 arg2",`echo 'print("hello")' | python3`],notes:["Pyodide runs in WebAssembly, so execution may be slower than native Python.","Only packages bundled with Pyodide are available (no pip install).","First execution loads Pyodide (~30MB), subsequent calls are faster.","Maximum execution time is 30 seconds by default."]};function M(r){let t={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(r.length===0)return t;let e=r.findIndex(s=>!s.startsWith("-")||s==="-"||s==="--");for(let s=0;s<(e===-1?r.length:e);s++){let o=r[s];if(o==="-c")return s+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
|
|
7
7
|
`,exitCode:2}:(t.code=r[s+1],t.scriptArgs=r.slice(s+2),t);if(o==="-m")return s+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'm'
|
|
8
8
|
`,exitCode:2}:(t.module=r[s+1],t.scriptArgs=r.slice(s+2),t);if(o==="--version"||o==="-V")return t.showVersion=!0,t;if(o.startsWith("-")&&o!=="-")return{stdout:"",stderr:`python3: unrecognized option '${o}'
|
|
9
|
-
`,exitCode:2}}if(e!==-1){let s=r[e];s==="--"?e+1<r.length&&(t.scriptFile=r[e+1],t.scriptArgs=r.slice(e+2)):(t.scriptFile=s,t.scriptArgs=r.slice(e+1))}return t}var c=null,F=null,S=[],E=null,
|
|
10
|
-
`,exitCode:m.exitCode||1}:m}var
|
|
9
|
+
`,exitCode:2}}if(e!==-1){let s=r[e];s==="--"?e+1<r.length&&(t.scriptFile=r[e+1],t.scriptArgs=r.slice(e+2)):(t.scriptFile=s,t.scriptArgs=r.slice(e+1))}return t}var c=null,F=null,S=[],E=null,b=L(new URL("./worker.js",import.meta.url));function _(){if(E||S.length===0)return;let r=S.shift();if(!r)return;E=r,B().postMessage(E.input)}function B(){return F&&(clearTimeout(F),F=null),c||(c=new N(b),c.on("message",r=>{E&&(E.resolve(r),E=null),S.length>0?_():v()}),c.on("error",r=>{E&&(E.resolve({success:!1,error:r.message}),E=null);for(let t of S)t.resolve({success:!1,error:"Worker crashed"});S.length=0,c=null}),c.on("exit",()=>{c=null}),c)}function v(){F=setTimeout(()=>{c&&!E&&S.length===0&&(c.terminate(),c=null)},5e3)}async function H(r,t,e,s=[]){let o=O(),l=new A(o,t.fs,t.cwd,t.fetch),d=t.limits?.maxPythonTimeoutMs??V,f={sharedBuffer:o,pythonCode:r,cwd:t.cwd,env:C(t.env),args:s,scriptPath:e},P=new Promise(T=>{let I=setTimeout(()=>{T({success:!1,error:`Execution timeout: exceeded ${d}ms limit`})},d),U=x=>{clearTimeout(I),T(x)};S.push({input:f,resolve:U}),_()}),[m,g]=await Promise.all([l.run(d),P.catch(T=>({success:!1,error:T.message}))]);return!g.success&&g.error?{stdout:m.stdout,stderr:`${m.stderr}python3: ${g.error}
|
|
10
|
+
`,exitCode:m.exitCode||1}:m}var W={name:"python3",async execute(r,t){if(D(r))return y(k);let e=M(r);if("exitCode"in e)return e;if(e.showVersion)return{stdout:`Python 3.12.1 (Pyodide)
|
|
11
11
|
`,stderr:"",exitCode:0};let s,o;if(e.code!==null)s=e.code,o="-c";else if(e.module!==null)s=`import runpy; runpy.run_module('${e.module}', run_name='__main__')`,o=e.module;else if(e.scriptFile!==null){let l=t.fs.resolvePath(t.cwd,e.scriptFile);if(!await t.fs.exists(l))return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': [Errno 2] No such file or directory
|
|
12
12
|
`,exitCode:2};try{s=await t.fs.readFile(l),o=e.scriptFile}catch(d){return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': ${d.message}
|
|
13
13
|
`,exitCode:2}}}else if(t.stdin.trim())s=t.stdin,o="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
|
|
14
|
-
`,exitCode:2};return
|
|
14
|
+
`,exitCode:2};return H(s,t,o,e.scriptArgs)}},Z={name:"python",async execute(r,t){return W.execute(r,t)}};export{W as python3Command,Z as pythonCommand};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as z,b as B,c as E}from"./chunk-GANRM5LO.js";import{a as $}from"./chunk-SE4C7FJY.js";import{a as _,b as A,c as D}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var G={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:[]}},M=class{types;constructor(){this.types=new Map(Object.entries(G).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($(`^${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($(`^${l}$`,"i").test(t))return!0}else if(n===r.toLowerCase())return!0}return!1}};function U(){let e=[];for(let[t,n]of Object.entries(G).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 q(){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 Q(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 ee(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
|
|
5
|
+
`,exitCode:1}}function V(e){return null}var Z=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:V},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:V},{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:Q,validate:ee},{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}],te={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}},se=new Set(["n","--line-number"]);function ne(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function re(e,t,n){let s=e[t];for(let r of Z){if(s.startsWith(`--${r.long}=`)){let l=s.slice(`--${r.long}=`.length),i=O(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=O(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=O(n,r,l);return i?{newIndex:t+1,error:i}:{newIndex:t+1}}}return null}function ie(e){return Z.find(t=>t.short===e)}function O(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 le(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 oe(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 ae(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function H(e){let t=q(),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=oe(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 d=ae(a);if(d!==null){t.maxCount=d;continue}let m=re(e,c,t);if(m){if(m.error)return{success:!1,error:m.error};c=m.newIndex;continue}let g=le(e,c);if(g){t.sort=g.value,c=g.newIndex;continue}let w=a.startsWith("--")?[a]:a.slice(1).split(""),p=!1;for(let f of w){if(se.has(f)){t.lineNumber=!0,o=!0;continue}if(f==="u"||f==="--unrestricted"){ne(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=ie(f);if(b){if(c+1>=e.length)return{success:!1,error:D("rg",`-${f}`)};let h=O(t,b,e[c+1]);if(h)return{success:!1,error:h};c++,p=!0;continue}}let x=te[f];if(x){x(t);continue}if(f.startsWith("--"))return{success:!1,error:D("rg",f)};if(f.length===1)return{success:!1,error:D("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 ce}from"node:zlib";var k=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+="(?:/.*)?$",$(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}},T=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 k(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 k(t);i.parse(l),this.parsers.push(i)}catch{}}}addPatternsFromContent(t,n){let s=new k(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 L(e,t,n=!1,s=!1,r=[]){let l=new T(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 fe(e){return e.length>=2&&e[0]===31&&e[1]===139}function ue(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 J(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=ue(x);if(b)return{stdout:"",stderr:`${b}
|
|
8
|
+
`,exitCode:1}}if(n.files){let f=[...n.patterns,...s];return me(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=he(n,l),c,a;try{let f=ge(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 L(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let d=new M;for(let f of n.typeClear)d.clearType(f);for(let f of n.typeAdd)d.addType(f);let{files:m,singleExplicitFile:g}=await Y(t,i,n,u,d);if(m.length===0)return{stdout:"",stderr:"",exitCode:1};let w=!n.noFilename&&(n.withFilename||!g||m.length>1),p=n.lineNumber;return r||(g&&m.length===1&&(p=!1),n.onlyMatching&&(p=!1)),xe(t,m,c,n,w,p,a)}function he(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function ge(e,t,n){let s;return e.length===1?s=e[0]:s=e.map(r=>t.fixedStrings?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${r})`).join("|"),B(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 Y(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 d=await e.fs.stat(u);if(d.isFile){if(i++,n.maxFilesize>0&&d.size>n.maxFilesize)continue;X(a,n,s,u,r)&&l.push(a)}else d.isDirectory&&(o++,await K(e,a,u,0,n,s,r,l))}catch{}}return{files:n.sort==="path"?l.sort():l,singleExplicitFile:i===1&&o===0}}async function K(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&&T.isCommonIgnored(u))continue;let d=u.startsWith("."),m=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,g=e.fs.resolvePath(n,u),w,p,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,p=y.isDirectory}catch{continue}else w=h.isFile,p=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,p=y.isDirectory}catch{continue}if(!l?.matches(g,p)&&!(d&&!r.hidden&&!l?.isWhitelisted(g,p))){if(p)await K(e,m,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}X(m,r,l,g,i)&&o.push(m)}}}}catch{}}}function X(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+="$",$(s,n?"i":"").test(e)}async function me(e,t,n){let s=null;n.noIgnore||(s=await L(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let r=new M;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 Y(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(fe(i))try{let o=ce(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 xe(e,t,n,s,r,l,i){let o="",c=!1,a=[],u=0,d=0,m=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:W}=F;if(m+=C.length,W&&!s.searchBinary)return null;let N=r&&!s.heading?h:"",S=z(C,n,{invertMatch:s.invertMatch,showLineNumbers:l,countOnly:s.count,countMatches:s.countMatches,filename:N,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?E(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,d++,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 W=C.split(`
|
|
14
|
+
`);n.lastIndex=0;let N=0;for(let S=0;S<W.length;S++){let j=W[S];n.lastIndex=0;let P=[];for(let I=n.exec(j);I!==null;I=n.exec(j)){let R={match:{text:I[0]},start:I.index,end:I.index+I[0].length};s.replace!==null&&(R.replacement={text:s.replace}),P.push(R),I[0].length===0&&n.lastIndex++}if(P.length>0){let I={type:"match",data:{path:{text:y},lines:{text:`${j}
|
|
15
|
+
`},line_number:S+1,absolute_offset:N,submatches:P}};a.push(JSON.stringify(I))}N+=j.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:d,bytes_searched:m,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`,`${d} files contained matches`,`${t.length} files searched`,`${m} bytes searched`].join(`
|
|
21
|
+
`);w+=`${f}
|
|
22
|
+
`}let p;return s.filesWithoutMatch?p=o.length>0?0:1:p=c?0:1,{stdout:w,stderr:"",exitCode:p}}var ye={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"]},Re={name:"rg",async execute(e,t){if(A(e))return _(ye);if(e.includes("--type-list"))return{stdout:U(),stderr:"",exitCode:0};let n=H(e);return n.success?J({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}};export{Re as rgCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as u}from"./chunk-
|
|
2
|
+
import{a as u}from"./chunk-JBABAK44.js";import{a as m}from"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var v={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},y={name:"rm",async execute(d,s){let e=u("rm",d,v);if(!e.ok)return e.error;let a=e.result.flags.recursive||e.result.flags.recursiveUpper,c=e.result.flags.force,p=e.result.flags.verbose,l=e.result.positional;if(l.length===0)return c?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
|
|
3
3
|
`,exitCode:1};let f="",t="",i=0;for(let r of l)try{let n=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(n)).isDirectory&&!a){t+=`rm: cannot remove '${r}': Is a directory
|
|
4
4
|
`,i=1;continue}await s.fs.rm(n,{recursive:a,force:c}),p&&(f+=`removed '${r}'
|
|
5
5
|
`)}catch(n){if(!c){let o=m(n);o.includes("ENOENT")||o.includes("no such file")?t+=`rm: cannot remove '${r}': No such file or directory
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as p}from"./chunk-
|
|
2
|
+
import{a as p}from"./chunk-JBABAK44.js";import{a as g}from"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var x=`Usage: rmdir [-pv] DIRECTORY...
|
|
3
3
|
Remove empty directories.
|
|
4
4
|
|
|
5
5
|
Options:
|