just-bash 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +72 -9
- package/dist/Bash.d.ts +12 -4
- package/dist/abort-signals.d.ts +10 -0
- package/dist/bin/chunks/alias-3R4G6HQY.js +3 -0
- package/dist/bin/chunks/awk2-7UZLEPVX.js +3 -0
- package/dist/bin/chunks/base64-W6FVFNXJ.js +3 -0
- package/dist/bin/chunks/basename-C4CRGDXP.js +3 -0
- package/dist/bin/chunks/bash-CFCBBWVH.js +3 -0
- package/dist/bin/chunks/cat-5YECZSFQ.js +3 -0
- package/dist/bin/chunks/chmod-45TMYSW2.js +3 -0
- package/dist/bin/chunks/chunk-23OI2XDJ.js +20 -0
- package/dist/bin/chunks/chunk-2OQ5HPZE.js +7 -0
- package/dist/bin/chunks/chunk-2YLY6FJA.js +10 -0
- package/dist/bin/chunks/chunk-3HUI54BW.js +143 -0
- package/dist/bin/chunks/chunk-3OYRDLJJ.js +101 -0
- package/dist/bin/chunks/chunk-3PCPQIUD.js +3 -0
- package/dist/bin/chunks/chunk-3VSWQCPN.js +18 -0
- package/dist/bin/chunks/chunk-43E7AR6A.js +3 -0
- package/dist/bin/chunks/chunk-46CDVHZ3.js +5 -0
- package/dist/bin/chunks/chunk-4SQKKW2M.js +3 -0
- package/dist/bin/chunks/chunk-5SKEZPTU.js +12 -0
- package/dist/bin/chunks/chunk-6D75E4LV.js +3 -0
- package/dist/bin/chunks/chunk-6SAZRW7E.js +15 -0
- package/dist/bin/chunks/chunk-7FGDUBSN.js +14 -0
- package/dist/bin/chunks/chunk-7I6MNC5I.js +3 -0
- package/dist/bin/chunks/chunk-B7RRNV3A.js +22 -0
- package/dist/bin/chunks/chunk-BCJ42NCM.js +15 -0
- package/dist/bin/chunks/chunk-BNYIXXC2.js +3 -0
- package/dist/bin/chunks/chunk-BPWZ7ADB.js +8 -0
- package/dist/bin/chunks/chunk-BWRQ5HYX.js +9 -0
- package/dist/bin/chunks/chunk-CB4SODHK.js +34 -0
- package/dist/bin/chunks/chunk-CC2AQ6B7.js +15 -0
- package/dist/bin/chunks/chunk-CPKBPQ2C.js +3 -0
- package/dist/bin/chunks/chunk-CPTQXTBJ.js +3 -0
- package/dist/bin/chunks/chunk-D3MUBZ4P.js +65 -0
- package/dist/bin/chunks/chunk-DN2YCFOR.js +3 -0
- package/dist/bin/chunks/chunk-DSZQ22OX.js +12 -0
- package/dist/bin/chunks/chunk-E5VZGTZ6.js +10 -0
- package/dist/bin/chunks/chunk-ETWDDV6I.js +10 -0
- package/dist/bin/chunks/chunk-GEUCQ4AB.js +10 -0
- package/dist/bin/chunks/chunk-H4BRFPKY.js +3 -0
- package/dist/bin/chunks/chunk-IAAPXDHN.js +11 -0
- package/dist/bin/chunks/chunk-ISW2U76N.js +17 -0
- package/dist/bin/chunks/chunk-JQER3HUP.js +20 -0
- package/dist/bin/chunks/chunk-K5KT6DMM.js +4 -0
- package/dist/bin/chunks/chunk-KG2KXL4Y.js +3 -0
- package/dist/bin/chunks/chunk-LCP3IKI7.js +9 -0
- package/dist/bin/chunks/chunk-LGERQ5TD.js +22 -0
- package/dist/bin/chunks/chunk-LNFTLSWJ.js +22 -0
- package/dist/bin/chunks/chunk-LUHU7UUN.js +7 -0
- package/dist/bin/chunks/chunk-LXFMIXGA.js +3 -0
- package/dist/bin/chunks/chunk-MYTNZ7MA.js +7 -0
- package/dist/bin/chunks/chunk-MZM7RVYU.js +8 -0
- package/dist/bin/chunks/chunk-NGD6G5ZG.js +9 -0
- package/dist/bin/chunks/chunk-NJ67YJRE.js +6 -0
- package/dist/bin/chunks/chunk-NQQ3X7MZ.js +36 -0
- package/dist/bin/chunks/chunk-O74FSWB4.js +4 -0
- package/dist/bin/chunks/chunk-OKU677H3.js +87 -0
- package/dist/bin/chunks/chunk-P6NPCASY.js +11 -0
- package/dist/bin/chunks/chunk-PKWK3LQM.js +22 -0
- package/dist/bin/chunks/chunk-PQPFDJFF.js +34 -0
- package/dist/bin/chunks/chunk-PRKSLEHG.js +291 -0
- package/dist/bin/chunks/chunk-PUZGSIMN.js +15 -0
- package/dist/bin/chunks/chunk-Q3LE3Y66.js +13 -0
- package/dist/bin/chunks/chunk-QAYU7HPM.js +7 -0
- package/dist/bin/chunks/chunk-QES5OSUC.js +3 -0
- package/dist/bin/chunks/chunk-QF7PPON7.js +16 -0
- package/dist/bin/chunks/chunk-QK6BXSHU.js +13 -0
- package/dist/bin/chunks/chunk-RYQB6GQ7.js +11 -0
- package/dist/bin/chunks/chunk-SSK3N7FN.js +3 -0
- package/dist/bin/chunks/chunk-TL4JI2SL.js +38 -0
- package/dist/bin/chunks/chunk-TPU3OX2A.js +3 -0
- package/dist/bin/chunks/chunk-TW2IJRUF.js +3 -0
- package/dist/bin/chunks/chunk-TZ3S7MY6.js +12 -0
- package/dist/bin/chunks/chunk-VGR3NA3H.js +13 -0
- package/dist/bin/chunks/chunk-VLWZ6L7C.js +4 -0
- package/dist/bin/chunks/chunk-VTAIIBJT.js +16 -0
- package/dist/bin/chunks/chunk-VTHA5UK5.js +7 -0
- package/dist/bin/chunks/chunk-VY2K25J4.js +16 -0
- package/dist/bin/chunks/chunk-W4U4QOZF.js +7 -0
- package/dist/bin/chunks/chunk-WDV2ECOC.js +3 -0
- package/dist/bin/chunks/chunk-WFVCEB5T.js +3 -0
- package/dist/bin/chunks/chunk-WSLBBXPJ.js +12 -0
- package/dist/bin/chunks/chunk-WWOUFMMY.js +3 -0
- package/dist/bin/chunks/chunk-WYTPLN2M.js +11 -0
- package/dist/bin/chunks/chunk-X5VUGFUL.js +3 -0
- package/dist/bin/chunks/chunk-X63MJBLH.js +26 -0
- package/dist/bin/chunks/chunk-XAAXPEOP.js +6 -0
- package/dist/bin/chunks/chunk-XEQ7KSRM.js +5 -0
- package/dist/bin/chunks/chunk-YIANER7Y.js +8 -0
- package/dist/bin/chunks/chunk-YMELOXDK.js +13 -0
- package/dist/bin/chunks/chunk-YTL6DXBO.js +11 -0
- package/dist/bin/chunks/chunk-YYZSYLJO.js +6 -0
- package/dist/bin/chunks/chunk-ZXIW4JPL.js +22 -0
- package/dist/bin/chunks/clear-OE52K3TM.js +3 -0
- package/dist/bin/chunks/column-7VBJL757.js +3 -0
- package/dist/bin/chunks/comm-URDMZCXL.js +3 -0
- package/dist/bin/chunks/cp-MF5GADQN.js +3 -0
- package/dist/bin/chunks/curl-FS5LAEYI.js +30 -0
- package/dist/bin/chunks/cut-QOTYBJJJ.js +3 -0
- package/dist/bin/chunks/date-FJUBX7TJ.js +3 -0
- package/dist/bin/chunks/diff-YXZZCUSQ.js +3 -0
- package/dist/bin/chunks/dirname-TPUFCYF6.js +3 -0
- package/dist/bin/chunks/du-A3UGHIKJ.js +3 -0
- package/dist/bin/chunks/echo-4OUEL7QB.js +3 -0
- package/dist/bin/chunks/env-2TSVF4W7.js +3 -0
- package/dist/bin/chunks/expand-P6SNTBGZ.js +3 -0
- package/dist/bin/chunks/expr-56X7LYOS.js +3 -0
- package/dist/bin/chunks/file-SQSOBJLR.js +3 -0
- package/dist/bin/chunks/find-XY2NTAT5.js +3 -0
- package/dist/bin/chunks/flag-coverage-WGSE667D.js +3 -0
- package/dist/bin/chunks/fold-YEY7X54W.js +3 -0
- package/dist/bin/chunks/grep-CMT2H2S7.js +3 -0
- package/dist/bin/chunks/gzip-DJSFJOY6.js +3 -0
- package/dist/bin/chunks/head-KPRH4HKC.js +3 -0
- package/dist/bin/chunks/help-HVIDHJ6M.js +3 -0
- package/dist/bin/chunks/history-3HAU45KT.js +3 -0
- package/dist/bin/chunks/hostname-2I76DUQL.js +3 -0
- package/dist/bin/chunks/html-to-markdown-WUBAMB4O.js +3 -0
- package/dist/bin/chunks/join-UQKXU2QP.js +3 -0
- package/dist/bin/chunks/jq-ACCMBTSD.js +3 -0
- package/dist/bin/chunks/js-exec-4KNUPGHA.js +99 -0
- package/dist/bin/chunks/js-exec-worker.js +187 -110
- package/dist/bin/chunks/ln-XSDIE6SU.js +3 -0
- package/dist/bin/chunks/ls-FTHYNINH.js +3 -0
- package/dist/bin/chunks/md5sum-Z6KAYGDK.js +3 -0
- package/dist/bin/chunks/mkdir-74BP5NTG.js +3 -0
- package/dist/bin/chunks/mv-YG75IRRE.js +3 -0
- package/dist/bin/chunks/nl-XHWFVVKH.js +3 -0
- package/dist/bin/chunks/od-A7CW5RMS.js +3 -0
- package/dist/bin/chunks/paste-YJLYVJMP.js +3 -0
- package/dist/bin/chunks/printf-F2KOCULO.js +3 -0
- package/dist/bin/chunks/pwd-YKLNXWZI.js +3 -0
- package/dist/bin/chunks/python3-AYUQQRCR.js +14 -0
- package/dist/bin/chunks/readlink-HMHVGSAM.js +3 -0
- package/dist/bin/chunks/rev-CZTQCNOZ.js +3 -0
- package/dist/bin/chunks/rg-JRKJ6I4X.js +3 -0
- package/dist/bin/chunks/rm-3PLW4O4B.js +3 -0
- package/dist/bin/chunks/rmdir-DCJ3XJRR.js +3 -0
- package/dist/bin/chunks/sed-QJ2LNV2N.js +3 -0
- package/dist/bin/chunks/seq-Q4LZ6EXV.js +3 -0
- package/dist/bin/chunks/sha1sum-CATBXX76.js +3 -0
- package/dist/bin/chunks/sha256sum-YGSNBVY3.js +3 -0
- package/dist/bin/chunks/sleep-FUDWGDCE.js +3 -0
- package/dist/bin/chunks/sort-M3DO25D5.js +3 -0
- package/dist/bin/chunks/split-7IYQYKOW.js +3 -0
- package/dist/bin/chunks/sqlite3-ZXF6BGDW.js +3 -0
- package/dist/bin/chunks/sqlite3-worker.js +316 -173
- package/dist/bin/chunks/stat-Y5D3VPLG.js +3 -0
- package/dist/bin/chunks/strings-J2X2Z6N2.js +3 -0
- package/dist/bin/chunks/tac-DG4BMYM5.js +3 -0
- package/dist/bin/chunks/tail-QISQLA3I.js +3 -0
- package/dist/bin/chunks/tar-TB2XWXF6.js +3 -0
- package/dist/bin/chunks/tee-L4HKV5PD.js +3 -0
- package/dist/bin/chunks/time-LF7BTSK5.js +3 -0
- package/dist/bin/chunks/timeout-TDOV6JDA.js +3 -0
- package/dist/bin/chunks/touch-TVQAUQOG.js +3 -0
- package/dist/bin/chunks/tr-AR6EK7JH.js +3 -0
- package/dist/bin/chunks/tree-ZGP6NPGS.js +3 -0
- package/dist/bin/chunks/true-KFTJGQLQ.js +3 -0
- package/dist/bin/chunks/undici-JES22UVU.js +141 -0
- package/dist/bin/chunks/unexpand-JPOQORZF.js +3 -0
- package/dist/bin/chunks/uniq-K5VRDP4Q.js +3 -0
- package/dist/bin/chunks/wc-VSQBRD6B.js +3 -0
- package/dist/bin/chunks/which-4TPGVSBZ.js +3 -0
- package/dist/bin/chunks/whoami-B5HDVKW6.js +3 -0
- package/dist/bin/chunks/worker.js +212 -105
- package/dist/bin/chunks/xan-D6US4ZGL.js +3 -0
- package/dist/bin/chunks/xan-view-QGKWT354.js +3 -0
- package/dist/bin/chunks/xargs-HMISWW4I.js +3 -0
- package/dist/bin/chunks/yq-EYV7HLKK.js +3 -0
- package/dist/bin/just-bash.js +412 -387
- package/dist/bin/shell/chunks/alias-3R4G6HQY.js +3 -0
- package/dist/bin/shell/chunks/awk2-7UZLEPVX.js +3 -0
- package/dist/bin/shell/chunks/base64-W6FVFNXJ.js +3 -0
- package/dist/bin/shell/chunks/basename-C4CRGDXP.js +3 -0
- package/dist/bin/shell/chunks/bash-CFCBBWVH.js +3 -0
- package/dist/bin/shell/chunks/cat-5YECZSFQ.js +3 -0
- package/dist/bin/shell/chunks/chmod-45TMYSW2.js +3 -0
- package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +20 -0
- package/dist/bin/shell/chunks/chunk-2OQ5HPZE.js +7 -0
- package/dist/bin/shell/chunks/chunk-2YLY6FJA.js +10 -0
- package/dist/bin/shell/chunks/chunk-3HUI54BW.js +143 -0
- package/dist/bin/shell/chunks/chunk-3OYRDLJJ.js +101 -0
- package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +3 -0
- package/dist/bin/shell/chunks/chunk-3VSWQCPN.js +18 -0
- package/dist/bin/shell/chunks/chunk-43E7AR6A.js +3 -0
- package/dist/bin/shell/chunks/chunk-46CDVHZ3.js +5 -0
- package/dist/bin/shell/chunks/chunk-4SQKKW2M.js +3 -0
- package/dist/bin/shell/chunks/chunk-5SKEZPTU.js +12 -0
- package/dist/bin/shell/chunks/chunk-6D75E4LV.js +3 -0
- package/dist/bin/shell/chunks/chunk-6SAZRW7E.js +15 -0
- package/dist/bin/shell/chunks/chunk-7FGDUBSN.js +14 -0
- package/dist/bin/shell/chunks/chunk-7I6MNC5I.js +3 -0
- package/dist/bin/shell/chunks/chunk-B7RRNV3A.js +22 -0
- package/dist/bin/shell/chunks/chunk-BCJ42NCM.js +15 -0
- package/dist/bin/shell/chunks/chunk-BNYIXXC2.js +3 -0
- package/dist/bin/shell/chunks/chunk-BPWZ7ADB.js +8 -0
- package/dist/bin/shell/chunks/chunk-BWRQ5HYX.js +9 -0
- package/dist/bin/shell/chunks/chunk-CB4SODHK.js +34 -0
- package/dist/bin/shell/chunks/chunk-CC2AQ6B7.js +15 -0
- package/dist/bin/shell/chunks/chunk-CPKBPQ2C.js +3 -0
- package/dist/bin/shell/chunks/chunk-CPTQXTBJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-D3MUBZ4P.js +65 -0
- package/dist/bin/shell/chunks/chunk-DN2YCFOR.js +3 -0
- package/dist/bin/shell/chunks/chunk-DSZQ22OX.js +12 -0
- package/dist/bin/shell/chunks/chunk-E5VZGTZ6.js +10 -0
- package/dist/bin/shell/chunks/chunk-ETWDDV6I.js +10 -0
- package/dist/bin/shell/chunks/chunk-GEUCQ4AB.js +10 -0
- package/dist/bin/shell/chunks/chunk-H4BRFPKY.js +3 -0
- package/dist/bin/shell/chunks/chunk-IAAPXDHN.js +11 -0
- package/dist/bin/shell/chunks/chunk-ISW2U76N.js +17 -0
- package/dist/bin/shell/chunks/chunk-JQER3HUP.js +20 -0
- package/dist/bin/shell/chunks/chunk-K5KT6DMM.js +4 -0
- package/dist/bin/shell/chunks/chunk-KG2KXL4Y.js +3 -0
- package/dist/bin/shell/chunks/chunk-LCP3IKI7.js +9 -0
- package/dist/bin/shell/chunks/chunk-LGERQ5TD.js +22 -0
- package/dist/bin/shell/chunks/chunk-LNFTLSWJ.js +22 -0
- package/dist/bin/shell/chunks/chunk-LUHU7UUN.js +7 -0
- package/dist/bin/shell/chunks/chunk-LXFMIXGA.js +3 -0
- package/dist/bin/shell/chunks/chunk-MYTNZ7MA.js +7 -0
- package/dist/bin/shell/chunks/chunk-MZM7RVYU.js +8 -0
- package/dist/bin/shell/chunks/chunk-NGD6G5ZG.js +9 -0
- package/dist/bin/shell/chunks/chunk-NJ67YJRE.js +6 -0
- package/dist/bin/shell/chunks/chunk-NQQ3X7MZ.js +36 -0
- package/dist/bin/shell/chunks/chunk-O74FSWB4.js +4 -0
- package/dist/bin/shell/chunks/chunk-OKU677H3.js +87 -0
- package/dist/bin/shell/chunks/chunk-P6NPCASY.js +11 -0
- package/dist/bin/shell/chunks/chunk-PKWK3LQM.js +22 -0
- package/dist/bin/shell/chunks/chunk-PQPFDJFF.js +34 -0
- package/dist/bin/shell/chunks/chunk-PRKSLEHG.js +291 -0
- package/dist/bin/shell/chunks/chunk-PUZGSIMN.js +15 -0
- package/dist/bin/shell/chunks/chunk-Q3LE3Y66.js +13 -0
- package/dist/bin/shell/chunks/chunk-QAYU7HPM.js +7 -0
- package/dist/bin/shell/chunks/chunk-QES5OSUC.js +3 -0
- package/dist/bin/shell/chunks/chunk-QF7PPON7.js +16 -0
- package/dist/bin/shell/chunks/chunk-QK6BXSHU.js +13 -0
- package/dist/bin/shell/chunks/chunk-RYQB6GQ7.js +11 -0
- package/dist/bin/shell/chunks/chunk-SSK3N7FN.js +3 -0
- package/dist/bin/shell/chunks/chunk-TL4JI2SL.js +38 -0
- package/dist/bin/shell/chunks/chunk-TPU3OX2A.js +3 -0
- package/dist/bin/shell/chunks/chunk-TW2IJRUF.js +3 -0
- package/dist/bin/shell/chunks/chunk-TZ3S7MY6.js +12 -0
- package/dist/bin/shell/chunks/chunk-VGR3NA3H.js +13 -0
- package/dist/bin/shell/chunks/chunk-VLWZ6L7C.js +4 -0
- package/dist/bin/shell/chunks/chunk-VTAIIBJT.js +16 -0
- package/dist/bin/shell/chunks/chunk-VTHA5UK5.js +7 -0
- package/dist/bin/shell/chunks/chunk-VY2K25J4.js +16 -0
- package/dist/bin/shell/chunks/chunk-W4U4QOZF.js +7 -0
- package/dist/bin/shell/chunks/chunk-WDV2ECOC.js +3 -0
- package/dist/bin/shell/chunks/chunk-WFVCEB5T.js +3 -0
- package/dist/bin/shell/chunks/chunk-WSLBBXPJ.js +12 -0
- package/dist/bin/shell/chunks/chunk-WWOUFMMY.js +3 -0
- package/dist/bin/shell/chunks/chunk-WYTPLN2M.js +11 -0
- package/dist/bin/shell/chunks/chunk-X5VUGFUL.js +3 -0
- package/dist/bin/shell/chunks/chunk-X63MJBLH.js +26 -0
- package/dist/bin/shell/chunks/chunk-XAAXPEOP.js +6 -0
- package/dist/bin/shell/chunks/chunk-XEQ7KSRM.js +5 -0
- package/dist/bin/shell/chunks/chunk-YIANER7Y.js +8 -0
- package/dist/bin/shell/chunks/chunk-YMELOXDK.js +13 -0
- package/dist/bin/shell/chunks/chunk-YTL6DXBO.js +11 -0
- package/dist/bin/shell/chunks/chunk-YYZSYLJO.js +6 -0
- package/dist/bin/shell/chunks/chunk-ZXIW4JPL.js +22 -0
- package/dist/bin/shell/chunks/clear-OE52K3TM.js +3 -0
- package/dist/bin/shell/chunks/column-7VBJL757.js +3 -0
- package/dist/bin/shell/chunks/comm-URDMZCXL.js +3 -0
- package/dist/bin/shell/chunks/cp-MF5GADQN.js +3 -0
- package/dist/bin/shell/chunks/curl-FS5LAEYI.js +30 -0
- package/dist/bin/shell/chunks/cut-QOTYBJJJ.js +3 -0
- package/dist/bin/shell/chunks/date-FJUBX7TJ.js +3 -0
- package/dist/bin/shell/chunks/diff-YXZZCUSQ.js +3 -0
- package/dist/bin/shell/chunks/dirname-TPUFCYF6.js +3 -0
- package/dist/bin/shell/chunks/du-A3UGHIKJ.js +3 -0
- package/dist/bin/shell/chunks/echo-4OUEL7QB.js +3 -0
- package/dist/bin/shell/chunks/env-2TSVF4W7.js +3 -0
- package/dist/bin/shell/chunks/expand-P6SNTBGZ.js +3 -0
- package/dist/bin/shell/chunks/expr-56X7LYOS.js +3 -0
- package/dist/bin/shell/chunks/file-SQSOBJLR.js +3 -0
- package/dist/bin/shell/chunks/find-XY2NTAT5.js +3 -0
- package/dist/bin/shell/chunks/flag-coverage-WGSE667D.js +3 -0
- package/dist/bin/shell/chunks/fold-YEY7X54W.js +3 -0
- package/dist/bin/shell/chunks/grep-CMT2H2S7.js +3 -0
- package/dist/bin/shell/chunks/gzip-DJSFJOY6.js +3 -0
- package/dist/bin/shell/chunks/head-KPRH4HKC.js +3 -0
- package/dist/bin/shell/chunks/help-HVIDHJ6M.js +3 -0
- package/dist/bin/shell/chunks/history-3HAU45KT.js +3 -0
- package/dist/bin/shell/chunks/hostname-2I76DUQL.js +3 -0
- package/dist/bin/shell/chunks/html-to-markdown-WUBAMB4O.js +3 -0
- package/dist/bin/shell/chunks/join-UQKXU2QP.js +3 -0
- package/dist/bin/shell/chunks/jq-ACCMBTSD.js +3 -0
- package/dist/bin/shell/chunks/js-exec-4KNUPGHA.js +99 -0
- package/dist/bin/shell/chunks/ln-XSDIE6SU.js +3 -0
- package/dist/bin/shell/chunks/ls-FTHYNINH.js +3 -0
- package/dist/bin/shell/chunks/md5sum-Z6KAYGDK.js +3 -0
- package/dist/bin/shell/chunks/mkdir-74BP5NTG.js +3 -0
- package/dist/bin/shell/chunks/mv-YG75IRRE.js +3 -0
- package/dist/bin/shell/chunks/nl-XHWFVVKH.js +3 -0
- package/dist/bin/shell/chunks/od-A7CW5RMS.js +3 -0
- package/dist/bin/shell/chunks/paste-YJLYVJMP.js +3 -0
- package/dist/bin/shell/chunks/printf-F2KOCULO.js +3 -0
- package/dist/bin/shell/chunks/pwd-YKLNXWZI.js +3 -0
- package/dist/bin/shell/chunks/python3-AYUQQRCR.js +14 -0
- package/dist/bin/shell/chunks/readlink-HMHVGSAM.js +3 -0
- package/dist/bin/shell/chunks/rev-CZTQCNOZ.js +3 -0
- package/dist/bin/shell/chunks/rg-JRKJ6I4X.js +3 -0
- package/dist/bin/shell/chunks/rm-3PLW4O4B.js +3 -0
- package/dist/bin/shell/chunks/rmdir-DCJ3XJRR.js +3 -0
- package/dist/bin/shell/chunks/sed-QJ2LNV2N.js +3 -0
- package/dist/bin/shell/chunks/seq-Q4LZ6EXV.js +3 -0
- package/dist/bin/shell/chunks/sha1sum-CATBXX76.js +3 -0
- package/dist/bin/shell/chunks/sha256sum-YGSNBVY3.js +3 -0
- package/dist/bin/shell/chunks/sleep-FUDWGDCE.js +3 -0
- package/dist/bin/shell/chunks/sort-M3DO25D5.js +3 -0
- package/dist/bin/shell/chunks/split-7IYQYKOW.js +3 -0
- package/dist/bin/shell/chunks/sqlite3-ZXF6BGDW.js +3 -0
- package/dist/bin/shell/chunks/stat-Y5D3VPLG.js +3 -0
- package/dist/bin/shell/chunks/strings-J2X2Z6N2.js +3 -0
- package/dist/bin/shell/chunks/tac-DG4BMYM5.js +3 -0
- package/dist/bin/shell/chunks/tail-QISQLA3I.js +3 -0
- package/dist/bin/shell/chunks/tar-TB2XWXF6.js +3 -0
- package/dist/bin/shell/chunks/tee-L4HKV5PD.js +3 -0
- package/dist/bin/shell/chunks/time-LF7BTSK5.js +3 -0
- package/dist/bin/shell/chunks/timeout-TDOV6JDA.js +3 -0
- package/dist/bin/shell/chunks/touch-TVQAUQOG.js +3 -0
- package/dist/bin/shell/chunks/tr-AR6EK7JH.js +3 -0
- package/dist/bin/shell/chunks/tree-ZGP6NPGS.js +3 -0
- package/dist/bin/shell/chunks/true-KFTJGQLQ.js +3 -0
- package/dist/bin/shell/chunks/undici-JES22UVU.js +141 -0
- package/dist/bin/shell/chunks/unexpand-JPOQORZF.js +3 -0
- package/dist/bin/shell/chunks/uniq-K5VRDP4Q.js +3 -0
- package/dist/bin/shell/chunks/wc-VSQBRD6B.js +3 -0
- package/dist/bin/shell/chunks/which-4TPGVSBZ.js +3 -0
- package/dist/bin/shell/chunks/whoami-B5HDVKW6.js +3 -0
- package/dist/bin/shell/chunks/xan-D6US4ZGL.js +3 -0
- package/dist/bin/shell/chunks/xan-view-QGKWT354.js +3 -0
- package/dist/bin/shell/chunks/xargs-HMISWW4I.js +3 -0
- package/dist/bin/shell/chunks/yq-EYV7HLKK.js +3 -0
- package/dist/bin/shell/shell.js +413 -391
- package/dist/bounded-builder.d.ts +37 -0
- package/dist/browser.d.ts +3 -3
- package/dist/bundle/browser.js +869 -832
- package/dist/bundle/chunks/alias-T5TO5GWK.js +2 -0
- package/dist/bundle/chunks/awk2-IPNBFNH2.js +2 -0
- package/dist/bundle/chunks/base64-OXGTKKDA.js +2 -0
- package/dist/bundle/chunks/basename-SJZQ5W65.js +2 -0
- package/dist/bundle/chunks/bash-HIEWVHJ2.js +2 -0
- package/dist/bundle/chunks/cat-636HYSH4.js +2 -0
- package/dist/bundle/chunks/chmod-4CIOYX5Q.js +2 -0
- package/dist/bundle/chunks/chunk-273265WK.js +6 -0
- package/dist/bundle/chunks/chunk-2KNTH3KH.js +9 -0
- package/dist/bundle/chunks/chunk-2VWG4LDT.js +11 -0
- package/dist/bundle/chunks/chunk-3DHFIWMM.js +15 -0
- package/dist/bundle/chunks/chunk-5ATEFZLC.js +4 -0
- package/dist/bundle/chunks/chunk-5HXWWNWH.js +11 -0
- package/dist/bundle/chunks/chunk-5KGKXQF6.js +142 -0
- package/dist/bundle/chunks/chunk-5VCAQBXL.js +17 -0
- package/dist/bundle/chunks/chunk-65Z4QURM.js +12 -0
- package/dist/bundle/chunks/chunk-6D3WD6YU.js +3 -0
- package/dist/bundle/chunks/chunk-6IUGGJ2Y.js +8 -0
- package/dist/bundle/chunks/chunk-6R4OQQWP.js +16 -0
- package/dist/bundle/chunks/chunk-6WGIZV3E.js +13 -0
- package/dist/bundle/chunks/chunk-AFFAMSJT.js +14 -0
- package/dist/bundle/chunks/chunk-AH7VTVWU.js +2 -0
- package/dist/bundle/chunks/chunk-AI5LSBJC.js +2 -0
- package/dist/bundle/chunks/chunk-AMLHAS2N.js +15 -0
- package/dist/bundle/chunks/chunk-ANCQ4SCV.js +2 -0
- package/dist/bundle/chunks/chunk-B3NGH6KE.js +5 -0
- package/dist/bundle/chunks/chunk-B5Z5HTFY.js +14 -0
- package/dist/bundle/chunks/chunk-BRJERIF4.js +2 -0
- package/dist/bundle/chunks/chunk-CHHWTPDH.js +3 -0
- package/dist/bundle/chunks/chunk-CN3HTJTZ.js +11 -0
- package/dist/bundle/chunks/chunk-D3W7DTI6.js +9 -0
- package/dist/bundle/chunks/chunk-E3D4WVAH.js +21 -0
- package/dist/bundle/chunks/chunk-EAQUR2NP.js +25 -0
- package/dist/bundle/chunks/chunk-EFORKKSH.js +8 -0
- package/dist/bundle/chunks/chunk-EJFBIRMD.js +6 -0
- package/dist/bundle/chunks/chunk-ELHOZMBD.js +10 -0
- package/dist/bundle/chunks/chunk-EQQGPAXI.js +9 -0
- package/dist/bundle/chunks/chunk-EWWPEE2G.js +37 -0
- package/dist/bundle/chunks/chunk-FBXMKFE2.js +2 -0
- package/dist/bundle/chunks/chunk-FIMO5HLX.js +2 -0
- package/dist/bundle/chunks/chunk-FT6ODGOU.js +2 -0
- package/dist/bundle/chunks/chunk-G4SEENI7.js +6 -0
- package/dist/bundle/chunks/chunk-GN6CQ3J4.js +2 -0
- package/dist/bundle/chunks/chunk-HW6ZCMM5.js +9 -0
- package/dist/bundle/chunks/chunk-IBRT3OJS.js +2 -0
- package/dist/bundle/chunks/chunk-INDA53JL.js +21 -0
- package/dist/bundle/chunks/chunk-INHMNORI.js +6 -0
- package/dist/bundle/chunks/chunk-J2OBOJ64.js +2 -0
- package/dist/bundle/chunks/chunk-JCPCQREJ.js +15 -0
- package/dist/bundle/chunks/chunk-JYQ6MII2.js +33 -0
- package/dist/bundle/chunks/chunk-K3XJ2WT4.js +2 -0
- package/dist/bundle/chunks/chunk-KIGPB52X.js +2 -0
- package/dist/bundle/chunks/chunk-KKVPMNSS.js +5 -0
- package/dist/bundle/chunks/chunk-LGLR6TFP.js +7 -0
- package/dist/bundle/chunks/chunk-LJRVJXUI.js +2 -0
- package/dist/bundle/chunks/chunk-LVDUF74R.js +7 -0
- package/dist/bundle/chunks/chunk-MAWVZWRK.js +12 -0
- package/dist/bundle/chunks/chunk-MF4F4ZPP.js +7 -0
- package/dist/bundle/chunks/chunk-MFGH46GH.js +14 -0
- package/dist/bundle/chunks/chunk-N4TGZ6H7.js +7 -0
- package/dist/bundle/chunks/chunk-NCUTH6QL.js +2 -0
- package/dist/bundle/chunks/chunk-NNH4ERNJ.js +100 -0
- package/dist/bundle/chunks/chunk-NOPXHH6G.js +290 -0
- package/dist/bundle/chunks/chunk-OQ7C4FYO.js +2 -0
- package/dist/bundle/chunks/chunk-ORDZCFFT.js +2 -0
- package/dist/bundle/chunks/chunk-OTYP7VVT.js +21 -0
- package/dist/bundle/chunks/chunk-P5BOIHWV.js +6 -0
- package/dist/bundle/chunks/chunk-PJWSSENQ.js +5 -0
- package/dist/bundle/chunks/chunk-PMYUC5JF.js +12 -0
- package/dist/bundle/chunks/chunk-POIWRLUV.js +6 -0
- package/dist/bundle/chunks/chunk-PPDMRIJ7.js +11 -0
- package/dist/bundle/chunks/chunk-QTLI5LUD.js +21 -0
- package/dist/bundle/chunks/chunk-R2FBRMDU.js +14 -0
- package/dist/bundle/chunks/chunk-RAHPENCM.js +35 -0
- package/dist/bundle/chunks/chunk-SELXJ5KQ.js +10 -0
- package/dist/bundle/chunks/chunk-T2RHALUC.js +64 -0
- package/dist/bundle/chunks/chunk-UB6T3UHL.js +8 -0
- package/dist/bundle/chunks/chunk-UBTKJ6MG.js +4 -0
- package/dist/bundle/chunks/chunk-UHHCL65P.js +3 -0
- package/dist/bundle/chunks/chunk-UK4BO5W3.js +2 -0
- package/dist/bundle/chunks/chunk-UTKGYVUZ.js +7 -0
- package/dist/bundle/chunks/chunk-VECGTAPW.js +10 -0
- package/dist/bundle/chunks/chunk-VOSNSQE2.js +2 -0
- package/dist/bundle/chunks/chunk-WENIVVEE.js +19 -0
- package/dist/bundle/chunks/chunk-WHHRIZS3.js +10 -0
- package/dist/bundle/chunks/chunk-WZQNMEQW.js +2 -0
- package/dist/bundle/chunks/chunk-XVL654YD.js +33 -0
- package/dist/bundle/chunks/chunk-Y3DGIAIG.js +21 -0
- package/dist/bundle/chunks/chunk-Y62SXZKJ.js +12 -0
- package/dist/bundle/chunks/chunk-YOUUMJLJ.js +10 -0
- package/dist/bundle/chunks/chunk-YUSFCOM7.js +2 -0
- package/dist/bundle/chunks/clear-KPIUNI6K.js +2 -0
- package/dist/bundle/chunks/column-LKMDIDCH.js +2 -0
- package/dist/bundle/chunks/comm-DTWKU2MC.js +2 -0
- package/dist/bundle/chunks/cp-FKTQRFYJ.js +2 -0
- package/dist/bundle/chunks/curl-DEHFBW27.js +29 -0
- package/dist/bundle/chunks/cut-RWPUW5FY.js +2 -0
- package/dist/bundle/chunks/date-FN2DXAEE.js +2 -0
- package/dist/bundle/chunks/diff-CSARC7WF.js +2 -0
- package/dist/bundle/chunks/dirname-Z2ZMOOW2.js +2 -0
- package/dist/bundle/chunks/du-PR3M44X6.js +2 -0
- package/dist/bundle/chunks/echo-HZOVZAPR.js +2 -0
- package/dist/bundle/chunks/env-VUUMB47B.js +2 -0
- package/dist/bundle/chunks/expand-2BPPGGSM.js +2 -0
- package/dist/bundle/chunks/expr-SHRJJ4PX.js +2 -0
- package/dist/bundle/chunks/file-YC4YEI4P.js +2 -0
- package/dist/bundle/chunks/find-DWWMZFO5.js +2 -0
- package/dist/bundle/chunks/flag-coverage-THYQHOT3.js +2 -0
- package/dist/bundle/chunks/fold-QJBPHRFJ.js +2 -0
- package/dist/bundle/chunks/grep-S6SNTIHZ.js +2 -0
- package/dist/bundle/chunks/gzip-BTI6CWY4.js +2 -0
- package/dist/bundle/chunks/head-UCOA3VQC.js +2 -0
- package/dist/bundle/chunks/help-QDDMBDU7.js +2 -0
- package/dist/bundle/chunks/history-3N762S3K.js +2 -0
- package/dist/bundle/chunks/hostname-CESD3CQR.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-NUF6QEX4.js +2 -0
- package/dist/bundle/chunks/join-KQ4Z5OD4.js +2 -0
- package/dist/bundle/chunks/jq-D6N4QCAJ.js +2 -0
- package/dist/bundle/chunks/js-exec-PNUEDFT5.js +98 -0
- package/dist/bundle/chunks/js-exec-worker.js +187 -110
- package/dist/bundle/chunks/ln-VYDFOFNO.js +2 -0
- package/dist/bundle/chunks/ls-R5CQLZQM.js +2 -0
- package/dist/bundle/chunks/md5sum-JEDX55KS.js +2 -0
- package/dist/bundle/chunks/mkdir-WDDKK2P3.js +2 -0
- package/dist/bundle/chunks/mv-XSJA2FNL.js +2 -0
- package/dist/bundle/chunks/nl-RFXH2GNX.js +2 -0
- package/dist/bundle/chunks/od-YXD2NNIU.js +2 -0
- package/dist/bundle/chunks/paste-ZU3EODNI.js +2 -0
- package/dist/bundle/chunks/printf-QHD2JRWQ.js +2 -0
- package/dist/bundle/chunks/pwd-76BPYV5F.js +2 -0
- package/dist/bundle/chunks/python3-QDNG2UXX.js +13 -0
- package/dist/bundle/chunks/readlink-IY6QKK2P.js +2 -0
- package/dist/bundle/chunks/rev-EPOS3MFH.js +2 -0
- package/dist/bundle/chunks/rg-OUJZ5DH6.js +2 -0
- package/dist/bundle/chunks/rm-JQ4GDKDD.js +2 -0
- package/dist/bundle/chunks/rmdir-WZKAT6M5.js +2 -0
- package/dist/bundle/chunks/sed-TZIPJOGL.js +2 -0
- package/dist/bundle/chunks/seq-5R2GKXC6.js +2 -0
- package/dist/bundle/chunks/sha1sum-BLPZJ6MP.js +2 -0
- package/dist/bundle/chunks/sha256sum-VJZ4PHQ4.js +2 -0
- package/dist/bundle/chunks/sleep-VPYWSKDR.js +2 -0
- package/dist/bundle/chunks/sort-PV2NEQHF.js +2 -0
- package/dist/bundle/chunks/split-KNDNAFPT.js +2 -0
- package/dist/bundle/chunks/sqlite3-WWZJZW37.js +2 -0
- package/dist/bundle/chunks/sqlite3-worker.js +316 -173
- package/dist/bundle/chunks/stat-MLNSW25G.js +2 -0
- package/dist/bundle/chunks/strings-WTD7Q2EF.js +2 -0
- package/dist/bundle/chunks/tac-YXC4HBTR.js +2 -0
- package/dist/bundle/chunks/tail-G3W6PNG3.js +2 -0
- package/dist/bundle/chunks/tar-GLX6QUHW.js +2 -0
- package/dist/bundle/chunks/tee-OOWSWHRQ.js +2 -0
- package/dist/bundle/chunks/time-NERE2JJ2.js +2 -0
- package/dist/bundle/chunks/timeout-SYQCWBMZ.js +2 -0
- package/dist/bundle/chunks/touch-W4DF6Z4T.js +2 -0
- package/dist/bundle/chunks/tr-3KPFH3J4.js +2 -0
- package/dist/bundle/chunks/tree-7OOL2MH6.js +2 -0
- package/dist/bundle/chunks/true-QUBPEGGU.js +2 -0
- package/dist/bundle/chunks/undici-HCLAUJT3.js +140 -0
- package/dist/bundle/chunks/unexpand-YD5BWFH4.js +2 -0
- package/dist/bundle/chunks/uniq-OVOW532K.js +2 -0
- package/dist/bundle/chunks/wc-RUR7HE5O.js +2 -0
- package/dist/bundle/chunks/which-UWVKETYW.js +2 -0
- package/dist/bundle/chunks/whoami-KR6E7UIR.js +2 -0
- package/dist/bundle/chunks/worker.js +212 -105
- package/dist/bundle/chunks/xan-KKPV2TJ3.js +2 -0
- package/dist/bundle/chunks/xan-view-47P277LZ.js +2 -0
- package/dist/bundle/chunks/xargs-L7TJHOJT.js +2 -0
- package/dist/bundle/chunks/yq-ZGB3W46S.js +2 -0
- package/dist/bundle/index.cjs +1450 -1263
- package/dist/bundle/index.js +407 -386
- package/dist/commands/alias/alias.d.ts +3 -3
- package/dist/commands/awk/awk2.d.ts +3 -3
- package/dist/commands/awk/builtins.d.ts +1 -1
- package/dist/commands/awk/interpreter/context.d.ts +13 -0
- package/dist/commands/awk/lexer.d.ts +2 -1
- package/dist/commands/awk/parser2-print.d.ts +3 -0
- package/dist/commands/awk/parser2.d.ts +15 -0
- package/dist/commands/base64/base64.d.ts +2 -2
- package/dist/commands/basename/basename.d.ts +2 -2
- package/dist/commands/bash/bash.d.ts +3 -3
- package/dist/commands/cat/cat.d.ts +2 -2
- package/dist/commands/chmod/chmod.d.ts +2 -2
- package/dist/commands/clear/clear.d.ts +2 -2
- package/dist/commands/column/column.d.ts +2 -2
- package/dist/commands/comm/comm.d.ts +2 -2
- package/dist/commands/compression/codec-budget.d.ts +35 -0
- package/dist/commands/cp/cp.d.ts +2 -2
- package/dist/commands/curl/curl.d.ts +2 -2
- package/dist/commands/curl/form.d.ts +3 -1
- package/dist/commands/curl/types.d.ts +30 -25
- package/dist/commands/cut/cut.d.ts +2 -2
- package/dist/commands/date/date.d.ts +2 -2
- package/dist/commands/diff/diff.d.ts +2 -2
- package/dist/commands/dirname/dirname.d.ts +2 -2
- package/dist/commands/du/du.d.ts +2 -2
- package/dist/commands/echo/echo.d.ts +2 -2
- package/dist/commands/env/env.d.ts +3 -3
- package/dist/commands/expand/expand.d.ts +2 -2
- package/dist/commands/expand/unexpand.d.ts +2 -2
- package/dist/commands/expr/expr.d.ts +2 -2
- package/dist/commands/file/file.d.ts +2 -2
- package/dist/commands/find/find.d.ts +2 -2
- package/dist/commands/find/matcher.d.ts +0 -16
- package/dist/commands/find/types.d.ts +3 -2
- package/dist/commands/fold/fold.d.ts +2 -2
- package/dist/commands/grep/grep.d.ts +4 -4
- package/dist/commands/gzip/gzip.d.ts +4 -4
- package/dist/commands/head/head-tail-shared.d.ts +2 -2
- package/dist/commands/head/head.d.ts +2 -2
- package/dist/commands/help/help.d.ts +2 -2
- package/dist/commands/history/history.d.ts +2 -2
- package/dist/commands/hostname/hostname.d.ts +2 -2
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +2 -2
- package/dist/commands/join/join.d.ts +2 -2
- package/dist/commands/jq/jq.d.ts +3 -3
- package/dist/commands/js-exec/fetch-polyfill.d.ts +1 -1
- package/dist/commands/js-exec/js-exec-worker.d.ts +1 -0
- package/dist/commands/js-exec/js-exec.d.ts +5 -3
- package/dist/commands/ln/ln.d.ts +2 -2
- package/dist/commands/ls/ls.d.ts +2 -2
- package/dist/commands/md5sum/checksum.d.ts +2 -2
- package/dist/commands/md5sum/md5sum.d.ts +2 -2
- package/dist/commands/md5sum/sha1sum.d.ts +2 -2
- package/dist/commands/md5sum/sha256sum.d.ts +2 -2
- package/dist/commands/mkdir/mkdir.d.ts +2 -2
- package/dist/commands/mv/mv.d.ts +2 -2
- package/dist/commands/nl/nl.d.ts +2 -2
- package/dist/commands/od/od.d.ts +2 -2
- package/dist/commands/paste/paste.d.ts +2 -2
- package/dist/commands/printf/escapes.d.ts +5 -3
- package/dist/commands/printf/printf.d.ts +2 -2
- package/dist/commands/printf/strftime.d.ts +6 -1
- package/dist/commands/pwd/pwd.d.ts +2 -2
- package/dist/commands/python3/python3.d.ts +3 -3
- package/dist/commands/python3/worker.d.ts +2 -0
- package/dist/commands/query-engine/builtins/control-builtins.d.ts +1 -1
- package/dist/commands/query-engine/builtins/path-builtins.d.ts +1 -1
- package/dist/commands/query-engine/evaluator.d.ts +15 -1
- package/dist/commands/query-engine/json-output.d.ts +11 -0
- package/dist/commands/query-engine/parser.d.ts +6 -1
- package/dist/commands/query-engine/safe-object.d.ts +9 -8
- package/dist/commands/query-engine/value-operations.d.ts +4 -1
- package/dist/commands/readlink/readlink.d.ts +2 -2
- package/dist/commands/registry.d.ts +5 -5
- package/dist/commands/rev/rev.d.ts +2 -2
- package/dist/commands/rg/rg-search.d.ts +2 -2
- package/dist/commands/rg/rg.d.ts +2 -2
- package/dist/commands/rm/rm.d.ts +2 -2
- package/dist/commands/rmdir/rmdir.d.ts +2 -2
- package/dist/commands/search-engine/matcher.d.ts +6 -0
- package/dist/commands/sed/lexer.d.ts +3 -1
- package/dist/commands/sed/parser.d.ts +4 -1
- package/dist/commands/sed/sed.d.ts +2 -2
- package/dist/commands/seq/seq.d.ts +2 -2
- package/dist/commands/sleep/sleep.d.ts +2 -2
- package/dist/commands/sort/sort.d.ts +2 -2
- package/dist/commands/split/split.d.ts +2 -2
- package/dist/commands/sqlite3/formatters.d.ts +2 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +3 -2
- package/dist/commands/sqlite3/worker.d.ts +5 -0
- package/dist/commands/sqlite3/worker.js +316 -173
- package/dist/commands/stat/stat.d.ts +2 -2
- package/dist/commands/strings/strings.d.ts +2 -2
- package/dist/commands/tac/tac.d.ts +2 -2
- package/dist/commands/tail/tail.d.ts +2 -2
- package/dist/commands/tar/archive.d.ts +29 -14
- package/dist/commands/tar/bzip2-compress.d.ts +2 -1
- package/dist/commands/tar/tar.d.ts +2 -2
- package/dist/commands/tee/tee.d.ts +2 -2
- package/dist/commands/time/time.d.ts +2 -2
- package/dist/commands/timeout/timeout.d.ts +2 -2
- package/dist/commands/touch/touch.d.ts +2 -2
- package/dist/commands/tr/tr.d.ts +2 -2
- package/dist/commands/tree/tree.d.ts +2 -2
- package/dist/commands/true/true.d.ts +3 -3
- package/dist/commands/uniq/uniq.d.ts +2 -2
- package/dist/commands/wc/wc.d.ts +2 -2
- package/dist/commands/which/which.d.ts +2 -2
- package/dist/commands/whoami/whoami.d.ts +2 -2
- package/dist/commands/worker-request-controller.d.ts +36 -0
- package/dist/commands/xan/aggregation.d.ts +13 -3
- package/dist/commands/xan/bounded-output.d.ts +4 -0
- package/dist/commands/xan/column-selection.d.ts +2 -1
- package/dist/commands/xan/csv.d.ts +29 -4
- package/dist/commands/xan/moonblade-parser.d.ts +11 -2
- package/dist/commands/xan/moonblade-to-jq.d.ts +2 -2
- package/dist/commands/xan/moonblade-tokenizer.d.ts +8 -1
- package/dist/commands/xan/xan-agg.d.ts +5 -5
- package/dist/commands/xan/xan-columns.d.ts +5 -5
- package/dist/commands/xan/xan-core.d.ts +7 -7
- package/dist/commands/xan/xan-data.d.ts +8 -8
- package/dist/commands/xan/xan-filter.d.ts +5 -5
- package/dist/commands/xan/xan-map.d.ts +3 -3
- package/dist/commands/xan/xan-reshape.d.ts +6 -6
- package/dist/commands/xan/xan-simple.d.ts +7 -7
- package/dist/commands/xan/xan-view.d.ts +3 -3
- package/dist/commands/xan/xan.d.ts +2 -2
- package/dist/commands/xargs/xargs.d.ts +2 -2
- package/dist/commands/yq/formats.d.ts +5 -4
- package/dist/commands/yq/yq.d.ts +3 -3
- package/dist/custom-commands.d.ts +25 -2
- package/dist/encoding.d.ts +5 -3
- package/dist/execution-output.d.ts +28 -0
- package/dist/execution-scope.d.ts +89 -0
- package/dist/fatal-execution-error.d.ts +5 -0
- package/dist/fs/identity.d.ts +9 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +24 -1
- package/dist/fs/interface.d.ts +4 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +13 -0
- package/dist/fs/path-utils.d.ts +2 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +11 -0
- package/dist/fs/real-fs-utils.d.ts +1 -1
- package/dist/fs/traversal.d.ts +98 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/interpreter/alias-expansion.d.ts +4 -0
- package/dist/interpreter/builtins/declare-array-parsing.d.ts +6 -2
- package/dist/interpreter/builtins/index.d.ts +0 -1
- package/dist/interpreter/builtins/variable-assignment.d.ts +4 -1
- package/dist/interpreter/conditionals.d.ts +1 -1
- package/dist/interpreter/defense-aware-command-context.d.ts +2 -2
- package/dist/interpreter/errors.d.ts +7 -17
- package/dist/interpreter/expansion/brace-range.d.ts +5 -1
- package/dist/interpreter/expansion/pattern-removal.d.ts +2 -3
- package/dist/interpreter/expansion/pattern-replacement.d.ts +4 -0
- package/dist/interpreter/expansion/tilde.d.ts +2 -0
- package/dist/interpreter/helpers/array.d.ts +16 -3
- package/dist/interpreter/helpers/bounded-array.d.ts +2 -0
- package/dist/interpreter/helpers/condition.d.ts +2 -5
- package/dist/interpreter/helpers/ifs.d.ts +3 -3
- package/dist/interpreter/helpers/quoting.d.ts +2 -0
- package/dist/interpreter/helpers/string-compare.d.ts +1 -1
- package/dist/interpreter/interpreter.d.ts +4 -8
- package/dist/interpreter/redirections.d.ts +5 -2
- package/dist/interpreter/simple-command-assignments.d.ts +7 -0
- package/dist/interpreter/state-transaction.d.ts +7 -0
- package/dist/interpreter/types.d.ts +24 -8
- package/dist/limits.d.ts +76 -17
- package/dist/network/dns-pin.d.ts +23 -32
- package/dist/network/fetch.d.ts +4 -0
- package/dist/network/types.d.ts +10 -1
- package/dist/parser/parser.d.ts +5 -2
- package/dist/parser/types.d.ts +10 -1
- package/dist/source-limit.d.ts +2 -0
- package/dist/timers.d.ts +12 -0
- package/dist/types.d.ts +43 -7
- package/dist/utils/file-reader.d.ts +5 -3
- package/package.json +10 -5
- package/dist/bin/chunks/alias-YRVAW27Y.js +0 -3
- package/dist/bin/chunks/awk2-UFCNQFCV.js +0 -3
- package/dist/bin/chunks/base64-EGKVQIBC.js +0 -3
- package/dist/bin/chunks/basename-F3AQ4KAQ.js +0 -3
- package/dist/bin/chunks/bash-BEG4JB7K.js +0 -3
- package/dist/bin/chunks/cat-NBL6MU5H.js +0 -3
- package/dist/bin/chunks/chmod-S564JCJW.js +0 -3
- package/dist/bin/chunks/chunk-2AIXTPH2.js +0 -9
- package/dist/bin/chunks/chunk-2GG3NVC4.js +0 -10
- package/dist/bin/chunks/chunk-2ZAK22BG.js +0 -9
- package/dist/bin/chunks/chunk-3WIMLJM7.js +0 -8
- package/dist/bin/chunks/chunk-47WZ2U6M.js +0 -9
- package/dist/bin/chunks/chunk-4BNS566Q.js +0 -4
- package/dist/bin/chunks/chunk-52FZYTIX.js +0 -34
- package/dist/bin/chunks/chunk-5KX5YUWT.js +0 -37
- package/dist/bin/chunks/chunk-5XSZHUEI.js +0 -15
- package/dist/bin/chunks/chunk-63LSI3D6.js +0 -17
- package/dist/bin/chunks/chunk-6FYCU7QB.js +0 -3
- package/dist/bin/chunks/chunk-6JKLDBRW.js +0 -18
- package/dist/bin/chunks/chunk-6WJQNLR2.js +0 -7
- package/dist/bin/chunks/chunk-7HK63L6Y.js +0 -3
- package/dist/bin/chunks/chunk-7NDRU2ZN.js +0 -5
- package/dist/bin/chunks/chunk-7VCQWCSH.js +0 -15
- package/dist/bin/chunks/chunk-AFAD5U2A.js +0 -8
- package/dist/bin/chunks/chunk-AZH64XMJ.js +0 -3
- package/dist/bin/chunks/chunk-BKQLXMS6.js +0 -36
- package/dist/bin/chunks/chunk-BPZJYOUA.js +0 -33
- package/dist/bin/chunks/chunk-BZP56QBM.js +0 -24
- package/dist/bin/chunks/chunk-C6JOQKE2.js +0 -22
- package/dist/bin/chunks/chunk-CX5CEEGI.js +0 -11
- package/dist/bin/chunks/chunk-D7YFPDMV.js +0 -22
- package/dist/bin/chunks/chunk-DHIKZU63.js +0 -3
- package/dist/bin/chunks/chunk-DWECIBLJ.js +0 -3
- package/dist/bin/chunks/chunk-FEENTUVZ.js +0 -18
- package/dist/bin/chunks/chunk-FYCT4DWY.js +0 -6
- package/dist/bin/chunks/chunk-G7ZWT7BT.js +0 -9
- package/dist/bin/chunks/chunk-GTO74SFS.js +0 -7
- package/dist/bin/chunks/chunk-HMCRB24D.js +0 -15
- package/dist/bin/chunks/chunk-HWNCK5BB.js +0 -10
- package/dist/bin/chunks/chunk-HZR3FOJM.js +0 -288
- package/dist/bin/chunks/chunk-ISLENKSH.js +0 -7
- package/dist/bin/chunks/chunk-IX7LKVVH.js +0 -15
- package/dist/bin/chunks/chunk-JDFKEXLG.js +0 -12
- package/dist/bin/chunks/chunk-JJC4ENJL.js +0 -13
- package/dist/bin/chunks/chunk-JSZBZ2XU.js +0 -3
- package/dist/bin/chunks/chunk-JXLDT4KX.js +0 -4
- package/dist/bin/chunks/chunk-KMZUSEWI.js +0 -12
- package/dist/bin/chunks/chunk-KWCO3YXP.js +0 -17
- package/dist/bin/chunks/chunk-LNVSXNT7.js +0 -3
- package/dist/bin/chunks/chunk-LX2H4DPL.js +0 -6
- package/dist/bin/chunks/chunk-MLUOPG3W.js +0 -3
- package/dist/bin/chunks/chunk-MNWK4UIM.js +0 -22
- package/dist/bin/chunks/chunk-MP77TJMM.js +0 -6
- package/dist/bin/chunks/chunk-MTK7VLZG.js +0 -12
- package/dist/bin/chunks/chunk-N3FQJLPZ.js +0 -17
- package/dist/bin/chunks/chunk-N6YW4W3Z.js +0 -29
- package/dist/bin/chunks/chunk-NMMVECGD.js +0 -14
- package/dist/bin/chunks/chunk-NXYVRP6D.js +0 -11
- package/dist/bin/chunks/chunk-NYIPFY36.js +0 -3
- package/dist/bin/chunks/chunk-OVVMB2JI.js +0 -7
- package/dist/bin/chunks/chunk-OXZSG3ZZ.js +0 -7
- package/dist/bin/chunks/chunk-PKE7GKU5.js +0 -3
- package/dist/bin/chunks/chunk-PSJORJRS.js +0 -6
- package/dist/bin/chunks/chunk-R36DS2UF.js +0 -20
- package/dist/bin/chunks/chunk-RKBWTGBZ.js +0 -7
- package/dist/bin/chunks/chunk-RO3XCUVQ.js +0 -141
- package/dist/bin/chunks/chunk-RVGYO2OU.js +0 -3
- package/dist/bin/chunks/chunk-SF2OLINE.js +0 -12
- package/dist/bin/chunks/chunk-TIRU5FOD.js +0 -101
- package/dist/bin/chunks/chunk-TKYWUEON.js +0 -13
- package/dist/bin/chunks/chunk-UI7CV277.js +0 -20
- package/dist/bin/chunks/chunk-UNWZQG7U.js +0 -3
- package/dist/bin/chunks/chunk-UOMNSQEZ.js +0 -10
- package/dist/bin/chunks/chunk-W5OBQVJ2.js +0 -6
- package/dist/bin/chunks/chunk-WDWNEHHE.js +0 -9
- package/dist/bin/chunks/chunk-WHUKZ3K3.js +0 -85
- package/dist/bin/chunks/chunk-XHCCSVP6.js +0 -9
- package/dist/bin/chunks/chunk-XPTYN6UE.js +0 -8
- package/dist/bin/chunks/chunk-XRUDFQG5.js +0 -7
- package/dist/bin/chunks/chunk-Y2IUEWQD.js +0 -11
- package/dist/bin/chunks/chunk-Y5OWCEDV.js +0 -64
- package/dist/bin/chunks/chunk-ZFUVUYWG.js +0 -15
- package/dist/bin/chunks/chunk-ZZP3RSWL.js +0 -4
- package/dist/bin/chunks/clear-FGNEKYDU.js +0 -3
- package/dist/bin/chunks/column-QLGOK3XM.js +0 -3
- package/dist/bin/chunks/comm-PLYUTVP3.js +0 -3
- package/dist/bin/chunks/cp-HYXTMN3D.js +0 -3
- package/dist/bin/chunks/curl-DCSPNPEW.js +0 -27
- package/dist/bin/chunks/cut-JNQTCQY7.js +0 -3
- package/dist/bin/chunks/date-OFYBOAUE.js +0 -3
- package/dist/bin/chunks/diff-LZ4WRLIF.js +0 -3
- package/dist/bin/chunks/dirname-VCINTLPD.js +0 -3
- package/dist/bin/chunks/du-4LRQIGRG.js +0 -3
- package/dist/bin/chunks/echo-KCOHTNDF.js +0 -3
- package/dist/bin/chunks/env-FNVYNLGB.js +0 -3
- package/dist/bin/chunks/expand-CB7FG7LQ.js +0 -3
- package/dist/bin/chunks/expr-6A2XZORA.js +0 -3
- package/dist/bin/chunks/file-GRZLWDVH.js +0 -3
- package/dist/bin/chunks/find-5OZWMYCV.js +0 -3
- package/dist/bin/chunks/flag-coverage-CAST5CDE.js +0 -3
- package/dist/bin/chunks/fold-7YEITA5L.js +0 -3
- package/dist/bin/chunks/grep-KKBXRB73.js +0 -3
- package/dist/bin/chunks/gzip-ZJP5VIAQ.js +0 -3
- package/dist/bin/chunks/head-B6GFQHKF.js +0 -3
- package/dist/bin/chunks/help-CGUEOGXQ.js +0 -3
- package/dist/bin/chunks/history-AQQWW3QB.js +0 -3
- package/dist/bin/chunks/hostname-USNWOQCK.js +0 -3
- package/dist/bin/chunks/html-to-markdown-3HJ7L7NL.js +0 -3
- package/dist/bin/chunks/join-WRM6S6CO.js +0 -3
- package/dist/bin/chunks/jq-3V5HDGLJ.js +0 -3
- package/dist/bin/chunks/js-exec-F7JAZ4ZQ.js +0 -98
- package/dist/bin/chunks/ln-LP4HMCSM.js +0 -3
- package/dist/bin/chunks/ls-KBNHNZWQ.js +0 -3
- package/dist/bin/chunks/md5sum-ZNYCDRQL.js +0 -3
- package/dist/bin/chunks/mkdir-P4DKRCDX.js +0 -3
- package/dist/bin/chunks/mv-QQK4FQX6.js +0 -3
- package/dist/bin/chunks/nl-6TVYE4ZB.js +0 -3
- package/dist/bin/chunks/od-Y3E3QXOL.js +0 -3
- package/dist/bin/chunks/paste-LYNFXXCM.js +0 -3
- package/dist/bin/chunks/printf-MR3FXCDE.js +0 -3
- package/dist/bin/chunks/pwd-FCNDA467.js +0 -3
- package/dist/bin/chunks/python3-R5OFWJIH.js +0 -13
- package/dist/bin/chunks/readlink-25V57VOL.js +0 -3
- package/dist/bin/chunks/rev-AJECDD4L.js +0 -3
- package/dist/bin/chunks/rg-DZKA632H.js +0 -3
- package/dist/bin/chunks/rm-ECNUFR66.js +0 -3
- package/dist/bin/chunks/rmdir-DLOHIA7Q.js +0 -3
- package/dist/bin/chunks/sed-IGRH7EGG.js +0 -3
- package/dist/bin/chunks/seq-UXDJE6FB.js +0 -3
- package/dist/bin/chunks/sha1sum-5QZSNFY3.js +0 -3
- package/dist/bin/chunks/sha256sum-DI7JAVAU.js +0 -3
- package/dist/bin/chunks/sleep-RPGCUUGX.js +0 -3
- package/dist/bin/chunks/sort-HQPAFL76.js +0 -3
- package/dist/bin/chunks/split-F6FSB5KI.js +0 -3
- package/dist/bin/chunks/sqlite3-7TRACAE7.js +0 -3
- package/dist/bin/chunks/stat-BD6KT3BP.js +0 -3
- package/dist/bin/chunks/strings-6PE3YMPO.js +0 -3
- package/dist/bin/chunks/tac-NERJXVOM.js +0 -3
- package/dist/bin/chunks/tail-24F643A4.js +0 -3
- package/dist/bin/chunks/tar-5HK3VMV2.js +0 -3
- package/dist/bin/chunks/tee-5B7P2QRJ.js +0 -3
- package/dist/bin/chunks/time-FN6VJGRS.js +0 -3
- package/dist/bin/chunks/timeout-ZARIAF3K.js +0 -3
- package/dist/bin/chunks/touch-DFGSVIX7.js +0 -3
- package/dist/bin/chunks/tr-QQZYZ3CH.js +0 -3
- package/dist/bin/chunks/tree-6D7SMPUR.js +0 -3
- package/dist/bin/chunks/true-SKL4L7JP.js +0 -3
- package/dist/bin/chunks/unexpand-3JWOSSBQ.js +0 -3
- package/dist/bin/chunks/uniq-Q5UH5NL3.js +0 -3
- package/dist/bin/chunks/wc-4HXNTHY3.js +0 -3
- package/dist/bin/chunks/which-LCXKCLFC.js +0 -3
- package/dist/bin/chunks/whoami-TZDZDU7T.js +0 -3
- package/dist/bin/chunks/xan-TCTFON2Q.js +0 -3
- package/dist/bin/chunks/xan-view-XBMA362V.js +0 -3
- package/dist/bin/chunks/xargs-VTFN762K.js +0 -3
- package/dist/bin/chunks/yq-OB6PB5GY.js +0 -3
- package/dist/bin/shell/chunks/alias-YRVAW27Y.js +0 -3
- package/dist/bin/shell/chunks/awk2-UFCNQFCV.js +0 -3
- package/dist/bin/shell/chunks/base64-EGKVQIBC.js +0 -3
- package/dist/bin/shell/chunks/basename-F3AQ4KAQ.js +0 -3
- package/dist/bin/shell/chunks/bash-BEG4JB7K.js +0 -3
- package/dist/bin/shell/chunks/cat-NBL6MU5H.js +0 -3
- package/dist/bin/shell/chunks/chmod-S564JCJW.js +0 -3
- package/dist/bin/shell/chunks/chunk-2AIXTPH2.js +0 -9
- package/dist/bin/shell/chunks/chunk-2GG3NVC4.js +0 -10
- package/dist/bin/shell/chunks/chunk-2ZAK22BG.js +0 -9
- package/dist/bin/shell/chunks/chunk-3WIMLJM7.js +0 -8
- package/dist/bin/shell/chunks/chunk-47WZ2U6M.js +0 -9
- package/dist/bin/shell/chunks/chunk-4BNS566Q.js +0 -4
- package/dist/bin/shell/chunks/chunk-52FZYTIX.js +0 -34
- package/dist/bin/shell/chunks/chunk-5KX5YUWT.js +0 -37
- package/dist/bin/shell/chunks/chunk-5XSZHUEI.js +0 -15
- package/dist/bin/shell/chunks/chunk-63LSI3D6.js +0 -17
- package/dist/bin/shell/chunks/chunk-6FYCU7QB.js +0 -3
- package/dist/bin/shell/chunks/chunk-6JKLDBRW.js +0 -18
- package/dist/bin/shell/chunks/chunk-6WJQNLR2.js +0 -7
- package/dist/bin/shell/chunks/chunk-7HK63L6Y.js +0 -3
- package/dist/bin/shell/chunks/chunk-7NDRU2ZN.js +0 -5
- package/dist/bin/shell/chunks/chunk-7VCQWCSH.js +0 -15
- package/dist/bin/shell/chunks/chunk-AFAD5U2A.js +0 -8
- package/dist/bin/shell/chunks/chunk-AZH64XMJ.js +0 -3
- package/dist/bin/shell/chunks/chunk-BKQLXMS6.js +0 -36
- package/dist/bin/shell/chunks/chunk-BPZJYOUA.js +0 -33
- package/dist/bin/shell/chunks/chunk-BZP56QBM.js +0 -24
- package/dist/bin/shell/chunks/chunk-C6JOQKE2.js +0 -22
- package/dist/bin/shell/chunks/chunk-CX5CEEGI.js +0 -11
- package/dist/bin/shell/chunks/chunk-D7YFPDMV.js +0 -22
- package/dist/bin/shell/chunks/chunk-DHIKZU63.js +0 -3
- package/dist/bin/shell/chunks/chunk-DWECIBLJ.js +0 -3
- package/dist/bin/shell/chunks/chunk-FEENTUVZ.js +0 -18
- package/dist/bin/shell/chunks/chunk-FYCT4DWY.js +0 -6
- package/dist/bin/shell/chunks/chunk-G7ZWT7BT.js +0 -9
- package/dist/bin/shell/chunks/chunk-GTO74SFS.js +0 -7
- package/dist/bin/shell/chunks/chunk-HMCRB24D.js +0 -15
- package/dist/bin/shell/chunks/chunk-HWNCK5BB.js +0 -10
- package/dist/bin/shell/chunks/chunk-HZR3FOJM.js +0 -288
- package/dist/bin/shell/chunks/chunk-ISLENKSH.js +0 -7
- package/dist/bin/shell/chunks/chunk-IX7LKVVH.js +0 -15
- package/dist/bin/shell/chunks/chunk-JDFKEXLG.js +0 -12
- package/dist/bin/shell/chunks/chunk-JJC4ENJL.js +0 -13
- package/dist/bin/shell/chunks/chunk-JSZBZ2XU.js +0 -3
- package/dist/bin/shell/chunks/chunk-JXLDT4KX.js +0 -4
- package/dist/bin/shell/chunks/chunk-KMZUSEWI.js +0 -12
- package/dist/bin/shell/chunks/chunk-KWCO3YXP.js +0 -17
- package/dist/bin/shell/chunks/chunk-LNVSXNT7.js +0 -3
- package/dist/bin/shell/chunks/chunk-LX2H4DPL.js +0 -6
- package/dist/bin/shell/chunks/chunk-MLUOPG3W.js +0 -3
- package/dist/bin/shell/chunks/chunk-MNWK4UIM.js +0 -22
- package/dist/bin/shell/chunks/chunk-MP77TJMM.js +0 -6
- package/dist/bin/shell/chunks/chunk-MTK7VLZG.js +0 -12
- package/dist/bin/shell/chunks/chunk-N3FQJLPZ.js +0 -17
- package/dist/bin/shell/chunks/chunk-N6YW4W3Z.js +0 -29
- package/dist/bin/shell/chunks/chunk-NMMVECGD.js +0 -14
- package/dist/bin/shell/chunks/chunk-NXYVRP6D.js +0 -11
- package/dist/bin/shell/chunks/chunk-NYIPFY36.js +0 -3
- package/dist/bin/shell/chunks/chunk-OVVMB2JI.js +0 -7
- package/dist/bin/shell/chunks/chunk-OXZSG3ZZ.js +0 -7
- package/dist/bin/shell/chunks/chunk-PKE7GKU5.js +0 -3
- package/dist/bin/shell/chunks/chunk-PSJORJRS.js +0 -6
- package/dist/bin/shell/chunks/chunk-R36DS2UF.js +0 -20
- package/dist/bin/shell/chunks/chunk-RKBWTGBZ.js +0 -7
- package/dist/bin/shell/chunks/chunk-RO3XCUVQ.js +0 -141
- package/dist/bin/shell/chunks/chunk-RVGYO2OU.js +0 -3
- package/dist/bin/shell/chunks/chunk-SF2OLINE.js +0 -12
- package/dist/bin/shell/chunks/chunk-TIRU5FOD.js +0 -101
- package/dist/bin/shell/chunks/chunk-TKYWUEON.js +0 -13
- package/dist/bin/shell/chunks/chunk-UI7CV277.js +0 -20
- package/dist/bin/shell/chunks/chunk-UNWZQG7U.js +0 -3
- package/dist/bin/shell/chunks/chunk-UOMNSQEZ.js +0 -10
- package/dist/bin/shell/chunks/chunk-W5OBQVJ2.js +0 -6
- package/dist/bin/shell/chunks/chunk-WDWNEHHE.js +0 -9
- package/dist/bin/shell/chunks/chunk-WHUKZ3K3.js +0 -85
- package/dist/bin/shell/chunks/chunk-XHCCSVP6.js +0 -9
- package/dist/bin/shell/chunks/chunk-XPTYN6UE.js +0 -8
- package/dist/bin/shell/chunks/chunk-XRUDFQG5.js +0 -7
- package/dist/bin/shell/chunks/chunk-Y2IUEWQD.js +0 -11
- package/dist/bin/shell/chunks/chunk-Y5OWCEDV.js +0 -64
- package/dist/bin/shell/chunks/chunk-ZFUVUYWG.js +0 -15
- package/dist/bin/shell/chunks/chunk-ZZP3RSWL.js +0 -4
- package/dist/bin/shell/chunks/clear-FGNEKYDU.js +0 -3
- package/dist/bin/shell/chunks/column-QLGOK3XM.js +0 -3
- package/dist/bin/shell/chunks/comm-PLYUTVP3.js +0 -3
- package/dist/bin/shell/chunks/cp-HYXTMN3D.js +0 -3
- package/dist/bin/shell/chunks/curl-DCSPNPEW.js +0 -27
- package/dist/bin/shell/chunks/cut-JNQTCQY7.js +0 -3
- package/dist/bin/shell/chunks/date-OFYBOAUE.js +0 -3
- package/dist/bin/shell/chunks/diff-LZ4WRLIF.js +0 -3
- package/dist/bin/shell/chunks/dirname-VCINTLPD.js +0 -3
- package/dist/bin/shell/chunks/du-4LRQIGRG.js +0 -3
- package/dist/bin/shell/chunks/echo-KCOHTNDF.js +0 -3
- package/dist/bin/shell/chunks/env-FNVYNLGB.js +0 -3
- package/dist/bin/shell/chunks/expand-CB7FG7LQ.js +0 -3
- package/dist/bin/shell/chunks/expr-6A2XZORA.js +0 -3
- package/dist/bin/shell/chunks/file-GRZLWDVH.js +0 -3
- package/dist/bin/shell/chunks/find-5OZWMYCV.js +0 -3
- package/dist/bin/shell/chunks/flag-coverage-CAST5CDE.js +0 -3
- package/dist/bin/shell/chunks/fold-7YEITA5L.js +0 -3
- package/dist/bin/shell/chunks/grep-KKBXRB73.js +0 -3
- package/dist/bin/shell/chunks/gzip-ZJP5VIAQ.js +0 -3
- package/dist/bin/shell/chunks/head-B6GFQHKF.js +0 -3
- package/dist/bin/shell/chunks/help-CGUEOGXQ.js +0 -3
- package/dist/bin/shell/chunks/history-AQQWW3QB.js +0 -3
- package/dist/bin/shell/chunks/hostname-USNWOQCK.js +0 -3
- package/dist/bin/shell/chunks/html-to-markdown-3HJ7L7NL.js +0 -3
- package/dist/bin/shell/chunks/join-WRM6S6CO.js +0 -3
- package/dist/bin/shell/chunks/jq-3V5HDGLJ.js +0 -3
- package/dist/bin/shell/chunks/js-exec-F7JAZ4ZQ.js +0 -98
- package/dist/bin/shell/chunks/ln-LP4HMCSM.js +0 -3
- package/dist/bin/shell/chunks/ls-KBNHNZWQ.js +0 -3
- package/dist/bin/shell/chunks/md5sum-ZNYCDRQL.js +0 -3
- package/dist/bin/shell/chunks/mkdir-P4DKRCDX.js +0 -3
- package/dist/bin/shell/chunks/mv-QQK4FQX6.js +0 -3
- package/dist/bin/shell/chunks/nl-6TVYE4ZB.js +0 -3
- package/dist/bin/shell/chunks/od-Y3E3QXOL.js +0 -3
- package/dist/bin/shell/chunks/paste-LYNFXXCM.js +0 -3
- package/dist/bin/shell/chunks/printf-MR3FXCDE.js +0 -3
- package/dist/bin/shell/chunks/pwd-FCNDA467.js +0 -3
- package/dist/bin/shell/chunks/python3-R5OFWJIH.js +0 -13
- package/dist/bin/shell/chunks/readlink-25V57VOL.js +0 -3
- package/dist/bin/shell/chunks/rev-AJECDD4L.js +0 -3
- package/dist/bin/shell/chunks/rg-DZKA632H.js +0 -3
- package/dist/bin/shell/chunks/rm-ECNUFR66.js +0 -3
- package/dist/bin/shell/chunks/rmdir-DLOHIA7Q.js +0 -3
- package/dist/bin/shell/chunks/sed-IGRH7EGG.js +0 -3
- package/dist/bin/shell/chunks/seq-UXDJE6FB.js +0 -3
- package/dist/bin/shell/chunks/sha1sum-5QZSNFY3.js +0 -3
- package/dist/bin/shell/chunks/sha256sum-DI7JAVAU.js +0 -3
- package/dist/bin/shell/chunks/sleep-RPGCUUGX.js +0 -3
- package/dist/bin/shell/chunks/sort-HQPAFL76.js +0 -3
- package/dist/bin/shell/chunks/split-F6FSB5KI.js +0 -3
- package/dist/bin/shell/chunks/sqlite3-7TRACAE7.js +0 -3
- package/dist/bin/shell/chunks/stat-BD6KT3BP.js +0 -3
- package/dist/bin/shell/chunks/strings-6PE3YMPO.js +0 -3
- package/dist/bin/shell/chunks/tac-NERJXVOM.js +0 -3
- package/dist/bin/shell/chunks/tail-24F643A4.js +0 -3
- package/dist/bin/shell/chunks/tar-5HK3VMV2.js +0 -3
- package/dist/bin/shell/chunks/tee-5B7P2QRJ.js +0 -3
- package/dist/bin/shell/chunks/time-FN6VJGRS.js +0 -3
- package/dist/bin/shell/chunks/timeout-ZARIAF3K.js +0 -3
- package/dist/bin/shell/chunks/touch-DFGSVIX7.js +0 -3
- package/dist/bin/shell/chunks/tr-QQZYZ3CH.js +0 -3
- package/dist/bin/shell/chunks/tree-6D7SMPUR.js +0 -3
- package/dist/bin/shell/chunks/true-SKL4L7JP.js +0 -3
- package/dist/bin/shell/chunks/unexpand-3JWOSSBQ.js +0 -3
- package/dist/bin/shell/chunks/uniq-Q5UH5NL3.js +0 -3
- package/dist/bin/shell/chunks/wc-4HXNTHY3.js +0 -3
- package/dist/bin/shell/chunks/which-LCXKCLFC.js +0 -3
- package/dist/bin/shell/chunks/whoami-TZDZDU7T.js +0 -3
- package/dist/bin/shell/chunks/xan-TCTFON2Q.js +0 -3
- package/dist/bin/shell/chunks/xan-view-XBMA362V.js +0 -3
- package/dist/bin/shell/chunks/xargs-VTFN762K.js +0 -3
- package/dist/bin/shell/chunks/yq-OB6PB5GY.js +0 -3
- package/dist/bundle/chunks/alias-RTYYYW3D.js +0 -2
- package/dist/bundle/chunks/awk2-SREAOJRG.js +0 -2
- package/dist/bundle/chunks/base64-WIGL46P3.js +0 -2
- package/dist/bundle/chunks/basename-UB3CIYNI.js +0 -2
- package/dist/bundle/chunks/bash-F4KHPMTX.js +0 -2
- package/dist/bundle/chunks/cat-LPZ6XNHG.js +0 -2
- package/dist/bundle/chunks/chmod-TFEPA42X.js +0 -2
- package/dist/bundle/chunks/chunk-27JIFWUR.js +0 -3
- package/dist/bundle/chunks/chunk-2VDTE5BV.js +0 -14
- package/dist/bundle/chunks/chunk-2VJJEDV2.js +0 -8
- package/dist/bundle/chunks/chunk-4I3HOE5Z.js +0 -21
- package/dist/bundle/chunks/chunk-4JLVZKHC.js +0 -8
- package/dist/bundle/chunks/chunk-4WKZNNJK.js +0 -2
- package/dist/bundle/chunks/chunk-55LZFN6S.js +0 -36
- package/dist/bundle/chunks/chunk-5MV7Q5QB.js +0 -5
- package/dist/bundle/chunks/chunk-6L65G6A7.js +0 -17
- package/dist/bundle/chunks/chunk-6NYPZ4NX.js +0 -8
- package/dist/bundle/chunks/chunk-6Y4TGEZL.js +0 -140
- package/dist/bundle/chunks/chunk-7CSMHFIJ.js +0 -33
- package/dist/bundle/chunks/chunk-AAGO7IQ5.js +0 -11
- package/dist/bundle/chunks/chunk-AX2X3SZS.js +0 -11
- package/dist/bundle/chunks/chunk-AXMYAPFA.js +0 -9
- package/dist/bundle/chunks/chunk-BU36VZYL.js +0 -4
- package/dist/bundle/chunks/chunk-BZUGFHVS.js +0 -2
- package/dist/bundle/chunks/chunk-CJFAMHFC.js +0 -7
- package/dist/bundle/chunks/chunk-CN5XGDNN.js +0 -6
- package/dist/bundle/chunks/chunk-CQV3EITV.js +0 -2
- package/dist/bundle/chunks/chunk-DVJY2RAX.js +0 -2
- package/dist/bundle/chunks/chunk-FLMHFDSN.js +0 -5
- package/dist/bundle/chunks/chunk-GE6OQDB2.js +0 -10
- package/dist/bundle/chunks/chunk-GHB6M7KA.js +0 -2
- package/dist/bundle/chunks/chunk-GRQJA2J7.js +0 -21
- package/dist/bundle/chunks/chunk-H2TS57O5.js +0 -5
- package/dist/bundle/chunks/chunk-H7WISVP3.js +0 -6
- package/dist/bundle/chunks/chunk-HAIOEUEV.js +0 -63
- package/dist/bundle/chunks/chunk-HBVMHTO5.js +0 -2
- package/dist/bundle/chunks/chunk-IZ6KBTV7.js +0 -100
- package/dist/bundle/chunks/chunk-J3LJZWL2.js +0 -6
- package/dist/bundle/chunks/chunk-JA7M2FXG.js +0 -16
- package/dist/bundle/chunks/chunk-JNYYVLEL.js +0 -35
- package/dist/bundle/chunks/chunk-JTMQLUCH.js +0 -16
- package/dist/bundle/chunks/chunk-K5JMLDHX.js +0 -13
- package/dist/bundle/chunks/chunk-KAPG5ONA.js +0 -2
- package/dist/bundle/chunks/chunk-KSBHIW2H.js +0 -19
- package/dist/bundle/chunks/chunk-KTL5PAHY.js +0 -5
- package/dist/bundle/chunks/chunk-KTPCYKBB.js +0 -3
- package/dist/bundle/chunks/chunk-KWGBQNTV.js +0 -32
- package/dist/bundle/chunks/chunk-MFDPAVC6.js +0 -14
- package/dist/bundle/chunks/chunk-MFRETFZB.js +0 -6
- package/dist/bundle/chunks/chunk-MIZIUC5M.js +0 -8
- package/dist/bundle/chunks/chunk-MJLETYZI.js +0 -14
- package/dist/bundle/chunks/chunk-MTHXXA6H.js +0 -6
- package/dist/bundle/chunks/chunk-NGPDJCUE.js +0 -5
- package/dist/bundle/chunks/chunk-OVH44QKR.js +0 -11
- package/dist/bundle/chunks/chunk-PDUL32DM.js +0 -16
- package/dist/bundle/chunks/chunk-PYDWFCTN.js +0 -11
- package/dist/bundle/chunks/chunk-QAJKDPNS.js +0 -2
- package/dist/bundle/chunks/chunk-QM4DZQWX.js +0 -287
- package/dist/bundle/chunks/chunk-R4IFXNY5.js +0 -28
- package/dist/bundle/chunks/chunk-R4QNMLOB.js +0 -12
- package/dist/bundle/chunks/chunk-RBQG6ZUG.js +0 -3
- package/dist/bundle/chunks/chunk-RCXNPPJY.js +0 -17
- package/dist/bundle/chunks/chunk-S2BIZAWY.js +0 -7
- package/dist/bundle/chunks/chunk-SAI2SPQQ.js +0 -8
- package/dist/bundle/chunks/chunk-SETW5JBN.js +0 -9
- package/dist/bundle/chunks/chunk-SJYEXC2Z.js +0 -14
- package/dist/bundle/chunks/chunk-SY4HAUHP.js +0 -2
- package/dist/bundle/chunks/chunk-TA74ENH7.js +0 -14
- package/dist/bundle/chunks/chunk-TC2WHAIS.js +0 -2
- package/dist/bundle/chunks/chunk-VACKIICN.js +0 -5
- package/dist/bundle/chunks/chunk-VBLMIJON.js +0 -6
- package/dist/bundle/chunks/chunk-WKPK7M56.js +0 -10
- package/dist/bundle/chunks/chunk-WM5IJFMP.js +0 -8
- package/dist/bundle/chunks/chunk-WPGQVBSY.js +0 -6
- package/dist/bundle/chunks/chunk-WVRWIZF5.js +0 -23
- package/dist/bundle/chunks/chunk-XEKXHOPO.js +0 -2
- package/dist/bundle/chunks/chunk-XPK7ZFVA.js +0 -12
- package/dist/bundle/chunks/chunk-XZUZRAAC.js +0 -10
- package/dist/bundle/chunks/chunk-Y4LIDHSD.js +0 -7
- package/dist/bundle/chunks/chunk-YRNR2VHY.js +0 -21
- package/dist/bundle/chunks/chunk-YS4NUBYX.js +0 -9
- package/dist/bundle/chunks/chunk-YWOZZRSK.js +0 -2
- package/dist/bundle/chunks/chunk-ZDIT6ST5.js +0 -7
- package/dist/bundle/chunks/clear-HKGFEOF6.js +0 -2
- package/dist/bundle/chunks/column-PVOEF65J.js +0 -2
- package/dist/bundle/chunks/comm-5QMYEAJL.js +0 -2
- package/dist/bundle/chunks/cp-BISAAS7A.js +0 -2
- package/dist/bundle/chunks/curl-PAWGO3EH.js +0 -26
- package/dist/bundle/chunks/cut-NDMV7SPO.js +0 -2
- package/dist/bundle/chunks/date-XKUEQ4WF.js +0 -2
- package/dist/bundle/chunks/diff-TT4M7WM3.js +0 -2
- package/dist/bundle/chunks/dirname-MPHRFUTI.js +0 -2
- package/dist/bundle/chunks/du-572XNP42.js +0 -2
- package/dist/bundle/chunks/echo-NDWZZHPO.js +0 -2
- package/dist/bundle/chunks/env-DLFRY633.js +0 -2
- package/dist/bundle/chunks/expand-T2TH4TBQ.js +0 -2
- package/dist/bundle/chunks/expr-YLACLCSM.js +0 -2
- package/dist/bundle/chunks/file-IPZJC3FQ.js +0 -2
- package/dist/bundle/chunks/find-T5TGGXUU.js +0 -2
- package/dist/bundle/chunks/flag-coverage-OHLSWDU5.js +0 -2
- package/dist/bundle/chunks/fold-XR2JMFCW.js +0 -2
- package/dist/bundle/chunks/grep-VUESTEZ7.js +0 -2
- package/dist/bundle/chunks/gzip-HF3D26QX.js +0 -2
- package/dist/bundle/chunks/head-AEMOMQSZ.js +0 -2
- package/dist/bundle/chunks/help-HZ6M2CKN.js +0 -2
- package/dist/bundle/chunks/history-WYYKSLSZ.js +0 -2
- package/dist/bundle/chunks/hostname-C4HQXXUP.js +0 -2
- package/dist/bundle/chunks/html-to-markdown-LXXMVQ3V.js +0 -2
- package/dist/bundle/chunks/join-YIABB6WR.js +0 -2
- package/dist/bundle/chunks/jq-OPEF5OPR.js +0 -2
- package/dist/bundle/chunks/js-exec-SR6IMNWM.js +0 -97
- package/dist/bundle/chunks/ln-4LGSXXGD.js +0 -2
- package/dist/bundle/chunks/ls-ZJGQER7M.js +0 -2
- package/dist/bundle/chunks/md5sum-LU7RVIB7.js +0 -2
- package/dist/bundle/chunks/mkdir-MEPGZOB6.js +0 -2
- package/dist/bundle/chunks/mv-W5BIQ646.js +0 -2
- package/dist/bundle/chunks/nl-Q2L5XQWZ.js +0 -2
- package/dist/bundle/chunks/od-RDSM4TQJ.js +0 -2
- package/dist/bundle/chunks/paste-ABCY7E6C.js +0 -2
- package/dist/bundle/chunks/printf-JPOOWRJC.js +0 -2
- package/dist/bundle/chunks/pwd-WE6EN5AV.js +0 -2
- package/dist/bundle/chunks/python3-JPCH6LLN.js +0 -12
- package/dist/bundle/chunks/readlink-OPJF4DL5.js +0 -2
- package/dist/bundle/chunks/rev-GCV6X22K.js +0 -2
- package/dist/bundle/chunks/rg-EBMD72T4.js +0 -2
- package/dist/bundle/chunks/rm-SSGETQVQ.js +0 -2
- package/dist/bundle/chunks/rmdir-OC4ZLPYA.js +0 -2
- package/dist/bundle/chunks/sed-DX2SGXMF.js +0 -2
- package/dist/bundle/chunks/seq-M5EC7Q57.js +0 -2
- package/dist/bundle/chunks/sha1sum-O6DM3TPQ.js +0 -2
- package/dist/bundle/chunks/sha256sum-WPVZLZPS.js +0 -2
- package/dist/bundle/chunks/sleep-HZ4QEFOK.js +0 -2
- package/dist/bundle/chunks/sort-VW2NIZHW.js +0 -2
- package/dist/bundle/chunks/split-NBMH43M2.js +0 -2
- package/dist/bundle/chunks/sqlite3-UE3PJTDQ.js +0 -2
- package/dist/bundle/chunks/stat-CD34IZ4P.js +0 -2
- package/dist/bundle/chunks/strings-MCXFXPDL.js +0 -2
- package/dist/bundle/chunks/tac-BQ7EDZW2.js +0 -2
- package/dist/bundle/chunks/tail-GJMTLMNE.js +0 -2
- package/dist/bundle/chunks/tar-WIZ3PDF4.js +0 -2
- package/dist/bundle/chunks/tee-SGANDVNY.js +0 -2
- package/dist/bundle/chunks/time-FCZCDIAM.js +0 -2
- package/dist/bundle/chunks/timeout-VDIEAB4R.js +0 -2
- package/dist/bundle/chunks/touch-UA33VN3N.js +0 -2
- package/dist/bundle/chunks/tr-JNNR5JMS.js +0 -2
- package/dist/bundle/chunks/tree-YLD52CNT.js +0 -2
- package/dist/bundle/chunks/true-FHQXJXBE.js +0 -2
- package/dist/bundle/chunks/unexpand-2TKXAENW.js +0 -2
- package/dist/bundle/chunks/uniq-DMFKT3AB.js +0 -2
- package/dist/bundle/chunks/wc-TZFYWFLA.js +0 -2
- package/dist/bundle/chunks/which-XEM24D5D.js +0 -2
- package/dist/bundle/chunks/whoami-XMTX52VE.js +0 -2
- package/dist/bundle/chunks/xan-LKYWG2QQ.js +0 -2
- package/dist/bundle/chunks/xan-view-YATJ4KAA.js +0 -2
- package/dist/bundle/chunks/xargs-VDP7DLOU.js +0 -2
- package/dist/bundle/chunks/yq-TVZ7R3O7.js +0 -2
- package/dist/interpreter/helpers/statements.d.ts +0 -20
- package/dist/interpreter/helpers/tilde.d.ts +0 -13
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as k,b as E,c as $,d as Te,e as S,g as C,h as ce}from"./chunk-FIMO5HLX.js";import{a as ue,c as xe}from"./chunk-DLL7UR66.js";import{a as Ie}from"./chunk-AI5LSBJC.js";import{a as j}from"./chunk-XVL654YD.js";import{d as G}from"./chunk-AH7VTVWU.js";import{l as g}from"./chunk-EFORKKSH.js";import{a as M}from"./chunk-GN6CQ3J4.js";function I(e){return e!==!1&&e!==null}function J(e,n){return JSON.stringify(e)===JSON.stringify(n)}function Y(e,n){return typeof e=="number"&&typeof n=="number"?e-n:typeof e=="string"&&typeof n=="string"?e.localeCompare(n):0}function Me(e,n,t={}){let r=t.maxDepth??2e3,s=C(e),o=[{target:s,source:n,depth:0}];for(;o.length>0;){let h=o.pop();if(!h)break;if(h.depth>r)throw new g(`query depth limit exceeded (${r})`,"recursion");for(let u of Object.keys(h.source)){if(t.visit?.(),!k(u))continue;let f=$(h.target,u)?S(h.target[u]):null,i=S(h.source[u]);if(f&&i){let c=C(f);E(h.target,u,c),o.push({target:c,source:i,depth:h.depth+1})}else E(h.target,u,h.source[u])}}return s}function B(e,n=3e3){if(e===null||typeof e!="object")return 0;if(n<=1)return n;let t=(i,c)=>({value:i,keys:Array.isArray(i)?void 0:Object.keys(i),nextChild:0,pathDepth:c,maxChildDepth:0}),r=i=>i.keys!==void 0?i.keys.length:i.value.length,s=i=>{if(i.keys){let c=i.keys[i.nextChild++];return i.value[c]}return i.value[i.nextChild++]},o=new WeakMap,h=new WeakMap,u=e,f=[t(u,1)];for(o.set(u,"visiting");f.length>0;){let i=f[f.length-1];if(i.nextChild<r(i)){let a=s(i);if(a===null||typeof a!="object")continue;let l=o.get(a);if(l==="visiting")return n;if(l==="done"){let b=h.get(a)??0;if(i.pathDepth+b>=n)return n;i.maxChildDepth=Math.max(i.maxChildDepth,b);continue}let y=i.pathDepth+1;if(y>=n)return n;let m=a;o.set(a,"visiting"),f.push(t(m,y));continue}let c=i.maxChildDepth+1;h.set(i.value,c),o.set(i.value,"done"),f.pop();let p=f.at(-1);if(p)p.maxChildDepth=Math.max(p.maxChildDepth,c);else return c}return 0}function Z(e,n){let t=u=>u===null?0:typeof u=="boolean"?1:typeof u=="number"?2:typeof u=="string"?3:Array.isArray(u)?4:typeof u=="object"?5:6,r=t(e),s=t(n);if(r!==s)return r-s;if(typeof e=="number"&&typeof n=="number")return e-n;if(typeof e=="string"&&typeof n=="string")return e.localeCompare(n);if(typeof e=="boolean"&&typeof n=="boolean")return(e?1:0)-(n?1:0);if(Array.isArray(e)&&Array.isArray(n)){for(let u=0;u<Math.min(e.length,n.length);u++){let f=Z(e[u],n[u]);if(f!==0)return f}return e.length-n.length}let o=S(e),h=S(n);if(o&&h){let u=Object.keys(o).sort(),f=Object.keys(h).sort();for(let i=0;i<Math.min(u.length,f.length);i++){let c=u[i].localeCompare(f[i]);if(c!==0)return c}if(u.length!==f.length)return u.length-f.length;for(let i of u){let c=Z(o[i],h[i]);if(c!==0)return c}}return 0}function v(e,n){if(J(e,n))return!0;if(typeof e=="string"&&typeof n=="string")return e.includes(n);if(Array.isArray(e)&&Array.isArray(n))return n.every(s=>e.some(o=>v(o,s)));let t=S(e),r=S(n);return t&&r?Object.keys(r).every(s=>$(t,s)&&v(t[s],r[s])):!1}function z(e,n,t=1){let r=e.limits.maxArrayElements;if(t<0||n>r-t)throw new g(`query result element limit exceeded (${r})`,"array_elements")}function he(e,n,t,r,s,o,h,u,f,i){switch(n){case"sort":return Array.isArray(e)?[[...e].sort(h)]:[null];case"sort_by":return!Array.isArray(e)||t.length===0?[null]:[[...e].sort((p,a)=>{let l=s(p,t[0],r)[0],y=s(a,t[0],r)[0];return h(l,y)})];case"bsearch":{if(!Array.isArray(e)){let p=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${p} (${JSON.stringify(e)}) cannot be searched from`)}return t.length===0?[null]:s(e,t[0],r).map(p=>{let a=0,l=e.length;for(;a<l;){let y=a+l>>>1;h(e[y],p)<0?a=y+1:l=y}return a<e.length&&h(e[a],p)===0?a:-a-1})}case"unique_by":{if(!Array.isArray(e)||t.length===0)return[null];let c=new Map;for(let a of e){let l=s(a,t[0],r)[0],y=JSON.stringify(l);c.has(y)||c.set(y,{item:a,key:l})}let p=[...c.values()];return p.sort((a,l)=>h(a.key,l.key)),[p.map(a=>a.item)]}case"group_by":{if(!Array.isArray(e)||t.length===0)return[null];let c=new Map;for(let p of e){let a=JSON.stringify(s(p,t[0],r)[0]);c.has(a)||c.set(a,[]),c.get(a)?.push(p)}return[[...c.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((c,p)=>h(c,p)>0?c:p)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||t.length===0?[null]:[e.reduce((c,p)=>{let a=s(c,t[0],r)[0],l=s(p,t[0],r)[0];return h(a,l)>0?c:p})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((c,p)=>h(c,p)<0?c:p)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||t.length===0?[null]:[e.reduce((c,p)=>{let a=s(c,t[0],r)[0],l=s(p,t[0],r)[0];return h(a,l)<0?c:p})];case"add":{let c=p=>{let a=p.filter(l=>l!==null);return a.length===0?null:a.every(l=>typeof l=="number")?a.reduce((l,y)=>l+y,0):a.every(l=>typeof l=="string")?a.join(""):a.every(l=>Array.isArray(l))?a.flat():a.every(l=>l&&typeof l=="object"&&!Array.isArray(l))?xe(...a):null};if(t.length>=1){let p=s(e,t[0],r);return[c(p)]}return Array.isArray(e)?[c(e)]:[null]}case"any":{if(t.length>=2){try{let c=o(e,t[0],r);for(let p of c)if(s(p,t[1],r).some(u))return[!0]}catch(c){if(c instanceof i)throw c}return[!1]}return t.length===1?Array.isArray(e)?[e.some(c=>u(s(c,t[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(u)]:[!1]}case"all":{if(t.length>=2){try{let c=o(e,t[0],r);for(let p of c)if(!s(p,t[1],r).some(u))return[!1]}catch(c){if(c instanceof i)throw c}return[!0]}return t.length===1?Array.isArray(e)?[e.every(c=>u(s(c,t[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(u)]:[!0]}case"select":return t.length===0?[e]:s(e,t[0],r).some(u)?[e]:[];case"map":{if(t.length===0||!Array.isArray(e))return[null];z(r,0,e.length);let c=[];for(let p of e){let a=s(p,t[0],r);z(r,c.length,a.length);for(let l of a)c.push(l)}return[c]}case"map_values":{if(t.length===0)return[null];if(Array.isArray(e)){z(r,0,e.length);let c=[];for(let p of e){let a=s(p,t[0],r);z(r,c.length,a.length);for(let l of a)c.push(l)}return[c]}if(e&&typeof e=="object"){let c=Object.create(null),p=Object.keys(e);z(r,0,p.length);for(let a of p){if(!k(a))continue;let l=e[a],y=s(l,t[0],r);y.length>0&&E(c,a,y[0])}return[c]}return[null]}case"has":{if(t.length===0)return[!1];let p=s(e,t[0],r)[0];return Array.isArray(e)&&typeof p=="number"?[p>=0&&p<e.length]:e&&typeof e=="object"&&typeof p=="string"?[Object.hasOwn(e,p)]:[!1]}case"in":{if(t.length===0)return[!1];let p=s(e,t[0],r)[0];return Array.isArray(p)&&typeof e=="number"?[e>=0&&e<p.length]:p&&typeof p=="object"&&typeof e=="string"?[Object.hasOwn(p,e)]:[!1]}case"contains":{if(t.length===0)return[!1];let c=s(e,t[0],r);return[f(e,c[0])]}case"inside":{if(t.length===0)return[!1];let c=s(e,t[0],r);return[f(c[0],e)]}default:return null}}function pe(e,n,t,r,s,o,h,u){switch(n){case"first":if(t.length>0)try{let f=o(e,t[0],r);return f.length>0?[f[0]]:[]}catch(f){if(f instanceof u)throw f;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(t.length>0){let f=s(e,t[0],r);return f.length>0?[f[f.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(t.length<1)return[null];let f=s(e,t[0],r);if(t.length>1){for(let c of f)if(c<0)throw new Error("nth doesn't support negative indices");let i;try{i=o(e,t[1],r)}catch(c){if(c instanceof u)throw c;i=[]}return f.flatMap(c=>{let p=c;return p<i.length?[i[p]]:[]})}return Array.isArray(e)?f.flatMap(i=>{let c=i;if(c<0)throw new Error("nth doesn't support negative indices");return c<e.length?[e[c]]:[null]}):[null]}case"range":{if(t.length===0)return[];let f=r.limits.maxArrayElements,i=(y,m)=>{if(y.length>=f)throw new u(`query result element limit exceeded (${f})`,"array_elements");y.push(m)},c=s(e,t[0],r);if(t.length===1){let y=[];for(let m of c){let b=m;for(let A=0;A<b;A++)i(y,A)}return y}let p=s(e,t[1],r);if(t.length===2){let y=[];for(let m of c)for(let b of p){let A=m,w=b;for(let N=A;N<w;N++)i(y,N)}return y}let a=s(e,t[2],r),l=[];for(let y of c)for(let m of p)for(let b of a){let A=y,w=m,N=b;if(N!==0)if(N>0)for(let O=A;O<w;O+=N)i(l,O);else for(let O=A;O>w;O+=N)i(l,O)}return l}case"limit":return t.length<2?[]:s(e,t[0],r).flatMap(i=>{let c=i;if(c<0)throw new Error("limit doesn't support negative count");if(c===0)return[];let p;try{p=o(e,t[1],r)}catch(a){if(a instanceof u)throw a;p=[]}return p.slice(0,c)});case"isempty":{if(t.length<1)return[!0];try{return[o(e,t[0],r).length===0]}catch(f){if(f instanceof u)throw f;return[!0]}}case"isvalid":{if(t.length<1)return[!0];try{return[s(e,t[0],r).length>0]}catch(f){if(f instanceof u)throw f;return[!1]}}case"skip":return t.length<2?[]:s(e,t[0],r).flatMap(i=>{let c=i;if(c<0)throw new Error("skip doesn't support negative count");return s(e,t[1],r).slice(c)});case"until":{if(t.length<2)return[e];let f=e,i=r.limits.maxIterations;for(let c=0;c<i;c++){if(s(f,t[0],r).some(h))return[f];let a=s(f,t[1],r);if(a.length===0)return[f];f=a[0]}throw new u(`jq until: too many iterations (${i}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(t.length<2)return[e];let f=[],i=e,c=r.limits.maxIterations;for(let p=0;p<c&&s(i,t[0],r).some(h);p++){f.push(i);let l=s(i,t[1],r);if(l.length===0)break;i=l[0]}if(f.length>=c)throw new u(`jq while: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations");return f}case"repeat":{if(t.length===0)return[e];let f=[],i=e,c=r.limits.maxIterations;for(let p=0;p<c;p++){f.push(i);let a=s(i,t[0],r);if(a.length===0)break;i=a[0]}if(f.length>=c)throw new u(`jq repeat: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations");return f}default:return null}}var je="%Y-%m-%dT%H:%M:%SZ";function ae(e,n){if(!Number.isFinite(e)||Math.abs(e)>864e10)throw new Error(`${n} timestamp is outside the supported range`);return new Date(e*1e3)}function Pe(e){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(!n)return null;let[,t,r,s,o,h,u]=n.map(Number),f=Date.UTC(t,r-1,s,o,h,u);if(!Number.isFinite(f))return null;let i=new Date(f);return i.getUTCFullYear()!==t||i.getUTCMonth()!==r-1||i.getUTCDate()!==s||i.getUTCHours()!==o||i.getUTCMinutes()!==h||i.getUTCSeconds()!==u?null:i}function le(e,n,t,r,s){switch(n){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let o=ae(e,"gmtime"),h=o.getUTCFullYear(),u=o.getUTCMonth(),f=o.getUTCDate(),i=o.getUTCHours(),c=o.getUTCMinutes(),p=o.getUTCSeconds(),a=o.getUTCDay(),l=Date.UTC(h,0,1),y=Math.floor((o.getTime()-l)/(1440*60*1e3));return[[h,u,f,i,c,p,a,y]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[o,h,u,f=0,i=0,c=0]=e;if(typeof o!="number"||typeof h!="number")throw new Error("mktime requires parsed datetime inputs");let p=Date.UTC(o,h,u??1,f??0,i??0,c??0);return[Math.floor(p/1e3)]}case"strftime":{if(t.length===0)return[null];let h=s(e,t[0],r)[0];if(typeof h!="string")throw new Error("strftime/1 requires a string format");let u;if(typeof e=="number")u=ae(e,"strftime");else if(Array.isArray(e)){let[a,l,y,m=0,b=0,A=0]=e;if(typeof a!="number"||typeof l!="number")throw new Error("strftime/1 requires parsed datetime inputs");u=new Date(Date.UTC(a,l,y??1,m??0,b??0,A??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=["January","February","March","April","May","June","July","August","September","October","November","December"],c=(a,l=2)=>String(a).padStart(l,"0");return[h.replace(/%Y/g,String(u.getUTCFullYear())).replace(/%m/g,c(u.getUTCMonth()+1)).replace(/%d/g,c(u.getUTCDate())).replace(/%H/g,c(u.getUTCHours())).replace(/%M/g,c(u.getUTCMinutes())).replace(/%S/g,c(u.getUTCSeconds())).replace(/%A/g,f[u.getUTCDay()]).replace(/%B/g,i[u.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(t.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let h=s(e,t[0],r)[0];if(typeof h!="string")throw new Error("strptime/1 requires a string format");if(h!==je)throw new Error(`strptime format is not supported: ${h}`);let u=Pe(e);if(u){let f=u.getUTCFullYear(),i=u.getUTCMonth(),c=u.getUTCDate(),p=u.getUTCHours(),a=u.getUTCMinutes(),l=u.getUTCSeconds(),y=u.getUTCDay(),m=Date.UTC(f,0,1),b=Math.floor((u.getTime()-m)/(1440*60*1e3));return[[f,i,c,p,a,l,y,b]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let o=Pe(e);if(!o)throw new Error(`date "${e}" does not match format "${je}"`);return[Math.floor(o.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[ae(e,"todate").toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var ze=2e3;function We(e){let n=[];for(let r=0;r<e.length;r+=32768){let s=Math.min(r+32768,e.length),o="";for(let h=r;h<s;h++)o+=String.fromCharCode(e[h]);n.push(o)}return n.join("")}function Xe(e){let n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}function ye(e,n,t){switch(n){case"@base64":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"utf-8").toString("base64")];let r=new TextEncoder().encode(e);return[btoa(We(r))]}return[null];case"@base64d":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"base64").toString("utf-8")];let r=Xe(atob(e));return[new TextDecoder("utf-8",{fatal:!1}).decode(r)]}return[null];case"@uri":return typeof e=="string"?[encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof e=="string"?[decodeURIComponent(e)]:[null];case"@csv":return Array.isArray(e)?[e.map(s=>{if(s===null)return"";if(typeof s=="boolean")return s?"true":"false";if(typeof s=="number")return String(s);let o=String(s);return o.includes(",")||o.includes('"')||o.includes(`
|
|
3
|
+
`)||o.includes("\r")?`"${o.replace(/"/g,'""')}"`:o}).join(",")]:[null];case"@tsv":return Array.isArray(e)?[e.map(r=>String(r??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let r=t??ze;return B(e,r+1)>r?[null]:[JSON.stringify(e)]}case"@html":return typeof e=="string"?[e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")]:[null];case"@sh":return typeof e=="string"?[`'${e.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof e=="string"?[e]:e==null?[""]:[String(e)];default:return null}}function me(e,n,t,r,s,o){switch(n){case"index":return t.length===0?[null]:s(e,t[0],r).map(u=>{if(typeof e=="string"&&typeof u=="string"){if(u===""&&e==="")return null;let f=e.indexOf(u);return f>=0?f:null}if(Array.isArray(e)){if(Array.isArray(u)){for(let i=0;i<=e.length-u.length;i++){let c=!0;for(let p=0;p<u.length;p++)if(!o(e[i+p],u[p])){c=!1;break}if(c)return i}return null}let f=e.findIndex(i=>o(i,u));return f>=0?f:null}return null});case"rindex":return t.length===0?[null]:s(e,t[0],r).map(u=>{if(typeof e=="string"&&typeof u=="string"){let f=e.lastIndexOf(u);return f>=0?f:null}if(Array.isArray(e)){if(Array.isArray(u)){for(let f=e.length-u.length;f>=0;f--){let i=!0;for(let c=0;c<u.length;c++)if(!o(e[f+c],u[c])){i=!1;break}if(i)return f}return null}for(let f=e.length-1;f>=0;f--)if(o(e[f],u))return f;return null}return null});case"indices":return t.length===0?[[]]:s(e,t[0],r).map(u=>{let f=[];if(typeof e=="string"&&typeof u=="string"){let i=e.indexOf(u);for(;i!==-1;)f.push(i),i=e.indexOf(u,i+1)}else if(Array.isArray(e))if(Array.isArray(u)){let i=u.length;if(i===0)for(let c=0;c<=e.length;c++)f.push(c);else for(let c=0;c<=e.length-i;c++){let p=!0;for(let a=0;a<i;a++)if(!o(e[c+a],u[a])){p=!1;break}p&&f.push(c)}}else for(let i=0;i<e.length;i++)o(e[i],u)&&f.push(i);return f});default:return null}}function de(e,n,t,r,s){switch(n){case"fabs":case"abs":return typeof e=="number"?[Math.abs(e)]:typeof e=="string"?[e]:[null];case"exp10":return typeof e=="number"?[10**e]:[null];case"exp2":return typeof e=="number"?[2**e]:[null];case"pow":{if(t.length<2)return[null];let o=s(e,t[0],r),h=s(e,t[1],r),u=o[0],f=h[0];return typeof u!="number"||typeof f!="number"?[null]:[u**f]}case"atan2":{if(t.length<2)return[null];let o=s(e,t[0],r),h=s(e,t[1],r),u=o[0],f=h[0];return typeof u!="number"||typeof f!="number"?[null]:[Math.atan2(u,f)]}case"hypot":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.hypot(e,o)]}case"fma":{if(typeof e!="number"||t.length<2)return[null];let o=s(e,t[0],r)[0],h=s(e,t[1],r)[0];return[e*o+h]}case"copysign":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.sign(o)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e-Math.round(e/o)*o]}case"fdim":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.max(0,e-o)]}case"fmax":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.max(e,o)]}case"fmin":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.min(e,o)]}case"ldexp":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e*2**o]}case"scalbn":case"scalbln":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e*2**o]}case"nearbyint":return typeof e=="number"?[Math.round(e)]:[null];case"logb":return typeof e=="number"?[Math.floor(Math.log2(Math.abs(e)))]:[null];case"significand":if(typeof e=="number"){let o=Math.floor(Math.log2(Math.abs(e)));return[e/2**o]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let o=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**o,o]]}return[null];case"modf":if(typeof e=="number"){let o=Math.trunc(e);return[[e-o,o]]}return[null];default:return null}}function V(e){let n=e.limits.maxIterations;return{maxDepth:e.limits.maxDepth,maxResults:e.limits.maxArrayElements,maxIterations:n}}function H(e){throw new g(e,"array_elements")}function ge(e,n){let t=1;for(let r of e){if(!Number.isSafeInteger(r)||r<0)throw new Error("combinations requires finite array lengths");r!==0&&t>Math.floor(n/r)&&H(`query combination limit exceeded (${n})`),t*=r}return t}function be(e,n,t,r,s,o,h,u){switch(n){case"recurse":{let f=[],i=V(r),c=t.length>=2?t[1]:null,p=[{value:e,depth:0}],a=0;for(;p.length>0;){let l=p.pop();if(!l)break;if(++a>i.maxIterations)throw new g(`query iteration limit exceeded (${i.maxIterations})`,"iterations");if(l.depth>i.maxDepth)throw new g(`query depth limit exceeded (${i.maxDepth})`,"recursion");if(c&&!s(l.value,c,r).some(o))continue;f.length>=i.maxResults&&H(`query result element limit exceeded (${i.maxResults})`),f.push(l.value);let y=[];t.length===0?Array.isArray(l.value)?y=l.value:l.value&&typeof l.value=="object"&&(y=Object.keys(l.value).map(m=>l.value[m])):y=s(l.value,t[0],r).filter(m=>m!=null),p.length>i.maxResults-y.length&&H(`query traversal queue limit exceeded (${i.maxResults})`);for(let m=y.length-1;m>=0;m--)p.push({value:y[m],depth:l.depth+1})}return f}case"recurse_down":return u(e,"recurse",t,r);case"walk":{if(t.length===0)return[e];let f=V(r),i=new WeakSet,c=new WeakMap,p=[{value:e,depth:0,expanded:!1}],a=e,l=0;for(;p.length>0;){let y=p.pop();if(!y)break;if(++l>f.maxIterations)throw new g(`query iteration limit exceeded (${f.maxIterations})`,"iterations");if(y.depth>f.maxDepth)throw new g(`query depth limit exceeded (${f.maxDepth})`,"recursion");let m=y.value!==null&&typeof y.value=="object"?y.value:null;if(!y.expanded&&m){if(i.has(m))continue;i.add(m),p.push({...y,expanded:!0});let w=S(y.value),N=Array.isArray(y.value)?y.value:Object.keys(w??{}).map(O=>w?.[O]);p.length>f.maxResults-N.length&&H(`query traversal queue limit exceeded (${f.maxResults})`);for(let O=N.length-1;O>=0;O--)p.push({value:N[O],depth:y.depth+1,expanded:!1});continue}let b=y.value;if(Array.isArray(y.value))b=y.value.map(w=>w!==null&&typeof w=="object"?c.get(w)??w:w);else if(m){let w=Object.create(null),N=S(y.value);for(let O of Object.keys(N??{})){if(!k(O))continue;let L=N?.[O];E(w,O,L!==null&&typeof L=="object"?c.get(L)??L:L)}b=w}let A=s(b,t[0],r)[0];m&&c.set(m,A),y.depth===0&&(a=A)}return[a]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let f=V(r),i=0;for(let p of e)Array.isArray(p)&&(i=Math.max(i,p.length));ge([e.length,i],f.maxResults);let c=[];for(let p=0;p<i;p++)c.push(e.map(a=>Array.isArray(a)?a[p]:null));return[c]}case"combinations":{if(t.length>0){let y=s(e,t[0],r)[0];if(!Array.isArray(e))return[];if(!Number.isFinite(y)||!Number.isSafeInteger(y)||y<0)throw new Error("combinations length must be a finite non-negative integer");let m=V(r);if(y>m.maxDepth||y>m.maxResults)throw new g(`query depth limit exceeded (${m.maxDepth})`,"recursion");if(y===0)return m.maxResults<1&&H("query combination limit exceeded (0)"),[[]];let b=ge(Array.from({length:y},()=>e.length),m.maxResults);if(b===0)return[];let A=[],w=new Array(y).fill(0);for(let N=0;N<b;N++){A.push(w.map(O=>e[O]));for(let O=y-1;O>=0&&(w[O]++,!(w[O]<e.length));O--)w[O]=0}return A}if(!Array.isArray(e))return[];if(e.length===0)return V(r).maxResults<1&&H("query combination limit exceeded (0)"),[[]];for(let l of e)if(!Array.isArray(l))return[];let f=V(r),i=e;if(i.length>f.maxDepth)throw new g(`query depth limit exceeded (${f.maxDepth})`,"recursion");let c=ge(i.map(l=>l.length),f.maxResults);if(c===0)return[];let p=[],a=new Array(i.length).fill(0);for(let l=0;l<c;l++){p.push(a.map((y,m)=>i[m][y]));for(let y=i.length-1;y>=0&&(a[y]++,!(a[y]<i[y].length));y--)a[y]=0}return p}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let f=r.currentPath;if(f.length===0)return[];let i=t.length>0?s(e,t[0],r)[0]:1;if(i>=0){if(i>f.length)return[];let c=f.slice(0,f.length-i);return[h(r.root,c)]}else{let c=-i-1;if(c>=f.length)return[e];let p=f.slice(0,c);return[h(r.root,p)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let f=r.currentPath,i=[];for(let c=f.length-1;c>=0;c--)i.push(h(r.root,f.slice(0,c)));return[i]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var Ae=2e3;function T(e){return e.limits.maxArrayElements}function ee(e,n){let t=T(e);if(n>=t)throw new g(`query result element limit exceeded (${t})`,"array_elements")}function Ge(e,n){let t=n.limits.maxDepth??Ae;if(e.length>t)throw new g(`query depth limit exceeded (${t})`,"recursion");let r=n.limits.maxArrayElements;for(let s of e)if(typeof s=="number"){if(!Number.isSafeInteger(s)||s<0||s>=r)throw new g(`query array index limit exceeded (${r})`,"array_elements")}else if(typeof s!="string")throw new Error("stream path components must be strings or integers")}function we(e,n,t,r,s){switch(n){case"keys":return Array.isArray(e)?[e.map((o,h)=>h)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((o,h)=>h)]:e&&typeof e=="object"?[Object.keys(e)]:[null];case"length":return typeof e=="string"?[e.length]:Array.isArray(e)?[e.length]:e&&typeof e=="object"?[Object.keys(e).length]:e===null?[0]:typeof e=="number"?[Math.abs(e)]:[null];case"utf8bytelength":{if(typeof e=="string")return[M(e)];let o=e===null?"null":Array.isArray(e)?"array":typeof e,h=o==="array"||o==="object"?JSON.stringify(e):String(e);throw new Error(`${o} (${h}) only strings have UTF-8 byte length`)}case"to_entries":{let o=S(e);if(o){let h=Object.keys(o);if(h.length>T(r))throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");return[h.map(u=>{let f=Object.create(null);return E(f,"key",u),E(f,"value",o[u]),f})]}return[null]}case"from_entries":if(Array.isArray(e)){let o=Object.create(null);for(let h of e){let u=S(h);if(u){let f=u.key??u.Key??u.name??u.Name??u.k,i=u.value??u.Value??u.v;if(f!==void 0){let c=String(f);k(c)&&E(o,c,i)}}}return[o]}return[null];case"with_entries":{if(t.length===0)return[e];let o=S(e);if(o){let h=Object.keys(o);if(h.length>T(r))throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");let u=[];for(let i of h){let c=Object.create(null);E(c,"key",i),E(c,"value",o[i]);let p=s(c,t[0],r);if(u.length>T(r)-p.length)throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");for(let a of p)u.push(a)}let f=Object.create(null);for(let i of u){let c=S(i);if(c){let p=c.key??c.name??c.k,a=c.value??c.v;if(p!==void 0){let l=String(p);k(l)&&E(f,l,a)}}}return[f]}return[null]}case"reverse":return Array.isArray(e)?[[...e].reverse()]:typeof e=="string"?[e.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(e)?(t.length>0?s(e,t[0],r):[Number.POSITIVE_INFINITY]).map(h=>{let u=h;if(u<0)throw new Error("flatten depth must not be negative");return e.flat(u)}):[null];case"unique":if(Array.isArray(e)){let o=new Set,h=[];for(let u of e){let f=JSON.stringify(u);o.has(f)||(o.add(f),h.push(u))}return[h]}return[null];case"tojson":case"tojsonstream":{let o=r.limits.maxDepth??Ae;return B(e,o+1)>o?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let o=e.trim().toLowerCase();if(o==="nan")return[Number.NaN];if(o==="inf"||o==="infinity")return[Number.POSITIVE_INFINITY];if(o==="-inf"||o==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[Te(JSON.parse(e),{maxDepth:r.limits.maxDepth,maxElements:r.limits.maxArrayElements})]}catch(h){throw h instanceof g?h:new Error(`Invalid JSON: ${e}`)}}return[e]}case"tostring":return typeof e=="string"?[e]:[JSON.stringify(e)];case"tonumber":if(typeof e=="number")return[e];if(typeof e=="string"){let o=Number(e);if(Number.isNaN(o))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[o]}throw new Error(`${typeof e} cannot be parsed as a number`);case"toboolean":{if(typeof e=="boolean")return[e];if(typeof e=="string"){if(e==="true")return[!0];if(e==="false")return[!1];throw new Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let o=e===null?"null":Array.isArray(e)?"array":typeof e,h=o==="array"||o==="object"?JSON.stringify(e):String(e);throw new Error(`${o} (${h}) cannot be parsed as a boolean`)}case"tostream":{let o=[],h=r.limits.maxDepth??Ae,u=[{value:e,path:[]}],f=new WeakSet,i=0;for(;u.length>0;){let c=u.pop();if(!c)break;if(++i>r.limits.maxIterations)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");if(c.path.length>h)throw new g(`query depth limit exceeded (${h})`,"recursion");let p=c.value;if(p===null||typeof p!="object")ee(r,o.length),o.push([c.path,p]);else if(Array.isArray(p)){if(f.has(p))throw new g("cyclic value cannot be converted to a stream","recursion");if(f.add(p),p.length===0)ee(r,o.length),o.push([c.path,[]]);else{if(u.length>T(r)-p.length)throw new g(`query traversal queue limit exceeded (${T(r)})`,"array_elements");for(let a=p.length-1;a>=0;a--)u.push({value:p[a],path:[...c.path,a]})}}else{if(f.has(p))throw new g("cyclic value cannot be converted to a stream","recursion");f.add(p);let a=Object.keys(p);if(a.length===0)ee(r,o.length),o.push([c.path,Object.create(null)]);else{if(u.length>T(r)-a.length)throw new g(`query traversal queue limit exceeded (${T(r)})`,"array_elements");for(let l=a.length-1;l>=0;l--){let y=a[l];u.push({value:p[y],path:[...c.path,y]})}}}}return ee(r,o.length),o.push([[]]),o}case"fromstream":{if(t.length===0)return[e];let o=s(e,t[0],r);if(o.length>T(r))throw new g(`query stream item limit exceeded (${T(r)})`,"array_elements");let h=null,u=0;for(let f of o){if(!Array.isArray(f)||f.length===1&&Array.isArray(f[0])&&f[0].length===0||f.length!==2)continue;let[i,c]=f;if(!Array.isArray(i))continue;if(Ge(i,r),i.length===0){h=c;continue}h===null&&(h=typeof i[0]=="number"?[]:Object.create(null));let p=h;for(let l=0;l<i.length-1;l++){let y=i[l],m=i[l+1];if(Array.isArray(p)&&typeof y=="number"){let b=y+1-p.length;if(b>r.limits.maxIterations-u)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(u+=Math.max(0,b);p.length<=y;)p.push(null);p[y]===null&&(p[y]=typeof m=="number"?[]:Object.create(null)),p=p[y]}else{let b=S(p);if(b){let A=String(y);if(!k(A))continue;(b[A]===null||b[A]===void 0)&&E(b,A,typeof m=="number"?[]:Object.create(null)),p=b[A]}}}let a=i[i.length-1];if(Array.isArray(p)&&typeof a=="number"){let l=a+1-p.length;if(l>r.limits.maxIterations-u)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(u+=Math.max(0,l);p.length<=a;)p.push(null);p[a]=c}else{let l=S(p);if(l){let y=String(a);k(y)&&E(l,y,c)}}}return[h]}case"truncate_stream":{let o=typeof e=="number"?Math.floor(e):0;if(t.length===0)return[];let h=[],u=s(e,t[0],r);for(let f of u)if(Array.isArray(f)){if(f.length===1&&Array.isArray(f[0])){let i=f[0];i.length>o&&h.push([i.slice(o)]);continue}if(f.length===2&&Array.isArray(f[0])){let i=f[0],c=f[1];i.length>o&&h.push([i.slice(o),c])}}return h}default:return null}}function Le(e,n){if(!Array.isArray(e))throw new Error("path must be an array");let t=n.limits.maxDepth;if(e.length>t)throw new g(`query depth limit exceeded (${t})`,"recursion");let r=n.limits.maxArrayElements,s=0;for(let o of e)if(typeof o=="number"){if(!Number.isSafeInteger(o)||o<0||o>=r)throw new g(`query array index limit exceeded (${r})`,"array_elements");let h=o+1;if(s>r-h)throw new g(`query cumulative array allocation limit exceeded (${r})`,"array_elements");s+=h}else if(typeof o!="string")throw new Error("path components must be strings or integers");return R(n,s+e.length),e}function _e(e,n,t){let r=[],s=[{value:e,path:[],isRoot:!0}];for(;s.length>0;){let o=s.pop();if(!o)break;if(R(n),o.path.length>n.limits.maxDepth)throw new g(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");if(!(o.value!==null&&typeof o.value=="object")){(t||!o.isRoot)&&(D(n,r.length),r.push(o.path));continue}!t&&!o.isRoot&&(D(n,r.length),r.push(o.path));let u=Array.isArray(o.value)?o.value.map((f,i)=>[i,f]):Object.keys(o.value).map(f=>[f,o.value[f]]);D(n,r.length,s.length+u.length);for(let f=u.length-1;f>=0;f--){let[i,c]=u[f],p=[...o.path,i];s.push({value:c,path:p,isRoot:!1})}}return r}function Ee(e,n,t,r,s,o,h,u,f,i){switch(n){case"getpath":{if(t.length===0)return[null];let c=s(e,t[0],r),p=[];for(let a of c){let l=a,y=e;for(let m of l){if(y==null){y=null;break}if(Array.isArray(y)&&typeof m=="number")y=y[m];else if(typeof m=="string"){let b=S(y);if(!b||!Object.hasOwn(b,m)){y=null;break}y=b[m]}else{y=null;break}}p.push(y)}return p}case"setpath":{if(t.length<2)return[null];let c=s(e,t[0],r),p=Le(c[0],r),l=s(e,t[1],r)[0];return[h(e,p,l)]}case"delpaths":{if(t.length===0)return[e];let p=s(e,t[0],r)[0],a=e;for(let l of p.sort((y,m)=>m.length-y.length))a=u(a,l);return[a]}case"path":{if(t.length===0)return[[]];let c=[];return i(e,t[0],r,[],c),c}case"del":return t.length===0?[e]:[f(e,t[0],r)];case"pick":{if(t.length===0)return[null];let c=[];for(let a of t)i(e,a,r,[],c);let p=null;for(let a of c){for(let y of a)if(typeof y=="number"&&y<0)throw new Error("Out of bounds negative array index");Le(a,r);let l=e;for(let y of a){if(l==null)break;if(Array.isArray(l)&&typeof y=="number")l=l[y];else if(typeof y=="string"){let m=S(l);if(!m||!Object.hasOwn(m,y)){l=null;break}l=m[y]}else{l=null;break}}p=h(p,a,l)}return[p]}case"paths":{let c=_e(e,r,!1);return t.length>0?c.filter(p=>{let a=e;for(let y of p)if(Array.isArray(a)&&typeof y=="number")a=a[y];else if(typeof y=="string"){let m=S(a);if(!m||!Object.hasOwn(m,y))return!1;a=m[y]}else return!1;return s(a,t[0],r).some(o)}):c}case"leaf_paths":return _e(e,r,!0);default:return null}}function ke(e,n,t,r,s,o){switch(n){case"IN":{if(t.length===0)return[!1];if(t.length===1){let i=s(e,t[0],r);for(let c of i)if(o(e,c))return[!0];return[!1]}let h=s(e,t[0],r),u=s(e,t[1],r),f=new Set(u.map(i=>JSON.stringify(i)));for(let i of h)if(f.has(JSON.stringify(i)))return[!0];return[!1]}case"INDEX":{if(t.length===0)return[Object.create(null)];if(t.length===1){let f=s(e,t[0],r),i=Object.create(null);for(let c of f){let p=String(c);k(p)&&E(i,p,c)}return[i]}if(t.length===2){let f=s(e,t[0],r),i=Object.create(null);for(let c of f){let p=s(c,t[1],r);if(p.length>0){let a=String(p[0]);k(a)&&E(i,a,c)}}return[i]}let h=s(e,t[0],r),u=Object.create(null);for(let f of h){let i=s(f,t[1],r),c=s(f,t[2],r);if(i.length>0&&c.length>0){let p=String(i[0]);k(p)&&E(u,p,c[0])}}return[u]}case"JOIN":{if(t.length<2)return[null];let h=S(s(e,t[0],r)[0]);if(!h)return[null];if(!Array.isArray(e))return[null];let u=[];for(let f of e){let i=s(f,t[1],r),c=i.length>0?String(i[0]):"",p=$(h,c)?h[c]:null;u.push([f,p])}return[u]}default:return null}}function Be(e){return e.limits.maxArrayElements}function $e(e){return Math.min(e.limits.maxStringLength,e.limits.maxOutputSize)}function U(e,n){let t=Be(e);if(!Number.isSafeInteger(n)||n<0||n>t)throw new g(`query result element limit exceeded (${t})`,"array_elements")}function Ze(e,n,t){if(e==="")return n===""?0:1;if(n==="")return e.length;let r=1,s=0;for(;;){let o=e.indexOf(n,s);if(o<0||(r++,r>t))return r;s=o+n.length}}function Se(e,n,t,r,s){switch(n){case"join":{if(!Array.isArray(e))return[null];let o=t.length>0?s(e,t[0],r):[""];for(let h of e)if(Array.isArray(h)||h!==null&&typeof h=="object")throw new Error("cannot join: contains arrays or objects");return U(r,o.length),o.map(h=>{let u=String(h),f=0;for(let i=0;i<e.length;i++){let c=e[i]===null?"":typeof e[i]=="string"?e[i]:String(e[i]);if(f+=M(c),i>0&&(f+=M(u)),f>$e(r))throw new g(`query string size limit exceeded (${$e(r)} bytes)`,"string_length")}return e.map(i=>i===null?"":typeof i=="string"?i:String(i)).join(u)})}case"split":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),h=String(o[0]);return U(r,Ze(e,h,Be(r))),[e.split(h)]}case"splits":{if(typeof e!="string"||t.length===0)return[];let o=s(e,t[0],r),h=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"g",f=j(h,u.includes("g")?u:`${u}g`),i=1;for(let p of f.matchAll(e))i+=Math.max(1,p.length),U(r,i);let c=f.split(e);return U(r,c.length),c}catch(u){if(u instanceof g)throw u;return[]}}case"scan":{if(typeof e!="string"||t.length===0)return[];let o=s(e,t[0],r),h=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",f=j(h,u.includes("g")?u:`${u}g`),i=[];for(let c of f.matchAll(e))U(r,i.length+1),c.length>1?(U(r,c.length-1),i.push(c.slice(1))):i.push(c[0]);return i}catch(u){if(u instanceof g)throw u;return[]}}case"test":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r),h=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"";return[j(h,u).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),h=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",i=j(h,`${u}d`).exec(e);if(!i)return[];let c=i.indices;return[{offset:i.index,length:i[0].length,string:i[0],captures:i.slice(1).map((p,a)=>({offset:c?.[a+1]?.[0]??null,length:p?.length??0,string:p??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),h=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",i=j(h,u).match(e);return!i||!i.groups?[Object.create(null)]:[i.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||t.length<2)return[null];let o=s(e,t[0],r),h=s(e,t[1],r),u=String(o[0]),f=String(h[0]);try{let i=t.length>2?String(s(e,t[2],r)[0]):"";return[j(u,i).replace(e,f)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||t.length<2)return[null];let o=s(e,t[0],r),h=s(e,t[1],r),u=String(o[0]),f=String(h[0]);try{let i=t.length>2?String(s(e,t[2],r)[0]):"g",c=i.includes("g")?i:`${i}g`;return[j(u,c).replace(e,f)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,o=>String.fromCharCode(o.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,o=>String.fromCharCode(o.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),h=String(o[0]);return[e.startsWith(h)?e.slice(h.length):e]}case"rtrimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),h=String(o[0]);return h===""?[e]:[e.endsWith(h)?e.slice(0,-h.length):e]}case"trimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),h=String(o[0]);if(h==="")return[e];let u=e;return u.startsWith(h)&&(u=u.slice(h.length)),u.endsWith(h)&&(u=u.slice(0,-h.length)),[u]}case"trim":if(typeof e=="string")return[e.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof e=="string")return[e.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof e=="string")return[e.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r);return[e.startsWith(String(o[0]))]}case"endswith":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r);return[e.endsWith(String(o[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":if(typeof e=="string"){let o=0;for(let h of e)o++,U(r,o);return[Array.from(e).map(h=>h.codePointAt(0))]}return[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(u=>{if(typeof u=="string")throw new Error(`string (${JSON.stringify(u)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof u!="number"||Number.isNaN(u))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let f=Math.trunc(u);return f<0||f>1114111||f>=55296&&f<=57343?String.fromCodePoint(65533):String.fromCodePoint(f)}).join("")];default:return null}}function Oe(e,n){switch(n){case"type":return e===null?["null"]:Array.isArray(e)?["array"]:typeof e=="boolean"?["boolean"]:typeof e=="number"?["number"]:typeof e=="string"?["string"]:typeof e=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof e=="number"&&!Number.isFinite(e)];case"isnan":return[typeof e=="number"&&Number.isNaN(e)];case"isnormal":return[typeof e=="number"&&Number.isFinite(e)&&e!==0];case"isfinite":return[typeof e=="number"&&Number.isFinite(e)];case"numbers":return typeof e=="number"?[e]:[];case"strings":return typeof e=="string"?[e]:[];case"booleans":return typeof e=="boolean"?[e]:[];case"nulls":return e===null?[e]:[];case"arrays":return Array.isArray(e)?[e]:[];case"objects":return e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"iterables":return Array.isArray(e)||e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"scalars":return!Array.isArray(e)&&!(e&&typeof e=="object")?[e]:[];case"values":return e===null?[]:[e];case"not":return e===!1||e===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}function te(e,n,t){if(n.length===0)return t;let[r,...s]=n;if(typeof r=="number"){if(e&&typeof e=="object"&&!Array.isArray(e))throw new Error("Cannot index object with number");if(r>536870911)throw new Error("Array index too large");if(r<0)throw new Error("Out of bounds negative array index");let i=Array.isArray(e)?[...e]:[];for(;i.length<=r;)i.push(null);return i[r]=te(i[r],s,t),i}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!k(r))return e??Object.create(null);let o=S(e),h=o?C(o):Object.create(null),u=Object.hasOwn(h,r)?h[r]:void 0;return E(h,r,te(u,s,t)),h}function re(e,n){if(n.length===0)return null;if(n.length===1){let s=n[0];if(Array.isArray(e)&&typeof s=="number"){let o=[...e];return o.splice(s,1),o}if(e&&typeof e=="object"&&!Array.isArray(e)){let o=String(s);if(!k(o))return e;let h=C(e);return delete h[o],h}return e}let[t,...r]=n;if(Array.isArray(e)&&typeof t=="number"){let s=[...e];return s[t]=re(s[t],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(t);if(!k(s))return e;let o=C(e);return Object.hasOwn(o,s)&&E(o,s,re(o[s],r)),o}return e}var Q=class e extends Error{label;partialResults;constructor(n,t=[]){super(`break ${n}`),this.label=n,this.partialResults=t,this.name="BreakError"}withPrependedResults(n){return new e(this.label,[...n,...this.partialResults])}},ie=class extends Error{value;constructor(n){super(typeof n=="string"?n:JSON.stringify(n)),this.value=n,this.name="JqError"}},ve=1e4,Ue=10*1024*1024,Ke=2e3,et=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]]);function F(e,n){return new g(e,n)}function R(e,n=1){if(!Number.isSafeInteger(n)||n<0||e.budget.operations>e.limits.maxIterations-n)throw F(`query evaluation: too many iterations (${e.limits.maxIterations})`,"iterations");e.budget.operations+=n}function D(e,n,t=1){let r=e.limits.maxArrayElements;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(t)||n<0||t<0||n>r-t)throw F(`query result element limit exceeded (${r})`,"array_elements")}function q(e,n,t){D(e,n.length,t.length);for(let r of t)n.push(r)}function x(e,n,t){let r=[];for(let s of n){R(e);let o=t(s);q(e,r,o)}return r}function tt(e){return{vars:new Map,limits:{maxIterations:e?.limits?.maxIterations??ve,maxDepth:e?.limits?.maxDepth??Ke,maxStringLength:e?.limits?.maxStringLength??Ue,maxOutputSize:e?.limits?.maxOutputSize??Ue,maxArrayElements:e?.limits?.maxArrayElements??1e5},env:e?.env,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1,budget:e?.budget??{operations:0,callDepth:0}}}function se(e,n,t){let r=new Map(e.vars);return r.set(n,t),{vars:r,limits:e.limits,env:e.env,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage,budget:e.budget}}function W(e,n,t){switch(n.type){case"var":return se(e,n.name,t);case"array":{if(!Array.isArray(t))return null;let r=e;for(let s=0;s<n.elements.length;s++){let o=n.elements[s],h=s<t.length?t[s]:null,u=W(r,o,h);if(u===null)return null;r=u}return r}case"object":{let r=S(t);if(!r)return null;let s=e;for(let o of n.fields){let h;if(typeof o.key=="string")h=o.key;else{let i=d(t,o.key,e);if(i.length===0)return null;h=String(i[0])}let u=$(r,h)?r[h]:null;o.keyVar&&(s=se(s,o.keyVar,u));let f=W(s,o.pattern,u);if(f===null)return null;s=f}return s}}}function rt(e,n){let t=e;for(let r of n)if(t&&typeof t=="object")if(Array.isArray(t))if(typeof r=="number")t=t[r];else return;else{let s=S(t);if(s&&typeof r=="string"&&Object.hasOwn(s,r))t=s[r];else return}else return;return t}function P(e){if(e.type==="Identity")return[];if(e.type==="Field"){let n=e.base?P(e.base):[];return n===null?null:[...n,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let n=e.base?P(e.base):[];if(n===null)return null;let t=e.index.value;return typeof t=="number"||typeof t=="string"?[...n,t]:null}if(e.type==="Pipe"){let n=P(e.left);return n===null?null:Ne(n,e.right)}if(e.type==="Call"){if(e.name==="parent"||e.name==="root")return null;if(e.name==="first"&&e.args.length===0)return[0];if(e.name==="last"&&e.args.length===0)return[-1]}return null}function Ne(e,n){if(n.type==="Call"){if(n.name==="parent"){let t=1;if(n.args.length>0&&n.args[0].type==="Literal"){let r=n.args[0].value;typeof r=="number"&&(t=r)}if(t>=0)return e.slice(0,Math.max(0,e.length-t));{let r=-t-1;return e.slice(0,Math.min(r,e.length))}}if(n.name==="root")return[]}if(n.type==="Field"){let t=P(n);if(t!==null)return[...e,...t]}if(n.type==="Index"&&n.index.type==="Literal"){let t=P(n);if(t!==null)return[...e,...t]}if(n.type==="Pipe"){let t=Ne(e,n.left);return t===null?null:Ne(t,n.right)}return n.type==="Identity"?e:null}function qe(e,n,t){if(n.type==="Comma"){let r=[];try{let s=d(e,n.left,t);q(t,r,s)}catch(s){if(s instanceof g)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{let s=d(e,n.right,t);q(t,r,s)}catch(s){if(s instanceof g)throw s;return r}return r}return d(e,n,t)}function d(e,n,t){let r=t&&"vars"in t?t:tt(t);if(r.defenseContextChecked||(Ie(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),R(r),r.budget.callDepth++,r.budget.callDepth>r.limits.maxDepth)throw r.budget.callDepth--,F(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");try{let s=nt(e,n,r);return D(r,0,s.length),s}finally{r.budget.callDepth--}}function nt(e,n,t){switch(t.coverage?.hit(`jq:node:${n.type}`),n.type){case"Identity":return[e];case"Field":{let r=n.base?d(e,n.base,t):[e];return x(t,r,s=>{let o=S(s);if(o){if(!Object.hasOwn(o,n.name))return[null];let u=o[n.name];return[u===void 0?null:u]}if(s===null)return[null];let h=Array.isArray(s)?"array":typeof s;throw new Error(`Cannot index ${h} with string "${n.name}"`)})}case"Index":{let r=n.base?d(e,n.base,t):[e];return x(t,r,s=>{let o=d(s,n.index,t);return x(t,o,h=>{if(typeof h=="number"&&Array.isArray(s)){if(Number.isNaN(h))return[null];let u=Math.trunc(h),f=u<0?s.length+u:u;return f>=0&&f<s.length?[s[f]]:[null]}if(typeof h=="string"){let u=S(s);return!u||!Object.hasOwn(u,h)?[null]:[u[h]]}return[null]})})}case"Slice":{let r=n.base?d(e,n.base,t):[e];return x(t,r,s=>{if(s===null)return[null];if(!Array.isArray(s)&&typeof s!="string")throw new Error(`Cannot slice ${typeof s} (${JSON.stringify(s)})`);let o=s.length,h=n.start?d(e,n.start,t):[0],u=n.end?d(e,n.end,t):[o];return D(t,0,h.length*u.length),x(t,h,f=>u.map(i=>{let c=f,p=i,a=Number.isNaN(c)?0:Number.isInteger(c)?c:Math.floor(c),l=Number.isNaN(p)?o:Number.isInteger(p)?p:Math.ceil(p),y=Fe(a,o),m=Fe(l,o);return Array.isArray(s),s.slice(y,m)}))})}case"Iterate":{let r=n.base?d(e,n.base,t):[e];return x(t,r,s=>Array.isArray(s)?s:s&&typeof s=="object"?Object.values(s):[])}case"Pipe":{let r=d(e,n.left,t),s=P(n.left),o=[];for(let h of r)try{if(s!==null){let u={...t,currentPath:[...t.currentPath??[],...s]},f=d(h,n.right,u);q(t,o,f)}else{let u=d(h,n.right,t);q(t,o,u)}}catch(u){throw u instanceof Q?u.withPrependedResults(o):u}return o}case"Comma":{let r=d(e,n.left,t),s=d(e,n.right,t);return D(t,r.length,s.length),[...r,...s]}case"Literal":return[n.value];case"Array":return n.elements?[d(e,n.elements,t)]:[[]];case"Object":{let r=[Object.create(null)];for(let s of n.entries){let o=typeof s.key=="string"?[s.key]:d(e,s.key,t),h=d(e,s.value,t),u=[],f=o.filter(p=>typeof p=="string"&&k(p)).length,i=f+(o.length-f),c=r.length*i*h.length;D(t,0,c);for(let p of r)for(let a of o){if(typeof a!="string"){let l=a===null?"null":Array.isArray(a)?"array":typeof a;throw new Error(`Cannot use ${l} (${JSON.stringify(a)}) as object key`)}if(!k(a)){for(let l of h)u.push(C(p));continue}for(let l of h){let y=C(p);E(y,a,l),u.push(y)}}r.length=0,q(t,r,u)}return r}case"Paren":return d(e,n.expr,t);case"BinaryOp":return ot(e,n.op,n.left,n.right,t);case"UnaryOp":return d(e,n.operand,t).map(s=>{if(n.op==="-"){if(typeof s=="number")return-s;if(typeof s=="string"){let o=h=>h.length>5?`"${h.slice(0,3)}...`:JSON.stringify(h);throw new Error(`string (${o(s)}) cannot be negated`)}return null}return n.op==="not"?!I(s):null});case"Cond":{let r=d(e,n.cond,t);return x(t,r,s=>{if(I(s))return d(e,n.then,t);for(let o of n.elifs)if(d(e,o.cond,t).some(I))return d(e,o.then,t);return n.else?d(e,n.else,t):[e]})}case"Try":try{return d(e,n.body,t)}catch(r){if(r instanceof g)throw r;if(n.catch){let s=r instanceof ie?r.value:r instanceof Error?r.message:String(r);return d(s,n.catch,t)}return[]}case"Call":return Je(e,n.name,n.args,t);case"VarBind":{let r=d(e,n.value,t);return x(t,r,s=>{let o=null,h=[];if(n.pattern?h.push(n.pattern):n.name&&h.push({type:"var",name:n.name}),n.alternatives)for(let u of n.alternatives)h.push(u);for(let u of h)if(o=W(t,u,s),o!==null)break;return o===null?[]:d(e,n.body,o)})}case"VarRef":{if(n.name==="$ENV")return[t.env?ue(t.env):Object.create(null)];let r=t.vars.get(n.name);return r!==void 0?[r]:[null]}case"Recurse":{let r=[],s=new WeakSet,o=[{val:e,depth:0}];for(;o.length>0;){let h=o.pop();if(!h)break;let{val:u,depth:f}=h;if(R(t),f>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");if(u&&typeof u=="object"){if(s.has(u))continue;s.add(u)}if(D(t,r.length),r.push(u),Array.isArray(u))for(let i=u.length-1;i>=0;i--)o.push({val:u[i],depth:f+1});else if(u&&typeof u=="object"){let i=Object.keys(u);for(let c=i.length-1;c>=0;c--)o.push({val:u[i[c]],depth:f+1})}}return r}case"Optional":try{return d(e,n.expr,t)}catch(r){if(r instanceof g)throw r;return[]}case"StringInterp":{let r=new G(t.limits.maxStringLength,"query string interpolation",()=>new g(`string size limit exceeded (${t.limits.maxStringLength} bytes)`,"string_length"));for(let s of n.parts){if(typeof s=="string"){r.append(s);continue}let o=d(e,s,t);for(let h of o){if(R(t),B(h,t.limits.maxDepth+1)>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");r.append(typeof h=="string"?h:JSON.stringify(h))}}return[r.build()]}case"UpdateOp":return[it(e,n.path,n.op,n.value,t)];case"Reduce":{let r=d(e,n.expr,t),s=d(e,n.init,t)[0],o=t.limits.maxDepth??Ke;for(let h of r){let u;if(n.pattern){if(u=W(t,n.pattern,h),u===null)continue}else u=se(t,n.varName,h);if(s=d(s,n.update,u)[0],B(s,o+1)>o)return[null]}return[s]}case"Foreach":{let r=d(e,n.expr,t),s=d(e,n.init,t)[0],o=[];for(let h of r)try{let u;if(n.pattern){if(u=W(t,n.pattern,h),u===null)continue}else u=se(t,n.varName,h);if(s=d(s,n.update,u)[0],n.extract){let f=d(s,n.extract,u);q(t,o,f)}else D(t,o.length),o.push(s)}catch(u){throw u instanceof Q?u.withPrependedResults(o):u}return o}case"Label":try{return d(e,n.body,{...t,labels:new Set([...t.labels??[],n.name])})}catch(r){if(r instanceof Q&&r.label===n.name)return r.partialResults;throw r}case"Break":throw new Q(n.name);case"Def":{let r=new Map(t.funcs??[]),s=`${n.name}/${n.params.length}`;r.set(s,{params:n.params,body:n.funcBody,closure:new Map(t.funcs??[])});let o={...t,funcs:r};return d(e,n.body,o)}default:{let r=n;throw new Error(`Unknown AST node type: ${r.type}`)}}}function Fe(e,n){return e<0?Math.max(0,n+e):Math.min(e,n)}function it(e,n,t,r,s){function o(f,i){switch(t){case"=":return i;case"|=":return d(f,r,s)[0]??null;case"+=":return typeof f=="number"&&typeof i=="number"||typeof f=="string"&&typeof i=="string"?f+i:Array.isArray(f)&&Array.isArray(i)?(D(s,f.length,i.length),[...f,...i]):f&&i&&typeof f=="object"&&typeof i=="object"?ce(f,i):i;case"-=":return typeof f=="number"&&typeof i=="number"?f-i:f;case"*=":return typeof f=="number"&&typeof i=="number"?f*i:f;case"/=":return typeof f=="number"&&typeof i=="number"?f/i:f;case"%=":return typeof f=="number"&&typeof i=="number"?f%i:f;case"//=":return f===null||f===!1?i:f;default:return i}}function h(f,i,c){switch(i.type){case"Identity":return c(f);case"Field":{if(!k(i.name))return f;if(i.base)return h(f,i.base,p=>{if(p&&typeof p=="object"&&!Array.isArray(p)){let a=C(p),l=Object.hasOwn(a,i.name)?a[i.name]:void 0;return E(a,i.name,c(l)),a}return p});if(f&&typeof f=="object"&&!Array.isArray(f)){let p=C(f),a=Object.hasOwn(p,i.name)?p[i.name]:void 0;return E(p,i.name,c(a)),p}return f}case"Index":{let a=d(e,i.index,s)[0];if(typeof a=="number"&&Number.isNaN(a))throw new Error("Cannot set array element at NaN index");if(typeof a=="number"&&!Number.isFinite(a))throw new Error("array index must be finite");if(typeof a=="number"&&!Number.isInteger(a)&&(a=Math.trunc(a)),i.base)return h(f,i.base,l=>{if(typeof a=="number"&&Array.isArray(l)){let y=[...l],m=a<0?y.length+a:a;if(m>=0){D(s,0,m+1),y.length<=m&&(y.length=m+1);for(let b=l.length;b<m;b++)y[b]=null;y[m]=c(y[m])}return y}if(typeof a=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!k(a))return l;let y=C(l),m=Object.hasOwn(y,a)?y[a]:void 0;return E(y,a,c(m)),y}return l});if(typeof a=="number"){if(!Number.isSafeInteger(a)||a>536870911)throw new Error("Array index too large");if(a<0&&(!f||!Array.isArray(f)))throw new Error("Out of bounds negative array index");if(Array.isArray(f)){let y=[...f],m=a<0?y.length+a:a;if(m>=0){D(s,0,m+1),y.length<=m&&(y.length=m+1);for(let b=f.length;b<m;b++)y[b]=null;y[m]=c(y[m])}return y}if(f==null){D(s,0,a+1);let y=new Array(a+1).fill(null);return y[a]=c(null),y}return f}if(typeof a=="string"&&f&&typeof f=="object"&&!Array.isArray(f)){if(!k(a))return f;let l=C(f),y=Object.hasOwn(l,a)?l[a]:void 0;return E(l,a,c(y)),l}return f}case"Iterate":{let p=a=>{if(Array.isArray(a)){D(s,0,a.length);let l=[];for(let y of a)R(s),l.push(c(y));return l}if(a&&typeof a=="object"){let l=Object.create(null);for(let[y,m]of Object.entries(a))k(y)&&E(l,y,c(m));return l}return a};return i.base?h(f,i.base,p):p(f)}case"Pipe":{let p=h(f,i.left,a=>a);return h(p,i.right,c)}default:return c(f)}}return h(e,n,f=>{if(t==="|=")return o(f,f);let i=d(e,r,s);return o(f,i[0]??null)})}function st(e,n,t){function r(o,h,u){switch(h.type){case"Identity":return u;case"Field":{if(!k(h.name))return o;if(h.base){let f=d(o,h.base,t)[0],i=r(f,{type:"Field",name:h.name},u);return r(o,h.base,i)}if(o&&typeof o=="object"&&!Array.isArray(o)){let f=C(o);return E(f,h.name,u),f}return o}case"Index":{if(h.base){let c=d(o,h.base,t)[0],p=r(c,{type:"Index",index:h.index},u);return r(o,h.base,p)}let i=d(e,h.index,t)[0];if(typeof i=="number"&&Array.isArray(o)){let c=[...o],p=i<0?c.length+i:i;return p>=0&&p<c.length&&(c[p]=u),c}if(typeof i=="string"&&o&&typeof o=="object"&&!Array.isArray(o)){if(!k(i))return o;let c=C(o);return E(c,i,u),c}return o}default:return o}}function s(o,h){switch(h.type){case"Identity":return null;case"Field":{if(!k(h.name))return o;if(h.base){let f=d(o,h.base,t)[0];if(f==null)return o;let i=s(f,{type:"Field",name:h.name});return r(o,h.base,i)}if(o&&typeof o=="object"&&!Array.isArray(o)){if(!k(h.name))return o;let f=C(o);return delete f[h.name],f}return o}case"Index":{if(h.base){let c=d(o,h.base,t)[0];if(c==null)return o;let p=s(c,{type:"Index",index:h.index});return r(o,h.base,p)}let i=d(e,h.index,t)[0];if(typeof i=="number"&&Array.isArray(o)){let c=[...o],p=i<0?c.length+i:i;return p>=0&&p<c.length&&c.splice(p,1),c}if(typeof i=="string"&&o&&typeof o=="object"&&!Array.isArray(o)){if(!k(i))return o;let c=C(o);return delete c[i],c}return o}case"Iterate":return Array.isArray(o)?[]:o&&typeof o=="object"?Object.create(null):o;case"Pipe":{let c=function(l,y,m){switch(y.type){case"Identity":return m;case"Field":{if(!k(y.name))return l;if(l&&typeof l=="object"&&!Array.isArray(l)){let b=C(l);return E(b,y.name,m),b}return l}case"Index":{let A=d(e,y.index,t)[0];if(typeof A=="number"&&Array.isArray(l)){let w=[...l],N=A<0?w.length+A:A;return N>=0&&N<w.length&&(w[N]=m),w}if(typeof A=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!k(A))return l;let w=C(l);return E(w,A,m),w}return l}case"Pipe":{let b=d(l,y.left,t)[0],A=c(b,y.right,m);return c(l,y.left,A)}default:return l}};var u=c;let f=h.left,i=h.right,p=d(o,f,t)[0];if(p==null)return o;let a=s(p,i);return c(o,f,a)}default:return o}}return s(e,n)}function ot(e,n,t,r,s){if(n==="and"){let f=d(e,t,s);return x(s,f,i=>{if(!I(i))return[!1];let c=d(e,r,s);return x(s,c,p=>[I(p)])})}if(n==="or"){let f=d(e,t,s);return x(s,f,i=>{if(I(i))return[!0];let c=d(e,r,s);return x(s,c,p=>[I(p)])})}if(n==="//"){let i=d(e,t,s).filter(c=>c!=null&&c!==!1);return i.length>0?i:d(e,r,s)}let o=d(e,t,s),h=d(e,r,s),u=o.length*h.length;return D(s,0,u),R(s,u),o.flatMap(f=>h.map(i=>{switch(n){case"+":if(f===null)return i;if(i===null)return f;if(typeof f=="number"&&typeof i=="number")return f+i;if(typeof f=="string"&&typeof i=="string"){let c=s.limits.maxStringLength;if(M(f)+M(i)>c)throw new g(`string size limit exceeded (${c} bytes)`,"string_length");return f+i}return Array.isArray(f)&&Array.isArray(i)?(D(s,f.length,i.length),[...f,...i]):f&&i&&typeof f=="object"&&typeof i=="object"&&!Array.isArray(f)&&!Array.isArray(i)?ce(f,i):null;case"-":if(typeof f=="number"&&typeof i=="number")return f-i;if(Array.isArray(f)&&Array.isArray(i)){let c=new Set(i.map(p=>JSON.stringify(p)));return f.filter(p=>!c.has(JSON.stringify(p)))}if(typeof f=="string"&&typeof i=="string"){let c=p=>p.length>10?`"${p.slice(0,10)}...`:JSON.stringify(p);throw new Error(`string (${c(f)}) and string (${c(i)}) cannot be subtracted`)}return null;case"*":if(typeof f=="number"&&typeof i=="number")return f*i;if(typeof f=="string"&&typeof i=="number"){if(!Number.isFinite(i))throw new Error(`invalid string repetition count: ${i}`);let c=Math.trunc(i);if(c<0)return null;let p=M(f),a=s.limits.maxStringLength;if(p>0&&c>Math.floor(a/p))throw new g(`string size limit exceeded (${a} bytes)`,"string_length");return f.repeat(c)}{let c=S(f),p=S(i);if(c&&p)return Me(c,p,{maxDepth:s.limits.maxDepth,visit:()=>R(s)})}return null;case"/":if(typeof f=="number"&&typeof i=="number"){if(i===0)throw new Error(`number (${f}) and number (${i}) cannot be divided because the divisor is zero`);return f/i}return typeof f=="string"&&typeof i=="string"?f.split(i):null;case"%":if(typeof f=="number"&&typeof i=="number"){if(i===0)throw new Error(`number (${f}) and number (${i}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(f)&&!Number.isNaN(f)?!Number.isFinite(i)&&!Number.isNaN(i)&&f<0&&i>0?-1:0:f%i}return null;case"==":return J(f,i);case"!=":return!J(f,i);case"<":return Y(f,i)<0;case"<=":return Y(f,i)<=0;case">":return Y(f,i)>0;case">=":return Y(f,i)>=0;default:return null}}))}function Je(e,n,t,r){let s=et.get(n);if(s)return typeof e=="number"?[s(e)]:[null];let o=de(e,n,t,r,d);if(o!==null)return o;let h=Se(e,n,t,r,d);if(h!==null)return h;let u=le(e,n,t,r,d);if(u!==null)return u;let f=ye(e,n,r.limits.maxDepth);if(f!==null)return f;let i=Oe(e,n);if(i!==null)return i;let c=we(e,n,t,r,d);if(c!==null)return c;let p=he(e,n,t,r,d,qe,Z,I,v,g);if(p!==null)return p;let a=Ee(e,n,t,r,d,I,te,re,st,ne);if(a!==null)return a;let l=me(e,n,t,r,d,J);if(l!==null)return l;let y=pe(e,n,t,r,d,qe,I,g);if(y!==null)return y;let m=be(e,n,t,r,d,I,rt,Je);if(m!==null)return m;let b=ke(e,n,t,r,d,J);if(b!==null)return b;switch(n){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let A=t.length>0?d(e,t[0],r)[0]:e;throw new ie(A)}case"env":return[r.env?ue(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let A=`${n}/${t.length}`,w=r.funcs?.get(A);if(w){let N=w.closure??r.funcs??new Map,O=new Map(N);O.set(A,w);for(let X=0;X<w.params.length;X++){let Ye=w.params[X],Re=t[X];if(Re){let _=d(e,Re,r),K;if(_.length===0)K={type:"Call",name:"empty",args:[]};else if(_.length===1)K={type:"Literal",value:_[0]};else{K={type:"Literal",value:_[_.length-1]};for(let fe=_.length-2;fe>=0;fe--)K={type:"Comma",left:{type:"Literal",value:_[fe]},right:K}}O.set(`${Ye}/0`,{params:[],body:K})}}let L={...r,funcs:O};return d(e,w.body,L)}throw new Error(`Unknown function: ${n}`)}}}function ne(e,n,t,r,s){if(R(t),r.length>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");let o=f=>{if(f.length>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");D(t,s.length),s.push(f)};if(n.type==="Comma"){let f=n;ne(e,f.left,t,r,s),ne(e,f.right,t,r,s);return}let h=P(n);if(h!==null){o([...r,...h]);return}if(n.type==="Iterate"){if(Array.isArray(e))for(let f=0;f<e.length;f++)R(t),o([...r,f]);else if(e&&typeof e=="object")for(let f of Object.keys(e))R(t),o([...r,f]);return}if(n.type==="Recurse"){let f=[{value:e,path:[]}];for(;f.length>0;){let i=f.pop();if(!i)break;if(R(t),o([...r,...i.path]),i.value&&typeof i.value=="object"){let c=Array.isArray(i.value)?i.value.map((p,a)=>[a,p]):Object.keys(i.value).map(p=>[p,i.value[p]]);D(t,0,f.length+c.length);for(let p=c.length-1;p>=0;p--){let[a,l]=c[p];f.push({value:l,path:[...i.path,a]})}}}return}if(n.type==="Pipe"){let f=P(n.left);if(f!==null){let i=d(e,n.left,t);for(let c of i)ne(c,n.right,t,[...r,...f],s);return}}d(e,n,t).length>0&&o(r)}var Ve=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]),oe=new Set(Ve.values());function He(e){let n=[],t=0,r=(i=0)=>e[t+i],s=()=>e[t++],o=()=>t>=e.length,h=i=>i>="0"&&i<="9",u=i=>i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="_",f=i=>u(i)||h(i);for(;!o();){let i=t,c=s();if(!(c===" "||c===" "||c===`
|
|
4
|
+
`||c==="\r")){if(c==="#"){for(;!o()&&r()!==`
|
|
5
|
+
`;)s();continue}if(c==="."&&r()==="."){s(),n.push({type:"DOTDOT",pos:i});continue}if(c==="="&&r()==="="){s(),n.push({type:"EQ",pos:i});continue}if(c==="!"&&r()==="="){s(),n.push({type:"NE",pos:i});continue}if(c==="<"&&r()==="="){s(),n.push({type:"LE",pos:i});continue}if(c===">"&&r()==="="){s(),n.push({type:"GE",pos:i});continue}if(c==="/"&&r()==="/"){s(),r()==="="?(s(),n.push({type:"UPDATE_ALT",pos:i})):n.push({type:"ALT",pos:i});continue}if(c==="+"&&r()==="="){s(),n.push({type:"UPDATE_ADD",pos:i});continue}if(c==="-"&&r()==="="){s(),n.push({type:"UPDATE_SUB",pos:i});continue}if(c==="*"&&r()==="="){s(),n.push({type:"UPDATE_MUL",pos:i});continue}if(c==="/"&&r()==="="){s(),n.push({type:"UPDATE_DIV",pos:i});continue}if(c==="%"&&r()==="="){s(),n.push({type:"UPDATE_MOD",pos:i});continue}if(c==="="&&r()!=="="){n.push({type:"ASSIGN",pos:i});continue}if(c==="."){n.push({type:"DOT",pos:i});continue}if(c==="|"){r()==="="?(s(),n.push({type:"UPDATE_PIPE",pos:i})):n.push({type:"PIPE",pos:i});continue}if(c===","){n.push({type:"COMMA",pos:i});continue}if(c===":"){n.push({type:"COLON",pos:i});continue}if(c===";"){n.push({type:"SEMICOLON",pos:i});continue}if(c==="("){n.push({type:"LPAREN",pos:i});continue}if(c===")"){n.push({type:"RPAREN",pos:i});continue}if(c==="["){n.push({type:"LBRACKET",pos:i});continue}if(c==="]"){n.push({type:"RBRACKET",pos:i});continue}if(c==="{"){n.push({type:"LBRACE",pos:i});continue}if(c==="}"){n.push({type:"RBRACE",pos:i});continue}if(c==="?"){n.push({type:"QUESTION",pos:i});continue}if(c==="+"){n.push({type:"PLUS",pos:i});continue}if(c==="-"){n.push({type:"MINUS",pos:i});continue}if(c==="*"){n.push({type:"STAR",pos:i});continue}if(c==="/"){n.push({type:"SLASH",pos:i});continue}if(c==="%"){n.push({type:"PERCENT",pos:i});continue}if(c==="<"){n.push({type:"LT",pos:i});continue}if(c===">"){n.push({type:"GT",pos:i});continue}if(h(c)){let p=c;for(;!o()&&(h(r())||r()==="."||r()==="e"||r()==="E");)(r()==="e"||r()==="E")&&(e[t+1]==="+"||e[t+1]==="-")&&(p+=s()),p+=s();n.push({type:"NUMBER",value:Number(p),pos:i});continue}if(c==='"'){let p="",a=0;for(;!o();){let l=r();if(a===0&&l==='"')break;if(a===0&&l==="\\"){if(s(),o())break;let y=s();switch(y){case"n":p+=`
|
|
6
|
+
`;break;case"r":p+="\r";break;case"t":p+=" ";break;case"\\":p+="\\";break;case'"':p+='"';break;case"(":p+="\\(",a=1;break;default:p+=y}continue}if(a>0){if(l==='"'){for(p+=s();!o();){let y=r();if(y==="\\"){p+=s(),o()||(p+=s());continue}if(p+=s(),y==='"')break}continue}l==="("?a++:l===")"&&a--,p+=s();continue}p+=s()}o()||s(),n.push({type:"STRING",value:p,pos:i});continue}if(u(c)||c==="$"||c==="@"){let p=c;for(;!o()&&f(r());)p+=s();let a=Ve.get(p);a?n.push({type:a,value:p,pos:i}):n.push({type:"IDENT",value:p,pos:i});continue}throw new Error(`Unexpected character '${c}' at position ${i}`)}}return n.push({type:"EOF",pos:t}),n}var Ce=class e{maxDepth;tokens;pos=0;depth;constructor(n,t,r=0){this.maxDepth=t,this.tokens=n,this.depth=r}peek(n=0){return this.tokens[this.pos+n]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(n){return this.peek().type===n}match(...n){for(let t of n)if(this.check(t))return this.advance();return null}expect(n,t){if(!this.check(n))throw new Error(`${t} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}withDepth(n){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return n()}finally{this.depth--}}isFieldNameAfterDot(n=0){let t=this.peek(n),r=this.peek(n+1);return r.type==="STRING"?!0:r.type==="IDENT"||oe.has(r.type)?r.pos===t.pos+1:!1}isIdentLike(){let n=this.peek().type;return n==="IDENT"||oe.has(n)}consumeFieldNameAfterDot(n){let t=this.peek();return t.type==="STRING"?this.advance().value:(t.type==="IDENT"||oe.has(t.type))&&t.pos===n.pos+1?this.advance().value:null}parse(){let n=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return n}parseExpr(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePipe()}finally{this.depth--}}parsePattern(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePatternInner()}finally{this.depth--}}parsePatternInner(){if(this.match("LBRACKET")){let r=[];if(!this.check("RBRACKET"))for(r.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)r.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:r}}if(this.match("LBRACE")){let r=[];if(!this.check("RBRACE"))for(r.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)r.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:r}}let n=this.expect("IDENT","Expected variable name in pattern"),t=n.value;if(!t.startsWith("$"))throw new Error(`Variable name must start with $ at position ${n.pos}`);return{type:"var",name:t}}parsePatternField(){if(this.match("LPAREN")){let t=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let r=this.parsePattern();return{key:t,pattern:r}}let n=this.peek();if(n.type==="IDENT"||oe.has(n.type)){let t=n.value;if(t.startsWith("$")){if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:t.slice(1),pattern:r,keyVar:t}}return{key:t.slice(1),pattern:{type:"var",name:t}}}if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:t,pattern:r}}return{key:t,pattern:{type:"var",name:`$${t}`}}}throw new Error(`Expected field name in object pattern at position ${n.pos}`)}parsePipe(){let n=this.parseComma();for(;this.match("PIPE");){let t=this.parseComma();n={type:"Pipe",left:n,right:t}}return n}parseComma(){let n=this.parseVarBind();for(;this.match("COMMA");){let t=this.parseVarBind();n={type:"Comma",left:n,right:t}}return n}parseVarBind(){let n=this.parseUpdate();if(this.match("AS")){let t=this.parsePattern(),r=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),r.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let s=this.parseExpr();return t.type==="var"&&r.length===0?{type:"VarBind",name:t.name,value:n,body:s}:{type:"VarBind",name:t.type==="var"?t.name:"",value:n,body:s,pattern:t.type!=="var"?t:void 0,alternatives:r.length>0?r:void 0}}return n}peekAhead(n){let t=this.pos+n;return t<this.tokens.length?this.tokens[t]:void 0}parseUpdate(){let n=this.parseAlt(),t=new Map([["ASSIGN","="],["UPDATE_ADD","+="],["UPDATE_SUB","-="],["UPDATE_MUL","*="],["UPDATE_DIV","/="],["UPDATE_MOD","%="],["UPDATE_ALT","//="],["UPDATE_PIPE","|="]]),r=this.match("ASSIGN","UPDATE_ADD","UPDATE_SUB","UPDATE_MUL","UPDATE_DIV","UPDATE_MOD","UPDATE_ALT","UPDATE_PIPE");if(r){let s=this.withDepth(()=>this.parseVarBind()),o=t.get(r.type);if(o)return{type:"UpdateOp",op:o,path:n,value:s}}return n}parseAlt(){let n=this.parseOr();for(;this.match("ALT");){let t=this.parseOr();n={type:"BinaryOp",op:"//",left:n,right:t}}return n}parseOr(){let n=this.parseAnd();for(;this.match("OR");){let t=this.parseAnd();n={type:"BinaryOp",op:"or",left:n,right:t}}return n}parseAnd(){let n=this.parseNot();for(;this.match("AND");){let t=this.parseNot();n={type:"BinaryOp",op:"and",left:n,right:t}}return n}parseNot(){return this.parseComparison()}parseComparison(){let n=this.parseAddSub(),t=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),r=this.match("EQ","NE","LT","LE","GT","GE");if(r){let s=t.get(r.type);if(s){let o=this.parseAddSub();n={type:"BinaryOp",op:s,left:n,right:o}}}return n}parseAddSub(){let n=this.parseMulDiv();for(;;)if(this.match("PLUS")){let t=this.parseMulDiv();n={type:"BinaryOp",op:"+",left:n,right:t}}else if(this.match("MINUS")){let t=this.parseMulDiv();n={type:"BinaryOp",op:"-",left:n,right:t}}else break;return n}parseMulDiv(){let n=this.parseUnary();for(;;)if(this.match("STAR")){let t=this.parseUnary();n={type:"BinaryOp",op:"*",left:n,right:t}}else if(this.match("SLASH")){let t=this.parseUnary();n={type:"BinaryOp",op:"/",left:n,right:t}}else if(this.match("PERCENT")){let t=this.parseUnary();n={type:"BinaryOp",op:"%",left:n,right:t}}else break;return n}parseUnary(){let n=0;for(;this.match("MINUS");)if(n++,this.depth+n>this.maxDepth)throw new Error(`query parse depth limit exceeded (${this.maxDepth})`);let t=this.parsePostfix();for(;n-- >0;)t={type:"UnaryOp",op:"-",operand:t};return t}parsePostfix(){let n=this.parsePrimary();for(;;)if(this.match("QUESTION"))n={type:"Optional",expr:n};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),n={type:"Field",name:this.advance().value,base:n};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))n={type:"Iterate",base:n};else if(this.check("COLON")){this.advance();let t=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),n={type:"Slice",end:t,base:n}}else{let t=this.parseExpr();if(this.match("COLON")){let r=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),n={type:"Slice",start:t,end:r,base:n}}else this.expect("RBRACKET","Expected ']'"),n={type:"Index",index:t,base:n}}else break;return n}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let n=this.advance();if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:s}}let r=this.parseExpr();if(this.match("COLON")){let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:r,end:s}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:r}}let t=this.consumeFieldNameAfterDot(n);return t!==null?{type:"Field",name:t}:{type:"Identity"}}if(this.match("TRUE"))return{type:"Literal",value:!0};if(this.match("FALSE"))return{type:"Literal",value:!1};if(this.match("NULL"))return{type:"Literal",value:null};if(this.check("NUMBER"))return{type:"Literal",value:this.advance().value};if(this.check("STRING")){let t=this.advance().value;return t.includes("\\(")?this.parseStringInterpolation(t):{type:"Literal",value:t}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let n=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:n}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let n=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:n}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let n=this.withDepth(()=>this.parsePostfix()),t;return this.match("CATCH")&&(t=this.withDepth(()=>this.parsePostfix())),{type:"Try",body:n,catch:t}}if(this.match("REDUCE")){let n=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let t=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let o=t.type==="var"?t.name:"";return{type:"Reduce",expr:n,varName:o,init:r,update:s,pattern:t.type!=="var"?t:void 0}}if(this.match("FOREACH")){let n=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let t=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr(),o;this.match("SEMICOLON")&&(o=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let h=t.type==="var"?t.name:"";return{type:"Foreach",expr:n,varName:h,init:r,update:s,extract:o,pattern:t.type!=="var"?t:void 0}}if(this.match("LABEL")){let n=this.expect("IDENT","Expected label name (e.g., $out)"),t=n.value;if(!t.startsWith("$"))throw new Error(`Label name must start with $ at position ${n.pos}`);this.expect("PIPE","Expected '|' after label name");let r=this.parseExpr();return{type:"Label",name:t,body:r}}if(this.match("BREAK")){let n=this.expect("IDENT","Expected label name to break to"),t=n.value;if(!t.startsWith("$"))throw new Error(`Break label must start with $ at position ${n.pos}`);return{type:"Break",name:t}}if(this.match("DEF")){let t=this.expect("IDENT","Expected function name after def").value,r=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let h=this.expect("IDENT","Expected parameter name");for(r.push(h.value);this.match("SEMICOLON");){let u=this.expect("IDENT","Expected parameter name");r.push(u.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let s=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let o=this.parseExpr();return{type:"Def",name:t,params:r,funcBody:s,body:o}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let t=this.advance().value;if(t.startsWith("$"))return{type:"VarRef",name:t};if(this.match("LPAREN")){let r=[];if(!this.check("RPAREN"))for(r.push(this.parseExpr());this.match("SEMICOLON");)r.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:t,args:r}}return{type:"Call",name:t,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parseObjectConstructionInner()}finally{this.depth--}}parseObjectConstructionInner(){let n=[];if(!this.check("RBRACE"))do{let t,r;if(this.match("LPAREN"))t=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else if(this.isIdentLike()){let s=this.advance().value;this.match("COLON")?(t=s,r=this.parseObjectValue()):(t=s,r={type:"Field",name:s})}else if(this.check("STRING"))t=this.advance().value,this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);n.push({key:t,value:r})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:n}}parseObjectValue(){let n=this.parseVarBind();for(;this.match("PIPE");){let t=this.parseVarBind();n={type:"Pipe",left:n,right:t}}return n}parseIf(){let n=this.parseExpr();this.expect("THEN","Expected 'then'");let t=this.parseExpr(),r=[];for(;this.match("ELIF");){let o=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let h=this.parseExpr();r.push({cond:o,then:h})}let s;return this.match("ELSE")&&(s=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:n,then:t,elifs:r,else:s}}parseStringInterpolation(n){let t=[],r="",s=0;for(;s<n.length;)if(n[s]==="\\"&&n[s+1]==="("){r&&(t.push(r),r=""),s+=2;let o=1,h="";for(;s<n.length&&o>0;){let i=n[s];if(i==='"'){for(h+=i,s++;s<n.length;){let c=n[s];if(c==="\\"){h+=c,s++,s<n.length&&(h+=n[s],s++);continue}if(h+=c,s++,c==='"')break}continue}i==="("?o++:i===")"&&o--,o>0&&(h+=i),s++}let u=He(h),f=new e(u,this.maxDepth,this.depth);t.push(f.parse())}else r+=n[s],s++;return r&&t.push(r),{type:"StringInterp",parts:t}}};function hr(e,n={}){let t=n.maxDepth??256,r=n.maxTokens??1e5,s=n.maxSourceLength??1048576;if(e.length>s)throw new Error(`query source length limit exceeded (${s} characters)`);if(e.length+1>r)throw new Error(`query token limit exceeded (${r})`);let o=He(e);return new Ce(o,t).parse()}function gr(e,n,t={}){let r=new G(n,"query JSON output",()=>new g(`output size limit exceeded (${n} bytes)`,t.limitKind??"output_size"));return De(r,e,t,0),r.build()}function De(e,n,t,r){if(n==null){e.append("null");return}if(typeof n=="boolean"){e.append(String(n));return}if(typeof n=="number"){e.append(Number.isFinite(n)?String(n):"null");return}if(typeof n=="string"){t.raw&&r===0?e.append(n):Qe(e,n);return}let s=t.compact??!1,o=t.indent??2,h=t.useTab?" ":" ".repeat(o);if(Array.isArray(n)){e.append("[");for(let f=0;f<n.length;f++)e.append(s?f===0?"":",":f===0?`
|
|
7
|
+
`:`,
|
|
8
|
+
`),s||e.repeat(h,r+1),De(e,n[f],t,r+1);!s&&n.length>0&&e.append(`
|
|
9
|
+
`).repeat(h,r),e.append("]");return}let u=Object.keys(n);t.sortKeys&&(u=u.sort()),e.append("{");for(let f=0;f<u.length;f++){let i=u[f];e.append(s?f===0?"":",":f===0?`
|
|
10
|
+
`:`,
|
|
11
|
+
`),s||e.repeat(h,r+1),Qe(e,i),e.append(s?":":": "),De(e,n[i],t,r+1)}!s&&u.length>0&&e.append(`
|
|
12
|
+
`).repeat(h,r),e.append("}")}function Qe(e,n){e.append('"');let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r),o="";s===34?o='\\"':s===92?o="\\\\":s===8?o="\\b":s===9?o="\\t":s===10?o="\\n":s===12?o="\\f":s===13?o="\\r":s<32&&(o=`\\u${s.toString(16).padStart(4,"0")}`),o&&(e.append(n.slice(t,r)).append(o),t=r+1)}e.append(n.slice(t)).append('"')}export{B as a,d as b,hr as c,gr as d};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{l as r}from"./chunk-EFORKKSH.js";import{a as c}from"./chunk-GN6CQ3J4.js";var f=10*1024*1024;function h(t,a,n){let e=n==="width"?Math.abs(t):t;if(!Number.isFinite(t)||!Number.isSafeInteger(t)||e<0||e>a)throw new r(`format ${n} limit exceeded (${a} bytes)`,"string_length")}function b(t,a,n,e=f){h(a,e,"width"),n!==-1&&h(n,e,"precision");let s=t;n>=0&&s.length>n&&(s=s.slice(0,n));let l=Math.abs(a);if(l>s.length){if(c(s)+l-s.length>e)throw new r(`formatted value size limit exceeded (${e} bytes)`,"string_length");a<0?s=s.padEnd(l," "):s=s.padStart(l," ")}if(c(s)>e)throw new r(`formatted value size limit exceeded (${e} bytes)`,"string_length");return s}function p(t,a,n=f){let e=a,s=0,l=-1,i=!1;for(e<t.length&&t[e]==="-"&&(i=!0,e++);e<t.length&&/\d/.test(t[e]);)s=s*10+parseInt(t[e],10),e++;if(e<t.length&&t[e]===".")for(e++,l=0;e<t.length&&/\d/.test(t[e]);)l=l*10+parseInt(t[e],10),e++;return i&&s>0&&(s=-s),h(s,n,"width"),l!==-1&&h(l,n,"precision"),[s,l,e-a]}function u(t,a=f){if(c(t)>a)throw new r(`escaped string size limit exceeded (${a} bytes)`,"string_length");let n="",e=0;for(;e<t.length;)if(t[e]==="\\"&&e+1<t.length)switch(t[e+1]){case"n":n+=`
|
|
3
|
+
`,e+=2;break;case"t":n+=" ",e+=2;break;case"r":n+="\r",e+=2;break;case"\\":n+="\\",e+=2;break;case"a":n+="\x07",e+=2;break;case"b":n+="\b",e+=2;break;case"f":n+="\f",e+=2;break;case"v":n+="\v",e+=2;break;case"e":case"E":n+="\x1B",e+=2;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let l="",i=e+1;for(;i<t.length&&i<e+4&&/[0-7]/.test(t[i]);)l+=t[i],i++;n+=String.fromCharCode(parseInt(l,8)),e=i;break}case"x":{let l=[],i=e;for(;i+3<t.length&&t[i]==="\\"&&t[i+1]==="x"&&/[0-9a-fA-F]{2}/.test(t.slice(i+2,i+4));)l.push(parseInt(t.slice(i+2,i+4),16)),i+=4;if(l.length>0){try{let o=new TextDecoder("utf-8",{fatal:!0});n+=o.decode(new Uint8Array(l))}catch{for(let o of l)n+=String.fromCharCode(o)}e=i}else n+=t[e],e++;break}case"u":{let l="",i=e+2;for(;i<t.length&&i<e+6&&/[0-9a-fA-F]/.test(t[i]);)l+=t[i],i++;l?(n+=String.fromCodePoint(parseInt(l,16)),e=i):(n+="\\u",e+=2);break}case"U":{let l="",i=e+2;for(;i<t.length&&i<e+10&&/[0-9a-fA-F]/.test(t[i]);)l+=t[i],i++;l?(n+=String.fromCodePoint(parseInt(l,16)),e=i):(n+="\\U",e+=2);break}default:n+=t[e],e++}else n+=t[e],e++;return n}export{h as a,b,p as c,u as d};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as w}from"./chunk-LJRVJXUI.js";import{d as b}from"./chunk-AH7VTVWU.js";import{d as S,e as F}from"./chunk-IBRT3OJS.js";import{a as v,b as $,c as y}from"./chunk-QAYAQNCG.js";var E={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"]},O={name:"chmod",async execute(e,a){if($(e))return v(E);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
|
|
3
|
+
`,exitCode:1};let i=!1,f=!1,n=0;for(;n<e.length&&e[n].startsWith("-");){let t=e[n];if(t==="-R"||t==="--recursive")i=!0,n++;else if(t==="-v"||t==="--verbose")f=!0,n++;else if(t==="--"){n++;break}else{if(/^[+-]?[rwxugo]+/.test(t)||/^\d+$/.test(t))break;if(/^-[Rv]+$/.test(t)){t.includes("R")&&(i=!0),t.includes("v")&&(f=!0),n++;continue}return y("chmod",t)}}if(e.length-n<2)return{stdout:"",stderr:`chmod: missing operand
|
|
4
|
+
`,exitCode:1};let r=e[n],d=e.slice(n+1),o=/^[0-7]+$/.test(r),s;if(o)s=parseInt(r,8);else try{p(r,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${r}'
|
|
5
|
+
`,exitCode:1}}let u=new b(Math.min(a.limits.maxOutputSize,a.limits.maxStringLength),"chmod"),l="",c=!1;for(let t of d){let m=a.fs.resolvePath(a.cwd,t);try{let h;if(o&&s!==void 0)h=s;else{let g=await a.fs.stat(m);h=p(r,g.mode)}await a.fs.chmod(m,h),f&&u.append(`mode of '${t}' changed to ${h.toString(8).padStart(4,"0")}
|
|
6
|
+
`),i&&(await a.fs.stat(m)).isDirectory&&await I(a,m,o?s:void 0,o?void 0:r,f,u)}catch(h){w(h),l+=`chmod: cannot access '${t}': No such file or directory
|
|
7
|
+
`,c=!0}}return{stdout:u.build(),stderr:l,exitCode:c?1:0}}};async function I(e,a,i,f,n,r){let d=new S({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"chmod"});await F({fs:e.fs,root:a,symlinks:"never",budget:d,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"chmod"},async o=>{if(o.depth===0||o.phase!=="enter")return;let s=i!==void 0?i:f!==void 0?p(f,o.stat.mode):420;await e.fs.chmod(o.path,s),n&&r.append(`mode of '${o.path}' changed to ${s.toString(8).padStart(4,"0")}
|
|
8
|
+
`)})}function p(e,a=420){if(/^[0-7]+$/.test(e))return parseInt(e,8);let i=a&4095,f=e.split(",");for(let n of f){let r=n.match(/^([ugoa]*)([+\-=])([rwxXst]*)$/);if(!r)throw new Error(`Invalid mode: ${e}`);let d=r[1]||"a",o=r[2],s=r[3];(d==="a"||d==="")&&(d="ugo");let u=0;s.includes("r")&&(u|=4),s.includes("w")&&(u|=2),(s.includes("x")||s.includes("X"))&&(u|=1);let l=0;s.includes("s")&&(d.includes("u")&&(l|=2048),d.includes("g")&&(l|=1024)),s.includes("t")&&(l|=512);for(let c of d){let t=0;c==="u"?t=6:c==="g"?t=3:c==="o"&&(t=0);let m=u<<t;o==="+"?i|=m:o==="-"?i&=~m:o==="="&&(i&=~(7<<t),c==="u"&&(i&=-2049),c==="g"&&(i&=-1025),c==="o"&&(i&=-513),i|=m)}o==="+"?i|=l:o==="-"?i&=~l:o==="="&&(s.includes("s")&&(d.includes("u")&&(i|=l&2048),d.includes("g")&&(i|=l&1024)),s.includes("t")&&(i|=l&512))}return i}var k={name:"chmod",flags:[{flag:"-R",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{O as a,k as b};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{c as O}from"./chunk-CHHWTPDH.js";import{d as F}from"./chunk-GN6CQ3J4.js";import{a as N,b as w,c as k}from"./chunk-QAYAQNCG.js";var P=new Map([["",1],["k",1024],["m",1048576],["g",1073741824],["t",1099511627776],["p",0x4000000000000],["e",1152921504606847e3]]),D=new Map([["jan",1],["feb",2],["mar",3],["apr",4],["may",5],["jun",6],["jul",7],["aug",8],["sep",9],["oct",10],["nov",11],["dec",12]]);function x(u){let r=u.trim(),e=r.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!e){let n=parseFloat(r);return Number.isNaN(n)?0:n}let l=parseFloat(e[1]),s=(e[2]||"").toLowerCase(),i=P.get(s)??1;return l*i}function M(u){let r=u.trim().toLowerCase().slice(0,3);return D.get(r)??0}function q(u,r){let e=u.split(/(\d+)/),l=r.split(/(\d+)/),s=Math.max(e.length,l.length);for(let i=0;i<s;i++){let n=e[i]||"",d=l[i]||"",o=/^\d+$/.test(n)?parseInt(n,10):null,c=/^\d+$/.test(d)?parseInt(d,10):null;if(o!==null&&c!==null){if(o!==c)return o-c}else if(n!==d)return n.localeCompare(d)}return 0}function L(u){return u.replace(/[^a-zA-Z0-9\s]/g,"")}function v(u,r,e){let l=e!==null?e:/\s+/,s=u.split(l),i=r.startField-1;if(i>=s.length)return"";if(r.endField===void 0){let o=s[i]||"";return r.startChar!==void 0&&(o=o.slice(r.startChar-1)),r.ignoreLeading&&(o=o.trimStart()),o}let n=Math.min(r.endField-1,s.length-1),d="";for(let o=i;o<=n&&o<s.length;o++){let c=s[o]||"";if(o===i&&r.startChar!==void 0&&(c=c.slice(r.startChar-1)),o===n&&r.endChar!==void 0){let t=o===i&&r.startChar!==void 0?r.endChar-r.startChar+1:r.endChar;c=c.slice(0,t)}o>i&&(d+=e||" "),d+=c}return r.ignoreLeading&&(d=d.trimStart()),d}function I(u,r,e){let l=u,s=r;if(e.dictionaryOrder&&(l=L(l),s=L(s)),e.ignoreCase&&(l=l.toLowerCase(),s=s.toLowerCase()),e.monthSort){let i=M(l),n=M(s);return i-n}if(e.humanNumeric){let i=x(l),n=x(s);return i-n}if(e.versionSort)return q(l,s);if(e.numeric){let i=parseFloat(l)||0,n=parseFloat(s)||0;return i-n}return l.localeCompare(s)}function B(u){let{keys:r,fieldDelimiter:e,numeric:l,ignoreCase:s,reverse:i,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c,ignoreLeadingBlanks:t,stable:a}=u;return(f,C)=>{let g=f,b=C;if(t&&(g=g.trimStart(),b=b.trimStart()),r.length===0){let h=I(g,b,{numeric:l,ignoreCase:s,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c});if(h!==0)return i?-h:h;if(!a){let p=f.localeCompare(C);return i?-p:p}return 0}for(let m of r){let h=v(g,m,e),p=v(b,m,e);m.ignoreLeading&&(h=h.trimStart(),p=p.trimStart());let V={numeric:m.numeric??l,ignoreCase:m.ignoreCase??s,humanNumeric:m.humanNumeric??n,versionSort:m.versionSort??d,dictionaryOrder:m.dictionaryOrder??o,monthSort:m.monthSort??c},A=m.reverse??i,S=I(h,p,V);if(S!==0)return A?-S:S}if(!a){let m=f.localeCompare(C);return i?-m:m}return 0}}function E(u,r){if(r.keys.length===0){if(r.ignoreCase){let s=new Set;return u.filter(i=>{let n=i.toLowerCase();return s.has(n)?!1:(s.add(n),!0)})}return[...new Set(u)]}let e=r.keys[0],l=new Set;return u.filter(s=>{let i=v(s,e,r.fieldDelimiter);return(e.ignoreCase??r.ignoreCase)&&(i=i.toLowerCase()),l.has(i)?!1:(l.add(i),!0)})}function y(u){let r={startField:1},e="",l=u,s=l.match(/([bdfhMnrV]+)$/);s&&(e=s[1],l=l.slice(0,-e.length)),e.includes("n")&&(r.numeric=!0),e.includes("r")&&(r.reverse=!0),e.includes("f")&&(r.ignoreCase=!0),e.includes("b")&&(r.ignoreLeading=!0),e.includes("h")&&(r.humanNumeric=!0),e.includes("V")&&(r.versionSort=!0),e.includes("d")&&(r.dictionaryOrder=!0),e.includes("M")&&(r.monthSort=!0);let i=l.split(",");if(i.length===0||i[0]==="")return null;let n=i[0].split("."),d=parseInt(n[0],10);if(Number.isNaN(d)||d<1)return null;if(r.startField=d,n.length>1&&n[1]){let o=parseInt(n[1],10);!Number.isNaN(o)&&o>=1&&(r.startChar=o)}if(i.length>1&&i[1]){let o=i[1],c=o.match(/([bdfhMnrV]+)$/);if(c){let a=c[1];a.includes("n")&&(r.numeric=!0),a.includes("r")&&(r.reverse=!0),a.includes("f")&&(r.ignoreCase=!0),a.includes("b")&&(r.ignoreLeading=!0),a.includes("h")&&(r.humanNumeric=!0),a.includes("V")&&(r.versionSort=!0),a.includes("d")&&(r.dictionaryOrder=!0),a.includes("M")&&(r.monthSort=!0),o=o.slice(0,-a.length)}let t=o.split(".");if(t[0]){let a=parseInt(t[0],10);if(!Number.isNaN(a)&&a>=1&&(r.endField=a),t.length>1&&t[1]){let f=parseInt(t[1],10);!Number.isNaN(f)&&f>=1&&(r.endChar=f)}}}return r}var H={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-b, --ignore-leading-blanks ignore leading blanks","-d, --dictionary-order consider only blanks and alphanumeric characters","-f, --ignore-case fold lower case to upper case characters","-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)","-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-V, --version-sort natural sort of (version) numbers within text","-c, --check check for sorted input; do not sort","-o, --output=FILE write result to FILE instead of stdout","-s, --stable stabilize sort by disabling last-resort comparison","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]]
|
|
3
|
+
F is a field number (1-indexed)
|
|
4
|
+
C is a character position within the field (1-indexed)
|
|
5
|
+
OPTS can be: b d f h M n r V (per-key modifiers)
|
|
6
|
+
|
|
7
|
+
Examples:
|
|
8
|
+
-k1 sort by first field
|
|
9
|
+
-k2,2 sort by second field only
|
|
10
|
+
-k1.3 sort by first field starting at 3rd character
|
|
11
|
+
-k1,2n sort by fields 1-2 numerically
|
|
12
|
+
-k2 -k1 sort by field 2, then by field 1`},R={name:"sort",async execute(u,r){if(w(u))return N(H);let e={reverse:!1,numeric:!1,unique:!1,ignoreCase:!1,humanNumeric:!1,versionSort:!1,dictionaryOrder:!1,monthSort:!1,ignoreLeadingBlanks:!1,stable:!1,checkOnly:!1,outputFile:null,keys:[],fieldDelimiter:null},l=[];for(let c=0;c<u.length;c++){let t=u[c];if(t==="-r"||t==="--reverse")e.reverse=!0;else if(t==="-n"||t==="--numeric-sort")e.numeric=!0;else if(t==="-u"||t==="--unique")e.unique=!0;else if(t==="-f"||t==="--ignore-case")e.ignoreCase=!0;else if(t==="-h"||t==="--human-numeric-sort")e.humanNumeric=!0;else if(t==="-V"||t==="--version-sort")e.versionSort=!0;else if(t==="-d"||t==="--dictionary-order")e.dictionaryOrder=!0;else if(t==="-M"||t==="--month-sort")e.monthSort=!0;else if(t==="-b"||t==="--ignore-leading-blanks")e.ignoreLeadingBlanks=!0;else if(t==="-s"||t==="--stable")e.stable=!0;else if(t==="-c"||t==="--check")e.checkOnly=!0;else if(t==="-o"||t==="--output")e.outputFile=u[++c]||null;else if(t.startsWith("-o"))e.outputFile=t.slice(2)||null;else if(t.startsWith("--output="))e.outputFile=t.slice(9)||null;else if(t==="-t"||t==="--field-separator")e.fieldDelimiter=u[++c]||null;else if(t.startsWith("-t"))e.fieldDelimiter=t.slice(2)||null;else if(t.startsWith("--field-separator="))e.fieldDelimiter=t.slice(18)||null;else if(t==="-k"||t==="--key"){let a=u[++c];if(a){let f=y(a);f&&e.keys.push(f)}}else if(t.startsWith("-k")){let a=y(t.slice(2));a&&e.keys.push(a)}else if(t.startsWith("--key=")){let a=y(t.slice(6));a&&e.keys.push(a)}else{if(t.startsWith("--"))return k("sort",t);if(t.startsWith("-")&&!t.startsWith("--")){let a=!1;for(let f of t.slice(1))if(f==="r")e.reverse=!0;else if(f==="n")e.numeric=!0;else if(f==="u")e.unique=!0;else if(f==="f")e.ignoreCase=!0;else if(f==="h")e.humanNumeric=!0;else if(f==="V")e.versionSort=!0;else if(f==="d")e.dictionaryOrder=!0;else if(f==="M")e.monthSort=!0;else if(f==="b")e.ignoreLeadingBlanks=!0;else if(f==="s")e.stable=!0;else if(f==="c")e.checkOnly=!0;else{a=!0;break}if(a)return k("sort",t)}else l.push(t)}}let s=await O(r,l,{cmdName:"sort"});if(!s.ok)return s.error;let n=F(s.content).split(`
|
|
13
|
+
`);n.length>0&&n[n.length-1]===""&&n.pop();let d=B(e);if(e.checkOnly){let c=l.length>0?l[0]:"-";for(let t=1;t<n.length;t++)if(d(n[t-1],n[t])>0)return{stdout:"",stderr:`sort: ${c}:${t+1}: disorder: ${n[t]}
|
|
14
|
+
`,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}n.sort(d),e.unique&&(n=E(n,e));let o=n.length>0?`${n.join(`
|
|
15
|
+
`)}
|
|
16
|
+
`:"";if(e.outputFile){let c=r.fs.resolvePath(r.cwd,e.outputFile);return await r.fs.writeFile(c,o),{stdout:"",stderr:"",exitCode:0}}return{stdout:o,stderr:"",exitCode:0}}},Y={name:"sort",flags:[{flag:"-r",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-V",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-M",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-k",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"path"}],stdinType:"text",needsFiles:!0};export{R as a,Y as b};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{d as g}from"./chunk-GN6CQ3J4.js";import{a as y,b as $,c as F}from"./chunk-QAYAQNCG.js";var b={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"]},E={name:"comm",async execute(m,a){if($(m))return y(b);let r=!1,l=!1,f=!1,i=[];for(let e of m)if(e==="-1")r=!0;else if(e==="-2")l=!0;else if(e==="-3")f=!0;else if(e==="-12"||e==="-21")r=!0,l=!0;else if(e==="-13"||e==="-31")r=!0,f=!0;else if(e==="-23"||e==="-32")l=!0,f=!0;else if(e==="-123"||e==="-132"||e==="-213"||e==="-231"||e==="-312"||e==="-321")r=!0,l=!0,f=!0;else{if(e.startsWith("-")&&e!=="-")return F("comm",e);i.push(e)}if(i.length!==2)return{stdout:"",stderr:`comm: missing operand
|
|
3
|
+
Try 'comm --help' for more information.
|
|
4
|
+
`,exitCode:1};let p=async e=>{if(e==="-")return g(a.stdin);try{let x=a.fs.resolvePath(a.cwd,e);return await a.fs.readFile(x)}catch{return null}},c=await p(i[0]);if(c===null)return{stdout:"",stderr:`comm: ${i[0]}: No such file or directory
|
|
5
|
+
`,exitCode:1};let d=await p(i[1]);if(d===null)return{stdout:"",stderr:`comm: ${i[1]}: No such file or directory
|
|
6
|
+
`,exitCode:1};let t=c.split(`
|
|
7
|
+
`),s=d.split(`
|
|
8
|
+
`);t.length>0&&t[t.length-1]===""&&t.pop(),s.length>0&&s[s.length-1]===""&&s.pop();let n=0,o=0,u="",h=r?"":" ",w=(r?"":" ")+(l?"":" ");for(;n<t.length||o<s.length;)n>=t.length?(l||(u+=`${h}${s[o]}
|
|
9
|
+
`),o++):o>=s.length?(r||(u+=`${t[n]}
|
|
10
|
+
`),n++):t[n]<s[o]?(r||(u+=`${t[n]}
|
|
11
|
+
`),n++):t[n]>s[o]?(l||(u+=`${h}${s[o]}
|
|
12
|
+
`),o++):(f||(u+=`${w}${t[n]}
|
|
13
|
+
`),n++,o++);return{stdout:u,stderr:"",exitCode:0}}},L={name:"comm",flags:[{flag:"-1",type:"boolean"},{flag:"-2",type:"boolean"},{flag:"-3",type:"boolean"}],needsArgs:!0,minArgs:2};export{E as a,L as b};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{l as m,m as d}from"./chunk-EFORKKSH.js";import{a as p,b as x,c as y}from"./chunk-QAYAQNCG.js";var L={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};function N(i){return i>=32&&i<=126||i===9}function S(i,s){if(s===null)return"";switch(s){case"o":return`${i.toString(8).padStart(7," ")} `;case"x":return`${i.toString(16).padStart(7," ")} `;case"d":return`${i.toString(10).padStart(7," ")} `;default:return s}}function $(i,s,n,f=!1,r){let u=[],a=0,l=0,t=typeof i=="string"&&!f?new TextEncoder().encode(i):i;if(t.length>n.maxStringLength-n.inputBytes)throw new m(`strings: aggregate input size limit exceeded (${n.maxStringLength} bytes)`,"string_length");n.inputBytes+=t.length;let e=new TextDecoder,g=(o,c)=>typeof t=="string"?t.slice(o,c):e.decode(t.subarray(o,c)),h=o=>{if(++n.iterations>n.maxIterations)throw new m(`strings: iteration limit exceeded (${n.maxIterations})`,"iterations");if(n.resultCount>=n.maxArrayElements)throw new m(`strings: array element limit exceeded (${n.maxArrayElements})`,"array_elements");let c=o.length+1;if(c>n.maxOutputSize-n.outputBytes)throw new m(`strings: output size limit exceeded (${n.maxOutputSize} bytes)`,"output_size");u.push(o),n.resultCount++,n.outputBytes+=c};for(let o=0;o<t.length;o++){if((o&4095)===0&&r?.aborted)throw new d;let c=typeof t=="string"?t.charCodeAt(o)&255:t[o];if(N(c)){if(a===0&&(l=o),a>=n.maxStringLength)throw new m(`strings: string length limit exceeded (${n.maxStringLength} bytes)`,"string_length");a++}else{if(a>=s.minLength){let w=S(l,s.offsetFormat);h(`${w}${g(l,o)}`)}a=0}}if(a>=s.minLength){let o=S(l,s.offsetFormat);h(`${o}${g(l,t.length)}`)}return u}var E={name:"strings",execute:async(i,s)=>{if(x(i))return p(L);let n={minLength:4,offsetFormat:null},f=[],r=0;for(;r<i.length;){let t=i[r];if(t==="-n"&&r+1<i.length){let e=Number.parseInt(i[r+1],10);if(Number.isNaN(e)||e<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${i[r+1]}'
|
|
3
|
+
`};n.minLength=e,r+=2}else if(t.match(/^-n\d+$/)){let e=Number.parseInt(t.slice(2),10);if(Number.isNaN(e)||e<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${t.slice(2)}'
|
|
4
|
+
`};n.minLength=e,r++}else if(t.match(/^-\d+$/)){let e=Number.parseInt(t.slice(1),10);if(Number.isNaN(e)||e<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${t.slice(1)}'
|
|
5
|
+
`};n.minLength=e,r++}else if(t==="-t"&&r+1<i.length){let e=i[r+1];if(e!=="o"&&e!=="x"&&e!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${e}'
|
|
6
|
+
`};n.offsetFormat=e,r+=2}else if(t.startsWith("-t")&&t.length===3){let e=t[2];if(e!=="o"&&e!=="x"&&e!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${e}'
|
|
7
|
+
`};n.offsetFormat=e,r++}else if(t==="-a"||t==="--all"||t==="-")t==="-"&&f.push(t),r++;else if(t==="-e"&&r+1<i.length){let e=i[r+1];if(e!=="s"&&e!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${e}'
|
|
8
|
+
`};r+=2}else if(t.startsWith("-e")&&t.length===3){let e=t[2];if(e!=="s"&&e!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${e}'
|
|
9
|
+
`};r++}else if(t==="--"){f.push(...i.slice(r+1));break}else{if(t.startsWith("-")&&t!=="-")return y("strings",t);f.push(t),r++}}let u="",a={maxArrayElements:s.limits.maxArrayElements,maxIterations:s.limits.maxLoopIterations,maxStringLength:Math.min(s.limits.maxInputBytes,s.limits.maxStringLength),maxOutputSize:Math.min(s.limits.maxOutputSize,s.limits.maxStringLength),iterations:0,inputBytes:0,resultCount:0,outputBytes:0},l=()=>s.stdin;if(f.length===0){let t=$(l(),n,a,!0,s.signal);u=t.length>0?`${t.join(`
|
|
10
|
+
`)}
|
|
11
|
+
`:""}else for(let t of f){let e;if(t==="-")e=l();else{let h=s.fs.resolvePath(s.cwd,t);try{e=await s.fs.readFileBuffer(h)}catch{return{exitCode:1,stdout:u,stderr:`strings: ${t}: No such file or directory
|
|
12
|
+
`}}}let g=$(e,n,a,typeof e=="string",s.signal);g.length>0&&(u+=`${g.join(`
|
|
13
|
+
`)}
|
|
14
|
+
`)}return{exitCode:0,stdout:u,stderr:""}}},F={name:"strings",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-a",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsFiles:!0};export{E as a,F as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{l as o}from"./chunk-EFORKKSH.js";import{a as u}from"./chunk-GN6CQ3J4.js";function n(s,t){if(!Number.isSafeInteger(s)||s<0)throw new o(`${t}: invalid bounded allocation count`,"array_elements")}function c(s){return new o(`${s}: invalid bounded allocation count`,"array_elements")}function f(s,t,e){n(s,e),n(t,e);let i=s+t;if(!Number.isSafeInteger(i))throw c(e);return i}function p(s,t,e){if(n(s,e),n(t,e),s!==0&&t>Math.floor(Number.MAX_SAFE_INTEGER/s))throw c(e);return s*t}function m(s,t,e,i){let r=new a(e,i);for(let h=0;h<s.length;h++)h>0&&r.append(t),r.append(s[h]);return r.build()}var a=class{maxBytes;label;createLimitError;reservedBytes;chunks=[];usedBytes=0;constructor(t,e,i=void 0,r=0){this.maxBytes=t,this.label=e,this.createLimitError=i,this.reservedBytes=r,n(t,e),n(r,e),r>t&&this.fail()}fail(){throw this.createLimitError?.()??new o(`${this.label}: output size limit exceeded (${this.maxBytes} bytes)`,"output_size")}get byteLength(){return this.usedBytes}get remainingBytes(){return this.maxBytes-this.reservedBytes-this.usedBytes}reserve(t){n(t,this.label),t>this.remainingBytes&&this.fail()}append(t){let e=u(t);return this.reserve(e),t&&this.chunks.push(t),this.usedBytes+=e,this}repeat(t,e){n(e,this.label);let i=u(t);return i!==0&&e>Math.floor(this.remainingBytes/i)&&this.fail(),this.append(t.repeat(e))}reset(){this.chunks.length=0,this.usedBytes=0}build(){return this.chunks.join("")}};export{f as a,p as b,m as c,a as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as s,b as i}from"./chunk-UBTKJ6MG.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as j}from"./chunk-UHHCL65P.js";import{a as S,b as k,d as N}from"./chunk-6D3WD6YU.js";import{l as w}from"./chunk-EFORKKSH.js";import{a as E}from"./chunk-GN6CQ3J4.js";import{a as V}from"./chunk-W5DWRFSU.js";import{a as Z,b as T}from"./chunk-QAYAQNCG.js";import{sprintf as $}from"sprintf-js";function X(e){let l="",n=0;for(;n<e.length;){let r=e[n];if(r<128){l+=String.fromCharCode(r),n++;continue}if((r&224)===192){if(n+1<e.length&&(e[n+1]&192)===128&&r>=194){let o=(r&31)<<6|e[n+1]&63;l+=String.fromCharCode(o),n+=2;continue}l+=String.fromCharCode(r),n++;continue}if((r&240)===224){if(n+2<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128){if(r===224&&e[n+1]<160){l+=String.fromCharCode(r),n++;continue}let o=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(o>=55296&&o<=57343){l+=String.fromCharCode(r),n++;continue}l+=String.fromCharCode(o),n+=3;continue}l+=String.fromCharCode(r),n++;continue}if((r&248)===240&&r<=244){if(n+3<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128&&(e[n+3]&192)===128){if(r===240&&e[n+1]<144){l+=String.fromCharCode(r),n++;continue}let o=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(o>1114111){l+=String.fromCharCode(r),n++;continue}l+=String.fromCodePoint(o),n+=4;continue}l+=String.fromCharCode(r),n++;continue}l+=String.fromCharCode(r),n++}return l}var G={name:"printf",summary:"format and print data",usage:"printf [-v var] FORMAT [ARGUMENT...]",options:[" -v var assign the output to shell variable VAR rather than display it"," --help display this help and exit"],notes:["FORMAT controls the output like in C printf.","Escape sequences: \\n (newline), \\t (tab), \\\\ (backslash)","Format specifiers: %s (string), %d (integer), %f (float), %x (hex), %o (octal), %% (literal %)","Width and precision: %10s (width 10), %.2f (2 decimal places), %010d (zero-padded)","Flags: %- (left-justify), %+ (show sign), %0 (zero-pad)"]},ae={name:"printf",async execute(e,l){if(T(e))return Z(G);if(e.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments]
|
|
3
|
+
`,exitCode:2};let n=null,r=0;for(;r<e.length;){let t=e[r];if(t==="--"){r++;break}if(t==="-v"){if(r+1>=e.length)return{stdout:"",stderr:`printf: -v: option requires an argument
|
|
4
|
+
`,exitCode:1};if(n=e[r+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\[[^\]\n]+\])?$/.test(n)||/[;\r\\]/.test(n)||n.includes(".."))return{stdout:"",stderr:`printf: \`${n}': not a valid identifier
|
|
5
|
+
`,exitCode:2};r+=2}else{if(t.startsWith("-")&&t!=="-")break;break}}if(r>=e.length)return{stdout:"",stderr:`printf: usage: printf format [arguments]
|
|
6
|
+
`,exitCode:1};let o=e[r],i=e.slice(r+1);try{let t=Math.min(l.limits.maxStringLength,l.limits.maxOutputSize),s=N(o,t),a="",f=0,c=0,x=!1,p="",d=l.env.get("TZ");do{let{result:m,argsConsumed:v,error:C,errMsg:b,stopped:g}=D(s,i,c,d,t-f),I=E(m);if(I>t-f)throw new w(`printf: output size limit exceeded (${t} bytes)`,"string_length");if(a+=m,f+=I,c+=v,C&&(x=!0,b&&(p=b)),g)break}while(c<i.length&&c>0);if(c===0&&i.length>0,n){let m=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(m){let v=m[1],C=m[3];if(C=C.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(b,g)=>l.env.get(g)??""),l.assignShellVariable)await l.assignShellVariable(v,a,C);else throw new Error("printf -v array assignment requires an interpreter assignment gateway")}else if(l.assignShellVariable)await l.assignShellVariable(n,a);else{if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n))throw new Error(`${n}: not a valid identifier`);l.env.set(n,a)}return{stdout:"",stderr:p,exitCode:x?1:0}}return{stdout:a,stderr:p,exitCode:x?1:0}}catch(t){if(t instanceof w||typeof t=="object"&&t!==null&&"name"in t&&t.name==="ExitError")throw t;return{stdout:"",stderr:`printf: ${V(t)}
|
|
7
|
+
`,exitCode:1}}}};function D(e,l,n,r,o=10*1024*1024){let i="",t=0,s=0,a=!1,f="",c=0,x=p=>{let d=E(p);if(d>o-c)throw new w(`printf: output size limit exceeded (${o} bytes)`,"string_length");i+=p,c+=d};for(;t<e.length;)if(e[t]==="%"&&t+1<e.length){let p=t;if(t++,e[t]==="%"){x("%"),t++;continue}let d=e.slice(p).match(/^%(-?\d*)(?:\.(\d+))?\(([^)]*)\)T/);if(d){let u=d[1]?parseInt(d[1],10):0,F=d[2]?parseInt(d[2],10):-1;S(u,o,"width"),F!==-1&&S(F,o,"precision");let H=d[3],L=d[0],A=l[n+s]||"";s++;let M;A===""||A==="-1"||A==="-2"?M=Math.floor(Date.now()/1e3):M=parseInt(A,10)||0;let _=j(H,M,r,{maxOperations:o-c,maxOutputBytes:o-c});_=k(_,u,F,o-c),x(_),t=p+L.length;continue}for(;t<e.length&&"+-0 #'".includes(e[t]);)t++;let m=!1;if(e[t]==="*")m=!0,t++;else for(;t<e.length&&/\d/.test(e[t]);)t++;let v=!1;if(e[t]===".")if(t++,e[t]==="*")v=!0,t++;else for(;t<e.length&&/\d/.test(e[t]);)t++;t<e.length&&"hlL".includes(e[t])&&t++;let C=e[t]||"";t++;let g=e.slice(p,t);if(m){let u=parseInt(l[n+s]||"0",10);S(u,o-c,"width"),s++,g=g.replace("*",String(u))}if(v){let u=parseInt(l[n+s]||"0",10);u>=0?S(u,o-c,"precision"):Number.isSafeInteger(u)||S(u,o-c,"precision"),s++,g=g.replace(".*",`.${u}`)}J(g,o-c);let I=l[n+s]||"";s++;let{value:q,parseError:R,parseErrMsg:W,stopped:U}=Q(g,C,I,o-c);if(x(q),R&&(a=!0,W&&(f=W)),U)return{result:i,argsConsumed:s,error:a,errMsg:f,stopped:!0}}else x(e[t]),t++;return{result:i,argsConsumed:s,error:a,errMsg:f,stopped:!1}}function Q(e,l,n,r){let o=!1,i="";switch(l){case"d":case"i":{let t=z(n);return o=h,o&&(i=`printf: ${n}: invalid number
|
|
8
|
+
`),{value:P(e,t),parseError:o,parseErrMsg:i}}case"o":{let t=z(n);return o=h,o&&(i=`printf: ${n}: invalid number
|
|
9
|
+
`),{value:K(e,t),parseError:o,parseErrMsg:i}}case"u":{let t=z(n);o=h,o&&(i=`printf: ${n}: invalid number
|
|
10
|
+
`);let s=t<0?t>>>0:t;return{value:P(e.replace("u","d"),s),parseError:o,parseErrMsg:i}}case"x":case"X":{let t=z(n);return o=h,o&&(i=`printf: ${n}: invalid number
|
|
11
|
+
`),{value:Y(e,t),parseError:o,parseErrMsg:i}}case"e":case"E":case"f":case"F":case"g":case"G":{let t=parseFloat(n)||0;return{value:ee(e,l,t),parseError:!1,parseErrMsg:""}}case"c":{if(n==="")return{value:"",parseError:!1,parseErrMsg:""};let a=new TextEncoder().encode(n)[0];return{value:String.fromCharCode(a),parseError:!1,parseErrMsg:""}}case"s":return{value:B(e,n,r),parseError:!1,parseErrMsg:""};case"q":return{value:O(e,n,r),parseError:!1,parseErrMsg:""};case"b":{let t=te(n,r);return{value:t.value,parseError:!1,parseErrMsg:"",stopped:t.stopped}}default:try{return{value:$(e,n),parseError:!1,parseErrMsg:""}}catch{return{value:"",parseError:!0,parseErrMsg:`printf: [sprintf] unexpected placeholder
|
|
12
|
+
`}}}}function J(e,l){let n=e.match(/^%[-+0 #' ]*(\d*)(?:\.(\d*))?/);if(!n)return;let r=n[1]?Number(n[1]):0,o=n[2]!==void 0?Number(n[2]):-1;S(r,l,"width"),o!==-1&&S(o,l,"precision")}var h=!1;function z(e){h=!1;let l=e.trimStart(),n=l!==l.trimEnd();if(e=l.trimEnd(),e.startsWith("'")&&e.length>=2||e.startsWith('"')&&e.length>=2)return e.charCodeAt(1);if(e.startsWith("\\'")&&e.length>=3||e.startsWith('\\"')&&e.length>=3)return e.charCodeAt(2);if(e.startsWith("+")&&(e=e.slice(1)),e.startsWith("0x")||e.startsWith("0X")){let r=parseInt(e,16);return Number.isNaN(r)?(h=!0,0):(n&&(h=!0),r)}if(e.startsWith("0")&&e.length>1&&/^-?0[0-7]+$/.test(e))return n&&(h=!0),parseInt(e,8)||0;if(/^\d+#/.test(e)){h=!0;let r=e.match(/^(\d+)#/);return r?parseInt(r[1],10):0}if(e!==""&&!/^-?\d+$/.test(e)){h=!0;let r=parseInt(e,10);return Number.isNaN(r)?0:r}return n&&(h=!0),parseInt(e,10)||0}function P(e,l){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[diu]$/);if(!n)return $(e.replace(/\.\d*/,""),l);let r=n[1]||"",o=n[2]?parseInt(n[2],10):0,i=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,t=l<0,s=Math.abs(l),a=String(s);i>=0&&(a=a.padStart(i,"0"));let f="";t?f="-":r.includes("+")?f="+":r.includes(" ")&&(f=" ");let c=f+a;return o>c.length&&(r.includes("-")?c=c.padEnd(o," "):r.includes("0")&&i<0?c=f+a.padStart(o-f.length,"0"):c=c.padStart(o," ")),c}function K(e,l){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?o$/);if(!n)return $(e,l);let r=n[1]||"",o=n[2]?parseInt(n[2],10):0,i=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,t=Math.abs(l).toString(8);i>=0&&(t=t.padStart(i,"0")),r.includes("#")&&!t.startsWith("0")&&(t=`0${t}`);let s=t;return o>s.length&&(r.includes("-")?s=s.padEnd(o," "):r.includes("0")&&i<0?s=s.padStart(o,"0"):s=s.padStart(o," ")),s}function Y(e,l){let n=e.includes("X"),r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[xX]$/);if(!r)return $(e,l);let o=r[1]||"",i=r[2]?parseInt(r[2],10):0,t=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,s=Math.abs(l).toString(16);n&&(s=s.toUpperCase()),t>=0&&(s=s.padStart(t,"0"));let a="";o.includes("#")&&l!==0&&(a=n?"0X":"0x");let f=a+s;return i>f.length&&(o.includes("-")?f=f.padEnd(i," "):o.includes("0")&&t<0?f=a+s.padStart(i-a.length,"0"):f=f.padStart(i," ")),f}function y(e,l){if(e===""){if(l<2)throw new w(`printf: output size limit exceeded (${l} bytes)`,"string_length");return"''"}if(/^[a-zA-Z0-9_./-]+$/.test(e)){if(E(e)>l)throw new w(`printf: output size limit exceeded (${l} bytes)`,"string_length");return e}let n=/[\x00-\x1f\x7f-\xff]/.test(e),r=n?3:0;for(let i of e){let t=i.charCodeAt(0);if(n?i==="'"||i==="\\"||i===`
|
|
13
|
+
`||i===" "||i==="\r"||i==="\x07"||i==="\b"||i==="\f"||i==="\v"||i==="\x1B"||i==='"'?r+=2:t<32||t>=127&&t<=255?r+=4:r+=E(i):r+=E(i)+(" |&;<>()$`\\\"'*?[#~=%!{}".includes(i)?1:0),r>l)throw new w(`printf: output size limit exceeded (${l} bytes)`,"string_length")}if(n){let i="$'";for(let t of e){let s=t.charCodeAt(0);t==="'"?i+="\\'":t==="\\"?i+="\\\\":t===`
|
|
14
|
+
`?i+="\\n":t===" "?i+="\\t":t==="\r"?i+="\\r":t==="\x07"?i+="\\a":t==="\b"?i+="\\b":t==="\f"?i+="\\f":t==="\v"?i+="\\v":t==="\x1B"?i+="\\E":s<32||s>=127&&s<=255?i+=`\\${s.toString(8).padStart(3,"0")}`:t==='"'?i+='\\"':i+=t}return i+="'",i}let o="";for(let i of e)" |&;<>()$`\\\"'*?[#~=%!{}".includes(i)?o+=`\\${i}`:o+=i;return o}function B(e,l,n){let r=e.match(/^%(-?)(\d*)(\.(\d*))?s$/);if(!r)return $(e.replace(/0+(?=\d)/,""),l);let o=r[1]==="-",i=r[2]?parseInt(r[2],10):0,t=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,s=o?-i:i;return k(l,s,t,n)}function O(e,l,n){let r=y(l,n),o=e.match(/^%(-?)(\d*)q$/);if(!o)return r;let i=o[1]==="-",t=o[2]?parseInt(o[2],10):0;return k(r,i?-t:t,-1,n)}function ee(e,l,n){let r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[eEfFgG]$/);if(!r)return $(e,n);let o=r[1]||"",i=r[2]?parseInt(r[2],10):0,t=r[3]!==void 0?r[4]?parseInt(r[4],10):0:6,s,a=l.toLowerCase();if(a==="e"?(s=n.toExponential(t),s=s.replace(/e([+-])(\d)$/,"e$10$2"),l==="E"&&(s=s.toUpperCase())):a==="f"?(s=n.toFixed(t),o.includes("#")&&t===0&&!s.includes(".")&&(s+=".")):a==="g"?(s=n.toPrecision(t||1),o.includes("#")||(s=s.replace(/\.?0+$/,""),s=s.replace(/\.?0+e/,"e")),s=s.replace(/e([+-])(\d)$/,"e$10$2"),l==="G"&&(s=s.toUpperCase())):s=n.toString(),n>=0&&(o.includes("+")?s=`+${s}`:o.includes(" ")&&(s=` ${s}`)),i>s.length)if(o.includes("-"))s=s.padEnd(i," ");else if(o.includes("0")){let f=s.match(/^[+ -]/)?.[0]||"",c=f?s.slice(1):s;s=f+c.padStart(i-f.length,"0")}else s=s.padStart(i," ");return s}function te(e,l){if(E(e)>l)throw new w(`printf: output size limit exceeded (${l} bytes)`,"string_length");let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length)switch(e[r+1]){case"n":n+=`
|
|
15
|
+
`,r+=2;break;case"t":n+=" ",r+=2;break;case"r":n+="\r",r+=2;break;case"\\":n+="\\",r+=2;break;case"a":n+="\x07",r+=2;break;case"b":n+="\b",r+=2;break;case"f":n+="\f",r+=2;break;case"v":n+="\v",r+=2;break;case"c":return{value:n,stopped:!0};case"x":{let i=[],t=r;for(;t+1<e.length&&e[t]==="\\"&&e[t+1]==="x";){let s="",a=t+2;for(;a<e.length&&a<t+4&&/[0-9a-fA-F]/.test(e[a]);)s+=e[a],a++;if(s)i.push(parseInt(s,16)),t=a;else break}i.length>0?(n+=X(i),r=t):(n+="\\x",r+=2);break}case"u":{let i="",t=r+2;for(;t<e.length&&t<r+6&&/[0-9a-fA-F]/.test(e[t]);)i+=e[t],t++;i?(n+=String.fromCodePoint(parseInt(i,16)),r=t):(n+="\\u",r+=2);break}case"0":{let i="",t=r+2;for(;t<e.length&&t<r+5&&/[0-7]/.test(e[t]);)i+=e[t],t++;i?n+=String.fromCharCode(parseInt(i,8)):n+="\0",r=t;break}case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let i="",t=r+1;for(;t<e.length&&t<r+4&&/[0-7]/.test(e[t]);)i+=e[t],t++;n+=String.fromCharCode(parseInt(i,8)),r=t;break}default:n+=e[r],r++}else n+=e[r],r++;return{value:n,stopped:!1}}var fe={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0};export{ae as a,fe as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{c as m}from"./chunk-CHHWTPDH.js";import{d}from"./chunk-GN6CQ3J4.js";import{a as y}from"./chunk-QIQMJJZ4.js";import{a as f,b as g}from"./chunk-QAYAQNCG.js";var T={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},w={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},$={name:"uniq",async execute(p,h){if(g(p))return f(T);let o=y("uniq",p,w);if(!o.ok)return o.error;let{count:q,duplicatesOnly:b,uniqueOnly:C,ignoreCase:a}=o.result.flags,x=o.result.positional,r=await m(h,x,{cmdName:"uniq"});if(!r.ok)return r.error;let t=(a?d(r.content):r.content).split(`
|
|
3
|
+
`);if(t.length>0&&t[t.length-1]===""&&t.pop(),t.length===0)return{stdout:"",stderr:"",exitCode:0};let n=[],i=t[0],s=1,O=(e,u)=>a?e.toLowerCase()===u.toLowerCase():e===u;for(let e=1;e<t.length;e++)O(t[e],i)?s++:(n.push({line:i,count:s}),i=t[e],s=1);n.push({line:i,count:s});let c=n;b?c=n.filter(e=>e.count>1):C&&(c=n.filter(e=>e.count===1));let l="";for(let{line:e,count:u}of c)q?l+=`${String(u).padStart(4)} ${e}
|
|
4
|
+
`:l+=`${e}
|
|
5
|
+
`;return a?{stdout:l,stderr:"",exitCode:0}:{stdout:l,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},k={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0};export{$ as a,k as b};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{l as m}from"./chunk-EFORKKSH.js";import{a as b,d as x,e as C}from"./chunk-GN6CQ3J4.js";import{a as U,b as E,c as $}from"./chunk-QAYAQNCG.js";var O={name:"join",summary:"join lines of two files on a common field",usage:"join [OPTION]... FILE1 FILE2",description:"For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks.",options:["-1 FIELD Join on this FIELD of file 1 (default: 1)","-2 FIELD Join on this FIELD of file 2 (default: 1)","-t CHAR Use CHAR as input and output field separator","-a FILENUM Also print unpairable lines from file FILENUM (1 or 2)","-v FILENUM Like -a but only output unpairable lines","-e STRING Replace missing fields with STRING","-o FORMAT Output format (comma-separated list of FILENUM.FIELD)","-i Ignore case when comparing fields"],examples:["join file1 file2 # Join on first field","join -1 2 -2 1 file1 file2 # Join file1 col 2 with file2 col 1","join -t ',' file1.csv file2.csv # Join CSV files","join -a 1 file1 file2 # Left outer join"]};function A(i,l){return l?i.split(l):i.split(/[ \t]+/).filter(n=>n.length>0)}function B(i,l,n,a){let t=A(i,l),r=t[n-1]??"";return a&&(r=r.toLowerCase()),{fields:t,joinKey:r,original:i}}function I(i,l,n){let a=n.separator??" ";if(n.outputFormat){let s=[];for(let{file:c,field:d}of n.outputFormat){let f=c===1?i:l;f&&d===0?s.push(f.joinKey):f&&f.fields[d-1]!==void 0?s.push(f.fields[d-1]):s.push(n.emptyString)}return s.join(a)}let t=[],r=i?.joinKey??l?.joinKey??"";if(t.push(r),i)for(let s=0;s<i.fields.length;s++)s!==n.field1-1&&t.push(i.fields[s]);if(l)for(let s=0;s<l.fields.length;s++)s!==n.field2-1&&t.push(l.fields[s]);return t.join(a)}function z(i){let l=i.split(","),n=[];for(let a of l){let t=a.trim().match(/^(\d+)\.(\d+)$/);if(!t)return null;let r=Number.parseInt(t[1],10),s=Number.parseInt(t[2],10);if(r!==1&&r!==2)return null;n.push({file:r,field:s})}return n}var _={name:"join",execute:async(i,l)=>{if(E(i))return U(O);let n={field1:1,field2:1,separator:null,printUnpairable:new Set,onlyUnpairable:new Set,emptyString:"",outputFormat:null,ignoreCase:!1},a=[],t=0;for(;t<i.length;){let e=i[t];if(e==="-1"&&t+1<i.length){let o=Number.parseInt(i[t+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${i[t+1]}'
|
|
3
|
+
`};n.field1=o,t+=2}else if(e==="-2"&&t+1<i.length){let o=Number.parseInt(i[t+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${i[t+1]}'
|
|
4
|
+
`};n.field2=o,t+=2}else if((e==="-t"||e==="--field-separator")&&t+1<i.length)n.separator=i[t+1],t+=2;else if(e.startsWith("-t")&&e.length>2)n.separator=e.slice(2),t++;else if(e==="-a"&&t+1<i.length){let o=Number.parseInt(i[t+1],10);if(o!==1&&o!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${i[t+1]}'
|
|
5
|
+
`};n.printUnpairable.add(o),t+=2}else if(e.match(/^-a[12]$/))n.printUnpairable.add(Number.parseInt(e[2],10)),t++;else if(e==="-v"&&t+1<i.length){let o=Number.parseInt(i[t+1],10);if(o!==1&&o!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${i[t+1]}'
|
|
6
|
+
`};n.onlyUnpairable.add(o),t+=2}else if(e.match(/^-v[12]$/))n.onlyUnpairable.add(Number.parseInt(e[2],10)),t++;else if(e==="-e"&&t+1<i.length)n.emptyString=i[t+1],t+=2;else if(e==="-o"&&t+1<i.length){let o=z(i[t+1]);if(!o)return{exitCode:1,stdout:"",stderr:`join: invalid field spec: '${i[t+1]}'
|
|
7
|
+
`};n.outputFormat=o,t+=2}else if(e==="-i"||e==="--ignore-case")n.ignoreCase=!0,t++;else if(e==="--"){a.push(...i.slice(t+1));break}else{if(e.startsWith("-")&&e!=="-")return $("join",e);a.push(e),t++}}if(a.length!==2)return{exitCode:1,stdout:"",stderr:a.length<2?`join: missing file operand
|
|
8
|
+
`:`join: extra operand
|
|
9
|
+
`};let r=[];for(let e of a)if(e==="-")r.push(x(l.stdin)??"");else{let o=l.fs.resolvePath(l.cwd,e),u=await l.fs.readFile(o);if(u===null)return{exitCode:1,stdout:"",stderr:`join: ${e}: No such file or directory
|
|
10
|
+
`};r.push(u)}let s=l.limits.maxArrayElements,c=l.limits.maxLoopIterations,d=Math.min(l.limits.maxInputBytes,l.limits.maxStringLength),f=Math.min(l.limits.maxOutputSize,l.limits.maxStringLength);if(r.reduce((e,o)=>e+b(o),0)>d)throw new m(`join: aggregate input size limit exceeded (${d} bytes)`,"string_length");let v=0,S=0,H=()=>{if(++S>c)throw new m(`join: iteration limit exceeded (${c})`,"iterations")},w=(e,o)=>{let u=e.length>0?1:0;for(let p=0;p<e.length;p++)e.charCodeAt(p)===10&&p+1<e.length&&u++;if(u>s-v)throw new m(`join: array element limit exceeded (${s})`,"array_elements");v+=u;let g=e.split(`
|
|
11
|
+
`);return e.endsWith(`
|
|
12
|
+
`)&&g[g.length-1]===""&&g.pop(),g.filter(p=>p.length>0).map(p=>B(p,n.separator,o,n.ignoreCase))},K=w(r[0],n.field1),L=w(r[1],n.field2),y=new Map;for(let e of L){let o=y.get(e.joinKey);o?o.push(e):y.set(e.joinKey,[e])}let h=[],F=0,j=e=>{if(H(),h.length>=s)throw new m(`join: array element limit exceeded (${s})`,"array_elements");let o=b(e)+1;if(o>f-F)throw new m(`join: output size limit exceeded (${f} bytes)`,"output_size");h.push(e),F+=o},N=new Set;for(let e of K){let o=y.get(e.joinKey);if(o&&o.length>0){if(N.add(e.joinKey),n.onlyUnpairable.size===0)for(let u of o)j(I(e,u,n))}else(n.printUnpairable.has(1)||n.onlyUnpairable.has(1))&&j(I(e,null,n))}if(n.printUnpairable.has(2)||n.onlyUnpairable.has(2))for(let e of L)N.has(e.joinKey)||j(I(null,e,n));return{exitCode:0,stdout:C(h.length>0?`${h.join(`
|
|
13
|
+
`)}
|
|
14
|
+
`:""),stderr:"",stdoutEncoding:"binary"}}},P={name:"join",flags:[{flag:"-1",type:"value",valueHint:"number"},{flag:"-2",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-a",type:"value",valueHint:"number"},{flag:"-v",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"string"},{flag:"-o",type:"value",valueHint:"format"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{_ as a,P as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
function i(...s){let e=[...new Set(s.filter(n=>n!==void 0))];if(e.length===0)return{signal:void 0,cleanup(){}};if(e.length===1)return{signal:e[0],cleanup(){}};let r=new AbortController,o=[];for(let n of e){if(n.aborted){r.abort(n.reason);break}let t=()=>r.abort(n.reason);n.addEventListener("abort",t,{once:!0}),o.push([n,t])}return{signal:r.signal,cleanup(){for(let[n,t]of o)n.removeEventListener("abort",t)}}}export{i as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{l as p}from"./chunk-EFORKKSH.js";import{f as m,g as d}from"./chunk-GN6CQ3J4.js";function B(e,t,n){if(!Number.isSafeInteger(t)||t<0||t>e.limits.maxInputBytes)throw new p(`${n}: input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");e.executionScope?.consumeInput(t,n)}async function y(e,t,n){let{cmdName:o,allowStdinMarker:u=!0,stopOnError:s=!1,batchSize:f=100}=n;if(t.length===0)return{files:[{filename:"",content:e.stdin}],stderr:"",exitCode:0};let a=[],c="",l=0;for(let i=0;i<t.length;i+=f){let h=t.slice(i,i+f),E=await Promise.all(h.map(async r=>{if(u&&r==="-")return{filename:"-",content:e.stdin,error:null};try{let w=e.fs.resolvePath(e.cwd,r),x=await d(e.fs,w);return{filename:r,content:x,error:null}}catch{return{filename:r,content:m,error:`${o}: ${r}: No such file or directory
|
|
3
|
+
`}}}));for(let r of E)if(r.error){if(c+=r.error,l=1,s)return{files:a,stderr:c,exitCode:l}}else a.push({filename:r.filename,content:r.content})}return{files:a,stderr:c,exitCode:l}}async function F(e,t,n){let o=await y(e,t,{...n,stopOnError:!0});return o.exitCode!==0?{ok:!1,error:{stdout:"",stderr:o.stderr,exitCode:o.exitCode}}:{ok:!0,content:o.files.map(s=>s.content).join("")}}export{B as a,y as b,F as c};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{b as D}from"./chunk-WNH3HOQA.js";import{a as A,b as h}from"./chunk-KIGPB52X.js";import{c as F,d as g}from"./chunk-K3XJ2WT4.js";import{a as O}from"./chunk-L2UW7DWF.js";import{b as T}from"./chunk-UBTKJ6MG.js";import{a as m,b as w}from"./chunk-FOCWZZDE.js";var n={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,RENAME:14,COPY_FILE:15,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300,INVOKE_TOOL:400},r={PENDING:0,READY:1,SUCCESS:2,ERROR:3},l={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},o={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},p={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:8388608,TOTAL:8392736},S={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},u={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function x(){return new A(p.TOTAL)}var R=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return h.load(this.int32View,o.OP_CODE/4)}setOpCode(t){h.store(this.int32View,o.OP_CODE/4,t)}getStatus(){return h.load(this.int32View,o.STATUS/4)}setStatus(t){h.store(this.int32View,o.STATUS/4,t)}getPathLength(){return h.load(this.int32View,o.PATH_LENGTH/4)}setPathLength(t){h.store(this.int32View,o.PATH_LENGTH/4,t)}getDataLength(){return h.load(this.int32View,o.DATA_LENGTH/4)}setDataLength(t){h.store(this.int32View,o.DATA_LENGTH/4,t)}getResultLength(){return h.load(this.int32View,o.RESULT_LENGTH/4)}setResultLength(t){h.store(this.int32View,o.RESULT_LENGTH/4,t)}getErrorCode(){return h.load(this.int32View,o.ERROR_CODE/4)}setErrorCode(t){h.store(this.int32View,o.ERROR_CODE/4,t)}getFlags(){return h.load(this.int32View,o.FLAGS/4)}setFlags(t){h.store(this.int32View,o.FLAGS/4,t)}getMode(){return h.load(this.int32View,o.MODE/4)}setMode(t){h.store(this.int32View,o.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(o.PATH_BUFFER,o.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>p.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${p.PATH_BUFFER}`);this.uint8View.set(e,o.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setData(t){if(t.length>p.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(o.DATA_BUFFER,o.DATA_BUFFER+t)}setResult(t){if(t.length>p.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,o.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[o.DATA_BUFFER+u.IS_FILE]=t.isFile?1:0,this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(o.DATA_BUFFER+u.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(o.DATA_BUFFER+u.SIZE,e,!0),this.dataView.setFloat64(o.DATA_BUFFER+u.MTIME,t.mtime.getTime(),!0),this.setResultLength(u.TOTAL)}decodeStat(){return{isFile:this.uint8View[o.DATA_BUFFER+u.IS_FILE]===1,isDirectory:this.uint8View[o.DATA_BUFFER+u.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[o.DATA_BUFFER+u.IS_SYMLINK]===1,mode:this.dataView.getInt32(o.DATA_BUFFER+u.MODE,!0),size:this.dataView.getFloat64(o.DATA_BUFFER+u.SIZE,!0),mtime:new Date(this.dataView.getFloat64(o.DATA_BUFFER+u.MTIME,!0))}}waitForReady(t){return h.wait(this.int32View,o.STATUS/4,r.PENDING,t)}waitForReadyAsync(t){return h.waitAsync(this.int32View,o.STATUS/4,r.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let a=this.getStatus();if(a===r.READY)return!0;let s=Date.now()-e;if(s>=t)return!1;let i=t-s,c=h.waitAsync(this.int32View,o.STATUS/4,a,i);if(c.async&&await c.value==="timed-out")return!1}}waitForResult(t){return h.wait(this.int32View,o.STATUS/4,r.READY,t)}notify(){return h.notify(this.int32View,o.STATUS/4)}reset(){this.setOpCode(n.NOOP),this.setStatus(r.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(l.NONE),this.setFlags(S.NONE),this.setMode(0)}};var C=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;invokeTool;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;constructor(t,e,a,s,i=void 0,c=0,d=void 0,E=void 0){this.fs=e,this.cwd=a,this.commandName=s,this.secureFetch=i,this.maxOutputSize=c,this.exec=d,this.invokeTool=E,this.protocol=new R(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
|
|
3
|
+
${this.commandName}: execution timeout exceeded
|
|
4
|
+
`,Promise.reject(new Error("Operation timed out"));let a=t();return e===Number.POSITIVE_INFINITY?a:new Promise((s,i)=>{let c=F(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
|
|
5
|
+
${this.commandName}: execution timeout exceeded
|
|
6
|
+
`,i(new Error("Operation timed out"))},e);a.then(d=>{g(c),s(d)},d=>{g(c),i(d)})})}async run(t){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=t;this.running;){if(Date.now()-this.startTime>=t){this.output.stderr+=`
|
|
7
|
+
${this.commandName}: execution timeout exceeded
|
|
8
|
+
`,this.output.exitCode=124;break}let a=this.remainingMs();if(!await this.protocol.waitUntilReady(a)){this.output.stderr+=`
|
|
9
|
+
${this.commandName}: execution timeout exceeded
|
|
10
|
+
`,this.output.exitCode=124;break}if(!this.running)break;let i=this.protocol.getOpCode();await this.handleOperation(i),this.protocol.notify()}return this.output}stop(){this.running=!1,this.protocol.setStatus(r.READY),this.protocol.notify()}async handleOperation(t){try{switch(t){case n.READ_FILE:await this.handleReadFile();break;case n.WRITE_FILE:await this.handleWriteFile();break;case n.STAT:await this.handleStat();break;case n.LSTAT:await this.handleLstat();break;case n.READDIR:await this.handleReaddir();break;case n.MKDIR:await this.handleMkdir();break;case n.RM:await this.handleRm();break;case n.EXISTS:await this.handleExists();break;case n.APPEND_FILE:await this.handleAppendFile();break;case n.SYMLINK:await this.handleSymlink();break;case n.READLINK:await this.handleReadlink();break;case n.CHMOD:await this.handleChmod();break;case n.REALPATH:await this.handleRealpath();break;case n.RENAME:await this.handleRename();break;case n.COPY_FILE:await this.handleCopyFile();break;case n.WRITE_STDOUT:this.handleWriteStdout();break;case n.WRITE_STDERR:this.handleWriteStderr();break;case n.EXIT:this.handleExit();break;case n.HTTP_REQUEST:await this.handleHttpRequest();break;case n.EXEC_COMMAND:await this.handleExecCommand();break;case n.INVOKE_TOOL:await this.handleInvokeTool();break;default:this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setStatus(r.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),a=(this.protocol.getFlags()&S.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:a}),this.protocol.setStatus(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),a=(e&S.RECURSIVE)!==0,s=(e&S.FORCE)!==0;try{await this.fs.rm(t,{recursive:a,force:s}),this.protocol.setStatus(r.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),a=this.resolvePath(t);try{await this.fs.symlink(e,a),this.protocol.setStatus(r.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(r.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}async handleCopyFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(t,e),this.protocol.setStatus(r.SUCCESS)}catch(a){this.setErrorFromException(a)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(r.ERROR);return}this.protocol.setStatus(r.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(r.ERROR);return}this.protocol.setStatus(r.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setStatus(r.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
|
|
11
|
+
`,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let s=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(s>0)if(this.output.stdout.length>=s)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-s);else{let i=s-this.output.stdout.length;this.output.stdout="",i>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-i)}this.output.stderr+=e}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(l.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(r.ERROR);return}let e=this.protocol.getPath(),a=this.protocol.getDataAsString();try{let s=a?JSON.parse(a):{},i=this.remainingMs(),c=await this.raceDeadline(()=>t(e,{method:s.method,headers:s.headers,body:s.body,timeoutMs:i})),d=JSON.stringify({status:c.status,statusText:c.statusText,headers:c.headers,bodyBase64:D(c.body,"base64"),url:c.url});this.protocol.setResultFromString(d),this.protocol.setStatus(r.SUCCESS)}catch(s){let i=m(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(l.NETWORK_ERROR),this.protocol.setResultFromString(i),this.protocol.setStatus(r.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setStatus(r.ERROR);return}let e=this.protocol.getPath(),a=this.protocol.getDataAsString(),s=new AbortController;try{let i={cwd:this.cwd,signal:s.signal};if(a){let E=JSON.parse(a);E.stdin&&(i.stdin=E.stdin),E.args&&Array.isArray(E.args)&&(i.args=E.args.map(f=>String(f)),e=O([e]))}let c=await this.raceDeadline(()=>t(e,i)),d=JSON.stringify({stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode});this.protocol.setResultFromString(d),this.protocol.setStatus(r.SUCCESS)}catch(i){s.abort();let c=i instanceof Error?i.message:String(i);this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(c),this.protocol.setStatus(r.ERROR)}}async handleInvokeTool(){let t=this.invokeTool;if(!t){this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString("Tool invocation not available in this context."),this.protocol.setStatus(r.ERROR);return}let e=this.protocol.getPath(),a=this.protocol.getDataAsString();try{let s=await this.raceDeadline(()=>T.runTrustedAsync(()=>t(e,a)));this.protocol.setResultFromString(s),this.protocol.setStatus(r.SUCCESS)}catch(s){let i=w(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(i),this.protocol.setStatus(r.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),a=m(e),s=l.IO_ERROR,i=e.toLowerCase();i.includes("no such file")||i.includes("not found")||i.includes("enoent")?s=l.NOT_FOUND:i.includes("is a directory")||i.includes("eisdir")?s=l.IS_DIRECTORY:i.includes("not a directory")||i.includes("enotdir")?s=l.NOT_DIRECTORY:i.includes("already exists")||i.includes("eexist")?s=l.EXISTS:(i.includes("permission")||i.includes("eperm")||i.includes("eacces"))&&(s=l.PERMISSION_DENIED),this.protocol.setErrorCode(s),this.protocol.setResultFromString(a),this.protocol.setStatus(r.ERROR)}};export{x as a,C as b};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as n}from"./chunk-TDD4NFYE.js";import{a as $}from"./chunk-LJRVJXUI.js";import{l as F}from"./chunk-EFORKKSH.js";import{a as S}from"./chunk-GN6CQ3J4.js";import{a as x}from"./chunk-QIQMJJZ4.js";import{a as z,b as O}from"./chunk-QAYAQNCG.js";var M={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},E={format:{short:"c",type:"string"}},I={name:"stat",async execute(l,s){if(O(l))return z(M);let o=x("stat",l,E);if(!o.ok)return o.error;let m=o.result.flags.format??null,u=o.result.positional;if(u.length===0)return{stdout:"",stderr:`stat: missing operand
|
|
3
|
+
`,exitCode:1};let c="",f="",p=!1,d=0,g=Math.min(s.limits.maxOutputSize,s.limits.maxStringLength),h=e=>{let r=S(e);if(r>g-d)throw new F(`stat: output size limit exceeded (${g} bytes)`,"output_size");c+=e,d+=r};for(let e of u){let r=s.fs.resolvePath(s.cwd,e);try{let t=await s.fs.stat(r);if(m){let a=t.mode.toString(8),i=n(t.mode,t.isDirectory),w=new Map([["%n",e],["%N",`'${e}'`],["%s",String(t.size)],["%F",t.isDirectory?"directory":"regular file"],["%a",a],["%A",i],["%u","1000"],["%U","user"],["%g","1000"],["%G","group"]]),A=m.replace(/%[nNsFaAuUgG]/g,y=>w.get(y)??y);h(`${A}
|
|
4
|
+
`)}else{let a=t.mode.toString(8).padStart(4,"0"),i=n(t.mode,t.isDirectory);h(` File: ${e}
|
|
5
|
+
Size: ${t.size} Blocks: ${Math.ceil(t.size/512)}
|
|
6
|
+
Access: (${a}/${i})
|
|
7
|
+
Modify: ${t.mtime.toISOString()}
|
|
8
|
+
`)}}catch(t){$(t),f+=`stat: cannot stat '${e}': No such file or directory
|
|
9
|
+
`,p=!0}}return{stdout:c,stderr:f,exitCode:p?1:0}}},P={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0};export{I as a,P as b};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as E}from"./chunk-LJRVJXUI.js";import{a as h}from"./chunk-IBRT3OJS.js";import{l as $}from"./chunk-EFORKKSH.js";import{a as k}from"./chunk-GN6CQ3J4.js";import{a as C,b as L,c as F}from"./chunk-QAYAQNCG.js";var A={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},S=1e5,_=0;function U(e){return Uint8Array.from(e,t=>t.charCodeAt(0))}function N(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let i=Number(t[1]);if(!Number.isSafeInteger(i)||i<1)return null;let u=(t[2]||"").toUpperCase(),a=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(u);return a===void 0||i>Math.floor(Number.MAX_SAFE_INTEGER/a)?null:i*a}function x(e){if(!/^[0-9]+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}function H(e,t,i){if(t)return e.toString().padStart(i,"0");let u="abcdefghijklmnopqrstuvwxyz",n=new Array(i),a=e;for(let o=i-1;o>=0;o--)n[o]=u[a%26],a=Math.floor(a/26);return n.join("")}function B(e,t){let i=[],u=0,n=0;for(let a=0;a<e.length;a++)e[a]===10&&(n++,n===t&&(i.push(e.subarray(u,a+1)),u=a+1,n=0));return u<e.length&&i.push(e.subarray(u)),i}function T(e,t){let i=[];for(let u=0;u<e.length;u+=t)i.push(e.subarray(u,u+t));return i}function X(e,t){let i=[],u=Math.ceil(e.length/t);for(let n=0;n<t;n++){let a=n*u,o=Math.min(a+u,e.length);a<o&&i.push(e.subarray(a,o))}return i}function z(e,t){let i=e?10**t:26**t;return Number.isSafeInteger(i)?i:Number.MAX_SAFE_INTEGER}function G(e){if(e.existence!=="unknown")return e.existence==="existing"?e.stableIdentity:e.canonicalPath===void 0?void 0:`missing:${e.canonicalPath}`}function I(e,t){return e.existence!==t.existence||e.existence==="unknown"||t.existence==="unknown"?!1:e.existence==="missing"&&t.existence==="missing"?e.canonicalPath===t.canonicalPath:e.existence==="existing"&&t.existence==="existing"?e.stableIdentity!==void 0&&e.stableIdentity===t.stableIdentity:!1}async function M(e,t,i){let u=t.lastIndexOf("/"),n=u<=0?"/":t.slice(0,u),a=t.slice(u+1);for(let o=0;o<100;o++){let d=_++,c=e.fs.resolvePath(n,`.${a}.just-bash-split-${i}-${d}`),p=await h(e.fs,c);if(p.existence==="missing")return c;if(p.existence==="unknown")break}throw new Error("unable to allocate transaction path")}var Z={name:"split",execute:async(e,t)=>{if(L(e))return C(A);let i={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},u=[],n=0;for(;n<e.length;){let s=e[n];if(s==="-l"&&n+1<e.length){let l=x(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[n+1]}'
|
|
3
|
+
`};i.mode="lines",i.lines=l,n+=2}else if(s.match(/^-l\d+$/)){let l=x(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${s.slice(2)}'
|
|
4
|
+
`};i.mode="lines",i.lines=l,n++}else if(s==="-b"&&n+1<e.length){let l=N(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${e[n+1]}'
|
|
5
|
+
`};i.mode="bytes",i.bytes=l,n+=2}else if(s.match(/^-b.+$/)){let l=N(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${s.slice(2)}'
|
|
6
|
+
`};i.mode="bytes",i.bytes=l,n++}else if(s==="-n"&&n+1<e.length){let l=x(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${e[n+1]}'
|
|
7
|
+
`};i.mode="chunks",i.chunks=l,n+=2}else if(s.match(/^-n\d+$/)){let l=x(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${s.slice(2)}'
|
|
8
|
+
`};i.mode="chunks",i.chunks=l,n++}else if(s==="-a"&&n+1<e.length){let l=x(e[n+1]);if(l===null||l>Math.min(t.limits.maxStringLength,t.limits.maxArrayElements))return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${e[n+1]}'
|
|
9
|
+
`};i.suffixLength=l,n+=2}else if(s.match(/^-a\d+$/)){let l=x(s.slice(2));if(l===null||l>Math.min(t.limits.maxStringLength,t.limits.maxArrayElements))return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${s.slice(2)}'
|
|
10
|
+
`};i.suffixLength=l,n++}else if(s==="-d"||s==="--numeric-suffixes")i.useNumericSuffix=!0,n++;else if(s.startsWith("--additional-suffix="))i.additionalSuffix=s.slice(20),n++;else if(s==="--additional-suffix"&&n+1<e.length)i.additionalSuffix=e[n+1],n+=2;else if(s==="--"){u.push(...e.slice(n+1));break}else{if(s.startsWith("-")&&s!=="-")return F("split",s);u.push(s),n++}}let a="-",o="x";if(u.length>=1&&(a=u[0]),u.length>=2&&(o=u[1]),u.length>2)return{exitCode:1,stdout:"",stderr:`split: extra operand '${u[2]}'
|
|
11
|
+
`};if(k(o)>t.limits.maxStringLength||k(i.additionalSuffix)>t.limits.maxStringLength||i.suffixLength>t.limits.maxStringLength-Math.min(t.limits.maxStringLength,k(o))-Math.min(t.limits.maxStringLength,k(i.additionalSuffix)))return{exitCode:1,stdout:"",stderr:`split: output filename exceeds configured string limit
|
|
12
|
+
`};let d,c=null,p;if(a==="-"){let s=t.stdin.length;p=t.executionScope?.reserveBytes("split transaction",s*2,"split"),d=U(t.stdin)}else{c=t.fs.resolvePath(t.cwd,a);try{let s=await t.fs.stat(c);if(p=t.executionScope?.reserveBytes("split transaction",s.size*2,"split"),d=await t.fs.readFileBuffer(c),d.byteLength>s.size)throw new $("split: input grew while being read","string_length");t.executionScope?.consumeInput(d.byteLength,"split")}catch(s){return p?.release(),E(s),{exitCode:1,stdout:"",stderr:`split: ${a}: No such file or directory
|
|
13
|
+
`}}}try{if(d.length===0)return{exitCode:0,stdout:"",stderr:""};if(i.mode==="chunks"&&i.chunks>S)return{exitCode:1,stdout:"",stderr:`split: too many output files (${i.chunks}), limit is ${S}
|
|
14
|
+
`};let s;switch(i.mode){case"lines":s=B(d,i.lines);break;case"bytes":s=T(d,i.bytes);break;case"chunks":s=X(d,i.chunks);break;default:return i.mode}if(s.length>S)return{exitCode:1,stdout:"",stderr:`split: too many output files (${s.length}), limit is ${S}
|
|
15
|
+
`};let l=z(i.useNumericSuffix,i.suffixLength);if(s.length>l)return{exitCode:1,stdout:"",stderr:`split: output file suffixes exhausted at ${l} files
|
|
16
|
+
`};t.executionScope?.consumeWork(s.length*i.suffixLength,"split suffix generation");let m=[],P=new Set,f=c?await h(t.fs,c):null;if(f?.existence==="unknown")return{exitCode:1,stdout:"",stderr:`split: cannot safely identify input file
|
|
17
|
+
`};for(let r=0;r<s.length;r++){let y=H(r,i.useNumericSuffix,i.suffixLength),b=`${o}${y}${i.additionalSuffix}`,v=t.fs.resolvePath(t.cwd,b),g=await h(t.fs,v),w=G(g);if(g.existence==="unknown"||w===void 0)return{exitCode:1,stdout:"",stderr:`split: cannot safely identify output file '${b}'
|
|
18
|
+
`};if(w!==void 0&&P.has(w))return{exitCode:1,stdout:"",stderr:`split: duplicate output file '${b}'
|
|
19
|
+
`};if(f!==null&&(f.existence==="existing"&&g.existence==="existing"&&f.stableIdentity!==void 0&&f.stableIdentity===g.stableIdentity||f.canonicalPath!==void 0&&f.canonicalPath===g.canonicalPath))return{exitCode:1,stdout:"",stderr:`split: output file '${b}' would overwrite input
|
|
20
|
+
`};w!==void 0&&P.add(w),m.push({path:v,displayName:b,content:s[r],initialIdentity:g,stagePath:"",committed:!1})}try{for(let r of m)r.stagePath=await M(t,r.path,"stage"),await t.fs.writeFile(r.stagePath,r.content);if(c!==null&&f!==null&&!I(f,await h(t.fs,c)))throw new Error("input identity changed during split");for(let r of m){let y=await h(t.fs,r.path);if(!I(r.initialIdentity,y))throw new Error("output identity changed during split");if(f?.existence==="existing"&&y.existence==="existing"&&f.stableIdentity===y.stableIdentity)throw new Error("output aliases input")}for(let r of m){if(!I(r.initialIdentity,await h(t.fs,r.path)))throw new Error("output identity changed during split");r.initialIdentity.existence==="existing"&&(r.backupPath=await M(t,r.path,"backup"),await t.fs.mv(r.path,r.backupPath)),await t.fs.mv(r.stagePath,r.path),r.committed=!0}for(let r of m)r.backupPath&&(await t.fs.rm(r.backupPath,{force:!0,recursive:!0}).catch(()=>{}),r.backupPath=void 0)}catch{for(let r of[...m].reverse())r.committed&&await t.fs.rm(r.path,{force:!0,recursive:!0}).catch(()=>{}),r.backupPath&&await t.fs.mv(r.backupPath,r.path).catch(()=>{}),r.stagePath&&await t.fs.rm(r.stagePath,{force:!0,recursive:!0}).catch(()=>{});return{exitCode:1,stdout:"",stderr:`split: failed to write output
|
|
21
|
+
`}}return{exitCode:0,stdout:"",stderr:""}}finally{p?.release()}}},Y={name:"split",flags:[{flag:"-l",type:"value",valueHint:"number"},{flag:"-b",type:"value",valueHint:"string"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-d",type:"boolean"},{flag:"-a",type:"value",valueHint:"number"}],needsFiles:!0};export{Z as a,Y as b};
|