@eidos.space/just-bash 3.0.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/CHANGELOG.md +53 -0
- package/LICENSE +201 -0
- package/README.md +609 -0
- package/dist/AGENTS.md +325 -0
- package/dist/Bash.d.ts +257 -0
- package/dist/ast/types.d.ts +609 -0
- package/dist/banned-patterns-test.d.ts +1 -0
- package/dist/bin/chunks/alias-YRVAW27Y.js +3 -0
- package/dist/bin/chunks/awk2-RLMNTGI7.js +3 -0
- package/dist/bin/chunks/base64-RZRLGMB3.js +3 -0
- package/dist/bin/chunks/basename-F3AQ4KAQ.js +3 -0
- package/dist/bin/chunks/bash-CLP24TE2.js +3 -0
- package/dist/bin/chunks/cat-LQH5FSAR.js +3 -0
- package/dist/bin/chunks/chmod-S564JCJW.js +3 -0
- package/dist/bin/chunks/chunk-22HCD466.js +3 -0
- package/dist/bin/chunks/chunk-2AIXTPH2.js +9 -0
- package/dist/bin/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/chunks/chunk-2GG3NVC4.js +10 -0
- package/dist/bin/chunks/chunk-2NRAWO6E.js +7 -0
- package/dist/bin/chunks/chunk-2SVX7I5P.js +14 -0
- package/dist/bin/chunks/chunk-3BYTCO2H.js +12 -0
- package/dist/bin/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/chunks/chunk-3UKQXBQ3.js +6 -0
- package/dist/bin/chunks/chunk-3WIMLJM7.js +8 -0
- package/dist/bin/chunks/chunk-47WZ2U6M.js +9 -0
- package/dist/bin/chunks/chunk-4KSZJAQK.js +6 -0
- package/dist/bin/chunks/chunk-5XSZHUEI.js +15 -0
- package/dist/bin/chunks/chunk-6FSBHK6H.js +22 -0
- package/dist/bin/chunks/chunk-6WJQNLR2.js +7 -0
- package/dist/bin/chunks/chunk-77MLOOQS.js +11 -0
- package/dist/bin/chunks/chunk-7AYT3UKI.js +6 -0
- package/dist/bin/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/chunks/chunk-7NC4CPHS.js +20 -0
- package/dist/bin/chunks/chunk-7UU7KPEM.js +7 -0
- package/dist/bin/chunks/chunk-7VCQWCSH.js +15 -0
- package/dist/bin/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/chunks/chunk-ALVEEXFD.js +19 -0
- package/dist/bin/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/chunks/chunk-BE4PARL3.js +13 -0
- package/dist/bin/chunks/chunk-BGX3RW7H.js +10 -0
- package/dist/bin/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/chunks/chunk-BPZJYOUA.js +33 -0
- package/dist/bin/chunks/chunk-BZP56QBM.js +24 -0
- package/dist/bin/chunks/chunk-C7ISPH7Y.js +18 -0
- package/dist/bin/chunks/chunk-CAZ75E7E.js +3 -0
- package/dist/bin/chunks/chunk-D6CPXGKK.js +75 -0
- package/dist/bin/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/chunks/chunk-EDTBGO7F.js +37 -0
- package/dist/bin/chunks/chunk-F3GKANW3.js +12 -0
- package/dist/bin/chunks/chunk-F3WNDKOC.js +3 -0
- package/dist/bin/chunks/chunk-FKVQZWJQ.js +10 -0
- package/dist/bin/chunks/chunk-FOUVACI7.js +16 -0
- package/dist/bin/chunks/chunk-FVRXEJYQ.js +141 -0
- package/dist/bin/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/chunks/chunk-H7JTIXAO.js +4 -0
- package/dist/bin/chunks/chunk-HL4ZS7TX.js +6 -0
- package/dist/bin/chunks/chunk-HN2DCT7T.js +13 -0
- package/dist/bin/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/chunks/chunk-IEXQTXU5.js +34 -0
- package/dist/bin/chunks/chunk-IZGLHVBB.js +8 -0
- package/dist/bin/chunks/chunk-J7TUF2VI.js +9 -0
- package/dist/bin/chunks/chunk-JNUX75OX.js +85 -0
- package/dist/bin/chunks/chunk-JXLDT4KX.js +4 -0
- package/dist/bin/chunks/chunk-JZW7NFK2.js +288 -0
- package/dist/bin/chunks/chunk-KFMPGSUT.js +9 -0
- package/dist/bin/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/chunks/chunk-KRRM5UCC.js +3 -0
- package/dist/bin/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/chunks/chunk-L24QXM5S.js +34 -0
- package/dist/bin/chunks/chunk-LAHBP3FW.js +11 -0
- package/dist/bin/chunks/chunk-LC6D27QJ.js +3 -0
- package/dist/bin/chunks/chunk-LNNWMRCB.js +3 -0
- package/dist/bin/chunks/chunk-LNVSXNT7.js +3 -0
- package/dist/bin/chunks/chunk-LSQTB2QK.js +7 -0
- package/dist/bin/chunks/chunk-M65CQLJE.js +101 -0
- package/dist/bin/chunks/chunk-MLUOPG3W.js +3 -0
- package/dist/bin/chunks/chunk-MNWK4UIM.js +22 -0
- package/dist/bin/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/chunks/chunk-N6YW4W3Z.js +29 -0
- package/dist/bin/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/chunks/chunk-NXVG64T3.js +22 -0
- package/dist/bin/chunks/chunk-NYIPFY36.js +3 -0
- package/dist/bin/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/chunks/chunk-OPMLWMNH.js +17 -0
- package/dist/bin/chunks/chunk-PAYQNSZN.js +18 -0
- package/dist/bin/chunks/chunk-PBOVSFTJ.js +3 -0
- package/dist/bin/chunks/chunk-PXP4YYZA.js +13 -0
- package/dist/bin/chunks/chunk-PZQVSQX6.js +4 -0
- package/dist/bin/chunks/chunk-Q2GOPGDA.js +6 -0
- package/dist/bin/chunks/chunk-Q4UMTSRO.js +15 -0
- package/dist/bin/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/chunks/chunk-SMSELHIY.js +12 -0
- package/dist/bin/chunks/chunk-UGJM7CKP.js +17 -0
- package/dist/bin/chunks/chunk-UO5LOD7U.js +12 -0
- package/dist/bin/chunks/chunk-UOMNSQEZ.js +10 -0
- package/dist/bin/chunks/chunk-UR4CEP4Y.js +3 -0
- package/dist/bin/chunks/chunk-V2RP73X4.js +15 -0
- package/dist/bin/chunks/chunk-VBDLSL7Y.js +10 -0
- package/dist/bin/chunks/chunk-VZK4FHWJ.js +3 -0
- package/dist/bin/chunks/chunk-WDWNEHHE.js +9 -0
- package/dist/bin/chunks/chunk-X4MX6EHF.js +6 -0
- package/dist/bin/chunks/chunk-XBB73LFB.js +5 -0
- package/dist/bin/chunks/chunk-XFFUAO3F.js +3 -0
- package/dist/bin/chunks/chunk-XHCCSVP6.js +9 -0
- package/dist/bin/chunks/chunk-XJ37N3S5.js +7 -0
- package/dist/bin/chunks/chunk-XPTYN6UE.js +8 -0
- package/dist/bin/chunks/chunk-XRUDFQG5.js +7 -0
- package/dist/bin/chunks/chunk-Y4FPH5DQ.js +64 -0
- package/dist/bin/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/chunks/chunk-YOKQNNQO.js +6 -0
- package/dist/bin/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/chunks/chunk-YY5PJR7O.js +7 -0
- package/dist/bin/chunks/chunk-ZFUVUYWG.js +15 -0
- package/dist/bin/chunks/clear-FGNEKYDU.js +3 -0
- package/dist/bin/chunks/column-AQB3A3PJ.js +3 -0
- package/dist/bin/chunks/comm-Q4VDF6ZO.js +3 -0
- package/dist/bin/chunks/cp-HYXTMN3D.js +3 -0
- package/dist/bin/chunks/curl-PLHETP4J.js +27 -0
- package/dist/bin/chunks/cut-ZI2HIAW7.js +3 -0
- package/dist/bin/chunks/date-JEZYSA4F.js +3 -0
- package/dist/bin/chunks/diff-YDJ42RKS.js +3 -0
- package/dist/bin/chunks/dirname-VCINTLPD.js +3 -0
- package/dist/bin/chunks/du-4LRQIGRG.js +3 -0
- package/dist/bin/chunks/echo-KCOHTNDF.js +3 -0
- package/dist/bin/chunks/env-NY32PQJM.js +3 -0
- package/dist/bin/chunks/expand-YYSO35NS.js +3 -0
- package/dist/bin/chunks/expansion-PPP6PD75.js +3 -0
- package/dist/bin/chunks/expr-7PLWSWZI.js +3 -0
- package/dist/bin/chunks/file-GRZLWDVH.js +3 -0
- package/dist/bin/chunks/find-P4DOE7CE.js +3 -0
- package/dist/bin/chunks/flag-coverage-RFKIBJ6L.js +3 -0
- package/dist/bin/chunks/fold-5MF7QZWQ.js +3 -0
- package/dist/bin/chunks/grep-VAYCFO4O.js +3 -0
- package/dist/bin/chunks/gzip-UGBQQKIH.js +3 -0
- package/dist/bin/chunks/head-QNC2ZYDO.js +3 -0
- package/dist/bin/chunks/help-CGUEOGXQ.js +3 -0
- package/dist/bin/chunks/history-AQQWW3QB.js +3 -0
- package/dist/bin/chunks/hostname-USNWOQCK.js +3 -0
- package/dist/bin/chunks/html-to-markdown-QEFY7XQR.js +3 -0
- package/dist/bin/chunks/join-EJ73DYTK.js +3 -0
- package/dist/bin/chunks/jq-GGTKKMEN.js +3 -0
- package/dist/bin/chunks/js-exec-BC6NI55L.js +98 -0
- package/dist/bin/chunks/js-exec-worker.js +4443 -0
- package/dist/bin/chunks/ln-LP4HMCSM.js +3 -0
- package/dist/bin/chunks/ls-KBNHNZWQ.js +3 -0
- package/dist/bin/chunks/md5sum-MCVDIB35.js +3 -0
- package/dist/bin/chunks/mkdir-P4DKRCDX.js +3 -0
- package/dist/bin/chunks/mv-QQK4FQX6.js +3 -0
- package/dist/bin/chunks/nl-KUPLVCTS.js +3 -0
- package/dist/bin/chunks/od-YQ5ZUI2H.js +3 -0
- package/dist/bin/chunks/paste-A5KKPWXX.js +3 -0
- package/dist/bin/chunks/printf-Z5C2UOI5.js +3 -0
- package/dist/bin/chunks/pwd-FCNDA467.js +3 -0
- package/dist/bin/chunks/python3-BQWDPUBM.js +13 -0
- package/dist/bin/chunks/readlink-25V57VOL.js +3 -0
- package/dist/bin/chunks/rev-PYHOZ4D4.js +3 -0
- package/dist/bin/chunks/rg-BGFMSIVK.js +3 -0
- package/dist/bin/chunks/rm-ECNUFR66.js +3 -0
- package/dist/bin/chunks/rmdir-DLOHIA7Q.js +3 -0
- package/dist/bin/chunks/sed-FWA634SN.js +3 -0
- package/dist/bin/chunks/seq-UXDJE6FB.js +3 -0
- package/dist/bin/chunks/sha1sum-4KF52U3Y.js +3 -0
- package/dist/bin/chunks/sha256sum-6YEPULPX.js +3 -0
- package/dist/bin/chunks/sleep-QHAPNY3Q.js +3 -0
- package/dist/bin/chunks/sort-4C6WOKNK.js +3 -0
- package/dist/bin/chunks/split-TV7NL7LA.js +3 -0
- package/dist/bin/chunks/sqlite3-W777NCI4.js +3 -0
- package/dist/bin/chunks/sqlite3-worker.js +1728 -0
- package/dist/bin/chunks/stat-BD6KT3BP.js +3 -0
- package/dist/bin/chunks/strings-MDD72LR6.js +3 -0
- package/dist/bin/chunks/tac-C2N4NQ6S.js +3 -0
- package/dist/bin/chunks/tail-BCB5W6JC.js +3 -0
- package/dist/bin/chunks/tar-DOO744MK.js +3 -0
- package/dist/bin/chunks/tee-UQHPO4OW.js +3 -0
- package/dist/bin/chunks/time-ZPY52VT2.js +3 -0
- package/dist/bin/chunks/timeout-5AX3ZS3X.js +3 -0
- package/dist/bin/chunks/touch-DFGSVIX7.js +3 -0
- package/dist/bin/chunks/tr-G7K6M6HP.js +3 -0
- package/dist/bin/chunks/tree-6D7SMPUR.js +3 -0
- package/dist/bin/chunks/true-SKL4L7JP.js +3 -0
- package/dist/bin/chunks/unexpand-QIR4EDPG.js +3 -0
- package/dist/bin/chunks/uniq-I7PVFJR4.js +3 -0
- package/dist/bin/chunks/wc-6NGWULAP.js +3 -0
- package/dist/bin/chunks/which-LCXKCLFC.js +3 -0
- package/dist/bin/chunks/whoami-TZDZDU7T.js +3 -0
- package/dist/bin/chunks/worker.js +3150 -0
- package/dist/bin/chunks/xan-KX4VPXUN.js +3 -0
- package/dist/bin/chunks/xan-view-JXOZLJ7S.js +3 -0
- package/dist/bin/chunks/xargs-UWHPYLY7.js +3 -0
- package/dist/bin/chunks/yq-GCDCJBKB.js +3 -0
- package/dist/bin/just-bash.js +755 -0
- package/dist/bin/shell/chunks/alias-YRVAW27Y.js +3 -0
- package/dist/bin/shell/chunks/awk2-RLMNTGI7.js +3 -0
- package/dist/bin/shell/chunks/base64-RZRLGMB3.js +3 -0
- package/dist/bin/shell/chunks/basename-F3AQ4KAQ.js +3 -0
- package/dist/bin/shell/chunks/bash-CLP24TE2.js +3 -0
- package/dist/bin/shell/chunks/cat-LQH5FSAR.js +3 -0
- package/dist/bin/shell/chunks/chmod-S564JCJW.js +3 -0
- package/dist/bin/shell/chunks/chunk-22HCD466.js +3 -0
- package/dist/bin/shell/chunks/chunk-2AIXTPH2.js +9 -0
- package/dist/bin/shell/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/shell/chunks/chunk-2GG3NVC4.js +10 -0
- package/dist/bin/shell/chunks/chunk-2NRAWO6E.js +7 -0
- package/dist/bin/shell/chunks/chunk-2SVX7I5P.js +14 -0
- package/dist/bin/shell/chunks/chunk-3BYTCO2H.js +12 -0
- package/dist/bin/shell/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/shell/chunks/chunk-3UKQXBQ3.js +6 -0
- package/dist/bin/shell/chunks/chunk-3WIMLJM7.js +8 -0
- package/dist/bin/shell/chunks/chunk-47WZ2U6M.js +9 -0
- package/dist/bin/shell/chunks/chunk-4KSZJAQK.js +6 -0
- package/dist/bin/shell/chunks/chunk-5XSZHUEI.js +15 -0
- package/dist/bin/shell/chunks/chunk-6FSBHK6H.js +22 -0
- package/dist/bin/shell/chunks/chunk-6WJQNLR2.js +7 -0
- package/dist/bin/shell/chunks/chunk-77MLOOQS.js +11 -0
- package/dist/bin/shell/chunks/chunk-7AYT3UKI.js +6 -0
- package/dist/bin/shell/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/shell/chunks/chunk-7NC4CPHS.js +20 -0
- package/dist/bin/shell/chunks/chunk-7UU7KPEM.js +7 -0
- package/dist/bin/shell/chunks/chunk-7VCQWCSH.js +15 -0
- package/dist/bin/shell/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/shell/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/shell/chunks/chunk-ALVEEXFD.js +19 -0
- package/dist/bin/shell/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/shell/chunks/chunk-BE4PARL3.js +13 -0
- package/dist/bin/shell/chunks/chunk-BGX3RW7H.js +10 -0
- package/dist/bin/shell/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/shell/chunks/chunk-BPZJYOUA.js +33 -0
- package/dist/bin/shell/chunks/chunk-BZP56QBM.js +24 -0
- package/dist/bin/shell/chunks/chunk-C7ISPH7Y.js +18 -0
- package/dist/bin/shell/chunks/chunk-CAZ75E7E.js +3 -0
- package/dist/bin/shell/chunks/chunk-D6CPXGKK.js +75 -0
- package/dist/bin/shell/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/shell/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/shell/chunks/chunk-EDTBGO7F.js +37 -0
- package/dist/bin/shell/chunks/chunk-F3GKANW3.js +12 -0
- package/dist/bin/shell/chunks/chunk-F3WNDKOC.js +3 -0
- package/dist/bin/shell/chunks/chunk-FKVQZWJQ.js +10 -0
- package/dist/bin/shell/chunks/chunk-FOUVACI7.js +16 -0
- package/dist/bin/shell/chunks/chunk-FVRXEJYQ.js +141 -0
- package/dist/bin/shell/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/shell/chunks/chunk-H7JTIXAO.js +4 -0
- package/dist/bin/shell/chunks/chunk-HL4ZS7TX.js +6 -0
- package/dist/bin/shell/chunks/chunk-HN2DCT7T.js +13 -0
- package/dist/bin/shell/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/shell/chunks/chunk-IEXQTXU5.js +34 -0
- package/dist/bin/shell/chunks/chunk-IZGLHVBB.js +8 -0
- package/dist/bin/shell/chunks/chunk-J7TUF2VI.js +9 -0
- package/dist/bin/shell/chunks/chunk-JNUX75OX.js +85 -0
- package/dist/bin/shell/chunks/chunk-JXLDT4KX.js +4 -0
- package/dist/bin/shell/chunks/chunk-JZW7NFK2.js +288 -0
- package/dist/bin/shell/chunks/chunk-KFMPGSUT.js +9 -0
- package/dist/bin/shell/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/shell/chunks/chunk-KRRM5UCC.js +3 -0
- package/dist/bin/shell/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/shell/chunks/chunk-L24QXM5S.js +34 -0
- package/dist/bin/shell/chunks/chunk-LAHBP3FW.js +11 -0
- package/dist/bin/shell/chunks/chunk-LC6D27QJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-LNNWMRCB.js +3 -0
- package/dist/bin/shell/chunks/chunk-LNVSXNT7.js +3 -0
- package/dist/bin/shell/chunks/chunk-LSQTB2QK.js +7 -0
- package/dist/bin/shell/chunks/chunk-M65CQLJE.js +101 -0
- package/dist/bin/shell/chunks/chunk-MLUOPG3W.js +3 -0
- package/dist/bin/shell/chunks/chunk-MNWK4UIM.js +22 -0
- package/dist/bin/shell/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/shell/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/shell/chunks/chunk-N6YW4W3Z.js +29 -0
- package/dist/bin/shell/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/shell/chunks/chunk-NXVG64T3.js +22 -0
- package/dist/bin/shell/chunks/chunk-NYIPFY36.js +3 -0
- package/dist/bin/shell/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/shell/chunks/chunk-OPMLWMNH.js +17 -0
- package/dist/bin/shell/chunks/chunk-PAYQNSZN.js +18 -0
- package/dist/bin/shell/chunks/chunk-PBOVSFTJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-PXP4YYZA.js +13 -0
- package/dist/bin/shell/chunks/chunk-PZQVSQX6.js +4 -0
- package/dist/bin/shell/chunks/chunk-Q2GOPGDA.js +6 -0
- package/dist/bin/shell/chunks/chunk-Q4UMTSRO.js +15 -0
- package/dist/bin/shell/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/shell/chunks/chunk-SMSELHIY.js +12 -0
- package/dist/bin/shell/chunks/chunk-UGJM7CKP.js +17 -0
- package/dist/bin/shell/chunks/chunk-UO5LOD7U.js +12 -0
- package/dist/bin/shell/chunks/chunk-UOMNSQEZ.js +10 -0
- package/dist/bin/shell/chunks/chunk-UR4CEP4Y.js +3 -0
- package/dist/bin/shell/chunks/chunk-V2RP73X4.js +15 -0
- package/dist/bin/shell/chunks/chunk-VBDLSL7Y.js +10 -0
- package/dist/bin/shell/chunks/chunk-VZK4FHWJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-WDWNEHHE.js +9 -0
- package/dist/bin/shell/chunks/chunk-X4MX6EHF.js +6 -0
- package/dist/bin/shell/chunks/chunk-XBB73LFB.js +5 -0
- package/dist/bin/shell/chunks/chunk-XFFUAO3F.js +3 -0
- package/dist/bin/shell/chunks/chunk-XHCCSVP6.js +9 -0
- package/dist/bin/shell/chunks/chunk-XJ37N3S5.js +7 -0
- package/dist/bin/shell/chunks/chunk-XPTYN6UE.js +8 -0
- package/dist/bin/shell/chunks/chunk-XRUDFQG5.js +7 -0
- package/dist/bin/shell/chunks/chunk-Y4FPH5DQ.js +64 -0
- package/dist/bin/shell/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/shell/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/shell/chunks/chunk-YOKQNNQO.js +6 -0
- package/dist/bin/shell/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/shell/chunks/chunk-YY5PJR7O.js +7 -0
- package/dist/bin/shell/chunks/chunk-ZFUVUYWG.js +15 -0
- package/dist/bin/shell/chunks/clear-FGNEKYDU.js +3 -0
- package/dist/bin/shell/chunks/column-AQB3A3PJ.js +3 -0
- package/dist/bin/shell/chunks/comm-Q4VDF6ZO.js +3 -0
- package/dist/bin/shell/chunks/cp-HYXTMN3D.js +3 -0
- package/dist/bin/shell/chunks/curl-PLHETP4J.js +27 -0
- package/dist/bin/shell/chunks/cut-ZI2HIAW7.js +3 -0
- package/dist/bin/shell/chunks/date-JEZYSA4F.js +3 -0
- package/dist/bin/shell/chunks/diff-YDJ42RKS.js +3 -0
- package/dist/bin/shell/chunks/dirname-VCINTLPD.js +3 -0
- package/dist/bin/shell/chunks/du-4LRQIGRG.js +3 -0
- package/dist/bin/shell/chunks/echo-KCOHTNDF.js +3 -0
- package/dist/bin/shell/chunks/env-NY32PQJM.js +3 -0
- package/dist/bin/shell/chunks/expand-YYSO35NS.js +3 -0
- package/dist/bin/shell/chunks/expansion-PPP6PD75.js +3 -0
- package/dist/bin/shell/chunks/expr-7PLWSWZI.js +3 -0
- package/dist/bin/shell/chunks/file-GRZLWDVH.js +3 -0
- package/dist/bin/shell/chunks/find-P4DOE7CE.js +3 -0
- package/dist/bin/shell/chunks/flag-coverage-RFKIBJ6L.js +3 -0
- package/dist/bin/shell/chunks/fold-5MF7QZWQ.js +3 -0
- package/dist/bin/shell/chunks/grep-VAYCFO4O.js +3 -0
- package/dist/bin/shell/chunks/gzip-UGBQQKIH.js +3 -0
- package/dist/bin/shell/chunks/head-QNC2ZYDO.js +3 -0
- package/dist/bin/shell/chunks/help-CGUEOGXQ.js +3 -0
- package/dist/bin/shell/chunks/history-AQQWW3QB.js +3 -0
- package/dist/bin/shell/chunks/hostname-USNWOQCK.js +3 -0
- package/dist/bin/shell/chunks/html-to-markdown-QEFY7XQR.js +3 -0
- package/dist/bin/shell/chunks/join-EJ73DYTK.js +3 -0
- package/dist/bin/shell/chunks/jq-GGTKKMEN.js +3 -0
- package/dist/bin/shell/chunks/js-exec-BC6NI55L.js +98 -0
- package/dist/bin/shell/chunks/ln-LP4HMCSM.js +3 -0
- package/dist/bin/shell/chunks/ls-KBNHNZWQ.js +3 -0
- package/dist/bin/shell/chunks/md5sum-MCVDIB35.js +3 -0
- package/dist/bin/shell/chunks/mkdir-P4DKRCDX.js +3 -0
- package/dist/bin/shell/chunks/mv-QQK4FQX6.js +3 -0
- package/dist/bin/shell/chunks/nl-KUPLVCTS.js +3 -0
- package/dist/bin/shell/chunks/od-YQ5ZUI2H.js +3 -0
- package/dist/bin/shell/chunks/paste-A5KKPWXX.js +3 -0
- package/dist/bin/shell/chunks/printf-Z5C2UOI5.js +3 -0
- package/dist/bin/shell/chunks/pwd-FCNDA467.js +3 -0
- package/dist/bin/shell/chunks/python3-BQWDPUBM.js +13 -0
- package/dist/bin/shell/chunks/readlink-25V57VOL.js +3 -0
- package/dist/bin/shell/chunks/rev-PYHOZ4D4.js +3 -0
- package/dist/bin/shell/chunks/rg-BGFMSIVK.js +3 -0
- package/dist/bin/shell/chunks/rm-ECNUFR66.js +3 -0
- package/dist/bin/shell/chunks/rmdir-DLOHIA7Q.js +3 -0
- package/dist/bin/shell/chunks/sed-FWA634SN.js +3 -0
- package/dist/bin/shell/chunks/seq-UXDJE6FB.js +3 -0
- package/dist/bin/shell/chunks/sha1sum-4KF52U3Y.js +3 -0
- package/dist/bin/shell/chunks/sha256sum-6YEPULPX.js +3 -0
- package/dist/bin/shell/chunks/sleep-QHAPNY3Q.js +3 -0
- package/dist/bin/shell/chunks/sort-4C6WOKNK.js +3 -0
- package/dist/bin/shell/chunks/split-TV7NL7LA.js +3 -0
- package/dist/bin/shell/chunks/sqlite3-W777NCI4.js +3 -0
- package/dist/bin/shell/chunks/stat-BD6KT3BP.js +3 -0
- package/dist/bin/shell/chunks/strings-MDD72LR6.js +3 -0
- package/dist/bin/shell/chunks/tac-C2N4NQ6S.js +3 -0
- package/dist/bin/shell/chunks/tail-BCB5W6JC.js +3 -0
- package/dist/bin/shell/chunks/tar-DOO744MK.js +3 -0
- package/dist/bin/shell/chunks/tee-UQHPO4OW.js +3 -0
- package/dist/bin/shell/chunks/time-ZPY52VT2.js +3 -0
- package/dist/bin/shell/chunks/timeout-5AX3ZS3X.js +3 -0
- package/dist/bin/shell/chunks/touch-DFGSVIX7.js +3 -0
- package/dist/bin/shell/chunks/tr-G7K6M6HP.js +3 -0
- package/dist/bin/shell/chunks/tree-6D7SMPUR.js +3 -0
- package/dist/bin/shell/chunks/true-SKL4L7JP.js +3 -0
- package/dist/bin/shell/chunks/unexpand-QIR4EDPG.js +3 -0
- package/dist/bin/shell/chunks/uniq-I7PVFJR4.js +3 -0
- package/dist/bin/shell/chunks/wc-6NGWULAP.js +3 -0
- package/dist/bin/shell/chunks/which-LCXKCLFC.js +3 -0
- package/dist/bin/shell/chunks/whoami-TZDZDU7T.js +3 -0
- package/dist/bin/shell/chunks/xan-KX4VPXUN.js +3 -0
- package/dist/bin/shell/chunks/xan-view-JXOZLJ7S.js +3 -0
- package/dist/bin/shell/chunks/xargs-UWHPYLY7.js +3 -0
- package/dist/bin/shell/chunks/yq-GCDCJBKB.js +3 -0
- package/dist/bin/shell/shell.js +734 -0
- package/dist/browser.d.ts +23 -0
- package/dist/bundle/browser.js +1515 -0
- package/dist/bundle/chunks/alias-RTYYYW3D.js +2 -0
- package/dist/bundle/chunks/awk2-LA3USKJP.js +2 -0
- package/dist/bundle/chunks/base64-C2AIWVNC.js +2 -0
- package/dist/bundle/chunks/basename-UB3CIYNI.js +2 -0
- package/dist/bundle/chunks/bash-YZ33HQZQ.js +2 -0
- package/dist/bundle/chunks/cat-TSFMZVYS.js +2 -0
- package/dist/bundle/chunks/chmod-TFEPA42X.js +2 -0
- package/dist/bundle/chunks/chunk-27JIFWUR.js +3 -0
- package/dist/bundle/chunks/chunk-2JIPICV3.js +13 -0
- package/dist/bundle/chunks/chunk-2SMD2AUA.js +3 -0
- package/dist/bundle/chunks/chunk-2VDTE5BV.js +14 -0
- package/dist/bundle/chunks/chunk-2VJJEDV2.js +8 -0
- package/dist/bundle/chunks/chunk-46RN27KI.js +100 -0
- package/dist/bundle/chunks/chunk-4I3HOE5Z.js +21 -0
- package/dist/bundle/chunks/chunk-4JLVZKHC.js +8 -0
- package/dist/bundle/chunks/chunk-4MZPEZTU.js +3 -0
- package/dist/bundle/chunks/chunk-4N6J7B5P.js +6 -0
- package/dist/bundle/chunks/chunk-4RUAZWKT.js +33 -0
- package/dist/bundle/chunks/chunk-4WKZNNJK.js +2 -0
- package/dist/bundle/chunks/chunk-5H5SCKJM.js +11 -0
- package/dist/bundle/chunks/chunk-6LASZU3O.js +5 -0
- package/dist/bundle/chunks/chunk-6SHYIICL.js +4 -0
- package/dist/bundle/chunks/chunk-6VAT5Z2D.js +5 -0
- package/dist/bundle/chunks/chunk-7AISL3XV.js +12 -0
- package/dist/bundle/chunks/chunk-7EUWTCWK.js +2 -0
- package/dist/bundle/chunks/chunk-7JHM3L42.js +6 -0
- package/dist/bundle/chunks/chunk-A4R2GWRF.js +9 -0
- package/dist/bundle/chunks/chunk-ACSZB4FE.js +11 -0
- package/dist/bundle/chunks/chunk-AQ6FYS2X.js +2 -0
- package/dist/bundle/chunks/chunk-BVKWRAS6.js +12 -0
- package/dist/bundle/chunks/chunk-BZUGFHVS.js +2 -0
- package/dist/bundle/chunks/chunk-CBJVD2XA.js +7 -0
- package/dist/bundle/chunks/chunk-CHFEPBH4.js +18 -0
- package/dist/bundle/chunks/chunk-CN5XGDNN.js +6 -0
- package/dist/bundle/chunks/chunk-DLL7UR66.js +2 -0
- package/dist/bundle/chunks/chunk-EBAPSGAO.js +9 -0
- package/dist/bundle/chunks/chunk-FAXLQUCQ.js +10 -0
- package/dist/bundle/chunks/chunk-FHC24QSK.js +7 -0
- package/dist/bundle/chunks/chunk-FJK43EBQ.js +14 -0
- package/dist/bundle/chunks/chunk-FOCWZZDE.js +2 -0
- package/dist/bundle/chunks/chunk-FW54FHZR.js +2 -0
- package/dist/bundle/chunks/chunk-FX4RBUYU.js +5 -0
- package/dist/bundle/chunks/chunk-FX7KQCEA.js +33 -0
- package/dist/bundle/chunks/chunk-FZRQOL3C.js +7 -0
- package/dist/bundle/chunks/chunk-G5EVRAOO.js +74 -0
- package/dist/bundle/chunks/chunk-GGC5NEPZ.js +8 -0
- package/dist/bundle/chunks/chunk-GIUR5SNU.js +15 -0
- package/dist/bundle/chunks/chunk-GJC3WVOW.js +2 -0
- package/dist/bundle/chunks/chunk-GSPYNYZA.js +6 -0
- package/dist/bundle/chunks/chunk-GTQIUQM6.js +5 -0
- package/dist/bundle/chunks/chunk-HBVMHTO5.js +2 -0
- package/dist/bundle/chunks/chunk-HDRAUQK2.js +2 -0
- package/dist/bundle/chunks/chunk-HJBTD7PY.js +21 -0
- package/dist/bundle/chunks/chunk-ICIEVHY5.js +36 -0
- package/dist/bundle/chunks/chunk-KATRCGLX.js +2 -0
- package/dist/bundle/chunks/chunk-KD3KENL6.js +11 -0
- package/dist/bundle/chunks/chunk-KWGBQNTV.js +32 -0
- package/dist/bundle/chunks/chunk-L2UW7DWF.js +2 -0
- package/dist/bundle/chunks/chunk-L64BMZUV.js +2 -0
- package/dist/bundle/chunks/chunk-LEKBROJD.js +6 -0
- package/dist/bundle/chunks/chunk-LNBPBRV4.js +21 -0
- package/dist/bundle/chunks/chunk-LPJEKUCB.js +8 -0
- package/dist/bundle/chunks/chunk-LSLPJOYM.js +3 -0
- package/dist/bundle/chunks/chunk-MFDPAVC6.js +14 -0
- package/dist/bundle/chunks/chunk-MLIO3BK2.js +7 -0
- package/dist/bundle/chunks/chunk-MQKGGNPS.js +16 -0
- package/dist/bundle/chunks/chunk-MZFCCXPZ.js +63 -0
- package/dist/bundle/chunks/chunk-N6DXJ2JN.js +287 -0
- package/dist/bundle/chunks/chunk-NRSASXYY.js +2 -0
- package/dist/bundle/chunks/chunk-OC35HPHG.js +2 -0
- package/dist/bundle/chunks/chunk-OGJ5CFPR.js +9 -0
- package/dist/bundle/chunks/chunk-OVGANXCG.js +8 -0
- package/dist/bundle/chunks/chunk-Q7H5W7YE.js +140 -0
- package/dist/bundle/chunks/chunk-QAYAQNCG.js +23 -0
- package/dist/bundle/chunks/chunk-QIQMJJZ4.js +4 -0
- package/dist/bundle/chunks/chunk-R4IFXNY5.js +28 -0
- package/dist/bundle/chunks/chunk-R74UQCKX.js +5 -0
- package/dist/bundle/chunks/chunk-S3LEJEPP.js +2 -0
- package/dist/bundle/chunks/chunk-S443BAN4.js +7 -0
- package/dist/bundle/chunks/chunk-SAI2SPQQ.js +8 -0
- package/dist/bundle/chunks/chunk-SBBYKIYU.js +3 -0
- package/dist/bundle/chunks/chunk-SETW5JBN.js +9 -0
- package/dist/bundle/chunks/chunk-SHKOQWO4.js +3 -0
- package/dist/bundle/chunks/chunk-SJYEXC2Z.js +14 -0
- package/dist/bundle/chunks/chunk-SO6R3ZKN.js +16 -0
- package/dist/bundle/chunks/chunk-STHBFACM.js +1 -0
- package/dist/bundle/chunks/chunk-SX2HC7SO.js +2 -0
- package/dist/bundle/chunks/chunk-T4TFLF3R.js +16 -0
- package/dist/bundle/chunks/chunk-TDD4NFYE.js +2 -0
- package/dist/bundle/chunks/chunk-TN7HHBQW.js +5 -0
- package/dist/bundle/chunks/chunk-U73A73IE.js +17 -0
- package/dist/bundle/chunks/chunk-UIJUTQPH.js +3 -0
- package/dist/bundle/chunks/chunk-UP6MSJGD.js +17 -0
- package/dist/bundle/chunks/chunk-VLCHOJWK.js +6 -0
- package/dist/bundle/chunks/chunk-VPADYNBD.js +10 -0
- package/dist/bundle/chunks/chunk-W5DWRFSU.js +2 -0
- package/dist/bundle/chunks/chunk-WM5IJFMP.js +8 -0
- package/dist/bundle/chunks/chunk-WNH3HOQA.js +2 -0
- package/dist/bundle/chunks/chunk-WPGQVBSY.js +6 -0
- package/dist/bundle/chunks/chunk-WVRWIZF5.js +23 -0
- package/dist/bundle/chunks/chunk-XCQWV4AU.js +12 -0
- package/dist/bundle/chunks/chunk-XDGLKIHR.js +9 -0
- package/dist/bundle/chunks/chunk-XHLMAZX2.js +5 -0
- package/dist/bundle/chunks/chunk-XRFHFXFP.js +2 -0
- package/dist/bundle/chunks/chunk-XUIHBHL5.js +5 -0
- package/dist/bundle/chunks/chunk-XYXUMFSU.js +14 -0
- package/dist/bundle/chunks/chunk-Y4LIDHSD.js +7 -0
- package/dist/bundle/chunks/chunk-YCLFEX4T.js +3 -0
- package/dist/bundle/chunks/chunk-YS4NUBYX.js +9 -0
- package/dist/bundle/chunks/chunk-ZDIT6ST5.js +7 -0
- package/dist/bundle/chunks/chunk-ZDPFA4L3.js +6 -0
- package/dist/bundle/chunks/chunk-ZZKH2ELC.js +11 -0
- package/dist/bundle/chunks/clear-HKGFEOF6.js +2 -0
- package/dist/bundle/chunks/column-XT6UFXNQ.js +2 -0
- package/dist/bundle/chunks/comm-VV2LDX2J.js +2 -0
- package/dist/bundle/chunks/cp-BISAAS7A.js +2 -0
- package/dist/bundle/chunks/curl-GRYA74XW.js +26 -0
- package/dist/bundle/chunks/cut-OKARJCCV.js +2 -0
- package/dist/bundle/chunks/date-UUUPW43J.js +2 -0
- package/dist/bundle/chunks/diff-MWJFIG7X.js +2 -0
- package/dist/bundle/chunks/dirname-MPHRFUTI.js +2 -0
- package/dist/bundle/chunks/du-572XNP42.js +2 -0
- package/dist/bundle/chunks/echo-NDWZZHPO.js +2 -0
- package/dist/bundle/chunks/env-36M5BO7M.js +2 -0
- package/dist/bundle/chunks/expand-JSPG6VOP.js +2 -0
- package/dist/bundle/chunks/expansion-R25BK4W3.js +2 -0
- package/dist/bundle/chunks/expr-5JAACS4X.js +2 -0
- package/dist/bundle/chunks/file-IPZJC3FQ.js +2 -0
- package/dist/bundle/chunks/find-INTH3OLC.js +2 -0
- package/dist/bundle/chunks/flag-coverage-XWSYNE72.js +2 -0
- package/dist/bundle/chunks/fold-4TQNYMSW.js +2 -0
- package/dist/bundle/chunks/grep-V3LQVMRQ.js +2 -0
- package/dist/bundle/chunks/gzip-O5ASJAFY.js +2 -0
- package/dist/bundle/chunks/head-442HYESI.js +2 -0
- package/dist/bundle/chunks/help-HZ6M2CKN.js +2 -0
- package/dist/bundle/chunks/history-WYYKSLSZ.js +2 -0
- package/dist/bundle/chunks/hostname-C4HQXXUP.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-JW4MSQZO.js +2 -0
- package/dist/bundle/chunks/join-TBRGI3LQ.js +2 -0
- package/dist/bundle/chunks/jq-4XLYLOS5.js +2 -0
- package/dist/bundle/chunks/js-exec-N5KEZBH7.js +97 -0
- package/dist/bundle/chunks/js-exec-worker.js +4443 -0
- package/dist/bundle/chunks/ln-4LGSXXGD.js +2 -0
- package/dist/bundle/chunks/ls-ZJGQER7M.js +2 -0
- package/dist/bundle/chunks/md5sum-SPU24VSG.js +2 -0
- package/dist/bundle/chunks/mkdir-MEPGZOB6.js +2 -0
- package/dist/bundle/chunks/mv-W5BIQ646.js +2 -0
- package/dist/bundle/chunks/nl-WSDW7I4O.js +2 -0
- package/dist/bundle/chunks/od-WOKFDJTP.js +2 -0
- package/dist/bundle/chunks/paste-7JC6S4DX.js +2 -0
- package/dist/bundle/chunks/printf-TWGXF445.js +2 -0
- package/dist/bundle/chunks/pwd-WE6EN5AV.js +2 -0
- package/dist/bundle/chunks/python3-POMOR4OA.js +12 -0
- package/dist/bundle/chunks/readlink-OPJF4DL5.js +2 -0
- package/dist/bundle/chunks/rev-5EHFX4EJ.js +2 -0
- package/dist/bundle/chunks/rg-S4FXYXWB.js +2 -0
- package/dist/bundle/chunks/rm-SSGETQVQ.js +2 -0
- package/dist/bundle/chunks/rmdir-OC4ZLPYA.js +2 -0
- package/dist/bundle/chunks/sed-S5UIK574.js +2 -0
- package/dist/bundle/chunks/seq-M5EC7Q57.js +2 -0
- package/dist/bundle/chunks/sha1sum-2PTOAFR6.js +2 -0
- package/dist/bundle/chunks/sha256sum-NS7D3IXX.js +2 -0
- package/dist/bundle/chunks/sleep-X22JJINO.js +2 -0
- package/dist/bundle/chunks/sort-SW2YEO5B.js +2 -0
- package/dist/bundle/chunks/split-4KKZZXXE.js +2 -0
- package/dist/bundle/chunks/sqlite3-CGOEFJAO.js +2 -0
- package/dist/bundle/chunks/sqlite3-worker.js +1728 -0
- package/dist/bundle/chunks/stat-CD34IZ4P.js +2 -0
- package/dist/bundle/chunks/strings-6WDHLGMX.js +2 -0
- package/dist/bundle/chunks/tac-2STMMJYW.js +2 -0
- package/dist/bundle/chunks/tail-R4PCA2C4.js +2 -0
- package/dist/bundle/chunks/tar-STHHZTZ6.js +2 -0
- package/dist/bundle/chunks/tee-YUZ2FKCJ.js +2 -0
- package/dist/bundle/chunks/time-D4LNBSWX.js +2 -0
- package/dist/bundle/chunks/timeout-YDCRSLPQ.js +2 -0
- package/dist/bundle/chunks/touch-UA33VN3N.js +2 -0
- package/dist/bundle/chunks/tr-36LHWFRQ.js +2 -0
- package/dist/bundle/chunks/tree-YLD52CNT.js +2 -0
- package/dist/bundle/chunks/true-FHQXJXBE.js +2 -0
- package/dist/bundle/chunks/unexpand-CADSA4VO.js +2 -0
- package/dist/bundle/chunks/uniq-XSIZR6PB.js +2 -0
- package/dist/bundle/chunks/wc-LF7NU4LA.js +2 -0
- package/dist/bundle/chunks/which-XEM24D5D.js +2 -0
- package/dist/bundle/chunks/whoami-XMTX52VE.js +2 -0
- package/dist/bundle/chunks/worker.js +3150 -0
- package/dist/bundle/chunks/xan-Y6WF3IRG.js +2 -0
- package/dist/bundle/chunks/xan-view-HDVKHFC2.js +2 -0
- package/dist/bundle/chunks/xargs-MGZPH7AX.js +2 -0
- package/dist/bundle/chunks/yq-4QJW3EQG.js +2 -0
- package/dist/bundle/index.cjs +2178 -0
- package/dist/bundle/index.js +710 -0
- package/dist/commands/alias/alias.d.ts +6 -0
- package/dist/commands/awk/ast.d.ts +202 -0
- package/dist/commands/awk/awk2.d.ts +9 -0
- package/dist/commands/awk/builtins.d.ts +17 -0
- package/dist/commands/awk/interpreter/context.d.ts +75 -0
- package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
- package/dist/commands/awk/interpreter/fields.d.ts +25 -0
- package/dist/commands/awk/interpreter/index.d.ts +8 -0
- package/dist/commands/awk/interpreter/interpreter.d.ts +54 -0
- package/dist/commands/awk/interpreter/statements.d.ts +11 -0
- package/dist/commands/awk/interpreter/type-coercion.d.ts +32 -0
- package/dist/commands/awk/interpreter/types.d.ts +13 -0
- package/dist/commands/awk/interpreter/variables.d.ts +35 -0
- package/dist/commands/awk/lexer.d.ts +100 -0
- package/dist/commands/awk/parser2-print.d.ts +35 -0
- package/dist/commands/awk/parser2.d.ts +81 -0
- package/dist/commands/base64/base64.d.ts +7 -0
- package/dist/commands/basename/basename.d.ts +4 -0
- package/dist/commands/bash/bash.d.ts +6 -0
- package/dist/commands/browser-excluded.d.ts +16 -0
- package/dist/commands/cat/cat.d.ts +4 -0
- package/dist/commands/chmod/chmod.d.ts +4 -0
- package/dist/commands/clear/clear.d.ts +4 -0
- package/dist/commands/column/column.d.ts +11 -0
- package/dist/commands/comm/comm.d.ts +12 -0
- package/dist/commands/cp/cp.d.ts +4 -0
- package/dist/commands/curl/curl.d.ts +8 -0
- package/dist/commands/curl/form.d.ts +21 -0
- package/dist/commands/curl/help.d.ts +9 -0
- package/dist/commands/curl/parse.d.ts +9 -0
- package/dist/commands/curl/response-formatting.d.ts +20 -0
- package/dist/commands/curl/types.d.ts +60 -0
- package/dist/commands/cut/cut.d.ts +4 -0
- package/dist/commands/date/date.d.ts +7 -0
- package/dist/commands/diff/diff.d.ts +7 -0
- package/dist/commands/dirname/dirname.d.ts +4 -0
- package/dist/commands/du/du.d.ts +4 -0
- package/dist/commands/duration.d.ts +5 -0
- package/dist/commands/echo/echo.d.ts +4 -0
- package/dist/commands/env/env.d.ts +6 -0
- package/dist/commands/expand/expand.d.ts +12 -0
- package/dist/commands/expand/unexpand.d.ts +12 -0
- package/dist/commands/expr/expr.d.ts +9 -0
- package/dist/commands/file/file.d.ts +9 -0
- package/dist/commands/find/find.d.ts +4 -0
- package/dist/commands/find/matcher.d.ts +69 -0
- package/dist/commands/find/parser.d.ts +2 -0
- package/dist/commands/find/types.d.ts +88 -0
- package/dist/commands/flag-coverage.d.ts +2 -0
- package/dist/commands/fold/fold.d.ts +12 -0
- package/dist/commands/format-mode.d.ts +4 -0
- package/dist/commands/fuzz-flags-types.d.ts +17 -0
- package/dist/commands/fuzz-flags.d.ts +8 -0
- package/dist/commands/grep/grep.d.ts +8 -0
- package/dist/commands/gzip/gzip.d.ts +13 -0
- package/dist/commands/head/head-tail-shared.d.ts +38 -0
- package/dist/commands/head/head.d.ts +4 -0
- package/dist/commands/help/help.d.ts +4 -0
- package/dist/commands/help.d.ts +16 -0
- package/dist/commands/history/history.d.ts +4 -0
- package/dist/commands/hostname/hostname.d.ts +11 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +9 -0
- package/dist/commands/join/join.d.ts +12 -0
- package/dist/commands/jq/jq.d.ts +9 -0
- package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
- package/dist/commands/js-exec/js-exec-worker.d.ts +32 -0
- package/dist/commands/js-exec/js-exec.d.ts +11 -0
- package/dist/commands/js-exec/module-shims.d.ts +29 -0
- package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
- package/dist/commands/ln/ln.d.ts +4 -0
- package/dist/commands/ls/ls.d.ts +4 -0
- package/dist/commands/md5sum/checksum.d.ts +7 -0
- package/dist/commands/md5sum/md5sum.d.ts +4 -0
- package/dist/commands/md5sum/sha1sum.d.ts +4 -0
- package/dist/commands/md5sum/sha256sum.d.ts +4 -0
- package/dist/commands/mkdir/mkdir.d.ts +4 -0
- package/dist/commands/mv/mv.d.ts +4 -0
- package/dist/commands/nl/nl.d.ts +12 -0
- package/dist/commands/od/od.d.ts +12 -0
- package/dist/commands/paste/paste.d.ts +4 -0
- package/dist/commands/printf/escapes.d.ts +25 -0
- package/dist/commands/printf/printf.d.ts +4 -0
- package/dist/commands/printf/strftime.d.ts +9 -0
- package/dist/commands/pwd/pwd.d.ts +4 -0
- package/dist/commands/python3/python3.d.ts +16 -0
- package/dist/commands/python3/worker.d.ts +28 -0
- package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
- package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/index.d.ts +17 -0
- package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
- package/dist/commands/query-engine/evaluator.d.ts +40 -0
- package/dist/commands/query-engine/index.d.ts +8 -0
- package/dist/commands/query-engine/parser-types.d.ts +171 -0
- package/dist/commands/query-engine/parser.d.ts +9 -0
- package/dist/commands/query-engine/path-operations.d.ts +15 -0
- package/dist/commands/query-engine/safe-object.d.ts +83 -0
- package/dist/commands/query-engine/value-operations.d.ts +41 -0
- package/dist/commands/readlink/readlink.d.ts +4 -0
- package/dist/commands/registry.d.ts +56 -0
- package/dist/commands/rev/rev.d.ts +13 -0
- package/dist/commands/rg/file-types.d.ts +49 -0
- package/dist/commands/rg/gitignore.d.ts +98 -0
- package/dist/commands/rg/rg-options.d.ts +61 -0
- package/dist/commands/rg/rg-parser.d.ts +20 -0
- package/dist/commands/rg/rg-search.d.ts +15 -0
- package/dist/commands/rg/rg.d.ts +14 -0
- package/dist/commands/rm/rm.d.ts +4 -0
- package/dist/commands/rmdir/rmdir.d.ts +4 -0
- package/dist/commands/search-engine/index.d.ts +10 -0
- package/dist/commands/search-engine/matcher.d.ts +66 -0
- package/dist/commands/search-engine/regex.d.ts +46 -0
- package/dist/commands/sed/executor.d.ts +7 -0
- package/dist/commands/sed/lexer.d.ts +86 -0
- package/dist/commands/sed/parser.d.ts +18 -0
- package/dist/commands/sed/sed-regex.d.ts +23 -0
- package/dist/commands/sed/sed.d.ts +4 -0
- package/dist/commands/sed/types.d.ts +216 -0
- package/dist/commands/seq/seq.d.ts +16 -0
- package/dist/commands/sleep/sleep.d.ts +4 -0
- package/dist/commands/sort/comparator.d.ts +9 -0
- package/dist/commands/sort/parser.d.ts +11 -0
- package/dist/commands/sort/sort.d.ts +4 -0
- package/dist/commands/sort/types.d.ts +30 -0
- package/dist/commands/split/split.d.ts +12 -0
- package/dist/commands/sqlite3/formatters.d.ts +15 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +23 -0
- package/dist/commands/sqlite3/worker.d.ts +45 -0
- package/dist/commands/sqlite3/worker.js +1728 -0
- package/dist/commands/stat/stat.d.ts +4 -0
- package/dist/commands/strings/strings.d.ts +12 -0
- package/dist/commands/tac/tac.d.ts +11 -0
- package/dist/commands/tail/tail.d.ts +4 -0
- package/dist/commands/tar/archive.d.ts +135 -0
- package/dist/commands/tar/bzip2-compress.d.ts +17 -0
- package/dist/commands/tar/tar-options.d.ts +37 -0
- package/dist/commands/tar/tar.d.ts +10 -0
- package/dist/commands/tee/tee.d.ts +4 -0
- package/dist/commands/time/time.d.ts +27 -0
- package/dist/commands/timeout/timeout.d.ts +4 -0
- package/dist/commands/touch/touch.d.ts +4 -0
- package/dist/commands/tr/tr.d.ts +4 -0
- package/dist/commands/tree/tree.d.ts +4 -0
- package/dist/commands/true/true.d.ts +6 -0
- package/dist/commands/uniq/uniq.d.ts +4 -0
- package/dist/commands/wc/wc.d.ts +4 -0
- package/dist/commands/which/which.d.ts +4 -0
- package/dist/commands/whoami/whoami.d.ts +11 -0
- package/dist/commands/worker-bridge/bridge-handler.d.ts +73 -0
- package/dist/commands/worker-bridge/protocol.d.ts +141 -0
- package/dist/commands/worker-bridge/sync-backend.d.ts +86 -0
- package/dist/commands/xan/aggregation.d.ts +20 -0
- package/dist/commands/xan/column-selection.d.ts +19 -0
- package/dist/commands/xan/csv.d.ts +37 -0
- package/dist/commands/xan/moonblade-parser.d.ts +80 -0
- package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
- package/dist/commands/xan/moonblade-tokenizer.d.ts +25 -0
- package/dist/commands/xan/subcommands.d.ts +15 -0
- package/dist/commands/xan/xan-agg.d.ts +8 -0
- package/dist/commands/xan/xan-columns.d.ts +8 -0
- package/dist/commands/xan/xan-core.d.ts +10 -0
- package/dist/commands/xan/xan-data.d.ts +52 -0
- package/dist/commands/xan/xan-filter.d.ts +8 -0
- package/dist/commands/xan/xan-map.d.ts +11 -0
- package/dist/commands/xan/xan-reshape.d.ts +40 -0
- package/dist/commands/xan/xan-simple.d.ts +40 -0
- package/dist/commands/xan/xan-view.d.ts +12 -0
- package/dist/commands/xan/xan.d.ts +10 -0
- package/dist/commands/xargs/xargs.d.ts +4 -0
- package/dist/commands/yq/formats.d.ts +64 -0
- package/dist/commands/yq/yq.d.ts +13 -0
- package/dist/custom-commands.d.ts +42 -0
- package/dist/encoding.d.ts +115 -0
- package/dist/fs/encoding.d.ts +17 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +75 -0
- package/dist/fs/in-memory-fs/index.d.ts +1 -0
- package/dist/fs/init.d.ts +22 -0
- package/dist/fs/interface.d.ts +251 -0
- package/dist/fs/mountable-fs/index.d.ts +1 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +118 -0
- package/dist/fs/overlay-fs/index.d.ts +1 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +165 -0
- package/dist/fs/path-utils.d.ts +46 -0
- package/dist/fs/read-write-fs/index.d.ts +1 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +98 -0
- package/dist/fs/real-fs-utils.d.ts +90 -0
- package/dist/fs/sanitize-error.d.ts +19 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/interpreter/alias-expansion.d.ts +23 -0
- package/dist/interpreter/arithmetic.d.ts +24 -0
- package/dist/interpreter/assignment-expansion.d.ts +24 -0
- package/dist/interpreter/builtin-dispatch.d.ts +39 -0
- package/dist/interpreter/builtins/break.d.ts +6 -0
- package/dist/interpreter/builtins/cd.d.ts +6 -0
- package/dist/interpreter/builtins/compgen.d.ts +26 -0
- package/dist/interpreter/builtins/complete.d.ts +17 -0
- package/dist/interpreter/builtins/compopt.d.ts +28 -0
- package/dist/interpreter/builtins/continue.d.ts +6 -0
- package/dist/interpreter/builtins/declare-array-parsing.d.ts +14 -0
- package/dist/interpreter/builtins/declare-print.d.ts +39 -0
- package/dist/interpreter/builtins/declare.d.ts +35 -0
- package/dist/interpreter/builtins/dirs.d.ts +29 -0
- package/dist/interpreter/builtins/eval.d.ts +9 -0
- package/dist/interpreter/builtins/exit.d.ts +5 -0
- package/dist/interpreter/builtins/export.d.ts +14 -0
- package/dist/interpreter/builtins/getopts.d.ts +18 -0
- package/dist/interpreter/builtins/hash.d.ts +19 -0
- package/dist/interpreter/builtins/help.d.ts +12 -0
- package/dist/interpreter/builtins/index.d.ts +45 -0
- package/dist/interpreter/builtins/let.d.ts +18 -0
- package/dist/interpreter/builtins/local.d.ts +6 -0
- package/dist/interpreter/builtins/mapfile.d.ts +17 -0
- package/dist/interpreter/builtins/read.d.ts +6 -0
- package/dist/interpreter/builtins/return.d.ts +6 -0
- package/dist/interpreter/builtins/set.d.ts +9 -0
- package/dist/interpreter/builtins/shift.d.ts +15 -0
- package/dist/interpreter/builtins/shopt.d.ts +7 -0
- package/dist/interpreter/builtins/source.d.ts +6 -0
- package/dist/interpreter/builtins/unset.d.ts +16 -0
- package/dist/interpreter/builtins/variable-assignment.d.ts +66 -0
- package/dist/interpreter/command-resolution.d.ts +43 -0
- package/dist/interpreter/conditionals.d.ts +17 -0
- package/dist/interpreter/control-flow.d.ts +21 -0
- package/dist/interpreter/defense-aware-command-context.d.ts +6 -0
- package/dist/interpreter/errors.d.ts +158 -0
- package/dist/interpreter/expansion/analysis.d.ts +37 -0
- package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
- package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
- package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
- package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
- package/dist/interpreter/expansion/brace-range.d.ts +20 -0
- package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
- package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
- package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
- package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
- package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +18 -0
- package/dist/interpreter/expansion/pattern.d.ts +23 -0
- package/dist/interpreter/expansion/positional-params.d.ts +59 -0
- package/dist/interpreter/expansion/prompt.d.ts +39 -0
- package/dist/interpreter/expansion/quoting.d.ts +13 -0
- package/dist/interpreter/expansion/tilde.d.ts +12 -0
- package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
- package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
- package/dist/interpreter/expansion/variable.d.ts +36 -0
- package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
- package/dist/interpreter/expansion/word-split.d.ts +29 -0
- package/dist/interpreter/expansion.d.ts +53 -0
- package/dist/interpreter/functions.d.ts +12 -0
- package/dist/interpreter/helpers/array.d.ts +43 -0
- package/dist/interpreter/helpers/condition.d.ts +22 -0
- package/dist/interpreter/helpers/errors.d.ts +8 -0
- package/dist/interpreter/helpers/file-tests.d.ts +33 -0
- package/dist/interpreter/helpers/ifs.d.ts +104 -0
- package/dist/interpreter/helpers/loop.d.ts +24 -0
- package/dist/interpreter/helpers/nameref.d.ts +65 -0
- package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
- package/dist/interpreter/helpers/quoting.d.ts +24 -0
- package/dist/interpreter/helpers/readonly.d.ts +45 -0
- package/dist/interpreter/helpers/regex.d.ts +8 -0
- package/dist/interpreter/helpers/result.d.ts +60 -0
- package/dist/interpreter/helpers/shell-constants.d.ts +25 -0
- package/dist/interpreter/helpers/shellopts.d.ts +28 -0
- package/dist/interpreter/helpers/statements.d.ts +20 -0
- package/dist/interpreter/helpers/string-compare.d.ts +24 -0
- package/dist/interpreter/helpers/string-tests.d.ts +13 -0
- package/dist/interpreter/helpers/tilde.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
- package/dist/interpreter/helpers/word-matching.d.ts +26 -0
- package/dist/interpreter/helpers/word-parts.d.ts +22 -0
- package/dist/interpreter/helpers/xtrace.d.ts +18 -0
- package/dist/interpreter/index.d.ts +3 -0
- package/dist/interpreter/interpreter.d.ts +79 -0
- package/dist/interpreter/pipeline-execution.d.ts +16 -0
- package/dist/interpreter/redirections.d.ts +51 -0
- package/dist/interpreter/simple-command-assignments.d.ts +29 -0
- package/dist/interpreter/subshell-group.d.ts +32 -0
- package/dist/interpreter/type-command.d.ts +37 -0
- package/dist/interpreter/types.d.ts +349 -0
- package/dist/limits.d.ts +52 -0
- package/dist/network/allow-list/shared.d.ts +57 -0
- package/dist/network/allow-list.d.ts +59 -0
- package/dist/network/dns-pin.d.ts +43 -0
- package/dist/network/fetch.d.ts +25 -0
- package/dist/network/index.d.ts +7 -0
- package/dist/network/types.d.ts +155 -0
- package/dist/parser/arithmetic-parser.d.ts +23 -0
- package/dist/parser/arithmetic-primaries.d.ts +45 -0
- package/dist/parser/command-parser.d.ts +10 -0
- package/dist/parser/compound-parser.d.ts +28 -0
- package/dist/parser/conditional-parser.d.ts +8 -0
- package/dist/parser/expansion-parser.d.ts +16 -0
- package/dist/parser/lexer.d.ts +197 -0
- package/dist/parser/parser-substitution.d.ts +62 -0
- package/dist/parser/parser.d.ts +135 -0
- package/dist/parser/types.d.ts +25 -0
- package/dist/parser/word-parser.d.ts +33 -0
- package/dist/sandbox/Command.d.ts +35 -0
- package/dist/sandbox/Sandbox.d.ts +90 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/shell-metadata.d.ts +25 -0
- package/dist/timers.d.ts +4 -0
- package/dist/types.d.ts +247 -0
- package/dist/utils/args.d.ts +55 -0
- package/dist/utils/constants.d.ts +15 -0
- package/dist/utils/file-reader.d.ts +74 -0
- package/dist/utils/glob.d.ts +25 -0
- package/dist/vitest-setup.d.ts +1 -0
- package/package.json +127 -0
- package/vendor/cpython-emscripten/python.cjs +2 -0
- package/vendor/cpython-emscripten/python.wasm +0 -0
- package/vendor/cpython-emscripten/python313.zip +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as Ee}from"./chunk-DLL7UR66.js";import{a as D,b as _}from"./chunk-L64BMZUV.js";import{a as x}from"./chunk-TN7HHBQW.js";import{a as v,b as H}from"./chunk-4RUAZWKT.js";import{c as z}from"./chunk-NRSASXYY.js";import{k as P}from"./chunk-SAI2SPQQ.js";import{a as fe,b as de,c as ie}from"./chunk-QAYAQNCG.js";var Be=1e4,He=100,$e=new H(/\s+/);function se(e={}){let{fieldSep:t=$e,maxIterations:n=Be,maxRecursionDepth:i=He,maxOutputSize:s=0,fs:a,cwd:o,exec:l,coverage:u,requireDefenseContext:N}=e;return{FS:" ",OFS:" ",ORS:`
|
|
3
|
+
`,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:i,maxOutputSize:s,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:a,cwd:o,exec:l,coverage:u,requireDefenseContext:N}}function Ne(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}function M(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function k(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function j(e,t){if(e.type==="regex")return e.pattern;let n=k(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function Se(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(M(await t.evalExpr(e.index)))}`:"$0":"$0"}function me(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return k(t.vars[e]??"")}function we(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let i=parseInt(e.slice(1),10)-1;for(;n.fields.length<=i;)n.fields.push("");n.fields[i]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function We(e,t,n){return e.length===0?t.line.length:k(await n.evalExpr(e[0])).length}async function Ve(e,t,n){if(e.length<2)return"";let i=k(await n.evalExpr(e[0])),s=Math.floor(M(await n.evalExpr(e[1])))-1;if(e.length>=3){let a=Math.floor(M(await n.evalExpr(e[2])));return i.substr(Math.max(0,s),a)}return i.substr(Math.max(0,s))}async function Ke(e,t,n){if(e.length<2)return 0;let i=k(await n.evalExpr(e[0])),s=k(await n.evalExpr(e[1])),a=i.indexOf(s);return a===-1?0:a+1}async function Xe(e,t,n){if(e.length<2)return 0;let i=k(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let a=s.name,o=t.FS;if(e.length>=3){let u=e[2];if(u.type==="regex")o=v(u.pattern);else{let N=k(await n.evalExpr(u));o=N===" "?v("\\s+"):N}}else t.FS===" "&&(o=v("\\s+"));let l=typeof o=="string"?i.split(o):o.split(i);t.arrays[a]=Object.create(null);for(let u=0;u<l.length;u++)t.arrays[a][String(u+1)]=l[u];return l.length}async function qe(e,t,n){if(e.length<2)return 0;let i=await j(e[0],n),s=k(await n.evalExpr(e[1])),a=await Se(e[2],n),o=me(a,t);try{let u=v(i).replace(o,Re(s)),N=u!==o?1:0;return we(a,u,t),N}catch{return 0}}async function ze(e,t,n){if(e.length<2)return 0;let i=await j(e[0],n),s=k(await n.evalExpr(e[1])),a=await Se(e[2],n),o=me(a,t);try{let l=v(i,"g"),u=l.match(o),N=u?u.length:0,A=l.replace(o,Re(s));return we(a,A,t),N}catch{return 0}}function Re(e){return t=>{let n="",i=0;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length){let s=e[i+1];s==="&"?(n+="&",i+=2):s==="\\"?(n+="\\",i+=2):(n+=e[i+1],i+=2)}else e[i]==="&"?(n+=t,i++):(n+=e[i],i++);return n}}async function je(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let i=k(await n.evalExpr(e[0])),s=await j(e[1],n);try{let o=v(s).exec(i);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function Qe(e,t,n){if(e.length<3)return"";let i=await j(e[0],n),s=k(await n.evalExpr(e[1])),a=k(await n.evalExpr(e[2])),o=e.length>=4?k(await n.evalExpr(e[3])):t.line;try{let l=a.toLowerCase()==="g",u=l?0:parseInt(a,10)||1;if(l)return v(i,"g").replace(o,(A,...C)=>ye(s,A,C.slice(0,-2)));{let N=0;return v(i,"g").replace(o,(C,...O)=>(N++,N===u?ye(s,C,O.slice(0,-2)):C))}}catch{return o}}function ye(e,t,n){let i="",s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];if(a==="&")i+="&",s+=2;else if(a==="0")i+=t,s+=2;else if(a>="1"&&a<="9"){let o=parseInt(a,10)-1;i+=n[o]||"",s+=2}else a==="n"?(i+=`
|
|
4
|
+
`,s+=2):a==="t"?(i+=" ",s+=2):(i+=a,s+=2)}else e[s]==="&"?(i+=t,s++):(i+=e[s],s++);return i}async function Je(e,t,n){return e.length===0?"":k(await n.evalExpr(e[0])).toLowerCase()}async function Ze(e,t,n){return e.length===0?"":k(await n.evalExpr(e[0])).toUpperCase()}async function Ye(e,t,n){if(e.length===0)return"";let i=k(await n.evalExpr(e[0])),s=[];for(let a=1;a<e.length;a++)s.push(await n.evalExpr(e[a]));return Q(i,s)}async function et(e,t,n){return e.length===0?0:Math.floor(M(await n.evalExpr(e[0])))}async function tt(e,t,n){return e.length===0?0:Math.sqrt(M(await n.evalExpr(e[0])))}async function nt(e,t,n){return e.length===0?0:Math.sin(M(await n.evalExpr(e[0])))}async function rt(e,t,n){return e.length===0?0:Math.cos(M(await n.evalExpr(e[0])))}async function it(e,t,n){let i=e.length>0?M(await n.evalExpr(e[0])):0,s=e.length>1?M(await n.evalExpr(e[1])):0;return Math.atan2(i,s)}async function st(e,t,n){return e.length===0?0:Math.log(M(await n.evalExpr(e[0])))}async function at(e,t,n){return e.length===0?1:Math.exp(M(await n.evalExpr(e[0])))}function ot(e,t,n){return t.random?t.random():Math.random()}async function lt(e,t,n){let i=e.length>0?M(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=i,i}function ut(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function ae(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var U=1e4;function Q(e,t){let n=0,i="",s=0;for(;s<e.length;)if(e[s]==="%"&&s+1<e.length){let a=s+1,o="",l="",u="",N,A=a;for(;a<e.length&&/\d/.test(e[a]);)a++;a>A&&e[a]==="$"?(N=parseInt(e.substring(A,a),10)-1,a++):a=A;let C=()=>{if(a<e.length){if(a+1<e.length&&(e[a]==="h"&&e[a+1]==="h"||e[a]==="l"&&e[a+1]==="l")){a+=2;return}/[lzjh]/.test(e[a])&&a++}};for(;a<e.length&&/[-+ #0]/.test(e[a]);)o+=e[a++];if(e[a]==="*"){let d=t[n++],R=d!==void 0?Math.floor(Number(d)):0;R<0?(o+="-",l=String(Math.min(-R,U))):l=String(Math.min(R,U)),a++}else for(;a<e.length&&/\d/.test(e[a]);)l+=e[a++];if(l&&parseInt(l,10)>U&&(l=String(U)),e[a]==="."){if(a++,e[a]==="*"){let d=t[n++];u=String(Math.min(d!==void 0?Math.floor(Number(d)):0,U)),a++}else for(;a<e.length&&/\d/.test(e[a]);)u+=e[a++];u&&parseInt(u,10)>U&&(u=String(U))}C();let O=e[a],w=t[N!==void 0?N:n];switch(O){case"s":{let d=w!==void 0?String(w):"";if(u&&(d=d.substring(0,parseInt(u,10))),l){let R=parseInt(l,10);o.includes("-")?d=d.padEnd(R):d=d.padStart(R)}i+=d,N===void 0&&n++;break}case"d":case"i":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=d<0,h=Math.abs(d).toString();if(u){let F=parseInt(u,10);h=h.padStart(F,"0")}let c="";R?c="-":o.includes("+")?c="+":o.includes(" ")&&(c=" ");let E=c+h;if(l){let F=parseInt(l,10);o.includes("-")?E=E.padEnd(F):o.includes("0")&&!u?E=c+h.padStart(F-c.length,"0"):E=E.padStart(F)}i+=E,N===void 0&&n++;break}case"f":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d.toFixed(R);if(l){let c=parseInt(l,10);o.includes("-")?h=h.padEnd(c):h=h.padStart(c)}i+=h,N===void 0&&n++;break}case"e":case"E":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d.toExponential(R);if(O==="E"&&(h=h.toUpperCase()),l){let c=parseInt(l,10);o.includes("-")?h=h.padEnd(c):h=h.padStart(c)}i+=h,N===void 0&&n++;break}case"g":case"G":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d!==0?Math.floor(Math.log10(Math.abs(d))):0,c;if(d===0?c="0":h<-4||h>=R?(c=d.toExponential(R-1),O==="G"&&(c=c.toUpperCase())):c=d.toPrecision(R),c.includes(".")&&(c=c.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),c.includes("e")&&(c=c.replace(/\.?0+e/,"e")),l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"x":case"X":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=Math.abs(d).toString(16);if(O==="X"&&(R=R.toUpperCase()),u){let E=parseInt(u,10);R=R.padStart(E,"0")}let h=d<0?"-":"",c=h+R;if(l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):o.includes("0")&&!u?c=h+R.padStart(E-h.length,"0"):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"o":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=Math.abs(d).toString(8);if(u){let E=parseInt(u,10);R=R.padStart(E,"0")}let h=d<0?"-":"",c=h+R;if(l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):o.includes("0")&&!u?c=h+R.padStart(E-h.length,"0"):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"c":{typeof w=="number"?i+=String.fromCharCode(w):i+=String(w??"").charAt(0)||"",N===void 0&&n++;break}case"%":i+="%";break;default:i+=e.substring(s,a+1)}s=a+1}else if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];switch(a){case"n":i+=`
|
|
5
|
+
`;break;case"t":i+=" ";break;case"r":i+="\r";break;case"\\":i+="\\";break;default:i+=a}s+=2}else i+=e[s++];return i}var ge=new Map([["length",We],["substr",Ve],["index",Ke],["split",Xe],["sub",qe],["gsub",ze],["match",je],["gensub",Qe],["tolower",Je],["toupper",Ze],["sprintf",Ye],["int",et],["sqrt",tt],["sin",nt],["cos",rt],["atan2",it],["log",st],["exp",at],["rand",ot],["srand",lt],["system",ut("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",ae("systime")],["mktime",ae("mktime")],["strftime",ae("strftime")]]);function b(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function g(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function m(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function oe(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function K(e,t){try{return v(e).test(t)}catch{return!1}}function Ae(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function J(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function le(e,t,n){if(t===0)e.line=m(n),e.fields=Ae(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=m(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function $(e,t){e.line=t,e.fields=Ae(e,t),e.NF=e.fields.length}function ve(e,t){if(e.FS=t,t===" ")e.fieldSep=new H(/\s+/);else try{e.fieldSep=v(t)}catch{e.fieldSep=v(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function Z(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function W(e,t,n){switch(t){case"FS":ve(e,m(n));return;case"OFS":e.OFS=m(n);return;case"ORS":e.ORS=m(n);return;case"OFMT":e.OFMT=m(n);return;case"NR":e.NR=Math.floor(g(n));return;case"NF":{let i=Math.floor(g(n));if(i<e.NF)e.fields=e.fields.slice(0,i),e.line=e.fields.join(e.OFS);else if(i>e.NF){for(;e.fields.length<i;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=i;return}case"FNR":e.FNR=Math.floor(g(n));return;case"FILENAME":e.FILENAME=m(n);return;case"RSTART":e.RSTART=Math.floor(g(n));return;case"RLENGTH":e.RLENGTH=Math.floor(g(n));return;case"SUBSEP":e.SUBSEP=m(n);return}e.vars[t]=n}function X(e,t){let n=t,i=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!i.has(n);)i.add(n),n=s,s=e.arrayAliases.get(n);return n}function Y(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let i=X(e,t);return e.arrays[i]?.[n]??""}function ue(e,t,n,i){let s=X(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=i}function Ie(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let i=X(e,t);return e.arrays[i]?.[n]!==void 0}function ke(e,t,n){let i=X(e,t);e.arrays[i]&&delete e.arrays[i][n]}function Ce(e,t){let n=X(e,t);delete e.arrays[n]}var be=null;function Oe(e){be=e}function L(e,t){D(e.requireDefenseContext,"awk",t)}function S(e,t,n){return _(e.requireDefenseContext,"awk",t,n)}async function f(e,t){switch(L(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return K(t.pattern,e.line)?1:0;case"field":return ct(e,t);case"variable":return Z(e,t.name);case"array_access":return ht(e,t);case"binary":return pt(e,t);case"unary":return Et(e,t);case"ternary":return b(await S(e,"ternary condition evaluation",()=>f(e,t.condition)))?await S(e,"ternary consequent evaluation",()=>f(e,t.consequent)):await S(e,"ternary alternate evaluation",()=>f(e,t.alternate));case"call":return Nt(e,t.name,t.args);case"assignment":return St(e,t);case"pre_increment":return mt(e,t.operand);case"pre_decrement":return wt(e,t.operand);case"post_increment":return Rt(e,t.operand);case"post_decrement":return gt(e,t.operand);case"in":return At(e,t.key,t.array);case"getline":return vt(e,t.variable,t.file,t.command);case"tuple":return Ct(e,t.elements);default:return""}}async function ct(e,t){L(e,"field reference evaluation");let n=Math.floor(g(await S(e,"field index evaluation",()=>f(e,t.index))));return J(e,n)}async function ht(e,t){L(e,"array access evaluation");let n=m(await S(e,"array key evaluation",()=>f(e,t.key)));return Y(e,t.array,n)}async function pt(e,t){L(e,"binary expression evaluation");let n=t.operator;if(n==="||")return b(await S(e,"logical-or left evaluation",()=>f(e,t.left)))||b(await S(e,"logical-or right evaluation",()=>f(e,t.right)))?1:0;if(n==="&&")return b(await S(e,"logical-and left evaluation",()=>f(e,t.left)))&&b(await S(e,"logical-and right evaluation",()=>f(e,t.right)))?1:0;if(n==="~"){let l=await S(e,"regex left evaluation",()=>f(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let u=t.right.type==="regex"?t.right.pattern:m(await S(e,"regex right evaluation",()=>f(e,t.right)));try{return v(u).test(m(l))?1:0}catch{return 0}}if(n==="!~"){let l=await S(e,"negated-regex left evaluation",()=>f(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let u=t.right.type==="regex"?t.right.pattern:m(await S(e,"negated-regex right evaluation",()=>f(e,t.right)));try{return v(u).test(m(l))?0:1}catch{return 1}}let i=await S(e,"binary left evaluation",()=>f(e,t.left)),s=await S(e,"binary right evaluation",()=>f(e,t.right));if(n===" "){let l=m(i)+m(s);if(e.maxOutputSize>0&&l.length>e.maxOutputSize)throw new P(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return l}if(ft(n))return dt(i,s,n);let a=g(i),o=g(s);return Ne(a,o,n)}function ft(e){return["<","<=",">",">=","==","!="].includes(e)}function dt(e,t,n){let i=oe(e),s=oe(t);if(i&&s){let l=g(e),u=g(t);switch(n){case"<":return l<u?1:0;case"<=":return l<=u?1:0;case">":return l>u?1:0;case">=":return l>=u?1:0;case"==":return l===u?1:0;case"!=":return l!==u?1:0}}let a=m(e),o=m(t);switch(n){case"<":return a<o?1:0;case"<=":return a<=o?1:0;case">":return a>o?1:0;case">=":return a>=o?1:0;case"==":return a===o?1:0;case"!=":return a!==o?1:0}return 0}async function Et(e,t){L(e,"unary expression evaluation");let n=await S(e,"unary operand evaluation",()=>f(e,t.operand));switch(t.operator){case"!":return b(n)?0:1;case"-":return-g(n);case"+":return+g(n);default:return n}}async function Nt(e,t,n){L(e,"function call evaluation");let i=ge.get(t);if(i)return i(n,e,{evalExpr:a=>f(e,a)});let s=e.functions.get(t);return s?yt(e,s,n):""}async function yt(e,t,n){if(L(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new P(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let i=Object.create(null);for(let l of t.params)i[l]=e.vars[l];let s=[];for(let l=0;l<t.params.length;l++){let u=t.params[l];if(l<n.length){let N=n[l];N.type==="variable"&&(e.arrayAliases.set(u,N.name),s.push(u));let A=await S(e,"user function argument evaluation",()=>f(e,N));e.vars[u]=A}else e.vars[u]=""}e.hasReturn=!1,e.returnValue=void 0;let a=be;a&&await S(e,"user function body execution",()=>a(e,t.body.statements));let o=e.returnValue??"";for(let l of t.params)i[l]!==void 0?e.vars[l]=i[l]:delete e.vars[l];for(let l of s)e.arrayAliases.delete(l);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function St(e,t){L(e,"assignment evaluation");let n=await S(e,"assignment value evaluation",()=>f(e,t.value)),i=t.target,s=t.operator,a;if(s==="=")a=n;else{let o;if(i.type==="field"){let N=Math.floor(g(await S(e,"assignment field index",()=>f(e,i.index))));o=J(e,N)}else if(i.type==="variable")o=Z(e,i.name);else{let N=m(await S(e,"assignment array key",()=>f(e,i.key)));o=Y(e,i.array,N)}let l=g(o),u=g(n);switch(s){case"+=":a=l+u;break;case"-=":a=l-u;break;case"*=":a=l*u;break;case"/=":a=u!==0?l/u:0;break;case"%=":a=u!==0?l%u:0;break;case"^=":a=l**u;break;default:a=n}}if(i.type==="field"){let o=Math.floor(g(await S(e,"assignment target field index",()=>f(e,i.index))));le(e,o,a)}else if(i.type==="variable")W(e,i.name,a);else{let o=m(await S(e,"assignment target array key",()=>f(e,i.key)));ue(e,i.array,o,a)}return a}async function ee(e,t,n,i){L(e,"inc/dec evaluation");let s;if(t.type==="field"){let a=Math.floor(g(await S(e,"inc/dec field index",()=>f(e,t.index))));s=g(J(e,a)),le(e,a,s+n)}else if(t.type==="variable")s=g(Z(e,t.name)),W(e,t.name,s+n);else{let a=m(await S(e,"inc/dec array key",()=>f(e,t.key)));s=g(Y(e,t.array,a)),ue(e,t.array,a,s+n)}return i?s+n:s}async function mt(e,t){return ee(e,t,1,!0)}async function wt(e,t){return ee(e,t,-1,!0)}async function Rt(e,t){return ee(e,t,1,!1)}async function gt(e,t){return ee(e,t,-1,!1)}async function At(e,t,n){L(e,"in-expression evaluation");let i;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let a of t.elements)s.push(m(await S(e,"tuple key element evaluation",()=>f(e,a))));i=s.join(e.SUBSEP)}else i=m(await S(e,"in-expression key evaluation",()=>f(e,t)));return Ie(e,n,i)?1:0}async function vt(e,t,n,i){if(L(e,"getline evaluation"),i)return It(e,t,i);if(n)return kt(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let a=e.lines[s];return t?W(e,t,a):$(e,a),e.NR++,e.lineIndex=s,1}async function It(e,t,n){let i=e.exec;if(!i)return-1;L(e,"getline command source");let s=m(await S(e,"getline command expression",()=>f(e,n))),a=`__cmd_${s}`,o=`__cmdi_${s}`,l,u;if(e.vars[a]===void 0)try{let C=await S(e,"getline command exec",()=>i(s));l=z(C.stdout).split(`
|
|
6
|
+
`),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[a]=JSON.stringify(l),e.vars[o]=-1,u=-1}catch(C){if(C instanceof x)throw C;return-1}else l=JSON.parse(e.vars[a]),u=e.vars[o];let N=u+1;if(N>=l.length)return 0;let A=l[N];return e.vars[o]=N,t?W(e,t,A):$(e,A),1}async function kt(e,t,n){let i=e.fs;if(!i||!e.cwd)return-1;L(e,"getline file source");let s=m(await S(e,"getline filename evaluation",()=>f(e,n)));if(s==="/dev/null")return 0;let a=i.resolvePath(e.cwd,s),o=`__fc_${a}`,l=`__fi_${a}`,u,N;if(e.vars[o]===void 0)try{u=(await S(e,"getline file read",()=>i.readFile(a))).split(`
|
|
7
|
+
`),u.length>0&&u[u.length-1]===""&&u.pop(),e.vars[o]=JSON.stringify(u),e.vars[l]=-1,N=-1}catch(O){if(O instanceof x)throw O;return-1}else u=JSON.parse(e.vars[o]),N=e.vars[l];let A=N+1;if(A>=u.length)return 0;let C=u[A];return e.vars[l]=A,t?W(e,t,C):$(e,C),1}async function Ct(e,t){if(L(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await S(e,"tuple intermediate element",()=>f(e,t[n]));return S(e,"tuple final element",()=>f(e,t[t.length-1]))}Oe(V);function ce(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new P(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function T(e,t){D(e.requireDefenseContext,"awk",t)}function y(e,t,n){return _(e.requireDefenseContext,"awk",t,n)}async function V(e,t){T(e,"block execution");for(let n of t)if(await y(e,"statement execution",()=>B(e,n)),bt(e))break}function bt(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function B(e,t){switch(T(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await y(e,"nested block statement",()=>V(e,t.statements));break;case"expr_stmt":await y(e,"expression statement",()=>f(e,t.expression));break;case"print":await y(e,"print statement",()=>Ot(e,t.args,t.output));break;case"printf":await y(e,"printf statement",()=>Lt(e,t.format,t.args,t.output));break;case"if":await y(e,"if statement",()=>Mt(e,t));break;case"while":await y(e,"while statement",()=>Pt(e,t));break;case"do_while":await y(e,"do-while statement",()=>Tt(e,t));break;case"for":await y(e,"for statement",()=>Ft(e,t));break;case"for_in":await y(e,"for-in statement",()=>Dt(e,t));break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0;{let n=t.code;e.exitCode=n?Math.floor(g(await y(e,"exit code expression",()=>f(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await y(e,"return expression",()=>f(e,n)):""}break;case"delete":await y(e,"delete statement",()=>_t(e,t.target));break}}async function Ot(e,t,n){T(e,"print execution");let i=[];for(let a of t){let o=await y(e,"print argument evaluation",()=>f(e,a));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?i.push(String(o)):i.push(Q(e.OFMT,[o])):i.push(m(o))}let s=i.join(e.OFS)+e.ORS;n?await y(e,"print redirection write",()=>Le(e,n.redirect,n.file,s)):(e.output+=s,ce(e))}async function Lt(e,t,n,i){T(e,"printf execution");let s=m(await y(e,"printf format evaluation",()=>f(e,t))),a=[];for(let l of n)a.push(await y(e,"printf argument evaluation",()=>f(e,l)));let o=Q(s,a);i?await y(e,"printf redirection write",()=>Le(e,i.redirect,i.file,o)):(e.output+=o,ce(e))}async function Le(e,t,n,i){T(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=i,ce(e);return}let a=m(await y(e,"redirection filename evaluation",()=>f(e,n))),o=s.resolvePath(e.cwd,a);t===">"?e.openedFiles.has(o)?await y(e,"redirection append write",()=>s.appendFile(o,i)):(await y(e,"redirection overwrite write",()=>s.writeFile(o,i)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await y(e,"redirection append mode write",()=>s.appendFile(o,i)))}async function Mt(e,t){if(T(e,"if execution"),b(await y(e,"if condition evaluation",()=>f(e,t.condition))))await y(e,"if consequent execution",()=>B(e,t.consequent));else if(t.alternate){let n=t.alternate;await y(e,"if alternate execution",()=>B(e,n))}}async function Pt(e,t){T(e,"while execution");let n=0;for(;b(await y(e,"while condition evaluation",()=>f(e,t.condition)));){if(n++,n>e.maxIterations)throw new P(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"while body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Tt(e,t){T(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new P(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"do-while body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(b(await y(e,"do-while condition evaluation",()=>f(e,t.condition))))}async function Ft(e,t){T(e,"for execution");let n=t.init,i=t.condition,s=t.update;n&&await y(e,"for init evaluation",()=>f(e,n));let a=0;for(;!i||b(await y(e,"for condition evaluation",()=>f(e,i)));){if(a++,a>e.maxIterations)throw new P(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"for body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await y(e,"for update evaluation",()=>f(e,s))}}async function Dt(e,t){T(e,"for-in execution");let n=e.arrays[t.array];if(n)for(let i of Object.keys(n)){if(e.vars[t.variable]=i,e.loopContinue=!1,await y(e,"for-in body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function _t(e,t){if(T(e,"delete execution"),t.type==="array_access"){let n=m(await y(e,"delete key evaluation",()=>f(e,t.key)));ke(e,t.array,n)}else t.type==="variable"&&Ce(e,t.name)}var q=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){D(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return _(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>V(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){$(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let i=this.program.rules[n];i.pattern?.type==="begin"||i.pattern?.type==="end"||await this.withDefenseContext("rule match",()=>this.matchesRule(i,n))&&await this.withDefenseContext("rule block execution",()=>V(this.ctx,i.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await this.withDefenseContext("END block execution",()=>V(this.ctx,t.action.statements)),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){this.assertDefenseContext("rule matching");let i=t.pattern;if(!i)return!0;switch(i.type){case"begin":case"end":return!1;case"regex_pattern":return K(i.pattern,this.ctx.line);case"expr_pattern":return b(await this.withDefenseContext("expression pattern evaluation",()=>f(this.ctx,i.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(i.start)),a=await this.withDefenseContext("range end pattern",()=>this.matchPattern(i.end));return this.rangeStates[n]?(a&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,a&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return K(t.pattern,this.ctx.line);case"expr_pattern":return b(await this.withDefenseContext("nested expression pattern",()=>f(this.ctx,t.expression)));default:return!1}}};var r;(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(r||(r={}));var Gt=new Map([["BEGIN",r.BEGIN],["END",r.END],["if",r.IF],["else",r.ELSE],["while",r.WHILE],["do",r.DO],["for",r.FOR],["in",r.IN],["break",r.BREAK],["continue",r.CONTINUE],["next",r.NEXT],["nextfile",r.NEXTFILE],["exit",r.EXIT],["return",r.RETURN],["delete",r.DELETE],["function",r.FUNCTION],["print",r.PRINT],["printf",r.PRINTF],["getline",r.GETLINE]]);function xt(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var Ut=new Set([r.COMMA,r.LBRACE,r.AND,r.OR,r.QUESTION,r.COLON,r.DO,r.ELSE,r.IF,r.WHILE]),te=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(r.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
|
|
8
|
+
`?(this.line++,this.column=1):this.column++,t}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="\\")if(this.peek(1)===`
|
|
9
|
+
`)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
|
|
10
|
+
`;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,i=this.peek();return i===`
|
|
11
|
+
`?(this.advance(),this.lastTokenType!==null&&Ut.has(this.lastTokenType)?this.nextToken():{type:r.NEWLINE,value:`
|
|
12
|
+
`,line:t,column:n}):i==='"'?this.readString():i==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(i)||i==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(i)||i==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,r.NEWLINE,r.SEMICOLON,r.LBRACE,r.RBRACE,r.LPAREN,r.LBRACKET,r.COMMA,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.AND,r.OR,r.NOT,r.MATCH,r.NOT_MATCH,r.QUESTION,r.COLON,r.LT,r.GT,r.LE,r.GE,r.EQ,r.NE,r.PLUS,r.MINUS,r.STAR,r.PERCENT,r.CARET,r.PRINT,r.PRINTF,r.IF,r.WHILE,r.DO,r.FOR,r.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let s=this.advance();switch(s){case"n":i+=`
|
|
13
|
+
`;break;case"t":i+=" ";break;case"r":i+="\r";break;case"f":i+="\f";break;case"b":i+="\b";break;case"v":i+="\v";break;case"a":i+="\x07";break;case"\\":i+="\\";break;case'"':i+='"';break;case"/":i+="/";break;case"x":{let a="";for(;a.length<2&&/[0-9a-fA-F]/.test(this.peek());)a+=this.advance();a.length>0?i+=String.fromCharCode(parseInt(a,16)):i+="x";break}default:if(/[0-7]/.test(s)){let a=s;for(;a.length<3&&/[0-7]/.test(this.peek());)a+=this.advance();i+=String.fromCharCode(parseInt(a,8))}else i+=s}}else i+=this.advance();return this.peek()==='"'&&this.advance(),{type:r.STRING,value:i,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")i+=this.advance(),this.pos<this.input.length&&(i+=this.advance());else{if(this.peek()===`
|
|
14
|
+
`)break;i+=this.advance()}return this.peek()==="/"&&this.advance(),i=xt(i),{type:r.REGEX,value:i,line:t,column:n}}readNumber(){let t=this.line,n=this.column,i="";for(;this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(i+=this.advance();this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(i+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(i+=this.advance());this.isDigit(this.peek());)i+=this.advance();return{type:r.NUMBER,value:parseFloat(i),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,i="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)i+=this.advance();let s=Gt.get(i);return s!==void 0?{type:s,value:i,line:t,column:n}:{type:r.IDENT,value:i,line:t,column:n}}readOperator(){let t=this.line,n=this.column,i=this.advance(),s=this.peek();switch(i){case"+":return s==="+"?(this.advance(),{type:r.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:r.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:r.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:r.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:r.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:r.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:r.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:r.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:r.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:r.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:r.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:r.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:r.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:r.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:r.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:r.EQ,value:"==",line:t,column:n}):{type:r.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:r.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:r.NOT_MATCH,value:"!~",line:t,column:n}):{type:r.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:r.LE,value:"<=",line:t,column:n}):{type:r.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:r.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:r.APPEND,value:">>",line:t,column:n}):{type:r.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:r.AND,value:"&&",line:t,column:n}):{type:r.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:r.OR,value:"||",line:t,column:n}):{type:r.PIPE,value:"|",line:t,column:n};case"~":return{type:r.MATCH,value:"~",line:t,column:n};case"?":return{type:r.QUESTION,value:"?",line:t,column:n};case":":return{type:r.COLON,value:":",line:t,column:n};case",":return{type:r.COMMA,value:",",line:t,column:n};case";":return{type:r.SEMICOLON,value:";",line:t,column:n};case"(":return{type:r.LPAREN,value:"(",line:t,column:n};case")":return{type:r.RPAREN,value:")",line:t,column:n};case"{":return{type:r.LBRACE,value:"{",line:t,column:n};case"}":return{type:r.RBRACE,value:"}",line:t,column:n};case"[":return{type:r.LBRACKET,value:"[",line:t,column:n};case"]":return{type:r.RBRACKET,value:"]",line:t,column:n};case"$":return{type:r.DOLLAR,value:"$",line:t,column:n};default:return{type:r.IDENT,value:i,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}};var p={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"};function De(e){e.expect(p.PRINT);let t=[];if(e.check(p.NEWLINE)||e.check(p.SEMICOLON)||e.check(p.RBRACE)||e.check(p.PIPE)||e.check(p.GT)||e.check(p.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(ne(e));e.check(p.COMMA);)e.advance(),t.push(ne(e));let n;return e.check(p.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(p.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function ne(e){return Bt(e)?he(e,!0):he(e,!1)}function he(e,t){let n=t?e.parseTernary():Ht(e);if(e.match(p.ASSIGN,p.PLUS_ASSIGN,p.MINUS_ASSIGN,p.STAR_ASSIGN,p.SLASH_ASSIGN,p.PERCENT_ASSIGN,p.CARET_ASSIGN)){let i=e.advance(),s=he(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(i.value)??"=",target:n,value:s}}return n}function Bt(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let i=e.tokens[n];if(i.type===p.LPAREN&&t++,i.type===p.RPAREN&&t--,i.type===p.QUESTION&&t===0)return!0;if(i.type===p.NEWLINE||i.type===p.SEMICOLON||i.type===p.RBRACE||i.type===p.COMMA||i.type===p.PIPE)return!1;n++}return!1}function Ht(e){let t=Me(e);for(;e.check(p.OR);){e.advance();let n=Me(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function Me(e){let t=Pe(e);for(;e.check(p.AND);){e.advance();let n=Pe(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function Pe(e){let t=$t(e);if(e.check(p.IN)){e.advance();let n=String(e.expect(p.IDENT).value);return{type:"in",key:t,array:n}}return t}function $t(e){let t=Te(e);for(;Wt(e)&&!Vt(e);){let n=Te(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function Te(e){let t=Fe(e);for(;e.match(p.MATCH,p.NOT_MATCH);){let n=e.advance().type===p.MATCH?"~":"!~",i=Fe(e);t={type:"binary",operator:n,left:t,right:i}}return t}function Fe(e){let t=e.parseAddSub();for(;e.match(p.LT,p.LE,p.GE,p.EQ,p.NE);){let n=e.advance(),i=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}function Wt(e){return e.match(p.NUMBER,p.STRING,p.IDENT,p.DOLLAR,p.LPAREN,p.NOT,p.MINUS,p.PLUS,p.INCREMENT,p.DECREMENT)}function Vt(e){return e.match(p.AND,p.OR,p.QUESTION,p.ASSIGN,p.PLUS_ASSIGN,p.MINUS_ASSIGN,p.STAR_ASSIGN,p.SLASH_ASSIGN,p.PERCENT_ASSIGN,p.CARET_ASSIGN,p.COMMA,p.SEMICOLON,p.NEWLINE,p.RBRACE,p.RPAREN,p.RBRACKET,p.COLON,p.PIPE,p.APPEND,p.GT,p.IN)}function _e(e){e.expect(p.PRINTF);let t=e.check(p.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():ne(e),i=[];for(;e.check(p.COMMA);)e.advance(),t&&e.skipNewlines(),i.push(t?e.parseExpression():ne(e));t&&(e.skipNewlines(),e.expect(p.RPAREN));let s;return e.check(p.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(p.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:i,output:s}}var re=class{tokens=[];pos=0;parse(t){let n=new te(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:r.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let i=this.current();throw new Error(n||`Expected ${t}, got ${i.type} at line ${i.line}:${i.column}`)}return this.advance()}skipNewlines(){for(;this.check(r.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(r.NEWLINE)||this.check(r.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(r.EOF)&&(this.skipNewlines(),!this.check(r.EOF));)this.check(r.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(r.FUNCTION);let t=this.expect(r.IDENT).value;this.expect(r.LPAREN);let n=[];if(!this.check(r.RPAREN))for(n.push(this.expect(r.IDENT).value);this.check(r.COMMA);)this.advance(),n.push(this.expect(r.IDENT).value);this.expect(r.RPAREN),this.skipNewlines();let i=this.parseBlock();return{name:t,params:n,body:i}}parseRule(){let t;if(this.check(r.BEGIN))this.advance(),t={type:"begin"};else if(this.check(r.END))this.advance(),t={type:"end"};else if(this.check(r.LBRACE))t=void 0;else if(this.check(r.REGEX)){let i=this.advance();if(this.check(r.AND)||this.check(r.OR)){let s={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:i.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(s)}}else{let s={type:"regex_pattern",pattern:i.value};if(this.check(r.COMMA)){this.advance();let a;this.check(r.REGEX)?a={type:"regex_pattern",pattern:this.advance().value}:a={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:a}}else t=s}}else{let s={type:"expr_pattern",expression:this.parseExpression()};if(this.check(r.COMMA)){this.advance();let a;this.check(r.REGEX)?a={type:"regex_pattern",pattern:this.advance().value}:a={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:a}}else t=s}this.skipNewlines();let n;return this.check(r.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(r.LBRACE),this.skipNewlines();let t=[];for(;!this.check(r.RBRACE)&&!this.check(r.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(r.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(r.SEMICOLON)||this.check(r.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(r.LBRACE))return this.parseBlock();if(this.check(r.IF))return this.parseIf();if(this.check(r.WHILE))return this.parseWhile();if(this.check(r.DO))return this.parseDoWhile();if(this.check(r.FOR))return this.parseFor();if(this.check(r.BREAK))return this.advance(),{type:"break"};if(this.check(r.CONTINUE))return this.advance(),{type:"continue"};if(this.check(r.NEXT))return this.advance(),{type:"next"};if(this.check(r.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(r.EXIT)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(r.RETURN)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(r.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(r.PRINT)?De(this):this.check(r.PRINTF)?_e(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(r.IF),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let i;return this.check(r.ELSE)&&(this.advance(),this.skipNewlines(),i=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:i}}parseWhile(){this.expect(r.WHILE),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(r.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(r.WHILE),this.expect(r.LPAREN);let n=this.parseExpression();return this.expect(r.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(r.FOR),this.expect(r.LPAREN),this.check(r.IDENT)){let a=this.advance();if(this.check(r.IN)){this.advance();let o=this.expect(r.IDENT).value;this.expect(r.RPAREN),this.skipNewlines();let l=this.parseStatement();return{type:"for_in",variable:a.value,array:o,body:l}}this.pos--}let t;this.check(r.SEMICOLON)||(t=this.parseExpression()),this.expect(r.SEMICOLON);let n;this.check(r.SEMICOLON)||(n=this.parseExpression()),this.expect(r.SEMICOLON);let i;this.check(r.RPAREN)||(i=this.parseExpression()),this.expect(r.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:i,body:s}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN)){let n=this.advance(),i=this.parseAssignment();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");let s=new Set(["=","+=","-=","*=","/=","%=","^="]),a=n.value;if(!s.has(a))throw new Error(`Unknown assignment operator: ${a}`);return{type:"assignment",operator:a,target:t,value:i}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(r.QUESTION)){this.advance();let n=this.parseExpression();this.expect(r.COLON);let i=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:i}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(r.PIPE)){if(this.advance(),!this.check(r.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(r.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(r.IN)){this.advance();let n=this.expect(r.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(r.MATCH,r.NOT_MATCH);){let n=this.advance().type===r.MATCH?"~":"!~",i=this.parseComparison();t={type:"binary",operator:n,left:t,right:i}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(r.LT,r.LE,r.GT,r.GE,r.EQ,r.NE);){let n=this.advance(),i=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}canStartExpression(){return this.match(r.NUMBER,r.STRING,r.IDENT,r.DOLLAR,r.LPAREN,r.NOT,r.MINUS,r.PLUS,r.INCREMENT,r.DECREMENT)}isConcatTerminator(){return this.match(r.AND,r.OR,r.QUESTION,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.COMMA,r.SEMICOLON,r.NEWLINE,r.RBRACE,r.RPAREN,r.RBRACKET,r.COLON,r.PIPE,r.APPEND,r.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(r.PLUS,r.MINUS);){let n=this.advance().value,i=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:i}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(r.STAR,r.SLASH,r.PERCENT);){let n=this.advance(),i=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:i}}return t}parseUnary(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(r.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(r.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(r.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(r.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(r.RPAREN),t}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(r.COMMA)){let i=[n];for(;this.check(r.COMMA);)this.advance(),i.push(this.parseExpression());this.expect(r.RBRACKET);let s=i.reduce((a,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:a,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:s}}return this.expect(r.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(r.COMMA)){let n=[t];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"tuple",elements:n}}return this.expect(r.RPAREN),t}if(this.check(r.GETLINE)){this.advance();let t,n;return this.check(r.IDENT)&&(t=this.advance().value),this.check(r.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(r.RBRACKET);let i;if(n.length===1)i=n[0];else{i=n[0];for(let s=1;s<n.length;s++)i={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:n[s]}}return{type:"array_access",array:t,key:i}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}};var Kt={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},zn={name:"awk",async execute(e,t){D(t.requireDefenseContext,"awk","execution entry");let n=(h,c)=>_(t.requireDefenseContext,"awk",h,c);if(de(e))return fe(Kt);let i=new H(/\s+/),s=" ",a=Object.create(null),o=0;for(let h=0;h<e.length;h++){let c=e[h];if(c==="-F"&&h+1<e.length)s=pe(e[++h]),i=Ge(s),o=h+1;else if(c.startsWith("-F"))s=pe(c.slice(2)),i=Ge(s),o=h+1;else if(c==="-v"&&h+1<e.length){let E=e[++h],F=E.indexOf("=");if(F>0){let G=E.slice(0,F),Ue=pe(E.slice(F+1));a[G]=Ue}o=h+1}else{if(c.startsWith("--"))return ie("awk",c);if(c.startsWith("-")&&c.length>1){let E=c[1];if(E!=="F"&&E!=="v")return ie("awk",`-${E}`);o=h+1}else if(!c.startsWith("-")){o=h;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program
|
|
15
|
+
`,exitCode:1};let l=e[o],u=e.slice(o+1),N=new re,A;try{A=N.parse(l)}catch(h){return{stdout:"",stderr:`awk: ${h instanceof Error?h.message:String(h)}
|
|
16
|
+
`,exitCode:1}}let C={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(h,c)=>{try{let E=await n("appendFile read",()=>t.fs.readFile(h));await n("appendFile write",()=>t.fs.writeFile(h,E+c))}catch(E){if(E instanceof x)throw E;await n("appendFile create",()=>t.fs.writeFile(h,c))}},resolvePath:t.fs.resolvePath.bind(t.fs)},O=t.exec,I=se({fieldSep:i,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:C,cwd:t.cwd,exec:O?h=>n("command pipe exec",()=>O(h,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});I.FS=s,I.vars=Object.assign(Object.create(null),a),I.ARGC=u.length+1,I.ARGV=Object.create(null),I.ARGV[0]="awk";for(let h=0;h<u.length;h++)I.ARGV[String(h+1)]=u[h];I.ENVIRON=Ee(t.env);let w=new q(I);w.execute(A);let d=A.rules.some(h=>h.pattern?.type!=="begin"&&h.pattern?.type!=="end"),R=A.rules.some(h=>h.pattern?.type==="end");try{if(await n("BEGIN execution",()=>w.executeBegin()),I.shouldExit)return await n("END execution after BEGIN exit",()=>w.executeEnd()),{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()};if(!d&&!R)return{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()};let h=[];if(u.length>0)for(let c of u)try{let E=t.fs.resolvePath(t.cwd,c),G=(await n("input file read",()=>t.fs.readFile(E))).split(`
|
|
17
|
+
`);G.length>0&&G[G.length-1]===""&&G.pop(),h.push({filename:c,lines:G})}catch(E){if(E instanceof x)throw E;return{stdout:"",stderr:`awk: ${c}: No such file or directory
|
|
18
|
+
`,exitCode:1}}else{let c=z(t.stdin).split(`
|
|
19
|
+
`);c.length>0&&c[c.length-1]===""&&c.pop(),h.push({filename:"",lines:c})}for(let c of h){for(I.FILENAME=c.filename,I.FNR=0,I.lines=c.lines,I.lineIndex=-1,I.shouldNextFile=!1;I.lineIndex<c.lines.length-1;){I.lineIndex++;let E=I.lineIndex;if(await n("line execution",()=>w.executeLine(c.lines[E])),I.shouldExit||I.shouldNextFile)break}if(I.shouldExit)break}return await n("END execution",()=>w.executeEnd()),{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()}}catch(h){if(h instanceof x)throw h;let c=h instanceof Error?h.message:String(h),E=h instanceof P?P.EXIT_CODE:2;return{stdout:w.getOutput(),stderr:`awk: ${c}
|
|
20
|
+
`,exitCode:E}}}};function pe(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
|
|
21
|
+
`).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function Ge(e){if(e===" ")return v("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return v(e)}catch{return v(xe(e))}return v(xe(e))}function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var jn={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{zn as a,jn as b};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as p}from"./chunk-FOCWZZDE.js";import{a as m}from"./chunk-QIQMJJZ4.js";import{a as u}from"./chunk-W5DWRFSU.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"}},E={name:"rm",async execute(g,s){let e=m("rm",g,v);if(!e.ok)return e.error;let i=e.result.flags.recursive||e.result.flags.recursiveUpper,a=e.result.flags.force,d=e.result.flags.verbose,c=e.result.positional;if(c.length===0)return a?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
|
|
3
|
+
`,exitCode:1};let f="",t="",l=0;for(let r of c)try{let n=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(n)).isDirectory&&!i){t+=`rm: cannot remove '${r}': Is a directory
|
|
4
|
+
`,l=1;continue}await s.fs.rm(n,{recursive:i,force:a}),d&&(f+=`removed '${r}'
|
|
5
|
+
`)}catch(n){if(!a){let o=u(n);o.includes("ENOENT")||o.includes("no such file")?t+=`rm: cannot remove '${r}': No such file or directory
|
|
6
|
+
`:o.includes("ENOTEMPTY")||o.includes("not empty")?t+=`rm: cannot remove '${r}': Directory not empty
|
|
7
|
+
`:t+=`rm: cannot remove '${r}': ${p(o)}
|
|
8
|
+
`,l=1}}return{stdout:f,stderr:t,exitCode:l}}},$={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{E as a,$ as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as d}from"./chunk-QIQMJJZ4.js";import{a as p,b as l}from"./chunk-QAYAQNCG.js";var m={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},u={append:{short:"a",long:"append",type:"boolean"}},w={name:"tee",async execute(r,e){if(l(r))return p(m);let t=d("tee",r,u);if(!t.ok)return t.error;let{append:f}=t.result.flags,c=t.result.positional,o=e.stdin,s="",a=0;for(let i of c)try{let n=e.fs.resolvePath(e.cwd,i);f?await e.fs.appendFile(n,o,"binary"):await e.fs.writeFile(n,o,"binary")}catch{s+=`tee: ${i}: No such file or directory
|
|
3
|
+
`,a=1}return{stdout:o,stderr:s,exitCode:a,stdoutEncoding:"binary"}}},b={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0};export{w as a,b};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as c,b as u,c as d}from"./chunk-QAYAQNCG.js";var p={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};function x(n){return n>=32&&n<=126||n===9}function g(n,s){if(s===null)return"";switch(s){case"o":return`${n.toString(8).padStart(7," ")} `;case"x":return`${n.toString(16).padStart(7," ")} `;case"d":return`${n.toString(10).padStart(7," ")} `;default:return s}}function h(n,s){let o=[],r="",i=0,a=typeof n=="string"?new TextEncoder().encode(n):n;for(let l=0;l<a.length;l++){let t=a[l];if(x(t))r.length===0&&(i=l),r+=String.fromCharCode(t);else{if(r.length>=s.minLength){let e=g(i,s.offsetFormat);o.push(`${e}${r}`)}r=""}}if(r.length>=s.minLength){let l=g(i,s.offsetFormat);o.push(`${l}${r}`)}return o}var v={name:"strings",execute:async(n,s)=>{if(u(n))return c(p);let o={minLength:4,offsetFormat:null},r=[],i=0;for(;i<n.length;){let t=n[i];if(t==="-n"&&i+1<n.length){let e=Number.parseInt(n[i+1],10);if(Number.isNaN(e)||e<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${n[i+1]}'
|
|
3
|
+
`};o.minLength=e,i+=2}else if(t.match(/^-n\d+$/)){let e=Number.parseInt(t.slice(2),10);if(Number.isNaN(e)||e<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${t.slice(2)}'
|
|
4
|
+
`};o.minLength=e,i++}else if(t.match(/^-\d+$/)){let e=Number.parseInt(t.slice(1),10);if(Number.isNaN(e)||e<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${t.slice(1)}'
|
|
5
|
+
`};o.minLength=e,i++}else if(t==="-t"&&i+1<n.length){let e=n[i+1];if(e!=="o"&&e!=="x"&&e!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${e}'
|
|
6
|
+
`};o.offsetFormat=e,i+=2}else if(t.startsWith("-t")&&t.length===3){let e=t[2];if(e!=="o"&&e!=="x"&&e!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${e}'
|
|
7
|
+
`};o.offsetFormat=e,i++}else if(t==="-a"||t==="--all"||t==="-")t==="-"&&r.push(t),i++;else if(t==="-e"&&i+1<n.length){let e=n[i+1];if(e!=="s"&&e!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${e}'
|
|
8
|
+
`};i+=2}else if(t.startsWith("-e")&&t.length===3){let e=t[2];if(e!=="s"&&e!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${e}'
|
|
9
|
+
`};i++}else if(t==="--"){r.push(...n.slice(i+1));break}else{if(t.startsWith("-")&&t!=="-")return d("strings",t);r.push(t),i++}}let a="",l=()=>Uint8Array.from(s.stdin??"",t=>t.charCodeAt(0));if(r.length===0){let t=h(l(),o);a=t.length>0?`${t.join(`
|
|
10
|
+
`)}
|
|
11
|
+
`:""}else for(let t of r){let e;if(t==="-")e=l();else{let m=s.fs.resolvePath(s.cwd,t);try{e=await s.fs.readFileBuffer(m)}catch{return{exitCode:1,stdout:a,stderr:`strings: ${t}: No such file or directory
|
|
12
|
+
`}}}let f=h(e,o);f.length>0&&(a+=`${f.join(`
|
|
13
|
+
`)}
|
|
14
|
+
`)}return{exitCode:0,stdout:a,stderr:""}}},F={name:"strings",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-a",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsFiles:!0};export{v as a,F as b};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as f}from"./chunk-FOCWZZDE.js";import{a as d}from"./chunk-QIQMJJZ4.js";import{a as l}from"./chunk-W5DWRFSU.js";var p={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},b={name:"mkdir",async execute(m,t){let e=d("mkdir",m,p);if(!e.ok)return e.error;let u=e.result.flags.recursive,g=e.result.flags.verbose,n=e.result.positional;if(n.length===0)return{stdout:"",stderr:`mkdir: missing operand
|
|
3
|
+
`,exitCode:1};let a="",o="",c=0;for(let r of n)try{let i=t.fs.resolvePath(t.cwd,r);await t.fs.mkdir(i,{recursive:u}),g&&(a+=`mkdir: created directory '${r}'
|
|
4
|
+
`)}catch(i){let s=l(i);s.includes("ENOENT")||s.includes("no such file")?o+=`mkdir: cannot create directory '${r}': No such file or directory
|
|
5
|
+
`:s.includes("EEXIST")||s.includes("already exists")?o+=`mkdir: cannot create directory '${r}': File exists
|
|
6
|
+
`:o+=`mkdir: cannot create directory '${r}': ${f(s)}
|
|
7
|
+
`,c=1}return{stdout:a,stderr:o,exitCode:c}}},h={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{b as a,h as b};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as r}from"./chunk-L2UW7DWF.js";var c=new Map([["File operations",["ls","cat","head","tail","wc","touch","mkdir","rm","cp","mv","ln","chmod","stat","readlink"]],["Text processing",["grep","sed","awk","sort","uniq","cut","tr","tee","diff"]],["Search",["find"]],["Navigation & paths",["pwd","basename","dirname","tree","du"]],["Environment & shell",["echo","printf","env","printenv","export","alias","unalias","history","clear","true","false","bash","sh"]],["Data processing",["xargs","jq","base64","date"]],["Network",["curl","html-to-markdown"]]]);function d(n){let e=[],s=new Set(n);e.push(`Available commands:
|
|
3
|
+
`);let t=[];for(let[a,l]of c){let o=l.filter(i=>s.has(i));if(o.length>0){e.push(` ${a}:`),e.push(` ${o.join(", ")}
|
|
4
|
+
`);for(let i of o)s.delete(i)}}for(let a of s)t.push(a);return t.length>0&&(e.push(" Other:"),e.push(` ${t.sort().join(", ")}
|
|
5
|
+
`)),e.push("Use '<command> --help' for details on a specific command."),`${e.join(`
|
|
6
|
+
`)}
|
|
7
|
+
`}var h={name:"help",async execute(n,e){if(n.includes("--help")||n.includes("-h"))return{stdout:`help - display available commands
|
|
8
|
+
|
|
9
|
+
Usage: help [command]
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
-h, --help Show this help message
|
|
13
|
+
|
|
14
|
+
If a command name is provided, shows help for that command.
|
|
15
|
+
Otherwise, lists all available commands.
|
|
16
|
+
`,stderr:"",exitCode:0};if(n.length>0&&e.exec){let t=n[0];return e.exec(r([t]),{cwd:e.cwd,signal:e.signal,args:["--help"]})}let s=e.getRegisteredCommands?.()??[];return{stdout:d(s),stderr:"",exitCode:0}}},p={name:"help",flags:[]};export{h as a,p as b};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as ye}from"./chunk-TDD4NFYE.js";import{b as Q}from"./chunk-TN7HHBQW.js";import{a as U}from"./chunk-4RUAZWKT.js";import{a as pe,b as ge,c as ee}from"./chunk-QAYAQNCG.js";var Ke="file",Je="link",Ve="symlink",ke="directory",Qe={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},et={0:Ke,1:Je,2:Ve,3:"character-device",4:"block-device",5:ke,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},tt=new Uint8Array(512),_=new Uint8Array(0),T=new TextEncoder,ze=new TextDecoder;function P(e,t,i,r){r&&T.encodeInto(r,e.subarray(t,t+i))}function L(e,t,i,r){if(r===void 0)return;let n=r.toString(8).padStart(i-1,"0");T.encodeInto(n,e.subarray(t,t+i-1))}function S(e,t,i){let r=e.indexOf(0,t),n=r===-1||r>t+i?t+i:r;return ze.decode(e.subarray(t,n))}function ne(e,t,i){let r=0,n=t+i;for(let s=t;s<n;s++){let a=e[s];if(a===0)break;a!==32&&(r=r*8+(a-48))}return r}function W(e,t,i){if(e[t]&128){let r=0;r=e[t]&127;for(let n=1;n<i;n++)r=r*256+e[t+n];if(!Number.isSafeInteger(r))throw new Error("TAR number too large");return r}return ne(e,t,i)}var N=e=>e.type==="directory"||e.type==="symlink"||e.type==="link"||e.type==="character-device"||e.type==="block-device"||e.type==="fifo";async function Ce(e){if(e==null)return _;if(e instanceof Uint8Array)return e;if(typeof e=="string")return T.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}var we=(e,t)=>{let i=e.split("/").filter(Boolean);return t>=i.length?"":i.slice(t).join("/")};function Ae(e,t){let{strip:i,filter:r,map:n}=t;if(!i&&!r&&!n)return e;let s={...e};if(i&&i>0){let o=we(s.name,i);if(!o)return null;if(s.name=s.type==="directory"&&!o.endsWith("/")?`${o}/`:o,s.linkname){let c=s.linkname.startsWith("/");if(c||s.type==="link"){let l=we(s.linkname,i);s.linkname=c?`/${l}`||"/":l}}}if(r?.(s)===!1)return null;let a=n?n(s):s;return a&&(!a.name||!a.name.trim()||a.name==="."||a.name==="/")?null:a}var re=32,rt=48;function nt(e){let t=ne(e,148,8),i=0;for(let r=0;r<e.length;r++)r>=148&&r<156?i+=re:i+=e[r];return t===i}function it(e){e.fill(re,148,156);let t=0;for(let i of e)t+=i;for(let i=153;i>=148;i--)e[i]=(t&7)+rt,t>>=3;e[154]=0,e[155]=re}var st=256;function ot(e){let t={};T.encode(e.name).length>100&&Ee(e.name)===null&&(t.path=e.name),e.linkname&&T.encode(e.linkname).length>100&&(t.linkpath=e.linkname),e.uname&&T.encode(e.uname).length>32&&(t.uname=e.uname),e.gname&&T.encode(e.gname).length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let i=Object.entries(t);if(i.length===0)return null;let r=T.encode(i.map(([n,s])=>{let a=`${n}=${s}
|
|
3
|
+
`,o=T.encode(a).length+1,c=o+String(o).length;return c=o+String(c).length,`${c} ${a}`}).join(""));return{paxHeader:$e({name:ze.decode(T.encode(`PaxHeader/${e.name}`).slice(0,100)),size:r.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:r}}function Ee(e){let t=T.encode(e).length;if(t<=100||t>st)return null;for(let i=e.length-1;i>0;i--){if(e[i]!=="/")continue;let r=e.slice(0,i),n=e.slice(i+1);if(T.encode(r).length<=155&&T.encode(n).length<=100)return{prefix:r,name:n}}return null}function $e(e){let t=new Uint8Array(512),i=N(e)?0:e.size??0,r=e.name,n="";if(!e.pax?.path){let s=Ee(r);s&&(r=s.name,n=s.prefix)}return P(t,0,100,r),L(t,100,8,e.mode??(e.type==="directory"?493:420)),L(t,108,8,e.uid??0),L(t,116,8,e.gid??0),L(t,124,12,i),L(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),P(t,156,1,Qe[e.type??"file"]),P(t,157,100,e.linkname),P(t,257,6,"ustar\0"),P(t,263,2,"00"),P(t,265,32,e.uname),P(t,297,32,e.gname),P(t,345,155,n),it(t),t}function at(e,t){if(t&&!nt(e))throw new Error("Invalid tar header checksum.");let i=S(e,156,1),r={name:S(e,0,100),mode:ne(e,100,8),uid:W(e,108,8),gid:W(e,116,8),size:W(e,124,12),mtime:new Date(W(e,136,12)*1e3),type:et[i]||"file",linkname:S(e,157,100)},n=S(e,257,6);return N(r)&&(r.size=0),n.trim()==="ustar"&&(r.uname=S(e,265,32),r.gname=S(e,297,32)),n==="ustar"&&(r.prefix=S(e,345,155)),r}var be={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>parseInt(e,10)],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function lt(e){let t=new TextDecoder("utf-8"),i=Object.create(null),r=Object.create(null),n=0;for(;n<e.length;){let s=e.indexOf(32,n);if(s===-1)break;let a=parseInt(t.decode(e.subarray(n,s)),10);if(Number.isNaN(a)||a===0)break;let o=n+a,[c,l]=t.decode(e.subarray(s+1,o-1)).split("=",2);if(c&&l!==void 0&&(r[c]=l,Object.hasOwn(be,c))){let[f,u]=be[c],y=u(l);(typeof y=="string"||!Number.isNaN(y))&&(i[f]=y)}n=o}return Object.keys(r).length>0&&(i.pax=r),i}function xe(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function ct(e){switch(e){case"pax-global-header":case"pax-header":return lt;case"gnu-long-name":return t=>({name:S(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:S(t,0,t.length)});default:return}}function ft(e){let t=$e(e),i=ot(e);if(!i)return[t];let r=-i.paxBody.length&511,n=r>0?[tt.subarray(0,r)]:[];return[i.paxHeader,i.paxBody,...n,t]}var ut=new Uint8Array(512*2);function Be(e,t,i){let r=null,n=0,s=!1,a=o=>{let c=new Error(o);throw t(c),c};return{add(o){s&&a("No new tar entries after finalize."),r!==null&&a("Previous entry must be completed before adding a new one");let c=N(o)?0:o.size;(!Number.isSafeInteger(c)||c<0)&&a("Invalid tar entry size.");try{let l=ft({...o,size:c});for(let f of l)e(f);r={...o,size:c},n=0}catch(l){t(l)}},write(o){r||a("No active tar entry."),s&&a("Cannot write data after finalize.");let c=n+o.length;c>r.size&&a(`"${r.name}" exceeds given size of ${r.size} bytes.`);try{n=c,e(o)}catch(l){t(l)}},endEntry(){r||a("No active entry to end."),s&&a("Cannot end entry after finalize.");try{n!==r.size&&a(`Size mismatch for "${r.name}".`);let o=-r.size&511;o>0&&e(new Uint8Array(o)),r=null,n=0}catch(o){throw t(o),o}},finalize(){s&&a("Archive has already been finalized"),r!==null&&a("Cannot finalize while an entry is still active");try{e(ut),s=!0,i&&i()}catch(o){t(o)}}}}var j=256;function dt(){let e=new Array(j),t=e.length-1,i=0,r=0,n=0,s=o=>{let c=e[i];o===c.length?(e[i]=_,i=i+1&t):e[i]=c.subarray(o),n-=o,n===0&&e.length>j&&(e=new Array(j),t=j-1,i=0,r=0)};function a(o,c){if(c){let g=0,d=Math.min(o,n);for(;d>0;){let p=e[i],m=Math.min(d,p.length),x=m===p.length?p:p.subarray(0,m);if(s(m),d-=m,g+=m,!c(x))break}return g}if(n<o)return null;if(o===0)return _;let l=e[i];if(l.length>=o){let g=l.length===o?l:l.subarray(0,o);return s(o),g}let f=new Uint8Array(o),u=0,y=o;for(;y>0;){let g=e[i],d=Math.min(y,g.length);f.set(d===g.length?g:g.subarray(0,d),u),u+=d,y-=d,s(d)}return f}return{push:o=>{if(o.length===0)return;let c=r+1&t;if(c===i){let l=e.length,f=l*2,u=new Array(f),y=r-i+l&l-1;if(i<r)for(let g=0;g<y;g++)u[g]=e[i+g];else if(y>0){let g=l-i;for(let d=0;d<g;d++)u[d]=e[i+d];for(let d=0;d<r;d++)u[g+d]=e[d]}e=u,t=f-1,i=0,r=y,c=r+1&t}e[r]=o,r=c,n+=o.length},available:()=>n,peek:o=>{if(n<o)return null;if(o===0)return _;let c=e[i];if(c.length>=o)return c.length===o?c:c.subarray(0,o);let l=new Uint8Array(o),f=0,u=i;for(;f<o;){let y=e[u],g=Math.min(o-f,y.length);g===y.length?l.set(y,f):l.set(y.subarray(0,g),f),f+=g,u=u+1&t}return l},discard:o=>{if(o>n)throw new Error("Too many bytes consumed");if(o===0)return;let c=o;for(;c>0;){let l=e[i],f=Math.min(c,l.length);s(f),c-=f}},pull:a}}var te=0,D=1,H=new Error("Tar archive is truncated.");function Te(e={}){let t=e.strict??!1,{available:i,peek:r,push:n,discard:s,pull:a}=dt(),o=te,c=!1,l=!1,f=!1,u=null,y={},g={},d={isEntryActive:()=>o===D,isBodyComplete:()=>!u||u.remaining===0,canFinish:()=>!u||i()>=u.remaining+u.padding,write(p){if(c)throw new Error("Archive already ended.");n(p)},end(){c=!0},readHeader(){if(o!==te)throw new Error("Cannot read header while an entry is active");if(!l)for(;!l;){if(i()<512){if(c){if(i()>0&&t)throw H;l=!0;return}return null}let p=r(512);if(ve(p)){if(i()<512*2){if(c){if(t)throw H;l=!0;return}return null}if(ve(r(512*2).subarray(512))){s(512*2),l=!0,f=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let m;try{m=at(p,t)}catch(E){if(t)throw E;s(512);continue}let x=ct(m.type);if(x){let E=m.size+(-m.size&511);if(i()<512+E){if(c&&t)throw H;return null}s(512);let v=x(a(E).subarray(0,m.size)),$=m.type==="pax-global-header"?y:g;for(let z in v)$[z]=v[z];continue}s(512);let b=m;return m.prefix&&(b.name=`${m.prefix}/${b.name}`),xe(b,y),xe(b,g),b.name.endsWith("/")&&b.type==="file"&&(b.type=ke),g={},u={header:b,remaining:b.size,padding:-b.size&511},o=D,b}},streamBody(p){if(o!==D||!u||u.remaining===0)return 0;let m=Math.min(u.remaining,i());if(m===0)return 0;let x=a(m,p);return u.remaining-=x,x},skipPadding(){if(o!==D||!u)return!0;if(u.remaining>0)throw new Error("Body not fully consumed");return i()<u.padding?!1:(s(u.padding),u=null,o=te,!0)},skipEntry(){if(o!==D||!u)return!0;let p=Math.min(u.remaining,i());return p>0&&(s(p),u.remaining-=p),u.remaining>0?!1:d.skipPadding()},validateEOF(){if(t){if(!f)throw H;if(i()>0&&a(i()).some(p=>p!==0))throw new Error("Invalid EOF.")}}};return d}function ve(e){if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let i=0;i<t.length;i++)if(t[i]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}function Fe(){return new CompressionStream("gzip")}function Ie(){return new DecompressionStream("gzip")}function mt(){let e,t;return{readable:new ReadableStream({start(i){e=i,t=Be(i.enqueue.bind(i),i.error.bind(i),i.close.bind(i))}}),controller:{add(i){let r=N(i);return t.add(i),r&&t.endEntry(),new WritableStream({write(n){t.write(n)},close(){r||t.endEntry()},abort(n){e.error(n)}})},finalize(){t.finalize()},error(i){e.error(i)}}}}async function Pe(e){let t=[],i=e.getReader(),r=0;try{for(;;){let{done:a,value:o}=await i.read();if(a)break;t.push(o),r+=o.length}let n=new Uint8Array(r),s=0;for(let a of t)n.set(a,s),s+=a.length;return n}finally{i.releaseLock()}}var Se=e=>e.pipeTo(new WritableStream);function ht(e={}){let t=Te(e),i=e.strict??!1,r=null,n=null,s=!1,a=!1,o=!1,c=!1,l=()=>{try{n?.close()}catch{}n=null},f=d=>{if(!c){c=!0;try{n?.error(d)}catch{}n=null;try{r.error(d)}catch{}r=null}},u=()=>{if(!c){c=!0,l();try{r.close()}catch{}r=null}},y=()=>{if(i)throw new Error("Tar archive is truncated.");u()},g=()=>{if(!(s||c||!r)){s=!0;try{for(;;){if(a){o&&(t.validateEOF(),u());break}if(t.isEntryActive()){if(o&&!t.canFinish()){y();break}if(n){if((n.desiredSize??1)<=0)break;if(t.streamBody(d=>(n.enqueue(d),(n.desiredSize??1)>0))===0&&!t.isBodyComplete()){o&&y();break}}else if(!t.skipEntry()){o&&y();break}if(t.isBodyComplete()&&(l(),!t.skipPadding())){o&&y();break}}else{if((r.desiredSize??0)<0)break;let d=t.readHeader();if(d===null){o&&u();break}if(d===void 0){if(o){t.validateEOF(),u();break}a=!0;break}r.enqueue({header:d,body:new ReadableStream({start(p){d.size===0?p.close():n=p},pull:g,cancel(){n=null,g()}})})}}}catch(d){throw f(d),d}finally{s=!1}}};return{readable:new ReadableStream({start(d){r=d},pull:g,cancel(d){d!==void 0?f(d):u()}},{highWaterMark:2}),writable:new WritableStream({write(d){try{if(a&&i&&d.some(p=>p!==0))throw new Error("Invalid EOF.");t.write(d),g()}catch(p){throw f(p),p}},close(){try{o=!0,t.end(),g()}catch(d){throw f(d),d}},abort(d){f(d)}})}}async function Oe(e){let{readable:t,controller:i}=mt();return await(async()=>{for(let r of e){let n=i.add(r.header),s="body"in r?r.body:r.data;if(!s){await n.close();continue}if(s instanceof ReadableStream)await s.pipeTo(n);else if(s instanceof Blob)await s.stream().pipeTo(n);else try{let a=await Ce(s);if(a.length>0){let o=n.getWriter();await o.write(a),await o.close()}else await n.close()}catch{throw new TypeError(`Unsupported content type for entry "${r.header.name}".`)}}})().then(()=>i.finalize()).catch(r=>i.error(r)),new Uint8Array(await Pe(t))}async function Ue(e,t={}){let i=e instanceof ReadableStream?e:new ReadableStream({start(s){s.enqueue(e instanceof Uint8Array?e:new Uint8Array(e)),s.close()}}),r=[],n=i.pipeThrough(ht(t));for await(let s of n){let a;try{a=Ae(s.header,t)}catch(o){throw await s.body.cancel(),o}if(a===null){await Se(s.body);continue}N(a)?(await Se(s.body),r.push({header:a})):r.push({header:a,data:await Pe(s.body)})}return r}import At from"seek-bzip";var pt=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let i=t<<24;for(let r=0;r<8;r++)i=i&2147483648?i<<1^79764919:i<<1;e[t]=i>>>0}return e})();function gt(e,t){return(e<<8^pt[(e>>>24^t)&255])>>>0}var ie=class{buffer=[];current=0;bitCount=0;writeBits(t,i){for(let r=t-1;r>=0;r--)this.current=this.current<<1|i>>>r&1,this.bitCount++,this.bitCount===8&&(this.buffer.push(this.current),this.current=0,this.bitCount=0)}writeBit(t){this.current=this.current<<1|t&1,this.bitCount++,this.bitCount===8&&(this.buffer.push(this.current),this.current=0,this.bitCount=0)}finish(){return this.bitCount>0&&this.buffer.push(this.current<<8-this.bitCount),new Uint8Array(this.buffer)}};function yt(e){let t=[],i=0;for(;i<e.length;){let r=e[i],n=1;for(;i+n<e.length&&e[i+n]===r&&n<255;)n++;n>=4?(t.push(r,r,r,r),t.push(n-4),i+=n):(t.push(r),i++)}return new Uint8Array(t)}function wt(e){let t=e.length;if(t===0)return{transformed:new Uint8Array(0),pointer:0};let i=bt(e),r=new Uint8Array(t),n=0;for(let s=0;s<t;s++)i[s]===0?(n=s,r[s]=e[t-1]):r[s]=e[i[s]-1];return{transformed:r,pointer:n}}function bt(e){let t=e.length,i=new Int32Array(t),r=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n,r[n]=e[n];for(let n=1;n<t;n*=2){let s=r.slice();i.sort((a,o)=>s[a]!==s[o]?s[a]-s[o]:s[(a+n)%t]-s[(o+n)%t]),r[i[0]]=0;for(let a=1;a<t;a++)s[i[a]]===s[i[a-1]]&&s[(i[a]+n)%t]===s[(i[a-1]+n)%t]?r[i[a]]=r[i[a-1]]:r[i[a]]=r[i[a-1]]+1;if(r[i[t-1]]===t-1)break}return i}function xt(e,t){let i=[];for(let a=0;a<256;a++)t[a]&&i.push(a);let r=new Array(256).fill(-1);for(let a=0;a<i.length;a++)r[i[a]]=a;let n=new Uint16Array(e.length),s=i.slice();for(let a=0;a<e.length;a++){let o=e[a],c=0;for(;s[c]!==o;)c++;if(n[a]=c,c>0){let l=s[c];for(let f=c;f>0;f--)s[f]=s[f-1];s[0]=l}}return{encoded:n,length:e.length}}function vt(e,t,i){let s=i+1,a=[],o=0;for(;o<t;)if(e[o]===0){let l=0;for(;o<t&&e[o]===0;)l++,o++;let f=l;for(;f>0;)f--,f&1?a.push(1):a.push(0),f>>>=1}else a.push(e[o]+1),o++;a.push(s);let c=new Uint16Array(a.length);for(let l=0;l<a.length;l++)c[l]=a[l];return{symbols:c,length:a.length,eob:s}}function Ne(e,t,i){if(t<=1){let l=new Array(e.length).fill(0);for(let f=0;f<e.length;f++)e[f]>0&&(l[f]=1);return{codeLengths:l,maxLen:1,minLen:1}}let r=[];for(let l=0;l<e.length;l++)e[l]>0&&r.push({freq:e[l],symbol:l,left:null,right:null});if(r.length===0)return{codeLengths:new Array(e.length).fill(0),maxLen:0,minLen:0};if(r.length===1){let l=new Array(e.length).fill(0);return l[r[0].symbol]=1,{codeLengths:l,maxLen:1,minLen:1}}for(;r.length>1;){r.sort((u,y)=>u.freq-y.freq);let l=r.shift(),f=r.shift();r.push({freq:l.freq+f.freq,symbol:-1,left:l,right:f})}let n=new Array(e.length).fill(0);function s(l,f){if(!l.left&&!l.right){n[l.symbol]=f;return}l.left&&s(l.left,f+1),l.right&&s(l.right,f+1)}s(r[0],0);let a=!0;for(;a;){a=!1;for(let l=0;l<n.length;l++)n[l]>i&&(n[l]=i,a=!0);if(a){let l=0;for(let f=0;f<n.length;f++)n[f]>0&&(l+=1/(1<<n[f]));if(l>1)for(let f=1;f<i&&l>1;f++)for(let u=0;u<n.length&&l>1;u++)n[u]===f&&(n[u]++,l-=1/(1<<f)-1/(1<<f+1));a=!1;for(let f=0;f<n.length;f++)if(n[f]>i){a=!0;break}}}let o=i,c=0;for(let l=0;l<n.length;l++)n[l]>0&&(n[l]<o&&(o=n[l]),n[l]>c&&(c=n[l]));return{codeLengths:n,maxLen:c,minLen:o}}function kt(e,t){let i=new Array(t).fill(0),r=e.slice(0,t),n=Math.max(...r,0),s=new Array(n+1).fill(0);for(let c=0;c<t;c++)r[c]>0&&s[r[c]]++;let a=new Array(n+1).fill(0),o=0;for(let c=1;c<=n;c++)o=o+s[c-1]<<1,a[c]=o;for(let c=0;c<t;c++)r[c]>0&&(i[c]=a[r[c]]++);return{codes:i,lengths:r}}function zt(e,t,i){e.writeBits(24,3227993),e.writeBits(24,2511705),e.writeBits(32,i),e.writeBit(0);let r=yt(t),{transformed:n,pointer:s}=wt(r);e.writeBits(24,s);let a=new Array(256).fill(!1);for(let h=0;h<n.length;h++)a[n[h]]=!0;let o=new Array(16).fill(!1);for(let h=0;h<16;h++)for(let w=0;w<16;w++)if(a[h*16+w]){o[h]=!0;break}for(let h=0;h<16;h++)e.writeBit(o[h]?1:0);for(let h=0;h<16;h++)if(o[h])for(let w=0;w<16;w++)e.writeBit(a[h*16+w]?1:0);let c=0;for(let h=0;h<256;h++)a[h]&&c++;let{encoded:l,length:f}=xt(n,a),{symbols:u,length:y}=vt(l,f,c),g=c+2,d=50,p=Math.ceil(y/d),m;y<200?m=2:y<600?m=3:y<1200?m=4:y<2400?m=5:m=6,m>p&&(m=Math.max(2,p));let x=[];for(let h=0;h<m;h++)x.push(new Array(g).fill(0));let b=new Int32Array(p);for(let h=0;h<p;h++)b[h]=h%m;for(let h=0;h<p;h++){let w=h*d,k=Math.min(w+d,y),B=b[h];for(let C=w;C<k;C++)x[B][u[C]]++}function E(h){for(let w=0;w<g;w++)h[w]<1&&(h[w]=1)}let v=[];for(let h=0;h<m;h++)E(x[h]),v.push(Ne(x[h],g,20));for(let h=0;h<4;h++){for(let w=0;w<m;w++)x[w].fill(0);for(let w=0;w<p;w++){let k=w*d,B=Math.min(k+d,y),C=0,M=1/0;for(let I=0;I<m;I++){let J=0;for(let V=k;V<B;V++)J+=v[I].codeLengths[u[V]]||20;J<M&&(M=J,C=I)}b[w]=C;for(let I=k;I<B;I++)x[C][u[I]]++}for(let w=0;w<m;w++)E(x[w]),v[w]=Ne(x[w],g,20)}e.writeBits(3,m),e.writeBits(15,p);let $=[],z=[];for(let h=0;h<m;h++)z.push(h);for(let h=0;h<p;h++){let w=b[h],k=0;for(;z[k]!==w;)k++;if($.push(k),k>0){let B=z[k];for(let C=k;C>0;C--)z[C]=z[C-1];z[0]=B}}for(let h=0;h<p;h++){for(let w=0;w<$[h];w++)e.writeBit(1);e.writeBit(0)}for(let h=0;h<m;h++){let w=v[h].codeLengths,k=w[0];e.writeBits(5,k);for(let B=0;B<g;B++){let C=w[B];for(;k<C;)e.writeBit(1),e.writeBit(0),k++;for(;k>C;)e.writeBit(1),e.writeBit(1),k--;e.writeBit(0)}}for(let h=0;h<m;h++){let{codes:w,lengths:k}=kt(v[h].codeLengths,g);v[h]=Object.assign(v[h],{_codes:w,_lengths:k})}let he=0,R=0;for(let h=0;h<y;h++){(R===0||R>=d)&&(h>0&&he++,R=0);let w=b[he],k=v[w],B=u[h],C=k._lengths[B],M=k._codes[B];C>0&&e.writeBits(C,M),R++}}var Ct=10*1024*1024;function Le(e,t=9,i=Ct){if(t<1||t>9)throw new Error("Block size level must be 1-9");if(e.length>i)throw new Error(`Input too large for bzip2 compression (${e.length} bytes, max ${i})`);let r=t*1e5,n=new ie;n.writeBits(8,66),n.writeBits(8,90),n.writeBits(8,104),n.writeBits(8,48+t);let s=0,a=0;for(;a<e.length;){let o=Math.min(a+r,e.length),c=e.subarray(a,o),l=4294967295;for(let f=0;f<c.length;f++)l=gt(l,c[f]);l=~l>>>0,s=(s<<1|s>>>31)>>>0,s=(s^l)>>>0,zt(n,c,l),a=o}return n.writeBits(24,1536581),n.writeBits(24,3690640),n.writeBits(32,s),n.finish()}var X=null,Z=null;async function Me(){if(X)return X;if(Z)throw Z;try{return X=await Q.runTrustedAsync(()=>import("node-liblzma")),X}catch{throw Z=new Error("xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies."),Z}}var G=null,q=null;async function We(){if(G)return G;if(q)throw q;try{return G=await Q.runTrustedAsync(()=>import("@mongodb-js/zstd")),G}catch{throw q=new Error("zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd"),q}}var A=100*1024*1024,De=512,Re=1e4;function Et(e){let t="file";e.isDirectory?t="directory":e.isSymlink&&(t="symlink");let i=e.name;e.isDirectory&&!i.endsWith("/")&&(i+="/");let r;e.content!==void 0&&(typeof e.content=="string"?r=new TextEncoder().encode(e.content):r=e.content);let n=e.isDirectory||e.isSymlink?0:r?.length??0;return{header:{name:i,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:n,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??"",uname:"user",gname:"user"},body:r}}async function O(e){let t=e.map(Et);return Oe(t)}async function je(e){let t=await O(e),n=new ReadableStream({start(l){l.enqueue(t),l.close()}}).pipeThrough(Fe()).getReader(),s=[];for(;;){let{done:l,value:f}=await n.read();if(l)break;s.push(f)}let a=s.reduce((l,f)=>l+f.length,0),o=new Uint8Array(a),c=0;for(let l of s)o.set(l,c),c+=l.length;return o}async function F(e){if(e.length>A)return{entries:[],error:`Archive too large (max ${A} bytes)`};if(e.length<De||e.length%De!==0)return{entries:[],error:"Invalid tar archive format"};try{let t=await Ue(e),i=[];for(let r of t){if(i.length>=Re)return{entries:i,error:`Too many entries (max ${Re})`};let n="file";switch(r.header.type){case"directory":n="directory";break;case"symlink":n="symlink";break;case"link":n="hardlink";break;case"file":n="file";break;default:n="other"}i.push({name:r.header.name,mode:r.header.mode??420,uid:r.header.uid??0,gid:r.header.gid??0,size:r.header.size,mtime:r.header.mtime??new Date,type:n,linkTarget:r.header.linkname||void 0,content:r.data??new Uint8Array(0)})}return{entries:i}}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function se(e){if(e.length>A)return{entries:[],error:`Archive too large (max ${A} bytes)`};try{let r=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(Ie()).getReader(),n=[],s=0;for(;;){let{done:c,value:l}=await r.read();if(c)break;if(s+=l.length,s>A)return await r.cancel(),{entries:[],error:`Decompressed archive too large (max ${A} bytes)`};n.push(l)}let a=new Uint8Array(s),o=0;for(let c of n)a.set(c,o),o+=c.length;return F(a)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:`Decompression failed: ${i}`}}}function oe(e){return e.length>=2&&e[0]===31&&e[1]===139}function ae(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function le(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function $t(e){let t=At.decode(Buffer.from(e));return new Uint8Array(t)}async function Bt(e){return Le(e,9)}async function Tt(e){let i=(await Me()).unxzSync(Buffer.from(e));return new Uint8Array(i)}async function St(e){let i=(await Me()).xzSync(Buffer.from(e));return new Uint8Array(i)}async function He(e){let t=await O(e);return Bt(t)}async function _e(e,t){if(!t?.allowNativeCodecs)throw new Error("xz compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.");let i=await O(e);return St(i)}async function ce(e){if(e.length>A)return{entries:[],error:`Archive too large (max ${A} bytes)`};try{let t=await $t(e);return t.length>A?{entries:[],error:`Decompressed archive too large (max ${A} bytes)`}:F(t)}catch(t){let i=t instanceof Error?t.message:"Unknown error";return{entries:[],error:i}}}async function fe(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:"xz decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction."};if(e.length>A)return{entries:[],error:`Archive too large (max ${A} bytes)`};try{let i=await Tt(e);return i.length>A?{entries:[],error:`Decompressed archive too large (max ${A} bytes)`}:F(i)}catch(i){let r=i instanceof Error?i.message:"Unknown error";return{entries:[],error:r}}}function ue(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function Ft(e){let i=await(await We()).compress(Buffer.from(e),3);return new Uint8Array(i)}async function It(e){let i=await(await We()).decompress(Buffer.from(e));return new Uint8Array(i)}async function Xe(e,t){if(!t?.allowNativeCodecs)throw new Error("zstd compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.");let i=await O(e);return Ft(i)}async function de(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:"zstd decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction."};if(e.length>A)return{entries:[],error:`Archive too large (max ${A} bytes)`};try{let i=await It(e);return i.length>A?{entries:[],error:`Decompressed archive too large (max ${A} bytes)`}:F(i)}catch(i){let r=i instanceof Error?i.message:"Unknown error";return{entries:[],error:r}}}function Ze(e){let t={create:!1,append:!1,update:!1,extract:!1,list:!1,file:"",autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:"",preserve:!1,absoluteNames:!1,strip:0,exclude:[],filesFrom:"",excludeFrom:"",wildcards:!1},i=[],r=0;for(;r<e.length;){let n=e[r];if(n.startsWith("-")&&!n.startsWith("--")&&n.length>2){if(/^-\d+$/.test(n)){i.push(n),r++;continue}for(let s=1;s<n.length;s++){let a=n[s];switch(a){case"c":t.create=!0;break;case"r":t.append=!0;break;case"u":t.update=!0;break;case"x":t.extract=!0;break;case"t":t.list=!0;break;case"a":t.autoCompress=!0;break;case"z":t.gzip=!0;break;case"j":t.bzip2=!0;break;case"J":t.xz=!0;break;case"v":t.verbose=!0;break;case"O":t.toStdout=!0;break;case"k":t.keepOldFiles=!0;break;case"m":t.touch=!0;break;case"p":t.preserve=!0;break;case"P":t.absoluteNames=!0;break;case"f":if(s<n.length-1)t.file=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
4
|
+
`,exitCode:2}};t.file=e[r]}break;case"C":if(s<n.length-1)t.directory=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
5
|
+
`,exitCode:2}};t.directory=e[r]}break;case"T":if(s<n.length-1)t.filesFrom=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
6
|
+
`,exitCode:2}};t.filesFrom=e[r]}break;case"X":if(s<n.length-1)t.excludeFrom=n.substring(s+1),s=n.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
7
|
+
`,exitCode:2}};t.excludeFrom=e[r]}break;default:return{ok:!1,error:ee("tar",`-${a}`)}}}r++;continue}if(n==="-c"||n==="--create")t.create=!0;else if(n==="-r"||n==="--append")t.append=!0;else if(n==="-u"||n==="--update")t.update=!0;else if(n==="-x"||n==="--extract"||n==="--get")t.extract=!0;else if(n==="-t"||n==="--list")t.list=!0;else if(n==="-a"||n==="--auto-compress")t.autoCompress=!0;else if(n==="-z"||n==="--gzip"||n==="--gunzip")t.gzip=!0;else if(n==="-j"||n==="--bzip2")t.bzip2=!0;else if(n==="-J"||n==="--xz")t.xz=!0;else if(n==="--zstd")t.zstd=!0;else if(n==="-v"||n==="--verbose")t.verbose=!0;else if(n==="-O"||n==="--to-stdout")t.toStdout=!0;else if(n==="-k"||n==="--keep-old-files")t.keepOldFiles=!0;else if(n==="-m"||n==="--touch")t.touch=!0;else if(n==="--wildcards")t.wildcards=!0;else if(n==="-p"||n==="--preserve"||n==="--preserve-permissions")t.preserve=!0;else if(n==="-P"||n==="--absolute-names")t.absoluteNames=!0;else if(n==="-f"||n==="--file"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
|
|
8
|
+
`,exitCode:2}};t.file=e[r]}else if(n.startsWith("--file="))t.file=n.substring(7);else if(n==="-C"||n==="--directory"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
|
|
9
|
+
`,exitCode:2}};t.directory=e[r]}else if(n.startsWith("--directory="))t.directory=n.substring(12);else if(n.startsWith("--strip-components=")||n.startsWith("--strip=")){let s=n.includes("--strip-components=")?n.substring(19):n.substring(8),a=parseInt(s,10);if(Number.isNaN(a)||a<0)return{ok:!1,error:{stdout:"",stderr:`tar: invalid number for --strip: '${s}'
|
|
10
|
+
`,exitCode:2}};t.strip=a}else if(n.startsWith("--exclude="))t.exclude.push(n.substring(10));else if(n==="--exclude"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option '--exclude' requires an argument
|
|
11
|
+
`,exitCode:2}};t.exclude.push(e[r])}else if(n==="-T"||n==="--files-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
|
|
12
|
+
`,exitCode:2}};t.filesFrom=e[r]}else if(n.startsWith("--files-from="))t.filesFrom=n.substring(13);else if(n==="-X"||n==="--exclude-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
|
|
13
|
+
`,exitCode:2}};t.excludeFrom=e[r]}else if(n.startsWith("--exclude-from="))t.excludeFrom=n.substring(15);else if(n==="--"){i.push(...e.slice(r+1));break}else{if(n.startsWith("-"))return{ok:!1,error:ee("tar",n)};i.push(n)}r++}return{ok:!0,options:t,files:i}}var Ge=100,Pt={name:"tar",summary:"manipulate tape archives",usage:"tar [options] [file...]",description:["Create, extract, or list contents of tar archives.","","One of -c, -r, -u, -x, or -t is required to specify the operation."],options:["-c, --create create a new archive","-r, --append append files to the end of an archive","-u, --update only append files newer than copy in archive","-x, --extract extract files from an archive","-t, --list list contents of an archive","-f, --file=ARCHIVE use archive file ARCHIVE","-a, --auto-compress use archive suffix to determine compression","-z, --gzip filter archive through gzip","-j, --bzip2 filter archive through bzip2","-J, --xz filter archive through xz","--zstd filter archive through zstd","-v, --verbose verbosely list files processed","-O, --to-stdout extract files to standard output","-k, --keep-old-files don't replace existing files when extracting","-m, --touch don't extract file modified time","-C, --directory=DIR change to directory DIR before performing operations","-p, --preserve preserve permissions","-P, --absolute-names do not strip leading '/' or block '..' paths","-T, --files-from=FILE read files to extract/create from FILE","-X, --exclude-from=FILE read exclude patterns from FILE","--strip=N strip N leading path components on extraction","--exclude=PATTERN exclude files matching PATTERN","--wildcards use wildcards for pattern matching"," --help display this help and exit"],examples:["tar -cvf archive.tar file1 file2 Create archive from files","tar -czvf archive.tar.gz dir/ Create gzip-compressed archive","tar -cjvf archive.tar.bz2 dir/ Create bzip2-compressed archive","tar -rf archive.tar newfile.txt Append file to archive","tar -uf archive.tar dir/ Update archive with newer files","tar -xvf archive.tar Extract archive","tar -xvf archive.tar -C /tmp Extract to /tmp","tar -tvf archive.tar List archive contents","tar -xzf archive.tar.gz Extract gzip archive","tar -xf archive.tar file1.txt Extract specific file","tar -xOf archive.tar file.txt Extract file to stdout","tar -xf archive.tar --wildcards '*.txt' Extract matching files"]};function me(e,t){let i=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;for(let r of t){let n=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,".");if(U(`^${n}$`).test(e)||U(`^${n}/`).test(e)||!r.includes("/")&&U(`^${n}$`).test(i))return!0}return!1}function Y(e,t){let i=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,"."),r=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;return U(`^${i}$`).test(e)||U(`^${i}$`).test(r)}function qe(e,t){if(t<=0)return e;let i=e.split("/").filter(r=>r!=="");return i.length<=t?"":i.slice(t).join("/")}function Ye(e){return e.split("/").some(t=>t==="..")}function Ot(e,t){if(t)return{safePath:e};let i=e.replace(/^\/+/,"");return i.length===0?{safePath:""}:Ye(i)?{error:"Path contains '..'"}:{safePath:i}}function Ut(e){let i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=e.getDate().toString().padStart(2," "),n=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0");return`${i} ${r} ${n}:${s}`}async function K(e,t,i,r){let n=[],s=[],a=e.fs.resolvePath(t,i);try{let o=await e.fs.stat(a);if(me(i,r))return{entries:n,errors:s};if(o.isDirectory){n.push({name:i,isDirectory:!0,mode:o.mode,mtime:o.mtime});let c=await e.fs.readdir(a);for(let l=0;l<c.length;l+=Ge){let f=c.slice(l,l+Ge),u=await Promise.all(f.map(y=>K(e,t,i?`${i}/${y}`:y,r)));for(let y of u)n.push(...y.entries),s.push(...y.errors)}}else if(o.isFile){let c=await e.fs.readFileBuffer(a);n.push({name:i,content:c,mode:o.mode,mtime:o.mtime})}else if(o.isSymbolicLink){let c=await e.fs.readlink(a);n.push({name:i,isSymlink:!0,linkTarget:c,mode:o.mode,mtime:o.mtime})}}catch(o){let c=o instanceof Error?o.message:"unknown error";s.push(`tar: ${i}: ${c}`)}return{entries:n,errors:s}}async function Nt(e,t,i){if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to create an empty archive
|
|
14
|
+
`,exitCode:2};let r=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,n=[],s=[],a="";for(let f of i){let{entries:u,errors:y}=await K(e,r,f,t.exclude);if(n.push(...u),s.push(...y),t.verbose)for(let g of u)a+=`${g.name}${g.isDirectory?"/":""}
|
|
15
|
+
`}if(n.length===0&&s.length>0)return{stdout:"",stderr:`${s.join(`
|
|
16
|
+
`)}
|
|
17
|
+
`,exitCode:2};let o;try{t.gzip?o=await je(n):t.bzip2?o=await He(n):t.xz?o=await _e(n):t.zstd?o=await Xe(n):o=await O(n)}catch(f){return{stdout:"",stderr:`tar: error creating archive: ${f instanceof Error?f.message:"unknown error"}
|
|
18
|
+
`,exitCode:2}}let c="";if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{await e.fs.writeFile(f,o)}catch(u){let y=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${y}
|
|
19
|
+
`,exitCode:2}}}else c=Buffer.from(o).toString("latin1");let l=a;return s.length>0&&(l+=`${s.join(`
|
|
20
|
+
`)}
|
|
21
|
+
`),{stdout:c,stderr:l,exitCode:s.length>0?2:0,stdoutKind:c.length>0?"bytes":"text"}}async function Lt(e,t,i){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot append to stdin/stdout
|
|
22
|
+
`,exitCode:2};if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to append nothing to archive
|
|
23
|
+
`,exitCode:2};let r=e.fs.resolvePath(e.cwd,t.file),n;try{n=await e.fs.readFileBuffer(r)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
24
|
+
`,exitCode:2}}let s=await F(n);if(s.error)return{stdout:"",stderr:`tar: ${s.error}
|
|
25
|
+
`,exitCode:2};let a=s.entries.map(d=>({name:d.name,content:d.content,mode:d.mode,mtime:d.mtime,isDirectory:d.type==="directory",isSymlink:d.type==="symlink",linkTarget:d.linkTarget,uid:d.uid,gid:d.gid})),o=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],f="";for(let d of i){let{entries:p,errors:m}=await K(e,o,d,t.exclude);if(c.push(...p),l.push(...m),t.verbose)for(let x of p)f+=`${x.name}${x.isDirectory?"/":""}
|
|
26
|
+
`}let u=[...a,...c],y;try{y=await O(u)}catch(d){return{stdout:"",stderr:`tar: error creating archive: ${d instanceof Error?d.message:"unknown error"}
|
|
27
|
+
`,exitCode:2}}try{await e.fs.writeFile(r,y)}catch(d){let p=d instanceof Error?d.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${p}
|
|
28
|
+
`,exitCode:2}}let g=f;return l.length>0&&(g+=`${l.join(`
|
|
29
|
+
`)}
|
|
30
|
+
`),{stdout:"",stderr:g,exitCode:l.length>0?2:0}}async function Dt(e,t,i){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot update stdin/stdout
|
|
31
|
+
`,exitCode:2};if(i.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to update with nothing
|
|
32
|
+
`,exitCode:2};let r=e.fs.resolvePath(e.cwd,t.file),n;try{n=await e.fs.readFileBuffer(r)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
33
|
+
`,exitCode:2}}let s=await F(n);if(s.error)return{stdout:"",stderr:`tar: ${s.error}
|
|
34
|
+
`,exitCode:2};let a=new Map;for(let m of s.entries)a.set(m.name,m.mtime);let o=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],f="";for(let m of i){let{entries:x,errors:b}=await K(e,o,m,t.exclude);l.push(...b);for(let E of x){let v=a.get(E.name);(!v||E.mtime&&E.mtime.getTime()>v.getTime())&&(c.push(E),t.verbose&&(f+=`${E.name}${E.isDirectory?"/":""}
|
|
35
|
+
`))}}if(c.length===0){let m="";return l.length>0&&(m=`${l.join(`
|
|
36
|
+
`)}
|
|
37
|
+
`),{stdout:"",stderr:m,exitCode:l.length>0?2:0}}let u=new Set(c.map(m=>m.name)),g=[...s.entries.filter(m=>!u.has(m.name)).map(m=>({name:m.name,content:m.content,mode:m.mode,mtime:m.mtime,isDirectory:m.type==="directory",isSymlink:m.type==="symlink",linkTarget:m.linkTarget,uid:m.uid,gid:m.gid})),...c],d;try{d=await O(g)}catch(m){return{stdout:"",stderr:`tar: error creating archive: ${m instanceof Error?m.message:"unknown error"}
|
|
38
|
+
`,exitCode:2}}try{await e.fs.writeFile(r,d)}catch(m){let x=m instanceof Error?m.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${x}
|
|
39
|
+
`,exitCode:2}}let p=f;return l.length>0&&(p+=`${l.join(`
|
|
40
|
+
`)}
|
|
41
|
+
`),{stdout:"",stderr:p,exitCode:l.length>0?2:0}}async function Rt(e,t,i){let r;if(t.file&&t.file!=="-"){let p=e.fs.resolvePath(e.cwd,t.file);try{r=await e.fs.readFileBuffer(p)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
42
|
+
`,exitCode:2}}}else r=Uint8Array.from(e.stdin,p=>p.charCodeAt(0));let n,s=t.gzip||oe(r),a=t.bzip2||ae(r),o=t.xz||le(r),c=t.zstd||ue(r);if(s?n=await se(r):a?n=await ce(r):o?n=await fe(r):c?n=await de(r):n=await F(r),n.error)return{stdout:"",stderr:`tar: ${n.error}
|
|
43
|
+
`,exitCode:2};let l=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,f=t.absoluteNames?i:i.map(p=>p.replace(/^\/+/,"")).filter(p=>p.length>0),u="",y="",g=[];if(t.directory&&!t.toStdout)try{await e.fs.mkdir(l,{recursive:!0})}catch{}for(let p of n.entries){let m=qe(p.name,t.strip);if(!m)continue;let x=Ot(m,t.absoluteNames);if(x.error){g.push(`tar: ${m}: ${x.error}`);continue}let b=x.safePath??"";if(!b)continue;let E=b.endsWith("/")?b.slice(0,-1):b;if(f.length>0){let $;if(t.wildcards?$=f.some(z=>Y(b,z)||Y(E,z)||b.startsWith(`${z}/`)):$=f.some(z=>b===z||b.startsWith(`${z}/`)||E===z),!$)continue}if(me(b,t.exclude))continue;let v=e.fs.resolvePath(l,b);try{if(p.type==="directory"){if(t.toStdout)continue;await e.fs.mkdir(v,{recursive:!0}),t.verbose&&(u+=`${b}
|
|
44
|
+
`)}else if(p.type==="file"){if(t.toStdout){y+=new TextDecoder().decode(p.content),t.verbose&&(u+=`${b}
|
|
45
|
+
`);continue}if(t.keepOldFiles)try{await e.fs.stat(v),t.verbose&&(u+=`${b}: not overwritten, file exists
|
|
46
|
+
`);continue}catch{}let $=v.substring(0,v.lastIndexOf("/"));if($)try{await e.fs.mkdir($,{recursive:!0})}catch{}if(await e.fs.writeFile(v,p.content),t.preserve&&p.mode)try{await e.fs.chmod(v,p.mode)}catch{}t.verbose&&(u+=`${b}
|
|
47
|
+
`)}else if(p.type==="symlink"&&p.linkTarget){if(t.toStdout)continue;if(!t.absoluteNames&&(p.linkTarget.startsWith("/")||Ye(p.linkTarget))){g.push(`tar: ${b}: unsafe symlink target`);continue}if(t.keepOldFiles)try{await e.fs.stat(v),t.verbose&&(u+=`${b}: not overwritten, file exists
|
|
48
|
+
`);continue}catch{}let $=v.substring(0,v.lastIndexOf("/"));if($)try{await e.fs.mkdir($,{recursive:!0})}catch{}try{await e.fs.symlink(p.linkTarget,v)}catch{}t.verbose&&(u+=`${b}
|
|
49
|
+
`)}}catch($){let z=$ instanceof Error?$.message:"unknown error";g.push(`tar: ${b}: ${z}`)}}let d=u;return g.length>0&&(d+=`${g.join(`
|
|
50
|
+
`)}
|
|
51
|
+
`),{stdout:y,stderr:d,exitCode:g.length>0?2:0}}async function Mt(e,t,i){let r;if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{r=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
|
|
52
|
+
`,exitCode:2}}}else r=Uint8Array.from(e.stdin,f=>f.charCodeAt(0));let n,s=t.gzip||oe(r),a=t.bzip2||ae(r),o=t.xz||le(r),c=t.zstd||ue(r);if(s?n=await se(r):a?n=await ce(r):o?n=await fe(r):c?n=await de(r):n=await F(r),n.error)return{stdout:"",stderr:`tar: ${n.error}
|
|
53
|
+
`,exitCode:2};let l="";for(let f of n.entries){let u=qe(f.name,t.strip);if(!u)continue;let y=u.endsWith("/")?u.slice(0,-1):u;if(i.length>0){let g;if(t.wildcards?g=i.some(d=>Y(u,d)||Y(y,d)||u.startsWith(`${d}/`)):g=i.some(d=>u===d||u.startsWith(`${d}/`)||y===d),!g)continue}if(!me(u,t.exclude))if(t.verbose){let g=f.type==="directory",d=ye(f.mode,g),p=`${f.uid}/${f.gid}`,m=f.size.toString().padStart(8," "),x=Ut(f.mtime),b=`${d} ${p.padEnd(10)} ${m} ${x} ${u}`;f.type==="symlink"&&f.linkTarget&&(b+=` -> ${f.linkTarget}`),l+=`${b}
|
|
54
|
+
`}else l+=`${u}
|
|
55
|
+
`}return{stdout:l,stderr:"",exitCode:0}}var sr={name:"tar",async execute(e,t){if(ge(e))return pe(Pt);let i=Ze(e);if(!i.ok)return i.error;let{options:r,files:n}=i,s=[r.create,r.append,r.update,r.extract,r.list].filter(Boolean).length;if(s===0)return{stdout:"",stderr:`tar: You must specify one of -c, -r, -u, -x, or -t
|
|
56
|
+
`,exitCode:2};if(s>1)return{stdout:"",stderr:`tar: You may not specify more than one of -c, -r, -u, -x, or -t
|
|
57
|
+
`,exitCode:2};if(r.autoCompress&&r.file&&r.create){let c=r.file.toLowerCase();c.endsWith(".tar.gz")||c.endsWith(".tgz")?r.gzip=!0:c.endsWith(".tar.bz2")||c.endsWith(".tbz2")?r.bzip2=!0:c.endsWith(".tar.xz")||c.endsWith(".txz")?r.xz=!0:(c.endsWith(".tar.zst")||c.endsWith(".tzst"))&&(r.zstd=!0)}let a=[r.gzip,r.bzip2,r.xz,r.zstd].filter(Boolean).length;if(a>1)return{stdout:"",stderr:`tar: You may not specify more than one compression option
|
|
58
|
+
`,exitCode:2};if((r.append||r.update)&&a>0)return{stdout:"",stderr:`tar: Cannot append/update compressed archives - decompress first
|
|
59
|
+
`,exitCode:2};let o=n;if(r.filesFrom){let c=t.fs.resolvePath(t.cwd,r.filesFrom);try{let f=(await t.fs.readFile(c)).split(`
|
|
60
|
+
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));o=[...n,...f]}catch{return{stdout:"",stderr:`tar: ${r.filesFrom}: Cannot open: No such file or directory
|
|
61
|
+
`,exitCode:2}}}if(r.excludeFrom){let c=t.fs.resolvePath(t.cwd,r.excludeFrom);try{let f=(await t.fs.readFile(c)).split(`
|
|
62
|
+
`).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));r.exclude.push(...f)}catch{return{stdout:"",stderr:`tar: ${r.excludeFrom}: Cannot open: No such file or directory
|
|
63
|
+
`,exitCode:2}}}return r.create?Nt(t,r,o):r.append?Lt(t,r,o):r.update?Dt(t,r,o):r.extract?Rt(t,r,o):Mt(t,r,o)}},or={name:"tar",flags:[{flag:"-c",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-f",type:"value",valueHint:"path"},{flag:"-z",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-C",type:"value",valueHint:"path"},{flag:"--strip-components",type:"value",valueHint:"number"},{flag:"--exclude",type:"value",valueHint:"pattern"}],needsArgs:!0};export{sr as a,or as b};
|