just-bash 1.2.5 → 1.3.1
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/README.md +1 -1
- package/dist/ai/index.d.ts +5 -0
- package/dist/ast/types.d.ts +2 -0
- package/dist/bin/chunks/{alias-74DFXE2E.js → alias-ZAQAKC5X.js} +1 -1
- package/dist/bin/chunks/{awk2-4DKPX43H.js → awk2-A73ZNFXJ.js} +1 -1
- package/dist/bin/chunks/base64-JPITV4MD.js +6 -0
- package/dist/bin/chunks/{basename-Y7JDBYHN.js → basename-IYEP3AMY.js} +1 -1
- package/dist/bin/{shell/chunks/bash-5IWSVGHN.js → chunks/bash-WZYHIZP6.js} +1 -1
- package/dist/bin/{shell/chunks/cat-YZXBF5YF.js → chunks/cat-XILYL7NW.js} +1 -1
- package/dist/bin/chunks/{chmod-3G4LK462.js → chmod-EXWX4N7Y.js} +1 -1
- package/dist/bin/chunks/chunk-GX4MPCG6.js +9 -0
- package/dist/bin/chunks/chunk-SJXDWN5X.js +2 -0
- package/dist/bin/{shell/chunks/clear-GTCFHSB2.js → chunks/clear-2APRIRCF.js} +1 -1
- package/dist/bin/chunks/comm-KY3COLF5.js +13 -0
- package/dist/bin/{shell/chunks/cp-77UY7PGN.js → chunks/cp-HES4UN7K.js} +1 -1
- package/dist/bin/chunks/{curl-NE7XEWMN.js → curl-BN5M3BUX.js} +1 -1
- package/dist/bin/chunks/{cut-UYV3FM7R.js → cut-JSIPAKOX.js} +1 -1
- package/dist/bin/chunks/{date-7NBRXV2Z.js → date-CU4J7GHI.js} +1 -1
- package/dist/bin/chunks/{diff-TG2NXCX2.js → diff-W4JRNHXW.js} +1 -1
- package/dist/bin/chunks/{dirname-VLHP44TU.js → dirname-UTCUUILN.js} +1 -1
- package/dist/bin/chunks/{du-4FZ7WF2P.js → du-2JU3PUTM.js} +1 -1
- package/dist/bin/chunks/{echo-DEUIS5JO.js → echo-HKLPYMNC.js} +1 -1
- package/dist/bin/chunks/{env-AKGX6HSG.js → env-2SBJNP7X.js} +1 -1
- package/dist/bin/chunks/{expr-HA2ZNL6S.js → expr-M74QZQ6C.js} +1 -1
- package/dist/bin/chunks/file-QPD3U2H7.js +23 -0
- package/dist/bin/{shell/chunks/find-JADNFF7V.js → chunks/find-D3ZC5DXH.js} +1 -1
- package/dist/bin/chunks/grep-BEZRXAWL.js +15 -0
- package/dist/bin/{shell/chunks/head-VGXR3WWL.js → chunks/head-YGMY3DHE.js} +1 -1
- package/dist/bin/chunks/{help-YQGNAT2T.js → help-UEF7LW7F.js} +1 -1
- package/dist/bin/{shell/chunks/history-PRQ4B6N2.js → chunks/history-OGBCIAR5.js} +1 -1
- package/dist/bin/chunks/{html-to-markdown-L4UWMK4S.js → html-to-markdown-HTGML4TH.js} +1 -1
- package/dist/bin/chunks/jq-ME57VHK6.js +14 -0
- package/dist/bin/chunks/{ln-DB7J2W5X.js → ln-RUR4ALOJ.js} +1 -1
- package/dist/bin/{shell/chunks/ls-C4MPAF3H.js → chunks/ls-GU5227KE.js} +1 -1
- package/dist/bin/chunks/md5sum-C7WDEYN5.js +2 -0
- package/dist/bin/chunks/{mkdir-LWULWDHP.js → mkdir-4OYU22AA.js} +1 -1
- package/dist/bin/chunks/{mv-TDYCNSIQ.js → mv-H3S4FEWR.js} +1 -1
- package/dist/bin/chunks/{paste-R36J3G4K.js → paste-HHCFASL4.js} +1 -1
- package/dist/bin/chunks/{printf-WM4X6IZ6.js → printf-2JFCUFOA.js} +1 -1
- package/dist/bin/chunks/{pwd-X4MWD4JP.js → pwd-T5Q3JEBO.js} +1 -1
- package/dist/bin/chunks/{readlink-DPNOQY67.js → readlink-M44TLMFS.js} +1 -1
- package/dist/bin/chunks/{rm-W6CCBEMG.js → rm-R4M647EC.js} +1 -1
- package/dist/bin/chunks/{sed-LTCVBSRV.js → sed-QLLAZYHH.js} +1 -1
- package/dist/bin/chunks/{seq-DGJILX2Q.js → seq-GJMQM7SP.js} +1 -1
- package/dist/bin/chunks/sha1sum-WKCGV66X.js +2 -0
- package/dist/bin/chunks/sha256sum-3ZDGP5WC.js +2 -0
- package/dist/bin/chunks/{sleep-E4DIYGTT.js → sleep-OJPODQGM.js} +1 -1
- package/dist/bin/chunks/sort-JL33INQB.js +16 -0
- package/dist/bin/{shell/chunks/stat-3PHITCPO.js → chunks/stat-CR2INBC2.js} +1 -1
- package/dist/bin/chunks/{tail-YSVKBQ77.js → tail-BYPLMYMZ.js} +1 -1
- package/dist/bin/chunks/{tee-UU2VS3OM.js → tee-HOMRRC3X.js} +1 -1
- package/dist/bin/chunks/{timeout-RP2AJGMV.js → timeout-MYKG34DQ.js} +1 -1
- package/dist/bin/{shell/chunks/touch-XCIAYF5I.js → chunks/touch-3ZANYAXI.js} +1 -1
- package/dist/bin/chunks/{tr-2EEKHHO6.js → tr-E66N7IS2.js} +1 -1
- package/dist/bin/chunks/{tree-4247W67O.js → tree-EE2PYIMV.js} +1 -1
- package/dist/bin/chunks/{true-JCX733LK.js → true-OWPVS7U4.js} +1 -1
- package/dist/bin/chunks/{uniq-W4HF6YSB.js → uniq-F5NP3LLU.js} +1 -1
- package/dist/bin/chunks/{wc-CNJ3QDRA.js → wc-NBMNJDZL.js} +1 -1
- package/dist/bin/chunks/{which-HX2NMOP3.js → which-6MRG2UCF.js} +1 -1
- package/dist/bin/chunks/xargs-EMY5BOJ2.js +4 -0
- package/dist/bin/just-bash.js +124 -116
- package/dist/bin/shell/chunks/{alias-74DFXE2E.js → alias-ZAQAKC5X.js} +1 -1
- package/dist/bin/shell/chunks/{awk2-4DKPX43H.js → awk2-A73ZNFXJ.js} +1 -1
- package/dist/bin/shell/chunks/base64-JPITV4MD.js +6 -0
- package/dist/bin/shell/chunks/{basename-Y7JDBYHN.js → basename-IYEP3AMY.js} +1 -1
- package/dist/bin/{chunks/bash-5IWSVGHN.js → shell/chunks/bash-WZYHIZP6.js} +1 -1
- package/dist/bin/{chunks/cat-YZXBF5YF.js → shell/chunks/cat-XILYL7NW.js} +1 -1
- package/dist/bin/shell/chunks/{chmod-3G4LK462.js → chmod-EXWX4N7Y.js} +1 -1
- package/dist/bin/shell/chunks/chunk-GX4MPCG6.js +9 -0
- package/dist/bin/shell/chunks/chunk-SJXDWN5X.js +2 -0
- package/dist/bin/{chunks/clear-GTCFHSB2.js → shell/chunks/clear-2APRIRCF.js} +1 -1
- package/dist/bin/shell/chunks/comm-KY3COLF5.js +13 -0
- package/dist/bin/{chunks/cp-77UY7PGN.js → shell/chunks/cp-HES4UN7K.js} +1 -1
- package/dist/bin/shell/chunks/{curl-NE7XEWMN.js → curl-BN5M3BUX.js} +1 -1
- package/dist/bin/shell/chunks/{cut-UYV3FM7R.js → cut-JSIPAKOX.js} +1 -1
- package/dist/bin/shell/chunks/{date-7NBRXV2Z.js → date-CU4J7GHI.js} +1 -1
- package/dist/bin/shell/chunks/{diff-TG2NXCX2.js → diff-W4JRNHXW.js} +1 -1
- package/dist/bin/shell/chunks/{dirname-VLHP44TU.js → dirname-UTCUUILN.js} +1 -1
- package/dist/bin/shell/chunks/{du-4FZ7WF2P.js → du-2JU3PUTM.js} +1 -1
- package/dist/bin/shell/chunks/{echo-DEUIS5JO.js → echo-HKLPYMNC.js} +1 -1
- package/dist/bin/shell/chunks/{env-AKGX6HSG.js → env-2SBJNP7X.js} +1 -1
- package/dist/bin/shell/chunks/{expr-HA2ZNL6S.js → expr-M74QZQ6C.js} +1 -1
- package/dist/bin/shell/chunks/file-QPD3U2H7.js +23 -0
- package/dist/bin/{chunks/find-JADNFF7V.js → shell/chunks/find-D3ZC5DXH.js} +1 -1
- package/dist/bin/shell/chunks/grep-BEZRXAWL.js +15 -0
- package/dist/bin/{chunks/head-VGXR3WWL.js → shell/chunks/head-YGMY3DHE.js} +1 -1
- package/dist/bin/shell/chunks/{help-YQGNAT2T.js → help-UEF7LW7F.js} +1 -1
- package/dist/bin/{chunks/history-PRQ4B6N2.js → shell/chunks/history-OGBCIAR5.js} +1 -1
- package/dist/bin/shell/chunks/{html-to-markdown-L4UWMK4S.js → html-to-markdown-HTGML4TH.js} +1 -1
- package/dist/bin/shell/chunks/jq-ME57VHK6.js +14 -0
- package/dist/bin/shell/chunks/{ln-DB7J2W5X.js → ln-RUR4ALOJ.js} +1 -1
- package/dist/bin/{chunks/ls-C4MPAF3H.js → shell/chunks/ls-GU5227KE.js} +1 -1
- package/dist/bin/shell/chunks/md5sum-C7WDEYN5.js +2 -0
- package/dist/bin/shell/chunks/{mkdir-LWULWDHP.js → mkdir-4OYU22AA.js} +1 -1
- package/dist/bin/shell/chunks/{mv-TDYCNSIQ.js → mv-H3S4FEWR.js} +1 -1
- package/dist/bin/shell/chunks/{paste-R36J3G4K.js → paste-HHCFASL4.js} +1 -1
- package/dist/bin/shell/chunks/{printf-WM4X6IZ6.js → printf-2JFCUFOA.js} +1 -1
- package/dist/bin/shell/chunks/{pwd-X4MWD4JP.js → pwd-T5Q3JEBO.js} +1 -1
- package/dist/bin/shell/chunks/{readlink-DPNOQY67.js → readlink-M44TLMFS.js} +1 -1
- package/dist/bin/shell/chunks/{rm-W6CCBEMG.js → rm-R4M647EC.js} +1 -1
- package/dist/bin/shell/chunks/{sed-LTCVBSRV.js → sed-QLLAZYHH.js} +1 -1
- package/dist/bin/shell/chunks/{seq-DGJILX2Q.js → seq-GJMQM7SP.js} +1 -1
- package/dist/bin/shell/chunks/sha1sum-WKCGV66X.js +2 -0
- package/dist/bin/shell/chunks/sha256sum-3ZDGP5WC.js +2 -0
- package/dist/bin/shell/chunks/{sleep-E4DIYGTT.js → sleep-OJPODQGM.js} +1 -1
- package/dist/bin/shell/chunks/sort-JL33INQB.js +16 -0
- package/dist/bin/{chunks/stat-3PHITCPO.js → shell/chunks/stat-CR2INBC2.js} +1 -1
- package/dist/bin/shell/chunks/{tail-YSVKBQ77.js → tail-BYPLMYMZ.js} +1 -1
- package/dist/bin/shell/chunks/{tee-UU2VS3OM.js → tee-HOMRRC3X.js} +1 -1
- package/dist/bin/shell/chunks/{timeout-RP2AJGMV.js → timeout-MYKG34DQ.js} +1 -1
- package/dist/bin/{chunks/touch-XCIAYF5I.js → shell/chunks/touch-3ZANYAXI.js} +1 -1
- package/dist/bin/shell/chunks/{tr-2EEKHHO6.js → tr-E66N7IS2.js} +1 -1
- package/dist/bin/shell/chunks/{tree-4247W67O.js → tree-EE2PYIMV.js} +1 -1
- package/dist/bin/shell/chunks/{true-JCX733LK.js → true-OWPVS7U4.js} +1 -1
- package/dist/bin/shell/chunks/{uniq-W4HF6YSB.js → uniq-F5NP3LLU.js} +1 -1
- package/dist/bin/shell/chunks/{wc-CNJ3QDRA.js → wc-NBMNJDZL.js} +1 -1
- package/dist/bin/shell/chunks/{which-HX2NMOP3.js → which-6MRG2UCF.js} +1 -1
- package/dist/bin/shell/chunks/xargs-EMY5BOJ2.js +4 -0
- package/dist/bin/shell/shell.js +107 -99
- package/dist/bundle/ai/index.js +442 -393
- package/dist/bundle/chunks/{alias-7ZSTROM7.js → alias-JFIUWFGE.js} +1 -1
- package/dist/{bin/chunks/awk2-UYU2UYZ2.js → bundle/chunks/awk2-QWBT4IFJ.js} +1 -2
- package/dist/bundle/chunks/base64-TUA2XORD.js +5 -0
- package/dist/bundle/chunks/{basename-SB5JXIY3.js → basename-5UVU5RXR.js} +1 -1
- package/dist/bundle/chunks/{bash-5WG5RD6L.js → bash-BASUPKHJ.js} +1 -1
- package/dist/bundle/chunks/cat-47EP4IAV.js +5 -0
- package/dist/bundle/chunks/{chmod-VLKWIL3N.js → chmod-XJXFAD4M.js} +1 -1
- package/dist/bundle/chunks/chunk-2RUN43TJ.js +1 -0
- package/dist/bundle/chunks/chunk-46TSKXFW.js +8 -0
- package/dist/bundle/chunks/clear-XD3TJRVQ.js +1 -0
- package/dist/bundle/chunks/comm-KSJ4BBRQ.js +12 -0
- package/dist/bundle/chunks/cp-37OVLNLD.js +7 -0
- package/dist/bundle/chunks/{curl-PA2MWGKN.js → curl-C43O5WQS.js} +1 -1
- package/dist/bundle/chunks/cut-FIZRELKC.js +5 -0
- package/dist/bundle/chunks/{date-YOOSNZVA.js → date-NN5C354M.js} +1 -1
- package/dist/bundle/chunks/diff-GLRVCAKJ.js +6 -0
- package/dist/bundle/chunks/dirname-U2KVUSQY.js +4 -0
- package/dist/bundle/chunks/du-KRAFOIQK.js +7 -0
- package/dist/bundle/chunks/{echo-W2TA2N7Y.js → echo-WUKBESC7.js} +1 -1
- package/dist/bundle/chunks/env-MSPSPGCD.js +8 -0
- package/dist/bundle/chunks/{expr-A4LJAGVP.js → expr-HYOCSWK6.js} +1 -1
- package/dist/bundle/chunks/file-LQXX6P4Y.js +22 -0
- package/dist/{bin/shell/chunks/find-NCI6KGUI.js → bundle/chunks/find-R6LJIRBI.js} +1 -2
- package/dist/bundle/chunks/grep-ZJVDG3FA.js +14 -0
- package/dist/bundle/chunks/head-6PAUYCDP.js +1 -0
- package/dist/{bin/shell/chunks/help-5V3MPCYQ.js → bundle/chunks/help-5E6PYJWQ.js} +3 -4
- package/dist/bundle/chunks/history-SG6VRATI.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-ZSZ34PAN.js +4 -0
- package/dist/bundle/chunks/jq-ABWUP4LV.js +13 -0
- package/dist/bundle/chunks/ln-XFYHBIFL.js +9 -0
- package/dist/bundle/chunks/{ls-B7C35UDO.js → ls-JGYJQA2Y.js} +1 -1
- package/dist/bundle/chunks/md5sum-PIH6F3O3.js +1 -0
- package/dist/bundle/chunks/{mkdir-WYI2LJ6H.js → mkdir-HA2FJX4O.js} +1 -1
- package/dist/bundle/chunks/mv-7I62SB3I.js +6 -0
- package/dist/bundle/chunks/paste-QBGVCQFT.js +7 -0
- package/dist/bundle/chunks/{printf-O2UW73XK.js → printf-HBP44PXI.js} +1 -1
- package/dist/bundle/chunks/pwd-CEF235GL.js +2 -0
- package/dist/bundle/chunks/readlink-MQIMKDSA.js +6 -0
- package/dist/bundle/chunks/{rm-5X2XSQQ6.js → rm-NF3FNLAY.js} +1 -1
- package/dist/{bin/shell/chunks/sed-B6FXUN7R.js → bundle/chunks/sed-H2RWPMTM.js} +1 -2
- package/dist/bundle/chunks/{seq-TFPZQZPJ.js → seq-VKYIUOPJ.js} +1 -1
- package/dist/bundle/chunks/sha1sum-HVHNZSEC.js +1 -0
- package/dist/bundle/chunks/sha256sum-REOOJORK.js +1 -0
- package/dist/bundle/chunks/{sleep-QJBQD6VS.js → sleep-AFN3PHJW.js} +1 -1
- package/dist/bundle/chunks/sort-XODGFZC4.js +15 -0
- package/dist/bundle/chunks/{stat-TM5F5YO4.js → stat-FVFLDQGP.js} +1 -1
- package/dist/bundle/chunks/tail-QXKYHAML.js +1 -0
- package/dist/bundle/chunks/tee-W5HCCBPO.js +2 -0
- package/dist/bundle/chunks/{timeout-VG2N46UR.js → timeout-XAA3N7CF.js} +1 -1
- package/dist/bundle/chunks/{touch-Z5XRYFYY.js → touch-FOE745V2.js} +1 -1
- package/dist/bundle/chunks/{tr-UV4V27RJ.js → tr-LMLGE4IE.js} +1 -1
- package/dist/bundle/chunks/{tree-75UXQ4XJ.js → tree-WBUGLVP5.js} +1 -1
- package/dist/bundle/chunks/true-6LGCG4EY.js +1 -0
- package/dist/bundle/chunks/uniq-7PFWPNWK.js +4 -0
- package/dist/bundle/chunks/wc-GV5WUREX.js +5 -0
- package/dist/bundle/chunks/which-KHFYPBWW.js +2 -0
- package/dist/bundle/chunks/xargs-NQBNFMCT.js +3 -0
- package/dist/bundle/index.js +120 -112
- package/dist/commands/comm/comm.d.ts +10 -0
- package/dist/commands/file/file.d.ts +7 -0
- package/dist/commands/md5sum/checksum.d.ts +7 -0
- package/dist/commands/{awk/awk.d.ts → md5sum/md5sum.d.ts} +1 -1
- package/dist/commands/md5sum/sha1sum.d.ts +2 -0
- package/dist/commands/md5sum/sha256sum.d.ts +2 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/sort/types.d.ts +12 -0
- package/dist/interpreter/types.d.ts +6 -0
- package/dist/shell-metadata.d.ts +28 -0
- package/package.json +2 -1
- package/dist/bin/chunks/awk-S63F6IYK.js +0 -15
- package/dist/bin/chunks/awk2-6XCE67AX.js +0 -20
- package/dist/bin/chunks/awk2-DKAZ7LPG.js +0 -20
- package/dist/bin/chunks/awk2-GAJ72X3Z.js +0 -20
- package/dist/bin/chunks/awk2-HJAPWU2N.js +0 -18
- package/dist/bin/chunks/awk2-LVXC5OAC.js +0 -20
- package/dist/bin/chunks/awk2-T6HR4EYO.js +0 -20
- package/dist/bin/chunks/awk2-W64AZN7P.js +0 -20
- package/dist/bin/chunks/base64-NC7HTKLZ.js +0 -5
- package/dist/bin/chunks/bash-TQGTNXAE.js +0 -7
- package/dist/bin/chunks/chunk-5KNEBKYN.js +0 -2
- package/dist/bin/chunks/chunk-6QUZ7QML.js +0 -3
- package/dist/bin/chunks/chunk-LV662IGP.js +0 -6
- package/dist/bin/chunks/env-FVITWNHG.js +0 -9
- package/dist/bin/chunks/find-4B67H4RP.js +0 -11
- package/dist/bin/chunks/find-7BUNQZX4.js +0 -11
- package/dist/bin/chunks/find-AMA6ABN5.js +0 -11
- package/dist/bin/chunks/find-HW2TUO6B.js +0 -11
- package/dist/bin/chunks/find-NCI6KGUI.js +0 -11
- package/dist/bin/chunks/find-QEYP42JQ.js +0 -11
- package/dist/bin/chunks/find-WJV3FM6L.js +0 -11
- package/dist/bin/chunks/find-YATLECXJ.js +0 -11
- package/dist/bin/chunks/grep-OVWU4WCZ.js +0 -15
- package/dist/bin/chunks/grep-PHBFGJCV.js +0 -15
- package/dist/bin/chunks/help-5V3MPCYQ.js +0 -16
- package/dist/bin/chunks/jq-EYSXBSCP.js +0 -14
- package/dist/bin/chunks/printf-ASOYDPIK.js +0 -14
- package/dist/bin/chunks/printf-BOFQVMMK.js +0 -15
- package/dist/bin/chunks/sed-7IS44XON.js +0 -48
- package/dist/bin/chunks/sed-B6FXUN7R.js +0 -80
- package/dist/bin/chunks/sed-RHLDIXPL.js +0 -76
- package/dist/bin/chunks/sed-SYSATJXR.js +0 -75
- package/dist/bin/chunks/sort-UJP353TM.js +0 -15
- package/dist/bin/chunks/timeout-OZVAGW2H.js +0 -12
- package/dist/bin/chunks/xargs-DKUAYNEK.js +0 -4
- package/dist/bin/chunks/xargs-YNLVLPOF.js +0 -4
- package/dist/bin/shell/chunks/awk-S63F6IYK.js +0 -15
- package/dist/bin/shell/chunks/awk2-6XCE67AX.js +0 -20
- package/dist/bin/shell/chunks/awk2-DKAZ7LPG.js +0 -20
- package/dist/bin/shell/chunks/awk2-GAJ72X3Z.js +0 -20
- package/dist/bin/shell/chunks/awk2-HJAPWU2N.js +0 -18
- package/dist/bin/shell/chunks/awk2-LVXC5OAC.js +0 -20
- package/dist/bin/shell/chunks/awk2-T6HR4EYO.js +0 -20
- package/dist/bin/shell/chunks/awk2-UYU2UYZ2.js +0 -20
- package/dist/bin/shell/chunks/awk2-W64AZN7P.js +0 -20
- package/dist/bin/shell/chunks/base64-NC7HTKLZ.js +0 -5
- package/dist/bin/shell/chunks/bash-TQGTNXAE.js +0 -7
- package/dist/bin/shell/chunks/chunk-5KNEBKYN.js +0 -2
- package/dist/bin/shell/chunks/chunk-6QUZ7QML.js +0 -3
- package/dist/bin/shell/chunks/chunk-LV662IGP.js +0 -6
- package/dist/bin/shell/chunks/env-FVITWNHG.js +0 -9
- package/dist/bin/shell/chunks/find-4B67H4RP.js +0 -11
- package/dist/bin/shell/chunks/find-7BUNQZX4.js +0 -11
- package/dist/bin/shell/chunks/find-AMA6ABN5.js +0 -11
- package/dist/bin/shell/chunks/find-HW2TUO6B.js +0 -11
- package/dist/bin/shell/chunks/find-QEYP42JQ.js +0 -11
- package/dist/bin/shell/chunks/find-WJV3FM6L.js +0 -11
- package/dist/bin/shell/chunks/find-YATLECXJ.js +0 -11
- package/dist/bin/shell/chunks/grep-OVWU4WCZ.js +0 -15
- package/dist/bin/shell/chunks/grep-PHBFGJCV.js +0 -15
- package/dist/bin/shell/chunks/jq-EYSXBSCP.js +0 -14
- package/dist/bin/shell/chunks/printf-ASOYDPIK.js +0 -14
- package/dist/bin/shell/chunks/printf-BOFQVMMK.js +0 -15
- package/dist/bin/shell/chunks/sed-7IS44XON.js +0 -48
- package/dist/bin/shell/chunks/sed-RHLDIXPL.js +0 -76
- package/dist/bin/shell/chunks/sed-SYSATJXR.js +0 -75
- package/dist/bin/shell/chunks/sort-UJP353TM.js +0 -15
- package/dist/bin/shell/chunks/timeout-OZVAGW2H.js +0 -12
- package/dist/bin/shell/chunks/xargs-DKUAYNEK.js +0 -4
- package/dist/bin/shell/chunks/xargs-YNLVLPOF.js +0 -4
- package/dist/bundle/chunks/awk-V4C3GTJI.js +0 -14
- package/dist/bundle/chunks/awk2-365HINHI.js +0 -19
- package/dist/bundle/chunks/awk2-4YCQ6UCB.js +0 -19
- package/dist/bundle/chunks/awk2-7YCFY7D2.js +0 -19
- package/dist/bundle/chunks/awk2-7YL3P4KU.js +0 -19
- package/dist/bundle/chunks/awk2-ETXZHQQ4.js +0 -19
- package/dist/bundle/chunks/awk2-FMEL7ESV.js +0 -19
- package/dist/bundle/chunks/awk2-LE4QUFGK.js +0 -19
- package/dist/bundle/chunks/awk2-MGHA6JPJ.js +0 -17
- package/dist/bundle/chunks/awk2-XEAK5PBN.js +0 -19
- package/dist/bundle/chunks/base64-WATI5PWI.js +0 -4
- package/dist/bundle/chunks/bash-T4PXVRYX.js +0 -6
- package/dist/bundle/chunks/cat-5KESXK2M.js +0 -5
- package/dist/bundle/chunks/chunk-JYYFSUWP.js +0 -5
- package/dist/bundle/chunks/chunk-TDJNT32M.js +0 -2
- package/dist/bundle/chunks/clear-ZBD2DMXN.js +0 -1
- package/dist/bundle/chunks/cp-BLHAPLQZ.js +0 -7
- package/dist/bundle/chunks/cut-7RHEYJ7Y.js +0 -5
- package/dist/bundle/chunks/diff-IVJFQANX.js +0 -6
- package/dist/bundle/chunks/dirname-Q5HDZLH2.js +0 -4
- package/dist/bundle/chunks/du-I5HYAKTQ.js +0 -7
- package/dist/bundle/chunks/env-2F2VHNYS.js +0 -8
- package/dist/bundle/chunks/env-OORA5GFS.js +0 -8
- package/dist/bundle/chunks/find-3O5V74IR.js +0 -10
- package/dist/bundle/chunks/find-4QUN2ATO.js +0 -10
- package/dist/bundle/chunks/find-522XP4ZY.js +0 -10
- package/dist/bundle/chunks/find-5UN24ZV7.js +0 -10
- package/dist/bundle/chunks/find-JXG2HF6L.js +0 -10
- package/dist/bundle/chunks/find-K3NO35MZ.js +0 -10
- package/dist/bundle/chunks/find-K7D4PKHS.js +0 -10
- package/dist/bundle/chunks/find-KP4M5DWC.js +0 -10
- package/dist/bundle/chunks/find-WM6ZETA7.js +0 -10
- package/dist/bundle/chunks/grep-3D2INI4S.js +0 -14
- package/dist/bundle/chunks/grep-CZTYKNEE.js +0 -14
- package/dist/bundle/chunks/head-7H5R4WKO.js +0 -1
- package/dist/bundle/chunks/help-SDCRRU2F.js +0 -15
- package/dist/bundle/chunks/help-XHGUXTV3.js +0 -15
- package/dist/bundle/chunks/history-7Z2STZ6Y.js +0 -2
- package/dist/bundle/chunks/html-to-markdown-XMBYO6FD.js +0 -4
- package/dist/bundle/chunks/jq-7R2XGLLH.js +0 -13
- package/dist/bundle/chunks/ln-UTUVIAFP.js +0 -9
- package/dist/bundle/chunks/mv-GN23UIZU.js +0 -6
- package/dist/bundle/chunks/paste-L4TYPVSP.js +0 -7
- package/dist/bundle/chunks/printf-3ZT5XOIZ.js +0 -14
- package/dist/bundle/chunks/printf-G2SBUNW3.js +0 -13
- package/dist/bundle/chunks/pwd-ZVX5RTL4.js +0 -2
- package/dist/bundle/chunks/readlink-HHC33N5C.js +0 -6
- package/dist/bundle/chunks/sed-2WWCANZT.js +0 -79
- package/dist/bundle/chunks/sed-5LZHAGFR.js +0 -74
- package/dist/bundle/chunks/sed-IGVS3UIY.js +0 -79
- package/dist/bundle/chunks/sed-UZJSXYQZ.js +0 -47
- package/dist/bundle/chunks/sed-V7XSBPTD.js +0 -75
- package/dist/bundle/chunks/sort-LHMQWYH2.js +0 -14
- package/dist/bundle/chunks/tail-BLGGG2VX.js +0 -1
- package/dist/bundle/chunks/tee-VCNOG5VI.js +0 -2
- package/dist/bundle/chunks/timeout-THAT7IOO.js +0 -11
- package/dist/bundle/chunks/true-OD7ZXH3O.js +0 -1
- package/dist/bundle/chunks/uniq-IIOQKNTS.js +0 -4
- package/dist/bundle/chunks/wc-OXLYBRUE.js +0 -5
- package/dist/bundle/chunks/which-ONWH3TNF.js +0 -2
- package/dist/bundle/chunks/xargs-752VENJT.js +0 -3
- package/dist/bundle/chunks/xargs-E5JPQL24.js +0 -3
- package/dist/commands/awk/executor.d.ts +0 -3
- package/dist/commands/awk/expressions.d.ts +0 -3
- package/dist/commands/awk/functions.d.ts +0 -12
- package/dist/commands/awk/interpreter2.d.ts +0 -90
- package/dist/commands/awk/parser.d.ts +0 -3
- package/dist/commands/awk/types.d.ts +0 -44
- package/dist/fs-interface.d.ts +0 -186
- package/dist/fs.d.ts +0 -39
- package/dist/overlay-fs/OverlayFs.d.ts +0 -87
- package/dist/overlay-fs/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -237,7 +237,7 @@ pnpm shell --no-network
|
|
|
237
237
|
|
|
238
238
|
### Text Processing
|
|
239
239
|
|
|
240
|
-
`awk`, `base64`, `cut`, `diff`, `grep`, `head`, `jq`, `printf`, `sed`, `sort`, `tail`, `tr`, `uniq`, `wc`, `xargs`
|
|
240
|
+
`awk`, `base64`, `comm`, `cut`, `diff`, `grep`, `head`, `jq`, `md5sum`, `printf`, `sed`, `sha1sum`, `sha256sum`, `sort`, `tail`, `tr`, `uniq`, `wc`, `xargs`
|
|
241
241
|
|
|
242
242
|
### Navigation & Environment
|
|
243
243
|
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -32,6 +32,11 @@ export interface CreateBashToolOptions {
|
|
|
32
32
|
* Use this to restrict which commands can be executed.
|
|
33
33
|
*/
|
|
34
34
|
commands?: CommandName[];
|
|
35
|
+
/**
|
|
36
|
+
* Custom commands to register alongside built-in commands.
|
|
37
|
+
* These take precedence over built-ins with the same name.
|
|
38
|
+
*/
|
|
39
|
+
customCommands?: BashOptions["customCommands"];
|
|
35
40
|
/**
|
|
36
41
|
* Network configuration for commands like curl.
|
|
37
42
|
* Disabled by default for security.
|
package/dist/ast/types.d.ts
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
/** Base interface for all AST nodes */
|
|
14
14
|
export interface ASTNode {
|
|
15
15
|
type: string;
|
|
16
|
+
/** Source line number (1-based) for $LINENO tracking. May be 0 or undefined for synthesized nodes. */
|
|
17
|
+
line?: number;
|
|
16
18
|
}
|
|
17
19
|
/** Position information for error reporting */
|
|
18
20
|
export interface Position {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as l,b as r}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as l,b as r}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var d={name:"alias",summary:"define or display aliases",usage:"alias [name[=value] ...]",options:[" --help display this help and exit"]},o="BASH_ALIAS_",f={name:"alias",async execute(i,n){if(r(i))return l(d);if(i.length===0){let e="";for(let[a,t]of Object.entries(n.env))if(a.startsWith(o)){let s=a.slice(o.length);e+=`alias ${s}='${t}'
|
|
3
3
|
`}return{stdout:e,stderr:"",exitCode:0}}for(let e of i){let a=e.indexOf("=");if(a===-1){let t=o+e;return n.env[t]?{stdout:`alias ${e}='${n.env[t]}'
|
|
4
4
|
`,stderr:"",exitCode:0}:{stdout:"",stderr:`alias: ${e}: not found
|
|
5
5
|
`,exitCode:1}}else{let t=e.slice(0,a),s=e.slice(a+1);(s.startsWith("'")&&s.endsWith("'")||s.startsWith('"')&&s.endsWith('"'))&&(s=s.slice(1,-1)),n.env[o+t]=s}}return{stdout:"",stderr:"",exitCode:0}}},m={name:"unalias",async execute(i,n){if(r(i))return l({name:"unalias",summary:"remove alias definitions",usage:"unalias name [name ...]",options:["-a remove all aliases"," --help display this help and exit"]});if(i.length===0)return{stdout:"",stderr:`unalias: usage: unalias [-a] name [name ...]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{i as g}from"./chunk-NWWB2XRE.js";import{a as K,b as Q,c as U}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{i as g}from"./chunk-NWWB2XRE.js";import{a as K,b as Q,c as U}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";function x(e={}){let{fieldSep:t=/\s+/,maxIterations:r=1e4,maxRecursionDepth:n=100,fs:a,cwd:s}=e;return{FS:" ",OFS:" ",ORS:`
|
|
3
3
|
`,NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:{},arrays:{},ARGC:0,ARGV:{},functions:new Map,fieldSep:t,maxIterations:r,maxRecursionDepth:n,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,output:"",openedFiles:new Set,fs:a,cwd:s}}function j(e,t,r){switch(r){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 A(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function w(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function ce(e,t,r){return e.length===0?t.line.length:w(await r.evalExpr(e[0])).length}async function he(e,t,r){if(e.length<2)return"";let n=w(await r.evalExpr(e[0])),a=Math.floor(A(await r.evalExpr(e[1])))-1;if(e.length>=3){let s=Math.floor(A(await r.evalExpr(e[2])));return n.substr(Math.max(0,a),s)}return n.substr(Math.max(0,a))}async function ue(e,t,r){if(e.length<2)return 0;let n=w(await r.evalExpr(e[0])),a=w(await r.evalExpr(e[1])),s=n.indexOf(a);return s===-1?0:s+1}async function pe(e,t,r){if(e.length<2)return 0;let n=w(await r.evalExpr(e[0])),a=e[1];if(a.type!=="variable")return 0;let s=a.name,o=t.FS;if(e.length>=3){let u=w(await r.evalExpr(e[2]));o=u===" "?/\s+/:u}else t.FS===" "&&(o=/\s+/);let l=n.split(o);t.arrays[s]={};for(let u=0;u<l.length;u++)t.arrays[s][String(u+1)]=l[u];return l.length}async function fe(e,t,r){if(e.length<2)return 0;let n;e[0].type==="regex"?n=e[0].pattern:(n=w(await r.evalExpr(e[0])),n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)));let a=w(await r.evalExpr(e[1])),s="$0";if(e.length>=3){let l=e[2];l.type==="variable"?s=l.name:l.type==="field"&&(s=`$${Math.floor(A(await r.evalExpr(l.index)))}`)}let o;if(s==="$0")o=t.line;else if(s.startsWith("$")){let l=parseInt(s.slice(1),10)-1;o=t.fields[l]||""}else o=w(t.vars[s]??"");try{let l=new RegExp(n),u=o.replace(l,z(a)),m=u!==o?1:0;if(s==="$0")t.line=u,t.fields=t.FS===" "?u.trim().split(/\s+/).filter(Boolean):u.split(t.fieldSep),t.NF=t.fields.length;else if(s.startsWith("$")){let N=parseInt(s.slice(1),10)-1;for(;t.fields.length<=N;)t.fields.push("");t.fields[N]=u,t.NF=t.fields.length,t.line=t.fields.join(t.OFS)}else t.vars[s]=u;return m}catch{return 0}}async function de(e,t,r){if(e.length<2)return 0;let n;e[0].type==="regex"?n=e[0].pattern:(n=w(await r.evalExpr(e[0])),n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)));let a=w(await r.evalExpr(e[1])),s="$0";if(e.length>=3){let l=e[2];l.type==="variable"?s=l.name:l.type==="field"&&(s=`$${Math.floor(A(await r.evalExpr(l.index)))}`)}let o;if(s==="$0")o=t.line;else if(s.startsWith("$")){let l=parseInt(s.slice(1),10)-1;o=t.fields[l]||""}else o=w(t.vars[s]??"");try{let l=new RegExp(n,"g"),u=o.match(l),m=u?u.length:0,N=o.replace(l,z(a));if(s==="$0")t.line=N,t.fields=t.FS===" "?N.trim().split(/\s+/).filter(Boolean):N.split(t.fieldSep),t.NF=t.fields.length;else if(s.startsWith("$")){let c=parseInt(s.slice(1),10)-1;for(;t.fields.length<=c;)t.fields.push("");t.fields[c]=N,t.NF=t.fields.length,t.line=t.fields.join(t.OFS)}else t.vars[s]=N;return m}catch{return 0}}function z(e){return t=>{let r="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length){let a=e[n+1];a==="&"?(r+="&",n+=2):a==="\\"?(r+="\\",n+=2):(r+=e[n+1],n+=2)}else e[n]==="&"?(r+=t,n++):(r+=e[n],n++);return r}}async function Ee(e,t,r){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let n=w(await r.evalExpr(e[0])),a;e[1].type==="regex"?a=e[1].pattern:(a=w(await r.evalExpr(e[1])),a.startsWith("/")&&a.endsWith("/")&&(a=a.slice(1,-1)));try{let o=new RegExp(a).exec(n);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 Ne(e,t,r){if(e.length<3)return"";let n;e[0].type==="regex"?n=e[0].pattern:(n=w(await r.evalExpr(e[0])),n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)));let a=w(await r.evalExpr(e[1])),s=w(await r.evalExpr(e[2])),o=e.length>=4?w(await r.evalExpr(e[3])):t.line;try{let l=s.toLowerCase()==="g",u=l?0:parseInt(s,10)||1;if(l){let m=new RegExp(n,"g");return o.replace(m,(N,...c)=>q(a,N,c.slice(0,-2)))}else{let m=0,N=new RegExp(n,"g");return o.replace(N,(c,...d)=>(m++,m===u?q(a,c,d.slice(0,-2)):c))}}catch{return o}}function q(e,t,r){let n="",a=0;for(;a<e.length;)if(e[a]==="\\"&&a+1<e.length){let s=e[a+1];if(s==="&")n+="&",a+=2;else if(s==="0")n+=t,a+=2;else if(s>="1"&&s<="9"){let o=parseInt(s,10)-1;n+=r[o]||"",a+=2}else s==="n"?(n+=`
|
|
4
4
|
`,a+=2):s==="t"?(n+=" ",a+=2):(n+=s,a+=2)}else e[a]==="&"?(n+=t,a++):(n+=e[a],a++);return n}async function ye(e,t,r){return e.length===0?"":w(await r.evalExpr(e[0])).toLowerCase()}async function me(e,t,r){return e.length===0?"":w(await r.evalExpr(e[0])).toUpperCase()}async function we(e,t,r){if(e.length===0)return"";let n=w(await r.evalExpr(e[0])),a=[];for(let s=1;s<e.length;s++)a.push(await r.evalExpr(e[s]));return W(n,a)}async function Re(e,t,r){return e.length===0?0:Math.floor(A(await r.evalExpr(e[0])))}async function Se(e,t,r){return e.length===0?0:Math.sqrt(A(await r.evalExpr(e[0])))}async function Ae(e,t,r){return e.length===0?0:Math.sin(A(await r.evalExpr(e[0])))}async function ge(e,t,r){return e.length===0?0:Math.cos(A(await r.evalExpr(e[0])))}async function ve(e,t,r){let n=e.length>0?A(await r.evalExpr(e[0])):0,a=e.length>1?A(await r.evalExpr(e[1])):0;return Math.atan2(n,a)}async function ke(e,t,r){return e.length===0?0:Math.log(A(await r.evalExpr(e[0])))}async function Ie(e,t,r){return e.length===0?1:Math.exp(A(await r.evalExpr(e[0])))}function Ce(e,t,r){return t.random?t.random():Math.random()}async function be(e,t,r){let n=e.length>0?A(await r.evalExpr(e[0])):Date.now();return t.vars._srand_seed=n,n}function H(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function $(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}function W(e,t){let r=0,n="",a=0;for(;a<e.length;)if(e[a]==="%"&&a+1<e.length){let s=a+1,o="",l="",u="";for(;s<e.length&&/[-+ #0]/.test(e[s]);)o+=e[s++];for(;s<e.length&&/\d/.test(e[s]);)l+=e[s++];if(e[s]===".")for(s++;s<e.length&&/\d/.test(e[s]);)u+=e[s++];let m=e[s],N=t[r];switch(m){case"s":{let c=N!==void 0?String(N):"";if(u&&(c=c.substring(0,parseInt(u,10))),l){let d=parseInt(l,10);o.includes("-")?c=c.padEnd(d):c=c.padStart(d)}n+=c,r++;break}case"d":case"i":{let c=N!==void 0?Math.floor(Number(N)):0;Number.isNaN(c)&&(c=0);let d=String(c);if(l){let h=parseInt(l,10);if(o.includes("-"))d=d.padEnd(h);else if(o.includes("0")&&!o.includes("-")){let f=c<0?"-":"";d=f+Math.abs(c).toString().padStart(h-f.length,"0")}else d=d.padStart(h)}n+=d,r++;break}case"f":{let c=N!==void 0?Number(N):0;Number.isNaN(c)&&(c=0);let d=u?parseInt(u,10):6,h=c.toFixed(d);if(l){let f=parseInt(l,10);o.includes("-")?h=h.padEnd(f):h=h.padStart(f)}n+=h,r++;break}case"e":case"E":{let c=N!==void 0?Number(N):0;Number.isNaN(c)&&(c=0);let d=u?parseInt(u,10):6,h=c.toExponential(d);if(m==="E"&&(h=h.toUpperCase()),l){let f=parseInt(l,10);o.includes("-")?h=h.padEnd(f):h=h.padStart(f)}n+=h,r++;break}case"g":case"G":{let c=N!==void 0?Number(N):0;Number.isNaN(c)&&(c=0);let d=u?parseInt(u,10):6,h=c!==0?Math.floor(Math.log10(Math.abs(c))):0,f;if(c===0?f="0":h<-4||h>=d?(f=c.toExponential(d-1),m==="G"&&(f=f.toUpperCase())):f=c.toPrecision(d),f=f.replace(/\.?0+$/,"").replace(/\.?0+e/,"e"),l){let R=parseInt(l,10);o.includes("-")?f=f.padEnd(R):f=f.padStart(R)}n+=f,r++;break}case"x":case"X":{let c=N!==void 0?Math.floor(Number(N)):0;Number.isNaN(c)&&(c=0);let d=Math.abs(c).toString(16);if(m==="X"&&(d=d.toUpperCase()),l){let h=parseInt(l,10);o.includes("0")?d=d.padStart(h,"0"):o.includes("-")?d=d.padEnd(h):d=d.padStart(h)}n+=c<0?`-${d}`:d,r++;break}case"o":{let c=N!==void 0?Math.floor(Number(N)):0;Number.isNaN(c)&&(c=0);let d=Math.abs(c).toString(8);if(l){let h=parseInt(l,10);o.includes("0")?d=d.padStart(h,"0"):o.includes("-")?d=d.padEnd(h):d=d.padStart(h)}n+=c<0?`-${d}`:d,r++;break}case"c":{typeof N=="number"?n+=String.fromCharCode(N):n+=String(N??"").charAt(0)||"",r++;break}case"%":n+="%";break;default:n+=e.substring(a,s+1)}a=s+1}else if(e[a]==="\\"&&a+1<e.length){let s=e[a+1];switch(s){case"n":n+=`
|
|
5
5
|
`;break;case"t":n+=" ";break;case"r":n+="\r";break;case"\\":n+="\\";break;default:n+=s}a+=2}else n+=e[a++];return n}var Z={length:ce,substr:he,index:ue,split:pe,sub:fe,gsub:de,match:Ee,gensub:Ne,tolower:ye,toupper:me,sprintf:we,int:Re,sqrt:Se,sin:Ae,cos:ge,atan2:ve,log:ke,exp:Ie,rand:Ce,srand:be,system:H("system","shell execution not allowed in sandboxed environment"),close:H("close","file operations not allowed"),fflush:H("fflush","file operations not allowed"),systime:$("systime"),mktime:$("mktime"),strftime:$("strftime")};function S(e){return typeof e=="number"?e!==0:e!==""}function E(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function y(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function X(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function F(e,t){try{return new RegExp(e).test(t)}catch{return!1}}function J(e,t){return e.FS===" "?t.trim().split(/\s+/).filter(Boolean):t.split(e.fieldSep)}function I(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function O(e,t,r){if(t===0)e.line=y(r),e.fields=J(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=y(r),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function T(e,t){e.line=t,e.fields=J(e,t),e.NF=e.fields.length}function Y(e,t){if(e.FS=t,t===" ")e.fieldSep=/\s+/;else try{e.fieldSep=new RegExp(t)}catch{e.fieldSep=new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function C(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;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 v(e,t,r){switch(t){case"FS":Y(e,y(r));return;case"OFS":e.OFS=y(r);return;case"ORS":e.ORS=y(r);return;case"NR":e.NR=Math.floor(E(r));return;case"NF":{let n=Math.floor(E(r));if(n<e.NF)e.fields=e.fields.slice(0,n),e.line=e.fields.join(e.OFS);else if(n>e.NF){for(;e.fields.length<n;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=n;return}case"FNR":e.FNR=Math.floor(E(r));return;case"FILENAME":e.FILENAME=y(r);return;case"RSTART":e.RSTART=Math.floor(E(r));return;case"RLENGTH":e.RLENGTH=Math.floor(E(r));return;case"SUBSEP":e.SUBSEP=y(r);return}e.vars[t]=r}function b(e,t,r){return t==="ARGV"?e.ARGV[r]??"":e.arrays[t]?.[r]??""}function P(e,t,r,n){e.arrays[t]||(e.arrays[t]={}),e.arrays[t][r]=n}function ee(e,t,r){return t==="ARGV"?e.ARGV[r]!==void 0:e.arrays[t]?.[r]!==void 0}function te(e,t,r){e.arrays[t]&&delete e.arrays[t][r]}function re(e,t){delete e.arrays[t]}var V=null;function ie(e){V=e}async function p(e,t){switch(t.type){case"number":return t.value;case"string":return t.value;case"regex":return F(t.pattern,e.line)?1:0;case"field":return Le(e,t);case"variable":return C(e,t.name);case"array_access":return Oe(e,t);case"binary":return Pe(e,t);case"unary":return Te(e,t);case"ternary":return S(await p(e,t.condition))?p(e,t.consequent):p(e,t.alternate);case"call":return _e(e,t.name,t.args);case"assignment":return De(e,t);case"pre_increment":return Be(e,t.operand);case"pre_decrement":return Ue(e,t.operand);case"post_increment":return xe(e,t.operand);case"post_decrement":return He(e,t.operand);case"in":return $e(e,t.key,t.array);case"getline":return We(e,t.variable,t.file);case"tuple":return Ve(e,t.elements);default:return""}}async function Le(e,t){let r=Math.floor(E(await p(e,t.index)));return I(e,r)}async function Oe(e,t){let r=y(await p(e,t.key));return b(e,t.array,r)}async function Pe(e,t){let r=t.operator;if(r==="||")return S(await p(e,t.left))||S(await p(e,t.right))?1:0;if(r==="&&")return S(await p(e,t.left))&&S(await p(e,t.right))?1:0;if(r==="~"){let l=await p(e,t.left),u=t.right.type==="regex"?t.right.pattern:y(await p(e,t.right));try{return new RegExp(u).test(y(l))?1:0}catch{return 0}}if(r==="!~"){let l=await p(e,t.left),u=t.right.type==="regex"?t.right.pattern:y(await p(e,t.right));try{return new RegExp(u).test(y(l))?0:1}catch{return 1}}let n=await p(e,t.left),a=await p(e,t.right);if(r===" ")return y(n)+y(a);if(Me(r))return Fe(n,a,r);let s=E(n),o=E(a);return j(s,o,r)}function Me(e){return["<","<=",">",">=","==","!="].includes(e)}function Fe(e,t,r){let n=X(e),a=X(t);if(n&&a){let l=E(e),u=E(t);switch(r){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 s=y(e),o=y(t);switch(r){case"<":return s<o?1:0;case"<=":return s<=o?1:0;case">":return s>o?1:0;case">=":return s>=o?1:0;case"==":return s===o?1:0;case"!=":return s!==o?1:0}return 0}async function Te(e,t){let r=await p(e,t.operand);switch(t.operator){case"!":return S(r)?0:1;case"-":return-E(r);case"+":return+E(r);default:return r}}async function _e(e,t,r){let n=Z[t];if(n)return n(r,e,{evalExpr:s=>p(e,s)});let a=e.functions.get(t);return a?Ge(e,a,r):""}async function Ge(e,t,r){if(e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new g(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let n={};for(let s of t.params)n[s]=e.vars[s];for(let s=0;s<t.params.length;s++){let o=t.params[s],l=s<r.length?await p(e,r[s]):"";e.vars[o]=l}e.hasReturn=!1,e.returnValue=void 0,V&&await V(e,t.body.statements);let a=e.returnValue??"";for(let s of t.params)n[s]!==void 0?e.vars[s]=n[s]:delete e.vars[s];return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,a}async function De(e,t){let r=await p(e,t.value),n=t.target,a=t.operator,s;if(a==="=")s=r;else{let o;if(n.type==="field"){let m=Math.floor(E(await p(e,n.index)));o=I(e,m)}else if(n.type==="variable")o=C(e,n.name);else{let m=y(await p(e,n.key));o=b(e,n.array,m)}let l=E(o),u=E(r);switch(a){case"+=":s=l+u;break;case"-=":s=l-u;break;case"*=":s=l*u;break;case"/=":s=u!==0?l/u:0;break;case"%=":s=u!==0?l%u:0;break;case"^=":s=l**u;break;default:s=r}}if(n.type==="field"){let o=Math.floor(E(await p(e,n.index)));O(e,o,s)}else if(n.type==="variable")v(e,n.name,s);else{let o=y(await p(e,n.key));P(e,n.array,o,s)}return s}async function Be(e,t){let r;if(t.type==="field"){let n=Math.floor(E(await p(e,t.index)));r=E(I(e,n))+1,O(e,n,r)}else if(t.type==="variable")r=E(C(e,t.name))+1,v(e,t.name,r);else{let n=y(await p(e,t.key));r=E(b(e,t.array,n))+1,P(e,t.array,n,r)}return r}async function Ue(e,t){let r;if(t.type==="field"){let n=Math.floor(E(await p(e,t.index)));r=E(I(e,n))-1,O(e,n,r)}else if(t.type==="variable")r=E(C(e,t.name))-1,v(e,t.name,r);else{let n=y(await p(e,t.key));r=E(b(e,t.array,n))-1,P(e,t.array,n,r)}return r}async function xe(e,t){let r;if(t.type==="field"){let n=Math.floor(E(await p(e,t.index)));r=E(I(e,n)),O(e,n,r+1)}else if(t.type==="variable")r=E(C(e,t.name)),v(e,t.name,r+1);else{let n=y(await p(e,t.key));r=E(b(e,t.array,n)),P(e,t.array,n,r+1)}return r}async function He(e,t){let r;if(t.type==="field"){let n=Math.floor(E(await p(e,t.index)));r=E(I(e,n)),O(e,n,r-1)}else if(t.type==="variable")r=E(C(e,t.name)),v(e,t.name,r-1);else{let n=y(await p(e,t.key));r=E(b(e,t.array,n)),P(e,t.array,n,r-1)}return r}async function $e(e,t,r){let n;if(t.type==="tuple"){let a=[];for(let s of t.elements)a.push(y(await p(e,s)));n=a.join(e.SUBSEP)}else n=y(await p(e,t));return ee(e,r,n)?1:0}async function We(e,t,r){if(r)return Xe(e,t,r);if(!e.lines||e.lineIndex===void 0)return-1;let n=e.lineIndex+1;if(n>=e.lines.length)return 0;let a=e.lines[n];return t?v(e,t,a):T(e,a),e.NR++,e.lineIndex=n,1}async function Xe(e,t,r){if(!e.fs||!e.cwd)return-1;let n=y(await p(e,r)),a=e.fs.resolvePath(e.cwd,n),s=`__fc_${a}`,o=`__fi_${a}`,l,u;if(e.vars[s]===void 0)try{l=(await e.fs.readFile(a)).split(`
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as f}from"./chunk-TA7RUHGQ.js";import{a as l,b as u}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var g={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},m={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};async function p(o,r,n){if(r.length===0||r.length===1&&r[0]==="-")return{ok:!0,data:new TextEncoder().encode(o.stdin)};let s=[];for(let e of r){if(e==="-"){s.push(new TextEncoder().encode(o.stdin));continue}try{let t=o.fs.resolvePath(o.cwd,e),a=await o.fs.readFileBuffer(t);s.push(a)}catch{return{ok:!1,error:{stdout:"",stderr:`${n}: ${e}: No such file or directory
|
|
3
|
+
`,exitCode:1}}}}let c=s.reduce((e,t)=>e+t.length,0),i=new Uint8Array(c),d=0;for(let e of s)i.set(e,d),d+=e.length;return{ok:!0,data:i}}var x={name:"base64",async execute(o,r){if(u(o))return l(g);let n=f("base64",o,m);if(!n.ok)return n.error;let s=n.result.flags.decode,c=n.result.flags.wrap,i=n.result.positional;try{if(s){let t=await p(r,i,"base64");if(!t.ok)return t.error;let h=new TextDecoder().decode(t.data).replace(/\s/g,""),w=Uint8Array.from(atob(h),b=>b.charCodeAt(0));return{stdout:new TextDecoder().decode(w),stderr:"",exitCode:0}}let d=await p(r,i,"base64");if(!d.ok)return d.error;let e=btoa(String.fromCharCode(...d.data));if(c>0){let t=[];for(let a=0;a<e.length;a+=c)t.push(e.slice(a,a+c));e=t.join(`
|
|
4
|
+
`)+(e.length>0?`
|
|
5
|
+
`:"")}return{stdout:e,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`base64: invalid input
|
|
6
|
+
`,exitCode:1}}}};export{x as base64Command};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as r,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var p={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX]
|
|
3
3
|
basename OPTION... NAME...`,options:["-a, --multiple support multiple arguments","-s, --suffix=SUFFIX remove a trailing SUFFIX"," --help display this help and exit"]},c={name:"basename",async execute(n,u){if(m(n))return r(p);let i=!1,s="",a=[];for(let t=0;t<n.length;t++){let e=n[t];e==="-a"||e==="--multiple"?i=!0:e==="-s"&&t+1<n.length?(s=n[++t],i=!0):e.startsWith("--suffix=")?(s=e.slice(9),i=!0):e.startsWith("-")||a.push(e)}if(a.length===0)return{stdout:"",stderr:`basename: missing operand
|
|
4
4
|
`,exitCode:1};!i&&a.length>=2&&(s=a.pop()??"");let o=[];for(let t of a){let e=t.replace(/\/+$/,""),l=e.split("/").pop()||e;s&&l.endsWith(s)&&(l=l.slice(0,-s.length)),o.push(l)}return{stdout:`${o.join(`
|
|
5
5
|
`)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as l,b as d}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as l,b as d}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var m={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},b={name:"bash",async execute(t,e){if(d(t))return l(m);if(t[0]==="-c"&&t.length>=2){let o=t[1],s=t[2]||"bash",i=t.slice(3);return h(o,s,i,e)}if(t.length===0)return{stdout:"",stderr:"",exitCode:0};let n=t[0],c=t.slice(1);try{let o=e.fs.resolvePath(e.cwd,n),s=await e.fs.readFile(o);return h(s,n,c,e)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
|
|
3
3
|
`,exitCode:127}}}},w={name:"sh",async execute(t,e){if(d(t))return l({...m,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(t[0]==="-c"&&t.length>=2){let o=t[1],s=t[2]||"sh",i=t.slice(3);return h(o,s,i,e)}if(t.length===0)return{stdout:"",stderr:"",exitCode:0};let n=t[0],c=t.slice(1);try{let o=e.fs.resolvePath(e.cwd,n),s=await e.fs.readFile(o);return h(s,n,c,e)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
|
|
4
4
|
`,exitCode:127}}}};async function h(t,e,n,c){if(!c.exec)return{stdout:"",stderr:`bash: internal error: exec function not available
|
|
5
5
|
`,exitCode:1};let o={0:e,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")};n.forEach((r,a)=>{o[String(a+1)]=r});let s=t;if(s.startsWith("#!")){let r=s.indexOf(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as p}from"./chunk-J7MJV6WO.js";import{a as d}from"./chunk-TA7RUHGQ.js";import{a as c,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as p}from"./chunk-J7MJV6WO.js";import{a as d}from"./chunk-TA7RUHGQ.js";import{a as c,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var f={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},b={number:{short:"n",long:"number",type:"boolean"}},w={name:"cat",async execute(t,r){if(m(t))return c(f);let e=d("cat",t,b);if(!e.ok)return e.error;let s=e.result.flags.number,o=e.result.positional,a=await p(r,o,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),n="",i=1;for(let{content:l}of a.files)if(s){let u=h(l,i);n+=u.content,i=u.nextLineNumber}else n+=l;return{stdout:n,stderr:a.stderr,exitCode:a.exitCode}}};function h(t,r){let e=t.split(`
|
|
3
3
|
`),s=t.endsWith(`
|
|
4
4
|
`),o=s?e.slice(0,-1):e;return{content:o.map((n,i)=>`${String(r+i).padStart(6," ")} ${n}`).join(`
|
|
5
5
|
`)+(s?`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as h,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as h,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var v={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},C={name:"chmod",async execute(o,s){if(m(o))return h(v);if(o.length<2)return{stdout:"",stderr:`chmod: missing operand
|
|
3
3
|
`,exitCode:1};let r=!1,n=!1,e=0;for(;e<o.length&&o[e].startsWith("-");){let t=o[e];if(t==="-R"||t==="--recursive")r=!0,e++;else if(t==="-v"||t==="--verbose")n=!0,e++;else if(t==="--"){e++;break}else{if(/^[+-]?[rwxugo]+/.test(t)||/^\d+$/.test(t))break;if(/^-[Rv]+$/.test(t)){t.includes("R")&&(r=!0),t.includes("v")&&(n=!0),e++;continue}return{stdout:"",stderr:`chmod: invalid option -- '${t.slice(1)}'
|
|
4
4
|
`,exitCode:1}}}if(o.length-e<2)return{stdout:"",stderr:`chmod: missing operand
|
|
5
5
|
`,exitCode:1};let a=o[e],f=o.slice(e+1),i;try{i=$(a)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${a}'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as U,b as m,c as F}from"./chunk-GTNBSMZR.js";var C={sha1:"SHA-1",sha256:"SHA-256"};function L(n){function h(a,u){return a<<u|a>>>32-u}let p=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),g=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],A=n.length*8,o=(n.length%64<56?56:120)-n.length%64,s=new Uint8Array(n.length+o+8);s.set(n),s[n.length]=128;let d=new DataView(s.buffer);d.setUint32(s.length-8,A>>>0,!0),d.setUint32(s.length-4,Math.floor(A/4294967296),!0);let b=1732584193,l=4023233417,w=2562383102,e=271733878;for(let a=0;a<s.length;a+=64){let u=new Uint32Array(16);for(let t=0;t<16;t++)u[t]=d.getUint32(a+t*4,!0);let $=b,r=l,x=w,c=e;for(let t=0;t<64;t++){let i,y;t<16?(i=r&x|~r&c,y=t):t<32?(i=c&r|~c&x,y=(5*t+1)%16):t<48?(i=r^x^c,y=(3*t+5)%16):(i=x^(r|~c),y=7*t%16),i=i+$+p[t]+u[y]>>>0,$=c,c=x,x=r,r=r+h(i,g[t])>>>0}b=b+$>>>0,l=l+r>>>0,w=w+x>>>0,e=e+c>>>0}let f=new Uint8Array(16);return new DataView(f.buffer).setUint32(0,b,!0),new DataView(f.buffer).setUint32(4,l,!0),new DataView(f.buffer).setUint32(8,w,!0),new DataView(f.buffer).setUint32(12,e,!0),Array.from(f).map(a=>a.toString(16).padStart(2,"0")).join("")}async function k(n,h){if(n==="md5")return L(h);let p=await globalThis.crypto.subtle.digest(C[n],new Uint8Array(h).buffer);return Array.from(new Uint8Array(p)).map(g=>g.toString(16).padStart(2,"0")).join("")}function S(n,h,p){let g={name:n,summary:p,usage:`${n} [OPTION]... [FILE]...`,options:["-c, --check read checksums from FILEs and check them"," --help display this help and exit"]};return{name:n,async execute(A,o){if(m(A))return U(g);let s=!1,d=[];for(let e of A)if(e==="-c"||e==="--check")s=!0;else if(!(e==="-b"||e==="-t"||e==="--binary"||e==="--text")){if(e.startsWith("-")&&e!=="-")return F(n,e);d.push(e)}d.length===0&&d.push("-");let b=async e=>{if(e==="-")return new TextEncoder().encode(o.stdin);try{return await o.fs.readFileBuffer(o.fs.resolvePath(o.cwd,e))}catch{return null}};if(s){let e=0,f="";for(let a of d){let u=a==="-"?o.stdin:await o.fs.readFile(o.fs.resolvePath(o.cwd,a)).catch(()=>null);if(u===null)return{stdout:"",stderr:`${n}: ${a}: No such file or directory
|
|
3
|
+
`,exitCode:1};for(let $ of u.split(`
|
|
4
|
+
`)){let r=$.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!r)continue;let[,x,c]=r,t=await b(c);if(t===null){f+=`${c}: FAILED open or read
|
|
5
|
+
`,e++;continue}let i=await k(h,t)===x.toLowerCase();f+=`${c}: ${i?"OK":"FAILED"}
|
|
6
|
+
`,i||e++}}return e>0&&(f+=`${n}: WARNING: ${e} computed checksum${e>1?"s":""} did NOT match
|
|
7
|
+
`),{stdout:f,stderr:"",exitCode:e>0?1:0}}let l="",w=0;for(let e of d){let f=await b(e);if(f===null){l+=`${n}: ${e}: No such file or directory
|
|
8
|
+
`,w=1;continue}l+=`${await k(h,f)} ${e}
|
|
9
|
+
`}return{stdout:l,stderr:"",exitCode:w}}}}export{S as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var l=(a,b,c,e)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&f(a,d,{get:()=>b[d],enumerable:!(e=h(b,d))||e.enumerable});return a};var o=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as e,b as r}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as e,b as r}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var t={name:"clear",summary:"clear the terminal screen",usage:"clear [OPTIONS]",options:[" --help display this help and exit"]},s={name:"clear",async execute(a,c){return r(a)?e(t):{stdout:"\x1B[2J\x1B[H",stderr:"",exitCode:0}}};export{s as clearCommand};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as g,b as $,c as y}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var x={name:"comm",summary:"compare two sorted files line by line",usage:"comm [OPTION]... FILE1 FILE2",options:["-1 suppress column 1 (lines unique to FILE1)","-2 suppress column 2 (lines unique to FILE2)","-3 suppress column 3 (lines that appear in both files)"," --help display this help and exit"]},I={name:"comm",async execute(p,c){if($(p))return g(x);let o=!1,i=!1,f=!1,l=[];for(let e of p)if(e==="-1")o=!0;else if(e==="-2")i=!0;else if(e==="-3")f=!0;else if(e==="-12"||e==="-21")o=!0,i=!0;else if(e==="-13"||e==="-31")o=!0,f=!0;else if(e==="-23"||e==="-32")i=!0,f=!0;else if(e==="-123"||e==="-132"||e==="-213"||e==="-231"||e==="-312"||e==="-321")o=!0,i=!0,f=!0;else{if(e.startsWith("-")&&e!=="-")return y("comm",e);l.push(e)}if(l.length!==2)return{stdout:"",stderr:`comm: missing operand
|
|
3
|
+
Try 'comm --help' for more information.
|
|
4
|
+
`,exitCode:1};let m=async e=>{if(e==="-")return c.stdin;try{let F=c.fs.resolvePath(c.cwd,e);return await c.fs.readFile(F)}catch{return null}},a=await m(l[0]);if(a===null)return{stdout:"",stderr:`comm: ${l[0]}: No such file or directory
|
|
5
|
+
`,exitCode:1};let h=await m(l[1]);if(h===null)return{stdout:"",stderr:`comm: ${l[1]}: No such file or directory
|
|
6
|
+
`,exitCode:1};let t=a.split(`
|
|
7
|
+
`),s=h.split(`
|
|
8
|
+
`);t.length>0&&t[t.length-1]===""&&t.pop(),s.length>0&&s[s.length-1]===""&&s.pop();let n=0,r=0,u="",d=o?"":" ",w=(o?"":" ")+(i?"":" ");for(;n<t.length||r<s.length;)n>=t.length?(i||(u+=`${d}${s[r]}
|
|
9
|
+
`),r++):r>=s.length?(o||(u+=`${t[n]}
|
|
10
|
+
`),n++):t[n]<s[r]?(o||(u+=`${t[n]}
|
|
11
|
+
`),n++):t[n]>s[r]?(i||(u+=`${d}${s[r]}
|
|
12
|
+
`),r++):(f||(u+=`${w}${t[n]}
|
|
13
|
+
`),n++,r++);return{stdout:u,stderr:"",exitCode:0}}};export{I as commCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as m}from"./chunk-TA7RUHGQ.js";import{a as $}from"./chunk-4VDEBYW7.js";import{a as g,b as y}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as m}from"./chunk-TA7RUHGQ.js";import{a as $}from"./chunk-4VDEBYW7.js";import{a as g,b as y}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var D={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},E={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},R={name:"cp",async execute(f,e){if(y(f))return g(D);let t=m("cp",f,E);if(!t.ok)return t.error;let u=t.result.flags.recursive||t.result.flags.recursiveUpper,w=t.result.flags.noClobber,C=t.result.flags.preserve,P=t.result.flags.verbose,a=t.result.positional;if(a.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
3
3
|
`,exitCode:1};let d=a.pop()??"",h=a,o=e.fs.resolvePath(e.cwd,d),v="",n="",l=0,p=!1;try{p=(await e.fs.stat(o)).isDirectory}catch{}if(h.length>1&&!p)return{stdout:"",stderr:`cp: target '${d}' is not a directory
|
|
4
4
|
`,exitCode:1};for(let r of h)try{let i=e.fs.resolvePath(e.cwd,r),s=await e.fs.stat(i),c=o;if(p){let b=r.split("/").pop()||r;c=o==="/"?`/${b}`:`${o}/${b}`}if(s.isDirectory&&!u){n+=`cp: -r not specified; omitting directory '${r}'
|
|
5
5
|
`,l=1;continue}if(w)try{await e.fs.stat(c);continue}catch{}await e.fs.cp(i,c,{recursive:u}),P&&(v+=`'${r}' -> '${c}'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as b}from"./chunk-4VDEBYW7.js";import{a as T,b as y,c as f}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as b}from"./chunk-4VDEBYW7.js";import{a as T,b as y,c as f}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";function u(s){let t=s.indexOf("=");if(t>=0){let r=s.slice(0,t),e=s.slice(t+1);return r?`${encodeURIComponent(r)}=${encodeURIComponent(e)}`:encodeURIComponent(e)}return encodeURIComponent(s)}function c(s){let t=s.indexOf("=");if(t<0)return null;let r=s.slice(0,t),e=s.slice(t+1),i,a,o=e.match(/;type=([^;]+)$/);o&&(a=o[1],e=e.slice(0,-o[0].length));let n=e.match(/;filename=([^;]+)/);return n&&(i=n[1],e=e.replace(n[0],"")),(e.startsWith("@")||e.startsWith("<"))&&(i=i??e.slice(1).split("/").pop()),{name:r,value:e,filename:i,contentType:a}}function w(s,t){let r=`----CurlFormBoundary${Date.now().toString(36)}`,e=[];for(let i of s){let a=i.value;if(a.startsWith("@")||a.startsWith("<")){let n=a.slice(1);a=t.get(n)??""}let o=`--${r}\r
|
|
3
3
|
`;i.filename?(o+=`Content-Disposition: form-data; name="${i.name}"; filename="${i.filename}"\r
|
|
4
4
|
`,i.contentType&&(o+=`Content-Type: ${i.contentType}\r
|
|
5
5
|
`)):o+=`Content-Disposition: form-data; name="${i.name}"\r
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as x}from"./chunk-J7MJV6WO.js";import{a as y,b as I,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{b as x}from"./chunk-J7MJV6WO.js";import{a as y,b as I,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var W={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function k(t){let c=[],l=t.split(",");for(let n of l)if(n.includes("-")){let[s,r]=n.split("-");c.push({start:s?parseInt(s,10):1,end:r?parseInt(r,10):null})}else{let s=parseInt(n,10);c.push({start:s,end:s})}return c}function C(t,c){let l=[];for(let n of c){let s=n.start-1,r=n.end===null?t.length:n.end;for(let i=s;i<r&&i<t.length;i++)i>=0&&!l.includes(t[i])&&l.push(t[i])}return l}var E={name:"cut",async execute(t,c){if(I(t))return y(W);let l=" ",n=null,s=null,r=!1,i=[];for(let o=0;o<t.length;o++){let e=t[o];if(e==="-d")l=t[++o]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")n=t[++o];else if(e.startsWith("-f"))n=e.slice(2);else if(e==="-c")s=t[++o];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")r=!0;else{if(e.startsWith("--"))return m("cut",e);if(e.startsWith("-")){let f=!1;for(let u of e.slice(1))if(u==="s")r=!0;else if(!"dfc".includes(u)){f=!0;break}if(f)return m("cut",e)}else i.push(e)}}if(!n&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
|
|
3
3
|
`,exitCode:1};let p=await x(c,i,{cmdName:"cut"});if(!p.ok)return p.error;let a=p.content.split(`
|
|
4
4
|
`);a.length>0&&a[a.length-1]===""&&a.pop();let g=k(n||s||"1"),h="";for(let o of a)if(s){let e=o.split(""),f=[];for(let u of g){let w=u.start-1,L=u.end===null?e.length:u.end;for(let d=w;d<L&&d<e.length;d++)d>=0&&f.push(e[d])}h+=`${f.join("")}
|
|
5
5
|
`}else{if(r&&!o.includes(l))continue;let e=o.split(l),f=C(e,g);h+=`${f.join(l)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as g,b as k,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as g,b as k,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var p={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]},M=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function n(t,i=2){return String(t).padStart(i,"0")}function T(t){let i=-t.getTimezoneOffset();return`${i>=0?"+":"-"}${n(Math.floor(Math.abs(i)/60))}${n(Math.abs(i)%60)}`}function d(t,i,r){let a=r?{Y:t.getUTCFullYear(),m:t.getUTCMonth(),D:t.getUTCDate(),H:t.getUTCHours(),M:t.getUTCMinutes(),S:t.getUTCSeconds(),w:t.getUTCDay()}:{Y:t.getFullYear(),m:t.getMonth(),D:t.getDate(),H:t.getHours(),M:t.getMinutes(),S:t.getSeconds(),w:t.getDay()},e="",o=0;for(;o<i.length;){if(i[o]==="%"&&o+1<i.length){let c=i[++o];switch(c){case"%":e+="%";break;case"a":e+=M[a.w];break;case"b":case"h":e+=h[a.m];break;case"d":e+=n(a.D);break;case"e":e+=String(a.D).padStart(2," ");break;case"F":e+=`${a.Y}-${n(a.m+1)}-${n(a.D)}`;break;case"H":e+=n(a.H);break;case"I":e+=n(a.H%12||12);break;case"m":e+=n(a.m+1);break;case"M":e+=n(a.M);break;case"n":e+=`
|
|
3
3
|
`;break;case"p":e+=a.H<12?"AM":"PM";break;case"P":e+=a.H<12?"am":"pm";break;case"R":e+=`${n(a.H)}:${n(a.M)}`;break;case"s":e+=Math.floor(t.getTime()/1e3);break;case"S":e+=n(a.S);break;case"t":e+=" ";break;case"T":e+=`${n(a.H)}:${n(a.M)}:${n(a.S)}`;break;case"u":e+=a.w||7;break;case"w":e+=a.w;break;case"y":e+=n(a.Y%100);break;case"Y":e+=a.Y;break;case"z":e+=r?"+0000":T(t);break;case"Z":e+=r?"UTC":Intl.DateTimeFormat().resolvedOptions().timeZone;break;default:e+=`%${c}`}}else e+=i[o];o++}return e}function S(t){let i=new Date(t);if(!Number.isNaN(i.getTime()))return i;if(/^\d+$/.test(t))return new Date(Number.parseInt(t,10)*1e3);let r=t.toLowerCase();return r==="now"||r==="today"?new Date:r==="yesterday"?new Date(Date.now()-864e5):r==="tomorrow"?new Date(Date.now()+864e5):null}var w={name:"date",async execute(t,i){if(k(t))return g(p);let r=!1,a=null,e=null,o=!1,c=!1;for(let f=0;f<t.length;f++){let s=t[f];if(s==="-u"||s==="--utc")r=!0;else if(s==="-d"||s==="--date")a=t[++f]??"";else if(s.startsWith("--date="))a=s.slice(7);else if(s==="-I"||s==="--iso-8601")o=!0;else if(s==="-R"||s==="--rfc-email")c=!0;else if(s.startsWith("+"))e=s.slice(1);else{if(s.startsWith("--"))return m("date",s);if(s.startsWith("-"))for(let b of s.slice(1))if(b==="u")r=!0;else if(b==="I")o=!0;else if(b==="R")c=!0;else return m("date",`-${b}`)}}let l=a!==null?S(a):new Date;if(!l)return{stdout:"",stderr:`date: invalid date '${a}'
|
|
4
4
|
`,exitCode:1};let u;return e?u=d(l,e,r):o?u=d(l,"%Y-%m-%dT%H:%M:%S%z",r):c?u=d(l,"%a, %d %b %Y %H:%M:%S %z",r):u=d(l,"%a %b %e %H:%M:%S %Z %Y",r),{stdout:`${u}
|
|
5
5
|
`,stderr:"",exitCode:0}}};export{w as dateCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as N}from"./chunk-TA7RUHGQ.js";import{a as S,b as E}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as N}from"./chunk-TA7RUHGQ.js";import{a as S,b as E}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var v=class{diff(e,t,n={}){let s;typeof n=="function"?(s=n,n={}):"callback"in n&&(s=n.callback);let u=this.castInput(e,n),f=this.castInput(t,n),i=this.removeEmpty(this.tokenize(u,n)),a=this.removeEmpty(this.tokenize(f,n));return this.diffWithOptionsObj(i,a,n,s)}diffWithOptionsObj(e,t,n,s){var u;let f=r=>{if(r=this.postProcess(r,n),s){setTimeout(function(){s(r)},0);return}else return r},i=t.length,a=e.length,d=1,o=i+a;n.maxEditLength!=null&&(o=Math.min(o,n.maxEditLength));let g=(u=n.timeout)!==null&&u!==void 0?u:1/0,w=Date.now()+g,m=[{oldPos:-1,lastComponent:void 0}],P=this.extractCommon(m[0],t,e,0,n);if(m[0].oldPos+1>=a&&P+1>=i)return f(this.buildValues(m[0].lastComponent,t,e));let C=-1/0,x=1/0,L=()=>{for(let r=Math.max(C,-d);r<=Math.min(x,d);r+=2){let c,h=m[r-1],p=m[r+1];h&&(m[r-1]=void 0);let y=!1;if(p){let I=p.oldPos-r;y=p&&0<=I&&I<i}let b=h&&h.oldPos+1<a;if(!y&&!b){m[r]=void 0;continue}if(!b||y&&h.oldPos<p.oldPos?c=this.addToPath(p,!0,!1,0,n):c=this.addToPath(h,!1,!0,1,n),P=this.extractCommon(c,t,e,r,n),c.oldPos+1>=a&&P+1>=i)return f(this.buildValues(c.lastComponent,t,e))||!0;m[r]=c,c.oldPos+1>=a&&(x=Math.min(x,r-1)),P+1>=i&&(C=Math.max(C,r+1))}d++};if(s)(function r(){setTimeout(function(){if(d>o||Date.now()>w)return s(void 0);L()||r()},0)})();else for(;d<=o&&Date.now()<=w;){let r=L();if(r)return r}}addToPath(e,t,n,s,u){let f=e.lastComponent;return f&&!u.oneChangePerToken&&f.added===t&&f.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:f.count+1,added:t,removed:n,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:t,removed:n,previousComponent:f}}}extractCommon(e,t,n,s,u){let f=t.length,i=n.length,a=e.oldPos,d=a-s,o=0;for(;d+1<f&&a+1<i&&this.equals(n[a+1],t[d+1],u);)d++,a++,o++,u.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return o&&!u.oneChangePerToken&&(e.lastComponent={count:o,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,d}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let s=[],u;for(;e;)s.push(e),u=e.previousComponent,delete e.previousComponent,e=u;s.reverse();let f=s.length,i=0,a=0,d=0;for(;i<f;i++){let o=s[i];if(o.removed)o.value=this.join(n.slice(d,d+o.count)),d+=o.count;else{if(!o.added&&this.useLongestToken){let g=t.slice(a,a+o.count);g=g.map(function(w,m){let P=n[d+m];return P.length>w.length?P:w}),o.value=this.join(g)}else o.value=this.join(t.slice(a,a+o.count));a+=o.count,o.added||(d+=o.count)}}return s}};var T=class extends v{constructor(){super(...arguments),this.tokenize=W}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
3
3
|
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
4
4
|
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
5
5
|
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as i,b as o}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as i,b as o}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var m={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},p={name:"dirname",async execute(t,l){if(o(t))return i(m);let a=t.filter(n=>!n.startsWith("-"));if(a.length===0)return{stdout:"",stderr:`dirname: missing operand
|
|
3
3
|
`,exitCode:1};let e=[];for(let n of a){let r=n.replace(/\/+$/,""),s=r.lastIndexOf("/");s===-1?e.push("."):s===0?e.push("/"):e.push(r.slice(0,s))}return{stdout:`${e.join(`
|
|
4
4
|
`)}
|
|
5
5
|
`,stderr:"",exitCode:0}}};export{p as dirnameCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as z}from"./chunk-TA7RUHGQ.js";import{a as p,b as g}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as z}from"./chunk-TA7RUHGQ.js";import{a as p,b as g}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var $={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},D={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},F={name:"du",async execute(t,l){if(g(t))return p($);let a=z("du",t,D);if(!a.ok)return a.error;let e={allFiles:a.result.flags.allFiles,humanReadable:a.result.flags.humanReadable,summarize:a.result.flags.summarize,grandTotal:a.result.flags.grandTotal,maxDepth:a.result.flags.maxDepth??null},s=a.result.positional;s.length===0&&s.push(".");let r="",n="",m=0;for(let o of s){let i=l.fs.resolvePath(l.cwd,o);try{await l.fs.stat(i);let u=await y(l,i,o,e,0);r+=u.output,m+=u.totalSize,n+=u.stderr}catch{n+=`du: cannot access '${o}': No such file or directory
|
|
3
3
|
`}}return e.grandTotal&&s.length>0&&(r+=`${d(m,e.humanReadable)} total
|
|
4
4
|
`),{stdout:r,stderr:n,exitCode:n?1:0}}};async function y(t,l,a,e,s){let r={output:"",totalSize:0,stderr:""};try{let n=await t.fs.stat(l);if(!n.isDirectory)return r.totalSize=n.size,(e.allFiles||s===0)&&(r.output=d(n.size,e.humanReadable)+" "+a+`
|
|
5
5
|
`),r;let m=await t.fs.readdir(l),o=0;for(let i of m){let u=l==="/"?`/${i}`:`${l}/${i}`,f=a==="."?i:`${a}/${i}`;try{let c=await t.fs.stat(u);if(c.isDirectory){let h=await y(t,u,f,e,s+1);o+=h.totalSize,e.summarize||(e.maxDepth===null||s+1<=e.maxDepth?r.output+=h.output:o+=0)}else o+=c.size,e.allFiles&&!e.summarize&&(r.output+=d(c.size,e.humanReadable)+" "+f+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-SJXDWN5X.js";function o(a){let s="",e=0;for(;e<a.length;)if(a[e]==="\\"){if(e+1>=a.length){s+="\\";break}let c=a[e+1];switch(c){case"\\":s+="\\",e+=2;break;case"n":s+=`
|
|
3
3
|
`,e+=2;break;case"t":s+=" ",e+=2;break;case"r":s+="\r",e+=2;break;case"a":s+="\x07",e+=2;break;case"b":s+="\b",e+=2;break;case"f":s+="\f",e+=2;break;case"v":s+="\v",e+=2;break;case"e":case"E":s+="\x1B",e+=2;break;case"c":return{output:s,stop:!0};case"0":{let r="",t=e+2;for(;t<a.length&&t<e+5&&/[0-7]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\0";else{let l=parseInt(r,8)%256;s+=String.fromCharCode(l)}e=t;break}case"x":{let r="",t=e+2;for(;t<a.length&&t<e+4&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\x",e+=2;else{let l=parseInt(r,16);s+=String.fromCharCode(l),e=t}break}case"u":{let r="",t=e+2;for(;t<a.length&&t<e+6&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\u",e+=2;else{let l=parseInt(r,16);s+=String.fromCodePoint(l),e=t}break}case"U":{let r="",t=e+2;for(;t<a.length&&t<e+10&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\U",e+=2;else{let l=parseInt(r,16);try{s+=String.fromCodePoint(l)}catch{s+=`\\U${r}`}e=t}break}default:s+=`\\${c}`,e+=2}}else s+=a[e],e++;return{output:s,stop:!1}}var n={name:"echo",async execute(a,s){let e=!1,c=!1,r=0;for(;r<a.length;){let l=a[r];if(l==="-n")e=!0,r++;else if(l==="-e")c=!0,r++;else if(l==="-E")c=!1,r++;else if(l==="-ne"||l==="-en")e=!0,c=!0,r++;else break}let t=a.slice(r).join(" ");if(c){let l=o(t);if(t=l.output,l.stop)return{stdout:t,stderr:"",exitCode:0}}return e||(t+=`
|
|
4
4
|
`),{stdout:t,stderr:"",exitCode:0}}};export{n as echoCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as m,b as f,c as p}from"./chunk-GTNBSMZR.js";import"./chunk-
|
|
2
|
+
import{a as m,b as f,c as p}from"./chunk-GTNBSMZR.js";import"./chunk-SJXDWN5X.js";var O={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},y={name:"env",async execute(s,i){if(f(s))return m(O);let u=!1,o=[],l={},t=-1;for(let n=0;n<s.length;n++){let e=s[n];if(e==="-i"||e==="--ignore-environment")u=!0;else if(e==="-u"&&n+1<s.length)o.push(s[++n]);else if(e.startsWith("-u"))o.push(e.slice(2));else if(e.startsWith("--unset="))o.push(e.slice(8));else{if(e.startsWith("--")&&e!=="--")return p("env",e);if(e.startsWith("-")&&e!=="-"){for(let r of e.slice(1))if(r!=="i"&&r!=="u")return p("env",`-${r}`);e.includes("i")&&(u=!0)}else if(e.includes("=")&&t===-1){let r=e.indexOf("="),h=e.slice(0,r),x=e.slice(r+1);l[h]=x}else{t=n;break}}}let a;if(u)a={...l};else{a={...i.env};for(let n of o)delete a[n];Object.assign(a,l)}if(t===-1){let n=[];for(let[e,r]of Object.entries(a))n.push(`${e}=${r}`);return{stdout:n.join(`
|
|
3
3
|
`)+(n.length>0?`
|
|
4
4
|
`:""),stderr:"",exitCode:0}}if(!i.exec)return{stdout:"",stderr:`env: command execution not supported in this context
|
|
5
5
|
`,exitCode:1};let c=s.slice(t).join(" "),d=Object.entries(l).map(([n,e])=>`${n}="${e}"`).join(" "),v=d?`${d} ${c}`:c;return i.exec(v,{cwd:i.cwd})}},g={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},A={name:"printenv",async execute(s,i){if(f(s))return m(g);let u=s.filter(t=>!t.startsWith("-"));if(u.length===0){let t=[];for(let[a,c]of Object.entries(i.env))t.push(`${a}=${c}`);return{stdout:t.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-SJXDWN5X.js";var d={name:"expr",async execute(s,r){if(s.length===0)return{stdout:"",stderr:`expr: missing operand
|
|
3
3
|
`,exitCode:2};try{let l=g(s),h=l==="0"||l===""?1:0;return{stdout:`${l}
|
|
4
4
|
`,stderr:"",exitCode:h}}catch(l){return{stdout:"",stderr:`expr: ${l.message}
|
|
5
5
|
`,exitCode:2}}}};function g(s){if(s.length===1)return s[0];let r=0;function l(){let e=h();for(;r<s.length&&s[r]==="|";){r++;let t=h();if(e!=="0"&&e!=="")return e;e=t}return e}function h(){let e=a();for(;r<s.length&&s[r]==="&";){r++;let t=a();(e==="0"||e===""||t==="0"||t==="")&&(e="0")}return e}function a(){let e=p();for(;r<s.length;){let t=s[r];if(["=","!=","<",">","<=",">="].includes(t)){r++;let o=p(),n=parseInt(e,10),i=parseInt(o,10),f=!Number.isNaN(n)&&!Number.isNaN(i),c;t==="="?c=f?n===i:e===o:t==="!="?c=f?n!==i:e!==o:t==="<"?c=f?n<i:e<o:t===">"?c=f?n>i:e>o:t==="<="?c=f?n<=i:e<=o:c=f?n>=i:e>=o,e=c?"1":"0"}else break}return e}function p(){let e=N();for(;r<s.length;){let t=s[r];if(t==="+"||t==="-"){r++;let o=N(),n=parseInt(e,10),i=parseInt(o,10);if(Number.isNaN(n)||Number.isNaN(i))throw new Error("non-integer argument");e=String(t==="+"?n+i:n-i)}else break}return e}function N(){let e=m();for(;r<s.length;){let t=s[r];if(t==="*"||t==="/"||t==="%"){r++;let o=m(),n=parseInt(e,10),i=parseInt(o,10);if(Number.isNaN(n)||Number.isNaN(i))throw new Error("non-integer argument");if((t==="/"||t==="%")&&i===0)throw new Error("division by zero");t==="*"?e=String(n*i):t==="/"?e=String(Math.trunc(n/i)):e=String(n%i)}else break}return e}function m(){let e=u();for(;r<s.length&&s[r]===":";){r++;let t=u(),o=new RegExp(`^${t}`),n=e.match(o);n?e=n[1]!==void 0?n[1]:String(n[0].length):e="0"}return e}function u(){if(r>=s.length)throw new Error("syntax error");let e=s[r];if(e==="match"){r++;let t=u(),o=u(),n=new RegExp(o),i=t.match(n);return i?i[1]!==void 0?i[1]:String(i[0].length):"0"}if(e==="substr"){r++;let t=u(),o=parseInt(u(),10),n=parseInt(u(),10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");return t.substring(o-1,o-1+n)}if(e==="index"){r++;let t=u(),o=u();for(let n=0;n<t.length;n++)if(o.includes(t[n]))return String(n+1);return"0"}if(e==="length"){r++;let t=u();return String(t.length)}if(e==="("){r++;let t=l();if(r>=s.length||s[r]!==")")throw new Error("syntax error");return r++,t}return r++,e}return l()}export{d as exprCommand};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as ge,b as we,c as te}from"./chunk-GTNBSMZR.js";import{a as ee,b as O,c as he}from"./chunk-SJXDWN5X.js";var be=O(ne=>{ne.read=function(i,e,t,r,n){var o,s,p=n*8-r-1,a=(1<<p)-1,m=a>>1,c=-7,f=t?n-1:0,l=t?-1:1,x=i[e+f];for(f+=l,o=x&(1<<-c)-1,x>>=-c,c+=p;c>0;o=o*256+i[e+f],f+=l,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=s*256+i[e+f],f+=l,c-=8);if(o===0)o=1-m;else{if(o===a)return s?NaN:(x?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-m}return(x?-1:1)*s*Math.pow(2,o-r)};ne.write=function(i,e,t,r,n,o){var s,p,a,m=o*8-n-1,c=(1<<m)-1,f=c>>1,l=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=r?0:o-1,v=r?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),s+f>=1?e+=l/a:e+=l*Math.pow(2,1-f),e*a>=2&&(s++,a/=2),s+f>=c?(p=0,s=c):s+f>=1?(p=(e*a-1)*Math.pow(2,n),s=s+f):(p=e*Math.pow(2,f-1)*Math.pow(2,n),s=0));n>=8;i[t+x]=p&255,x+=v,p/=256,n-=8);for(s=s<<n|p,m+=n;m>0;i[t+x]=s&255,x+=v,s/=256,m-=8);i[t+x-v]|=w*128}});var Be=O((_i,Ee)=>{var M=1e3,L=M*60,j=L*60,I=j*24,ft=I*7,mt=I*365.25;Ee.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return lt(i);if(t==="number"&&isFinite(i))return e.long?ut(i):xt(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function lt(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*mt;case"weeks":case"week":case"w":return t*ft;case"days":case"day":case"d":return t*I;case"hours":case"hour":case"hrs":case"hr":case"h":return t*j;case"minutes":case"minute":case"mins":case"min":case"m":return t*L;case"seconds":case"second":case"secs":case"sec":case"s":return t*M;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function xt(i){var e=Math.abs(i);return e>=I?Math.round(i/I)+"d":e>=j?Math.round(i/j)+"h":e>=L?Math.round(i/L)+"m":e>=M?Math.round(i/M)+"s":i+"ms"}function ut(i){var e=Math.abs(i);return e>=I?J(i,e,I,"day"):e>=j?J(i,e,j,"hour"):e>=L?J(i,e,L,"minute"):e>=M?J(i,e,M,"second"):i+" ms"}function J(i,e,t,r){var n=e>=t*1.5;return Math.round(i/t)+" "+r+(n?"s":"")}});var se=O(($i,Ie)=>{function dt(i){t.debug=t,t.default=t,t.coerce=a,t.disable=s,t.enable=n,t.enabled=p,t.humanize=Be(),t.destroy=m,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let f=0;for(let l=0;l<c.length;l++)f=(f<<5)-f+c.charCodeAt(l),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(c){let f,l=null,x,v;function w(...C){if(!w.enabled)return;let A=w,$=Number(new Date),Ge=$-(f||$);A.diff=Ge,A.prev=f,A.curr=$,f=$,C[0]=t.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let H=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(K,Je)=>{if(K==="%%")return"%";H++;let de=t.formatters[Je];if(typeof de=="function"){let Xe=C[H];K=de.call(A,Xe),C.splice(H,1),H--}return K}),t.formatArgs.call(A,C),(A.log||t.log).apply(A,C)}return w.namespace=c,w.useColors=t.useColors(),w.color=t.selectColor(c),w.extend=r,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(x!==t.namespaces&&(x=t.namespaces,v=t.enabled(c)),v),set:C=>{l=C}}),typeof t.init=="function"&&t.init(w),w}function r(c,f){let l=t(this.namespace+(typeof f>"u"?":":f)+c);return l.log=this.log,l}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let f=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let l of f)l[0]==="-"?t.skips.push(l.slice(1)):t.names.push(l)}function o(c,f){let l=0,x=0,v=-1,w=0;for(;l<c.length;)if(x<f.length&&(f[x]===c[l]||f[x]==="*"))f[x]==="*"?(v=x,w=l,x++):(l++,x++);else if(v!==-1)x=v+1,w++,l=w;else return!1;for(;x<f.length&&f[x]==="*";)x++;return x===f.length}function s(){let c=[...t.names,...t.skips.map(f=>"-"+f)].join(",");return t.enable(""),c}function p(c){for(let f of t.skips)if(o(c,f))return!1;for(let f of t.names)if(o(c,f))return!0;return!1}function a(c){return c instanceof Error?c.stack||c.message:c}function m(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Ie.exports=dt});var De=O((b,X)=>{b.formatArgs=gt;b.save=wt;b.load=kt;b.useColors=ht;b.storage=yt();b.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();b.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ht(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function gt(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+X.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}b.log=console.debug||console.log||(()=>{});function wt(i){try{i?b.storage.setItem("debug",i):b.storage.removeItem("debug")}catch{}}function kt(){let i;try{i=b.storage.getItem("debug")||b.storage.getItem("DEBUG")}catch{}return!i&&typeof process<"u"&&"env"in process&&(i=process.env.DEBUG),i}function yt(){try{return localStorage}catch{}}X.exports=se()(b);var{formatters:bt}=X.exports;bt.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ze=O((g,Q)=>{var Ct=ee("tty"),Z=ee("util");g.init=Bt;g.log=Tt;g.formatArgs=vt;g.save=At;g.load=Et;g.useColors=Ft;g.destroy=Z.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");g.colors=[6,2,3,4,5,1];try{let i=ee("supports-color");i&&(i.stderr||i).level>=2&&(g.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}g.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,o)=>o.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function Ft(){return"colors"in g.inspectOpts?!!g.inspectOpts.colors:Ct.isatty(process.stderr.fd)}function vt(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),o=` ${n};1m${e} \x1B[0m`;i[0]=o+i[0].split(`
|
|
3
|
+
`).join(`
|
|
4
|
+
`+o),i.push(n+"m+"+Q.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=St()+e+" "+i[0]}function St(){return g.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Tt(...i){return process.stderr.write(Z.formatWithOptions(g.inspectOpts,...i)+`
|
|
5
|
+
`)}function At(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Et(){return process.env.DEBUG}function Bt(i){i.inspectOpts={};let e=Object.keys(g.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=g.inspectOpts[e[t]]}Q.exports=se()(g);var{formatters:Oe}=Q.exports;Oe.o=function(i){return this.inspectOpts.colors=this.useColors,Z.inspect(i,this.inspectOpts).split(`
|
|
6
|
+
`).map(e=>e.trim()).join(" ")};Oe.O=function(i){return this.inspectOpts.colors=this.useColors,Z.inspect(i,this.inspectOpts)}});var Ue=O((Hi,ae)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?ae.exports=De():ae.exports=ze()});var Ze="End-Of-Stream",u=class extends Error{constructor(){super(Ze),this.name="EndOfStreamError"}},E=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var B=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0&&!t)throw new u;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let o=Math.min(n.length,t);e.set(n.subarray(0,o),r),r+=o,t-=o,o<n.length&&this.peekQueue.push(n.subarray(o))}return r}async readRemainderFromStream(e,t){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new E;let n=await this.readFromStream(e.subarray(r),t);if(n===0)break;r+=n}if(!t&&r<e.length)throw new u;return r}};var W=class extends B{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}};var R=class extends W{async readFromStream(e,t){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}};var z=class extends B{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let r=Math.min(t.length,e.length);return e.set(t.subarray(0,r)),r<t.length?this.buffer=t.subarray(r):this.buffer=null,r}async readFromStream(e,t){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){let n=await this.reader.read();if(n.done){this.endOfStream=!0;break}n.value&&(r+=this.writeChunk(e.subarray(r),n.value))}if(!t&&r===0&&this.endOfStream)throw new u;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function ie(i){try{let e=i.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new z(e):new R(e)}catch(e){if(e instanceof TypeError)return new z(i.getReader());throw e}}var F=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})<e.len)throw new u;return e.get(r,0)}async peekToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:t})<e.len)throw new u;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new u;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new u;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){let t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}};var Ye=256e3,V=class extends F{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let o=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=o,(!t||!t.mayBeLess)&&o<r.length)throw new u;return o}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=0;if(r.position){let o=r.position-this.position;if(o>0){let s=new Uint8Array(r.length+o);return n=await this.peekBuffer(s,{mayBeLess:r.mayBeLess}),e.set(s.subarray(o)),n-o}if(o<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(o){if(t?.mayBeLess&&o instanceof u)return 0;throw o}if(!r.mayBeLess&&n<r.length)throw new u}return n}async ignore(e){let t=Math.min(Ye,e),r=new Uint8Array(t),n=0;for(;n<e;){let o=e-n,s=await this.readBuffer(r,{length:Math.min(t,o)});if(s<0)return s;n+=s}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}};var q=class extends F{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new u;return e.set(this.uint8Array.subarray(r.position,r.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};var G=class extends F{constructor(e,t){super(t),this.blob=e,this.fileInfo={...t?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new u;let o=await this.blob.slice(r.position,r.position+n).arrayBuffer();return e.set(new Uint8Array(o)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};function re(i,e){let t=ie(i),r=e??{},n=r.onClose;return r.onClose=async()=>{if(await t.close(),n)return n()},new V(t,r)}function ke(i,e){return new q(i,e)}function ye(i,e){return new G(i,e)}import{open as et}from"node:fs/promises";var P=class i extends F{static async fromFile(e){let t=await et(e,"r"),r=await t.stat();return new i(t,{fileInfo:{path:e,size:r.size}})}constructor(e,t){super(t),this.fileHandle=e,this.fileInfo=t.fileInfo}async readBuffer(e,t){let r=this.normalizeOptions(e,t);if(this.position=r.position,r.length===0)return 0;let n=await this.fileHandle.read(e,0,r.length,r.position);if(this.position+=n.bytesRead,n.bytesRead<r.length&&(!t||!t.mayBeLess))throw new u;return n.bytesRead}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=await this.fileHandle.read(e,0,r.length,r.position);if(!r.mayBeLess&&n.bytesRead<r.length)throw new u;return n.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(e){this.position=e}supportsRandomAccess(){return!0}};var tt=P.fromFile;var Fe=he(be(),1);var oe={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},rt={};for(let[i,e]of Object.entries(oe))rt[e]=Number.parseInt(i);function Ce(i,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(i):nt(i);case"utf-16le":return ot(i);case"ascii":return st(i);case"latin1":case"iso-8859-1":return at(i);case"windows-1252":return ct(i);default:throw new RangeError(`Encoding '${e}' not supported`)}}function nt(i){let e="",t=0;for(;t<i.length;){let r=i[t++];if(r<128)e+=String.fromCharCode(r);else if(r<224){let n=i[t++]&63;e+=String.fromCharCode((r&31)<<6|n)}else if(r<240){let n=i[t++]&63,o=i[t++]&63;e+=String.fromCharCode((r&15)<<12|n<<6|o)}else{let n=i[t++]&63,o=i[t++]&63,s=i[t++]&63,p=(r&7)<<18|n<<12|o<<6|s;p-=65536,e+=String.fromCharCode(55296+(p>>10&1023),56320+(p&1023))}}return e}function ot(i){let e="";for(let t=0;t<i.length;t+=2)e+=String.fromCharCode(i[t]|i[t+1]<<8);return e}function st(i){return String.fromCharCode(...i.map(e=>e&127))}function at(i){return String.fromCharCode(...i)}function ct(i){let e="";for(let t of i)t>=128&&t<=159&&oe[t]?e+=oe[t]:e+=String.fromCharCode(t);return e}function k(i){return new DataView(i.buffer,i.byteOffset)}var ve={len:1,get(i,e){return k(i).getUint8(e)},put(i,e,t){return k(i).setUint8(e,t),e+1}},d={len:2,get(i,e){return k(i).getUint16(e,!0)},put(i,e,t){return k(i).setUint16(e,t,!0),e+2}},U={len:2,get(i,e){return k(i).getUint16(e)},put(i,e,t){return k(i).setUint16(e,t),e+2}};var h={len:4,get(i,e){return k(i).getUint32(e,!0)},put(i,e,t){return k(i).setUint32(e,t,!0),e+4}},Se={len:4,get(i,e){return k(i).getUint32(e)},put(i,e,t){return k(i).setUint32(e,t),e+4}};var Te={len:4,get(i,e){return k(i).getInt32(e)},put(i,e,t){return k(i).setInt32(e,t),e+4}};var Ae={len:8,get(i,e){return k(i).getBigUint64(e,!0)},put(i,e,t){return k(i).setBigUint64(e,t,!0),e+8}};var y=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){let r=e.subarray(t,t+this.len);return Ce(r,this.encoding)}};var Re=he(Ue(),1);var D={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},ce={get(i){return{signature:h.get(i,0),compressedSize:h.get(i,8),uncompressedSize:h.get(i,12)}},len:16},Me={get(i){let e=d.get(i,6);return{signature:h.get(i,0),minVersion:d.get(i,4),dataDescriptor:!!(e&8),compressedMethod:d.get(i,8),compressedSize:h.get(i,18),uncompressedSize:h.get(i,22),filenameLength:d.get(i,26),extraFieldLength:d.get(i,28),filename:null}},len:30},Le={get(i){return{signature:h.get(i,0),nrOfThisDisk:d.get(i,4),nrOfThisDiskWithTheStart:d.get(i,6),nrOfEntriesOnThisDisk:d.get(i,8),nrOfEntriesOfSize:d.get(i,10),sizeOfCd:h.get(i,12),offsetOfStartOfCd:h.get(i,16),zipFileCommentLength:d.get(i,20)}},len:22},je={get(i){let e=d.get(i,8);return{signature:h.get(i,0),minVersion:d.get(i,6),dataDescriptor:!!(e&8),compressedMethod:d.get(i,10),compressedSize:h.get(i,20),uncompressedSize:h.get(i,24),filenameLength:d.get(i,28),extraFieldLength:d.get(i,30),fileCommentLength:d.get(i,32),relativeOffsetOfLocalHeader:h.get(i,42),filename:null}},len:46};function Pe(i){let e=new Uint8Array(h.len);return h.put(e,0,i),e}var S=(0,Re.default)("tokenizer:inflate"),pe=256*1024,It=Pe(D.DataDescriptor),Y=Pe(D.EndOfCentralDirectory),N=class i{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(pe)}async isZip(){return await this.peekSignature()===D.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(h)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,t=Math.min(16*1024,e.fileInfo.size),r=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(r,{position:e.fileInfo.size-t});for(let n=r.length-4;n>=0;n--)if(r[n]===Y[0]&&r[n+1]===Y[1]&&r[n+2]===Y[2]&&r[n+3]===Y[3])return e.fileInfo.size-t+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){S("Cannot reading central-directory without random-read support");return}S("Reading central-directory...");let e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){S("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(Le,t),n=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let o=0;o<r.nrOfEntriesOfSize;++o){let s=await this.tokenizer.readToken(je);if(s.signature!==D.CentralFileHeader)throw new Error("Expected Central-File-Header signature");s.filename=await this.tokenizer.readToken(new y(s.filenameLength,"utf-8")),await this.tokenizer.ignore(s.extraFieldLength),await this.tokenizer.ignore(s.fileCommentLength),n.push(s),S(`Add central-directory file-entry: n=${o+1}/${n.length}: filename=${n[o].filename}`)}return this.tokenizer.setPosition(e),n}this.tokenizer.setPosition(e)}async unzip(e){let t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let r=!1;do{let n=await this.readLocalFileHeader();if(!n)break;let o=e(n);r=!!o.stop;let s;if(await this.tokenizer.ignore(n.extraFieldLength),n.dataDescriptor&&n.compressedSize===0){let p=[],a=pe;S("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let m=-1;for(;m<0&&a===pe;){a=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),m=Dt(this.syncBuffer.subarray(0,a),It);let c=m>=0?m:a;if(o.handler){let f=new Uint8Array(c);await this.tokenizer.readBuffer(f),p.push(f)}else await this.tokenizer.ignore(c)}S(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),o.handler&&await this.inflate(n,Ot(p),o.handler)}else o.handler?(S(`Reading compressed-file-data: ${n.compressedSize} bytes`),s=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(s),await this.inflate(n,s,o.handler)):(S(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(S(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(ce)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-ce.len}`)}while(!r)}async iterateOverCentralDirectory(e,t){for(let r of e){let n=t(r);if(n.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let o=await this.readLocalFileHeader();if(o){await this.tokenizer.ignore(o.extraFieldLength);let s=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(s),await this.inflate(o,s,n.handler)}}if(n.stop)break}}async inflate(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);S(`Decompress filename=${e.filename}, compressed-size=${t.length}`);let n=await i.decompressDeflateRaw(t);return r(n)}static async decompressDeflateRaw(e){let t=new ReadableStream({start(o){o.enqueue(e),o.close()}}),r=new DecompressionStream("deflate-raw"),n=t.pipeThrough(r);try{let s=await new Response(n).arrayBuffer();return new Uint8Array(s)}catch(o){let s=o instanceof Error?`Failed to deflate ZIP entry: ${o.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(s)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(h);if(e===D.LocalFileHeader){let t=await this.tokenizer.readToken(Me);return t.filename=await this.tokenizer.readToken(new y(t.filenameLength,"utf-8")),t}if(e===D.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function Dt(i,e){let t=i.length,r=e.length;if(r>t)return-1;for(let n=0;n<=t-r;n++){let o=!0;for(let s=0;s<r;s++)if(i[n+s]!==e[s]){o=!1;break}if(o)return n}return-1}function Ot(i){let e=i.reduce((n,o)=>n+o.length,0),t=new Uint8Array(e),r=0;for(let n of i)t.set(n,r),r+=n.length;return t}var _=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let r=new Uint8Array(1024),n=await e.readBuffer(r,{mayBeLess:!0});if(n===0){t.close();return}t.enqueue(r.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}};var Ki={utf8:new globalThis.TextDecoder("utf8")};var er=new globalThis.TextEncoder;var tr=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function fe(i){let{byteLength:e}=i;if(e===6)return i.getUint16(0)*2**32+i.getUint32(2);if(e===5)return i.getUint8(0)*2**32+i.getUint32(1);if(e===4)return i.getUint32(0);if(e===3)return i.getUint8(0)*2**16+i.getUint16(1);if(e===2)return i.getUint16(0);if(e===1)return i.getUint8(0)}function Ne(i,e){if(e==="utf-16le"){let t=[];for(let r=0;r<i.length;r++){let n=i.charCodeAt(r);t.push(n&255,n>>8&255)}return t}if(e==="utf-16be"){let t=[];for(let r=0;r<i.length;r++){let n=i.charCodeAt(r);t.push(n>>8&255,n&255)}return t}return[...i].map(t=>t.charCodeAt(0))}function _e(i,e=0){let t=Number.parseInt(new y(6).get(i,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(t))return!1;let r=256;for(let n=e;n<e+148;n++)r+=i[n];for(let n=e+156;n<e+512;n++)r+=i[n];return t===r}var $e={get:(i,e)=>i[e+3]&127|i[e+2]<<7|i[e+1]<<14|i[e]<<21,len:4};var He=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],We=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"];var me=4100;async function ue(i,e){return new xe(e).fromBuffer(i)}function le(i){switch(i=i.toLowerCase(),i){case"application/epub+zip":return{ext:"epub",mime:i};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:i};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:i};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:i};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:i};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:i};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:i};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:i};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:i};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:i};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:i};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:i};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:i};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:i};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:i};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:i};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function T(i,e,t){t={offset:0,...t};for(let[r,n]of e.entries())if(t.mask){if(n!==(t.mask[r]&i[r+t.offset]))return!1}else if(n!==i[r+t.offset])return!1;return!0}var xe=class{constructor(e){this.options={mpegOffsetTolerance:0,...e},this.detectors=[...e?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e?.signal}}async fromTokenizer(e){let t=e.position;for(let r of this.detectors){let n=await r.detect(e);if(n)return n;if(t!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t?.length>1)return this.fromTokenizer(ke(t,this.tokenizerOptions))}async fromBlob(e){let t=ye(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async fromStream(e){let t=re(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t){let{sampleSize:r=me}=t,n,o,s=e.getReader({mode:"byob"});try{let{value:m,done:c}=await s.read(new Uint8Array(r));if(o=m,!c&&m)try{n=await this.fromBuffer(m.subarray(0,r))}catch(f){if(!(f instanceof u))throw f;n=void 0}o=m}finally{s.releaseLock()}let p=new TransformStream({async start(m){m.enqueue(o)},transform(m,c){c.enqueue(m)}}),a=e.pipeThrough(p);return a.fileType=n,a}check(e,t){return T(this.buffer,e,t)}checkString(e,t){return this.check(Ne(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(me),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8])){let r=new _(e).inflate(),n=!0;try{let o;try{o=await this.fromStream(r)}catch{n=!1}if(o&&o.ext==="tar")return{ext:"tar.gz",mime:"application/gzip"}}finally{n&&await r.cancel()}return{ext:"gz",mime:"application/gzip"}}if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);let t=await e.readToken($e);return e.position+t>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(t),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let t;return await new N(e).unzip(r=>{switch(r.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(n){let o=new TextDecoder("utf-8").decode(n).trim();t=le(o)},stop:!0};case"[Content_Types].xml":return{async handler(n){let o=new TextDecoder("utf-8").decode(n),s=o.indexOf('.main+xml"');if(s===-1){let p="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";o.includes(`ContentType="${p}"`)&&(t=le(p))}else{o=o.slice(0,Math.max(0,s));let p=o.lastIndexOf('"'),a=o.slice(Math.max(0,p+1));t=le(a)}},stop:!0};default:return/classes\d*\.dex/.test(r.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}).catch(r=>{if(!(r instanceof u))throw r}),t??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),T(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:T(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:T(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:T(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:T(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:T(t,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){let t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){let p=await e.peekNumber(ve),a=128,m=0;for(;(p&a)===0&&a!==0;)++m,a>>=1;let c=new Uint8Array(m+1);return await e.readBuffer(c),c}async function r(){let p=await t(),a=await t();a[0]^=128>>a.length-1;let m=Math.min(6,a.length),c=new DataView(p.buffer),f=new DataView(a.buffer,a.length-m,m);return{id:fe(c),len:fe(f)}}async function n(p){for(;p>0;){let a=await r();if(a.id===17026)return(await e.readToken(new y(a.len))).replaceAll(/\00.*$/g,"");await e.ignore(a.len),--p}}let o=await r();switch(await n(o.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let t=new y(4,"latin1").get(this.buffer,2);if(t.match("^d*")&&t>=1e3&&t<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new y(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
7
|
+
`,"\r"," "," ","\0"].some(t=>this.checkString(t,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){await e.ignore(8);async function t(){return{length:await e.readToken(Te),type:await e.readToken(new y(4,"latin1"))}}do{let r=await t();if(r.length<0)return;switch(r.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(r.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let t=new y(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(t){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return t.startsWith("3g")?t.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
8
|
+
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function t(){let r=new Uint8Array(16);return await e.readBuffer(r),{id:r,size:Number(await e.readToken(Ae))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){let r=await t(),n=r.size-24;if(T(r.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let o=new Uint8Array(16);if(n-=await e.readBuffer(o),T(o,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(T(o,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(n)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new y(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let t=new DataView(this.buffer.buffer).getUint32(12,!0);if(t>12&&this.buffer.length>=t+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,t+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&_e(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let t="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:t})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:t})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
|
|
9
|
+
`,{offset:2,encoding:t})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async e=>{if(this.buffer=new Uint8Array(me),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let t=0;t<=this.options.mpegOffsetTolerance;++t){let r=this.scanMpeg(t);if(r)return r}};async readTiffTag(e){let t=await this.tokenizer.readToken(e?U:d);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let t=await this.tokenizer.readToken(e?U:d);for(let r=0;r<t;++r){let n=await this.readTiffTag(e);if(n)return n}}async readTiffHeader(e){let t=(e?U:d).get(this.buffer,2),r=(e?Se:h).get(this.buffer,4);if(t===42){if(r>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r>=8){let o=(e?U:d).get(this.buffer,8),s=(e?U:d).get(this.buffer,10);if(o===28&&s===254||o===31&&s===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(r),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(t===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:e+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},zt=new Set(He),Ut=new Set(We);var Mt={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},Ve={".js":{description:"JavaScript source",mime:"text/javascript"},".mjs":{description:"JavaScript module",mime:"text/javascript"},".cjs":{description:"CommonJS module",mime:"text/javascript"},".ts":{description:"TypeScript source",mime:"text/typescript"},".tsx":{description:"TypeScript JSX source",mime:"text/typescript"},".jsx":{description:"JavaScript JSX source",mime:"text/javascript"},".py":{description:"Python script",mime:"text/x-python"},".rb":{description:"Ruby script",mime:"text/x-ruby"},".go":{description:"Go source",mime:"text/x-go"},".rs":{description:"Rust source",mime:"text/x-rust"},".c":{description:"C source",mime:"text/x-c"},".h":{description:"C header",mime:"text/x-c"},".cpp":{description:"C++ source",mime:"text/x-c++"},".hpp":{description:"C++ header",mime:"text/x-c++"},".java":{description:"Java source",mime:"text/x-java"},".sh":{description:"Bourne-Again shell script",mime:"text/x-shellscript"},".bash":{description:"Bourne-Again shell script",mime:"text/x-shellscript"},".zsh":{description:"Zsh shell script",mime:"text/x-shellscript"},".json":{description:"JSON data",mime:"application/json"},".yaml":{description:"YAML data",mime:"text/yaml"},".yml":{description:"YAML data",mime:"text/yaml"},".xml":{description:"XML document",mime:"application/xml"},".csv":{description:"CSV text",mime:"text/csv"},".toml":{description:"TOML data",mime:"text/toml"},".html":{description:"HTML document",mime:"text/html"},".htm":{description:"HTML document",mime:"text/html"},".css":{description:"CSS stylesheet",mime:"text/css"},".svg":{description:"SVG image",mime:"image/svg+xml"},".md":{description:"Markdown document",mime:"text/markdown"},".markdown":{description:"Markdown document",mime:"text/markdown"},".txt":{description:"ASCII text",mime:"text/plain"},".rst":{description:"reStructuredText",mime:"text/x-rst"},".env":{description:"ASCII text",mime:"text/plain"},".gitignore":{description:"ASCII text",mime:"text/plain"},".dockerignore":{description:"ASCII text",mime:"text/plain"}},qe={jpg:"JPEG image data",jpeg:"JPEG image data",png:"PNG image data",gif:"GIF image data",webp:"WebP image data",bmp:"PC bitmap",ico:"MS Windows icon resource",tif:"TIFF image data",tiff:"TIFF image data",psd:"Adobe Photoshop Document",avif:"AVIF image",heic:"HEIC image",heif:"HEIF image",jxl:"JPEG XL image",icns:"Mac OS X icon",svg:"SVG Scalable Vector Graphics image",pdf:"PDF document",epub:"EPUB document",mobi:"Mobipocket E-book",djvu:"DjVu document",zip:"Zip archive data",gz:"gzip compressed data",gzip:"gzip compressed data",bz2:"bzip2 compressed data",xz:"XZ compressed data",tar:"POSIX tar archive",rar:"RAR archive data","7z":"7-zip archive data",lz:"lzip compressed data",lzma:"LZMA compressed data",zst:"Zstandard compressed data",cab:"Microsoft Cabinet archive",ar:"Unix ar archive",rpm:"RPM package",deb:"Debian binary package",apk:"Android Package",dmg:"Apple disk image",iso:"ISO 9660 CD-ROM filesystem data",vhd:"Microsoft Virtual Hard Disk",vhdx:"Microsoft Virtual Hard Disk (new format)",qcow2:"QEMU QCOW Image",mp3:"Audio file with ID3",m4a:"MPEG-4 audio",aac:"AAC audio",wav:"RIFF (little-endian) data, WAVE audio",flac:"FLAC audio bitstream data",ogg:"Ogg data",oga:"Ogg audio",opus:"Ogg Opus audio",aiff:"AIFF audio",wma:"Windows Media Audio",amr:"AMR audio",mid:"MIDI audio",midi:"MIDI audio",ape:"Monkey's Audio",mp4:"ISO Media, MPEG-4",m4v:"MPEG-4 video",webm:"WebM",avi:"RIFF (little-endian) data, AVI",mov:"ISO Media, Apple QuickTime movie",mkv:"Matroska data",wmv:"Windows Media Video",flv:"Flash Video","3gp":"3GPP multimedia","3g2":"3GPP2 multimedia",ogv:"Ogg video",mts:"MPEG transport stream",m2ts:"MPEG transport stream",ts:"MPEG transport stream",mpg:"MPEG video",mpeg:"MPEG video",exe:"PE32 executable",dll:"PE32 DLL",elf:"ELF executable",mach:"Mach-O executable",wasm:"WebAssembly (wasm) binary module",dex:"Android Dalvik executable",class:"Java class file",swf:"Adobe Flash",doc:"Microsoft Word Document",docx:"Microsoft Word 2007+ Document",xls:"Microsoft Excel Spreadsheet",xlsx:"Microsoft Excel 2007+ Spreadsheet",ppt:"Microsoft PowerPoint Presentation",pptx:"Microsoft PowerPoint 2007+ Presentation",odt:"OpenDocument Text",ods:"OpenDocument Spreadsheet",odp:"OpenDocument Presentation",ttf:"TrueType Font",otf:"OpenType Font",woff:"Web Open Font Format",woff2:"Web Open Font Format 2",eot:"Embedded OpenType font",stl:"Stereolithography CAD",obj:"Wavefront 3D Object",gltf:"GL Transmission Format",glb:"GL Transmission Format (binary)",sqlite:"SQLite 3.x database",mdb:"Microsoft Access Database",xml:"XML document",json:"JSON data",macho:"Mach-O binary",ics:"iCalendar data",vcf:"vCard data",msi:"Microsoft Installer",ps:"PostScript",ai:"Adobe Illustrator",indd:"Adobe InDesign",sketch:"Sketch design file",fig:"Figma design file",xd:"Adobe XD",blend:"Blender",fbx:"Autodesk FBX",lnk:"MS Windows shortcut",alias:"Mac OS alias",torrent:"BitTorrent file",pcap:"pcap capture file",arrow:"Apache Arrow",parquet:"Apache Parquet"};function Lt(i,e){if(qe[i])return qe[i];let[t,r]=e.split("/"),n=r?.split("+")[0]?.replace(/-/g," ")||i;switch(t){case"image":return`${n.toUpperCase()} image data`;case"audio":return`${n.toUpperCase()} audio`;case"video":return`${n.toUpperCase()} video`;case"font":return`${n} font`;case"model":return`${n} 3D model`;case"application":return r?.includes("zip")||r?.includes("compressed")?`${n} archive data`:r?.includes("executable")?`${n} executable`:`${i.toUpperCase()} data`;default:return`${i.toUpperCase()} data`}}function jt(i){let e=i.split("/").pop()||i;if(e.startsWith(".")&&!e.includes(".",1))return e;let t=e.lastIndexOf(".");return t===-1||t===0?"":e.slice(t).toLowerCase()}function Rt(i,e){if(i.startsWith("#!")){let a=i.split(`
|
|
10
|
+
`)[0];return a.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:a.includes("node")||a.includes("bun")||a.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:a.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:a.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:a.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:a.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let t=i.trimStart();if(t.startsWith("<?xml"))return{description:"XML document",mime:"application/xml"};if(t.startsWith("<!DOCTYPE html")||t.toLowerCase().startsWith("<html"))return{description:"HTML document",mime:"text/html"};let r=i.includes(`\r
|
|
11
|
+
`),n=i.includes("\r")&&!r,o="";r?o=", with CRLF line terminators":n&&(o=", with CR line terminators");let s=jt(e);if(s&&Ve[s]){let a=Ve[s];return a.mime.startsWith("text/")&&o?{description:`${a.description}${o}`,mime:a.mime}:a}let p=!1;for(let a=0;a<Math.min(i.length,8192);a++)if(i.charCodeAt(a)>127){p=!0;break}return p?{description:`UTF-8 Unicode text${o}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${o}`,mime:"text/plain"}}async function Pt(i,e){if(e.length===0)return{description:"empty",mime:"inode/x-empty"};let t=await ue(e);if(t)return{description:Lt(t.ext,t.mime),mime:t.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(e);return Rt(r,i)}var wr={name:"file",async execute(i,e){if(we(i))return ge(Mt);let t=!1,r=!1,n=[];for(let p of i)if(p.startsWith("--")){if(p==="--brief")t=!0;else if(p==="--mime"||p==="--mime-type")r=!0;else if(p!=="--dereference")return te("file",p)}else if(p.startsWith("-")&&p!=="-"){for(let a of p.slice(1))if(a==="b")t=!0;else if(a==="i")r=!0;else if(a!=="L")return te("file",`-${a}`)}else n.push(p);if(n.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
|
|
12
|
+
`,exitCode:1};let o="",s=0;for(let p of n)try{let a=e.fs.resolvePath(e.cwd,p);if((await e.fs.stat(a)).isDirectory){let x=r?"inode/directory":"directory";o+=t?`${x}
|
|
13
|
+
`:`${p}: ${x}
|
|
14
|
+
`;continue}let c=await e.fs.readFileBuffer(a),f=await Pt(p,c),l=r?f.mime:f.description;o+=t?`${l}
|
|
15
|
+
`:`${p}: ${l}
|
|
16
|
+
`}catch{o+=t?`cannot open
|
|
17
|
+
`:`${p}: cannot open (No such file or directory)
|
|
18
|
+
`,s=1}return{stdout:o,stderr:"",exitCode:s}}};export{wr as fileCommand};
|
|
19
|
+
/*! Bundled license information:
|
|
20
|
+
|
|
21
|
+
ieee754/index.js:
|
|
22
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
23
|
+
*/
|